@latentic/live-markdown 0.3.0 → 0.4.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.
Files changed (341) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +2 -2
  3. package/dist/chunk-V6TY7KAL.js +8 -0
  4. package/dist/chunk-V6TY7KAL.js.map +1 -0
  5. package/dist/codemirror/CodeMirrorMarkdownEditor.d.ts +106 -0
  6. package/dist/codemirror/CodeMirrorMarkdownEditor.js +482 -0
  7. package/dist/codemirror/CodeMirrorMarkdownEditor.js.map +1 -0
  8. package/dist/codemirror/byteOffset.d.ts +17 -0
  9. package/dist/codemirror/byteOffset.js +19 -0
  10. package/dist/codemirror/byteOffset.js.map +1 -0
  11. package/dist/codemirror/caretLayer.d.ts +19 -0
  12. package/dist/codemirror/caretLayer.js +44 -0
  13. package/dist/codemirror/caretLayer.js.map +1 -0
  14. package/dist/codemirror/clipboard/copyRich.d.ts +37 -0
  15. package/dist/codemirror/clipboard/copyRich.js +72 -0
  16. package/dist/codemirror/clipboard/copyRich.js.map +1 -0
  17. package/dist/codemirror/clipboard/htmlToMarkdown.d.ts +20 -0
  18. package/dist/codemirror/clipboard/htmlToMarkdown.js +91 -0
  19. package/dist/codemirror/clipboard/htmlToMarkdown.js.map +1 -0
  20. package/dist/codemirror/clipboard/pasteMarkdown.d.ts +18 -0
  21. package/dist/codemirror/clipboard/pasteMarkdown.js +41 -0
  22. package/dist/codemirror/clipboard/pasteMarkdown.js.map +1 -0
  23. package/dist/codemirror/code/codeHighlight.d.ts +13 -0
  24. package/dist/codemirror/code/codeHighlight.js +15 -0
  25. package/dist/codemirror/code/codeHighlight.js.map +1 -0
  26. package/dist/codemirror/code/codeLangAffordance.d.ts +17 -0
  27. package/dist/codemirror/code/codeLangAffordance.js +80 -0
  28. package/dist/codemirror/code/codeLangAffordance.js.map +1 -0
  29. package/dist/codemirror/code/codeLanguageMenu.d.ts +40 -0
  30. package/dist/codemirror/code/codeLanguageMenu.js +184 -0
  31. package/dist/codemirror/code/codeLanguageMenu.js.map +1 -0
  32. package/dist/codemirror/code/codePalette.d.ts +39 -0
  33. package/dist/codemirror/code/codePalette.js +53 -0
  34. package/dist/codemirror/code/codePalette.js.map +1 -0
  35. package/dist/codemirror/code/fenceAutoClose.d.ts +30 -0
  36. package/dist/codemirror/code/fenceAutoClose.js +171 -0
  37. package/dist/codemirror/code/fenceAutoClose.js.map +1 -0
  38. package/dist/codemirror/code/fenceCaretGuard.d.ts +28 -0
  39. package/dist/codemirror/code/fenceCaretGuard.js +66 -0
  40. package/dist/codemirror/code/fenceCaretGuard.js.map +1 -0
  41. package/dist/codemirror/code/fenceDeleteGuards.d.ts +22 -0
  42. package/dist/codemirror/code/fenceDeleteGuards.js +105 -0
  43. package/dist/codemirror/code/fenceDeleteGuards.js.map +1 -0
  44. package/dist/codemirror/code/fenceTabIndent.d.ts +8 -0
  45. package/dist/codemirror/code/fenceTabIndent.js +50 -0
  46. package/dist/codemirror/code/fenceTabIndent.js.map +1 -0
  47. package/dist/codemirror/code/highlightFence.d.ts +25 -0
  48. package/dist/codemirror/code/highlightFence.js +45 -0
  49. package/dist/codemirror/code/highlightFence.js.map +1 -0
  50. package/dist/codemirror/code/index.d.ts +9 -0
  51. package/dist/codemirror/code/index.js +8 -0
  52. package/dist/codemirror/code/index.js.map +1 -0
  53. package/dist/codemirror/core/codeContext.d.ts +32 -0
  54. package/dist/codemirror/core/codeContext.js +22 -0
  55. package/dist/codemirror/core/codeContext.js.map +1 -0
  56. package/dist/codemirror/core/editorTestHarness.d.ts +31 -0
  57. package/dist/codemirror/core/editorTestHarness.js +69 -0
  58. package/dist/codemirror/core/editorTestHarness.js.map +1 -0
  59. package/dist/codemirror/core/editorTheme.d.ts +39 -0
  60. package/dist/codemirror/core/editorTheme.js +498 -0
  61. package/dist/codemirror/core/editorTheme.js.map +1 -0
  62. package/dist/codemirror/core/hostFacets.d.ts +58 -0
  63. package/dist/codemirror/core/hostFacets.js +27 -0
  64. package/dist/codemirror/core/hostFacets.js.map +1 -0
  65. package/dist/codemirror/core/hrWidget.d.ts +22 -0
  66. package/dist/codemirror/core/hrWidget.js +22 -0
  67. package/dist/codemirror/core/hrWidget.js.map +1 -0
  68. package/dist/codemirror/core/htmlEscape.d.ts +6 -0
  69. package/dist/codemirror/core/htmlEscape.js +12 -0
  70. package/dist/codemirror/core/htmlEscape.js.map +1 -0
  71. package/dist/codemirror/core/index.d.ts +13 -0
  72. package/dist/codemirror/core/index.js +9 -0
  73. package/dist/codemirror/core/index.js.map +1 -0
  74. package/dist/codemirror/core/inlineScan.d.ts +49 -0
  75. package/dist/codemirror/core/inlineScan.js +31 -0
  76. package/dist/codemirror/core/inlineScan.js.map +1 -0
  77. package/dist/codemirror/core/lineStructure.d.ts +47 -0
  78. package/dist/codemirror/core/lineStructure.js +64 -0
  79. package/dist/codemirror/core/lineStructure.js.map +1 -0
  80. package/dist/codemirror/core/linkResolution.d.ts +36 -0
  81. package/dist/codemirror/core/linkResolution.js +58 -0
  82. package/dist/codemirror/core/linkResolution.js.map +1 -0
  83. package/dist/codemirror/core/paint.d.ts +118 -0
  84. package/dist/codemirror/core/paint.js +42 -0
  85. package/dist/codemirror/core/paint.js.map +1 -0
  86. package/dist/codemirror/core/parseToEnd.d.ts +24 -0
  87. package/dist/codemirror/core/parseToEnd.js +38 -0
  88. package/dist/codemirror/core/parseToEnd.js.map +1 -0
  89. package/dist/codemirror/core/plugin.d.ts +32 -0
  90. package/dist/codemirror/core/plugin.js +161 -0
  91. package/dist/codemirror/core/plugin.js.map +1 -0
  92. package/dist/codemirror/core/registry.d.ts +38 -0
  93. package/dist/codemirror/core/registry.js +133 -0
  94. package/dist/codemirror/core/registry.js.map +1 -0
  95. package/dist/codemirror/core/testKeys.d.ts +17 -0
  96. package/dist/codemirror/core/testKeys.js +11 -0
  97. package/dist/codemirror/core/testKeys.js.map +1 -0
  98. package/dist/codemirror/core/treeAt.d.ts +31 -0
  99. package/dist/codemirror/core/treeAt.js +10 -0
  100. package/dist/codemirror/core/treeAt.js.map +1 -0
  101. package/dist/codemirror/extensions/footnoteExtension.d.ts +9 -0
  102. package/dist/codemirror/extensions/footnoteExtension.js +14 -0
  103. package/dist/codemirror/extensions/footnoteExtension.js.map +1 -0
  104. package/dist/codemirror/extensions/highlightExtension.d.ts +9 -0
  105. package/dist/codemirror/extensions/highlightExtension.js +14 -0
  106. package/dist/codemirror/extensions/highlightExtension.js.map +1 -0
  107. package/dist/codemirror/extensions/index.d.ts +12 -0
  108. package/dist/codemirror/extensions/index.js +19 -0
  109. package/dist/codemirror/extensions/index.js.map +1 -0
  110. package/dist/codemirror/extensions/loader.d.ts +24 -0
  111. package/dist/codemirror/extensions/loader.js +33 -0
  112. package/dist/codemirror/extensions/loader.js.map +1 -0
  113. package/dist/codemirror/extensions/mathExtension.d.ts +9 -0
  114. package/dist/codemirror/extensions/mathExtension.js +14 -0
  115. package/dist/codemirror/extensions/mathExtension.js.map +1 -0
  116. package/dist/codemirror/extensions/mermaidExtension.d.ts +9 -0
  117. package/dist/codemirror/extensions/mermaidExtension.js +12 -0
  118. package/dist/codemirror/extensions/mermaidExtension.js.map +1 -0
  119. package/dist/codemirror/extensions/tableExtension.d.ts +13 -0
  120. package/dist/codemirror/extensions/tableExtension.js +39 -0
  121. package/dist/codemirror/extensions/tableExtension.js.map +1 -0
  122. package/dist/codemirror/extensions/types.d.ts +39 -0
  123. package/dist/codemirror/extensions/types.js +1 -0
  124. package/dist/codemirror/extensions/types.js.map +1 -0
  125. package/dist/codemirror/extensions/wikilinkExtension.d.ts +9 -0
  126. package/dist/codemirror/extensions/wikilinkExtension.js +14 -0
  127. package/dist/codemirror/extensions/wikilinkExtension.js.map +1 -0
  128. package/dist/codemirror/features/blockCommandSteps.d.ts +20 -0
  129. package/dist/codemirror/features/blockCommandSteps.js +83 -0
  130. package/dist/codemirror/features/blockCommandSteps.js.map +1 -0
  131. package/dist/codemirror/footnote/footnotePlugin.d.ts +10 -0
  132. package/dist/codemirror/footnote/footnotePlugin.js +78 -0
  133. package/dist/codemirror/footnote/footnotePlugin.js.map +1 -0
  134. package/dist/codemirror/footnote/footnoteScanRule.d.ts +9 -0
  135. package/dist/codemirror/footnote/footnoteScanRule.js +12 -0
  136. package/dist/codemirror/footnote/footnoteScanRule.js.map +1 -0
  137. package/dist/codemirror/footnote/index.d.ts +2 -0
  138. package/dist/codemirror/footnote/index.js +2 -0
  139. package/dist/codemirror/footnote/index.js.map +1 -0
  140. package/dist/codemirror/format/blockCommands.d.ts +17 -0
  141. package/dist/codemirror/format/blockCommands.js +176 -0
  142. package/dist/codemirror/format/blockCommands.js.map +1 -0
  143. package/dist/codemirror/format/formatCommands.d.ts +11 -0
  144. package/dist/codemirror/format/formatCommands.js +132 -0
  145. package/dist/codemirror/format/formatCommands.js.map +1 -0
  146. package/dist/codemirror/format/index.d.ts +4 -0
  147. package/dist/codemirror/format/index.js +3 -0
  148. package/dist/codemirror/format/index.js.map +1 -0
  149. package/dist/codemirror/highlight/highlightPlugin.d.ts +10 -0
  150. package/dist/codemirror/highlight/highlightPlugin.js +66 -0
  151. package/dist/codemirror/highlight/highlightPlugin.js.map +1 -0
  152. package/dist/codemirror/highlight/highlightScanRule.d.ts +8 -0
  153. package/dist/codemirror/highlight/highlightScanRule.js +12 -0
  154. package/dist/codemirror/highlight/highlightScanRule.js.map +1 -0
  155. package/dist/codemirror/highlight/index.d.ts +2 -0
  156. package/dist/codemirror/highlight/index.js +2 -0
  157. package/dist/codemirror/highlight/index.js.map +1 -0
  158. package/dist/codemirror/html/htmlWidget.d.ts +23 -0
  159. package/dist/codemirror/html/htmlWidget.js +67 -0
  160. package/dist/codemirror/html/htmlWidget.js.map +1 -0
  161. package/dist/codemirror/html/index.d.ts +4 -0
  162. package/dist/codemirror/html/index.js +2 -0
  163. package/dist/codemirror/html/index.js.map +1 -0
  164. package/dist/codemirror/image/imageActionMenu.d.ts +14 -0
  165. package/dist/codemirror/image/imageActionMenu.js +112 -0
  166. package/dist/codemirror/image/imageActionMenu.js.map +1 -0
  167. package/dist/codemirror/image/imageEditEvent.d.ts +20 -0
  168. package/dist/codemirror/image/imageEditEvent.js +6 -0
  169. package/dist/codemirror/image/imageEditEvent.js.map +1 -0
  170. package/dist/codemirror/image/imageInsertHandlers.d.ts +13 -0
  171. package/dist/codemirror/image/imageInsertHandlers.js +64 -0
  172. package/dist/codemirror/image/imageInsertHandlers.js.map +1 -0
  173. package/dist/codemirror/image/imageWidget.d.ts +49 -0
  174. package/dist/codemirror/image/imageWidget.js +83 -0
  175. package/dist/codemirror/image/imageWidget.js.map +1 -0
  176. package/dist/codemirror/image/index.d.ts +8 -0
  177. package/dist/codemirror/image/index.js +5 -0
  178. package/dist/codemirror/image/index.js.map +1 -0
  179. package/dist/codemirror/interaction/clickModel.d.ts +43 -0
  180. package/dist/codemirror/interaction/clickModel.js +99 -0
  181. package/dist/codemirror/interaction/clickModel.js.map +1 -0
  182. package/dist/codemirror/interaction/cursorModel.d.ts +10 -0
  183. package/dist/codemirror/interaction/cursorModel.js +58 -0
  184. package/dist/codemirror/interaction/cursorModel.js.map +1 -0
  185. package/dist/codemirror/interaction/deleteNormalizer.d.ts +18 -0
  186. package/dist/codemirror/interaction/deleteNormalizer.js +157 -0
  187. package/dist/codemirror/interaction/deleteNormalizer.js.map +1 -0
  188. package/dist/codemirror/interaction/flankingGuard.d.ts +20 -0
  189. package/dist/codemirror/interaction/flankingGuard.js +48 -0
  190. package/dist/codemirror/interaction/flankingGuard.js.map +1 -0
  191. package/dist/codemirror/interaction/index.d.ts +7 -0
  192. package/dist/codemirror/interaction/index.js +6 -0
  193. package/dist/codemirror/interaction/index.js.map +1 -0
  194. package/dist/codemirror/interaction/visiblePosition.d.ts +43 -0
  195. package/dist/codemirror/interaction/visiblePosition.js +98 -0
  196. package/dist/codemirror/interaction/visiblePosition.js.map +1 -0
  197. package/dist/codemirror/list/bulletWidget.d.ts +61 -0
  198. package/dist/codemirror/list/bulletWidget.js +84 -0
  199. package/dist/codemirror/list/bulletWidget.js.map +1 -0
  200. package/dist/codemirror/list/index.d.ts +4 -0
  201. package/dist/codemirror/list/index.js +3 -0
  202. package/dist/codemirror/list/index.js.map +1 -0
  203. package/dist/codemirror/list/listContinuation.d.ts +28 -0
  204. package/dist/codemirror/list/listContinuation.js +61 -0
  205. package/dist/codemirror/list/listContinuation.js.map +1 -0
  206. package/dist/codemirror/list/listIndent.d.ts +8 -0
  207. package/dist/codemirror/list/listIndent.js +95 -0
  208. package/dist/codemirror/list/listIndent.js.map +1 -0
  209. package/dist/codemirror/list/taskCheckboxWidget.d.ts +42 -0
  210. package/dist/codemirror/list/taskCheckboxWidget.js +47 -0
  211. package/dist/codemirror/list/taskCheckboxWidget.js.map +1 -0
  212. package/dist/codemirror/math/index.d.ts +3 -0
  213. package/dist/codemirror/math/index.js +2 -0
  214. package/dist/codemirror/math/index.js.map +1 -0
  215. package/dist/codemirror/math/mathPlugin.d.ts +10 -0
  216. package/dist/codemirror/math/mathPlugin.js +73 -0
  217. package/dist/codemirror/math/mathPlugin.js.map +1 -0
  218. package/dist/codemirror/math/mathScanRule.d.ts +16 -0
  219. package/dist/codemirror/math/mathScanRule.js +18 -0
  220. package/dist/codemirror/math/mathScanRule.js.map +1 -0
  221. package/dist/codemirror/math/mathWidget.d.ts +15 -0
  222. package/dist/codemirror/math/mathWidget.js +36 -0
  223. package/dist/codemirror/math/mathWidget.js.map +1 -0
  224. package/dist/codemirror/mermaid/index.d.ts +4 -0
  225. package/dist/codemirror/mermaid/index.js +3 -0
  226. package/dist/codemirror/mermaid/index.js.map +1 -0
  227. package/dist/codemirror/mermaid/mermaidPlugin.d.ts +25 -0
  228. package/dist/codemirror/mermaid/mermaidPlugin.js +78 -0
  229. package/dist/codemirror/mermaid/mermaidPlugin.js.map +1 -0
  230. package/dist/codemirror/mermaid/mermaidRender.d.ts +42 -0
  231. package/dist/codemirror/mermaid/mermaidRender.js +136 -0
  232. package/dist/codemirror/mermaid/mermaidRender.js.map +1 -0
  233. package/dist/codemirror/mermaid/mermaidWidget.d.ts +42 -0
  234. package/dist/codemirror/mermaid/mermaidWidget.js +142 -0
  235. package/dist/codemirror/mermaid/mermaidWidget.js.map +1 -0
  236. package/dist/codemirror/selectionLayer.d.ts +43 -0
  237. package/dist/codemirror/selectionLayer.js +135 -0
  238. package/dist/codemirror/selectionLayer.js.map +1 -0
  239. package/dist/codemirror/table/cellDividerWidget.d.ts +9 -0
  240. package/dist/codemirror/table/cellDividerWidget.js +19 -0
  241. package/dist/codemirror/table/cellDividerWidget.js.map +1 -0
  242. package/dist/codemirror/table/index.d.ts +5 -0
  243. package/dist/codemirror/table/index.js +4 -0
  244. package/dist/codemirror/table/index.js.map +1 -0
  245. package/dist/codemirror/table/tableArmed.d.ts +27 -0
  246. package/dist/codemirror/table/tableArmed.js +43 -0
  247. package/dist/codemirror/table/tableArmed.js.map +1 -0
  248. package/dist/codemirror/table/tableCell.d.ts +19 -0
  249. package/dist/codemirror/table/tableCell.js +15 -0
  250. package/dist/codemirror/table/tableCell.js.map +1 -0
  251. package/dist/codemirror/table/tableCellNav.d.ts +51 -0
  252. package/dist/codemirror/table/tableCellNav.js +47 -0
  253. package/dist/codemirror/table/tableCellNav.js.map +1 -0
  254. package/dist/codemirror/table/tableContextMenu.d.ts +22 -0
  255. package/dist/codemirror/table/tableContextMenu.js +139 -0
  256. package/dist/codemirror/table/tableContextMenu.js.map +1 -0
  257. package/dist/codemirror/table/tableEditCommands.d.ts +29 -0
  258. package/dist/codemirror/table/tableEditCommands.js +86 -0
  259. package/dist/codemirror/table/tableEditCommands.js.map +1 -0
  260. package/dist/codemirror/table/tableExcerpt.d.ts +29 -0
  261. package/dist/codemirror/table/tableExcerpt.js +34 -0
  262. package/dist/codemirror/table/tableExcerpt.js.map +1 -0
  263. package/dist/codemirror/table/tableField.d.ts +6 -0
  264. package/dist/codemirror/table/tableField.js +37 -0
  265. package/dist/codemirror/table/tableField.js.map +1 -0
  266. package/dist/codemirror/table/tableGeometry.d.ts +33 -0
  267. package/dist/codemirror/table/tableGeometry.js +28 -0
  268. package/dist/codemirror/table/tableGeometry.js.map +1 -0
  269. package/dist/codemirror/table/tableInline.d.ts +37 -0
  270. package/dist/codemirror/table/tableInline.js +105 -0
  271. package/dist/codemirror/table/tableInline.js.map +1 -0
  272. package/dist/codemirror/table/tableModel.d.ts +45 -0
  273. package/dist/codemirror/table/tableModel.js +98 -0
  274. package/dist/codemirror/table/tableModel.js.map +1 -0
  275. package/dist/codemirror/tablev2/bridgeRules.d.ts +48 -0
  276. package/dist/codemirror/tablev2/bridgeRules.js +42 -0
  277. package/dist/codemirror/tablev2/bridgeRules.js.map +1 -0
  278. package/dist/codemirror/tablev2/cellEditingSurface.d.ts +79 -0
  279. package/dist/codemirror/tablev2/cellEditingSurface.js +70 -0
  280. package/dist/codemirror/tablev2/cellEditingSurface.js.map +1 -0
  281. package/dist/codemirror/tablev2/cellText.d.ts +11 -0
  282. package/dist/codemirror/tablev2/cellText.js +12 -0
  283. package/dist/codemirror/tablev2/cellText.js.map +1 -0
  284. package/dist/codemirror/tablev2/inlineCellSurface.d.ts +38 -0
  285. package/dist/codemirror/tablev2/inlineCellSurface.js +162 -0
  286. package/dist/codemirror/tablev2/inlineCellSurface.js.map +1 -0
  287. package/dist/codemirror/tablev2/overlayCellSurface.d.ts +36 -0
  288. package/dist/codemirror/tablev2/overlayCellSurface.js +150 -0
  289. package/dist/codemirror/tablev2/overlayCellSurface.js.map +1 -0
  290. package/dist/codemirror/tablev2/tableEditingSteps.d.ts +12 -0
  291. package/dist/codemirror/tablev2/tableEditingSteps.js +518 -0
  292. package/dist/codemirror/tablev2/tableEditingSteps.js.map +1 -0
  293. package/dist/codemirror/tablev2/tableV2HoverControls.d.ts +23 -0
  294. package/dist/codemirror/tablev2/tableV2HoverControls.js +89 -0
  295. package/dist/codemirror/tablev2/tableV2HoverControls.js.map +1 -0
  296. package/dist/codemirror/tablev2/tableV2Interaction.d.ts +29 -0
  297. package/dist/codemirror/tablev2/tableV2Interaction.js +224 -0
  298. package/dist/codemirror/tablev2/tableV2Interaction.js.map +1 -0
  299. package/dist/codemirror/tablev2/tableV2Selection.d.ts +45 -0
  300. package/dist/codemirror/tablev2/tableV2Selection.js +81 -0
  301. package/dist/codemirror/tablev2/tableV2Selection.js.map +1 -0
  302. package/dist/codemirror/tablev2/tableV2Sync.d.ts +13 -0
  303. package/dist/codemirror/tablev2/tableV2Sync.js +13 -0
  304. package/dist/codemirror/tablev2/tableV2Sync.js.map +1 -0
  305. package/dist/codemirror/tablev2/tableWidgetV2.d.ts +46 -0
  306. package/dist/codemirror/tablev2/tableWidgetV2.js +139 -0
  307. package/dist/codemirror/tablev2/tableWidgetV2.js.map +1 -0
  308. package/dist/codemirror/updateBus.d.ts +29 -0
  309. package/dist/codemirror/updateBus.js +26 -0
  310. package/dist/codemirror/updateBus.js.map +1 -0
  311. package/dist/codemirror/wikilink/index.d.ts +3 -0
  312. package/dist/codemirror/wikilink/index.js +2 -0
  313. package/dist/codemirror/wikilink/index.js.map +1 -0
  314. package/dist/codemirror/wikilink/wikilinkPlugin.d.ts +40 -0
  315. package/dist/codemirror/wikilink/wikilinkPlugin.js +89 -0
  316. package/dist/codemirror/wikilink/wikilinkPlugin.js.map +1 -0
  317. package/dist/codemirror/wikilink/wikilinkScanRule.d.ts +9 -0
  318. package/dist/codemirror/wikilink/wikilinkScanRule.js +13 -0
  319. package/dist/codemirror/wikilink/wikilinkScanRule.js.map +1 -0
  320. package/dist/frontmatter.d.ts +79 -0
  321. package/dist/frontmatter.js +58 -0
  322. package/dist/frontmatter.js.map +1 -0
  323. package/dist/imageInsert.d.ts +66 -0
  324. package/dist/imageInsert.js +111 -0
  325. package/dist/imageInsert.js.map +1 -0
  326. package/dist/imageSrcResolver.d.ts +55 -0
  327. package/dist/imageSrcResolver.js +49 -0
  328. package/dist/imageSrcResolver.js.map +1 -0
  329. package/dist/index.d.ts +35 -880
  330. package/dist/index.js +128 -5989
  331. package/dist/index.js.map +1 -1
  332. package/dist/links/wikilink.d.ts +26 -0
  333. package/dist/links/wikilink.js +54 -0
  334. package/dist/links/wikilink.js.map +1 -0
  335. package/dist/links/workspaceLink.d.ts +34 -0
  336. package/dist/links/workspaceLink.js +60 -0
  337. package/dist/links/workspaceLink.js.map +1 -0
  338. package/dist/types.d.ts +20 -0
  339. package/dist/types.js +1 -0
  340. package/dist/types.js.map +1 -0
  341. package/package.json +7 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/editorTheme.ts"],"sourcesContent":["/**\n * Editor theme.\n *\n * Lives in `EditorView.baseTheme` rather than in `global.scss` for\n * three load-bearing reasons:\n *\n * 1. **Line-metric integrity.** CM6 measures line heights from the\n * DOM through a `requestMeasure` cycle to compute click → byte\n * and scroll → viewport mappings. Styles injected via\n * `EditorView.theme` participate in that cycle at the right\n * moment; styles from an external sheet can land *after* the\n * first measurement, so clicks land on the wrong line until the\n * next measure fires. (This was the click-drift the spike\n * shipped — fixed by moving here.)\n * 2. **Specificity that beats the base theme without `!important`.**\n * CM6 ships its monospace-and-purple base theme via the same\n * mechanism; layering `EditorView.theme` on top is the only\n * collision-free pattern.\n * 3. **No margin/padding on heading lines.** Margins between\n * `.cm-line` siblings shift visual position without changing\n * `offsetTop`, so the metric cache and the eye disagree —\n * that's the canonical click-on-wrong-line bug. We change\n * `font:` (which doesn't touch line-height), nothing else.\n *\n * Zettlr's `markdown-editor/theme/editor.ts` is the canonical\n * reference for this pattern in the open-source ecosystem.\n */\n\nimport { EditorView } from \"@codemirror/view\";\n\n/**\n * `EditorView.theme` (not `baseTheme`) — `baseTheme` is the\n * low-priority slot meant for theme packages and gets out-specifity'd\n * by any app-level CSS (Carbon's globals in our case). `theme` is the\n * app-priority slot; our intent is to override CM6's defaults, so\n * this is the right tier.\n */\nexport const editorBaseTheme = EditorView.theme({\n // CM6 paints a focus outline by default. The caret IS the focus\n // indicator in Compose; the box would be visual noise.\n \"&.cm-focused\": {\n outline: \"none\",\n },\n\n // Body type. Override CM6's monospace default *here* (not in the\n // external stylesheet) so the measurement cycle sees it.\n \".cm-content\": {\n fontFamily:\n \"var(--cds-body-01-font-family, -apple-system, BlinkMacSystemFont, \\\"Segoe UI\\\", sans-serif)\",\n fontSize: \"1rem\",\n // Tight line-height: the caret height tracks the line box\n // (line-height × font-size), so anything above 1.4 starts to\n // feel disproportionate. 1.4 is the value Zettlr uses for the\n // same reason.\n lineHeight: \"1.4\",\n color: \"var(--cds-text-primary, #161616)\",\n maxWidth: \"48rem\",\n margin: \"0 auto\",\n },\n\n // Scroller padding — kept here so it's part of the same theme\n // bundle as the content metrics.\n \".cm-scroller\": {\n padding: \"1.5rem 3rem\",\n },\n\n // Drawn selection (selectionLayer.ts) — ranges paint from logical state so\n // the highlight survives the virtualized viewport. The widget tint sits\n // ABOVE block widgets (their opaque backgrounds hide the below-layer band).\n \".cm-selectionBackground\": {\n background: \"var(--cds-highlight, #d0e2ff)\",\n },\n \"&:not(.cm-focused) .cm-selectionBackground\": {\n background: \"var(--cds-layer-accent-01, #e0e0e0)\",\n },\n \".cm-selectionWidgetTint\": {\n background: \"rgba(15, 98, 254, 0.08)\",\n },\n\n // Caret stroke. CM6 owns the height (it tracks the current line-box,\n // so headings get a heading-sized caret automatically per spec 6.2).\n // Width is spec's 1 px at the default root size, in rem so it follows the\n // user's text-size preference; \"thick caret\" mode is a Phase-N follow-up.\n //\n // The COLOUR has to be stated. CodeMirror's base theme paints the caret\n // `solid black` and only picks its lighter variant when the view theme is\n // registered with `{ dark: true }`. This editor is themed through CSS custom\n // properties instead, so CodeMirror believes it is always light — leaving a\n // black caret on a dark canvas, invisible exactly where someone is typing.\n \".cm-cursor, .cm-dropCursor\": {\n borderLeftWidth: \"0.0625rem\",\n borderLeftColor: \"var(--cds-text-primary, #161616)\",\n },\n\n // Headings — `font:` shorthand changes size + weight *without*\n // setting line-height (it inherits the content's 1.5). The vertical\n // breathing room is `padding` not `margin` for the click-metric\n // reason above — sibling margins drift, sibling padding doesn't.\n \".cm-heading--1\": {\n fontWeight: \"700\",\n fontSize: \"2.0rem\",\n lineHeight: \"1.3\",\n paddingTop: \"0.6em\",\n paddingBottom: \"0.2em\",\n },\n \".cm-heading--2\": {\n fontWeight: \"700\",\n fontSize: \"1.6rem\",\n lineHeight: \"1.3\",\n paddingTop: \"0.5em\",\n paddingBottom: \"0.15em\",\n },\n \".cm-heading--3\": {\n fontWeight: \"700\",\n fontSize: \"1.3rem\",\n lineHeight: \"1.3\",\n paddingTop: \"0.4em\",\n paddingBottom: \"0.1em\",\n },\n \".cm-heading--4\": { fontWeight: \"700\", fontSize: \"1.15rem\", paddingTop: \"0.3em\" },\n \".cm-heading--5\": { fontWeight: \"700\", fontSize: \"1.05rem\", paddingTop: \"0.25em\" },\n \".cm-heading--6\": {\n fontWeight: \"700\",\n fontSize: \"1.0rem\",\n color: \"var(--cds-text-secondary, #525252)\",\n paddingTop: \"0.2em\",\n },\n\n // Inline / block styling. All sized by font + color only — never\n // by margin/padding, never by line-height override.\n \".cm-strong\": { fontWeight: \"700\" },\n \".cm-emphasis\": { fontStyle: \"italic\" },\n \".cm-strikethrough\": { textDecoration: \"line-through\" },\n\n // Code backgrounds are translucent, never opaque: the drawn selection\n // (selectionLayer.ts) paints BELOW the content, so an opaque background here\n // blanks the highlight on exactly these rows/chips while the prose around\n // them tints. The alphas composite to the intended resting colors on the\n // white canvas — #e0e0e0 for the inline chip, #f6f8fa (GitHub-style) for\n // fence lines.\n \".cm-inline-code\": {\n fontFamily:\n \"var(--cds-code-01-font-family, ui-monospace, \\\"SF Mono\\\", Menlo, monospace)\",\n fontSize: \"0.92em\",\n padding: \"0 0.25em\",\n background: \"rgba(141, 141, 141, 0.27)\",\n borderRadius: \"0.1875rem\",\n },\n\n \".cm-fenced-code\": {\n fontFamily:\n \"var(--cds-code-01-font-family, ui-monospace, \\\"SF Mono\\\", Menlo, monospace)\",\n fontSize: \"0.92em\",\n background: \"rgba(30, 80, 130, 0.04)\",\n paddingLeft: \"0.75em\",\n paddingBottom: \"0\",\n },\n // Language tag on a fence's opener row — visible (never invisible typing)\n // and rendered as a small pill so it reads as the block's chrome, not as a\n // wrong-font first code line (§12.4/§12.7).\n \".cm-code-info\": {\n color: \"var(--cds-text-secondary, #6f6f6f)\",\n fontSize: \"0.75em\",\n background: \"var(--cds-layer-accent-01, #e8ebee)\",\n padding: \"0.1em 0.5em\",\n borderRadius: \"999rem\",\n verticalAlign: \"0.1em\",\n cursor: \"pointer\",\n },\n \".cm-code-info:hover\": {\n background: \"var(--cds-layer-accent-hover-01, #d1d7dc)\",\n color: \"var(--cds-text-primary, #161616)\",\n },\n // The languageless placeholder: same chip, dimmed, so every closed block\n // has a discoverable language control.\n \".cm-code-info--unset\": {\n opacity: \"0.55\",\n fontStyle: \"italic\",\n },\n\n \".cm-blockquote\": {\n borderInlineStart: \"0.1875rem solid var(--cds-border-subtle-02, #c6c6c6)\",\n paddingInlineStart: \"0.75em\",\n color: \"var(--cds-text-secondary, #525252)\",\n fontStyle: \"italic\",\n },\n\n // List-item line: small left indent so the bullet widget sits in\n // its own column. Padding (not margin) keeps click metrics exact.\n \".cm-list-line\": {\n paddingInlineStart: \"0.5em\",\n },\n\n // Bullet widget — styled here so the widget's HTML inherits the\n // right colour against body type.\n \".cm-bullet-widget\": {\n display: \"inline-block\",\n width: \"1em\",\n color: \"var(--cds-text-secondary, #525252)\",\n fontWeight: \"700\",\n },\n\n // Ordered-list number (`1.`) — wider than a bullet's fixed 1em so multi-digit\n // markers fit, with a small gap before the item text. Normal weight: a bold\n // number reads as heavier than the body text it labels.\n \".cm-ordered-marker\": {\n width: \"auto\",\n minWidth: \"1.2em\",\n marginRight: \"0.3em\",\n fontWeight: \"normal\",\n },\n\n // Task list checkbox — drawn as a Carbon checkbox, not the native control.\n // `appearance: none` is what replaces WebKit's small rounded default; the box\n // then matches the design system rather than approximating it with an accent\n // colour over the native shape.\n //\n // Sized in `em`, not `rem`: a 1rem box beside 1rem text is as tall as the\n // whole em box, so it towered over lowercase letters, whose cap height is\n // nearer 0.7em. One knob — the checkbox's own `font-size` — drives the box,\n // the tick and the baseline offset, so the parts cannot drift apart, and the\n // control tracks the text if a list ever renders at another size.\n \".cm-task-checkbox\": {\n appearance: \"none\",\n WebkitAppearance: \"none\",\n boxSizing: \"border-box\",\n position: \"relative\",\n fontSize: \"0.875em\",\n width: \"1em\",\n height: \"1em\",\n margin: \"0 0.45em 0 0\",\n cursor: \"pointer\",\n // Centres the box on the x-height rather than hanging it off the baseline.\n verticalAlign: \"-0.2em\",\n border: \"0.0625em solid var(--cds-icon-primary, #161616)\",\n borderRadius: \"0.0625em\",\n background: \"transparent\",\n },\n \".cm-task-checkbox:checked\": {\n background: \"var(--cds-icon-primary, #161616)\",\n borderColor: \"var(--cds-icon-primary, #161616)\",\n },\n // The tick: an L (right + bottom border) rotated 45° into a check.\n //\n // Drawn in `--cds-background`, NOT `--cds-icon-on-color`. \"On color\" means an\n // icon on a branded fill and is white in every theme, while the box here is\n // filled with `--cds-icon-primary` — which inverts. In dark that was a white\n // tick on a near-white box: a checked item read as unchecked.\n //\n // `top` is the OPTICAL centre, not the geometric one. The L's ink sits below\n // and right of its own rect centre, and `rotate(45deg)` turns that diagonal\n // offset into a purely downward one — 0.065em of it — so the rect has to ride\n // that much higher for the tick to look centred. Geometric centring (0.1875em)\n // renders visibly low; the old 0.0625em was visibly high.\n \".cm-task-checkbox:checked::after\": {\n content: \"''\",\n position: \"absolute\",\n left: \"0.3125em\",\n top: \"0.125em\",\n width: \"0.25em\",\n height: \"0.5em\",\n border: \"solid var(--cds-background, #ffffff)\",\n // 0.125em read as a heavy slab once the box shrank to 0.875em.\n borderWidth: \"0 0.1em 0.1em 0\",\n transform: \"rotate(45deg)\",\n },\n \".cm-task-checkbox:focus-visible\": {\n outline: \"0.125rem solid var(--cds-focus, #0f62fe)\",\n outlineOffset: \"0.0625rem\",\n },\n\n // Inline image widget. Constrained max-width so a single large\n // image doesn't blow up the editor; lazy loading via `<img loading=\"lazy\">`.\n \".cm-image-widget\": {\n display: \"inline-block\",\n maxWidth: \"min(100%, 32rem)\",\n height: \"auto\",\n borderRadius: \"0.25rem\",\n margin: \"0.25em 0\",\n },\n\n // Horizontal-rule widget. Inline span styled as a full-width\n // border so the line stays inside CM6's line layout.\n \".cm-hr-widget\": {\n display: \"inline-block\",\n width: \"100%\",\n height: \"0\",\n borderTop: \"0.0625rem solid var(--cds-border-subtle-02, #c6c6c6)\",\n verticalAlign: \"middle\",\n },\n\n \".cm-table-widget\": {\n borderCollapse: \"collapse\",\n width: \"100%\",\n // `fixed` distributes width evenly across columns instead of letting the\n // auto algorithm shrink columns toward their content — with the inherited\n // `cm-lineWrapping` word-breaking, an auto-shrunk column wraps one\n // character per line (\"T / o / p / i / c\").\n tableLayout: \"fixed\",\n },\n \".cm-table-widget th, .cm-table-widget td\": {\n border: \"0.0625rem solid var(--cds-border-subtle-02, #c6c6c6)\",\n padding: \"0.4em 0.75em\",\n verticalAlign: \"top\",\n // No native text-selection: a drag would otherwise zig-zag a ragged\n // selection across cells (uneven heights). `tablev2` tracks the\n // drag and tints whole cells uniformly instead; the cell editor re-enables\n // selection for its own content (below).\n userSelect: \"none\",\n WebkitUserSelect: \"none\",\n // Wrap at word boundaries like prose (overriding the `word-break: break-word`\n // cm-lineWrapping inherits onto `.cm-content`), but still break a single\n // over-long token (e.g. `complementarity/orchestration`) so it can't spill\n // past its fixed-width column into the neighbour.\n overflowWrap: \"break-word\",\n wordBreak: \"normal\",\n },\n \".cm-table-widget thead th\": {\n background: \"var(--cds-layer-accent-01, #e8e8e8)\",\n fontWeight: \"600\",\n textAlign: \"left\",\n },\n // The cell editor's own content stays selectable so a mounted cell edits\n // normally (only the surrounding grid is locked, above).\n \".cm-table-widget .cm-content\": {\n userSelect: \"text\",\n WebkitUserSelect: \"text\",\n },\n // Cell highlight: `--selected` is a drag-selection (tablev2);\n // `--hover` previews the row/column a \"Comment on this row/column\" menu item\n // targets; `--commenting` is held by the host while that comment composer is\n // open. All read as the same even tint.\n \".cm-table-cell--selected, .cm-table-cell--hover, .cm-table-cell--commenting\": {\n backgroundColor: \"var(--cds-highlight, #d0e2ff)\",\n },\n\n // Hover inserters (tablev2/tableV2HoverControls.ts). The wrapper reserves a top + left\n // padding gutter; JS parks the two \"+\" circles in it — clear of the grid, so\n // they never clip at a corner or sit under the header.\n \".cm-table-wrap\": {\n position: \"relative\",\n // Vertical spacing is PADDING, never margin — the same rule the headings and\n // lists above follow. CM6 measures a block widget's height from its border\n // box (margins excluded), so a margin here under-measures the table and\n // drifts every click below it down onto the next line. The top padding\n // doubles as the hover-\"+\" gutter.\n paddingTop: \"2.5em\",\n paddingBottom: \"0.5em\",\n paddingLeft: \"2em\",\n },\n\n // Two-step delete (tableArmed.ts). The first Backspace/Delete next to a table\n // parks the caret at its edge and arms it: the table gets a blue \"selected\"\n // outline, and a green line is drawn at the armed edge — Zettlr's \"green line\n // cursor behind the table\" cue, signalling the next press removes it. The\n // caret is hidden while arming (it renders on the blank line just past the\n // table, which reads as \"the cursor never moved\") by hiding the drawn cursor\n // layer.\n \"&.cm-table-arming .cm-cursorLayer\": {\n display: \"none\",\n },\n \".cm-table-armed .cm-table-widget\": {\n outline: \"0.125rem solid var(--cds-border-interactive, #0f62fe)\",\n outlineOffset: \"0.0625rem\",\n position: \"relative\",\n },\n \".cm-table-wrap[data-armed-edge] .cm-table-widget::after\": {\n content: \"''\",\n position: \"absolute\",\n left: \"0\",\n right: \"0\",\n height: \"0.1875rem\",\n background: \"var(--cds-support-success, #24a148)\",\n pointerEvents: \"none\",\n },\n \".cm-table-wrap[data-armed-edge=\\\"end\\\"] .cm-table-widget::after\": {\n bottom: \"-0.375rem\",\n },\n \".cm-table-wrap[data-armed-edge=\\\"start\\\"] .cm-table-widget::after\": {\n top: \"-0.375rem\",\n },\n \".cm-table-inserter\": {\n position: \"absolute\",\n display: \"none\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"1.25rem\",\n height: \"1.25rem\",\n borderRadius: \"50%\",\n appearance: \"none\",\n border: \"none\",\n padding: \"0\",\n cursor: \"pointer\",\n zIndex: \"3\",\n // Subtle at rest (a neutral chip); the primary accent is the hover\n // affordance. The glyph is a centred SVG stroked with currentColor.\n background: \"var(--cds-layer-accent-01, #e0e0e0)\",\n color: \"var(--cds-icon-secondary, #525252)\",\n boxShadow: \"0 0.0625rem 0.125rem rgba(0, 0, 0, 0.12)\",\n transition: \"background 80ms ease, color 80ms ease\",\n },\n \".cm-table-inserter:hover\": {\n background: \"var(--cds-link-primary, #0f62fe)\",\n color: \"#ffffff\",\n },\n\n \".cm-image-menu\": {\n background: \"var(--cds-layer-01, #ffffff)\",\n border: \"0.0625rem solid var(--cds-border-subtle-01, #e0e0e0)\",\n borderRadius: \"0.125rem\",\n boxShadow: \"0 0.25rem 0.75rem rgba(0, 0, 0, 0.15)\",\n padding: \"0.25rem 0\",\n minWidth: \"11rem\",\n fontFamily:\n \"var(--cds-body-01-font-family, -apple-system, BlinkMacSystemFont, \\\"Segoe UI\\\", sans-serif)\",\n fontSize: \"0.875rem\",\n },\n \".cm-image-menu__item\": {\n appearance: \"none\",\n background: \"transparent\",\n border: \"none\",\n textAlign: \"start\",\n padding: \"0.4rem 0.75rem\",\n cursor: \"pointer\",\n width: \"100%\",\n color: \"var(--cds-text-primary, #161616)\",\n font: \"inherit\",\n },\n \".cm-image-menu__item:hover\": {\n background: \"var(--cds-layer-hover-01, #e8e8e8)\",\n },\n \".cm-image-menu__item--danger\": {\n color: \"var(--cds-text-error, #da1e28)\",\n },\n\n \".cm-math-inline\": {\n fontFamily: \"KaTeX_Main, serif\",\n },\n \".cm-math-block\": {\n display: \"block\",\n margin: \"0.5em 0\",\n textAlign: \"center\",\n fontFamily: \"KaTeX_Main, serif\",\n },\n\n // A diagram reads as CONTENT, not a control: no fill or pointer on hover —\n // just a hairline frame plus a corner \"Edit\" chip as the click-to-edit cue.\n \".cm-mermaid-block\": {\n position: \"relative\",\n display: \"flex\",\n justifyContent: \"center\",\n margin: \"0.5em 0\",\n padding: \"0.75em\",\n borderRadius: \"0.25rem\",\n },\n \".cm-mermaid-block:hover\": {\n outline: \"0.0625rem solid var(--cds-border-subtle-01, #e0e0e0)\",\n },\n // The click-to-select state — native selection paints nothing over a block\n // widget, so the widget carries its own \"I'm selected, ⌘C copies me\" look.\n \".cm-mermaid-block--selected, .cm-mermaid-block--selected:hover\": {\n outline: \"0.125rem solid var(--cds-focus, #0f62fe)\",\n outlineOffset: \"-0.125rem\",\n background: \"rgba(15, 98, 254, 0.06)\",\n },\n \".cm-mermaid-edit\": {\n position: \"absolute\",\n insetBlockStart: \"0.375rem\",\n insetInlineEnd: \"0.375rem\",\n padding: \"0.1rem 0.5rem\",\n fontSize: \"0.75rem\",\n color: \"var(--cds-text-secondary, #525252)\",\n background: \"var(--cds-layer-01, #f4f4f4)\",\n border: \"0.0625rem solid var(--cds-border-subtle-01, #e0e0e0)\",\n borderRadius: \"999rem\",\n cursor: \"pointer\",\n opacity: \"0\",\n transition: \"opacity 80ms ease\",\n },\n \".cm-mermaid-block:hover .cm-mermaid-edit\": {\n opacity: \"1\",\n },\n \".cm-mermaid-block > svg\": {\n maxWidth: \"100%\",\n height: \"auto\",\n // Uniform click handling: SVG sub-elements otherwise swallow pointer\n // events over parts of the diagram, making click-to-select land only on\n // the background.\n pointerEvents: \"none\",\n },\n \".cm-mermaid-block--pending\": {\n color: \"var(--cds-text-secondary, #525252)\",\n fontStyle: \"italic\",\n },\n \".cm-mermaid-block--error\": {\n display: \"block\",\n borderLeft: \"0.1875rem solid var(--cds-support-error, #da1e28)\",\n background: \"var(--cds-layer-01, #f4f4f4)\",\n },\n \".cm-mermaid-error__title\": {\n color: \"var(--cds-text-error, #da1e28)\",\n fontSize: \"0.875em\",\n },\n \".cm-mermaid-error__message\": {\n margin: \"0.5em 0 0\",\n fontFamily: \"'IBM Plex Mono', ui-monospace, monospace\",\n fontSize: \"0.75em\",\n color: \"var(--cds-text-secondary, #525252)\",\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"anywhere\",\n },\n\n \".cm-html-inline, .cm-html-block\": {\n display: \"inline\",\n },\n \".cm-html-block\": {\n display: \"block\",\n margin: \"0.5em 0\",\n },\n\n \".cm-link\": {\n color: \"var(--cds-link-primary, #0f62fe)\",\n textDecoration: \"underline\",\n },\n\n // Wikilink label — distinguish from regular markdown links via a\n // dashed underline so a non-technical reader can tell at a glance\n // that this is a vault-internal target. Matches the Tiptap version\n // (`.wikilink`).\n \".cm-wikilink\": {\n color: \"var(--cds-link-primary, #0f62fe)\",\n textDecoration: \"underline dashed\",\n cursor: \"pointer\",\n },\n\n // Explicit yellow, not var(--cds-highlight): the app maps that token to the\n // drawn-selection color, and a mark bound to it is indistinguishable from\n // selected text. Translucent so the below-content selection band reads\n // through; the alpha composites to the intended #fff8c5 resting yellow on\n // the white canvas.\n \".cm-highlight\": {\n background: \"rgba(255, 235, 89, 0.35)\",\n padding: \"0 0.1em\",\n borderRadius: \"0.125rem\",\n },\n\n \".cm-footnote-ref\": {\n fontSize: \"0.75em\",\n verticalAlign: \"super\",\n color: \"var(--cds-link-primary, #0f62fe)\",\n cursor: \"pointer\",\n },\n\n \".cm-footnote-def\": {\n fontSize: \"0.875em\",\n color: \"var(--cds-text-secondary, #525252)\",\n paddingInlineStart: \"0.5em\",\n borderInlineStart: \"0.125rem solid var(--cds-border-subtle-02, #c6c6c6)\",\n },\n});\n"],"mappings":";AA4BA,SAAS,kBAAkB;AASpB,MAAM,kBAAkB,WAAW,MAAM;AAAA;AAAA;AAAA,EAG9C,gBAAgB;AAAA,IACd,SAAS;AAAA,EACX;AAAA;AAAA;AAAA,EAIA,eAAe;AAAA,IACb,YACE;AAAA,IACF,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,IAKV,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA;AAAA;AAAA,EAIA,gBAAgB;AAAA,IACd,SAAS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OAAO;AAAA,IACP,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA,EAEA,mCAAmC;AAAA,IACjC,SAAS;AAAA,EACX;AAAA,EACA,kBAAkB;AAAA,IAChB,SAAS;AAAA,IACT,QAAQ;AAAA,EACV;AAAA,EAEA,YAAY;AAAA,IACV,OAAO;AAAA,IACP,gBAAgB;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAgB;AAAA,IACd,OAAO;AAAA,IACP,gBAAgB;AAAA,IAChB,QAAQ;AAAA,EACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,EAChB;AAAA,EAEA,oBAAoB;AAAA,IAClB,UAAU;AAAA,IACV,eAAe;AAAA,IACf,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EAEA,oBAAoB;AAAA,IAClB,UAAU;AAAA,IACV,OAAO;AAAA,IACP,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,EACrB;AACF,CAAC;","names":[]}
