allyhub 0.19.0 → 0.20.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/dist/commands/align.js +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/cloud-tools.js +1 -1
- package/dist/commands/cloud.js +1 -1
- package/dist/commands/dev.js +5 -5
- package/dist/commands/export.js +3 -0
- package/dist/commands/frames/doc.js +1 -1
- package/dist/commands/frames/piece.js +1 -1
- package/dist/commands/frames/sheet.js +1 -1
- package/dist/commands/frames.js +9 -9
- package/dist/commands/index.js +1 -1
- package/dist/commands/inspect/combos.js +1 -1
- package/dist/commands/inspect/common.js +2 -2
- package/dist/commands/inspect/facts.js +2 -2
- package/dist/commands/migrate.js +3 -0
- package/dist/commands/skills.js +3 -3
- package/dist/commands/upgrade.js +5 -0
- package/dist/commands.json +1 -1
- package/dist/help.js +3 -3
- package/dist/main.js +8 -7
- package/dist/node_modules/@allyhub/3d-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/blocks/LICENSE +241 -0
- package/dist/node_modules/@allyhub/blocks/dist/alt.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/elements.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/flow-resolve.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/flow-table.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/format.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/gantt.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/grids.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/html.js +75 -0
- package/dist/node_modules/@allyhub/blocks/dist/icons.generated.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/icons.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/layout.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/look.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/measure.js +3 -0
- package/dist/node_modules/@allyhub/blocks/dist/model.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/page.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/palette.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/path.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/resolve.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/samples.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/sankey.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/svg.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/tidy.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/trees.js +2 -0
- package/dist/node_modules/@allyhub/blocks/package.json +19 -0
- package/dist/node_modules/@allyhub/browser/dist/html.js +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/fonts.js +9 -3
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/migrate.js +2 -0
- package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
- package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
- package/dist/node_modules/@allyhub/build/package.json +5 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-file.js +2 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +4 -3
- package/dist/node_modules/@allyhub/chart/dist/chart.js +4 -2
- package/dist/node_modules/@allyhub/chart/dist/chartex-xml.js +4 -0
- package/dist/node_modules/@allyhub/chart/dist/classic.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/embedded.js +2 -2
- package/dist/node_modules/@allyhub/chart/dist/extended.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/svg.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/tree.js +2 -0
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/call.js +4 -4
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/storage.js +2 -0
- package/dist/node_modules/@allyhub/cloud/dist/uploads.js +2 -2
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/background.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/item-process.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/item-worker.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/pages.js +20 -1
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/validate.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/writer.js +3 -3
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/dist/rules.js +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/color.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/docx-read.js +12 -0
- package/dist/node_modules/@allyhub/doc/dist/docx.js +5 -4
- package/dist/node_modules/@allyhub/doc/dist/html.js +83 -48
- package/dist/node_modules/@allyhub/doc/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/markdown.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/merges.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/numbering.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/omml.js +3 -0
- package/dist/node_modules/@allyhub/doc/dist/page.js +2 -1
- package/dist/node_modules/@allyhub/doc/dist/paper.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/parse.js +5 -4
- package/dist/node_modules/@allyhub/doc/dist/redline.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/revisions.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/shapes.js +4 -0
- package/dist/node_modules/@allyhub/doc/dist/styles.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/table.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/write.js +65 -39
- package/dist/node_modules/@allyhub/doc/package.json +5 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/build.js +2 -2
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/find.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/import.js +3 -0
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/index.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/styles.js +4 -0
- package/dist/node_modules/@allyhub/doc-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +22 -2
- package/dist/node_modules/@allyhub/doc-print/dist/drawn.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc-print/dist/layout.js +8 -7
- package/dist/node_modules/@allyhub/doc-print/dist/print.js +22 -16
- 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/blocks-flow.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/blocks.d.ts +146 -0
- package/dist/node_modules/@allyhub/formats/dist/data/blocks.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/cell-styles.d.ts +9 -0
- package/dist/node_modules/@allyhub/formats/dist/data/cell-styles.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +47 -40
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/diagram-kinds.d.ts +6 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagram-kinds.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagrams.d.ts +29 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagrams.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +18 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/page-data.d.ts +59 -0
- package/dist/node_modules/@allyhub/formats/dist/data/page-data.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/reference.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +698 -258
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +14104 -2167
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/themes.d.ts +82 -0
- package/dist/node_modules/@allyhub/formats/dist/data/themes.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/tokens.d.ts +67 -0
- package/dist/node_modules/@allyhub/formats/dist/data/tokens.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +42 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/index.d.ts +7 -0
- package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +12 -3
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +3260 -290
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/tolerant.d.ts +45 -0
- package/dist/node_modules/@allyhub/formats/dist/tolerant.js +2 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/html-extension/dist/project-tools.js +21 -9
- package/dist/node_modules/@allyhub/html-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/html-extension/markup/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/html-extension/markup/markup.json +14 -4
- package/dist/node_modules/@allyhub/html-extension/markup/pages/budget.html +22 -1
- package/dist/node_modules/@allyhub/html-extension/package.json +9 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/fonts.js +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/inspect.js +2 -2
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/build-plugins.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +1 -1
- package/dist/node_modules/@allyhub/image-measure/dist/layout.js +2 -2
- 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/dist/block.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -3
- package/dist/node_modules/@allyhub/linkedin-extension/skills/allyhub/references/linkedin.md +3 -3
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/analyses/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/asr/transcribe.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/ocr/text.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/vision/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/vision/index-media.js +3 -2
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/markup/csv/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/markup.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/markup/document/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/markup.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/mce.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/node.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ns.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/opc.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/export.d.ts +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +2 -0
- package/dist/node_modules/@allyhub/piece/dist/look.d.ts +10 -2
- package/dist/node_modules/@allyhub/piece/dist/look.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/media.d.ts +8 -2
- package/dist/node_modules/@allyhub/piece/dist/script.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +3 -0
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/media-index.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/page-frame.js +2 -0
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/footage.js +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/packages.js +2 -2
- package/dist/node_modules/@allyhub/runtimes/dist/runtimes.js +3 -3
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/dist/index.js +12 -8
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/server.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/cell-styles.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/file.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/heatmap.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/paginate.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/printed.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/sdk.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/sparklines.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/theme.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/tiles.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/units.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/write.js +14 -14
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/theme.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/cli/sheet.js +7 -7
- package/dist/node_modules/@allyhub/sheet-extension/dist/code.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/evaluate.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/export.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/inspect.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/migrations.js +4 -0
- package/dist/node_modules/@allyhub/sheet-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +7 -3
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/code.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/office-layouts.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/styles/brief.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/editorial.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/index.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/kit.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/layouts.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/pitch.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/stage.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/tiles.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/theme.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/cli/slides.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/dist/deck-fonts.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +24 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/charts.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/fonts.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/image-size.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/code.js +3 -3
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/index.js +7 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/names.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/script.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/mtx.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chart.js +3 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chartex.js +3 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/common.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/index.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/table.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/timing.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/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 +3 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub/slides-runtime/dist/load.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/files/archivo-black-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/files/archivo-black-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/host.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.html +42 -0
- package/dist/node_modules/@allyhub/stage-page/dist/style-faces.js +2 -0
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +96 -92
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/dist/limit.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/package.json +5 -1
- package/dist/node_modules/@allyhub/text-extension/markup/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/footage-motion.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/seams.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/cli/reference-text.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/index.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/joins.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/loop.js +3 -0
- package/dist/node_modules/@allyhub/video-extension/package.json +2 -25
- package/dist/node_modules/@allyhub/video-measure/dist/check.js +2 -2
- package/dist/node_modules/@allyhub/video-measure/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/dist/seams.js +1 -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/free.js +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/website/dist/website.js +2 -2
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +3 -3
- package/dist/node_modules/@allyhub/x-extension/package.json +1 -3
- package/dist/node_modules/@allyhub/x-extension/skills/allyhub/references/x.md +3 -3
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +14 -14
- package/dist/self-upgrade.js +2 -0
- package/dist/text/batch-text.js +1 -1
- package/dist/text/facts-text.js +5 -5
- package/dist/text/format.js +2 -2
- package/dist/update-notice.js +3 -0
- package/dist/version.js +1 -1
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-DYaMS_BB.js → abnfDiagram-WEYOIA3C-BkVJMd53.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-g_Tjfl_y.js → architecture-WOLXFQ4H-C6rnaynZ.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-CqdhofOL.js → architectureDiagram-ZHVYKT53-D3vrh8LK.js} +1 -1
- package/editor-web/assets/arrow-down-D-QZrqcz.js +1 -0
- package/editor-web/assets/arrow-up-B1zjKUHX.js +1 -0
- package/editor-web/assets/article-DHf6mOY_.js +7 -0
- package/editor-web/assets/article-Dns1-Xh-.js +3 -0
- package/editor-web/assets/{audio-lines-PZj77e7t.js → audio-lines-BFoW_IeO.js} +1 -1
- package/editor-web/assets/bar-button-CKPfx2AB.js +1 -0
- package/editor-web/assets/{blockDiagram-RJAE7QA3-Bc-28Bci.js → blockDiagram-RJAE7QA3-BKngt8H7.js} +1 -1
- package/editor-web/assets/{browser-C9NP0ZYz.js → browser-DEGNhKTV.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-CTGJb8FB.js → c4Diagram-XDPPPE54-j7sUELqF.js} +1 -1
- package/editor-web/assets/calc-worker-Cr4a0xmt.js +168 -0
- package/editor-web/assets/channel-CVWSV3su.js +1 -0
- package/editor-web/assets/{chart-no-axes-column-Be0lFcGF.js → chart-no-axes-column-Dyy25XZ_.js} +1 -1
- package/editor-web/assets/chip-Bn_9JRRG.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-B2MPOVTU.js → chunk-2E7WHVMD-BXa-uRSi.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-BUV1ZHP0.js → chunk-4EMNKR2T-B3ntcsZN.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BZlpspL5.js → chunk-55XCU76K-AMvnFwUg.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-CpKeisWE.js → chunk-7S6XSTFO-BA6esfFu.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-BJqwAPyo.js → chunk-AQDTSKZB-BT_vANXs.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-D6oPWl_W.js → chunk-DSNLSHJZ-DoUgmzGB.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-B5pk4MZF.js → chunk-HAGFOTED-DtnIrCZb.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-DHbSPvxQ.js → chunk-HNE4Q36P-BlPwQx3_.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-CcL_GcRA.js → chunk-NQOKRVIF-D2r7jp2r.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-YgiOL6XE.js → chunk-UHW7PFBP-Cmc0_F5o.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-p14b4UYc.js → chunk-VQ5W62QI-nJSMqAr0.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-BWW0x-XH.js → chunk-WQQL4CDK-Btq2nbF6.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-oG3qd68C.js → chunk-YZO67HFG-DTbcCoGt.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-CpcheH0u.js → chunk-ZAUX2LTX-DVwkg-2N.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-cWQvLl1w.js → chunk-ZCHMQSOR-BV39jOOE.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-7PG7YcdU.js → classDiagram-v2-4MYWR3UA-Cj74-fhM.js} +1 -1
- package/editor-web/assets/code-Ch6AB5bZ.js +1 -0
- package/editor-web/assets/collaborator-XiHOxwGM.js +1 -0
- package/editor-web/assets/{copy-CuJSs0nI.js → copy-SoaMYqsN.js} +1 -1
- package/editor-web/assets/{createLucideIcon-lm_6n8YT.js → createLucideIcon-euu7Wcd9.js} +1 -1
- package/editor-web/assets/{cynefin-EF2NZ3EQ-CtcknEQ_.js → cynefin-EF2NZ3EQ-C0CkiipV.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-Ca7VIsjN.js → cynefinDiagram-WF24UDRP-hdsnJ4cI.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-BzcSLtsr.js → dagre-NK4GIZVX-CC7WSgaK.js} +1 -1
- package/editor-web/assets/deck-DQpNIS2p.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-DpRmTGlG.js → diagram-CBK3MWTC-DmaVm13J.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-BTrs_AX8.js → diagram-I5XIIV2D-De8jqp7b.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-CkIVjPqH.js → diagram-ODIL2UCW-B5pBTulX.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-BlFMbAG1.js → diagram-PFBEJUXE-BYsXg5_w.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-D3f8VJ-D.js → diagram-RJA3I4VV-DZ8f6bYe.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-Bbpngj6F.js → diagram-TYUNFSNR-qXHUsauD.js} +1 -1
- package/editor-web/assets/dist--z0ZHp4T.js +16 -0
- package/editor-web/assets/dist-9kuRjUTN.js +41 -0
- package/editor-web/assets/dist-B3rd02Cg.js +6 -0
- package/editor-web/assets/dist-B5GOGGEe.js +1 -0
- package/editor-web/assets/dist-Bx6q9kCu.js +1 -0
- package/editor-web/assets/dist-C4hHtrJr.js +1 -0
- package/editor-web/assets/dist-CCXJewsi.js +19 -0
- package/editor-web/assets/dist-CfK2BLl8.js +4 -0
- package/editor-web/assets/dist-Cmux3oJ_.js +1 -0
- package/editor-web/assets/dist-Cspf85KV.js +6 -0
- package/editor-web/assets/dist-DA72-4WB.js +82 -0
- package/editor-web/assets/{dist-DruvDNQe.js → dist-DAhe-kFC.js} +5 -5
- package/editor-web/assets/dist-DIJnhQFK.js +9 -0
- package/editor-web/assets/dist-DOrGo1GD.js +19 -0
- package/editor-web/assets/{dist-Bd8IxQPP.js → dist-DQ6RpEJD.js} +2 -2
- package/editor-web/assets/dist-DjiCHlSu.js +35 -0
- package/editor-web/assets/dist-Do4a40Wn.js +19 -0
- package/editor-web/assets/dist-FKEWS3Co.js +547 -0
- package/editor-web/assets/dist-QKd2i6kG.js +5 -0
- package/editor-web/assets/dist-SGnOfLhx.js +24 -0
- package/editor-web/assets/dist-VmVB7tl4.js +3 -0
- package/editor-web/assets/{docx-draw-CoK1oqQD.js → docx-draw-L54blreB.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-BaKj-yL6.js → ebnfDiagram-V4P3TTPT-B7-IfVI-.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-Cn2qv1_U.js → elk-QONTBCTQ-Gj_WaeBn.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-Bd7AEIDo.js → erDiagram-KYQIGQAA-BDF6Qoqx.js} +1 -1
- package/editor-web/assets/esm-PQD5Pn8a.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-Sfp7_461.js → eventmodeling-K75KTNOO-elxVXXEe.js} +1 -1
- package/editor-web/assets/{file-question-mark-DlIjUK37.js → file-question-mark-PeZgyqkK.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-B-25n8zE.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-CBqcGdHI.js → ganttDiagram-R7GPNTJY-CEogW3jW.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-WTokXKTW.js → gitGraph-VSP46ZUC-Bh9cRWFa.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-BIWZHD9q.js → gitGraphDiagram-PDYL7XHY-BQAvdM_V.js} +1 -1
- package/editor-web/assets/{group-BdrTp7gi.js → group-DwM2yqU8.js} +1 -1
- package/editor-web/assets/hint-CbwoSBMw.js +1 -0
- package/editor-web/assets/index-CXisi0Cj.css +2 -0
- package/editor-web/assets/index-wMlfx8aT.js +28 -0
- package/editor-web/assets/{info-OHQRW6UA-COC6G-_J.js → info-OHQRW6UA-CdPrqere.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-DpaqdKBD.js → infoDiagram-MVDRKAX5-uwIMeP44.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-Dyn2MAy1.js → ishikawaDiagram-HPEHV2GE-rtfvqK7E.js} +1 -1
- package/editor-web/assets/iso-UwGLGD3F.js +1 -0
- package/editor-web/assets/{italic-zw4_eUNF.js → italic-BV7iHxoP.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-DeSVfmm7.js → journeyDiagram-BOSHW7O7-mmhfIyVG.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-Bfg0lj7B.js → kanban-definition-FNSA4HC5-Fe7jBsi-.js} +1 -1
- package/editor-web/assets/{link-DopSU3aa.js → link-CFOv3nz-.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-CyhovuYE.js → mermaid-parser.core-BxOSjBH9.js} +3 -3
- package/editor-web/assets/{mermaid.core-Dx1fBVUG.js → mermaid.core-BOln9YdH.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-QEU2HF_m.js → mindmap-definition-6OY57UG3-M3Q1LOtO.js} +1 -1
- package/editor-web/assets/minus-ngE8owxs.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-ReJTa_hw.js → packet-JDAUHWVQ-Dbb0TUG6.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-Bo1jFrvb.js → pegDiagram-ECIUJNBX-BZMRpSFC.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-BrtYafNA.js → pie-XZMESJXO-Ctm9XdKp.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-Cj0zQqs_.js → pieDiagram-GNMPY74T-cGbs5ZTl.js} +1 -1
- package/editor-web/assets/progress-DZQTiRLv.js +6 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-D5npDAVn.js → quadrantDiagram-D57K4MC3-BUe_zsxT.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-C8RDrRqi.js → radar-ABXABTNO-CCmKtqLs.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-ebDrmYTK.js → railroad-I3PHUGI6-k-yhjhjA.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-BxKuqg6V.js → railroad-abnf-LNEFI6M7-B-PvntB3.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DOclnfpr.js → railroad-ebnf-DWYD2UWJ-Ds2rua1h.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-DN0A1fpq.js → railroad-peg-JR7BVNR7-jNZ2wEp2.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-B3PjoVWw.js → railroadDiagram-Y72NRBL7-CTqSQ15w.js} +1 -1
- package/editor-web/assets/react-Byupo4pA.js +1 -0
- package/editor-web/assets/replace-CLLMtF4e.js +1 -0
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-DLdzkQk5.js → requirementDiagram-EQYSW5RA-CUblhR5M.js} +1 -1
- package/editor-web/assets/ribbon-DajdQ_Ya.js +1 -0
- package/editor-web/assets/row-Bei9HNEe.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-Dip4Piv_.js → sankeyDiagram-SY24JHO5-nSz6zDX3.js} +1 -1
- package/editor-web/assets/schemas-C21MyseF.js +1 -0
- package/editor-web/assets/{iso-DoC-ZoBr.js → schemas-DlRAoVtq.js} +1 -1
- package/editor-web/assets/{scissors-B_xOiUhd.js → scissors-m6QcoEf2.js} +1 -1
- package/editor-web/assets/search-D75Bi2GU.js +1 -0
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-QnPcoybL.js → sequenceDiagram-BLEHNHQU-DxTpOYuo.js} +1 -1
- package/editor-web/assets/{session-DMlLCFWg.js → session-BhClkDyr.js} +1 -1
- package/editor-web/assets/{sigma-DSUsJhMn.js → sigma-B4AWtnVA.js} +1 -1
- package/editor-web/assets/snapshots-DwGHDN3t.js +1 -0
- package/editor-web/assets/sound-DkR3qxSt.js +1 -0
- package/editor-web/assets/split-DBAbwPZ5.js +3 -0
- package/editor-web/assets/{square-arrow-out-up-right-DF5dvsSp.js → square-arrow-out-up-right-1NqFsNDe.js} +1 -1
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-D103CiMX.js → stateDiagram-v2-A6IESKWZ-C3e14iHY.js} +1 -1
- package/editor-web/assets/{sticky-note-BdkIu5_D.js → sticky-note-s4QfzaBB.js} +1 -1
- package/editor-web/assets/surface-CIF0Ae0z.js +1 -0
- package/editor-web/assets/swatch-BUzr_XmH.js +1 -0
- package/editor-web/assets/{swimlanes-B3ENRKFQ-y4gCqEoa.js → swimlanes-B3ENRKFQ-DPPdzNzu.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-B8n3zOw_.js +8 -0
- package/editor-web/assets/switch-DrZxoPQS.js +1 -0
- package/editor-web/assets/{syntax-CU_WPKxt.js → syntax-emXV4DnN.js} +1 -1
- package/editor-web/assets/table-BW43XXVd.js +1 -0
- package/editor-web/assets/tabs-BwU2E7bU.js +1 -0
- package/editor-web/assets/text-wrap-Baus6l-V.js +1 -0
- package/editor-web/assets/textarea-BX_ax3X8.js +1 -0
- package/editor-web/assets/{timeline-definition-JXYKGLGB-BMp76v4V.js → timeline-definition-JXYKGLGB-DRTJ1_Er.js} +1 -1
- package/editor-web/assets/tolerant-DM9s0Mt1.js +1 -0
- package/editor-web/assets/{treeView-D4JQ5SDB-Q_GYyk0b.js → treeView-D4JQ5SDB-BYJ_m-i5.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-B5lRWdQB.js → treemap-SAJKECNS-BcU6I6Rg.js} +1 -1
- package/editor-web/assets/type-CvZ0HZsV.js +41 -0
- package/editor-web/assets/{undo-2-C47jrRp5.js → undo-2-DCbMWoug.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX--QRllA-U.js → usecaseDiagram-WPOLBNNX-YV92pS4o.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-CzkATPA3.js → vennDiagram-Q3Y3IDCW-oAvfHZtf.js} +1 -1
- package/editor-web/assets/video-SJvDRCJK.js +1 -0
- package/editor-web/assets/{wardley-7MLQ67FV-BXzwcdJa.js → wardley-7MLQ67FV-BLNiqxtt.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-BQvC8Agx.js → wardleyDiagram-IVAIDKWA-SppgC6xW.js} +1 -1
- package/editor-web/assets/{whole-word-D3ZAtnkw.js → whole-word-C9TkGBCY.js} +1 -1
- package/editor-web/assets/{words-CaUHhQHf.js → words-BUlNNuH2.js} +3 -3
- package/editor-web/assets/words-zMedmPWc.js +3 -0
- package/editor-web/assets/workbook-BZKYx4WB.js +41 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-aY-lsD5o.js → xychartDiagram-4URNHDU4-BHMn_jwJ.js} +1 -1
- package/editor-web/assets/{zoom-in-PgsC94hP.js → zoom-in-yAGKspfC.js} +1 -1
- package/editor-web/index.html +9 -8
- package/package.json +3 -3
- package/CHANGELOG.md +0 -251
- package/dist/commands/render.js +0 -3
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/motion.js +0 -4
- package/dist/node_modules/@allyhub/video-measure/dist/still.js +0 -2
- package/editor-web/assets/arrow-down-B8VUPCGi.js +0 -1
- package/editor-web/assets/arrow-up-Ds4juY8X.js +0 -1
- package/editor-web/assets/article-8evPh712.js +0 -3
- package/editor-web/assets/article-BhRtWYMd.js +0 -7
- package/editor-web/assets/bar-button-J9vbfzTx.js +0 -1
- package/editor-web/assets/calc-worker-oEIqrrTM.js +0 -45
- package/editor-web/assets/channel-wIj_OqDm.js +0 -1
- package/editor-web/assets/chart-amT4lgX3.js +0 -2
- package/editor-web/assets/chart-file-dGiRgFcH.js +0 -1
- package/editor-web/assets/code-CD-CbJG9.js +0 -1
- package/editor-web/assets/collaborator-BU4qU7O3.js +0 -1
- package/editor-web/assets/deck-C7fN0Qtn.js +0 -1
- package/editor-web/assets/dist-3iovns9K.js +0 -16
- package/editor-web/assets/dist-BkHnbOEj.js +0 -4
- package/editor-web/assets/dist-BvOrNcK-.js +0 -19
- package/editor-web/assets/dist-CEIszq39.js +0 -1
- package/editor-web/assets/dist-CU5RbLNH.js +0 -1
- package/editor-web/assets/dist-CWZj8IAm.js +0 -1
- package/editor-web/assets/dist-C_Mtrnif.js +0 -17
- package/editor-web/assets/dist-CdqpwdCV.js +0 -24
- package/editor-web/assets/dist-CjT76RAw.js +0 -43
- package/editor-web/assets/dist-CpzEn9T8.js +0 -6
- package/editor-web/assets/dist-CrFYWl5-.js +0 -3
- package/editor-web/assets/dist-D3C6FyrO.js +0 -82
- package/editor-web/assets/dist-D4eBFGVL.js +0 -1
- package/editor-web/assets/dist-DTcjb3cP.js +0 -18
- package/editor-web/assets/dist-D_WSM29I.js +0 -17
- package/editor-web/assets/dist-Dp_9ISjP.js +0 -531
- package/editor-web/assets/dist-J-tPYKGS.js +0 -5
- package/editor-web/assets/dist-YW8hS4IM.js +0 -9
- package/editor-web/assets/esm-Cjv8ogpP.js +0 -21
- package/editor-web/assets/file-exclamation-point-_L3ElCJ5.js +0 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-BlVUglzw.js +0 -1
- package/editor-web/assets/hint-rlht0uxG.js +0 -1
- package/editor-web/assets/index-BQWZnyAQ.js +0 -28
- package/editor-web/assets/index-Dvh1t1om.css +0 -2
- package/editor-web/assets/minus-CbPnUIOy.js +0 -1
- package/editor-web/assets/progress-CwKcXARv.js +0 -6
- package/editor-web/assets/props-form-BpSXbrSF.js +0 -1
- package/editor-web/assets/react-Edyoga_4.js +0 -1
- package/editor-web/assets/row-C_svyL8o.js +0 -1
- package/editor-web/assets/schemas-CQ_UU8-Z.js +0 -1
- package/editor-web/assets/search-Ba2BbT6T.js +0 -1
- package/editor-web/assets/slides-7xWhREpt.js +0 -1
- package/editor-web/assets/snapshots-BLX4NTQC.js +0 -1
- package/editor-web/assets/sound-bTlco_K3.js +0 -1
- package/editor-web/assets/split-tFGKk-x8.js +0 -3
- package/editor-web/assets/strikethrough-BwXWi4zg.js +0 -1
- package/editor-web/assets/surface-DtCjIlrq.js +0 -1
- package/editor-web/assets/svg-CWIBMIQ9.js +0 -1
- package/editor-web/assets/swatch-DhztHwPU.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-DKzB_wSf.js +0 -8
- package/editor-web/assets/switch-8MU4Nfxe.js +0 -1
- package/editor-web/assets/table-DRbddzx0.js +0 -1
- package/editor-web/assets/tabs-CuEawka3.js +0 -1
- package/editor-web/assets/tag-CIfWT8B_.js +0 -1
- package/editor-web/assets/text-align-start-Cic2-TLh.js +0 -1
- package/editor-web/assets/textarea-D7TnPwv1.js +0 -1
- package/editor-web/assets/video-D0uTbHWx.js +0 -1
- package/editor-web/assets/words-XlXG79Ur.js +0 -3
- package/editor-web/assets/workbook-CiCXkjmN.js +0 -45
- package/editor-web/assets/x-DlhyIKuu.js +0 -41
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{CITATION_STYLES as x}from"./cite.js";export const PAPERS={a3:[297,420],a4:[210,297],a5:[148,210],b5:[176,250],letter:[215.9,279.4],legal:[215.9,355.6]},PAGE_FONTS=["sans","serif","mono","times","song","hei","fangsong","kai","xiaobiaosong"],CHINESE_SIZES={初号:42,小初:36,一号:26,小一:24,二号:22,小二:18,三号:16,小三:15,四号:14,小四:12,五号:10.5,小五:9,六号:7.5,小六:6.5,七号:5.5,八号:5},RUNNING_PLACES=["left","center","right","outside","inside"],PAGE_PRESETS=["apa","mla","brief","memo","business-letter"];const H=new Map([["report","brief"]]),$={apa:{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:2,textIndent:3,paragraphSpacing:0,textAlign:"left",title:{size:12,weight:"bold",align:"center"},headings:{1:{size:12,weight:"bold",align:"center"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold",italic:!0},4:{size:12,weight:"bold"},5:{size:12,weight:"bold",italic:!0},6:{size:12,weight:"bold"}},header:{right:"{page}"},footer:!1,citationStyle:"apa"},mla:{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:2,textIndent:3,paragraphSpacing:0,textAlign:"left",title:{size:12,weight:"normal",align:"center"},headings:{1:{size:12,weight:"bold"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold",italic:!0},4:{size:12,weight:"bold"},5:{size:12,weight:"bold"},6:{size:12,weight:"bold"}},header:{right:"{page}"},footer:!1,citationStyle:"mla"},brief:{size:10.5,lineHeight:1.2,paragraphSpacing:.7,title:{size:24,weight:"bold"},headings:{1:{size:18,weight:"bold"},2:{size:14,weight:"bold",rule:!0},3:{size:11.5,weight:"bold"}}},memo:{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:1,textIndent:0,paragraphSpacing:1,textAlign:"left",title:{size:12,weight:"bold"},headings:{1:{size:12,weight:"bold"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold",italic:!0},4:{size:12,weight:"bold"},5:{size:12,weight:"bold"},6:{size:12,weight:"bold"}},header:!1,footer:{center:"{page}"}},"business-letter":{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:1,textIndent:0,paragraphSpacing:1,textAlign:"left",title:{size:12,weight:"bold"},headings:{1:{size:12,weight:"bold"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold"},4:{size:12,weight:"bold"},5:{size:12,weight:"bold"},6:{size:12,weight:"bold"}},header:!1,footer:!1,pageNumbers:!1}};export const presetLook=e=>$[e];export function effectiveLook(e){if(e.preset===void 0)return e;const i=$[e.preset],n={...i.headings};for(const[a,t]of Object.entries(e.headings??{}))n[Number(a)]={...i.headings?.[Number(a)],...t};return{...i,...e,...i.title||e.title?{title:{...i.title,...e.title}}:{},...Object.keys(n).length>0?{headings:n}:{}}}export const sizePt=e=>typeof e=="number"?e:CHINESE_SIZES[e];export function marginBox(e){return typeof e=="number"?{top:e,right:e,bottom:e,left:e}:e.length===2?{top:e[0],right:e[1],bottom:e[0],left:e[1]}:{top:e[0],right:e[1],bottom:e[2],left:e[3]}}export const PAGE_DEFAULTS={paper:"letter",margins:{top:18,right:20,bottom:18,left:20},size:11,lineHeight:1.15,textIndent:0,paragraphSpacing:.5,headingScale:{title:2.3,1:1.75,2:1.45,3:1.15,4:1,5:1,6:1},footer:{left:"{title}",right:"{page} / {pages}"}};const w=25.4/72;export const paperSize=e=>e===void 0?PAPERS[PAGE_DEFAULTS.paper]:typeof e=="string"?PAPERS[e]:e;export function resolvePage(e={}){const i=effectiveLook(e),[n,a]=paperSize(i.paper),t=i.orientation==="landscape",s=t?Math.max(n,a):Math.min(n,a),r=t?Math.min(n,a):Math.max(n,a),o=i.margins===void 0?{...PAGE_DEFAULTS.margins}:marginBox(i.margins),g=s-o.left-o.right,p=r-o.top-o.bottom,y=i.font??"sans";let d=i.size===void 0?PAGE_DEFAULTS.size:sizePt(i.size),h=i.lineHeight===void 0?{multiple:PAGE_DEFAULTS.lineHeight}:typeof i.lineHeight=="number"?{multiple:i.lineHeight}:{pt:Number.parseFloat(i.lineHeight)},z=0;if(i.grid){h={pt:p/w/i.grid.lines};const f=g/w/i.grid.chars;i.size===void 0&&(d=Math.floor(f*2)/2),z=(f*.998-d)/d}const S=(f,I)=>({font:f?.font??y,size:f?.size===void 0?d*I:sizePt(f.size),weight:f?.weight??"bold",align:f?.align??"left",italic:f?.italic??!1,rule:f?.rule??!1}),m=PAGE_DEFAULTS.headingScale,A=Object.fromEntries([1,2,3,4,5,6].map(f=>[f,S(i.headings?.[f],m[f])])),E=i.footer===!1||i.footer===void 0&&i.pageNumbers===!1?void 0:i.footer??PAGE_DEFAULTS.footer;return{width:s,height:r,margins:o,textWidth:g,textHeight:p,font:y,size:d,lineHeight:h,letterSpacing:z,textIndent:i.textIndent??PAGE_DEFAULTS.textIndent,paragraphSpacing:i.paragraphSpacing??PAGE_DEFAULTS.paragraphSpacing,textAlign:i.textAlign??"left",title:S(i.title,m.title),headings:A,header:i.header===!1?void 0:i.header,footer:E,captions:i.captions!=="plain",spacing:J(d,i.paragraphSpacing??PAGE_DEFAULTS.paragraphSpacing,i.grid===void 0||!("pt"in h)?void 0:h.pt)}}export const LIST_STEP=18;function J(e,i,n){const a=n!==void 0||i===0;return{after:i*e,heading:a?{before:0,after:0}:{before:14,after:6},title:n??(a?0:12),caption:4,box:{top:6,side:8},cell:{top:4,side:7},divider:12,contents:5,quote:12,step:LIST_STEP,small:Math.round(e*.9*2)/2,card:{top:9,side:11},gap:8,figure:Math.round(e*2.2)}}export const SINGLE_LINE={sans:1.2207,serif:1.1719,mono:1.1328,times:1.1499},lineMultiple=e=>"pt"in e.lineHeight?void 0:e.lineHeight.multiple*(SINGLE_LINE[e.font]??1),lineHeightPt=(e,i=e.size)=>"pt"in e.lineHeight?e.lineHeight.pt:(lineMultiple(e)??1)*i,PAGE_KEYS=["preset","paper","orientation","margins","font","size","line-height","text-indent","paragraph-spacing","text-align","grid","title","headings","header","footer","captions","bibliography","citation-style","accent","cover","cover-y","page-numbers","picture-dpi"];const P=["left","center","right"],c=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),l=e=>typeof e=="number"&&Number.isFinite(e)&&e>0;function u(e){if(l(e))return e;if(typeof e=="string"){const i=e.trim();if(Object.hasOwn(CHINESE_SIZES,i))return i;const n=/^(\d+(?:\.\d+)?)\s*pt$/u.exec(i);if(n)return Number(n[1])}}const b=`a size in pt (12) or a Chinese size (${Object.keys(CHINESE_SIZES).join(", ")})`;function N(e,i,n){if(!c(e)){n(`${i} holds font, size, weight, align, italic and rule`);return}const a={};for(const[t,s]of Object.entries(e))if(t==="font")PAGE_FONTS.includes(s)?a.font=s:n(`${i}'s font is ${PAGE_FONTS.join(", ")}, not ${JSON.stringify(s)}`);else if(t==="size"){const r=u(s);r===void 0?n(`${i}'s size is ${b}`):a.size=r}else t==="weight"?s==="normal"||s==="bold"?a.weight=s:n(`${i}'s weight is normal or bold, not ${JSON.stringify(s)}`):t==="align"?P.includes(s)?a.align=s:n(`${i}'s align is left, center or right, not ${JSON.stringify(s)}`):t==="italic"?typeof s=="boolean"?a.italic=s:n(`${i}'s italic is true or false, not ${JSON.stringify(s)}`):t==="rule"?typeof s=="boolean"?a.rule=s:n(`${i}'s rule is true or false, not ${JSON.stringify(s)}`):n(`${i} holds font, size, weight, align, italic and rule: ${t} is not one of them`);return a}function v(e,i,n){if(e===!1)return!1;if(typeof e=="string")return{center:e};if(!c(e)){n(`a page's ${i} is false, words, or words by place (${RUNNING_PLACES.join(", ")}) with a font and a size`);return}const a={};for(const[t,s]of Object.entries(e))if(t==="font")PAGE_FONTS.includes(s)?a.font=s:n(`a page's ${i} font is ${PAGE_FONTS.join(", ")}, not ${JSON.stringify(s)}`);else if(t==="size"){const r=u(s);r===void 0?n(`a page's ${i} size is ${b}`):a.size=r}else RUNNING_PLACES.includes(t)?typeof s!="string"&&typeof s!="number"?n(`a page's ${i} ${t} is words`):a[t]=String(s):n(`a page's ${i} holds ${RUNNING_PLACES.join(", ")}, font and size: ${t} is not one of them`);return a}export function readPageLook(e,i){const n={};for(const[a,t]of Object.entries(e))switch(a){case"preset":{const s=typeof t=="string"?H.get(t):void 0;PAGE_PRESETS.includes(t)?n.preset=t:s!==void 0?n.preset=s:i(`a page's preset is ${PAGE_PRESETS.join(" or ")}, not ${JSON.stringify(t)}`);break}case"paper":{const s=typeof t=="string"?t.trim().toLowerCase():void 0;s!==void 0&&Object.hasOwn(PAPERS,s)?n.paper=s:Array.isArray(t)&&t.length===2&&t.every(l)?n.paper=t:i(`a page's paper is ${Object.keys(PAPERS).join(", ")} or its width and height in mm ([210, 297]), not ${JSON.stringify(t)}`);break}case"orientation":t==="portrait"||t==="landscape"?n.orientation=t:i(`a page's orientation is portrait or landscape, not ${JSON.stringify(t)}`);break;case"margins":typeof t=="number"&&t>=0||Array.isArray(t)&&(t.length===2||t.length===4)&&t.every(s=>typeof s=="number"&&s>=0)?n.margins=t:i("a page's margins are mm: one for all four, [top and bottom, sides], or [top, right, bottom, left]");break;case"font":PAGE_FONTS.includes(t)?n.font=t:i(`a page's font is ${PAGE_FONTS.join(", ")}, not ${JSON.stringify(t)}`);break;case"size":{const s=u(t);s===void 0?i(`a page's size is ${b}`):n.size=s;break}case"line-height":l(t)?n.lineHeight=t:typeof t=="string"&&/^\d+(\.\d+)?pt$/u.test(t.trim())?n.lineHeight=t.trim():i(`a page's line-height is a multiple (1.5) or pt (28pt), not ${JSON.stringify(t)}`);break;case"text-indent":typeof t=="number"&&t>=0?n.textIndent=t:i("a page's text-indent is how many characters a paragraph's first line is set in (2)");break;case"paragraph-spacing":typeof t=="number"&&t>=0?n.paragraphSpacing=t:i("a page's paragraph-spacing is the space between paragraphs in em (0.5)");break;case"text-align":t==="left"||t==="justify"?n.textAlign=t:i(`a page's text-align is left or justify, not ${JSON.stringify(t)}`);break;case"grid":{const s=c(t)?t.chars:void 0,r=c(t)?t.lines:void 0;c(t)&&Object.keys(t).length===2&&l(s)&&l(r)&&Number.isInteger(s)&&Number.isInteger(r)?n.grid={chars:s,lines:r}:i("a page's grid is { chars, lines }: characters to a line and lines to a page");break}case"title":{const s=N(t,"the title",i);s&&(n.title=s);break}case"headings":{if(!c(t)){i("a page's headings are by level: { 1: { font, size }, 2: … }");break}const s={};for(const[r,o]of Object.entries(t)){const g=Number(r);if(!Number.isInteger(g)||g<1||g>6){i(`a heading's level is 1 to 6, not ${r}`);continue}const p=N(o,`heading ${r}`,i);p&&(s[g]=p)}n.headings=s;break}case"header":case"footer":{const s=v(t,a,i);s!==void 0&&(n[a]=s);break}case"captions":t==="numbered"||t==="plain"?n.captions=t:i(`a page's captions are numbered or plain, not ${JSON.stringify(t)}`);break;case"bibliography":typeof t=="string"&&t.trim()!==""?n.bibliography=t.trim():i("a page's bibliography is a CSL-JSON file's path");break;case"citation-style":x.includes(t)?n.citationStyle=t:i(`a page's citation-style is ${x.join(" or ")}, not ${JSON.stringify(t)}`);break;case"accent":typeof t=="string"&&t.trim()!==""?n.accent=t.trim():i("a page's accent is a colour");break;case"cover":typeof t=="string"&&t.trim()!==""?n.cover=t.trim():i("a page's cover is a picture's path");break;case"cover-y":typeof t=="number"&&t>=0&&t<=100?n.coverY=t:i(`a cover's cover-y is 0 (its top) to 100 (its bottom), not ${JSON.stringify(t)}`);break;case"picture-dpi":t===!1?n.pictureDpi=!1:typeof t=="number"&&t>=72&&t<=2400?n.pictureDpi=t:i(`a page's picture-dpi is 72 to 2400 (dots an inch of paper), or false to print pictures as they are, not ${JSON.stringify(t)}`);break;case"page-numbers":t===!1?n.pageNumbers=!1:t!==!0&&i(`a page's page-numbers is true or false, not ${JSON.stringify(t)}`);break;default:i(`the front matter holds ${PAGE_KEYS.join(", ")}: ${a} is not one of them`)}return n}const O=e=>({...e.font===void 0?{}:{font:e.font},...e.size===void 0?{}:{size:e.size},...e.weight===void 0?{}:{weight:e.weight},...e.align===void 0?{}:{align:e.align},...e.italic===void 0?{}:{italic:e.italic},...e.rule===void 0?{}:{rule:e.rule}}),j=e=>e===!1?!1:Object.keys(e).length===1&&e.center!==void 0?e.center:{...e},L=e=>/^[ab]\d$/u.test(e)?e.toUpperCase():`${e.charAt(0).toUpperCase()}${e.slice(1)}`;export function pageLookYaml(e){return{...e.preset===void 0?{}:{preset:e.preset},...e.paper===void 0?{}:{paper:typeof e.paper=="string"?L(e.paper):[...e.paper]},...e.orientation===void 0?{}:{orientation:e.orientation},...e.margins===void 0?{}:{margins:typeof e.margins=="number"?e.margins:[...e.margins]},...e.font===void 0?{}:{font:e.font},...e.size===void 0?{}:{size:e.size},...e.lineHeight===void 0?{}:{"line-height":e.lineHeight},...e.textIndent===void 0?{}:{"text-indent":e.textIndent},...e.paragraphSpacing===void 0?{}:{"paragraph-spacing":e.paragraphSpacing},...e.textAlign===void 0?{}:{"text-align":e.textAlign},...e.grid===void 0?{}:{grid:{...e.grid}},...e.title===void 0?{}:{title:O(e.title)},...e.headings===void 0?{}:{headings:Object.fromEntries(Object.entries(e.headings).map(([n,a])=>[n,O(a)]))},...e.header===void 0?{}:{header:j(e.header)},...e.footer===void 0?{}:{footer:j(e.footer)},...e.captions===void 0?{}:{captions:e.captions},...e.bibliography===void 0?{}:{bibliography:e.bibliography},...e.citationStyle===void 0?{}:{"citation-style":e.citationStyle},...e.accent===void 0?{}:{accent:e.accent},...e.cover===void 0?{}:{cover:e.cover},...e.cover===void 0||e.coverY===void 0?{}:{"cover-y":e.coverY},...e.pageNumbers===!1?{"page-numbers":!1}:{},...e.pictureDpi===void 0?{}:{"picture-dpi":e.pictureDpi}}}
|
|
2
|
+
import{THEME_CHOICES as G,ThemeSchema as Y}from"@allyhub/formats";import{CITATION_STYLES as E}from"./cite.js";import{readNumbering as W}from"./numbering.js";import{NORMAL as I,TITLE_STYLE as H,headingStyle as U,readStyles as D,resolveStyle as b,writtenStyle as F}from"./styles.js";export const PAPERS={a3:[297,420],a4:[210,297],a5:[148,210],b5:[176,250],letter:[215.9,279.4],legal:[215.9,355.6]},PAGE_FONTS=["sans","serif","mono","times","song","hei","fangsong","kai","xiaobiaosong"],CHINESE_SIZES={初号:42,小初:36,一号:26,小一:24,二号:22,小二:18,三号:16,小三:15,四号:14,小四:12,五号:10.5,小五:9,六号:7.5,小六:6.5,七号:5.5,八号:5},RUNNING_PICTURE_HEIGHT=10,RUNNING_PLACES=["left","center","right","outside","inside"],PAGE_PRESETS=["apa","mla","brief","memo","business-letter"];const k=new Map([["report","brief"]]);export const WATERMARK_COLOR="#C0C0C0",WATERMARK_OPACITY=.5,WATERMARK_WASHOUT=.15;const T={apa:{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:2,textIndent:3,paragraphSpacing:0,textAlign:"left",title:{size:12,weight:"bold",align:"center"},headings:{1:{size:12,weight:"bold",align:"center"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold",italic:!0},4:{size:12,weight:"bold"},5:{size:12,weight:"bold",italic:!0},6:{size:12,weight:"bold"}},header:{right:"{page}"},footer:!1,citationStyle:"apa"},mla:{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:2,textIndent:3,paragraphSpacing:0,textAlign:"left",title:{size:12,weight:"normal",align:"center"},headings:{1:{size:12,weight:"bold"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold",italic:!0},4:{size:12,weight:"bold"},5:{size:12,weight:"bold"},6:{size:12,weight:"bold"}},header:{right:"{page}"},footer:!1,citationStyle:"mla"},brief:{size:10.5,lineHeight:1.2,paragraphSpacing:.7,title:{size:24,weight:"bold"},headings:{1:{size:18,weight:"bold"},2:{size:14,weight:"bold",rule:!0},3:{size:11.5,weight:"bold"}}},memo:{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:1,textIndent:0,paragraphSpacing:1,textAlign:"left",title:{size:12,weight:"bold"},headings:{1:{size:12,weight:"bold"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold",italic:!0},4:{size:12,weight:"bold"},5:{size:12,weight:"bold"},6:{size:12,weight:"bold"}},header:!1,footer:{center:"{page}"}},"business-letter":{paper:"letter",margins:25.4,font:"times",size:12,lineHeight:1,textIndent:0,paragraphSpacing:1,textAlign:"left",title:{size:12,weight:"bold"},headings:{1:{size:12,weight:"bold"},2:{size:12,weight:"bold"},3:{size:12,weight:"bold"},4:{size:12,weight:"bold"},5:{size:12,weight:"bold"},6:{size:12,weight:"bold"}},header:!1,footer:!1,pageNumbers:!1}};export const presetLook=e=>T[e];export function effectiveLook(e){return K(B(e))}const M=e=>e!==void 0&&PAGE_FONTS.includes(e)?e:void 0;function J(e){const i=M(e.font),n={...i===void 0?{}:{font:i},...e.size===void 0?{}:{size:e.size},...e.bold===void 0?{}:{weight:e.bold?"bold":"normal"},...e.italic===void 0?{}:{italic:e.italic},...e.align==="left"||e.align==="center"||e.align==="right"?{align:e.align}:{}};return Object.keys(n).length===0?void 0:n}function K(e){const i=e.styles;if(i===void 0)return e;const n={...e};if(i[I]!==void 0){const t=b(i,I),s=M(t.font);s!==void 0&&(n.font=s),t.size!==void 0&&(n.size=t.size),t.lineHeight!==void 0&&(n.lineHeight=t.lineHeight),t.firstLine!==void 0&&t.firstLine>=0&&(n.textIndent=t.firstLine),t.spaceAfter!==void 0&&(n.paragraphSpacing=t.spaceAfter/sizePt(n.size??PAGE_DEFAULTS.size)),(t.align==="left"||t.align==="justify")&&(n.textAlign=t.align)}if(i[H]!==void 0){const t=J(b(i,H));t!==void 0&&(n.title={...n.title,...t})}const a={...n.headings};for(const t of[1,2,3,4,5,6]){const s=U(t);if(i[s]===void 0)continue;const r=J(b(i,s));r!==void 0&&(a[t]={...a[t],...r})}return Object.keys(a).length>0&&(n.headings=a),n}function B(e){if(e.preset===void 0)return e;const i=T[e.preset],n={...i.headings};for(const[a,t]of Object.entries(e.headings??{}))n[Number(a)]={...i.headings?.[Number(a)],...t};return{...i,...e,...i.title||e.title?{title:{...i.title,...e.title}}:{},...Object.keys(n).length>0?{headings:n}:{}}}export const sizePt=e=>typeof e=="number"?e:CHINESE_SIZES[e];export function marginBox(e){return typeof e=="number"?{top:e,right:e,bottom:e,left:e}:e.length===2?{top:e[0],right:e[1],bottom:e[0],left:e[1]}:{top:e[0],right:e[1],bottom:e[2],left:e[3]}}export const PAGE_DEFAULTS={paper:"letter",margins:{top:18,right:20,bottom:18,left:20},size:11,lineHeight:1.15,textIndent:0,paragraphSpacing:.5,headingScale:{title:2.3,1:1.75,2:1.45,3:1.15,4:1,5:1,6:1},footer:{left:"{title}",right:"{page} / {pages}"}};const m=25.4/72;export const paperSize=e=>e===void 0?PAPERS[PAGE_DEFAULTS.paper]:typeof e=="string"?PAPERS[e]:e,RUNNING_EDGE=5,runningGap=e=>Math.min(7,e/2);function P(e,i){return(e?.size===void 0?Math.max(7.5,i*.75):sizePt(e.size))*1.2*m}export function runningTall(e,i){if(e===void 0)return 0;const n=a=>{const t=P({...e,...a},i);return Math.max(0,...RUNNING_PLACES.map(s=>{const r=a[s];return r===void 0?0:typeof r!="string"?r.height??RUNNING_PICTURE_HEIGHT:r.split(`
|
|
3
|
+
`).length*t}))};return Math.max(n(e),e.first===void 0||e.first===!1?0:n(e.first),e.even===void 0||e.even===!1?0:n(e.even))}function L(e,i,n){const a=runningTall(i,n);return a===0||Math.min(RUNNING_EDGE,e-runningGap(e)-P(i,n))+a+runningGap(e)<=e?e:Math.ceil((RUNNING_EDGE+a+runningGap(1/0))*10)/10}export function resolvePage(e={}){const i=effectiveLook(e),[n,a]=paperSize(i.paper),t=i.orientation==="landscape",s=t?Math.max(n,a):Math.min(n,a),r=t?Math.min(n,a):Math.max(n,a),f=i.margins===void 0?{...PAGE_DEFAULTS.margins}:marginBox(i.margins),d=i.footer===!1||i.footer===void 0&&i.pageNumbers===!1?void 0:i.footer??PAGE_DEFAULTS.footer,l=i.header===!1?void 0:i.header,x=i.size===void 0?PAGE_DEFAULTS.size:sizePt(i.size),p={...f,top:L(f.top,l,x),bottom:L(f.bottom,d,x)},w=s-p.left-p.right,$=r-p.top-p.bottom,O=i.font??"sans";let u=i.size===void 0?PAGE_DEFAULTS.size:sizePt(i.size),h=i.lineHeight===void 0?{multiple:PAGE_DEFAULTS.lineHeight}:typeof i.lineHeight=="number"?{multiple:i.lineHeight}:{pt:Number.parseFloat(i.lineHeight)},N=0;if(i.grid){h={pt:$/m/i.grid.lines};const o=w/m/i.grid.chars;i.size===void 0&&(u=Math.floor(o*2)/2),N=(o*.998-u)/u}const j=(o,C)=>({font:o?.font??O,size:o?.size===void 0?u*C:sizePt(o.size),weight:o?.weight??"bold",align:o?.align??"left",italic:o?.italic??!1,rule:o?.rule??!1}),A=PAGE_DEFAULTS.headingScale,v=Object.fromEntries([1,2,3,4,5,6].map(o=>[o,j(i.headings?.[o],A[o])]));return{width:s,height:r,margins:p,textWidth:w,textHeight:$,font:O,size:u,lineHeight:h,letterSpacing:N,textIndent:i.textIndent??PAGE_DEFAULTS.textIndent,paragraphSpacing:i.paragraphSpacing??PAGE_DEFAULTS.paragraphSpacing,textAlign:i.textAlign??"left",title:j(i.title,A.title),headings:v,header:l,footer:d,captions:i.captions!=="plain",spacing:Z(u,i.paragraphSpacing??PAGE_DEFAULTS.paragraphSpacing,i.grid===void 0||!("pt"in h)?void 0:h.pt)}}export const LIST_STEP=18;function Z(e,i,n){const a=n!==void 0||i===0;return{after:i*e,heading:a?{before:0,after:0}:{before:14,after:6},title:n??(a?0:12),caption:4,box:{top:6,side:8},cell:{top:4,side:7},divider:12,contents:5,quote:12,step:LIST_STEP,small:Math.round(e*.9*2)/2,card:{top:9,side:11},gap:8,figure:Math.round(e*2.2)}}export const SINGLE_LINE={sans:1.2207,serif:1.1719,mono:1.1328,times:1.1499},lineMultiple=e=>"pt"in e.lineHeight?void 0:e.lineHeight.multiple*(SINGLE_LINE[e.font]??1),lineHeightPt=(e,i=e.size)=>"pt"in e.lineHeight?e.lineHeight.pt:(lineMultiple(e)??1)*i,PAGE_KEYS=["preset","paper","orientation","margins","font","size","line-height","text-indent","paragraph-spacing","text-align","grid","title","headings","header","footer","captions","notes","lists","track","bibliography","citation-style","accent","theme","watermark","cover","cover-y","page-numbers","picture-dpi","styles"];const q=["left","center","right"],c=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),g=e=>typeof e=="number"&&Number.isFinite(e)&&e>0;function z(e){if(g(e))return e;if(typeof e=="string"){const i=e.trim();if(Object.hasOwn(CHINESE_SIZES,i))return i;const n=/^(\d+(?:\.\d+)?)\s*pt$/u.exec(i);if(n)return Number(n[1])}}const S=`a size in pt (12) or a Chinese size (${Object.keys(CHINESE_SIZES).join(", ")})`;function R(e,i,n){if(!c(e)){n(`${i} holds font, size, weight, align, italic and rule`);return}const a={};for(const[t,s]of Object.entries(e))if(t==="font")PAGE_FONTS.includes(s)?a.font=s:n(`${i}'s font is ${PAGE_FONTS.join(", ")}, not ${JSON.stringify(s)}`);else if(t==="size"){const r=z(s);r===void 0?n(`${i}'s size is ${S}`):a.size=r}else t==="weight"?s==="normal"||s==="bold"?a.weight=s:n(`${i}'s weight is normal or bold, not ${JSON.stringify(s)}`):t==="align"?q.includes(s)?a.align=s:n(`${i}'s align is left, center or right, not ${JSON.stringify(s)}`):t==="italic"?typeof s=="boolean"?a.italic=s:n(`${i}'s italic is true or false, not ${JSON.stringify(s)}`):t==="rule"?typeof s=="boolean"?a.rule=s:n(`${i}'s rule is true or false, not ${JSON.stringify(s)}`):n(`${i} holds font, size, weight, align, italic and rule: ${t} is not one of them`);return a}function Q(e){if(!c(e))return;const{picture:i,height:n,...a}=e;if(!(typeof i!="string"||i==="")&&!(Object.keys(a).length>0))return n===void 0?{picture:i}:typeof n=="number"&&n>0?{picture:i,height:n}:void 0}export function runningPictures(e,i=[]){const n=new Set,a=s=>{if(!(s===void 0||s===!1))for(const r of RUNNING_PLACES){const f=s[r];f!==void 0&&typeof f!="string"&&n.add(f.picture)}},t=i.flatMap(s=>s.type==="pagebreak"?[s.header,s.footer]:[]);for(const s of[e.header,e.footer,...t])s!==void 0&&s!==!1&&(a(s),a(s.first),a(s.even));return e.watermark!==void 0&&"picture"in e.watermark&&n.add(e.watermark.picture),[...n]}function V(e,i){if(typeof e=="string"&&e.trim()!=="")return{text:e.trim()};if(!c(e)){i("a watermark is its words, or { text, color, layout, font }, or { picture, washout, scale }");return}const n=new Set(["text","color","layout","font","picture","washout","scale"]);for(const s of Object.keys(e))n.has(s)||i(`a watermark has no ${s}`);if(typeof e.picture=="string"&&e.picture.trim()!==""){const s=e.scale;return s!==void 0&&!g(s)&&i(`a watermark's scale is a % above 0, not ${JSON.stringify(s)}`),{picture:e.picture.trim(),...e.washout===!0?{washout:!0}:{},...g(s)?{scale:s}:{}}}const a=e.text;if(typeof a!="string"||a.trim()===""){i("a watermark names its words (text) or its picture (picture)");return}const t=e.layout;return t!==void 0&&t!=="diagonal"&&t!=="horizontal"&&i(`a watermark's layout is diagonal or horizontal, not ${JSON.stringify(t)}`),e.font!==void 0&&!PAGE_FONTS.includes(e.font)&&i(`a watermark's font is ${PAGE_FONTS.join(", ")}, not ${JSON.stringify(e.font)}`),{text:a.trim(),...typeof e.color=="string"&&e.color.trim()!==""?{color:e.color.trim()}:{},...t==="horizontal"?{layout:t}:{},...PAGE_FONTS.includes(e.font)?{font:e.font}:{}}}function X(e){return"picture"in e?{...e}:Object.keys(e).length===1?e.text:{...e}}function ee(e,i){if(!c(e)){i("a doc's lists hold numbered and bullets, each a list of levels");return}const n={};for(const[a,t]of Object.entries(e)){if(a!=="numbered"&&a!=="bullets"){i(`a doc's lists hold numbered and bullets: ${a} is not one of them`);continue}if(!Array.isArray(t)||t.length===0||t.length>6||!t.every(r=>typeof r=="string"&&r!=="")){i(`a doc's lists' ${a} are 1 to 6 levels, each words`);continue}const s=t;if(a==="numbered"){const r=s.map((f,d)=>W(f,d+1,`a list's level ${String(d+1)}`).problem).find(f=>f!==void 0);if(r!==void 0){i(r);continue}}n[a]=s}return Object.keys(n).length>0?n:void 0}export function readRunning(e,i,n){if(e===!1)return!1;if(typeof e=="string")return{center:e};if(!c(e)){n(`a page's ${i} is false, words, or words by place (${RUNNING_PLACES.join(", ")}) with a font and a size`);return}const a={};for(const[t,s]of Object.entries(e))if(t==="first"||t==="even"){const r=t==="first"?"first page":"even pages",f=readRunning(s,`${i}'s ${r}`,n);f===!1?a[t]=!1:f!==void 0&&((f.first!==void 0||f.even!==void 0)&&n(`a page's ${i}'s ${r} have no first or even page of their own`),a[t]=Object.fromEntries(Object.entries(f).filter(([d])=>d!=="first"&&d!=="even")))}else if(t==="font")PAGE_FONTS.includes(s)?a.font=s:n(`a page's ${i} font is ${PAGE_FONTS.join(", ")}, not ${JSON.stringify(s)}`);else if(t==="size"){const r=z(s);r===void 0?n(`a page's ${i} size is ${S}`):a.size=r}else if(!RUNNING_PLACES.includes(t))n(`a page's ${i} holds ${RUNNING_PLACES.join(", ")}, font, size, first and even: ${t} is not one of them`);else if(typeof s=="string"||typeof s=="number")a[t]=String(s);else{const r=Q(s);r===void 0?n(`a page's ${i} ${t} is words, or a picture: { picture: <file>, height: <mm> }`):a[t]=r}return a}export function readPageLook(e,i){const n={};for(const[a,t]of Object.entries(e))switch(a){case"preset":{const s=typeof t=="string"?k.get(t):void 0;PAGE_PRESETS.includes(t)?n.preset=t:s!==void 0?n.preset=s:i(`a page's preset is ${PAGE_PRESETS.join(" or ")}, not ${JSON.stringify(t)}`);break}case"paper":{const s=typeof t=="string"?t.trim().toLowerCase():void 0;s!==void 0&&Object.hasOwn(PAPERS,s)?n.paper=s:Array.isArray(t)&&t.length===2&&t.every(g)?n.paper=t:i(`a page's paper is ${Object.keys(PAPERS).join(", ")} or its width and height in mm ([210, 297]), not ${JSON.stringify(t)}`);break}case"orientation":t==="portrait"||t==="landscape"?n.orientation=t:i(`a page's orientation is portrait or landscape, not ${JSON.stringify(t)}`);break;case"margins":typeof t=="number"&&t>=0||Array.isArray(t)&&(t.length===2||t.length===4)&&t.every(s=>typeof s=="number"&&s>=0)?n.margins=t:i("a page's margins are mm: one for all four, [top and bottom, sides], or [top, right, bottom, left]");break;case"font":PAGE_FONTS.includes(t)?n.font=t:i(`a page's font is ${PAGE_FONTS.join(", ")}, not ${JSON.stringify(t)}`);break;case"size":{const s=z(t);s===void 0?i(`a page's size is ${S}`):n.size=s;break}case"line-height":g(t)?n.lineHeight=t:typeof t=="string"&&/^\d+(\.\d+)?pt$/u.test(t.trim())?n.lineHeight=t.trim():i(`a page's line-height is a multiple (1.5) or pt (28pt), not ${JSON.stringify(t)}`);break;case"text-indent":typeof t=="number"&&t>=0?n.textIndent=t:i("a page's text-indent is how many characters a paragraph's first line is set in (2)");break;case"paragraph-spacing":typeof t=="number"&&t>=0?n.paragraphSpacing=t:i("a page's paragraph-spacing is the space between paragraphs in em (0.5)");break;case"text-align":t==="left"||t==="justify"?n.textAlign=t:i(`a page's text-align is left or justify, not ${JSON.stringify(t)}`);break;case"grid":{const s=c(t)?t.chars:void 0,r=c(t)?t.lines:void 0;c(t)&&Object.keys(t).length===2&&g(s)&&g(r)&&Number.isInteger(s)&&Number.isInteger(r)?n.grid={chars:s,lines:r}:i("a page's grid is { chars, lines }: characters to a line and lines to a page");break}case"title":{const s=R(t,"the title",i);s&&(n.title=s);break}case"headings":{if(!c(t)){i("a page's headings are by level: { 1: { font, size }, 2: … }");break}const s={};for(const[r,f]of Object.entries(t)){const d=Number(r);if(!Number.isInteger(d)||d<1||d>6){i(`a heading's level is 1 to 6, not ${r}`);continue}const l=R(f,`heading ${r}`,i);l&&(s[d]=l)}n.headings=s;break}case"header":case"footer":{const s=readRunning(t,a,i);s!==void 0&&(n[a]=s);break}case"captions":t==="numbered"||t==="plain"?n.captions=t:i(`a page's captions are numbered or plain, not ${JSON.stringify(t)}`);break;case"track":typeof t=="boolean"?t&&(n.track=!0):i(`a doc's track is true or false, not ${JSON.stringify(t)}`);break;case"notes":t==="foot"||t==="end"?n.notes=t:i(`a doc's notes are at the foot of the page or the end, not ${JSON.stringify(t)}`);break;case"lists":{const s=ee(t,i);s!==void 0&&(n.lists=s);break}case"bibliography":typeof t=="string"&&t.trim()!==""?n.bibliography=t.trim():i("a page's bibliography is a CSL-JSON file's path");break;case"citation-style":E.includes(t)?n.citationStyle=t:i(`a page's citation-style is ${E.join(" or ")}, not ${JSON.stringify(t)}`);break;case"accent":typeof t=="string"&&t.trim()!==""?n.accent=t.trim():i("a page's accent is a colour");break;case"theme":{const s=Y.safeParse(t);s.success?n.theme=s.data:i(`a page's theme is one of ${G.join(", ")}, or { name, colors }`);break}case"watermark":{const s=V(t,i);s!==void 0&&(n.watermark=s);break}case"cover":typeof t=="string"&&t.trim()!==""?n.cover=t.trim():i("a page's cover is a picture's path");break;case"cover-y":typeof t=="number"&&t>=0&&t<=100?n.coverY=t:i(`a cover's cover-y is 0 (its top) to 100 (its bottom), not ${JSON.stringify(t)}`);break;case"picture-dpi":t===!1?n.pictureDpi=!1:typeof t=="number"&&t>=72&&t<=2400?n.pictureDpi=t:i(`a page's picture-dpi is 72 to 2400 (dots an inch of paper), or false to print pictures as they are, not ${JSON.stringify(t)}`);break;case"styles":n.styles=D(t,i);break;case"page-numbers":t===!1?n.pageNumbers=!1:t!==!0&&i(`a page's page-numbers is true or false, not ${JSON.stringify(t)}`);break;default:i(`the front matter holds ${PAGE_KEYS.join(", ")}: ${a} is not one of them`)}return n}const _=e=>({...e.font===void 0?{}:{font:e.font},...e.size===void 0?{}:{size:e.size},...e.weight===void 0?{}:{weight:e.weight},...e.align===void 0?{}:{align:e.align},...e.italic===void 0?{}:{italic:e.italic},...e.rule===void 0?{}:{rule:e.rule}}),y=e=>e===!1?!1:Object.keys(e).length===1&&typeof e.center=="string"?e.center:{...e,...e.first===void 0?{}:{first:e.first===!1?!1:y(e.first)},...e.even===void 0?{}:{even:e.even===!1?!1:y(e.even)}},te=e=>/^[ab]\d$/u.test(e)?e.toUpperCase():`${e.charAt(0).toUpperCase()}${e.slice(1)}`;export function pageLookYaml(e){return{...e.preset===void 0?{}:{preset:e.preset},...e.paper===void 0?{}:{paper:typeof e.paper=="string"?te(e.paper):[...e.paper]},...e.orientation===void 0?{}:{orientation:e.orientation},...e.margins===void 0?{}:{margins:typeof e.margins=="number"?e.margins:[...e.margins]},...e.font===void 0?{}:{font:e.font},...e.size===void 0?{}:{size:e.size},...e.lineHeight===void 0?{}:{"line-height":e.lineHeight},...e.textIndent===void 0?{}:{"text-indent":e.textIndent},...e.paragraphSpacing===void 0?{}:{"paragraph-spacing":e.paragraphSpacing},...e.textAlign===void 0?{}:{"text-align":e.textAlign},...e.grid===void 0?{}:{grid:{...e.grid}},...e.title===void 0?{}:{title:_(e.title)},...e.headings===void 0?{}:{headings:Object.fromEntries(Object.entries(e.headings).map(([n,a])=>[n,_(a)]))},...e.header===void 0?{}:{header:y(e.header)},...e.footer===void 0?{}:{footer:y(e.footer)},...e.captions===void 0?{}:{captions:e.captions},...e.notes===void 0?{}:{notes:e.notes},...e.lists===void 0?{}:{lists:e.lists},...e.track===!0?{track:!0}:{},...e.bibliography===void 0?{}:{bibliography:e.bibliography},...e.citationStyle===void 0?{}:{"citation-style":e.citationStyle},...e.accent===void 0?{}:{accent:e.accent},...e.theme===void 0?{}:{theme:e.theme},...e.watermark===void 0?{}:{watermark:X(e.watermark)},...e.cover===void 0?{}:{cover:e.cover},...e.cover===void 0||e.coverY===void 0?{}:{"cover-y":e.coverY},...e.pageNumbers===!1?{"page-numbers":!1}:{},...e.pictureDpi===void 0?{}:{"picture-dpi":e.pictureDpi},...e.styles===void 0||Object.keys(e.styles).length===0?{}:{styles:Object.fromEntries(Object.entries(e.styles).map(([n,a])=>[n,F(a)]))}}}export const withTheme=(e,i)=>e.theme!==void 0||i===void 0?e:{...e,theme:i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{
|
|
2
|
+
import{NAMED_COLORS as f,TONE_COLORS as s,namedColorColors as p,toneOf as S}from"@allyhub/formats";export const CHART_PALETTE=["#2A78D6","#EB6834","#1BAF7A","#EDA100","#E87BA4","#008300"],PAPER={ink:"#1F1D1A",lead:"#605B51",leadSoft:"#847F72",rule:"#EAE6DE",ruleStrong:"#959083",ruleMid:"#D6D1C6",stone:"#F8F6F1",stone2:"#EFECE5",stone3:"#E4E0D7",sheet:"#FFFFFF"},tagColors=o=>{const e=(o??"gray").trim().toLowerCase();if(f.includes(e)){const t=p(e);return{bg:t.tint,fg:t.ink}}const r=S(e),n=s[r===void 0||r==="accent1"?"neutral":r];return{bg:n.tint,fg:n.ink}},TONE_COLORS={good:s.good.mark,bad:s.bad.mark,warning:s.warning.mark,info:s.info.mark,flat:PAPER.lead};const d=o=>{const e=Number.parseInt(o.slice(1),16);return[e>>16&255,e>>8&255,e&255]};function B(o,e){const[r,n,t]=d(o);let i=0,l=1/0;return e.forEach((a,g)=>{const[k,C,u]=d(a),c=2*(r-k)**2+4*(n-C)**2+3*(t-u)**2;c<l&&(l=c,i=g)}),i}export function accentPalette(o){const e=[...CHART_PALETTE];if(o===void 0)return e;const r=B(o,e);return[o,...e.filter((n,t)=>t!==r)]}export function tint(o,e){const r=Number.parseInt(o.slice(1),16),n=t=>Math.round(255-(255-t)*e).toString(16).padStart(2,"0");return`#${n(r>>16&255)}${n(r>>8&255)}${n(r&255)}`.toUpperCase()}export const DIAGRAM_TEXT_PX=14;export function diagramConfig(o){const e=accentPalette(o.accent),r=Object.fromEntries(Array.from({length:12},(i,l)=>{const a=e[l%e.length]??PAPER.leadSoft;return[[`cScale${String(l)}`,tint(a,.22)],[`cScaleLabel${String(l)}`,PAPER.ink],[`cScalePeer${String(l)}`,tint(a,.6)],[`cScaleInv${String(l)}`,tint(a,.7)]]}).flat()),n=Object.fromEntries(e.map((i,l)=>[`pie${String(l+1)}`,i])),t=e[0]??CHART_PALETTE[0];return{startOnLoad:!1,securityLevel:"strict",htmlLabels:!1,fontFamily:o.font,theme:"base",themeCSS:`.grid .tick line { stroke: ${PAPER.rule}; } .grid .tick text { fill: ${PAPER.lead}; } .grid path { stroke-width: 0; } .lineWrapper line, line.lineWrapper { stroke: ${PAPER.leadSoft}; } .cluster-label text, .cluster-label tspan { font-weight: 600; }`,look:"classic",layout:"dagre",elk:{considerModelOrder:"NODES_AND_EDGES",forceNodeModelOrder:!0,mergeEdges:!1},flowchart:{htmlLabels:!1,nodeSpacing:36,rankSpacing:44,padding:10,curve:"basis"},sequence:{actorMargin:40,width:120,height:44,boxMargin:8,messageFontSize:14,mirrorActors:!1},gantt:{barHeight:22,barGap:6,fontSize:12,sectionFontSize:12},themeVariables:{fontFamily:o.font,fontSize:`${String(DIAGRAM_TEXT_PX)}px`,background:PAPER.sheet,primaryColor:PAPER.stone,primaryBorderColor:PAPER.ruleMid,primaryTextColor:PAPER.ink,secondaryColor:PAPER.stone2,secondaryBorderColor:PAPER.ruleMid,secondaryTextColor:PAPER.ink,tertiaryColor:PAPER.sheet,tertiaryBorderColor:PAPER.rule,tertiaryTextColor:PAPER.ink,mainBkg:PAPER.stone,nodeBorder:PAPER.ruleMid,clusterBkg:"#FCFBF8",clusterBorder:PAPER.rule,titleColor:PAPER.ink,textColor:PAPER.ink,lineColor:PAPER.leadSoft,edgeLabelBackground:PAPER.sheet,actorBkg:PAPER.stone,actorBorder:PAPER.ruleMid,actorTextColor:PAPER.ink,actorLineColor:PAPER.ruleMid,signalColor:PAPER.lead,signalTextColor:PAPER.ink,labelBoxBkgColor:PAPER.stone,labelBoxBorderColor:PAPER.ruleMid,noteBkgColor:"#FBF3DB",noteBorderColor:"#E9D9A6",noteTextColor:PAPER.ink,sectionBkgColor:PAPER.stone,altSectionBkgColor:PAPER.sheet,sectionBkgColor2:PAPER.stone,gridColor:PAPER.rule,taskBkgColor:tint(t,.35),taskBorderColor:tint(t,.8),taskTextColor:PAPER.ink,taskTextLightColor:PAPER.ink,taskTextOutsideColor:PAPER.ink,activeTaskBkgColor:tint(t,.18),activeTaskBorderColor:tint(t,.8),doneTaskBkgColor:PAPER.stone2,doneTaskBorderColor:PAPER.ruleMid,critBkgColor:tint("#D6403A",.3),critBorderColor:"#D6403A",...r,...n,pieStrokeColor:PAPER.sheet,pieOuterStrokeColor:PAPER.rule,pieTitleTextColor:PAPER.ink,pieSectionTextColor:PAPER.ink,pieLegendTextColor:PAPER.ink}}}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{CHART_LEGEND_POSITIONS as
|
|
3
|
-
`,n,
|
|
4
|
-
`,n,
|
|
5
|
-
`&&Object.keys(r[0].styles).length===0?[]:r,under:E(t,i)}}return H(n)?{content:[],under:E(t,i)}:{content:[],under:E(t,e)}}const A=(t,e)=>e.length>0?{...t,children:e}:t;function de(t,e,n,i){const{content:r,under:o}=G(t,e.children);return typeof e.checked=="boolean"?A({type:"check",checked:e.checked,content:r},o):A(n?{type:"numbered",...i===void 0||i===1?{}:{start:i},content:r}:{type:"bullet",content:r},o)}function fe(t,e){return e.children.map(n=>F(t,n.children))}function f(t,e){return e?{[t]:e}:{}}function me(t,e){const n=b(t,e,["align","color","bg","toggle"]),i=E(t,e.children),[r,...o]=i;if(r===void 0)return l(t,e,`<${BLOCK_TAG}> holds a block: this one is empty`),[];if(r.type==="embed"||r.type==="source")return l(t,e,`<${BLOCK_TAG}> holds a block of the doc's own, not a tag or an import`),i;const s=n.get("align");s!==void 0&&!J.has(s)&&l(t,e,`align is center, right or justify, not "${s}"`);const c={...s!==void 0&&J.has(s)?{align:s}:{},...f("color",n.get("color")),...f("background",n.get("bg"))};let a=r;if(n.has("toggle")&&(a.type==="heading"?a={...a,toggle:!0}:a.type==="paragraph"?a={type:"toggle",content:a.content}:l(t,e,"toggle is for a heading or a line of text")),Object.keys(c).length>0&&("content"in a?a={...a,look:c}:l(t,e,`a ${a.type} has no look to set`)),o.length>0)if("content"in a)a={...a,children:[...a.children??[],...o]};else return l(t,e,`a ${a.type} holds no blocks under it`),[a,...o];return[a]}function he(t,e){const n=b(t,e,["icon","color","bg"]),{content:i,under:r}=G(t,e.children),o={...f("color",n.get("color")),...f("background",n.get("bg"))};return[A({type:"callout",...f("icon",n.get("icon")),...Object.keys(o).length>0?{look:o}:{},content:i},r)]}function ge(t,e){const n=b(t,e,["title","subtitle"]),i=E(t,e.children);return[A({type:"card",...f("title",n.get("title")),...f("subtitle",n.get("subtitle"))},i)]}function pe(t,e){b(t,e,[]);const n=[];for(const i of e.children){if(i.type!=="mdxJsxFlowElement"||i.name!==STAT_TAG||i.children.length>0)return l(t,i,`<${STATS_TAG}> holds <${STAT_TAG} label="…" value="…" />s, one to a line`),[];const r=b(t,i,STAT_ATTRIBUTES),o=r.get("label"),s=r.get("value");if(s===void 0||o===void 0)return l(t,i,`a <${STAT_TAG}> has a label and a value`),[];const c=r.get("trend"),a=c?.split(",").map(g=>Number(g.trim()));if(a!==void 0&&!a.every(g=>Number.isFinite(g)))return l(t,i,`a stat's trend is numbers, oldest first, comma-separated ("12,15,14,19"), not "${c??""}"`),[];n.push({label:o,value:s,...f("delta",r.get("delta")),...f("note",r.get("note")),...r.has("down-is-good")&&r.get("down-is-good")!=="false"?{downIsGood:!0}:{},...a===void 0||a.length<2?{}:{trend:a}})}return n.length===0?(l(t,e,`<${STATS_TAG}> holds one <${STAT_TAG} /> or more`),[]):[{type:"stats",stats:n}]}function be(t,e){const n=b(t,e,["src","alt","title","width","align","id"]),i=n.get("src");if(!i)return l(t,e,"<img> names its picture: src is missing"),[];const r=Number(n.get("width")),o=n.get("align");return o!==void 0&&o!=="center"&&o!=="right"&&l(t,e,`a picture's align is center or right, not "${o}"`),[{type:"image",src:i,...f("alt",n.get("alt")),...f("caption",n.get("title")),...Number.isFinite(r)&&r>0?{width:Math.round(r)}:{},...o==="center"||o==="right"?{align:o}:{},...f("id",n.get("id"))}]}function U(t,e,n=COMPONENT_TAG){const i=n===ITEM_TAG;if(e.children.length>0)return l(t,e,i?`<${ITEM_TAG}> holds nothing: what it shows is its attributes`:`<${n}> holds nothing: its props are its attributes`),[];const r=new Map,o={};for(const h of e.attributes){if(h.type!=="mdxJsxAttribute"){l(t,e,`<${n}>'s attributes are plain strings, not {…}`);continue}const p=h.value===null||h.value===void 0?"":typeof h.value=="string"?h.value:void 0;if(p===void 0){l(t,e,`${h.name} of <${n}> is a plain string`);continue}COMPONENT_ATTRIBUTES.includes(h.name)?r.set(h.name,p):i?l(t,e,`<${ITEM_TAG}> has no ${h.name}: it takes of, at, width, height, alt, title, align and id`):o[h.name]=p}const s=r.get("of")??"";if(s.trim()==="")return l(t,e,i?`<${ITEM_TAG}> names the item it shows: of is missing (of="../deck/q3.ts#pricing")`:`<${n}> names its component: of is missing (of="../ui.ts#Dialog")`),[];const c=h=>{const p=r.get(h);if(p===void 0)return;const w=Number(p);if(Number.isFinite(w)&&w>0)return Math.round(w);l(t,e,`${h} of <${n}> is a number of pixels, not "${p}"`)},a=c("width"),g=c("height"),m=r.get("at"),u=m===void 0?void 0:Number(m);u!==void 0&&!(Number.isFinite(u)&&u>=0)&&l(t,e,`at of <${n}> is seconds, 0 or more, not "${m??""}"`);const d=r.get("align");return d!==void 0&&d!=="center"&&d!=="right"&&l(t,e,`a component's align is center or right, not "${d}"`),[{type:"component",of:s,...a===void 0?{}:{width:a},...g===void 0?{}:{height:g},...u!==void 0&&Number.isFinite(u)&&u>=0?{at:u}:{},...f("alt",r.get("alt")),...f("caption",r.get("title")),...d==="center"||d==="right"?{align:d}:{},...f("id",r.get("id")),props:o,...i?{item:!0}:{}}]}function $e(t,e){const n=b(t,e,CHART_ATTRIBUTES),i=$=>{l(t,e,$)},r=n.get("type");if(r===void 0||r==="")return i(`<${CHART_TAG}> says what it is drawn as: type is missing (${j.join(", ")})`),[];if(!j.includes(r))return i(`a chart's type is ${j.join(", ")}, not "${r}"`),[];const o=e.children,[s,...c]=o;if(c.length>0||s!==void 0&&s.type!=="table")return i(`<${CHART_TAG}> holds one table: its numbers`),[];const a=s?.type==="table"?s.children.map($=>$.children.map(y=>F(t,y.children).map(v=>v.text).join("").trim())):void 0,g=n.get("data"),m=n.get("categories"),u=n.get("series");if(a!==void 0&&g!==void 0)return i("a chart's numbers are its table or the file data names, not both"),[];if(a===void 0&&(g===void 0||g===""))return i(`<${CHART_TAG}> has numbers: a table inside it, or data="…" naming a file of them`),[];if(a!==void 0){(m!==void 0||u!==void 0)&&i("categories and series name a file's columns: a chart's own table has its series in its head row and its categories in its first column");const $=Math.min(...a.map(y=>y.length));(a.length<2||$<2)&&i("a chart's table has a head row and a row of numbers, a column of categories and a column of numbers")}else(m===void 0||m==="")&&i("with data, categories names the column of the categories"),(u===void 0||N(u).length===0)&&i('with data, series names the columns of the numbers (series="revenue,cost")');const d=n.get("legend"),h=[...Y,"none"];d!==void 0&&!h.includes(d)&&i(`a chart's legend is ${h.join(", ")}, not "${d}"`);const p=n.get("labels"),w=p===void 0?void 0:p===""?["value"]:N(p),S=w?.filter($=>!P.includes($));S?.length&&i(`a chart's labels are ${P.join(", ")}, not ${S.map($=>`"${$}"`).join(", ")}`);const M=($,y)=>{const v=n.get($);if(v===void 0)return;const C=Number(v);if(v.trim()!==""&&Number.isFinite(C)&&(!y||C>0))return y?Math.round(C):C;i(`${$} of <${CHART_TAG}> is ${y?"a number of pixels":"a number"}, not "${v}"`)},L=M("min",!1),B=M("max",!1),I=M("width",!0),R=M("height",!0),O=n.get("colors");return[{type:"chart",kind:r,...f("title",n.get("title")),...a===void 0?{}:{table:a},...g===void 0||g===""?{}:{data:g},...a===void 0?f("categories",m):{},...a===void 0&&u!==void 0&&N(u).length>0?{series:N(u)}:{},...d!==void 0&&h.includes(d)?{legend:d}:{},...w!==void 0&&!S?.length?{labels:w}:{},...f("format",n.get("format")),...L===void 0?{}:{min:L},...B===void 0?{}:{max:B},...O!==void 0&&N(O).length>0?{colors:N(O)}:{},...n.has("smooth")&&n.get("smooth")!=="false"?{smooth:!0}:{},...I===void 0?{}:{width:I},...R===void 0?{}:{height:R},...f("alt",n.get("alt")),...f("id",n.get("id"))}]}function ke(t,e){b(t,e,[]);const n=[];for(const i of e.children){if(i.type!=="mdxJsxFlowElement"||i.name!==COLUMN_TAG)return l(t,i,`<${COLUMNS_TAG}> holds <${COLUMN_TAG}>s, each around its blocks`),[];const o=b(t,i,["width"]).get("width"),s=o===void 0?void 0:Number(o);o!==void 0&&!(Number.isFinite(s)&&(s??0)>0)&&l(t,i,`a column's width is a share against the others' (1, 2, 0.5), not "${o}"`);const c=E(t,i.children);if(c.some(a=>a.type==="columns"))return l(t,i,`a <${COLUMN_TAG}> holds no <${COLUMNS_TAG}>`),[];n.push({...s!==void 0&&Number.isFinite(s)&&s>0&&s!==1?{width:s}:{},blocks:c})}return n.length<2?(l(t,e,`<${COLUMNS_TAG}> holds two or more <${COLUMN_TAG}>s`),[]):[{type:"columns",columns:n}]}function we(t,e){const n=b(t,e,["widths","head","caption","id","data","fields"]),i=E(t,e.children),r=n.get("data"),o=n.get("fields")?.split(",").map(m=>m.trim()).filter(m=>m!=="");if(r===void 0&&o!==void 0&&l(t,e,"fields say which columns a table shows of its data: give it data"),r!==void 0&&i.length>0)return l(t,e,`<${TABLE_TAG} data> reads its rows: it holds no table`),i;const[s,...c]=r===void 0?i:[{type:"table",rows:[]}];if(s?.type!=="table"||c.length>0)return l(t,e,`<${TABLE_TAG}> holds one table`),i;const a=n.get("head");a!==void 0&&!["none","column","both","row"].includes(a)&&l(t,e,`a table's head is none, row, column or both, not "${a}"`);const g=n.get("widths")?.split(",").map(m=>{const u=Number(m.trim());return m.trim()!==""&&Number.isFinite(u)&&u>0?Math.round(u):null});return[{...s,...a==="none"||a==="column"||a==="both"?{head:a}:{},...g?.some(m=>m!==null)?{widths:g}:{},...f("caption",n.get("caption")),...f("id",n.get("id")),...r===void 0?{}:{data:r},...r===void 0||o===void 0||o.length===0?{}:{fields:o}}]}function ye(t,e){switch(e.type){case"paragraph":{const n=e.children.length===1?e.children[0]:void 0;if(n?.type==="image")return[{type:"image",src:n.url,...n.alt?{alt:n.alt}:{},...n.title?{caption:n.title}:{}}];const i=F(t,e.children),r=i.map(o=>o.text).join("").trim();return r.startsWith("$$")&&r.endsWith("$$")&&r.length>4&&l(t,e,"$$ is not drawn in a doc: an equation is a ```math code block"),[{type:"paragraph",content:i}]}case"heading":return[{type:"heading",level:e.depth,content:F(t,e.children)}];case"list":{const n=e.ordered===!0;return e.children.map((i,r)=>de(t,i,n,r===0&&n?e.start??void 0:void 0))}case"blockquote":{const{content:n,under:i}=G(t,e.children);return[A({type:"quote",content:n},i)]}case"code":return[{type:"code",...e.lang?{language:e.lang}:{},code:e.value}];case"table":return[{type:"table",rows:e.children.map(n=>fe(t,n))}];case"thematicBreak":return[{type:"divider"}];case"mdxJsxFlowElement":{const n=i=>i.length>0?i:[{type:"embed",source:k(t,e)}];if(e.name===BLOCK_TAG)return n(me(t,e));if(e.name===TABLE_TAG)return we(t,e);if(e.name===CALLOUT_TAG)return he(t,e);if(e.name===COMPONENT_TAG)return n(U(t,e));if(e.name===ITEM_TAG)return n(U(t,e,ITEM_TAG));if(e.name===CHART_TAG)return n($e(t,e));if(e.name===COLUMNS_TAG)return n(ke(t,e));if(e.name===CARD_TAG)return n(ge(t,e));if(e.name===STATS_TAG)return n(pe(t,e));if(e.name===STAT_TAG)return l(t,e,`a <${STAT_TAG} /> stands inside <${STATS_TAG}>`),n([]);if(e.name===PAGE_BREAK_TAG){const r=b(t,e,["orientation"]).get("orientation");return e.children.length>0?(l(t,e,`<${PAGE_BREAK_TAG} /> holds nothing`),n([])):r!==void 0&&r!=="portrait"&&r!=="landscape"?(l(t,e,`a page break's orientation is portrait or landscape, not "${r}"`),n([])):[{type:"pagebreak",...r===void 0?{}:{orientation:r}}]}if(e.name===BIBLIOGRAPHY_TAG)return e.attributes.length>0||e.children.length>0?(l(t,e,`<${BIBLIOGRAPHY_TAG} /> takes nothing`),n([])):[{type:"bibliography"}];if(e.name===TOC_TAG){const i=b(t,e,["levels","title"]),r=i.get("levels"),o=i.get("title"),s=r===void 0?void 0:Number(r);return e.children.length>0||s!==void 0&&!(Number.isInteger(s)&&s>=1&&s<=6)?(l(t,e,`<${TOC_TAG} /> holds nothing, and its levels are 1 to 6 (the deepest heading it lists)`),n([])):[{type:"toc",...s===void 0?{}:{levels:s},...o===void 0?{}:{title:o}}]}return e.name===COLUMN_TAG?(l(t,e,`a <${COLUMN_TAG}> stands inside <${COLUMNS_TAG}>`),n([])):e.name==="img"&&e.children.length===0?n(be(t,e)):H(e)?[{type:"paragraph",content:[]}]:[{type:"embed",source:k(t,e)}]}case"footnoteDefinition":{const{content:n,under:i}=G(t,e.children);return[A({type:"note",label:e.label??e.identifier,content:n},i)]}case"mdxjsEsm":case"definition":return[{type:"source",source:k(t,e)}];case"mdxFlowExpression":return l(t,e,"{…} on its own is not drawn in a doc"),[{type:"source",source:k(t,e)}];default:return l(t,e,`${e.type} is not drawn in a doc`),[{type:"source",source:k(t,e)}]}}function D(t,e){return e.map((n,i)=>{const r=ye(t,n),o=e[i-1],s=r[0];return n.type==="list"&&n.ordered===!0&&o?.type==="list"&&o.ordered===!0&&s?.type==="numbered"&&s.start===void 0&&(r[0]={...s,start:n.start??1}),r})}function E(t,e){return D(t,e).flat()}export function parseDoc(t){const e={source:t,problems:[]};let n;try{n=q(t,{extensions:[x(),re(),ee(),ne(),te(),ie(),Z()],mdastExtensions:[K(),V(),W(),X(),z(),Q()]})}catch(u){const d=u;return{source:t,blocks:[],segments:[],page:{},problems:[{message:d.reason??d.message??"The file is not MDX",...typeof d.line=="number"?{line:d.line}:{},...typeof d.column=="number"?{column:d.column}:{}}]}}const[i]=n.children,r=i?.type==="yaml"?i:void 0,o=r?n.children.slice(1):n.children,s=r?Te(e,r):{},c=[],a=D(e,o);o.forEach((u,d)=>{const h=u.position?.start.offset,p=u.position?.end.offset;h===void 0||p===void 0||c.push({start:h,end:p,blocks:a[d]??[]})});const g=r?.position?.start.offset,m=r?.position?.end.offset;return{source:t,blocks:c.flatMap(u=>u.blocks),segments:c,problems:e.problems,page:s,...g===void 0||m===void 0?{}:{frontMatter:{start:g,end:m}}}}function Te(t,e){let n;try{n=oe(e.value)}catch(i){return l(t,e,`the front matter is not YAML: ${i instanceof Error?i.message:String(i)}`),{}}return n==null?{}:typeof n!="object"||Array.isArray(n)?(l(t,e,`the front matter holds keys: ${ae.join(", ")}`),{}):le(n,i=>{l(t,e,i)})}
|
|
2
|
+
import{CHART_LEGEND_POSITIONS as oe,QUARTILE_METHODS as Z,SHEET_CHART_TYPES as q,valueOf as Q}from"@allyhub/formats";import{fromMarkdown as ae}from"mdast-util-from-markdown";import{frontmatterFromMarkdown as ue}from"mdast-util-frontmatter";import{gfmFootnoteFromMarkdown as le}from"mdast-util-gfm-footnote";import{gfmStrikethroughFromMarkdown as de}from"mdast-util-gfm-strikethrough";import{gfmTableFromMarkdown as fe}from"mdast-util-gfm-table";import{gfmTaskListItemFromMarkdown as ce}from"mdast-util-gfm-task-list-item";import{mdxFromMarkdown as me}from"mdast-util-mdx";import{cjkFriendlyExtension as he}from"micromark-extension-cjk-friendly";import{frontmatter as pe}from"micromark-extension-frontmatter";import{gfmFootnote as ge}from"micromark-extension-gfm-footnote";import{gfmStrikethrough as be}from"micromark-extension-gfm-strikethrough";import{gfmTable as ye}from"micromark-extension-gfm-table";import{gfmTaskListItem as $e}from"micromark-extension-gfm-task-list-item";import{mdxjs as we}from"micromark-extension-mdxjs";import{YAMLParseError as K,parse as M}from"yaml";import{citedOf as ke}from"./cite.js";import{cellAt as Te,readAligns as Ae,readMerges as ve}from"./merges.js";import{PAGE_KEYS as Ee,readPageLook as Ne,readRunning as Se}from"./page.js";import{isCharacterStyle as _e,isTableStyle as Oe,TABLE_GRID as Fe,propKeys as V,propsOf as U,styleKnown as Me}from"./styles.js";import{CHART_LABELS as x,FORMAT_KEYS as Y}from"./model.js";import{LIBRARY_TAGS as ee}from"./blocks.js";import{readBlock as Ce}from"@allyhub/formats";export const BLOCK_TAG="Block",CALLOUT_TAG="Callout",TABLE_TAG="Table",COMPONENT_TAG="Component",ITEM_TAG="Item",COMPONENT_ATTRIBUTES=["of","width","height","at","alt","title","align","id"],PAGE_BREAK_TAG="PageBreak",SECTION_BREAK_TAG="SectionBreak",CARD_TAG="Card",TEXT_BOX_TAG="TextBox",STATS_TAG="Stats",STAT_TAG="Stat",STAT_ATTRIBUTES=["label","value","delta","note","down-is-good","trend","status","target","icon","good"],TAG_TAG="Tag",INSERTED_TAG="Inserted",COMMENT_TAG="Comment",FIELD_TAG="Field",CELL_TAG="Cell",DELETED_TAG="Deleted",FORMATTED_TAG="Formatted",COLUMNS_TAG="Columns",COLUMN_TAG="Column",CHART_TAG="Chart",CHART_ATTRIBUTES=["type","title","data","categories","series","legend","labels","format","min","max","colors","smooth","totals","quartiles","width","height","alt","id"],BIBLIOGRAPHY_TAG="Bibliography",TOC_TAG="TableOfContents";const v=t=>t.split(",").map(e=>e.trim()).filter(e=>e!==""),Ge=["style","font","size","caps","small-caps","letter-spacing"],E=(t,e)=>{const n=e.position?.start.offset,r=e.position?.end.offset;return n===void 0||r===void 0?"":t.source.slice(n,r)};function a(t,e,n){const r=e.position?.start;t.problems.push({message:n,...r?{line:r.line,column:r.column}:{}})}const te=t=>JSON.stringify(t,Object.keys(t).sort()),je=(t,e)=>te(t)===te(e);function C(t,e){const n=$(t,e,["author","date","move"]),r=n.get("author"),i=n.get("date"),s=n.get("move");return(r===void 0||r==="")&&a(t,e,`<${e.name??""}> names its author: author="…"`),i!==void 0&&Number.isNaN(Date.parse(i))&&a(t,e,`a revision's date is ISO 8601 (2026-11-20T10:00:00Z), not "${i}"`),{author:r??"",...i===void 0||i===""?{}:{date:i},...s===void 0||s===""?{}:{move:s}}}function Le(t,e,n){if(n==null)return{};if(typeof n!="object"||Array.isArray(n))return a(t,e,`a <${FORMATTED_TAG}>'s was holds ${Y.join(", ")}`),{};const r={};for(const[i,s]of Object.entries(n)){const o=["bold","italic","underline","strike","superscript","subscript","caps","smallCaps"].includes(i);Y.includes(i)&&(o?s===!0:i==="letterSpacing"?typeof s=="number":i==="size"&&typeof s=="number"||typeof s=="string")?r[i]=s:a(t,e,`a <${FORMATTED_TAG}>'s was holds ${Y.join(", ")}, flags true: ${i} is not one of them`)}return r}function Be(t,e){const n=$(t,e,["id","author","date","reply-to","done"]),r=n.get("id"),i=n.get("author"),s=n.get("date");if(r===void 0||r==="")return a(t,e,`a <${COMMENT_TAG}> names itself: id="…"`),[];(i===void 0||i==="")&&a(t,e,`a <${COMMENT_TAG}> names its author: author="…"`),s!==void 0&&Number.isNaN(Date.parse(s))&&a(t,e,`a comment's date is ISO 8601 (2026-11-20T10:00:00Z), not "${s}"`);const o=n.get("reply-to");return[{type:"comment",id:r,author:i??"",...s===void 0||s===""?{}:{date:s},...o===void 0||o===""?{}:{replyTo:o},...n.has("done")?{done:!0}:{},blocks:T(t,e.children)}]}function Ie(t,e){const n=C(t,e),r=e.name===INSERTED_TAG?"inserted":"deleted";return e.children.length===0?[{type:"paragraph",content:[],mark:{kind:r,...n}}]:T(t,e.children).map(i=>({...i,revision:{kind:r,...n}}))}function Re(t,e){const n=e.attributes.find(d=>d.type==="mdxJsxAttribute"&&d.name==="was"),r=C(t,{...e,attributes:e.attributes.filter(d=>d!==n)});let i={};if(n?.type==="mdxJsxAttribute"&&n.value!==null&&n.value!==void 0){const d=n.value;try{i=typeof d=="string"?M(d):M(d.value)}catch(h){if(!(h instanceof K))throw h;a(t,e,`a <${FORMATTED_TAG}>'s was is its look before: ${h.message}`)}}const s=new Map;if(i!==null&&typeof i=="object"&&!Array.isArray(i))for(const[d,h]of Object.entries(i))s.set(d,h===!0?"":String(h));const o=["color","bg","style",...V("paragraph")];for(const d of s.keys())o.includes(d)||a(t,e,`a <${FORMATTED_TAG}>'s was holds ${o.join(", ")}: ${d} is not one of them`);const u=U(s,"paragraph",`<${FORMATTED_TAG}>`,d=>{a(t,e,d)}),f=z(t,e,s.get("style"),"paragraph"),l={...u,...g("color",s.get("color")),...g("background",s.get("bg")),...f===void 0?{}:{style:f}};return T(t,e.children).map(d=>({...d,formatted:{...r,was:l}}))}function z(t,e,n,r){if(n===void 0||n.trim()==="")return;const i=n.trim();return Me(t.styles,i)?t.styles?.[i]?.type==="table"?(a(t,e,`the style ${i} is a table's: <${TABLE_TAG} style> takes it`),i):(_e(t.styles,i)!==(r==="character")&&a(t,e,r==="character"?`the style ${i} is a paragraph's: <span style> takes a style of characters (type: character)`:`the style ${i} is of characters: <${BLOCK_TAG} style> takes a paragraph's`),i):(a(t,e,`the style ${i} is not one of the doc's: name it under styles in its front matter`),i)}function _(t,e,n,r){if(e==="")return;const i=t.at(-1);if(i&&i.note===void 0&&i.cite===void 0&&i.field===void 0&&i.href===r&&je(i.styles,n)){i.text+=e;return}t.push({text:e,styles:{...n},...r===void 0?{}:{href:r}})}function $(t,e,n){const r=new Map;for(const i of e.attributes){if(i.type!=="mdxJsxAttribute"||!n.includes(i.name)){a(t,e,`<${e.name??""}> takes ${n.join(", ")}: ${i.type==="mdxJsxAttribute"?i.name:"{…}"} is not one of them`);continue}i.value===null||i.value===void 0?r.set(i.name,""):typeof i.value=="string"?r.set(i.name,i.value):a(t,e,`${i.name} of <${e.name??""}> is a plain string`)}return r}function Je(t,e,n){switch(e.name){case"u":return{...n,underline:!0};case"strong":case"b":return{...n,bold:!0};case"em":case"i":return{...n,italic:!0};case"del":case"s":return{...n,strike:!0};case"code":return{...n,code:!0};case TAG_TAG:{const r=$(t,e,["color"]).get("color");return{...n,tag:r===void 0||r===""?"gray":r}}case COMMENT_TAG:{const r=$(t,e,["id"]).get("id");return r===void 0||r===""?(a(t,e,`<${COMMENT_TAG}> around words names its comment: id="…"`),n):{...n,comments:[...(n.comments??[]).filter(i=>i!==r),r]}}case INSERTED_TAG:case DELETED_TAG:{e.children.length===0&&a(t,e,`an empty <${e.name}> is its paragraph's mark: it stands at the end of its words`);const r=C(t,e);return e.name===INSERTED_TAG?{...n,inserted:r}:{...n,deleted:r}}case FORMATTED_TAG:{const r=e.attributes.find(o=>o.type==="mdxJsxAttribute"&&o.name==="was"),i=C(t,{...e,attributes:e.attributes.filter(o=>o!==r)});let s={};if(r?.type==="mdxJsxAttribute"&&r.value!==null&&r.value!==void 0){const o=r.value;try{s=typeof o=="string"?M(o):M(o.value)}catch(u){if(!(u instanceof K))throw u;a(t,e,`a <${FORMATTED_TAG}>'s was is its words' look before: ${u.message}`)}}return{...n,formatted:{...i,was:Le(t,e,s)}}}case"sup":return{...n,superscript:!0};case"sub":return{...n,subscript:!0};case"span":{const r=$(t,e,["color","bg",...Ge]),i=r.get("color"),s=r.get("bg"),o=U(r,"run","<span>",f=>{a(t,e,f)}),u=z(t,e,r.get("style"),"character");return{...n,...i?{color:i}:{},...s?{background:s}:{},...u===void 0?{}:{style:u},...o.font===void 0?{}:{font:o.font},...o.size===void 0?{}:{size:o.size},...o.caps===!0?{caps:!0}:{},...o.smallCaps===!0?{smallCaps:!0}:{},...o.letterSpacing===void 0?{}:{letterSpacing:o.letterSpacing}}}default:return}}function O(t,e,n,r,i){for(const s of e)switch(s.type){case"text":for(const[,o]of s.value.matchAll(/\[\^([^\]\s]+)\]/gu))a(t,s,`the footnote [^${o??""}] has no note: write [^${o??""}]: … on a line of its own`);for(const o of s.value.replace(/\r?\n/g," ").split(/(\[-?@[^\]]+\])/u)){if(o==="")continue;const u=/^\[(-?@[^\]]+)\]$/u.exec(o)?.[1];u!==void 0&&ke(u).keys.length>0?i.push({text:o,styles:{...n},cite:u}):_(i,o,n,r)}break;case"strong":O(t,s.children,{...n,bold:!0},r,i);break;case"emphasis":O(t,s.children,{...n,italic:!0},r,i);break;case"delete":O(t,s.children,{...n,strike:!0},r,i);break;case"inlineCode":_(i,s.value,{...n,code:!0},r);break;case"break":_(i,`
|
|
3
|
+
`,n,r);break;case"link":s.children.length===0?i.push({text:"",styles:{...n},href:s.url}):O(t,s.children,n,s.url,i);break;case"footnoteReference":{const o=s.label??s.identifier;i.push({text:o,styles:{...n},...r===void 0?{}:{href:r},note:o});break}case"mdxJsxTextElement":{if(s.name==="br"){_(i,`
|
|
4
|
+
`,n,r);break}if(s.name===FIELD_TAG){const u=$(t,s,["code"]).get("code")?.trim();if(u===void 0||u===""){a(t,s,`a <${FIELD_TAG}> says its code as Word writes it: code="PAGEREF budget"`);break}const f=[];O(t,s.children,{},void 0,f),i.push({text:f.map(l=>l.text).join(""),styles:{...n},...r===void 0?{}:{href:r},field:u.replace(/\s+/gu," ")});break}const o=Je(t,s,n);if(o){O(t,s.children,o,r,i);break}a(t,s,`<${s.name??""}> inside a line is not drawn: a tag the doc's code draws goes on lines of its own`),_(i,E(t,s),n,r);break}case"mdxTextExpression":a(t,s,"{…} in a line is not drawn: write \\{ for a brace"),_(i,E(t,s),n,r);break;default:a(t,s,`${s.type} is not drawn in a doc`),_(i,E(t,s),n,r)}}function j(t,e){const n=[];return O(t,e,{},void 0,n),n}function H(t,e){let n=e.length;for(;n>0;){const u=e[n-1];if(u?.type==="text"&&u.value.trim()==="")n--;else break}const r=e[n-1];if(r?.type!=="mdxJsxTextElement"||r.name!==INSERTED_TAG&&r.name!==DELETED_TAG||r.children.length>0)return{content:j(t,e)};const i={kind:r.name===INSERTED_TAG?"inserted":"deleted",...C(t,r)},s=j(t,e.slice(0,n-1));return{content:s.length===1&&s[0]?.text===`
|
|
5
|
+
`&&Object.keys(s[0].styles).length===0?[]:s,mark:i}}const ne=t=>t?.type==="mdxJsxFlowElement"&&t.name==="br"&&t.children.length===0;function R(t,e){const[n,...r]=e;if(n?.type==="paragraph"){const{content:i,mark:s}=H(t,n.children);return{content:i.length===1&&i[0]?.text===`
|
|
6
|
+
`&&Object.keys(i[0].styles).length===0?[]:i,under:T(t,r),...s===void 0?{}:{mark:s}}}return ne(n)?{content:[],under:T(t,r)}:n?.type==="mdxJsxFlowElement"&&(n.name===INSERTED_TAG||n.name===DELETED_TAG)&&n.children.length===0?{content:[],under:T(t,r),mark:{kind:n.name===INSERTED_TAG?"inserted":"deleted",...C(t,n)}}:{content:[],under:T(t,e)}}const N=(t,e)=>e.length>0?{...t,children:e}:t;function De(t,e,n,r){const{content:i,under:s,mark:o}=R(t,e.children),u=o===void 0?{}:{mark:o};return typeof e.checked=="boolean"?N({type:"check",checked:e.checked,content:i,...u},s):N(n?{type:"numbered",...r===void 0||r===1?{}:{start:r},content:i,...u}:{type:"bullet",content:i,...u},s)}function Pe(t,e){return e.children.map(n=>j(t,n.children))}function g(t,e){return e?{[t]:e}:{}}function qe(t,e){const n=$(t,e,["color","bg","toggle","style",...V("paragraph")]),r=T(t,e.children),[i,...s]=r;if(i===void 0)return a(t,e,`<${BLOCK_TAG}> holds a block: this one is empty`),[];if(i.type==="embed"||i.type==="source")return a(t,e,`<${BLOCK_TAG}> holds a block of the doc's own, not a tag or an import`),r;const o=U(n,"paragraph",`<${BLOCK_TAG}>`,d=>{a(t,e,d)}),u=z(t,e,n.get("style"),"paragraph"),f={...o,...g("color",n.get("color")),...g("background",n.get("bg")),...u===void 0?{}:{style:u}};let l=i;if(n.has("toggle")&&(l.type==="heading"?l={...l,toggle:!0}:l.type==="paragraph"?l={type:"toggle",content:l.content}:a(t,e,"toggle is for a heading or a line of text")),Object.keys(f).length>0&&("content"in l?l={...l,look:f}:a(t,e,`a ${l.type} has no look to set`)),s.length>0)if("content"in l)l={...l,children:[...l.children??[],...s]};else return a(t,e,`a ${l.type} holds no blocks under it`),[l,...s];return[l]}function Ke(t,e){const n=$(t,e,["icon","color","bg","tone"]),{content:r,under:i}=R(t,e.children),s={...g("color",n.get("color")),...g("background",n.get("bg"))};return[N({type:"callout",...g("icon",n.get("icon")),...g("tone",n.get("tone")),...Object.keys(s).length>0?{look:s}:{},content:r},i)]}function Ue(t,e){const n=$(t,e,["title","subtitle","icon","tag","featured"]),r=T(t,e.children);return[N({type:"card",...g("title",n.get("title")),...g("subtitle",n.get("subtitle")),...g("icon",n.get("icon")),...g("tag",n.get("tag")),...n.has("featured")&&n.get("featured")!=="false"?{featured:!0}:{}},r)]}function Ye(t,e){const n=$(t,e,["float","width","wrap","x","y"]),r=n.get("float");r!==void 0&&r!=="left"&&r!=="right"&&a(t,e,`a text box's float is left or right, not "${r}"`);const i=n.get("wrap");i!==void 0&&i!=="front"&&i!=="behind"&&a(t,e,`a text box's wrap is front or behind, not "${i}"`);const s=i==="front"||i==="behind",o=l=>{const d=n.get(l);if(d===void 0)return{};const h=Number(d);return Number.isFinite(h)?{[l]:Math.round(h)}:(a(t,e,`a text box's ${l} is a number of px, not "${d}"`),{})},u=n.get("width"),f=u===void 0?void 0:Number(u);return f!==void 0&&!(Number.isFinite(f)&&f>0)&&a(t,e,`a text box's width is a number of px, not "${u??""}"`),[N({type:"textbox",...(r==="left"||r==="right")&&!s?{float:r}:{},...s?{wrap:i,...o("x"),...o("y")}:{},...f!==void 0&&Number.isFinite(f)&&f>0?{width:f}:{}},T(t,e.children))]}function re(t,e){const n={};for(const r of e.attributes){if(r.type!=="mdxJsxAttribute"||r.value!==null&&r.value!==void 0&&typeof r.value!="string"){a(t,e,`<${e.name??""}> takes plain strings: ${r.type==="mdxJsxAttribute"?r.name:"{…}"} is not one`);return}n[r.name]=r.value??""}return n}function ze(t,e){const n=e.name??"",r=ee[n],i=re(t,e);if(r===void 0||i===void 0)return[];const s=[];for(const l of e.children){if(r.item===void 0||l.type!=="mdxJsxFlowElement"||l.name!==r.item||l.children.length>0)return a(t,l,r.item===void 0?`<${n} /> holds nothing`:`<${n}> holds <${r.item} … />s, one to a line`),[];const d=re(t,l);if(d===void 0)return[];s.push({tag:l.name,props:d})}const o={type:"block",tag:n,props:i,...r.item===void 0||s.length===0?{}:{items:s}},u=s.length===0?{...i}:{...i,items:s.map(l=>l.props)},f=Ce(r.kind,u);if(f.problems.length>0){for(const l of f.problems)a(t,e,`<${n}>${l.path.length>0?` ${l.path.join(".")}`:""}: ${l.message}`);return[]}return[o]}function He(t,e){$(t,e,[]);const n=[];for(const r of e.children){if(r.type!=="mdxJsxFlowElement"||r.name!==STAT_TAG||r.children.length>0)return a(t,r,`<${STATS_TAG}> holds <${STAT_TAG} label="…" value="…" />s, one to a line`),[];const i=$(t,r,STAT_ATTRIBUTES),s=i.get("label"),o=i.get("value");if(o===void 0||s===void 0)return a(t,r,`a <${STAT_TAG}> has a label and a value`),[];const u=i.get("trend"),f=u?.split(",").map(l=>Number(l.trim()));if(f!==void 0&&!f.every(l=>Number.isFinite(l)))return a(t,r,`a stat's trend is numbers, oldest first, comma-separated ("12,15,14,19"), not "${u??""}"`),[];n.push({label:s,value:o,...g("delta",i.get("delta")),...g("note",i.get("note")),...i.has("down-is-good")&&i.get("down-is-good")!=="false"||i.get("good")==="down"?{downIsGood:!0}:{},...g("status",i.get("status")),...g("target",i.get("target")),...g("icon",i.get("icon")),...f===void 0||f.length<2?{}:{trend:f}})}return n.length===0?(a(t,e,`<${STATS_TAG}> holds one <${STAT_TAG} /> or more`),[]):[{type:"stats",stats:n}]}function We(t,e){const n=$(t,e,["src","alt","title","width","align","float","wrap","x","y","id"]),r=n.get("src");if(!r)return a(t,e,"<img> names its picture: src is missing"),[];const i=Number(n.get("width")),s=n.get("align");s!==void 0&&s!=="center"&&s!=="right"&&a(t,e,`a picture's align is center or right, not "${s}"`);const o=n.get("float");o!==void 0&&o!=="left"&&o!=="right"&&a(t,e,`a picture's float is left or right, not "${o}"`);const u=n.get("wrap");u!==void 0&&u!=="front"&&u!=="behind"&&a(t,e,`a picture's wrap is front or behind, not "${u}"`);const f=d=>{const h=n.get(d);if(h===void 0)return{};const p=Number(h);return Number.isFinite(p)?{[d]:Math.round(p)}:(a(t,e,`a picture's ${d} is a number of px, not "${h}"`),{})},l=u==="front"||u==="behind";return[{type:"image",src:r,...g("alt",n.get("alt")),...g("caption",n.get("title")),...Number.isFinite(i)&&i>0?{width:Math.round(i)}:{},...s==="center"||s==="right"?{align:s}:{},...(o==="left"||o==="right")&&!l?{float:o}:{},...l?{wrap:u,...f("x"),...f("y")}:{},...g("id",n.get("id"))}]}function ie(t,e,n=COMPONENT_TAG){const r=n===ITEM_TAG;if(e.children.length>0)return a(t,e,r?`<${ITEM_TAG}> holds nothing: what it shows is its attributes`:`<${n}> holds nothing: its props are its attributes`),[];const i=new Map,s={};for(const c of e.attributes){if(c.type!=="mdxJsxAttribute"){a(t,e,`<${n}>'s attributes are plain strings, not {…}`);continue}const y=c.value===null||c.value===void 0?"":typeof c.value=="string"?c.value:void 0;if(y===void 0){a(t,e,`${c.name} of <${n}> is a plain string`);continue}COMPONENT_ATTRIBUTES.includes(c.name)?i.set(c.name,y):r?a(t,e,`<${ITEM_TAG}> has no ${c.name}: it takes of, at, width, height, alt, title, align and id`):s[c.name]=y}const o=i.get("of")??"";if(o.trim()==="")return a(t,e,r?`<${ITEM_TAG}> names the item it shows: of is missing (of="../deck/q3.ts#pricing")`:`<${n}> names its component: of is missing (of="../ui.ts#Dialog")`),[];const u=c=>{const y=i.get(c);if(y===void 0)return;const k=Number(y);if(Number.isFinite(k)&&k>0)return Math.round(k);a(t,e,`${c} of <${n}> is a number of pixels, not "${y}"`)},f=u("width"),l=u("height"),d=i.get("at"),h=d===void 0?void 0:Number(d);h!==void 0&&!(Number.isFinite(h)&&h>=0)&&a(t,e,`at of <${n}> is seconds, 0 or more, not "${d??""}"`);const p=i.get("align");return p!==void 0&&p!=="center"&&p!=="right"&&a(t,e,`a component's align is center or right, not "${p}"`),[{type:"component",of:o,...f===void 0?{}:{width:f},...l===void 0?{}:{height:l},...h!==void 0&&Number.isFinite(h)&&h>=0?{at:h}:{},...g("alt",i.get("alt")),...g("caption",i.get("title")),...p==="center"||p==="right"?{align:p}:{},...g("id",i.get("id")),props:s,...r?{item:!0}:{}}]}function Xe(t,e){const n=$(t,e,CHART_ATTRIBUTES),r=A=>{a(t,e,A)},i=n.get("type");if(i===void 0||i==="")return r(`<${CHART_TAG}> says what it is drawn as: type is missing (${q.join(", ")})`),[];const s=Q(i,q);if(s===void 0)return r(`a chart's type is ${q.join(", ")}, not "${i}"`),[];const o=e.children,[u,...f]=o;if(f.length>0||u!==void 0&&u.type!=="table")return r(`<${CHART_TAG}> holds one table: its numbers`),[];const l=u?.type==="table"?u.children.map(A=>A.children.map(S=>j(t,S.children).map(F=>F.text).join("").trim())):void 0,d=n.get("data"),h=n.get("categories"),p=n.get("series");if(l!==void 0&&d!==void 0)return r("a chart's numbers are its table or the file data names, not both"),[];if(l===void 0&&(d===void 0||d===""))return r(`<${CHART_TAG}> has numbers: a table inside it, or data="…" naming a file of them`),[];if(l!==void 0){(h!==void 0||p!==void 0)&&r("categories and series name a file's columns: a chart's own table has its series in its head row and its categories in its first column");const A=Math.min(...l.map(S=>S.length));(l.length<2||A<2)&&r("a chart's table has a head row and a row of numbers, a column of categories and a column of numbers")}else(h===void 0||h==="")&&r("with data, categories names the column of the categories"),(p===void 0||v(p).length===0)&&r('with data, series names the columns of the numbers (series="revenue,cost")');const c=n.get("legend"),y=[...oe,"none"];c!==void 0&&!y.includes(c)&&r(`a chart's legend is ${y.join(", ")}, not "${c}"`);const k=n.get("labels"),m=k===void 0?void 0:k===""?["value"]:v(k),b=m?.filter(A=>!x.includes(A));b?.length&&r(`a chart's labels are ${x.join(", ")}, not ${b.map(A=>`"${A}"`).join(", ")}`);const w=(A,S)=>{const F=n.get(A);if(F===void 0)return;const I=Number(F);if(F.trim()!==""&&Number.isFinite(I)&&(!S||I>0))return S?Math.round(I):I;r(`${A} of <${CHART_TAG}> is ${S?"a number of pixels":"a number"}, not "${F}"`)},G=w("min",!1),L=w("max",!1),W=w("width",!0),X=w("height",!0),J=n.get("colors"),D=n.get("totals"),B=n.get("quartiles"),P=B===void 0?void 0:Q(B,Z);return B!==void 0&&P===void 0&&r(`a chart's quartiles are ${Z.join(" or ")}, not "${B}"`),[{type:"chart",kind:s,...g("title",n.get("title")),...l===void 0?{}:{table:l},...d===void 0||d===""?{}:{data:d},...l===void 0?g("categories",h):{},...l===void 0&&p!==void 0&&v(p).length>0?{series:v(p)}:{},...c!==void 0&&y.includes(c)?{legend:c}:{},...m!==void 0&&!b?.length?{labels:m}:{},...g("format",n.get("format")),...G===void 0?{}:{min:G},...L===void 0?{}:{max:L},...J!==void 0&&v(J).length>0?{colors:v(J)}:{},...n.has("smooth")&&n.get("smooth")!=="false"?{smooth:!0}:{},...D!==void 0&&v(D).length>0?{totals:v(D)}:{},...P===void 0?{}:{quartiles:P},...W===void 0?{}:{width:W},...X===void 0?{}:{height:X},...g("alt",n.get("alt")),...g("id",n.get("id"))}]}function Ze(t,e){$(t,e,[]);const n=[];for(const r of e.children){if(r.type!=="mdxJsxFlowElement"||r.name!==COLUMN_TAG)return a(t,r,`<${COLUMNS_TAG}> holds <${COLUMN_TAG}>s, each around its blocks`),[];const s=$(t,r,["width"]).get("width"),o=s===void 0?void 0:Number(s);s!==void 0&&!(Number.isFinite(o)&&(o??0)>0)&&a(t,r,`a column's width is a share against the others' (1, 2, 0.5), not "${s}"`);const u=T(t,r.children);if(u.some(f=>f.type==="columns"))return a(t,r,`a <${COLUMN_TAG}> holds no <${COLUMNS_TAG}>`),[];n.push({...o!==void 0&&Number.isFinite(o)&&o>0&&o!==1?{width:o}:{},blocks:u})}return n.length<2?(a(t,e,`<${COLUMNS_TAG}> holds two or more <${COLUMN_TAG}>s`),[]):[{type:"columns",columns:n}]}function Qe(t,e){const n=$(t,e,["widths","head","caption","id","data","fields","merge","style","heights","valign"]),r=m=>m.type==="mdxJsxFlowElement"&&m.name===CELL_TAG,i=T(t,e.children.filter(m=>!r(m))),s=e.children.filter(m=>r(m)),o=n.get("data"),u=n.get("fields")?.split(",").map(m=>m.trim()).filter(m=>m!=="");if(o===void 0&&u!==void 0&&a(t,e,"fields say which columns a table shows of its data: give it data"),o!==void 0&&i.length>0)return a(t,e,`<${TABLE_TAG} data> reads its rows: it holds no table`),i;const[f,...l]=o===void 0?i:[{type:"table",rows:[]}];if(f?.type!=="table"||l.length>0)return a(t,e,`<${TABLE_TAG}> holds one table`),i;const d=n.get("head");d!==void 0&&!["none","column","both","row"].includes(d)&&a(t,e,`a table's head is none, row, column or both, not "${d}"`);const h=m=>n.get(m)?.split(",").map(b=>{const w=Number(b.trim());return b.trim()!==""&&Number.isFinite(w)&&w>0?Math.round(w):null}),p=h("widths"),c=o===void 0?h("heights"):void 0,y={rows:f.rows.length,cols:Math.max(0,...f.rows.map(m=>m.length))},k={};for(const m of s){const b=$(t,m,["at"]).get("at")?.trim().toUpperCase(),w=b===void 0?void 0:Te(b),G=w===void 0?void 0:f.rows[w.row]?.[w.col];if(b===void 0||w===void 0||G===void 0){a(t,m,`a <${CELL_TAG}> names a cell of its table as Excel does: at="B2", not "${b??""}"`);continue}G.some(L=>L.text.trim()!=="")&&a(t,m,`${b} holds blocks in its <${CELL_TAG}>: its place in the grid is empty`),k[b]=T(t,m.children)}return[{...f,...Object.keys(k).length>0?{cells:k}:{},...d==="none"||d==="column"||d==="both"?{head:d}:{},...p?.some(m=>m!==null)?{widths:p}:{},...c?.some(m=>m!==null)?{heights:c.slice(0,y.rows)}:{},...(()=>{const m=n.get("valign");if(m===void 0||o!==void 0)return{};const b=Ae(m,y,w=>{a(t,e,w)});return b.length>0?{valign:b}:{}})(),...(()=>{const m=n.get("style");return m===void 0?{}:(Oe(t.styles,m)||a(t,e,`the table style ${m} is not the doc's: name it in its styles with type: table, or Word's ${Fe}`),{style:m})})(),...(()=>{const m=n.get("merge");if(m===void 0||o!==void 0)return{};const b=ve(m,y,w=>{a(t,e,w)});return b.length>0?{merges:b}:{}})(),...g("caption",n.get("caption")),...g("id",n.get("id")),...o===void 0?{}:{data:o},...o===void 0||u===void 0||u.length===0?{}:{fields:u}}]}function Ve(t,e){switch(e.type){case"paragraph":{const n=e.children.length===1?e.children[0]:void 0;if(n?.type==="image")return[{type:"image",src:n.url,...n.alt?{alt:n.alt}:{},...n.title?{caption:n.title}:{}}];const{content:r,mark:i}=H(t,e.children),s=r.map(o=>o.text).join("").trim();return s.startsWith("$$")&&s.endsWith("$$")&&s.length>4&&a(t,e,"$$ is not drawn in a doc: an equation is a ```math code block"),[{type:"paragraph",content:r,...i===void 0?{}:{mark:i}}]}case"heading":{const{content:n,mark:r}=H(t,e.children);return[{type:"heading",level:e.depth,content:n,...r===void 0?{}:{mark:r}}]}case"list":{const n=e.ordered===!0;return e.children.map((r,i)=>De(t,r,n,i===0&&n?e.start??void 0:void 0))}case"blockquote":{const{content:n,under:r}=R(t,e.children);return[N({type:"quote",content:n},r)]}case"code":return[{type:"code",...e.lang?{language:e.lang}:{},code:e.value}];case"table":return[{type:"table",rows:e.children.map(n=>Pe(t,n))}];case"thematicBreak":return[{type:"divider"}];case"mdxJsxFlowElement":{const n=r=>r.length>0?r:[{type:"embed",source:E(t,e)}];if(e.name===BLOCK_TAG)return n(qe(t,e));if(e.name===INSERTED_TAG||e.name===DELETED_TAG)return n(Ie(t,e));if(e.name===FORMATTED_TAG)return n(Re(t,e));if(e.name===COMMENT_TAG)return n(Be(t,e));if(e.name===TABLE_TAG)return Qe(t,e);if(e.name===CALLOUT_TAG)return Ke(t,e);if(e.name===COMPONENT_TAG)return n(ie(t,e));if(e.name===ITEM_TAG)return n(ie(t,e,ITEM_TAG));if(e.name===CHART_TAG)return n(Xe(t,e));if(e.name===COLUMNS_TAG)return n(Ze(t,e));if(e.name===CARD_TAG)return n(Ue(t,e));if(e.name===TEXT_BOX_TAG)return n(Ye(t,e));if(e.name===STATS_TAG)return n(He(t,e));if(e.name!==null&&e.name in ee)return n(ze(t,e));if(e.name===STAT_TAG)return a(t,e,`a <${STAT_TAG} /> stands inside <${STATS_TAG}>`),n([]);if(e.name===PAGE_BREAK_TAG||e.name===SECTION_BREAK_TAG){const r=e.name===SECTION_BREAK_TAG,i={},s=c=>!r&&c.type==="mdxJsxAttribute"&&(c.name==="header"||c.name==="footer");for(const c of e.attributes){if(!s(c)||c.type!=="mdxJsxAttribute")continue;const y=c.name;let k=c.value;if(c.value!==null&&typeof c.value=="object")try{k=M(c.value.value)}catch(b){if(!(b instanceof K))throw b;a(t,e,`a section's ${y} is words, false, or a running line as the front matter writes one: ${b.message}`);continue}const m=Se(k,`section's ${y}`,b=>{a(t,e,b)});m!==void 0&&(i[y]=m)}const o=$(t,{...e,attributes:e.attributes.filter(c=>!s(c))},r?["columns"]:["orientation","columns","margins","header","footer"]),u=o.get("orientation"),f=o.get("margins"),l=f?.split(/[\s,]+/u).filter(c=>c!=="").map(Number);if(l!==void 0&&!([1,2,4].includes(l.length)&&l.every(c=>Number.isFinite(c)&&c>=0)))return a(t,e,`a section's margins are mm: one for all four, top and bottom then the sides, or top, right, bottom, left; not "${f??""}"`),n([]);const d=l===void 0?void 0:l.length===1?l[0]??0:l,h=o.get("columns"),p=h===void 0?void 0:Number(h);return e.children.length>0?(a(t,e,`<${e.name} /> holds nothing`),n([])):p!==void 0&&(!Number.isInteger(p)||p<1||p>9)?(a(t,e,`a section's columns are 1 to 9, not "${h??""}"`),n([])):u!==void 0&&u!=="portrait"&&u!=="landscape"?(a(t,e,`a page break's orientation is portrait or landscape, not "${u}"`),n([])):[{type:"pagebreak",...u===void 0?{}:{orientation:u},...p===void 0?{}:{columns:p},...r?{continuous:!0}:{},...d===void 0?{}:{margins:d},...i}]}if(e.name===BIBLIOGRAPHY_TAG)return e.attributes.length>0||e.children.length>0?(a(t,e,`<${BIBLIOGRAPHY_TAG} /> takes nothing`),n([])):[{type:"bibliography"}];if(e.name===TOC_TAG){const r=$(t,e,["levels","title"]),i=r.get("levels"),s=r.get("title"),o=i===void 0?void 0:Number(i);return e.children.length>0||o!==void 0&&!(Number.isInteger(o)&&o>=1&&o<=6)?(a(t,e,`<${TOC_TAG} /> holds nothing, and its levels are 1 to 6 (the deepest heading it lists)`),n([])):[{type:"toc",...o===void 0?{}:{levels:o},...s===void 0?{}:{title:s}}]}if(e.name===COLUMN_TAG)return a(t,e,`a <${COLUMN_TAG}> stands inside <${COLUMNS_TAG}>`),n([]);if(e.name==="img"&&e.children.length===0)return n(We(t,e));if(e.name===FIELD_TAG){const r={...e,type:"mdxJsxTextElement",children:e.children.flatMap(i=>i.type==="paragraph"?i.children:[])};return[{type:"paragraph",content:j(t,[r])}]}return ne(e)?[{type:"paragraph",content:[]}]:[{type:"embed",source:E(t,e)}]}case"footnoteDefinition":{const{content:n,under:r}=R(t,e.children);return[N({type:"note",label:e.label??e.identifier,content:n},r)]}case"mdxjsEsm":case"definition":return[{type:"source",source:E(t,e)}];case"mdxFlowExpression":return a(t,e,"{…} on its own is not drawn in a doc"),[{type:"source",source:E(t,e)}];default:return a(t,e,`${e.type} is not drawn in a doc`),[{type:"source",source:E(t,e)}]}}function se(t,e){return e.map((n,r)=>{const i=Ve(t,n),s=e[r-1],o=i[0];return n.type==="list"&&n.ordered===!0&&s?.type==="list"&&s.ordered===!0&&o?.type==="numbered"&&o.start===void 0&&(i[0]={...o,start:n.start??1}),i})}function T(t,e){return se(t,e).flat()}export function parseDoc(t){const e={source:t,problems:[]};let n;try{n=ae(t,{extensions:[pe(),we(),ge(),ye(),be(),$e(),he()],mdastExtensions:[ue(),me(),le(),fe(),de(),ce()]})}catch(h){const p=h;return{source:t,blocks:[],segments:[],page:{},problems:[{message:p.reason??p.message??"The file is not MDX",...typeof p.line=="number"?{line:p.line}:{},...typeof p.column=="number"?{column:p.column}:{}}]}}const[r]=n.children,i=r?.type==="yaml"?r:void 0,s=i?n.children.slice(1):n.children,o=i?xe(e,i):{};o.styles!==void 0&&(e.styles=o.styles);const u=[],f=se(e,s);s.forEach((h,p)=>{const c=h.position?.start.offset,y=h.position?.end.offset;c===void 0||y===void 0||u.push({start:c,end:y,blocks:f[p]??[]})});const l=i?.position?.start.offset,d=i?.position?.end.offset;return{source:t,blocks:u.flatMap(h=>h.blocks),segments:u,problems:e.problems,page:o,...l===void 0||d===void 0?{}:{frontMatter:{start:l,end:d}}}}function xe(t,e){let n;try{n=M(e.value)}catch(r){return a(t,e,`the front matter is not YAML: ${r instanceof Error?r.message:String(r)}`),{}}return n==null?{}:typeof n!="object"||Array.isArray(n)?(a(t,e,`the front matter holds keys: ${Ee.join(", ")}`),{}):Ne(n,r=>{a(t,e,r)})}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{diffArrays as a}from"diff";import{blockKey as x}from"./model.js";export const REDLINE_ALIKE=.4;const S=new Set(["paragraph","heading","bullet","numbered","check","toggle","quote","callout","note"]),h=t=>S.has(t.type)&&"content"in t&&Array.isArray(t.content);export function redline(t,e,n){const o={author:n.author,...n.date===void 0?{}:{date:n.date}},r=n.alike??REDLINE_ALIKE;return p(t,e,o,r)}function p(t,e,n,o){const r=[],c=a(t.map(x),e.map(x));let u=0,l=0,s=[];const i=d=>{r.push(...v(s,d,n,o)),s=[]};for(const d of c){const f=d.count;d.removed?(s.push(...t.slice(u,u+f)),u+=f):d.added?(i(e.slice(l,l+f)),l+=f):(i([]),r.push(...e.slice(l,l+f)),u+=f,l+=f)}return i([]),r}function v(t,e,n,o){const r=[];let c=0,u=[];const l=s=>{for(const i of t.slice(c,s))r.push(m(i,"deleted",n));r.push(...u),u=[]};for(const s of e){const i=t.findIndex((f,O)=>O>=c&&E(f,s,o)),d=t[i];if(d===void 0){u.push(m(s,"inserted",n));continue}l(i),r.push(I(d,s,n,o)),c=i+1}return l(t.length),r}function E(t,e,n){return t.type!==e.type?!1:h(t)&&h(e)?likeness(k(t.content),k(e.content))>=n:t.type==="table"&&e.type==="table"?N(t.rows,e.rows):t.type==="columns"&&e.type==="columns"?t.columns.length===e.columns.length:!1}function I(t,e,n,o){if(h(t)&&h(e)){const r="children"in e||"children"in t?p(("children"in t?t.children:void 0)??[],("children"in e?e.children:void 0)??[],n,o):[];return{...e,content:runsAgainst(t.content,e.content,n),...r.length>0?{children:r}:{}}}return t.type==="table"&&e.type==="table"?{...e,rows:e.rows.map((r,c)=>r.map((u,l)=>runsAgainst(t.rows[c]?.[l]??[],u,n)))}:t.type==="columns"&&e.type==="columns"?{...e,columns:e.columns.map((r,c)=>({...r,blocks:p(t.columns[c]?.blocks??[],r.blocks,n,o)}))}:e}function m(t,e,n){const o={kind:e,...n},r="children"in t?t.children??[]:[],c=r.length>0?{children:r.map(u=>m(u,e,n))}:{};return{...t,...c,revision:o}}const N=(t,e)=>t.length===e.length&&t.every((n,o)=>n.length===e[o]?.length),k=t=>t.map(e=>e.text).join(""),j=new Intl.Segmenter("und",{granularity:"word"}),g=t=>Array.from(j.segment(t),e=>e.segment);export function likeness(t,e){return t===""&&e===""?1:2*a(g(t),g(e)).filter(o=>!o.added&&!o.removed).reduce((o,r)=>o+r.value.join("").length,0)/(t.length+e.length)}function A(t){return t.flatMap(e=>{if(e.note!==void 0||e.cite!==void 0||e.field!==void 0||e.text==="")return[{key:`\0${JSON.stringify(e)}`,text:e.text,run:e}];const n=e.href===void 0?"":`\0${e.href}`;return g(e.text).map(o=>({key:o+n,text:o,run:e}))})}export function runsAgainst(t,e,n){const o=A(t),r=A(e),c=[];let u=0,l=0;for(const s of a(o.map(i=>i.key),r.map(i=>i.key)))if(s.removed){for(const i of o.slice(u,u+s.count))y(c,i,{deleted:n});u+=s.count}else if(s.added){for(const i of r.slice(l,l+s.count))y(c,i,{inserted:n});l+=s.count}else{for(const i of r.slice(l,l+s.count))y(c,i,{});u+=s.count,l+=s.count}return c}function y(t,e,n){const o={...e.run.styles,...n},r=e.key.startsWith("\0{"),c=t.at(-1);if(!r&&c!==void 0&&c.note===void 0&&c.cite===void 0&&c.field===void 0&&c.text!==""&&c.href===e.run.href&&JSON.stringify(c.styles)===JSON.stringify(o)){c.text+=e.text;return}t.push({...e.run,text:e.text,styles:o})}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{FORMAT_KEYS as a}from"./model.js";function m(d,t){const e=t==="reject"&&d.formatted!==void 0,n=Object.fromEntries(Object.entries(d).filter(([s])=>s!=="inserted"&&s!=="deleted"&&s!=="formatted"&&!(e&&a.includes(s))));return e?{...n,...d.formatted?.was}:n}export function settleRuns(d,t){const e=[];for(const n of d){if(t==="accept"?n.styles.deleted!==void 0:n.styles.inserted!==void 0&&n.styles.deleted===void 0)continue;const o=m(n.styles,t),i=e.at(-1);if(i!==void 0&&i.note===void 0&&i.cite===void 0&&i.field===void 0&&n.note===void 0&&n.cite===void 0&&n.field===void 0&&i.href===n.href&&JSON.stringify(i.styles)===JSON.stringify(o)){i.text+=n.text;continue}e.push({...n,styles:o})}return e}export function settleBlocks(d,t,e){const n=[];let s;for(const o of d){const i=e===void 0||e(o),c=i?p([o],t):[o],f=i&&y(o,t);for(const u of c){let r=u;if(s!==void 0){if("content"in r&&Array.isArray(r.content)){const l="content"in s?s.content:[];r={...r,content:settleRuns([...l,...r.content],t)}}else n.push(s);s=void 0}f&&"content"in r?s=r:n.push(r)}}return s!==void 0&&n.push(s),n}const y=(d,t)=>d.mark?.kind===(t==="accept"?"deleted":"inserted");function p(d,t){return d.flatMap(e=>{if(e.revision?.kind===(t==="accept"?"deleted":"inserted"))return[];const n={...e};delete n.revision,delete n.mark,delete n.formatted,t==="reject"&&e.formatted!==void 0&&(Object.keys(e.formatted.was).length>0?n.look=e.formatted.was:delete n.look),"content"in e&&Array.isArray(e.content)&&(n.content=settleRuns(e.content,t));const s="children"in e?e.children??[]:[];return s.length>0&&(n.children=settleBlocks(s,t)),e.type==="table"&&(n.rows=e.rows.map(o=>o.map(i=>settleRuns(i,t)))),e.type==="columns"&&(n.columns=e.columns.map(o=>({...o,blocks:settleBlocks(o.blocks,t)}))),[n]})}export function hasRevisions(d){const t=e=>e.some(n=>n.styles.inserted!==void 0||n.styles.deleted!==void 0||n.styles.formatted!==void 0);return d.some(e=>e.revision!==void 0||e.mark!==void 0||e.formatted!==void 0||"content"in e&&Array.isArray(e.content)&&t(e.content)||"children"in e&&hasRevisions(e.children??[])||e.type==="table"&&e.rows.some(n=>n.some(t))||e.type==="columns"&&e.columns.some(n=>hasRevisions(n.blocks)))}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{attrOf as J}from"@allyhub/ooxml";const z=(i,l)=>i?.children.filter(a=>a.key===l)??[],g=(i,l)=>i?.children.find(a=>a.key===l),w=(i,l)=>i===void 0?void 0:J(i,l),x=i=>{if(i===void 0)return;const l=Number(i);return Number.isFinite(l)?l:void 0},D=9525,K={map:i=>i};export function drawShapes(i,l){const f=R(i,"a:graphicData")?.children.find(p=>p.key==="wps:wsp"||p.key==="wpg:wgp");if(f===void 0)return;const u=R(i,"wp:extent"),s=(x(w(u,"cx"))??0)/D,n=(x(w(u,"cy"))??0)/D;if(s<=0&&n<=0)return;const r=[],d=[],$={defs:r,n:0};if(f.key==="wpg:wgp"?Y(f,l,$,d,{map:()=>({x:0,y:0,w:s,h:n})},!0):_(f,l,$,d,K,{x:0,y:0,w:s,h:n}),d.length===0)return;const c=Math.max(1,Math.round(s)),o=Math.max(1,Math.round(n));return{svg:`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${String(c)}" height="${String(o)}" viewBox="0 0 ${String(B(s))} ${String(B(n))}" overflow="visible">${r.length>0?`<defs>${r.join("")}</defs>`:""}${d.join("")}</svg>`,width:c,height:o}}function R(i,l){for(const a of i.children){if(a.key===l)return a;const f=R(a,l);if(f!==void 0)return f}}const B=i=>Math.round(i*100)/100,t=i=>String(B(i));function T(i,l){const a=g(i,"a:off"),f=g(i,"a:ext");if(!(a===void 0||f===void 0))return l.map({x:x(w(a,"x"))??0,y:x(w(a,"y"))??0,w:x(w(f,"cx"))??0,h:x(w(f,"cy"))??0})}function Z(i,l){const a=(x(w(i,"rot"))??0)/6e4,f=w(i,"flipH")==="1",u=w(i,"flipV")==="1";if(a===0&&!f&&!u)return"";const s=l.x+l.w/2,n=l.y+l.h/2,r=[`translate(${t(s)} ${t(n)})`];return a!==0&&r.push(`rotate(${t(a)})`),(f||u)&&r.push(`scale(${f?"-1":"1"} ${u?"-1":"1"})`),r.push(`translate(${t(-s)} ${t(-n)})`),` transform="${r.join(" ")}"`}function Y(i,l,a,f,u,s=!1){const n=g(g(i,"wpg:grpSpPr")??g(i,"a:grpSpPr"),"a:xfrm"),r=g(n,"a:off"),d=g(n,"a:ext"),$=g(n,"a:chOff"),c=g(n,"a:chExt"),o=s?u.map({x:0,y:0,w:0,h:0}):T(n,u);if(o===void 0)return;const h=x(w($,"x"))??x(w(r,"x"))??0,p=x(w($,"y"))??x(w(r,"y"))??0,e=x(w(c,"cx"))??x(w(d,"cx"))??1,m=x(w(c,"cy"))??x(w(d,"cy"))??1,F=e===0?0:o.w/e,M=m===0?0:o.h/m,A={map:y=>({x:o.x+(y.x-h)*F,y:o.y+(y.y-p)*M,w:y.w*F,h:y.h*M})},C=[];for(const y of i.children)y.key==="wps:wsp"||y.key==="a:sp"||y.key==="wpg:cxnSp"?_(y,l,a,C,A):y.key==="wpg:grpSp"||y.key==="wpg:wgp"?Y(y,l,a,C,A):y.key==="pic:pic"||y.key==="wpg:pic"?tt(y,l,C,A):y.key==="wpg:graphicFrame"&&l.lose("a chart or table in a group of shapes, left out of its picture");f.push(`<g${s?"":Z(n,o)}>${C.join("")}</g>`)}function tt(i,l,a,f){const u=g(i,"pic:spPr"),s=g(u,"a:xfrm"),n=T(s,f),r=R(i,"a:blip"),d=w(r,"r:embed");if(n===void 0||d===void 0)return;const $=l.picture(d);if($===void 0){l.lose("a picture in a group of shapes it cannot show");return}a.push(`<image x="${t(n.x)}" y="${t(n.y)}" width="${t(n.w)}" height="${t(n.h)}" preserveAspectRatio="none" xlink:href="data:${$.type};base64,${$t($.bytes)}"${Z(s,n)}/>`)}function _(i,l,a,f,u,s){const n=g(i,"wps:spPr")??g(i,"a:spPr"),r=g(n,"a:xfrm"),d=s??T(r,u);if(d===void 0)return;const $=g(i,"wps:style")??g(i,"a:style"),c=ot(n,$,l,a),o=at(n,$,l,a),h=ct(n,d,l),p=Z(r,d);if(h!==void 0){const m=h.open===!0;f.push(`<path d="${h.d}" fill="${m?"none":c}"${o}${p}/>`)}const e=g(g(i,"wps:txbx"),"w:txbxContent");e!==void 0&&f.push(ft(e,g(i,"wps:bodyPr"),d,$,l,p))}const nt={black:"000000",white:"FFFFFF",red:"FF0000",green:"008000",blue:"0000FF",yellow:"FFFF00",gray:"808080",grey:"808080",orange:"FFA500",purple:"800080",darkBlue:"00008B",darkRed:"8B0000",darkGreen:"006400",lightGray:"D3D3D3"};function P(i,l,a){const f=i?.children.find(o=>["a:srgbClr","a:schemeClr","a:sysClr","a:prstClr","a:scrgbClr"].includes(o.key));if(f===void 0)return;let u;const s=w(f,"val");if(f.key==="a:srgbClr")u=s;else if(f.key==="a:sysClr")u=w(f,"lastClr")??(s==="window"?"FFFFFF":"000000");else if(f.key==="a:prstClr")u=s===void 0?void 0:nt[s];else if(f.key==="a:scrgbClr"){const o=h=>Math.round((x(w(f,h))??0)/1e5*255);u=[o("r"),o("g"),o("b")].map(h=>h.toString(16).padStart(2,"0")).join("")}else if(s==="phClr")u=a;else{const o=s==="tx1"?"dk1":s==="bg1"?"lt1":s==="tx2"?"dk2":s==="bg2"?"lt2":s;u=o===void 0?void 0:l.scheme(o)}if(u===void 0||!/^[0-9a-fA-F]{6}$/u.test(u))return;let[n,r,d]=[0,2,4].map(o=>parseInt(u.slice(o,o+2),16)),$=1;for(const o of f.children){const h=(x(w(o,"val"))??1e5)/1e5;if(o.key==="a:alpha")$=h;else if(o.key==="a:shade")[n,r,d]=[n*h,r*h,d*h];else if(o.key==="a:tint")[n,r,d]=[n,r,d].map(p=>p+(255-p)*(1-h));else if(o.key==="a:lumMod"||o.key==="a:lumOff"){const[p,e,m]=et(n,r,d),F=o.key==="a:lumMod"?m*h:Math.min(1,m+h);[n,r,d]=st(p,e,F)}}return{hex:`#${[n,r,d].map(o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")).join("").toUpperCase()}`,alpha:$}}function et(i,l,a){const[f,u,s]=[i/255,l/255,a/255],n=Math.max(f,u,s),r=Math.min(f,u,s),d=(n+r)/2;if(n===r)return[0,0,d];const $=n-r,c=d>.5?$/(2-n-r):$/(n+r);return[(n===f?(u-s)/$+(u<s?6:0):n===u?(s-f)/$+2:(f-u)/$+4)/6,c,d]}function st(i,l,a){if(l===0)return[a*255,a*255,a*255];const f=a<.5?a*(1+l):a+l-a*l,u=2*a-f,s=n=>{let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?u+(f-u)*6*r:r<1/2?f:r<2/3?u+(f-u)*(2/3-r)*6:u};return[s(i+1/3)*255,s(i)*255,s(i-1/3)*255]}const j=(i,l)=>i.alpha<1?`${i.hex}" ${l}-opacity="${t(i.alpha)}`:i.hex;function ot(i,l,a,f){const u=i?.children.find(r=>["a:noFill","a:solidFill","a:gradFill","a:pattFill","a:blipFill","a:grpFill"].includes(r.key)),s=g(l,"a:fillRef"),n=P(s,a);if(u===void 0)return(x(w(s,"idx"))??0)>0&&n!==void 0?j(n,"fill"):"none";if(u.key==="a:noFill")return"none";if(u.key==="a:solidFill"){const r=P(u,a,n?.hex.slice(1));return r===void 0?"none":j(r,"fill")}if(u.key==="a:pattFill"){const r=P(g(u,"a:fgClr"),a);return a.lose("a shape's pattern fill, drawn in its foreground colour"),r===void 0?"none":j(r,"fill")}if(u.key==="a:gradFill"){const r=z(g(u,"a:gsLst"),"a:gs").map(m=>({at:(x(w(m,"pos"))??0)/1e3,c:P(m,a,n?.hex.slice(1))})).filter(m=>m.c!==void 0);if(r.length===0)return"none";const d=`g${String(++f.n)}`,c=(x(w(g(u,"a:lin"),"ang"))??0)/6e4*Math.PI/180,[o,h,p,e]=[.5-Math.cos(c)/2,.5-Math.sin(c)/2,.5+Math.cos(c)/2,.5+Math.sin(c)/2];return g(u,"a:path")!==void 0&&a.lose("a shape's radial gradient, drawn as a straight one"),f.defs.push(`<linearGradient id="${d}" x1="${t(o)}" y1="${t(h)}" x2="${t(p)}" y2="${t(e)}">${r.map(m=>`<stop offset="${t(m.at)}%" stop-color="${m.c.hex}"${m.c.alpha<1?` stop-opacity="${t(m.c.alpha)}"`:""}/>`).join("")}</linearGradient>`),`url(#${d})`}return a.lose("a shape filled with a picture or its group's fill, left unfilled"),"none"}const rt={dash:[4,3],sysDash:[3,1],dot:[1,1],sysDot:[1,1],dashDot:[4,3,1,3],lgDash:[8,3],lgDashDot:[8,3,1,3],sysDashDot:[3,1,1,1]};function at(i,l,a,f){const u=g(i,"a:ln"),s=g(l,"a:lnRef"),n=x(w(s,"idx"))??0;if(g(u,"a:noFill")!==void 0)return' stroke="none"';const r=P(g(u,"a:solidFill"),a,P(s,a)?.hex.slice(1))??(n>0?P(s,a):void 0);if(r===void 0)return' stroke="none"';const d=x(w(u,"w"))??[6350,12700,19050][n-1]??9525,$=Math.max(.5,d/D),c=w(g(u,"a:prstDash"),"val"),o=c===void 0?void 0:rt[c],h=p=>{const e=w(g(u,p),"type");if(e===void 0||e==="none")return"";const m=`m${String(++f.n)}`;return f.defs.push(`<marker id="${m}" viewBox="0 0 10 10" refX="${e==="oval"?"5":"9"}" refY="5" markerWidth="4" markerHeight="4" orient="auto-start-reverse">${e==="oval"?`<circle cx="5" cy="5" r="4" fill="${r.hex}"/>`:e==="arrow"?`<path d="M1 1 L9 5 L1 9" fill="none" stroke="${r.hex}" stroke-width="1.5"/>`:`<path d="M0 0 L10 5 L0 10 z" fill="${r.hex}"/>`}</marker>`),` marker-${p==="a:headEnd"?"start":"end"}="url(#${m})"`};return` stroke="${j(r,"stroke")}" stroke-width="${t($)}"${o===void 0?"":` stroke-dasharray="${o.map(p=>t(p*$)).join(" ")}"`}${h("a:headEnd")}${h("a:tailEnd")}`}const k=i=>`M${i.map(([l,a])=>`${t(l)} ${t(a)}`).join(" L")} Z`;function ct(i,l,a){const f=g(i,"a:custGeom");if(f!==void 0)return ut(f,l);const u=w(g(i,"a:prstGeom"),"prst")??"rect",{x:s,y:n,w:r,h:d}=l,$=Math.min(r,d),c=s+r,o=n+d,h=s+r/2,p=n+d/2;switch(u){case"rect":case"flowChartProcess":case"flowChartPredefinedProcess":case"flowChartInternalStorage":case"frame":return{d:k([[s,n],[c,n],[c,o],[s,o]])};case"roundRect":case"flowChartAlternateProcess":{const e=$*.16667;return{d:`M${t(s+e)} ${t(n)} H${t(c-e)} A${t(e)} ${t(e)} 0 0 1 ${t(c)} ${t(n+e)} V${t(o-e)} A${t(e)} ${t(e)} 0 0 1 ${t(c-e)} ${t(o)} H${t(s+e)} A${t(e)} ${t(e)} 0 0 1 ${t(s)} ${t(o-e)} V${t(n+e)} A${t(e)} ${t(e)} 0 0 1 ${t(s+e)} ${t(n)} Z`}}case"flowChartTerminator":{const e=d/2;return{d:`M${t(s+e)} ${t(n)} H${t(c-e)} A${t(e)} ${t(e)} 0 0 1 ${t(c-e)} ${t(o)} H${t(s+e)} A${t(e)} ${t(e)} 0 0 1 ${t(s+e)} ${t(n)} Z`}}case"ellipse":case"flowChartConnector":case"donut":return{d:`M${t(s)} ${t(p)} A${t(r/2)} ${t(d/2)} 0 1 0 ${t(c)} ${t(p)} A${t(r/2)} ${t(d/2)} 0 1 0 ${t(s)} ${t(p)} Z`};case"line":case"straightConnector1":case"bentConnector2":case"bentConnector3":case"curvedConnector3":return u==="bentConnector3"?{d:`M${t(s)} ${t(n)} H${t(h)} V${t(o)} H${t(c)}`,open:!0}:u==="bentConnector2"?{d:`M${t(s)} ${t(n)} H${t(c)} V${t(o)}`,open:!0}:u==="curvedConnector3"?{d:`M${t(s)} ${t(n)} C${t(h)} ${t(n)} ${t(h)} ${t(o)} ${t(c)} ${t(o)}`,open:!0}:{d:`M${t(s)} ${t(n)} L${t(c)} ${t(o)}`,open:!0};case"triangle":case"flowChartExtract":return{d:k([[h,n],[c,o],[s,o]])};case"flowChartMerge":return{d:k([[s,n],[c,n],[h,o]])};case"rtTriangle":return{d:k([[s,n],[c,o],[s,o]])};case"diamond":case"flowChartDecision":return{d:k([[h,n],[c,p],[h,o],[s,p]])};case"parallelogram":case"flowChartInputOutput":{const e=u==="parallelogram"?$*.25:r*.2;return{d:k([[s+e,n],[c,n],[c-e,o],[s,o]])}}case"trapezoid":{const e=$*.25;return{d:k([[s+e,n],[c-e,n],[c,o],[s,o]])}}case"flowChartManualOperation":{const e=r*.2;return{d:k([[s,n],[c,n],[c-e,o],[s+e,o]])}}case"pentagon":case"homePlate":{const e=$*.5;return{d:k([[s,n],[c-e,n],[c,p],[c-e,o],[s,o]])}}case"chevron":{const e=$*.5;return{d:k([[s,n],[c-e,n],[c,p],[c-e,o],[s,o],[s+e,p]])}}case"hexagon":case"flowChartPreparation":{const e=u==="hexagon"?$*.25:r*.2;return{d:k([[s+e,n],[c-e,n],[c,p],[c-e,o],[s+e,o],[s,p]])}}case"octagon":{const e=$*.29289;return{d:k([[s+e,n],[c-e,n],[c,n+e],[c,o-e],[c-e,o],[s+e,o],[s,o-e],[s,n+e]])}}case"plus":case"mathPlus":{const e=$*.25;return{d:k([[s+e,n],[c-e,n],[c-e,n+e],[c,n+e],[c,o-e],[c-e,o-e],[c-e,o],[s+e,o],[s+e,o-e],[s,o-e],[s,n+e],[s+e,n+e]])}}case"rightArrow":case"leftArrow":case"upArrow":case"downArrow":case"leftRightArrow":return{d:it(u,l)};case"star5":case"star4":case"star6":case"star8":{const e=Number(u.slice(4)),m=e===4?.375:e===5?.382:e===6?.577:.75,F=[];for(let M=0;M<e*2;M++){const A=-Math.PI/2+M*Math.PI/e,C=M%2===0?1:m;F.push([h+Math.cos(A)*r*C/2,p+Math.sin(A)*d*C/2])}return{d:k(F)}}case"flowChartDocument":return{d:`M${t(s)} ${t(n)} H${t(c)} V${t(o-d*.15)} C${t(s+r*.75)} ${t(o-d*.35)} ${t(s+r*.25)} ${t(o+d*.05)} ${t(s)} ${t(o-d*.1)} Z`};case"wedgeRectCallout":case"wedgeRoundRectCallout":{const e=s+r*.29,m=o+d*.56;return{d:k([[s,n],[c,n],[c,o],[s+r*.58,o],[e,m],[s+r*.33,o],[s,o]])}}case"wedgeEllipseCallout":return{d:`M${t(s+r*.3)} ${t(o-d*.05)} L${t(s+r*.29)} ${t(o+d*.56)} L${t(s+r*.45)} ${t(o)} A${t(r/2)} ${t(d/2)} 0 1 0 ${t(s+r*.3)} ${t(o-d*.05)} Z`};case"can":case"flowChartMagneticDisk":{const e=d*.1;return{d:`M${t(s)} ${t(n+e)} A${t(r/2)} ${t(e)} 0 0 1 ${t(c)} ${t(n+e)} V${t(o-e)} A${t(r/2)} ${t(e)} 0 0 1 ${t(s)} ${t(o-e)} Z M${t(s)} ${t(n+e)} A${t(r/2)} ${t(e)} 0 0 0 ${t(c)} ${t(n+e)}`}}case"cube":{const e=$*.25;return{d:`${k([[s,n+e],[c-e,n+e],[c-e,o],[s,o]])} ${k([[s,n+e],[s+e,n],[c,n],[c-e,n+e]])} ${k([[c-e,n+e],[c,n],[c,o-e],[c-e,o]])}`}}case"heart":return{d:`M${t(h)} ${t(n+d*.25)} C${t(h)} ${t(n-d*.08)} ${t(s-r*.15)} ${t(n+d*.05)} ${t(s+r*.05)} ${t(n+d*.45)} L${t(h)} ${t(o)} L${t(c-r*.05)} ${t(n+d*.45)} C${t(c+r*.15)} ${t(n+d*.05)} ${t(h)} ${t(n-d*.08)} ${t(h)} ${t(n+d*.25)} Z`};default:return a.lose(`a shape of a kind drawn as its box (${u})`),{d:k([[s,n],[c,n],[c,o],[s,o]])}}}function it(i,l){const{x:a,y:f,w:u,h:s}=l,n=a+u,r=f+s;if(i==="rightArrow"||i==="leftArrow"||i==="leftRightArrow"){const h=Math.min(u/(i==="leftRightArrow"?2:1),s*.5),p=f+s*.25,e=f+s*.75,m=f+s/2;return k(i==="rightArrow"?[[a,p],[n-h,p],[n-h,f],[n,m],[n-h,r],[n-h,e],[a,e]]:i==="leftArrow"?[[n,p],[a+h,p],[a+h,f],[a,m],[a+h,r],[a+h,e],[n,e]]:[[a,m],[a+h,f],[a+h,p],[n-h,p],[n-h,f],[n,m],[n-h,r],[n-h,e],[a+h,e],[a+h,r]])}const d=Math.min(s,u*.5),$=a+u*.25,c=a+u*.75,o=a+u/2;return k(i==="upArrow"?[[$,r],[$,f+d],[a,f+d],[o,f],[n,f+d],[c,f+d],[c,r]]:[[$,f],[$,r-d],[a,r-d],[o,r],[n,r-d],[c,r-d],[c,f]])}function ut(i,l){const a=[];let f=!0;for(const u of z(g(i,"a:pathLst"),"a:path")){const s=x(w(u,"w"))??l.w,n=x(w(u,"h"))??l.h,r=s===0?1:l.w/s,d=n===0?1:l.h/n,$=o=>[l.x+(x(w(o,"x"))??0)*r,l.y+(x(w(o,"y"))??0)*d];let c=[l.x,l.y];for(const o of u.children){const h=z(o,"a:pt");if(o.key==="a:moveTo")c=$(h[0]),a.push(`M${t(c[0])} ${t(c[1])}`);else if(o.key==="a:lnTo")c=$(h[0]),a.push(`L${t(c[0])} ${t(c[1])}`);else if(o.key==="a:cubicBezTo"&&h.length===3){const[p,e,m]=h.map($);c=m,a.push(`C${[p,e,m].map(([F,M])=>`${t(F)} ${t(M)}`).join(" ")}`)}else if(o.key==="a:quadBezTo"&&h.length===2){const[p,e]=h.map($);c=e,a.push(`Q${t(p[0])} ${t(p[1])} ${t(e[0])} ${t(e[1])}`)}else if(o.key==="a:arcTo"){const p=(x(w(o,"wR"))??0)*r,e=(x(w(o,"hR"))??0)*d,m=(x(w(o,"stAng"))??0)/6e4*(Math.PI/180),F=(x(w(o,"swAng"))??0)/6e4*(Math.PI/180),M=c[0]-p*Math.cos(m),A=c[1]-e*Math.sin(m),C=[M+p*Math.cos(m+F),A+e*Math.sin(m+F)];a.push(`A${t(p)} ${t(e)} 0 ${Math.abs(F)>Math.PI?"1":"0"} ${F>0?"1":"0"} ${t(C[0])} ${t(C[1])}`),c=C}else o.key==="a:close"&&(a.push("Z"),f=!1)}}return a.length===0?void 0:{d:a.join(" "),open:f}}function ft(i,l,a,f,u,s){const n=(y,b)=>(x(w(l,y))??b)/D,r=n("lIns",91440),d=n("rIns",91440),$=n("tIns",45720),c=n("bIns",45720),o=Math.max(1,a.w-r-d),h=P(g(f,"a:fontRef"),u)?.hex,p=[];for(const y of V(i,"w:p")){const b=g(y,"w:pPr"),S=w(g(b,"w:jc"),"w:val"),L=S==="center"?"middle":S==="right"||S==="end"?"end":"start",G=V(y,"w:r"),O=g(G[0],"w:rPr")??g(b,"w:rPr"),N=x(w(g(O,"w:sz"),"w:val")),q=N===void 0?u.textSize:N/2,X=E=>{const v=g(O,E),U=w(v,"w:val");return v!==void 0&&U!=="0"&&U!=="false"},H=w(g(O,"w:color"),"w:val"),Q=G.flatMap(E=>E.children.map(v=>v.key==="w:t"?v.text:v.key==="w:tab"?" ":v.key==="w:br"?`
|
|
3
|
+
`:"")).join(""),W=q*4/3;for(const E of Q.split(`
|
|
4
|
+
`))for(const v of dt(E,o,W))p.push({text:v,size:q,bold:X("w:b"),italic:X("w:i"),...H!==void 0&&/^[0-9A-Fa-f]{6}$/u.test(H)?{color:`#${H}`}:h===void 0?{}:{color:h},align:L})}if(p.every(y=>y.text.trim()===""))return"";const e=p.map(y=>y.size*4/3*1.2),m=e.reduce((y,b)=>y+b,0),F=w(l,"anchor"),M=a.h-$-c-m;let A=a.y+$+(F==="ctr"?M/2:F==="b"?M:0);const C=[];return p.forEach((y,b)=>{const S=e[b]??0,L=y.align==="middle"?a.x+r+o/2:y.align==="end"?a.x+a.w-d:a.x+r;A+=S,y.text!==""&&C.push(`<text x="${t(L)}" y="${t(A-S*.25)}" font-size="${t(y.size*4/3)}" text-anchor="${y.align}"${y.bold?' font-weight="bold"':""}${y.italic?' font-style="italic"':""} fill="${y.color??"#000000"}">${ht(y.text)}</text>`)}),`<g font-family="Calibri, Carlito, 'Noto Sans SC', sans-serif"${s}>${C.join("")}</g>`}function V(i,l){const a=[];for(const f of i.children)f.key===l?a.push(f):a.push(...V(f,l));return a}const lt=i=>/[\u2E80-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u.test(i)?1:.52;function dt(i,l,a){if(i==="")return[""];const f=[];let u="",s=0;const n=i.match(/[\u2E80-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]|\s+|[^\s\u2E80-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]+/gu)??[];for(const r of n){let d=0;for(const c of r)d+=lt(c);const $=d*a;s+$>l&&u.trim()!==""?(f.push(u.trimEnd()),u=/^\s+$/u.test(r)?"":r,s=/^\s+$/u.test(r)?0:$):(u+=r,s+=$)}return u!==""&&f.push(u.trimEnd()),f}const ht=i=>i.replace(/[&<>"]/gu,l=>l==="&"?"&":l==="<"?"<":l===">"?">":"""),I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function $t(i){let l="";for(let a=0;a<i.length;a+=3){const f=i[a]??0,u=i[a+1],s=i[a+2],n=f<<16|(u??0)<<8|(s??0);l+=(I[n>>18&63]??"")+(I[n>>12&63]??"")+(u===void 0?"=":I[n>>6&63]??"")+(s===void 0?"=":I[n&63]??"")}return l}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{readNumbering as x}from"./numbering.js";import{CHINESE_SIZES as S}from"./page.js";export const NORMAL="Normal",TITLE_STYLE="Title",QUOTE_STYLE="Quote",LIST_PARAGRAPH="List Paragraph",CAPTION_STYLE="Caption",headingStyle=e=>`Heading ${String(e)}`;const $=new Map([1,2,3,4,5,6].map(e=>[headingStyle(e),e]));export const BUILT_IN_STYLES=[NORMAL,TITLE_STYLE,QUOTE_STYLE,LIST_PARAGRAPH,CAPTION_STYLE,...[1,2,3,4,5,6].map(headingStyle)],TABLE_GRID="Table Grid";const p={[TABLE_GRID]:{borders:"all",borderColor:"#000000",headBold:!1}};export const TABLE_KEYS={borders:"borders",borderColor:"border-color",headBg:"head-bg",headColor:"head-color",headBold:"head-bold",banded:"banded"};const h=["all","rows","outside","none"];export const isTableStyle=(e,t)=>e?.[t]?.type==="table"||e?.[t]===void 0&&Object.hasOwn(p,t);export function resolveTableStyle(e,t){const n={};for(const i of l(e??{},t).names.reverse()){const f=e?.[i];if(Object.assign(n,p[i]??{}),f!==void 0)for(const s of Object.keys(TABLE_KEYS))f[s]!==void 0&&Object.assign(n,{[s]:f[s]})}return n}export const RUN_KEYS={font:"font",size:"size",bold:"bold",italic:"italic",underline:"underline",strike:"strike",color:"color",background:"bg",caps:"caps",smallCaps:"small-caps",letterSpacing:"letter-spacing"},PARAGRAPH_KEYS={align:"align",indent:"indent",indentRight:"indent-right",firstLine:"first-line",spaceBefore:"space-before",spaceAfter:"space-after",lineHeight:"line-height",keepNext:"keep-next",keepLines:"keep-lines",pageBreakBefore:"page-break-before"};const d={type:"type",basedOn:"based-on",next:"next",numbering:"numbering"},k=new Set(["bold","italic","underline","strike","caps","smallCaps"]),N=new Set(["keepNext","keepLines","pageBreakBefore"]),y=["left","center","right","justify"],O=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);export function readFontSize(e){if(typeof e=="number"&&e>0&&e<=1638)return e;if(typeof e=="string"){const t=e.trim();if(Object.hasOwn(S,t))return t;const n=/^(\d+(?:\.\d+)?)\s*(?:pt)?$/u.exec(t);if(n)return readFontSize(Number(n[1]))}}export function readLineHeight(e){if(typeof e=="number"&&e>0)return e;if(typeof e=="string"){const t=e.trim();if(/^\d+(\.\d+)?pt$/u.test(t))return t;if(/^\d+(\.\d+)?$/u.test(t)&&Number(t)>0)return Number(t)}}function b(e){if(typeof e=="boolean")return e;if(e===""||e==="true")return!0;if(e==="false")return!1}function m(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&/^-?\d+(\.\d+)?$/u.test(e.trim()))return Number(e.trim())}function A(e){if(typeof e!="string")return;const t=e.trim();if(!(t===""||/[;{}<>"]/u.test(t)))return t}function j(e,t,n,i,f){const s=Object.keys(RUN_KEYS).find(r=>RUN_KEYS[r]===t),o=Object.keys(PARAGRAPH_KEYS).find(r=>PARAGRAPH_KEYS[r]===t),c=r=>(f(`${i}'s ${t} is ${r}, not ${JSON.stringify(n)}`),!0),a=Object.keys(TABLE_KEYS).find(r=>TABLE_KEYS[r]===t);if(a!==void 0){if(a==="borders"){if(!h.includes(n))return c(h.join(", "));e.borders=n}else if(a==="headBold"){const r=b(n);if(r===void 0)return c("true or false");e.headBold=r}else{if(typeof n!="string"||n.trim()==="")return c("a colour");e[a]=n.trim()}return!0}if(s!==void 0){if(k.has(s)){const r=b(n);if(r===void 0)return c("true or false");e[s]=r}else if(s==="font"){const r=A(n);if(r===void 0)return c("a face's name");e.font=r}else if(s==="size"){const r=readFontSize(n);if(r===void 0)return c("pt or a Chinese size (小四)");e.size=r}else if(s==="letterSpacing"){const r=m(n);if(r===void 0)return c("pt");e.letterSpacing=r}else if(s==="color"||s==="background"){if(typeof n!="string"||n.trim()==="")return c("a colour");e[s]=n.trim()}return!0}if(o!==void 0){if(N.has(o)){const r=b(n);if(r===void 0)return c("true or false");e[o]=r}else if(o==="align"){if(!y.includes(n))return c(y.join(", "));e.align=n}else if(o==="lineHeight"){const r=readLineHeight(n);if(r===void 0)return c("a multiple (1.5) or pt (28pt)");e.lineHeight=r}else{const r=m(n);if(r===void 0||(o==="spaceBefore"||o==="spaceAfter")&&r<0)return c(o==="spaceBefore"||o==="spaceAfter"?"pt":"characters");e[o]=r}return!0}return!1}export function propsOf(e,t,n,i){const f={},s=new Set([...t==="paragraph"?[]:Object.values(RUN_KEYS),...t==="run"?[]:Object.values(PARAGRAPH_KEYS)]);for(const[o,c]of e)s.has(o)&&j(f,o,c,n,i);return f}export const propKeys=e=>[...e==="paragraph"?[]:Object.values(RUN_KEYS),...e==="run"?[]:Object.values(PARAGRAPH_KEYS)];export function readStyles(e,t){if(!O(e))return t(`a page's styles are by name: { Normal: { font, size }, "Heading 1": { … }, Abstract: { based-on: Normal, italic: true } }`),{};const n={};for(const[i,f]of Object.entries(e)){const s=`the style ${i}`;if(i.trim()===""||/[<>{}]/u.test(i)){t(`a style's name is words, not ${JSON.stringify(i)}`);continue}if(!O(f)){t(`${s} is its properties: { font, size, bold, indent, … }`);continue}const o={};for(const[a,r]of Object.entries(f))if(a===d.type)r==="paragraph"||r==="character"||r==="table"?o.type=r:t(`${s}'s type is paragraph, character or table, not ${JSON.stringify(r)}`);else if(a===d.numbering){const u=$.get(i);if(u===void 0)t(`${s} has no numbering: a Heading style's (Heading 1 to Heading 6) numbers its headings`);else if(typeof r!="string")t(`${s}'s numbering is words with a count, "{1}.{2}"`);else{const g=x(r,u);g.problem!==void 0?t(g.problem):o.numbering=r}}else a===d.basedOn||a===d.next?typeof r=="string"&&r.trim()!==""?o[a===d.next?"next":"basedOn"]=r.trim():t(`${s}'s ${a} is a style's name`):j(o,a,r,s,t)||t(`${s} has no ${a}: a style holds type, based-on, next, numbering, ${[...Object.values(RUN_KEYS),...Object.values(PARAGRAPH_KEYS)].join(", ")}, and a table's ${Object.values(TABLE_KEYS).join(", ")}`);const c=Object.keys(TABLE_KEYS).filter(a=>o[a]!==void 0);if(o.type!=="table"&&c.length>0&&t(`${s} is not a table's: ${c.map(a=>TABLE_KEYS[a]).join(", ")} ${c.length===1?"is":"are"} a table style's (type: table)`),o.type==="table"){const a=[...Object.keys(RUN_KEYS).map(r=>[r,RUN_KEYS[r]]),...Object.keys(PARAGRAPH_KEYS).map(r=>[r,PARAGRAPH_KEYS[r]])].filter(([r])=>o[r]!==void 0);a.length>0&&t(`${s} is a table's: ${a.map(([,r])=>r).join(", ")} ${a.length===1?"is":"are"} a paragraph's or its words'`)}if(o.type==="character"){const a=Object.keys(PARAGRAPH_KEYS).filter(r=>o[r]!==void 0);a.length>0&&t(`${s} is of characters: ${a.map(r=>PARAGRAPH_KEYS[r]).join(", ")} ${a.length===1?"is a paragraph's":"are a paragraph's"}`)}n[i]=o}for(const[i,f]of Object.entries(n)){for(const s of[f.basedOn,f.next]){if(s===void 0)continue;const o=n[s];o===void 0&&!BUILT_IN_STYLES.includes(s)&&!Object.hasOwn(p,s)?t(`the style ${i} names ${s}, which the doc has not`):o!==void 0&&s===f.basedOn&&(o.type??"paragraph")!==(f.type??"paragraph")&&t(`the style ${i} is based on ${s}, a style of ${o.type==="character"?"characters":o.type==="table"?"a table":"a paragraph"}`)}l(n,i).cycle&&t(`the style ${i} is based on itself, through its bases`)}return n}function l(e,t){const n=[];let i=t;for(;i!==void 0;){if(n.includes(i))return{names:n,cycle:!0};n.push(i),i=e[i]?.basedOn}return{names:n,cycle:!1}}export function resolveStyle(e,t){if(e===void 0)return{};const n={};for(const i of l(e,t).names.reverse()){const f=e[i];f!==void 0&&Object.assign(n,pickProps(f,"both"))}return n}export function pickProps(e,t){const n=[...t==="paragraph"?[]:Object.keys(RUN_KEYS),...t==="run"?[]:Object.keys(PARAGRAPH_KEYS)],i={};for(const f of n)e[f]!==void 0&&(i[f]=e[f]);return i}export const styleKnown=(e,t)=>BUILT_IN_STYLES.includes(t)||e!==void 0&&Object.hasOwn(e,t),isCharacterStyle=(e,t)=>e?.[t]?.type==="character";export function renameStyle(e,t,n){return Object.fromEntries(Object.entries(e).map(([i,f])=>{const s={...f};return s.basedOn===t&&(s.basedOn=n),s.next===t&&(s.next=n),[i===t?n:i,s]}))}export function styleId(e){const t=e.normalize("NFKC").replace(/[^\p{L}\p{N}]+/gu,"").slice(0,60);return t===""?"Style":t}export function writtenStyle(e){const t={};e.type!==void 0&&(t[d.type]=e.type),e.basedOn!==void 0&&(t[d.basedOn]=e.basedOn),e.next!==void 0&&(t[d.next]=e.next),e.numbering!==void 0&&(t[d.numbering]=e.numbering);for(const n of Object.keys(RUN_KEYS))e[n]!==void 0&&(t[RUN_KEYS[n]]=e[n]);for(const n of Object.keys(PARAGRAPH_KEYS))e[n]!==void 0&&(t[PARAGRAPH_KEYS[n]]=e[n]);for(const n of Object.keys(TABLE_KEYS))e[n]!==void 0&&(t[TABLE_KEYS[n]]=e[n]);return t}export function writtenAttributes(e){const t=[],n=(i,f)=>{f!==void 0&&(f===!0?t.push([i,!0]):t.push([i,String(f)]))};for(const i of Object.keys(RUN_KEYS))n(RUN_KEYS[i],e[i]);for(const i of Object.keys(PARAGRAPH_KEYS))n(PARAGRAPH_KEYS[i],e[i]);return t}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{shownPath as M}from"@allyhub/formats";const
|
|
2
|
+
import{shownPath as M}from"@allyhub/formats";const g=/^[+\-−–]?[$€£¥]?\s?\d[\d,.\s]*\s?(%|×|x|k|K|M|B|bn|pt|pp)?\*?$/u,A=/^([—–-]|n\/a|N\/A|NA)$/u,x=t=>t.map(e=>e.text).join("").trim();export function numberColumns(t){const e=t.head===void 0||t.head==="both",a=t.head==="column"||t.head==="both",d=e?t.rows.slice(1):t.rows,c=Math.max(0,...t.rows.map(r=>r.length)),m=new Set;for(let r=a?1:0;r<c;r++){const u=d.map(i=>x(i[r]??[]));u.some(i=>g.test(i))&&u.every(i=>i===""||g.test(i)||A.test(i))&&m.add(r)}return m}export function emptyHead(t){const e=t.head===void 0||t.head==="both",a=t.rows[0];return e&&a!==void 0&&t.rows.length>1&&a.every(d=>x(d)==="")}const l={min:6,max:36,room:2},$=.55;export const charsAcross=(t,e)=>t/(e*96/72)/$;const R=t=>Math.max(0,...t.split(/\s+/u).map(e=>Array.from(e).length));export function columnShares(t,e){const a=Math.max(0,...t.rows.map(n=>n.length)),d=n=>t.rows.map(s=>x(s[n]??[])),c=n=>Math.max(0,...d(n).map(s=>Array.from(s).length)),m=Array.from({length:a},(n,s)=>Math.min(l.max,Math.max(l.min,c(s)+l.room)));if(e===void 0)return m;const r=m.map((n,s)=>Math.max(0,...d(s).map(R))+e.margins),u=m.map((n,s)=>Math.max(r[s]??0,Math.min(l.max,Math.max(l.min,c(s)))+e.margins)),i=n=>!t.widths?.[n],f=n=>n.reduce((s,p,y)=>s+(i(y)?p:0),0),o=f(r),h=f(u);if(h<=e.across||h===o)return u;if(o>=e.across)return r;const w=(e.across-o)/(h-o);return u.map((n,s)=>{const p=r[s]??n;return p+(n-p)*w})}export function tableRowsOf(t,e){if(t.data===void 0)return{rows:t.rows,problems:[]};if(e.data===void 0)return{rows:[],problems:[],waiting:!0};const a=e.data(M(t.data)),d=Array.isArray(a)?a:e.data(t.data);if(!Array.isArray(d)||d.length===0)return{rows:[],problems:[d===void 0?`${t.data} is not a data file or a sheet's table of the project`:`${t.data} holds no rows`]};const c=d,m=Object.keys(c[0]??{}),r=t.fields??m,u=r.filter(o=>!m.includes(o));if(u.length>0)return{rows:[],problems:[`${t.data} has no column ${u.join(", ")} (it has ${m.join(", ")})`]};const i=o=>{const h=typeof o=="string"||typeof o=="number"||typeof o=="boolean"?String(o):"";return h===""?[]:[{text:h,styles:{}}]};return{rows:[...t.head!=="none"&&t.head!=="column"?[r.map(o=>i(o))]:[],...c.map(o=>r.map(h=>i(o[h])))],problems:[]}}export function withTableData(t,e){return t.map(a=>a.type==="table"&&a.data!==void 0?{...a,rows:tableRowsOf(a,e).rows}:a.type==="columns"?{...a,columns:a.columns.map(d=>({...d,blocks:withTableData(d.blocks,e)}))}:a)}export function laidWidths(t,e,a,d){const c=Math.max(1,...t.rows.map(n=>n.length)),m=Array.from({length:c},(n,s)=>t.widths?.[s]?t.widths[s]??0:void 0),r=m.reduce((n,s)=>n+(s??0),0),u=columnShares(t,{across:charsAcross(Math.max(e-r,0),a),margins:charsAcross(2*d*96/72,a)}),i=m.reduce((n,s,p)=>n+(s===void 0?u[p]??1:0),0)||1,f=Math.max(e-r,0),o=m.map((n,s)=>n??f*(u[s]??1)/i),h=o.reduce((n,s)=>n+s,0)||1,w=Math.min(1,e/h);return o.map(n=>n*w)}
|