@locus-forge/locus-map 0.2.2-dev.20261206.g5e970d2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{abnfDiagram-VCTEODGH-JiCO6vo-.js → abnfDiagram-VCTEODGH-YtlnkH6t.js} +1 -1
- package/dist/assets/{ar-SA-G6X2FPQ2-BdzEBmp3.js → ar-SA-G6X2FPQ2-BH5AlOAp.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-D7T_vJwe.js → architectureDiagram-5GKGNRK7-DKYw7IM8.js} +1 -1
- package/dist/assets/{az-AZ-76LH7QW2-BQ_SoVB7.js → az-AZ-76LH7QW2-DoI4xcyq.js} +1 -1
- package/dist/assets/{bg-BG-XCXSNQG7-DlH1olUf.js → bg-BG-XCXSNQG7-CS9_2dp-.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-DPz0LEjY.js → blockDiagram-I7D4REHJ-FelDwD1I.js} +1 -1
- package/dist/assets/{bn-BD-2XOGV67Q-CFIZU06C.js → bn-BD-2XOGV67Q-CoIu5tTK.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-B6uCi0Ol.js → c4Diagram-7LVT6UL2-Bh7h9IHP.js} +1 -1
- package/dist/assets/{ca-ES-6MX7JW3Y-Bpe3kOti.js → ca-ES-6MX7JW3Y-DAEHzf3H.js} +1 -1
- package/dist/assets/channel-DXsl7ag_.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DTWRWhpx.js → chunk-2Q5K7J3B-CgUOCDxa.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-Dfr1HUAN.js → chunk-5VM5RSS4-B97oha-s.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-D_IVoCIK.js → chunk-F27PBJKO-BQGqI2Ej.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-Boa_chn8.js → chunk-IMKFNOWR-C_sOeFT_.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-RaK8jzc2.js → chunk-JWPE2WC7-DG5n2owX.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-D7xOpv6O.js → chunk-POPQ4Y6H-Y-h3THrr.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-XvJsx1jt.js → chunk-SVP7TREG-Dn6yBHtF.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-DZCVWmZG.js → chunk-TICWLB2K-Cb_yWOVI.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-Djk-REAy.js → chunk-XXDRQBXY-QE51OqTj.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-DLyWZtYF.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-Cb3mb68m.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-D6XaIbtG.js → cose-bilkent-JH36ORCC-Bt7ZI9S1.js} +1 -1
- package/dist/assets/{cs-CZ-2BRQDIVT-BdzgSHdJ.js → cs-CZ-2BRQDIVT-BKZzkx2M.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-BMTkMDG1.js → cynefin-OW5HDTMX-n6-BmECj.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-C2s5i9h9.js → cynefinDiagram-5FMLGOSQ-Bq2km1fZ.js} +1 -1
- package/dist/assets/{d3-scale-BMIMKl27.js → d3-scale-C9oJHYFk.js} +1 -1
- package/dist/assets/{da-DK-5WZEPLOC-Bj-GFWHU.js → da-DK-5WZEPLOC-DWJm1_Yl.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-CMT8wlz0.js → dagre-GXQ25YYZ-D9EJj_nK.js} +1 -1
- package/dist/assets/{de-DE-XR44H4JA-JmpondAB.js → de-DE-XR44H4JA-D-5dMJXD.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-DU1blS3M.js → diagram-S7CK7UJ4-DX3qZf_H.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-0lWi4KDV.js → diagram-UQ7AKVKN-lODsxrZ9.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-CrseWrhn.js → diagram-VSXAHHWV-B48xz8Xq.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-C5BMS8Ql.js → diagram-VX7I27RA-Dms2AfBa.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-Cc3vq6b8.js → diagram-Z3DM3KII-BnwZBeJA.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-ZF78imma.js → ebnfDiagram-PWID7BFC-OtcCvaIU.js} +1 -1
- package/dist/assets/{el-GR-BZB4AONW-BFslUpdm.js → el-GR-BZB4AONW-BZVA3YVN.js} +1 -1
- package/dist/assets/{engines-BtEtIBXt.js → engines-DPbXorS1.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-CjPjDn2i.js → erDiagram-RLTQ6QDP-Cnh8Gn9f.js} +1 -1
- package/dist/assets/{es-ES-U4NZUMDT-B0ezBTxQ.js → es-ES-U4NZUMDT-DKJIfS-2.js} +1 -1
- package/dist/assets/{eu-ES-A7QVB2H4-DP_gx2kf.js → eu-ES-A7QVB2H4-LHCF7lHc.js} +1 -1
- package/dist/assets/{fa-IR-HGAKTJCU-BuT1ELty.js → fa-IR-HGAKTJCU-CMtLvHxY.js} +1 -1
- package/dist/assets/{fi-FI-Z5N7JZ37-BAu_Cj7n.js → fi-FI-Z5N7JZ37-CUIzm5UM.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-yqPGWNdd.js → flowDiagram-HODETNUW-lneiCvFi.js} +1 -1
- package/dist/assets/{fr-FR-RHASNOE6-OF1CpgtN.js → fr-FR-RHASNOE6-DTJ2WS73.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-zUY5je2K.js → ganttDiagram-EL5Y4UJY-B2aJ2MDb.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-oWrs7wy0.js → gitGraphDiagram-WWUBYQGX-C74V3MFm.js} +1 -1
- package/dist/assets/{gl-ES-HMX3MZ6V-CkJ47l98.js → gl-ES-HMX3MZ6V-BP8M0fQQ.js} +1 -1
- package/dist/assets/{he-IL-6SHJWFNN-D7CecRlh.js → he-IL-6SHJWFNN-BMd-Q0PW.js} +1 -1
- package/dist/assets/{hi-IN-IWLTKZ5I-CGlW2X-h.js → hi-IN-IWLTKZ5I-Ct52OkX5.js} +1 -1
- package/dist/assets/{hu-HU-A5ZG7DT2-Dq_n_tbp.js → hu-HU-A5ZG7DT2-NfIL6Jfo.js} +1 -1
- package/dist/assets/{id-ID-SAP4L64H-CotwO_06.js → id-ID-SAP4L64H-Osl6P1wb.js} +1 -1
- package/dist/assets/{index-CdVc9Lmz.js → index-CyQSsku0.js} +181 -181
- package/dist/assets/{index-Cv-tTxNC.css → index-DR6sd54W.css} +1 -1
- package/dist/assets/{index-VaWCb9bx.js → index-VfiAlFSM.js} +5 -5
- package/dist/assets/{infoDiagram-27XIBGKW-CYzIkNFW.js → infoDiagram-27XIBGKW-BjDMKD-X.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-DkgUsuk5.js → ishikawaDiagram-5VMMS53U-DjrBmz8f.js} +1 -1
- package/dist/assets/{it-IT-JPQ66NNP-h97o81us.js → it-IT-JPQ66NNP-vT-EYZw5.js} +1 -1
- package/dist/assets/{ja-JP-DBVTYXUO-M6EVfh0o.js → ja-JP-DBVTYXUO-DexyPC4p.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-CuKkNrJy.js → journeyDiagram-3NMN7TZE-Bs5RL4Ef.js} +1 -1
- package/dist/assets/{kaa-6HZHGXH3-DUy85zzz.js → kaa-6HZHGXH3-0BLUFlXY.js} +1 -1
- package/dist/assets/{kab-KAB-ZGHBKWFO-ChL-fKtk.js → kab-KAB-ZGHBKWFO-ByGN5_Fc.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-DkOxt3kf.js → kanban-definition-UXKFOSKX-DgcopnbA.js} +1 -1
- package/dist/assets/{kk-KZ-P5N5QNE5-DY6ucSGD.js → kk-KZ-P5N5QNE5-DlK-wQWu.js} +1 -1
- package/dist/assets/{km-KH-HSX4SM5Z-BAaS4014.js → km-KH-HSX4SM5Z-BZ75967_.js} +1 -1
- package/dist/assets/{ko-KR-MTYHY66A-D-r3mJ1R.js → ko-KR-MTYHY66A-C-copauZ.js} +1 -1
- package/dist/assets/{ku-TR-6OUDTVRD-Dk1GCoOP.js → ku-TR-6OUDTVRD-CNqY-Uj4.js} +1 -1
- package/dist/assets/{layout-DtNEGI4_.js → layout-B8D2HGrb.js} +1 -1
- package/dist/assets/{lt-LT-XHIRWOB4-3Z2Ui1VZ.js → lt-LT-XHIRWOB4-BopE_XJX.js} +1 -1
- package/dist/assets/{lv-LV-5QDEKY6T-Bg59rOkR.js → lv-LV-5QDEKY6T--7hU3JSZ.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-Dcs8eV7p.js → mindmap-definition-YA3MSWOX-DYOVTEyE.js} +1 -1
- package/dist/assets/{mr-IN-CRQNXWMA-DepTOG29.js → mr-IN-CRQNXWMA-DydjVI2G.js} +1 -1
- package/dist/assets/{my-MM-5M5IBNSE-4KqL4Tav.js → my-MM-5M5IBNSE-D6ewM-EV.js} +1 -1
- package/dist/assets/{nb-NO-T6EIAALU-5YWO_l3W.js → nb-NO-T6EIAALU--iqOwj15.js} +1 -1
- package/dist/assets/{nl-NL-IS3SIHDZ-QlAndkM2.js → nl-NL-IS3SIHDZ-Bnhl_SmS.js} +1 -1
- package/dist/assets/{nn-NO-6E72VCQL-BscwhEDW.js → nn-NO-6E72VCQL-CIx7sLAQ.js} +1 -1
- package/dist/assets/{oc-FR-POXYY2M6-k7bYbSQj.js → oc-FR-POXYY2M6-DWt5a8Ow.js} +1 -1
- package/dist/assets/{pa-IN-N4M65BXN-jxBFwrWj.js → pa-IN-N4M65BXN-BW3LNure.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-zM-VZA3r.js → pegDiagram-XKGWAZYB-ixSY_9-e.js} +1 -1
- package/dist/assets/{pica-CsWQ4DPU.js → pica-Dn0N8xAP.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-C60FE0D8.js → pieDiagram-E7YTZNPT-BbCRV6Qi.js} +1 -1
- package/dist/assets/{pl-PL-T2D74RX3-be8atU_l.js → pl-PL-T2D74RX3-7nXJ8SiV.js} +1 -1
- package/dist/assets/{pt-BR-5N22H2LF-CSE0O2fj.js → pt-BR-5N22H2LF-DKGGof4J.js} +1 -1
- package/dist/assets/{pt-PT-UZXXM6DQ-5rnYJhy1.js → pt-PT-UZXXM6DQ-DCLEXuhk.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-DyH84hx6.js → quadrantDiagram-AXDQQJYC-Bvh_H4wg.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-DCrJgP9s.js → railroadDiagram-O6MQD6OU-DHC3neQ8.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-C78-QlFo.js → requirementDiagram-BXWQKSXE-DuCkl3u1.js} +1 -1
- package/dist/assets/{ro-RO-JPDTUUEW-Gh6EgC27.js → ro-RO-JPDTUUEW-Cwf4k3Ou.js} +1 -1
- package/dist/assets/{ru-RU-B4JR7IUQ-BUWESZhq.js → ru-RU-B4JR7IUQ-sZF6fySs.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-D_MOkKEs.js → sankeyDiagram-P5KCCOFB-1ELTqwtI.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-BeQbHZRB.js → sequenceDiagram-WJ2MYXX4-BK8Ou8Dz.js} +1 -1
- package/dist/assets/{si-LK-N5RQ5JYF-C9pnvQMf.js → si-LK-N5RQ5JYF-DmYhXIqO.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-DUn-Mus_.js → sizeCapture-INFHLROL-BKwx3lxX.js} +1 -1
- package/dist/assets/{sk-SK-C5VTKIMK-FnkPBibb.js → sk-SK-C5VTKIMK-BRLu35YX.js} +1 -1
- package/dist/assets/{sl-SI-NN7IZMDC-Cwrqj_B9.js → sl-SI-NN7IZMDC-CMjfvJTr.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-C3EF3jQ3.js → stateDiagram-D77RDMKH-CDwJ9XLN.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BZjKARGY.js +1 -0
- package/dist/assets/{subset-shared.chunk-8ifLcT_D.js → subset-shared.chunk-DngAvf0H.js} +1 -1
- package/dist/assets/{subset-worker.chunk-DrNTybDR.js → subset-worker.chunk-DkH_mqr5.js} +1 -1
- package/dist/assets/{sv-SE-XGPEYMSR-Btz80pGx.js → sv-SE-XGPEYMSR-G4S06sbd.js} +1 -1
- package/dist/assets/{swimlanes-42K2YHIH-B2_kGhPA.js → swimlanes-42K2YHIH-Z9u8PDi-.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-D0kM5xmS.js +8 -0
- package/dist/assets/{ta-IN-2NMHFXQM-B0bWtgu1.js → ta-IN-2NMHFXQM-DgBbCQ8S.js} +1 -1
- package/dist/assets/{th-TH-HPSO5L25-DgC0yFw3.js → th-TH-HPSO5L25-o9u4fVfq.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-Bu0W3Mcy.js → timeline-definition-24CTP7MA-BNgrm1r_.js} +1 -1
- package/dist/assets/{tr-TR-DEFEU3FU-C9Mmy6ri.js → tr-TR-DEFEU3FU-BqqSdzoL.js} +1 -1
- package/dist/assets/{uk-UA-QMV73CPH-rxEnqB_i.js → uk-UA-QMV73CPH-Dna46aia.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-63JTeOph.js → vennDiagram-4TSXK5OY-CHwUI40M.js} +1 -1
- package/dist/assets/{vi-VN-M7AON7JQ-DOVa-vAT.js → vi-VN-M7AON7JQ-CbKRBQPB.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-Bct0TRuC.js → wardleyDiagram-VM6X3IG4-KB0xBjXX.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-C21zgvSM.js → xychartDiagram-S5SC5T6Z-B3LOQLL-.js} +1 -1
- package/dist/assets/{zh-CN-LNUGB5OW-MyifsmQ8.js → zh-CN-LNUGB5OW-BFjA6n_2.js} +1 -1
- package/dist/assets/{zh-HK-E62DVLB3-Cp55UViv.js → zh-HK-E62DVLB3-BoTU6iS7.js} +1 -1
- package/dist/assets/{zh-TW-RAJ6MFWO-DMy6SZap.js → zh-TW-RAJ6MFWO-DB4kdpOS.js} +1 -1
- package/dist/index.html +2 -2
- package/docs/LOCAL-DOCUMENT.md +36 -83
- package/docs/VIEWER-LAUNCH.md +24 -27
- package/docs/adr/ADR-002-2026-12-03-project-selector/ADR-002-2026-12-03-project-selector.md +1 -1
- package/docs/adr/ADR-005-2026-12-04-named-libraries/ADR-005-2026-12-04-named-libraries.md +1 -1
- package/package.json +1 -1
- package/scripts/lib/library-directory.mjs +1 -1
- package/scripts/lib/map-build-invocation.mjs +5 -1
- package/scripts/lib/map-viewer-server.mjs +148 -20
- package/scripts/lib/project-catalog.mjs +250 -95
- package/scripts/lib/project-registry.mjs +151 -47
- package/scripts/lib/view-args.mjs +25 -45
- package/scripts/locus-map.mjs +12 -11
- package/scripts/open-map.mjs +18 -8
- package/skills/locus-map/SKILL.md +6 -4
- package/skills/locus-map/references/checks.md +1 -1
- package/skills/locus-map/references/component-checkpoint.md +4 -4
- package/skills/locus-map/references/folder.md +2 -2
- package/skills/locus-map/references/selection.md +2 -2
- package/skills/locus-map/references/visual-composition.md +20 -20
- package/skills/locus-map-draft/SKILL.md +76 -76
- package/skills/locus-map-draft/references/divergence-and-formats.md +58 -107
- package/skills/locus-map-primitives/SKILL.md +11 -14
- package/skills/locus-map-primitives/assets/batch/README.md +2 -2
- package/skills/locus-map-primitives/assets/batch/build.mjs +1 -1
- package/skills/locus-map-primitives/assets/batch/{project.json → topic.json} +13 -20
- package/src/bundle/projectClient.js +5 -3
- package/src/main.jsx +25 -1
- package/src/viewer/ControlIcon.jsx +2 -0
- package/src/viewer/ProjectLocation.jsx +25 -7
- package/src/viewer/ProjectRail.jsx +9 -2
- package/src/viewer/ProjectViewChainViewer.jsx +35 -16
- package/src/viewer/SketchCanvas.jsx +124 -15
- package/src/viewer/ViewChainViewer.jsx +14 -5
- package/src/viewer/ViewerSettings.jsx +208 -0
- package/src/viewer/projectContents.js +248 -55
- package/src/viewer/projectNavigation.js +27 -3
- package/src/viewer/viewChain.css +52 -1
- package/dist/assets/channel-DB3atv5o.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-CzvsXoj_.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-HxwJpdPt.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-CVQHmIvK.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-C1rOmrkT.js +0 -8
|
@@ -9,65 +9,121 @@ import { isSketchPath, loadSketch, sketchFilename, sketchNameError, sketchView }
|
|
|
9
9
|
import { captureDirectory, directoryIdentity, checkLibraryDirectory } from './library-directory.mjs';
|
|
10
10
|
import { publishSketch } from './sketch-publication.mjs';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
const limits = { bytes: 256 * 1024, documents: 128, links: 512, libraryEntries: 10_000 };
|
|
12
|
+
const limits = { bytes: 256 * 1024, documents: 128, links: 512, libraryEntries: 10_000, maxDepth: 8 };
|
|
14
13
|
const validId = value => typeof value === 'string' && value.length <= 128
|
|
15
14
|
&& /^[A-Za-z0-9][A-Za-z0-9._:-]*$/u.test(value) && !isReservedKey(value);
|
|
15
|
+
const isMapPath = value => isPortablePath(value) && value.endsWith('.locus-map.json');
|
|
16
|
+
const isTopicDocPath = value => isMapPath(value) || isSketchPath(value);
|
|
17
|
+
const isChildName = value => typeof value === 'string' && value.length > 0 && value.length <= 128
|
|
18
|
+
&& !value.includes('/') && !value.includes('\\') && !value.startsWith('.') && value !== '.' && value !== '..' && !isReservedKey(value);
|
|
16
19
|
const linkKey = ({ map, view, trigger }) => `${map}\0${view}\0${trigger}`;
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const allowedTopicKeys = ['version', 'title', 'entry', 'order', 'models', 'sources', 'links', 'navigation'];
|
|
22
|
+
|
|
23
|
+
export function parseTopicManifest(text) {
|
|
24
|
+
const requireManifest = (condition, message) => {
|
|
20
25
|
if (!condition) throw new DocumentError('INVALID_PROJECT', message);
|
|
21
26
|
};
|
|
22
|
-
const
|
|
27
|
+
const manifest = JSON.parse(text);
|
|
23
28
|
rejectDuplicateJsonKeys(text);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
requireManifest(manifest && typeof manifest === 'object' && !Array.isArray(manifest), 'Topic manifest must be a JSON object.');
|
|
30
|
+
const presentKeys = allowedTopicKeys.filter(key => Object.hasOwn(manifest, key));
|
|
31
|
+
exactKeys(manifest, ['version', ...presentKeys.filter(key => key !== 'version')], 'Topic manifest');
|
|
32
|
+
requireManifest(manifest.version === 1, 'Expected a version 1 topic manifest.');
|
|
33
|
+
|
|
34
|
+
let title;
|
|
35
|
+
if (Object.hasOwn(manifest, 'title')) {
|
|
36
|
+
requireManifest(typeof manifest.title === 'string' && manifest.title.trim() && manifest.title.length <= 256, 'Topic title must be a non-empty string.');
|
|
37
|
+
title = manifest.title.trim();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const checkAddress = (address, fields, label, pathCheck = isMapPath) => {
|
|
41
|
+
requireManifest(address && typeof address === 'object' && !Array.isArray(address), `${label} must be an object.`);
|
|
27
42
|
exactKeys(address, fields, label);
|
|
28
|
-
|
|
43
|
+
for (const field of fields) {
|
|
44
|
+
if (field === 'map') requireManifest(pathCheck(address.map), `${label} must use a portable relative document path.`);
|
|
45
|
+
else requireManifest(validId(address[field]), `${label} must use stable IDs.`);
|
|
46
|
+
}
|
|
29
47
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
exactKeys(document, ['id', 'modelId', 'path'], 'Project document');
|
|
36
|
-
requireCatalog(validId(document.id) && validId(document.modelId), 'Project documents must use stable IDs.');
|
|
37
|
-
requireCatalog(isPortablePath(document.path) && document.path.endsWith('.locus-map.json'),
|
|
38
|
-
'Project documents must use portable relative .locus-map.json paths.');
|
|
39
|
-
requireCatalog(!ids.has(document.id) && !paths.has(document.path), 'Project document IDs and paths must be unique.');
|
|
40
|
-
ids.add(document.id);
|
|
41
|
-
paths.add(document.path);
|
|
48
|
+
|
|
49
|
+
let entry;
|
|
50
|
+
if (Object.hasOwn(manifest, 'entry')) {
|
|
51
|
+
checkAddress(manifest.entry, ['map', 'view'], 'Topic entry', isTopicDocPath);
|
|
52
|
+
entry = manifest.entry;
|
|
42
53
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
|
|
55
|
+
let order;
|
|
56
|
+
if (Object.hasOwn(manifest, 'order')) {
|
|
57
|
+
requireManifest(Array.isArray(manifest.order) && manifest.order.length > 0 && manifest.order.length <= limits.documents,
|
|
58
|
+
'Topic order must be a non-empty list of child names.');
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
for (const name of manifest.order) {
|
|
61
|
+
requireManifest(isChildName(name) && !seen.has(name), 'Topic order entries must be unique child folder or file names.');
|
|
62
|
+
seen.add(name);
|
|
63
|
+
}
|
|
64
|
+
order = manifest.order;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const models = new Map();
|
|
68
|
+
if (Object.hasOwn(manifest, 'models')) {
|
|
69
|
+
requireManifest(manifest.models && typeof manifest.models === 'object' && !Array.isArray(manifest.models),
|
|
70
|
+
'Topic models must map relative map paths to model IDs.');
|
|
71
|
+
const entries = Object.entries(manifest.models);
|
|
72
|
+
requireManifest(entries.length <= limits.documents, `Expected at most ${limits.documents} model pins.`);
|
|
73
|
+
for (const [docPath, modelId] of entries) {
|
|
74
|
+
requireManifest(isMapPath(docPath) && validId(modelId), 'Topic models must map portable .locus-map.json paths to stable model IDs.');
|
|
75
|
+
models.set(docPath, modelId);
|
|
76
|
+
}
|
|
48
77
|
}
|
|
49
|
-
|
|
78
|
+
|
|
79
|
+
const sources = new Map();
|
|
80
|
+
if (Object.hasOwn(manifest, 'sources')) {
|
|
81
|
+
requireManifest(manifest.sources && typeof manifest.sources === 'object' && !Array.isArray(manifest.sources),
|
|
82
|
+
'Topic sources must map relative map paths to relative source files.');
|
|
83
|
+
const entries = Object.entries(manifest.sources);
|
|
84
|
+
requireManifest(entries.length <= limits.documents, `Expected at most ${limits.documents} source bindings.`);
|
|
85
|
+
for (const [docPath, sourcePath] of entries) {
|
|
86
|
+
requireManifest(isMapPath(docPath) && isPortablePath(sourcePath), 'Topic sources must use portable relative paths.');
|
|
87
|
+
sources.set(docPath, sourcePath);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const links = [];
|
|
92
|
+
if (Object.hasOwn(manifest, 'links')) {
|
|
93
|
+
requireManifest(Array.isArray(manifest.links) && manifest.links.length <= limits.links, `Expected at most ${limits.links} topic links.`);
|
|
94
|
+
for (const link of manifest.links) {
|
|
95
|
+
exactKeys(link, ['from', 'to'], 'Topic link');
|
|
96
|
+
checkAddress(link.from, ['map', 'view', 'trigger'], 'Topic link source', isMapPath);
|
|
97
|
+
checkAddress(link.to, Object.hasOwn(link.to ?? {}, 'node') ? ['map', 'view', 'node'] : ['map', 'view'], 'Topic link target', isMapPath);
|
|
98
|
+
links.push(link);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let navigation;
|
|
103
|
+
if (Object.hasOwn(manifest, 'navigation')) {
|
|
50
104
|
const targets = new Set();
|
|
51
105
|
let count = 0;
|
|
52
106
|
const visit = (items, depth) => {
|
|
53
|
-
|
|
107
|
+
requireManifest(Array.isArray(items) && items.length && depth <= limits.maxDepth, 'Navigation needs nonempty groups within eight levels.');
|
|
54
108
|
for (const item of items) {
|
|
55
|
-
|
|
109
|
+
requireManifest(++count <= 2048 && item && typeof item === 'object', 'Invalid or oversized topic navigation.');
|
|
56
110
|
if (Object.hasOwn(item, 'children')) {
|
|
57
111
|
exactKeys(item, ['title', 'children'], 'Navigation group');
|
|
58
|
-
|
|
112
|
+
requireManifest(typeof item.title === 'string' && item.title.trim() && item.title.length <= 256, 'Navigation groups need a title.');
|
|
59
113
|
visit(item.children, depth + 1);
|
|
60
114
|
} else {
|
|
61
|
-
checkAddress(item, Object.hasOwn(item, 'node') ? ['map', 'view', 'node'] : ['map', 'view'], 'Navigation destination');
|
|
115
|
+
checkAddress(item, Object.hasOwn(item, 'node') ? ['map', 'view', 'node'] : ['map', 'view'], 'Navigation destination', isTopicDocPath);
|
|
62
116
|
const key = JSON.stringify([item.map, item.view, item.node]);
|
|
63
|
-
|
|
117
|
+
requireManifest(!targets.has(key), 'Navigation needs one location per destination.');
|
|
64
118
|
targets.add(key);
|
|
65
119
|
}
|
|
66
120
|
}
|
|
67
121
|
};
|
|
68
|
-
visit(
|
|
122
|
+
visit(manifest.navigation, 1);
|
|
123
|
+
navigation = manifest.navigation;
|
|
69
124
|
}
|
|
70
|
-
|
|
125
|
+
|
|
126
|
+
return { version: 1, title, entry, order, models, sources, links, navigation };
|
|
71
127
|
}
|
|
72
128
|
|
|
73
129
|
const diagnostic = (code, message) => ({ code, message });
|
|
@@ -188,27 +244,46 @@ async function editorWorkspace(directory, sourceDeclared, expectedIdentity) {
|
|
|
188
244
|
};
|
|
189
245
|
}
|
|
190
246
|
|
|
191
|
-
|
|
192
|
-
if (!
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
247
|
+
async function resolveSafeSourceFile(libraryPath, relativeSourcePath) {
|
|
248
|
+
if (!isPortablePath(relativeSourcePath)) return null;
|
|
249
|
+
const fullPath = path.join(libraryPath, ...relativeSourcePath.split('/'));
|
|
250
|
+
try {
|
|
251
|
+
const stat = await fs.lstat(fullPath);
|
|
252
|
+
if (!stat.isFile()) return null;
|
|
253
|
+
const real = await fs.realpath(fullPath);
|
|
254
|
+
const rel = path.relative(libraryPath, real);
|
|
255
|
+
if (!rel || rel === '..' || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel)) return null;
|
|
256
|
+
return real;
|
|
257
|
+
} catch {
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async function findSiblingSource(libraryPath, docRelativePath) {
|
|
263
|
+
const dir = path.posix.dirname(docRelativePath);
|
|
264
|
+
const stem = path.posix.basename(docRelativePath, '.locus-map.json');
|
|
265
|
+
const candidates = [`${stem}.mjs`, `${stem}.puml`, `${stem}.map.json`, 'gen.mjs', 'build.mjs'];
|
|
266
|
+
for (const name of candidates) {
|
|
267
|
+
const rel = dir === '.' ? name : `${dir}/${name}`;
|
|
268
|
+
const full = await resolveSafeSourceFile(libraryPath, rel);
|
|
269
|
+
if (full) return rel;
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
203
272
|
}
|
|
204
273
|
|
|
205
|
-
const excludedLibraryDirectories = new Set(['archive', 'artifacts', 'builds', 'preflight', 'viewer-check']);
|
|
274
|
+
const excludedLibraryDirectories = new Set(['archive', 'artifacts', 'builds', 'materials', 'preflight', 'viewer-check']);
|
|
206
275
|
const libraryWorkDirectory = name => excludedLibraryDirectories.has(name.toLowerCase()) || /^build-\d+$/i.test(name);
|
|
207
276
|
|
|
208
|
-
export async function openProjectLibrary({ directory, sourceRoot, workspaceIdentity, binding, name, sketches = false, id = `library-${randomUUID()}` }) {
|
|
209
|
-
if (!binding && !path.isAbsolute(directory))
|
|
210
|
-
|
|
211
|
-
|
|
277
|
+
export async function openProjectLibrary({ directory, libraryDirectory, sourceRoot, workspaceIdentity, binding, name, sketches = true, scoped = false, id = `library-${randomUUID()}` }) {
|
|
278
|
+
if (!binding && !libraryDirectory && !path.isAbsolute(directory)) {
|
|
279
|
+
throw new DocumentError('INVALID_PROJECT', 'An absolute project directory is required.');
|
|
280
|
+
}
|
|
281
|
+
if (libraryDirectory && !path.isAbsolute(libraryDirectory)) {
|
|
282
|
+
throw new DocumentError('INVALID_PROJECT', 'An absolute library directory is required.');
|
|
283
|
+
}
|
|
284
|
+
const root = binding ? binding.root : libraryDirectory ? null : await captureDirectory(directory);
|
|
285
|
+
const library = binding?.library
|
|
286
|
+
?? (libraryDirectory ? await captureDirectory(libraryDirectory) : await captureDirectory(path.join(root.path, '.locus-map'), false));
|
|
212
287
|
if (!binding && !library.identity && !library.missing) {
|
|
213
288
|
throw new DocumentError('INVALID_PROJECT', 'The project library must be a regular directory.');
|
|
214
289
|
}
|
|
@@ -224,9 +299,19 @@ export async function openProjectLibrary({ directory, sourceRoot, workspaceIdent
|
|
|
224
299
|
return result;
|
|
225
300
|
};
|
|
226
301
|
return openProject({
|
|
227
|
-
projectRoot: library,
|
|
228
|
-
|
|
229
|
-
|
|
302
|
+
projectRoot: library,
|
|
303
|
+
catalog: { id, documents: [], links: [] },
|
|
304
|
+
library: {
|
|
305
|
+
name: name ?? path.basename(root?.path ?? library.path),
|
|
306
|
+
folder: path.basename(library.path),
|
|
307
|
+
path: library.path,
|
|
308
|
+
sketches,
|
|
309
|
+
scoped: Boolean(scoped || libraryDirectory),
|
|
310
|
+
},
|
|
311
|
+
workspace,
|
|
312
|
+
scan,
|
|
313
|
+
check,
|
|
314
|
+
publish: sketches ? (map, text) => publishSketch({ library, map, text, check }) : undefined,
|
|
230
315
|
});
|
|
231
316
|
}
|
|
232
317
|
|
|
@@ -235,7 +320,9 @@ async function discoverLibrary(projectRoot, sketches) {
|
|
|
235
320
|
const documents = [];
|
|
236
321
|
const manifests = [];
|
|
237
322
|
let entriesSeen = 0;
|
|
323
|
+
|
|
238
324
|
async function discover(parts = []) {
|
|
325
|
+
if (parts.length > limits.maxDepth) return;
|
|
239
326
|
const folder = path.join(libraryPath, ...parts);
|
|
240
327
|
if (await fs.realpath(folder) !== folder) return;
|
|
241
328
|
const entries = await fs.readdir(folder, { withFileTypes: true });
|
|
@@ -249,7 +336,7 @@ async function discoverLibrary(projectRoot, sketches) {
|
|
|
249
336
|
const relativePath = child.join('/');
|
|
250
337
|
if (!isPortablePath(relativePath)) continue;
|
|
251
338
|
if (item.isDirectory() && !libraryWorkDirectory(item.name)) await discover(child);
|
|
252
|
-
else if (
|
|
339
|
+
else if (item.isFile() && item.name === 'topic.json') manifests.push({ folder: parts.join('/'), relativePath });
|
|
253
340
|
else if (item.isFile() && (item.name.endsWith('.locus-map.json') || (sketches && isSketchPath(relativePath)))) {
|
|
254
341
|
if (documents.length === limits.documents) throw new DocumentError('INVALID_PROJECT', `Expected at most ${limits.documents} library documents.`);
|
|
255
342
|
documents.push({ id: relativePath, path: relativePath, sketch: isSketchPath(relativePath) });
|
|
@@ -257,35 +344,59 @@ async function discoverLibrary(projectRoot, sketches) {
|
|
|
257
344
|
}
|
|
258
345
|
}
|
|
259
346
|
if (identity !== null) await discover();
|
|
260
|
-
|
|
261
|
-
const
|
|
347
|
+
|
|
348
|
+
const sections = [];
|
|
349
|
+
const diagnostics = [];
|
|
350
|
+
const explicitSources = new Map();
|
|
351
|
+
const folderDepth = folder => (folder ? folder.split('/').length : 0);
|
|
352
|
+
// Process shallower manifests first so deeper (more specific) topic.json overrides source bindings cleanly.
|
|
353
|
+
manifests.sort((a, b) => folderDepth(a.folder) - folderDepth(b.folder));
|
|
354
|
+
|
|
262
355
|
for (const { folder, relativePath } of manifests) {
|
|
263
|
-
|
|
356
|
+
const prefix = folder ? folder + '/' : '';
|
|
357
|
+
const hasMembers = documents.some(doc => !folder || doc.path.startsWith(prefix));
|
|
358
|
+
if (!hasMembers) continue;
|
|
264
359
|
try {
|
|
265
360
|
const file = await openStableDocumentFile({ filePath: path.join(libraryPath, relativePath), projectRoot, maxBytes: limits.bytes });
|
|
266
|
-
const authored =
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const qualify = address => {
|
|
270
|
-
const map = paths.get(address.map);
|
|
271
|
-
return map ? { ...address, map } : null;
|
|
272
|
-
};
|
|
361
|
+
const authored = parseTopicManifest((await file.read()).text);
|
|
362
|
+
const qualifyPath = rel => prefix + rel;
|
|
363
|
+
const qualify = address => ({ ...address, map: qualifyPath(address.map) });
|
|
273
364
|
const qualifyItem = item => item.children ? { ...item, children: item.children.map(qualifyItem) } : qualify(item);
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
.
|
|
278
|
-
|
|
279
|
-
sections.push({
|
|
365
|
+
|
|
366
|
+
const identities = [...authored.models.entries()].map(([rel, modelId]) => [qualifyPath(rel), modelId]);
|
|
367
|
+
for (const [docRel, sourceRel] of authored.sources.entries()) {
|
|
368
|
+
explicitSources.set(qualifyPath(docRel), qualifyPath(sourceRel));
|
|
369
|
+
}
|
|
370
|
+
sections.push({
|
|
371
|
+
folder,
|
|
372
|
+
...(authored.title && { title: authored.title }),
|
|
373
|
+
...(authored.entry && { entry: qualify(authored.entry) }),
|
|
374
|
+
...(authored.order && { order: authored.order }),
|
|
375
|
+
...(authored.navigation && { navigation: authored.navigation.map(qualifyItem) }),
|
|
376
|
+
identities,
|
|
377
|
+
links: authored.links.map(link => ({ from: qualify(link.from), to: qualify(link.to) })),
|
|
378
|
+
});
|
|
280
379
|
} catch {
|
|
281
|
-
diagnostics.push({ code: 'FOLDER_CATALOG_UNAVAILABLE', message: 'Could not use the
|
|
380
|
+
diagnostics.push({ code: 'FOLDER_CATALOG_UNAVAILABLE', message: 'Could not use the topic manifest.', folder });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
for (const doc of documents) {
|
|
385
|
+
if (doc.sketch) continue;
|
|
386
|
+
const declared = explicitSources.get(doc.path);
|
|
387
|
+
if (declared) {
|
|
388
|
+
const full = await resolveSafeSourceFile(libraryPath, declared);
|
|
389
|
+
if (full) { doc.sourcePath = declared; continue; }
|
|
282
390
|
}
|
|
391
|
+
const sibling = await findSiblingSource(libraryPath, doc.path);
|
|
392
|
+
if (sibling) doc.sourcePath = sibling;
|
|
283
393
|
}
|
|
394
|
+
|
|
284
395
|
return { documents, sections, diagnostics };
|
|
285
396
|
}
|
|
286
397
|
|
|
287
398
|
async function openProject({ projectRoot, catalog: { id: project, entry, documents, links, navigation }, manifestIdentity,
|
|
288
|
-
library, workspace, folder, scan, publish }) {
|
|
399
|
+
library, workspace, folder, scan, check, publish }) {
|
|
289
400
|
let members = new Map();
|
|
290
401
|
const identities = new Set(manifestIdentity ? [manifestIdentity] : []);
|
|
291
402
|
let closing = false;
|
|
@@ -300,10 +411,15 @@ async function openProject({ projectRoot, catalog: { id: project, entry, documen
|
|
|
300
411
|
return next;
|
|
301
412
|
}
|
|
302
413
|
const closeWriter = member => member.writer?.close();
|
|
303
|
-
async function register({ id, modelId, path: relativePath, sketch }) {
|
|
414
|
+
async function register({ id, modelId, path: relativePath, sketch, sourcePath }) {
|
|
304
415
|
const retained = members.get(id);
|
|
305
|
-
if (retained?.file)
|
|
306
|
-
|
|
416
|
+
if (retained?.file) {
|
|
417
|
+
retained.document.sourcePath = sourcePath;
|
|
418
|
+
return retained;
|
|
419
|
+
}
|
|
420
|
+
const member = {
|
|
421
|
+
document: { id, modelId, relativePath, ...(sketch && { kind: 'sketch' }), ...(sourcePath && { sourcePath }) },
|
|
422
|
+
};
|
|
307
423
|
try {
|
|
308
424
|
member.file = await openStableDocumentFile({ filePath: path.join(projectRoot.path, relativePath), projectRoot });
|
|
309
425
|
} catch (error) { member.registrationError = error; return member; }
|
|
@@ -339,9 +455,15 @@ async function openProject({ projectRoot, catalog: { id: project, entry, documen
|
|
|
339
455
|
return member;
|
|
340
456
|
}
|
|
341
457
|
function scoped(map, member, { revision, readOnly, bundle, outcome }) {
|
|
342
|
-
const { document: { relativePath, kind }, file } = member;
|
|
343
|
-
return {
|
|
344
|
-
|
|
458
|
+
const { document: { relativePath, kind, sourcePath }, file } = member;
|
|
459
|
+
return {
|
|
460
|
+
project, map, relativePath,
|
|
461
|
+
...(kind && { kind }),
|
|
462
|
+
...(sourcePath && { sourcePath }),
|
|
463
|
+
...(workspace && { documentPath: file.path }),
|
|
464
|
+
revision, readOnly, bundle,
|
|
465
|
+
...(outcome && { outcome }),
|
|
466
|
+
};
|
|
345
467
|
}
|
|
346
468
|
async function read(map, authorized = false) {
|
|
347
469
|
const member = memberFor(map);
|
|
@@ -371,12 +493,15 @@ async function openProject({ projectRoot, catalog: { id: project, entry, documen
|
|
|
371
493
|
const title = path.posix.basename(map, sketch ? '.excalidraw' : '.locus-map.json');
|
|
372
494
|
try {
|
|
373
495
|
const { bundle } = await read(map);
|
|
374
|
-
summaries.set(map, sketch ? {
|
|
375
|
-
views: [{ id: sketchView, title, family: sketchView, depth: 0 }] },
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
496
|
+
summaries.set(map, sketch ? {
|
|
497
|
+
row: { ...member.document, title, status: 'available', views: [{ id: sketchView, title, family: sketchView, depth: 0 }] },
|
|
498
|
+
triggers: new Map(), internal: new Set(),
|
|
499
|
+
} : summarize(member.document, bundle));
|
|
500
|
+
} catch (error) {
|
|
501
|
+
summaries.set(map, {
|
|
502
|
+
row: { ...member.document, title: library ? title : map, status: 'unavailable', views: [], diagnostic: projectDiagnostic(error) },
|
|
503
|
+
triggers: new Map(), internal: new Set(),
|
|
504
|
+
});
|
|
380
505
|
}
|
|
381
506
|
}
|
|
382
507
|
const resolveNavigation = item => {
|
|
@@ -389,18 +514,31 @@ async function openProject({ projectRoot, catalog: { id: project, entry, documen
|
|
|
389
514
|
return { ...item, title: title || item.node || item.view, available: Boolean(title) };
|
|
390
515
|
};
|
|
391
516
|
const rows = [...summaries.values()].map(summary => summary.row);
|
|
392
|
-
const
|
|
517
|
+
const isDraftDoc = row => /(?:^|\/)drafts\//i.test(row.relativePath ?? '');
|
|
518
|
+
const first = library && (
|
|
519
|
+
rows.find(row => row.status === 'available' && row.kind !== 'sketch' && !isDraftDoc(row))
|
|
520
|
+
?? rows.find(row => row.status === 'available' && row.kind !== 'sketch')
|
|
521
|
+
?? rows.find(row => row.status === 'available')
|
|
522
|
+
);
|
|
393
523
|
const sectionDiagnostics = [...diagnostics];
|
|
394
524
|
const qualifiedLinks = [...links];
|
|
525
|
+
let rootEntry = null;
|
|
395
526
|
const qualified = sections?.map(section => {
|
|
396
527
|
const unavailable = new Set(section.identities.filter(([map, modelId]) => {
|
|
397
528
|
const row = summaries.get(map)?.row;
|
|
398
529
|
return !row || row.status !== 'available' || row.modelId !== modelId;
|
|
399
530
|
}).map(([map]) => map));
|
|
400
|
-
const rootUnavailable =
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
531
|
+
const rootUnavailable = Boolean(section.entry && (
|
|
532
|
+
unavailable.has(section.entry.map)
|
|
533
|
+
|| !summaries.get(section.entry.map)?.row.views.some(view => view.id === section.entry.view)
|
|
534
|
+
));
|
|
535
|
+
if (unavailable.size || rootUnavailable) {
|
|
536
|
+
sectionDiagnostics.push({
|
|
537
|
+
code: 'FOLDER_CONTENTS_INCOMPLETE',
|
|
538
|
+
message: 'Some topic destinations are missing or no longer match their declared model.',
|
|
539
|
+
folder: section.folder,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
404
542
|
const retain = item => {
|
|
405
543
|
if (item.children) {
|
|
406
544
|
const children = item.children.flatMap(retain);
|
|
@@ -414,17 +552,27 @@ async function openProject({ projectRoot, catalog: { id: project, entry, documen
|
|
|
414
552
|
if (unavailable.has(link.from.map) || (unavailable.has(link.to.map) && summaries.has(link.to.map))) continue;
|
|
415
553
|
qualifiedLinks.push(link);
|
|
416
554
|
}
|
|
417
|
-
|
|
418
|
-
|
|
555
|
+
if (section.folder === '' && section.entry && !rootUnavailable) rootEntry = section.entry;
|
|
556
|
+
return {
|
|
557
|
+
folder: section.folder,
|
|
558
|
+
...(section.title && { title: section.title }),
|
|
559
|
+
...(section.entry && { entry: section.entry }),
|
|
560
|
+
...(section.order && { order: section.order }),
|
|
561
|
+
...(section.navigation && { navigation: section.navigation.flatMap(retain) }),
|
|
562
|
+
...(rootUnavailable && { rootUnavailable }),
|
|
563
|
+
};
|
|
419
564
|
});
|
|
420
565
|
const admitted = admitLinks(qualifiedLinks, summaries);
|
|
421
566
|
return {
|
|
422
567
|
...(folder && { folder }),
|
|
423
568
|
...(workspace && { workspace: (await workspace()).info }),
|
|
424
569
|
...(qualified && { sections: qualified }),
|
|
425
|
-
project,
|
|
570
|
+
project,
|
|
571
|
+
entry: entry ?? rootEntry ?? (first ? { map: first.id, view: first.views[0].id } : null),
|
|
426
572
|
...(navigation && { navigation: navigation.map(resolveNavigation) }),
|
|
427
|
-
documents: rows,
|
|
573
|
+
documents: rows,
|
|
574
|
+
links: admitted.links,
|
|
575
|
+
diagnostics: [...admitted.diagnostics, ...sectionDiagnostics],
|
|
428
576
|
};
|
|
429
577
|
}
|
|
430
578
|
|
|
@@ -454,9 +602,16 @@ async function openProject({ projectRoot, catalog: { id: project, entry, documen
|
|
|
454
602
|
}),
|
|
455
603
|
...(workspace && {
|
|
456
604
|
workspace: (await workspace()).info,
|
|
457
|
-
editorPaths: map => serial(async () => {
|
|
605
|
+
editorPaths: (map, target = 'document') => serial(async () => {
|
|
458
606
|
if (map === null) return [await (await workspace()).openProjectPath()];
|
|
459
607
|
const member = memberFor(map);
|
|
608
|
+
if (target === 'source') {
|
|
609
|
+
if (check) await check();
|
|
610
|
+
if (!member.document.sourcePath) throw new DocumentError('DOCUMENT_MISSING', 'No authored source file is bound to this map.');
|
|
611
|
+
const verified = await resolveSafeSourceFile(projectRoot.path, member.document.sourcePath);
|
|
612
|
+
if (!verified) throw new DocumentError('DOCUMENT_MISSING', 'The authored source file is unavailable.');
|
|
613
|
+
return [verified];
|
|
614
|
+
}
|
|
460
615
|
await member.file.read();
|
|
461
616
|
return [member.file.path];
|
|
462
617
|
}),
|