@@ -0,0 +1,58 @@
1
+ import { Facet } from '@codemirror/state';
2
+ import { ImageResolveContext } from '../../imageSrcResolver.js';
3
+ import { SourceRange } from '../../types.js';
4
+
5
+ /**
6
+ * Host-environment injection seams.
7
+ *
8
+ * The editor surface is environment-agnostic: it knows how to render and edit
9
+ * markdown, but NOT how to read/write files, resolve asset URLs, or open links —
10
+ * those depend on where it's embedded (a Tauri desktop shell, a plain browser, a
11
+ * server-rendered preview). Each capability is a CM6 facet with a sensible
12
+ * browser default; the React host overrides it by setting the facet from a prop.
13
+ *
14
+ * Keeping these as facets (not React context) lets the non-React CM6 plugins and
15
+ * widgets — image paste handlers, the inline `<img>` widget, the click model —
16
+ * read them straight off `view.state`.
17
+ */
18
+
19
+ type ResolveImageSrc = (rawSrc: string, ctx: ImageResolveContext) => string;
20
+ type SaveImageBytes = (relPath: string, bytes: Uint8Array) => Promise<void>;
21
+ type OpenExternalUrl = (url: string) => void;
22
+ /** Viewport point a comment composer should anchor to (the right-click point). */
23
+ type CommentAnchor = {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ type CommentOnExcerpt = (excerpt: {
28
+ text: string;
29
+ range: SourceRange;
30
+ }, anchor: CommentAnchor) => void;
31
+ /**
32
+ * Turn a markdown image `src` into a URL the view can load. Default: pass the
33
+ * reference through unchanged (data URLs and absolute URLs render directly; a
34
+ * browser resolves relative refs against the page origin). A desktop host
35
+ * overrides this to map workspace-relative paths onto its asset protocol.
36
+ */
37
+ declare const resolveImageSrcFacet: Facet<ResolveImageSrc, ResolveImageSrc>;
38
+ /**
39
+ * Persist pasted/dropped image bytes at a workspace-relative path. Default:
40
+ * `null` — the insert pipeline then inlines the image as a `data:` URL so it
41
+ * still survives a reload. A desktop host provides a writer that saves to disk
42
+ * and the markdown reference stays a portable relative path.
43
+ */
44
+ declare const saveImageBytesFacet: Facet<SaveImageBytes | null, SaveImageBytes | null>;
45
+ /**
46
+ * Open a clicked external link. Default: a new browser tab. A desktop host
47
+ * overrides this to leave the app's webview via its shell-open API.
48
+ */
49
+ declare const openExternalUrlFacet: Facet<OpenExternalUrl, OpenExternalUrl>;
50
+ /**
51
+ * Comment on a selected table row/column — the table context menu hands its
52
+ * excerpt + anchor point here. Default: `null` — the menu then omits its
53
+ * "Comment on this row/column" items. A desktop host opens its comment composer
54
+ * (the same one a text selection uses) seeded with the excerpt.
55
+ */
56
+ declare const commentOnExcerptFacet: Facet<CommentOnExcerpt | null, CommentOnExcerpt | null>;
57
+
58
+ export { type CommentAnchor, type CommentOnExcerpt, type OpenExternalUrl, type ResolveImageSrc, type SaveImageBytes, commentOnExcerptFacet, openExternalUrlFacet, resolveImageSrcFacet, saveImageBytesFacet };
@@ -0,0 +1,27 @@
1
+ import "../../chunk-V6TY7KAL.js";
2
+ import { Facet } from "@codemirror/state";
3
+ import { defaultResolveImageSrc } from "../../imageSrcResolver.js";
4
+ const resolveImageSrcFacet = Facet.define({
5
+ combine: (values) => values[0] ?? defaultResolveImageSrc
6
+ });
7
+ const saveImageBytesFacet = Facet.define({
8
+ combine: (values) => values[0] ?? null
9
+ });
10
+ const openExternalUrlFacet = Facet.define({
11
+ combine: (values) => values[0] ?? defaultOpenExternalUrl
12
+ });
13
+ const commentOnExcerptFacet = Facet.define({
14
+ combine: (values) => values[0] ?? null
15
+ });
16
+ function defaultOpenExternalUrl(url) {
17
+ if (typeof window !== "undefined") {
18
+ window.open(url, "_blank", "noopener,noreferrer");
19
+ }
20
+ }
21
+ export {
22
+ commentOnExcerptFacet,
23
+ openExternalUrlFacet,
24
+ resolveImageSrcFacet,
25
+ saveImageBytesFacet
26
+ };
27
+ //# sourceMappingURL=hostFacets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/hostFacets.ts"],"sourcesContent":["/**\n * Host-environment injection seams.\n *\n * The editor surface is environment-agnostic: it knows how to render and edit\n * markdown, but NOT how to read/write files, resolve asset URLs, or open links —\n * those depend on where it's embedded (a Tauri desktop shell, a plain browser, a\n * server-rendered preview). Each capability is a CM6 facet with a sensible\n * browser default; the React host overrides it by setting the facet from a prop.\n *\n * Keeping these as facets (not React context) lets the non-React CM6 plugins and\n * widgets — image paste handlers, the inline `<img>` widget, the click model —\n * read them straight off `view.state`.\n */\n\nimport { Facet } from \"@codemirror/state\";\n\nimport { defaultResolveImageSrc, type ImageResolveContext } from \"../../imageSrcResolver\";\nimport { type SourceRange } from \"../../types\";\n\nexport type ResolveImageSrc = (rawSrc: string, ctx: ImageResolveContext) => string;\nexport type SaveImageBytes = (relPath: string, bytes: Uint8Array) => Promise<void>;\nexport type OpenExternalUrl = (url: string) => void;\n/** Viewport point a comment composer should anchor to (the right-click point). */\nexport type CommentAnchor = { x: number; y: number };\nexport type CommentOnExcerpt = (\n excerpt: { text: string; range: SourceRange },\n anchor: CommentAnchor,\n) => void;\n\n/**\n * Turn a markdown image `src` into a URL the view can load. Default: pass the\n * reference through unchanged (data URLs and absolute URLs render directly; a\n * browser resolves relative refs against the page origin). A desktop host\n * overrides this to map workspace-relative paths onto its asset protocol.\n */\nexport const resolveImageSrcFacet = Facet.define<ResolveImageSrc, ResolveImageSrc>({\n combine: (values) => values[0] ?? defaultResolveImageSrc,\n});\n\n/**\n * Persist pasted/dropped image bytes at a workspace-relative path. Default:\n * `null` — the insert pipeline then inlines the image as a `data:` URL so it\n * still survives a reload. A desktop host provides a writer that saves to disk\n * and the markdown reference stays a portable relative path.\n */\nexport const saveImageBytesFacet = Facet.define<SaveImageBytes | null, SaveImageBytes | null>({\n combine: (values) => values[0] ?? null,\n});\n\n/**\n * Open a clicked external link. Default: a new browser tab. A desktop host\n * overrides this to leave the app's webview via its shell-open API.\n */\nexport const openExternalUrlFacet = Facet.define<OpenExternalUrl, OpenExternalUrl>({\n combine: (values) => values[0] ?? defaultOpenExternalUrl,\n});\n\n/**\n * Comment on a selected table row/column — the table context menu hands its\n * excerpt + anchor point here. Default: `null` — the menu then omits its\n * \"Comment on this row/column\" items. A desktop host opens its comment composer\n * (the same one a text selection uses) seeded with the excerpt.\n */\nexport const commentOnExcerptFacet = Facet.define<\n CommentOnExcerpt | null,\n CommentOnExcerpt | null\n>({\n combine: (values) => values[0] ?? null,\n});\n\nfunction defaultOpenExternalUrl(url: string): void {\n if (typeof window !== \"undefined\") {\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n }\n}\n"],"mappings":";AAcA,SAAS,aAAa;AAEtB,SAAS,8BAAwD;AAmB1D,MAAM,uBAAuB,MAAM,OAAyC;AAAA,EACjF,SAAS,CAAC,WAAW,OAAO,CAAC,KAAK;AACpC,CAAC;AAQM,MAAM,sBAAsB,MAAM,OAAqD;AAAA,EAC5F,SAAS,CAAC,WAAW,OAAO,CAAC,KAAK;AACpC,CAAC;AAMM,MAAM,uBAAuB,MAAM,OAAyC;AAAA,EACjF,SAAS,CAAC,WAAW,OAAO,CAAC,KAAK;AACpC,CAAC;AAQM,MAAM,wBAAwB,MAAM,OAGzC;AAAA,EACA,SAAS,CAAC,WAAW,OAAO,CAAC,KAAK;AACpC,CAAC;AAED,SAAS,uBAAuB,KAAmB;AACjD,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO,KAAK,KAAK,UAAU,qBAAqB;AAAA,EAClD;AACF;","names":[]}
@@ -0,0 +1,22 @@
1
+ import { WidgetType, EditorView } from '@codemirror/view';
2
+ import { NodeRule } from './paint.js';
3
+ import '@codemirror/state';
4
+
5
+ /**
6
+ * Horizontal-rule widget — replaces `---` / `***` / `___` source
7
+ * with a styled inline `<span>` that draws a horizontal line.
8
+ *
9
+ * Kept as an inline widget (not `block: true`) so the line still
10
+ * participates in CM6's normal line-metric measurement; CSS draws
11
+ * the rule via a full-width border.
12
+ */
13
+
14
+ declare class HorizontalRuleWidget extends WidgetType {
15
+ eq(_other: HorizontalRuleWidget): boolean;
16
+ toDOM(_view: EditorView): HTMLElement;
17
+ ignoreEvent(): boolean;
18
+ }
19
+ /** `---` → a styled `<hr>` widget. */
20
+ declare const horizontalRuleRule: NodeRule;
21
+
22
+ export { HorizontalRuleWidget, horizontalRuleRule };
@@ -0,0 +1,22 @@
1
+ import "../../chunk-V6TY7KAL.js";
2
+ import { Decoration, WidgetType } from "@codemirror/view";
3
+ class HorizontalRuleWidget extends WidgetType {
4
+ eq(_other) {
5
+ return true;
6
+ }
7
+ toDOM(_view) {
8
+ const span = document.createElement("span");
9
+ span.className = "cm-hr-widget";
10
+ return span;
11
+ }
12
+ ignoreEvent() {
13
+ return false;
14
+ }
15
+ }
16
+ const HR_REPLACE = Decoration.replace({ widget: new HorizontalRuleWidget() });
17
+ const horizontalRuleRule = () => ({ paint: "widget", deco: HR_REPLACE });
18
+ export {
19
+ HorizontalRuleWidget,
20
+ horizontalRuleRule
21
+ };
22
+ //# sourceMappingURL=hrWidget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/hrWidget.ts"],"sourcesContent":["/**\n * Horizontal-rule widget — replaces `---` / `***` / `___` source\n * with a styled inline `<span>` that draws a horizontal line.\n *\n * Kept as an inline widget (not `block: true`) so the line still\n * participates in CM6's normal line-metric measurement; CSS draws\n * the rule via a full-width border.\n */\n\nimport { Decoration, EditorView, WidgetType } from \"@codemirror/view\";\n\nimport { type NodeRule } from \"./paint\";\n\nexport class HorizontalRuleWidget extends WidgetType {\n override eq(_other: HorizontalRuleWidget): boolean {\n return true;\n }\n\n override toDOM(_view: EditorView): HTMLElement {\n const span = document.createElement(\"span\");\n span.className = \"cm-hr-widget\";\n return span;\n }\n\n override ignoreEvent(): boolean {\n return false;\n }\n}\n\n/* ---------------- The HorizontalRule rule ---------------- */\n\n\n\n// Stateless → one shared decoration; allocating per node per viewport build\n// is pure GC pressure.\nconst HR_REPLACE = Decoration.replace({ widget: new HorizontalRuleWidget() });\n\n/** `---` → a styled `<hr>` widget. */\nexport const horizontalRuleRule: NodeRule = () => ({ paint: \"widget\", deco: HR_REPLACE });\n"],"mappings":";AASA,SAAS,YAAwB,kBAAkB;AAI5C,MAAM,6BAA6B,WAAW;AAAA,EAC1C,GAAG,QAAuC;AACjD,WAAO;AAAA,EACT;AAAA,EAES,MAAM,OAAgC;AAC7C,UAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,SAAK,YAAY;AACjB,WAAO;AAAA,EACT;AAAA,EAES,cAAuB;AAC9B,WAAO;AAAA,EACT;AACF;AAQA,MAAM,aAAa,WAAW,QAAQ,EAAE,QAAQ,IAAI,qBAAqB,EAAE,CAAC;AAGrE,MAAM,qBAA+B,OAAO,EAAE,OAAO,UAAU,MAAM,WAAW;","names":[]}
@@ -0,0 +1,6 @@
1
+ /** Entity-escaping for the string renderers (table cells), which build HTML
2
+ * text rather than DOM and so must neutralise markup in document content. */
3
+ declare function escapeText(value: string): string;
4
+ declare function escapeAttr(value: string): string;
5
+
6
+ export { escapeAttr, escapeText };
@@ -0,0 +1,12 @@
1
+ import "../../chunk-V6TY7KAL.js";
2
+ function escapeText(value) {
3
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4
+ }
5
+ function escapeAttr(value) {
6
+ return escapeText(value).replace(/"/g, "&quot;");
7
+ }
8
+ export {
9
+ escapeAttr,
10
+ escapeText
11
+ };
12
+ //# sourceMappingURL=htmlEscape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/htmlEscape.ts"],"sourcesContent":["/** Entity-escaping for the string renderers (table cells), which build HTML\n * text rather than DOM and so must neutralise markup in document content. */\n\nexport function escapeText(value: string): string {\n return value.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n}\n\nexport function escapeAttr(value: string): string {\n return escapeText(value).replace(/\"/g, \"&quot;\");\n}\n"],"mappings":";AAGO,SAAS,WAAW,OAAuB;AAChD,SAAO,MAAM,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,MAAM,EAAE,QAAQ,MAAM,MAAM;AAChF;AAEO,SAAS,WAAW,OAAuB;AAChD,SAAO,WAAW,KAAK,EAAE,QAAQ,MAAM,QAAQ;AACjD;","names":[]}
@@ -0,0 +1,13 @@
1
+ export { NodeContext, NodeLike, NodeRule, NodeRules, Paint, RuleMeta, headingLine, hideAlways, line, mark, nodeRulesFacet, none, raw, structural } from './paint.js';
2
+ export { InlineScanMatch, InlineScanRule, inlineScanRulesFacet, scanInline } from './inlineScan.js';
3
+ export { escapeAttr, escapeText } from './htmlEscape.js';
4
+ export { parseToEnd } from './parseToEnd.js';
5
+ export { treeAt } from './treeAt.js';
6
+ export { markdownDecorationsPlugin } from './plugin.js';
7
+ export { editorBaseTheme } from './editorTheme.js';
8
+ export { CommentAnchor, CommentOnExcerpt, OpenExternalUrl, ResolveImageSrc, SaveImageBytes, commentOnExcerptFacet, openExternalUrlFacet, resolveImageSrcFacet, saveImageBytesFacet } from './hostFacets.js';
9
+ import '@codemirror/state';
10
+ import '@codemirror/view';
11
+ import '@codemirror/language';
12
+ import '../../imageSrcResolver.js';
13
+ import '../../types.js';
@@ -0,0 +1,9 @@
1
+ export * from "./paint.js";
2
+ export * from "./inlineScan.js";
3
+ export * from "./htmlEscape.js";
4
+ export * from "./parseToEnd.js";
5
+ export * from "./treeAt.js";
6
+ export * from "./plugin.js";
7
+ export * from "./editorTheme.js";
8
+ export * from "./hostFacets.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/index.ts"],"sourcesContent":["/**\n * The paint engine: the NodeRule/Paint rendering contract, the canonical\n * rules table, the viewport painter, the base theme, and the host-environment\n * facets. Every other feature folder builds on these.\n *\n * Folder front doors (this file and its siblings) are for composition roots —\n * the package index, the editor shell, and `extensions/`. Feature-folder\n * modules import each other by concrete module path instead, so module\n * initialization order never depends on a barrel's export order.\n *\n * Engine-internal, deliberately not re-exported: `registry` (consumed by the\n * painter and the table cell renderer), `lineStructure`, `hrWidget`, and\n * `editorTestHarness` (test-only — it pulls the whole extension set).\n */\nexport * from \"./paint\";\nexport * from \"./inlineScan\";\nexport * from \"./htmlEscape\";\nexport * from \"./parseToEnd\";\nexport * from \"./treeAt\";\nexport * from \"./plugin\";\nexport * from \"./editorTheme\";\nexport * from \"./hostFacets\";\n"],"mappings":"AAcA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,49 @@
1
+ import { Facet } from '@codemirror/state';
2
+
3
+ /**
4
+ * Constructs Lezer never parses.
5
+ *
6
+ * Wikilinks, `==highlight==`, footnote references and `$math$` are not
7
+ * CommonMark, so no node exists for any of them and the editor finds each by
8
+ * scanning text (`codeContext.ts` documents the shared code guard). A renderer
9
+ * that walks the tree is therefore blind to all four — which is how a table cell
10
+ * came to show `$440 = 2 \times \frac{22}{7} \times r$` as literal source while
11
+ * the same expression rendered as mathematics in the paragraph above it.
12
+ *
13
+ * A feature contributes its pattern and its markup through this facet; the
14
+ * string renderers consult the facet and stay ignorant of what the constructs
15
+ * are. The decoration plugins keep their own viewport-scanning path — the two
16
+ * paths share the pattern, not the machinery, because one produces decorations
17
+ * over a live document and the other an HTML string.
18
+ */
19
+
20
+ interface InlineScanRule {
21
+ readonly name: string;
22
+ /** Global-flagged; the scanner drives `exec` and resets `lastIndex`. */
23
+ readonly pattern: RegExp;
24
+ /** Markup for one match. Escaping document text is the rule's job. */
25
+ render(match: RegExpExecArray): string;
26
+ /**
27
+ * Upgrade rendered markup to real DOM, after sanitisation. Only for a
28
+ * construct whose rendering is DOM rather than markup (KaTeX): the generated
29
+ * nodes bypass the sanitiser, so a hydrate reads inert text from the element
30
+ * it replaces and never trusts the document.
31
+ */
32
+ hydrate?(root: HTMLElement): void;
33
+ }
34
+ declare const inlineScanRulesFacet: Facet<InlineScanRule, readonly InlineScanRule[]>;
35
+ interface InlineScanMatch {
36
+ readonly from: number;
37
+ readonly to: number;
38
+ readonly html: string;
39
+ }
40
+ /**
41
+ * Every rule's matches in `text`, in document order, offset by `at`.
42
+ *
43
+ * Earliest wins, then longest — two constructs cannot both own one span, and
44
+ * the alternative (rule declaration order) would make the result depend on
45
+ * extension load order.
46
+ */
47
+ declare function scanInline(rules: readonly InlineScanRule[], text: string, at?: number): InlineScanMatch[];
48
+
49
+ export { type InlineScanMatch, type InlineScanRule, inlineScanRulesFacet, scanInline };
@@ -0,0 +1,31 @@
1
+ import "../../chunk-V6TY7KAL.js";
2
+ import { Facet } from "@codemirror/state";
3
+ const inlineScanRulesFacet = Facet.define({
4
+ combine: (values) => values
5
+ });
6
+ function scanInline(rules, text, at = 0) {
7
+ const found = [];
8
+ for (const rule of rules) {
9
+ rule.pattern.lastIndex = 0;
10
+ let match;
11
+ while ((match = rule.pattern.exec(text)) !== null) {
12
+ found.push({
13
+ from: at + match.index,
14
+ to: at + match.index + match[0].length,
15
+ html: rule.render(match)
16
+ });
17
+ }
18
+ }
19
+ found.sort((a, b) => a.from - b.from || b.to - a.to);
20
+ const kept = [];
21
+ for (const span of found) {
22
+ const last = kept[kept.length - 1];
23
+ if (!last || span.from >= last.to) kept.push(span);
24
+ }
25
+ return kept;
26
+ }
27
+ export {
28
+ inlineScanRulesFacet,
29
+ scanInline
30
+ };
31
+ //# sourceMappingURL=inlineScan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/inlineScan.ts"],"sourcesContent":["/**\n * Constructs Lezer never parses.\n *\n * Wikilinks, `==highlight==`, footnote references and `$math$` are not\n * CommonMark, so no node exists for any of them and the editor finds each by\n * scanning text (`codeContext.ts` documents the shared code guard). A renderer\n * that walks the tree is therefore blind to all four — which is how a table cell\n * came to show `$440 = 2 \\times \\frac{22}{7} \\times r$` as literal source while\n * the same expression rendered as mathematics in the paragraph above it.\n *\n * A feature contributes its pattern and its markup through this facet; the\n * string renderers consult the facet and stay ignorant of what the constructs\n * are. The decoration plugins keep their own viewport-scanning path — the two\n * paths share the pattern, not the machinery, because one produces decorations\n * over a live document and the other an HTML string.\n */\n\nimport { Facet } from \"@codemirror/state\";\n\nexport interface InlineScanRule {\n readonly name: string;\n /** Global-flagged; the scanner drives `exec` and resets `lastIndex`. */\n readonly pattern: RegExp;\n /** Markup for one match. Escaping document text is the rule's job. */\n render(match: RegExpExecArray): string;\n /**\n * Upgrade rendered markup to real DOM, after sanitisation. Only for a\n * construct whose rendering is DOM rather than markup (KaTeX): the generated\n * nodes bypass the sanitiser, so a hydrate reads inert text from the element\n * it replaces and never trusts the document.\n */\n hydrate?(root: HTMLElement): void;\n}\n\nexport const inlineScanRulesFacet = Facet.define<InlineScanRule, readonly InlineScanRule[]>({\n combine: (values) => values,\n});\n\nexport interface InlineScanMatch {\n readonly from: number;\n readonly to: number;\n readonly html: string;\n}\n\n/**\n * Every rule's matches in `text`, in document order, offset by `at`.\n *\n * Earliest wins, then longest — two constructs cannot both own one span, and\n * the alternative (rule declaration order) would make the result depend on\n * extension load order.\n */\nexport function scanInline(\n rules: readonly InlineScanRule[],\n text: string,\n at = 0,\n): InlineScanMatch[] {\n const found: InlineScanMatch[] = [];\n for (const rule of rules) {\n rule.pattern.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = rule.pattern.exec(text)) !== null) {\n found.push({\n from: at + match.index,\n to: at + match.index + match[0].length,\n html: rule.render(match),\n });\n }\n }\n found.sort((a, b) => a.from - b.from || b.to - a.to);\n const kept: InlineScanMatch[] = [];\n for (const span of found) {\n const last = kept[kept.length - 1];\n if (!last || span.from >= last.to) kept.push(span);\n }\n return kept;\n}\n"],"mappings":";AAiBA,SAAS,aAAa;AAiBf,MAAM,uBAAuB,MAAM,OAAkD;AAAA,EAC1F,SAAS,CAAC,WAAW;AACvB,CAAC;AAeM,SAAS,WACd,OACA,MACA,KAAK,GACc;AACnB,QAAM,QAA2B,CAAC;AAClC,aAAW,QAAQ,OAAO;AACxB,SAAK,QAAQ,YAAY;AACzB,QAAI;AACJ,YAAQ,QAAQ,KAAK,QAAQ,KAAK,IAAI,OAAO,MAAM;AACjD,YAAM,KAAK;AAAA,QACT,MAAM,KAAK,MAAM;AAAA,QACjB,IAAI,KAAK,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,QAChC,MAAM,KAAK,OAAO,KAAK;AAAA,MACzB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;AACnD,QAAM,OAA0B,CAAC;AACjC,aAAW,QAAQ,OAAO;AACxB,UAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,QAAI,CAAC,QAAQ,KAAK,QAAQ,KAAK,GAAI,MAAK,KAAK,IAAI;AAAA,EACnD;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,47 @@
1
+ import { EditorState, Line } from '@codemirror/state';
2
+
3
+ /**
4
+ * What the GRAMMAR says a line is — resolved from the Lezer syntax tree, not
5
+ * from regexes over the line's text (#61). Text lies where the tree doesn't:
6
+ * `- item` inside a code fence isn't a list item, a nested ` - item` is one
7
+ * even though its marker isn't at column 0, and ` - item` under a list is
8
+ * a nested item while the same text at top level is indented code. Commands
9
+ * that reshape a line consult this and edit the marker range the PARSER
10
+ * identified.
11
+ */
12
+
13
+ interface LineListInfo {
14
+ kind: "bullet" | "ordered";
15
+ /** The item carries a task checkbox (`- [ ] …`). */
16
+ task: boolean;
17
+ /** Source range of the list marker (plus checkbox for tasks), INCLUDING the
18
+ * single space that separates it from the content. */
19
+ markFrom: number;
20
+ markTo: number;
21
+ }
22
+ interface LineStructure {
23
+ /** Line belongs to a BLOCK code context (fenced or indented code, including
24
+ * the fence lines themselves) — structure commands must not rewrite code.
25
+ * Inline code inside a paragraph does not count: the line is still prose. */
26
+ inCode: boolean;
27
+ /** ATX heading when the line is one, with its mark range (hashes +
28
+ * following space). */
29
+ heading: {
30
+ level: number;
31
+ markFrom: number;
32
+ markTo: number;
33
+ } | null;
34
+ list: LineListInfo | null;
35
+ /** Outermost blockquote marker starting this line (`> `), when present. */
36
+ quote: {
37
+ markFrom: number;
38
+ markTo: number;
39
+ } | null;
40
+ /** Where this line's own content starts — after indentation and any
41
+ * blockquote markers. A fresh line-type marker belongs here, so indented
42
+ * and quoted lines keep their prefix. */
43
+ contentFrom: number;
44
+ }
45
+ declare function lineStructure(state: EditorState, line: Line): LineStructure;
46
+
47
+ export { type LineListInfo, type LineStructure, lineStructure };
@@ -0,0 +1,64 @@
1
+ import "../../chunk-V6TY7KAL.js";
2
+ import { treeAt } from "./treeAt.js";
3
+ const HEADING = /^ATXHeading(\d)$/;
4
+ function withMarkerSpace(state, to, lineTo) {
5
+ return to < lineTo && state.sliceDoc(to, to + 1) === " " ? to + 1 : to;
6
+ }
7
+ function firstNonWhitespace(state, from, to) {
8
+ const text = state.sliceDoc(from, to);
9
+ return from + (text.length - text.trimStart().length);
10
+ }
11
+ function lineStructure(state, line) {
12
+ const result = {
13
+ inCode: false,
14
+ heading: null,
15
+ list: null,
16
+ quote: null,
17
+ contentFrom: firstNonWhitespace(state, line.from, line.to)
18
+ };
19
+ const tree = treeAt(state, result.contentFrom);
20
+ let node = tree.resolveInner(result.contentFrom, 1);
21
+ while (node.name === "QuoteMark" && node.from >= line.from) {
22
+ result.quote ?? (result.quote = {
23
+ markFrom: node.from,
24
+ markTo: withMarkerSpace(state, node.to, line.to)
25
+ });
26
+ result.contentFrom = firstNonWhitespace(state, node.to, line.to);
27
+ node = tree.resolveInner(result.contentFrom, 1);
28
+ }
29
+ for (let cur = node; cur; cur = cur.parent) {
30
+ const name = cur.name;
31
+ if (name === "FencedCode" || name === "CodeBlock") {
32
+ result.inCode = true;
33
+ continue;
34
+ }
35
+ const heading = HEADING.exec(name);
36
+ if (heading && cur.from >= line.from && cur.from <= result.contentFrom) {
37
+ const mark = cur.getChild("HeaderMark");
38
+ if (mark) {
39
+ result.heading = {
40
+ level: Number(heading[1]),
41
+ markFrom: mark.from,
42
+ markTo: withMarkerSpace(state, mark.to, line.to)
43
+ };
44
+ }
45
+ continue;
46
+ }
47
+ if (name === "ListItem" && !result.list && cur.from >= line.from && cur.from <= line.to) {
48
+ const mark = cur.getChild("ListMark");
49
+ if (!mark || mark.from > line.to) continue;
50
+ const taskMark = cur.getChild("Task")?.getChild("TaskMarker") ?? null;
51
+ result.list = {
52
+ kind: cur.parent?.name === "OrderedList" ? "ordered" : "bullet",
53
+ task: Boolean(taskMark),
54
+ markFrom: mark.from,
55
+ markTo: withMarkerSpace(state, (taskMark ?? mark).to, line.to)
56
+ };
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ export {
62
+ lineStructure
63
+ };
64
+ //# sourceMappingURL=lineStructure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/lineStructure.ts"],"sourcesContent":["/**\n * What the GRAMMAR says a line is — resolved from the Lezer syntax tree, not\n * from regexes over the line's text (#61). Text lies where the tree doesn't:\n * `- item` inside a code fence isn't a list item, a nested ` - item` is one\n * even though its marker isn't at column 0, and ` - item` under a list is\n * a nested item while the same text at top level is indented code. Commands\n * that reshape a line consult this and edit the marker range the PARSER\n * identified.\n */\n\nimport type { EditorState, Line } from \"@codemirror/state\";\nimport { treeAt } from \"./treeAt\";\n\nexport interface LineListInfo {\n kind: \"bullet\" | \"ordered\";\n /** The item carries a task checkbox (`- [ ] …`). */\n task: boolean;\n /** Source range of the list marker (plus checkbox for tasks), INCLUDING the\n * single space that separates it from the content. */\n markFrom: number;\n markTo: number;\n}\n\nexport interface LineStructure {\n /** Line belongs to a BLOCK code context (fenced or indented code, including\n * the fence lines themselves) — structure commands must not rewrite code.\n * Inline code inside a paragraph does not count: the line is still prose. */\n inCode: boolean;\n /** ATX heading when the line is one, with its mark range (hashes +\n * following space). */\n heading: { level: number; markFrom: number; markTo: number } | null;\n list: LineListInfo | null;\n /** Outermost blockquote marker starting this line (`> `), when present. */\n quote: { markFrom: number; markTo: number } | null;\n /** Where this line's own content starts — after indentation and any\n * blockquote markers. A fresh line-type marker belongs here, so indented\n * and quoted lines keep their prefix. */\n contentFrom: number;\n}\n\nconst HEADING = /^ATXHeading(\\d)$/;\n\n/** The slice of Lezer's SyntaxNode these lookups touch. */\ntype NodeLike = {\n readonly name: string;\n readonly from: number;\n readonly to: number;\n readonly parent: NodeLike | null;\n getChild(type: string): NodeLike | null;\n};\n\n/** Extend a mark's end over the single following space, when present. */\nfunction withMarkerSpace(state: EditorState, to: number, lineTo: number): number {\n return to < lineTo && state.sliceDoc(to, to + 1) === \" \" ? to + 1 : to;\n}\n\nfunction firstNonWhitespace(state: EditorState, from: number, to: number): number {\n const text = state.sliceDoc(from, to);\n return from + (text.length - text.trimStart().length);\n}\n\nexport function lineStructure(state: EditorState, line: Line): LineStructure {\n const result: LineStructure = {\n inCode: false,\n heading: null,\n list: null,\n quote: null,\n contentFrom: firstNonWhitespace(state, line.from, line.to),\n };\n\n const tree = treeAt(state, result.contentFrom);\n // Resolve at the first content character. Blockquote markers are container\n // prefixes, not content — step past each one (`> > - x` → resolve at `-`)\n // so the line's own structure is an ancestor of the resolve point.\n let node = tree.resolveInner(result.contentFrom, 1) as unknown as NodeLike;\n while (node.name === \"QuoteMark\" && node.from >= line.from) {\n result.quote ??= {\n markFrom: node.from,\n markTo: withMarkerSpace(state, node.to, line.to),\n };\n result.contentFrom = firstNonWhitespace(state, node.to, line.to);\n node = tree.resolveInner(result.contentFrom, 1) as unknown as NodeLike;\n }\n\n // Every structural fact about the resolve point is one of its ancestors.\n for (let cur: NodeLike | null = node; cur; cur = cur.parent) {\n const name = cur.name;\n if (name === \"FencedCode\" || name === \"CodeBlock\") {\n result.inCode = true;\n continue;\n }\n const heading = HEADING.exec(name);\n if (heading && cur.from >= line.from && cur.from <= result.contentFrom) {\n const mark = cur.getChild(\"HeaderMark\");\n if (mark) {\n result.heading = {\n level: Number(heading[1]),\n markFrom: mark.from,\n markTo: withMarkerSpace(state, mark.to, line.to),\n };\n }\n continue;\n }\n // The innermost ListItem STARTING on this line owns the line's marker; an\n // item merely continuing here (wrapped paragraph) contributes nothing.\n if (name === \"ListItem\" && !result.list && cur.from >= line.from && cur.from <= line.to) {\n const mark = cur.getChild(\"ListMark\");\n if (!mark || mark.from > line.to) continue;\n const taskMark = cur.getChild(\"Task\")?.getChild(\"TaskMarker\") ?? null;\n result.list = {\n kind: cur.parent?.name === \"OrderedList\" ? \"ordered\" : \"bullet\",\n task: Boolean(taskMark),\n markFrom: mark.from,\n markTo: withMarkerSpace(state, (taskMark ?? mark).to, line.to),\n };\n }\n }\n return result;\n}\n"],"mappings":";AAWA,SAAS,cAAc;AA6BvB,MAAM,UAAU;AAYhB,SAAS,gBAAgB,OAAoB,IAAY,QAAwB;AAC/E,SAAO,KAAK,UAAU,MAAM,SAAS,IAAI,KAAK,CAAC,MAAM,MAAM,KAAK,IAAI;AACtE;AAEA,SAAS,mBAAmB,OAAoB,MAAc,IAAoB;AAChF,QAAM,OAAO,MAAM,SAAS,MAAM,EAAE;AACpC,SAAO,QA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AACpC,UAAI,CAAC,QAAQ,KAAK,OAAO,KAAK,GAAI;AAClC,YAAM,WAAW,IAAI,SAAS,MAAM,GAAG,SAAS,YAAY,KAAK;AACjE,aAAO,OAAO;AAAA,QACZ,MAAM,IAAI,QAAQ,SAAS,gBAAgB,YAAY;AAAA,QACvD,MAAM,QAAQ,QAAQ;AAAA,QACtB,UAAU,KAAK;AAAA,QACf,QAAQ,gBAAgB,QAAQ,YAAY,MAAM,IAAI,KAAK,EAAE;AAAA,MAC/D;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,36 @@
1
+ import { EditorState } from '@codemirror/state';
2
+ import { NodeLike } from './paint.js';
3
+ import '@codemirror/view';
4
+
5
+ /**
6
+ * Does a bracketed span actually link anywhere?
7
+ *
8
+ * Lezer emits a `Link` node for EVERY `[…]` it sees, resolved or not. CommonMark
9
+ * makes `[label]` a link only when the document also carries a matching
10
+ * `[label]: url` definition, and the parser leaves that lookup to its consumer —
11
+ * so "there is a Link node here" is not the same claim as "this is a link".
12
+ *
13
+ * Treating the two as one hid the brackets out of ordinary prose: `arr[0]` drew
14
+ * as `arr0`, `see [3]` as `see 3`, and every optional argument in a pasted LaTeX
15
+ * block vanished (`\begin{tikzpicture}[scale=0.42]` → `\begin{tikzpicture}scale=0.42`).
16
+ * The document was intact; only the rendering lied, which is the worse failure —
17
+ * nothing looked broken enough to report.
18
+ */
19
+
20
+ /**
21
+ * Does this `Link` render as a link — or as the literal brackets the author typed?
22
+ *
23
+ * True for an inline `[text](url)`, and for a reference link whose label the
24
+ * document defines. False for the shortcut form with nothing to resolve against,
25
+ * which is most `[…]` in prose.
26
+ */
27
+ declare function linkResolves(link: NodeLike, state: EditorState): boolean;
28
+ /**
29
+ * Does the link render any visible label text? Whitespace-only counts as
30
+ * invisible — for `[](url)` / `[ ](url)` the URL is the link's entire visible
31
+ * content, and hiding it (with the marks already hidden) left an invisible,
32
+ * unclickable dead zone.
33
+ */
34
+ declare function linkHasVisibleLabel(link: NodeLike, state: EditorState): boolean;
35
+
36
+ export { linkHasVisibleLabel, linkResolves };
@@ -0,0 +1,58 @@
1
+ import "../../chunk-V6TY7KAL.js";
2
+ import { docTree } from "./codeContext.js";
3
+ const DEFINITION_CONTAINERS = /* @__PURE__ */ new Set([
4
+ "Document",
5
+ "Blockquote",
6
+ "BulletList",
7
+ "OrderedList",
8
+ "ListItem"
9
+ ]);
10
+ function normalizeLabel(label) {
11
+ return label.trim().replace(/\s+/g, " ").toLowerCase();
12
+ }
13
+ function labelInner(state, label) {
14
+ return state.sliceDoc(label.from + 1, label.to - 1);
15
+ }
16
+ const definedLabels = /* @__PURE__ */ new WeakMap();
17
+ function definitions(state) {
18
+ const cached = definedLabels.get(state);
19
+ if (cached) return cached;
20
+ const labels = /* @__PURE__ */ new Set();
21
+ docTree(state).iterate({
22
+ enter: (node) => {
23
+ if (node.name !== "LinkReference") return DEFINITION_CONTAINERS.has(node.name);
24
+ const label = node.node.getChild("LinkLabel");
25
+ if (label) labels.add(normalizeLabel(labelInner(state, label)));
26
+ return false;
27
+ }
28
+ });
29
+ definedLabels.set(state, labels);
30
+ return labels;
31
+ }
32
+ function ownLabel(state, link) {
33
+ let open = null;
34
+ let close = null;
35
+ for (let child = link.firstChild; child; child = child.nextSibling) {
36
+ if (child.name !== "LinkMark") continue;
37
+ const mark = state.sliceDoc(child.from, child.to);
38
+ if (mark === "[" && !open) open = child;
39
+ else if (mark === "]" && !close) close = child;
40
+ }
41
+ if (!open || !close || close.from <= open.to) return null;
42
+ return state.sliceDoc(open.to, close.from);
43
+ }
44
+ function linkResolves(link, state) {
45
+ if (link.getChild("URL")) return true;
46
+ const reference = link.getChild("LinkLabel");
47
+ const explicit = reference ? labelInner(state, reference) : "";
48
+ const key = explicit.trim() === "" ? ownLabel(state, link) ?? "" : explicit;
49
+ return key.trim() !== "" && definitions(state).has(normalizeLabel(key));
50
+ }
51
+ function linkHasVisibleLabel(link, state) {
52
+ return (ownLabel(state, link) ?? "").trim() !== "";
53
+ }
54
+ export {
55
+ linkHasVisibleLabel,
56
+ linkResolves
57
+ };
58
+ //# sourceMappingURL=linkResolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/codemirror/core/linkResolution.ts"],"sourcesContent":["/**\n * Does a bracketed span actually link anywhere?\n *\n * Lezer emits a `Link` node for EVERY `[…]` it sees, resolved or not. CommonMark\n * makes `[label]` a link only when the document also carries a matching\n * `[label]: url` definition, and the parser leaves that lookup to its consumer —\n * so \"there is a Link node here\" is not the same claim as \"this is a link\".\n *\n * Treating the two as one hid the brackets out of ordinary prose: `arr[0]` drew\n * as `arr0`, `see [3]` as `see 3`, and every optional argument in a pasted LaTeX\n * block vanished (`\\begin{tikzpicture}[scale=0.42]` → `\\begin{tikzpicture}scale=0.42`).\n * The document was intact; only the rendering lied, which is the worse failure —\n * nothing looked broken enough to report.\n */\n\nimport { type EditorState } from \"@codemirror/state\";\n\nimport { docTree } from \"./codeContext\";\nimport { type NodeLike } from \"./paint\";\n\n/** Block containers a `[label]: url` definition can sit inside. Inline nodes are\n * not descended into — a definition is a block construct, so stopping at the\n * paragraph level turns the scan below from O(nodes) into O(blocks). */\nconst DEFINITION_CONTAINERS = new Set([\n \"Document\",\n \"Blockquote\",\n \"BulletList\",\n \"OrderedList\",\n \"ListItem\",\n]);\n\n/** CommonMark label matching: case-folded, whitespace-collapsed, trimmed. */\nfunction normalizeLabel(label: string): string {\n return label.trim().replace(/\\s+/g, \" \").toLowerCase();\n}\n\n/** A `LinkLabel` node's text without its enclosing brackets. */\nfunction labelInner(state: EditorState, label: NodeLike): string {\n return state.sliceDoc(label.from + 1, label.to - 1);\n}\n\nconst definedLabels = new WeakMap<EditorState, ReadonlySet<string>>();\n\n/** Every label the document defines. Cached per state — a rule runs once per\n * painted node, and each state is scanned at most once. */\nfunction definitions(state: EditorState): ReadonlySet<string> {\n const cached = definedLabels.get(state);\n if (cached) return cached;\n const labels = new Set<string>();\n docTree(state).iterate({\n enter: (node) => {\n if (node.name !== \"LinkReference\") return DEFINITION_CONTAINERS.has(node.name);\n const label = node.node.getChild(\"LinkLabel\");\n if (label) labels.add(normalizeLabel(labelInner(state, label)));\n return false;\n },\n });\n definedLabels.set(state, labels);\n return labels;\n}\n\n/** The text between a link's own `[` and `]` marks, or null when it has none. */\nfunction ownLabel(state: EditorState, link: NodeLike): string | null {\n let open: NodeLike | null = null;\n let close: NodeLike | null = null;\n for (let child = link.firstChild; child; child = child.nextSibling) {\n if (child.name !== \"LinkMark\") continue;\n const mark = state.sliceDoc(child.from, child.to);\n if (mark === \"[\" && !open) open = child;\n else if (mark === \"]\" && !close) close = child;\n }\n if (!open || !close || close.from <= open.to) return null;\n return state.sliceDoc(open.to, close.from);\n}\n\n/**\n * Does this `Link` render as a link — or as the literal brackets the author typed?\n *\n * True for an inline `[text](url)`, and for a reference link whose label the\n * document defines. False for the shortcut form with nothing to resolve against,\n * which is most `[…]` in prose.\n */\nexport function linkResolves(link: NodeLike, state: EditorState): boolean {\n if (link.getChild(\"URL\")) return true;\n const reference = link.getChild(\"LinkLabel\");\n const explicit = reference ? labelInner(state, reference) : \"\";\n // Collapsed `[text][]` and shortcut `[text]` both resolve on their own label.\n const key = explicit.trim() === \"\" ? (ownLabel(state, link) ?? \"\") : explicit;\n return key.trim() !== \"\" && definitions(state).has(normalizeLabel(key));\n}\n\n/**\n * Does the link render any visible label text? Whitespace-only counts as\n * invisible — for `[](url)` / `[ ](url)` the URL is the link's entire visible\n * content, and hiding it (with the marks already hidden) left an invisible,\n * unclickable dead zone.\n */\nexport function linkHasVisibleLabel(link: NodeLike, state: EditorState): boolean {\n return (ownLabel(state, link) ?? \"\").trim() !== \"\";\n}\n"],"mappings":";AAiBA,SAAS,eAAe;AAMxB,MAAM,wBAAwB,oBAAI,IAAI;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,SAAS,eAAe,OAAuB;AAC7C,SAAO,MAAM,KAA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