@locus-forge/locus-map 0.2.0 → 0.3.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/CONTRIBUTING.md +2 -2
- package/README.md +21 -6
- package/dist/assets/{abnfDiagram-VCTEODGH-BnTGKKaL.js → abnfDiagram-VCTEODGH-YtlnkH6t.js} +1 -1
- package/dist/assets/{ar-SA-G6X2FPQ2-LY3czoz9.js → ar-SA-G6X2FPQ2-BH5AlOAp.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-BG9h9KRx.js → architectureDiagram-5GKGNRK7-DKYw7IM8.js} +1 -1
- package/dist/assets/{az-AZ-76LH7QW2-Brv6kuM6.js → az-AZ-76LH7QW2-DoI4xcyq.js} +1 -1
- package/dist/assets/{bg-BG-XCXSNQG7-tsQwwvMW.js → bg-BG-XCXSNQG7-CS9_2dp-.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-V9bUuR63.js → blockDiagram-I7D4REHJ-FelDwD1I.js} +1 -1
- package/dist/assets/{bn-BD-2XOGV67Q-0Cou5nNv.js → bn-BD-2XOGV67Q-CoIu5tTK.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-BmCtzbrY.js → c4Diagram-7LVT6UL2-Bh7h9IHP.js} +1 -1
- package/dist/assets/{ca-ES-6MX7JW3Y-pZF7WJUL.js → ca-ES-6MX7JW3Y-DAEHzf3H.js} +1 -1
- package/dist/assets/channel-DXsl7ag_.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-D2iTDmHh.js → chunk-2Q5K7J3B-CgUOCDxa.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CTxdXZIx.js → chunk-5VM5RSS4-B97oha-s.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-Hic1X1pm.js → chunk-F27PBJKO-BQGqI2Ej.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-DhLW1JVb.js → chunk-IMKFNOWR-C_sOeFT_.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-_g5twKlC.js → chunk-JWPE2WC7-DG5n2owX.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-DMV4qmkd.js → chunk-POPQ4Y6H-Y-h3THrr.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-BWg83oEL.js → chunk-SVP7TREG-Dn6yBHtF.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-CPmkpa7J.js → chunk-TICWLB2K-Cb_yWOVI.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-KnXvIZ_8.js → chunk-XXDRQBXY-QE51OqTj.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-DLyWZtYF.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-Cb3mb68m.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-BChK_CGh.js → cose-bilkent-JH36ORCC-Bt7ZI9S1.js} +1 -1
- package/dist/assets/{cs-CZ-2BRQDIVT-CtAC2Qjy.js → cs-CZ-2BRQDIVT-BKZzkx2M.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-CdsltaMX.js → cynefin-OW5HDTMX-n6-BmECj.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-bXvXX3Fx.js → cynefinDiagram-5FMLGOSQ-Bq2km1fZ.js} +1 -1
- package/dist/assets/{d3-scale-sM87TD1Z.js → d3-scale-C9oJHYFk.js} +1 -1
- package/dist/assets/{da-DK-5WZEPLOC-DyWwaclV.js → da-DK-5WZEPLOC-DWJm1_Yl.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-CTmiZZVO.js → dagre-GXQ25YYZ-D9EJj_nK.js} +1 -1
- package/dist/assets/{de-DE-XR44H4JA-BDXUBHki.js → de-DE-XR44H4JA-D-5dMJXD.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-Bm8Fy0R_.js → diagram-S7CK7UJ4-DX3qZf_H.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-BU_AmM_A.js → diagram-UQ7AKVKN-lODsxrZ9.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-B78LUoXq.js → diagram-VSXAHHWV-B48xz8Xq.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-DNvWjMlf.js → diagram-VX7I27RA-Dms2AfBa.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-DmFVt1fa.js → diagram-Z3DM3KII-BnwZBeJA.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-CpDna0Jp.js → ebnfDiagram-PWID7BFC-OtcCvaIU.js} +1 -1
- package/dist/assets/{el-GR-BZB4AONW-CNhF7oN2.js → el-GR-BZB4AONW-BZVA3YVN.js} +1 -1
- package/dist/assets/{engines-a8mi_N6S.js → engines-DPbXorS1.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-BGD-9OAS.js → erDiagram-RLTQ6QDP-Cnh8Gn9f.js} +1 -1
- package/dist/assets/{es-ES-U4NZUMDT-DXMrJcKL.js → es-ES-U4NZUMDT-DKJIfS-2.js} +1 -1
- package/dist/assets/{eu-ES-A7QVB2H4-BTkMEwMi.js → eu-ES-A7QVB2H4-LHCF7lHc.js} +1 -1
- package/dist/assets/{fa-IR-HGAKTJCU-CgkknSS7.js → fa-IR-HGAKTJCU-CMtLvHxY.js} +1 -1
- package/dist/assets/{fi-FI-Z5N7JZ37-B1K83nId.js → fi-FI-Z5N7JZ37-CUIzm5UM.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-CjU1yR1F.js → flowDiagram-HODETNUW-lneiCvFi.js} +1 -1
- package/dist/assets/{fr-FR-RHASNOE6-CBFZBGMr.js → fr-FR-RHASNOE6-DTJ2WS73.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-bvb8BjSh.js → ganttDiagram-EL5Y4UJY-B2aJ2MDb.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-DZXQ_x8t.js → gitGraphDiagram-WWUBYQGX-C74V3MFm.js} +1 -1
- package/dist/assets/{gl-ES-HMX3MZ6V-CON98Mma.js → gl-ES-HMX3MZ6V-BP8M0fQQ.js} +1 -1
- package/dist/assets/{he-IL-6SHJWFNN-CBoFaEdB.js → he-IL-6SHJWFNN-BMd-Q0PW.js} +1 -1
- package/dist/assets/{hi-IN-IWLTKZ5I-BJuoh3dl.js → hi-IN-IWLTKZ5I-Ct52OkX5.js} +1 -1
- package/dist/assets/{hu-HU-A5ZG7DT2-CQruu8XR.js → hu-HU-A5ZG7DT2-NfIL6Jfo.js} +1 -1
- package/dist/assets/{id-ID-SAP4L64H-VhaoENjR.js → id-ID-SAP4L64H-Osl6P1wb.js} +1 -1
- package/dist/assets/index-CyQSsku0.js +624 -0
- package/dist/assets/{index-CDNl17QJ.css → index-DR6sd54W.css} +1 -1
- package/dist/assets/{index-CboxqaL5.js → index-VfiAlFSM.js} +5 -5
- package/dist/assets/{infoDiagram-27XIBGKW-CM9Hap0f.js → infoDiagram-27XIBGKW-BjDMKD-X.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-i8pQztJI.js → ishikawaDiagram-5VMMS53U-DjrBmz8f.js} +1 -1
- package/dist/assets/{it-IT-JPQ66NNP-Dj9BkXfh.js → it-IT-JPQ66NNP-vT-EYZw5.js} +1 -1
- package/dist/assets/{ja-JP-DBVTYXUO-CB2BlfIS.js → ja-JP-DBVTYXUO-DexyPC4p.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-PxcdqONT.js → journeyDiagram-3NMN7TZE-Bs5RL4Ef.js} +1 -1
- package/dist/assets/{kaa-6HZHGXH3-CLnR_zY5.js → kaa-6HZHGXH3-0BLUFlXY.js} +1 -1
- package/dist/assets/{kab-KAB-ZGHBKWFO-8TJr4nPf.js → kab-KAB-ZGHBKWFO-ByGN5_Fc.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-B2p5NBhO.js → kanban-definition-UXKFOSKX-DgcopnbA.js} +1 -1
- package/dist/assets/{kk-KZ-P5N5QNE5-5uZYjZ2e.js → kk-KZ-P5N5QNE5-DlK-wQWu.js} +1 -1
- package/dist/assets/{km-KH-HSX4SM5Z-D54aOpMd.js → km-KH-HSX4SM5Z-BZ75967_.js} +1 -1
- package/dist/assets/{ko-KR-MTYHY66A-Bnm0G6eo.js → ko-KR-MTYHY66A-C-copauZ.js} +1 -1
- package/dist/assets/{ku-TR-6OUDTVRD-CtGCn_eB.js → ku-TR-6OUDTVRD-CNqY-Uj4.js} +1 -1
- package/dist/assets/{layout-BBV3_Svw.js → layout-B8D2HGrb.js} +1 -1
- package/dist/assets/{lt-LT-XHIRWOB4-Bl8G0yv6.js → lt-LT-XHIRWOB4-BopE_XJX.js} +1 -1
- package/dist/assets/{lv-LV-5QDEKY6T-Cax93Eua.js → lv-LV-5QDEKY6T--7hU3JSZ.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-CsOezwmE.js → mindmap-definition-YA3MSWOX-DYOVTEyE.js} +1 -1
- package/dist/assets/{mr-IN-CRQNXWMA-Br7GVyJH.js → mr-IN-CRQNXWMA-DydjVI2G.js} +1 -1
- package/dist/assets/{my-MM-5M5IBNSE-xC6lzTDV.js → my-MM-5M5IBNSE-D6ewM-EV.js} +1 -1
- package/dist/assets/{nb-NO-T6EIAALU-B0i5THqA.js → nb-NO-T6EIAALU--iqOwj15.js} +1 -1
- package/dist/assets/{nl-NL-IS3SIHDZ-CqYhUjP3.js → nl-NL-IS3SIHDZ-Bnhl_SmS.js} +1 -1
- package/dist/assets/{nn-NO-6E72VCQL-rpjr_9Z5.js → nn-NO-6E72VCQL-CIx7sLAQ.js} +1 -1
- package/dist/assets/{oc-FR-POXYY2M6-BlhQ99Ty.js → oc-FR-POXYY2M6-DWt5a8Ow.js} +1 -1
- package/dist/assets/{pa-IN-N4M65BXN-N2XbQgZ_.js → pa-IN-N4M65BXN-BW3LNure.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-C2iSJgYQ.js → pegDiagram-XKGWAZYB-ixSY_9-e.js} +1 -1
- package/dist/assets/{pica-DvYcrBvx.js → pica-Dn0N8xAP.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-CUjgOGBw.js → pieDiagram-E7YTZNPT-BbCRV6Qi.js} +1 -1
- package/dist/assets/{pl-PL-T2D74RX3-CnMxn1dA.js → pl-PL-T2D74RX3-7nXJ8SiV.js} +1 -1
- package/dist/assets/{pt-BR-5N22H2LF-Di-jnHb3.js → pt-BR-5N22H2LF-DKGGof4J.js} +1 -1
- package/dist/assets/{pt-PT-UZXXM6DQ-BaAKq8Sh.js → pt-PT-UZXXM6DQ-DCLEXuhk.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-DwwqgJXZ.js → quadrantDiagram-AXDQQJYC-Bvh_H4wg.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-DyRgYGPF.js → railroadDiagram-O6MQD6OU-DHC3neQ8.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-C3ixXeHJ.js → requirementDiagram-BXWQKSXE-DuCkl3u1.js} +1 -1
- package/dist/assets/{ro-RO-JPDTUUEW-BWrclVyo.js → ro-RO-JPDTUUEW-Cwf4k3Ou.js} +1 -1
- package/dist/assets/{ru-RU-B4JR7IUQ-_z0DINaG.js → ru-RU-B4JR7IUQ-sZF6fySs.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-mKpKYI_w.js → sankeyDiagram-P5KCCOFB-1ELTqwtI.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-ZkNd0Wnj.js → sequenceDiagram-WJ2MYXX4-BK8Ou8Dz.js} +1 -1
- package/dist/assets/{si-LK-N5RQ5JYF-CdKOb383.js → si-LK-N5RQ5JYF-DmYhXIqO.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-hQLGO-0z.js → sizeCapture-INFHLROL-BKwx3lxX.js} +1 -1
- package/dist/assets/{sk-SK-C5VTKIMK-MHJC6ZIe.js → sk-SK-C5VTKIMK-BRLu35YX.js} +1 -1
- package/dist/assets/{sl-SI-NN7IZMDC-BF9YWbZx.js → sl-SI-NN7IZMDC-CMjfvJTr.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-CRWj3j-B.js → stateDiagram-D77RDMKH-CDwJ9XLN.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BZjKARGY.js +1 -0
- package/dist/assets/{subset-shared.chunk-DtxXjVIA.js → subset-shared.chunk-DngAvf0H.js} +1 -1
- package/dist/assets/{subset-worker.chunk-DONNSbUF.js → subset-worker.chunk-DkH_mqr5.js} +1 -1
- package/dist/assets/{sv-SE-XGPEYMSR-DkaTkfUY.js → sv-SE-XGPEYMSR-G4S06sbd.js} +1 -1
- package/dist/assets/{swimlanes-42K2YHIH-CFf6j7jO.js → swimlanes-42K2YHIH-Z9u8PDi-.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-D0kM5xmS.js +8 -0
- package/dist/assets/{ta-IN-2NMHFXQM-BfxqXEDI.js → ta-IN-2NMHFXQM-DgBbCQ8S.js} +1 -1
- package/dist/assets/{th-TH-HPSO5L25-DT3vLA39.js → th-TH-HPSO5L25-o9u4fVfq.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-BGP2Dq8M.js → timeline-definition-24CTP7MA-BNgrm1r_.js} +1 -1
- package/dist/assets/{tr-TR-DEFEU3FU-CdfsG7py.js → tr-TR-DEFEU3FU-BqqSdzoL.js} +1 -1
- package/dist/assets/{uk-UA-QMV73CPH-CZrQuC1S.js → uk-UA-QMV73CPH-Dna46aia.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-CaxGPIab.js → vennDiagram-4TSXK5OY-CHwUI40M.js} +1 -1
- package/dist/assets/{vi-VN-M7AON7JQ-DQJk1_KV.js → vi-VN-M7AON7JQ-CbKRBQPB.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-DQxQ-zXH.js → wardleyDiagram-VM6X3IG4-KB0xBjXX.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-DoxdZQ6R.js → xychartDiagram-S5SC5T6Z-B3LOQLL-.js} +1 -1
- package/dist/assets/{zh-CN-LNUGB5OW-DRVBfkOy.js → zh-CN-LNUGB5OW-BFjA6n_2.js} +1 -1
- package/dist/assets/{zh-HK-E62DVLB3-BJHrltss.js → zh-HK-E62DVLB3-BoTU6iS7.js} +1 -1
- package/dist/assets/{zh-TW-RAJ6MFWO-DpMZ5m2x.js → zh-TW-RAJ6MFWO-DB4kdpOS.js} +1 -1
- package/dist/index.html +2 -2
- package/docs/BUNDLE-FORMAT.md +18 -5
- package/docs/DIAGRAM-SOURCE.md +59 -12
- package/docs/LOCAL-DOCUMENT.md +42 -86
- package/docs/MODEL-CONTRACT.md +7 -4
- package/docs/PLANTUML-SOURCE.md +3 -2
- package/docs/VIEWER-LAUNCH.md +29 -22
- package/docs/VIEWER.md +93 -26
- package/docs/adr/ADR-002-2026-12-03-project-selector/ADR-002-2026-12-03-project-selector.md +1 -1
- package/docs/adr/ADR-005-2026-12-04-named-libraries/ADR-005-2026-12-04-named-libraries.md +1 -1
- package/docs/capabilities.json +21 -3
- package/package.json +2 -1
- package/scripts/build-map.mjs +1 -1
- package/scripts/lib/library-directory.mjs +1 -1
- package/scripts/lib/map-build-invocation.mjs +5 -1
- package/scripts/lib/map-viewer-server.mjs +195 -43
- package/scripts/lib/original-materials.mjs +1 -1
- package/scripts/lib/original-report-server.mjs +7 -3
- package/scripts/lib/project-catalog.mjs +264 -97
- package/scripts/lib/project-map-inputs.mjs +1 -1
- package/scripts/lib/project-registry.mjs +151 -47
- package/scripts/lib/sketch-publication.mjs +1 -1
- package/scripts/lib/task-map-build.mjs +1 -1
- package/scripts/lib/view-args.mjs +163 -0
- package/scripts/lib/workflow/reader-surface.mjs +29 -11
- package/scripts/locus-map.mjs +18 -23
- package/scripts/open-map.mjs +96 -51
- package/skills/README.md +2 -1
- package/skills/locus-map/SKILL.md +30 -26
- package/skills/locus-map/assets/artifact-handoff.md +2 -1
- package/skills/locus-map/references/build-environment.md +11 -7
- package/skills/locus-map/references/checks.md +16 -4
- package/skills/locus-map/references/component-checkpoint.md +35 -0
- package/skills/locus-map/references/draw-skill.md +2 -1
- package/skills/locus-map/references/folder.md +2 -2
- package/skills/locus-map/references/selection.md +36 -13
- package/skills/locus-map/references/task-maps.md +5 -0
- package/skills/locus-map/references/visual-composition.md +69 -0
- package/skills/locus-map-draft/SKILL.md +95 -0
- package/skills/locus-map-draft/assets/chosen-direction.md +47 -0
- package/skills/locus-map-draft/references/divergence-and-formats.md +78 -0
- package/skills/locus-map-primitives/SKILL.md +11 -10
- package/skills/locus-map-primitives/assets/batch/README.md +2 -2
- package/skills/locus-map-primitives/assets/batch/build.mjs +1 -1
- package/skills/locus-map-primitives/assets/batch/{project.json → topic.json} +13 -20
- package/skills/locus-map-primitives/references/card-presentation.md +57 -3
- package/skills/locus-map-primitives/references/reading-files.md +1 -1
- package/src/adapter/areas.js +1 -0
- package/src/adapter/semanticAdmission.js +118 -5
- package/src/authoring/buildDiagram.mjs +99 -19
- package/src/authoring/canvas-source-worker.mjs +96 -0
- package/src/authoring/canvasSource.mjs +41 -0
- package/src/authoring/diagramChecks.js +143 -1
- package/src/authoring/diagramSource.js +31 -5
- package/src/authoring/printPlantumlSource.js +13 -2
- package/src/authoring/readDetailsFiles.mjs +100 -19
- package/src/bundle/chain.js +129 -32
- package/src/bundle/chainBrowser.js +26 -2
- package/src/bundle/localDocument.mjs +87 -22
- package/src/bundle/localDocumentClient.js +5 -1
- package/src/bundle/projectClient.js +64 -21
- package/src/chain/validation.js +7 -1
- package/src/contract/readingMaterials.js +18 -2
- package/src/contract/readingTable.js +66 -0
- package/src/main.jsx +25 -1
- package/src/viewer/ControlIcon.jsx +3 -0
- package/src/viewer/DiagramViewer.jsx +70 -30
- package/src/viewer/EmbeddedExcalidrawEditor.jsx +305 -0
- package/src/viewer/HighlightOverlay.jsx +53 -25
- package/src/viewer/Inspector.jsx +109 -39
- package/src/viewer/ProjectLocation.jsx +25 -7
- package/src/viewer/ProjectRail.jsx +20 -7
- package/src/viewer/ProjectViewChainViewer.jsx +254 -83
- package/src/viewer/ReadingTable.jsx +151 -0
- package/src/viewer/SketchCanvas.jsx +133 -84
- package/src/viewer/ViewChainViewer.jsx +557 -57
- package/src/viewer/ViewerSettings.jsx +208 -0
- package/src/viewer/camera.js +50 -18
- package/src/viewer/chainEditorSession.js +160 -35
- package/src/viewer/chainInstallation.js +3 -3
- package/src/viewer/details/CanvasPreview.jsx +303 -0
- package/src/viewer/details/InspectorReadingSettings.jsx +50 -13
- package/src/viewer/details/ReadingFiles.jsx +32 -4
- package/src/viewer/details/details.css +65 -26
- package/src/viewer/diagramControls.css +1 -1
- package/src/viewer/fileError.js +53 -0
- package/src/viewer/geometry.js +12 -0
- package/src/viewer/inspectorPosition.js +54 -31
- package/src/viewer/projectContents.js +248 -55
- package/src/viewer/projectNavigation.js +27 -3
- package/src/viewer/readingTable.css +47 -0
- package/src/viewer/sketchSettling.js +71 -0
- package/src/viewer/useInspectorPosition.js +116 -35
- package/src/viewer/viewChain.css +92 -5
- package/src/viewer/viewer.css +23 -12
- package/dist/assets/channel-Dx9OTBrx.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-Da4s894j.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY--H9NrCfO.js +0 -1
- package/dist/assets/index-DBGHN_5E.js +0 -624
- package/dist/assets/stateDiagram-v2-MP3YSRHH-B2DcVJGG.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-DO_W2uN2.js +0 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isModernProfile, isTitleFirstProfile } from '@locus-forge/locus-draw/source';
|
|
2
2
|
import { mappingVersionForView } from '../contract/documentVersions.js';
|
|
3
|
-
import { handwrittenElement, hasHandwrittenText } from '@locus-forge/locus-draw/scene';
|
|
3
|
+
import { handwrittenElement, hasHandwrittenText, presentation as drawPresentation } from '@locus-forge/locus-draw/scene';
|
|
4
4
|
import { inspectPresentation } from '@locus-forge/locus-draw/geometry';
|
|
5
|
-
import { toDrawInput,decodeDrawSnapshot } from './drawProjection.js';
|
|
5
|
+
import { toDrawInput, decodeDrawSnapshot } from './drawProjection.js';
|
|
6
6
|
import { ARCHIMATE_PROFILE, archimateModelDiagnostics } from '../contract/archimateNotation.js';
|
|
7
7
|
import { STRUCTURE_PROFILE, SCENARIO_PROFILE, structureRoleDiagnostics, scenarioRoleDiagnostics } from '../contract/presentationProfile.js';
|
|
8
8
|
import { isDiagramPresentationProfile, relationPresentation } from '../contract/diagramPresentation.js';
|
|
@@ -23,7 +23,7 @@ import { layoutModel, legacyCe6cadaGuideWidth, nodeSize } from './layout.js';
|
|
|
23
23
|
import { containsBox, firstPointY, inspectCueLayout } from './layoutDiagnostics.js';
|
|
24
24
|
import { createGuideSkeleton, guideTextSource, isGuideElement, legacyCe6cadaOriginalText, nodeGroupId, nodeShape, presentationStyle } from './presentation.js';
|
|
25
25
|
import { parseAndValidate } from '../contract/index.js';
|
|
26
|
-
import { areaSceneParts, areaStyle } from './areas.js';
|
|
26
|
+
import { areaElementId, areaSceneParts, areaStyle } from './areas.js';
|
|
27
27
|
import { legendReferencedNodeIds, legendReferencedRelationIds, protectedSceneParts, sceneCardHatches, verifiedNodeGroupTranslation } from './page.js';
|
|
28
28
|
import { edgeGroupId, relationLabelText } from './relationLabels.js';
|
|
29
29
|
import { routeEntersBox } from './routeGeometry.js';
|
|
@@ -38,6 +38,8 @@ export { SEMANTIC_MAPPING_VERSION } from '../contract/documentVersions.js';
|
|
|
38
38
|
const MAPPING_KEYS = ['kind', 'modelId', 'role', 'semanticId', 'version'];
|
|
39
39
|
const NODE_ROLES = new Set(['shape', 'lifeline', 'name', 'type', 'tag', 'technology', 'responsibility', 'badge', 'outcome', 'outcome-rule', 'claim', 'icon-body', 'icon-detail', 'icon-tab', 'card-fold', 'badge-shape', 'icon-image', 'icon-badge', 'card-outline', 'card-cap', 'tag-shape', 'external']);
|
|
40
40
|
const EDGE_ROLES = new Set(['arrow', 'label', 'label-mask']);
|
|
41
|
+
const AREA_HEADER_ROLES = new Set(['area-title', 'area-subtitle', 'area-note']);
|
|
42
|
+
const MAX_GRID_GAP = 240;
|
|
41
43
|
const TIER_ROLES = ['type', 'tag', 'name', 'technology', 'responsibility', 'badge', 'outcome', 'claim', 'external'];
|
|
42
44
|
const ICON_ROLES = ['icon-body', 'icon-detail', 'icon-tab', 'card-fold', 'badge-shape', 'icon-image', 'icon-badge', 'card-outline', 'card-cap', 'tag-shape', 'outcome-rule'];
|
|
43
45
|
const active = element => element && !element.isDeleted;
|
|
@@ -461,9 +463,113 @@ export function inspectSavedSemanticScene(model, sceneOrElements, {
|
|
|
461
463
|
return active(element) && ['rectangle', 'diamond', 'ellipse', 'line', 'freedraw'].includes(element.type)
|
|
462
464
|
&& paintOrder.get(element.id) < paintOrder.get(text.id) && paintedOpaqueFill(element) && containsBox(element, text);
|
|
463
465
|
}).at(-1)?.backgroundColor ?? sceneBackground;
|
|
466
|
+
const collectAreaRowBounds = (areas, rootArea, cells) => {
|
|
467
|
+
const areaIds = new Set([rootArea?.id]);
|
|
468
|
+
const members = new Set(rootArea?.nodeIds ?? []);
|
|
469
|
+
const queue = [rootArea?.id];
|
|
470
|
+
while (queue.length) {
|
|
471
|
+
const currentId = queue.shift();
|
|
472
|
+
for (const candidate of areas) {
|
|
473
|
+
if (candidate?.parentId !== currentId || areaIds.has(candidate.id)) continue;
|
|
474
|
+
areaIds.add(candidate.id);
|
|
475
|
+
queue.push(candidate.id);
|
|
476
|
+
for (const nodeId of candidate.nodeIds ?? []) members.add(nodeId);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
let minRow = Infinity;
|
|
480
|
+
let maxRow = -Infinity;
|
|
481
|
+
for (const nodeId of members) {
|
|
482
|
+
const cell = cells?.[nodeId];
|
|
483
|
+
if (Array.isArray(cell) && Number.isFinite(cell[0])) {
|
|
484
|
+
minRow = Math.min(minRow, cell[0]);
|
|
485
|
+
maxRow = Math.max(maxRow, cell[0]);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
for (const note of model.page?.notes ?? []) {
|
|
489
|
+
if (areaIds.has(note?.area) && Array.isArray(note.cell) && Number.isFinite(note.cell[0])) {
|
|
490
|
+
minRow = Math.min(minRow, note.cell[0]);
|
|
491
|
+
maxRow = Math.max(maxRow, note.cell[0]);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return { minRow, maxRow };
|
|
495
|
+
};
|
|
496
|
+
let cachedEffectiveVerticalGap;
|
|
497
|
+
const effectiveVerticalGap = () => {
|
|
498
|
+
if (cachedEffectiveVerticalGap !== undefined) return cachedEffectiveVerticalGap;
|
|
499
|
+
if (Number.isFinite(model.layout?.grid?.gap?.[1])) {
|
|
500
|
+
cachedEffectiveVerticalGap = model.layout.grid.gap[1];
|
|
501
|
+
return cachedEffectiveVerticalGap;
|
|
502
|
+
}
|
|
503
|
+
try {
|
|
504
|
+
const sizes = new Map(model.nodes.map(node => [node.id, nodeSize(node, family, false, template)]));
|
|
505
|
+
const drawModel = { ...toDrawInput(model, { template, includeGuide: false }), presentationProfile: model.presentationProfile };
|
|
506
|
+
const resolved = drawPresentation.resolveGridLayout(drawModel, sizes);
|
|
507
|
+
if (Number.isFinite(resolved?.gap?.[1])) {
|
|
508
|
+
cachedEffectiveVerticalGap = resolved.gap[1];
|
|
509
|
+
return cachedEffectiveVerticalGap;
|
|
510
|
+
}
|
|
511
|
+
} catch { /* Fall back to profile default when grid layout cannot be resolved. */ }
|
|
512
|
+
cachedEffectiveVerticalGap = template.id === 'c4-reference-v1' ? 80 : 64;
|
|
513
|
+
return cachedEffectiveVerticalGap;
|
|
514
|
+
};
|
|
515
|
+
const gridAreaCollisionHint = (element, role, cover) => {
|
|
516
|
+
if (!AREA_HEADER_ROLES.has(role) || model.layout?.mode !== 'grid') return '';
|
|
517
|
+
const coverMapping = cover?.customData?.locusMap;
|
|
518
|
+
const isNodeCover = coverMapping?.kind === 'node' && coverMapping.role === 'shape';
|
|
519
|
+
const isAreaCover = coverMapping?.kind === 'page' && coverMapping.role === 'area-shape';
|
|
520
|
+
if (!isNodeCover && !isAreaCover) return '';
|
|
521
|
+
const cells = model.layout?.grid?.cells;
|
|
522
|
+
const area = protectedParts.get(element.id)?.area;
|
|
523
|
+
if (!area) return '';
|
|
524
|
+
const areas = Array.isArray(model.layout?.areas) ? model.layout.areas : [];
|
|
525
|
+
const areasById = new Map(areas.map(item => [item.id, item]));
|
|
526
|
+
const areaAncestors = new Set();
|
|
527
|
+
for (let cursor = area; cursor && !areaAncestors.has(cursor.id); cursor = areasById.get(cursor.parentId)) {
|
|
528
|
+
areaAncestors.add(cursor.id);
|
|
529
|
+
}
|
|
530
|
+
const { minRow: areaMinRow } = collectAreaRowBounds(areas, area, cells);
|
|
531
|
+
if (!Number.isFinite(areaMinRow)) return '';
|
|
532
|
+
let coverRow = -Infinity;
|
|
533
|
+
let coverArea;
|
|
534
|
+
if (isNodeCover) {
|
|
535
|
+
const coverCell = cells?.[coverMapping.semanticId];
|
|
536
|
+
if (!Array.isArray(coverCell) || !Number.isFinite(coverCell[0])) return '';
|
|
537
|
+
coverRow = coverCell[0];
|
|
538
|
+
coverArea = areas.find(candidate => candidate.nodeIds?.includes(coverMapping.semanticId));
|
|
539
|
+
} else {
|
|
540
|
+
coverArea = protectedParts.get(cover.id)?.area;
|
|
541
|
+
if (!coverArea || areaAncestors.has(coverArea.id)) return '';
|
|
542
|
+
coverRow = collectAreaRowBounds(areas, coverArea, cells).maxRow;
|
|
543
|
+
}
|
|
544
|
+
if (!(coverRow < areaMinRow)) return '';
|
|
545
|
+
const coverBottom = cover.y + cover.height;
|
|
546
|
+
if (!Number.isFinite(coverBottom)) return '';
|
|
547
|
+
const areaShape = byId.get(areaElementId(model, area.id, 'shape'));
|
|
548
|
+
if (!active(areaShape) || !Number.isFinite(areaShape.y)) {
|
|
549
|
+
return ` (grid row collision above area "${area.id}": separate the areas across rows)`;
|
|
550
|
+
}
|
|
551
|
+
const areaTop = areaShape.y;
|
|
552
|
+
let requiredIncrease = (coverBottom - areaTop) / (areaMinRow - coverRow);
|
|
553
|
+
for (let cursor = coverArea; cursor; cursor = areasById.get(cursor.parentId)) {
|
|
554
|
+
if (areaAncestors.has(cursor.id)) break;
|
|
555
|
+
const { maxRow: upperMaxRow } = collectAreaRowBounds(areas, cursor, cells);
|
|
556
|
+
if (!(upperMaxRow < areaMinRow)) continue;
|
|
557
|
+
const upperShape = byId.get(areaElementId(model, cursor.id, 'shape'));
|
|
558
|
+
if (active(upperShape) && Number.isFinite(upperShape.y) && Number.isFinite(upperShape.height)) {
|
|
559
|
+
requiredIncrease = Math.max(requiredIncrease, (upperShape.y + upperShape.height - areaTop) / (areaMinRow - upperMaxRow));
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
if (!(requiredIncrease > 0)) return '';
|
|
563
|
+
const minGap = Math.ceil(effectiveVerticalGap() + requiredIncrease);
|
|
564
|
+
if (minGap > MAX_GRID_GAP) {
|
|
565
|
+
return ` (grid row collision above area "${area.id}": separate the areas across rows; required vertical gap exceeds the ${MAX_GRID_GAP} px grid limit)`;
|
|
566
|
+
}
|
|
567
|
+
return ` (grid row collision above area "${area.id}": increase layout.grid.gap[1] to at least ${minGap} px, or separate the areas across rows)`;
|
|
568
|
+
};
|
|
464
569
|
if (isDiagramPresentationProfile(template.id)) {
|
|
465
570
|
const opaqueCovers = elements.filter(element => active(element) && paintedOpaqueFill(element)
|
|
466
571
|
&& ['rectangle', 'diamond', 'ellipse', 'line', 'freedraw'].includes(element.type));
|
|
572
|
+
const hintedPageElements = new Set();
|
|
467
573
|
for (const element of elements) {
|
|
468
574
|
const owner = element?.customData?.locusMap;
|
|
469
575
|
if (!active(element) || !owner || owner.kind === 'page' && !protectedParts.has(element.id)
|
|
@@ -476,9 +582,11 @@ export function inspectSavedSemanticScene(model, sceneOrElements, {
|
|
|
476
582
|
? boxesOverlap(candidate, { ...element, width: Math.max(1, element.width), height: Math.max(1, element.height) }, 0)
|
|
477
583
|
: containsBox(candidate, element)));
|
|
478
584
|
if (!cover) continue;
|
|
585
|
+
const hint = owner.kind === 'page' ? gridAreaCollisionHint(element, owner.role, cover) : '';
|
|
586
|
+
if (hint) hintedPageElements.add(element.id);
|
|
479
587
|
report(owner.kind === 'node' ? 'NODE_PART_HIDDEN' : owner.kind === 'page' ? 'PAGE_PART_HIDDEN'
|
|
480
588
|
: owner.role === 'arrow' ? 'EDGE_HIDDEN' : 'EDGE_LABEL_HIDDEN', element,
|
|
481
|
-
`Protected ${owner.kind} role ${owner.role} is fully painted behind opaque shape ${cover.id}
|
|
589
|
+
`Protected ${owner.kind} role ${owner.role} is fully painted behind opaque shape ${cover.id}.${hint}`);
|
|
482
590
|
}
|
|
483
591
|
for (const [id, part] of protectedParts) {
|
|
484
592
|
if (!part.mapped) continue;
|
|
@@ -490,7 +598,12 @@ export function inspectSavedSemanticScene(model, sceneOrElements, {
|
|
|
490
598
|
&& paintOrder.get(candidate.id) > paintOrder.get(element.id)
|
|
491
599
|
&& ((paintedObscuringFill(candidate) && (element.type === 'text' ? boxesOverlap(candidate, element) : containsBox(candidate, element)))
|
|
492
600
|
|| (element.type === 'text' ? strokeObscuresText(candidate, element) : strokeCoversBox(candidate, element))));
|
|
493
|
-
if (cover)
|
|
601
|
+
if (cover) {
|
|
602
|
+
const hint = !hintedPageElements.has(element.id) && paintedObscuringFill(cover)
|
|
603
|
+
? gridAreaCollisionHint(element, part.role, cover)
|
|
604
|
+
: '';
|
|
605
|
+
report('PAGE_PART_HIDDEN', element, `Protected page role ${part.role} is painted behind opaque shape or stroke ${cover.id}.${hint}`);
|
|
606
|
+
}
|
|
494
607
|
}
|
|
495
608
|
}
|
|
496
609
|
for (const node of model.nodes) {
|
|
@@ -34,12 +34,29 @@ function diagnosticsOf(error) {
|
|
|
34
34
|
path: String(row.path ?? '/'),
|
|
35
35
|
message: String(row.message ?? error.message),
|
|
36
36
|
...(row.severity === undefined ? {} : { severity: row.severity }),
|
|
37
|
+
...(row.viewId === undefined ? {} : { viewId: row.viewId }),
|
|
37
38
|
...(row.ids === undefined ? {} : { ids: row.ids }),
|
|
38
39
|
...(row.sourcePath === undefined ? {} : { sourcePath: row.sourcePath, line: row.line, column: row.column }),
|
|
39
40
|
}));
|
|
40
41
|
return [{ code: String(error?.code ?? 'BUILD_FAILED'), path: '/', message: String(error?.message ?? 'Build failed.') }];
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
function attributeChildFailure(error, name) {
|
|
45
|
+
const prefix = `/canvases/${name}`;
|
|
46
|
+
const diagnostics = diagnosticsOf(error).map(({ viewId, ...row }) => {
|
|
47
|
+
if (row.path === prefix || row.path.startsWith(`${prefix}/`)) return { ...row, severity: row.severity ?? 'error' };
|
|
48
|
+
const suffix = row.path !== '/' ? (row.path.startsWith('/') ? row.path : `/${row.path}`) : '';
|
|
49
|
+
const label = viewId ? `${name} · ${viewId}` : name;
|
|
50
|
+
return {
|
|
51
|
+
...row,
|
|
52
|
+
severity: row.severity ?? 'error',
|
|
53
|
+
path: `${prefix}${viewId ? `/views/${viewId}` : ''}${suffix}`,
|
|
54
|
+
message: row.message.startsWith(`[${name}`) ? row.message : `[${label}] ${row.message}`,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
return new MapAuthoringError(diagnostics);
|
|
58
|
+
}
|
|
59
|
+
|
|
43
60
|
const diagnosticCheck = diagnostic => ({
|
|
44
61
|
...diagnostic, severity: diagnostic.severity ?? 'error', passed: false,
|
|
45
62
|
ids: diagnostic.ids ?? [diagnostic.path], value: diagnostic.ids?.length ?? 1, limit: 0,
|
|
@@ -58,6 +75,41 @@ const mainPathMissing = checks => checks.some(row => row.code === 'MAIN_PATH_MIS
|
|
|
58
75
|
+ 'Declare LM_MainPath("entry ... result"), or record "Main path and roles: none — <reason>" in handoff.md for a view without one flow.',
|
|
59
76
|
}] : [];
|
|
60
77
|
|
|
78
|
+
const DETOUR_RULES = {
|
|
79
|
+
EDGE_ROUTE_DETOUR: {
|
|
80
|
+
defaultLimit: 4,
|
|
81
|
+
describe: (ratio, maxRatio, ids) => `Relation detour exceeds ${ratio}× direct distance `
|
|
82
|
+
+ `(max ${maxRatio}×; relations: ${ids}). `
|
|
83
|
+
+ 'Inspect the rendered route for an unnecessary outer detour or obstructing header text before publishing.',
|
|
84
|
+
},
|
|
85
|
+
ADJACENT_EDGE_DETOUR: {
|
|
86
|
+
defaultLimit: 2.5,
|
|
87
|
+
describe: (ratio, maxRatio, ids) => `Adjacent relation detour exceeds ${ratio}× card gap or abandoned facing sides `
|
|
88
|
+
+ `(max ${maxRatio}×; relations: ${ids}). `
|
|
89
|
+
+ 'Inspect ports and intervening headers/obstacles before publishing.',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** Surface excessive or adjacent route detours in diagnostics and stderr alongside MAIN_PATH_MISSING. */
|
|
94
|
+
export const routeDetours = checks => checks
|
|
95
|
+
.filter(row => Object.hasOwn(DETOUR_RULES, row.code) && !row.passed)
|
|
96
|
+
.map(row => {
|
|
97
|
+
const rule = DETOUR_RULES[row.code];
|
|
98
|
+
const ratio = row.limit?.maxRatio ?? rule.defaultLimit;
|
|
99
|
+
const maxRatio = row.value?.maxRatio ?? 'unknown';
|
|
100
|
+
const ids = row.ids?.length ? row.ids.join(', ') : 'unknown';
|
|
101
|
+
return {
|
|
102
|
+
code: row.code,
|
|
103
|
+
severity: 'warning',
|
|
104
|
+
path: row.ids?.length === 1 ? `/relations/${row.ids[0]}` : '/relations',
|
|
105
|
+
ids: row.ids ?? [],
|
|
106
|
+
message: rule.describe(ratio, maxRatio, ids),
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const hasDiagnostic = (list, code, ids) => list.some(item =>
|
|
111
|
+
item.code === code && (ids === undefined || isDeepStrictEqual(item.ids, ids)));
|
|
112
|
+
|
|
61
113
|
// A project generator can supply its emitted JSON in memory while sourcePath still identifies the input.
|
|
62
114
|
export async function buildDiagram({ sourcePath, sourceText: emittedSource, outputDir, style, handwrittenCardFill, multiScreen = false, citationBindings, detailsFilesPath, chromiumPath, chromiumSource = 'api', timeoutMs = 90_000 }, {
|
|
63
115
|
browserBuilder = runBrowserBuild,
|
|
@@ -84,7 +136,29 @@ export async function buildDiagram({ sourcePath, sourceText: emittedSource, outp
|
|
|
84
136
|
throw error;
|
|
85
137
|
}
|
|
86
138
|
let { model, chain } = compiled;
|
|
87
|
-
|
|
139
|
+
let browserResolution, selectedBrowser;
|
|
140
|
+
const ensureBrowser = () => browserResolution ??= Promise.resolve().then(async () => {
|
|
141
|
+
selectedBrowser = await browserResolver?.({ chromiumPath, source: chromiumSource });
|
|
142
|
+
return selectedBrowser;
|
|
143
|
+
});
|
|
144
|
+
const buildInBrowser = async (model, chain) => browserBuilder({
|
|
145
|
+
projectRoot, model, chain, staticDelivery: false, frameToViewport: true, style, handwrittenCardFill,
|
|
146
|
+
browser: await ensureBrowser(), chromiumPath, viewport: { width: 1600, height: 1000 }, timeoutMs,
|
|
147
|
+
});
|
|
148
|
+
const buildCanvas = async ({ name, model, chain }) => {
|
|
149
|
+
try {
|
|
150
|
+
const child = await buildInBrowser(model, chain);
|
|
151
|
+
admitBuiltDelivery(child, chain.views.map(view => view.id), { viewportFramed: true });
|
|
152
|
+
const errors = child.layoutDiagnostics.flatMap(row => row.diagnostics
|
|
153
|
+
.filter(item => item.code !== 'LABEL_NO_SLOT' && item.severity !== 'warning')
|
|
154
|
+
.map(item => ({ ...item, viewId: item.viewId ?? row.viewId, severity: item.severity ?? 'error' })));
|
|
155
|
+
if (errors.length) throw new MapAuthoringError(errors);
|
|
156
|
+
return { bundle: child.bundle };
|
|
157
|
+
} catch (error) {
|
|
158
|
+
throw attributeChildFailure(error, name);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const materials = detailsFilesPath === undefined ? undefined : await readDetailsFiles(detailsFilesPath, model, { deferCanvasBuilds: true });
|
|
88
162
|
const withReadingFiles = candidate => materials ? parseAndValidate({
|
|
89
163
|
...candidate, assets: { ...candidate.assets, ...materials.metadata }, reading: materials.reading,
|
|
90
164
|
}) : candidate;
|
|
@@ -96,7 +170,7 @@ export async function buildDiagram({ sourcePath, sourceText: emittedSource, outp
|
|
|
96
170
|
const stage = await createOutputStage(out);
|
|
97
171
|
|
|
98
172
|
const pngName = `${source.id}.png`, bundleName = `${source.id}.locus-map.json`;
|
|
99
|
-
let
|
|
173
|
+
let browser, imageBuffer, published = false, publishing = false, checkRows = [];
|
|
100
174
|
|
|
101
175
|
const publishFailure = async (error, existingChecks = []) => {
|
|
102
176
|
if (published) return;
|
|
@@ -122,19 +196,8 @@ export async function buildDiagram({ sourcePath, sourceText: emittedSource, outp
|
|
|
122
196
|
|
|
123
197
|
try {
|
|
124
198
|
if (emitSource) await writeFile(resolve(stage, 'source.map.json'), json(source));
|
|
125
|
-
|
|
126
|
-
browser = structuredClone(await
|
|
127
|
-
projectRoot,
|
|
128
|
-
model,
|
|
129
|
-
chain,
|
|
130
|
-
staticDelivery: false,
|
|
131
|
-
frameToViewport: true,
|
|
132
|
-
style, handwrittenCardFill,
|
|
133
|
-
browser: selectedBrowser,
|
|
134
|
-
chromiumPath,
|
|
135
|
-
viewport: { width: 1600, height: 1000 },
|
|
136
|
-
timeoutMs,
|
|
137
|
-
}));
|
|
199
|
+
if (materials?.pendingCanvases.length) await materials.buildPendingCanvases(buildCanvas);
|
|
200
|
+
browser = structuredClone(await buildInBrowser(model, chain));
|
|
138
201
|
const delivery = admitBuiltDelivery(browser, [viewId], { viewportFramed: true });
|
|
139
202
|
imageBuffer = delivery.imageBuffers[viewId];
|
|
140
203
|
const officialBrowser = delivery.reportedOfficial && browserBuilder === runBrowserBuild && browserRestorer === runBrowserRestore;
|
|
@@ -167,9 +230,11 @@ export async function buildDiagram({ sourcePath, sourceText: emittedSource, outp
|
|
|
167
230
|
]);
|
|
168
231
|
}
|
|
169
232
|
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
233
|
+
const postCheckDiagnostics = [
|
|
234
|
+
...legendDiagnostics,
|
|
235
|
+
...mainPathMissing(evaluation.checks),
|
|
236
|
+
...routeDetours(evaluation.checks),
|
|
237
|
+
];
|
|
173
238
|
|
|
174
239
|
if (materials) {
|
|
175
240
|
const original = await loadChainBundle(browser.bundle);
|
|
@@ -179,6 +244,7 @@ export async function buildDiagram({ sourcePath, sourceText: emittedSource, outp
|
|
|
179
244
|
model = withReadingFiles(model);
|
|
180
245
|
browser.bundle = await saveChainBundle({
|
|
181
246
|
model, chain: original.chain, scenes: original.scenes, assets: new Map([...original.assets, ...materials.assets]),
|
|
247
|
+
...(materials.canvases.size && { canvases: materials.canvases }),
|
|
182
248
|
});
|
|
183
249
|
}
|
|
184
250
|
const stagedBundlePath = resolve(stage, bundleName);
|
|
@@ -203,6 +269,12 @@ export async function buildDiagram({ sourcePath, sourceText: emittedSource, outp
|
|
|
203
269
|
code: 'BROWSER_RESTORE_CHANGED', path: '/browser/restore', message: JSON.stringify(comparison.views.filter(item => !item.matches)),
|
|
204
270
|
}]);
|
|
205
271
|
|
|
272
|
+
// Defer warning emission until post-check restore succeeds so failures report each warning once via catch.
|
|
273
|
+
for (const diagnostic of postCheckDiagnostics) {
|
|
274
|
+
sourceDiagnostics.push(diagnostic);
|
|
275
|
+
onDiagnostic(diagnostic);
|
|
276
|
+
}
|
|
277
|
+
|
|
206
278
|
evaluation.checks.push(
|
|
207
279
|
{ code: 'SEMANTIC_ADMISSION', severity: 'error', passed: true, ids: [viewId], value: true, limit: true },
|
|
208
280
|
{ code: 'BUNDLE_READBACK', severity: 'error', passed: true, ids: [viewId], value: true, limit: true },
|
|
@@ -238,7 +310,15 @@ export async function buildDiagram({ sourcePath, sourceText: emittedSource, outp
|
|
|
238
310
|
// Once at the final boundary: routing attempts may each fail, but the missing path is one fact.
|
|
239
311
|
const missing = mainPathMissing(checkRows);
|
|
240
312
|
if (!published && missing.length && Array.isArray(error?.diagnostics)
|
|
241
|
-
&& !
|
|
313
|
+
&& !hasDiagnostic(sourceDiagnostics, 'MAIN_PATH_MISSING')
|
|
314
|
+
&& !hasDiagnostic(error.diagnostics, 'MAIN_PATH_MISSING')) error.diagnostics.push(...missing);
|
|
315
|
+
for (const detour of routeDetours(checkRows)) {
|
|
316
|
+
if (!published && Array.isArray(error?.diagnostics)
|
|
317
|
+
&& !hasDiagnostic(sourceDiagnostics, detour.code, detour.ids)
|
|
318
|
+
&& !hasDiagnostic(error.diagnostics, detour.code, detour.ids)) {
|
|
319
|
+
error.diagnostics.push(detour);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
242
322
|
if (!publishing && !published) await publishFailure(error);
|
|
243
323
|
throw error;
|
|
244
324
|
} finally {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Build-time .mjs sources run as trusted code in a Node subprocess with the builder's permissions.
|
|
2
|
+
import { writeSync } from 'node:fs';
|
|
3
|
+
import { BUNDLE_LIMITS } from '../bundle/safety.js';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { registerHooks } from 'node:module';
|
|
6
|
+
import { sourcePrimitives } from './sourceView.js';
|
|
7
|
+
|
|
8
|
+
const chunks = [];
|
|
9
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
10
|
+
const { source } = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
11
|
+
const filePath = process.argv[2];
|
|
12
|
+
const url = pathToFileURL(filePath).href;
|
|
13
|
+
process.argv = [process.execPath, filePath];
|
|
14
|
+
registerHooks({
|
|
15
|
+
resolve(specifier, context, next) {
|
|
16
|
+
return specifier === url ? { url, shortCircuit: true } : next(specifier, context);
|
|
17
|
+
},
|
|
18
|
+
load(target, context, next) {
|
|
19
|
+
return target === url ? { format: 'module', source, shortCircuit: true } : next(target, context);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const pauseBuffer = new Int32Array(new SharedArrayBuffer(4));
|
|
23
|
+
const output = [];
|
|
24
|
+
let stdoutBytes = 0;
|
|
25
|
+
let overflowed = false;
|
|
26
|
+
let emitted = false;
|
|
27
|
+
let hasExport = false;
|
|
28
|
+
let exportResult;
|
|
29
|
+
const limitError = () => {
|
|
30
|
+
overflowed = true;
|
|
31
|
+
return new Error('Canvas source stdout exceeds the size limit.');
|
|
32
|
+
};
|
|
33
|
+
function writeAllSync(fd, data) {
|
|
34
|
+
let offset = 0;
|
|
35
|
+
while (offset < data.length) {
|
|
36
|
+
try { offset += writeSync(fd, data, offset, data.length - offset); }
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (error.code === 'EAGAIN') { Atomics.wait(pauseBuffer, 0, 0, 1); continue; }
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const emitSync = payload => writeAllSync(1, Buffer.from(JSON.stringify(payload), 'utf8'));
|
|
44
|
+
const writeStderrSync = text => writeAllSync(2, Buffer.from(text, 'utf8'));
|
|
45
|
+
process.stdout.write = (chunk, encoding, cb) => {
|
|
46
|
+
const callback = typeof encoding === 'function' ? encoding : cb;
|
|
47
|
+
const charset = typeof encoding === 'string' ? encoding : undefined;
|
|
48
|
+
const bytes = typeof chunk === 'string' ? Buffer.from(chunk, charset) : Buffer.from(chunk);
|
|
49
|
+
stdoutBytes += bytes.byteLength;
|
|
50
|
+
if (stdoutBytes > BUNDLE_LIMITS.bundleBytes) throw limitError();
|
|
51
|
+
if (bytes.byteLength) output.push(bytes);
|
|
52
|
+
callback?.();
|
|
53
|
+
return true;
|
|
54
|
+
};
|
|
55
|
+
function finalize(code) {
|
|
56
|
+
const effectiveCode = process.exitCode !== undefined ? Number(process.exitCode) : code;
|
|
57
|
+
if (emitted || code !== 0 || effectiveCode !== 0) return;
|
|
58
|
+
if (overflowed) {
|
|
59
|
+
writeStderrSync('Canvas source stdout exceeds the size limit.\n');
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
if (hasExport) {
|
|
65
|
+
emitted = true;
|
|
66
|
+
emitSync(exportResult);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const text = new TextDecoder('utf-8', { fatal: true }).decode(Buffer.concat(output));
|
|
70
|
+
if (!text.trim()) {
|
|
71
|
+
writeStderrSync('Canvas source module must export a diagram source or write schema-v1 JSON to stdout.\n');
|
|
72
|
+
process.exitCode = 1;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
emitted = true;
|
|
76
|
+
emitSync({ mode: 'cli', text });
|
|
77
|
+
} catch (error) {
|
|
78
|
+
writeStderrSync(`${error?.message || error}\n`);
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const rawEmit = process.emit.bind(process);
|
|
83
|
+
process.emit = (event, ...args) => {
|
|
84
|
+
const result = rawEmit(event, ...args);
|
|
85
|
+
if (event === 'exit') finalize(args[0]);
|
|
86
|
+
return result;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const mod = await import(url);
|
|
90
|
+
const plain = value => value && [Object.prototype, null].includes(Object.getPrototypeOf(value));
|
|
91
|
+
const author = typeof mod.default === 'function' || plain(mod.default) ? mod.default : mod.diagram ?? mod.source;
|
|
92
|
+
if (author !== undefined) {
|
|
93
|
+
exportResult = { mode: 'export', source: typeof author === 'function' ? await author(sourcePrimitives) : author };
|
|
94
|
+
hasExport = true;
|
|
95
|
+
}
|
|
96
|
+
if (stdoutBytes > BUNDLE_LIMITS.bundleBytes) throw limitError();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { execFileBounded } from './boundedProcess.mjs';
|
|
3
|
+
import { compileDiagramSource, parseDiagramSourceText, validateDiagramSource } from './diagramSource.js';
|
|
4
|
+
import { parsePlantumlSource } from './plantumlSource.js';
|
|
5
|
+
import { locatePlantumlDiagnostics } from './plantumlSyntax.js';
|
|
6
|
+
import { MapAuthoringError } from './mapAuthoring.js';
|
|
7
|
+
import { BUNDLE_LIMITS } from '../bundle/safety.js';
|
|
8
|
+
|
|
9
|
+
const worker = fileURLToPath(new URL('./canvas-source-worker.mjs', import.meta.url));
|
|
10
|
+
const bounds = { timeoutMs: 20_000, maxBuffer: 16 * 1024 * 1024 };
|
|
11
|
+
|
|
12
|
+
export async function compileCanvasSourceFile({ filePath, bytes, sourceFormat }) {
|
|
13
|
+
let imported;
|
|
14
|
+
try {
|
|
15
|
+
if (bytes.byteLength > BUNDLE_LIMITS.bundleBytes) throw new Error('Canvas source exceeds the size limit.');
|
|
16
|
+
const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
17
|
+
let source;
|
|
18
|
+
if (sourceFormat === 'mjs') {
|
|
19
|
+
// Execute the admitted bytes once as trusted code in a Node subprocess with the builder's permissions.
|
|
20
|
+
const { stdout } = await execFileBounded(process.execPath, [worker, filePath], {
|
|
21
|
+
...bounds, input: JSON.stringify({ source: text }),
|
|
22
|
+
});
|
|
23
|
+
if (!stdout.trim()) throw new Error('Canvas source module must export a diagram source or write schema-v1 JSON to stdout.');
|
|
24
|
+
const result = JSON.parse(stdout);
|
|
25
|
+
if (result?.mode === 'cli') source = parseDiagramSourceText(result.text);
|
|
26
|
+
else if (result?.mode === 'export') source = validateDiagramSource(result.source);
|
|
27
|
+
else throw new Error('Invalid canvas source worker result.');
|
|
28
|
+
} else if (sourceFormat === 'puml') {
|
|
29
|
+
imported = parsePlantumlSource(text, { sourcePath: filePath });
|
|
30
|
+
source = imported.source;
|
|
31
|
+
} else if (sourceFormat === 'map-json') {
|
|
32
|
+
source = parseDiagramSourceText(text);
|
|
33
|
+
} else throw new Error('Unsupported canvas source format.');
|
|
34
|
+
const { model, chain } = compileDiagramSource(source);
|
|
35
|
+
return { sourceFormat, source, model, chain, title: source.title || model.title };
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (imported && error.diagnostics) throw new MapAuthoringError(locatePlantumlDiagnostics(error.diagnostics, imported.locations, filePath));
|
|
38
|
+
if (error instanceof MapAuthoringError) throw error;
|
|
39
|
+
throw new MapAuthoringError([{ code: 'INVALID_DETAILS_FILE', path: filePath, message: error.stderr?.trim() || error.message }]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { presentation as drawPresentation } from '@locus-forge/locus-draw/scene';
|
|
1
2
|
import { isModernProfile } from '@locus-forge/locus-draw/source';
|
|
2
3
|
import { inspectDiagramLayout } from './diagramLayoutChecks.js';
|
|
3
|
-
import { inspectAreaLayout, ROUTE_DETOUR_WARN_RATIO } from '../adapter/areas.js';
|
|
4
|
+
import { ADJACENT_DETOUR_WARN_RATIO, inspectAreaLayout, ROUTE_DETOUR_WARN_RATIO } from '../adapter/areas.js';
|
|
4
5
|
import { inspectPageLayout } from '../adapter/page.js';
|
|
6
|
+
import { savedCardTemplate, supportedCardPresentation } from '../adapter/cards/template.js';
|
|
5
7
|
import { C4_REFERENCE_PROFILE, isDiagramPresentationProfile, isEditorialPresentationProfile, relationPresentation } from '../contract/diagramPresentation.js';
|
|
6
8
|
|
|
7
9
|
export const DIAGRAM_READABILITY = Object.freeze({
|
|
@@ -88,6 +90,124 @@ function conditionInLabel(edge) {
|
|
|
88
90
|
return pattern.test(normalizedConditionText(edge.label ?? ''));
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
const TITLE_ORPHAN_LINE_RATIO = 0.35;
|
|
94
|
+
const TITLE_SINGLE_WORD_BALANCE_RATIO = 0.55;
|
|
95
|
+
const TITLE_NAME_ROLES = new Set(['name', 'label']);
|
|
96
|
+
const COMPOSITE_CARD_ROLES = new Set(['card-outline', 'card-fold', 'card-cap']);
|
|
97
|
+
|
|
98
|
+
function profileWiderCardOption(profile) {
|
|
99
|
+
if (!profile || !supportedCardPresentation(profile)) return null;
|
|
100
|
+
const template = savedCardTemplate(profile);
|
|
101
|
+
const baseWidth = template?.card?.width;
|
|
102
|
+
if (!Number.isFinite(baseWidth)) return null;
|
|
103
|
+
if (Number.isFinite(template?.extraWide?.width) && template.extraWide.width > baseWidth) {
|
|
104
|
+
return { size: 'extra-wide', width: template.extraWide.width };
|
|
105
|
+
}
|
|
106
|
+
if (Number.isFinite(template?.card?.wideWidth) && template.card.wideWidth > baseWidth) {
|
|
107
|
+
return { size: 'wide', width: template.card.wideWidth };
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Flag awkward automatic title wraps without nagging over intentional breaks or balanced two-line titles. */
|
|
113
|
+
export function inspectTitleWraps(model, scene) {
|
|
114
|
+
const elements = Array.isArray(scene?.elements) ? scene.elements : [];
|
|
115
|
+
const shapesById = new Map();
|
|
116
|
+
const compositeIds = new Set();
|
|
117
|
+
const outlinesById = new Map();
|
|
118
|
+
const foldsById = new Set();
|
|
119
|
+
const glyphIds = new Set();
|
|
120
|
+
for (const element of elements) {
|
|
121
|
+
const mapping = element?.customData?.locusMap;
|
|
122
|
+
if (element?.isDeleted || mapping?.kind !== 'node') continue;
|
|
123
|
+
if (mapping.role === 'shape') shapesById.set(mapping.semanticId, element);
|
|
124
|
+
if (COMPOSITE_CARD_ROLES.has(mapping.role)) compositeIds.add(mapping.semanticId);
|
|
125
|
+
if (mapping.role === 'card-outline') outlinesById.set(mapping.semanticId, element);
|
|
126
|
+
if (mapping.role === 'card-fold') foldsById.add(mapping.semanticId);
|
|
127
|
+
if (typeof mapping.role === 'string' && mapping.role.startsWith('icon-')) glyphIds.add(mapping.semanticId);
|
|
128
|
+
}
|
|
129
|
+
const nodesById = new Map((model?.nodes ?? []).map(node => [node.id, node]));
|
|
130
|
+
const profile = model?.presentationProfile;
|
|
131
|
+
const widerOption = profileWiderCardOption(profile);
|
|
132
|
+
const templateCard = profile && supportedCardPresentation(profile) ? savedCardTemplate(profile)?.card : null;
|
|
133
|
+
const findings = [];
|
|
134
|
+
for (const element of elements) {
|
|
135
|
+
const mapping = element?.customData?.locusMap;
|
|
136
|
+
if (element?.type !== 'text' || element.isDeleted || mapping?.kind !== 'node' || !TITLE_NAME_ROLES.has(mapping.role)) continue;
|
|
137
|
+
if (typeof element.text !== 'string' || !Number.isFinite(element.fontSize) || element.fontSize <= 0) continue;
|
|
138
|
+
const lines = element.text.replace(/\r\n?/gu, '\n').split('\n').map(line => line.trim()).filter(Boolean);
|
|
139
|
+
if (lines.length <= 1) continue;
|
|
140
|
+
const modelNode = nodesById.get(mapping.semanticId);
|
|
141
|
+
const explicitBreak = (typeof modelNode?.label === 'string' && /[\r\n]/u.test(modelNode.label))
|
|
142
|
+
|| (typeof element.originalText === 'string' && /[\r\n]/u.test(element.originalText));
|
|
143
|
+
if (explicitBreak) continue;
|
|
144
|
+
|
|
145
|
+
const rawSingleLine = typeof element.originalText === 'string' && element.originalText.trim()
|
|
146
|
+
? element.originalText
|
|
147
|
+
: typeof modelNode?.label === 'string' && modelNode.label.trim()
|
|
148
|
+
? modelNode.label
|
|
149
|
+
: lines.join(' ');
|
|
150
|
+
const singleLineText = rawSingleLine.replace(/\s+/gu, ' ').trim();
|
|
151
|
+
const singleLineWidth = drawPresentation.renderedTextWidth(singleLineText, element.fontSize, element.fontFamily);
|
|
152
|
+
const lineWidths = lines.map(line => drawPresentation.renderedTextWidth(line, element.fontSize, element.fontFamily));
|
|
153
|
+
const firstLineWidth = Math.max(1, lineWidths[0] ?? 0);
|
|
154
|
+
const lastLine = lines.at(-1) ?? '';
|
|
155
|
+
const lastLineWords = lastLine ? lastLine.split(/\s+/u) : [];
|
|
156
|
+
const lastLineWidth = lineWidths.at(-1) ?? 0;
|
|
157
|
+
|
|
158
|
+
const shape = shapesById.get(mapping.semanticId);
|
|
159
|
+
const cardWidth = Number.isFinite(shape?.width) ? shape.width : null;
|
|
160
|
+
let recoveredSlotWidth = 0;
|
|
161
|
+
const needsSlotRecovery = (element.textAlign === 'center' && drawPresentation.isTitleFirstProfile(profile))
|
|
162
|
+
|| (Boolean(profile) && !isDiagramPresentationProfile(profile));
|
|
163
|
+
if (needsSlotRecovery && cardWidth !== null && templateCard && Number.isFinite(templateCard.padding)) {
|
|
164
|
+
const cut = Math.min(24, cardWidth * 0.12);
|
|
165
|
+
const outline = outlinesById.get(mapping.semanticId);
|
|
166
|
+
const hasFold = foldsById.has(mapping.semanticId);
|
|
167
|
+
const isHexagon = Boolean(outline && Number.isFinite(shape?.x) && outline.x > shape.x + 0.5);
|
|
168
|
+
const iconSpace = glyphIds.has(mapping.semanticId) && Number.isFinite(templateCard.glyphSize)
|
|
169
|
+
? templateCard.glyphSize + (templateCard.glyphGap ?? 0)
|
|
170
|
+
: 0;
|
|
171
|
+
recoveredSlotWidth = Math.max(0, cardWidth - 2 * (templateCard.padding + (isHexagon ? cut : 0)) - (hasFold ? cut : 0) - iconSpace);
|
|
172
|
+
}
|
|
173
|
+
const allocatedWidth = Math.max(
|
|
174
|
+
Number.isFinite(element.width) && element.width > 0 ? element.width : 0,
|
|
175
|
+
recoveredSlotWidth,
|
|
176
|
+
firstLineWidth,
|
|
177
|
+
);
|
|
178
|
+
const extraWidthPx = Math.max(1, Math.ceil(singleLineWidth - allocatedWidth));
|
|
179
|
+
|
|
180
|
+
const isStandardRect = shape?.type === 'rectangle'
|
|
181
|
+
&& shape.strokeColor !== 'transparent'
|
|
182
|
+
&& !compositeIds.has(mapping.semanticId);
|
|
183
|
+
const hasWiderOption = Boolean(widerOption && isStandardRect && cardWidth !== null && widerOption.width > cardWidth + 1);
|
|
184
|
+
const widerSizeFits = hasWiderOption && extraWidthPx <= widerOption.width - cardWidth;
|
|
185
|
+
|
|
186
|
+
const referenceWidth = Math.max(allocatedWidth, firstLineWidth);
|
|
187
|
+
const slotRatio = lastLineWidth / referenceWidth;
|
|
188
|
+
const singleWordOrphan = lastLineWords.length === 1
|
|
189
|
+
&& lastLineWidth / firstLineWidth < TITLE_SINGLE_WORD_BALANCE_RATIO;
|
|
190
|
+
|
|
191
|
+
const reasons = [];
|
|
192
|
+
if (lines.length >= 3) reasons.push('many-lines');
|
|
193
|
+
if (lines.length === 2 && widerSizeFits) reasons.push('wider-size-fits');
|
|
194
|
+
if (lines.length === 2 && (singleWordOrphan || slotRatio < TITLE_ORPHAN_LINE_RATIO)) {
|
|
195
|
+
reasons.push('orphan-wrap');
|
|
196
|
+
}
|
|
197
|
+
if (!reasons.length) continue;
|
|
198
|
+
|
|
199
|
+
findings.push({
|
|
200
|
+
id: mapping.semanticId,
|
|
201
|
+
lines: lines.length,
|
|
202
|
+
reasons,
|
|
203
|
+
cardWidth: cardWidth === null ? null : Math.round(cardWidth),
|
|
204
|
+
extraWidthPx,
|
|
205
|
+
...(hasWiderOption ? { suggestedSize: widerOption.size } : {}),
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return findings;
|
|
209
|
+
}
|
|
210
|
+
|
|
91
211
|
/** Fixed reader-facing checks over the official restored scene and browser measurements. */
|
|
92
212
|
export function evaluateDiagramChecks({ model, scene, browserMeasurement, layoutDiagnostics = [], officialBrowser, mainPath, multiScreen = false }) {
|
|
93
213
|
const checks = mainPathChecks(model, scene, mainPath);
|
|
@@ -120,6 +240,23 @@ export function evaluateDiagramChecks({ model, scene, browserMeasurement, layout
|
|
|
120
240
|
const overflows = browserMeasurement?.overflows ?? [];
|
|
121
241
|
checks.push(check('CARD_TEXT_OVERFLOW', 'error', overflows.length === 0, overflows.map(row => row.id), overflows.length, 0));
|
|
122
242
|
|
|
243
|
+
const titleWraps = inspectTitleWraps(model, scene);
|
|
244
|
+
checks.push({
|
|
245
|
+
...check(
|
|
246
|
+
'TITLE_WRAP_WARNING',
|
|
247
|
+
'warning',
|
|
248
|
+
titleWraps.length === 0,
|
|
249
|
+
titleWraps.map(row => row.id),
|
|
250
|
+
{
|
|
251
|
+
count: titleWraps.length,
|
|
252
|
+
maxLines: titleWraps.length ? Math.max(...titleWraps.map(row => row.lines)) : 1,
|
|
253
|
+
maxExtraWidthPx: titleWraps.length ? Math.max(...titleWraps.map(row => row.extraWidthPx)) : 0,
|
|
254
|
+
},
|
|
255
|
+
{ maxCount: 0 },
|
|
256
|
+
),
|
|
257
|
+
...(titleWraps.length ? { details: titleWraps } : {}),
|
|
258
|
+
});
|
|
259
|
+
|
|
123
260
|
if (isDiagramPresentationProfile(model.presentationProfile)) {
|
|
124
261
|
const missingDetails = [
|
|
125
262
|
...model.nodes.filter(node => node.technical?.external !== true && node.body === (node.technical?.responsibility ?? '')).map(node => node.id),
|
|
@@ -164,6 +301,11 @@ export function evaluateDiagramChecks({ model, scene, browserMeasurement, layout
|
|
|
164
301
|
checks.push(check('EDGE_ROUTE_DETOUR', 'warning', detours.length === 0, detours.flatMap(item => item.ids ?? []),
|
|
165
302
|
{ count: detours.length, maxRatio: detours.length ? Math.max(...detours.map(item => item.value)) : 0 },
|
|
166
303
|
{ maxRatio: ROUTE_DETOUR_WARN_RATIO }));
|
|
304
|
+
const adjacentDetours = areaDiagnostics.filter(item => item.code === 'ADJACENT_EDGE_DETOUR');
|
|
305
|
+
checks.push(check('ADJACENT_EDGE_DETOUR', 'warning', adjacentDetours.length === 0,
|
|
306
|
+
adjacentDetours.flatMap(item => item.ids ?? []),
|
|
307
|
+
{ count: adjacentDetours.length, maxRatio: adjacentDetours.length ? Math.max(...adjacentDetours.map(item => item.value)) : 0 },
|
|
308
|
+
{ maxRatio: adjacentDetours[0]?.limit ?? ADJACENT_DETOUR_WARN_RATIO }));
|
|
167
309
|
const pageCollisions = inspectPageLayout(model, scene.elements);
|
|
168
310
|
checks.push(check('PAGE_GRAPH_COLLISION', 'error', pageCollisions.length === 0,
|
|
169
311
|
pageCollisions.flatMap(item => item.ids ?? []), pageCollisions.length, 0));
|