@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.
- package/CHANGELOG.md +38 -0
- package/README.md +2 -2
- package/dist/chunk-V6TY7KAL.js +8 -0
- package/dist/chunk-V6TY7KAL.js.map +1 -0
- package/dist/codemirror/CodeMirrorMarkdownEditor.d.ts +106 -0
- package/dist/codemirror/CodeMirrorMarkdownEditor.js +482 -0
- package/dist/codemirror/CodeMirrorMarkdownEditor.js.map +1 -0
- package/dist/codemirror/byteOffset.d.ts +17 -0
- package/dist/codemirror/byteOffset.js +19 -0
- package/dist/codemirror/byteOffset.js.map +1 -0
- package/dist/codemirror/caretLayer.d.ts +19 -0
- package/dist/codemirror/caretLayer.js +44 -0
- package/dist/codemirror/caretLayer.js.map +1 -0
- package/dist/codemirror/clipboard/copyRich.d.ts +37 -0
- package/dist/codemirror/clipboard/copyRich.js +72 -0
- package/dist/codemirror/clipboard/copyRich.js.map +1 -0
- package/dist/codemirror/clipboard/htmlToMarkdown.d.ts +20 -0
- package/dist/codemirror/clipboard/htmlToMarkdown.js +91 -0
- package/dist/codemirror/clipboard/htmlToMarkdown.js.map +1 -0
- package/dist/codemirror/clipboard/pasteMarkdown.d.ts +18 -0
- package/dist/codemirror/clipboard/pasteMarkdown.js +41 -0
- package/dist/codemirror/clipboard/pasteMarkdown.js.map +1 -0
- package/dist/codemirror/code/codeHighlight.d.ts +13 -0
- package/dist/codemirror/code/codeHighlight.js +15 -0
- package/dist/codemirror/code/codeHighlight.js.map +1 -0
- package/dist/codemirror/code/codeLangAffordance.d.ts +17 -0
- package/dist/codemirror/code/codeLangAffordance.js +80 -0
- package/dist/codemirror/code/codeLangAffordance.js.map +1 -0
- package/dist/codemirror/code/codeLanguageMenu.d.ts +40 -0
- package/dist/codemirror/code/codeLanguageMenu.js +184 -0
- package/dist/codemirror/code/codeLanguageMenu.js.map +1 -0
- package/dist/codemirror/code/codePalette.d.ts +39 -0
- package/dist/codemirror/code/codePalette.js +53 -0
- package/dist/codemirror/code/codePalette.js.map +1 -0
- package/dist/codemirror/code/fenceAutoClose.d.ts +30 -0
- package/dist/codemirror/code/fenceAutoClose.js +171 -0
- package/dist/codemirror/code/fenceAutoClose.js.map +1 -0
- package/dist/codemirror/code/fenceCaretGuard.d.ts +28 -0
- package/dist/codemirror/code/fenceCaretGuard.js +66 -0
- package/dist/codemirror/code/fenceCaretGuard.js.map +1 -0
- package/dist/codemirror/code/fenceDeleteGuards.d.ts +22 -0
- package/dist/codemirror/code/fenceDeleteGuards.js +105 -0
- package/dist/codemirror/code/fenceDeleteGuards.js.map +1 -0
- package/dist/codemirror/code/fenceTabIndent.d.ts +8 -0
- package/dist/codemirror/code/fenceTabIndent.js +50 -0
- package/dist/codemirror/code/fenceTabIndent.js.map +1 -0
- package/dist/codemirror/code/highlightFence.d.ts +25 -0
- package/dist/codemirror/code/highlightFence.js +45 -0
- package/dist/codemirror/code/highlightFence.js.map +1 -0
- package/dist/codemirror/code/index.d.ts +9 -0
- package/dist/codemirror/code/index.js +8 -0
- package/dist/codemirror/code/index.js.map +1 -0
- package/dist/codemirror/core/codeContext.d.ts +32 -0
- package/dist/codemirror/core/codeContext.js +22 -0
- package/dist/codemirror/core/codeContext.js.map +1 -0
- package/dist/codemirror/core/editorTestHarness.d.ts +31 -0
- package/dist/codemirror/core/editorTestHarness.js +69 -0
- package/dist/codemirror/core/editorTestHarness.js.map +1 -0
- package/dist/codemirror/core/editorTheme.d.ts +39 -0
- package/dist/codemirror/core/editorTheme.js +498 -0
- package/dist/codemirror/core/editorTheme.js.map +1 -0
- package/dist/codemirror/core/hostFacets.d.ts +58 -0
- package/dist/codemirror/core/hostFacets.js +27 -0
- package/dist/codemirror/core/hostFacets.js.map +1 -0
- package/dist/codemirror/core/hrWidget.d.ts +22 -0
- package/dist/codemirror/core/hrWidget.js +22 -0
- package/dist/codemirror/core/hrWidget.js.map +1 -0
- package/dist/codemirror/core/htmlEscape.d.ts +6 -0
- package/dist/codemirror/core/htmlEscape.js +12 -0
- package/dist/codemirror/core/htmlEscape.js.map +1 -0
- package/dist/codemirror/core/index.d.ts +13 -0
- package/dist/codemirror/core/index.js +9 -0
- package/dist/codemirror/core/index.js.map +1 -0
- package/dist/codemirror/core/inlineScan.d.ts +49 -0
- package/dist/codemirror/core/inlineScan.js +31 -0
- package/dist/codemirror/core/inlineScan.js.map +1 -0
- package/dist/codemirror/core/lineStructure.d.ts +47 -0
- package/dist/codemirror/core/lineStructure.js +64 -0
- package/dist/codemirror/core/lineStructure.js.map +1 -0
- package/dist/codemirror/core/linkResolution.d.ts +36 -0
- package/dist/codemirror/core/linkResolution.js +58 -0
- package/dist/codemirror/core/linkResolution.js.map +1 -0
- package/dist/codemirror/core/paint.d.ts +118 -0
- package/dist/codemirror/core/paint.js +42 -0
- package/dist/codemirror/core/paint.js.map +1 -0
- package/dist/codemirror/core/parseToEnd.d.ts +24 -0
- package/dist/codemirror/core/parseToEnd.js +38 -0
- package/dist/codemirror/core/parseToEnd.js.map +1 -0
- package/dist/codemirror/core/plugin.d.ts +32 -0
- package/dist/codemirror/core/plugin.js +161 -0
- package/dist/codemirror/core/plugin.js.map +1 -0
- package/dist/codemirror/core/registry.d.ts +38 -0
- package/dist/codemirror/core/registry.js +133 -0
- package/dist/codemirror/core/registry.js.map +1 -0
- package/dist/codemirror/core/testKeys.d.ts +17 -0
- package/dist/codemirror/core/testKeys.js +11 -0
- package/dist/codemirror/core/testKeys.js.map +1 -0
- package/dist/codemirror/core/treeAt.d.ts +31 -0
- package/dist/codemirror/core/treeAt.js +10 -0
- package/dist/codemirror/core/treeAt.js.map +1 -0
- package/dist/codemirror/extensions/footnoteExtension.d.ts +9 -0
- package/dist/codemirror/extensions/footnoteExtension.js +14 -0
- package/dist/codemirror/extensions/footnoteExtension.js.map +1 -0
- package/dist/codemirror/extensions/highlightExtension.d.ts +9 -0
- package/dist/codemirror/extensions/highlightExtension.js +14 -0
- package/dist/codemirror/extensions/highlightExtension.js.map +1 -0
- package/dist/codemirror/extensions/index.d.ts +12 -0
- package/dist/codemirror/extensions/index.js +19 -0
- package/dist/codemirror/extensions/index.js.map +1 -0
- package/dist/codemirror/extensions/loader.d.ts +24 -0
- package/dist/codemirror/extensions/loader.js +33 -0
- package/dist/codemirror/extensions/loader.js.map +1 -0
- package/dist/codemirror/extensions/mathExtension.d.ts +9 -0
- package/dist/codemirror/extensions/mathExtension.js +14 -0
- package/dist/codemirror/extensions/mathExtension.js.map +1 -0
- package/dist/codemirror/extensions/mermaidExtension.d.ts +9 -0
- package/dist/codemirror/extensions/mermaidExtension.js +12 -0
- package/dist/codemirror/extensions/mermaidExtension.js.map +1 -0
- package/dist/codemirror/extensions/tableExtension.d.ts +13 -0
- package/dist/codemirror/extensions/tableExtension.js +39 -0
- package/dist/codemirror/extensions/tableExtension.js.map +1 -0
- package/dist/codemirror/extensions/types.d.ts +39 -0
- package/dist/codemirror/extensions/types.js +1 -0
- package/dist/codemirror/extensions/types.js.map +1 -0
- package/dist/codemirror/extensions/wikilinkExtension.d.ts +9 -0
- package/dist/codemirror/extensions/wikilinkExtension.js +14 -0
- package/dist/codemirror/extensions/wikilinkExtension.js.map +1 -0
- package/dist/codemirror/features/blockCommandSteps.d.ts +20 -0
- package/dist/codemirror/features/blockCommandSteps.js +83 -0
- package/dist/codemirror/features/blockCommandSteps.js.map +1 -0
- package/dist/codemirror/footnote/footnotePlugin.d.ts +10 -0
- package/dist/codemirror/footnote/footnotePlugin.js +78 -0
- package/dist/codemirror/footnote/footnotePlugin.js.map +1 -0
- package/dist/codemirror/footnote/footnoteScanRule.d.ts +9 -0
- package/dist/codemirror/footnote/footnoteScanRule.js +12 -0
- package/dist/codemirror/footnote/footnoteScanRule.js.map +1 -0
- package/dist/codemirror/footnote/index.d.ts +2 -0
- package/dist/codemirror/footnote/index.js +2 -0
- package/dist/codemirror/footnote/index.js.map +1 -0
- package/dist/codemirror/format/blockCommands.d.ts +17 -0
- package/dist/codemirror/format/blockCommands.js +176 -0
- package/dist/codemirror/format/blockCommands.js.map +1 -0
- package/dist/codemirror/format/formatCommands.d.ts +11 -0
- package/dist/codemirror/format/formatCommands.js +132 -0
- package/dist/codemirror/format/formatCommands.js.map +1 -0
- package/dist/codemirror/format/index.d.ts +4 -0
- package/dist/codemirror/format/index.js +3 -0
- package/dist/codemirror/format/index.js.map +1 -0
- package/dist/codemirror/highlight/highlightPlugin.d.ts +10 -0
- package/dist/codemirror/highlight/highlightPlugin.js +66 -0
- package/dist/codemirror/highlight/highlightPlugin.js.map +1 -0
- package/dist/codemirror/highlight/highlightScanRule.d.ts +8 -0
- package/dist/codemirror/highlight/highlightScanRule.js +12 -0
- package/dist/codemirror/highlight/highlightScanRule.js.map +1 -0
- package/dist/codemirror/highlight/index.d.ts +2 -0
- package/dist/codemirror/highlight/index.js +2 -0
- package/dist/codemirror/highlight/index.js.map +1 -0
- package/dist/codemirror/html/htmlWidget.d.ts +23 -0
- package/dist/codemirror/html/htmlWidget.js +67 -0
- package/dist/codemirror/html/htmlWidget.js.map +1 -0
- package/dist/codemirror/html/index.d.ts +4 -0
- package/dist/codemirror/html/index.js +2 -0
- package/dist/codemirror/html/index.js.map +1 -0
- package/dist/codemirror/image/imageActionMenu.d.ts +14 -0
- package/dist/codemirror/image/imageActionMenu.js +112 -0
- package/dist/codemirror/image/imageActionMenu.js.map +1 -0
- package/dist/codemirror/image/imageEditEvent.d.ts +20 -0
- package/dist/codemirror/image/imageEditEvent.js +6 -0
- package/dist/codemirror/image/imageEditEvent.js.map +1 -0
- package/dist/codemirror/image/imageInsertHandlers.d.ts +13 -0
- package/dist/codemirror/image/imageInsertHandlers.js +64 -0
- package/dist/codemirror/image/imageInsertHandlers.js.map +1 -0
- package/dist/codemirror/image/imageWidget.d.ts +49 -0
- package/dist/codemirror/image/imageWidget.js +83 -0
- package/dist/codemirror/image/imageWidget.js.map +1 -0
- package/dist/codemirror/image/index.d.ts +8 -0
- package/dist/codemirror/image/index.js +5 -0
- package/dist/codemirror/image/index.js.map +1 -0
- package/dist/codemirror/interaction/clickModel.d.ts +43 -0
- package/dist/codemirror/interaction/clickModel.js +99 -0
- package/dist/codemirror/interaction/clickModel.js.map +1 -0
- package/dist/codemirror/interaction/cursorModel.d.ts +10 -0
- package/dist/codemirror/interaction/cursorModel.js +58 -0
- package/dist/codemirror/interaction/cursorModel.js.map +1 -0
- package/dist/codemirror/interaction/deleteNormalizer.d.ts +18 -0
- package/dist/codemirror/interaction/deleteNormalizer.js +157 -0
- package/dist/codemirror/interaction/deleteNormalizer.js.map +1 -0
- package/dist/codemirror/interaction/flankingGuard.d.ts +20 -0
- package/dist/codemirror/interaction/flankingGuard.js +48 -0
- package/dist/codemirror/interaction/flankingGuard.js.map +1 -0
- package/dist/codemirror/interaction/index.d.ts +7 -0
- package/dist/codemirror/interaction/index.js +6 -0
- package/dist/codemirror/interaction/index.js.map +1 -0
- package/dist/codemirror/interaction/visiblePosition.d.ts +43 -0
- package/dist/codemirror/interaction/visiblePosition.js +98 -0
- package/dist/codemirror/interaction/visiblePosition.js.map +1 -0
- package/dist/codemirror/list/bulletWidget.d.ts +61 -0
- package/dist/codemirror/list/bulletWidget.js +84 -0
- package/dist/codemirror/list/bulletWidget.js.map +1 -0
- package/dist/codemirror/list/index.d.ts +4 -0
- package/dist/codemirror/list/index.js +3 -0
- package/dist/codemirror/list/index.js.map +1 -0
- package/dist/codemirror/list/listContinuation.d.ts +28 -0
- package/dist/codemirror/list/listContinuation.js +61 -0
- package/dist/codemirror/list/listContinuation.js.map +1 -0
- package/dist/codemirror/list/listIndent.d.ts +8 -0
- package/dist/codemirror/list/listIndent.js +95 -0
- package/dist/codemirror/list/listIndent.js.map +1 -0
- package/dist/codemirror/list/taskCheckboxWidget.d.ts +42 -0
- package/dist/codemirror/list/taskCheckboxWidget.js +47 -0
- package/dist/codemirror/list/taskCheckboxWidget.js.map +1 -0
- package/dist/codemirror/math/index.d.ts +3 -0
- package/dist/codemirror/math/index.js +2 -0
- package/dist/codemirror/math/index.js.map +1 -0
- package/dist/codemirror/math/mathPlugin.d.ts +10 -0
- package/dist/codemirror/math/mathPlugin.js +73 -0
- package/dist/codemirror/math/mathPlugin.js.map +1 -0
- package/dist/codemirror/math/mathScanRule.d.ts +16 -0
- package/dist/codemirror/math/mathScanRule.js +18 -0
- package/dist/codemirror/math/mathScanRule.js.map +1 -0
- package/dist/codemirror/math/mathWidget.d.ts +15 -0
- package/dist/codemirror/math/mathWidget.js +36 -0
- package/dist/codemirror/math/mathWidget.js.map +1 -0
- package/dist/codemirror/mermaid/index.d.ts +4 -0
- package/dist/codemirror/mermaid/index.js +3 -0
- package/dist/codemirror/mermaid/index.js.map +1 -0
- package/dist/codemirror/mermaid/mermaidPlugin.d.ts +25 -0
- package/dist/codemirror/mermaid/mermaidPlugin.js +78 -0
- package/dist/codemirror/mermaid/mermaidPlugin.js.map +1 -0
- package/dist/codemirror/mermaid/mermaidRender.d.ts +42 -0
- package/dist/codemirror/mermaid/mermaidRender.js +136 -0
- package/dist/codemirror/mermaid/mermaidRender.js.map +1 -0
- package/dist/codemirror/mermaid/mermaidWidget.d.ts +42 -0
- package/dist/codemirror/mermaid/mermaidWidget.js +142 -0
- package/dist/codemirror/mermaid/mermaidWidget.js.map +1 -0
- package/dist/codemirror/selectionLayer.d.ts +43 -0
- package/dist/codemirror/selectionLayer.js +135 -0
- package/dist/codemirror/selectionLayer.js.map +1 -0
- package/dist/codemirror/table/cellDividerWidget.d.ts +9 -0
- package/dist/codemirror/table/cellDividerWidget.js +19 -0
- package/dist/codemirror/table/cellDividerWidget.js.map +1 -0
- package/dist/codemirror/table/index.d.ts +5 -0
- package/dist/codemirror/table/index.js +4 -0
- package/dist/codemirror/table/index.js.map +1 -0
- package/dist/codemirror/table/tableArmed.d.ts +27 -0
- package/dist/codemirror/table/tableArmed.js +43 -0
- package/dist/codemirror/table/tableArmed.js.map +1 -0
- package/dist/codemirror/table/tableCell.d.ts +19 -0
- package/dist/codemirror/table/tableCell.js +15 -0
- package/dist/codemirror/table/tableCell.js.map +1 -0
- package/dist/codemirror/table/tableCellNav.d.ts +51 -0
- package/dist/codemirror/table/tableCellNav.js +47 -0
- package/dist/codemirror/table/tableCellNav.js.map +1 -0
- package/dist/codemirror/table/tableContextMenu.d.ts +22 -0
- package/dist/codemirror/table/tableContextMenu.js +139 -0
- package/dist/codemirror/table/tableContextMenu.js.map +1 -0
- package/dist/codemirror/table/tableEditCommands.d.ts +29 -0
- package/dist/codemirror/table/tableEditCommands.js +86 -0
- package/dist/codemirror/table/tableEditCommands.js.map +1 -0
- package/dist/codemirror/table/tableExcerpt.d.ts +29 -0
- package/dist/codemirror/table/tableExcerpt.js +34 -0
- package/dist/codemirror/table/tableExcerpt.js.map +1 -0
- package/dist/codemirror/table/tableField.d.ts +6 -0
- package/dist/codemirror/table/tableField.js +37 -0
- package/dist/codemirror/table/tableField.js.map +1 -0
- package/dist/codemirror/table/tableGeometry.d.ts +33 -0
- package/dist/codemirror/table/tableGeometry.js +28 -0
- package/dist/codemirror/table/tableGeometry.js.map +1 -0
- package/dist/codemirror/table/tableInline.d.ts +37 -0
- package/dist/codemirror/table/tableInline.js +105 -0
- package/dist/codemirror/table/tableInline.js.map +1 -0
- package/dist/codemirror/table/tableModel.d.ts +45 -0
- package/dist/codemirror/table/tableModel.js +98 -0
- package/dist/codemirror/table/tableModel.js.map +1 -0
- package/dist/codemirror/tablev2/bridgeRules.d.ts +48 -0
- package/dist/codemirror/tablev2/bridgeRules.js +42 -0
- package/dist/codemirror/tablev2/bridgeRules.js.map +1 -0
- package/dist/codemirror/tablev2/cellEditingSurface.d.ts +79 -0
- package/dist/codemirror/tablev2/cellEditingSurface.js +70 -0
- package/dist/codemirror/tablev2/cellEditingSurface.js.map +1 -0
- package/dist/codemirror/tablev2/cellText.d.ts +11 -0
- package/dist/codemirror/tablev2/cellText.js +12 -0
- package/dist/codemirror/tablev2/cellText.js.map +1 -0
- package/dist/codemirror/tablev2/inlineCellSurface.d.ts +38 -0
- package/dist/codemirror/tablev2/inlineCellSurface.js +162 -0
- package/dist/codemirror/tablev2/inlineCellSurface.js.map +1 -0
- package/dist/codemirror/tablev2/overlayCellSurface.d.ts +36 -0
- package/dist/codemirror/tablev2/overlayCellSurface.js +150 -0
- package/dist/codemirror/tablev2/overlayCellSurface.js.map +1 -0
- package/dist/codemirror/tablev2/tableEditingSteps.d.ts +12 -0
- package/dist/codemirror/tablev2/tableEditingSteps.js +518 -0
- package/dist/codemirror/tablev2/tableEditingSteps.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2HoverControls.d.ts +23 -0
- package/dist/codemirror/tablev2/tableV2HoverControls.js +89 -0
- package/dist/codemirror/tablev2/tableV2HoverControls.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2Interaction.d.ts +29 -0
- package/dist/codemirror/tablev2/tableV2Interaction.js +224 -0
- package/dist/codemirror/tablev2/tableV2Interaction.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2Selection.d.ts +45 -0
- package/dist/codemirror/tablev2/tableV2Selection.js +81 -0
- package/dist/codemirror/tablev2/tableV2Selection.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2Sync.d.ts +13 -0
- package/dist/codemirror/tablev2/tableV2Sync.js +13 -0
- package/dist/codemirror/tablev2/tableV2Sync.js.map +1 -0
- package/dist/codemirror/tablev2/tableWidgetV2.d.ts +46 -0
- package/dist/codemirror/tablev2/tableWidgetV2.js +139 -0
- package/dist/codemirror/tablev2/tableWidgetV2.js.map +1 -0
- package/dist/codemirror/updateBus.d.ts +29 -0
- package/dist/codemirror/updateBus.js +26 -0
- package/dist/codemirror/updateBus.js.map +1 -0
- package/dist/codemirror/wikilink/index.d.ts +3 -0
- package/dist/codemirror/wikilink/index.js +2 -0
- package/dist/codemirror/wikilink/index.js.map +1 -0
- package/dist/codemirror/wikilink/wikilinkPlugin.d.ts +40 -0
- package/dist/codemirror/wikilink/wikilinkPlugin.js +89 -0
- package/dist/codemirror/wikilink/wikilinkPlugin.js.map +1 -0
- package/dist/codemirror/wikilink/wikilinkScanRule.d.ts +9 -0
- package/dist/codemirror/wikilink/wikilinkScanRule.js +13 -0
- package/dist/codemirror/wikilink/wikilinkScanRule.js.map +1 -0
- package/dist/frontmatter.d.ts +79 -0
- package/dist/frontmatter.js +58 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/imageInsert.d.ts +66 -0
- package/dist/imageInsert.js +111 -0
- package/dist/imageInsert.js.map +1 -0
- package/dist/imageSrcResolver.d.ts +55 -0
- package/dist/imageSrcResolver.js +49 -0
- package/dist/imageSrcResolver.js.map +1 -0
- package/dist/index.d.ts +35 -880
- package/dist/index.js +128 -5989
- package/dist/index.js.map +1 -1
- package/dist/links/wikilink.d.ts +26 -0
- package/dist/links/wikilink.js +54 -0
- package/dist/links/wikilink.js.map +1 -0
- package/dist/links/workspaceLink.d.ts +34 -0
- package/dist/links/workspaceLink.js +60 -0
- package/dist/links/workspaceLink.js.map +1 -0
- package/dist/types.d.ts +20 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/core/registry.ts"],"sourcesContent":["/**\n * Canonical table: every Lezer markdown node name → its {@link NodeRule} —\n * ONE place answering \"how does this construct render\". The Lezer parser\n * handles CommonMark + GFM spec compliance; this file is the visual contract.\n *\n * Why a table of rules (functions), not data:\n *\n * 1. **Completeness is auditable.** `registry.test.ts` reads the live\n * parser's node set and fails when any node Lezer emits has no entry\n * here — a lezer-markdown bump that adds a node trips the gate before\n * it ships unstyled. Only the KEYS matter for that, so entries are free\n * to be behavior.\n * 2. **Context is first-class.** A node name can mean different things in\n * different parents (a URL inside `[text](url)` is chrome; a bare\n * pasted URL is content — hiding it made an invisible dead zone).\n * Every rule receives context; contextual entries are ordinary inline\n * functions, readable at the point of definition.\n * 3. **Adding a construct touches one place.** A styled span is a\n * one-liner via the combinators; a widget construct exports its rule\n * from its own module and is listed here; an EXTENSION with its own\n * grammar ships rules via `nodeRulesFacet` and never touches this file.\n * 4. **Deliberate non-styling stays documented.** `raw(why)` /\n * `structural(why)` tag their rules; the coverage test insists the\n * `why` is present.\n *\n * The rules speak {@link Paint} — CodeMirror's own mechanisms (line class,\n * span mark, hide, widget, nothing). That union is CLOSED: constructs grow,\n * ways to paint don't, so the single switch over Paint lives in the painter\n * (plugin.ts) and no new construct ever edits it.\n */\n\nimport { horizontalRuleRule } from \"./hrWidget\";\nimport { htmlBlockRule, htmlInlineRule } from \"../html/htmlWidget\";\nimport { imageRule } from \"../image/imageWidget\";\nimport { linkHasVisibleLabel, linkResolves } from \"./linkResolution\";\nimport { listMarkRule } from \"../list/bulletWidget\";\nimport {\n headingLine,\n hideAlways,\n line,\n mark,\n none,\n raw,\n structural,\n type NodeContext,\n type NodeLike,\n type NodeRules,\n} from \"./paint\";\nimport { taskMarkerRule } from \"../list/taskCheckboxWidget\";\n\n/** The enclosing `Link`, for a rule running on one of its parts. */\nfunction parentLink(ctx: NodeContext): NodeLike | null {\n return ctx.parentName === \"Link\" ? ctx.node.parent : null;\n}\n\nexport const NODE_RULES: NodeRules = {\n // ----- Structural wrappers (never directly styled) -----\n Document: structural(\"top-level wrapper\"),\n Paragraph: structural(\"body font is the default\"),\n\n // ----- ATX headings (`# H1` … `###### H6`) -----\n ATXHeading1: headingLine(\"cm-heading cm-heading--1\"),\n ATXHeading2: headingLine(\"cm-heading cm-heading--2\"),\n ATXHeading3: headingLine(\"cm-heading cm-heading--3\"),\n ATXHeading4: headingLine(\"cm-heading cm-heading--4\"),\n ATXHeading5: headingLine(\"cm-heading cm-heading--5\"),\n ATXHeading6: headingLine(\"cm-heading cm-heading--6\"),\n\n // ----- Setext headings (`=====` / `-----` under text) -----\n SetextHeading1: raw(\"Phase 2: same line scaling as ATXHeading1\"),\n SetextHeading2: raw(\"Phase 2: same line scaling as ATXHeading2\"),\n\n // ----- Block-level constructs -----\n Blockquote: line(\"cm-blockquote\"),\n BulletList: structural(\"ListItem children carry the styling\"),\n OrderedList: structural(\"ListItem children carry the styling\"),\n ListItem: line(\"cm-list-line\"),\n FencedCode: line(\"cm-fenced-code\"),\n CodeBlock: raw(\"Phase 2: indented code-block, same style as FencedCode\"),\n HorizontalRule: horizontalRuleRule, // `---` → styled `<hr>` widget\n HTMLBlock: htmlBlockRule,\n LinkReference: raw(\"Phase 2: reference-style links resolve in click handler\"),\n\n // ----- Inline styling -----\n Emphasis: mark(\"cm-emphasis\"),\n StrongEmphasis: mark(\"cm-strong\"),\n InlineCode: mark(\"cm-inline-code\"),\n // A `Link` node is not yet a link: Lezer emits one for every `[…]`, and the\n // reference lookup CommonMark requires is left to us. Unresolved, it is the\n // literal brackets the author typed — most `[…]` in prose, and every optional\n // argument in a LaTeX block.\n Link: (ctx) =>\n linkResolves(ctx.node, ctx.state) ? { paint: \"mark\", className: \"cm-link\" } : none,\n Image: imageRule, // `` → inline `<img>` widget\n\n // ----- Inline literal sub-nodes (rendered inside their parent) -----\n // Inside a Link the URL is chrome ONLY when a visible label exists — for\n // `[](url)` / `[ ](url)` the URL is the link's entire visible content, and\n // hiding it (with the marks already hidden) left an invisible dead zone.\n // Bare GFM autolinks and <angle> autolinks emit the SAME node name, and\n // there the URL IS the content — same class of bug when hidden.\n URL: (ctx) => {\n const link = parentLink(ctx);\n if (!link) return { paint: \"mark\", className: \"cm-link\" };\n return linkHasVisibleLabel(link, ctx.state)\n ? { paint: \"hide\" }\n : { paint: \"mark\", className: \"cm-link\" };\n },\n LinkLabel: raw(\"visible inside Link; parent mark styles it\"),\n LinkTitle: hideAlways(), // `[text](URL \"title\")` — title never visible\n CodeText: raw(\"interior of FencedCode/InlineCode; parent decoration covers it\"),\n CodeInfo: mark(\"cm-code-info\"), // language tag on the opener row — visible so typing there is never invisible (§12.4)\n HardBreak: structural(\"trailing two-spaces or backslash, no visible glyph\"),\n Comment: raw(\"Phase 2: dim inline HTML comments\"),\n CommentBlock: raw(\"Phase 2: dim block HTML comments\"),\n ProcessingInstruction: raw(\"Phase 2: dim like HTML comments\"),\n ProcessingInstructionBlock: raw(\"Phase 2: dim like HTML comments\"),\n Entity: raw(\"HTML entities like & render as-is, by design\"),\n // Backslash-escape: hide only the leading `\\`, so `\\'` renders as `'` per\n // CommonMark rather than showing a literal backslash.\n Escape: (ctx) => ({\n paint: \"hide\",\n range: { from: ctx.from, to: ctx.from + 1 },\n expandSpace: false,\n }),\n HTMLTag: htmlInlineRule,\n\n // ----- Syntax markers (hidden always — non-technical UX, distinct from Obsidian's Live Preview) -----\n // `#` marks on ATX headings hide; a SETEXT heading's underline is that\n // heading's only marker on its own line — hiding it left an invisible,\n // unclickable dead line. Visible until setext gets real styling.\n HeaderMark: (ctx) =>\n ctx.parentName?.startsWith(\"SetextHeading\") ? { paint: \"none\" } : { paint: \"hide\" },\n EmphasisMark: hideAlways(), // `*` / `_`\n CodeMark: hideAlways(), // backticks for inline / fence pairs for blocks\n // `[`/`]`/`(`/`)` — chrome only where they really are chrome. An unresolved\n // link's brackets are content, and hiding them rewrote the document on screen.\n LinkMark: (ctx) => {\n const link = parentLink(ctx);\n return link && !linkResolves(link, ctx.state) ? none : { paint: \"hide\" };\n },\n QuoteMark: hideAlways(), // `>`\n ListMark: listMarkRule, // `-`/`1.` → bullet / number / nothing beside a checkbox\n TaskMarker: taskMarkerRule, // `[ ]` / `[x]` → real checkbox\n\n // ----- GFM extensions (enabled via `markdownLanguage`) -----\n Strikethrough: mark(\"cm-strikethrough\"),\n // `~~` joins the hidden-marker system like EmphasisMark — the flanking\n // guard and delete normalizer already assume these semantics; leaving the\n // marks visible made deletion eat single tildes (interaction-spec §8.1).\n StrikethroughMark: hideAlways(),\n Subscript: raw(\"Phase 2: vertical-align: sub\"),\n SubscriptMark: raw(\"Phase 2: hide `~` off-parent\"),\n Superscript: raw(\"Phase 2: vertical-align: super\"),\n SuperscriptMark: raw(\"Phase 2: hide `^` off-parent\"),\n Emoji: raw(\"Phase 2: replace `:smile:` with the emoji glyph\"),\n Autolink: raw(\"wrapper of a visible URL child; Phase 2 wires click-to-open\"),\n Task: raw(\"Phase 2: render task list items with a real checkbox\"),\n\n // GFM tables — handled by a dedicated StateField that emits the block\n // widget on Table nodes (CM6 forbids multi-line replace from a ViewPlugin,\n // so this rules-driven plugin can't do that shape; see tableField.ts).\n Table: structural(\"tableField StateField owns Table rendering\"),\n TableHeader: structural(\"covered by Table widget\"),\n TableRow: structural(\"covered by Table widget\"),\n TableCell: structural(\"covered by Table widget\"),\n TableDelimiter: structural(\"covered by Table widget\"),\n};\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test-only: the chord CodeMirror's `Mod-` prefix resolves to HERE.
|
|
3
|
+
*
|
|
4
|
+
* `Mod` is Cmd on macOS and Ctrl everywhere else, and CodeMirror decides that
|
|
5
|
+
* from `navigator.platform` — so a suite that presses `{Meta>}z{/Meta}`
|
|
6
|
+
* literally tests undo on a Mac and tests nothing at all on Linux. The
|
|
7
|
+
* keystroke reaches no binding, the assertion reads the un-undone text, and the
|
|
8
|
+
* failure looks like a broken editor rather than a mis-aimed key. This picks the
|
|
9
|
+
* modifier the same way the keymap does, so the two can never disagree.
|
|
10
|
+
*
|
|
11
|
+
* Not shipped — nothing in the package imports it outside tests.
|
|
12
|
+
*/
|
|
13
|
+
declare const MOD: string;
|
|
14
|
+
/** A `userEvent.keyboard` sequence for `Mod-<keys>`. */
|
|
15
|
+
declare function modChord(keys: string): string;
|
|
16
|
+
|
|
17
|
+
export { MOD, modChord };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
const nav = typeof navigator === "undefined" ? { platform: "" } : navigator;
|
|
3
|
+
const MOD = /Mac|iP(hone|[oa]d)/.test(nav.platform) ? "Meta" : "Control";
|
|
4
|
+
function modChord(keys) {
|
|
5
|
+
return `{${MOD}>}${keys}{/${MOD}}`;
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
MOD,
|
|
9
|
+
modChord
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=testKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/core/testKeys.ts"],"sourcesContent":["/**\n * Test-only: the chord CodeMirror's `Mod-` prefix resolves to HERE.\n *\n * `Mod` is Cmd on macOS and Ctrl everywhere else, and CodeMirror decides that\n * from `navigator.platform` — so a suite that presses `{Meta>}z{/Meta}`\n * literally tests undo on a Mac and tests nothing at all on Linux. The\n * keystroke reaches no binding, the assertion reads the un-undone text, and the\n * failure looks like a broken editor rather than a mis-aimed key. This picks the\n * modifier the same way the keymap does, so the two can never disagree.\n *\n * Not shipped — nothing in the package imports it outside tests.\n */\n\nconst nav = typeof navigator === \"undefined\" ? { platform: \"\" } : navigator;\n\nexport const MOD = /Mac|iP(hone|[oa]d)/.test(nav.platform) ? \"Meta\" : \"Control\";\n\n/** A `userEvent.keyboard` sequence for `Mod-<keys>`. */\nexport function modChord(keys: string): string {\n return `{${MOD}>}${keys}{/${MOD}}`;\n}\n"],"mappings":";AAaA,MAAM,MAAM,OAAO,cAAc,cAAc,EAAE,UAAU,GAAG,IAAI;AAE3D,MAAM,MAAM,qBAAqB,KAAK,IAAI,QAAQ,IAAI,SAAS;AAG/D,SAAS,SAAS,MAAsB;AAC7C,SAAO,IAAI,GAAG,KAAK,IAAI,KAAK,GAAG;AACjC;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { syntaxTree } from '@codemirror/language';
|
|
2
|
+
import { EditorState } from '@codemirror/state';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A syntax tree that reaches `pos`.
|
|
6
|
+
*
|
|
7
|
+
* `syntaxTree` returns only what the **viewport** has driven the parser
|
|
8
|
+
* through, so `resolveInner` past that point reports the position as bare
|
|
9
|
+
* `Document`. Every command that asks "am I inside a list / a fence / a table?"
|
|
10
|
+
* then gets "no" and takes the plain-text path: a wrong answer, not a slow one.
|
|
11
|
+
*
|
|
12
|
+
* Measured in WebKit, the engine we ship on, with real layout — two regimes.
|
|
13
|
+
*
|
|
14
|
+
* On the frame a document opens the parser has covered a few thousand
|
|
15
|
+
* characters: 3,009 of 7,902, viewport 0–331, for an editor 11,404px tall. The
|
|
16
|
+
* idle parse then catches up within about half a second, so near the viewport
|
|
17
|
+
* this is a race — and it heals before a hand-test can see it.
|
|
18
|
+
*
|
|
19
|
+
* Further out it never heals. The idle parse stops 100,000 characters past the
|
|
20
|
+
* viewport: the tree plateaus at 100,739 for a 167k-character document and a
|
|
21
|
+
* 341k one alike, and stays there. `ensureSyntaxTree` resumes from that plateau
|
|
22
|
+
* and finishes the 341k document in 43ms — inside the budget above.
|
|
23
|
+
*
|
|
24
|
+
* Only for questions about a *position*. Decoration plugins iterate
|
|
25
|
+
* `view.visibleRanges` and should keep using `syntaxTree` directly: there,
|
|
26
|
+
* being limited to the viewport is the point.
|
|
27
|
+
*/
|
|
28
|
+
type Tree = ReturnType<typeof syntaxTree>;
|
|
29
|
+
declare function treeAt(state: EditorState, pos: number): Tree;
|
|
30
|
+
|
|
31
|
+
export { treeAt };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { ensureSyntaxTree, syntaxTree } from "@codemirror/language";
|
|
3
|
+
const PARSE_BUDGET_MS = 150;
|
|
4
|
+
function treeAt(state, pos) {
|
|
5
|
+
return ensureSyntaxTree(state, pos + 1, PARSE_BUDGET_MS) ?? syntaxTree(state);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
treeAt
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=treeAt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/core/treeAt.ts"],"sourcesContent":["import { ensureSyntaxTree, syntaxTree } from \"@codemirror/language\";\nimport type { EditorState } from \"@codemirror/state\";\n\n/**\n * How long a structural lookup may spend parsing. It runs inside a keystroke,\n * so this is a budget rather than a guarantee: past it we answer from whatever\n * has been parsed, exactly as before.\n *\n * 50ms was too thin to be a budget. The worst realistic case below — resuming a\n * 341k-character document — was measured at 43ms on the development machine,\n * and CI on a slower runner duly blew through it: `ensureSyntaxTree` returned\n * null, the guard fell back to the short tree, and a backspace crossed a fence\n * boundary it should have walled. A budget that only holds on the fastest\n * machine available is not a budget.\n *\n * The cost of the larger number is bounded and rare. `parseToEnd` keeps the\n * document covered, so this call normally returns from an already-complete tree\n * in microseconds; the budget only bites in the window after a very large\n * document opens, and there one slow keystroke beats one wrong answer.\n */\nconst PARSE_BUDGET_MS = 150;\n\n/**\n * A syntax tree that reaches `pos`.\n *\n * `syntaxTree` returns only what the **viewport** has driven the parser\n * through, so `resolveInner` past that point reports the position as bare\n * `Document`. Every command that asks \"am I inside a list / a fence / a table?\"\n * then gets \"no\" and takes the plain-text path: a wrong answer, not a slow one.\n *\n * Measured in WebKit, the engine we ship on, with real layout — two regimes.\n *\n * On the frame a document opens the parser has covered a few thousand\n * characters: 3,009 of 7,902, viewport 0–331, for an editor 11,404px tall. The\n * idle parse then catches up within about half a second, so near the viewport\n * this is a race — and it heals before a hand-test can see it.\n *\n * Further out it never heals. The idle parse stops 100,000 characters past the\n * viewport: the tree plateaus at 100,739 for a 167k-character document and a\n * 341k one alike, and stays there. `ensureSyntaxTree` resumes from that plateau\n * and finishes the 341k document in 43ms — inside the budget above.\n *\n * Only for questions about a *position*. Decoration plugins iterate\n * `view.visibleRanges` and should keep using `syntaxTree` directly: there,\n * being limited to the viewport is the point.\n */\n/// The tree type, named without importing `@lezer/common` — it is a transitive\n/// dependency, and a declaration referring to it by pnpm path is not portable\n/// for anyone consuming the built package.\ntype Tree = ReturnType<typeof syntaxTree>;\n\nexport function treeAt(state: EditorState, pos: number): Tree {\n return ensureSyntaxTree(state, pos + 1, PARSE_BUDGET_MS) ?? syntaxTree(state);\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,kBAAkB;AAoB7C,MAAM,kBAAkB;AA+BjB,SAAS,OAAO,OAAoB,KAAmB;AAC5D,SAAO,iBAAiB,OAAO,MAAM,GAAG,eAAe,KAAK,WAAW,KAAK;AAC9E;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { footnotePlugin } from "../footnote/index.js";
|
|
3
|
+
import { inlineScanRulesFacet } from "../core/inlineScan.js";
|
|
4
|
+
import { footnoteScanRule } from "../footnote/footnoteScanRule.js";
|
|
5
|
+
const footnoteExtension = {
|
|
6
|
+
name: "@compose/footnote",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
description: "Renders `[^id]` references and `[^id]:` definitions with tooltip jump.",
|
|
9
|
+
extensions: [footnotePlugin, inlineScanRulesFacet.of(footnoteScanRule)]
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
footnoteExtension
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=footnoteExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/footnoteExtension.ts"],"sourcesContent":["import { footnotePlugin } from \"../footnote\";\nimport { inlineScanRulesFacet } from \"../core/inlineScan\";\nimport { footnoteScanRule } from \"../footnote/footnoteScanRule\";\n\nimport { type MarkdownExtension } from \"./types\";\n\nexport const footnoteExtension: MarkdownExtension = {\n name: \"@compose/footnote\",\n version: \"0.1.0\",\n description: \"Renders `[^id]` references and `[^id]:` definitions with tooltip jump.\",\n extensions: [footnotePlugin, inlineScanRulesFacet.of(footnoteScanRule)],\n};\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAI1B,MAAM,oBAAuC;AAAA,EAClD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY,CAAC,gBAAgB,qBAAqB,GAAG,gBAAgB,CAAC;AACxE;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { highlightPlugin } from "../highlight/index.js";
|
|
3
|
+
import { inlineScanRulesFacet } from "../core/inlineScan.js";
|
|
4
|
+
import { highlightScanRule } from "../highlight/highlightScanRule.js";
|
|
5
|
+
const highlightExtension = {
|
|
6
|
+
name: "@compose/highlight",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
description: "Renders `==text==` with a yellow highlight background.",
|
|
9
|
+
extensions: [highlightPlugin, inlineScanRulesFacet.of(highlightScanRule)]
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
highlightExtension
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=highlightExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/highlightExtension.ts"],"sourcesContent":["import { highlightPlugin } from \"../highlight\";\nimport { inlineScanRulesFacet } from \"../core/inlineScan\";\nimport { highlightScanRule } from \"../highlight/highlightScanRule\";\n\nimport { type MarkdownExtension } from \"./types\";\n\nexport const highlightExtension: MarkdownExtension = {\n name: \"@compose/highlight\",\n version: \"0.1.0\",\n description: \"Renders `==text==` with a yellow highlight background.\",\n extensions: [highlightPlugin, inlineScanRulesFacet.of(highlightScanRule)],\n};\n"],"mappings":";AAAA,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAI3B,MAAM,qBAAwC;AAAA,EACnD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY,CAAC,iBAAiB,qBAAqB,GAAG,iBAAiB,CAAC;AAC1E;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { CaretContextSnapshot, MarkdownExtension, ToolbarContribution } from './types.js';
|
|
2
|
+
export { ComposedExtension, composeExtensions, mergeExtensions } from './loader.js';
|
|
3
|
+
export { highlightExtension } from './highlightExtension.js';
|
|
4
|
+
export { footnoteExtension } from './footnoteExtension.js';
|
|
5
|
+
export { mathExtension } from './mathExtension.js';
|
|
6
|
+
export { mermaidExtension } from './mermaidExtension.js';
|
|
7
|
+
export { tableExtension } from './tableExtension.js';
|
|
8
|
+
export { wikilinkExtension } from './wikilinkExtension.js';
|
|
9
|
+
import '@codemirror/view';
|
|
10
|
+
import '@codemirror/state';
|
|
11
|
+
import 'react';
|
|
12
|
+
import '../core/paint.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { mergeExtensions, composeExtensions } from "./loader.js";
|
|
3
|
+
import { highlightExtension } from "./highlightExtension.js";
|
|
4
|
+
import { footnoteExtension } from "./footnoteExtension.js";
|
|
5
|
+
import { mathExtension } from "./mathExtension.js";
|
|
6
|
+
import { mermaidExtension } from "./mermaidExtension.js";
|
|
7
|
+
import { tableExtension } from "./tableExtension.js";
|
|
8
|
+
import { wikilinkExtension } from "./wikilinkExtension.js";
|
|
9
|
+
export {
|
|
10
|
+
composeExtensions,
|
|
11
|
+
footnoteExtension,
|
|
12
|
+
highlightExtension,
|
|
13
|
+
mathExtension,
|
|
14
|
+
mergeExtensions,
|
|
15
|
+
mermaidExtension,
|
|
16
|
+
tableExtension,
|
|
17
|
+
wikilinkExtension
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/index.ts"],"sourcesContent":["export { type MarkdownExtension, type ToolbarContribution, type CaretContextSnapshot } from \"./types\";\nexport { mergeExtensions, composeExtensions, type ComposedExtension } from \"./loader\";\nexport { highlightExtension } from \"./highlightExtension\";\nexport { footnoteExtension } from \"./footnoteExtension\";\nexport { mathExtension } from \"./mathExtension\";\nexport { mermaidExtension } from \"./mermaidExtension\";\nexport { tableExtension } from \"./tableExtension\";\nexport { wikilinkExtension } from \"./wikilinkExtension\";\n"],"mappings":";AACA,SAAS,iBAAiB,yBAAiD;AAC3E,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Extension } from '@codemirror/state';
|
|
2
|
+
import { ToolbarContribution, MarkdownExtension } from './types.js';
|
|
3
|
+
import '@codemirror/view';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '../core/paint.js';
|
|
6
|
+
|
|
7
|
+
interface ComposedExtension {
|
|
8
|
+
extensions: Extension[];
|
|
9
|
+
toolbar: ToolbarContribution[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Merge extension modules into one set of CodeMirror extensions plus the
|
|
13
|
+
* toolbar items they contribute. Later modules win: a host's rules are applied
|
|
14
|
+
* after the built-ins, so it can deliberately override a construct.
|
|
15
|
+
*/
|
|
16
|
+
declare function mergeExtensions(modules: readonly MarkdownExtension[]): ComposedExtension;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Renamed to {@link mergeExtensions}. "compose" reads as the app
|
|
19
|
+
* this package was extracted from rather than as the verb; the editor is meant
|
|
20
|
+
* for more hosts than that one. Kept as an alias so the rename is not breaking.
|
|
21
|
+
*/
|
|
22
|
+
declare const composeExtensions: typeof mergeExtensions;
|
|
23
|
+
|
|
24
|
+
export { type ComposedExtension, composeExtensions, mergeExtensions };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { keymap as cmKeymap } from "@codemirror/view";
|
|
3
|
+
import { nodeRulesFacet } from "../core/index.js";
|
|
4
|
+
function mergeExtensions(modules) {
|
|
5
|
+
const extensions = [];
|
|
6
|
+
const toolbar = [];
|
|
7
|
+
const allKeyBindings = [];
|
|
8
|
+
const seenRuleNames = /* @__PURE__ */ new Set();
|
|
9
|
+
for (const mod of modules) {
|
|
10
|
+
if (mod.extensions?.length) extensions.push(...mod.extensions);
|
|
11
|
+
if (mod.keymap?.length) allKeyBindings.push(...mod.keymap);
|
|
12
|
+
if (mod.toolbar?.length) toolbar.push(...mod.toolbar);
|
|
13
|
+
if (mod.rules) {
|
|
14
|
+
extensions.push(nodeRulesFacet.of(mod.rules));
|
|
15
|
+
for (const name of Object.keys(mod.rules)) {
|
|
16
|
+
if (seenRuleNames.has(name)) {
|
|
17
|
+
console.warn(
|
|
18
|
+
`MarkdownExtension "${mod.name}" overrides node rule "${name}" already provided by another extension.`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
seenRuleNames.add(name);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (allKeyBindings.length) extensions.push(cmKeymap.of(allKeyBindings));
|
|
26
|
+
return { extensions, toolbar };
|
|
27
|
+
}
|
|
28
|
+
const composeExtensions = mergeExtensions;
|
|
29
|
+
export {
|
|
30
|
+
composeExtensions,
|
|
31
|
+
mergeExtensions
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/loader.ts"],"sourcesContent":["import { type Extension } from \"@codemirror/state\";\nimport { keymap as cmKeymap } from \"@codemirror/view\";\n\nimport { nodeRulesFacet } from \"../core\";\nimport { type MarkdownExtension, type ToolbarContribution } from \"./types\";\n\nexport interface ComposedExtension {\n extensions: Extension[];\n toolbar: ToolbarContribution[];\n}\n\n/**\n * Merge extension modules into one set of CodeMirror extensions plus the\n * toolbar items they contribute. Later modules win: a host's rules are applied\n * after the built-ins, so it can deliberately override a construct.\n */\nexport function mergeExtensions(modules: readonly MarkdownExtension[]): ComposedExtension {\n const extensions: Extension[] = [];\n const toolbar: ToolbarContribution[] = [];\n const allKeyBindings: import(\"@codemirror/view\").KeyBinding[] = [];\n const seenRuleNames = new Set<string>();\n\n for (const mod of modules) {\n if (mod.extensions?.length) extensions.push(...mod.extensions);\n if (mod.keymap?.length) allKeyBindings.push(...mod.keymap);\n if (mod.toolbar?.length) toolbar.push(...mod.toolbar);\n if (mod.rules) {\n // An extension's node rules feed the decoration painter through the\n // facet — introducing (or deliberately overriding) a construct never\n // touches the base table.\n extensions.push(nodeRulesFacet.of(mod.rules));\n for (const name of Object.keys(mod.rules)) {\n if (seenRuleNames.has(name)) {\n // eslint-disable-next-line no-console\n console.warn(\n `MarkdownExtension \"${mod.name}\" overrides node rule \"${name}\" already provided by another extension.`,\n );\n }\n seenRuleNames.add(name);\n }\n }\n }\n\n if (allKeyBindings.length) extensions.push(cmKeymap.of(allKeyBindings));\n\n return { extensions, toolbar };\n}\n\n/**\n * @deprecated Renamed to {@link mergeExtensions}. \"compose\" reads as the app\n * this package was extracted from rather than as the verb; the editor is meant\n * for more hosts than that one. Kept as an alias so the rename is not breaking.\n */\nexport const composeExtensions = mergeExtensions;\n"],"mappings":";AACA,SAAS,UAAU,gBAAgB;AAEnC,SAAS,sBAAsB;AAaxB,SAAS,gBAAgB,SAA0D;AACxF,QAAM,aAA0B,CAAC;AACjC,QAAM,UAAiC,CAAC;AACxC,QAAM,iBAA0D,CAAC;AACjE,QAAM,gBAAgB,oBAAI,IAAY;AAEtC,aAAW,OAAO,SAAS;AACzB,QAAI,IAAI,YAAY,OAAQ,YAAW,KAAK,GAAG,IAAI,UAAU;AAC7D,QAAI,IAAI,QAAQ,OAAQ,gBAAe,KAAK,GAAG,IAAI,MAAM;AACzD,QAAI,IAAI,SAAS,OAAQ,SAAQ,KAAK,GAAG,IAAI,OAAO;AACpD,QAAI,IAAI,OAAO;AAIb,iBAAW,KAAK,eAAe,GAAG,IAAI,KAAK,CAAC;AAC5C,iBAAW,QAAQ,OAAO,KAAK,IAAI,KAAK,GAAG;AACzC,YAAI,cAAc,IAAI,IAAI,GAAG;AAE3B,kBAAQ;AAAA,YACN,sBAAsB,IAAI,IAAI,0BAA0B,IAAI;AAAA,UAC9D;AAAA,QACF;AACA,sBAAc,IAAI,IAAI;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AAEA,MAAI,eAAe,OAAQ,YAAW,KAAK,SAAS,GAAG,cAAc,CAAC;AAEtE,SAAO,EAAE,YAAY,QAAQ;AAC/B;AAOO,MAAM,oBAAoB;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { mathPlugin } from "../math/index.js";
|
|
3
|
+
import { inlineScanRulesFacet } from "../core/inlineScan.js";
|
|
4
|
+
import { mathScanRule } from "../math/mathScanRule.js";
|
|
5
|
+
const mathExtension = {
|
|
6
|
+
name: "@compose/math",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
description: "Renders `$x$` inline and `$$x$$` block math via KaTeX.",
|
|
9
|
+
extensions: [mathPlugin, inlineScanRulesFacet.of(mathScanRule)]
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
mathExtension
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=mathExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/mathExtension.ts"],"sourcesContent":["import { mathPlugin } from \"../math\";\nimport { inlineScanRulesFacet } from \"../core/inlineScan\";\nimport { mathScanRule } from \"../math/mathScanRule\";\n\nimport { type MarkdownExtension } from \"./types\";\n\nexport const mathExtension: MarkdownExtension = {\n name: \"@compose/math\",\n version: \"0.1.0\",\n description: \"Renders `$x$` inline and `$$x$$` block math via KaTeX.\",\n extensions: [mathPlugin, inlineScanRulesFacet.of(mathScanRule)],\n};\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAItB,MAAM,gBAAmC;AAAA,EAC9C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY,CAAC,YAAY,qBAAqB,GAAG,YAAY,CAAC;AAChE;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { mermaidField } from "../mermaid/index.js";
|
|
3
|
+
const mermaidExtension = {
|
|
4
|
+
name: "@compose/mermaid",
|
|
5
|
+
version: "0.1.0",
|
|
6
|
+
description: "Renders closed ```mermaid fences as diagrams; click a diagram to edit its source.",
|
|
7
|
+
extensions: [mermaidField]
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
mermaidExtension
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=mermaidExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/mermaidExtension.ts"],"sourcesContent":["import { mermaidField } from \"../mermaid\";\n\nimport { type MarkdownExtension } from \"./types\";\n\nexport const mermaidExtension: MarkdownExtension = {\n name: \"@compose/mermaid\",\n version: \"0.1.0\",\n description:\n \"Renders closed ```mermaid fences as diagrams; click a diagram to edit its source.\",\n extensions: [mermaidField],\n};\n"],"mappings":";AAAA,SAAS,oBAAoB;AAItB,MAAM,mBAAsC;AAAA,EACjD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aACE;AAAA,EACF,YAAY,CAAC,YAAY;AAC3B;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MarkdownExtension } from './types.js';
|
|
2
|
+
import '@codemirror/view';
|
|
3
|
+
import '@codemirror/state';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '../core/paint.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A FACTORY, not a const: each composition gets its own editing surface (the
|
|
9
|
+
* one-active-edit state), so two mounted editors can never share a cell edit.
|
|
10
|
+
*/
|
|
11
|
+
declare function tableExtension(): MarkdownExtension;
|
|
12
|
+
|
|
13
|
+
export { tableExtension };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { EditorView } from "@codemirror/view";
|
|
3
|
+
import { armedTableField, tableArmedHighlight, tableField } from "../table/index.js";
|
|
4
|
+
import { InlineCellSurface } from "../tablev2/inlineCellSurface.js";
|
|
5
|
+
import { tableV2HoverControls } from "../tablev2/tableV2HoverControls.js";
|
|
6
|
+
import { tableV2Interaction } from "../tablev2/tableV2Interaction.js";
|
|
7
|
+
import { tableV2Sync } from "../tablev2/tableV2Sync.js";
|
|
8
|
+
function tableExtension() {
|
|
9
|
+
const surface = new InlineCellSurface();
|
|
10
|
+
return {
|
|
11
|
+
name: "@compose/table",
|
|
12
|
+
version: "0.2.0",
|
|
13
|
+
description: "Renders GFM tables as a grid widget; cells edit natively in place (ADR 0001).",
|
|
14
|
+
extensions: [
|
|
15
|
+
tableField,
|
|
16
|
+
// Treat each table as one atomic block: the caret, clicks, and selection
|
|
17
|
+
// skip over it instead of landing on its hidden `| … |` source. Without
|
|
18
|
+
// this, arrows/clicks resolve to hidden offsets and Backspace edits a
|
|
19
|
+
// hidden pipe — corrupting the grid (and eating the blank-line separator).
|
|
20
|
+
EditorView.atomicRanges.of((view) => view.state.field(tableField)),
|
|
21
|
+
// Two-step delete: the field records which table the next press deletes;
|
|
22
|
+
// the plugin outlines it and draws the "armed" edge line.
|
|
23
|
+
armedTableField,
|
|
24
|
+
tableArmedHighlight,
|
|
25
|
+
// Keep the surface's table anchor + active edit alive across doc changes.
|
|
26
|
+
tableV2Sync(surface),
|
|
27
|
+
// Click-to-edit at the clicked character, bridge keys (Tab/arrows/
|
|
28
|
+
// Backspace/Delete/Enter), whole-cell drag selection + TSV copy, the
|
|
29
|
+
// structure menu, and table entry/exit from the main document.
|
|
30
|
+
tableV2Interaction(surface),
|
|
31
|
+
// Hover "+" quick inserters (row below / column right).
|
|
32
|
+
tableV2HoverControls()
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
tableExtension
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=tableExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/tableExtension.ts"],"sourcesContent":["import { EditorView } from \"@codemirror/view\";\n\nimport { armedTableField, tableArmedHighlight, tableField } from \"../table\";\nimport { InlineCellSurface } from \"../tablev2/inlineCellSurface\";\nimport { tableV2HoverControls } from \"../tablev2/tableV2HoverControls\";\nimport { tableV2Interaction } from \"../tablev2/tableV2Interaction\";\nimport { tableV2Sync } from \"../tablev2/tableV2Sync\";\n\nimport { type MarkdownExtension } from \"./types\";\n\n/**\n * A FACTORY, not a const: each composition gets its own editing surface (the\n * one-active-edit state), so two mounted editors can never share a cell edit.\n */\nexport function tableExtension(): MarkdownExtension {\n const surface = new InlineCellSurface();\n return {\n name: \"@compose/table\",\n version: \"0.2.0\",\n description:\n \"Renders GFM tables as a grid widget; cells edit natively in place (ADR 0001).\",\n extensions: [\n tableField,\n // Treat each table as one atomic block: the caret, clicks, and selection\n // skip over it instead of landing on its hidden `| … |` source. Without\n // this, arrows/clicks resolve to hidden offsets and Backspace edits a\n // hidden pipe — corrupting the grid (and eating the blank-line separator).\n EditorView.atomicRanges.of((view) => view.state.field(tableField)),\n // Two-step delete: the field records which table the next press deletes;\n // the plugin outlines it and draws the \"armed\" edge line.\n armedTableField,\n tableArmedHighlight,\n // Keep the surface's table anchor + active edit alive across doc changes.\n tableV2Sync(surface),\n // Click-to-edit at the clicked character, bridge keys (Tab/arrows/\n // Backspace/Delete/Enter), whole-cell drag selection + TSV copy, the\n // structure menu, and table entry/exit from the main document.\n tableV2Interaction(surface),\n // Hover \"+\" quick inserters (row below / column right).\n tableV2HoverControls(),\n ],\n };\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,iBAAiB,qBAAqB,kBAAkB;AACjE,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAQrB,SAAS,iBAAoC;AAClD,QAAM,UAAU,IAAI,kBAAkB;AACtC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACE;AAAA,IACF,YAAY;AAAA,MACV;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,WAAW,aAAa,GAAG,CAAC,SAAS,KAAK,MAAM,MAAM,UAAU,CAAC;AAAA;AAAA;AAAA,MAGjE;AAAA,MACA;AAAA;AAAA,MAEA,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA,MAInB,mBAAmB,OAAO;AAAA;AAAA,MAE1B,qBAAqB;AAAA,IACvB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as _codemirror_view from '@codemirror/view';
|
|
2
|
+
import { KeyBinding } from '@codemirror/view';
|
|
3
|
+
import { Extension } from '@codemirror/state';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { NodeRules } from '../core/paint.js';
|
|
6
|
+
|
|
7
|
+
interface ToolbarContribution {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly group: "heading" | "format" | "block" | "insert" | string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly icon: ReactNode;
|
|
12
|
+
readonly shortcut?: string;
|
|
13
|
+
readonly isActive?: (caretContext: CaretContextSnapshot) => boolean;
|
|
14
|
+
readonly run: (view: _codemirror_view.EditorView) => void;
|
|
15
|
+
}
|
|
16
|
+
interface CaretContextSnapshot {
|
|
17
|
+
readonly bold: boolean;
|
|
18
|
+
readonly italic: boolean;
|
|
19
|
+
readonly code: boolean;
|
|
20
|
+
readonly link: boolean;
|
|
21
|
+
readonly heading: 1 | 2 | 3 | 4 | 5 | 6 | 0;
|
|
22
|
+
readonly bulletList: boolean;
|
|
23
|
+
readonly orderedList: boolean;
|
|
24
|
+
readonly blockquote: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface MarkdownExtension {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly version: string;
|
|
29
|
+
readonly description?: string;
|
|
30
|
+
/** Node rules for constructs this extension's grammar introduces (or
|
|
31
|
+
* deliberately overrides) — merged into the decoration painter via
|
|
32
|
+
* `nodeRulesFacet`, so an extension never edits the base table. */
|
|
33
|
+
readonly rules?: NodeRules;
|
|
34
|
+
readonly extensions?: Extension[];
|
|
35
|
+
readonly keymap?: KeyBinding[];
|
|
36
|
+
readonly toolbar?: ToolbarContribution[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type { CaretContextSnapshot, MarkdownExtension, ToolbarContribution };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { wikilinkPlugin } from "../wikilink/index.js";
|
|
3
|
+
import { inlineScanRulesFacet } from "../core/inlineScan.js";
|
|
4
|
+
import { wikilinkScanRule } from "../wikilink/wikilinkScanRule.js";
|
|
5
|
+
const wikilinkExtension = {
|
|
6
|
+
name: "@compose/wikilink",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
description: "Renders `[[target]]` / `[[target|alias]]` as clickable links.",
|
|
9
|
+
extensions: [wikilinkPlugin, inlineScanRulesFacet.of(wikilinkScanRule)]
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
wikilinkExtension
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=wikilinkExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/extensions/wikilinkExtension.ts"],"sourcesContent":["import { wikilinkPlugin } from \"../wikilink\";\nimport { inlineScanRulesFacet } from \"../core/inlineScan\";\nimport { wikilinkScanRule } from \"../wikilink/wikilinkScanRule\";\n\nimport { type MarkdownExtension } from \"./types\";\n\nexport const wikilinkExtension: MarkdownExtension = {\n name: \"@compose/wikilink\",\n version: \"0.1.0\",\n description: \"Renders `[[target]]` / `[[target|alias]]` as clickable links.\",\n extensions: [wikilinkPlugin, inlineScanRulesFacet.of(wikilinkScanRule)],\n};\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAI1B,MAAM,oBAAuC;AAAA,EAClD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY,CAAC,gBAAgB,qBAAqB,GAAG,gBAAgB,CAAC;AACxE;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Given/When/Then steps for the block-command feature files.
|
|
3
|
+
*
|
|
4
|
+
* The whole block-command surface has one regular shape — a document with a
|
|
5
|
+
* caret (or selection) goes in, a command runs, a document with a caret comes
|
|
6
|
+
* out — so these steps drive every scenario across the `.feature` files. They're
|
|
7
|
+
* registered once as a shared pool via {@link defineBlockSteps}; each scenario
|
|
8
|
+
* draws the steps it needs.
|
|
9
|
+
*
|
|
10
|
+
* Marker convention in the doc strings: `‸` marks the caret; a second `‸` turns
|
|
11
|
+
* it into a selection spanning the two marks. (`|` would collide with table
|
|
12
|
+
* syntax, so it's deliberately not used.)
|
|
13
|
+
*/
|
|
14
|
+
/** Zero-width space the runner prefixes onto doc-string content lines to hide
|
|
15
|
+
* literal markdown from the cucumber parser; stripped back out here. */
|
|
16
|
+
declare const ZWSP: string;
|
|
17
|
+
declare function defineBlockSteps(): void;
|
|
18
|
+
declare function protectMarkdown(raw: string): string;
|
|
19
|
+
|
|
20
|
+
export { ZWSP, defineBlockSteps, protectMarkdown };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { EditorSelection } from "@codemirror/state";
|
|
3
|
+
import { defineSteps } from "@amiceli/vitest-cucumber";
|
|
4
|
+
import { expect } from "vitest";
|
|
5
|
+
import { blockCommands } from "../format/index.js";
|
|
6
|
+
import { indentListItem, outdentListItem } from "../list/index.js";
|
|
7
|
+
import { makeEditor, text } from "../core/editorTestHarness.js";
|
|
8
|
+
const CARET = "\u2038";
|
|
9
|
+
const ZWSP = String.fromCharCode(8203);
|
|
10
|
+
const COMMANDS = {
|
|
11
|
+
"toggle heading 1": blockCommands.toggleHeading1,
|
|
12
|
+
"toggle heading 2": blockCommands.toggleHeading2,
|
|
13
|
+
"toggle heading 3": blockCommands.toggleHeading3,
|
|
14
|
+
"toggle a bullet list": blockCommands.toggleBulletList,
|
|
15
|
+
"toggle an ordered list": blockCommands.toggleOrderedList,
|
|
16
|
+
"toggle a task list": blockCommands.toggleTaskList,
|
|
17
|
+
"toggle a blockquote": blockCommands.toggleBlockquote,
|
|
18
|
+
"toggle a code block": blockCommands.toggleCodeBlock,
|
|
19
|
+
"insert a table": blockCommands.insertTable,
|
|
20
|
+
"indent the list item": indentListItem,
|
|
21
|
+
"outdent the list item": outdentListItem
|
|
22
|
+
};
|
|
23
|
+
function cleanDoc(block) {
|
|
24
|
+
return block.split(ZWSP).join("").replace(/\n+$/, "");
|
|
25
|
+
}
|
|
26
|
+
function parseMarked(marked) {
|
|
27
|
+
const first = marked.indexOf(CARET);
|
|
28
|
+
if (first < 0) return { doc: marked, anchor: 0, head: 0 };
|
|
29
|
+
const afterFirst = marked.slice(0, first) + marked.slice(first + CARET.length);
|
|
30
|
+
const second = afterFirst.indexOf(CARET);
|
|
31
|
+
if (second < 0) return { doc: afterFirst, anchor: first, head: first };
|
|
32
|
+
const doc = afterFirst.slice(0, second) + afterFirst.slice(second + CARET.length);
|
|
33
|
+
return { doc, anchor: first, head: second };
|
|
34
|
+
}
|
|
35
|
+
function renderMarked(view) {
|
|
36
|
+
const { anchor, head } = view.state.selection.main;
|
|
37
|
+
const body = text(view);
|
|
38
|
+
if (anchor === head) return body.slice(0, head) + CARET + body.slice(head);
|
|
39
|
+
const [from, to] = anchor < head ? [anchor, head] : [head, anchor];
|
|
40
|
+
return body.slice(0, from) + CARET + body.slice(from, to) + CARET + body.slice(to);
|
|
41
|
+
}
|
|
42
|
+
function defineBlockSteps() {
|
|
43
|
+
let view;
|
|
44
|
+
defineSteps(({ Given, When, Then, And }) => {
|
|
45
|
+
Given("the document:", (_ctx, doc) => {
|
|
46
|
+
const { doc: source, anchor, head } = parseMarked(cleanDoc(doc));
|
|
47
|
+
view = makeEditor(source, head);
|
|
48
|
+
if (anchor !== head) view.dispatch({ selection: EditorSelection.range(anchor, head) });
|
|
49
|
+
});
|
|
50
|
+
const run = (_ctx, phrase) => {
|
|
51
|
+
const command = COMMANDS[phrase];
|
|
52
|
+
if (!command) throw new Error(`no editor command bound for "${phrase}"`);
|
|
53
|
+
command(view);
|
|
54
|
+
};
|
|
55
|
+
When("I {string}", run);
|
|
56
|
+
And("I {string}", run);
|
|
57
|
+
Then("the document is:", (_ctx, expected) => {
|
|
58
|
+
const want = cleanDoc(expected);
|
|
59
|
+
expect(want.includes(CARET) ? renderMarked(view) : text(view)).toBe(want);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function protectMarkdown(raw) {
|
|
64
|
+
let insideDocString = false;
|
|
65
|
+
let baseIndent = 0;
|
|
66
|
+
return raw.split("\n").map((line) => {
|
|
67
|
+
const trimmed = line.trimStart();
|
|
68
|
+
if (trimmed.startsWith('"""')) {
|
|
69
|
+
if (!insideDocString) baseIndent = line.length - trimmed.length;
|
|
70
|
+
insideDocString = !insideDocString;
|
|
71
|
+
return line;
|
|
72
|
+
}
|
|
73
|
+
if (!insideDocString) return line;
|
|
74
|
+
const dedented = line.startsWith(" ".repeat(baseIndent)) ? line.slice(baseIndent) : trimmed;
|
|
75
|
+
return ZWSP + dedented;
|
|
76
|
+
}).join("\n");
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
ZWSP,
|
|
80
|
+
defineBlockSteps,
|
|
81
|
+
protectMarkdown
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=blockCommandSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/features/blockCommandSteps.ts"],"sourcesContent":["/**\n * Shared Given/When/Then steps for the block-command feature files.\n *\n * The whole block-command surface has one regular shape — a document with a\n * caret (or selection) goes in, a command runs, a document with a caret comes\n * out — so these steps drive every scenario across the `.feature` files. They're\n * registered once as a shared pool via {@link defineBlockSteps}; each scenario\n * draws the steps it needs.\n *\n * Marker convention in the doc strings: `‸` marks the caret; a second `‸` turns\n * it into a selection spanning the two marks. (`|` would collide with table\n * syntax, so it's deliberately not used.)\n */\n\nimport { EditorSelection } from \"@codemirror/state\";\nimport { type EditorView } from \"@codemirror/view\";\nimport { defineSteps } from \"@amiceli/vitest-cucumber\";\nimport { expect } from \"vitest\";\n\nimport { blockCommands } from \"../format\";\nimport { indentListItem, outdentListItem } from \"../list\";\nimport { makeEditor, text } from \"../core/editorTestHarness\";\n\nconst CARET = \"‸\";\n\n/** Zero-width space the runner prefixes onto doc-string content lines to hide\n * literal markdown from the cucumber parser; stripped back out here. */\nexport const ZWSP = String.fromCharCode(0x200b);\n\nconst COMMANDS: Record<string, (view: EditorView) => boolean> = {\n \"toggle heading 1\": blockCommands.toggleHeading1,\n \"toggle heading 2\": blockCommands.toggleHeading2,\n \"toggle heading 3\": blockCommands.toggleHeading3,\n \"toggle a bullet list\": blockCommands.toggleBulletList,\n \"toggle an ordered list\": blockCommands.toggleOrderedList,\n \"toggle a task list\": blockCommands.toggleTaskList,\n \"toggle a blockquote\": blockCommands.toggleBlockquote,\n \"toggle a code block\": blockCommands.toggleCodeBlock,\n \"insert a table\": blockCommands.insertTable,\n \"indent the list item\": indentListItem,\n \"outdent the list item\": outdentListItem,\n};\n\n// A Gherkin doc string reaches us with the runner's zero-width guards and the\n// parser's own per-line trim; drop the guards and any trailing blank line so the\n// literal markdown is what the scenario asserts against.\nfunction cleanDoc(block: string): string {\n return block\n .split(ZWSP)\n .join(\"\")\n .replace(/\\n+$/, \"\");\n}\n\n// `‸` → caret; a second `‸` → a selection from the first mark to the second.\nfunction parseMarked(marked: string): { doc: string; anchor: number; head: number } {\n const first = marked.indexOf(CARET);\n if (first < 0) return { doc: marked, anchor: 0, head: 0 };\n const afterFirst = marked.slice(0, first) + marked.slice(first + CARET.length);\n const second = afterFirst.indexOf(CARET);\n if (second < 0) return { doc: afterFirst, anchor: first, head: first };\n const doc = afterFirst.slice(0, second) + afterFirst.slice(second + CARET.length);\n return { doc, anchor: first, head: second };\n}\n\n// Re-insert the marker(s) at the current selection, so a `Then` doc string can\n// assert the resulting caret/selection as readably as it set the starting one.\nfunction renderMarked(view: EditorView): string {\n const { anchor, head } = view.state.selection.main;\n const body = text(view);\n if (anchor === head) return body.slice(0, head) + CARET + body.slice(head);\n const [from, to] = anchor < head ? [anchor, head] : [head, anchor];\n return body.slice(0, from) + CARET + body.slice(from, to) + CARET + body.slice(to);\n}\n\n// Register the shared step pool. Scenarios run sequentially within the file, so\n// a single live editor is enough to thread Given → When → Then.\nexport function defineBlockSteps(): void {\n let view: EditorView;\n\n defineSteps(({ Given, When, Then, And }) => {\n Given(\"the document:\", (_ctx: unknown, doc: string) => {\n const { doc: source, anchor, head } = parseMarked(cleanDoc(doc));\n view = makeEditor(source, head);\n if (anchor !== head) view.dispatch({ selection: EditorSelection.range(anchor, head) });\n });\n\n const run = (_ctx: unknown, phrase: string) => {\n const command = COMMANDS[phrase];\n if (!command) throw new Error(`no editor command bound for \"${phrase}\"`);\n command(view);\n };\n When(\"I {string}\", run);\n And(\"I {string}\", run);\n\n // A `Then` doc string opts into a caret assertion by including `‸`; without\n // one it asserts the document text alone.\n Then(\"the document is:\", (_ctx: unknown, expected: string) => {\n const want = cleanDoc(expected);\n expect(want.includes(CARET) ? renderMarked(view) : text(view)).toBe(want);\n });\n });\n}\n\n// The cucumber parser treats a `#`-leading line as a comment and a `\"\"\"`/``` line\n// as a doc-string delimiter — even *inside* a doc string — and it strips each\n// content line's leading whitespace, which would also flatten the *relative*\n// indent that list-nesting scenarios assert. So for every doc-string content\n// line: strip the doc string's own base indent (the opening `\"\"\"` column), then\n// prefix a zero-width space at column 0. The ZWSP is now the first character, so\n// the parser strips nothing (relative indent survives) and reads no `#`/`\"\"\"`/```\n// as syntax; the steps drop the ZWSP back out. Source `.feature` files stay clean.\nexport function protectMarkdown(raw: string): string {\n let insideDocString = false;\n let baseIndent = 0;\n return raw\n .split(\"\\n\")\n .map((line) => {\n const trimmed = line.trimStart();\n if (trimmed.startsWith('\"\"\"')) {\n if (!insideDocString) baseIndent = line.length - trimmed.length;\n insideDocString = !insideDocString;\n return line;\n }\n if (!insideDocString) return line;\n const dedented = line.startsWith(\" \".repeat(baseIndent))\n ? line.slice(baseIndent)\n : trimmed;\n return ZWSP + dedented;\n })\n .join(\"\\n\");\n}\n"],"mappings":"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","names":[]}
|