collabmd 0.1.34 → 0.1.35

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.
Files changed (266) hide show
  1. package/dist/client/assets/{CodeMirrorEditor-UCMRAMCV-Bg0dawOb.js → CodeMirrorEditor-UCMRAMCV-CvLFeHXu.js} +1 -1
  2. package/dist/client/assets/_baseFor-Bfo4esZ5.js +1 -0
  3. package/dist/client/assets/arc-tRoMuWFi.js +1 -0
  4. package/dist/client/assets/architecture-YZFGNWBL-CtU43_5T.js +1 -0
  5. package/dist/client/assets/{architectureDiagram-2XIMDMQ5-kYbOThe4.js → architectureDiagram-Q4EWVU46-CVdcOotN.js} +4 -4
  6. package/dist/client/assets/blockDiagram-DXYQGD6D-B_gNUKQ4.js +132 -0
  7. package/dist/client/assets/c4Diagram-AHTNJAMY-BSDwfduG.js +10 -0
  8. package/dist/client/assets/channel-BDb1g_mJ.js +1 -0
  9. package/dist/client/assets/chunk-2KRD3SAO-C6u8y11R.js +1 -0
  10. package/dist/client/assets/chunk-336JU56O-Ch9X5KoM.js +2 -0
  11. package/dist/client/assets/{chunk-HHEYEP7N-DlevL8bq.js → chunk-426QAEUC-CwJ7loGf.js} +1 -1
  12. package/dist/client/assets/chunk-4TB4RGXK-BEsauZP5.js +206 -0
  13. package/dist/client/assets/chunk-5FUZZQ4R-6x8SlhH9.js +62 -0
  14. package/dist/client/assets/chunk-5PVQY5BW-R5SE6dhE.js +2 -0
  15. package/dist/client/assets/chunk-67CJDMHE-CjXw5hFa.js +1 -0
  16. package/dist/client/assets/chunk-7N4EOEYR-DNHyuswJ.js +1 -0
  17. package/dist/client/assets/chunk-AA7GKIK3-DayE4IF_.js +1 -0
  18. package/dist/client/assets/chunk-BSJP7CBP-CexlYBxB.js +1 -0
  19. package/dist/client/assets/chunk-CIAEETIT-CkDJ4DYI.js +1 -0
  20. package/dist/client/assets/{chunk-KX2RTZJC-BTiOJb7N.js → chunk-EDXVE4YY-BVR_nF3y.js} +1 -1
  21. package/dist/client/assets/chunk-ENJZ2VHE-CFVWytAB.js +10 -0
  22. package/dist/client/assets/chunk-FOC6F5B3-DzCiCLGs.js +1 -0
  23. package/dist/client/assets/chunk-ICPOFSXX-B9LPHgU7.js +122 -0
  24. package/dist/client/assets/chunk-K5T4RW27-kmGSebVE.js +94 -0
  25. package/dist/client/assets/chunk-KGLVRYIC-DVjPRsaR.js +1 -0
  26. package/dist/client/assets/chunk-LIHQZDEY-DKFj13sC.js +1 -0
  27. package/dist/client/assets/chunk-NU2UP6EN-UVL-wkIc.js +35 -0
  28. package/dist/client/assets/chunk-ORNJ4GCN-D0uTAC-5.js +1 -0
  29. package/dist/client/assets/{chunk-NQ4KR5QH-CMJKI6Oj.js → chunk-OYMX7WX6-nWiNHNyD.js} +25 -14
  30. package/dist/client/assets/{chunk-PU5JKC2W-D_6N6t8f.js → chunk-U2HBQHQK-Bue4Ufzn.js} +6 -6
  31. package/dist/client/assets/{chunk-PQ6SQG4A-D1AbThjy.js → chunk-X2U36JSP-CRE6lp7n.js} +1 -1
  32. package/dist/client/assets/{chunk-XPW4576I-DJr4_4Yy.js → chunk-XPW4576I-BL5M-tF8.js} +1 -1
  33. package/dist/client/assets/{chunk-JSJVCQXG-DPQ9cPJt.js → chunk-YZCP3GAM-D7Z5wUWA.js} +1 -1
  34. package/dist/client/assets/chunk-ZZ45TVLE-CBbl1Qec.js +1 -0
  35. package/dist/client/assets/classDiagram-6PBFFD2Q-MIbgV5UL.js +1 -0
  36. package/dist/client/assets/classDiagram-v2-HSJHXN6E-Bb70vg2O.js +1 -0
  37. package/dist/client/assets/clike-BFTLRaGS.js +1 -0
  38. package/dist/client/assets/clone-D6JWrlxJ.js +1 -0
  39. package/dist/client/assets/{coffeescript-B_7eyHAa.js → coffeescript-B7GZajzV.js} +1 -1
  40. package/dist/client/assets/{cose-bilkent-S5V4N54A-DASO2hrk.js → cose-bilkent-S5V4N54A-xxgR5OJ-.js} +1 -1
  41. package/dist/client/assets/{cypher-DE6I2lIA.js → cypher-DEGl2llJ.js} +1 -1
  42. package/dist/client/assets/cytoscape.esm-B3PRdePO.js +321 -0
  43. package/dist/client/assets/{d-BNkKjn0o.js → d-BspB0dox.js} +1 -1
  44. package/dist/client/assets/dagre-KV5264BT-C2K9mFg1.js +4 -0
  45. package/dist/client/assets/dagre-VaFYRFbD.js +1 -0
  46. package/dist/client/assets/diagram-5BDNPKRD-DE0M0jaM.js +10 -0
  47. package/dist/client/assets/diagram-G4DWMVQ6-BfaRuSTT.js +24 -0
  48. package/dist/client/assets/diagram-MMDJMWI5-91Bly_hN.js +43 -0
  49. package/dist/client/assets/diagram-TYMM5635-fBkLwZGN.js +24 -0
  50. package/dist/client/assets/{dist-BzpfHRaE.js → dist-74GtnE06.js} +1 -1
  51. package/dist/client/assets/dist-B3lARV_e.js +1 -0
  52. package/dist/client/assets/{dist-O1z0Ayg0.js → dist-BCvzlTeb.js} +1 -1
  53. package/dist/client/assets/{dist-DsL7sqZR.js → dist-BMlUxhOz.js} +1 -1
  54. package/dist/client/assets/dist-BSED50tI.js +13 -0
  55. package/dist/client/assets/{dist-B-02vKOA.js → dist-Bkn7JaJv.js} +1 -1
  56. package/dist/client/assets/dist-Bq8Z0WUT.js +1 -0
  57. package/dist/client/assets/{dist-E_jPb93e.js → dist-Bzb9nPam.js} +1 -1
  58. package/dist/client/assets/{dist-CL-jjdvG.js → dist-C0e9kfNh.js} +1 -1
  59. package/dist/client/assets/dist-C8wdW7W4.js +1 -0
  60. package/dist/client/assets/dist-CDUQ5ELn.js +1 -0
  61. package/dist/client/assets/dist-CHSg_nUM.js +1 -0
  62. package/dist/client/assets/dist-CSAH9iuE.js +6 -0
  63. package/dist/client/assets/{dist-CxfohGIV.js → dist-CSNMpi-w.js} +1 -1
  64. package/dist/client/assets/dist-CZPTvk_g2.js +1 -0
  65. package/dist/client/assets/{dist-k47-Io7D.js → dist-Co8HE14w.js} +1 -1
  66. package/dist/client/assets/{dist-Bc2ND6i3.js → dist-CqU98NzX.js} +1 -1
  67. package/dist/client/assets/{dist-BzbYwa8m.js → dist-D0dQAc9b.js} +1 -1
  68. package/dist/client/assets/{dist-Dyt7n5Ui.js → dist-D1-dK0Dk.js} +1 -1
  69. package/dist/client/assets/{dist-B4uQVR_X.js → dist-DAKGEzm0.js} +1 -1
  70. package/dist/client/assets/dist-DBzteOlY.js +1 -0
  71. package/dist/client/assets/{dist-CjII8VDS.js → dist-DSRCADL9.js} +1 -1
  72. package/dist/client/assets/{dist-lDhnP-K1.js → dist-DdR2aYqj.js} +1 -1
  73. package/dist/client/assets/{dist-DUvaQ-Bj.js → dist-DidT3Jay.js} +1 -1
  74. package/dist/client/assets/dist-Doo91MTa.js +1 -0
  75. package/dist/client/assets/{dist-BLAlZer_.js → dist-Dwy75xI6.js} +1 -1
  76. package/dist/client/assets/{dist-3uAMa5w5.js → dist-FC9LftvP.js} +1 -1
  77. package/dist/client/assets/{dist-CGV1S_as.js → dist-PPAeaw4t.js} +1 -1
  78. package/dist/client/assets/{dist-BtnXjRx0.js → dist-VPEWg0Ob.js} +1 -1
  79. package/dist/client/assets/{dist-CXpKYW9s.js → dist-cQSK4Xor.js} +1 -1
  80. package/dist/client/assets/{dist-rMhng5DK.js → dist-r5I9Jgww.js} +1 -1
  81. package/dist/client/assets/drawio-editor-CWLEpwps.js +9 -0
  82. package/dist/client/assets/{drawioEditor-D6clB5OH.js → drawioEditor-5rJhxjA4.js} +2 -2
  83. package/dist/client/assets/{ecl-M7Iek4lq.js → ecl-D9rhJ9-u.js} +1 -1
  84. package/dist/client/assets/{editor-session-Dzy_85Wp.js → editor-session-CLOuvy37.js} +3 -3
  85. package/dist/client/assets/{erDiagram-INFDFZHY-DlIf-fb7.js → erDiagram-SMLLAGMA-DUQcqEQ1.js} +33 -18
  86. package/dist/client/assets/excalidraw-editor-ukEKPqGJ.js +9 -0
  87. package/dist/client/assets/{excalidraw-mermaid-stub-Bwe-bKcT.js → excalidraw-mermaid-stub-Df0Q2qkW.js} +1 -1
  88. package/dist/client/assets/excalidraw-scene-CDK3oDnm.js +176 -0
  89. package/dist/client/assets/excalidrawEditor-BJ8QLmWc.js +2 -0
  90. package/dist/client/assets/{export-page-PeexH2QK.js → export-page-D2rCmrUH.js} +2 -2
  91. package/dist/client/assets/exportDocument-Dunnjgii.js +2 -0
  92. package/dist/client/assets/{fcl-BWKK0S4-.js → fcl-CUXJFJn1.js} +1 -1
  93. package/dist/client/assets/flatten-CX_XvnUf.js +1 -0
  94. package/dist/client/assets/flowDiagram-DWJPFMVM-B_A5JyId.js +162 -0
  95. package/dist/client/assets/ganttDiagram-T4ZO3ILL-HM3CD7bk.js +292 -0
  96. package/dist/client/assets/gitGraph-7Q5UKJZL-BrBlB49D.js +1 -0
  97. package/dist/client/assets/gitGraphDiagram-UUTBAWPF-Dw7twZDm.js +106 -0
  98. package/dist/client/assets/graphlib-DDD4Vdye.js +1 -0
  99. package/dist/client/assets/{groovy-BEKazBrO.js → groovy-Di--Vb9Z.js} +1 -1
  100. package/dist/client/assets/{haxe-BY9d_5nB.js → haxe-CcPA1xnA.js} +1 -1
  101. package/dist/client/assets/image-XLNPCCAD-BFNybKza.js +1 -0
  102. package/dist/client/assets/{image-blob-reduce.esm-DriR2zT9.js → image-blob-reduce.esm-DiuPkovC.js} +1 -1
  103. package/dist/client/assets/{index-BLrtj9YM.js → index-BbziNMqE.js} +2 -2
  104. package/dist/client/assets/info-OMHHGYJF-BcmgcSx1.js +1 -0
  105. package/dist/client/assets/{infoDiagram-LFFYTUFH-DFTI0nfs.js → infoDiagram-42DDH7IO-DX-d3DMp.js} +1 -1
  106. package/dist/client/assets/isEmpty-BKDbo1FH.js +1 -0
  107. package/dist/client/assets/ishikawaDiagram-UXIWVN3A-BHmsxpMs.js +70 -0
  108. package/dist/client/assets/{javascript-CdiVhQeA.js → javascript-gTK9fxz6.js} +1 -1
  109. package/dist/client/assets/javascript-qUBHINSy.js +1 -0
  110. package/dist/client/assets/{journeyDiagram-4ABVD52K-DDur6iHm.js → journeyDiagram-VCZTEJTY-jxDSjgE1.js} +2 -2
  111. package/dist/client/assets/{jsx-runtime-C2p7wRmT.js → jsx-runtime-B_8UNt-W.js} +1 -1
  112. package/dist/client/assets/{kanban-definition-K7BYSVSG-dA6NPLsg.js → kanban-definition-6JOO6SKY-od3qY1mE.js} +2 -2
  113. package/dist/client/assets/line-CZsGUM4H.js +1 -0
  114. package/dist/client/assets/{lua-kutgyRGY.js → lua-Cg0FqIlO.js} +1 -1
  115. package/dist/client/assets/main-CN0kbtGk.js +1369 -0
  116. package/dist/client/assets/mermaid-parser.core-DtIbxv6L.js +4 -0
  117. package/dist/client/assets/mermaid-runtime-vVJfjscE.js +11 -0
  118. package/dist/client/assets/{mindmap-definition-YRQLILUH-DjQcsPoe.js → mindmap-definition-QFDTVHPH-C9qrdAqo.js} +39 -11
  119. package/dist/client/assets/packet-4T2RLAQJ-DYYSvRuJ.js +1 -0
  120. package/dist/client/assets/pica-BEurQXMu.js +2 -0
  121. package/dist/client/assets/pie-ZZUOXDRM-cG65Mc64.js +1 -0
  122. package/dist/client/assets/pieDiagram-DEJITSTG-BHXxj7wl.js +30 -0
  123. package/dist/client/assets/{preview-render-compiler-BjLlHmiQ.js → preview-render-compiler-BHeDhYho.js} +2 -2
  124. package/dist/client/assets/preview-render-compiler-D3QM1Ryz.js +1 -0
  125. package/dist/client/assets/{preview-render-profile-CR4dJZrp.js → preview-render-profile-BF6os3x9.js} +5 -5
  126. package/dist/client/assets/{preview-render-worker-B4dH2yxj.js → preview-render-worker-C4AFtMIr.js} +6 -6
  127. package/dist/client/assets/{pug-DkUcLYWt.js → pug-lkTEco3G.js} +1 -1
  128. package/dist/client/assets/{python-CZtTmYkS.js → python-BUyhM0Ew.js} +1 -1
  129. package/dist/client/assets/{q-I27iQntV.js → q-Dls1OX0D.js} +1 -1
  130. package/dist/client/assets/{quadrantDiagram-337W2JSQ-CYKgdx7K.js → quadrantDiagram-34T5L4WZ-CWW7LORF.js} +1 -1
  131. package/dist/client/assets/{quick-switcher-controller-DcyllYpm.js → quick-switcher-controller-B1erSgJ1.js} +1 -1
  132. package/dist/client/assets/{r-DN_EydfL.js → r-DeZ8Mdev.js} +1 -1
  133. package/dist/client/assets/radar-PYXPWWZC-Bmpup_xw.js +1 -0
  134. package/dist/client/assets/reduce-C6FuFJbE.js +1 -0
  135. package/dist/client/assets/requirementDiagram-MS252O5E-CTljNdQH.js +84 -0
  136. package/dist/client/assets/{room-yJaBAoEU.js → room-DI7DXGeS.js} +1 -1
  137. package/dist/client/assets/{sankeyDiagram-WA2Y5GQK-CfHe3D6R.js → sankeyDiagram-XADWPNL6-CCfFkC74.js} +1 -1
  138. package/dist/client/assets/sequenceDiagram-FGHM5R23-BD9vj6WG.js +157 -0
  139. package/dist/client/assets/{sparql-BOvq0dv7.js → sparql-vm8qNO8J.js} +1 -1
  140. package/dist/client/assets/sql-GL7dVWcd.js +1 -0
  141. package/dist/client/assets/stateDiagram-FHFEXIEX-CpiX3KPd.js +1 -0
  142. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-D_5ufPqT.js +1 -0
  143. package/dist/client/assets/{swift-BCxe4-cw.js → swift-CKcKnWv9.js} +1 -1
  144. package/dist/client/assets/timeline-definition-GMOUNBTQ-BafRAkSF.js +120 -0
  145. package/dist/client/assets/treeView-SZITEDCU-NbjhK5cw.js +1 -0
  146. package/dist/client/assets/treemap-W4RFUUIX-DJzRbb-x.js +1 -0
  147. package/dist/client/assets/{turtle-GBz_E4RG.js → turtle-BkP3ExOG.js} +1 -1
  148. package/dist/client/assets/{vault-api-client-p7h7cXKM.js → vault-api-client-DSx3mWkH.js} +1 -1
  149. package/dist/client/assets/{vault-utils-5Xr0MXCb.js → vault-utils-CRpy8MQz.js} +1 -1
  150. package/dist/client/assets/vennDiagram-DHZGUBPP-DSngq_Zj.js +34 -0
  151. package/dist/client/assets/{verilog-C4wTycyo.js → verilog-DSARZZPc.js} +1 -1
  152. package/dist/client/assets/{vhdl-Bwndeg44.js → vhdl-CnYyYTpa.js} +1 -1
  153. package/dist/client/assets/wardley-RL74JXVD-DTNoH_BY.js +1 -0
  154. package/dist/client/assets/wardleyDiagram-NUSXRM2D-CAEd2kJG.js +20 -0
  155. package/dist/client/assets/{xychartDiagram-JWTSCODW-C3vA70iJ.js → xychartDiagram-5P7HB3ND-BScQpnru.js} +6 -6
  156. package/dist/client/assets/{yjs-provider-reset-guard-CtERLBID.js → yjs-provider-reset-guard-_Q3mj6tP.js} +1 -1
  157. package/dist/client/drawio-editor.html +1 -1
  158. package/dist/client/excalidraw-editor.html +1 -1
  159. package/dist/client/export-document.html +1 -1
  160. package/dist/client/index.html +1 -1
  161. package/package.json +11 -11
  162. package/src/client/application/app-shell/ui-feature-shell.js +5 -2
  163. package/src/client/application/quick-switcher-loader.js +39 -0
  164. package/src/client/bootstrap/collabmd-app-shell.js +16 -20
  165. package/src/client/domain/keyboard-shortcuts.js +8 -0
  166. package/src/client/drawio-editor.js +13 -0
  167. package/src/client/excalidraw-editor.js +13 -0
  168. package/src/client/infrastructure/excalidraw-room-client.js +1 -1
  169. package/src/client/infrastructure/workspace-sync-client.js +26 -3
  170. package/src/client/presentation/comment-ui/comment-ui-card.js +83 -3
  171. package/src/client/presentation/comment-ui/comment-ui-state.js +25 -2
  172. package/src/client/presentation/drawio-embed-controller.js +18 -0
  173. package/src/client/presentation/excalidraw-embed-controller.js +7 -0
  174. package/src/client/presentation/git-panel-controller.js +2 -0
  175. package/src/server/domain/backlink-index.js +33 -72
  176. package/src/server/domain/bases/base-index-snapshot-store.js +46 -62
  177. package/src/server/domain/markdown-reference-extractor.js +233 -0
  178. package/src/server/infrastructure/persistence/vault-file-store.js +39 -4
  179. package/src/server/infrastructure/workspace/file-system-sync-service.js +37 -11
  180. package/dist/client/assets/_basePickBy-Dv0sK1l7.js +0 -1
  181. package/dist/client/assets/_baseUniq-DKYX57ji.js +0 -1
  182. package/dist/client/assets/arc-DrfYGhWk.js +0 -1
  183. package/dist/client/assets/architecture-PBZL5I3N-DiglIZi9.js +0 -1
  184. package/dist/client/assets/blockDiagram-WCTKOSBZ-GIgTqnhk.js +0 -132
  185. package/dist/client/assets/c4Diagram-IC4MRINW-CkHO1i_L.js +0 -10
  186. package/dist/client/assets/channel-CgsU9TSN.js +0 -1
  187. package/dist/client/assets/chunk-7E7YKBS2-TdU92i9i.js +0 -1
  188. package/dist/client/assets/chunk-7R4GIKGN-mqd2GwMg.js +0 -80
  189. package/dist/client/assets/chunk-C72U2L5F-CJKQWBtz.js +0 -1
  190. package/dist/client/assets/chunk-EGIJ26TM-C4nq20om.js +0 -1
  191. package/dist/client/assets/chunk-GEFDOKGD-Bs7FmFox.js +0 -2
  192. package/dist/client/assets/chunk-GLR3WWYH-qQe2O5VQ.js +0 -2
  193. package/dist/client/assets/chunk-KYZI473N-CTSCuqRb.js +0 -53
  194. package/dist/client/assets/chunk-L3YUKLVL-CJZMBtKF.js +0 -1
  195. package/dist/client/assets/chunk-MX3YWQON-DQpSwRf6.js +0 -1
  196. package/dist/client/assets/chunk-NU2UP6EN-DlUENSHU.js +0 -35
  197. package/dist/client/assets/chunk-O4XLMI2P-CcVxZh41.js +0 -7
  198. package/dist/client/assets/chunk-OZEHJAEY-DjBZbgu0.js +0 -1
  199. package/dist/client/assets/chunk-R5LLSJPH-CkjKXM73.js +0 -1
  200. package/dist/client/assets/chunk-WL4C6EOR-axcuKSup.js +0 -189
  201. package/dist/client/assets/chunk-XIRO2GV7-4wqVHjs_.js +0 -1
  202. package/dist/client/assets/chunk-XZSTWKYB-C8Y_hIKZ.js +0 -94
  203. package/dist/client/assets/chunk-YBOYWFTD-CKg4ymFF.js +0 -1
  204. package/dist/client/assets/classDiagram-VBA2DB6C-BHZpvOxK.js +0 -1
  205. package/dist/client/assets/classDiagram-v2-RAHNMMFH-DA7HMUUs.js +0 -1
  206. package/dist/client/assets/clike-1_ZsiVV8.js +0 -1
  207. package/dist/client/assets/clone-Dgi8Z4IL.js +0 -1
  208. package/dist/client/assets/cytoscape.esm-Czjc507F.js +0 -321
  209. package/dist/client/assets/dagre-CfB3Fw33.js +0 -1
  210. package/dist/client/assets/dagre-KLK3FWXG-CC7tq2Ky.js +0 -4
  211. package/dist/client/assets/diagram-E7M64L7V-CMt7BN5M.js +0 -24
  212. package/dist/client/assets/diagram-IFDJBPK2-BFMBUGpd.js +0 -43
  213. package/dist/client/assets/diagram-P4PSJMXO-CviA1xXr.js +0 -24
  214. package/dist/client/assets/dist-3bQB_we3.js +0 -1
  215. package/dist/client/assets/dist-8Igu3Ee_2.js +0 -1
  216. package/dist/client/assets/dist-BU8uusJX.js +0 -1
  217. package/dist/client/assets/dist-BVB8rn7o.js +0 -1
  218. package/dist/client/assets/dist-D5QOYy7y.js +0 -6
  219. package/dist/client/assets/dist-DIi0uqLJ.js +0 -1
  220. package/dist/client/assets/dist-DJ16N7ol.js +0 -1
  221. package/dist/client/assets/dist-DWJL3_bF.js +0 -13
  222. package/dist/client/assets/dist-OQE68wIX.js +0 -1
  223. package/dist/client/assets/dist-x7PIEmJu.js +0 -1
  224. package/dist/client/assets/drawio-editor-BMTwP5mD.js +0 -9
  225. package/dist/client/assets/excalidraw-editor-CAP9F8CB.js +0 -9
  226. package/dist/client/assets/excalidraw-scene-BF_bT1OL.js +0 -176
  227. package/dist/client/assets/excalidrawEditor-DD4AvzYP.js +0 -2
  228. package/dist/client/assets/exportDocument-Zfwq1XVx.js +0 -2
  229. package/dist/client/assets/flowDiagram-PKNHOUZH-C_t-mkwb.js +0 -162
  230. package/dist/client/assets/ganttDiagram-A5KZAMGK-BtK9Tb--.js +0 -292
  231. package/dist/client/assets/gitGraph-HDMCJU4V-CT7YfbD3.js +0 -1
  232. package/dist/client/assets/gitGraphDiagram-K3NZZRJ6-DULDLGiJ.js +0 -65
  233. package/dist/client/assets/graphlib-BgRST-Qg.js +0 -1
  234. package/dist/client/assets/image-XLNPCCAD-CFiKwiWK.js +0 -1
  235. package/dist/client/assets/info-3K5VOQVL-DUpNyDC-.js +0 -1
  236. package/dist/client/assets/isArrayLikeObject-BId_dPHM.js +0 -1
  237. package/dist/client/assets/isEmpty-CVvRj8fj.js +0 -1
  238. package/dist/client/assets/ishikawaDiagram-PHBUUO56-DpBuDpC6.js +0 -70
  239. package/dist/client/assets/javascript-UJe68_xi.js +0 -1
  240. package/dist/client/assets/line-B2GMovaI.js +0 -1
  241. package/dist/client/assets/main-CfSHaGes.js +0 -1368
  242. package/dist/client/assets/math-B-LMBwub.js +0 -1
  243. package/dist/client/assets/mermaid-parser.core-B1ogGcR8.js +0 -4
  244. package/dist/client/assets/mermaid-runtime-Bn8A6DGx.js +0 -11
  245. package/dist/client/assets/packet-RMMSAZCW-DEwNbIrA.js +0 -1
  246. package/dist/client/assets/pica-C1TdTz-C.js +0 -2
  247. package/dist/client/assets/pie-UPGHQEXC-D5M_lSjo.js +0 -1
  248. package/dist/client/assets/pieDiagram-SKSYHLDU-jhHouFpk.js +0 -30
  249. package/dist/client/assets/preview-render-compiler-Duy_3IcP.js +0 -1
  250. package/dist/client/assets/radar-KQ55EAFF-AU1qh3Bw.js +0 -1
  251. package/dist/client/assets/requirementDiagram-Z7DCOOCP-D9SHxoW7.js +0 -73
  252. package/dist/client/assets/sequenceDiagram-2WXFIKYE-CZsMMqAJ.js +0 -145
  253. package/dist/client/assets/sql-DDFeQNTK.js +0 -1
  254. package/dist/client/assets/stateDiagram-RAJIS63D-CoNZjTYV.js +0 -1
  255. package/dist/client/assets/stateDiagram-v2-FVOUBMTO-1zOw6NmQ.js +0 -1
  256. package/dist/client/assets/timeline-definition-YZTLITO2-DSe2mrG8.js +0 -61
  257. package/dist/client/assets/treemap-KZPCXAKY-C9UI2fwP.js +0 -1
  258. package/dist/client/assets/vennDiagram-LZ73GAT5-xSzaIpy1.js +0 -34
  259. /package/dist/client/assets/{chunk-55IACEB6-CpncB3ru.js → chunk-55IACEB6-DLqevMSj.js} +0 -0
  260. /package/dist/client/assets/{chunk-QZHKN3VN-CgLPFSk5.js → chunk-QZHKN3VN-BnOS2iQW.js} +0 -0
  261. /package/dist/client/assets/{drawio-room-DEivFyNV.js → drawio-room-1i6Nn0_Z.js} +0 -0
  262. /package/dist/client/assets/{excalidraw-mermaid-stub-BZPU4ZhU.js → excalidraw-mermaid-stub-DzxtBcQW.js} +0 -0
  263. /package/dist/client/assets/{file-kind-DBptLlF_.js → file-kind-DmKq2MvD.js} +0 -0
  264. /package/dist/client/assets/{preview-diagram-utils-COt-IYMD.js → preview-diagram-utils-D8VypUft.js} +0 -0
  265. /package/dist/client/assets/{rough.esm-DE_lJ5Ge.js → rough.esm-BU2knLt9.js} +0 -0
  266. /package/dist/client/assets/{runtime-config-CqhchMC4.js → runtime-config-DWTejofP.js} +0 -0
