allyhub 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/commands/auth.js +4 -4
- package/dist/commands/cloud-tools.js +11 -11
- package/dist/commands/frames/compare.js +2 -2
- package/dist/commands/frames/piece.js +1 -1
- package/dist/commands/frames.js +8 -8
- package/dist/commands/index.js +1 -1
- package/dist/commands/inspect/common.js +4 -2
- package/dist/commands/inspect/facts.js +3 -3
- package/dist/commands/inspect/layout.js +1 -1
- package/dist/commands/orgs.js +2 -2
- package/dist/help.js +4 -4
- package/dist/main.js +8 -7
- package/dist/node_modules/@allyhub/3d-extension/package.json +34 -2
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +2 -1
- package/dist/node_modules/@allyhub/canvas-extension/skills/allyhub/references/canvas.md +4 -24
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +2 -2
- package/dist/node_modules/@allyhub/chart/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/client.d.ts +10 -0
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/config.d.ts +9 -0
- package/dist/node_modules/@allyhub/cloud/dist/config.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/credentials.d.ts +4 -4
- package/dist/node_modules/@allyhub/cloud/dist/credentials.js +2 -2
- package/dist/node_modules/@allyhub/cloud/dist/device.d.ts +12 -0
- package/dist/node_modules/@allyhub/cloud/dist/device.js +2 -0
- 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/components/r/callout.json +1 -1
- package/dist/node_modules/@allyhub/components/src/callout.ts +98 -13
- 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/dist/captions.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/docx.js +4 -4
- package/dist/node_modules/@allyhub/doc/dist/html.js +50 -47
- package/dist/node_modules/@allyhub/doc/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/page.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/paper.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/table.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/write.js +22 -22
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +17 -2
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/dist/export.js +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/dist/points.js +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +87 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +89 -0
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +50 -0
- 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 +16 -1
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +7 -39
- 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/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/vision/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +7 -4
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +16 -0
- package/dist/node_modules/@allyhub/piece/dist/page/locate.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +6 -0
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/version.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +132 -0
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +19 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.d.ts +337 -0
- package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +153 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +4 -2
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +43 -188
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +1 -0
- package/dist/node_modules/@allyhub/protocol/dist/mail.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +51 -91
- package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +3 -3
- package/dist/node_modules/@allyhub/protocol/package.json +5 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/dist/look.js +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/compose.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/embed.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/player/clips.js +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/index.d.ts +2 -2
- package/dist/node_modules/@allyhub/scenery/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/moire.d.ts +45 -5
- package/dist/node_modules/@allyhub/scenery/dist/moire.js +2 -2
- package/dist/node_modules/@allyhub/scenery/dist/phone.d.ts +4 -3
- package/dist/node_modules/@allyhub/scenery/dist/phone.js +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/grade.d.ts +7 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/grade.js +2 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/index.d.ts +4 -3
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/index.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/screens.d.ts +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/screens.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/measure/facts.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/page/screens.d.ts +8 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/page/screens.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/kernels.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/maths.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/types.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/move.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/print.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/printed.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/values.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/write.js +15 -15
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/formula.js +2 -2
- 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/sax.js +3 -1
- 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/dist/xlsx/xml.js +3 -2
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/export.js +4 -4
- package/dist/node_modules/@allyhub/sheet-extension/package.json +22 -3
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +20 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/code.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/index.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/common.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/text.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 +1 -1
- 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/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/dist/fonts/caladea/400-italic.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/400.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/700-italic.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/700.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/cambria.css +76 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/400-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/400.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/700-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/700.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/courier-new.css +316 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/400-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/400.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/700-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/700.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/times-new-roman.css +316 -0
- package/dist/node_modules/@allyhub/stage-page/dist/host.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.html +3 -0
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +19 -19
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +16 -1
- package/dist/node_modules/@allyhub/video-measure/dist/version.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/dist/phone.js +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/dist/held.js +2 -0
- package/dist/node_modules/@allyhub/website-extension/dist/project-tools.js +24 -1
- package/dist/node_modules/@allyhub/website-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +49 -2
- package/dist/node_modules/@allyhub/x-extension/package.json +34 -4
- package/dist/node_modules/@allyhub/x-extension/skills/allyhub/references/x.md +7 -62
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/article.js +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/post.js +2 -2
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +10 -10
- package/dist/text/facts-text.js +5 -5
- package/dist/text/index.js +1 -1
- package/dist/text/long-text.js +4 -0
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-CN5PiJYY.js → abnfDiagram-WEYOIA3C-CjAmWsNR.js} +1 -1
- package/editor-web/assets/alt-DnBZJzEh.js +4 -0
- package/editor-web/assets/{architecture-WOLXFQ4H-BnvZtQYk.js → architecture-WOLXFQ4H-DeeKhyhZ.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-tkcEcFQ8.js → architectureDiagram-ZHVYKT53-b32qTaJg.js} +1 -1
- package/editor-web/assets/{arrow-up-DTP2yVSU.js → arrow-up-L4YV_65f.js} +1 -1
- package/editor-web/assets/article-DLMjAdbP.js +73 -0
- package/editor-web/assets/{audio-lines-Ti8-m7H2.js → audio-lines-BFcM7G2L.js} +1 -1
- package/editor-web/assets/{blockDiagram-RJAE7QA3-DhqEIpie.js → blockDiagram-RJAE7QA3-BNbnMNmw.js} +1 -1
- package/editor-web/assets/button-Chk675Xu.js +41 -0
- package/editor-web/assets/{c4Diagram-XDPPPE54-Bg9G95tl.js → c4Diagram-XDPPPE54-BEuemvMw.js} +1 -1
- package/editor-web/assets/calc-worker-D2pGis6e.js +45 -0
- package/editor-web/assets/channel-EzYq4r0d.js +1 -0
- package/editor-web/assets/chart-Be9Hj5GL.js +1 -0
- package/editor-web/assets/choice-BgmBh4yu.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-C8Ve9lAa.js → chunk-2E7WHVMD-Zb5nPx_e.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-BDWwPUnT.js → chunk-4EMNKR2T-DSEM2reX.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BQiNPKgx.js → chunk-55XCU76K-BOZa_65H.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-QoEt-6jf.js → chunk-7S6XSTFO-DeiGeVpB.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-BeuwIv0-.js → chunk-AQDTSKZB-fPuQFBJc.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-BHW7sLAz.js → chunk-DSNLSHJZ-5vdnoak2.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-bbGED0hu.js → chunk-HAGFOTED-DFF2mZJ1.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-FltWp8yo.js → chunk-HNE4Q36P-g6-ZLbTg.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-NeQzr6kH.js → chunk-NQOKRVIF-o3hNcHMJ.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-eA4-WUhn.js → chunk-UHW7PFBP-BQiDI9dK.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-BPPv325z.js → chunk-VQ5W62QI-CJlMXWWz.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-DOCIz7Te.js → chunk-WQQL4CDK-pNBU8dXv.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-Dc_ihQJi.js → chunk-YZO67HFG-2x-BiWd-.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-CoqwCPSm.js → chunk-ZAUX2LTX-etFStEM8.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-CZUQPkJx.js → chunk-ZCHMQSOR-B3AYRhIY.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-DUh9c50k.js → classDiagram-v2-4MYWR3UA-6y2yX0oq.js} +1 -1
- package/editor-web/assets/collaborator-LRd0hELn.js +1 -0
- package/editor-web/assets/createLucideIcon-CPS-TrJJ.js +1 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-DUTZiog0.js → cynefin-EF2NZ3EQ-CX4BTQQe.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-oAjpfbrU.js → cynefinDiagram-WF24UDRP-LbDkOTy3.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-BrKvKCvb.js → dagre-NK4GIZVX-wCKQk7hi.js} +1 -1
- package/editor-web/assets/{diagram-CBK3MWTC-GekVRnmm.js → diagram-CBK3MWTC-a9fofQwk.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-CDd1VFRT.js → diagram-I5XIIV2D-UCLZWch5.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-535RISTn.js → diagram-ODIL2UCW-CAEe88Lp.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-MXzzKCGG.js → diagram-PFBEJUXE-Cp1o45bs.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-vKVwkQxY.js → diagram-RJA3I4VV-c6OVxDyq.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-UwGAiQLx.js → diagram-TYUNFSNR-BVRWslDM.js} +1 -1
- package/editor-web/assets/{dist-CKyfo5RM.js → dist--KKyT5zP.js} +1 -1
- package/editor-web/assets/dist-1k0MHB3i.js +1 -0
- package/editor-web/assets/dist-B9KHJqL5.js +4 -0
- package/editor-web/assets/dist-BbJyrhIY.js +1 -0
- package/editor-web/assets/dist-CJXCQxQM.js +37 -0
- package/editor-web/assets/dist-D9xQGwe9.js +5 -0
- package/editor-web/assets/dist-DFiLzbx8.js +219 -0
- package/editor-web/assets/{dist-shKo7XVN.js → dist-DIPV6xfF.js} +1 -1
- package/editor-web/assets/dist-Dp-fQMtx.js +6 -0
- package/editor-web/assets/dist-Duw28VxJ.js +16 -0
- package/editor-web/assets/{dist-9ymlIMhr.js → dist-DwGhfliS.js} +1 -1
- package/editor-web/assets/dist-OBE2IIYP.js +24 -0
- package/editor-web/assets/dist-j6ZLVcgf.js +38 -0
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-73yGokYa.js → ebnfDiagram-V4P3TTPT-KdOTJgFu.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-BW6V9y6a.js → elk-QONTBCTQ-Cmlrp7qB.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-BPqIJ22h.js → erDiagram-KYQIGQAA-CBM7-aQm.js} +1 -1
- package/editor-web/assets/{eventmodeling-K75KTNOO-_VZ8jvuy.js → eventmodeling-K75KTNOO-CEoJkbuW.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-Xm2E2ib_.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-DZ157JN2.js → ganttDiagram-R7GPNTJY-D4S6ZSYD.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-fmcNL9bq.js → gitGraph-VSP46ZUC-BvkL6RSh.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-DiZDyksR.js → gitGraphDiagram-PDYL7XHY-lTGguloH.js} +1 -1
- package/editor-web/assets/hint-BimUgJms.js +1 -0
- package/editor-web/assets/index-C-i_iuxN.js +28 -0
- package/editor-web/assets/index-Cxh_Shkm.css +2 -0
- package/editor-web/assets/{info-OHQRW6UA-V06620kN.js → info-OHQRW6UA-DvKzqNvp.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-CbIgheWX.js → infoDiagram-MVDRKAX5-D7hCpehs.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-D5oJQPkG.js → ishikawaDiagram-HPEHV2GE-Bg93sZQe.js} +1 -1
- package/editor-web/assets/{italic-CDhZKo_q.js → italic-BQBwRTe8.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-BZEv6JI4.js → journeyDiagram-BOSHW7O7-CKm_KONJ.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-CLG1R8y_.js → kanban-definition-FNSA4HC5-BKknnpTR.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-DxDwXM7z.js → mermaid-parser.core-BzqkDnqL.js} +3 -3
- package/editor-web/assets/{mermaid.core-tU55ZwVG.js → mermaid.core-CEpvTOAe.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-CYf4zzAh.js → mindmap-definition-6OY57UG3-BJ0qG8Wi.js} +1 -1
- package/editor-web/assets/minus-oPj1GxwA.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-DsHeKYNL.js → packet-JDAUHWVQ-ew3kvyFm.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-CQyh6TTa.js → pegDiagram-ECIUJNBX-DqUS2xit.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-3vCIvpNB.js → pie-XZMESJXO-DTIAMPGm.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-DF5yGBLn.js → pieDiagram-GNMPY74T-DoKOE02-.js} +1 -1
- package/editor-web/assets/progress-CPEbDOoN.js +6 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-B7pxlDYP.js → quadrantDiagram-D57K4MC3-DauOpYun.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-cpEA41mL.js → radar-ABXABTNO-BvMJXUU-.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-BLyy5R2c.js → railroad-I3PHUGI6-D3jdJmhM.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-Y-oyol19.js → railroad-abnf-LNEFI6M7-Dm8ZpmPj.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-o58wHZsr.js → railroad-ebnf-DWYD2UWJ-oc0Du7Ag.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-CcD3PXZ8.js → railroad-peg-JR7BVNR7-CMrQL_7U.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-BuCC4eyy.js → railroadDiagram-Y72NRBL7-y99z0C7i.js} +1 -1
- package/editor-web/assets/react-DztDSW4P.js +1 -0
- package/editor-web/assets/{repeat-2-C5PCbNsg.js → repeat-2-DJi4LW5C.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-Dp-JFGn4.js → requirementDiagram-EQYSW5RA-jMr_uoF6.js} +1 -1
- package/editor-web/assets/row-ClBisiBs.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-rYuCqEvw.js → sankeyDiagram-SY24JHO5-DcUyx03Q.js} +1 -1
- package/editor-web/assets/schemas-68mjUjP5.js +1 -0
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-DryW8x6d.js → sequenceDiagram-BLEHNHQU-R4X8wRCd.js} +1 -1
- package/editor-web/assets/session-2u9U7koW.js +1 -0
- package/editor-web/assets/slides-BByblSSR.js +1 -0
- package/editor-web/assets/snapshots-C9KV-Y2_.js +56 -0
- package/editor-web/assets/sound-DExlNJbb.js +1 -0
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-Bnp0XfpT.js → stateDiagram-v2-A6IESKWZ-BqvXKbCA.js} +1 -1
- package/editor-web/assets/{strikethrough-DJckA35o.js → strikethrough-CyUBnGTl.js} +1 -1
- package/editor-web/assets/{svg-BjM9RazX.js → svg-lBRT-uhy.js} +1 -1
- package/editor-web/assets/swatch-1c1uVn1z.js +1 -0
- package/editor-web/assets/{swimlanes-B3ENRKFQ-BiRRhhbd.js → swimlanes-B3ENRKFQ-hjTXIc6M.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-BLfytmPY.js +8 -0
- package/editor-web/assets/switch-D0K-K8-C.js +1 -0
- package/editor-web/assets/{syntax-CC6QYhCz.js → syntax-Bih_jv7W.js} +1 -1
- package/editor-web/assets/tabs-CxxOnGLR.js +1 -0
- package/editor-web/assets/{textarea-BGtPqZdB.js → textarea-Fu93tFO3.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-D-Q5ZtDF.js → timeline-definition-JXYKGLGB-BcSoN4Dq.js} +1 -1
- package/editor-web/assets/{trash-2-Bjj6cWzP.js → trash-2-BAKAeziW.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-B6DDatXq.js → treeView-D4JQ5SDB-CsFN2jrc.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-D7j5ZhiI.js → treemap-SAJKECNS-DP1eqXJ2.js} +1 -1
- package/editor-web/assets/{undo-2-yOSG766T.js → undo-2-DQ5CBmki.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-tkrdKUJB.js → usecaseDiagram-WPOLBNNX-BGxa0osF.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-Ch4XbSnD.js → vennDiagram-Q3Y3IDCW-D2XhTF49.js} +1 -1
- package/editor-web/assets/video-CDbPX4Cr.js +1 -0
- package/editor-web/assets/{wardley-7MLQ67FV-Bynt7qNQ.js → wardley-7MLQ67FV-DM3jMAbZ.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-DRuSgm_L.js → wardleyDiagram-IVAIDKWA-Bf-DaZEg.js} +1 -1
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DctpvfkL.js → xychartDiagram-4URNHDU4-dp-mdcWd.js} +1 -1
- package/editor-web/index.html +6 -5
- package/package.json +2 -2
- package/editor-web/assets/alt-BOVao_9S.js +0 -4
- package/editor-web/assets/article-B6YCzhj8.js +0 -73
- package/editor-web/assets/calc-worker-B5-fDWnb.js +0 -45
- package/editor-web/assets/channel-C26aBI4o.js +0 -1
- package/editor-web/assets/chart-BOnxneyw.js +0 -1
- package/editor-web/assets/choice-O5nwc2N0.js +0 -1
- package/editor-web/assets/collaborator-BJU5qwHd.js +0 -1
- package/editor-web/assets/createLucideIcon-B3B95oX5.js +0 -1
- package/editor-web/assets/dist-C6NqUEG4.js +0 -16
- package/editor-web/assets/dist-C9UGmCG9.js +0 -6
- package/editor-web/assets/dist-CAk5bjBm.js +0 -1
- package/editor-web/assets/dist-CRaWqNwq.js +0 -37
- package/editor-web/assets/dist-CwIBc7HQ.js +0 -1
- package/editor-web/assets/dist-DXRmkezB.js +0 -38
- package/editor-web/assets/dist-EKK5i0dG.js +0 -219
- package/editor-web/assets/dist-hHJlpLWo.js +0 -5
- package/editor-web/assets/dist-oYKcwWUj.js +0 -4
- package/editor-web/assets/dist-wrKxBrVu.js +0 -24
- package/editor-web/assets/flowDiagram-IUGLLWBU-ouDQYiTr.js +0 -1
- package/editor-web/assets/hint-_AQWCDMj.js +0 -1
- package/editor-web/assets/index-BsstP-cI.js +0 -28
- package/editor-web/assets/index-DQRcmxBO.css +0 -2
- package/editor-web/assets/minus-Cgmm6ncD.js +0 -1
- package/editor-web/assets/progress-0B_TVsPi.js +0 -6
- package/editor-web/assets/react-BP46yLMB.js +0 -1
- package/editor-web/assets/react-pgBZqVxJ.js +0 -96
- package/editor-web/assets/schemas-Ewwjtbf4.js +0 -1
- package/editor-web/assets/session-DiI9KYRI.js +0 -1
- package/editor-web/assets/slides-CCwgBcGH.js +0 -1
- package/editor-web/assets/sound-CqryteNl.js +0 -1
- package/editor-web/assets/swatch-DL3HqIjW.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-BkOls8Tv.js +0 -8
- package/editor-web/assets/switch-DltnKqN-.js +0 -1
- package/editor-web/assets/tabs-C-re0Kxn.js +0 -1
- package/editor-web/assets/video-DXFiCNGc.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/canvas-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"icon": "layout-dashboard",
|
|
43
43
|
"color": "kind-ochre",
|
|
44
44
|
"module": "@allyhub/canvas-editor",
|
|
45
|
+
"markup": "./markup",
|
|
45
46
|
"check": "./dist/check.js",
|
|
46
47
|
"place": {
|
|
47
48
|
"type": "object",
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
# references/canvas.md
|
|
2
2
|
|
|
3
|
-
A canvas lays a project's work out to be seen together, compared and talked over: a launch's outputs side by side, two cuts of a video, a mood board, candidates with your reasons beside them. It draws nothing of its own and exports nothing. It is a `.canvas` file
|
|
3
|
+
A canvas lays a project's work out to be seen together, compared and talked over: a launch's outputs side by side, two cuts of a video, a mood board, candidates with your reasons beside them. It draws nothing of its own and exports nothing. It is a `.canvas` file (JSON Canvas, as Obsidian writes it) anywhere in the project, written by hand and listed in `allyhub.yaml` for the person to see it.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"nodes":[
|
|
9
|
-
{"id":"7d1f0c3a9b2e4f60","type":"group","label":"Share pictures","x":-40,"y":-80,"width":1360,"height":520},
|
|
10
|
-
{"id":"2b9e81c04d7f3a15","type":"file","file":"launch/og/og.ts","x":0,"y":0,"width":600,"height":340},
|
|
11
|
-
{"id":"c04d7f3a152b9e81","type":"text","text":"**Why this plate**: the river reads at 400 px.","x":640,"y":0,"width":320,"height":160,"color":"4"},
|
|
12
|
-
{"id":"9a6e2f10b3c84d57","type":"link","url":"https://x.com/allyhub","x":640,"y":200,"width":320,"height":120}
|
|
13
|
-
],
|
|
14
|
-
"edges":[
|
|
15
|
-
{"id":"5e3a9c1d7b0f2846","fromNode":"c04d7f3a152b9e81","fromSide":"left","toNode":"2b9e81c04d7f3a15","toSide":"right","label":"chosen"}
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
- **Paths are from the project's folder**, wherever the canvas is.
|
|
21
|
-
- **A file node points at an item by its file**, as `allyhub.yaml` lists it (`launch/og/og.ts`, `launch/film/film.ts`); it shows the item's own preview, live: an image's boards, a deck's slide, a video's still, a doc's first words. Any other file (`assets/media/plate.webp`, a clip, a sound) shows itself.
|
|
22
|
-
- **Nodes**: `text` (Markdown), `file`, `link` (`url`) and `group` (`label`), each with whole-pixel `x`, `y`, `width` and `height`; y grows down. The first node is drawn at the back, so a group comes before what it holds. A group holds the nodes whose boxes are inside its box.
|
|
23
|
-
- **Edges** join two nodes by id, from a side (`top`, `right`, `bottom`, `left`) to a side, with a `label`; `toEnd` is an arrow unless `"none"`.
|
|
24
|
-
- **Colours** are `"1"` red, `"2"` orange, `"3"` yellow, `"4"` green, `"5"` cyan, `"6"` purple, or a hex colour.
|
|
25
|
-
- **Ids** are unique across nodes and edges: 16 hex digits, as Obsidian makes them.
|
|
26
|
-
- **The person's changes** (moves, notes, edges) are written to the same file: read it before you change it, and keep the ids and the fields you do not know.
|
|
27
|
-
- `allyhub check` reports a duplicate id, a file node at a missing file and an edge at a missing node (AK-C001 to AK-C004). `allyhub inspect canvas <file>` lists the nodes with their boxes and what they point at, what each group holds and each edge's ends. `allyhub dev <file>` opens it for the person.
|
|
5
|
+
- `allyhub help canvases` lists the commands and prints where the SDK's `canvas.md` is. Read it before writing a canvas.
|
|
6
|
+
- **The person moves things and adds notes and edges in the same file.** Read it before you change it, and keep what they put there.
|
|
7
|
+
- `allyhub inspect canvas <file>` lists what it holds and where, without drawing it; `allyhub dev <file>` opens it for the person.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{lumOf as
|
|
3
|
-
`,
|
|
2
|
+
import{lumOf as V}from"@allyhub/ooxml/brightness";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 O,isBar as L,isHorizontal as G,isLine as S,isRound as g,isScatter as w,labelPositionOf as H,variesOf as M}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",j="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 r(e,n={},...c){const a=Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>` ${s}="${d(typeof i=="boolean"?i?"1":"0":String(i))}"`).join(""),o=c.join("");return o===""?`<${e}${a}/>`:`<${e}${a}>${o}</${e}>`}const te=e=>{if(typeof e=="string")return r("a:schemeClr",{val:e});if("rgb"in e)return r("a:srgbClr",{val:e.rgb.replace("#","").toUpperCase()});const{lumMod:n,lumOff:c}=V(e.brightness);return r("a:schemeClr",{val:e.theme_color},t("a:lumMod",n),...c===void 0?[]:[t("a:lumOff",c)])},h=e=>e===null?r("a:noFill"):r("a:solidFill",{},te(e)),t=(e,n)=>r(e,{val:typeof n=="boolean"?n?1:0:n}),f=(e,n)=>r("a:ln",n===void 0?{}:{w:Math.round(n*12700)},h(e)),X=(e,n)=>r("c:txPr",{},r("a:bodyPr"),r("a:lstStyle"),r("a:p",{},r("a:pPr",{},r("a:defRPr",e===void 0?{}:{sz:Math.round(e*100)},n===void 0?"":h(n))),r("a:endParaRPr",{lang:"en-US"}))),$=e=>r("c:strCache",{},t("c:ptCount",e.length),...e.map((n,c)=>r("c:pt",{idx:c},`<c:v>${d(n)}</c:v>`))),F=(e,n)=>r("c:numCache",{},`<c:formatCode>${d(e??"General")}</c:formatCode>`,t("c:ptCount",n.length),...n.flatMap((c,a)=>c===null?[]:[r("c:pt",{idx:a},`<c:v>${String(c)}</c:v>`)])),ne=(e,n)=>r("c:tx",{},n===void 0?`<c:v>${d(e.name)}</c:v>`:r("c:strRef",{},`<c:f>${d(n)}</c:f>`,$([e.name]))),re=(e,n)=>n===void 0?"":r("c:xVal",{},r("c:numRef",{},`<c:f>${d(n)}</c:f>`,F("General",e.x??[])));function oe(e,n,c,a){const o=n.color??I(c),s=g(e.type),i=w(e.type),l=S(e.type)||i,u=Z(e.type),z=l?r("c:spPr",{},W(e.type)?f(o,n.line_width??m.lineWidth):r("a:ln",{w:19050},h(null))):r("c:spPr",{},h(o),s?f("lt1",1):""),v=a.categories;return r("c:ser",{},t("c:idx",c),t("c:order",c),ne(n,a.name(c)),z,L(e.type)?t("c:invertIfNegative",!1):"",l?r("c:marker",{},t("c:symbol",u?"circle":"none"),u?t("c:size",n.marker_size??m.marker):"",u?r("c:spPr",{},h(o),f(o)):""):"",...M(e)&&!l&&!O(e.type)?e.categories.map((P,p)=>r("c:dPt",{},t("c:idx",p),L(e.type)?t("c:invertIfNegative",!1):"",t("c:bubble3D",!1),r("c:spPr",{},h(e.category_colors?.[p]??I(p)),s?f("lt1",1):""))):[],i?re(n,a.x?.(c)):v===void 0?"":r("c:cat",{},a.numeric===!0?r("c:numRef",{},`<c:f>${d(v)}</c:f>`,F(a.categoryFormat??"General",a.categoryNumbers??e.categories.map(P=>{const p=Number(P);return P===""||!Number.isFinite(p)?null:p}))):r("c:strRef",{},`<c:f>${d(v)}</c:f>`,$(e.categories))),r(i?"c:yVal":"c:val",{},r("c:numRef",{},`<c:f>${d(a.values(c))}</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 c=n.show_percentage===!0,a=H(e);return r("c:dLbls",{},n.number_format===void 0?"":r("c:numFmt",{formatCode:n.number_format,sourceLinked:0}),n.size===void 0&&n.color===void 0&&!g(e.type)?"":X(n.size,n.color??(g(e.type)?"lt1":void 0)),a===void 0?"":t("c:dLblPos",a),t("c:showLegendKey",!1),t("c:showVal",n.show_value??!c),t("c:showCatName",n.show_category_name===!0),t("c:showSerName",n.show_series_name===!0),t("c:showPercent",c),t("c:showBubbleSize",!1))}function ce(e,n){const c=R(e),[a]=c;return c.length<=1&&a?.secondary!==!0?E(e,e.series.map((o,s)=>s),n,!1):c.map(o=>E({...e,type:o.kind},o.series,n,o.secondary)).join("")}function E(e,n,c,a){const o=n.map(l=>{const u=e.series[l];return u?oe(e,u,l,c):""}).join(""),s=A(e.type),i=a?t("c:axId",j)+t("c:axId",T):t("c:axId",b)+t("c:axId",y);if(g(e.type)){const l=e.type==="pie";return r(l?"c:pieChart":"c:doughnutChart",{},t("c:varyColors",M(e)),o,_(e),t("c:firstSliceAng",0),l?"":t("c:holeSize",e.hole_size??50))}if(w(e.type))return r("c:scatterChart",{},t("c:scatterStyle","lineMarker"),t("c:varyColors",!1),o,_(e),i);if(L(e.type)){const l=s!=="clustered";return r("c:barChart",{},t("c:barDir",G(e.type)?"bar":"col"),t("c:grouping",s),t("c:varyColors",M(e)),o,_(e),t("c:gapWidth",e.gap_width??150),e.overlap!==void 0||l?t("c:overlap",e.overlap??100):"",i)}return r(S(e.type)?"c:lineChart":"c:areaChart",{},t("c:grouping",s),t("c:varyColors",!1),o,_(e),S(e.type)?t("c:marker",!0):"",i)}const x=e=>r("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=>r("c:spPr",{},f(e.line_color??{rgb:m.axisLine},m.gridWidth)),k=e=>e.has_major_gridlines===!0?r("c:majorGridlines",{},r("c:spPr",{},f(e.gridline_color??{rgb:m.gridline},m.gridWidth))):"",U=(e,n)=>r("c:rich",{},r("a:bodyPr"),r("a:lstStyle"),r("a:p",{},r("a:pPr",{},r("a:defRPr",{sz:n,b:0})),r("a:r",{},r("a:rPr",{lang:"en-US",sz:n,b:0}),`<a:t>${d(e)}</a:t>`))),C=(e,n)=>e===void 0||e===""?"":r("c:title",{},r("c:tx",{},U(e,n)),t("c:overlay",!1));function ae(e,n){if(g(e.type))return"";const c=w(e.type),a=G(e.type),o=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(c?r("c:valAx",{},t("c:axId",b),x(o),t("c:delete",o.visible===!1),t("c:axPos","b"),k(o),C(o.title,u),r("c:numFmt",{formatCode:o.number_format??"General",sourceLinked:o.number_format===void 0?1:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),N(o),t("c:crossAx",y),t("c:crosses","autoZero"),t("c:crossBetween","midCat"),o.major_unit===void 0?"":t("c:majorUnit",o.major_unit)):r("c:catAx",{},t("c:axId",b),x(o),t("c:delete",o.visible===!1),t("c:axPos",a?"l":"b"),k(o),C(o.title,u),n?.numeric===!0?r("c:numFmt",{formatCode:o.number_format??n.categoryFormat??"General",sourceLinked:o.number_format===void 0?1:0}):r("c:numFmt",{formatCode:"General",sourceLinked:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),N(o),t("c:crossAx",y),t("c:crosses","autoZero"),t("c:auto",!0),t("c:lblAlgn","ctr"),t("c:lblOffset",100),t("c:noMultiLvlLbl",!1)))+r("c:valAx",{},t("c:axId",y),x(s),t("c:delete",s.visible===!1),t("c:axPos",a?"b":"l"),k(s),C(s.title,u),r("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"),r("c:spPr",{},f(null)),t("c:crossAx",b),t("c:crosses","autoZero"),t("c:crossBetween",O(e.type)||c?"midCat":"between"),s.major_unit===void 0?"":t("c:majorUnit",s.major_unit))+se(e,u)}function se(e,n){const c=R(e).find(i=>i.secondary);if(!c)return"";const a=e.secondary_axis??{},o=A(c.kind)==="percentStacked",s=a.number_format??(o?"0%":e.series[c.series[0]??0]?.number_format??"General");return r("c:catAx",{},t("c:axId",j),x({}),t("c:delete",!0),t("c:axPos","b"),r("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))+r("c:valAx",{},t("c:axId",T),x(a),t("c:delete",a.visible===!1),t("c:axPos","r"),k(a),C(a.title,n),r("c:numFmt",{formatCode:s,sourceLinked:a.number_format===void 0&&!o?1:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),r("c:spPr",{},f(null)),t("c:crossAx",j),t("c:crosses","max"),t("c:crossBetween","between"),a.major_unit===void 0?"":t("c:majorUnit",a.major_unit))}const ie={bottom:"b",top:"t",left:"l",right:"r"};function le(e,n){const c=n.width,a=n.height,{plot:o}=B(e,c,a),s=i=>Number(i.toFixed(5));return r("c:layout",{},r("c:manualLayout",{},t("c:layoutTarget","inner"),t("c:xMode","edge"),t("c:yMode","edge"),t("c:x",s(o.x/c)),t("c:y",s(o.y/a)),t("c:w",s(o.width/c)),t("c:h",s(o.height/a))))}const D=r("c:spPr",{},r("a:noFill"),r("a:ln",{},r("a:noFill")));export function chartSpaceXml(e,n){const c=e.title!==void 0&&e.title!==""?e.title:void 0,a=e.font_size??m.fontSize,o=Math.round((e.title_size??a*m.titleScale)*100);return J+r("c:chartSpace",{"xmlns:c":Y,"xmlns:a":q,"xmlns:r":K},t("c:date1904",!1),t("c:roundedCorners",!1),r("c:chart",{},c===void 0?"":r("c:title",{},r("c:tx",{},n.titleRef===void 0?U(c,o):r("c:strRef",{},`<c:f>${d(n.titleRef)}</c:f>`,$([c]))),t("c:overlay",!1)),t("c:autoTitleDeleted",c===void 0),r("c:plotArea",{},n.frame?le(e,n.frame):r("c:layout"),ce(e,n.refs),ae(e,n.refs),n.frameless===!0?D:""),e.legend===void 0?"":r("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:"",X(a,e.font_color??"dk1"),n.tail??"")}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{format as Ct,isValidFormat as Lt}from"numfmt";import{brightened as jt}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:jt(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 vt=["accent1","accent2","accent3","accent4","accent5","accent6"];export const accentOf=t=>vt[t%vt.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),l=t.labels?.position;if(l!==void 0&&s.includes(l))return l;if(s.length!==0)return t.type==="pie"?"ctr":isLine(t.type)||isScatter(t.type)?"t":groupingOf(t.type)==="clustered"?"outEnd":"ctr"}export const variesOf=t=>t.vary_by_categories??isRound(t.type);export function formatValue(t,s="General"){return s==="General"||!Lt(s)?String(Number(t.toPrecision(10))):Ct(s,t)}const Ft=[1,2,5,10];export function chartScale(t,s,l,r,e={}){const h=t>0&&(s-t)/s<.16666666666666666?t:Math.min(t,0),a=s<=0&&t<0?0:s,o=e.minimum_scale??h,j=e.maximum_scale??a,b=j>o?j-o:1,F=Math.max(1,Math.floor(l/r)),w=b/F,P=10**Math.floor(Math.log10(w)),O=e.major_unit??(Ft.find(E=>E*P>=w)??10)*P,B=(E,C)=>Number((C(Number((E/O).toFixed(9)))*O).toPrecision(12)),Z=a>0?a+b*.05:a===h?b:a,g=e.maximum_scale??B(Z,Math.ceil),R=h<0?h-b*.05:h,W=e.minimum_scale??B(R,Math.floor),N=[],x=Math.round((g-W)/O);for(let E=0;E<=x;E++)N.push(Number((W+E*O).toPrecision(12)));return{min:W,max:g,major:O,ticks:N}}const it=(t,s)=>{let l=0;for(const r of t)l+=(r.codePointAt(0)??0)>11903?1:CHART_DEFAULTS.letter;return l*s},m=t=>String(Number(t.toFixed(3)));function kt(t){const s=l=>t[Math.max(0,Math.min(t.length-1,l))]??[0,0];return t.map(([l,r],e)=>{if(e===0)return`M${m(l)} ${m(r)}`;const[h,a]=s(e-2),[o,j]=s(e-1),[b,F]=s(e+1),w=`${m(o+(l-h)/6)} ${m(j+(r-a)/6)}`,P=`${m(l-(b-o)/6)} ${m(r-(F-j)/6)}`;return`C${w} ${P} ${m(l)} ${m(r)}`}).join(" ")}const lt=t=>t.map(([s,l],r)=>`${r===0?"M":"L"}${m(s)} ${m(l)}`).join(" ");function Ot(t,s,l,r,e,h){const a=(F,w)=>`${m(t+F*Math.sin(w))} ${m(s-F*Math.cos(w))}`,o=h-e>=Math.PI*2?e+Math.PI*2-1e-4:h,j=o-e>Math.PI?1:0,b=`M${a(l,e)} A${m(l)} ${m(l)} 0 ${String(j)} 1 ${a(l,o)}`;return r<=0?`${b} L${m(t)} ${m(s)} Z`:`${b} L${a(r,o)} A${m(r)} ${m(r)} 0 ${String(j)} 0 ${a(r,e)} Z`}function Wt(t,s,l,r){const e=r*1.5;return s!==void 0&&s!==""&&(t.bottom-=e),l!==void 0&&l!==""&&(t.left+=e),{x:t.left-e/2,y:t.bottom+e/2}}function Et(t,s,l,r,e,h,a){r!==void 0&&r!==""&&t.words.push({x:s.x+s.width/2,y:l.y,text:r,size:h,anchor:"middle",color:a}),e!==void 0&&e!==""&&t.words.push({x:l.x,y:s.y+s.height/2,text:e,size:h,anchor:"middle",color:a,rotate:-90})}const ht=(t,s,l,r,e)=>{const h=t.labels;if(!h)return"";const a=isRound(t.type),o=[];return h.show_series_name&&o.push(r.name),h.show_category_name&&o.push(e),(h.show_value??!(h.show_percentage??!1))&&o.push(formatValue(s,h.number_format??r.number_format)),h.show_percentage&&a&&o.push(formatValue(l,h.number_format??"0%")),o.join(", ")};function Bt(t,s,l,r,e){const h=CHART_DEFAULTS,a=t.category_axis??{},o=t.value_axis??{},j=Wt(l,a.title,o.title,r),b=t.series.map(c=>c.values.flatMap(($,H)=>{const I=c.x?.[H]??(c.x?null:H+1);return I===null||$===null?[]:[[I,$]]})),F=b.flat().map(c=>c[0]),w=b.flat().map(c=>c[1]),P=c=>c.length>0?Math.min(...c):0,O=c=>c.length>0?Math.max(...c):1,B=o.number_format??t.series[0]?.number_format??"General",Z=a.number_format??"General",g=r*.5,R=chartScale(P(w),O(w),l.bottom-l.top,r*2.4,o),W=o.visible===!1?0:Math.max(0,...R.ticks.map(c=>it(formatValue(c,B),r)))+g,N=a.visible===!1?0:r*1.2+g,x={x:l.left+W,y:l.top,width:l.right-l.left-W,height:l.bottom-l.top-N};s.plot=x,Et(s,x,j,a.title,o.title,r,e);const E=chartScale(P(F),O(F),x.width,r*5,a),C=chartScale(P(w),O(w),x.height,r*2.4,o),z=c=>x.x+(Math.min(E.max,Math.max(E.min,c))-E.min)/(E.max-E.min)*x.width,D=c=>x.y+x.height-(Math.min(C.max,Math.max(C.min,c))-C.min)/(C.max-C.min)*x.height;for(const c of C.ticks){const $=D(c);(o.has_major_gridlines??!0)&&s.grid.push({d:`M${m(x.x)} ${m($)} H${m(x.x+x.width)}`,color:o.gridline_color??{rgb:h.gridline},width:h.gridWidth}),o.visible!==!1&&s.words.push({x:x.x-g,y:$,text:formatValue(c,B),size:r,anchor:"end",color:e})}for(const c of E.ticks){const $=z(c);a.has_major_gridlines===!0&&s.grid.push({d:`M${m($)} ${m(x.y)} V${m(x.y+x.height)}`,color:a.gridline_color??{rgb:h.gridline},width:h.gridWidth}),a.visible!==!1&&s.words.push({x:$,y:x.y+x.height+g+r*.6,text:formatValue(c,Z),size:r,anchor:"middle",color:e})}s.axes.push({d:`M${m(x.x)} ${m(D(Math.max(C.min,Math.min(C.max,0))))} H${m(x.x+x.width)}`,color:a.line_color??{rgb:h.axisLine},width:h.gridWidth}),t.series.forEach((c,$)=>{const H=c.color??accentOf($),I=(b[$]??[]).map(([U,Y])=>[z(U),D(Y)]);if(I.length!==0&&(hasLines(t.type)&&s.lines.push({d:t.type==="scatter-smooth"||c.smooth===!0?kt(I):lt(I),color:H,width:c.line_width??h.lineWidth,series:$}),hasMarkers(t.type)))for(const[U,Y]of I)s.dots.push({x:U,y:Y,r:(c.marker_size??h.marker)/2,color:H})})}export function chartDrawing(t,s,l){const r=CHART_DEFAULTS,e=t.font_size??r.fontSize,h=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:s-r.margin,bottom:l-r.margin};if(t.title!==void 0&&t.title!==""){const n=t.title_size??e*r.titleScale;a.words.push({x:s/2,y:o.top+n*.7,text:t.title,size:n,anchor:"middle",color:h}),o.top+=n*1.6}const j=isRound(t.type),b=variesOf(t),F=(n,d)=>b?t.category_colors?.[d]??accentOf(d):t.series[n]?.color??accentOf(n);if(t.legend!==void 0){const n=b?t.categories:t.series.map(p=>p.name),d=e*.6,f=e*.4,i=e*1.5,y=n.map(p=>d+f+it(p,e)),S=(p,M,_)=>{a.keys.push({x:M,y:_-d/2,width:d,height:d,color:b?t.category_colors?.[p]??accentOf(p):t.series[p]?.color??accentOf(p),series:b?0:p,category:b?p:0}),a.words.push({x:M+d+f,y:_,text:n[p]??"",size:e,anchor:"start",color:h})};if(t.legend==="top"||t.legend==="bottom"){const p=y.reduce((A,v)=>A+v,0)+e*(n.length-1),M=t.legend==="top"?o.top+i/2:o.bottom-i/2;let _=(s-p)/2;n.forEach((A,v)=>{S(v,_,M),_+=(y[v]??0)+e}),t.legend_overlay!==!0&&(t.legend==="top"?o.top+=i:o.bottom-=i)}else{const p=Math.max(0,...y),M=t.legend==="left"?o.left:o.right-p,_=(o.top+o.bottom-i*n.length)/2+i/2;n.forEach((A,v)=>{S(v,M,_+v*i)}),t.legend_overlay!==!0&&(t.legend==="left"?o.left+=p+e:o.right-=p+e)}}const w=t.labels,P=w?.size??e,O=w?.color??h,B=(n,d,f,i,y=O)=>{f!==""&&a.words.push({x:n,y:d,text:f,size:P,anchor:i,color:y})};if(j){const n=t.series[0],d=(n?.values??[]).map(_=>Math.max(0,_??0)),f=d.reduce((_,A)=>_+A,0),i=Math.max(0,Math.min(o.right-o.left,o.bottom-o.top)/2),y=(o.left+o.right)/2,S=(o.top+o.bottom)/2,p=t.type==="doughnut"?i*((t.hole_size??r.holeSize)/100):0;a.plot={x:y-i,y:S-i,width:i*2,height:i*2};let M=0;return d.forEach((_,A)=>{const v=f>0?_/f:0,V=M+v*Math.PI*2;if(v>0){a.shapes.push({d:Ot(y,S,i,p,M,V),color:"lt1",width:1,fill:F(0,A),series:0,category:A});const L=(M+V)/2,k=p>0?(i+p)/2:labelPositionOf(t)==="inEnd"?i*.85:i*.6;n&&B(y+k*Math.sin(L),S-k*Math.cos(L),ht(t,_,v,n,t.categories[A]??""),"middle",w?.color??"lt1")}M=V}),a}if(isScatter(t.type))return Bt(t,a,o,e,h),a;const Z=Math.max(1,t.categories.length),g=isHorizontal(t.type),R=groupingOf(t.type),W=R!=="clustered"&&R!=="standard",N=R==="percentStacked",x=t.series.map(n=>t.categories.map((d,f)=>n.values[f]??null)),E=t.categories.map((n,d)=>x.reduce((f,i)=>f+Math.abs(i[d]??0),0)),C=(n,d)=>{const f=x[n]?.[d];if(f==null)return null;const i=E[d]??0;return N?i>0?f/i:0:f};let z=0,D=0;if(t.categories.forEach((n,d)=>{let f=0,i=0;t.series.forEach((y,S)=>{const p=C(S,d)??0;W?p>=0?f+=p:i+=p:(f=Math.max(f,p),i=Math.min(i,p))}),D=Math.max(D,f),z=Math.min(z,i)}),!W){const n=x.flat().filter(d=>d!==null);n.length>0&&Math.min(...n)>0&&(z=Math.min(...n))}N&&(D=1,z=Math.min(z,0));const c=t.value_axis??{},$=t.category_axis??{},H=c.number_format??(N?"0%":t.series[0]?.number_format??"General"),I=g?o.right-o.left:o.bottom-o.top,U=g?e*5:e*2.4,Y=chartScale(z,D,I,U,{...c,...N?{maximum_scale:c.maximum_scale??1}:{}}),dt=c.visible===!1?[]:Y.ticks.map(n=>formatValue(n,H)),mt=Math.max(0,...dt.map(n=>it(n,e))),ot=$.visible!==!1,ft=ot?Math.max(0,...t.categories.map(n=>it(n,e))):0,T=e*.5,ut=g?c.title:$.title,pt=g?$.title:c.title,St=Wt(o,ut,pt,e),u=g?{x:o.left+(ot?ft+T:0),y:o.top,width:0,height:o.bottom-o.top-(c.visible===!1?0:e*1.2+T)}:{x:o.left+(c.visible===!1?0:mt+T),y:o.top,width:0,height:o.bottom-o.top-(ot?e*1.2+T:0)};u.width=o.right-u.x-(g&&dt.length>0?mt/2:0),a.plot=u,Et(a,u,St,ut,pt,e,h);const G=chartScale(z,D,g?u.width:u.height,U,{...c,...N?{maximum_scale:c.maximum_scale??1}:{}}),gt=n=>(Math.min(G.max,Math.max(G.min,n))-G.min)/(G.max-G.min)*(g?u.width:u.height),q=n=>g?u.x+gt(n):u.y+u.height-gt(n),xt=isArea(t.type),yt=$.reverse_order===!0,Mt=g?!yt:yt,at=(g?u.height:u.width)/Z,_t=xt?(g?u.height:u.width)/Math.max(1,Z-1):at,ct=n=>{const d=xt?n*_t:(n+.5)*at,f=g?u.height:u.width,i=Mt?f-d:d;return(g?u.y:u.x)+i},bt=q(Math.max(G.min,Math.min(G.max,0)));for(const n of G.ticks){const d=q(n);(c.has_major_gridlines??!0)&&a.grid.push({d:g?`M${m(d)} ${m(u.y)} V${m(u.y+u.height)}`:`M${m(u.x)} ${m(d)} H${m(u.x+u.width)}`,color:c.gridline_color??{rgb:r.gridline},width:r.gridWidth}),c.visible!==!1&&a.words.push(g?{x:d,y:u.y+u.height+T+e*.6,text:formatValue(n,H),size:e,anchor:"middle",color:h}:{x:u.x-T,y:d,text:formatValue(n,H),size:e,anchor:"end",color:h})}if(a.axes.push({d:g?`M${m(bt)} ${m(u.y)} V${m(u.y+u.height)}`:`M${m(u.x)} ${m(bt)} H${m(u.x+u.width)}`,color:$.line_color??{rgb:r.axisLine},width:r.gridWidth}),ot){const n=g?e*1.3:ft+e,d=Math.max(1,Math.ceil(n/Math.max(1,_t)));t.categories.forEach((f,i)=>{if(i%d!==0)return;const y=ct(i);a.words.push(g?{x:u.x-T,y,text:f,size:e,anchor:"end",color:h}:{x:y,y:u.y+u.height+T+e*.6,text:f,size:e,anchor:"middle",color:h})})}if(isBar(t.type)){const n=(t.gap_width??r.gapWidth)/100,d=W?1:t.series.length,f=W?1:(t.overlap??0)/100,i=at/(Math.max(1,d-(d-1)*f)+n),y=i*(1-f),S=i+y*(d-1);t.categories.forEach((p,M)=>{const _=ct(M);let A=0,v=0;t.series.forEach((V,L)=>{const k=C(L,M);if(k===null)return;const nt=W?k>=0?A:v:0,tt=nt+k;W&&(k>=0?A=tt:v=tt);const J=q(nt),K=q(tt),st=(W?_-i/2:_-S/2+L*y)+(g&&Mt&&!W?S-i-2*L*y:0),Pt=g?{x:Math.min(J,K),y:st,width:Math.abs(K-J),height:i}:{x:st,y:Math.min(J,K),width:i,height:Math.abs(K-J)};if(a.boxes.push({...Pt,color:F(L,M),series:L,category:M}),!w)return;const wt=ht(t,x[L]?.[M]??0,0,V,t.categories[M]??""),rt=labelPositionOf(t),Q=P*.8,At=k>=0?1:-1,$t=(et,X)=>rt==="ctr"?(et+X)/2:rt==="inBase"?et+(X>et?Q:-Q):rt==="inEnd"?X-(X>et?Q:-Q):X+(X>=et?Q:-Q);g?B($t(J,K),st+i/2,wt,rt==="outEnd"?At>0?"start":"end":"middle"):B(st+i/2,$t(J,K),wt,"middle")})})}else{const n=t.categories.map(()=>0),d=t.series.map((f,i)=>{const y=[],S=[];return t.categories.forEach((p,M)=>{const _=C(i,M);if(_===null)return;const A=W?n[M]??0:0,v=A+_;W&&(n[M]=v);const V=ct(M),L=k=>g?[q(k),V]:[V,q(k)];if(y.push(L(v)),S.push(L(A)),isLine(t.type)&&w){const k=labelPositionOf(t),[nt,tt]=L(v);B(nt+(k==="r"?P:k==="l"?-P:0),tt+(k==="t"?-P:k==="b"?P:0),ht(t,x[i]?.[M]??0,0,f,t.categories[M]??""),k==="r"?"start":k==="l"?"end":"middle")}}),{series:f,s:i,points:y,base:S}});for(const{series:f,s:i,points:y,base:S}of d){const p=f.color??accentOf(i);if(isArea(t.type)&&y.length>0)a.shapes.push({d:`${lt([...y,...[...S].reverse()])} Z`,color:p,width:0,fill:p,series:i});else if(y.length>0&&(a.lines.push({d:f.smooth===!0?kt(y):lt(y),color:p,width:f.line_width??r.lineWidth,series:i}),hasMarkers(t.type)))for(const[M,_]of y)a.dots.push({x:M,y:_,r:(f.marker_size??r.marker)/2,color:p})}a.shapes.reverse()}return a}
|
|
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())}}
|
|
@@ -8,12 +8,20 @@ export interface Key {
|
|
|
8
8
|
account: string;
|
|
9
9
|
/** When it stops working (ISO 8601); a key from the environment does not say. */
|
|
10
10
|
expiresAt?: string;
|
|
11
|
+
/** The sign-in's id, sent as DEVICE_HEADER so AllyHub knows which computer asks. */
|
|
12
|
+
device?: string;
|
|
11
13
|
}
|
|
12
14
|
/** Removes anything key-shaped from text that may reach the screen. */
|
|
13
15
|
export declare function scrub(text: string, key?: string): string;
|
|
14
16
|
export declare class Cloud {
|
|
15
17
|
readonly config: CloudConfig;
|
|
16
18
|
constructor(config: CloudConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Run by an agent in Studio, Studio is told a call was refused for
|
|
21
|
+
* credits, and offers the person to buy them. Never fails the command:
|
|
22
|
+
* a Host that does not answer in a second is left.
|
|
23
|
+
*/
|
|
24
|
+
private tellStudio;
|
|
17
25
|
get url(): string;
|
|
18
26
|
/**
|
|
19
27
|
* The key to use, or undefined when this computer is not signed in;
|
|
@@ -38,6 +46,8 @@ export declare class Cloud {
|
|
|
38
46
|
body?: unknown;
|
|
39
47
|
auth?: boolean;
|
|
40
48
|
signal?: AbortSignal;
|
|
49
|
+
/** The team it acts in, when not the one this computer works in. */
|
|
50
|
+
organization?: string;
|
|
41
51
|
}): Promise<unknown>;
|
|
42
52
|
}
|
|
43
53
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -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
|
|
2
|
+
import{createHash as g}from"node:crypto";import{BILLING_PAGE_PATH as h,DEVICE_HEADER as w,EXIT as o,ORGANIZATION_HEADER as f}from"@allyhub/protocol";import{accessOf as p,SignedOut as m}from"./credentials.js";import{CloudError as d,notSignedIn as l,unreachable as y}from"./errors.js";export function scrub(u,n){let t=u.replace(/(authorization)\s*[:=]\s*[^\r\n]+/giu,"$1: <redacted>");return t=t.replace(/\bahk_[A-Za-z0-9_-]+/gu,"<api-key>"),t=t.replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/gu,"<token>"),n&&(t=t.split(n).join("<key>")),t}export class Cloud{config;constructor(n){this.config=n}async tellStudio(){const n=this.config.studioHost;n!==void 0&&await fetch(`${n}/out-of-credits`,{method:"POST",signal:AbortSignal.timeout(1e3)}).then(t=>t.body?.cancel(),()=>{})}get url(){return this.config.url}async key(n={}){const t=this.config.apiKey;if(t)return{key:t,source:"env",account:g("sha256").update(t).digest("hex")};try{const i=await p(this.config,n);if(!i)return;const a=i.credentials.account.organization?.id,e=i.credentials.device;return{key:i.token,source:"oauth",account:i.credentials.account.id,expiresAt:i.expiresAt,...a===void 0?{}:{organization:a},...e===void 0?{}:{device:e}}}catch(i){if(i instanceof m)return;throw y(this.url,i)}}async requireKey(){const n=await this.key();if(!n)throw l();return n}keyedFetch=async(n,t)=>{const i=s=>{const c=new Headers(t?.headers);return c.set("authorization",`Bearer ${s.key}`),s.organization!==void 0&&!c.has(f)&&c.set(f,s.organization),s.device!==void 0&&c.set(w,s.device),this.config.fetch(n,{...t,headers:c})},a=await this.requireKey(),e=await i(a);if(e.status!==401||a.source!=="oauth"||t?.body instanceof ReadableStream||n instanceof Request)return e;const r=await this.key({refused:a.key});return r===void 0?e:(await e.body?.cancel(),i(r))};async json(n,t={}){const i=t.auth!==!1,a=i?(await this.requireKey()).key:void 0;let e;try{e=await(i?this.keyedFetch:this.config.fetch)(`${this.url}${n}`,{redirect:"error",signal:t.signal??AbortSignal.timeout(3e4),method:t.method??"GET",headers:{accept:"application/json",...t.body===void 0?{}:{"content-type":"application/json"},...t.organization===void 0?{}:{[f]:t.organization}},...t.body===void 0?{}:{body:JSON.stringify(t.body)}})}catch(c){throw c instanceof d?c:y(this.url,c)}const r=await e.text(),s=e.ok?void 0:_(r,e.status,a,this.url);if(s?.code==="insufficient-credits"&&await this.tellStudio(),s&&e.status!==401)throw s;if(e.status===403)throw new d("forbidden","This AllyHub account does not have access to this operation.",{exit:o.auth,status:403});if(e.status===401)throw l(i?"This computer's AllyHub sign-in is not valid any more.":void 0);if(!e.ok)throw new d("api-error",`${this.url}${n} answered ${String(e.status)}: ${scrub(r.slice(0,300),a)}`,{exit:e.status>=500?o.platform:o.usage,status:e.status});try{return JSON.parse(r)}catch{throw new d("api-error",`${this.url}${n} did not answer JSON.`,{exit:o.platform,status:e.status})}}}const b={bad_input:o.usage,insufficient_credits:o.auth,plan_required:o.auth,tool_off:o.auth,limit_reached:o.auth,forbidden:o.auth,not_found:o.notFound,conflict:o.conflict,worked_elsewhere:o.conflict};function _(u,n,t,i){let a;try{a=JSON.parse(u)}catch{return}const e=a?.error;if(typeof e?.code!="string"||typeof e.message!="string")return;const r=e.code==="insufficient_credits"?`Buy credits at ${i}${h}, or ask an owner or admin of the team to.`:e.code==="plan_required"?`Subscribe at ${i}${h}, or ask an owner or admin of the team to.`:e.code==="tool_off"?`Turn it on in Capabilities at ${i}/, or ask an owner or admin of the team to.`:typeof e.hint=="string"?e.hint:void 0;return new d(e.code.replaceAll("_","-"),scrub(e.message,t),{exit:b[e.code]??o.platform,status:n,...r===void 0?{}:{hint:r},...typeof e.data=="object"&&e.data!==null?{data:e.data}:{}})}
|
|
@@ -15,9 +15,18 @@ export interface CloudConfig {
|
|
|
15
15
|
apiKey?: string;
|
|
16
16
|
/** The fetch every request goes through (a test's own). */
|
|
17
17
|
fetch: typeof fetch;
|
|
18
|
+
/** The program, as its User-Agent's product names it ("AllyHub-Studio/0.9.1"): told to AllyHub as it signs in. */
|
|
19
|
+
client?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Studio's Host, when an agent in Studio runs this (`ALLYHUB_STUDIO_HOST`,
|
|
22
|
+
* a loopback address with its token): told when a call is refused for
|
|
23
|
+
* credits, so Studio offers to buy them.
|
|
24
|
+
*/
|
|
25
|
+
studioHost?: string;
|
|
18
26
|
}
|
|
19
27
|
export declare function cloudConfig(env: Readonly<Record<string, string | undefined>>, options?: {
|
|
20
28
|
fetch?: typeof fetch;
|
|
29
|
+
client?: string;
|
|
21
30
|
}): CloudConfig;
|
|
22
31
|
/** "https://…", marked when a variable set it: a test box is never taken for production. */
|
|
23
32
|
export declare function hostsText(c: CloudConfig): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{homedir as s}from"node:os";import{join as
|
|
2
|
+
import{homedir as s}from"node:os";import{join as m}from"node:path";import{API_KEY_ENV as l,CREDENTIALS_FILE as d}from"@allyhub/protocol";import{cacheHome as _}from"@allyhub/runtimes";import{osKeychain as h}from"./keychain.js";const H="https://app.allyhub.com",U=["ALLYHUB_URL"],A=o=>o.replace(/\/+$/u,"");export function cloudConfig(o,r={}){const i=o[l]?.trim(),t=A(o.ALLYHUB_URL??H),e=o.ALLYHUB_HOME,c=r.client??o.ALLYHUB_CLIENT,n=m(e??s(),d),f=o.ALLYHUB_CREDENTIALS_STORE,L=f==="keychain"||f!=="file"&&e===void 0?h({service:"AllyHub",account:e===void 0?t:`${t} ${n}`}):void 0;return{url:t,from:U.filter(u=>o[u]!==void 0),credentialsFile:n,...L?{keychain:L}:{},cacheDir:m(_(o),"cloud"),...i?{apiKey:i}:{},fetch:r.fetch??fetch,...c===void 0?{}:{client:c},...o.ALLYHUB_STUDIO_HOST?{studioHost:o.ALLYHUB_STUDIO_HOST}:{}}}export function hostsText(o){return o.from.length>0?`${o.url} (from ${o.from.join(", ")})`:o.url}
|
|
@@ -28,7 +28,7 @@ export declare function forgetCredentials(c: Where, refreshToken?: string): Prom
|
|
|
28
28
|
/** Who an access token is, and the organization it acts in. */
|
|
29
29
|
export declare function accountOf(c: Pick<CloudConfig, "url" | "fetch">, token: string): Promise<Account>;
|
|
30
30
|
/** A code from the authorization endpoint, with its PKCE verifier, made this computer's sign-in. */
|
|
31
|
-
export declare function signInWithCode(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain">, exchange: {
|
|
31
|
+
export declare function signInWithCode(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain" | "client">, exchange: {
|
|
32
32
|
code: string;
|
|
33
33
|
codeVerifier: string;
|
|
34
34
|
redirectUri: string;
|
|
@@ -38,7 +38,7 @@ export declare function signInWithCode(c: Pick<CloudConfig, "url" | "fetch" | "c
|
|
|
38
38
|
* with no browser: `show` is given the code and the address to enter it
|
|
39
39
|
* at, then this waits, polling as the server asks, until the person has.
|
|
40
40
|
*/
|
|
41
|
-
export declare function signInWithDevice(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain">, show: (device: DeviceAuthorization) => void, signal?: AbortSignal): Promise<Credentials>;
|
|
41
|
+
export declare function signInWithDevice(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain" | "client">, show: (device: DeviceAuthorization) => void, signal?: AbortSignal): Promise<Credentials>;
|
|
42
42
|
/**
|
|
43
43
|
* An access token from the computer's sign-in: the one kept while it has
|
|
44
44
|
* more than a minute left, else a new one made with the refresh token
|
|
@@ -50,7 +50,7 @@ export declare function signInWithDevice(c: Pick<CloudConfig, "url" | "fetch" |
|
|
|
50
50
|
* sign-in another version kept in its file moves its tokens to the
|
|
51
51
|
* system's store, where there is one.
|
|
52
52
|
*/
|
|
53
|
-
export declare function accessOf(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain">, o?: {
|
|
53
|
+
export declare function accessOf(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain" | "client">, o?: {
|
|
54
54
|
refused?: string;
|
|
55
55
|
}): Promise<{
|
|
56
56
|
token: string;
|
|
@@ -62,7 +62,7 @@ export declare function accessOf(c: Pick<CloudConfig, "url" | "fetch" | "credent
|
|
|
62
62
|
* 7009), every program here with it, and the file and the store's entry forgotten. The file goes
|
|
63
63
|
* even when AllyHub cannot be reached; that it was not revoked is thrown after.
|
|
64
64
|
*/
|
|
65
|
-
export declare function signOut(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain">, credentials: Credentials): Promise<void>;
|
|
65
|
+
export declare function signOut(c: Pick<CloudConfig, "url" | "fetch" | "credentialsFile" | "keychain" | "client">, credentials: Credentials): Promise<void>;
|
|
66
66
|
/**
|
|
67
67
|
* The organization this computer's requests act in from now on (and pay
|
|
68
68
|
* from): kept in the credentials file, under its lock, so a refresh at the
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{randomBytes as
|
|
3
|
-
`,{mode:384}),await
|
|
2
|
+
import{randomBytes as T}from"node:crypto";import{chmod as C,mkdir as m,readFile as b,rename as P,rm as h,stat as O,writeFile as z}from"node:fs/promises";import{dirname as x}from"node:path";import*as y from"zod";import{ACCOUNT_PATH as I,AccountSchema as j,AuthServerSchema as N,CLIENT_ID as w,CredentialsFileSchema as $,DeviceAuthorizationSchema as R,METADATA_PATH as J,OAuthErrorSchema as L,SCOPES as U,TokenResponseSchema as B}from"@allyhub/protocol";import{deviceHeaders as W,newDeviceId as E}from"./device.js";import{notSignedIn as G}from"./errors.js";export class SignedOut extends Error{}const K=6e4,p={waitMs:15e3,staleMs:3e4,stepMs:50},g=new Map;export function authServer(e){let n=g.get(e.url);return n||(n=(async()=>{const t=await e.fetch(`${e.url}${J}`,{redirect:"error",headers:{accept:"application/json"},signal:AbortSignal.timeout(3e4)});if(!t.ok)throw new Error(`AllyHub's sign-in metadata answered ${String(t.status)}.`);return N.parse(await t.json())})(),n.catch(()=>g.delete(e.url)),g.set(e.url,n)),n}const V=y.object({revision:y.string().min(1),refreshToken:y.string().min(1),access:$.shape.access}),k=new Map;async function q(e,n,t){const r=k.get(e.credentialsFile);if(!t&&r?.revision===n)return r;if(e.keychain)try{const i=await e.keychain.get(),a=V.safeParse(i===void 0?void 0:JSON.parse(i));return!a.success||a.data.revision!==n?void 0:(k.set(e.credentialsFile,a.data),a.data)}catch{return}}export async function readCredentials(e,n=!1){for(let t=0;t<3;t+=1){let r;try{const a=$.safeParse(JSON.parse(await b(e.credentialsFile,"utf8")));if(!a.success||a.data.url!==e.url)return;r=a.data}catch{return}if(r.keychain===void 0)return r.refreshToken===void 0?void 0:{...r,refreshToken:r.refreshToken};const i=await q(e,r.keychain,n||t>0);if(i){const{access:a,refreshToken:o}=i;return{...r,refreshToken:o,...a?{access:a}:{}}}await new Promise(a=>setTimeout(a,p.stepMs))}}export async function writeCredentials(e,n){const{refreshToken:t,access:r,...i}=n,a={version:i.version,url:i.url,issuer:i.issuer,account:i.account,since:i.since};let o={...a,refreshToken:t,...r?{access:r}:{}};if(e.keychain){const f={revision:T(9).toString("base64url"),refreshToken:t,...r?{access:r}:{}},A=JSON.stringify(f);try{if(await e.keychain.set(A),await e.keychain.get()!==A)throw new Error(`${e.keychain.name} did not keep the sign-in.`);k.set(e.credentialsFile,f),o={...a,keychain:f.revision}}catch{}}const d=e.credentialsFile,u=`${JSON.stringify(o,null,2)}
|
|
3
|
+
`,c=await O(d).catch(()=>{});if(c!==void 0&&(c.mode&511)===384&&await b(d,"utf8").catch(()=>{})===u)return;await m(x(d),{recursive:!0,mode:448});const s=`${d}.${T(6).toString("hex")}.tmp`;try{await z(s,u,{mode:384}),await C(s,384),await P(s,d)}finally{await h(s,{force:!0})}}export async function forgetCredentials(e,n){if(n!==void 0){const t=await readCredentials(e,!0);if(t!==void 0&&t.refreshToken!==n)return}await h(e.credentialsFile,{force:!0}),k.delete(e.credentialsFile),await e.keychain?.delete().catch(()=>{})}async function _(e,n){const t=`${e}.lock`;await m(x(e),{recursive:!0,mode:448});const r=Date.now()+p.waitMs;for(;;)try{await m(t);break}catch{const i=await O(t).catch(()=>{});if(i&&Date.now()-i.mtimeMs>p.staleMs){await h(t,{recursive:!0,force:!0});continue}if(Date.now()>r)throw new Error("Another AllyHub program holds the sign-in's lock.");await new Promise(a=>setTimeout(a,p.stepMs))}try{return await n()}finally{await h(t,{recursive:!0,force:!0})}}async function l(e,n,t,r,i={}){return e.fetch(n,{method:"POST",redirect:"error",headers:{...i,"content-type":"application/x-www-form-urlencoded",accept:"application/json"},body:new URLSearchParams(t).toString(),signal:r??AbortSignal.timeout(3e4)})}async function S(e){const n=await e.json().catch(()=>({}));if(e.ok)return B.parse(n);const t=L.safeParse(n);return{error:t.success?t.data.error:`http_${String(e.status)}`}}const D=e=>({token:e.access_token,expiresAt:new Date(Date.now()+e.expires_in*1e3).toISOString()});export async function accountOf(e,n){const t=await e.fetch(`${e.url}${I}`,{redirect:"error",headers:{authorization:`Bearer ${n}`,accept:"application/json"},signal:AbortSignal.timeout(3e4)});if(t.status===401)throw new SignedOut("This computer is signed out of AllyHub.");if(!t.ok)throw new Error(`Reading the account: AllyHub answered ${String(t.status)}.`);const r=await t.json();return j.parse({id:r.id,email:r.email,...r.name?{name:r.name}:{},...r.organization?{organization:r.organization}:{}})}const Q=e=>e.client??"AllyHub",v=(e,n)=>W(Q(e),n),F=async e=>(await readCredentials(e).catch(()=>{}))?.device??E();async function H(e,n,t){if(n.refresh_token===void 0)throw new Error("AllyHub gave no refresh token.");const r=await authServer(e),i={version:1,url:e.url,issuer:r.issuer,account:await accountOf(e,n.access_token),refreshToken:n.refresh_token,access:D(n),since:new Date().toISOString(),device:t},a=await readCredentials(e).catch(()=>{});return await writeCredentials(e,i),a!==void 0&&a.refreshToken!==i.refreshToken&&await M(e,r.revocation_endpoint,a.refreshToken).then(o=>o.body?.cancel()).catch(()=>{}),i}const M=(e,n,t)=>l(e,n,{token:t,token_type_hint:"refresh_token",client_id:w});export async function signInWithCode(e,n){const t=await authServer(e),r=await F(e),i=await S(await l(e,t.token_endpoint,{grant_type:"authorization_code",client_id:w,code:n.code,redirect_uri:n.redirectUri,code_verifier:n.codeVerifier,resource:e.url},void 0,await v(e,r)));if("error"in i)throw new Error(`Signing in: AllyHub refused the code (${i.error}).`);return H(e,i,r)}export async function signInWithDevice(e,n,t){const r=await authServer(e),i=await l(e,r.device_authorization_endpoint,{client_id:w,scope:U,resource:e.url});if(!i.ok)throw new Error(`Asking for a device's code: AllyHub answered ${String(i.status)}.`);const a=R.parse(await i.json()),o=await F(e),d=await v(e,o);n(a);let u=(a.interval??5)*1e3;const c=Date.now()+a.expires_in*1e3;for(;Date.now()<c;){if(await new Promise(f=>setTimeout(f,u)),t?.aborted===!0)throw new Error("Signing in was stopped.");const s=await S(await l(e,r.token_endpoint,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:w,device_code:a.device_code,resource:e.url},void 0,d));if(!("error"in s))return H(e,s,o);if(s.error!=="authorization_pending"){if(s.error==="slow_down"){u+=5e3;continue}throw new Error(s.error==="access_denied"?"The sign-in was turned down.":`Signing in: AllyHub refused (${s.error}).`)}}throw new Error("The device's code ran out before it was entered.")}export async function accessOf(e,n={}){const t=o=>o?.access!==void 0&&o.access.token!==n.refused&&Date.parse(o.access.expiresAt)-K>Date.now()?{token:o.access.token,expiresAt:o.access.expiresAt,credentials:o}:void 0;let r=await readCredentials(e);if(!r||(e.keychain&&r.keychain===void 0&&(r=await _(e.credentialsFile,async()=>{const o=await readCredentials(e,!0);return o&&o.keychain===void 0&&await writeCredentials(e,o),o})),!r))return;const i=t(r);if(i)return i;const a=await authServer(e);return _(e.credentialsFile,async()=>{const o=await readCredentials(e,!0);if(!o)return;const d=t(o);if(d)return d;const u=o.device??E(),c=await S(await l(e,a.token_endpoint,{grant_type:"refresh_token",client_id:w,refresh_token:o.refreshToken,resource:e.url},void 0,await v(e,u)));if("error"in c)throw c.error==="invalid_grant"?(await forgetCredentials(e,o.refreshToken),new SignedOut("This computer is signed out of AllyHub.")):new Error(`Renewing the sign-in: AllyHub answered ${c.error}.`);const s={...o,refreshToken:c.refresh_token??o.refreshToken,access:D(c),device:u};return await writeCredentials(e,s),{token:s.access?.token??c.access_token,expiresAt:s.access?.expiresAt??"",credentials:s}})}export async function signOut(e,n){await forgetCredentials(e,n.refreshToken);const t=await authServer(e),r=await M(e,t.revocation_endpoint,n.refreshToken);if(await r.body?.cancel(),!r.ok&&r.status!==400)throw new Error(`Signing out: AllyHub answered ${String(r.status)}.`)}export async function chooseOrganization(e,n){await _(e.credentialsFile,async()=>{const t=await readCredentials(e,!0);if(!t)throw G();await writeCredentials(e,{...t,account:{...t.account,organization:n}})})}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The computer's name and system. */
|
|
2
|
+
export interface Computer {
|
|
3
|
+
name: string;
|
|
4
|
+
os: string;
|
|
5
|
+
}
|
|
6
|
+
/** This computer, read once per process. */
|
|
7
|
+
export declare function thisComputer(): Promise<Computer>;
|
|
8
|
+
/** A new sign-in's id (DEVICE_HEADER). */
|
|
9
|
+
export declare const newDeviceId: () => string;
|
|
10
|
+
/** What a token request says of the computer, for the sign-in `device`, from the program `client` ("AllyHub-Studio/0.9.1"). */
|
|
11
|
+
export declare function deviceHeaders(client: string, device: string): Promise<Record<string, string>>;
|
|
12
|
+
//# sourceMappingURL=device.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{execFile as u}from"node:child_process";import{randomBytes as l}from"node:crypto";import{arch as p,hostname as d,platform as s,release as r}from"node:os";import{DEVICE_HEADER as w,DEVICE_NAME_HEADER as f}from"@allyhub/protocol";const a=(e,t)=>new Promise(n=>{u(e,t,{timeout:2e3},(m,c)=>{const o=c.trim();n(m===null&&o!==""?o:void 0)})});let i;export function thisComputer(){return i??=(async()=>{const e=d().replace(/\.local$/u,"");switch(s()){case"darwin":{const[t,n]=await Promise.all([a("/usr/sbin/scutil",["--get","ComputerName"]),a("/usr/bin/sw_vers",["-productVersion"])]);return{name:t??e,os:`macOS ${n??r()}`}}case"win32":return{name:e,os:`Windows ${r()}`};case"linux":return{name:e,os:`Linux ${r()}`};default:return{name:e,os:`${s()} ${r()}`}}})(),i}export const newDeviceId=()=>l(18).toString("base64url");export async function deviceHeaders(e,t){const n=await thisComputer();return{"user-agent":`${e} (${n.os}; ${p()})`,[w]:t,[f]:encodeURIComponent(n.name)}}
|