@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/docs/VIEWER.md
CHANGED
|
@@ -77,9 +77,9 @@ replacement it keeps the values installed with the current document.
|
|
|
77
77
|
**Readable**, **Fit**) always stay in the canvas stage.
|
|
78
78
|
- `statusTarget`: optional DOM element that receives, through a React portal, the
|
|
79
79
|
warning-level diagnostics that scene inspection reports for a valid scene, such
|
|
80
|
-
as a route search that stopped early. Drift, refused-replacement and
|
|
81
|
-
warnings stay in the canvas stage. Without a target, both the toolbar and
|
|
82
|
-
warnings render inside the viewer.
|
|
80
|
+
as a route search that stopped early. Drift, refused-replacement and Edit-mode
|
|
81
|
+
area warnings stay in the canvas stage. Without a target, both the toolbar and
|
|
82
|
+
these warnings render inside the viewer.
|
|
83
83
|
- `detailTargets`, `onOpenDetails`: optional map from a semantic ID to its linked
|
|
84
84
|
detail view, and the callback that opens it. Together they show drill-down
|
|
85
85
|
markers and the card's **Details → target title** action.
|
|
@@ -148,21 +148,55 @@ readable without dimming or making the card transparent against a dark canvas.
|
|
|
148
148
|
Its light color-scheme is scoped to the card, not the official editor.
|
|
149
149
|
|
|
150
150
|
The inspector is a nonmodal, opaque overlay above the entire official
|
|
151
|
-
editor stacking context and the highlight layer. It
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
the
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
editor stacking context and the highlight layer. It defaults to a wide reading
|
|
152
|
+
card (`760 × 720 px`, capped to stage bounds on narrow or short viewports) and
|
|
153
|
+
keeps its full preferred size instead of shrinking into a tight gap beside a
|
|
154
|
+
card. While the inspector is already open, selecting another card or following
|
|
155
|
+
a connection keeps the window stationary and replaces only its content. After
|
|
156
|
+
closing, reopening on the same diagram restores the diagram's last window
|
|
157
|
+
position unless that rect would substantially cover the newly selected item
|
|
158
|
+
(more than 35% of its area) and a clearer side is available—in which case it
|
|
159
|
+
moves beside the selection while keeping the reader's preferred size. An unavailable anchor uses a
|
|
160
|
+
canvas-edge fallback. Once open, the reader can immediately resize or drag the
|
|
161
|
+
inspector freely within stage bounds—including over diagram elements—without
|
|
162
|
+
first moving it; `Home` or **Return Inspector** clears the diagram's saved
|
|
163
|
+
position and places the card beside the current selection at its preferred
|
|
164
|
+
size. Its sticky header shows the selected item title alongside borderless
|
|
165
|
+
circular Back/Settings/Close controls and a soft **Path** pill while content
|
|
166
|
+
scrolls.
|
|
167
|
+
|
|
168
|
+
### Minimalist viewer chrome
|
|
169
|
+
|
|
170
|
+
Viewer controls follow quiet, borderless chrome so diagram content and reading
|
|
171
|
+
notes stay primary:
|
|
172
|
+
|
|
173
|
+
- **Inspector header:** show the selected node, relation or task title on a
|
|
174
|
+
single truncated line beside compact, circular, borderless icon controls
|
|
175
|
+
(**Back**, **Reading settings**, **Close**) with a subtle hover tint and clear
|
|
176
|
+
`:focus-visible` outline. Group **Path** (**From** / **To**) inside one soft
|
|
177
|
+
borderless pill (`#f1f5f9`) whose buttons lift onto a white pill on hover or
|
|
178
|
+
focus.
|
|
179
|
+
- **Structural `Contents` groups:** preserve heading weight on structural folder
|
|
180
|
+
or subgroup headers (`data-group-entry`, `aria-disabled="true"`), mute their
|
|
181
|
+
text (`var(--lm-muted)` with reduced opacity), and suppress clickable-link
|
|
182
|
+
hover affordances on disabled rows so only actual diagram pages read as
|
|
183
|
+
navigation targets.
|
|
184
|
+
- **In-page `Contents` card anchors:** render optional card-anchor rows
|
|
185
|
+
(`data-node-anchor`, `{map, view, node}`) in a smaller, tighter muted scale
|
|
186
|
+
with a subtle dot indicator and `aria-current="location"` when selected so
|
|
187
|
+
readers distinguish in-page jumps from page/canvas destinations.
|
|
188
|
+
- **Clean View canvas:** keep live `Area layout` geometry warnings in **Edit**
|
|
189
|
+
mode rather than overlaying them in **View**.
|
|
157
190
|
|
|
158
191
|
### Inspector reading order
|
|
159
192
|
|
|
160
193
|
Selecting an element opens the available primary document for reading. The
|
|
161
|
-
borderless Inspector opens with the
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
`description` as plain text,
|
|
165
|
-
|
|
194
|
+
borderless Inspector opens with the selected item's title in its sticky header,
|
|
195
|
+
followed by the author's note, when present, and the first assigned reading
|
|
196
|
+
file. A local task uses its own `task.md` as the primary document, showing the
|
|
197
|
+
task title in the header, any textual frontmatter `description` as plain text,
|
|
198
|
+
and the complete rendered Markdown body. See the
|
|
199
|
+
[accepted viewer design decisions](decisions.md) for the rationale.
|
|
166
200
|
|
|
167
201
|
Markdown keeps its own headings, lists, pipe tables and
|
|
168
202
|
code. In CommonMark notes, packaged Markdown, and local task documents, use
|
|
@@ -195,9 +229,25 @@ a labeled group. Open details deliberately with **Options → Inspect**. Clickin
|
|
|
195
229
|
the canvas again closes the Inspector.
|
|
196
230
|
|
|
197
231
|
Closing the card returns focus to its opener or to the canvas. Its Back control
|
|
198
|
-
revisits cards inspected on that canvas.
|
|
199
|
-
|
|
200
|
-
|
|
232
|
+
revisits cards inspected on that canvas. Attached canvas files (`kind: "canvas"`)
|
|
233
|
+
render inline inside the Inspector using a view-only official Excalidraw preview
|
|
234
|
+
(the primary attachment mounts immediately; supporting attachments mount lazily
|
|
235
|
+
when expanded) with **Fit** and **↗** pop-out controls. When an element also
|
|
236
|
+
has a linked `↘` diagram, the same compact preview appears alongside its
|
|
237
|
+
**↘** target action: same-file views preview from the current session drafts,
|
|
238
|
+
and cross-document project links fetch strictly read-only previews through
|
|
239
|
+
`GET /api/project/document` without acquiring a write lock. Inspector text-zoom
|
|
240
|
+
settings scale prose blocks while canvas previews stay at native zoom (`1`).
|
|
241
|
+
When focus is inside a preview stage, `Escape` lets active preview menus or
|
|
242
|
+
dialogs close first or moves focus out of the preview stage instead of closing
|
|
243
|
+
the Inspector on the first press. Clicking **↗** on an attached canvas opens it
|
|
244
|
+
full-screen in the same window (supporting View/Edit, Save through the outer
|
|
245
|
+
document session and file lock, child **Inspector**, internal multi-view child
|
|
246
|
+
traversal, and `SceneEditPrompt` provenance naming `canvasId`, `attachment`, and
|
|
247
|
+
`sourcePath`) while keeping the parent viewer suspended in place so its camera,
|
|
248
|
+
undo history, and selected card caption survive return. A compact single-line
|
|
249
|
+
`←` return pill integrates into the existing location row (or header breadcrumb
|
|
250
|
+
when no location row is shown), reserving zero extra vertical chrome rows. Activating a `↘` destination opens the target in the same tab. The destination can be a view
|
|
201
251
|
in this file or a view in another registered project document. Project
|
|
202
252
|
addresses, the sidebar and browser history track the active canvas. A project address with a node ID highlights the card and shows its name above the canvas.
|
|
203
253
|
**Inspect card** opens its details. The document title stays at the top throughout the visit.
|
|
@@ -233,9 +283,9 @@ not trap Tab. On narrow screens its width and scrollable height stay within the
|
|
|
233
283
|
canvas.
|
|
234
284
|
|
|
235
285
|
The selected element names the dialog for assistive technology. Its title stays on the canvas. An unlabeled relationship uses its endpoints in source-to-target order. Connections in this diagram and Sources start collapsed. Expand Connections to read compact directional rows or follow a relationship. Back restores the previous disclosure, focus and scroll position. The gear opens **Reading settings** to adjust its width, height
|
|
236
|
-
and text zoom. The default size is
|
|
286
|
+
and text zoom. The default size is 760 × 720 pixels, constrained to the canvas.
|
|
237
287
|
The canvas keeps its own zoom. Desktop readers can also drag the resize corner.
|
|
238
|
-
|
|
288
|
+
Once customized, the browser remembers these three settings for the viewer hostname in the current
|
|
239
289
|
browser profile, including when the next launch selects a different port. They
|
|
240
290
|
apply across documents on that host. With cookies disabled, the fallback uses
|
|
241
291
|
storage for the same host and port. With all storage disabled, controls operate
|
|
@@ -249,9 +299,11 @@ card, release the pointer at the edge. **Return Inspector** appears on the visib
|
|
|
249
299
|
canvas as soon as the card extends beyond an edge. Click it or focus it and
|
|
250
300
|
press Enter to bring the same card back beside the selection. Its scroll
|
|
251
301
|
position, open sections and reading settings are preserved. Home on the handle
|
|
252
|
-
also returns the card.
|
|
253
|
-
current
|
|
254
|
-
|
|
302
|
+
also returns the card. Window placement is remembered per diagram in the
|
|
303
|
+
current session, including when the Inspector is closed and reopened, unless
|
|
304
|
+
reopening would cover more than 35% of the newly selected item and a clearer
|
|
305
|
+
position is available. Switching items while a visible Inspector is open keeps
|
|
306
|
+
it stationary. Home and Return Inspector clear the remembered position. Reloading the page
|
|
255
307
|
starts a fresh session. Position and evidence controls are local UI state.
|
|
256
308
|
|
|
257
309
|
The selected outline or arrow is drawn with a heavier stroke in its existing
|
|
@@ -360,10 +412,12 @@ Every model receives the same public camera controls:
|
|
|
360
412
|
- The viewer starts in **Fit**, which contains the whole graph and may make text
|
|
361
413
|
smaller; an `initialCamera` replaces that first frame. Zoom stays within
|
|
362
414
|
10%–3000%, so a graph too large to fit at 10% is cropped.
|
|
363
|
-
- **Readable** keeps primary node names at least 14 CSS pixels
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
415
|
+
- **Readable** keeps primary node names at least 14 CSS pixels and card body
|
|
416
|
+
text (`responsibility`, `outcome`, `body`, `description`) at least 12.5 CSS
|
|
417
|
+
pixels (with a minimum floor of 60%). A graph whose Fit zoom reaches that
|
|
418
|
+
scale is shown whole, no larger than 100% unless the floor is higher;
|
|
419
|
+
otherwise the graph is framed from its top-left corner at the floor and may
|
|
420
|
+
require panning.
|
|
367
421
|
- `−` and `+` step by 5 percentage points around the viewport centre. Wheel and
|
|
368
422
|
pinch zoom stay native editor gestures; the percentage follows them.
|
|
369
423
|
- Both framings exclude the native guide. Camera choices are temporary and emit
|
|
@@ -377,3 +431,16 @@ The checks for this document and their limits are listed in `tests/README.md`
|
|
|
377
431
|
(source checkout only).
|
|
378
432
|
|
|
379
433
|
For editorial diagrams, expand the diagram key beneath the canvas to see the current card fills and relationship strokes. The accent identifies the author’s emphasized card. Declared legend labels describe their sampled treatments. Diagonal card hatching is drawn separately from the relationship line.
|
|
434
|
+
|
|
435
|
+
## Reading a table alongside the diagram
|
|
436
|
+
|
|
437
|
+
Views with a [reading table](DIAGRAM-SOURCE.md#reading-table) offer **Table**
|
|
438
|
+
and **Diagram**. Filter buttons show row counts. Select a row or use the arrow
|
|
439
|
+
keys and Enter to read its note, files and sources in the docked Inspector.
|
|
440
|
+
**Show in diagram ↘** reveals the node, expands any folded ancestors and opens
|
|
441
|
+
its canvas Inspector. Switching to Diagram also frames the selected row.
|
|
442
|
+
Returning to Table highlights the inspected node when it has a row and clears
|
|
443
|
+
a filter that hides it. A project link to a specific node opens the canvas
|
|
444
|
+
directly. The editor stays mounted while the table is open. Save and reopen
|
|
445
|
+
retain the authored table and its default mode. Reading selections and filters
|
|
446
|
+
belong to the current visit.
|
package/docs/capabilities.json
CHANGED
|
@@ -26,12 +26,13 @@
|
|
|
26
26
|
"description": "Ordinary packet-free Draw source build. PlantUML is the text input; schema-v1 .map.json is the compatibility input. Both use the same Map compiler.",
|
|
27
27
|
"limits": [
|
|
28
28
|
"Draw bounds actual label placement work. A label-search refusal identifies the exhausted resource, the relationship being processed and diagram-wide label counts; see the source guide linked below.",
|
|
29
|
-
"The optional --details-files index assigns local Markdown
|
|
29
|
+
"The optional --details-files index assigns local Markdown, static HTML, and depth-1 canvas files (.locus-map.json, .excalidraw, .puml, .map.json, .mjs; up to 16 distinct canvases) to nodes or relations. The document packages reading text, tables, raster figures, and admitted canvas payloads with the associated view. A {sourcePath} item links a repository original without packaging its content. Optional sourcePaths record the origins of embedded files. With --source-root, the bound local viewer opens an available original in Zed and assigned HTML on an isolated read-only report origin. Build-time .mjs canvas sources execute once from admitted bytes as trusted authoring code. The optional authored note precedes the first assigned document. Markdown renders pipe tables and LaTeX formulas and hides leading YAML metadata in the reader.",
|
|
30
30
|
"Handwritten text and optional hatched card fill are independent of the semantics and relationship strokes.",
|
|
31
31
|
"Draw owns the source language, source profiles and examples. Resolve @locus-forge/locus-draw/skill using the linked PlantUML guide rather than copying its catalog.",
|
|
32
32
|
"Title-first editorial-v4 and c4-modern-v2 cards admit decision nodes, as do editorial-v3 and c4-modern-v1. These profiles and editorial-v2 support per-node catalog icons, shapes and badges. The viewer hydrates installed Draw artwork by full file ID, including the role ink of architecture icons, after v4 admission and exports standalone images.",
|
|
33
33
|
"In editorial-v2 an author can omit the accent and repeat negative, caution or positive tones. Native legend samples follow the corresponding cards.",
|
|
34
34
|
"The opt-in task-card-v1 profile displays header metadata, a complete title, description and optional expected outcome. These are authored source fields, not verified completion claims or inferred dependencies.",
|
|
35
|
+
"A JSON source can declare a readingTable with ordered rows, filter options and cells. The viewer shares node details between table and canvas.",
|
|
35
36
|
"An optional readingTree declares ordered ownership edges for a foldable View projection. Edit and Save retain the full admitted drawing.",
|
|
36
37
|
"The compiler creates one semantic view. C4 Component notation selects vocabulary and appearance; source areas are reading areas, not canonical contains ownership.",
|
|
37
38
|
"The source subset has flow/data/call/dependency relations, without canonical contains or sequence/order. Do not infer a different family from a profile name.",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
{ "path": "docs/PLANTUML-SOURCE.md" }
|
|
43
44
|
],
|
|
44
45
|
"implementation": [
|
|
45
|
-
{ "path": "src/authoring/diagramSource.js", "line":
|
|
46
|
+
{ "path": "src/authoring/diagramSource.js", "line": 51 },
|
|
46
47
|
{ "path": "src/authoring/buildDiagram.mjs", "line": 62 }
|
|
47
48
|
],
|
|
48
49
|
"examples": [
|
|
@@ -142,6 +143,23 @@
|
|
|
142
143
|
],
|
|
143
144
|
"docs": [{ "path": "docs/LOCAL-DOCUMENT.md" }]
|
|
144
145
|
},
|
|
146
|
+
{
|
|
147
|
+
"text": "The Inspector renders attached depth-1 canvas diagrams (.locus-map.json, .excalidraw, and compiled sources) and linked ↘ detail targets inline via the official view-only Excalidraw preview (fetching cross-document project previews read-only without acquiring a write lock). Full-screen ↗ pop-out editing, internal child view return, and child SceneEditPrompt provenance save through the outer document's single file lock and revision while keeping parent camera and located-card state intact and placing the compact ← return pill in the existing location or breadcrumb row.",
|
|
148
|
+
"implementation": [
|
|
149
|
+
{ "path": "src/contract/readingMaterials.js" },
|
|
150
|
+
{ "path": "src/authoring/readDetailsFiles.mjs" },
|
|
151
|
+
{ "path": "src/bundle/chain.js" },
|
|
152
|
+
{ "path": "src/bundle/localDocument.mjs" },
|
|
153
|
+
{ "path": "src/viewer/Inspector.jsx" },
|
|
154
|
+
{ "path": "src/viewer/ViewChainViewer.jsx" },
|
|
155
|
+
{ "path": "src/viewer/SceneEditPrompt.jsx" }
|
|
156
|
+
],
|
|
157
|
+
"docs": [
|
|
158
|
+
{ "path": "docs/DIAGRAM-SOURCE.md" },
|
|
159
|
+
{ "path": "docs/BUNDLE-FORMAT.md" },
|
|
160
|
+
{ "path": "docs/VIEWER.md" }
|
|
161
|
+
]
|
|
162
|
+
},
|
|
145
163
|
{
|
|
146
164
|
"text": "Explicit positions and routes are admitted only for semantic/decision. component/sequence retain family placement; presentation areas do not create contains relations.",
|
|
147
165
|
"implementation": [
|
|
@@ -210,7 +228,7 @@
|
|
|
210
228
|
],
|
|
211
229
|
"implementation": [
|
|
212
230
|
{ "path": "src/contract/validation.js", "line": 23 },
|
|
213
|
-
{ "path": "src/authoring/diagramSource.js", "line":
|
|
231
|
+
{ "path": "src/authoring/diagramSource.js", "line": 118 },
|
|
214
232
|
{ "path": "src/authoring/excalidrawDsl.js", "line": 28 }
|
|
215
233
|
],
|
|
216
234
|
"evidence": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locus-forge/locus-map",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2-dev.20261206.g5e970d2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Locus Forge contributors",
|
|
6
6
|
"private": false,
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"exports": {
|
|
60
60
|
"./package.json": "./package.json",
|
|
61
61
|
"./skill": "./skills/locus-map/SKILL.md",
|
|
62
|
+
"./draft-skill": "./skills/locus-map-draft/SKILL.md",
|
|
62
63
|
"./primitives-skill": "./skills/locus-map-primitives/SKILL.md",
|
|
63
64
|
"./research-skill": "./skills/locus-map-research/SKILL.md"
|
|
64
65
|
},
|
package/scripts/build-map.mjs
CHANGED
|
@@ -23,7 +23,7 @@ Result file paths in stdout JSON (outputDir, bundlePath, pngPath, checkPath, sou
|
|
|
23
23
|
current working directory; API paths are absolute. Pass an absolute path, e.g. "$PWD/<bundlePath>", to open-map --document
|
|
24
24
|
and --previous-document. Import diagnostics may still carry the absolute source path.
|
|
25
25
|
The separate research Pi workflow still requires chromiumPath.
|
|
26
|
-
--details-files is only for --source. Each element lists packaged Markdown or
|
|
26
|
+
--details-files is only for --source. Each element lists packaged Markdown, HTML or canvas (.locus-map.json, .excalidraw, .puml, .map.json, .mjs) paths, or {sourcePath} entries for originals.
|
|
27
27
|
Open an original in Zed by starting the viewer with --source-root DIR.
|
|
28
28
|
--citation-bindings is only for --source: exact citation keys map to local source scopes.
|
|
29
29
|
API/stdout and check.json include citationChecks; omitted bindings are unbound. Valid ranges never verify meaning.
|
|
@@ -105,15 +105,16 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
105
105
|
const projectMode = Boolean(singleProject || registry);
|
|
106
106
|
const describe = (snapshot, originals) => originals && snapshot.kind !== 'sketch' ? originals.describe(snapshot, reports) : snapshot;
|
|
107
107
|
let origin;
|
|
108
|
+
let allowedHosts;
|
|
108
109
|
const canWrite = request => !readOnly && authenticated(request.headers['x-locus-write'], capability);
|
|
109
110
|
// A comparison failure never changes the confirmation of the main read/save.
|
|
110
|
-
async function withComparison(saved) {
|
|
111
|
+
async function withComparison(saved, requestOrigin = origin) {
|
|
111
112
|
if (!previous) return saved;
|
|
112
113
|
let comparison;
|
|
113
114
|
try {
|
|
114
115
|
const snapshot = await previous.read();
|
|
115
116
|
comparison = { status: 'available', scope: 'saved-documents',
|
|
116
|
-
previous: { path: previous.path, url: snapshot.loaded.scenes ? `${
|
|
117
|
+
previous: { path: previous.path, url: snapshot.loaded.scenes ? `${requestOrigin}/?document=${encodeURIComponent(previous.path)}` : null },
|
|
117
118
|
report: compareMapDocuments({ previous: snapshot.loaded, candidate: await loadChainBundle(JSON.stringify(saved.bundle)) }),
|
|
118
119
|
};
|
|
119
120
|
} catch (error) {
|
|
@@ -133,11 +134,13 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
133
134
|
response.end(JSON.stringify(value));
|
|
134
135
|
};
|
|
135
136
|
try {
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
const requestHost = typeof request.headers.host === 'string' ? request.headers.host.toLowerCase() : '';
|
|
138
|
+
const requestOrigin = `http://${requestHost}`;
|
|
139
|
+
if (!allowedHosts.has(requestHost)
|
|
140
|
+
|| (request.headers.origin && request.headers.origin !== requestOrigin)) {
|
|
138
141
|
return json(403, { code: 'ORIGIN_REFUSED', message: 'The request must come from this local viewer.', outcome: 'rejected' });
|
|
139
142
|
}
|
|
140
|
-
const url = new URL(request.url,
|
|
143
|
+
const url = new URL(request.url, requestOrigin);
|
|
141
144
|
const rawPath = request.url.split('?')[0];
|
|
142
145
|
if (!rawPath.startsWith('/') || rawPath !== url.pathname || /%(?:2f|5c|2e|25)/i.test(rawPath) || rawPath.includes('\\')) {
|
|
143
146
|
return json(404, { code: 'PATH_REFUSED', message: 'Unknown asset path.', outcome: 'rejected' });
|
|
@@ -169,7 +172,7 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
169
172
|
}
|
|
170
173
|
const context = () => registry ? registry.get(url.searchParams.get('project')) : singleContext;
|
|
171
174
|
if (url.pathname === '/api/original') {
|
|
172
|
-
if (request.method !== 'POST' || request.headers.origin !==
|
|
175
|
+
if (request.method !== 'POST' || request.headers.origin !== requestOrigin || request.headers['x-locus-action'] !== 'open-in-zed') {
|
|
173
176
|
return json(403, { message: 'Open the source from its local viewer.' });
|
|
174
177
|
}
|
|
175
178
|
const query = url.searchParams;
|
|
@@ -188,7 +191,7 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
188
191
|
return result.opened ? json(200, result) : json(409, { message: result.reason });
|
|
189
192
|
}
|
|
190
193
|
if ((registry || singleProject?.editorPaths) && url.pathname === '/api/project/zed') {
|
|
191
|
-
if (request.method !== 'POST' || request.headers.origin !==
|
|
194
|
+
if (request.method !== 'POST' || request.headers.origin !== requestOrigin || request.headers['x-locus-action'] !== 'open-in-zed') {
|
|
192
195
|
return json(403, { message: 'Open Zed from this local project viewer.' });
|
|
193
196
|
}
|
|
194
197
|
const query = url.searchParams;
|
|
@@ -208,7 +211,7 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
208
211
|
}
|
|
209
212
|
if (registry && url.pathname === '/api/project/sketch') {
|
|
210
213
|
if (request.method !== 'POST') return json(405, { code: 'METHOD_REFUSED', message: 'Method not supported.' });
|
|
211
|
-
if (request.headers.origin !==
|
|
214
|
+
if (request.headers.origin !== requestOrigin || !canWrite(request)) {
|
|
212
215
|
return json(403, { code: 'READ_ONLY', message: 'No permission to create a drawing.', outcome: 'rejected' });
|
|
213
216
|
}
|
|
214
217
|
const query = url.searchParams;
|
|
@@ -230,7 +233,7 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
230
233
|
if (!reading && (request.method !== 'POST' || catalogRequest)) {
|
|
231
234
|
return json(405, { code: 'METHOD_REFUSED', message: 'Method not supported.', outcome: 'rejected' });
|
|
232
235
|
}
|
|
233
|
-
if (!reading && (request.headers.origin !==
|
|
236
|
+
if (!reading && (request.headers.origin !== requestOrigin || !canWrite(request))) {
|
|
234
237
|
return json(403, { code: 'READ_ONLY', message: 'No permission to write this document.', outcome: 'rejected' });
|
|
235
238
|
}
|
|
236
239
|
const { project, originals } = await context();
|
|
@@ -258,13 +261,13 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
258
261
|
if (!snapshot.loaded.scenes) throw new DocumentError('UNSUPPORTED_MAPPING_VERSION', 'The presentation of the previous version is not supported; only a limited mapping is available.');
|
|
259
262
|
return json(200, { path: previous.path, revision: previousRevision, readOnly: true, bundle: snapshot.loaded.bundle });
|
|
260
263
|
}
|
|
261
|
-
if (request.method === 'GET') return json(200, await describe(await withComparison(await document.read()), singleOriginals));
|
|
264
|
+
if (request.method === 'GET') return json(200, await describe(await withComparison(await document.read(), requestOrigin), singleOriginals));
|
|
262
265
|
if (request.method !== 'POST') return json(405, { code: 'METHOD_REFUSED', message: 'Method not supported.', outcome: 'rejected' });
|
|
263
|
-
if (request.headers.origin !==
|
|
266
|
+
if (request.headers.origin !== requestOrigin || !canWrite(request)) {
|
|
264
267
|
return json(403, { code: 'READ_ONLY', message: 'No permission to write this document.', outcome: 'rejected' });
|
|
265
268
|
}
|
|
266
269
|
const confirmed = await document.save(await saveInput(request));
|
|
267
|
-
return json(200, await withComparison(confirmed));
|
|
270
|
+
return json(200, await withComparison(confirmed, requestOrigin));
|
|
268
271
|
}
|
|
269
272
|
if (!['GET', 'HEAD'].includes(request.method)) return json(405, { code: 'METHOD_REFUSED', message: 'Method not supported.' });
|
|
270
273
|
const asset = assets.get(url.pathname);
|
|
@@ -279,7 +282,13 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
279
282
|
}
|
|
280
283
|
});
|
|
281
284
|
const sockets = new Set();
|
|
282
|
-
|
|
285
|
+
let closing;
|
|
286
|
+
let serverClosed = false;
|
|
287
|
+
server.on('connection', socket => {
|
|
288
|
+
if (closing) { socket.destroy(); return; }
|
|
289
|
+
sockets.add(socket);
|
|
290
|
+
socket.once('close', () => sockets.delete(socket));
|
|
291
|
+
});
|
|
283
292
|
server.requestTimeout = 30000;
|
|
284
293
|
server.headersTimeout = 10000;
|
|
285
294
|
try {
|
|
@@ -292,7 +301,9 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
292
301
|
server.once('error', reject);
|
|
293
302
|
server.listen(port, '127.0.0.1', resolve);
|
|
294
303
|
});
|
|
295
|
-
|
|
304
|
+
const boundPort = server.address().port;
|
|
305
|
+
origin = `http://127.0.0.1:${boundPort}`;
|
|
306
|
+
allowedHosts = new Set([`127.0.0.1:${boundPort}`, `localhost:${boundPort}`]);
|
|
296
307
|
} catch (error) { await reports?.close(); await document?.close(); await previous?.close(); await singleProject?.close(); await registry?.close(); throw error; }
|
|
297
308
|
const launch = new URL('/', origin);
|
|
298
309
|
if (registry) launch.searchParams.set('project', registry.entry);
|
|
@@ -303,20 +314,33 @@ export async function startMapViewer({ filePath, projectPath, libraryRoot, regis
|
|
|
303
314
|
if (registry) fragment.set('workspace', discovery);
|
|
304
315
|
launch.hash = fragment.toString();
|
|
305
316
|
const url = launch.href;
|
|
306
|
-
|
|
317
|
+
const destroyConnections = () => {
|
|
318
|
+
server.closeAllConnections?.();
|
|
319
|
+
for (const socket of sockets) socket.destroy();
|
|
320
|
+
};
|
|
307
321
|
return {
|
|
308
322
|
url,
|
|
309
323
|
documentPath: document?.path,
|
|
310
324
|
previousDocumentPath: previous?.path,
|
|
311
|
-
close: ({ force = false } = {}) =>
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
325
|
+
close: ({ force = false } = {}) => {
|
|
326
|
+
if (!closing) {
|
|
327
|
+
closing = (async () => {
|
|
328
|
+
const closed = new Promise((resolve, reject) => server.close(error => error ? reject(error) : resolve()));
|
|
329
|
+
server.closeIdleConnections?.();
|
|
330
|
+
for (const socket of sockets) if (socket.bytesRead === 0 && !socket._httpMessage) socket.destroy();
|
|
331
|
+
if (force) destroyConnections();
|
|
332
|
+
try { await Promise.all([closed, reports?.close()]); }
|
|
333
|
+
finally {
|
|
334
|
+
serverClosed = true;
|
|
335
|
+
if (registry) await registry.close();
|
|
336
|
+
else if (singleProject) await singleProject.close();
|
|
337
|
+
else try { await document.close(); } finally { await previous?.close(); }
|
|
338
|
+
}
|
|
339
|
+
})();
|
|
340
|
+
} else if (force && !serverClosed) {
|
|
341
|
+
destroyConnections();
|
|
319
342
|
}
|
|
320
|
-
|
|
343
|
+
return closing;
|
|
344
|
+
},
|
|
321
345
|
};
|
|
322
346
|
}
|
|
@@ -24,7 +24,7 @@ export async function originalMaterials(sourceRoot, expectedIdentity) {
|
|
|
24
24
|
|
|
25
25
|
async function locate(file) {
|
|
26
26
|
if (!projectRoot) return { reason: 'The declared source root is unavailable. Restart the viewer with its repository directory.' };
|
|
27
|
-
if (!isPortablePath(file?.sourcePath) || !['markdown', 'report', 'original'].includes(file.kind)) {
|
|
27
|
+
if (!isPortablePath(file?.sourcePath) || !['markdown', 'report', 'original', 'canvas'].includes(file.kind)) {
|
|
28
28
|
return { reason: unavailable };
|
|
29
29
|
}
|
|
30
30
|
const candidate = path.join(root, file.sourcePath);
|
|
@@ -36,6 +36,7 @@ export async function startOriginalReportServer(readOriginal) {
|
|
|
36
36
|
server.listen(0, '127.0.0.1', resolve);
|
|
37
37
|
});
|
|
38
38
|
const host = '127.0.0.1:' + server.address().port;
|
|
39
|
+
let closing;
|
|
39
40
|
return {
|
|
40
41
|
links(map, files, project) {
|
|
41
42
|
return Object.fromEntries(files.map(([id, sourcePath]) => {
|
|
@@ -44,9 +45,12 @@ export async function startOriginalReportServer(readOriginal) {
|
|
|
44
45
|
}));
|
|
45
46
|
},
|
|
46
47
|
close() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
return closing ??= (() => {
|
|
49
|
+
const closed = new Promise((resolve, reject) => server.close(error => error ? reject(error) : resolve()));
|
|
50
|
+
server.closeIdleConnections?.();
|
|
51
|
+
server.closeAllConnections?.();
|
|
52
|
+
return closed;
|
|
53
|
+
})();
|
|
50
54
|
},
|
|
51
55
|
};
|
|
52
56
|
}
|
|
@@ -72,7 +72,14 @@ function parseCatalog(text) {
|
|
|
72
72
|
|
|
73
73
|
const diagnostic = (code, message) => ({ code, message });
|
|
74
74
|
const writeLimit = error => {
|
|
75
|
-
if (error.code === 'DOCUMENT_LOCKED')
|
|
75
|
+
if (error.code === 'DOCUMENT_LOCKED') {
|
|
76
|
+
const reason = diagnostic('DOCUMENT_LOCKED', 'The document is open for writing in another viewer.');
|
|
77
|
+
if (error.lock) {
|
|
78
|
+
const { pid, role, createdAt, stale } = error.lock;
|
|
79
|
+
reason.lock = { pid, role, createdAt, stale };
|
|
80
|
+
}
|
|
81
|
+
return reason;
|
|
82
|
+
}
|
|
76
83
|
if (['READ_ONLY', 'EACCES', 'EPERM', 'EROFS'].includes(error.code)) {
|
|
77
84
|
return diagnostic('READ_ONLY', 'The document or its directory is read-only.');
|
|
78
85
|
}
|
|
@@ -460,11 +467,16 @@ async function openProject({ projectRoot, catalog: { id: project, entry, documen
|
|
|
460
467
|
if (!sketch && !member.document.modelId) await read(map);
|
|
461
468
|
if (closing) throw new DocumentError('OWNER_CLOSED', 'The project viewer is closing.');
|
|
462
469
|
try {
|
|
463
|
-
member.writer ??= await (sketch ? openSketchWriter(member.file)
|
|
470
|
+
member.writer ??= await (sketch ? openSketchWriter(member.file)
|
|
471
|
+
: openLocalDocument({ projectFile: member.file, modelId: member.document.modelId, role: 'viewer' }));
|
|
464
472
|
return scoped(map, member, await member.writer.read({ requireWrite: true }));
|
|
465
473
|
} catch (error) {
|
|
466
474
|
const readOnlyReason = writeLimit(error);
|
|
467
475
|
if (!readOnlyReason) throw error;
|
|
476
|
+
if (error.code === 'DOCUMENT_LOCKED' && member.writer) {
|
|
477
|
+
await closeWriter(member);
|
|
478
|
+
member.writer = undefined;
|
|
479
|
+
}
|
|
468
480
|
return { ...await read(map), readOnlyReason };
|
|
469
481
|
}
|
|
470
482
|
}),
|
|
@@ -131,7 +131,7 @@ export async function bindMapInputs(repository, library, entries, registryFile)
|
|
|
131
131
|
if (!artifactPath(document, artifact) || path.dirname(path.resolve(bundlePath)) !== path.resolve(outputDir)) throw new Error('Unexpected candidate for the build input record.');
|
|
132
132
|
const artifactVersion = await localFileVersion(library.path, artifact);
|
|
133
133
|
if (!artifactVersion) throw new Error('The verified build output is missing.');
|
|
134
|
-
const lock = await acquireDocumentLock(record, { checkParents: guard });
|
|
134
|
+
const lock = await acquireDocumentLock(record, { checkParents: guard, role: 'build' });
|
|
135
135
|
try {
|
|
136
136
|
const data = { format: 'locus-map.build-inputs', version: 1, document, artifact, artifactVersion, workingRoot, recipe, inputs: source.inputs, versions: before };
|
|
137
137
|
const text = JSON.stringify(data) + '\n';
|
|
@@ -18,7 +18,7 @@ export async function publishSketch({ library, map, text, check, io = fs }) {
|
|
|
18
18
|
await io.access(library.path, constants.W_OK);
|
|
19
19
|
const filename = path.join(library.path, map);
|
|
20
20
|
const parentCheck = () => check(false);
|
|
21
|
-
const lock = await acquireDocumentLock(filename, { io, checkParents: parentCheck }).catch(error => {
|
|
21
|
+
const lock = await acquireDocumentLock(filename, { io, checkParents: parentCheck, role: 'sketch-create' }).catch(error => {
|
|
22
22
|
if (error.code === 'DOCUMENT_LOCKED') throw collision();
|
|
23
23
|
throw error;
|
|
24
24
|
});
|
|
@@ -59,7 +59,7 @@ export async function buildTaskDocument({ root = '.', tasksDir, map, includeArch
|
|
|
59
59
|
throw new Error('Task facts or the project author module changed during the build. Rebuild the map.');
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
const lock = await acquireDocumentLock(dest, { checkParents: checkParent });
|
|
62
|
+
const lock = await acquireDocumentLock(dest, { checkParents: checkParent, role: 'task-build' });
|
|
63
63
|
async function publishTaskDocument(stage, out, { last, bundleName }) {
|
|
64
64
|
await lock.check();
|
|
65
65
|
const temp = join(parent, '.locus-map-' + randomUUID() + '.tmp');
|