@@ -10,11 +10,15 @@
10
10
  * incrementally whenever a file is persisted, created, deleted, or renamed.
11
11
  */
12
12
 
13
- import { createWikiTargetIndex, resolveWikiTargetWithIndex } from '../../domain/wiki-link-resolver.js';
14
- import { getVaultFileExtension, isMarkdownFilePath } from '../../domain/file-kind.js';
13
+ import { createWikiTargetIndex } from '../../domain/wiki-link-resolver.js';
14
+ import { isMarkdownFilePath } from '../../domain/file-kind.js';
15
+ import {
16
+ collectMarkdownReferences,
17
+ collectReferenceTargetKeysForFilePath,
18
+ createReferenceTargetAliasMap,
19
+ } from './markdown-reference-extractor.js';
15
20
  import { mapWithConcurrency } from '../shared/async-utils.js';
16
21
 
17
- const WIKI_LINK_RE = /\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g;
18
22
  const BACKLINK_BUILD_CONCURRENCY = 8;
19
23
 
20
24
  function createDeferred() {
@@ -27,39 +31,6 @@ function createDeferred() {
27
31
  return { promise, reject, resolve };
28
32
  }
29
33
 
30
- function normalizeWikiTargetKey(target = '') {
31
- const normalizedTarget = String(target ?? '').trim();
32
- if (!normalizedTarget) {
33
- return '';
34
- }
35
-
36
- return getVaultFileExtension(normalizedTarget)
37
- ? normalizedTarget
38
- : `${normalizedTarget}.md`;
39
- }
40
-
41
- function collectWikiTargetKeysForFilePath(filePath = '') {
42
- const normalizedPath = String(filePath ?? '').trim();
43
- if (!normalizedPath) {
44
- return [];
45
- }
46
-
47
- const segments = normalizedPath.split('/').filter(Boolean);
48
- const keys = [];
49
- for (let index = 0; index < segments.length; index += 1) {
50
- keys.push(segments.slice(index).join('/'));
51
- }
52
-
53
- if (isMarkdownFilePath(normalizedPath)) {
54
- const rawSegments = normalizedPath.replace(/\.md$/i, '').split('/').filter(Boolean);
55
- for (let index = 0; index < rawSegments.length; index += 1) {
56
- keys.push(rawSegments.slice(index).join('/'));
57
- }
58
- }
59
-
60
- return [...new Set(keys)];
61
- }
62
-
63
34
  export class BacklinkIndex {
64
35
  constructor({
65
36
  rebuildDelayMs = 150,
@@ -225,7 +196,10 @@ export class BacklinkIndex {
225
196
  * Incrementally update the index when a file's content changes.
226
197
  * Call this after every persist / write.
227
198
  */
228
- updateFile(filePath, content, { refreshIndex = true } = {}) {
199
+ updateFile(filePath, content, {
200
+ refreshIndex = true,
201
+ targetPathAliases = new Map(),
202
+ } = {}) {
229
203
  // Remove old forward links for this file
230
204
  this._removeForwardLinks(filePath);
231
205
 
@@ -242,7 +216,7 @@ export class BacklinkIndex {
242
216
  }
243
217
 
244
218
  // Re-index with new content
245
- this._indexFile(filePath, content);
219
+ this._indexFile(filePath, content, { targetPathAliases });
246
220
  }
247
221
 
248
222
  /**
@@ -514,38 +488,32 @@ export class BacklinkIndex {
514
488
 
515
489
  // --- Private methods ---
516
490
 
517
- _indexFile(filePath, content) {
491
+ _indexFile(filePath, content, { targetPathAliases = new Map() } = {}) {
518
492
  const resolvedTargets = new Set();
519
493
  const contextsByTarget = new Map();
520
494
  const rawTargetKeys = new Set();
521
- const lines = content.split('\n');
522
-
523
- for (const line of lines) {
524
- WIKI_LINK_RE.lastIndex = 0;
525
- let match;
526
- while ((match = WIKI_LINK_RE.exec(line)) !== null) {
527
- const target = match[1].trim();
528
- if (!target) {
529
- continue;
530
- }
495
+ const references = collectMarkdownReferences(content, {
496
+ sourceFilePath: filePath,
497
+ targetPathAliases,
498
+ wikiTargetIndex: this._wikiTargetIndex,
499
+ });
531
500
 
532
- const rawTargetKey = normalizeWikiTargetKey(target);
533
- if (rawTargetKey) {
534
- rawTargetKeys.add(rawTargetKey);
535
- }
501
+ for (const reference of references) {
502
+ if (reference.rawTargetKey) {
503
+ rawTargetKeys.add(reference.rawTargetKey);
504
+ }
536
505
 
537
- const resolved = this._resolveTarget(target);
538
- if (!resolved || resolved === filePath) {
539
- continue;
540
- }
506
+ const resolved = reference.resolvedPath;
507
+ if (!resolved || resolved === filePath) {
508
+ continue;
509
+ }
541
510
 
542
- resolvedTargets.add(resolved);
511
+ resolvedTargets.add(resolved);
543
512
 
544
- if (!contextsByTarget.has(resolved)) {
545
- contextsByTarget.set(resolved, []);
546
- }
547
- contextsByTarget.get(resolved).push(line.trim());
513
+ if (!contextsByTarget.has(resolved)) {
514
+ contextsByTarget.set(resolved, []);
548
515
  }
516
+ contextsByTarget.get(resolved).push(reference.context);
549
517
  }
550
518
 
551
519
  this.contextsBySource.delete(filePath);
@@ -594,14 +562,6 @@ export class BacklinkIndex {
594
562
  this.forward.delete(filePath);
595
563
  }
596
564
 
597
- /**
598
- * Resolve a wiki-link target string to a vault file path.
599
- * Same logic as the client's resolveWikiTarget.
600
- */
601
- _resolveTarget(target) {
602
- return resolveWikiTargetWithIndex(target, this._wikiTargetIndex);
603
- }
604
-
605
565
  _refreshWikiTargetIndex() {
606
566
  this._wikiTargetIndex = createWikiTargetIndex(this._fileList);
607
567
  }
@@ -629,7 +589,7 @@ export class BacklinkIndex {
629
589
  _collectImpactedSourcesForMembershipChanges(pathValues = []) {
630
590
  const affectedTargetKeys = new Set();
631
591
  pathValues.forEach((pathValue) => {
632
- collectWikiTargetKeysForFilePath(pathValue).forEach((targetKey) => {
592
+ collectReferenceTargetKeysForFilePath(pathValue).forEach((targetKey) => {
633
593
  affectedTargetKeys.add(targetKey);
634
594
  });
635
595
  });
@@ -648,6 +608,7 @@ export class BacklinkIndex {
648
608
  renameMap = new Map(),
649
609
  } = {}) {
650
610
  const refreshedSources = new Set();
611
+ const targetPathAliases = createReferenceTargetAliasMap(Array.from(renameMap.entries()));
651
612
 
652
613
  for (const sourcePath of impactedSources) {
653
614
  const livePath = renameMap.get(sourcePath) ?? sourcePath;
@@ -666,7 +627,7 @@ export class BacklinkIndex {
666
627
  }
667
628
 
668
629
  refreshedSources.add(livePath);
669
- this.updateFile(livePath, content, { refreshIndex: false });
630
+ this.updateFile(livePath, content, { refreshIndex: false, targetPathAliases });
670
631
  }
671
632
  }
672
633
  }
@@ -1,16 +1,19 @@
1
1
  import { basename, dirname, extname } from 'node:path';
2
2
 
3
- import { createWikiTargetIndex, resolveWikiTargetWithIndex } from '../../../domain/wiki-link-resolver.js';
3
+ import { createWikiTargetIndex } from '../../../domain/wiki-link-resolver.js';
4
4
  import {
5
- getVaultFileExtension,
6
5
  isMarkdownFilePath,
7
6
  stripVaultFileExtension,
8
7
  } from '../../../domain/file-kind.js';
9
8
  import { extractYamlFrontmatter } from '../../../domain/yaml-frontmatter.js';
9
+ import {
10
+ collectMarkdownReferences,
11
+ collectReferenceTargetKeysForFilePath,
12
+ createReferenceTargetAliasMap,
13
+ } from '../markdown-reference-extractor.js';
10
14
  import { mapWithConcurrency } from '../../shared/async-utils.js';
11
15
  import { createLinkValue, dedupeLinkValues } from './base-expression-runtime.js';
12
16
 
13
- const INTERNAL_LINK_RE = /(!)?\[\[([^\]|#]+)(?:#[^\]|]+)?(?:\|[^\]]+)?\]\]/g;
14
17
  const INLINE_TAG_RE = /(^|[\s(])#([A-Za-z0-9/_-]+)/g;
15
18
  const INDEX_READ_CONCURRENCY = 8;
16
19
 
@@ -42,28 +45,35 @@ function compareVaultPaths(left = '', right = '') {
42
45
  return String(left).localeCompare(String(right), undefined, { sensitivity: 'base' });
43
46
  }
44
47
 
45
- function extractReferences(markdownText = '', wikiTargetIndex) {
48
+ function extractReferences(markdownText = '', {
49
+ sourceFilePath = '',
50
+ targetPathAliases = new Map(),
51
+ wikiTargetIndex,
52
+ } = {}) {
46
53
  const links = [];
47
54
  const embeds = [];
48
- let match;
49
- while ((match = INTERNAL_LINK_RE.exec(String(markdownText ?? ''))) !== null) {
50
- const isEmbed = Boolean(match[1]);
51
- const rawTarget = String(match[2] ?? '').trim();
52
- if (!rawTarget) {
53
- continue;
54
- }
55
+ const rawTargetKeys = new Set();
56
+ const references = collectMarkdownReferences(markdownText, {
57
+ sourceFilePath,
58
+ targetPathAliases,
59
+ wikiTargetIndex,
60
+ });
55
61
 
56
- const resolvedPath = resolveWikiTargetWithIndex(rawTarget, wikiTargetIndex);
57
- const linkValue = createLinkValue(resolvedPath || rawTarget, {
58
- exists: Boolean(resolvedPath),
59
- rawTarget,
62
+ references.forEach((reference) => {
63
+ const linkValue = createLinkValue(reference.resolvedPath || reference.targetPath || reference.rawTarget, {
64
+ exists: Boolean(reference.resolvedPath),
65
+ rawTarget: reference.rawTarget,
60
66
  });
61
67
  links.push(linkValue);
62
- if (isEmbed) {
68
+ if (reference.isEmbed) {
63
69
  embeds.push(linkValue);
64
70
  }
65
- }
66
- return { embeds, links };
71
+ if (reference.rawTargetKey) {
72
+ rawTargetKeys.add(reference.rawTargetKey);
73
+ }
74
+ });
75
+
76
+ return { embeds, links, rawTargetKeys };
67
77
  }
68
78
 
69
79
  function isWorkspaceFileEntry(entry = null) {
@@ -81,39 +91,6 @@ function listWorkspaceFilePaths(workspaceState = {}) {
81
91
  .sort(compareVaultPaths);
82
92
  }
83
93
 
84
- function normalizeWikiTargetKey(target = '') {
85
- const normalizedTarget = String(target ?? '').trim();
86
- if (!normalizedTarget) {
87
- return '';
88
- }
89
-
90
- return getVaultFileExtension(normalizedTarget)
91
- ? normalizedTarget
92
- : `${normalizedTarget}.md`;
93
- }
94
-
95
- function collectWikiTargetKeysForFilePath(filePath = '') {
96
- const normalizedPath = String(filePath ?? '').trim();
97
- if (!normalizedPath) {
98
- return [];
99
- }
100
-
101
- const segments = normalizedPath.split('/').filter(Boolean);
102
- const keys = [];
103
- for (let index = 0; index < segments.length; index += 1) {
104
- keys.push(segments.slice(index).join('/'));
105
- }
106
-
107
- if (isMarkdownFilePath(normalizedPath)) {
108
- const rawSegments = normalizedPath.replace(/\.md$/i, '').split('/').filter(Boolean);
109
- for (let index = 0; index < rawSegments.length; index += 1) {
110
- keys.push(rawSegments.slice(index).join('/'));
111
- }
112
- }
113
-
114
- return [...new Set(keys)];
115
- }
116
-
117
94
  function createBacklinkEntry(sourcePath = '') {
118
95
  return createLinkValue(sourcePath, {
119
96
  display: basename(sourcePath),
@@ -160,12 +137,18 @@ export class BaseIndexSnapshotStore {
160
137
  return scannedWorkspaceState;
161
138
  }
162
139
 
163
- createSnapshotRow(filePath, workspaceState, wikiTargetIndex, markdownContent = null) {
140
+ createSnapshotRow(filePath, workspaceState, wikiTargetIndex, markdownContent = null, {
141
+ targetPathAliases = new Map(),
142
+ } = {}) {
164
143
  const metadata = workspaceState.metadata.get(filePath) ?? null;
165
144
  const frontmatter = markdownContent ? extractYamlFrontmatter(markdownContent) : null;
166
145
  const noteProperties = isPlainObject(frontmatter?.data) ? frontmatter.data : {};
167
146
  const bodyMarkdown = frontmatter?.bodyMarkdown ?? markdownContent ?? '';
168
- const references = extractReferences(bodyMarkdown, wikiTargetIndex);
147
+ const references = extractReferences(bodyMarkdown, {
148
+ sourceFilePath: filePath,
149
+ targetPathAliases,
150
+ wikiTargetIndex,
151
+ });
169
152
  const tags = [...new Set([
170
153
  ...normalizeTags(noteProperties.tags),
171
154
  ...extractInlineTags(bodyMarkdown),
@@ -193,11 +176,7 @@ export class BaseIndexSnapshotStore {
193
176
  .map((link) => link?.path)
194
177
  .filter((targetPath) => targetPath && targetPath !== filePath),
195
178
  ),
196
- rawTargetKeys: new Set(
197
- references.links
198
- .map((link) => normalizeWikiTargetKey(link?.rawTarget))
199
- .filter(Boolean),
200
- ),
179
+ rawTargetKeys: references.rawTargetKeys,
201
180
  row: {
202
181
  file: fileValue,
203
182
  noteProperties,
@@ -373,7 +352,7 @@ export class BaseIndexSnapshotStore {
373
352
  collectImpactedSourcesForMembershipChanges(snapshot, pathValues = []) {
374
353
  const affectedTargetKeys = new Set();
375
354
  pathValues.forEach((pathValue) => {
376
- collectWikiTargetKeysForFilePath(pathValue).forEach((targetKey) => {
355
+ collectReferenceTargetKeysForFilePath(pathValue).forEach((targetKey) => {
377
356
  affectedTargetKeys.add(targetKey);
378
357
  });
379
358
  });
@@ -392,7 +371,9 @@ export class BaseIndexSnapshotStore {
392
371
  return impactedPaths;
393
372
  }
394
373
 
395
- async refreshSnapshotRows(snapshot, workspaceState, pathValues = []) {
374
+ async refreshSnapshotRows(snapshot, workspaceState, pathValues = [], {
375
+ targetPathAliases = new Map(),
376
+ } = {}) {
396
377
  const filePathsToRefresh = Array.from(new Set(pathValues))
397
378
  .filter((pathValue) => {
398
379
  const entry = workspaceState?.entries?.get(pathValue);
@@ -403,7 +384,9 @@ export class BaseIndexSnapshotStore {
403
384
  const markdownContent = isMarkdownFilePath(filePath)
404
385
  ? await this.vaultFileStore.readMarkdownFile(filePath)
405
386
  : null;
406
- const rowRecord = this.createSnapshotRow(filePath, workspaceState, snapshot.wikiTargetIndex, markdownContent);
387
+ const rowRecord = this.createSnapshotRow(filePath, workspaceState, snapshot.wikiTargetIndex, markdownContent, {
388
+ targetPathAliases,
389
+ });
407
390
  this.removeRawTargetSourceContributions(snapshot, filePath);
408
391
  snapshot.rowsByPath.set(filePath, rowRecord.row);
409
392
  snapshot.forwardLinksByPath.set(filePath, rowRecord.forwardLinks);
@@ -489,6 +472,7 @@ export class BaseIndexSnapshotStore {
489
472
  const snapshot = this.indexSnapshot;
490
473
  const affectedTargetPaths = new Set();
491
474
  const affectedSourcePaths = new Set(markdownPathsToRefresh);
475
+ const targetPathAliases = createReferenceTargetAliasMap(renamedFileEntries);
492
476
  if (membershipChanged) {
493
477
  const membershipAffectedPaths = [
494
478
  ...deletedFilePaths,
@@ -543,7 +527,7 @@ export class BaseIndexSnapshotStore {
543
527
  ...createdFilePaths,
544
528
  ...renamedFileEntries.map((entry) => entry.newPath),
545
529
  ...affectedSourcePaths,
546
- ]);
530
+ ], { targetPathAliases });
547
531
  } else {
548
532
  affectedSourcePaths.forEach((pathValue) => {
549
533
  this.removeSourceBacklinkContributions(snapshot, pathValue, affectedTargetPaths);
@@ -0,0 +1,233 @@
1
+ import {
2
+ getVaultFileExtension,
3
+ isImageAttachmentFilePath,
4
+ isMarkdownFilePath,
5
+ } from '../../domain/file-kind.js';
6
+ import { resolveWikiTargetWithIndex } from '../../domain/wiki-link-resolver.js';
7
+
8
+ const INTERNAL_LINK_RE = /(!)?\[\[([^\]|#]+)(?:#[^\]|]+)?(?:\|[^\]]+)?\]\]/g;
9
+ const MARKDOWN_IMAGE_OPEN_RE = /!\[[^\]\n]*\]\(/g;
10
+
11
+ function isAbsoluteOrExternalUrl(source = '') {
12
+ const normalized = String(source ?? '').trim();
13
+ return (
14
+ !normalized
15
+ || normalized.startsWith('data:')
16
+ || normalized.startsWith('blob:')
17
+ || normalized.startsWith('#')
18
+ || normalized.startsWith('//')
19
+ || /^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(normalized)
20
+ || normalized.startsWith('/')
21
+ );
22
+ }
23
+
24
+ function normalizePathSegments(pathValue = '') {
25
+ return String(pathValue ?? '')
26
+ .replace(/\\/g, '/')
27
+ .split('/')
28
+ .filter(Boolean);
29
+ }
30
+
31
+ function resolveVaultRelativePath(fromFilePath = '', relativePath = '') {
32
+ const sourceSegments = normalizePathSegments(fromFilePath);
33
+ const targetSegments = String(relativePath ?? '')
34
+ .split('/')
35
+ .map((segment) => {
36
+ try {
37
+ return decodeURIComponent(segment);
38
+ } catch {
39
+ return segment;
40
+ }
41
+ });
42
+
43
+ if (targetSegments.length === 0) {
44
+ return '';
45
+ }
46
+
47
+ sourceSegments.pop();
48
+ const resolvedSegments = [...sourceSegments];
49
+
50
+ for (const rawSegment of targetSegments) {
51
+ const segment = String(rawSegment ?? '').trim();
52
+ if (!segment || segment === '.') {
53
+ continue;
54
+ }
55
+
56
+ if (segment === '..') {
57
+ if (resolvedSegments.length === 0) {
58
+ return '';
59
+ }
60
+ resolvedSegments.pop();
61
+ continue;
62
+ }
63
+
64
+ resolvedSegments.push(segment);
65
+ }
66
+
67
+ return resolvedSegments.join('/');
68
+ }
69
+
70
+ function parseMarkdownImageDestination(sourceText = '') {
71
+ const text = String(sourceText ?? '');
72
+ let index = 0;
73
+ while (/\s/u.test(text[index] ?? '')) {
74
+ index += 1;
75
+ }
76
+
77
+ if (text[index] === '<') {
78
+ const endIndex = text.indexOf('>', index + 1);
79
+ if (endIndex < 0 || text.indexOf(')', endIndex + 1) < 0) {
80
+ return '';
81
+ }
82
+ return text.slice(index + 1, endIndex).trim();
83
+ }
84
+
85
+ const startIndex = index;
86
+ while (index < text.length) {
87
+ const char = text[index];
88
+ if (char === ')' || /\s/u.test(char)) {
89
+ break;
90
+ }
91
+ index += 1;
92
+ }
93
+
94
+ if (startIndex === index || text.indexOf(')', index) < 0) {
95
+ return '';
96
+ }
97
+
98
+ return text.slice(startIndex, index).trim();
99
+ }
100
+
101
+ function resolveMarkdownImageTargetPath(sourceFilePath = '', imageSource = '') {
102
+ const source = String(imageSource ?? '').trim();
103
+ if (isAbsoluteOrExternalUrl(source)) {
104
+ return '';
105
+ }
106
+
107
+ const resolvedPath = resolveVaultRelativePath(sourceFilePath, source);
108
+ return isImageAttachmentFilePath(resolvedPath) ? resolvedPath : '';
109
+ }
110
+
111
+ function resolveAliasedTargetPath(targetPath = '', wikiTargetIndex = null, targetPathAliases = new Map()) {
112
+ const candidates = [
113
+ String(targetPath ?? '').trim(),
114
+ normalizeReferenceTargetKey(targetPath),
115
+ ].filter(Boolean);
116
+
117
+ for (const candidate of candidates) {
118
+ const aliasedPath = targetPathAliases?.get?.(candidate);
119
+ if (aliasedPath && wikiTargetIndex?.exactPaths?.has?.(aliasedPath)) {
120
+ return aliasedPath;
121
+ }
122
+ }
123
+
124
+ return null;
125
+ }
126
+
127
+ export function normalizeReferenceTargetKey(target = '') {
128
+ const normalizedTarget = String(target ?? '').trim();
129
+ if (!normalizedTarget) {
130
+ return '';
131
+ }
132
+
133
+ return getVaultFileExtension(normalizedTarget)
134
+ ? normalizedTarget
135
+ : `${normalizedTarget}.md`;
136
+ }
137
+
138
+ export function collectReferenceTargetKeysForFilePath(filePath = '') {
139
+ const normalizedPath = String(filePath ?? '').trim();
140
+ if (!normalizedPath) {
141
+ return [];
142
+ }
143
+
144
+ const segments = normalizedPath.split('/').filter(Boolean);
145
+ const keys = [];
146
+ for (let index = 0; index < segments.length; index += 1) {
147
+ keys.push(segments.slice(index).join('/'));
148
+ }
149
+
150
+ if (isMarkdownFilePath(normalizedPath)) {
151
+ const rawSegments = normalizedPath.replace(/\.md$/i, '').split('/').filter(Boolean);
152
+ for (let index = 0; index < rawSegments.length; index += 1) {
153
+ keys.push(rawSegments.slice(index).join('/'));
154
+ }
155
+ }
156
+
157
+ return [...new Set(keys)];
158
+ }
159
+
160
+ export function createReferenceTargetAliasMap(renamedEntries = []) {
161
+ const aliases = new Map();
162
+
163
+ renamedEntries.forEach((entry) => {
164
+ const oldPath = Array.isArray(entry) ? entry[0] : entry?.oldPath;
165
+ const newPath = Array.isArray(entry) ? entry[1] : entry?.newPath;
166
+ if (!oldPath || !newPath) {
167
+ return;
168
+ }
169
+
170
+ aliases.set(oldPath, newPath);
171
+ collectReferenceTargetKeysForFilePath(oldPath).forEach((targetKey) => {
172
+ aliases.set(targetKey, newPath);
173
+ });
174
+ });
175
+
176
+ return aliases;
177
+ }
178
+
179
+ export function collectMarkdownReferences(markdownText = '', {
180
+ sourceFilePath = '',
181
+ targetPathAliases = new Map(),
182
+ wikiTargetIndex = null,
183
+ } = {}) {
184
+ const references = [];
185
+ const lines = String(markdownText ?? '').split('\n');
186
+
187
+ for (const line of lines) {
188
+ const context = line.trim();
189
+
190
+ INTERNAL_LINK_RE.lastIndex = 0;
191
+ let linkMatch;
192
+ while ((linkMatch = INTERNAL_LINK_RE.exec(line)) !== null) {
193
+ const rawTarget = String(linkMatch[2] ?? '').trim();
194
+ if (!rawTarget) {
195
+ continue;
196
+ }
197
+
198
+ const resolvedPath = resolveWikiTargetWithIndex(rawTarget, wikiTargetIndex)
199
+ || resolveAliasedTargetPath(rawTarget, wikiTargetIndex, targetPathAliases);
200
+ references.push({
201
+ context,
202
+ isEmbed: Boolean(linkMatch[1]),
203
+ rawTarget,
204
+ rawTargetKey: normalizeReferenceTargetKey(rawTarget),
205
+ resolvedPath,
206
+ targetPath: resolvedPath || rawTarget,
207
+ });
208
+ }
209
+
210
+ MARKDOWN_IMAGE_OPEN_RE.lastIndex = 0;
211
+ while (MARKDOWN_IMAGE_OPEN_RE.exec(line) !== null) {
212
+ const rawTarget = parseMarkdownImageDestination(line.slice(MARKDOWN_IMAGE_OPEN_RE.lastIndex));
213
+ const targetPath = resolveMarkdownImageTargetPath(sourceFilePath, rawTarget);
214
+ if (!targetPath) {
215
+ continue;
216
+ }
217
+
218
+ const resolvedPath = wikiTargetIndex?.exactPaths?.has?.(targetPath)
219
+ ? targetPath
220
+ : resolveAliasedTargetPath(targetPath, wikiTargetIndex, targetPathAliases);
221
+ references.push({
222
+ context,
223
+ isEmbed: true,
224
+ rawTarget,
225
+ rawTargetKey: normalizeReferenceTargetKey(targetPath),
226
+ resolvedPath,
227
+ targetPath,
228
+ });
229
+ }
230
+ }
231
+
232
+ return references;
233
+ }
@@ -108,6 +108,41 @@ function replacePathPrefix(pathValue, oldPrefix, newPrefix) {
108
108
  return `${newPrefix}${pathValue.slice(oldPrefix.length)}`;
109
109
  }
110
110
 
111
+ function collectAncestorDirectoryPaths(pathValue) {
112
+ const normalizedPath = String(pathValue ?? '').replace(/\\/g, '/').trim();
113
+ if (!normalizedPath) {
114
+ return [];
115
+ }
116
+
117
+ const segments = normalizedPath.split('/').filter(Boolean);
118
+ const ancestors = [];
119
+ let currentPath = '';
120
+ for (let index = 0; index < Math.max(segments.length - 1, 0); index += 1) {
121
+ currentPath = currentPath ? `${currentPath}/${segments[index]}` : segments[index];
122
+ ancestors.push(currentPath);
123
+ }
124
+
125
+ return ancestors;
126
+ }
127
+
128
+ function expandManagedPaths(paths = []) {
129
+ const expandedPaths = new Set();
130
+
131
+ paths.filter(Boolean).forEach((pathValue) => {
132
+ const normalizedPath = String(pathValue ?? '').replace(/\\/g, '/').trim();
133
+ if (!normalizedPath) {
134
+ return;
135
+ }
136
+
137
+ expandedPaths.add(normalizedPath);
138
+ collectAncestorDirectoryPaths(normalizedPath).forEach((ancestorPath) => {
139
+ expandedPaths.add(ancestorPath);
140
+ });
141
+ });
142
+
143
+ return sortWorkspacePaths(Array.from(expandedPaths));
144
+ }
145
+
111
146
  function sortWorkspacePaths(paths = [], direction = 'asc') {
112
147
  const factor = direction === 'desc' ? -1 : 1;
113
148
  return [...paths].sort((left, right) => {
@@ -833,7 +868,7 @@ export class VaultFileStore {
833
868
  }
834
869
 
835
870
  try {
836
- await this.runManagedWrite([filePath], async () => {
871
+ await this.runManagedWrite(expandManagedPaths([filePath]), async () => {
837
872
  await rm(absolute, { force: true });
838
873
  await this.sidecarStore.deleteAllForFile(filePath);
839
874
  });
@@ -858,7 +893,7 @@ export class VaultFileStore {
858
893
  }
859
894
 
860
895
  try {
861
- await this.runManagedWrite([oldPath, newPath], async () => {
896
+ await this.runManagedWrite(expandManagedPaths([oldPath, newPath]), async () => {
862
897
  await mkdir(dirname(absoluteNew), { recursive: true });
863
898
  await rename(absoluteOld, absoluteNew);
864
899
  await this.sidecarStore.renameAllForFile(oldPath, newPath);
@@ -901,7 +936,7 @@ export class VaultFileStore {
901
936
  const nextManagedPaths = managedPaths.map((pathValue) => replacePathPrefix(pathValue, oldPath, newPath));
902
937
 
903
938
  try {
904
- await this.runManagedWrite([oldPath, newPath, ...managedPaths, ...nextManagedPaths], async () => {
939
+ await this.runManagedWrite(expandManagedPaths([oldPath, newPath, ...managedPaths, ...nextManagedPaths]), async () => {
905
940
  await mkdir(dirname(absoluteNew), { recursive: true });
906
941
  await rename(absoluteOld, absoluteNew);
907
942
  await Promise.all(
@@ -943,7 +978,7 @@ export class VaultFileStore {
943
978
  }
944
979
  }
945
980
 
946
- await this.runManagedWrite([dirPath, ...managedPaths], async () => {
981
+ await this.runManagedWrite(expandManagedPaths([dirPath, ...managedPaths]), async () => {
947
982
  if (recursive) {
948
983
  await rm(absolute, { force: true, recursive: true });
949
984
  } else {