allyhub 0.15.0 → 0.15.2
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 +10 -0
- 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/package.json +1 -1
- 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/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-print/dist/drawn.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/dist/fonts.js +3 -3
- package/dist/node_modules/@allyhub/doc-print/dist/layout.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/dist/pdf.js +4 -4
- 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/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/cli.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/export.js +2 -2
- package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/dist/ag-psd.js +2 -0
- package/dist/node_modules/@allyhub/image-psd/dist/read.js +12 -12
- package/dist/node_modules/@allyhub/image-psd/dist/write.js +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/dist/pdf.js +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/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/dist/index.js +2 -1
- package/dist/node_modules/@allyhub/linkedin-view/dist/stage.js +65 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- 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/package.json +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/dist/exports.js +2 -2
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/packages.d.ts +17 -0
- package/dist/node_modules/@allyhub/runtimes/dist/packages.js +3 -3
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/pins/ag-psd/package-lock.json +49 -0
- package/dist/node_modules/@allyhub/runtimes/pins/ag-psd/package.json +7 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-caladea/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-caladea/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-carlito/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-carlito/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-cousine/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-cousine/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-lxgw-wenkai/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-lxgw-wenkai/package.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-color-emoji/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-color-emoji/package.json +17 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-sans-sc/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-sans-sc/package.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-serif-sc/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-serif-sc/package.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-tinos/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-tinos/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/mermaid/package-lock.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/mermaid/package.json +15 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pdf-lib/package-lock.json +55 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pdf-lib/package.json +7 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pptxgenjs/package-lock.json +169 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pptxgenjs/package.json +7 -0
- 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/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chart.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +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/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
- package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
- 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/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/index.js +262 -1
- package/dist/node_modules/@allyhub/x-view/dist/stage.js +325 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +12 -12
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-BHI0AbUY.js → abnfDiagram-WEYOIA3C-9z0ZEYUq.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-BMQS-OKZ.js → architecture-WOLXFQ4H-ELMO_PA6.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-DZp9CM6P.js → architectureDiagram-ZHVYKT53-C0yuCWU3.js} +1 -1
- package/editor-web/assets/article-DHFgHYjv.js +3 -0
- package/editor-web/assets/article-Dt9id9Y9.js +7 -0
- package/editor-web/assets/{blockDiagram-RJAE7QA3-h6LWaev4.js → blockDiagram-RJAE7QA3-vi6JOg4o.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-BvSMs7J4.js → c4Diagram-XDPPPE54-Agf_H8uS.js} +1 -1
- package/editor-web/assets/channel-Dkg198L0.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-0EJTAmDF.js → chunk-2E7WHVMD-XalaZaha.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-BeYB4AEY.js → chunk-4EMNKR2T-DUlRZkCS.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BPFOPTBe.js → chunk-55XCU76K-DTa7whGr.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-CZ2C7ULu.js → chunk-7S6XSTFO-85zCPzj0.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-B5RtsZkj.js → chunk-AQDTSKZB-CWBseIyh.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-_3G4hddj.js → chunk-DSNLSHJZ-BFnyvrWg.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-DO5b4ll2.js → chunk-HAGFOTED-DFWda2Rk.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-C6XNI71Q.js → chunk-HNE4Q36P-aXibFitC.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-nDCX29rQ.js → chunk-NQOKRVIF-CtJUuFdN.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-CRCOiitq.js → chunk-UHW7PFBP-B6QKSKWE.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-hNPKKjCN.js → chunk-VQ5W62QI-CF6Al55P.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-KlnVtIDc.js → chunk-WQQL4CDK-w2TKLkyw.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-B76hDUrM.js → chunk-YZO67HFG-DVGOATM3.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-D9m1N0wI.js → chunk-ZAUX2LTX-Cq7MMjDP.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-443euxzo.js → chunk-ZCHMQSOR-GMW_lBh4.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-Bbw-8Ons.js → classDiagram-v2-4MYWR3UA-C7AK5Bkj.js} +1 -1
- package/editor-web/assets/code-BID_OoRp.js +1 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-C4E7TlUr.js → cynefin-EF2NZ3EQ-ZnDieQsN.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-PBPGa_HS.js → cynefinDiagram-WF24UDRP-BrukKIBF.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-DwXdEtQG.js → dagre-NK4GIZVX-DfO0S2p_.js} +1 -1
- package/editor-web/assets/{diagram-CBK3MWTC-BE3FwdX7.js → diagram-CBK3MWTC-D43RLesi.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-BPl2ZY33.js → diagram-I5XIIV2D-bA1B1QQG.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-BLVPYSzw.js → diagram-ODIL2UCW-DAdXBD2K.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-BVZk62FO.js → diagram-PFBEJUXE-C_KyEaws.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-Z75LSbxH.js → diagram-RJA3I4VV-oXTtENF7.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-BynGqDAg.js → diagram-TYUNFSNR-Czupe6mO.js} +1 -1
- package/editor-web/assets/dist-2lNSE-G_.js +82 -0
- package/editor-web/assets/{dist-D_xVYGnk.js → dist-5HNrQ9AU.js} +3 -3
- package/editor-web/assets/dist-BPecIPz6.js +530 -0
- package/editor-web/assets/dist-BXJKASX4.js +24 -0
- package/editor-web/assets/{dist-CIQUbiAd.js → dist-BeDRTqQ8.js} +11 -11
- package/editor-web/assets/{dist-CxlIyluY.js → dist-BlL-4sl3.js} +1 -1
- package/editor-web/assets/dist-BtRMClDw.js +40 -0
- package/editor-web/assets/{dist-Ch34PllS.js → dist-BuqBg8k8.js} +1 -1
- package/editor-web/assets/{dist-cUeSwqws.js → dist-BwW08gSh.js} +1 -1
- package/editor-web/assets/{dist-VP4ECMOk.js → dist-C30Thvb3.js} +1 -1
- package/editor-web/assets/dist-Cj5AmpVb.js +5 -0
- package/editor-web/assets/dist-CjjnDOa8.js +3 -0
- package/editor-web/assets/dist-D7ur8721.js +6 -0
- package/editor-web/assets/{dist-Nc_h0Jye.js → dist-DOHhp09C.js} +1 -1
- package/editor-web/assets/{dist-UG2TIZxP.js → dist-LhFEYZza.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-SwhqbeK4.js → ebnfDiagram-V4P3TTPT-BOhNZmtp.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-Bb1GSt2Z.js → elk-QONTBCTQ-DoZH3OoE.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-qUy0NDKn.js → erDiagram-KYQIGQAA-Bv0KDJi4.js} +1 -1
- package/editor-web/assets/{eventmodeling-K75KTNOO-BYBYso_j.js → eventmodeling-K75KTNOO-C-_xzqfj.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-C7ZmHJZW.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-Cw-BkZT8.js → ganttDiagram-R7GPNTJY-CAuJlaZX.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-CTXzWPq_.js → gitGraph-VSP46ZUC-Dx2xLi5C.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-Jd9HU3WA.js → gitGraphDiagram-PDYL7XHY-DHsk_UOT.js} +1 -1
- package/editor-web/assets/{index-CglHrLRS.js → index-BGAXezRR.js} +2 -2
- package/editor-web/assets/{info-OHQRW6UA-C4oj5BpF.js → info-OHQRW6UA-CnKQHx5m.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-D09aYJ28.js → infoDiagram-MVDRKAX5-ibAVFw_2.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-BEdXoXb2.js → ishikawaDiagram-HPEHV2GE-C1OCHt3y.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-DE-_0aww.js → journeyDiagram-BOSHW7O7-BDdqMOM1.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-Cn3_bvPS.js → kanban-definition-FNSA4HC5-CSAS_zGn.js} +1 -1
- package/editor-web/assets/lib-KOEbW83T.js +3 -0
- package/editor-web/assets/{mermaid-parser.core-BK52JMZH.js → mermaid-parser.core-DTLyYXbn.js} +3 -3
- package/editor-web/assets/{mermaid.core-CmfBU89G.js → mermaid.core-B8478wZ1.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-CtUhkv9I.js → mindmap-definition-6OY57UG3-DSWHcglH.js} +1 -1
- package/editor-web/assets/{packet-JDAUHWVQ-C7nciBNp.js → packet-JDAUHWVQ-_k1BF29s.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-DUkbAcTs.js → pegDiagram-ECIUJNBX-B22YyWAa.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-BIGyKhav.js → pie-XZMESJXO-CSwV32hj.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-DrYj-JeG.js → pieDiagram-GNMPY74T-rSFNeWnq.js} +1 -1
- package/editor-web/assets/{props-form-DrZYDmSM.js → props-form-B6mYjTgZ.js} +1 -1
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-qkBoh1ep.js → quadrantDiagram-D57K4MC3-Xrntfg4j.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-BkJmvR6a.js → radar-ABXABTNO-Dwq5qiNw.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-BFH-ip4B.js → railroad-I3PHUGI6-sIUGWcZh.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-BBlzHL6Z.js → railroad-abnf-LNEFI6M7-1rWlT9BX.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-CCVsG0ui.js → railroad-ebnf-DWYD2UWJ-DWdkzEHc.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-Puo7BFPl.js → railroad-peg-JR7BVNR7-CME0JBbV.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-DCwfkv35.js → railroadDiagram-Y72NRBL7-Ch4BpP22.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-DSTcDj32.js → requirementDiagram-EQYSW5RA-CgE-x3wN.js} +1 -1
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-Kqq4fCvG.js → sankeyDiagram-SY24JHO5-DBf4G6n3.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-B1uodEgL.js → sequenceDiagram-BLEHNHQU-Bz07CoUS.js} +1 -1
- package/editor-web/assets/{split-Cu0fidVK.js → split-mDSkdQkd.js} +1 -1
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-B6gG3vUm.js → stateDiagram-v2-A6IESKWZ-DuqAmDPP.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-CZayRtvU.js → swimlanes-B3ENRKFQ-C7sOL6rB.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CQ2aWYP-.js +8 -0
- package/editor-web/assets/syntax-BIEjjMZL.js +27 -0
- package/editor-web/assets/{tabs-B_K0Db1I.js → tabs-C0AHyuE5.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-5YoY8Xhw.js → timeline-definition-JXYKGLGB-CaLYz9mc.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-Brd_NUPx.js → treeView-D4JQ5SDB-D1P1Kyxc.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-DmfdnlWl.js → treemap-SAJKECNS-2YaFL53t.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-lcAkMviI.js → usecaseDiagram-WPOLBNNX-uYdbUhUS.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DY_n48hQ.js → vennDiagram-Q3Y3IDCW-DHepmX4t.js} +1 -1
- package/editor-web/assets/{video-Bv3rETBU.js → video-Xl-OaXRc.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-DzIFSBQz.js → wardley-7MLQ67FV-Dx0MOPV1.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-CsXNajIg.js → wardleyDiagram-IVAIDKWA-BX8ElwDW.js} +1 -1
- package/editor-web/assets/words-B2FXYyeZ.js +263 -0
- package/editor-web/assets/words-DFIhHhHF.js +3 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DDpGFEum.js → xychartDiagram-4URNHDU4-DoWQRJUS.js} +1 -1
- package/editor-web/index.html +1 -1
- package/package.json +2 -19
- package/editor-web/assets/article-C_mBG5a1.js +0 -8
- package/editor-web/assets/article-DWBxNvX0.js +0 -7
- package/editor-web/assets/bookmark-Dfji3syX.js +0 -1
- package/editor-web/assets/channel-BFHB0S0f.js +0 -1
- package/editor-web/assets/dist--ijXGgvi.js +0 -5
- package/editor-web/assets/dist-C-yi9AAi.js +0 -274
- package/editor-web/assets/dist-D9N4Fxqr.js +0 -84
- package/editor-web/assets/dist-DWKEqAou.js +0 -6
- package/editor-web/assets/dist-DX0VLTRV.js +0 -3
- package/editor-web/assets/dist-xpAaABxb.js +0 -24
- package/editor-web/assets/flowDiagram-IUGLLWBU-BSCBBtP3.js +0 -1
- package/editor-web/assets/katex-UWCZofcd.js +0 -257
- package/editor-web/assets/play-DvMyq5xW.js +0 -1
- package/editor-web/assets/repeat-2-DfPmKp4w.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-B9tLTrym.js +0 -8
- package/editor-web/assets/syntax-PERQ2szW.js +0 -66
- package/editor-web/assets/words-BTRrBFUo.js +0 -2
- package/editor-web/assets/words-ll_94CD2.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Feature highlights from each AllyHub release.
|
|
4
4
|
|
|
5
|
+
## 0.15.2
|
|
6
|
+
|
|
7
|
+
- **The agent hands work over in its editor.** It makes each piece in AllyHub, shows it open in its editor for you to look at and mark up, and exports a PowerPoint, Word or Excel file when you say it is final.
|
|
8
|
+
- **A new project in Studio is ready for code.** It starts with AllyHub in place, so the agent installs nothing before writing a video or a scenery.
|
|
9
|
+
- **Waking a cloud computer says how far it is**, also when you make a new project, and a wake that installs a new version is no longer given up too early.
|
|
10
|
+
|
|
11
|
+
## 0.15.1
|
|
12
|
+
|
|
13
|
+
- **A much smaller install.** A new project installs a fraction of what it did. Fonts, diagrams and the tools only some work uses are downloaded the first time a project needs them, once for the computer, and kept for every project.
|
|
14
|
+
|
|
5
15
|
## 0.15.0
|
|
6
16
|
|
|
7
17
|
- **Reports are set aside.** AllyHub no longer makes reports, and `allyhub report style` is gone. Write a page of findings as a doc, a sheet or a deck instead.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{randomBytes as F}from"node:crypto";import{readFile as
|
|
2
|
+
import{randomBytes as F}from"node:crypto";import{readFile as D}from"node:fs/promises";import{createServer as J}from"node:http";import{join as M,resolve as C}from"node:path";import{getRequestListener as W}from"@hono/node-server";import{Hono as G}from"hono";import{WebSocketServer as K}from"ws";import{KeyedStore as Y}from"@allyhub/project";import{CollaboratorStateSchema as Q,PRESENCE_PATH as V,SNAPSHOT_TREE as $,TREE_PAGES as X,stageCsp as Z}from"@allyhub/protocol";import{runtimeFile as ee}from"@allyhub/stage-page";import{pathProblem as te}from"./paths.js";import{fileResponse as g}from"./respond.js";import{ProjectServer as ne}from"./project.js";import{STILL_NAME as re,inside as x,matteFile as oe,sourceName as se}from"./tree.js";export const RPC_PATH="/rpc",RAW_PATH="/files/raw/";const p={"access-control-allow-origin":"*"},L=/^[a-z][a-z0-9+.-]*:\/\/[a-z0-9.-]+(:\d{1,5})?$/u;export const PING_MS=3e4,ALLYHUB_FORWARDED="allyhub-forwarded";export function forwardedHost(n){const d=n[ALLYHUB_FORWARDED],y=(n.forwarded??(Array.isArray(d)?d[0]:d))?.split(",")[0]?.split(";").map(i=>i.trim().split("=")).find(([i])=>i?.toLowerCase()==="host")?.[1];if(y!==void 0)return y.replace(/^"(.*)"$/u,"$1");const u=n["x-forwarded-host"];return(Array.isArray(u)?u[0]:u)?.split(",")[0]?.trim()}export function frameSources(n){const d=["'self'","http://127.0.0.1:*","http://localhost:*"];if(n===void 0)return d;const a=new URL(n.replace("{port}","1")),y=new URL(n.replace("{port}","2"));if(a.port!==y.port)return[...d,`${a.protocol}//${a.hostname}:*`];const u=a.hostname.slice(a.hostname.indexOf(".")+1);return[...d,`${a.protocol}//*.${u}`]}export async function startDevServer(n){const d=C(n.root);if(n.embedder!==void 0&&!L.test(n.embedder))throw new Error(`Not an origin: ${n.embedder}`);if(n.publicOrigin!==void 0&&!L.test(n.publicOrigin.replace("{port}","1")))throw new Error(`Not an origin: ${n.publicOrigin}`);const a=n.token??F(18).toString("base64url"),u=`/s/${F(18).toString("base64url")}/`,i=await ne.open({...n,root:d,...n.publicOrigin===void 0?{}:{reveal:!1}});let f=0;const P=()=>f===0?void 0:n.publicOrigin?.replace("{port}",String(f)),v=()=>{const e=P();return e===void 0?void 0:new URL(e).host},E=()=>{const e=v();return new Set([`127.0.0.1:${String(f)}`,`localhost:${String(f)}`,...e===void 0?[]:[e]])},R=e=>e===v()?P()??"":`http://${e}`,N=e=>new URL(e.req.url).host,T=e=>R(N(e)),A=e=>{const t=v();t!==void 0&&forwardedHost(e.headers)===t&&(e.headers.host=t)},U=e=>e??`http://127.0.0.1:${String(f)}`;i.serving={file:(e,t)=>`${U(e)}${RAW_PATH}${t.split("/").map(encodeURIComponent).join("/")}?token=${encodeURIComponent(a)}`,tree:e=>`${U(e)}${u}`};const{routes:O}=i.live,b=new G,I=async e=>{if(!n.ui)return e.text("allyhub dev serves its editors here.",200);const t=await D(M(n.ui,"index.html"),"utf8").catch(()=>{});if(t===void 0)return e.text("The page's files are missing: build them first (pnpm --filter @allyhub/editor-web build).",500);const c=F(16).toString("base64");return e.html(t.replace(/<script/gu,`<script nonce="${c}"`).replace("</head>",`<meta name="allyhub-token" content="${a}"></head>`),200,{"content-security-policy":["default-src 'self'",`script-src 'self' 'nonce-${c}'`,"style-src 'self' 'unsafe-inline'","img-src 'self' data: blob:","media-src 'self' blob:","font-src 'self' data:",`connect-src 'self' ws://${N(e)}`,`frame-src ${frameSources(n.publicOrigin).join(" ")}`,`frame-ancestors ${n.embedder??"'none'"}`].join("; "),"cache-control":"no-store"})};b.get("/",I),b.post(V,async e=>{if(e.req.header("authorization")!==`Bearer ${a}`)return e.text("forbidden",403);const t=Q.safeParse(await e.req.json().catch(()=>{}));return t.success?(i.presence.agent(t.data),e.body(null,204)):e.text(t.error.message,400)}),b.get(`${RAW_PATH}*`,async e=>{if(e.req.query("token")!==a)return e.text("forbidden",403);const t=decodeURIComponent(e.req.path.slice(RAW_PATH.length));if(te(t)!==void 0)return e.text("forbidden",403);const c=x(d,t);return c?g(c,e.req.header("range"),{"x-content-type-options":"nosniff","content-security-policy":"sandbox; default-src 'none'; img-src 'self'; media-src 'self'; style-src 'unsafe-inline'"}):e.text("forbidden",403)}),b.get(`${u}*`,async e=>{let t;try{t=decodeURIComponent(e.req.path.slice(u.length))}catch{return e.notFound()}const c=e.req.header("range"),m=T(e),l=t.slice(0,t.indexOf("/")+1),s=t.slice(l.length);switch(l){case $.runtime:{const r=ee(s);if(!r)return e.notFound();const o=Object.values(X).includes(t);return g(r,void 0,{...p,...o?{"content-security-policy":Z(`${m}${u}`,[m,...n.embedder?[n.embedder]:[],...n.framers??[]],O.loads())}:{}})}case $.build:{const r=se(s);if(r===void 0){const o=x(i.live.pieceDir,s);return o?g(o,void 0,p):e.notFound()}try{return e.json(await i.live.source(r),200,{...p,"cache-control":"no-store"})}catch(o){return e.json({error:{message:o instanceof Error?o.message:String(o)}},404,p)}}case $.media:{const o=Object.hasOwn(i.live.latest()?.media??{},s)||O.allowed(s)?x(d,s):void 0;return o?g(o,c,p):e.notFound()}case $.matte:{const r=oe(d,i.live.latest()?.media[s]);return r?g(r,c,{...p,"content-type":"video/mp4"}):e.notFound()}case $.stills:return re.test(s)?g(Y.of(d,"stills").path(s),void 0,{...p,"cache-control":"public, max-age=31536000, immutable"}):e.notFound();default:try{const r=await O.route(l);if(!r)return await e.notFound();const o=new WeakSet,h=await r.route.serve({path:s,query:new URL(e.req.url).searchParams,file:async(B,q,z)=>{const j=x(B,q);if(!j)return;const k=await g(j,c,{...p,...z});return o.add(k),k}},r.context);return h?(!o.has(h)&&!h.headers.has("access-control-allow-origin")&&h.headers.set("access-control-allow-origin","*"),h):await e.notFound()}catch(r){return e.text(r instanceof Error?r.message:String(r),500,{...p})}}}),b.get("/*",async e=>{if(!n.ui)return e.notFound();const t=x(C(n.ui),decodeURIComponent(e.req.path.slice(1)));return t?g(t,void 0,{"cache-control":"public, max-age=3600"}):e.notFound()});const S=new K({noServer:!0,maxPayload:512*1024*1024});S.on("connection",(e,t)=>{const c=i.connect(r=>{e.readyState===e.OPEN&&e.send(JSON.stringify(r))},{origin:R(t.headers.host??"")});e.on("message",(r,o)=>{if(o||!Buffer.isBuffer(r))return;let h;try{h=JSON.parse(r.toString("utf8"))}catch{e.send(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Not JSON."}}));return}c.receive(h)});const m=n.pingMs??PING_MS;let l=!0;e.on("pong",()=>{l=!0});const s=m>0?setInterval(()=>{if(!l){e.terminate();return}l=!1,e.ping()},m):void 0;s?.unref(),e.on("close",()=>{clearInterval(s),c.close()})});const H=W(b.fetch),_=(e,t)=>{e.writeHead(403,{"content-type":"text/plain; charset=utf-8"}),e.end(t)},w=J((e,t)=>{if(A(e),!E().has(e.headers.host??"")){_(t,"forbidden host");return}H(e,t)});w.on("upgrade",(e,t,c)=>{const m=new URL(e.url??"/","http://x"),l=(r,o)=>{t.end(`HTTP/1.1 ${String(r)} ${o}\r
|
|
3
3
|
connection: close\r
|
|
4
4
|
content-length: 0\r
|
|
5
5
|
\r
|
|
6
|
-
`)};
|
|
6
|
+
`)};A(e);const s=e.headers.host??"";if(!E().has(s)){l(403,"Forbidden");return}if(m.pathname!==RPC_PATH){l(404,"Not Found");return}if(e.headers.origin!==R(s)){l(403,"Forbidden");return}if(m.searchParams.get("token")!==a){l(403,"Forbidden");return}S.handleUpgrade(e,t,c,r=>{S.emit("connection",r,e)})});try{await new Promise((e,t)=>{w.once("error",t),w.listen(n.port??0,"127.0.0.1",()=>{e()})})}catch(e){throw await i.close(),e}return f=w.address().port,{url:`http://127.0.0.1:${String(f)}/`,port:f,token:a,tree:`http://127.0.0.1:${String(f)}${u}`,ui:n.ui,project:i,async close(){for(const e of S.clients)e.terminate();S.close(),await new Promise(e=>{w.closeAllConnections(),w.close(()=>{e()})}),await i.close()}}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as
|
|
3
|
-
const codes = ${JSON.stringify(
|
|
4
|
-
window.mermaid.initialize(${JSON.stringify(
|
|
2
|
+
import{readFile as l}from"node:fs/promises";import{createRequire as y}from"node:module";import{dirname as p,join as m}from"node:path";import{openPage as u}from"@allyhub/browser";import{diagramConfig as v}from"@allyhub/doc";import{createPackages as x}from"@allyhub/runtimes";const h=y(import.meta.url);let f;export function katexCss(){return f??=(async()=>{const e=h.resolve("katex/dist/katex.min.css"),a=await l(e,"utf8"),n=[...a.matchAll(/src:url\((fonts\/[^)]+\.woff2)\) format\("woff2"\)[^;}]*/gu)];let r=a;for(const[i,t]of n){if(t===void 0)continue;const o=await l(m(p(e),t));r=r.replace(i,`src:url(data:font/woff2;base64,${o.toString("base64")}) format("woff2")`)}return r})(),f}let c;const b=()=>(c??=(async()=>{let e;try{e=h.resolve("mermaid/dist/mermaid.min.js")}catch{const{dir:a}=await x().ensure("mermaid");e=m(a,"node_modules","mermaid","dist","mermaid.min.js")}return l(e,"utf8")})(),c.catch(()=>{c=void 0}),c);export async function drawDiagrams(e,a,n){const r=v(n),i=new Map,t=[...new Set(a)];if(t.length===0)return i;const o=await u(e,{width:900,height:1200,allow:()=>!1});try{await w(o,`<!doctype html><html><head><meta charset="utf-8"></head><body><script>${(await b()).replace(/<\/script/giu,"<\\/script")}<\/script></body></html>`);const s=await o.evaluate(`(async () => {
|
|
3
|
+
const codes = ${JSON.stringify(t)};
|
|
4
|
+
window.mermaid.initialize(${JSON.stringify(r)});
|
|
5
5
|
const out = [];
|
|
6
6
|
for (let i = 0; i < codes.length; i++) {
|
|
7
7
|
try {
|
|
@@ -24,4 +24,4 @@ import{readFile as d}from"node:fs/promises";import{createRequire as g}from"node:
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
return out;
|
|
27
|
-
})()`);
|
|
27
|
+
})()`);t.forEach((d,g)=>{i.set(d,s[g]??{error:"Mermaid drew nothing"})})}finally{await o.close()}return i}async function w(e,a){const{frameTree:n}=await e.session.send("Page.getFrameTree");await e.session.send("Page.setDocumentContent",{frameId:n.frame.id,html:a}),await e.evaluate("new Promise((r) => (document.readyState === 'complete' ? r(true) : addEventListener('load', () => r(true), { once: true })))")}const S=2;export async function mathPictures(e,a){const n=new Map,r=[...new Set(a)];if(r.length===0)return n;const i=await u(e,{width:900,height:1200,scale:S,allow:()=>!1});try{await w(i,`<!doctype html><html><head><meta charset="utf-8"><style>${await katexCss()} body{margin:0;background:#fff} .eq{display:inline-block;padding:2px 4px} .katex-display{margin:0}</style></head><body>${r.map((t,o)=>`<div><div class="eq" id="eq${String(o)}">${t}</div></div>`).join("")}</body></html>`),await i.evaluate("document.fonts.ready.then(() => true)");for(let t=0;t<r.length;t++){const o=r[t];if(o===void 0)continue;const s=await i.evaluate(`(() => { const r = document.getElementById("eq${String(t)}")?.getBoundingClientRect(); return r ? { x: r.x, y: r.y + scrollY, width: r.width, height: r.height } : null; })()`);if(!s||s.width===0||s.height===0)continue;const d=await i.session.send("Page.captureScreenshot",{format:"png",clip:{...s,scale:1},captureBeyondViewport:!0});n.set(o,{data:Buffer.from(d.data,"base64"),width:Math.ceil(s.width),height:Math.ceil(s.height)})}}finally{await i.close()}return n}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as
|
|
3
|
-
`)}async function
|
|
4
|
-
`)}const
|
|
2
|
+
import{readFile as h}from"node:fs/promises";import{createRequire as b}from"node:module";import{dirname as O,join as l}from"node:path";import{EMOJI_PATTERN as T,effectiveLook as $}from"@allyhub/doc";import{createPackages as C}from"@allyhub/runtimes";const g=new Map;function M(o){let e=g.get(o);if(e===void 0){const n=`@fontsource/${o}`;e=(async()=>{try{return O(b(import.meta.url).resolve(`${n}/package.json`))}catch{}const{dir:r}=await C().ensure(`fontsource-${o}`);return l(r,"node_modules",n)})(),e.catch(()=>g.delete(o)),g.set(o,e)}return e}export const SHEET_FONT="Carlito";async function P(o,e){const n=await M(o),r=[];for(const t of e){const f=await h(l(n,t),"utf8");for(const[i]of f.matchAll(/@font-face\s*\{[^}]*\}/gu)){const a=/url\(\.\/(files\/[^)]+\.woff2)\)/u.exec(i)?.[1];if(a===void 0)continue;const c=(/unicode-range:\s*([^;}]+)/u.exec(i)?.[1]??"U+0-10FFFF").split(",").map(m=>{const[u="0",p]=m.trim().replace(/^U\+/iu,"").split("-"),A=Number.parseInt(u.replaceAll("?","0"),16),R=Number.parseInt((p??u).replaceAll("?","F"),16);return[A,R]});r.push({css:i.replace(/src:[^;]+;/u,`src: url(${l(n,a)}) format('woff2');`),file:l(n,a),ranges:c})}}return r}export function sheetFontsCss(o){return k(o,["carlito","noto-sans-sc"])}const d=["400.css","400-italic.css","700.css","700-italic.css"],I={carlito:d,caladea:d,cousine:d,tinos:d,"noto-sans-sc":["400.css","700.css"],"noto-serif-sc":["400.css","700.css"],"lxgw-wenkai":["500.css","700.css"],"noto-color-emoji":["emoji.css"]},F=new Set(["noto-sans-sc","noto-serif-sc","lxgw-wenkai","noto-color-emoji"]),j={sans:["carlito","noto-sans-sc"],serif:["caladea","noto-serif-sc"],mono:["cousine","noto-sans-sc"],times:["tinos","noto-serif-sc"],song:["noto-serif-sc"],hei:["noto-sans-sc"],fangsong:["noto-serif-sc"],kai:["lxgw-wenkai","noto-serif-sc"],xiaobiaosong:["noto-serif-sc"]};function N(o){const e=$(o);return[e.font??"sans","mono",...[e.title?.font,...Object.values(e.headings??{}).map(n=>n.font),e.header===!1?void 0:e.header?.font,e.footer===!1?void 0:e.footer?.font].filter(n=>n!==void 0)]}export function docFaces(o){const e=N(o);return{faces:[...new Set([...e.flatMap(n=>j[n]),"noto-color-emoji"])],leading:[...new Set(e.map(n=>j[n][0]).filter(n=>n!==void 0))]}}const w=new Map;function S(o){let e=w.get(o);return e===void 0&&(e=P(o,I[o]),e.catch(()=>w.delete(o)),w.set(o,e)),e}export function docFontsCss(o,e){return k(o,e.faces,e.leading)}async function k(o,e,n=[]){const r=new RegExp(T,"gu"),t=[],f=[];for(const s of new Set(e)){if(F.has(s))continue;const c=await S(s);f.push(...c),t.push(await x(c,o))}const i=[...new Set(o.replace(r,""))].filter(s=>{const c=s.codePointAt(0)??0;return c>32&&!/\s/u.test(s)&&!f.some(m=>m.ranges.some(([u,p])=>c>=u&&c<=p))}).join(""),a=(o.match(r)??[]).join("");for(const s of new Set(e)){if(!F.has(s))continue;const c=s==="noto-color-emoji"?a:n.includes(s)?o:i;c!==""&&t.push(await x(await S(s),c))}return t.filter(s=>s!=="").join(`
|
|
3
|
+
`)}async function x(o,e){const n=new Set;for(const t of e)n.add(t.codePointAt(0)??0);const r=[];for(const t of o){if(![...n].some(a=>t.ranges.some(([s,c])=>a>=s&&a<=c)))continue;let i=E.get(t.file);i===void 0&&(i=`url(data:font/woff2;base64,${(await h(t.file)).toString("base64")})`,E.set(t.file,i)),r.push(t.css.replace(`url(${t.file})`,i))}return r.join(`
|
|
4
|
+
`)}const E=new Map;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as
|
|
2
|
+
import{mkdir as Z,mkdtemp as tt,readFile as T,rm as et}from"node:fs/promises";import{tmpdir as nt}from"node:os";import{dirname as at,join as B}from"node:path";import{openPage as j,startBrowser as st}from"@allyhub/browser";import{PAPER as q,blockNumbers as L,docParts as ot,effectiveLook as it,everyBlock as O,headingAnchors as rt,pageFaces as _,parseDoc as lt,resolvePage as ct,shownBlocks as H,sizePt as dt,splitTitle as U,titleText as ft}from"@allyhub/doc";import{PdfJoiner as W,pdfLib as G}from"./pdf.js";import{docPage as pt,PICTURE_DPI as ht,printOne as J,setContent as K,shrinkPictures as gt}from"./print.js";const A=25.4/72,ut=96/25.4,I="https://allyhub.invalid/",mt=3,wt=t=>`(() => {
|
|
3
3
|
const H = ${JSON.stringify(I)};
|
|
4
4
|
const style = document.createElement("style");
|
|
5
5
|
style.textContent = "a.allyhub-m{position:absolute;width:1px;height:1lh;margin:0;padding:0;border:0}a.allyhub-box{left:0;top:0;width:100%;height:100%}";
|
|
@@ -15,7 +15,7 @@ import{mkdir as nt,mkdtemp as at,readFile as T,rm as st}from"node:fs/promises";i
|
|
|
15
15
|
const placed = (el) => {
|
|
16
16
|
if (getComputedStyle(el).position === "static") el.style.position = "relative";
|
|
17
17
|
};
|
|
18
|
-
const px = ${String(
|
|
18
|
+
const px = ${String(ut)};
|
|
19
19
|
const out = { lines: {}, over: {}, drawn: {} };
|
|
20
20
|
const range = document.createRange();
|
|
21
21
|
const els = [...document.querySelectorAll("[data-b]")];
|
|
@@ -106,11 +106,11 @@ import{mkdir as nt,mkdtemp as at,readFile as T,rm as st}from"node:fs/promises";i
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
return out;
|
|
109
|
-
})()`;async function
|
|
109
|
+
})()`;async function bt(t,n,s,i,d){const o=await j(t,{width:1200,height:1200,allow:()=>!1});try{await K(o,n),d!==!1&&await gt(o,d);const e=i?await o.evaluate(wt(s)):void 0;return{pdf:await J(o,!i),...e===void 0?{}:{marks:e}}}finally{await o.close()}}async function yt(t,n){const{PDFArray:s,PDFDict:i,PDFDocument:d,PDFName:o,PDFNumber:e,PDFString:a}=await G(),r=await d.load(t,{updateMetadata:!1}),h=[],w=[];return r.getPages().forEach((l,f)=>{const{width:g,height:p}=l.getSize();h.push({width:g*A,height:p*A});const m=l.node.lookupMaybe(o.of("Annots"),s);if(m)for(let y=0;y<m.size();y++){const x=m.lookupMaybe(y,i),k=x?.lookupMaybe(o.of("A"),i)?.lookupMaybe(o.of("URI"),a),v=x?.lookupMaybe(o.of("Rect"),s);if(!k||!v)continue;const P=k.decodeText();if(!P.startsWith(I))continue;const[S=0,c=0,b=0,$=0]=v.asArray().map(R=>R instanceof e?R.asNumber():0),[N="",...E]=P.slice(I.length).split("/");w.push({kind:N,parts:E,at:{page:n+f+1,top:(p-Math.max(c,$))*A,bottom:(p-Math.min(c,$))*A,left:Math.min(S,b)*A,right:Math.max(S,b)*A}})}}),{pages:h,marks:w}}async function xt(t,n,s,i){const d=[],o=new Map;for(const e of t){const a=e.marks??{lines:{},over:{},drawn:{}},{pages:r,marks:h}=await yt(e.pdf,d.length);for(const l of r){const f=d.length,{top:g,right:p,bottom:m,left:y}=n.margins;d.push({n:f+1,width:l.width,height:l.height,landscape:l.width>l.height,text:{top:f===0&&s.cover!==void 0?0:g,bottom:l.height-m,left:y,right:l.width-p}})}const w=l=>{let f=o.get(l);if(!f){const g=a.over[String(l)],p=a.drawn[String(l)];f={n:l,boxes:[],lines:[],rows:[],past:g?.past??0,pastPaper:g?.pastPaper??0,...p===void 0?{}:{drawn:p}},o.set(l,f)}return f};for(const{kind:l,parts:f,at:g}of h){const p=Number(f[0]);if(!Number.isInteger(p))continue;const m=w(p);if(l==="B")m.boxes.push(g);else if(l==="E")m.end=g;else if(l==="R")m.rows.push({...g,row:Number(f[1])});else if(l==="L"){const y=Number(f[1]),x=a.lines[String(p)]?.[y];m.lines[y]={...g,chars:x?.chars??0,letters:x?.letters??0,first:x?.first??"",last:x?.last??""}}}}for(const e of o.values())e.lines=Object.values(e.lines),e.boxes.sort((a,r)=>a.page-r.page||a.top-r.top),e.rows.sort((a,r)=>a.row-r.row);return{pages:d,blocks:o,numbered:i,page:n}}export function headingPages(t,n){const s=L(n),i=new Map;for(const[d,o]of rt(n)){const e=s.get(d),a=e===void 0?void 0:t.blocks.get(e),r=a?.lines[0]?.page??a?.boxes[0]?.page;r!==void 0&&i.set(o,r)}return i}const kt=(t,n)=>t.size===n.size&&[...t].every(([s,i])=>n.get(s)===i);export async function printDoc(t){const n=await T(B(t.root,t.doc.file),"utf8"),s=lt(n),i=ct(s.page),d=L(s.blocks),o=[...O(s.blocks)].some(a=>a.type==="toc"),e=await st({gpu:!1,htmlInCanvas:!1});try{let a=o?new Map:void 0;const r=u=>u===void 0?void 0:k=>u.get(k)??88;let h,w=0,l=!0;const f=ot(s.blocks),g=u=>f[u]?.landscape===!0?i.height:i.width,p=async u=>{const k=[];for(let v=0;v<f.length;v++){t.signal?.throwIfAborted();const P=await pt(t.root,t.doc,t.stills,{...u?{ids:!0}:{},headingPage:r(a),...f.length>1?{part:v}:{}});k.push(await bt(e,P,g(v),u,s.page.pictureDpi??ht))}return k};for(;w+=1,h=await xt(await p(!0),i,s.page,d),a!==void 0;){const u=headingPages(h,s.blocks);if(kt(u,a))break;if(a=u,w>=mt){l=!1;break}}const m=await vt((await p(!1)).map(u=>u.pdf)),y=await Mt(e,h,s.blocks,s.page,t.doc);return{pdf:await At(m,y),layout:h,passes:w,settled:l}}finally{await e.close()}}async function vt(t){if(t.length===1&&t[0]!==void 0)return t[0];const n=await tt(B(nt(),"allyhub-doc-parts-"));try{const s=B(n,"doc.pdf"),i=await W.create(s);try{for(const d of t)await i.add(d)}finally{await i.close({})}return await T(s)}finally{await et(n,{recursive:!0,force:!0})}}export async function writeDocPdf(t){const n=await printDoc(t);await Z(at(t.file),{recursive:!0});const s=await W.create(t.file);try{await s.add(n.pdf)}finally{await s.close(t.title===void 0?{}:{title:t.title})}return n}const Pt=(t,n)=>t.replaceAll("{title}",n.title).replaceAll("{section}",n.section).replaceAll("{page}",String(n.page)).replaceAll("{pages}",String(n.pages)),St=t=>t.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">");function $t(t,n){const{title:s}=U(H(n)),i=[...O(n)].filter(e=>e.type==="heading"&&e!==s),d=Math.min(...i.map(e=>e.level)),o=i.filter(e=>e.level===d).map(e=>{const a=t.numbered.get(e),r=a===void 0?void 0:t.blocks.get(a);return{page:r?.lines[0]?.page??r?.boxes[0]?.page??0,words:e.content.map(h=>h.text).join("")}}).filter(e=>e.page>0);return t.pages.map(e=>{const a=o.find(r=>r.page===e.n);return a?a.words:o.filter(r=>r.page<e.n).at(-1)?.words??""})}async function Mt(t,n,s,i,d){const o=n.page,{header:e,footer:a}=o;if(e===void 0&&a===void 0)return null;const r=it(i),h=ft(U(H(s)).title).trim(),w=h!==""?h:d.title??d.path,l=$t(n,s),f=_(i),g=n.pages.length,p=(c,b,$,N)=>{const E={title:w,section:l[b.n-1]??"",page:b.n,pages:g},R=b.n%2===1,M={left:[],center:[],right:[]};c.left!==void 0&&M.left.push(c.left),c.center!==void 0&&M.center.push(c.center),c.right!==void 0&&M.right.push(c.right),c.outside!==void 0&&M[R?"right":"left"].push(c.outside),c.inside!==void 0&&M[R?"left":"right"].push(c.inside);const V=c.size===void 0?Math.max(7.5,o.size*.75):dt(c.size),X=(c.font===void 0?f.text:Rt(c.font)).replaceAll('"',"'"),z=D=>Math.min(7,D/2),Y=$==="head"?`top:${String(b.text.top-z(o.margins.top))}mm;transform:translateY(-100%)`:`top:${String(b.text.bottom+z(o.margins.bottom))}mm`,F=D=>St(M[D].map(Q=>Pt(Q,E)).join(" ")),C="white-space:nowrap;overflow:hidden;text-overflow:ellipsis";return`<div style="position:absolute;left:${String(b.text.left)}mm;width:${String(b.text.right-b.text.left)}mm;${Y};display:flex;justify-content:space-between;gap:6mm;font-family:${X};font-size:${String(V)}pt;line-height:1.2;color:${N?q.leadSoft:q.ink}"><span style="min-width:0;${C}">${F("left")}</span><span style="position:absolute;left:0;right:0;text-align:center;${C}">${F("center")}</span><span style="min-width:0;text-align:right;${C}">${F("right")}</span></div>`},m=r.footer===void 0,x=n.pages.map(c=>{const b=e!==void 0&&!(c.n===1&&r.cover!==void 0)?p(e,c,"head",r.header===void 0):"",$=a===void 0?"":p(a,c,"foot",m);return`<div class="sheet${c.landscape?" turned":""}" style="width:${String(c.width)}mm;height:${String(c.height)}mm">${b}${$}</div>`}).join(""),{docFaces:u,docFontsCss:k}=await import("./fonts.js"),P=`<!doctype html><html><head><meta charset="utf-8"><style>${await k(`${w}${l.join("")}${x}`,u(i))}</style><style>
|
|
110
110
|
@page { size: ${String(o.width)}mm ${String(o.height)}mm; margin: 0; }
|
|
111
111
|
@page turned { size: ${String(o.height)}mm ${String(o.width)}mm; margin: 0; }
|
|
112
112
|
html, body { margin: 0; padding: 0; background: transparent; }
|
|
113
113
|
.sheet { position: relative; overflow: hidden; break-after: page; }
|
|
114
114
|
.sheet:last-child { break-after: auto; }
|
|
115
115
|
.sheet.turned { page: turned; }
|
|
116
|
-
</style></head><body>${
|
|
116
|
+
</style></head><body>${x}</body></html>`,S=await j(t,{width:1200,height:1200,allow:()=>!1});try{return await K(S,P),await J(S,!1)}finally{await S.close()}}async function At(t,n){if(n===null)return t;const{PDFDocument:s}=await G(),i=await s.load(t,{updateMetadata:!1}),d=await s.load(n,{updateMetadata:!1}),o=i.getPages(),e=await i.embedPdf(d,o.map((a,r)=>Math.min(r,d.getPageCount()-1)));return o.forEach((a,r)=>{const h=e[r];if(h===void 0)return;const{width:w,height:l}=a.getSize();a.drawPage(h,{x:0,y:0,width:w,height:l})}),Buffer.from(await i.save({useObjectStreams:!1}))}function Rt(t){return _({font:t}).text}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{open as D}from"node:fs/promises";const v=new Set([0,9,10,12,13,32]),F=new Set(Buffer.from("()<>[]{}/%","latin1"));class
|
|
2
|
+
import{open as D}from"node:fs/promises";import{firstUse as B}from"@allyhub/runtimes";export const pdfLib=B("pdf-lib",()=>import("pdf-lib"));const v=new Set([0,9,10,12,13,32]),F=new Set(Buffer.from("()<>[]{}/%","latin1"));class I{bytes;text;at=0;offsets=new Map;trailer;constructor(t){this.bytes=t,this.text=t.toString("latin1");const e=/startxref\s+(\d+)\s+%%EOF\s*$/u.exec(this.text);if(!e)throw new Error("Not a PDF: no startxref.");if(this.at=Number(e[1]),!this.text.startsWith("xref",this.at))throw new Error("This PDF keeps its cross-references in a stream, which this reader does not read.");for(this.at+=4;this.skip(),!this.text.startsWith("trailer",this.at);){const s=this.number(),i=this.number();this.skip();for(let d=0;d<i;d++){const g=this.text.slice(this.at,this.at+20);g[17]==="n"&&this.offsets.set(s+d,Number(g.slice(0,10))),this.at+=20}}this.at+=7;const r=this.value();if(r.t!=="dict")throw new Error("Not a PDF: its trailer is no dictionary.");this.trailer=r.v}numbers(){return[...this.offsets.keys()].sort((t,e)=>t-e)}skip(){const{bytes:t}=this;for(;;){const e=t[this.at];if(e===void 0)return;if(v.has(e))this.at++;else if(e===37)for(;this.at<t.length&&t[this.at]!==10&&t[this.at]!==13;)this.at++;else return}}regular(){const t=this.at;for(;this.at<this.bytes.length;){const e=this.bytes[this.at]??0;if(v.has(e)||F.has(e))break;this.at++}return this.text.slice(t,this.at)}number(){this.skip();const t=this.regular(),e=Number(t);if(t===""||Number.isNaN(e))throw new Error(`Not a number at ${String(this.at)}: ${t}`);return e}value(){this.skip();const{text:t}=this,e=t[this.at];if(t.startsWith("<<",this.at)){this.at+=2;const s=new Map;for(;;){if(this.skip(),t.startsWith(">>",this.at))return this.at+=2,{t:"dict",v:s};const i=this.value();if(i.t!=="raw"||!i.s.startsWith("/"))throw new Error(`A dictionary's key is no name at ${String(this.at)}.`);s.set(i.s,this.value())}}if(e==="["){this.at++;const s=[];for(;;){if(this.skip(),t[this.at]==="]")return this.at++,{t:"arr",v:s};s.push(this.value())}}if(e==="("){const s=this.at;let i=0;for(;this.at<t.length;this.at++){const d=t[this.at];if(d==="\\")this.at++;else if(d==="(")i++;else if(d===")"&&--i===0)break}return this.at++,{t:"raw",s:t.slice(s,this.at)}}if(e==="<"){const s=t.indexOf(">",this.at),i=t.slice(this.at,s+1);return this.at=s+1,{t:"raw",s:i}}if(e==="/")return this.at++,{t:"raw",s:`/${this.regular()}`};const r=this.regular();if(r==="")throw new Error(`Unexpected ${String(e)} at ${String(this.at)}.`);if(/^\d+$/u.test(r)){const s=this.at;this.skip();const i=this.regular();if(/^\d+$/u.test(i)&&(this.skip(),t[this.at]==="R"&&(v.has(this.bytes[this.at+1]??32)||F.has(this.bytes[this.at+1]??32))))return this.at++,{t:"ref",n:Number(r)};this.at=s}return{t:"raw",s:r}}object(t){const e=this.offsets.get(t);if(e===void 0)throw new Error(`No object ${String(t)}.`);if(this.at=e,this.number(),this.number(),this.skip(),!this.text.startsWith("obj",this.at))throw new Error(`Object ${String(t)} is not where its entry says.`);this.at+=3;const r=this.value();if(this.skip(),!this.text.startsWith("stream",this.at))return{value:r};this.at+=6,this.text[this.at]==="\r"&&this.at++,this.text[this.at]===`
|
|
3
3
|
`&&this.at++;const s=r.t==="dict"?r.v.get("/Length"):void 0,i=s?.t==="raw"?Number(s.s):s?.t==="ref"?Number(this.object(s.n).value.s):Number.NaN;if(!Number.isFinite(i))throw new Error(`Object ${String(t)}'s stream has no length.`);return{value:r,stream:this.bytes.subarray(this.at,this.at+i)}}}const $=a=>a?.t==="dict"?a.v:void 0,y=a=>a?.t==="raw"?a.s:void 0,p=a=>a?.t==="ref"?a.n:void 0;function m(a,t){switch(a.t){case"raw":return a.s;case"ref":return`${String(t(a.n))} 0 R`;case"arr":return`[${a.v.map(e=>m(e,t)).join(" ")}]`;case"dict":return`<<${[...a.v].map(([e,r])=>`${e} ${m(r,t)}`).join(`
|
|
4
|
-
`)}>>`}}function
|
|
4
|
+
`)}>>`}}function K(a){if(/^[\x20-\x7e]*$/u.test(a))return`(${a.replace(/[\\()]/gu,"\\$&")})`;let t="FEFF";for(let e=0;e<a.length;e++)t+=a.charCodeAt(e).toString(16).padStart(4,"0").toUpperCase();return`<${t}>`}const W=["/Resources","/MediaBox","/CropBox","/Rotate"];export class PdfJoiner{file;offset=0;next=1;offsets=[];pages=[];structure=[];parents=[];keys=0;lang;root;tree;constructor(t){this.file=t,this.tree=this.next++,this.root=this.next++}static async create(t){const e=new PdfJoiner(await D(t,"w"));return await e.put(Buffer.from(`%PDF-1.4
|
|
5
5
|
%âãÏÓ
|
|
6
6
|
`,"latin1")),e}async put(t){await this.file.write(t,0,t.length,this.offset),this.offset+=t.length}async object(t,e,r){if(this.offsets[t]=this.offset,r===void 0){await this.put(Buffer.from(`${String(t)} 0 obj
|
|
7
7
|
${e}
|
|
@@ -12,13 +12,13 @@ stream
|
|
|
12
12
|
`,"latin1")),await this.put(r),await this.put(Buffer.from(`
|
|
13
13
|
endstream
|
|
14
14
|
endobj
|
|
15
|
-
`,"latin1"))}async add(t){const e=new
|
|
15
|
+
`,"latin1"))}async add(t){const e=new I(t),r=p(e.trailer.get("/Root"));if(r===void 0)throw new Error("A PDF without a catalog.");const s=$(e.object(r).value)??new Map;this.lang??=s.get("/Lang");const i=new Set([r]),d=p(e.trailer.get("/Info"));d!==void 0&&i.add(d);const g=[],f=(n,u)=>{const c=$(e.object(n).value);if(c)if(y(c.get("/Type"))==="/Pages"){i.add(n);const l=new Map(u);for(const h of W){const o=c.get(h);o!==void 0&&l.set(h,o)}for(const h of c.get("/Kids")?.t==="arr"?c.get("/Kids").v:[]){const o=p(h);o!==void 0&&f(o,l)}}else g.push({n,inherits:u})},w=p(s.get("/Pages"));w!==void 0&&f(w,new Map);const b=p(s.get("/StructTreeRoot")),S=b===void 0?void 0:$(e.object(b).value),k=this.keys,E=[],R=[];if(b!==void 0&&S){i.add(b);const n=S.get("/K");for(const h of n?.t==="arr"?n.v:n?[n]:[]){const o=p(h);o!==void 0&&E.push(o)}const u=p(S.get("/ParentTree")),c=[],l=h=>{i.add(h);const o=$(e.object(h).value),x=o?.get("/Nums");x?.t==="arr"&&c.push(...x.v);const T=o?.get("/Kids");for(const A of T?.t==="arr"?T.v:[]){const P=p(A);P!==void 0&&l(P)}};u!==void 0&&l(u);for(let h=0;h+1<c.length;h+=2){const o=c[h+1];o&&R.push([k+Number(y(c[h])),o])}this.keys=k+Number(y(S.get("/ParentTreeNextKey"))??"0")}const j=new Map;for(const n of e.numbers())i.has(n)||j.set(n,this.next++);const N=n=>{if(n===b)return this.root;if(i.has(n))return this.tree;const u=j.get(n);if(u===void 0)throw new Error(`A reference to object ${String(n)}, which is not there.`);return u};this.structure.push(...E.map(N));for(const[n,u]of R)this.parents.push([n,{t:"raw",s:m(u,N)}]);const M=new Map(g.map(n=>[n.n,n.inherits]));for(const[n,u]of j){const c=e.object(n),l=$(c.value);if(l){const h=M.get(n);if(h){this.pages.push(u);for(const[o,x]of h)l.has(o)||l.set(o,x)}for(const o of["/StructParents","/StructParent"]){const x=y(l.get(o));x!==void 0&&l.set(o,{t:"raw",s:String(k+Number(x))})}}await this.object(u,m(c.value,N),c.stream)}}async close(t={}){try{await this.object(this.tree,`<</Type /Pages
|
|
16
16
|
/Count ${String(this.pages.length)}
|
|
17
17
|
/Kids [${this.pages.map(f=>`${String(f)} 0 R`).join(" ")}]>>`);const e=this.structure.length>0,r=this.next++;e&&(await this.object(this.root,`<</Type /StructTreeRoot
|
|
18
18
|
/K [${this.structure.map(f=>`${String(f)} 0 R`).join(" ")}]
|
|
19
19
|
/ParentTree ${String(r)} 0 R
|
|
20
20
|
/ParentTreeNextKey ${String(this.keys)}>>`),await this.object(r,`<</Nums [${this.parents.map(([f,w])=>`${String(f)} ${m(w,b=>b)}`).join(" ")}]>>`));const s=this.next++;await this.object(s,["<</Type /Catalog",`/Pages ${String(this.tree)} 0 R`,...e?["/MarkInfo <</Marked true>>",`/StructTreeRoot ${String(this.root)} 0 R`]:[],...this.lang?[`/Lang ${m(this.lang,f=>f)}`]:[],...t.title===void 0?[]:["/ViewerPreferences <</DisplayDocTitle true>>"],">>"].join(`
|
|
21
|
-
`));const i=this.next++;await this.object(i,`<<${t.title===void 0?"":`/Title ${
|
|
21
|
+
`));const i=this.next++;await this.object(i,`<<${t.title===void 0?"":`/Title ${K(t.title)}
|
|
22
22
|
`}/Producer (AllyHub)>>`);const d=this.offset,g=[`xref
|
|
23
23
|
0 ${String(this.next)}
|
|
24
24
|
`,`0000000000 65535 f
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{existsSync as x}from"node:fs";import{mkdir as O,readFile as S,stat as T,writeFile as v}from"node:fs/promises";import{basename as b,dirname as z,join as f,posix as C,resolve as F}from"node:path";import{PROJECT_DIR as I,defineCliCommand as E,listWork as P,projectRoot as R}from"@allyhub/build";import{itemIdOf as W}from"@allyhub/formats";import{importPsd as D,keyOf as M}from"@allyhub/image-psd";import{CommandError as g,EXIT as u}from"@allyhub/protocol";import{z as m}from"zod";const N=m.string().transform(o=>o.replace(/^\/+/gu,"")).refine(o=>o.endsWith(".ts")&&!o.split("/").some(a=>a===""||a==="."||a===".."),{message:"a .ts file from the project's root, such as launch/poster.ts"}),A={approximate:"approximate",pixels:"as pixels",omitted:"not carried over"};export const imageImport=E({input:m.strictObject({file:m.string().describe("The .psd or .psb to make an image of"),to:N.optional().describe("The image's module, from the project's root (default <the file's name>.ts); a person's changes are <name>.yaml beside it, its script <name>.<lang>.yaml, its pictures and the file as it was beside them under names no file there has"),lang:m.string().regex(/^[a-z]{2,3}(-[a-z0-9]+)*$/u).default("en").describe("The language of its words: its script is <name>.<lang>.yaml"),dir:I}),positional:["file"],output:m.looseObject({}),examples:["allyhub image import ~/Downloads/poster.psd --to launch/poster.ts","allyhub image import 海报.psd --to posters/spring.ts --lang zh-cn"],run:async(o,a)=>{const c=await R(a.cwd,o.dir),r=F(a.cwd,o.file),k=await S(r).catch(()=>{throw new g("not-found",`There is no file ${r}.`,{exit:u.notFound})}),n=o.to??`${M(b(r).replace(/\.ps[db]$/iu,""),"image",new Set)}.ts`,w=C.dirname(n),l=e=>w==="."?e:`${w}/${e}`,d=W(n);let t;try{t=D(new Uint8Array(k),{id:d,lang:o.lang,source:b(r),taken:e=>x(f(c,l(e)))})}catch(e){throw new g("bad-file",`${r} is not a Photoshop file this can read: ${e.message}`,{exit:u.usage})}const $=[...t.files.keys()].map(l);for(const e of $)if(await T(f(c,e)).catch(()=>{}))throw new g("place-taken",`${e} is already there.`,{exit:u.conflict,hint:"Name another module with --to."});for(const[e,s]of t.files){const i=f(c,l(e));await O(z(i),{recursive:!0}),await v(i,s,{flag:"wx"})}await P(c,{kind:"image",file:n});const h=new Map;for(const e of t.report){const s=`${e.how}|${e.what}`,i=h.get(s)??{line:` ${A[e.how]}: ${e.what}`,at:[]},p=[e.board,e.layer].filter(j=>j!==void 0).join("/");p!==""&&!i.at.includes(p)&&i.at.push(p),h.set(s,i)}const y=[...h.values()].map(e=>`${e.line}${e.at.length===0?"":` (${e.at.slice(0,4).join(", ")}${e.at.length>4?` and ${String(e.at.length-4)} more`:""})`}`);return{value:{file:n,id:d,source:l(t.source),boards:t.boards.map(e=>({key:e.key,name:e.name,width:e.width,height:e.height,kinds:e.kinds})),files:$,report:t.report},text:[`Made ${n}: ${t.boards.map(e=>`${e.key} (${String(e.width)}×${String(e.height)}: ${Object.entries(e.kinds).map(([s,i])=>`${String(i)} ${s}`).join(", ")||"no layers"})`).join("; ")}; listed in allyhub.yaml as ${d}.`,`The file as it was: ${l(t.source)}`,...y.length>0?[`Not carried over as it is (${String(t.report.length)}, grouped; all with --json):`,...y]:[],`allyhub check, then allyhub frames ${d}, to see it.`].join(`
|
|
2
|
+
import{existsSync as x}from"node:fs";import{mkdir as O,readFile as S,stat as T,writeFile as v}from"node:fs/promises";import{basename as b,dirname as z,join as f,posix as C,resolve as F}from"node:path";import{PROJECT_DIR as I,defineCliCommand as E,listWork as P,projectRoot as R}from"@allyhub/build";import{itemIdOf as W}from"@allyhub/formats";import{importPsd as D,keyOf as M}from"@allyhub/image-psd";import{CommandError as g,EXIT as u}from"@allyhub/protocol";import{z as m}from"zod";const N=m.string().transform(o=>o.replace(/^\/+/gu,"")).refine(o=>o.endsWith(".ts")&&!o.split("/").some(a=>a===""||a==="."||a===".."),{message:"a .ts file from the project's root, such as launch/poster.ts"}),A={approximate:"approximate",pixels:"as pixels",omitted:"not carried over"};export const imageImport=E({input:m.strictObject({file:m.string().describe("The .psd or .psb to make an image of"),to:N.optional().describe("The image's module, from the project's root (default <the file's name>.ts); a person's changes are <name>.yaml beside it, its script <name>.<lang>.yaml, its pictures and the file as it was beside them under names no file there has"),lang:m.string().regex(/^[a-z]{2,3}(-[a-z0-9]+)*$/u).default("en").describe("The language of its words: its script is <name>.<lang>.yaml"),dir:I}),positional:["file"],output:m.looseObject({}),examples:["allyhub image import ~/Downloads/poster.psd --to launch/poster.ts","allyhub image import 海报.psd --to posters/spring.ts --lang zh-cn"],run:async(o,a)=>{const c=await R(a.cwd,o.dir),r=F(a.cwd,o.file),k=await S(r).catch(()=>{throw new g("not-found",`There is no file ${r}.`,{exit:u.notFound})}),n=o.to??`${M(b(r).replace(/\.ps[db]$/iu,""),"image",new Set)}.ts`,w=C.dirname(n),l=e=>w==="."?e:`${w}/${e}`,d=W(n);let t;try{t=await D(new Uint8Array(k),{id:d,lang:o.lang,source:b(r),taken:e=>x(f(c,l(e)))})}catch(e){throw new g("bad-file",`${r} is not a Photoshop file this can read: ${e.message}`,{exit:u.usage})}const $=[...t.files.keys()].map(l);for(const e of $)if(await T(f(c,e)).catch(()=>{}))throw new g("place-taken",`${e} is already there.`,{exit:u.conflict,hint:"Name another module with --to."});for(const[e,s]of t.files){const i=f(c,l(e));await O(z(i),{recursive:!0}),await v(i,s,{flag:"wx"})}await P(c,{kind:"image",file:n});const h=new Map;for(const e of t.report){const s=`${e.how}|${e.what}`,i=h.get(s)??{line:` ${A[e.how]}: ${e.what}`,at:[]},p=[e.board,e.layer].filter(j=>j!==void 0).join("/");p!==""&&!i.at.includes(p)&&i.at.push(p),h.set(s,i)}const y=[...h.values()].map(e=>`${e.line}${e.at.length===0?"":` (${e.at.slice(0,4).join(", ")}${e.at.length>4?` and ${String(e.at.length-4)} more`:""})`}`);return{value:{file:n,id:d,source:l(t.source),boards:t.boards.map(e=>({key:e.key,name:e.name,width:e.width,height:e.height,kinds:e.kinds})),files:$,report:t.report},text:[`Made ${n}: ${t.boards.map(e=>`${e.key} (${String(e.width)}×${String(e.height)}: ${Object.entries(e.kinds).map(([s,i])=>`${String(i)} ${s}`).join(", ")||"no layers"})`).join("; ")}; listed in allyhub.yaml as ${d}.`,`The file as it was: ${l(t.source)}`,...y.length>0?[`Not carried over as it is (${String(t.report.length)}, grouped; all with --json):`,...y]:[],`allyhub check, then allyhub frames ${d}, to see it.`].join(`
|
|
3
3
|
`)}}});const H={"image import":imageImport};export default H;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as B,readdir as A,rm as K,writeFile as j}from"node:fs/promises";import{dirname as
|
|
2
|
+
import{mkdir as B,readdir as A,rm as K,writeFile as j}from"node:fs/promises";import{dirname as U,join as P,parse as q}from"node:path";import{PSD_DEFAULTS as X,trimmed as T,writeBoardPsd as Q}from"@allyhub/image-psd";import{cropImage as J,readPng as V}from"@allyhub/measure";import{finishPdf as W,pdfLib as H}from"@allyhub/image-render/pdf";import{zipSync as Y}from"fflate";export const IMAGE_EXPORT_DEFAULTS={jpegQuality:90,scale:1};const v={min:.25,max:4},L=16384,Z=["png","jpeg","webp"],tt=t=>Z.includes(t),M={png:"png",jpeg:"jpg",webp:"webp"},et=t=>typeof t=="number"&&Number.isFinite(t)?Math.max(0,Math.min(100,Math.round(t))):void 0,E=t=>{const e=typeof t=="number"?t:typeof t=="string"?Number(t.trim().replace(/[x×]$/iu,"")):Number.NaN;return Number.isFinite(e)&&e>0?e:void 0};export function scaleOf(t,e){const r=["scale","width","height"].filter(i=>t[i]!==void 0);if(r.length>1)return{code:"bad-param",message:`${r.join(" and ")} both size a board's picture.`,hint:"Give one: scale (2), width or height (pixels)."};const[a]=r;if(a===void 0)return IMAGE_EXPORT_DEFAULTS.scale;const d=E(t[a]);if(d===void 0)return{code:"bad-param",message:`${a} is ${JSON.stringify(t[a])}, not a positive number.`};const s=a==="scale"?d:d/(a==="width"?e.width:e.height),l=Math.round(e.width*s),u=Math.round(e.height*s);return s<v.min||s>v.max?{code:"bad-param",message:`Board ${e.key} (${String(e.width)}×${String(e.height)}) at ${a} ${String(d)} is drawn at ${String(Math.round(s*1e3)/1e3)}×, not from ${String(v.min)}× to ${String(v.max)}×.`,hint:"Change the board's size in the code for a picture further from it."}:Math.max(l,u)>L?{code:"bad-param",message:`Board ${e.key} at ${String(Math.round(s*1e3)/1e3)}× is ${String(l)}×${String(u)}, over ${String(L)} pixels a side.`}:s}async function _(t,e,r,a){return t.stage.capture({format:e,alpha:a,...e==="jpeg"?{quality:r??IMAGE_EXPORT_DEFAULTS.jpegQuality}:e==="webp"&&r!==void 0?{quality:r}:{}})}const C=t=>Math.round(t/1024*10)/10;async function G(t,e,r,a){const d=scaleOf(a.params,e);if(typeof d!="number")return d;const s=E(a.params.maxKb),l=t.timeline.parts.find(u=>u.key===e.key);await t.stage.rescale(d);try{await t.seek(l?.still??0);const u=et(a.params.quality),i=a.transparent&&r!=="jpeg",n=await _(t,r,u,i);if(s===void 0||n.length<=s*1024)return{bytes:n};if(r==="png")return{code:"over-size",message:`Board ${e.key}'s PNG is ${String(C(n.length))} KB, over ${String(s)} KB, and a PNG keeps every pixel.`,hint:"Export it as jpeg or webp, which find a quality under the size, or at a smaller scale."};let m=0,$=u??100,o;for(;m<=$;){const f=Math.floor((m+$)/2),h=await _(t,r,f,i);h.length<=s*1024?(o={bytes:h,picked:f},m=f+1):$=f-1}return o??{code:"over-size",message:`Board ${e.key}'s ${r} is over ${String(s)} KB at every quality.`,hint:"Export it at a smaller scale, or as another type."}}finally{await t.stage.rescale(1)}}const nt=`[...document.querySelectorAll("*")].some((el) => {
|
|
3
3
|
const f = getComputedStyle(el).backdropFilter;
|
|
4
4
|
return f !== "" && f !== "none" && el.checkVisibility();
|
|
5
|
-
})`,D=.75;async function at(t,e,
|
|
5
|
+
})`,D=.75;async function at(t,e,r,a){const{PDFDocument:d}=await H(),s=await d.create({updateMetadata:!1}),l=[];for(const i of e){const n=await t.another();try{const $=n.timeline.parts.find(p=>p.key===i.key)?.still??0;if(await n.seek($),await n.stage.page.evaluate(nt)){await n.stage.rescale(2);const p=await n.stage.capture({format:"png",alpha:a});s.addPage([i.width*D,i.height*D]).drawImage(await s.embedPng(p),{x:0,y:0,width:i.width*D,height:i.height*D}),l.push(i.key);continue}const o=await n.stage.print([{still:$,title:i.key,background:a?"transparent":n.timeline.background??"white"}],`${String(i.width)}px ${String(i.height)}px`,{width:i.width,height:i.height}),f=await d.load(o,{updateMetadata:!1}),[h]=await s.copyPages(f,[0]);h&&s.addPage(h)}finally{await n.close()}}return{bytes:await W(await s.save(),{...r===void 0?{}:{title:r},outline:e.map(i=>i.key)}),pictured:l}}function it(t){const e=t.piece.title;return typeof e=="string"?e:e===void 0?void 0:e[t.target.combo.lang??""]??Object.values(e)[0]}async function N(t,e,r){const a=V(await t.stage.capture({format:"png",alpha:r}));return a.width===e.width&&a.height===e.height?a:J(a,[0,0,e.width,e.height])??a}const R=t=>t.flatMap(e=>[e,...R(e.layers??[])]);async function st(t,e,r,a){const d=t.timeline.parts.find(i=>i.key===e.key);await t.seek(d?.still??0);const s=await N(t,e,!0),l=new Map,u=new Map;try{for(const i of R(r.layers)){if(i.pixels){await t.stage.call("psdDraw",e.key,i.key,"pixels");const n=T(await N(t,e,!0));n&&l.set(i.key,n)}if(i.mask?.kind==="raster"){await t.stage.call("psdDraw",e.key,i.key,"mask");const n=T(await N(t,e,!1),0);n&&u.set(i.key,n)}}}finally{await t.stage.call("psdDraw",null)}return await Q(r,{composite:s,layers:l,masks:u},{format:a})}export async function renderImage(t){const e=t.version;if(!e)throw new Error("An image's files are made from a version.");const r=e.version,a=await r.stage.call("boards"),d=e.piece.options.transparent===!0,s=[];let l=0;const u=t.types.length*Math.max(1,a.length),i=()=>{l++,t.onProgress?.(Math.min(1,l/u))};for(const n of t.types){t.signal?.throwIfAborted();const m=t.out(n);await B(U(m),{recursive:!0});const $={transparent:d,params:t.params,...t.signal?{signal:t.signal}:{}};if(tt(n)){const{dir:o,name:f}=q(m),h=P(o,f);await B(h,{recursive:!0});const p=new Set(a.map(g=>`${g.key}.${M[n]}`));for(const g of await A(h))g.endsWith(`.${M[n]}`)&&!p.has(g)&&await K(P(h,g),{force:!0});const y=[],x=[],S={};let k;for(const g of a){const w=await G(r,g,n,$);if(i(),!("bytes"in w)){k=w;break}const c=P(h,`${g.key}.${M[n]}`);await j(c,w.bytes),y.push(c),S[g.key]=c,w.picked!==void 0&&x.push(`${f}/${g.key}.${M[n]} at quality ${String(w.picked)}, ${String(C(w.bytes.length))} KB, under the ${String(E(t.params.maxKb))} KB asked`)}s.push(k?{type:n,failure:k}:{type:n,files:y,partFiles:S,...x.length>0?{chosen:x}:{}});continue}if(n==="zip"){const o={};let f;for(const p of a){const y=await G(r,p,"png",{...$,params:{...$.params,maxKb:void 0}});if(i(),!("bytes"in y)){f=y;break}o[`${p.key}.${M.png}`]=y.bytes}if(f){s.push({type:n,failure:f});continue}const h=Y(Object.fromEntries(Object.entries(o).map(([p,y])=>[p,[y,{level:0,mtime:new Date(1980,0,1)}]])));await j(m,h),s.push({type:n,files:[m]});continue}if(n==="pdf"){const o=await at(e,a,it(e),d);await j(m,o.bytes),l+=a.length,t.onProgress?.(Math.min(1,l/u)),s.push({type:n,files:[m],...o.pictured.length>0?{notes:[`${o.pictured.join(", ")} ${o.pictured.length===1?"is a picture":"are pictures"} in the PDF, ${o.pictured.length===1?"its":"their"} text as pixels: an adjustment (a backdrop-filter) is left out where a PDF is printed.`]}:{}});continue}if(n==="psd"){const o=t.params.psd==="psb"?"psb":X.format,{dir:f,name:h}=q(m),p=P(f,h);await B(p,{recursive:!0});const y=new Set(a.map(c=>`${c.key}.${o}`));for(const c of await A(p))/\.ps[db]$/u.test(c)&&!y.has(c)&&await K(P(p,c),{force:!0});const x=await r.stage.call("psdBoards"),S=[],k=[],g=new Set,w=[];for(const c of a){const F=x.find(b=>b.key===c.key);if(!F){w.push(c.key);continue}const I=P(p,`${c.key}.${o}`),O=await st(r,c,F,o);await j(I,O.bytes),S.push(I);for(const b of O.fidelity){const z=`${b.how}|${b.what}|${b.layer??""}`;g.has(z)||(g.add(z),k.push({...b,...b.layer===void 0?{}:{layer:`${c.key}/${b.layer}`}}))}i()}if(S.length===0){s.push({type:n,failure:{code:"psd-unread",message:`No board's layers could be read for a PSD (${w.join(", ")}).`}});continue}s.push({type:n,files:S,...k.length>0?{fidelity:k}:{},...w.length>0?{notes:w.map(c=>`Board ${c} is not in a PSD: its layers could not be read.`)}:{}});continue}s.push({type:n,failure:{code:"bad-type",message:`An image is not made as ${n}.`,hint:"Its types: png, jpeg, webp, pdf, zip, psd."}})}return s}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{firstUse as e}from"@allyhub/runtimes";export const agPsd=e("ag-psd",async()=>await import("ag-psd"));let r=!1;export async function psdLib(){const a=await agPsd();if(!r){const i=(s,t)=>({width:s,height:t,data:new Uint8ClampedArray(s*t*4),colorSpace:"srgb"});a.initializeCanvas(()=>{throw new Error("ag-psd asked for a canvas: AllyHub gives it pixels as data.")},i),r=!0}return a}
|