@locus-forge/locus-map 0.2.0 → 0.2.2-dev.20261206.g5e970d2
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-JiCO6vo-.js} +1 -1
- package/dist/assets/{ar-SA-G6X2FPQ2-LY3czoz9.js → ar-SA-G6X2FPQ2-BdzEBmp3.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-BG9h9KRx.js → architectureDiagram-5GKGNRK7-D7T_vJwe.js} +1 -1
- package/dist/assets/{az-AZ-76LH7QW2-Brv6kuM6.js → az-AZ-76LH7QW2-BQ_SoVB7.js} +1 -1
- package/dist/assets/{bg-BG-XCXSNQG7-tsQwwvMW.js → bg-BG-XCXSNQG7-DlH1olUf.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-V9bUuR63.js → blockDiagram-I7D4REHJ-DPz0LEjY.js} +1 -1
- package/dist/assets/{bn-BD-2XOGV67Q-0Cou5nNv.js → bn-BD-2XOGV67Q-CFIZU06C.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-BmCtzbrY.js → c4Diagram-7LVT6UL2-B6uCi0Ol.js} +1 -1
- package/dist/assets/{ca-ES-6MX7JW3Y-pZF7WJUL.js → ca-ES-6MX7JW3Y-Bpe3kOti.js} +1 -1
- package/dist/assets/channel-DB3atv5o.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-D2iTDmHh.js → chunk-2Q5K7J3B-DTWRWhpx.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CTxdXZIx.js → chunk-5VM5RSS4-Dfr1HUAN.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-Hic1X1pm.js → chunk-F27PBJKO-D_IVoCIK.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-DhLW1JVb.js → chunk-IMKFNOWR-Boa_chn8.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-_g5twKlC.js → chunk-JWPE2WC7-RaK8jzc2.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-DMV4qmkd.js → chunk-POPQ4Y6H-D7xOpv6O.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-BWg83oEL.js → chunk-SVP7TREG-XvJsx1jt.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-CPmkpa7J.js → chunk-TICWLB2K-DZCVWmZG.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-KnXvIZ_8.js → chunk-XXDRQBXY-Djk-REAy.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-CzvsXoj_.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-HxwJpdPt.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-BChK_CGh.js → cose-bilkent-JH36ORCC-D6XaIbtG.js} +1 -1
- package/dist/assets/{cs-CZ-2BRQDIVT-CtAC2Qjy.js → cs-CZ-2BRQDIVT-BdzgSHdJ.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-CdsltaMX.js → cynefin-OW5HDTMX-BMTkMDG1.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-bXvXX3Fx.js → cynefinDiagram-5FMLGOSQ-C2s5i9h9.js} +1 -1
- package/dist/assets/{d3-scale-sM87TD1Z.js → d3-scale-BMIMKl27.js} +1 -1
- package/dist/assets/{da-DK-5WZEPLOC-DyWwaclV.js → da-DK-5WZEPLOC-Bj-GFWHU.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-CTmiZZVO.js → dagre-GXQ25YYZ-CMT8wlz0.js} +1 -1
- package/dist/assets/{de-DE-XR44H4JA-BDXUBHki.js → de-DE-XR44H4JA-JmpondAB.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-Bm8Fy0R_.js → diagram-S7CK7UJ4-DU1blS3M.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-BU_AmM_A.js → diagram-UQ7AKVKN-0lWi4KDV.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-B78LUoXq.js → diagram-VSXAHHWV-CrseWrhn.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-DNvWjMlf.js → diagram-VX7I27RA-C5BMS8Ql.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-DmFVt1fa.js → diagram-Z3DM3KII-Cc3vq6b8.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-CpDna0Jp.js → ebnfDiagram-PWID7BFC-ZF78imma.js} +1 -1
- package/dist/assets/{el-GR-BZB4AONW-CNhF7oN2.js → el-GR-BZB4AONW-BFslUpdm.js} +1 -1
- package/dist/assets/{engines-a8mi_N6S.js → engines-BtEtIBXt.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-BGD-9OAS.js → erDiagram-RLTQ6QDP-CjPjDn2i.js} +1 -1
- package/dist/assets/{es-ES-U4NZUMDT-DXMrJcKL.js → es-ES-U4NZUMDT-B0ezBTxQ.js} +1 -1
- package/dist/assets/{eu-ES-A7QVB2H4-BTkMEwMi.js → eu-ES-A7QVB2H4-DP_gx2kf.js} +1 -1
- package/dist/assets/{fa-IR-HGAKTJCU-CgkknSS7.js → fa-IR-HGAKTJCU-BuT1ELty.js} +1 -1
- package/dist/assets/{fi-FI-Z5N7JZ37-B1K83nId.js → fi-FI-Z5N7JZ37-BAu_Cj7n.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-CjU1yR1F.js → flowDiagram-HODETNUW-yqPGWNdd.js} +1 -1
- package/dist/assets/{fr-FR-RHASNOE6-CBFZBGMr.js → fr-FR-RHASNOE6-OF1CpgtN.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-bvb8BjSh.js → ganttDiagram-EL5Y4UJY-zUY5je2K.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-DZXQ_x8t.js → gitGraphDiagram-WWUBYQGX-oWrs7wy0.js} +1 -1
- package/dist/assets/{gl-ES-HMX3MZ6V-CON98Mma.js → gl-ES-HMX3MZ6V-CkJ47l98.js} +1 -1
- package/dist/assets/{he-IL-6SHJWFNN-CBoFaEdB.js → he-IL-6SHJWFNN-D7CecRlh.js} +1 -1
- package/dist/assets/{hi-IN-IWLTKZ5I-BJuoh3dl.js → hi-IN-IWLTKZ5I-CGlW2X-h.js} +1 -1
- package/dist/assets/{hu-HU-A5ZG7DT2-CQruu8XR.js → hu-HU-A5ZG7DT2-Dq_n_tbp.js} +1 -1
- package/dist/assets/{id-ID-SAP4L64H-VhaoENjR.js → id-ID-SAP4L64H-CotwO_06.js} +1 -1
- package/dist/assets/index-CdVc9Lmz.js +624 -0
- package/dist/assets/{index-CDNl17QJ.css → index-Cv-tTxNC.css} +1 -1
- package/dist/assets/{index-CboxqaL5.js → index-VaWCb9bx.js} +5 -5
- package/dist/assets/{infoDiagram-27XIBGKW-CM9Hap0f.js → infoDiagram-27XIBGKW-CYzIkNFW.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-i8pQztJI.js → ishikawaDiagram-5VMMS53U-DkgUsuk5.js} +1 -1
- package/dist/assets/{it-IT-JPQ66NNP-Dj9BkXfh.js → it-IT-JPQ66NNP-h97o81us.js} +1 -1
- package/dist/assets/{ja-JP-DBVTYXUO-CB2BlfIS.js → ja-JP-DBVTYXUO-M6EVfh0o.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-PxcdqONT.js → journeyDiagram-3NMN7TZE-CuKkNrJy.js} +1 -1
- package/dist/assets/{kaa-6HZHGXH3-CLnR_zY5.js → kaa-6HZHGXH3-DUy85zzz.js} +1 -1
- package/dist/assets/{kab-KAB-ZGHBKWFO-8TJr4nPf.js → kab-KAB-ZGHBKWFO-ChL-fKtk.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-B2p5NBhO.js → kanban-definition-UXKFOSKX-DkOxt3kf.js} +1 -1
- package/dist/assets/{kk-KZ-P5N5QNE5-5uZYjZ2e.js → kk-KZ-P5N5QNE5-DY6ucSGD.js} +1 -1
- package/dist/assets/{km-KH-HSX4SM5Z-D54aOpMd.js → km-KH-HSX4SM5Z-BAaS4014.js} +1 -1
- package/dist/assets/{ko-KR-MTYHY66A-Bnm0G6eo.js → ko-KR-MTYHY66A-D-r3mJ1R.js} +1 -1
- package/dist/assets/{ku-TR-6OUDTVRD-CtGCn_eB.js → ku-TR-6OUDTVRD-Dk1GCoOP.js} +1 -1
- package/dist/assets/{layout-BBV3_Svw.js → layout-DtNEGI4_.js} +1 -1
- package/dist/assets/{lt-LT-XHIRWOB4-Bl8G0yv6.js → lt-LT-XHIRWOB4-3Z2Ui1VZ.js} +1 -1
- package/dist/assets/{lv-LV-5QDEKY6T-Cax93Eua.js → lv-LV-5QDEKY6T-Bg59rOkR.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-CsOezwmE.js → mindmap-definition-YA3MSWOX-Dcs8eV7p.js} +1 -1
- package/dist/assets/{mr-IN-CRQNXWMA-Br7GVyJH.js → mr-IN-CRQNXWMA-DepTOG29.js} +1 -1
- package/dist/assets/{my-MM-5M5IBNSE-xC6lzTDV.js → my-MM-5M5IBNSE-4KqL4Tav.js} +1 -1
- package/dist/assets/{nb-NO-T6EIAALU-B0i5THqA.js → nb-NO-T6EIAALU-5YWO_l3W.js} +1 -1
- package/dist/assets/{nl-NL-IS3SIHDZ-CqYhUjP3.js → nl-NL-IS3SIHDZ-QlAndkM2.js} +1 -1
- package/dist/assets/{nn-NO-6E72VCQL-rpjr_9Z5.js → nn-NO-6E72VCQL-BscwhEDW.js} +1 -1
- package/dist/assets/{oc-FR-POXYY2M6-BlhQ99Ty.js → oc-FR-POXYY2M6-k7bYbSQj.js} +1 -1
- package/dist/assets/{pa-IN-N4M65BXN-N2XbQgZ_.js → pa-IN-N4M65BXN-jxBFwrWj.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-C2iSJgYQ.js → pegDiagram-XKGWAZYB-zM-VZA3r.js} +1 -1
- package/dist/assets/{pica-DvYcrBvx.js → pica-CsWQ4DPU.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-CUjgOGBw.js → pieDiagram-E7YTZNPT-C60FE0D8.js} +1 -1
- package/dist/assets/{pl-PL-T2D74RX3-CnMxn1dA.js → pl-PL-T2D74RX3-be8atU_l.js} +1 -1
- package/dist/assets/{pt-BR-5N22H2LF-Di-jnHb3.js → pt-BR-5N22H2LF-CSE0O2fj.js} +1 -1
- package/dist/assets/{pt-PT-UZXXM6DQ-BaAKq8Sh.js → pt-PT-UZXXM6DQ-5rnYJhy1.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-DwwqgJXZ.js → quadrantDiagram-AXDQQJYC-DyH84hx6.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-DyRgYGPF.js → railroadDiagram-O6MQD6OU-DCrJgP9s.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-C3ixXeHJ.js → requirementDiagram-BXWQKSXE-C78-QlFo.js} +1 -1
- package/dist/assets/{ro-RO-JPDTUUEW-BWrclVyo.js → ro-RO-JPDTUUEW-Gh6EgC27.js} +1 -1
- package/dist/assets/{ru-RU-B4JR7IUQ-_z0DINaG.js → ru-RU-B4JR7IUQ-BUWESZhq.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-mKpKYI_w.js → sankeyDiagram-P5KCCOFB-D_MOkKEs.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-ZkNd0Wnj.js → sequenceDiagram-WJ2MYXX4-BeQbHZRB.js} +1 -1
- package/dist/assets/{si-LK-N5RQ5JYF-CdKOb383.js → si-LK-N5RQ5JYF-C9pnvQMf.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-hQLGO-0z.js → sizeCapture-INFHLROL-DUn-Mus_.js} +1 -1
- package/dist/assets/{sk-SK-C5VTKIMK-MHJC6ZIe.js → sk-SK-C5VTKIMK-FnkPBibb.js} +1 -1
- package/dist/assets/{sl-SI-NN7IZMDC-BF9YWbZx.js → sl-SI-NN7IZMDC-Cwrqj_B9.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-CRWj3j-B.js → stateDiagram-D77RDMKH-C3EF3jQ3.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-CVQHmIvK.js +1 -0
- package/dist/assets/{subset-shared.chunk-DtxXjVIA.js → subset-shared.chunk-8ifLcT_D.js} +1 -1
- package/dist/assets/{subset-worker.chunk-DONNSbUF.js → subset-worker.chunk-DrNTybDR.js} +1 -1
- package/dist/assets/{sv-SE-XGPEYMSR-DkaTkfUY.js → sv-SE-XGPEYMSR-Btz80pGx.js} +1 -1
- package/dist/assets/{swimlanes-42K2YHIH-CFf6j7jO.js → swimlanes-42K2YHIH-B2_kGhPA.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-C1rOmrkT.js +8 -0
- package/dist/assets/{ta-IN-2NMHFXQM-BfxqXEDI.js → ta-IN-2NMHFXQM-B0bWtgu1.js} +1 -1
- package/dist/assets/{th-TH-HPSO5L25-DT3vLA39.js → th-TH-HPSO5L25-DgC0yFw3.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-BGP2Dq8M.js → timeline-definition-24CTP7MA-Bu0W3Mcy.js} +1 -1
- package/dist/assets/{tr-TR-DEFEU3FU-CdfsG7py.js → tr-TR-DEFEU3FU-C9Mmy6ri.js} +1 -1
- package/dist/assets/{uk-UA-QMV73CPH-CZrQuC1S.js → uk-UA-QMV73CPH-rxEnqB_i.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-CaxGPIab.js → vennDiagram-4TSXK5OY-63JTeOph.js} +1 -1
- package/dist/assets/{vi-VN-M7AON7JQ-DQJk1_KV.js → vi-VN-M7AON7JQ-DOVa-vAT.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-DQxQ-zXH.js → wardleyDiagram-VM6X3IG4-Bct0TRuC.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-DoxdZQ6R.js → xychartDiagram-S5SC5T6Z-C21zgvSM.js} +1 -1
- package/dist/assets/{zh-CN-LNUGB5OW-DRVBfkOy.js → zh-CN-LNUGB5OW-MyifsmQ8.js} +1 -1
- package/dist/assets/{zh-HK-E62DVLB3-BJHrltss.js → zh-HK-E62DVLB3-Cp55UViv.js} +1 -1
- package/dist/assets/{zh-TW-RAJ6MFWO-DpMZ5m2x.js → zh-TW-RAJ6MFWO-DMy6SZap.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 +17 -14
- package/docs/MODEL-CONTRACT.md +7 -4
- package/docs/PLANTUML-SOURCE.md +3 -2
- package/docs/VIEWER-LAUNCH.md +13 -3
- package/docs/VIEWER.md +93 -26
- package/docs/capabilities.json +21 -3
- package/package.json +2 -1
- package/scripts/build-map.mjs +1 -1
- package/scripts/lib/map-viewer-server.mjs +48 -24
- package/scripts/lib/original-materials.mjs +1 -1
- package/scripts/lib/original-report-server.mjs +7 -3
- package/scripts/lib/project-catalog.mjs +14 -2
- package/scripts/lib/project-map-inputs.mjs +1 -1
- package/scripts/lib/sketch-publication.mjs +1 -1
- package/scripts/lib/task-map-build.mjs +1 -1
- package/scripts/lib/view-args.mjs +183 -0
- package/scripts/lib/workflow/reader-surface.mjs +29 -11
- package/scripts/locus-map.mjs +14 -20
- package/scripts/open-map.mjs +84 -49
- package/skills/README.md +2 -1
- package/skills/locus-map/SKILL.md +27 -25
- 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/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 +127 -0
- package/skills/locus-map-primitives/SKILL.md +6 -2
- 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 +59 -18
- package/src/chain/validation.js +7 -1
- package/src/contract/readingMaterials.js +18 -2
- package/src/contract/readingTable.js +66 -0
- package/src/viewer/ControlIcon.jsx +1 -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/ProjectRail.jsx +11 -5
- package/src/viewer/ProjectViewChainViewer.jsx +222 -70
- package/src/viewer/ReadingTable.jsx +151 -0
- package/src/viewer/SketchCanvas.jsx +15 -75
- package/src/viewer/ViewChainViewer.jsx +543 -52
- 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/readingTable.css +47 -0
- package/src/viewer/sketchSettling.js +71 -0
- package/src/viewer/useInspectorPosition.js +116 -35
- package/src/viewer/viewChain.css +40 -4
- 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
package/src/chain/validation.js
CHANGED
|
@@ -7,6 +7,8 @@ import { PAGE_QUESTION_CHARACTERS } from '../contract/page.js';
|
|
|
7
7
|
import { validateLayoutHints } from '../contract/layoutHints.js';
|
|
8
8
|
import { readingTreeProblem } from '@locus-forge/locus-draw/source';
|
|
9
9
|
|
|
10
|
+
import { readingTableProblem } from '../contract/readingTable.js';
|
|
11
|
+
|
|
10
12
|
const ROOT_FIELDS = ['schemaVersion', 'rootViewId', 'views', 'links'];
|
|
11
13
|
const VIEW_FIELDS = ['id', 'title', 'family', 'nodeIds', 'edgeIds'];
|
|
12
14
|
const VIEW_OPTIONAL_FIELDS = ['layout', 'page'];
|
|
@@ -106,7 +108,7 @@ function inspectChain(input, modelInput) {
|
|
|
106
108
|
const viewRecords = [];
|
|
107
109
|
for (const [index, view] of (Array.isArray(chain.views) ? chain.views : []).slice(0, maxViews).entries()) {
|
|
108
110
|
const path = `/views/${index}`;
|
|
109
|
-
let projectable = exactRecord(view, path, [...VIEW_FIELDS, ...(structured ? ['maxNodes'] : []), ...(profiled ? ['presentationProfile'] : ['question'])], [...VIEW_OPTIONAL_FIELDS, 'question', ...(profiled ? ['readingTree'] : [])]);
|
|
111
|
+
let projectable = exactRecord(view, path, [...VIEW_FIELDS, ...(structured ? ['maxNodes'] : []), ...(profiled ? ['presentationProfile'] : ['question'])], [...VIEW_OPTIONAL_FIELDS, 'question', ...(profiled ? ['readingTree', 'readingTable'] : [])]);
|
|
110
112
|
if (!projectable) continue;
|
|
111
113
|
if (profiled && !isPresentationProfile(view.presentationProfile)) report('PRESENTATION_PROFILE', `${path}/presentationProfile`, `Choose one of: ${ALL_PRESENTATION_PROFILES.join(', ')}.`);
|
|
112
114
|
if ((model.presentationProfile === ARCHIMATE_PROFILE || view.presentationProfile === ARCHIMATE_PROFILE) && (view.presentationProfile !== model.presentationProfile || view.family !== 'semantic')) report('ARCHIMATE_PROFILE', path, 'ArchiMate views must retain the canonical profile and semantic layout.');
|
|
@@ -172,6 +174,10 @@ function inspectChain(input, modelInput) {
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
viewRecords.push({ view, path, projectable });
|
|
177
|
+
if (profiled && projectable && Object.hasOwn(view, 'readingTable')) {
|
|
178
|
+
const problem = readingTableProblem(view.readingTable, nodeList.ids);
|
|
179
|
+
if (problem) report('INVALID_READING_TABLE', path + '/readingTable', problem);
|
|
180
|
+
}
|
|
175
181
|
if (projectable && Object.hasOwn(view, 'readingTree')) {
|
|
176
182
|
const problem = view.family !== 'semantic' ? 'A reading tree requires a semantic view.'
|
|
177
183
|
: readingTreeProblem(view.readingTree, nodeList.ids, edgeList.ids.map(id => edges.get(id)));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { parseStoredMarkdown, readingTextLimit, readingTokenLimit } from './readingMarkdown.js';
|
|
2
2
|
import { isMarkdownText } from '@locus-forge/locus-draw/source';
|
|
3
|
-
import { isPortablePath, isReservedKey } from './safety.js';
|
|
3
|
+
import { isPlainText, isPortablePath, isReservedKey } from './safety.js';
|
|
4
4
|
|
|
5
5
|
export const hasHtmlOriginal = file => (file?.kind === 'report' || file?.kind === 'original')
|
|
6
6
|
&& typeof file.sourcePath === 'string' && /\.html?$/iu.test(file.sourcePath);
|
|
7
7
|
|
|
8
8
|
// Saved reports contain text, these inert elements, and references to bundle images.
|
|
9
9
|
export const reportTags = new Set('div p h1 h2 h3 h4 h5 h6 blockquote pre code strong em b i sub sup del ul ol li dl dt dd table caption thead tbody tfoot tr th td figure figcaption br hr'.split(' '));
|
|
10
|
-
export const readingLimits = Object.freeze({ files: 128, perItem: 12, nodes: 12000, depth: 20, text: readingTextLimit });
|
|
10
|
+
export const readingLimits = Object.freeze({ files: 128, canvases: 16, perItem: 12, nodes: 12000, depth: 20, text: readingTextLimit });
|
|
11
11
|
const object = v => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
12
12
|
const fields = (value, allowed) => object(value) && Object.keys(value).every(k => allowed.includes(k));
|
|
13
13
|
const id = s => typeof s === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/.test(s) && !isReservedKey(s);
|
|
@@ -50,6 +50,7 @@ export function validateReadingMaterials(reading, model, report) {
|
|
|
50
50
|
}
|
|
51
51
|
return n.children.every(child => validNode(child, depth + 1));
|
|
52
52
|
}
|
|
53
|
+
const canvasIds = new Set();
|
|
53
54
|
for (const [key, f] of files) {
|
|
54
55
|
if (f?.kind === 'original') {
|
|
55
56
|
if (!id(key) || !used.has(key) || !fields(f, ['kind', 'sourcePath']) || !isPortablePath(f.sourcePath)) {
|
|
@@ -70,6 +71,13 @@ export function validateReadingMaterials(reading, model, report) {
|
|
|
70
71
|
valid = Boolean(parsed) && extendedMarkdownTokens <= readingTokenLimit;
|
|
71
72
|
characters += f.text.length;
|
|
72
73
|
}
|
|
74
|
+
} else if (valid && f.kind === 'canvas') {
|
|
75
|
+
valid = fields(f, ['kind', 'name', 'canvasId', 'format', 'title', 'sourceFormat', 'sourcePath'])
|
|
76
|
+
&& id(f.canvasId) && !canvasIds.has(f.canvasId) && canvasIds.size < readingLimits.canvases
|
|
77
|
+
&& ['locus-map', 'excalidraw'].includes(f.format)
|
|
78
|
+
&& typeof f.title === 'string' && Boolean(f.title.trim()) && f.title.length <= 256 && isPlainText(f.title)
|
|
79
|
+
&& (!own(f, 'sourceFormat') || ['mjs', 'puml', 'map-json', 'locus-map', 'excalidraw'].includes(f.sourceFormat));
|
|
80
|
+
canvasIds.add(f.canvasId);
|
|
73
81
|
} else if (valid) {
|
|
74
82
|
valid = f.kind === 'report' && fields(f,['kind','name','content','sourcePath']) && Array.isArray(f.content)
|
|
75
83
|
&& f.content.length > 0 && f.content.every(n => validNode(n, 0));
|
|
@@ -78,6 +86,14 @@ export function validateReadingMaterials(reading, model, report) {
|
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
|
|
89
|
+
export function readingCanvasEntries(model) {
|
|
90
|
+
return Object.entries(model?.reading?.files ?? {})
|
|
91
|
+
.filter(([, file]) => file?.kind === 'canvas')
|
|
92
|
+
.map(([id, { canvasId, format, title, name, sourceFormat, sourcePath }]) =>
|
|
93
|
+
({ id, canvasId, format, title, name, sourceFormat, sourcePath }))
|
|
94
|
+
.sort((a, b) => a.canvasId < b.canvasId ? -1 : Number(a.canvasId > b.canvasId));
|
|
95
|
+
}
|
|
96
|
+
|
|
81
97
|
export function projectReadingMaterials(reading, elements, assetIds) {
|
|
82
98
|
if (!reading) return;
|
|
83
99
|
const items = {}, files = {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isPlainText, isReservedKey } from './safety.js';
|
|
2
|
+
|
|
3
|
+
const record = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
4
|
+
const keys = (value, allowed) => record(value) && Object.keys(value).every(key => allowed.includes(key));
|
|
5
|
+
const invisible = /[\u200b-\u200f\u202a-\u202e\u2060\u2063\u2066-\u2069\ufeff]/u;
|
|
6
|
+
const text = (value, limit) => isPlainText(value) && Boolean(value.trim()) && value.length <= limit && !invisible.test(value);
|
|
7
|
+
const list = (value, limit) => Array.isArray(value) && value.length >= 1 && value.length <= limit;
|
|
8
|
+
const stableId = id => typeof id === 'string' && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u.test(id) && !isReservedKey(id);
|
|
9
|
+
const tones = ['ok', 'bad', 'warn', 'info', 'neutral'];
|
|
10
|
+
|
|
11
|
+
function catalogProblem(items, columns) {
|
|
12
|
+
const ids = new Set();
|
|
13
|
+
for (const item of items) {
|
|
14
|
+
if (!keys(item, columns ? ['id', 'label', 'align'] : ['id', 'label']) || !stableId(item.id) || ids.has(item.id))
|
|
15
|
+
return 'Each entry needs a unique stable id and supported fields.';
|
|
16
|
+
if (!text(item.label, columns ? 120 : 64)) return 'Each entry needs a nonempty plain text label within the length limit.';
|
|
17
|
+
if ('align' in item && !['left', 'right'].includes(item.align)) return 'Choose left or right alignment.';
|
|
18
|
+
ids.add(item.id);
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function validCell(value) {
|
|
24
|
+
if (typeof value === 'string') return text(value, 256);
|
|
25
|
+
return keys(value, ['text', 'subtext', 'tone']) && text(value.text, 256)
|
|
26
|
+
&& (!('subtext' in value) || text(value.subtext, 256))
|
|
27
|
+
&& (!('tone' in value) || tones.includes(value.tone));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function readingTableProblem(table, nodeIds) {
|
|
31
|
+
if (!keys(table, ['columns', 'rows', 'defaultMode', 'filters'])) return 'Expected a reading table with supported fields.';
|
|
32
|
+
if ('defaultMode' in table && !['table', 'canvas'].includes(table.defaultMode)) return 'Choose table or canvas for defaultMode.';
|
|
33
|
+
if (!list(table.columns, 8)) return 'Declare 1–8 columns.';
|
|
34
|
+
const columnProblem = catalogProblem(table.columns, true);
|
|
35
|
+
if (columnProblem) return 'Invalid columns. ' + columnProblem;
|
|
36
|
+
const columns = new Set(table.columns.map(column => column.id));
|
|
37
|
+
const filters = table.filters;
|
|
38
|
+
if ('filters' in table) {
|
|
39
|
+
if (!keys(filters, ['allLabel', 'options']) || !list(filters.options, 16)
|
|
40
|
+
|| ('allLabel' in filters && !text(filters.allLabel, 64))) return 'Declare 1–16 filter options and an optional plain text allLabel (at most 64 characters).';
|
|
41
|
+
const filterProblem = catalogProblem(filters.options, false);
|
|
42
|
+
if (filterProblem) return 'Invalid filters. ' + filterProblem;
|
|
43
|
+
}
|
|
44
|
+
const options = new Set(filters?.options.map(option => option.id));
|
|
45
|
+
if (!list(table.rows, 500)) return 'Declare 1–500 rows.';
|
|
46
|
+
const available = new Set(nodeIds);
|
|
47
|
+
for (const [index, row] of table.rows.entries()) {
|
|
48
|
+
const location = 'Row ' + (index + 1) + ': ';
|
|
49
|
+
if (!keys(row, ['nodeId', 'cells', 'filter', 'dividerBefore']) || !available.delete(row.nodeId))
|
|
50
|
+
return location + 'Use supported fields and a distinct nodeId from this view.';
|
|
51
|
+
if ('filter' in row && !options.has(row.filter)) return location + 'Unknown filter.';
|
|
52
|
+
if ('dividerBefore' in row && typeof row.dividerBefore !== 'boolean') return location + 'dividerBefore must be boolean.';
|
|
53
|
+
if (!record(row.cells) || !Object.keys(row.cells).length) return location + 'Declare at least one cell.';
|
|
54
|
+
for (const [id, cell] of Object.entries(row.cells)) {
|
|
55
|
+
if (!columns.has(id)) return location + 'Unknown column ' + id + '.';
|
|
56
|
+
if (!validCell(cell)) return location + 'Invalid text, subtext or tone in column ' + id + '.';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function validateReadingTable(table, nodeIds, path = '/readingTable') {
|
|
63
|
+
const message = readingTableProblem(table, nodeIds);
|
|
64
|
+
return message ? { valid: false, diagnostics: [{ code: 'INVALID_READING_TABLE', path, message }] }
|
|
65
|
+
: { valid: true, diagnostics: [] };
|
|
66
|
+
}
|
|
@@ -13,6 +13,7 @@ const strokes = {
|
|
|
13
13
|
share: 'm9 15 6-6m-7 3-2 2a3.5 3.5 0 0 0 5 5l3-3m2-4 2-2a3.5 3.5 0 0 0-5-5l-3 3',
|
|
14
14
|
readable: 'm3 18 5-13 5 13M5 14h6m3-3c5-3 6 1 6 3v4m0-5c-7-1-7 7 0 3',
|
|
15
15
|
fit: 'M9 4H4v5m11-5h5v5M4 15v5h5m11-5v5h-5',
|
|
16
|
+
popout: 'M7 17 17 7M9 7h8v8',
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export function ControlIcon({ name }) {
|
|
@@ -15,6 +15,9 @@ import { currentScene, documentDraftElements, sameInstallation } from './sceneSt
|
|
|
15
15
|
import { MIN_ZOOM, MAX_ZOOM, ZOOM_STEP, fitCamera, revealCamera, readableFrame, sceneBounds, zoomAtCenter } from './camera.js';
|
|
16
16
|
import { HighlightOverlay, DrilldownOverlay } from './HighlightOverlay.jsx';
|
|
17
17
|
import { Inspector } from './Inspector.jsx';
|
|
18
|
+
import { CanvasPreview } from './details/CanvasPreview.jsx';
|
|
19
|
+
export { CanvasPreview };
|
|
20
|
+
export { EmbeddedExcalidrawEditor } from './EmbeddedExcalidrawEditor.jsx';
|
|
18
21
|
import { DiagramGuide } from './DiagramGuide.jsx';
|
|
19
22
|
import { sketchState, setSketch } from '../adapter/drawingStyle.js';
|
|
20
23
|
import { legendReferencedNodeIds } from '../adapter/page.js';
|
|
@@ -97,12 +100,13 @@ function PathResultPanel({ api, path, message, indexes, onClear }) {
|
|
|
97
100
|
|
|
98
101
|
/** Generic official editor host. Scene is an installation input, NOT a controlled
|
|
99
102
|
* onChange value. Keep its reference stable until deliberately installing again. */
|
|
100
|
-
export function DiagramViewer({ model, scene, viewOnly = false, initialFraming = 'fit', editSource, originalBinding, readingTree, sourceDescription, initialCamera = null, assetUrls = EMPTY_URLS, toolbarTarget, statusTarget, inspectActionTarget, detailTargets, inspectorPositions, onOpenDetails,
|
|
101
|
-
|
|
103
|
+
export function DiagramViewer({ model, scene, viewOnly = false, suspended = false, transitioning = false, initialFraming = 'fit', editSource, originalBinding, readingTree, sourceDescription, initialCamera = null, assetUrls = EMPTY_URLS, toolbarTarget, statusTarget, inspectActionTarget, detailTargets, inspectorPositions, onOpenDetails,
|
|
104
|
+
canvasAttachments, onOpenCanvas, resolveDetailPreview,
|
|
105
|
+
inspectScene = inspectSemanticDrift, resolveSelection = resolveSemanticSelection, onSceneChange, onSelectNode, onReady, onInstalled, onInstallError, restoreDraft = false }) {
|
|
102
106
|
const [installed, setInstalled] = useState(null), [error, setError] = useState(null);
|
|
103
107
|
const retained = useRef(null);
|
|
104
108
|
const callbacks = useRef(null);
|
|
105
|
-
callbacks.current = { onSceneChange, onReady, onInstalled, onInstallError, detailTargets, inspectorPositions, onOpenDetails, toolbarTarget, statusTarget, inspectActionTarget };
|
|
109
|
+
callbacks.current = { suspended, transitioning, onSceneChange, onSelectNode, onReady, onInstalled, onInstallError, detailTargets, inspectorPositions, onOpenDetails, toolbarTarget, statusTarget, inspectActionTarget, canvasAttachments, onOpenCanvas, resolveDetailPreview };
|
|
106
110
|
useEffect(() => {
|
|
107
111
|
let cancelled = false;
|
|
108
112
|
async function stage() {
|
|
@@ -132,12 +136,13 @@ export function DiagramViewer({ model, scene, viewOnly = false, initialFraming =
|
|
|
132
136
|
return <div style={{ height: '100%', width: '100%', position: 'relative' }}>
|
|
133
137
|
{error && !current && <div className="lm-open-error" role="alert" style={{ position: 'absolute', top: 0, right: 0, zIndex: 6, maxWidth: '30rem', padding: 8, background: '#fff', border: '1px solid #b42318' }}>Open failed. {error.code || error.diagnostics?.[0]?.code}: {error.message} <button type="button" onClick={() => setError(null)}>Dismiss</button></div>}
|
|
134
138
|
{current ? <InstalledViewer viewOnly={viewOnly} initialFraming={initialFraming} editSource={current.editSource} originalBinding={current.originalBinding} sourceDescription={current.sourceDescription} model={current.model} scene={current.scene} readingTree={current.readingTree} initialCamera={current.initialCamera} assetUrls={current.assetUrls ?? EMPTY_URLS}
|
|
135
|
-
inspectScene={current.inspectScene} draftDrift={current.draftDrift} resolveSelection={current.resolveSelection} replacementError={!sameInput ? error : null} onDismissReplacementError={() => setError(null)} {...current.callbacks} /> : <div className="lm-empty">Preparing diagram…</div>}
|
|
139
|
+
inspectScene={current.inspectScene} draftDrift={current.draftDrift} resolveSelection={current.resolveSelection} replacementError={!sameInput ? error : null} onDismissReplacementError={() => setError(null)} {...current.callbacks} suspended={suspended} transitioning={transitioning} /> : <div className="lm-empty">Preparing diagram…</div>}
|
|
136
140
|
</div>;
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, originalBinding, readingTree, sourceDescription, initialCamera, assetUrls = EMPTY_URLS, toolbarTarget, statusTarget, inspectActionTarget, detailTargets, inspectorPositions, replacementError, onOpenDetails,
|
|
140
|
-
|
|
143
|
+
function InstalledViewer({ model, scene, viewOnly, suspended = false, transitioning = false, initialFraming, editSource, originalBinding, readingTree, sourceDescription, initialCamera, assetUrls = EMPTY_URLS, toolbarTarget, statusTarget, inspectActionTarget, detailTargets, inspectorPositions, replacementError, onOpenDetails,
|
|
144
|
+
canvasAttachments, onOpenCanvas, resolveDetailPreview,
|
|
145
|
+
inspectScene, resolveSelection, draftDrift, onDismissReplacementError, onSceneChange, onSelectNode, onReady, onInstalled, onInstallError }) {
|
|
141
146
|
const editTarget = useMemo(() => editSource?.target ?? { modelId: model.id, viewId: model.id, title: model.title }, [editSource, model]);
|
|
142
147
|
const legendNodes = useMemo(() => legendReferencedNodeIds(model), [model]);
|
|
143
148
|
const [drawingStyle, setDrawingStyle] = useState(() => sketchState(scene?.elements, legendNodes));
|
|
@@ -147,6 +152,9 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
147
152
|
const [inspection, setInspectionState] = useState({ focus: null, history: [], restore: null });
|
|
148
153
|
const [pathEndpoints, setPathEndpoints] = useState({ startId: '', endId: '' });
|
|
149
154
|
const focus = inspection.focus;
|
|
155
|
+
useLayoutEffect(() => {
|
|
156
|
+
if (focus?.kind === 'node') onSelectNode?.(focus.id);
|
|
157
|
+
}, [focus, onSelectNode]);
|
|
150
158
|
const [locatedNode, setLocatedNode] = useState(null);
|
|
151
159
|
const [drift, setDrift] = useState(null), [loading, setLoading] = useState(true);
|
|
152
160
|
const [areaWarnings, setAreaWarnings] = useState([]);
|
|
@@ -154,7 +162,12 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
154
162
|
const stageRef = useRef(null), returnFocusRef = useRef(null);
|
|
155
163
|
const installedRef = useRef(null), latestRef = useRef(null), lastEmissionRef = useRef(''), nativeElementsRef = useRef(structuredClone(scene?.elements ?? []));
|
|
156
164
|
const spaceRef = useRef(false), gestureRef = useRef(createGestureTracker());
|
|
165
|
+
const suspendedRef = useRef(suspended);
|
|
166
|
+
suspendedRef.current = suspended;
|
|
167
|
+
const transitioningRef = useRef(transitioning);
|
|
168
|
+
transitioningRef.current = transitioning;
|
|
157
169
|
const readyApiRef = useRef(null), driftKeyRef = useRef('');
|
|
170
|
+
const lastNativeSelection = useRef(null);
|
|
158
171
|
const routeHistoryRef = useRef(new Map());
|
|
159
172
|
const localInspectorPositions = useMemo(() => new Map(), [model.id]);
|
|
160
173
|
const treeRef = useRef(null), [tree, setTree] = useState(null);
|
|
@@ -174,7 +187,7 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
174
187
|
const prepared = prepareReadingTree(model, readingTree, elements);
|
|
175
188
|
if (prepared) showTree(prepared, prepared.project());
|
|
176
189
|
}, [model, readingTree, showTree]);
|
|
177
|
-
latestRef.current = { model, scene, mode, focus, draftElements, inspectScene, resolveSelection, onSceneChange, onReady, onInstalled, onInstallError, replacementError, onOpenDetails };
|
|
190
|
+
latestRef.current = { model, scene, mode, focus, draftElements, inspectScene, resolveSelection, onSceneChange, onSelectNode, onReady, onInstalled, onInstallError, replacementError, onOpenDetails };
|
|
178
191
|
const indexed = useMemo(() => {
|
|
179
192
|
try { return { indexes: indexModel(model), error: null }; }
|
|
180
193
|
catch (error) { return { indexes: null, error }; }
|
|
@@ -210,6 +223,7 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
210
223
|
stageRef.current?.focus({ preventScroll: true });
|
|
211
224
|
}, []);
|
|
212
225
|
const close = useCallback(() => { clearInspection(); restoreOpener(); }, [clearInspection, restoreOpener]);
|
|
226
|
+
useEffect(() => { if (suspended || transitioning) clearInspection(); }, [suspended, transitioning, clearInspection]);
|
|
213
227
|
const refusalFocusRef = useRef(false);
|
|
214
228
|
if (replacementError && stageRef.current?.querySelector('.lm-inspector:focus-within, .lm-inspector-return:focus')) refusalFocusRef.current = true;
|
|
215
229
|
useLayoutEffect(() => {
|
|
@@ -290,6 +304,15 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
290
304
|
setTheme(appState.theme === 'dark' ? 'dark' : 'light');
|
|
291
305
|
setZoom(appState.zoom.value);
|
|
292
306
|
const result = repaired ? latest.inspectScene(latest.model, latest.draftElements(elements)) : incoming;
|
|
307
|
+
if (latest.onSelectNode && latest.mode === 'edit' && result.valid) {
|
|
308
|
+
const ids = Object.keys(appState.selectedElementIds ?? {}).filter(id => appState.selectedElementIds[id]);
|
|
309
|
+
const key = JSON.stringify(ids);
|
|
310
|
+
if (key !== lastNativeSelection.current && ids.length) {
|
|
311
|
+
const selected = singleSelection(latest.resolveSelection(latest.model, latest.draftElements(elements), ids));
|
|
312
|
+
if (selected?.kind === 'node') latest.onSelectNode(selected.id);
|
|
313
|
+
}
|
|
314
|
+
lastNativeSelection.current = key;
|
|
315
|
+
} else lastNativeSelection.current = null;
|
|
293
316
|
const warnings = inspectAreaLayout(latest.model, elements);
|
|
294
317
|
setAreaWarnings(previous => JSON.stringify(previous) === JSON.stringify(warnings) ? previous : warnings);
|
|
295
318
|
setInspection(result);
|
|
@@ -430,6 +453,12 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
430
453
|
api.history.clear();
|
|
431
454
|
const inspectLocated = id => {
|
|
432
455
|
if (treeRef.current && !treeRef.current.state.boxes.has(id)) prepareLocation(id)();
|
|
456
|
+
if (api.getAppState().activeTool?.type !== 'selection') {
|
|
457
|
+
flushSync(() => api.updateScene({
|
|
458
|
+
appState: { activeTool: { type: 'selection', customType: null, locked: false, lastActiveTool: null } },
|
|
459
|
+
captureUpdate: CaptureUpdateAction.NEVER,
|
|
460
|
+
}));
|
|
461
|
+
}
|
|
433
462
|
return choose({ kind: 'node', id });
|
|
434
463
|
};
|
|
435
464
|
installedRef.current = { model, scene, flush, inspectLocated, fitVisit };
|
|
@@ -479,8 +508,10 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
479
508
|
const move = event => tracker.move(event);
|
|
480
509
|
const finish = event => tracker.cancel(event);
|
|
481
510
|
const keyboard = event => {
|
|
511
|
+
if (suspendedRef.current || transitioningRef.current) return;
|
|
482
512
|
if (event.code === 'Space') spaceRef.current = event.type === 'keydown';
|
|
483
513
|
if (event.type === 'keydown' && event.key === 'Escape' && focus && stageRef.current?.contains(document.activeElement)) {
|
|
514
|
+
if (event.defaultPrevented || event.target?.closest?.('.lm-canvas-preview-stage') || document.activeElement?.closest?.('.lm-canvas-preview-stage')) return;
|
|
484
515
|
event.preventDefault(); event.stopPropagation(); close();
|
|
485
516
|
}
|
|
486
517
|
};
|
|
@@ -552,6 +583,8 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
552
583
|
api.updateScene({ appState: zoomAtCenter(state, state.zoom.value + direction * ZOOM_STEP), captureUpdate: CaptureUpdateAction.NEVER });
|
|
553
584
|
};
|
|
554
585
|
const pointerDown = event => {
|
|
586
|
+
if (transitioning) return;
|
|
587
|
+
if (event.target?.closest?.('.lm-inspector')) return;
|
|
555
588
|
if (event.target.tagName !== 'CANVAS') return;
|
|
556
589
|
if (mode === 'edit') {
|
|
557
590
|
if (focus) clearInspection();
|
|
@@ -560,6 +593,8 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
560
593
|
gestureRef.current.down(event, !loading && !replacementError && !spaceRef.current);
|
|
561
594
|
};
|
|
562
595
|
const pointerUp = event => {
|
|
596
|
+
if (transitioning) return;
|
|
597
|
+
if (event.target?.closest?.('.lm-inspector')) return;
|
|
563
598
|
if (mode === 'edit') return;
|
|
564
599
|
const clicked = gestureRef.current.up(event);
|
|
565
600
|
if (!clicked || event.target.tagName !== 'CANVAS' || !api || loading || replacementError || spaceRef.current) return;
|
|
@@ -576,7 +611,8 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
576
611
|
if (result.focus) choose(result.focus, undefined, stageRef.current);
|
|
577
612
|
else clearInspection();
|
|
578
613
|
};
|
|
579
|
-
const
|
|
614
|
+
const controlsDisabled = loading || transitioning;
|
|
615
|
+
const inspectionEnabled = !controlsDisabled && !drift && !replacementError && !indexed.error && sameInstallation(installedRef.current, model, scene);
|
|
580
616
|
const validFocus = inspectionEnabled ? focus : null;
|
|
581
617
|
const toggleBranch = id => {
|
|
582
618
|
const current = treeRef.current;
|
|
@@ -616,13 +652,17 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
616
652
|
|| byId.get(semanticElementId(validFocus.kind, validFocus.id));
|
|
617
653
|
if (!element) return null;
|
|
618
654
|
const stage = stageRef.current.getBoundingClientRect();
|
|
655
|
+
const offsetLeft = Number.isFinite(state.offsetLeft) ? state.offsetLeft : stage.left;
|
|
656
|
+
const offsetTop = Number.isFinite(state.offsetTop) ? state.offsetTop : stage.top;
|
|
657
|
+
const normalizedState = offsetLeft === state.offsetLeft && offsetTop === state.offsetTop
|
|
658
|
+
? state : { ...state, offsetLeft, offsetTop };
|
|
619
659
|
const viewportBox = shape => {
|
|
620
660
|
const painted = shape.containerId ? boundTextBox(shape, byId.get(shape.containerId)) : null;
|
|
621
661
|
const box = sceneBounds([painted ? { ...shape, ...painted } : shape]);
|
|
622
662
|
if (!box) return null;
|
|
623
|
-
const start = sceneCoordsToViewportCoords({ sceneX: box.minX, sceneY: box.minY },
|
|
624
|
-
const end = sceneCoordsToViewportCoords({ sceneX: box.maxX, sceneY: box.maxY },
|
|
625
|
-
return { x: start.x -
|
|
663
|
+
const start = sceneCoordsToViewportCoords({ sceneX: box.minX, sceneY: box.minY }, normalizedState);
|
|
664
|
+
const end = sceneCoordsToViewportCoords({ sceneX: box.maxX, sceneY: box.maxY }, normalizedState);
|
|
665
|
+
return { x: start.x - offsetLeft, y: start.y - offsetTop, width: end.x - start.x, height: end.y - start.y };
|
|
626
666
|
};
|
|
627
667
|
const obstacles = visibleModel.nodes.flatMap(node => {
|
|
628
668
|
const shape = byId.get(semanticElementId('node', node.id));
|
|
@@ -635,15 +675,15 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
635
675
|
const panelGroup = toolbarTarget?.id || localToolbarId;
|
|
636
676
|
const toolbar = <>
|
|
637
677
|
<div className="lm-viewer-toolbar" role="toolbar" aria-label="Diagram interaction">
|
|
638
|
-
{!viewOnly && <div className="lm-mode" role="group" aria-label="Mode"><button type="button" aria-pressed={mode === 'view'} disabled={
|
|
678
|
+
{!viewOnly && <div className="lm-mode" role="group" aria-label="Mode"><button type="button" aria-pressed={mode === 'view'} disabled={controlsDisabled} onClick={() => changeMode('view')}>View</button><button type="button" aria-pressed={mode === 'edit'} disabled={controlsDisabled} onClick={() => changeMode('edit')}>Edit</button></div>}
|
|
639
679
|
|
|
640
680
|
<details name={panelGroup} className="lm-settings"><summary className="lm-icon-button" title="Options" aria-label="Options"><ControlIcon name="options" /></summary><div className="lm-settings-panel">
|
|
641
|
-
<label className="lm-picker">Inspect<select aria-label="Inspect a diagram item" disabled={
|
|
681
|
+
<label className="lm-picker">Inspect<select aria-label="Inspect a diagram item" disabled={controlsDisabled || Boolean(drift) || Boolean(replacementError) || Boolean(indexed.error)} value={validFocus ? `${validFocus.kind}:${validFocus.id}` : ''} onChange={event => {
|
|
642
682
|
if (!event.target.value) { close(); return; }
|
|
643
683
|
const [kind, ...id] = event.target.value.split(':'); choose({ kind, id: id.join(':') });
|
|
644
684
|
}}><option value="">Choose an item…</option><optgroup label="Nodes">{visibleModel.nodes.map(node => <option key={node.id} value={`node:${node.id}`}>{personPickerLabel(node)}</option>)}</optgroup><optgroup label="Relations">{visibleModel.edges.map(edge => <option key={edge.id} value={`edge:${edge.id}`}>{edge.label}</option>)}</optgroup></select></label> <div className="lm-appearance" role="group" aria-label="Drawing appearance">
|
|
645
|
-
<button type="button" disabled={
|
|
646
|
-
<button className="lm-theme-toggle" type="button" disabled={
|
|
685
|
+
<button type="button" disabled={controlsDisabled} aria-pressed={drawingStyle === 'mixed' ? 'mixed' : drawingStyle === 'on'} title="Change native block and straight-arrow roughness. Curved routes, text and role glyphs keep their appearance. Mixed means saved styles differ or use another roughness." onClick={toggleSketch}>Sketch: {drawingStyle === 'mixed' ? 'Mixed' : drawingStyle === 'on' ? 'On' : 'Off'}</button>
|
|
686
|
+
<button className="lm-theme-toggle" type="button" disabled={controlsDisabled} aria-pressed={theme === 'dark'} aria-label="Dark theme" title="Switch the official editor between light and dark for this session" onClick={toggleTheme}>Theme: {theme === 'dark' ? 'Dark' : 'Light'}</button>
|
|
647
687
|
</div>
|
|
648
688
|
</div></details>
|
|
649
689
|
{!originalBinding?.compactLinks && <details name={panelGroup} className="lm-path-finder"><summary className="lm-icon-button" title="Path" aria-label="Path"><ControlIcon name="path" /></summary><div className="lm-path-controls">
|
|
@@ -655,7 +695,7 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
655
695
|
</select></label>
|
|
656
696
|
<button type="button" disabled={!hasPathChoice} onClick={clearPath}>Clear path</button>
|
|
657
697
|
</div></details>}
|
|
658
|
-
<span className="lm-hint"><span className="lm-hint-measure" aria-hidden="true">Official editor · changes stay in this scene</span><span>{
|
|
698
|
+
<span className="lm-hint"><span className="lm-hint-measure" aria-hidden="true">Official editor · changes stay in this scene</span><span>{drift && !installedRef.current ? 'Scene could not be installed' : controlsDisabled ? 'Loading diagram…' : mode !== 'view' ? 'Official editor · changes stay in this scene' : tree ? 'Click to inspect or fold · drag to pan' : readingTree && !drift ? 'Original layout · positioned drawing elements' : 'Click to inspect · drag to pan'}</span></span>
|
|
659
699
|
</div>
|
|
660
700
|
</>;
|
|
661
701
|
const warnings = sceneWarnings.length > 0 && !loading && !drift && <span className="lm-scene-warning" role="status">
|
|
@@ -664,18 +704,18 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
664
704
|
const navigationControls = <div className="lm-map-controls">
|
|
665
705
|
{!loading && <Minimap api={api} scene={scene} stageRef={stageRef} initiallyOpen={mode === 'view'} />}
|
|
666
706
|
<div className="lm-camera" role="group" aria-label="Diagram framing">
|
|
667
|
-
<button type="button" disabled={
|
|
707
|
+
<button type="button" disabled={controlsDisabled || zoom <= MIN_ZOOM} aria-label="Zoom out" onClick={() => stepZoom(-1)}>−</button>
|
|
668
708
|
<output aria-label="Current zoom">{Math.round(zoom * 100)}%</output>
|
|
669
|
-
<button type="button" disabled={
|
|
670
|
-
<button type="button" disabled={
|
|
671
|
-
<button type="button" disabled={
|
|
709
|
+
<button type="button" disabled={controlsDisabled || zoom >= MAX_ZOOM} aria-label="Zoom in" onClick={() => stepZoom(1)}>+</button>
|
|
710
|
+
<button type="button" disabled={controlsDisabled} title="Readable · zoom to read card text" onClick={() => frameDiagram(true)}><ControlIcon name="readable" /><span className="lm-sr-only">Readable</span></button>
|
|
711
|
+
<button type="button" disabled={controlsDisabled} title={initialFraming === 'readable' ? 'Fit to available zoom' : 'Fit the whole graph'} onClick={() => frameDiagram(false)}><ControlIcon name="fit" /><span className="lm-sr-only">Fit</span></button>
|
|
672
712
|
</div>
|
|
673
713
|
</div>;
|
|
674
714
|
return <div className="lm-viewer" data-mode={mode} data-theme={theme}>
|
|
675
|
-
{statusTarget ? createPortal(warnings, statusTarget) : warnings}
|
|
676
|
-
{toolbarTarget ? createPortal(toolbar, toolbarTarget) : toolbar}
|
|
677
|
-
{model.presentationProfile === ARCHIMATE_PROFILE && <DiagramGuide model={model} elements={api?.getSceneElements() ?? scene.elements} sourceDescription={sourceDescription} template={sceneCardTemplate(scene)} />}
|
|
678
|
-
<div className="lm-viewer-stage" ref={stageRef} tabIndex={0} role="region" aria-label={`${model?.title || 'Diagram'} canvas`} onPointerDownCapture={pointerDown} onPointerUpCapture={pointerUp} onPointerCancelCapture={event => gestureRef.current.cancel(event)}>
|
|
715
|
+
{!suspended && (statusTarget ? createPortal(warnings, statusTarget) : warnings)}
|
|
716
|
+
{!suspended && (toolbarTarget ? createPortal(toolbar, toolbarTarget) : toolbar)}
|
|
717
|
+
{!suspended && model.presentationProfile === ARCHIMATE_PROFILE && <DiagramGuide model={model} elements={api?.getSceneElements() ?? scene.elements} sourceDescription={sourceDescription} template={sceneCardTemplate(scene)} />}
|
|
718
|
+
<div className="lm-viewer-stage" ref={stageRef} tabIndex={0} role="region" aria-label={`${model?.title || 'Diagram'} canvas`} onPointerDownCapture={pointerDown} onPointerUpCapture={pointerUp} onPointerCancelCapture={event => { if (!event.target?.closest?.('.lm-inspector')) gestureRef.current.cancel(event); }}>
|
|
679
719
|
<div className="lm-path-status lm-sr-only" role="status" aria-live="polite">{inspectionEnabled && hasPathChoice ? pathMessage : ''}</div>
|
|
680
720
|
{mode === 'view' && navigationControls}
|
|
681
721
|
|
|
@@ -683,22 +723,22 @@ function InstalledViewer({ model, scene, viewOnly, initialFraming, editSource, o
|
|
|
683
723
|
{replacementError && <div className="lm-drift" role="alert"><strong>Replacement could not be opened.</strong><p>The current diagram is unchanged. Details are paused until the refused input is dismissed or replaced.</p><details><summary>{replacementError.diagnostics?.length || 1} issue{replacementError.diagnostics?.length === 1 ? '' : 's'}</summary><ul>{(replacementError.diagnostics || [{ code: replacementError.code || 'OPEN_FAILED', message: replacementError.message }]).map((item, index) => <li key={`${item.code}:${item.path || ''}:${index}`}>{item.code}: {item.message}</li>)}</ul></details><button type="button" onClick={onDismissReplacementError}>Dismiss</button></div>}
|
|
684
724
|
{drift && !installedRef.current && <div className="lm-drift" role="alert"><strong>Scene could not be installed.</strong><details><summary>Show diagnostics ({drift.diagnostics.length})</summary>
|
|
685
725
|
<ul>{drift.diagnostics.map((item, index) => <li key={index}><code>{item.code}</code> {item.path} {item.message}</li>)}</ul></details></div>}
|
|
686
|
-
{areaWarnings.length > 0 && <details className="lm-area-warning"><summary>Area layout · {areaWarnings.length}</summary>{areaWarnings.map(warning => <p key={warning.path}>{warning.message}</p>)}</details>}
|
|
687
|
-
{!loading && !drift && !replacementError && <DrilldownOverlay api={api} stageRef={stageRef} targets={detailTargets} onOpenDetails={onOpenDetails} />}
|
|
726
|
+
{mode === 'edit' && areaWarnings.length > 0 && <details className="lm-area-warning"><summary>Area layout · {areaWarnings.length}</summary>{areaWarnings.map(warning => <p key={warning.path}>{warning.message}</p>)}</details>}
|
|
727
|
+
{!loading && !transitioning && !drift && !replacementError && <DrilldownOverlay api={api} stageRef={stageRef} targets={detailTargets} onOpenDetails={onOpenDetails} />}
|
|
688
728
|
{inspectionEnabled && tree && <FoldButtons api={api} stageRef={stageRef} tree={tree} indexes={indexed.indexes} detailTargets={detailTargets} onToggle={toggleBranch} />}
|
|
689
729
|
{inspectionEnabled && hasPathChoice && <PathResultPanel key={JSON.stringify([pathEndpoints, path])} api={api} path={path} message={pathMessage} indexes={indexed.indexes} onClear={clearPath} />}
|
|
690
730
|
{inspectionEnabled && path?.status === 'found' && <HighlightOverlay api={api} path={path} stageRef={stageRef} />}
|
|
691
|
-
{inspectActionTarget && createPortal(<button type="button" disabled={!inspectionEnabled || !locatedNode}
|
|
731
|
+
{!suspended && inspectActionTarget && createPortal(<button type="button" disabled={!inspectionEnabled || !locatedNode}
|
|
692
732
|
onClick={() => installedRef.current?.inspectLocated?.(locatedNode)}>Inspect card</button>, inspectActionTarget)}
|
|
693
733
|
{inspectionEnabled && locatedNode && (!tree || tree.state.boxes.has(locatedNode)) && !validFocus && <HighlightOverlay api={api} indexes={indexed.indexes}
|
|
694
734
|
focus={{ kind: 'node', id: locatedNode }} stageRef={stageRef} />}
|
|
695
|
-
{validFocus && <><HighlightOverlay api={api} indexes={indexed.indexes} focus={validFocus} stageRef={stageRef} /><Inspector originalBinding={originalBinding} model={visibleModel} branchExpanded={tree ? !tree.state.collapsed.has(validFocus.id) : undefined} onToggleBranch={tree?.prepared.owners.has(validFocus.id) && validFocus.kind === 'node' ? toggleBranch : undefined} indexes={indexed.indexes} focus={validFocus} assetUrls={assetUrls} getPlacement={inspectorPlacement} positions={inspectorPositions ?? localInspectorPositions} detailTarget={detailTargets?.get?.(validFocus.id)} historyLength={inspection.history.length} restoreState={inspection.restore} onChoose={choose} onSetPathEndpoint={originalBinding?.compactLinks ? undefined : setPathEndpoint} onOpenDetails={latestRef.current.onOpenDetails} onBack={back} onClose={close} /></>}
|
|
735
|
+
{!suspended && validFocus && <><HighlightOverlay api={api} indexes={indexed.indexes} focus={validFocus} stageRef={stageRef} /><Inspector originalBinding={originalBinding} model={visibleModel} diagramKey={JSON.stringify([editTarget.canvasId ?? null, editTarget.modelId ?? model.id, editTarget.viewId ?? model.id])} branchExpanded={tree ? !tree.state.collapsed.has(validFocus.id) : undefined} onToggleBranch={tree?.prepared.owners.has(validFocus.id) && validFocus.kind === 'node' ? toggleBranch : undefined} indexes={indexed.indexes} focus={validFocus} assetUrls={assetUrls} getPlacement={inspectorPlacement} positions={inspectorPositions ?? localInspectorPositions} detailTarget={detailTargets?.get?.(validFocus.id)} historyLength={inspection.history.length} restoreState={inspection.restore} onChoose={choose} onSetPathEndpoint={originalBinding?.compactLinks ? undefined : setPathEndpoint} onOpenDetails={latestRef.current.onOpenDetails} onBack={back} onClose={close} canvasAttachments={canvasAttachments} onOpenCanvas={onOpenCanvas} resolveDetailPreview={resolveDetailPreview} PreviewComponent={CanvasPreview} /></>}
|
|
696
736
|
</div>
|
|
697
737
|
{mode === 'edit' && <div className="lm-edit-navigation">{navigationControls}</div>}
|
|
698
|
-
{!loading && !replacementError && api && sameInstallation(installedRef.current, model, scene) && (mode === 'edit' || drift) &&
|
|
738
|
+
{!suspended && !loading && !transitioning && !replacementError && api && sameInstallation(installedRef.current, model, scene) && (mode === 'edit' || drift) &&
|
|
699
739
|
<SceneEditPrompt api={api} model={model} baseline={openedElements} target={editTarget}
|
|
700
740
|
drift={drift} readDraftElements={readDraftElements} inspectScene={inspectScene} flush={installedRef.current.flush} bound={Boolean(originalBinding)} />}
|
|
701
|
-
{model.presentationProfile !== ARCHIMATE_PROFILE && <DiagramGuide relationKeys={originalBinding?.relationKeys} model={model} elements={api?.getSceneElements() ?? scene.elements} sourceDescription={sourceDescription} template={sceneCardTemplate(scene)} />}
|
|
741
|
+
{!suspended && model.presentationProfile !== ARCHIMATE_PROFILE && <DiagramGuide relationKeys={originalBinding?.relationKeys} model={model} elements={api?.getSceneElements() ?? scene.elements} sourceDescription={sourceDescription} template={sceneCardTemplate(scene)} />}
|
|
702
742
|
</div>;
|
|
703
743
|
}
|
|
704
744
|
|