allyhub 0.11.0 → 0.13.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 +16 -0
- package/bin/allyhub.js +2 -2
- package/dist/commands/frames/report.js +1 -1
- package/dist/commands/frames.js +11 -11
- package/dist/main.js +6 -6
- package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/audio/dist/render.js +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/dist/media.js +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/dist/chart-file.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +3 -2
- package/dist/node_modules/@allyhub/chart/dist/chart.js +2 -1
- package/dist/node_modules/@allyhub/chart/dist/color.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/svg.js +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/call.js +4 -4
- package/dist/node_modules/@allyhub/cloud/dist/client.d.ts +2 -0
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/config.d.ts +6 -0
- package/dist/node_modules/@allyhub/cloud/dist/config.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/credentials.js +2 -2
- package/dist/node_modules/@allyhub/cloud/dist/device.d.ts +2 -0
- package/dist/node_modules/@allyhub/cloud/dist/device.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/records.d.ts +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/signin.d.ts +11 -3
- package/dist/node_modules/@allyhub/cloud/dist/signin.js +2 -2
- package/dist/node_modules/@allyhub/cloud/dist/uploads.d.ts +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/uploads.js +2 -2
- 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/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +1 -1
- 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/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/data/deck-code.d.ts +130 -0
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/gen.d.ts +3 -1
- package/dist/node_modules/@allyhub/formats/dist/data/gen.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +512 -166
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +2523 -136
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +931 -87
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- 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/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/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -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/dist/run.d.ts +6 -1
- package/dist/node_modules/@allyhub/media/dist/run.js +2 -2
- 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/dist/color.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/transform.js +2 -0
- package/dist/node_modules/@allyhub/ooxml/package.json +5 -1
- package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +4 -4
- package/dist/node_modules/@allyhub/piece/dist/media.d.ts +2 -2
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/part-keys.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +49 -5
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +56 -0
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +72 -9
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +35 -20
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/errors.d.ts +7 -0
- package/dist/node_modules/@allyhub/protocol/dist/errors.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +328 -0
- package/dist/node_modules/@allyhub/protocol/dist/events.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +28 -2
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
- package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +2 -2
- package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +69 -6
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +9 -9
- 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/package.json +1 -1
- package/dist/node_modules/@allyhub/report-extension/dist/cli/find.js +1 -1
- package/dist/node_modules/@allyhub/report-extension/dist/cli/index.js +3 -3
- package/dist/node_modules/@allyhub/report-extension/dist/cli/picture.js +29 -1
- package/dist/node_modules/@allyhub/report-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/STYLE.md +11 -4
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.css +6 -2
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.json +1 -1
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/tokens.js +3 -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/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/annotations.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/rules.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/arrange.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/data-tools.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/edit.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/fill.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/filter.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/outline.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/rich.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/rules.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +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/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/numbering.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/patterns.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/table-style.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/deck-pptx.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/workspace.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/audio-icon.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/code.js +3 -3
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/index.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/script.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chart.js +2 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/common.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/index.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/table.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/timing.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/table-styles.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/theme.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/timing.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/xml.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub/slides-runtime/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/ink.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/load.js +5 -5
- 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/dist/runtime.js +101 -49
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/LICENSE +241 -0
- package/dist/node_modules/@allyhub/telemetry/dist/doc.js +47 -0
- package/dist/node_modules/@allyhub/telemetry/dist/errors.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/dist/level.js +3 -0
- package/dist/node_modules/@allyhub/telemetry/dist/scrub.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/dist/telemetry.js +5 -0
- package/dist/node_modules/@allyhub/telemetry/package.json +21 -0
- package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/timeline-text.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +3 -3
- 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/package.json +1 -1
- package/dist/package.json +12 -12
- package/dist/telemetry.js +4 -0
- package/dist/turn.js +2 -0
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-BKmMA6gn.js → abnfDiagram-WEYOIA3C-D70jg8mE.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-BEFBgb4k.js → architecture-WOLXFQ4H-CrXS3E8e.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-_u5YfCjY.js → architectureDiagram-ZHVYKT53-JrBljCOx.js} +1 -1
- package/editor-web/assets/arrow-down-DzZjFrBL.js +1 -0
- package/editor-web/assets/arrow-up-hdmh9LVD.js +1 -0
- package/editor-web/assets/{article-BUmD3xtR.js → article-BWrfVMRA.js} +6 -6
- package/editor-web/assets/article-hxHjqzV1.js +7 -0
- package/editor-web/assets/{audio-lines-CzuzsGjI.js → audio-lines-1s1eRs4Q.js} +1 -1
- package/editor-web/assets/{blockDiagram-RJAE7QA3-DybfaO3Z.js → blockDiagram-RJAE7QA3-BzfC1xTS.js} +1 -1
- package/editor-web/assets/{bookmark-Dsd3kHJJ.js → bookmark-Dfji3syX.js} +1 -1
- package/editor-web/assets/{button-eGxLxbv9.js → button-EftXSfev.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-BfqLHB5i.js → c4Diagram-XDPPPE54-s2TpXKgH.js} +1 -1
- package/editor-web/assets/calc-worker-jImBXoeb.js +45 -0
- package/editor-web/assets/channel-BFbXY6R0.js +1 -0
- package/editor-web/assets/chart-BC3kUUDD.js +2 -0
- package/editor-web/assets/{chart-no-axes-column-BVkeF_Mr.js → chart-no-axes-column-CJmeYOSo.js} +1 -1
- package/editor-web/assets/{chunk-2E7WHVMD-BVp1I_d0.js → chunk-2E7WHVMD-DyE9v6UX.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-CTdgWEMr.js → chunk-4EMNKR2T-CCunMMcT.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-7pnsxeaP.js → chunk-55XCU76K-CZgJYrN4.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-Dc0Dvkq7.js → chunk-7S6XSTFO-B01FlTFf.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-VAILIsfx.js → chunk-AQDTSKZB-latWUvVu.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-CUDx1Rv5.js → chunk-DSNLSHJZ-BHFiQInN.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-DAoEe-dJ.js → chunk-HAGFOTED-C4hR36ab.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-g0akya12.js → chunk-HNE4Q36P-CNrxiD2Q.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-hTGjzXdJ.js → chunk-NQOKRVIF-DpyEHKEY.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-BgLV8BIJ.js → chunk-UHW7PFBP-SIEJdixh.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-Bw19OOSD.js → chunk-VQ5W62QI-CxWnQRxx.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-CMST9dyE.js → chunk-WQQL4CDK-CbRuCBm6.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-Bbpu36XF.js → chunk-YZO67HFG-Cgu-EQvs.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-C48Ri0Gs.js → chunk-ZAUX2LTX-pAl5CV3o.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-DN1g01Oe.js → chunk-ZCHMQSOR-Du5hY-FP.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-U6jbPr2d.js → classDiagram-v2-4MYWR3UA-CevU94T6.js} +1 -1
- package/editor-web/assets/{collaborator-B1u2td9m.js → collaborator-C6IJkcGR.js} +1 -1
- package/editor-web/assets/copy-DvOiv9Ra.js +1 -0
- package/editor-web/assets/{createLucideIcon-GFZ_fxLc.js → createLucideIcon-REX213UO.js} +1 -1
- package/editor-web/assets/{cynefin-EF2NZ3EQ-gzkai_7-.js → cynefin-EF2NZ3EQ-DBHwpMRJ.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-DtSekSr6.js → cynefinDiagram-WF24UDRP-CxUzpjvG.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-CiUwYVT6.js → dagre-NK4GIZVX-BAJNBDYO.js} +1 -1
- package/editor-web/assets/{diagram-CBK3MWTC-r9XHCV-k.js → diagram-CBK3MWTC-BQW9Fbw-.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-DxVsDZ34.js → diagram-I5XIIV2D-DQBROUfn.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-B0eNQoHV.js → diagram-ODIL2UCW-DEoK31qy.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-C7f2MfJT.js → diagram-PFBEJUXE-BTCa2We1.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-CSXcnvct.js → diagram-RJA3I4VV-DNM8qWC3.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-DXzOD_ii.js → diagram-TYUNFSNR-BcKpED4d.js} +1 -1
- package/editor-web/assets/dist-90dg0B0d.js +2 -0
- package/editor-web/assets/dist-BSPs7tZR.js +1 -0
- package/editor-web/assets/dist-CP9XwbBS.js +45 -0
- package/editor-web/assets/dist-CRxtC7DG.js +24 -0
- package/editor-web/assets/{dist-CC7OeU1e.js → dist-Cmnq14RO.js} +3 -3
- package/editor-web/assets/dist-CrZwqOm2.js +1 -0
- package/editor-web/assets/dist-CzUWTcvC.js +38 -0
- package/editor-web/assets/dist-D2a_y4AE.js +1 -0
- package/editor-web/assets/{dist-DDv_SbKw.js → dist-DMZ1VHPK.js} +1 -1
- package/editor-web/assets/dist-DYnXIW8F.js +16 -0
- package/editor-web/assets/{dist-BuWaZ3Y4.js → dist-Dpet39Yp.js} +30 -30
- package/editor-web/assets/dist-Dre4Cwpz.js +1 -0
- package/editor-web/assets/dist-RkxskWGK.js +5 -0
- package/editor-web/assets/dist-aANR6S2I.js +3 -0
- package/editor-web/assets/{dist-Gz6NDS0J.js → dist-qSuFWuVB.js} +3 -3
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-Cs4YRvDD.js → ebnfDiagram-V4P3TTPT-D-1x27Eh.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-Bh3LZ9WI.js → elk-QONTBCTQ-BJSCxiTH.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-C4vYTYXp.js → erDiagram-KYQIGQAA-C7Q357iD.js} +1 -1
- package/editor-web/assets/{eventmodeling-K75KTNOO-BN1kkHWS.js → eventmodeling-K75KTNOO-kXrQLSF5.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-GSC4btef.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-CA1LkkC5.js → ganttDiagram-R7GPNTJY-Bt3SRgK7.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-Dy5tA7dG.js → gitGraph-VSP46ZUC-DS4CkhfK.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-hJIB8EkH.js → gitGraphDiagram-PDYL7XHY-BgfmSVdI.js} +1 -1
- package/editor-web/assets/group-pebHQTdP.js +1 -0
- package/editor-web/assets/{hint-B8JpEypy.js → hint-BmRKl2nL.js} +1 -1
- package/editor-web/assets/index-D8qc_ipi.js +28 -0
- package/editor-web/assets/index-DDtZpLDF.css +2 -0
- package/editor-web/assets/{info-OHQRW6UA-DvzSf7rQ.js → info-OHQRW6UA-BZjctF3x.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-BjIMm4Af.js → infoDiagram-MVDRKAX5-BAp5oUXk.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-Bpz71S40.js → ishikawaDiagram-HPEHV2GE-DGL7ZfUu.js} +1 -1
- package/editor-web/assets/{italic-D10w8n6C.js → italic-CtlNOXN9.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-DAB-pZjD.js → journeyDiagram-BOSHW7O7-DOOoBGx-.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-cYeyh3P6.js → kanban-definition-FNSA4HC5-lbLuUiMW.js} +1 -1
- package/editor-web/assets/katex-UWCZofcd.js +257 -0
- package/editor-web/assets/{link-BC5xK1-1.js → link-CW2KxKT_.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-req5LE0X.js → mermaid-parser.core-RkCFmJcg.js} +3 -3
- package/editor-web/assets/{mermaid.core-zFwZug4C.js → mermaid.core-BVUl-afX.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-TStWb7DG.js → mindmap-definition-6OY57UG3-C3DC4T1J.js} +1 -1
- package/editor-web/assets/minus-D1tgAHbU.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-smFhVKcB.js → packet-JDAUHWVQ-Bkd6YpX8.js} +1 -1
- package/editor-web/assets/{palette-BIOudGkm.js → palette-INFK0Zsr.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-DvSNRv0-.js → pegDiagram-ECIUJNBX-B5Seh4Oe.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-qjaGsBZG.js → pie-XZMESJXO-BNbb4Q8k.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-Dd9P-Pdc.js → pieDiagram-GNMPY74T-_hnbUloZ.js} +1 -1
- package/editor-web/assets/play-DvMyq5xW.js +1 -0
- package/editor-web/assets/{progress-DE4C5_3x.js → progress-D6wSFdpY.js} +1 -1
- package/editor-web/assets/props-form-BfwEi6jW.js +1 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-h2IIKUUA.js → quadrantDiagram-D57K4MC3-1rbqW-KO.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-DlVrSA1d.js → radar-ABXABTNO-BWSnhBSp.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-nFbuLAtc.js → railroad-I3PHUGI6-BNB-OKs1.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-Daj8h2iV.js → railroad-abnf-LNEFI6M7-BKgidf_B.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-eYJyl5PH.js → railroad-ebnf-DWYD2UWJ-CNCnxtHp.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-BTRhKZQq.js → railroad-peg-JR7BVNR7-CyBW6_0o.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-CeLGUjdp.js → railroadDiagram-Y72NRBL7-Cud3SJ7O.js} +1 -1
- package/editor-web/assets/{react-WA6wlt8S.js → react-Bk7NnOLX.js} +1 -1
- package/editor-web/assets/{repeat-2-VQP1EVOZ.js → repeat-2-DfPmKp4w.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-Dmk9XRM5.js → requirementDiagram-EQYSW5RA-BrSCcpqV.js} +1 -1
- package/editor-web/assets/{row-BRlEWRrK.js → row-VwyPfa1b.js} +1 -1
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-Yn4zlrAM.js → sankeyDiagram-SY24JHO5-rJV4dJFn.js} +1 -1
- package/editor-web/assets/scissors-D9WmgvNP.js +1 -0
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-BTRnp_PW.js → sequenceDiagram-BLEHNHQU-CEUuD2n6.js} +1 -1
- package/editor-web/assets/{session-Do9AqS38.js → session-DE0fvAcs.js} +1 -1
- package/editor-web/assets/sigma-CY2Chbro.js +1 -0
- package/editor-web/assets/slides-BgacyjJW.js +1 -0
- package/editor-web/assets/{snapshots-BUGlKQIB.js → snapshots-D8TtZp1x.js} +1 -1
- package/editor-web/assets/{sound-Bj3o9_Fa.js → sound-DUCxe9eC.js} +1 -1
- package/editor-web/assets/split-Cx2MMnC_.js +3 -0
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-kstrRKv2.js → stateDiagram-v2-A6IESKWZ-BRE_C2he.js} +1 -1
- package/editor-web/assets/sticky-note-C5qUDHhC.js +1 -0
- package/editor-web/assets/{strikethrough-CfXx6IYH.js → strikethrough-DP-7tMz0.js} +1 -1
- package/editor-web/assets/svg-nJtFNJ-7.js +1 -0
- package/editor-web/assets/{swatch-WeJD41aW.js → swatch-lxK4C8fD.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-DaZsZkeP.js → swimlanes-B3ENRKFQ-BEPqWgVe.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-DAcNszZ6.js +8 -0
- package/editor-web/assets/{switch-N0G_sbqt.js → switch-DaG6OuAi.js} +1 -1
- package/editor-web/assets/{syntax-oWsKBWFw.js → syntax-9LD8MzGy.js} +1 -1
- package/editor-web/assets/{syntax-BVsgRJ4I.js → syntax-CLaCSmoi.js} +1 -1
- package/editor-web/assets/{table-B6hVZAMi.js → table-CTjNpE4W.js} +1 -1
- package/editor-web/assets/tabs-DjhzblAG.js +1 -0
- package/editor-web/assets/{textarea-tEWvBY9p.js → textarea-DBwRbOyF.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-CLCvY-Yf.js → timeline-definition-JXYKGLGB-p8Qeg4pS.js} +1 -1
- package/editor-web/assets/{trash-2-BP6nqpg2.js → trash-2-DrnRa91l.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-BmN0gwdC.js → treeView-D4JQ5SDB-C9FTdXKq.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-DN29G_E_.js → treemap-SAJKECNS-XAeLVOtI.js} +1 -1
- package/editor-web/assets/{undo-2-CHR0nvWL.js → undo-2-DUGGyBdX.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-DTRS54cB.js → usecaseDiagram-WPOLBNNX-BV3AMRuH.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DAAc11Hx.js → vennDiagram-Q3Y3IDCW-CJdKcYyA.js} +1 -1
- package/editor-web/assets/{video-BlvmR8BK.js → video-He8p6dr6.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-B-UYkmdB.js → wardley-7MLQ67FV-DZh6Mf22.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-BmbwCaky.js → wardleyDiagram-IVAIDKWA-XtvKSX-m.js} +1 -1
- package/editor-web/assets/{words-D_4T9Adq.js → words-CPHp_0tt.js} +1 -1
- package/editor-web/assets/{words-WgdEQdYP.js → words-CjW-1tZI.js} +1 -1
- package/editor-web/assets/{xychartDiagram-4URNHDU4-ChAfAq1U.js → xychartDiagram-4URNHDU4-CGkL42sz.js} +1 -1
- package/editor-web/assets/zoom-in-C4lxmIDE.js +1 -0
- package/editor-web/index.html +6 -6
- package/package.json +2 -2
- package/editor-web/assets/arrow-up-B5rJbBv0.js +0 -1
- package/editor-web/assets/article-DNioBb3p.js +0 -7
- package/editor-web/assets/calc-worker-D2pGis6e.js +0 -45
- package/editor-web/assets/channel-TNPgFDrw.js +0 -1
- package/editor-web/assets/chart-C37xvZT2.js +0 -1
- package/editor-web/assets/dist-BGRwhCQO.js +0 -1
- package/editor-web/assets/dist-BW4X7BrF.js +0 -1
- package/editor-web/assets/dist-BgDRE85b.js +0 -2
- package/editor-web/assets/dist-Blq5nJnU.js +0 -24
- package/editor-web/assets/dist-C1emZ9wX.js +0 -37
- package/editor-web/assets/dist-CX-fiPSn.js +0 -38
- package/editor-web/assets/dist-C_VvG-_9.js +0 -5
- package/editor-web/assets/dist-Ce7HrBxv.js +0 -3
- package/editor-web/assets/dist-D2k6w-_a.js +0 -1
- package/editor-web/assets/dist-DEoEO4zs.js +0 -1
- package/editor-web/assets/dist-DlDxxPIP.js +0 -16
- package/editor-web/assets/flowDiagram-IUGLLWBU-B04NGsyi.js +0 -1
- package/editor-web/assets/index-CgB5osVc.js +0 -28
- package/editor-web/assets/index-Daytem9N.css +0 -2
- package/editor-web/assets/katex-5Z2zF-9g.js +0 -257
- package/editor-web/assets/minus-DaWs5i8B.js +0 -1
- package/editor-web/assets/play-CrMmPghG.js +0 -1
- package/editor-web/assets/props-form-CsmDBqzy.js +0 -1
- package/editor-web/assets/schemas-VikZYZIK.js +0 -1
- package/editor-web/assets/slides-diTEQ3C5.js +0 -1
- package/editor-web/assets/split-CNU1RHcX.js +0 -3
- package/editor-web/assets/svg-Cx50MpxK.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CBZAujYY.js +0 -8
- package/editor-web/assets/tabs-DIFDqj-l.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Feature highlights from each AllyHub release.
|
|
4
4
|
|
|
5
|
+
## 0.13.0
|
|
6
|
+
|
|
7
|
+
- **Decks and sheets work like PowerPoint and Excel.** The deck editor has PowerPoint's ribbon and every animation effect; the sheet editor has Excel's everyday commands, from filters by colour to Paste Special, and rich text in a cell. An export says what it leaves out.
|
|
8
|
+
- **A provenance record is `<file>.provenance`.** The record beside a file a tool made no longer ends in `.json`, so reading a folder's data skips it.
|
|
9
|
+
- **Choose how hard AllyHub's own agent thinks.** Studio offers each model's Effort, starting at medium.
|
|
10
|
+
- **More of each cloud tool's options**, such as the country TikTok is seen from or YouTube's counts and descriptions in search.
|
|
11
|
+
- **A new account starts with 200 credits**, and uploads and tools' results are let go 2 hours after they were used.
|
|
12
|
+
|
|
13
|
+
## 0.12.0
|
|
14
|
+
|
|
15
|
+
- **AllyHub learns what is used and what fails.** The CLI and Studio tell AllyHub which commands run, how long agents take and the errors they meet, never what you make or say. Studio's Settings or `ALLYHUB_TELEMETRY=off` turns it off; the list of what is told is public.
|
|
16
|
+
- **Credits are simpler.** Every plan gives 100 credits a dollar, and a new account starts with 100.
|
|
17
|
+
- **A call is checked against your credits before it runs**, so it never ends unpaid halfway; while your other calls are still running, it waits a moment instead.
|
|
18
|
+
- **Files kept up to a cap.** 1 GiB without a plan, 100 GiB with one; an upload or a tool's result is let go 7 days after it was last used.
|
|
19
|
+
- **A cloud Studio pauses when its idle time is up**, and is paid for no longer than that.
|
|
20
|
+
|
|
5
21
|
## 0.11.0
|
|
6
22
|
|
|
7
23
|
- **Reports.** A page written freely in HTML, CSS and JavaScript, read on a screen and sent as a link; rendered as one self-contained HTML file, a PDF or one long PNG, with report styles to start from (`allyhub report style`).
|
package/bin/allyhub.js
CHANGED
|
@@ -39,6 +39,6 @@ if (theirs !== undefined) {
|
|
|
39
39
|
);
|
|
40
40
|
await import(pathToFileURL(join(theirs, "bin", "allyhub.js")).href);
|
|
41
41
|
} else {
|
|
42
|
-
const {
|
|
43
|
-
process.exitCode = await
|
|
42
|
+
const { run } = await import("../dist/main.js");
|
|
43
|
+
process.exitCode = await run(process.argv.slice(2));
|
|
44
44
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{createHash as d}from"node:crypto";import{dirname as m,join as c,relative as
|
|
2
|
+
import{createHash as d}from"node:crypto";import{dirname as m,join as c,relative as o}from"node:path";import{REPORT_DEFAULTS as f,reportPicture as u}from"@allyhub/report-extension/cli";import{webp as l}from"@allyhub/image-render/webp";import{EXIT as h}from"@allyhub/protocol";import{CommandError as w}from"../../command.js";import{picturePath as g,save as k,workPath as E}from"./common.js";export function selectorName(t){const n=t.replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,40),e=d("sha256").update(t).digest("hex").slice(0,6);return n===""?e:`${n}-${e}`}export async function reportFrames(t){const n=o(t.root,m(t.file)),e=t.width??f.width;let r;try{r=await u({root:t.root,file:o(t.root,t.file).split("\\").join("/"),width:e,dark:t.dark,print:t.print,at:t.at})}catch(i){throw i instanceof Error&&i.name==="ReportPictureError"?new w("no-element",i.message,{exit:h.notFound,hint:"Write --at as a CSS selector of an element the page draws."}):i}const s=[`w${String(e)}`,...t.dark?["dark"]:[],...t.print?["print"]:[],...t.at===void 0?[]:[`at-${selectorName(t.at)}`]].join("-"),p=await k(g(t.cwd,t.out,c(E(t.root,"frames",n),`${s}.png`)),await l(r.png,90)),a=r.findings;return{mode:"frame",source:"report",report:n,out:p,width:e,pageHeight:r.pageHeight,bands:r.bands,missing:a.missing,outside:a.outside,thrown:a.thrown,...a.unsettled===void 0?{}:{unsettled:a.unsettled},blankCanvases:r.blankCanvases}}
|
package/dist/commands/frames.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{relative as _,sep as G}from"node:path";import{z as r}from"zod";import{formatConsole as H,formatProblem as N}from"../text/index.js";import{sizeOf as B}from"@allyhub/build";import{COMPARE_DEFAULTS as U}from"@allyhub/measure";import{CUT_REVIEW_DEFAULTS as J,cutLine as V,dbText as x,silenceText as q}from"@allyhub/video-measure";import{consoleJson as T}from"@allyhub/project";import{PAGE_CAPTURE_DEFAULTS as j}from"@allyhub/browser";import{itemIdOf as X}from"@allyhub/formats";import{EXIT as
|
|
3
|
-
`)}}if(e.grid!==void 0)throw m("bad-option","--grid draws a video file's frame at its own size: give the file.");const
|
|
4
|
-
`)}}const
|
|
5
|
-
`)[0]??""}`),...t.unsettled===void 0?[]:[t.unsettled]];return{value:t,text:[t.out,`${t.report}: ${String(t.width)} px wide, ${String(t.pageHeight)} px tall${t.bands>1?`, in ${String(t.bands)} bands side by side`:""}`,...n.map(
|
|
6
|
-
`)}}if(e.width!==void 0||e.dark||e.print)throw m("bad-option","--width, --dark and --print are a report's: name the report.");const s=e.item===void 0?void 0:await re(
|
|
7
|
-
`)}}if(e.page!==void 0)throw m("bad-option","--page is a doc's: name the doc.");if(e.range!==void 0)throw m("bad-option","--range is a sheet's: name the sheet.");const h=e.at!==void 0||e.part!==void 0||e.from!==void 0||e.to!==void 0;if(!h&&(e.clip!==void 0||e.beside!==void 0))throw m("bad-option","--clip and --beside draw moments: give --at, --part, or --from and --to.");if(!h&&!e.overlay){const{result:t,...n}=await y(e,i,"render",b=>ee(b,{cwd:a,root:
|
|
8
|
-
`)}}const f=!h&&e.overlay,{result:o,...p}=await y(e,i,"render",async t=>{const n=await Z(t,{cwd:a,root:
|
|
9
|
-
`)}}),framesCuts=w({name:"frames cuts",summary:"A review sheet per cut of a video (a cut take's jumps, part joins, a scenery camera's cuts): frames around it, waveform and level, the words each side, the sound at it",input:r.strictObject({...k,part:r.string().optional().describe("Only this part's cuts and its joins"),out:r.string().optional().describe("The folder the sheets go in; default .allyhub/work/cuts/"),params:D({span:r.number().positive().max(10).default(J.span).describe("Seconds shown on each side of a cut")})}),positional:["item"],output:r.looseObject({out:r.string(),cuts:r.array(r.looseObject({sheet:r.string()}))}),examples:["allyhub frames cuts launch/film","allyhub frames cuts launch/film --part hook"]},async(e,i)=>{const a=i.cwd,
|
|
10
|
-
`)}});const R=U;export const framesCompare=w({name:"frames compare",summary:"How a candidate picture differs from a reference, as numbers (ΔE, channels, SSIM, levels, grain, edges, regions) with a heatmap and a side-by-side: a piece's moment, a picture file or a video file's frame",input:r.strictObject({reference:r.string().describe("The reference picture (PNG, WebP, JPEG…)"),candidate:r.string().optional().describe("A piece (its id, its file without its extension, or its file; default the project's only one) at --at or --part's still; or a file by its extension: a picture (.png, .jpg, .webp…), or a video file's frame at --at (.mp4, .mov, .webm…)"),combo:k.combo,dir:
|
|
11
|
-
`)}}),framesWeb=w({name:"frames web",summary:"A web page's screenshot with its named elements' boxes in the image's pixels, for a screen demo",input:r.strictObject({url:r.string().describe("The page: an address, or an HTML file on this computer"),el:r.array(r.string()).optional().describe("An element to locate, name=selector (CSS, or text=<words>); [data-el] elements are found too"),click:r.array(r.string()).optional().describe("Selectors clicked in order before the shot (close a banner, open a dialog)"),full:r.boolean().default(!1).describe("The whole page, not one viewport"),out:r.string().optional().describe("Where the picture goes (a WebP), its boxes in <out>.elements.json beside it; default under .allyhub/work/pages/"),dir:
|
|
12
|
-
`),exit:s.missing.length>0?
|
|
2
|
+
import{relative as _,sep as G}from"node:path";import{z as r}from"zod";import{formatConsole as H,formatProblem as N}from"../text/index.js";import{sizeOf as B}from"@allyhub/build";import{COMPARE_DEFAULTS as U}from"@allyhub/measure";import{CUT_REVIEW_DEFAULTS as J,cutLine as V,dbText as x,silenceText as q}from"@allyhub/video-measure";import{consoleJson as T}from"@allyhub/project";import{PAGE_CAPTURE_DEFAULTS as j}from"@allyhub/browser";import{itemIdOf as X}from"@allyhub/formats";import{EXIT as C}from"@allyhub/protocol";import{defineCommand as w}from"../command.js";import{dir as O}from"../fields.js";import{parameters as D}from"../parameters.js";import{tellPresence as E}from"../presence.js";import{projectRoot as $}from"../project.js";import{VERSION_FIELDS as k,commandError as P,withVersion as y}from"../version.js";import{compareText as W,comparePictures as z}from"./frames/compare.js";import{isPicture as A,isVideo as M,usage as m}from"./frames/common.js";import{cutSheets as K}from"./frames/cuts.js";import{fileFrames as Q}from"./frames/file.js";import{pageShot as Y}from"./frames/page.js";import{pieceMoments as Z,stillsSheet as ee}from"./frames/piece.js";import{docPicture as te}from"./frames/doc.js";import{findDoc as re}from"@allyhub/doc-extension/cli";import{sheetPicture as oe}from"./frames/sheet.js";import{findSheet as I}from"@allyhub/sheet-extension/cli";import{reportFrames as ae}from"./frames/report.js";import{findReport as ne}from"@allyhub/report-extension/cli";function v(e){return[...e.problems.filter(a=>a.level==="error").map(N),...H(T(e.console))]}const S=e=>({problems:e.problems,...T(e.console)}),F=(e,i)=>$(e,i),ie=r.strictObject({...k,item:r.string().optional().describe("The piece (its id, its file without its extension, or its file; default the project's only one), a sheet, a doc, a report, or a video file: a path ending in .mp4, .mov, .webm, .m4v, .qt, .mkv or .avi is a file"),range:r.string().optional().describe("A sheet's: what to draw, a sheet (Summary), a range (Summary!B3:D9, or B3:D9 on the first sheet), columns (A:C) or rows (1:20); default its sheets, from A1"),page:r.string().optional().describe("A doc's: the pages to draw large, counted from 1 (2, 2-4, 1,5); default every page, small, tiled"),at:r.array(r.string()).optional().describe("Moments: seconds (from the start of --part when given) or anchors (@press, @/map a stretch's end, @press+0.2); a video file's are seconds. One is written as the frame itself, several are tiled. Without it, --part's still, or every part's still on one sheet. A report's: a CSS selector, that element alone"),width:r.number().int().min(200).max(3840).optional().describe("A report's: the page's width, CSS pixels (default 1440; 375 a phone's)"),dark:r.boolean().default(!1).describe("A report's: drawn as a reader who asks for dark sees it"),print:r.boolean().default(!1).describe("A report's: laid out for paper (@media print) at the width given, as one long picture"),part:r.string().optional().describe("The part --at, --from and --to count from; alone, its still"),from:r.number().optional().describe("A stretch of consecutive frames from this second (with --to), instead of --at"),to:r.number().optional().describe("The stretch's last second"),clip:r.string().optional().describe("Write the stretch as a small silent video, .gif, .mp4 or .webm by its extension; with --out, the grid too"),overlay:r.boolean().default(!1).describe("Draw over each tile the face boxes with ids, the person matte's outline, the covered areas and the text boxes (a deck's: each shape's box and name, and the lines nearly in line); places nothing. Alone, over every part's still"),beside:r.string().optional().describe("Another video file (a reference) whose frame at the same time goes on each tile's left"),grid:r.number().int().min(4).optional().describe("A video file at one --at: the frame at its own size with numbered lines every this many pixels"),out:r.string().optional().describe("Where the picture goes, always a WebP whatever the extension; default under .allyhub/work/frames/")});function se(e){const i=[["--combo",e.combo!==void 0],["--part",e.part!==void 0],["--beside",e.beside!==void 0],["--overlay",e.overlay]].filter(([,a])=>a).map(([a])=>a);if(i.length>0)throw m("bad-option",`${i.join(" and ")} ${i.length===1?"is":"are"} a piece's: a video file has no combos or parts.`)}function de(e){const i=[["--at",e.at!==void 0],["--part",e.part!==void 0],["--from",e.from!==void 0],["--to",e.to!==void 0],["--clip",e.clip!==void 0],["--overlay",e.overlay],["--beside",e.beside!==void 0],["--range",e.range!==void 0],["--combo",e.combo!==void 0]].filter(([,a])=>a).map(([a])=>a);if(i.length>0)throw m("bad-option",`${i.join(" and ")} ${i.length===1?"is":"are"} not a doc's: a doc has pages (--page), not moments.`)}function le(e){const i=[["--part",e.part!==void 0],["--from",e.from!==void 0],["--to",e.to!==void 0],["--clip",e.clip!==void 0],["--overlay",e.overlay],["--beside",e.beside!==void 0],["--range",e.range!==void 0],["--page",e.page!==void 0],["--combo",e.combo!==void 0],["--at with more than one selector",(e.at?.length??0)>1]].filter(([,a])=>a).map(([a])=>a);if(i.length>0)throw m("bad-option",`${i.join(" and ")} ${i.length===1?"is":"are"} not a report's: a report is one page (--width, --dark, --print, --at <selector>).`)}export const frames=w({name:"frames",summary:"Pictures of a piece over time, drawn as the render draws them: every part's still on a sheet (default), a moment, a stretch tiled or as a clip, overlays; a sheet's cells, or a range of them; a doc's pages as they print, with how many; a report's page at a width, light or dark, or laid out for print; or any video file's frames",input:ie,positional:["item"],output:r.looseObject({mode:r.enum(["sheet","frame","grid","clip"])}),examples:["allyhub frames launch/film","allyhub frames launch/film --at 2.5","allyhub frames launch/film --part hook --from 0 --to 1 --clip hook.gif","allyhub frames launch/film --at 1,2,3 --overlay","allyhub frames reference.mp4 --at 0,1,2","allyhub frames reference.mp4 --at 3 --grid 50","allyhub frames finance/budget --range 'Summary!A1:F20'","allyhub frames launch/plan","allyhub frames launch/plan --page 2-3","allyhub frames research/channels/channels --width 375","allyhub frames research/channels/channels --at '#tiers'"]},async(e,i)=>{const a=i.cwd;if(e.item!==void 0&&M(e.item)){se(e);const t=await Q({cwd:a,root:await F(a,e.dir),file:e.item,at:e.at,from:e.from,to:e.to,clip:e.clip,out:e.out,grid:e.grid}).catch(b=>{throw P(b)}),n=t.video,d=`${t.file} · ${n.duration.toFixed(2)} s · ${String(n.width)}×${String(n.height)} · ${String(n.fps)} fps`,g="clip"in t&&t.clip?`${t.clip.out} (${t.clip.type}, ${String(t.clip.frames)} frames at ${String(t.clip.fps)} fps, no sound)`:void 0;return{value:t,text:[d,..."out"in t?[`${t.out}${"tiles"in t?` (${String(t.tiles.length)} moments in ${String(t.cols)} columns)`:""}`]:[],...g?[g]:[]].join(`
|
|
3
|
+
`)}}if(e.grid!==void 0)throw m("bad-option","--grid draws a video file's frame at its own size: give the file.");const l=await $(a,e.dir);if(e.item!==void 0&&await I(l,a,e.item)!==void 0){const t=await oe({cwd:a,root:l,item:e.item,range:e.range,out:e.out}),n=await I(l,a,e.item);return n!==void 0&&Object.keys(t.at).length>0&&await E(l,{doing:"looking",item:X(_(l,n).split(G).join("/")),place:t.at}),{value:t,text:[t.out,...t.cut].join(`
|
|
4
|
+
`)}}const c=e.item===void 0?void 0:await ne(l,a,e.item);if(c!==void 0){le(e);const t=await ae({cwd:a,root:l,file:c,width:e.width,dark:e.dark,print:e.print,at:e.at?.[0],out:e.out}),n=[...t.missing.map(d=>`asks for ${d.path}, not in the project`),...t.outside.map(d=>`asks for ${d}, outside the project: refused`),...t.thrown.map(d=>`threw ${d.text.split(`
|
|
5
|
+
`)[0]??""}`),...t.unsettled===void 0?[]:[t.unsettled],...t.blankCanvases.map(d=>`${d.canvas} (${String(d.width)} × ${String(d.height)} px) has nothing drawn on it`)];return{value:t,text:[t.out,`${t.report}: ${String(t.width)} px wide, ${String(t.pageHeight)} px tall${t.bands>1?`, in ${String(t.bands)} bands side by side`:""}`,...n.map(d=>`${t.report}: ${d}`)].join(`
|
|
6
|
+
`)}}if(e.width!==void 0||e.dark||e.print)throw m("bad-option","--width, --dark and --print are a report's: name the report.");const s=e.item===void 0?void 0:await re(l,a,e.item);if(s!==void 0){de(e);const t=await te({cwd:a,root:l,file:s,page:e.page,out:e.out,progress:d=>{i.progress(d)}}),n=t.drawn.length===t.pages?"every page":`page${t.drawn.length===1?"":"s"} ${t.drawn.join(", ")}`;return{value:t,text:[t.out,`${t.doc}: ${String(t.pages)} page${t.pages===1?"":"s"} on ${String(t.paper.width)} × ${String(t.paper.height)} mm paper; ${n} drawn`].join(`
|
|
7
|
+
`)}}if(e.page!==void 0)throw m("bad-option","--page is a doc's: name the doc.");if(e.range!==void 0)throw m("bad-option","--range is a sheet's: name the sheet.");const h=e.at!==void 0||e.part!==void 0||e.from!==void 0||e.to!==void 0;if(!h&&(e.clip!==void 0||e.beside!==void 0))throw m("bad-option","--clip and --beside draw moments: give --at, --part, or --from and --to.");if(!h&&!e.overlay){const{result:t,...n}=await y(e,i,"render",b=>ee(b,{cwd:a,root:l,out:e.out})),{unit:d,...g}=t;return{value:{...g,...S(n)},text:[`${t.out} (${t.piece} · ${t.format} · ${String(t.parts.length)} ${t.parts.length===1?d.noun:d.plural})`,...v(n)].join(`
|
|
8
|
+
`)}}const f=!h&&e.overlay,{result:o,...p}=await y(e,i,"render",async t=>{const n=await Z(t,{cwd:a,root:l,at:f?t.timeline.parts.map(L=>String(L.still)):e.at,part:e.part,from:e.from,to:e.to,clip:e.clip,out:e.out,overlay:e.overlay,beside:e.beside}),d="tiles"in n?n.tiles[0]:void 0,g=n.mode==="frame"?n.t:n.stretch?.from??d?.t,b=n.mode==="frame"?n.part:d?.part;return g!==void 0&&!f&&await E(l,{doing:"looking",item:t.piece.place,place:{t:g,...b===void 0?{}:{part:b}}}),n}),u=[];if(o.mode==="frame"&&u.push(`${o.out} (${o.piece} · ${o.format} · ${o.part} · ${o.t.toFixed(2)} s)`),o.mode==="grid"){u.push(`${o.out} (${o.piece} · ${String(o.tiles.length)} moments in ${String(o.cols)} columns)`,` ${o.tiles.map(n=>`${n.t.toFixed(o.stretch?3:2)} ${n.part}`).join(" · ")}`);const t=[...new Set(o.tiles.flatMap(n=>n.overlay?.missing??[]))];t.length>0&&u.push(` Not measured: ${t.join(", ")}.`)}return o.stretch&&u.push(` Stretch ${o.stretch.from.toFixed(3)}–${o.stretch.to.toFixed(3)} s, one frame in ${String(o.stretch.every)}: ${String(o.stretch.frames)} frames.`),"clip"in o&&o.clip&&u.push(`${o.clip.out} (${o.clip.type}, ${String(o.clip.frames)} frames at ${String(o.clip.fps)} fps, no sound)`),{value:{...o,...S(p)},text:[...u,...v(p)].join(`
|
|
9
|
+
`)}}),framesCuts=w({name:"frames cuts",summary:"A review sheet per cut of a video (a cut take's jumps, part joins, a scenery camera's cuts): frames around it, waveform and level, the words each side, the sound at it",input:r.strictObject({...k,part:r.string().optional().describe("Only this part's cuts and its joins"),out:r.string().optional().describe("The folder the sheets go in; default .allyhub/work/cuts/"),params:D({span:r.number().positive().max(10).default(J.span).describe("Seconds shown on each side of a cut")})}),positional:["item"],output:r.looseObject({out:r.string(),cuts:r.array(r.looseObject({sheet:r.string()}))}),examples:["allyhub frames cuts launch/film","allyhub frames cuts launch/film --part hook"]},async(e,i)=>{const a=i.cwd,l=await $(a,e.dir),{result:c,...s}=await y(e,i,"render",o=>K(o,{cwd:a,root:l,part:e.part,out:e.out,review:{span:e.params.span}})),h=c.part===void 0?`${String(c.cuts.length)} cut${c.cuts.length===1?"":"s"}`:`${String(c.cuts.length)} of ${String(c.total)} cuts (part ${c.part} and its joins)`,f=[`${c.piece} · ${c.format} · ${h}; silence is sound under ${String(c.threshold)} dBFS`];for(const o of c.cuts){const p=o.sound?`level ${x(o.sound.levelDb)} / around ${x(o.sound.aroundDb)} dBFS, peak ${x(o.sound.peakDb)}, step ${o.sound.jumpDb<0?"−":"+"}${Math.abs(o.sound.jumpDb).toFixed(1)} dB`:"no sound";f.push(`${String(o.index).padStart(3)} ${o.t.toFixed(3).padStart(7)} s ${o.kind.padEnd(6)} ${V(o)}`,` silence at the cut: ${q(o.silence)} · ${p}`,` “${o.said.before}” | “${o.said.after}”${o.across?` · across the cut: “${o.across}”`:""}`,` ${o.sheet}`)}return{value:{...c,...S(s)},text:[...f,...v(s)].join(`
|
|
10
|
+
`)}});const R=U;export const framesCompare=w({name:"frames compare",summary:"How a candidate picture differs from a reference, as numbers (ΔE, channels, SSIM, levels, grain, edges, regions) with a heatmap and a side-by-side: a piece's moment, a picture file or a video file's frame",input:r.strictObject({reference:r.string().describe("The reference picture (PNG, WebP, JPEG…)"),candidate:r.string().optional().describe("A piece (its id, its file without its extension, or its file; default the project's only one) at --at or --part's still; or a file by its extension: a picture (.png, .jpg, .webp…), or a video file's frame at --at (.mp4, .mov, .webm…)"),combo:k.combo,dir:O,at:r.string().optional().describe("The moment: seconds (from the start of --part when given) or an anchor of the piece; a video file's are seconds (default 0)"),part:r.string().optional().describe("The piece's part --at counts from; alone, its still"),refCrop:r.string().optional().describe("Cut the reference to x,y,width,height, or to an element of the elements.json beside it (frames web writes one)"),crop:r.string().optional().describe("Cut the candidate to x,y,width,height before any resize"),encode:r.string().optional().describe("Draw the candidate through this encode first, as a platform serves it: codec:kbps, h264 or hevc (hevc:618)"),out:r.string().optional().describe("Where its files go, a path without extension; default under .allyhub/work/compare/"),params:D({resize:r.enum(["stretch","width","none"]).default(R.resize).describe("When sizes differ: stretch the candidate to the reference, scale it to its width, or compare the common area"),shift:r.number().int().min(0).max(32).default(R.shift).describe("Search the best offset within this many pixels each way")})}),positional:["reference","candidate"],output:r.looseObject({reference:r.string(),files:r.looseObject({side:r.string(),heatmap:r.string()})}),examples:["allyhub frames compare reference.png launch/film --at 2.5 --encode hevc:618","allyhub frames compare reference.png shot.webp --ref-crop cta","allyhub frames compare reference.png theirs.mp4 --at 3"]},async(e,i)=>{const a=i.cwd,l=e.params;if(!A(e.reference))throw m("bad-reference",`${e.reference} is not a picture: the reference comes first, a picture file (PNG, WebP, JPEG…), then the piece or file to compare with it.`,`For example: allyhub frames compare ${e.candidate!==void 0&&A(e.candidate)?e.candidate:"reference.png"} ${e.reference}`);const c=e.candidate!==void 0&&(A(e.candidate)||M(e.candidate))?e.candidate:void 0,s=p=>({cwd:a,root:p,reference:e.reference,file:c,at:e.at===void 0?void 0:[e.at],part:e.part,refCrop:e.refCrop,crop:e.crop,encode:e.encode,out:e.out,options:{shift:l.shift,resize:l.resize}});if(c!==void 0){if(e.combo!==void 0||e.part!==void 0)throw m("bad-option","--combo and --part are a piece's: the candidate is a file.");const p=await z(s(await F(a,e.dir)),void 0).catch(u=>{throw P(u)});return{value:p,text:W(p)}}const h=await $(a,e.dir),{result:f,...o}=await y({...e,item:e.candidate},i,"render",p=>z(s(h),p));return{value:{...f,...S(o)},text:[W(f),...v(o)].join(`
|
|
11
|
+
`)}}),framesWeb=w({name:"frames web",summary:"A web page's screenshot with its named elements' boxes in the image's pixels, for a screen demo",input:r.strictObject({url:r.string().describe("The page: an address, or an HTML file on this computer"),el:r.array(r.string()).optional().describe("An element to locate, name=selector (CSS, or text=<words>); [data-el] elements are found too"),click:r.array(r.string()).optional().describe("Selectors clicked in order before the shot (close a banner, open a dialog)"),full:r.boolean().default(!1).describe("The whole page, not one viewport"),out:r.string().optional().describe("Where the picture goes (a WebP), its boxes in <out>.elements.json beside it; default under .allyhub/work/pages/"),dir:O,size:r.string().default(`${String(j.width)}x${String(j.height)}`).describe("The viewport, WIDTHxHEIGHT in CSS pixels"),scale:r.number().min(1).max(4).default(j.scale).describe("Image pixels per CSS pixel; 2 draws a high-density screen, sharp when a camera goes in"),wait:r.number().int().min(0).optional().describe("Milliseconds to wait after loading and clicking")}),positional:["url"],output:r.looseObject({out:r.string(),elementsFile:r.string()}),examples:["allyhub frames web https://example.com --el cta=text=Sign\\ up --scale 2 --out assets/media/home","allyhub frames web page.html --click '#accept' --full"]},async(e,i)=>{const a=i.cwd,[l,c]=B(e.size),s=await Y({cwd:a,root:await F(a,e.dir),url:e.url,out:e.out,el:e.el,click:e.click,width:l,height:c,scale:e.scale,full:e.full,wait:e.wait});return{value:s,text:[`${s.out}: ${String(s.width)}×${String(s.height)}${s.scale===1?"":` (${String(s.scale)} image pixels per CSS pixel)`}, ${String(Object.keys(s.elements).length)} elements (${Object.keys(s.elements).join(", ")||"none"}) in ${s.elementsFile}`,...s.missing.length>0?[`Not found: ${s.missing.join(", ")} (the selector is wrong, or something must be opened with --click first).`]:[]].join(`
|
|
12
|
+
`),exit:s.missing.length>0?C.failed:C.ok}}),FRAMES_COMMANDS=[frames,framesCuts,framesCompare,framesWeb];
|
package/dist/main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as
|
|
3
|
-
`);return}const
|
|
4
|
-
`)),i.stdout(`${
|
|
5
|
-
`)},
|
|
6
|
-
`)},signal:
|
|
2
|
+
import{mkdir as P,writeFile as Y}from"node:fs/promises";import{tmpdir as F}from"node:os";import{dirname as V,join as O}from"node:path";import"@allyhub/stage-runtime/use";import{EXIT as m,describeCommand as T}from"@allyhub/protocol";import{WORK_DIR as X}from"@allyhub/formats";import{projectAt as q}from"./project.js";import{cutLong as z}from"./text/index.js";import{readArgs as Q}from"./args.js";import{CLI_VERSION as x}from"./cli-version.js";import{CommandError as C}from"./command.js";import{COMMAND_SOURCES as H,COMMANDS as W,allCommands as Z}from"./commands/index.js";import{contributedSpecs as tt}from"./commands/contributed.js";import{builtInExtensions as nt}from"./commands/extensions.js";import{commandHelp as _,groupHelp as et,listHelp as ot,workHelp as rt}from"./help.js";import{sdkDocs as it}from"./sdk-docs.js";import{cliTelemetry as st}from"./telemetry.js";import{turnOf as at}from"./turn.js";import{WORKS as ct,cloudNouns as lt,withJoined as J,workNamed as mt,workTitle as U}from"./works.js";const j={stdout:e=>process.stdout.write(e),stderr:e=>process.stderr.write(e),cwd:process.cwd(),env:process.env};export function findCommand(e,i=W){let p;for(const c of i){const d=c.spec.name.split(" ");d.every((f,h)=>e[h]===f)&&d.length>(p?.length??0)&&(p={command:c,length:d.length})}return p?{command:p.command,rest:e.slice(p.length)}:{rest:[...e]}}export async function resolveCommand(e,i,p=W,c=H){const d=findCommand(e,p);if(d.command){const f=d.command.spec.name;if(d.rest.length>0)for(const h of c.filter(o=>o.under===f)){const o=await h.resolve(e,i);if(o)return o}return d}for(const f of c){const h=await f.resolve(e,i);if(h)return h}return d}const B=e=>({...T(e.spec),...e.about?.value});export async function main(e,i=j,p,c=H,d){nt();const f=p??await Z(),h=e.includes("--json"),o=e.filter(t=>t!=="--json"),y=async(t,n,g)=>{if(h){i.stdout(`${JSON.stringify(t,null,2)}
|
|
3
|
+
`);return}const b=await q(i.cwd),l=O(b===void 0?O(F(),"allyhub"):O(b,X),"out",`${g.replaceAll(" ","-")}.txt`),u=z(n,l);u!==void 0&&(await P(V(l),{recursive:!0}),await Y(l,`${n}
|
|
4
|
+
`)),i.stdout(`${u??n}
|
|
5
|
+
`)},N=f.map(t=>t.spec),S=t=>N.filter(n=>t.length>0&&n.name.startsWith(`${t.join(" ")} `)),A=new AbortController,w={cwd:i.cwd,env:{ALLYHUB_CLIENT:`AllyHub-CLI/${x}`,...i.env},progress:t=>{i.stderr(`${t}
|
|
6
|
+
`)},signal:A.signal};if(o[0]==="--version"||o[0]==="-v")return await y({version:x},x,"version"),m.ok;if(o.length===0||o[0]==="help"||o[0]==="--help"||o[0]==="-h"){const t=o.slice(1).findIndex(r=>r.startsWith("-")),n=(t<0?o.slice(1):o.slice(1,t+1)).flatMap(r=>r.split(" ").filter(a=>a!=="")),g=await it(i.cwd).catch(()=>{}),b=async()=>{const r=await Promise.all(c.map(a=>a.nouns(w).then(G=>G.map(K=>({...K,work:a.works!==!1}))).catch(()=>{})));return r.some(a=>a===void 0)?void 0:r.flatMap(a=>a??[])},l=await tt(w);if(n.length===0){const r=await b();return await y({version:x,docs:g?.dir,works:ct.map(a=>({...J(a,l),title:U(a,r)})),commands:N.map(T),made:[...c.flatMap(a=>a.entries),...r??[]]},ot(N,c,r,g?.dir),"help"),m.ok}const u=n.length===1?mt(n[0]??""):void 0,k=u&&J(u,l);if(k){const r=k.cloud===void 0?[]:await b();return await y({...k,title:U(k,r),...k.cloud===void 0?{}:{cloudWorks:r&<(k,r)},docsDir:g?.dir},rt(k,N,c,g?.dir,r,l),`help ${n.join(" ")}`),m.ok}let v;try{v=await resolveCommand(n,w,f,c)}catch(r){return I(r)}const{command:s,rest:R}=v;if(s&&v.list===!0)return await M(s,R);const L=S(n);return!s&&L.length>0?(await y({commands:L.map(T)},et(n.join(" "),L),`help ${n.join(" ")}`),m.ok):!s||R.length>0?I(new C("unknown-command",`allyhub has no command "${n.join(" ")}".`,{exit:m.usage,hint:"allyhub help lists them and the works."})):(await y(B(s),_(s.spec,s.about?.lines,S(s.spec.name.split(" "))),`help ${s.spec.name}`),m.ok)}let D;try{D=await resolveCommand(o,w,f,c)}catch(t){return I(t)}const{command:$,rest:E}=D;if(!$){const t=S(o.slice(0,1));return I(new C("unknown-command",`allyhub has no command "${o.join(" ")}".`,{exit:m.usage,hint:t.length>0?`${o[0]??""} has these: ${t.map(n=>n.name).join(", ")}.`:"allyhub help lists them."}))}if(E.includes("--help")||E.includes("-h"))return await y(B($),_($.spec,$.about?.lines,S($.spec.name.split(" "))),`${$.spec.name} help`),m.ok;return await M($,E);async function M(t,n){const g=()=>{A.abort(new C("interrupted","Stopped.",{exit:m.interrupted}))};process.once("SIGINT",g);const b=Date.now();let l=m.failed;const u=await at(w.env,w.cwd),k=u===void 0?w:{...w,env:{...w.env,TRACEPARENT:u}};try{const v=Q(t.spec,n),s=await t.run(v,k);await y(s.value,s.text,t.spec.name),l=s.exit??m.ok}catch(v){l=I(v)}finally{process.off("SIGINT",g)}return await d?.({command:t.spec.name,ms:Date.now()-b,exit:l,...u===void 0?{}:{traceparent:u}}),l}function I(t){const n=t instanceof C?t:A.signal.aborted?new C("interrupted","Stopped.",{exit:m.interrupted}):new C("failed",t instanceof Error?t.message:String(t));return h?i.stdout(`${JSON.stringify({error:{code:n.code,message:n.message,...n.hint?{hint:n.hint}:{}}},null,2)}
|
|
7
7
|
`):i.stderr(`${n.message}${n.hint?`
|
|
8
8
|
${n.hint}`:""}
|
|
9
|
-
`),n.exit}}
|
|
9
|
+
`),n.exit}}export function run(e){return main(e,j,void 0,H,st({ALLYHUB_CLIENT:`AllyHub-CLI/${x}`,...j.env},i=>{j.stderr(i)}))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{clipSource as
|
|
2
|
+
import{clipSource as k}from"./decode.js";import{equalPower as z,gainAt as A}from"./envelope.js";import{playMusic as B}from"./music.js";import{shapes as C,shapeSound as H,soundLevel as q}from"./shape.js";import{synthSfx as J}from"./sfx.js";import{playVoice as K,voiceGroups as N}from"./voice.js";function Q(n,r,o){if(r.length===0)return;const s=n[0].length;for(let f=0;f<s;f++){const e=10**(A(r,f/o)/20);e!==1&&(n[0][f]=(n[0][f]??0)*e,n[1][f]=(n[1][f]??0)*e)}}function x(n,r,o,s,f,e){const m=Math.round(o.dur*s),y=Math.round(o.at*s),b=10**(o.gainDb/20),p=Math.min(Math.round(.01*s),Math.floor(m/4)),t=l=>l===void 0||l<=0?0:Math.min(Math.round(l*s),Math.floor(m/2)),i=t(o.fadeIn),h=t(o.fadeOut),c=(l,g)=>g>0?z(l/g):p>0&&l<p?l/p:1,a=[...o.envelope??[]],v=n[0].length,u=r[0].length,d=f===void 0?o.speed??1:1,S=f===void 0?o.from*s:o.from/f*s;for(let l=0;l<m;l++){const g=y+l;if(g<0||g>=v)continue;const F=d===1?Math.round(S)+l:S+l*d,M=Math.floor(F);if(M<0||M>=u)continue;const E=F-M,I=Math.min(M+1,u-1),w=g/s,O=a.length>0||e.length>0?10**((A(a,w)+A(e,w))/20):1,V=b*O*c(l,i)*c(m-1-l,h);for(let D=0;D<2;D++){const G=r[D]??r[0],L=G[M]??0,j=G[I]??0,P=n[D]??n[0];P[g]=(P[g]??0)+(L+(j-L)*E)*V}}}export function playSfx(n,r,o){if(!n.shape||!(C(n.shape)||n.shape.filter!==void 0))return{src:r,gainDb:n.gainDb};const s=q(r,o)?.lufs,f=[Float32Array.from(r[0]),Float32Array.from(r[1])];H(f,n.shape,o,0);const e=q(f,o)?.lufs;return e===void 0?{src:f,gainDb:n.gainDb}:n.level?{src:f,gainDb:n.level.target-e+n.level.gainDb}:{src:f,gainDb:n.gainDb+(s===void 0?0:s-e)}}function R(n,r,o){const s=J(n,r,o);return[s,s]}export function renderMix(n,r,o,s={}){const f=Math.round(n.duration*o),e=[new Float32Array(f),new Float32Array(f)],m=n.speechGain??[],y=k(r),{groups:b,dry:p}=N(n);for(const t of b){const[i,h]=K(t,n.duration,o,y);Q([i,h],m,o);for(let c=0;c<f;c++)e[0][c]=(e[0][c]??0)+(i[c]??0),e[1][c]=(e[1][c]??0)+(h[c]??0)}for(const t of p){const i=y(t);i&&x(e,i.src,t,o,i.stretched,m)}if(s.only==="voice")return e;for(const t of n.footage){const i=r(t.file,{});i&&x(e,i.src,t,o,void 0,[])}if(n.music){const t=n.music,i=r(t.file,t.shape?.filter?{filter:t.shape.filter}:{});if(i){const[h,c]=B(t,i.src,n.duration,o);for(let a=0;a<f;a++)e[0][a]=(e[0][a]??0)+(h[a]??0),e[1][a]=(e[1][a]??0)+(c[a]??0)}}for(const t of n.sfx){let i;if(t.file!==void 0?i=r(t.file,t.shape?.filter?{filter:t.shape.filter}:{})?.src:i=R(t.sound,o,t.seed),!i)continue;if(t.from!==void 0||t.length!==void 0){const u=Math.max(0,Math.round((t.from??0)*o)),d=t.length===void 0?i[0].length:Math.min(i[0].length,u+Math.round(t.length*o));i=[i[0].subarray(u,d),i[1].subarray(u,d)]}const h=playSfx(t,i,o),c=10**(h.gainDb/20),a=Math.round(t.at*o),v=h.src[0].length;for(let u=0;u<v;u++){const d=a+u;d<0||d>=f||(e[0][d]=(e[0][d]??0)+(h.src[0][u]??0)*c,e[1][d]=(e[1][d]??0)+(h.src[1][u]??0)*c)}}return e}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as y}from"node:fs/promises";import{missingFiles as
|
|
2
|
+
import{readFile as y}from"node:fs/promises";import{missingFiles as O,modelInfo as j}from"./model-info.js";import{takeVoice as N}from"./takes.js";import{join as h}from"node:path";import{genFileFor as $,readDataFile as F}from"@allyhub/formats";import{ONSET_RATE as S,cached as k,decodeMono as M,estimateTempo as T,hasMatte as D,mediaKindOf as E,onsetNovelty as I,probeMedia as J,readFaceTrack as K}from"@allyhub/media";import{mediaGen as x}from"@allyhub/piece";import{unheardSounds as A}from"@allyhub/piece";const G=new Set(["image","audio","video","font","model","environment"]),w=e=>e.replace(/\.[^./]+$/u,"");async function g(e){try{return JSON.parse(await y(e,"utf8"))}catch{return}}async function R(e){const d=F("words",await g(e));if(d.ok)return d.value.words.map(({confidence:s,...r})=>s===void 0?r:{...r,confidence:s})}async function U(e,d,s){return await k(e,"tempo",{version:1},{root:d},async()=>{const c=T(I(await M(e,S,s),S));return c?{bpm:c.bpm,confidence:c.confidence,beat:c.beats[0]??0}:null}).catch(()=>null)??void 0}export async function readMedia(e,d,s={}){const r=new Set(d),c={},p=s.runtimes?{runtimes:s.runtimes}:{};for(const a of d){const o=E(a);if(!o||!G.has(o))continue;const u=h(e,a);s.onFile?.(a);const t=await J(u,{root:e,...p}),i={path:a,sha256:t.sha256,kind:o,url:"",bytes:t.bytes,...t.width===void 0?{}:{width:t.width},...t.height===void 0?{}:{height:t.height},...t.duration===void 0?{}:{duration:t.duration},...t.rotation===void 0?{}:{rotation:t.rotation},...o==="video"?{audio:(t.audio??[]).length>0}:{}},v=`${w(a)}.words.json`;if((o==="audio"||o==="video")&&r.has(v)){const n=await R(h(e,v));if(n){i.words=n;const f=n.at(-1);i.duration===void 0&&f&&(i.duration=f.end);const m=n.length>0?await N(u,e,p):void 0;if(m){const b=A(n,{hop:m.hop,db:m.db,voicing:m.voicing});i.envelope=m.base64,i.speechDb=b.speech,i.sounds=b.sounds}}}else if(o==="audio"){const n=await U(u,e,p);n&&(i.tempo=n)}const l=$(a);if(r.has(l)){const n=await g(h(e,l)),f=n===void 0?{error:"not JSON"}:x(l,n,t.sha256);"gen"in f?i.gen=f.gen:i.genUnread={record:l,error:f.error}}if(o==="video"){const n=await K(e,t.sha256);n&&(i.faces=n),await D(e,t.sha256)&&(i.matte=!0)}if(o==="model"&&/\.(glb|gltf)$/iu.test(a)){const n=await k(u,"model",{version:1},{root:e},async()=>j(e,a,await y(u)));i.model=n.container==="gltf"?{...n,missing:await O(e,a)}:n}if(o==="image"&&r.has(`${w(a)}.elements.json`)){const n=F("elements",await g(h(e,`${w(a)}.elements.json`)));n.ok&&(i.elements=n.value)}c[a]=i}return c}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{colorOfFile as
|
|
2
|
+
import{colorOfFile as O}from"@allyhub/formats";import{isCombinable as S,isScatter as k,labelPositionsOf as w}from"./chart.js";const u=e=>O(e)??"dk1";function F(e,n){if(n.startsWith("/"))return n.slice(1);const i=e===""?[]:e.split("/");for(const s of n.split("/"))s===""||s==="."||(s===".."?i.pop():i.push(s));return i.join("/")}function p(e,n){if(e===void 0&&n===void 0)return;const i=e??{};return{...n===void 0?{}:{title:n},...i.min===void 0?{}:{minimum_scale:i.min},...i.max===void 0?{}:{maximum_scale:i.max},...i.major===void 0?{}:{major_unit:i.major},...i.gridlines===void 0?{}:{has_major_gridlines:i.gridlines},...i.visible===void 0?{}:{visible:i.visible},...i.format===void 0?{}:{number_format:i.format},...i.reverse===void 0?{}:{reverse_order:i.reverse},...i.gridline_color===void 0?{}:{gridline_color:u(i.gridline_color)},...i.line_color===void 0?{}:{line_color:u(i.line_color)}}}const A=e=>{if(!(e===void 0||e===!1))return e===!0?{show_value:!0}:{...e.value===void 0?{}:{show_value:e.value},...e.percentage===void 0?{}:{show_percentage:e.percentage},...e.category===void 0?{}:{show_category_name:e.category},...e.series===void 0?{}:{show_series_name:e.series},...e.format===void 0?{}:{number_format:e.format},...e.position===void 0?{}:{position:e.position},...e.size===void 0?{}:{size:e.size},...e.color===void 0?{}:{color:u(e.color)}}};function $(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e==null)return null;if(typeof e!="string")return;const n=e.trim();if(n==="")return null;const i=Number(n);return Number.isFinite(i)?i:void 0}export function chartOfFile(e,n){const i=A(e.labels),s=k(e.type);let l,m;const g=r=>({...r.color===void 0?{}:{color:u(r.color)},...r.format===void 0?{}:{number_format:r.format},...r.smooth===void 0?{}:{smooth:r.smooth},...r.line_width===void 0?{}:{line_width:r.line_width},...r.marker_size===void 0?{}:{marker_size:r.marker_size},...r.type===void 0?{}:{type:r.type},...r.secondary===void 0?{}:{secondary:r.secondary}});if(e.data!==void 0){let r;try{r=n.rows(e.data)}catch(o){n.problem(`${e.data} cannot be read: ${o instanceof Error?o.message:String(o)}`);return}if(!Array.isArray(r)||r.length===0){n.problem(`${e.data} holds no rows.`);return}const t=r,d=e.categories;if(typeof d!="string"){n.problem("with data, categories names its column.");return}const b=Object.keys(t[0]??{}),v=[d,...e.series.map(o=>typeof o=="string"?o:o.name)].filter(o=>!b.includes(o));if(v.length>0){n.problem(`${e.data} has no column ${v.join(", ")} (it has ${b.join(", ")}).`);return}l=t.map(o=>{const a=o[d];return typeof a=="string"||typeof a=="number"?String(a):""}),m=e.series.map(o=>{const a=typeof o=="string"?o:o.name,z=t.map((c,j)=>{const x=$(c[a]);return x===void 0?(n.problem(`${String(e.data)} row ${String(j+1)}: ${JSON.stringify(c[a])} in ${a} is not a number.`),null):x});return{name:a,values:z,...s?{x:t.map(c=>$(c[d])??null)}:{},...typeof o=="string"?{}:g(o)}})}else{if(typeof e.categories=="string"){n.problem("categories names a column, and there is no data to read.");return}if(e.categories===void 0&&!s){n.problem(`a ${e.type} chart has categories.`);return}l=e.categories??[];const r=[];for(const t of e.series){if(typeof t=="string"||!t.values){const d=typeof t=="string"?t:t.name;n.problem(`series ${d} has no values, and there is no data to read.`);return}if(s){if(t.x?.length!==t.values.length){n.problem(`series ${t.name} has an x for each of its values.`);return}}else t.values.length!==l.length&&n.problem(`series ${t.name} has ${String(t.values.length)} values for ${String(l.length)} categories.`);r.push({name:t.name,values:t.values,...s&&t.x?{x:t.x}:{},...g(t)})}m=r}!S(e.type)&&e.series.some(r=>typeof r!="string"&&(r.type!==void 0||r.secondary===!0))&&n.problem(`a ${e.type} chart combines with no other kind and has no second axis: only columns, lines and areas do.`);const f=i?.position;f!==void 0&&!w(e.type).includes(f)&&n.problem(`a ${e.type} chart has no label position ${f}, which PowerPoint would repair (it has ${w(e.type).join(", ")||"none"}).`);const _=p(e.value_axis,n.axisTitles?.value_axis),y=p(e.category_axis,n.axisTitles?.category_axis),h=p(e.secondary_axis,n.axisTitles?.secondary_axis);return{type:e.type,categories:l,series:m,...n.title===void 0?{}:{title:n.title},...e.legend===void 0?{}:{legend:e.legend},...i?{labels:i}:{},...e.gap_width===void 0?{}:{gap_width:e.gap_width},...e.overlap===void 0?{}:{overlap:e.overlap},...e.vary_by_categories===void 0?{}:{vary_by_categories:e.vary_by_categories},...e.category_colors===void 0?{}:{category_colors:e.category_colors.map(u)},...e.hole_size===void 0?{}:{hole_size:e.hole_size},..._?{value_axis:_}:{},...y?{category_axis:y}:{},...h?{secondary_axis:h}:{},...e.size===void 0?{}:{font_size:e.size},...e.title_size===void 0?{}:{title_size:e.title_size},...e.color===void 0?{}:{font_color:u(e.color)},...e.data===void 0?{}:{source:F(n.base,e.data)}}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{
|
|
3
|
-
`,b="2118791784",y="2140495176",
|
|
2
|
+
import{colorXml as V}from"./color.js";import{accentOf as I,CHART_DEFAULTS as m,chartDrawing as B,groupingOf as A,groupsOf as R,hasLines as W,hasMarkers as Z,isArea as X,isBar as L,isHorizontal as G,isLine as S,isRound as h,isScatter as w,labelPositionOf as H,variesOf as j}from"./chart.js";const Y="http://schemas.openxmlformats.org/drawingml/2006/chart",q="http://schemas.openxmlformats.org/drawingml/2006/main",K="http://schemas.openxmlformats.org/officeDocument/2006/relationships",J=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
|
+
`,b="2118791784",y="2140495176",M="2118791785",T="2140495177",Q={"&":"&","<":"<",">":">",'"':"""},ee=e=>{const n=e.charCodeAt(0);return n<32&&n!==9&&n!==10&&n!==13||n===65534||n===65535},d=e=>Array.from(e,n=>ee(n)?"":Q[n]??n).join("");function o(e,n={},...a){const r=Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>` ${s}="${d(typeof i=="boolean"?i?"1":"0":String(i))}"`).join(""),c=a.join("");return c===""?`<${e}${r}/>`:`<${e}${r}>${c}</${e}>`}const te=e=>V(e),x=e=>e===null?o("a:noFill"):o("a:solidFill",{},te(e)),t=(e,n)=>o(e,{val:typeof n=="boolean"?n?1:0:n}),f=(e,n)=>o("a:ln",n===void 0?{}:{w:Math.round(n*12700)},x(e)),O=(e,n)=>o("c:txPr",{},o("a:bodyPr"),o("a:lstStyle"),o("a:p",{},o("a:pPr",{},o("a:defRPr",e===void 0?{}:{sz:Math.round(e*100)},n===void 0?"":x(n))),o("a:endParaRPr",{lang:"en-US"}))),$=e=>o("c:strCache",{},t("c:ptCount",e.length),...e.map((n,a)=>o("c:pt",{idx:a},`<c:v>${d(n)}</c:v>`))),F=(e,n)=>o("c:numCache",{},`<c:formatCode>${d(e??"General")}</c:formatCode>`,t("c:ptCount",n.length),...n.flatMap((a,r)=>a===null?[]:[o("c:pt",{idx:r},`<c:v>${String(a)}</c:v>`)])),ne=(e,n)=>o("c:tx",{},n===void 0?`<c:v>${d(e.name)}</c:v>`:o("c:strRef",{},`<c:f>${d(n)}</c:f>`,$([e.name]))),oe=(e,n)=>n===void 0?"":o("c:xVal",{},o("c:numRef",{},`<c:f>${d(n)}</c:f>`,F("General",e.x??[])));function re(e,n,a,r){const c=n.color??I(a),s=h(e.type),i=w(e.type),l=S(e.type)||i,u=Z(e.type),z=l?o("c:spPr",{},W(e.type)?f(c,n.line_width??m.lineWidth):o("a:ln",{w:19050},x(null))):o("c:spPr",{},x(c),s?f("lt1",1):""),v=r.categories;return o("c:ser",{},t("c:idx",a),t("c:order",a),ne(n,r.name(a)),z,L(e.type)?t("c:invertIfNegative",!1):"",l?o("c:marker",{},t("c:symbol",u?"circle":"none"),u?t("c:size",n.marker_size??m.marker):"",u?o("c:spPr",{},x(c),f(c)):""):"",...j(e)&&!l&&!X(e.type)?e.categories.map((C,p)=>o("c:dPt",{},t("c:idx",p),L(e.type)?t("c:invertIfNegative",!1):"",t("c:bubble3D",!1),o("c:spPr",{},x(e.category_colors?.[p]??I(p)),s?f("lt1",1):""))):[],i?oe(n,r.x?.(a)):v===void 0?"":o("c:cat",{},r.numeric===!0?o("c:numRef",{},`<c:f>${d(v)}</c:f>`,F(r.categoryFormat??"General",r.categoryNumbers??e.categories.map(C=>{const p=Number(C);return C===""||!Number.isFinite(p)?null:p}))):o("c:strRef",{},`<c:f>${d(v)}</c:f>`,$(e.categories))),o(i?"c:yVal":"c:val",{},o("c:numRef",{},`<c:f>${d(r.values(a))}</c:f>`,F(n.number_format,n.values))),l?t("c:smooth",n.smooth===!0||e.type==="scatter-smooth"):"")}function _(e){const n=e.labels;if(!n)return"";const a=n.show_percentage===!0,r=H(e);return o("c:dLbls",{},n.number_format===void 0?"":o("c:numFmt",{formatCode:n.number_format,sourceLinked:0}),n.size===void 0&&n.color===void 0&&!h(e.type)?"":O(n.size,n.color??(h(e.type)?"lt1":void 0)),r===void 0?"":t("c:dLblPos",r),t("c:showLegendKey",!1),t("c:showVal",n.show_value??!a),t("c:showCatName",n.show_category_name===!0),t("c:showSerName",n.show_series_name===!0),t("c:showPercent",a),t("c:showBubbleSize",!1))}function ce(e,n){const a=R(e);return a.length<=1?E(e,e.series.map((r,c)=>c),n,!1):a.map(r=>E({...e,type:r.kind},r.series,n,r.secondary)).join("")}function E(e,n,a,r){const c=n.map(l=>{const u=e.series[l];return u?re(e,u,l,a):""}).join(""),s=A(e.type),i=r?t("c:axId",M)+t("c:axId",T):t("c:axId",b)+t("c:axId",y);if(h(e.type)){const l=e.type==="pie";return o(l?"c:pieChart":"c:doughnutChart",{},t("c:varyColors",j(e)),c,_(e),t("c:firstSliceAng",0),l?"":t("c:holeSize",e.hole_size??50))}if(w(e.type))return o("c:scatterChart",{},t("c:scatterStyle","lineMarker"),t("c:varyColors",!1),c,_(e),i);if(L(e.type)){const l=s!=="clustered";return o("c:barChart",{},t("c:barDir",G(e.type)?"bar":"col"),t("c:grouping",s),t("c:varyColors",j(e)),c,_(e),t("c:gapWidth",e.gap_width??150),e.overlap!==void 0||l?t("c:overlap",e.overlap??100):"",i)}return o(S(e.type)?"c:lineChart":"c:areaChart",{},t("c:grouping",s),t("c:varyColors",!1),c,_(e),S(e.type)?t("c:marker",!0):"",i)}const g=e=>o("c:scaling",{},t("c:orientation",e.reverse_order===!0?"maxMin":"minMax"),e.maximum_scale===void 0?"":t("c:max",e.maximum_scale),e.minimum_scale===void 0?"":t("c:min",e.minimum_scale)),N=e=>o("c:spPr",{},f(e.line_color??{rgb:m.axisLine},m.gridWidth)),k=e=>e.has_major_gridlines===!0?o("c:majorGridlines",{},o("c:spPr",{},f(e.gridline_color??{rgb:m.gridline},m.gridWidth))):"",U=(e,n)=>o("c:rich",{},o("a:bodyPr"),o("a:lstStyle"),...e.split(`
|
|
4
|
+
`).map(a=>o("a:p",{},o("a:pPr",{},o("a:defRPr",{sz:n,b:0})),o("a:r",{},o("a:rPr",{lang:"en-US",sz:n,b:0}),`<a:t>${d(a)}</a:t>`)))),P=(e,n)=>e===void 0||e===""?"":o("c:title",{},o("c:tx",{},U(e,n)),t("c:overlay",!1));function ae(e,n){if(h(e.type))return"";const a=w(e.type),r=G(e.type),c=e.category_axis??{},s={has_major_gridlines:!0,...e.value_axis},i=A(e.type)==="percentStacked",l=s.number_format??(i?"0%":e.series[0]?.number_format??"General"),u=Math.round((e.font_size??m.fontSize)*100);return(a?o("c:valAx",{},t("c:axId",b),g(c),t("c:delete",c.visible===!1),t("c:axPos","b"),k(c),P(c.title,u),o("c:numFmt",{formatCode:c.number_format??"General",sourceLinked:c.number_format===void 0?1:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),N(c),t("c:crossAx",y),t("c:crosses","autoZero"),t("c:crossBetween","midCat"),c.major_unit===void 0?"":t("c:majorUnit",c.major_unit)):o("c:catAx",{},t("c:axId",b),g(c),t("c:delete",c.visible===!1),t("c:axPos",r?"l":"b"),k(c),P(c.title,u),n?.numeric===!0?o("c:numFmt",{formatCode:c.number_format??n.categoryFormat??"General",sourceLinked:c.number_format===void 0?1:0}):o("c:numFmt",{formatCode:"General",sourceLinked:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),N(c),t("c:crossAx",y),t("c:crosses","autoZero"),t("c:auto",!0),t("c:lblAlgn","ctr"),t("c:lblOffset",100),t("c:noMultiLvlLbl",!1)))+o("c:valAx",{},t("c:axId",y),g(s),t("c:delete",s.visible===!1),t("c:axPos",r?"b":"l"),k(s),P(s.title,u),o("c:numFmt",{formatCode:l,sourceLinked:s.number_format===void 0&&!i?1:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),o("c:spPr",{},f(null)),t("c:crossAx",b),t("c:crosses","autoZero"),t("c:crossBetween",X(e.type)||a?"midCat":"between"),s.major_unit===void 0?"":t("c:majorUnit",s.major_unit))+se(e,u)}function se(e,n){const a=R(e).find(i=>i.secondary);if(!a)return"";const r=e.secondary_axis??{},c=A(a.kind)==="percentStacked",s=r.number_format??(c?"0%":e.series[a.series[0]??0]?.number_format??"General");return o("c:catAx",{},t("c:axId",M),g({}),t("c:delete",!0),t("c:axPos","b"),o("c:numFmt",{formatCode:"General",sourceLinked:1}),t("c:majorTickMark","out"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),t("c:crossAx",T),t("c:crosses","autoZero"),t("c:auto",!0),t("c:lblAlgn","ctr"),t("c:lblOffset",100),t("c:noMultiLvlLbl",!1))+o("c:valAx",{},t("c:axId",T),g(r),t("c:delete",r.visible===!1),t("c:axPos","r"),k(r),P(r.title,n),o("c:numFmt",{formatCode:s,sourceLinked:r.number_format===void 0&&!c?1:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),o("c:spPr",{},f(null)),t("c:crossAx",M),t("c:crosses","max"),t("c:crossBetween","between"),r.major_unit===void 0?"":t("c:majorUnit",r.major_unit))}const ie={bottom:"b",top:"t",left:"l",right:"r"};function le(e,n){const a=n.width,r=n.height,{plot:c}=B(e,a,r),s=i=>Number(i.toFixed(5));return o("c:layout",{},o("c:manualLayout",{},t("c:layoutTarget","inner"),t("c:xMode","edge"),t("c:yMode","edge"),t("c:x",s(c.x/a)),t("c:y",s(c.y/r)),t("c:w",s(c.width/a)),t("c:h",s(c.height/r))))}const D=o("c:spPr",{},o("a:noFill"),o("a:ln",{},o("a:noFill")));export function chartSpaceXml(e,n){const a=e.title!==void 0&&e.title!==""?e.title:void 0,r=e.font_size??m.fontSize,c=Math.round((e.title_size??r*m.titleScale)*100);return J+o("c:chartSpace",{"xmlns:c":Y,"xmlns:a":q,"xmlns:r":K},t("c:date1904",!1),t("c:roundedCorners",!1),o("c:chart",{},a===void 0?"":o("c:title",{},o("c:tx",{},n.titleRef===void 0?U(a,c):o("c:strRef",{},`<c:f>${d(n.titleRef)}</c:f>`,$([a]))),t("c:overlay",!1)),t("c:autoTitleDeleted",a===void 0),o("c:plotArea",{},n.frame?le(e,n.frame):o("c:layout"),ce(e,n.refs),ae(e,n.refs),n.frameless===!0?D:""),e.legend===void 0?"":o("c:legend",{},t("c:legendPos",ie[e.legend]),t("c:overlay",e.legend_overlay===!0)),t("c:plotVisOnly",n.plotVisible??!0),t("c:dispBlanksAs","gap")),n.frameless===!0?D:"",O(r,e.font_color??"dk1"),n.tail??"")}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{format as Vt,isValidFormat as Rt}from"numfmt";import{brightened as Zt}from"@allyhub/ooxml/brightness";export const themeColor=(t,s=0)=>s===0?t:{theme_color:t,brightness:s},themeColorOf=t=>typeof t=="string"?t:"theme_color"in t?t.theme_color:void 0;export function colorRgb(t,s){return typeof t=="string"?s[t]:"rgb"in t?t.rgb:Zt(s[t.theme_color],t.brightness)}export const CHART_DEFAULTS={fontSize:12,titleScale:1.2,gapWidth:150,holeSize:50,margin:6,gridline:"#D9D9D9",axisLine:"#BFBFBF",letter:.55,lineWidth:2.25,gridWidth:.75,marker:5};const Ft=["accent1","accent2","accent3","accent4","accent5","accent6"];export const accentOf=t=>Ft[t%Ft.length]??"accent1",isBar=t=>t.startsWith("column")||t.startsWith("bar"),isHorizontal=t=>t.startsWith("bar"),isLine=t=>t.startsWith("line"),isArea=t=>t.startsWith("area"),isRound=t=>t==="pie"||t==="doughnut",isScatter=t=>t.startsWith("scatter"),hasLines=t=>!isScatter(t)||t!=="scatter",hasMarkers=t=>t==="line-markers"||t==="scatter"||t==="scatter-lines",groupingOf=t=>t.endsWith("-100")?"percentStacked":t.endsWith("-stacked")?"stacked":isBar(t)?"clustered":"standard";export function labelPositionsOf(t){return isArea(t)||t==="doughnut"?[]:t==="pie"?["bestFit","outEnd","inEnd","ctr"]:isLine(t)||isScatter(t)?["t","b","l","r","ctr"]:groupingOf(t)==="clustered"?["outEnd","inEnd","ctr","inBase"]:["inEnd","ctr","inBase"]}export function labelPositionOf(t){const s=labelPositionsOf(t.type),h=t.labels?.position;if(h!==void 0&&s.includes(h))return h;if(s.length!==0)return t.type==="pie"?"ctr":isLine(t.type)||isScatter(t.type)?"t":groupingOf(t.type)==="clustered"?"outEnd":"ctr"}export const isCombinable=t=>t.startsWith("column")||isLine(t)||isArea(t);export function groupsOf(t){const s=isCombinable(t.type),h=[];t.series.forEach((o,c)=>{const n=o.type!==void 0&&s&&isCombinable(o.type)?o.type??t.type:t.type,S=s&&o.secondary===!0,_=h.find(O=>O.kind===n&&O.secondary===S);_?_.series.push(c):h.push({kind:n,secondary:S,series:[c]})});const r=o=>(o.secondary?3:0)+(isArea(o.kind)?0:isBar(o.kind)?1:2);return h.sort((o,c)=>r(o)-r(c))}export const variesOf=t=>t.vary_by_categories??isRound(t.type);export function formatValue(t,s="General"){return s==="General"||!Rt(s)?String(Number(t.toPrecision(10))):Vt(s,t)}const Ut=[1,2,5,10];export function chartScale(t,s,h,r,o={}){const c=t>0&&(s-t)/s<.16666666666666666?t:Math.min(t,0),a=s<=0&&t<0?0:s,n=o.minimum_scale??c,S=o.maximum_scale??a,_=S>n?S-n:1,O=Math.max(1,Math.floor(h/r)),k=_/O,P=10**Math.floor(Math.log10(k)),N=o.major_unit??(Ut.find(v=>v*P>=k)??10)*P,z=(v,j)=>Number((j(Number((v/N).toFixed(9)))*N).toPrecision(12)),q=a>0?a+_*.05:a===c?_:a,x=o.maximum_scale??z(q,Math.ceil),Z=c<0?c-_*.05:c,V=o.minimum_scale??z(Z,Math.floor),D=[],y=Math.round((x-V)/N);for(let v=0;v<=y;v++)D.push(Number((V+v*N).toPrecision(12)));return{min:V,max:x,major:N,ticks:D}}const it=(t,s)=>{let h=0;for(const r of t)h+=(r.codePointAt(0)??0)>11903?1:CHART_DEFAULTS.letter;return h*s},m=t=>String(Number(t.toFixed(3)));function jt(t){const s=h=>t[Math.max(0,Math.min(t.length-1,h))]??[0,0];return t.map(([h,r],o)=>{if(o===0)return`M${m(h)} ${m(r)}`;const[c,a]=s(o-2),[n,S]=s(o-1),[_,O]=s(o+1),k=`${m(n+(h-c)/6)} ${m(S+(r-a)/6)}`,P=`${m(h-(_-n)/6)} ${m(r-(O-S)/6)}`;return`C${k} ${P} ${m(h)} ${m(r)}`}).join(" ")}const gt=t=>t.map(([s,h],r)=>`${r===0?"M":"L"}${m(s)} ${m(h)}`).join(" ");function qt(t,s,h,r,o,c){const a=(O,k)=>`${m(t+O*Math.sin(k))} ${m(s-O*Math.cos(k))}`,n=c-o>=Math.PI*2?o+Math.PI*2-1e-4:c,S=n-o>Math.PI?1:0,_=`M${a(h,o)} A${m(h)} ${m(h)} 0 ${String(S)} 1 ${a(h,n)}`;return r<=0?`${_} L${m(t)} ${m(s)} Z`:`${_} L${a(r,n)} A${m(r)} ${m(r)} 0 ${String(S)} 0 ${a(r,o)} Z`}function Nt(t,s,h,r){const o=r*1.5;return s!==void 0&&s!==""&&(t.bottom-=o),h!==void 0&&h!==""&&(t.left+=o),{x:t.left-o/2,y:t.bottom+o/2}}function Bt(t,s,h,r,o,c,a){r!==void 0&&r!==""&&t.words.push({x:s.x+s.width/2,y:h.y,text:r,size:c,anchor:"middle",color:a}),o!==void 0&&o!==""&&t.words.push({x:h.x,y:s.y+s.height/2,text:o,size:c,anchor:"middle",color:a,rotate:-90})}const xt=(t,s,h,r,o)=>{const c=t.labels;if(!c)return"";const a=isRound(t.type),n=[];return c.show_series_name&&n.push(r.name),c.show_category_name&&n.push(o),(c.show_value??!(c.show_percentage??!1))&&n.push(formatValue(s,c.number_format??r.number_format)),c.show_percentage&&a&&n.push(formatValue(h,c.number_format??"0%")),n.join(", ")};function Jt(t,s,h,r,o){const c=CHART_DEFAULTS,a=t.category_axis??{},n=t.value_axis??{},S=Nt(h,a.title,n.title,r),_=t.series.map(f=>f.values.flatMap((W,B)=>{const I=f.x?.[B]??(f.x?null:B+1);return I===null||W===null?[]:[[I,W]]})),O=_.flat().map(f=>f[0]),k=_.flat().map(f=>f[1]),P=f=>f.length>0?Math.min(...f):0,N=f=>f.length>0?Math.max(...f):1,z=n.number_format??t.series[0]?.number_format??"General",q=a.number_format??"General",x=r*.5,Z=chartScale(P(k),N(k),h.bottom-h.top,r*2.4,n),V=n.visible===!1?0:Math.max(0,...Z.ticks.map(f=>it(formatValue(f,z),r)))+x,D=a.visible===!1?0:r*1.2+x,y={x:h.left+V,y:h.top,width:h.right-h.left-V,height:h.bottom-h.top-D};s.plot=y,Bt(s,y,S,a.title,n.title,r,o);const v=chartScale(P(O),N(O),y.width,r*5,a),j=chartScale(P(k),N(k),y.height,r*2.4,n),U=f=>y.x+(Math.min(v.max,Math.max(v.min,f))-v.min)/(v.max-v.min)*y.width,G=f=>y.y+y.height-(Math.min(j.max,Math.max(j.min,f))-j.min)/(j.max-j.min)*y.height;for(const f of j.ticks){const W=G(f);(n.has_major_gridlines??!0)&&s.grid.push({d:`M${m(y.x)} ${m(W)} H${m(y.x+y.width)}`,color:n.gridline_color??{rgb:c.gridline},width:c.gridWidth}),n.visible!==!1&&s.words.push({x:y.x-x,y:W,text:formatValue(f,z),size:r,anchor:"end",color:o})}for(const f of v.ticks){const W=U(f);a.has_major_gridlines===!0&&s.grid.push({d:`M${m(W)} ${m(y.y)} V${m(y.y+y.height)}`,color:a.gridline_color??{rgb:c.gridline},width:c.gridWidth}),a.visible!==!1&&s.words.push({x:W,y:y.y+y.height+x+r*.6,text:formatValue(f,q),size:r,anchor:"middle",color:o})}s.axes.push({d:`M${m(y.x)} ${m(G(Math.max(j.min,Math.min(j.max,0))))} H${m(y.x+y.width)}`,color:a.line_color??{rgb:c.axisLine},width:c.gridWidth}),t.series.forEach((f,W)=>{const B=f.color??accentOf(W),I=(_[W]??[]).map(([J,R])=>[U(J),G(R)]);if(I.length!==0&&(hasLines(t.type)&&s.lines.push({d:t.type==="scatter-smooth"||f.smooth===!0?jt(I):gt(I),color:B,width:f.line_width??c.lineWidth,series:W}),hasMarkers(t.type)))for(const[J,R]of I)s.dots.push({x:J,y:R,r:(f.marker_size??c.marker)/2,color:B})})}export function chartDrawing(t,s,h){const r=CHART_DEFAULTS,o=t.font_size??r.fontSize,c=t.font_color??"dk1",a={grid:[],shapes:[],boxes:[],lines:[],axes:[],dots:[],keys:[],words:[],plot:{x:0,y:0,width:0,height:0}},n={left:r.margin,top:r.margin,right:s-r.margin,bottom:h-r.margin};if(t.title!==void 0&&t.title!==""){const e=t.title_size??o*r.titleScale;a.words.push({x:s/2,y:n.top+e*.7,text:t.title,size:e,anchor:"middle",color:c}),n.top+=e*1.6}const S=isRound(t.type),_=variesOf(t),O=(e,i)=>_?t.category_colors?.[i]??accentOf(i):t.series[e]?.color??accentOf(e);if(t.legend!==void 0){const e=_?t.categories:t.series.map(d=>d.name),i=o*.6,g=o*.4,l=o*1.5,b=e.map(d=>i+g+it(d,o)),F=(d,w,u)=>{a.keys.push({x:w,y:u-i/2,width:i,height:i,color:_?t.category_colors?.[d]??accentOf(d):t.series[d]?.color??accentOf(d),series:_?0:d,category:_?d:0}),a.words.push({x:w+i+g,y:u,text:e[d]??"",size:o,anchor:"start",color:c})};if(t.legend==="top"||t.legend==="bottom"){const d=b.reduce((E,M)=>E+M,0)+o*(e.length-1),w=t.legend==="top"?n.top+l/2:n.bottom-l/2;let u=(s-d)/2;e.forEach((E,M)=>{F(M,u,w),u+=(b[M]??0)+o}),t.legend_overlay!==!0&&(t.legend==="top"?n.top+=l:n.bottom-=l)}else{const d=Math.max(0,...b),w=t.legend==="left"?n.left:n.right-d,u=(n.top+n.bottom-l*e.length)/2+l/2;e.forEach((E,M)=>{F(M,w,u+M*l)}),t.legend_overlay!==!0&&(t.legend==="left"?n.left+=d+o:n.right-=d+o)}}const k=t.labels,P=k?.size??o,N=k?.color??c,z=(e,i,g,l,b=N)=>{g!==""&&a.words.push({x:e,y:i,text:g,size:P,anchor:l,color:b})};if(S){const e=t.series[0],i=(e?.values??[]).map(u=>Math.max(0,u??0)),g=i.reduce((u,E)=>u+E,0),l=Math.max(0,Math.min(n.right-n.left,n.bottom-n.top)/2),b=(n.left+n.right)/2,F=(n.top+n.bottom)/2,d=t.type==="doughnut"?l*((t.hole_size??r.holeSize)/100):0;a.plot={x:b-l,y:F-l,width:l*2,height:l*2};let w=0;return i.forEach((u,E)=>{const M=g>0?u/g:0,$=w+M*Math.PI*2;if(M>0){a.shapes.push({d:qt(b,F,l,d,w,$),color:"lt1",width:1,fill:O(0,E),series:0,category:E});const A=(w+$)/2,T=d>0?(l+d)/2:labelPositionOf(t)==="inEnd"?l*.85:l*.6;e&&z(b+T*Math.sin(A),F-T*Math.cos(A),xt(t,u,M,e,t.categories[E]??""),"middle",k?.color??"lt1")}w=$}),a}if(isScatter(t.type))return Jt(t,a,n,o,c),a;const q=Math.max(1,t.categories.length),x=isHorizontal(t.type),Z=groupsOf(t),V=Z.every(e=>e.secondary)?Z.map(e=>({...e,secondary:!1})):Z,D=t.series.map(e=>t.categories.map((i,g)=>e.values[g]??null)),y=V.map(e=>{const i=groupingOf(e.kind),g=i!=="clustered"&&i!=="standard",l=i==="percentStacked",b=t.categories.map((F,d)=>e.series.reduce((w,u)=>w+Math.abs(D[u]?.[d]??0),0));return{...e,stacked:g,percent:l,totals:b}}),v=(e,i,g)=>{const l=D[i]?.[g];if(l==null)return null;const b=e.totals[g]??0;return e.percent?b>0?l/b:0:l},j=e=>{let i=0,g=0,l=1/0,b=!1;for(const u of y)if(u.secondary===e&&(b||=u.percent,t.categories.forEach((E,M)=>{let $=0,A=0;for(const T of u.series){const C=v(u,T,M)??0;u.stacked?C>=0?$+=C:A+=C:($=Math.max($,C),A=Math.min(A,C))}g=Math.max(g,$),i=Math.min(i,A)}),!u.stacked))for(const E of u.series)for(const M of D[E]??[])M!==null&&(l=Math.min(l,M));y.every(u=>u.secondary!==e||!u.stacked)&&Number.isFinite(l)&&l>0&&(i=l),b&&(g=1,i=Math.min(i,0));const d=y.find(u=>u.secondary===e),w=d===void 0?void 0:d.series[0];return{low:i,high:g,percent:b,format:w===void 0?void 0:t.series[w]?.number_format}},U=j(!1),G=y.some(e=>e.secondary)?j(!0):void 0,f=t.value_axis??{},W=t.secondary_axis??{},B=t.category_axis??{},I=f.number_format??(U.percent?"0%":U.format??"General"),J=W.number_format??(G?.percent===!0?"0%":G?.format??"General"),R=(e,i,g,l)=>chartScale(e.low,e.high,g,l,{...i,...e.percent?{maximum_scale:i.maximum_scale??1}:{}}),yt=x?n.right-n.left:n.bottom-n.top,at=x?o*5:o*2.4,It=R(U,f,yt,at),bt=f.visible===!1?[]:It.ticks.map(e=>formatValue(e,I)),Mt=Math.max(0,...bt.map(e=>it(e,o))),wt=G===void 0||W.visible===!1?0:Math.max(0,...R(G,W,yt,at).ticks.map(e=>it(formatValue(e,J),o))),ct=B.visible!==!1,_t=ct?Math.max(0,...t.categories.map(e=>it(e,o))):0,H=o*.5,$t=x?f.title:B.title,kt=x?B.title:f.title,zt=Nt(n,$t,kt,o),p=x?{x:n.left+(ct?_t+H:0),y:n.top,width:0,height:n.bottom-n.top-(f.visible===!1?0:o*1.2+H)}:{x:n.left+(f.visible===!1?0:Mt+H),y:n.top,width:0,height:n.bottom-n.top-(ct?o*1.2+H:0)};p.width=n.right-p.x-(x&&bt.length>0?Mt/2:0)-(wt>0?wt+H:0),a.plot=p,Bt(a,p,zt,$t,kt,o,c);const ft=x?p.width:p.height,et=R(U,f,ft,at),ot=G===void 0?void 0:R(G,W,ft,at),vt=(e,i)=>(Math.min(e.max,Math.max(e.min,i))-e.min)/(e.max-e.min)*ft,ut=(e,i)=>x?p.x+vt(e,i):p.y+p.height-vt(e,i),Wt=e=>ut(et,e),Et=y.every(e=>isArea(e.kind)),St=B.reverse_order===!0,Ot=x?!St:St,mt=(x?p.height:p.width)/q,Pt=Et?(x?p.height:p.width)/Math.max(1,q-1):mt,pt=e=>{const i=Et?e*Pt:(e+.5)*mt,g=x?p.height:p.width,l=Ot?g-i:i;return(x?p.y:p.x)+l},At=Wt(Math.max(et.min,Math.min(et.max,0)));for(const e of et.ticks){const i=Wt(e);(f.has_major_gridlines??!0)&&a.grid.push({d:x?`M${m(i)} ${m(p.y)} V${m(p.y+p.height)}`:`M${m(p.x)} ${m(i)} H${m(p.x+p.width)}`,color:f.gridline_color??{rgb:r.gridline},width:r.gridWidth}),f.visible!==!1&&a.words.push(x?{x:i,y:p.y+p.height+H+o*.6,text:formatValue(e,I),size:o,anchor:"middle",color:c}:{x:p.x-H,y:i,text:formatValue(e,I),size:o,anchor:"end",color:c})}if(ot&&W.visible!==!1)for(const e of ot.ticks)a.words.push({x:p.x+p.width+H,y:ut(ot,e),text:formatValue(e,J),size:o,anchor:"start",color:c});if(a.axes.push({d:x?`M${m(At)} ${m(p.y)} V${m(p.y+p.height)}`:`M${m(p.x)} ${m(At)} H${m(p.x+p.width)}`,color:B.line_color??{rgb:r.axisLine},width:r.gridWidth}),ct){const e=x?o*1.3:_t+o,i=Math.max(1,Math.ceil(e/Math.max(1,Pt)));t.categories.forEach((g,l)=>{if(l%i!==0)return;const b=pt(l);a.words.push(x?{x:p.x-H,y:b,text:g,size:o,anchor:"end",color:c}:{x:b,y:p.y+p.height+H+o*.6,text:g,size:o,anchor:"middle",color:c})})}for(const e of y){const i=e.secondary&&ot?ot:et,g=b=>ut(i,b),l={type:e.kind,...t.labels===void 0?{}:{labels:t.labels}};isBar(e.kind)?Dt(e,g,l):Gt(e,g,l)}return a;function Dt(e,i,g){const l=(t.gap_width??r.gapWidth)/100,b=e.stacked?1:e.series.length,F=e.stacked?1:(t.overlap??0)/100,d=mt/(Math.max(1,b-(b-1)*F)+l),w=d*(1-F),u=d+w*(b-1);t.categories.forEach((E,M)=>{const $=pt(M);let A=0,T=0;e.series.forEach((C,nt)=>{const K=t.series[C],L=v(e,C,M);if(L===null||!K)return;const lt=e.stacked?L>=0?A:T:0,st=lt+L;e.stacked&&(L>=0?A=st:T=st);const Q=i(lt),X=i(st),ht=(e.stacked?$-d/2:$-u/2+nt*w)+(x&&Ot&&!e.stacked?u-d-2*nt*w:0),Ht=x?{x:Math.min(Q,X),y:ht,width:Math.abs(X-Q),height:d}:{x:ht,y:Math.min(Q,X),width:d,height:Math.abs(X-Q)};if(a.boxes.push({...Ht,color:O(C,M),series:C,category:M}),!k)return;const Ct=xt(t,D[C]?.[M]??0,0,K,t.categories[M]??""),dt=labelPositionOf(g),Y=P*.8,Tt=L>=0?1:-1,Lt=(rt,tt)=>dt==="ctr"?(rt+tt)/2:dt==="inBase"?rt+(tt>rt?Y:-Y):dt==="inEnd"?tt-(tt>rt?Y:-Y):tt+(tt>=rt?Y:-Y);x?z(Lt(Q,X),ht+d/2,Ct,dt==="outEnd"?Tt>0?"start":"end":"middle"):z(ht+d/2,Lt(Q,X),Ct,"middle")})})}function Gt(e,i,g){const l=t.categories.map(()=>0),b=e.series.map(d=>{const w=t.series[d],u=[],E=[];return t.categories.forEach((M,$)=>{const A=v(e,d,$);if(A===null||!w)return;const T=e.stacked?l[$]??0:0,C=T+A;e.stacked&&(l[$]=C);const nt=pt($),K=L=>x?[i(L),nt]:[nt,i(L)];if(u.push(K(C)),E.push(K(T)),isLine(e.kind)&&k){const L=labelPositionOf(g),[lt,st]=K(C);z(lt+(L==="r"?P:L==="l"?-P:0),st+(L==="t"?-P:L==="b"?P:0),xt(t,D[d]?.[$]??0,0,w,t.categories[$]??""),L==="r"?"start":L==="l"?"end":"middle")}}),{series:w,s:d,points:u,base:E}}),F=[];for(const{series:d,s:w,points:u,base:E}of b){if(!d)continue;const M=d.color??accentOf(w);if(isArea(e.kind)&&u.length>0)F.push({d:`${gt([...u,...[...E].reverse()])} Z`,color:M,width:0,fill:M,series:w});else if(u.length>0&&(a.lines.push({d:d.smooth===!0?jt(u):gt(u),color:M,width:d.line_width??r.lineWidth,series:w}),hasMarkers(e.kind)))for(const[$,A]of u)a.dots.push({x:$,y:A,r:(d.marker_size??r.marker)/2,color:M})}a.shapes.push(...F.reverse())}}
|
|
2
|
+
import{format as Zt,isValidFormat as Ut}from"numfmt";export const CHART_DEFAULTS={fontSize:12,titleScale:1.2,gapWidth:150,holeSize:50,margin:6,gridline:"#D9D9D9",axisLine:"#BFBFBF",letter:.55,lineWidth:2.25,gridWidth:.75,marker:5};const jt=["accent1","accent2","accent3","accent4","accent5","accent6"];export const accentOf=t=>jt[t%jt.length]??"accent1",isBar=t=>t.startsWith("column")||t.startsWith("bar"),isHorizontal=t=>t.startsWith("bar"),isLine=t=>t.startsWith("line"),isArea=t=>t.startsWith("area"),isRound=t=>t==="pie"||t==="doughnut",isScatter=t=>t.startsWith("scatter"),hasLines=t=>!isScatter(t)||t!=="scatter",hasMarkers=t=>t==="line-markers"||t==="scatter"||t==="scatter-lines",groupingOf=t=>t.endsWith("-100")?"percentStacked":t.endsWith("-stacked")?"stacked":isBar(t)?"clustered":"standard";export function labelPositionsOf(t){return isArea(t)||t==="doughnut"?[]:t==="pie"?["bestFit","outEnd","inEnd","ctr"]:isLine(t)||isScatter(t)?["t","b","l","r","ctr"]:groupingOf(t)==="clustered"?["outEnd","inEnd","ctr","inBase"]:["inEnd","ctr","inBase"]}export function labelPositionOf(t){const c=labelPositionsOf(t.type),h=t.labels?.position;if(h!==void 0&&c.includes(h))return h;if(c.length!==0)return t.type==="pie"?"ctr":isLine(t.type)||isScatter(t.type)?"t":groupingOf(t.type)==="clustered"?"outEnd":"ctr"}export const isCombinable=t=>t.startsWith("column")||isLine(t)||isArea(t);export function groupsOf(t){const c=isCombinable(t.type),h=[];if(t.series.forEach((n,i)=>{const o=n.type!==void 0&&c&&isCombinable(n.type)?n.type??t.type:t.type,S=c&&n.secondary===!0,_=h.find(A=>A.kind===o&&A.secondary===S);_?_.series.push(i):h.push({kind:o,secondary:S,series:[i]})}),h.every(n=>n.secondary))for(const n of h)n.secondary=!1;const r=n=>(n.secondary?3:0)+(isArea(n.kind)?0:isBar(n.kind)?1:2);return h.sort((n,i)=>r(n)-r(i))}export const variesOf=t=>t.vary_by_categories??isRound(t.type);export function formatValue(t,c="General"){return c==="General"||!Ut(c)?String(Number(t.toPrecision(10))):Zt(c,t)}const qt=[1,2,5,10];export function chartScale(t,c,h,r,n={}){const i=t>0&&(c-t)/c<.16666666666666666?t:Math.min(t,0),a=c<=0&&t<0?0:c,o=n.minimum_scale??i,S=n.maximum_scale??a,_=S>o?S-o:1,A=Math.max(1,Math.floor(h/r)),k=_/A,O=10**Math.floor(Math.log10(k)),T=n.major_unit??(qt.find(E=>E*O>=k)??10)*O,D=(E,P)=>Number((P(Number((E/T).toFixed(9)))*T).toPrecision(12)),U=a>0?a+_*.05:a===i?_:a,x=n.maximum_scale??D(U,Math.ceil),tt=i<0?i-_*.05:i,N=n.minimum_scale??D(tt,Math.floor),B=[],M=Math.round((x-N)/T);for(let E=0;E<=M;E++)B.push(Number((N+E*T).toPrecision(12)));return{min:N,max:x,major:T,ticks:B}}const Jt=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584],it=(t,c)=>{let h=0;for(const r of t){const n=r.codePointAt(0)??0,i=Jt[n-32];h+=i!==void 0?i/1e3:n>11903?1:CHART_DEFAULTS.letter}return h*c},m=t=>String(Number(t.toFixed(3)));function Nt(t){const c=h=>t[Math.max(0,Math.min(t.length-1,h))]??[0,0];return t.map(([h,r],n)=>{if(n===0)return`M${m(h)} ${m(r)}`;const[i,a]=c(n-2),[o,S]=c(n-1),[_,A]=c(n+1),k=`${m(o+(h-i)/6)} ${m(S+(r-a)/6)}`,O=`${m(h-(_-o)/6)} ${m(r-(A-S)/6)}`;return`C${k} ${O} ${m(h)} ${m(r)}`}).join(" ")}const xt=t=>t.map(([c,h],r)=>`${r===0?"M":"L"}${m(c)} ${m(h)}`).join(" ");function Kt(t,c,h,r,n,i){const a=(A,k)=>`${m(t+A*Math.sin(k))} ${m(c-A*Math.cos(k))}`,o=i-n>=Math.PI*2?n+Math.PI*2-1e-4:i,S=o-n>Math.PI?1:0,_=`M${a(h,n)} A${m(h)} ${m(h)} 0 ${String(S)} 1 ${a(h,o)}`;return r<=0?`${_} L${m(t)} ${m(c)} Z`:`${_} L${a(r,o)} A${m(r)} ${m(r)} 0 ${String(S)} 0 ${a(r,n)} Z`}function Tt(t,c,h,r){const n=r*1.5;return c!==void 0&&c!==""&&(t.bottom-=n),h!==void 0&&h!==""&&(t.left+=n),{x:t.left-n/2,y:t.bottom+n/2}}function Bt(t,c,h,r,n,i,a){r!==void 0&&r!==""&&t.words.push({x:c.x+c.width/2,y:h.y,text:r,size:i,anchor:"middle",color:a}),n!==void 0&&n!==""&&t.words.push({x:h.x,y:c.y+c.height/2,text:n,size:i,anchor:"middle",color:a,rotate:-90})}const yt=(t,c,h,r,n)=>{const i=t.labels;if(!i)return"";const a=isRound(t.type),o=[];return i.show_series_name&&o.push(r.name),i.show_category_name&&o.push(n),(i.show_value??!(i.show_percentage??!1))&&o.push(formatValue(c,i.number_format??r.number_format)),i.show_percentage&&a&&o.push(formatValue(h,i.number_format??"0%")),o.join(", ")};function Qt(t,c,h,r,n){const i=CHART_DEFAULTS,a=t.category_axis??{},o=t.value_axis??{},S=Tt(h,a.title,o.title,r),_=t.series.map(p=>p.values.flatMap((v,R)=>{const z=p.x?.[R]??(p.x?null:R+1);return z===null||v===null?[]:[[z,v]]})),A=_.flat().map(p=>p[0]),k=_.flat().map(p=>p[1]),O=p=>p.length>0?Math.min(...p):0,T=p=>p.length>0?Math.max(...p):1,D=o.number_format??t.series[0]?.number_format??"General",U=a.number_format??"General",x=r*.5,tt=chartScale(O(k),T(k),h.bottom-h.top,r*2.4,o),N=o.visible===!1?0:Math.max(0,...tt.ticks.map(p=>it(formatValue(p,D),r)))+x,B=a.visible===!1?0:r*1.2+x,M={x:h.left+N,y:h.top,width:h.right-h.left-N,height:h.bottom-h.top-B};c.plot=M,Bt(c,M,S,a.title,o.title,r,n);const E=chartScale(O(A),T(A),M.width,r*5,a),P=chartScale(O(k),T(k),M.height,r*2.4,o),H=p=>M.x+(Math.min(E.max,Math.max(E.min,p))-E.min)/(E.max-E.min)*M.width,C=p=>M.y+M.height-(Math.min(P.max,Math.max(P.min,p))-P.min)/(P.max-P.min)*M.height;for(const p of P.ticks){const v=C(p);(o.has_major_gridlines??!0)&&c.grid.push({d:`M${m(M.x)} ${m(v)} H${m(M.x+M.width)}`,color:o.gridline_color??{rgb:i.gridline},width:i.gridWidth}),o.visible!==!1&&c.words.push({x:M.x-x,y:v,text:formatValue(p,D),size:r,anchor:"end",color:n})}for(const p of E.ticks){const v=H(p);a.has_major_gridlines===!0&&c.grid.push({d:`M${m(v)} ${m(M.y)} V${m(M.y+M.height)}`,color:a.gridline_color??{rgb:i.gridline},width:i.gridWidth}),a.visible!==!1&&c.words.push({x:v,y:M.y+M.height+x+r*.6,text:formatValue(p,U),size:r,anchor:"middle",color:n})}c.axes.push({d:`M${m(M.x)} ${m(C(Math.max(P.min,Math.min(P.max,0))))} H${m(M.x+M.width)}`,color:a.line_color??{rgb:i.axisLine},width:i.gridWidth}),t.series.forEach((p,v)=>{const R=p.color??accentOf(v),z=(_[v]??[]).map(([Z,q])=>[H(Z),C(q)]);if(z.length!==0&&(hasLines(t.type)&&c.lines.push({d:t.type==="scatter-smooth"||p.smooth===!0?Nt(z):xt(z),color:R,width:p.line_width??i.lineWidth,series:v}),hasMarkers(t.type)))for(const[Z,q]of z)c.dots.push({x:Z,y:q,r:(p.marker_size??i.marker)/2,color:R})})}export function chartDrawing(t,c,h){const r=CHART_DEFAULTS,n=t.font_size??r.fontSize,i=t.font_color??"dk1",a={grid:[],shapes:[],boxes:[],lines:[],axes:[],dots:[],keys:[],words:[],plot:{x:0,y:0,width:0,height:0}},o={left:r.margin,top:r.margin,right:c-r.margin,bottom:h-r.margin};if(t.title!==void 0&&t.title!==""){const e=t.title_size??n*r.titleScale,s=t.title.split(`
|
|
3
|
+
`);s.forEach((g,l)=>{a.words.push({x:c/2,y:o.top+e*(.7+l*1.2),text:g,size:e,anchor:"middle",color:i})}),o.top+=e*(1.6+(s.length-1)*1.2)}const S=isRound(t.type),_=variesOf(t),A=(e,s)=>_?t.category_colors?.[s]??accentOf(s):t.series[e]?.color??accentOf(e);if(t.legend!==void 0){const e=_?t.categories:t.series.map(d=>d.name),s=n*.6,g=n*.4,l=n*1.5,y=e.map(d=>s+g+it(d,n)),j=(d,w,f)=>{a.keys.push({x:w,y:f-s/2,width:s,height:s,color:_?t.category_colors?.[d]??accentOf(d):t.series[d]?.color??accentOf(d),series:_?0:d,category:_?d:0}),a.words.push({x:w+s+g,y:f,text:e[d]??"",size:n,anchor:"start",color:i})};if(t.legend==="top"||t.legend==="bottom"){const d=y.reduce((W,b)=>W+b,0)+n*(e.length-1),w=t.legend==="top"?o.top+l/2:o.bottom-l/2;let f=(c-d)/2;e.forEach((W,b)=>{j(b,f,w),f+=(y[b]??0)+n}),t.legend_overlay!==!0&&(t.legend==="top"?o.top+=l:o.bottom-=l)}else{const d=Math.max(0,...y),w=t.legend==="left"?o.left:o.right-d,f=(o.top+o.bottom-l*e.length)/2+l/2;e.forEach((W,b)=>{j(b,w,f+b*l)}),t.legend_overlay!==!0&&(t.legend==="left"?o.left+=d+n:o.right-=d+n)}}const k=t.labels,O=k?.size??n,T=k?.color??i,D=(e,s,g,l,y=T)=>{g!==""&&a.words.push({x:e,y:s,text:g,size:O,anchor:l,color:y})};if(S){const e=t.series[0],s=(e?.values??[]).map(f=>Math.max(0,f??0)),g=s.reduce((f,W)=>f+W,0),l=Math.max(0,Math.min(o.right-o.left,o.bottom-o.top)/2),y=(o.left+o.right)/2,j=(o.top+o.bottom)/2,d=t.type==="doughnut"?l*((t.hole_size??r.holeSize)/100):0;a.plot={x:y-l,y:j-l,width:l*2,height:l*2};let w=0;return s.forEach((f,W)=>{const b=g>0?f/g:0,$=w+b*Math.PI*2;if(b>0){a.shapes.push({d:Kt(y,j,l,d,w,$),color:"lt1",width:1,fill:A(0,W),series:0,category:W});const I=(w+$)/2,V=d>0?(l+d)/2:labelPositionOf(t)==="inEnd"?l*.85:l*.6;e&&D(y+V*Math.sin(I),j-V*Math.cos(I),yt(t,f,b,e,t.categories[W]??""),"middle",k?.color??"lt1")}w=$}),a}if(isScatter(t.type))return Qt(t,a,o,n,i),a;const U=Math.max(1,t.categories.length),x=isHorizontal(t.type),tt=groupsOf(t),N=t.series.map(e=>t.categories.map((s,g)=>e.values[g]??null)),B=tt.map(e=>{const s=groupingOf(e.kind),g=s!=="clustered"&&s!=="standard",l=s==="percentStacked",y=t.categories.map((j,d)=>e.series.reduce((w,f)=>w+Math.abs(N[f]?.[d]??0),0));return{...e,stacked:g,percent:l,totals:y}}),M=(e,s,g)=>{const l=N[s]?.[g];if(l==null)return null;const y=e.totals[g]??0;return e.percent?y>0?l/y:0:l},E=e=>{let s=0,g=0,l=1/0,y=!1;for(const f of B)if(f.secondary===e&&(y||=f.percent,t.categories.forEach((W,b)=>{let $=0,I=0;for(const V of f.series){const L=M(f,V,b)??0;f.stacked?L>=0?$+=L:I+=L:($=Math.max($,L),I=Math.min(I,L))}g=Math.max(g,$),s=Math.min(s,I)}),!f.stacked))for(const W of f.series)for(const b of N[W]??[])b!==null&&(l=Math.min(l,b));B.every(f=>f.secondary!==e||!f.stacked)&&Number.isFinite(l)&&l>0&&(s=l),y&&(g=1,s=Math.min(s,0));const d=B.find(f=>f.secondary===e),w=d===void 0?void 0:d.series[0];return{low:s,high:g,percent:y,format:w===void 0?void 0:t.series[w]?.number_format}},P=E(!1),H=B.some(e=>e.secondary)?E(!0):void 0,C=t.value_axis??{},p=t.secondary_axis??{},v=t.category_axis??{},R=C.number_format??(P.percent?"0%":P.format??"General"),z=p.number_format??(H?.percent===!0?"0%":H?.format??"General"),Z=(e,s,g,l)=>chartScale(e.low,e.high,g,l,{...s,...e.percent?{maximum_scale:s.maximum_scale??1}:{}}),q=x?o.right-o.left:o.bottom-o.top,at=x?n*5:n*2.4,Dt=Z(P,C,q,at),bt=C.visible===!1?[]:Dt.ticks.map(e=>formatValue(e,R)),wt=Math.max(0,...bt.map(e=>it(e,n))),Mt=H===void 0||p.visible===!1?0:Math.max(0,...Z(H,p,q,at).ticks.map(e=>it(formatValue(e,z),n))),ct=v.visible!==!1,_t=ct?Math.max(0,...t.categories.map(e=>it(e,n))):0,G=n*.5,$t=x?C.title:v.title,kt=x?v.title:C.title,Ht=Tt(o,$t,kt,n),lt=H===void 0?void 0:p.title,vt=n*1.5,Wt=lt!==void 0&<!==""?(o.right-=vt)+vt/2:void 0,u=x?{x:o.left+(ct?_t+G:0),y:o.top,width:0,height:o.bottom-o.top-(C.visible===!1?0:n*1.2+G)}:{x:o.left+(C.visible===!1?0:wt+G),y:o.top,width:0,height:o.bottom-o.top-(ct?n*1.2+G:0)};u.width=o.right-u.x-(x&&bt.length>0?wt/2:0)-(Mt>0?Mt+G:0),a.plot=u,Bt(a,u,Ht,$t,kt,n,i),Wt!==void 0&<!==void 0&&a.words.push({x:Wt,y:u.y+u.height/2,text:lt,size:n,anchor:"middle",color:i,rotate:-90});const ut=x?u.width:u.height,et=Z(P,C,ut,at),nt=H===void 0?void 0:Z(H,p,ut,at),Et=(e,s)=>(Math.min(e.max,Math.max(e.min,s))-e.min)/(e.max-e.min)*ut,mt=(e,s)=>x?u.x+Et(e,s):u.y+u.height-Et(e,s),St=e=>mt(et,e),At=B.every(e=>isArea(e.kind)),Ot=v.reverse_order===!0,Pt=x?!Ot:Ot,pt=(x?u.height:u.width)/U,Ct=At?(x?u.height:u.width)/Math.max(1,U-1):pt,gt=e=>{const s=At?e*Ct:(e+.5)*pt,g=x?u.height:u.width,l=Pt?g-s:s;return(x?u.y:u.x)+l},It=St(Math.max(et.min,Math.min(et.max,0)));for(const e of et.ticks){const s=St(e);(C.has_major_gridlines??!0)&&a.grid.push({d:x?`M${m(s)} ${m(u.y)} V${m(u.y+u.height)}`:`M${m(u.x)} ${m(s)} H${m(u.x+u.width)}`,color:C.gridline_color??{rgb:r.gridline},width:r.gridWidth}),C.visible!==!1&&a.words.push(x?{x:s,y:u.y+u.height+G+n*.6,text:formatValue(e,R),size:n,anchor:"middle",color:i}:{x:u.x-G,y:s,text:formatValue(e,R),size:n,anchor:"end",color:i})}if(nt&&p.visible!==!1)for(const e of nt.ticks)a.words.push({x:u.x+u.width+G,y:mt(nt,e),text:formatValue(e,z),size:n,anchor:"start",color:i});if(a.axes.push({d:x?`M${m(It)} ${m(u.y)} V${m(u.y+u.height)}`:`M${m(u.x)} ${m(It)} H${m(u.x+u.width)}`,color:v.line_color??{rgb:r.axisLine},width:r.gridWidth}),ct){const e=x?n*1.3:_t+n,s=Math.max(1,Math.ceil(e/Math.max(1,Ct)));t.categories.forEach((g,l)=>{if(l%s!==0)return;const y=gt(l);a.words.push(x?{x:u.x-G,y,text:g,size:n,anchor:"end",color:i}:{x:y,y:u.y+u.height+G+n*.6,text:g,size:n,anchor:"middle",color:i})})}for(const e of B){const s=e.secondary&&nt?nt:et,g=y=>mt(s,y),l={type:e.kind,...t.labels===void 0?{}:{labels:t.labels}};isBar(e.kind)?zt(e,g,l):Gt(e,g,l)}return a;function zt(e,s,g){const l=(t.gap_width??r.gapWidth)/100,y=e.stacked?1:e.series.length,j=e.stacked?1:(t.overlap??0)/100,d=pt/(Math.max(1,y-(y-1)*j)+l),w=d*(1-j),f=d+w*(y-1);t.categories.forEach((W,b)=>{const $=gt(b);let I=0,V=0;e.series.forEach((L,ot)=>{const J=t.series[L],F=M(e,L,b);if(F===null||!J)return;const ht=e.stacked?F>=0?I:V:0,st=ht+F;e.stacked&&(F>=0?I=st:V=st);const K=s(ht),Q=s(st),dt=(e.stacked?$-d/2:$-f/2+ot*w)+(x&&Pt&&!e.stacked?f-d-2*ot*w:0),Vt=x?{x:Math.min(K,Q),y:dt,width:Math.abs(Q-K),height:d}:{x:dt,y:Math.min(K,Q),width:d,height:Math.abs(Q-K)};if(a.boxes.push({...Vt,color:A(L,b),series:L,category:b}),!k)return;const Lt=yt(t,N[L]?.[b]??0,0,J,t.categories[b]??""),ft=labelPositionOf(g),X=O*.8,Rt=F>=0?1:-1,Ft=(rt,Y)=>ft==="ctr"?(rt+Y)/2:ft==="inBase"?rt+(Y>rt?X:-X):ft==="inEnd"?Y-(Y>rt?X:-X):Y+(Y>=rt?X:-X);x?D(Ft(K,Q),dt+d/2,Lt,ft==="outEnd"?Rt>0?"start":"end":"middle"):D(dt+d/2,Ft(K,Q),Lt,"middle")})})}function Gt(e,s,g){const l=t.categories.map(()=>0),y=e.series.map(d=>{const w=t.series[d],f=[],W=[];return t.categories.forEach((b,$)=>{const I=M(e,d,$);if(I===null||!w)return;const V=e.stacked?l[$]??0:0,L=V+I;e.stacked&&(l[$]=L);const ot=gt($),J=F=>x?[s(F),ot]:[ot,s(F)];if(f.push(J(L)),W.push(J(V)),isLine(e.kind)&&k){const F=labelPositionOf(g),[ht,st]=J(L);D(ht+(F==="r"?O:F==="l"?-O:0),st+(F==="t"?-O:F==="b"?O:0),yt(t,N[d]?.[$]??0,0,w,t.categories[$]??""),F==="r"?"start":F==="l"?"end":"middle")}}),{series:w,s:d,points:f,base:W}}),j=[];for(const{series:d,s:w,points:f,base:W}of y){if(!d)continue;const b=d.color??accentOf(w);if(isArea(e.kind)&&f.length>0)j.push({d:`${xt([...f,...[...W].reverse()])} Z`,color:b,width:0,fill:b,series:w});else if(f.length>0&&(a.lines.push({d:d.smooth===!0?Nt(f):xt(f),color:b,width:d.line_width??r.lineWidth,series:w}),hasMarkers(e.kind)))for(const[$,I]of f)a.dots.push({x:$,y:I,r:(d.marker_size??r.marker)/2,color:b})}a.shapes.push(...j.reverse())}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{brightened as u,hexOfRgb as h,lumOf as p,rgbOfHex as b}from"@allyhub/ooxml/brightness";import{transformed as d}from"@allyhub/ooxml/transform";export const DEFAULT_MAPPED={tx1:"dk1",bg1:"lt1",tx2:"dk2",bg2:"lt2"};export function mappedColors(t,r){if(!r||Object.keys(r).length===0)return t;const e={...t};for(const[o,n]of Object.entries(r))e[o]=t[n];return e}export const themeColor=(t,r=0)=>r===0?t:{theme_color:t,brightness:r},themeColorOf=t=>typeof t=="string"?t:"theme_color"in t?t.theme_color:void 0;const f=(t,r)=>r[t]??(t in DEFAULT_MAPPED?r[DEFAULT_MAPPED[t]]:"#000000"),x=new Set(["hue","hueOff"]);export const transformVal=t=>Math.round(t.value*(x.has(t.name)?6e4:1e5));export function colorRgba(t,r){const e=typeof t=="string"?f(t,r):"rgb"in t?t.rgb:"brightness"in t?u(f(t.theme_color,r),t.brightness):f(t.theme_color,r),o=typeof t=="string"||"brightness"in t?[]:t.transforms;let n={rgb:b(e),alpha:1};for(const a of o??[])n=d(n,a.name,transformVal(a));return n}export function colorRgb(t,r){if(typeof t=="string")return f(t,r);if("rgb"in t&&!t.transforms?.length)return t.rgb;if("brightness"in t)return u(f(t.theme_color,r),t.brightness);const{rgb:e,alpha:o}=colorRgba(t,r),n=h(e);return o>=1?n:`${n}${Math.round(o*255).toString(16).padStart(2,"0").toUpperCase()}`}const g=t=>Object.entries(t).map(([r,e])=>` ${r}="${String(e)}"`).join("");export function colorXml(t,r=""){const e=(s,i,m)=>m===""?`<${s}${g(i)}/>`:`<${s}${g(i)}>${m}</${s}>`,o=(s,i)=>`<a:${s} val="${String(i)}"/>`;if(typeof t=="string")return e("a:schemeClr",{val:t},r);const n=s=>(s??[]).map(i=>o(i.name,transformVal(i))).join("");if("rgb"in t)return e("a:srgbClr",{val:t.rgb.replace("#","").toUpperCase()},n(t.transforms)+r);if("transforms"in t)return e("a:schemeClr",{val:t.theme_color},n(t.transforms)+r);const{lumMod:a,lumOff:l}=p(t.brightness);return e("a:schemeClr",{val:t.theme_color},o("lumMod",a)+(l===void 0?"":o("lumOff",l))+r)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export*from"./chart.js";export*from"./chart-file.js";export*from"./chart-xml.js";export*from"./embedded.js";export*from"./svg.js";
|
|
2
|
+
export*from"./color.js";export*from"./chart.js";export*from"./chart-file.js";export*from"./chart-xml.js";export*from"./embedded.js";export*from"./svg.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{
|
|
2
|
+
import{colorRgb as u}from"./color.js";import{chartDrawing as F}from"./chart.js";export const OFFICE_COLORS={dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"};const w={"&":"&","<":"<",">":">",'"':"""},i=n=>n.replace(/[&<>"]/gu,r=>w[r]??r),o=n=>String(Number(n.toFixed(3)));function k(n,r){const l=t=>{const c=t.fill===void 0?"none":r(t.fill),s=t.width>0?r(t.color):"none";return`<path d="${i(t.d)}" fill="${c}" stroke="${s}" stroke-width="${o(t.width)}" stroke-linejoin="round"/>`},e=[];for(const t of[...n.grid,...n.shapes])e.push(l(t));for(const t of[...n.boxes,...n.keys])e.push(`<rect x="${o(t.x)}" y="${o(t.y)}" width="${o(t.width)}" height="${o(t.height)}" fill="${r(t.color)}"/>`);for(const t of[...n.axes,...n.lines])e.push(l(t));for(const t of n.dots)e.push(`<circle cx="${o(t.x)}" cy="${o(t.y)}" r="${o(t.r)}" fill="${r(t.color)}"/>`);for(const t of n.words){const c=t.rotate===void 0?"":` transform="rotate(${o(t.rotate)} ${o(t.x)} ${o(t.y)})"`;e.push(`<text x="${o(t.x)}" y="${o(t.y)}" font-size="${o(t.size)}" text-anchor="${t.anchor}" dominant-baseline="central" fill="${r(t.color)}"${c}>${i(t.text)}</text>`)}return e.join("")}export function chartSvg(n,r,l,e={}){const t=e.pointsPerPixel??.75,c=r*t,s=l*t,f=e.colors??OFFICE_COLORS,h=g=>u(g,f),d=e.font??"Carlito, Calibri, Arial, sans-serif",$=e.paper??"#FFFFFF",a=e.edge??"#D9D9D9",p=e.label===void 0?"":` role="img" aria-label="${i(e.label)}"`,x=$==="none"&&a==="none"?"":`<rect x="0.375" y="0.375" width="${o(c-.75)}" height="${o(s-.75)}" fill="${i($)}" stroke="${i(a)}" stroke-width="${a==="none"?"0":"0.75"}"/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${o(c)} ${o(s)}" width="${o(r)}" height="${o(l)}" font-family="${i(d)}"${p}>${x}${k(F(n,c,s),h)}</svg>`}
|