daigram 0.0.0-stage → 0.1.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/LICENSE +661 -0
- package/LICENSE-MIT +21 -0
- package/NOTICE +11 -0
- package/README.md +788 -2
- package/assets/fonts/CascadiaCode-Regular.ttf +0 -0
- package/assets/fonts/Excalifont-Regular.ttf +0 -0
- package/assets/fonts/LICENSES.md +63 -0
- package/assets/fonts/LiberationSans-Regular.ttf +0 -0
- package/assets/fonts/Virgil-Regular.ttf +0 -0
- package/dist/ai/config.d.ts +11 -0
- package/dist/ai/config.d.ts.map +1 -0
- package/dist/ai/config.js +59 -0
- package/dist/ai/config.js.map +1 -0
- package/dist/ai/providers/anthropic.d.ts +3 -0
- package/dist/ai/providers/anthropic.d.ts.map +1 -0
- package/dist/ai/providers/anthropic.js +71 -0
- package/dist/ai/providers/anthropic.js.map +1 -0
- package/dist/ai/providers/openai-compatible.d.ts +3 -0
- package/dist/ai/providers/openai-compatible.d.ts.map +1 -0
- package/dist/ai/providers/openai-compatible.js +95 -0
- package/dist/ai/providers/openai-compatible.js.map +1 -0
- package/dist/ai/request-settings.d.ts +9 -0
- package/dist/ai/request-settings.d.ts.map +1 -0
- package/dist/ai/request-settings.js +56 -0
- package/dist/ai/request-settings.js.map +1 -0
- package/dist/ai/routes.d.ts +7 -0
- package/dist/ai/routes.d.ts.map +1 -0
- package/dist/ai/routes.js +192 -0
- package/dist/ai/routes.js.map +1 -0
- package/dist/ai/runner.d.ts +19 -0
- package/dist/ai/runner.d.ts.map +1 -0
- package/dist/ai/runner.js +77 -0
- package/dist/ai/runner.js.map +1 -0
- package/dist/ai/sse.d.ts +4 -0
- package/dist/ai/sse.d.ts.map +1 -0
- package/dist/ai/sse.js +53 -0
- package/dist/ai/sse.js.map +1 -0
- package/dist/ai/system.d.ts +2 -0
- package/dist/ai/system.d.ts.map +1 -0
- package/dist/ai/system.js +17 -0
- package/dist/ai/system.js.map +1 -0
- package/dist/ai/tools.d.ts +10 -0
- package/dist/ai/tools.d.ts.map +1 -0
- package/dist/ai/tools.js +134 -0
- package/dist/ai/tools.js.map +1 -0
- package/dist/ai/types.d.ts +72 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +52 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli/args.d.ts +15 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +78 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands/ai.d.ts +2 -0
- package/dist/cli/commands/ai.d.ts.map +1 -0
- package/dist/cli/commands/ai.js +45 -0
- package/dist/cli/commands/ai.js.map +1 -0
- package/dist/cli/commands/arrange.d.ts +2 -0
- package/dist/cli/commands/arrange.d.ts.map +1 -0
- package/dist/cli/commands/arrange.js +103 -0
- package/dist/cli/commands/arrange.js.map +1 -0
- package/dist/cli/commands/canvases.d.ts +2 -0
- package/dist/cli/commands/canvases.d.ts.map +1 -0
- package/dist/cli/commands/canvases.js +38 -0
- package/dist/cli/commands/canvases.js.map +1 -0
- package/dist/cli/commands/check.d.ts +2 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +15 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/comment.d.ts +2 -0
- package/dist/cli/commands/comment.d.ts.map +1 -0
- package/dist/cli/commands/comment.js +76 -0
- package/dist/cli/commands/comment.js.map +1 -0
- package/dist/cli/commands/elements.d.ts +8 -0
- package/dist/cli/commands/elements.d.ts.map +1 -0
- package/dist/cli/commands/elements.js +285 -0
- package/dist/cli/commands/elements.js.map +1 -0
- package/dist/cli/commands/frame.d.ts +2 -0
- package/dist/cli/commands/frame.d.ts.map +1 -0
- package/dist/cli/commands/frame.js +58 -0
- package/dist/cli/commands/frame.js.map +1 -0
- package/dist/cli/commands/install-skill.d.ts +2 -0
- package/dist/cli/commands/install-skill.d.ts.map +1 -0
- package/dist/cli/commands/install-skill.js +108 -0
- package/dist/cli/commands/install-skill.js.map +1 -0
- package/dist/cli/commands/layout.d.ts +2 -0
- package/dist/cli/commands/layout.d.ts.map +1 -0
- package/dist/cli/commands/layout.js +15 -0
- package/dist/cli/commands/layout.js.map +1 -0
- package/dist/cli/commands/render.d.ts +2 -0
- package/dist/cli/commands/render.d.ts.map +1 -0
- package/dist/cli/commands/render.js +64 -0
- package/dist/cli/commands/render.js.map +1 -0
- package/dist/cli/commands/scene.d.ts +8 -0
- package/dist/cli/commands/scene.d.ts.map +1 -0
- package/dist/cli/commands/scene.js +147 -0
- package/dist/cli/commands/scene.js.map +1 -0
- package/dist/cli/commands/server.d.ts +4 -0
- package/dist/cli/commands/server.d.ts.map +1 -0
- package/dist/cli/commands/server.js +66 -0
- package/dist/cli/commands/server.js.map +1 -0
- package/dist/cli/commands/snapshot.d.ts +2 -0
- package/dist/cli/commands/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/snapshot.js +41 -0
- package/dist/cli/commands/snapshot.js.map +1 -0
- package/dist/cli/image-options.d.ts +43 -0
- package/dist/cli/image-options.d.ts.map +1 -0
- package/dist/cli/image-options.js +71 -0
- package/dist/cli/image-options.js.map +1 -0
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +115 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/util.d.ts +5 -0
- package/dist/cli/util.d.ts.map +1 -0
- package/dist/cli/util.js +35 -0
- package/dist/cli/util.js.map +1 -0
- package/dist/core/arrow-routing.d.ts +31 -0
- package/dist/core/arrow-routing.d.ts.map +1 -0
- package/dist/core/arrow-routing.js +244 -0
- package/dist/core/arrow-routing.js.map +1 -0
- package/dist/core/bulk-ops.d.ts +55 -0
- package/dist/core/bulk-ops.d.ts.map +1 -0
- package/dist/core/bulk-ops.js +181 -0
- package/dist/core/bulk-ops.js.map +1 -0
- package/dist/core/canvas-client.d.ts +110 -0
- package/dist/core/canvas-client.d.ts.map +1 -0
- package/dist/core/canvas-client.js +416 -0
- package/dist/core/canvas-client.js.map +1 -0
- package/dist/core/canvas-id.d.ts +4 -0
- package/dist/core/canvas-id.d.ts.map +1 -0
- package/dist/core/canvas-id.js +5 -0
- package/dist/core/canvas-id.js.map +1 -0
- package/dist/core/canvas-persistence.d.ts +30 -0
- package/dist/core/canvas-persistence.d.ts.map +1 -0
- package/dist/core/canvas-persistence.js +854 -0
- package/dist/core/canvas-persistence.js.map +1 -0
- package/dist/core/canvas-registry.d.ts +36 -0
- package/dist/core/canvas-registry.d.ts.map +1 -0
- package/dist/core/canvas-registry.js +161 -0
- package/dist/core/canvas-registry.js.map +1 -0
- package/dist/core/canvas-routes.d.ts +5 -0
- package/dist/core/canvas-routes.d.ts.map +1 -0
- package/dist/core/canvas-routes.js +29 -0
- package/dist/core/canvas-routes.js.map +1 -0
- package/dist/core/canvas-state.d.ts +14 -0
- package/dist/core/canvas-state.d.ts.map +1 -0
- package/dist/core/canvas-state.js +20 -0
- package/dist/core/canvas-state.js.map +1 -0
- package/dist/core/canvas.d.ts +13 -0
- package/dist/core/canvas.d.ts.map +1 -0
- package/dist/core/canvas.js +4 -0
- package/dist/core/canvas.js.map +1 -0
- package/dist/core/comment-ops.d.ts +3 -0
- package/dist/core/comment-ops.d.ts.map +1 -0
- package/dist/core/comment-ops.js +36 -0
- package/dist/core/comment-ops.js.map +1 -0
- package/dist/core/comments.d.ts +5 -0
- package/dist/core/comments.d.ts.map +1 -0
- package/dist/core/comments.js +137 -0
- package/dist/core/comments.js.map +1 -0
- package/dist/core/compact.d.ts +13 -0
- package/dist/core/compact.d.ts.map +1 -0
- package/dist/core/compact.js +20 -0
- package/dist/core/compact.js.map +1 -0
- package/dist/core/config.d.ts +8 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +18 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/describe.d.ts +3 -0
- package/dist/core/describe.d.ts.map +1 -0
- package/dist/core/describe.js +94 -0
- package/dist/core/describe.js.map +1 -0
- package/dist/core/design-guide.d.ts +2 -0
- package/dist/core/design-guide.d.ts.map +1 -0
- package/dist/core/design-guide.js +115 -0
- package/dist/core/design-guide.js.map +1 -0
- package/dist/core/diagram-layout.d.ts +64 -0
- package/dist/core/diagram-layout.d.ts.map +1 -0
- package/dist/core/diagram-layout.js +238 -0
- package/dist/core/diagram-layout.js.map +1 -0
- package/dist/core/diagram-ops.d.ts +165 -0
- package/dist/core/diagram-ops.d.ts.map +1 -0
- package/dist/core/diagram-ops.js +46 -0
- package/dist/core/diagram-ops.js.map +1 -0
- package/dist/core/entry.d.ts +3 -0
- package/dist/core/entry.d.ts.map +1 -0
- package/dist/core/entry.js +35 -0
- package/dist/core/entry.js.map +1 -0
- package/dist/core/expand-elements.d.ts +9 -0
- package/dist/core/expand-elements.d.ts.map +1 -0
- package/dist/core/expand-elements.js +277 -0
- package/dist/core/expand-elements.js.map +1 -0
- package/dist/core/frame-ops.d.ts +60 -0
- package/dist/core/frame-ops.d.ts.map +1 -0
- package/dist/core/frame-ops.js +90 -0
- package/dist/core/frame-ops.js.map +1 -0
- package/dist/core/frames.d.ts +31 -0
- package/dist/core/frames.d.ts.map +1 -0
- package/dist/core/frames.js +95 -0
- package/dist/core/frames.js.map +1 -0
- package/dist/core/geometry.d.ts +30 -0
- package/dist/core/geometry.d.ts.map +1 -0
- package/dist/core/geometry.js +167 -0
- package/dist/core/geometry.js.map +1 -0
- package/dist/core/layout-check.d.ts +30 -0
- package/dist/core/layout-check.d.ts.map +1 -0
- package/dist/core/layout-check.js +181 -0
- package/dist/core/layout-check.js.map +1 -0
- package/dist/core/local-origin.d.ts +4 -0
- package/dist/core/local-origin.d.ts.map +1 -0
- package/dist/core/local-origin.js +27 -0
- package/dist/core/local-origin.js.map +1 -0
- package/dist/core/mcp-dispatch.d.ts +9 -0
- package/dist/core/mcp-dispatch.d.ts.map +1 -0
- package/dist/core/mcp-dispatch.js +741 -0
- package/dist/core/mcp-dispatch.js.map +1 -0
- package/dist/core/mcp-http.d.ts +3 -0
- package/dist/core/mcp-http.d.ts.map +1 -0
- package/dist/core/mcp-http.js +38 -0
- package/dist/core/mcp-http.js.map +1 -0
- package/dist/core/mcp-server.d.ts +19 -0
- package/dist/core/mcp-server.d.ts.map +1 -0
- package/dist/core/mcp-server.js +57 -0
- package/dist/core/mcp-server.js.map +1 -0
- package/dist/core/mcp-tools.d.ts +3 -0
- package/dist/core/mcp-tools.d.ts.map +1 -0
- package/dist/core/mcp-tools.js +723 -0
- package/dist/core/mcp-tools.js.map +1 -0
- package/dist/core/normalize.d.ts +26 -0
- package/dist/core/normalize.d.ts.map +1 -0
- package/dist/core/normalize.js +134 -0
- package/dist/core/normalize.js.map +1 -0
- package/dist/core/obsidian-md.d.ts +4 -0
- package/dist/core/obsidian-md.d.ts.map +1 -0
- package/dist/core/obsidian-md.js +227 -0
- package/dist/core/obsidian-md.js.map +1 -0
- package/dist/core/pidfile.d.ts +5 -0
- package/dist/core/pidfile.d.ts.map +1 -0
- package/dist/core/pidfile.js +51 -0
- package/dist/core/pidfile.js.map +1 -0
- package/dist/core/png-scene.d.ts +4 -0
- package/dist/core/png-scene.d.ts.map +1 -0
- package/dist/core/png-scene.js +176 -0
- package/dist/core/png-scene.js.map +1 -0
- package/dist/core/render/excalidraw-node/dom.d.ts +29 -0
- package/dist/core/render/excalidraw-node/dom.d.ts.map +1 -0
- package/dist/core/render/excalidraw-node/dom.js +132 -0
- package/dist/core/render/excalidraw-node/dom.js.map +1 -0
- package/dist/core/render/excalidraw-node/index.d.ts +11 -0
- package/dist/core/render/excalidraw-node/index.d.ts.map +1 -0
- package/dist/core/render/excalidraw-node/index.js +77 -0
- package/dist/core/render/excalidraw-node/index.js.map +1 -0
- package/dist/core/render/fonts.d.ts +34 -0
- package/dist/core/render/fonts.d.ts.map +1 -0
- package/dist/core/render/fonts.js +133 -0
- package/dist/core/render/fonts.js.map +1 -0
- package/dist/core/render/index.d.ts +40 -0
- package/dist/core/render/index.d.ts.map +1 -0
- package/dist/core/render/index.js +135 -0
- package/dist/core/render/index.js.map +1 -0
- package/dist/core/render/png-worker.d.ts +2 -0
- package/dist/core/render/png-worker.d.ts.map +1 -0
- package/dist/core/render/png-worker.js +65 -0
- package/dist/core/render/png-worker.js.map +1 -0
- package/dist/core/render/png.d.ts +15 -0
- package/dist/core/render/png.d.ts.map +1 -0
- package/dist/core/render/png.js +128 -0
- package/dist/core/render/png.js.map +1 -0
- package/dist/core/render/text-metrics.d.ts +2 -0
- package/dist/core/render/text-metrics.d.ts.map +1 -0
- package/dist/core/render/text-metrics.js +136 -0
- package/dist/core/render/text-metrics.js.map +1 -0
- package/dist/core/request-canvas.d.ts +9 -0
- package/dist/core/request-canvas.d.ts.map +1 -0
- package/dist/core/request-canvas.js +2 -0
- package/dist/core/request-canvas.js.map +1 -0
- package/dist/core/request-headers.d.ts +5 -0
- package/dist/core/request-headers.d.ts.map +1 -0
- package/dist/core/request-headers.js +80 -0
- package/dist/core/request-headers.js.map +1 -0
- package/dist/core/scene-input.d.ts +2 -0
- package/dist/core/scene-input.d.ts.map +1 -0
- package/dist/core/scene-input.js +11 -0
- package/dist/core/scene-input.js.map +1 -0
- package/dist/core/scene-io.d.ts +16 -0
- package/dist/core/scene-io.d.ts.map +1 -0
- package/dist/core/scene-io.js +95 -0
- package/dist/core/scene-io.js.map +1 -0
- package/dist/core/share-url.d.ts +3 -0
- package/dist/core/share-url.d.ts.map +1 -0
- package/dist/core/share-url.js +77 -0
- package/dist/core/share-url.js.map +1 -0
- package/dist/core/spawn.d.ts +41 -0
- package/dist/core/spawn.d.ts.map +1 -0
- package/dist/core/spawn.js +153 -0
- package/dist/core/spawn.js.map +1 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +14 -0
- package/dist/core/version.js.map +1 -0
- package/dist/frontend/assets/Assistant-Bold-gm-uSS1B.woff2 +0 -0
- package/dist/frontend/assets/Assistant-Medium-DrcxCXg3.woff2 +0 -0
- package/dist/frontend/assets/Assistant-Regular-DVxZuzxb.woff2 +0 -0
- package/dist/frontend/assets/Assistant-SemiBold-SCI4bEL9.woff2 +0 -0
- package/dist/frontend/assets/Tableau10-CvOaoHrI.js +1 -0
- package/dist/frontend/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
- package/dist/frontend/assets/abnfDiagram-VCTEODGH-CO_aNPe5.js +1 -0
- package/dist/frontend/assets/advancedFormat-DE2dNp0u.js +1 -0
- package/dist/frontend/assets/ar-SA-G6X2FPQ2-Bq4yiKbc.js +10 -0
- package/dist/frontend/assets/arc--vhPzIZC.js +1 -0
- package/dist/frontend/assets/architectureDiagram-5GKGNRK7-aHYJQElw.js +36 -0
- package/dist/frontend/assets/array-BKyUJesY.js +1 -0
- package/dist/frontend/assets/az-AZ-76LH7QW2-BB3yat67.js +1 -0
- package/dist/frontend/assets/band-dPffDWoQ.js +1 -0
- package/dist/frontend/assets/bg-BG-XCXSNQG7-DmC2FjQc.js +5 -0
- package/dist/frontend/assets/blockDiagram-68f4deed-Bn83vchM.js +118 -0
- package/dist/frontend/assets/blockDiagram-NRAW4CY4-CxaW-TzC.js +129 -0
- package/dist/frontend/assets/bn-BD-2XOGV67Q-DpCbZMS6.js +5 -0
- package/dist/frontend/assets/c4Diagram-15b5d702-Bq7Ko0Vs.js +10 -0
- package/dist/frontend/assets/c4Diagram-UCG6FXSJ-Dh883fAO.js +38 -0
- package/dist/frontend/assets/ca-ES-6MX7JW3Y-CBOshpbV.js +8 -0
- package/dist/frontend/assets/channel-DYvM7vRx.js +1 -0
- package/dist/frontend/assets/chunk-2Q5K7J3B-DaFhLtFc.js +1 -0
- package/dist/frontend/assets/chunk-5VM5RSS4-CyLfaWw7.js +15 -0
- package/dist/frontend/assets/chunk-F27PBJKO-BHNc-edD.js +1 -0
- package/dist/frontend/assets/chunk-G27WJ6UU-BBKiZxqf.js +231 -0
- package/dist/frontend/assets/chunk-JWPE2WC7-7twsn51D.js +1 -0
- package/dist/frontend/assets/chunk-LCL6LL3I-BTwZuXJ6.js +206 -0
- package/dist/frontend/assets/chunk-POPQ4Y6H-CaHDxqyV.js +1 -0
- package/dist/frontend/assets/chunk-SVP7TREG-B8-zByXy.js +88 -0
- package/dist/frontend/assets/chunk-XXDRQBXY-DQLro-7R.js +1 -0
- package/dist/frontend/assets/classDiagram-DTDB5LWJ-Dpwx6IJK.js +1 -0
- package/dist/frontend/assets/classDiagram-d40c83e7-BPxlcZuc.js +2 -0
- package/dist/frontend/assets/classDiagram-v2-JRS7N3AN-Dpwx6IJK.js +1 -0
- package/dist/frontend/assets/classDiagram-v2-d5a6b087-Cyz34qAK.js +2 -0
- package/dist/frontend/assets/clone-Iw0eB1Cb.js +1 -0
- package/dist/frontend/assets/cose-bilkent-JH36ORCC-C4ZX1Xvi.js +1 -0
- package/dist/frontend/assets/createText-d213de94-CDH1rzxH.js +7 -0
- package/dist/frontend/assets/cs-CZ-2BRQDIVT-CGAN69M4.js +11 -0
- package/dist/frontend/assets/cynefin-OW5HDTMX-B8XT9png.js +178 -0
- package/dist/frontend/assets/cynefinDiagram-5FMLGOSQ-COTZjqlj.js +62 -0
- package/dist/frontend/assets/cytoscape-cose-bilkent-D4yGolDn.js +1 -0
- package/dist/frontend/assets/cytoscape.esm-BjAbmLdb.js +331 -0
- package/dist/frontend/assets/da-DK-5WZEPLOC-FIDoeOAn.js +5 -0
- package/dist/frontend/assets/dagre-3AP2YEHR-v8EtxNwx.js +4 -0
- package/dist/frontend/assets/de-DE-XR44H4JA-Hquyrt1G.js +8 -0
- package/dist/frontend/assets/defaultLocale-C4B-KCzX.js +1 -0
- package/dist/frontend/assets/diagram-S7CK7UJ4-BiwOlZBI.js +30 -0
- package/dist/frontend/assets/diagram-UQ7AKVKN-DIfzNs7s.js +41 -0
- package/dist/frontend/assets/diagram-VSXAHHWV-kKkEHy5z.js +3 -0
- package/dist/frontend/assets/diagram-VX7I27RA-zTp2qGKo.js +24 -0
- package/dist/frontend/assets/diagram-Z3DM3KII-hUxSr-QT.js +24 -0
- package/dist/frontend/assets/directory-open-01563666-DWU9wJ6I.js +1 -0
- package/dist/frontend/assets/directory-open-4ed118d0-CunoC1EB.js +1 -0
- package/dist/frontend/assets/ebnfDiagram-PWID7BFC-CRwXBVzS.js +1 -0
- package/dist/frontend/assets/edges-332bd1c7-CbPhghy3.js +4 -0
- package/dist/frontend/assets/el-GR-BZB4AONW-CWRJJANX.js +10 -0
- package/dist/frontend/assets/erDiagram-880f2ed8-CY1dU-f9.js +51 -0
- package/dist/frontend/assets/erDiagram-SSCWMZ5O-BfDW8Lxf.js +99 -0
- package/dist/frontend/assets/es-ES-U4NZUMDT-BwZWIjT5.js +9 -0
- package/dist/frontend/assets/eu-ES-A7QVB2H4-B9suQ9BE.js +11 -0
- package/dist/frontend/assets/fa-IR-HGAKTJCU-tgrKvE4J.js +8 -0
- package/dist/frontend/assets/fi-FI-Z5N7JZ37-Ddoc7R-q.js +6 -0
- package/dist/frontend/assets/file-open-002ab408-DIuFHtCF.js +1 -0
- package/dist/frontend/assets/file-open-7c801643-684qeFg4.js +1 -0
- package/dist/frontend/assets/file-save-3189631c-C1wFhQhH.js +1 -0
- package/dist/frontend/assets/file-save-745eba88-Bb9F9Kg7.js +1 -0
- package/dist/frontend/assets/flowDb-7c981674-DkYacLUz.js +10 -0
- package/dist/frontend/assets/flowDiagram-A5DVABFB-CCBuG42p.js +168 -0
- package/dist/frontend/assets/flowDiagram-cbd28bf7-DhhBmCsw.js +4 -0
- package/dist/frontend/assets/flowDiagram-v2-ffc7f31a-BICbZ5-w.js +1 -0
- package/dist/frontend/assets/flowchart-elk-definition-36e2d292-BsyTsM2Q.js +139 -0
- package/dist/frontend/assets/fr-FR-RHASNOE6-Bzn_6dcd.js +9 -0
- package/dist/frontend/assets/ganttDiagram-04f9e578-CCKAlfpJ.js +257 -0
- package/dist/frontend/assets/ganttDiagram-EL5Y4UJY-B8CXkutd.js +292 -0
- package/dist/frontend/assets/gitGraphDiagram-21fc4d3e-DBAYEQql.js +70 -0
- package/dist/frontend/assets/gitGraphDiagram-WWUBYQGX-Ge5QWjv2.js +106 -0
- package/dist/frontend/assets/gl-ES-HMX3MZ6V-vcZHbFum.js +10 -0
- package/dist/frontend/assets/graph-87dI2d0Q.js +1 -0
- package/dist/frontend/assets/has-D7z5cd7K.js +1 -0
- package/dist/frontend/assets/he-IL-6SHJWFNN-CK07fY3l.js +10 -0
- package/dist/frontend/assets/hi-IN-IWLTKZ5I-CDZ0p7Jv.js +4 -0
- package/dist/frontend/assets/hu-HU-A5ZG7DT2-FH5SLnWy.js +7 -0
- package/dist/frontend/assets/id-ID-SAP4L64H-MjXIXb2f.js +10 -0
- package/dist/frontend/assets/image-blob-reduce.esm-HwCm7IZ0.js +7 -0
- package/dist/frontend/assets/index-6079d271-DiB2AL6F.js +1 -0
- package/dist/frontend/assets/index-BcAUh2Nm.css +1 -0
- package/dist/frontend/assets/index-Biw8Vgb3.js +320 -0
- package/dist/frontend/assets/index-fTyH8AV3.js +354 -0
- package/dist/frontend/assets/infoDiagram-4a4f5b27-BOdJmCUU.js +7 -0
- package/dist/frontend/assets/infoDiagram-RXCK75RN-CNm06Rxs.js +2 -0
- package/dist/frontend/assets/init-Gi6I4Gst.js +1 -0
- package/dist/frontend/assets/ishikawaDiagram-5VMMS53U-DoLWy3n2.js +70 -0
- package/dist/frontend/assets/it-IT-JPQ66NNP-D3n0iaPa.js +11 -0
- package/dist/frontend/assets/ja-JP-DBVTYXUO-ejSNO7M9.js +8 -0
- package/dist/frontend/assets/journeyDiagram-29694f62-Cm6qVjA9.js +139 -0
- package/dist/frontend/assets/journeyDiagram-EYS64GPL-ByZmvOcj.js +139 -0
- package/dist/frontend/assets/kaa-6HZHGXH3-D8l_gwno.js +1 -0
- package/dist/frontend/assets/kab-KAB-ZGHBKWFO-CCdAUgdW.js +8 -0
- package/dist/frontend/assets/kanban-definition-3QL26DDD-Y5ylzca9.js +89 -0
- package/dist/frontend/assets/katex-C5jXJg4s.js +257 -0
- package/dist/frontend/assets/kk-KZ-P5N5QNE5-DeuZqHeo.js +1 -0
- package/dist/frontend/assets/km-KH-HSX4SM5Z-CiG2k5fk.js +11 -0
- package/dist/frontend/assets/ko-KR-MTYHY66A-KQOGYf_l.js +9 -0
- package/dist/frontend/assets/ku-TR-6OUDTVRD-iPec9Wpx.js +9 -0
- package/dist/frontend/assets/layout-ChryVliD.js +1 -0
- package/dist/frontend/assets/layout-chXYHUIV.js +1 -0
- package/dist/frontend/assets/line-V0o6yOnB.js +1 -0
- package/dist/frontend/assets/linear-BvV3B0Vg.js +1 -0
- package/dist/frontend/assets/lt-LT-XHIRWOB4-CATjC2gQ.js +3 -0
- package/dist/frontend/assets/lv-LV-5QDEKY6T-BsDP-7Dd.js +7 -0
- package/dist/frontend/assets/mindmap-definition-FBJOCRG2-z4KcwRlx.js +96 -0
- package/dist/frontend/assets/mindmap-definition-ac74a2e8-C1QU2vBv.js +95 -0
- package/dist/frontend/assets/mr-IN-CRQNXWMA-DWJhwvxv.js +13 -0
- package/dist/frontend/assets/my-MM-5M5IBNSE-DckXEMN8.js +1 -0
- package/dist/frontend/assets/nb-NO-T6EIAALU-HaOR9ZeX.js +10 -0
- package/dist/frontend/assets/nl-NL-IS3SIHDZ-ef_ywpFu.js +8 -0
- package/dist/frontend/assets/nn-NO-6E72VCQL-Bg7QdVqf.js +8 -0
- package/dist/frontend/assets/oc-FR-POXYY2M6-D5HmBPnC.js +8 -0
- package/dist/frontend/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/frontend/assets/pa-IN-N4M65BXN-BHYM0tZp.js +4 -0
- package/dist/frontend/assets/path-CbwjOpE9.js +1 -0
- package/dist/frontend/assets/pegDiagram-XKGWAZYB-BL0-JiYs.js +1 -0
- package/dist/frontend/assets/pica-CHpl3DYP.js +7 -0
- package/dist/frontend/assets/pie-b97pL0mM.js +1 -0
- package/dist/frontend/assets/pieDiagram-421022e6-DiRybrxD.js +35 -0
- package/dist/frontend/assets/pieDiagram-E7YTZNPT-VybkpWmu.js +39 -0
- package/dist/frontend/assets/pl-PL-T2D74RX3-uZIVDHgu.js +9 -0
- package/dist/frontend/assets/pt-BR-5N22H2LF-dJVfhAeV.js +9 -0
- package/dist/frontend/assets/pt-PT-UZXXM6DQ-DjJzcznP.js +9 -0
- package/dist/frontend/assets/quadrantDiagram-0957ecba-BHJpECv1.js +7 -0
- package/dist/frontend/assets/quadrantDiagram-AXDQQJYC-RAG8nSkZ.js +7 -0
- package/dist/frontend/assets/railroadDiagram-O6MQD6OU-lCMtporN.js +1 -0
- package/dist/frontend/assets/requirementDiagram-23d650b8-mSFTWSrD.js +52 -0
- package/dist/frontend/assets/requirementDiagram-EFPCY7ZU-B8YnTqPO.js +84 -0
- package/dist/frontend/assets/ro-RO-JPDTUUEW-B5X8VOmp.js +11 -0
- package/dist/frontend/assets/roundRect-0PYZxl1G.js +1 -0
- package/dist/frontend/assets/ru-RU-B4JR7IUQ-Czv9kfuz.js +9 -0
- package/dist/frontend/assets/sankeyDiagram-23345273-B3g3P-D1.js +8 -0
- package/dist/frontend/assets/sankeyDiagram-P5KCCOFB-DRm9HHoQ.js +40 -0
- package/dist/frontend/assets/sankeyLinkHorizontal-CgO6js3K.js +1 -0
- package/dist/frontend/assets/sequenceDiagram-17ac3bff-DzZiSttS.js +122 -0
- package/dist/frontend/assets/sequenceDiagram-WJ2MYXX4-BrSDYDx-.js +162 -0
- package/dist/frontend/assets/si-LK-N5RQ5JYF-DFWOZdgD.js +1 -0
- package/dist/frontend/assets/sizeCapture-X5ZJPWSS-CbaN7yeQ.js +1 -0
- package/dist/frontend/assets/sk-SK-C5VTKIMK-B8VlFn2Z.js +6 -0
- package/dist/frontend/assets/sl-SI-NN7IZMDC-CJeSgLEg.js +6 -0
- package/dist/frontend/assets/stateDiagram-9c5f0230-Dzm1fyzw.js +1 -0
- package/dist/frontend/assets/stateDiagram-HBIQ2CUA-B5Nv-PBX.js +1 -0
- package/dist/frontend/assets/stateDiagram-v2-4QOOHH4V-B72hUL6s.js +1 -0
- package/dist/frontend/assets/stateDiagram-v2-51a3dcff-DvLAYBjA.js +1 -0
- package/dist/frontend/assets/styles-2ab5d517-D6473lhT.js +116 -0
- package/dist/frontend/assets/styles-5f03d8d2-CZ5U9u1n.js +160 -0
- package/dist/frontend/assets/styles-edf9a4b0-DzQC88FF.js +207 -0
- package/dist/frontend/assets/subset-shared.chunk.js +84 -0
- package/dist/frontend/assets/subset-worker.chunk.js +1 -0
- package/dist/frontend/assets/sv-SE-XGPEYMSR-BKMKxZWF.js +10 -0
- package/dist/frontend/assets/svgDrawCommon-3ba9043b-CQsuw6x4.js +1 -0
- package/dist/frontend/assets/swimlanes-XN3QIQJK-D6c81JTS.js +1 -0
- package/dist/frontend/assets/swimlanesDiagram-VK2B7HYN-SMIGSMWR.js +8 -0
- package/dist/frontend/assets/ta-IN-2NMHFXQM-BtPPl3RQ.js +9 -0
- package/dist/frontend/assets/th-TH-HPSO5L25-CSjFGi1j.js +2 -0
- package/dist/frontend/assets/timeline-definition-24CTP7MA-DTBgPsOR.js +120 -0
- package/dist/frontend/assets/timeline-definition-7e6b55e7-D44e8lHF.js +61 -0
- package/dist/frontend/assets/tr-TR-DEFEU3FU-BS1kZ0-G.js +7 -0
- package/dist/frontend/assets/uk-UA-QMV73CPH--ucRdDwc.js +6 -0
- package/dist/frontend/assets/union-DI_iry4-.js +1 -0
- package/dist/frontend/assets/vennDiagram-4TSXK5OY-DDIUJU_f.js +34 -0
- package/dist/frontend/assets/vi-VN-M7AON7JQ-BcGYkPOn.js +5 -0
- package/dist/frontend/assets/wardleyDiagram-VM6X3IG4-TfvrOirV.js +78 -0
- package/dist/frontend/assets/xychartDiagram-S5SC5T6Z-DaSdOJbv.js +7 -0
- package/dist/frontend/assets/xychartDiagram-b6496bcd-VIsyqEG1.js +7 -0
- package/dist/frontend/assets/zh-CN-LNUGB5OW-RL4CyEYU.js +10 -0
- package/dist/frontend/assets/zh-HK-E62DVLB3-DKGVR3J1.js +1 -0
- package/dist/frontend/assets/zh-TW-RAJ6MFWO-C7djgh-M.js +9 -0
- package/dist/frontend/assets/zipObject-Bl99JdSU.js +1 -0
- package/dist/frontend/index.html +569 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/render/excalidraw-node.mjs +540 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1684 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +263 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +49 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +63 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +127 -4
- package/skills/excalidraw-skill/SKILL.md +331 -0
- package/skills/excalidraw-skill/evals/evals.json +35 -0
- package/skills/excalidraw-skill/references/cheatsheet.md +217 -0
- package/src/ai/config.ts +58 -0
- package/src/ai/providers/anthropic.ts +62 -0
- package/src/ai/providers/openai-compatible.ts +84 -0
- package/src/ai/request-settings.ts +50 -0
- package/src/ai/routes.ts +157 -0
- package/src/ai/runner.ts +80 -0
- package/src/ai/sse.ts +40 -0
- package/src/ai/system.ts +16 -0
- package/src/ai/tools.ts +130 -0
- package/src/ai/types.ts +48 -0
- package/src/bin.ts +56 -0
- package/src/cli/args.ts +97 -0
- package/src/cli/commands/ai.ts +40 -0
- package/src/cli/commands/arrange.ts +112 -0
- package/src/cli/commands/canvases.ts +37 -0
- package/src/cli/commands/check.ts +15 -0
- package/src/cli/commands/comment.ts +72 -0
- package/src/cli/commands/elements.ts +299 -0
- package/src/cli/commands/frame.ts +55 -0
- package/src/cli/commands/install-skill.ts +116 -0
- package/src/cli/commands/layout.ts +14 -0
- package/src/cli/commands/render.ts +68 -0
- package/src/cli/commands/scene.ts +168 -0
- package/src/cli/commands/server.ts +71 -0
- package/src/cli/commands/snapshot.ts +45 -0
- package/src/cli/image-options.ts +77 -0
- package/src/cli/run.ts +123 -0
- package/src/cli/util.ts +39 -0
- package/src/core/arrow-routing.ts +256 -0
- package/src/core/bulk-ops.ts +183 -0
- package/src/core/canvas-client.ts +525 -0
- package/src/core/canvas-id.ts +8 -0
- package/src/core/canvas-persistence.ts +1067 -0
- package/src/core/canvas-registry.ts +180 -0
- package/src/core/canvas-routes.ts +34 -0
- package/src/core/canvas-state.ts +37 -0
- package/src/core/canvas.ts +18 -0
- package/src/core/comment-ops.ts +36 -0
- package/src/core/comments.ts +142 -0
- package/src/core/compact.ts +21 -0
- package/src/core/config.ts +24 -0
- package/src/core/describe.ts +100 -0
- package/src/core/design-guide.ts +114 -0
- package/src/core/diagram-layout.ts +278 -0
- package/src/core/diagram-ops.ts +48 -0
- package/src/core/entry.ts +37 -0
- package/src/core/expand-elements.ts +316 -0
- package/src/core/frame-ops.ts +112 -0
- package/src/core/frames.ts +113 -0
- package/src/core/geometry.ts +213 -0
- package/src/core/layout-check.ts +200 -0
- package/src/core/local-origin.ts +27 -0
- package/src/core/mcp-dispatch.ts +858 -0
- package/src/core/mcp-http.ts +38 -0
- package/src/core/mcp-server.ts +72 -0
- package/src/core/mcp-tools.ts +725 -0
- package/src/core/normalize.ts +158 -0
- package/src/core/obsidian-md.ts +231 -0
- package/src/core/pidfile.ts +52 -0
- package/src/core/png-scene.ts +177 -0
- package/src/core/render/excalidraw-node/dom.ts +159 -0
- package/src/core/render/excalidraw-node/index.ts +100 -0
- package/src/core/render/fonts.ts +173 -0
- package/src/core/render/index.ts +198 -0
- package/src/core/render/png-worker.ts +75 -0
- package/src/core/render/png.ts +148 -0
- package/src/core/render/text-metrics.ts +141 -0
- package/src/core/request-canvas.ts +10 -0
- package/src/core/request-headers.ts +79 -0
- package/src/core/scene-input.ts +11 -0
- package/src/core/scene-io.ts +125 -0
- package/src/core/share-url.ts +99 -0
- package/src/core/spawn.ts +186 -0
- package/src/core/version.ts +13 -0
- package/src/index.ts +86 -0
- package/src/server.ts +1873 -0
- package/src/types.ts +384 -0
- package/src/utils/logger.ts +77 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import logger from '../utils/logger.js';
|
|
2
|
+
import { generateId, ServerElement } from '../types.js';
|
|
3
|
+
import {
|
|
4
|
+
getElementFromCanvas,
|
|
5
|
+
updateElementOnCanvas,
|
|
6
|
+
batchCreateElementsOnCanvas,
|
|
7
|
+
getElements
|
|
8
|
+
} from './canvas-client.js';
|
|
9
|
+
|
|
10
|
+
export type Alignment = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom';
|
|
11
|
+
export type Direction = 'horizontal' | 'vertical';
|
|
12
|
+
|
|
13
|
+
export async function alignElements(
|
|
14
|
+
elementIds: string[],
|
|
15
|
+
alignment: Alignment
|
|
16
|
+
): Promise<{ aligned: boolean; elementIds: string[]; alignment: Alignment; successCount: number }> {
|
|
17
|
+
// Fetch all elements
|
|
18
|
+
const elementsToAlign: ServerElement[] = [];
|
|
19
|
+
for (const id of elementIds) {
|
|
20
|
+
const el = await getElementFromCanvas(id);
|
|
21
|
+
if (el) elementsToAlign.push(el);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (elementsToAlign.length < 2) {
|
|
25
|
+
throw new Error('Need at least 2 elements to align');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Calculate alignment target
|
|
29
|
+
let updateFn: (el: ServerElement) => { x?: number; y?: number };
|
|
30
|
+
switch (alignment) {
|
|
31
|
+
case 'left': {
|
|
32
|
+
const minX = Math.min(...elementsToAlign.map(el => el.x));
|
|
33
|
+
updateFn = () => ({ x: minX });
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 'right': {
|
|
37
|
+
const maxRight = Math.max(...elementsToAlign.map(el => el.x + (el.width || 0)));
|
|
38
|
+
updateFn = (el) => ({ x: maxRight - (el.width || 0) });
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'center': {
|
|
42
|
+
const centers = elementsToAlign.map(el => el.x + (el.width || 0) / 2);
|
|
43
|
+
const avgCenter = centers.reduce((a, b) => a + b, 0) / centers.length;
|
|
44
|
+
updateFn = (el) => ({ x: avgCenter - (el.width || 0) / 2 });
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case 'top': {
|
|
48
|
+
const minY = Math.min(...elementsToAlign.map(el => el.y));
|
|
49
|
+
updateFn = () => ({ y: minY });
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case 'bottom': {
|
|
53
|
+
const maxBottom = Math.max(...elementsToAlign.map(el => el.y + (el.height || 0)));
|
|
54
|
+
updateFn = (el) => ({ y: maxBottom - (el.height || 0) });
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case 'middle': {
|
|
58
|
+
const middles = elementsToAlign.map(el => el.y + (el.height || 0) / 2);
|
|
59
|
+
const avgMiddle = middles.reduce((a, b) => a + b, 0) / middles.length;
|
|
60
|
+
updateFn = (el) => ({ y: avgMiddle - (el.height || 0) / 2 });
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Apply updates
|
|
66
|
+
const updatePromises = elementsToAlign.map(async (el) => {
|
|
67
|
+
const coords = updateFn(el);
|
|
68
|
+
return await updateElementOnCanvas({ id: el.id, ...coords });
|
|
69
|
+
});
|
|
70
|
+
const results = await Promise.all(updatePromises);
|
|
71
|
+
const successCount = results.filter(r => r).length;
|
|
72
|
+
|
|
73
|
+
if (successCount === 0) {
|
|
74
|
+
throw new Error('Failed to align any elements: HTTP server unavailable');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return { aligned: true, elementIds, alignment, successCount };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function distributeElements(
|
|
81
|
+
elementIds: string[],
|
|
82
|
+
direction: Direction
|
|
83
|
+
): Promise<{ distributed: boolean; elementIds: string[]; direction: Direction; count: number }> {
|
|
84
|
+
// Fetch all elements
|
|
85
|
+
const elementsToDist: ServerElement[] = [];
|
|
86
|
+
for (const id of elementIds) {
|
|
87
|
+
const el = await getElementFromCanvas(id);
|
|
88
|
+
if (el) elementsToDist.push(el);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (elementsToDist.length < 3) {
|
|
92
|
+
throw new Error('Need at least 3 elements to distribute');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (direction === 'horizontal') {
|
|
96
|
+
// Sort by x position
|
|
97
|
+
elementsToDist.sort((a, b) => a.x - b.x);
|
|
98
|
+
const first = elementsToDist[0]!;
|
|
99
|
+
const last = elementsToDist[elementsToDist.length - 1]!;
|
|
100
|
+
const totalSpan = (last.x + (last.width || 0)) - first.x;
|
|
101
|
+
const totalElementWidth = elementsToDist.reduce((sum, el) => sum + (el.width || 0), 0);
|
|
102
|
+
const gap = (totalSpan - totalElementWidth) / (elementsToDist.length - 1);
|
|
103
|
+
|
|
104
|
+
let currentX = first.x;
|
|
105
|
+
for (const el of elementsToDist) {
|
|
106
|
+
await updateElementOnCanvas({ id: el.id, x: currentX });
|
|
107
|
+
currentX += (el.width || 0) + gap;
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
// Sort by y position
|
|
111
|
+
elementsToDist.sort((a, b) => a.y - b.y);
|
|
112
|
+
const first = elementsToDist[0]!;
|
|
113
|
+
const last = elementsToDist[elementsToDist.length - 1]!;
|
|
114
|
+
const totalSpan = (last.y + (last.height || 0)) - first.y;
|
|
115
|
+
const totalElementHeight = elementsToDist.reduce((sum, el) => sum + (el.height || 0), 0);
|
|
116
|
+
const gap = (totalSpan - totalElementHeight) / (elementsToDist.length - 1);
|
|
117
|
+
|
|
118
|
+
let currentY = first.y;
|
|
119
|
+
for (const el of elementsToDist) {
|
|
120
|
+
await updateElementOnCanvas({ id: el.id, y: currentY });
|
|
121
|
+
currentY += (el.height || 0) + gap;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return { distributed: true, elementIds, direction, count: elementsToDist.length };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function setElementsLocked(
|
|
129
|
+
elementIds: string[],
|
|
130
|
+
locked: boolean
|
|
131
|
+
): Promise<{ elementIds: string[]; successCount: number }> {
|
|
132
|
+
const updatePromises = elementIds.map(async (id) => {
|
|
133
|
+
return await updateElementOnCanvas({ id, locked });
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const results = await Promise.all(updatePromises);
|
|
137
|
+
const successCount = results.filter(result => result).length;
|
|
138
|
+
|
|
139
|
+
if (successCount === 0) {
|
|
140
|
+
throw new Error(`Failed to ${locked ? 'lock' : 'unlock'} any elements: HTTP server unavailable`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return { elementIds, successCount };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Group elements by appending a fresh groupId to each element's groupIds on
|
|
147
|
+
// the canvas. Canvas element state (not process-local memory) is the source
|
|
148
|
+
// of truth so per-invocation clients like the CLI behave identically.
|
|
149
|
+
export async function groupElements(
|
|
150
|
+
elementIds: string[]
|
|
151
|
+
): Promise<{ groupId: string; elementIds: string[]; successCount: number }> {
|
|
152
|
+
const groupId = generateId();
|
|
153
|
+
|
|
154
|
+
// Fetch existing groups and append new groupId to preserve multi-group membership
|
|
155
|
+
const updatePromises = elementIds.map(async (id) => {
|
|
156
|
+
const element = await getElementFromCanvas(id);
|
|
157
|
+
const existingGroups = element?.groupIds || [];
|
|
158
|
+
const updatedGroupIds = [...existingGroups, groupId];
|
|
159
|
+
return await updateElementOnCanvas({ id, groupIds: updatedGroupIds });
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const results = await Promise.all(updatePromises);
|
|
163
|
+
const successCount = results.filter(result => result).length;
|
|
164
|
+
|
|
165
|
+
if (successCount === 0) {
|
|
166
|
+
throw new Error('Failed to group any elements: HTTP server unavailable');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return { groupId, elementIds, successCount };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Ungroup by finding members via canvas groupIds. Optionally seeded with a
|
|
173
|
+
// known member list (the MCP server's legacy in-memory group map) for
|
|
174
|
+
// backward compatibility.
|
|
175
|
+
export async function ungroupElements(
|
|
176
|
+
groupId: string,
|
|
177
|
+
knownMemberIds?: string[]
|
|
178
|
+
): Promise<{ groupId: string; ungrouped: boolean; elementIds: string[]; successCount: number }> {
|
|
179
|
+
let memberIds = knownMemberIds;
|
|
180
|
+
if (!memberIds || memberIds.length === 0) {
|
|
181
|
+
const allElements = await getElements();
|
|
182
|
+
memberIds = allElements
|
|
183
|
+
.filter(el => (el.groupIds || []).includes(groupId))
|
|
184
|
+
.map(el => el.id);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (memberIds.length === 0) {
|
|
188
|
+
throw new Error(`Group ${groupId} not found`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Update elements on canvas, removing only this specific groupId
|
|
192
|
+
const updatePromises = memberIds.map(async (id) => {
|
|
193
|
+
// Fetch current element to get existing groupIds
|
|
194
|
+
const element = await getElementFromCanvas(id);
|
|
195
|
+
if (!element) {
|
|
196
|
+
logger.warn(`Element ${id} not found on canvas, skipping ungroup`);
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Remove only the specific groupId, preserve others
|
|
201
|
+
const updatedGroupIds = (element.groupIds || []).filter(gid => gid !== groupId);
|
|
202
|
+
return await updateElementOnCanvas({ id, groupIds: updatedGroupIds });
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const results = await Promise.all(updatePromises);
|
|
206
|
+
const successCount = results.filter(result => result !== null).length;
|
|
207
|
+
|
|
208
|
+
if (successCount === 0) {
|
|
209
|
+
throw new Error('Failed to ungroup: no elements were updated (elements may not exist on canvas)');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return { groupId, ungrouped: true, elementIds: memberIds, successCount };
|
|
213
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { ServerElement } from '../types.js';
|
|
2
|
+
|
|
3
|
+
export type IssueKind = 'text-overflow' | 'overlap' | 'arrow-crosses-shape' | 'cramped' | 'oversized' | 'outside-frame' | 'unattached-arrow';
|
|
4
|
+
|
|
5
|
+
export interface LayoutIssue {
|
|
6
|
+
kind: IssueKind;
|
|
7
|
+
ids: string[];
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface LayoutReport {
|
|
12
|
+
ok: boolean;
|
|
13
|
+
checked: number;
|
|
14
|
+
issues: LayoutIssue[];
|
|
15
|
+
/** Issues beyond the first `MAX_ISSUES`, by kind. */
|
|
16
|
+
omitted?: Partial<Record<IssueKind, number>>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const MAX_ISSUES = 25;
|
|
20
|
+
// The worst first: a label that does not fit or a shape under another is wrong, a tight gap is only untidy.
|
|
21
|
+
const SEVERITY: IssueKind[] = ['text-overflow', 'overlap', 'arrow-crosses-shape', 'outside-frame', 'unattached-arrow', 'oversized', 'cramped'];
|
|
22
|
+
|
|
23
|
+
const SHAPES = new Set(['rectangle', 'diamond', 'ellipse', 'image', 'embeddable', 'iframe']);
|
|
24
|
+
const FRAMES = new Set(['frame', 'magicframe']);
|
|
25
|
+
// The guide says to leave 40 px between shapes; only under MIN_GAP is it worth reporting.
|
|
26
|
+
const MIN_GAP = 16;
|
|
27
|
+
const PADDING = 8;
|
|
28
|
+
// A box is oversized when it is this many times the area of its label's box and also wastes this much room.
|
|
29
|
+
const OVERSIZE_AREA = 5;
|
|
30
|
+
const OVERSIZE_WIDTH = 140;
|
|
31
|
+
const OVERSIZE_HEIGHT = 90;
|
|
32
|
+
// Overlaps smaller than this share of the smaller shape, or thinner than OVERLAP_MIN px, are edge contact.
|
|
33
|
+
const OVERLAP_SHARE = 0.02;
|
|
34
|
+
const OVERLAP_MIN = 4;
|
|
35
|
+
// An arrow end this close to a shape counts as touching it.
|
|
36
|
+
const TOUCH = 12;
|
|
37
|
+
|
|
38
|
+
interface Box { x: number; y: number; w: number; h: number }
|
|
39
|
+
type Pt = [number, number];
|
|
40
|
+
|
|
41
|
+
const boxOf = (e: ServerElement): Box => ({ x: e.x, y: e.y, w: e.width ?? 0, h: e.height ?? 0 });
|
|
42
|
+
const area = (b: Box): number => b.w * b.h;
|
|
43
|
+
const overlapOf = (a: Box, b: Box): Box | null => {
|
|
44
|
+
const [x0, y0] = [Math.max(a.x, b.x), Math.max(a.y, b.y)];
|
|
45
|
+
const [x1, y1] = [Math.min(a.x + a.w, b.x + b.w), Math.min(a.y + a.h, b.y + b.h)];
|
|
46
|
+
return x1 > x0 && y1 > y0 ? { x: x0, y: y0, w: x1 - x0, h: y1 - y0 } : null;
|
|
47
|
+
};
|
|
48
|
+
const contains = (outer: Box, inner: Box, slack = 1): boolean =>
|
|
49
|
+
outer.x - slack <= inner.x && outer.y - slack <= inner.y && outer.x + outer.w + slack >= inner.x + inner.w && outer.y + outer.h + slack >= inner.y + inner.h;
|
|
50
|
+
|
|
51
|
+
type Joined = ServerElement & { start?: { id: string }; end?: { id: string }; startBinding?: { elementId: string } | null; endBinding?: { elementId: string } | null };
|
|
52
|
+
|
|
53
|
+
/** The ids of the shapes an arrow starts and ends on: by `start`/`end` as drawn through the tools, or by the bindings the browser saves. */
|
|
54
|
+
export const arrowEnds = (arrow: ServerElement): [string | undefined, string | undefined] => {
|
|
55
|
+
const a = arrow as Joined;
|
|
56
|
+
return [a.start?.id ?? a.startBinding?.elementId, a.end?.id ?? a.endBinding?.elementId];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const label = (e: ServerElement): string => (e.type === 'text' ? `text "${String(e.text ?? '').slice(0, 24)}"` : `${e.type} ${e.id}`);
|
|
60
|
+
|
|
61
|
+
// A text's size when the browser has not measured it: about 0.6 em wide per character, 1.25 em per line.
|
|
62
|
+
export const CHAR_EM = 0.6;
|
|
63
|
+
const LINE_EM = 1.25;
|
|
64
|
+
function textNeeds(text: string, fontSize: number, width: number): { w: number; h: number } {
|
|
65
|
+
const perLine = Math.max(1, Math.floor(width / (fontSize * CHAR_EM)));
|
|
66
|
+
const lines = text.split('\n').reduce((sum, line) => sum + Math.max(1, Math.ceil(line.length / perLine)), 0);
|
|
67
|
+
const widest = Math.min(width, Math.max(...text.split('\n').map(l => l.length)) * fontSize * CHAR_EM);
|
|
68
|
+
return { w: widest, h: lines * fontSize * LINE_EM };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function pathOf(arrow: ServerElement): Pt[] {
|
|
72
|
+
const points = ((arrow as { points?: Array<Pt | { x: number; y: number }> }).points ?? []).map((p): Pt => (Array.isArray(p) ? p : [p.x, p.y]));
|
|
73
|
+
return points.length >= 2 ? points.map(([px, py]): Pt => [arrow.x + px, arrow.y + py]) : [[arrow.x, arrow.y], [arrow.x + (arrow.width ?? 0), arrow.y + (arrow.height ?? 0)]];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const crossesInterior = (a: Pt, b: Pt, r: Box): boolean =>
|
|
77
|
+
Math.max(a[0], b[0]) > r.x && Math.min(a[0], b[0]) < r.x + r.w && Math.max(a[1], b[1]) > r.y && Math.min(a[1], b[1]) < r.y + r.h;
|
|
78
|
+
|
|
79
|
+
// Right-angled paths are checked exactly; a slanted segment is sampled along its length.
|
|
80
|
+
function segmentCrosses(a: Pt, b: Pt, r: Box): boolean {
|
|
81
|
+
// Most shapes are nowhere near a segment; one comparison of boxes settles those before any sampling.
|
|
82
|
+
if (!crossesInterior(a, b, r)) return false;
|
|
83
|
+
if (a[0] === b[0] || a[1] === b[1]) return true;
|
|
84
|
+
const steps = Math.min(400, Math.max(2, Math.ceil(Math.hypot(b[0] - a[0], b[1] - a[1]) / 6)));
|
|
85
|
+
for (let i = 1; i < steps; i++) {
|
|
86
|
+
const [x, y] = [a[0] + ((b[0] - a[0]) * i) / steps, a[1] + ((b[1] - a[1]) * i) / steps];
|
|
87
|
+
if (x > r.x && x < r.x + r.w && y > r.y && y < r.y + r.h) return true;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** The size a shape's label needs, without padding; null when it has no label. */
|
|
93
|
+
export function labelNeeds(shape: ServerElement, bound?: ServerElement): { w: number; h: number } | null {
|
|
94
|
+
// A label is a bound text element once the browser has saved it, and `label: { text }` (or `text`) on the shape before.
|
|
95
|
+
const text = String(bound?.text ?? (shape as { label?: { text?: string } }).label?.text ?? shape.text ?? '').trim();
|
|
96
|
+
if (!text || shape.type === 'image') return null;
|
|
97
|
+
const fontSize = Number(bound?.fontSize ?? shape.fontSize ?? 20);
|
|
98
|
+
if (bound?.width && bound.height) return { w: bound.width, h: bound.height };
|
|
99
|
+
return textNeeds(text, fontSize, Math.max(10, (shape.width ?? 0) - 2 * PADDING));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The size a shape must grow to so its label fits, or null when it already does (shapes only grow). */
|
|
103
|
+
export function fittedSize(shape: ServerElement, bound?: ServerElement): { width: number; height: number } | null {
|
|
104
|
+
const needs = labelNeeds(shape, bound);
|
|
105
|
+
if (!needs) return null;
|
|
106
|
+
const width = Math.max(shape.width ?? 0, Math.ceil(needs.w + 2 * PADDING));
|
|
107
|
+
const height = Math.max(shape.height ?? 0, Math.ceil(needs.h + 2 * PADDING));
|
|
108
|
+
return width > (shape.width ?? 0) + 2 || height > (shape.height ?? 0) + 2 ? { width, height } : null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Looks for what makes a diagram hard to read, without drawing it: a pure function of the elements. */
|
|
112
|
+
export function checkLayout(all: readonly ServerElement[]): LayoutReport {
|
|
113
|
+
const elements = all.filter(e => !e.isDeleted);
|
|
114
|
+
const byId = new Map(elements.map(e => [e.id, e]));
|
|
115
|
+
const issues: LayoutIssue[] = [];
|
|
116
|
+
const add = (kind: IssueKind, ids: string[], message: string): void => { issues.push({ kind, ids, message }); };
|
|
117
|
+
|
|
118
|
+
const shapes = elements.filter(e => SHAPES.has(e.type));
|
|
119
|
+
const texts = elements.filter(e => e.type === 'text');
|
|
120
|
+
const arrows = elements.filter(e => e.type === 'arrow' || e.type === 'line');
|
|
121
|
+
const boundText = new Map<string, ServerElement>();
|
|
122
|
+
for (const t of texts) if (t.containerId && byId.has(t.containerId)) boundText.set(t.containerId, t);
|
|
123
|
+
|
|
124
|
+
// 1. A label that does not fit its shape.
|
|
125
|
+
for (const s of shapes) {
|
|
126
|
+
const box = boxOf(s);
|
|
127
|
+
const needs = labelNeeds(s, boundText.get(s.id));
|
|
128
|
+
if (!needs) continue;
|
|
129
|
+
const inner = Math.max(10, box.w - 2 * PADDING);
|
|
130
|
+
const roomH = box.h - 2 * PADDING;
|
|
131
|
+
const roomW = inner;
|
|
132
|
+
if (needs.h > roomH + 2 || needs.w > roomW + 2) {
|
|
133
|
+
add('text-overflow', [s.id], `${label(s)} is ${Math.round(box.w)}x${Math.round(box.h)} but its label needs about ${Math.round(needs.w + 2 * PADDING)}x${Math.round(needs.h + 2 * PADDING)} with padding: widen or heighten it, or shorten the text`);
|
|
134
|
+
} else if (area(box) > OVERSIZE_AREA * (needs.w + 2 * PADDING) * (needs.h + 2 * PADDING) && (box.w - needs.w > OVERSIZE_WIDTH || box.h - needs.h > OVERSIZE_HEIGHT)) {
|
|
135
|
+
add('oversized', [s.id], `${label(s)} is ${Math.round(box.w)}x${Math.round(box.h)} for a label of about ${Math.round(needs.w + 2 * PADDING)}x${Math.round(needs.h + 2 * PADDING)} with padding: shrink it`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 2. Shapes and free text on top of each other. One that holds the other (a zone, a backdrop, a label inside) is fine.
|
|
140
|
+
const placed = [...shapes, ...texts.filter(t => !t.containerId)];
|
|
141
|
+
for (let i = 0; i < placed.length; i++) {
|
|
142
|
+
for (let j = i + 1; j < placed.length; j++) {
|
|
143
|
+
const [a, b] = [placed[i]!, placed[j]!];
|
|
144
|
+
const [ba, bb] = [boxOf(a), boxOf(b)];
|
|
145
|
+
const both = overlapOf(ba, bb);
|
|
146
|
+
if (!both || contains(ba, bb) || contains(bb, ba)) continue;
|
|
147
|
+
if (area(both) < OVERLAP_SHARE * Math.min(area(ba), area(bb)) || both.w < OVERLAP_MIN || both.h < OVERLAP_MIN) continue;
|
|
148
|
+
add('overlap', [a.id, b.id], `${label(a)} and ${label(b)} overlap by ${Math.round(both.w)}x${Math.round(both.h)}: move one, or send the background behind with reorder_elements`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 3. Arrows through shapes they do not join, and arrows joined to nothing.
|
|
153
|
+
for (const arrow of arrows) {
|
|
154
|
+
const path = pathOf(arrow);
|
|
155
|
+
const [start, end] = arrowEnds(arrow);
|
|
156
|
+
const joined = new Set([start, end].filter((id): id is string => !!id));
|
|
157
|
+
const backdrops = [...joined].map(id => byId.get(id)).filter((e): e is ServerElement => !!e).map(boxOf);
|
|
158
|
+
// The title of a zone behind the arrow's ends is annotation, not something the arrow must avoid.
|
|
159
|
+
const zones = shapes.filter(z => !joined.has(z.id) && backdrops.some(b => contains(boxOf(z), b))).map(boxOf);
|
|
160
|
+
for (const s of [...shapes, ...texts.filter(t => !t.containerId && t.width && t.height && !zones.some(z => contains(z, boxOf(t))))]) {
|
|
161
|
+
if (joined.has(s.id) || s.type === 'image') continue;
|
|
162
|
+
const box = boxOf(s);
|
|
163
|
+
if (backdrops.some(b => contains(box, b))) continue;
|
|
164
|
+
if (contains(box, { x: path[0]![0], y: path[0]![1], w: 0, h: 0 })) continue;
|
|
165
|
+
if (path.slice(1).some((p, i) => segmentCrosses(path[i]!, p, box))) {
|
|
166
|
+
add('arrow-crosses-shape', [arrow.id, s.id], `arrow ${arrow.id} passes through ${label(s)}: re-route it with route_arrows, or move the shape`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!start && !end && arrow.type === 'arrow') {
|
|
170
|
+
const touches = (p: Pt): boolean => shapes.some(s => { const b = boxOf(s); return p[0] >= b.x - TOUCH && p[0] <= b.x + b.w + TOUCH && p[1] >= b.y - TOUCH && p[1] <= b.y + b.h + TOUCH; });
|
|
171
|
+
if (!touches(path[0]!) && !touches(path.at(-1)!)) add('unattached-arrow', [arrow.id], `arrow ${arrow.id} is joined to nothing: give it startElementId and endElementId`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 4. Neighbours too close, and anything outside the frame it belongs to.
|
|
176
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
177
|
+
for (let j = i + 1; j < shapes.length; j++) {
|
|
178
|
+
const [a, b] = [boxOf(shapes[i]!), boxOf(shapes[j]!)];
|
|
179
|
+
if (overlapOf(a, b) || shapes[i]!.frameId !== shapes[j]!.frameId) continue;
|
|
180
|
+
const gapX = Math.max(b.x - (a.x + a.w), a.x - (b.x + b.w));
|
|
181
|
+
const gapY = Math.max(b.y - (a.y + a.h), a.y - (b.y + b.h));
|
|
182
|
+
const sideBySide = gapX >= 0 && gapY < 0;
|
|
183
|
+
const stacked = gapY >= 0 && gapX < 0;
|
|
184
|
+
const gap = sideBySide ? gapX : stacked ? gapY : Infinity;
|
|
185
|
+
if (gap < MIN_GAP) add('cramped', [shapes[i]!.id, shapes[j]!.id], `${label(shapes[i]!)} and ${label(shapes[j]!)} are ${Math.round(gap)} px apart: leave at least 40`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (const e of elements) {
|
|
189
|
+
if (!e.frameId || FRAMES.has(e.type)) continue;
|
|
190
|
+
const frame = byId.get(e.frameId);
|
|
191
|
+
if (!frame) continue;
|
|
192
|
+
if (!contains(boxOf(frame), boxOf(e), 2)) add('outside-frame', [e.id, frame.id], `${label(e)} reaches outside the frame "${(frame as { name?: string }).name ?? frame.id}", where it is clipped`);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const order = (kind: IssueKind): number => SEVERITY.indexOf(kind);
|
|
196
|
+
issues.sort((a, b) => order(a.kind) - order(b.kind));
|
|
197
|
+
const omitted: Partial<Record<IssueKind, number>> = {};
|
|
198
|
+
for (const extra of issues.slice(MAX_ISSUES)) omitted[extra.kind] = (omitted[extra.kind] ?? 0) + 1;
|
|
199
|
+
return { ok: issues.length === 0, checked: elements.length, issues: issues.slice(0, MAX_ISSUES), ...(Object.keys(omitted).length ? { omitted } : {}) };
|
|
200
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IncomingHttpHeaders } from 'http';
|
|
2
|
+
|
|
3
|
+
const LOOPBACK_NAMES = new Set(['localhost', '127.0.0.1', '[::1]']);
|
|
4
|
+
|
|
5
|
+
const isLoopbackBind = (host: string): boolean => host === 'localhost' || host === '::1' || host.startsWith('127.');
|
|
6
|
+
|
|
7
|
+
export function parseAllowedOrigins(value: string | undefined): string[] {
|
|
8
|
+
return (value ?? '').split(',').map((origin) => origin.trim().replace(/\/+$/, '')).filter(Boolean);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Any website can reach a local server (a WebSocket ignores CORS; a rebinding DNS name can point at 127.0.0.1).
|
|
12
|
+
// Only the canvas page, listed origins and non-browser clients pass.
|
|
13
|
+
export function isTrustedRequest(headers: IncomingHttpHeaders, bindHost: string, allowedOrigins: readonly string[] = []): boolean {
|
|
14
|
+
const origin = headers.origin;
|
|
15
|
+
if (origin && allowedOrigins.includes(origin)) return true;
|
|
16
|
+
const site = headers['sec-fetch-site'];
|
|
17
|
+
if (site && site !== 'same-origin' && site !== 'none') return false;
|
|
18
|
+
const host = headers.host ?? '';
|
|
19
|
+
if (origin) {
|
|
20
|
+
try {
|
|
21
|
+
if (new URL(origin).host !== host) return false;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return !isLoopbackBind(bindHost) || LOOPBACK_NAMES.has(host.replace(/:\d+$/, ''));
|
|
27
|
+
}
|