phormat 0.0.5
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/README.md +102 -0
- package/dist/assets/example-test.svelte +228 -0
- package/dist/debug/JsonDebug.svelte +19 -0
- package/dist/debug/JsonDebug.svelte.d.ts +6 -0
- package/dist/debug/JsonDebugNode.svelte +138 -0
- package/dist/debug/JsonDebugNode.svelte.d.ts +11 -0
- package/dist/demo/documentLifecycle.d.ts +57 -0
- package/dist/demo/documentLifecycle.js +196 -0
- package/dist/demo/index.d.ts +2 -0
- package/dist/demo/index.js +2 -0
- package/dist/editor/BlockEditor.svelte +112 -0
- package/dist/editor/BlockEditor.svelte.d.ts +7 -0
- package/dist/editor/BlockRow.svelte +76 -0
- package/dist/editor/BlockRow.svelte.d.ts +20 -0
- package/dist/editor/Editor.svelte +103 -0
- package/dist/editor/Editor.svelte.d.ts +7 -0
- package/dist/editor/MarkdownEditor.svelte.d.ts +160 -0
- package/dist/editor/MarkdownEditor.svelte.js +1119 -0
- package/dist/editor/NestedRowChrome.svelte +160 -0
- package/dist/editor/NestedRowChrome.svelte.d.ts +20 -0
- package/dist/editor/PhormatEditor.svelte +206 -0
- package/dist/editor/PhormatEditor.svelte.d.ts +26 -0
- package/dist/editor/RawMarkdownPanel.svelte +39 -0
- package/dist/editor/RawMarkdownPanel.svelte.d.ts +6 -0
- package/dist/editor/block-specs/BlockSpecMissing.svelte +12 -0
- package/dist/editor/block-specs/BlockSpecMissing.svelte.d.ts +7 -0
- package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte +32 -0
- package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/blockquote/commands.d.ts +2 -0
- package/dist/editor/block-specs/blockquote/commands.js +65 -0
- package/dist/editor/block-specs/blockquote/index.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/index.js +5 -0
- package/dist/editor/block-specs/blockquote/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/inlineSecondPass.js +35 -0
- package/dist/editor/block-specs/blockquote/parse.d.ts +16 -0
- package/dist/editor/block-specs/blockquote/parse.js +188 -0
- package/dist/editor/block-specs/blockquote/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/blockquote/reconcile.js +9 -0
- package/dist/editor/block-specs/blockquote/serialize.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/serialize.js +55 -0
- package/dist/editor/block-specs/blockquote/types.d.ts +20 -0
- package/dist/editor/block-specs/blockquote/types.js +1 -0
- package/dist/editor/block-specs/blockquoteSpec.d.ts +4 -0
- package/dist/editor/block-specs/blockquoteSpec.js +37 -0
- package/dist/editor/block-specs/callout/CalloutRenderer.svelte +38 -0
- package/dist/editor/block-specs/callout/CalloutRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte +14 -0
- package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte.d.ts +7 -0
- package/dist/editor/block-specs/callout/commands.d.ts +2 -0
- package/dist/editor/block-specs/callout/commands.js +65 -0
- package/dist/editor/block-specs/callout/icons.d.ts +10 -0
- package/dist/editor/block-specs/callout/icons.js +52 -0
- package/dist/editor/block-specs/callout/index.d.ts +9 -0
- package/dist/editor/block-specs/callout/index.js +7 -0
- package/dist/editor/block-specs/callout/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/callout/inlineSecondPass.js +9 -0
- package/dist/editor/block-specs/callout/parse.d.ts +9 -0
- package/dist/editor/block-specs/callout/parse.js +83 -0
- package/dist/editor/block-specs/callout/parseBody.d.ts +6 -0
- package/dist/editor/block-specs/callout/parseBody.js +290 -0
- package/dist/editor/block-specs/callout/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/callout/reconcile.js +8 -0
- package/dist/editor/block-specs/callout/serialize.d.ts +5 -0
- package/dist/editor/block-specs/callout/serialize.js +65 -0
- package/dist/editor/block-specs/callout/types.d.ts +7 -0
- package/dist/editor/block-specs/callout/types.js +1 -0
- package/dist/editor/block-specs/calloutSpec.d.ts +2 -0
- package/dist/editor/block-specs/calloutSpec.js +23 -0
- package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte +18 -0
- package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/codeFence/commands.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/commands.js +1 -0
- package/dist/editor/block-specs/codeFence/index.d.ts +5 -0
- package/dist/editor/block-specs/codeFence/index.js +4 -0
- package/dist/editor/block-specs/codeFence/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/codeFence/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/codeFence/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/reconcile.js +5 -0
- package/dist/editor/block-specs/codeFence/serialize.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/serialize.js +8 -0
- package/dist/editor/block-specs/codeFence/types.d.ts +6 -0
- package/dist/editor/block-specs/codeFence/types.js +1 -0
- package/dist/editor/block-specs/codeFenceSpec.d.ts +2 -0
- package/dist/editor/block-specs/codeFenceSpec.js +23 -0
- package/dist/editor/block-specs/columns/ColumnsRenderer.svelte +18 -0
- package/dist/editor/block-specs/columns/ColumnsRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/columns/EditableColumns.svelte +16 -0
- package/dist/editor/block-specs/columns/EditableColumns.svelte.d.ts +4 -0
- package/dist/editor/block-specs/columns/commands.d.ts +2 -0
- package/dist/editor/block-specs/columns/commands.js +1 -0
- package/dist/editor/block-specs/columns/index.d.ts +6 -0
- package/dist/editor/block-specs/columns/index.js +5 -0
- package/dist/editor/block-specs/columns/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/columns/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/columns/parse.d.ts +20 -0
- package/dist/editor/block-specs/columns/parse.js +111 -0
- package/dist/editor/block-specs/columns/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/columns/reconcile.js +6 -0
- package/dist/editor/block-specs/columns/serialize.d.ts +2 -0
- package/dist/editor/block-specs/columns/serialize.js +16 -0
- package/dist/editor/block-specs/columns/types.d.ts +4 -0
- package/dist/editor/block-specs/columns/types.js +1 -0
- package/dist/editor/block-specs/columnsSpec.d.ts +2 -0
- package/dist/editor/block-specs/columnsSpec.js +24 -0
- package/dist/editor/block-specs/heading/HeaderRenderer.svelte +30 -0
- package/dist/editor/block-specs/heading/HeaderRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/heading/commands.d.ts +2 -0
- package/dist/editor/block-specs/heading/commands.js +41 -0
- package/dist/editor/block-specs/heading/edit.d.ts +10 -0
- package/dist/editor/block-specs/heading/edit.js +33 -0
- package/dist/editor/block-specs/heading/index.d.ts +7 -0
- package/dist/editor/block-specs/heading/index.js +6 -0
- package/dist/editor/block-specs/heading/inlineSecondPass.d.ts +4 -0
- package/dist/editor/block-specs/heading/inlineSecondPass.js +20 -0
- package/dist/editor/block-specs/heading/parse.d.ts +5 -0
- package/dist/editor/block-specs/heading/parse.js +18 -0
- package/dist/editor/block-specs/heading/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/heading/reconcile.js +8 -0
- package/dist/editor/block-specs/heading/serialize.d.ts +2 -0
- package/dist/editor/block-specs/heading/serialize.js +9 -0
- package/dist/editor/block-specs/heading/types.d.ts +5 -0
- package/dist/editor/block-specs/heading/types.js +1 -0
- package/dist/editor/block-specs/headingSpec.d.ts +2 -0
- package/dist/editor/block-specs/headingSpec.js +28 -0
- package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte +15 -0
- package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/horizontalRule/commands.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/commands.js +1 -0
- package/dist/editor/block-specs/horizontalRule/index.d.ts +6 -0
- package/dist/editor/block-specs/horizontalRule/index.js +5 -0
- package/dist/editor/block-specs/horizontalRule/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/horizontalRule/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/horizontalRule/parse.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/parse.js +15 -0
- package/dist/editor/block-specs/horizontalRule/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/reconcile.js +5 -0
- package/dist/editor/block-specs/horizontalRule/serialize.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/serialize.js +3 -0
- package/dist/editor/block-specs/horizontalRule/types.d.ts +3 -0
- package/dist/editor/block-specs/horizontalRule/types.js +1 -0
- package/dist/editor/block-specs/horizontalRuleSpec.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRuleSpec.js +24 -0
- package/dist/editor/block-specs/list/ListRenderer.svelte +70 -0
- package/dist/editor/block-specs/list/ListRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/list/commands.d.ts +2 -0
- package/dist/editor/block-specs/list/commands.js +65 -0
- package/dist/editor/block-specs/list/index.d.ts +6 -0
- package/dist/editor/block-specs/list/index.js +5 -0
- package/dist/editor/block-specs/list/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/list/inlineSecondPass.js +78 -0
- package/dist/editor/block-specs/list/parse.d.ts +11 -0
- package/dist/editor/block-specs/list/parse.js +312 -0
- package/dist/editor/block-specs/list/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/list/reconcile.js +6 -0
- package/dist/editor/block-specs/list/serialize.d.ts +4 -0
- package/dist/editor/block-specs/list/serialize.js +83 -0
- package/dist/editor/block-specs/list/types.d.ts +27 -0
- package/dist/editor/block-specs/list/types.js +1 -0
- package/dist/editor/block-specs/listSpec.d.ts +4 -0
- package/dist/editor/block-specs/listSpec.js +24 -0
- package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte +22 -0
- package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/paragraph/commands.d.ts +2 -0
- package/dist/editor/block-specs/paragraph/commands.js +41 -0
- package/dist/editor/block-specs/paragraph/edit.d.ts +10 -0
- package/dist/editor/block-specs/paragraph/edit.js +69 -0
- package/dist/editor/block-specs/paragraph/index.d.ts +7 -0
- package/dist/editor/block-specs/paragraph/index.js +6 -0
- package/dist/editor/block-specs/paragraph/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/paragraph/inlineSecondPass.js +25 -0
- package/dist/editor/block-specs/paragraph/parse.d.ts +9 -0
- package/dist/editor/block-specs/paragraph/parse.js +76 -0
- package/dist/editor/block-specs/paragraph/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/paragraph/reconcile.js +9 -0
- package/dist/editor/block-specs/paragraph/serialize.d.ts +4 -0
- package/dist/editor/block-specs/paragraph/serialize.js +39 -0
- package/dist/editor/block-specs/paragraph/types.d.ts +10 -0
- package/dist/editor/block-specs/paragraph/types.js +1 -0
- package/dist/editor/block-specs/paragraphSpec.d.ts +2 -0
- package/dist/editor/block-specs/paragraphSpec.js +24 -0
- package/dist/editor/block-specs/registry.d.ts +10 -0
- package/dist/editor/block-specs/registry.js +34 -0
- package/dist/editor/block-specs/table/TableRenderer.svelte +53 -0
- package/dist/editor/block-specs/table/TableRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/table/commands.d.ts +2 -0
- package/dist/editor/block-specs/table/commands.js +1 -0
- package/dist/editor/block-specs/table/edit.d.ts +10 -0
- package/dist/editor/block-specs/table/edit.js +127 -0
- package/dist/editor/block-specs/table/editCommands.d.ts +18 -0
- package/dist/editor/block-specs/table/editCommands.js +87 -0
- package/dist/editor/block-specs/table/index.d.ts +8 -0
- package/dist/editor/block-specs/table/index.js +6 -0
- package/dist/editor/block-specs/table/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/table/inlineSecondPass.js +22 -0
- package/dist/editor/block-specs/table/parse.d.ts +17 -0
- package/dist/editor/block-specs/table/parse.js +181 -0
- package/dist/editor/block-specs/table/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/table/reconcile.js +6 -0
- package/dist/editor/block-specs/table/serialize.d.ts +3 -0
- package/dist/editor/block-specs/table/serialize.js +32 -0
- package/dist/editor/block-specs/table/types.d.ts +11 -0
- package/dist/editor/block-specs/table/types.js +1 -0
- package/dist/editor/block-specs/tableSpec.d.ts +2 -0
- package/dist/editor/block-specs/tableSpec.js +25 -0
- package/dist/editor/block-specs/toc/EditableToc.svelte +16 -0
- package/dist/editor/block-specs/toc/EditableToc.svelte.d.ts +4 -0
- package/dist/editor/block-specs/toc/TocRenderer.svelte +22 -0
- package/dist/editor/block-specs/toc/TocRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/toc/commands.d.ts +2 -0
- package/dist/editor/block-specs/toc/commands.js +1 -0
- package/dist/editor/block-specs/toc/index.d.ts +6 -0
- package/dist/editor/block-specs/toc/index.js +5 -0
- package/dist/editor/block-specs/toc/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/toc/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/toc/parse.d.ts +10 -0
- package/dist/editor/block-specs/toc/parse.js +43 -0
- package/dist/editor/block-specs/toc/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/toc/reconcile.js +5 -0
- package/dist/editor/block-specs/toc/serialize.d.ts +2 -0
- package/dist/editor/block-specs/toc/serialize.js +6 -0
- package/dist/editor/block-specs/toc/types.d.ts +8 -0
- package/dist/editor/block-specs/toc/types.js +1 -0
- package/dist/editor/block-specs/tocSpec.d.ts +2 -0
- package/dist/editor/block-specs/tocSpec.js +24 -0
- package/dist/editor/block-specs/toggle/ToggleRenderer.svelte +19 -0
- package/dist/editor/block-specs/toggle/ToggleRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/toggle/commands.d.ts +2 -0
- package/dist/editor/block-specs/toggle/commands.js +1 -0
- package/dist/editor/block-specs/toggle/index.d.ts +7 -0
- package/dist/editor/block-specs/toggle/index.js +5 -0
- package/dist/editor/block-specs/toggle/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/toggle/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/toggle/parse.d.ts +9 -0
- package/dist/editor/block-specs/toggle/parse.js +78 -0
- package/dist/editor/block-specs/toggle/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/toggle/reconcile.js +6 -0
- package/dist/editor/block-specs/toggle/serialize.d.ts +4 -0
- package/dist/editor/block-specs/toggle/serialize.js +13 -0
- package/dist/editor/block-specs/toggle/types.d.ts +5 -0
- package/dist/editor/block-specs/toggle/types.js +1 -0
- package/dist/editor/block-specs/toggleSpec.d.ts +2 -0
- package/dist/editor/block-specs/toggleSpec.js +24 -0
- package/dist/editor/block-specs/types.d.ts +26 -0
- package/dist/editor/block-specs/types.js +1 -0
- package/dist/editor/blocks/EditableBlockquote.svelte +52 -0
- package/dist/editor/blocks/EditableBlockquote.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableBlockquoteNodes.svelte +134 -0
- package/dist/editor/blocks/EditableBlockquoteNodes.svelte.d.ts +14 -0
- package/dist/editor/blocks/EditableBlockquoteParagraph.svelte +44 -0
- package/dist/editor/blocks/EditableBlockquoteParagraph.svelte.d.ts +12 -0
- package/dist/editor/blocks/EditableCallout.svelte +182 -0
- package/dist/editor/blocks/EditableCallout.svelte.d.ts +11 -0
- package/dist/editor/blocks/EditableCalloutListItemRow.svelte +169 -0
- package/dist/editor/blocks/EditableCalloutListItemRow.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableCalloutNodes.svelte +91 -0
- package/dist/editor/blocks/EditableCalloutNodes.svelte.d.ts +13 -0
- package/dist/editor/blocks/EditableCalloutParagraph.svelte +39 -0
- package/dist/editor/blocks/EditableCalloutParagraph.svelte.d.ts +12 -0
- package/dist/editor/blocks/EditableCodeBlock.svelte +43 -0
- package/dist/editor/blocks/EditableCodeBlock.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableHeading.svelte +161 -0
- package/dist/editor/blocks/EditableHeading.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableHorizontalRule.svelte +20 -0
- package/dist/editor/blocks/EditableHorizontalRule.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableInlineSurface.svelte +423 -0
- package/dist/editor/blocks/EditableInlineSurface.svelte.d.ts +26 -0
- package/dist/editor/blocks/EditableList.svelte +77 -0
- package/dist/editor/blocks/EditableList.svelte.d.ts +17 -0
- package/dist/editor/blocks/EditableListItemRow.svelte +231 -0
- package/dist/editor/blocks/EditableListItemRow.svelte.d.ts +19 -0
- package/dist/editor/blocks/EditableParagraph.svelte +208 -0
- package/dist/editor/blocks/EditableParagraph.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableParagraphNodes.svelte +89 -0
- package/dist/editor/blocks/EditableParagraphNodes.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableTable.svelte +83 -0
- package/dist/editor/blocks/EditableTable.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableTableCell.svelte +89 -0
- package/dist/editor/blocks/EditableTableCell.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableToggle.svelte +94 -0
- package/dist/editor/blocks/EditableToggle.svelte.d.ts +10 -0
- package/dist/editor/commandMenu.d.ts +18 -0
- package/dist/editor/commandMenu.js +83 -0
- package/dist/editor/commandRegistry.d.ts +48 -0
- package/dist/editor/commandRegistry.js +133 -0
- package/dist/editor/context/assetBaseUrl.d.ts +6 -0
- package/dist/editor/context/assetBaseUrl.js +20 -0
- package/dist/editor/dom/editorHistoryKeydown.d.ts +6 -0
- package/dist/editor/dom/editorHistoryKeydown.js +31 -0
- package/dist/editor/dom/plainEnterKeydown.d.ts +12 -0
- package/dist/editor/dom/plainEnterKeydown.js +53 -0
- package/dist/editor/dom/plaintextCaret.d.ts +12 -0
- package/dist/editor/dom/plaintextCaret.js +61 -0
- package/dist/editor/dom/syncDocumentSelectionFocus.d.ts +17 -0
- package/dist/editor/dom/syncDocumentSelectionFocus.js +56 -0
- package/dist/editor/draftPersistence.d.ts +27 -0
- package/dist/editor/draftPersistence.js +83 -0
- package/dist/editor/editorHistoryHandle.d.ts +16 -0
- package/dist/editor/editorHistoryHandle.js +22 -0
- package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte +174 -0
- package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte.d.ts +8 -0
- package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte +181 -0
- package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte.d.ts +3 -0
- package/dist/editor/inlineChrome/inlineChromeActions.d.ts +17 -0
- package/dist/editor/inlineChrome/inlineChromeActions.js +148 -0
- package/dist/editor/inlineChrome/inlineChromeState.svelte.d.ts +23 -0
- package/dist/editor/inlineChrome/inlineChromeState.svelte.js +21 -0
- package/dist/editor/inlineChrome/inlineToolbarIcons.d.ts +14 -0
- package/dist/editor/inlineChrome/inlineToolbarIcons.js +14 -0
- package/dist/editor/inlineChrome/inlineWrapActive.d.ts +3 -0
- package/dist/editor/inlineChrome/inlineWrapActive.js +19 -0
- package/dist/editor/inlineChrome/selectionRect.d.ts +2 -0
- package/dist/editor/inlineChrome/selectionRect.js +23 -0
- package/dist/editor/model/blockEditCommands.d.ts +73 -0
- package/dist/editor/model/blockEditCommands.js +719 -0
- package/dist/editor/model/blockTree.d.ts +39 -0
- package/dist/editor/model/blockTree.js +185 -0
- package/dist/editor/model/blockTreeDrop.d.ts +9 -0
- package/dist/editor/model/blockTreeDrop.js +295 -0
- package/dist/editor/model/blockTreeMutations.d.ts +10 -0
- package/dist/editor/model/blockTreeMutations.js +68 -0
- package/dist/editor/model/calloutEditCommands.d.ts +39 -0
- package/dist/editor/model/calloutEditCommands.js +305 -0
- package/dist/editor/model/documentSelection.d.ts +8 -0
- package/dist/editor/model/documentSelection.js +56 -0
- package/dist/editor/model/documentSelectionFromSource.d.ts +3 -0
- package/dist/editor/model/documentSelectionFromSource.js +45 -0
- package/dist/editor/model/documentToRenderBlocks.d.ts +3 -0
- package/dist/editor/model/documentToRenderBlocks.js +13 -0
- package/dist/editor/model/editorPipeline.bench.d.ts +1 -0
- package/dist/editor/model/editorPipeline.bench.js +27 -0
- package/dist/editor/model/editorTransactions.d.ts +20 -0
- package/dist/editor/model/editorTransactions.js +68 -0
- package/dist/editor/model/emptyParagraph.d.ts +11 -0
- package/dist/editor/model/emptyParagraph.js +25 -0
- package/dist/editor/model/enterCommands.d.ts +16 -0
- package/dist/editor/model/enterCommands.js +288 -0
- package/dist/editor/model/extensionSyntaxWarnings.d.ts +29 -0
- package/dist/editor/model/extensionSyntaxWarnings.js +122 -0
- package/dist/editor/model/findBlockAtSourceOffset.d.ts +3 -0
- package/dist/editor/model/findBlockAtSourceOffset.js +20 -0
- package/dist/editor/model/fixtures/serialization-fidelity/reorder-gaps.svelte +4 -0
- package/dist/editor/model/focusOutcome.d.ts +25 -0
- package/dist/editor/model/focusOutcome.js +1 -0
- package/dist/editor/model/incrementalReparse.d.ts +16 -0
- package/dist/editor/model/incrementalReparse.js +111 -0
- package/dist/editor/model/index.d.ts +22 -0
- package/dist/editor/model/index.js +19 -0
- package/dist/editor/model/inlineDraftCommit.d.ts +17 -0
- package/dist/editor/model/inlineDraftCommit.js +187 -0
- package/dist/editor/model/inlineDraftMerge.d.ts +8 -0
- package/dist/editor/model/inlineDraftMerge.js +81 -0
- package/dist/editor/model/inlineEditCommands.d.ts +28 -0
- package/dist/editor/model/inlineEditCommands.js +581 -0
- package/dist/editor/model/inlinePlain.d.ts +3 -0
- package/dist/editor/model/inlinePlain.js +28 -0
- package/dist/editor/model/inlineSecondPass.d.ts +4 -0
- package/dist/editor/model/inlineSecondPass.js +47 -0
- package/dist/editor/model/line-utils.d.ts +14 -0
- package/dist/editor/model/line-utils.js +38 -0
- package/dist/editor/model/listEditCommands.d.ts +56 -0
- package/dist/editor/model/listEditCommands.js +299 -0
- package/dist/editor/model/nestedContainerTransactions.d.ts +36 -0
- package/dist/editor/model/nestedContainerTransactions.js +336 -0
- package/dist/editor/model/parseMarkdownDocument.d.ts +2 -0
- package/dist/editor/model/parseMarkdownDocument.js +324 -0
- package/dist/editor/model/quoteEditCommands.d.ts +39 -0
- package/dist/editor/model/quoteEditCommands.js +323 -0
- package/dist/editor/model/reconcileBlockIds.d.ts +9 -0
- package/dist/editor/model/reconcileBlockIds.js +297 -0
- package/dist/editor/model/reparseOptions.d.ts +12 -0
- package/dist/editor/model/reparseOptions.js +1 -0
- package/dist/editor/model/resolveEnterPlainSnapshot.d.ts +6 -0
- package/dist/editor/model/resolveEnterPlainSnapshot.js +23 -0
- package/dist/editor/model/richInlines.d.ts +16 -0
- package/dist/editor/model/richInlines.js +494 -0
- package/dist/editor/model/serializeInlineNodes.d.ts +3 -0
- package/dist/editor/model/serializeInlineNodes.js +45 -0
- package/dist/editor/model/serializeMarkdownDocument.d.ts +30 -0
- package/dist/editor/model/serializeMarkdownDocument.js +150 -0
- package/dist/editor/model/structureParseWarnings.d.ts +10 -0
- package/dist/editor/model/structureParseWarnings.js +60 -0
- package/dist/editor/model/syntheticInlineRanges.d.ts +3 -0
- package/dist/editor/model/syntheticInlineRanges.js +36 -0
- package/dist/editor/model/types.d.ts +185 -0
- package/dist/editor/model/types.js +26 -0
- package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte +20 -0
- package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/autolinks/index.d.ts +2 -0
- package/dist/editor/plugins/autolinks/index.js +4 -0
- package/dist/editor/plugins/autolinks/parse-autolinks.d.ts +2 -0
- package/dist/editor/plugins/autolinks/parse-autolinks.js +68 -0
- package/dist/editor/plugins/autolinks/types.d.ts +6 -0
- package/dist/editor/plugins/autolinks/types.js +1 -0
- package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte +15 -0
- package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/emphasis/index.d.ts +2 -0
- package/dist/editor/plugins/emphasis/index.js +4 -0
- package/dist/editor/plugins/emphasis/parse-emphasis.d.ts +2 -0
- package/dist/editor/plugins/emphasis/parse-emphasis.js +188 -0
- package/dist/editor/plugins/emphasis/types.d.ts +24 -0
- package/dist/editor/plugins/emphasis/types.js +1 -0
- package/dist/editor/plugins/escaping/EscapingRenderer.svelte +18 -0
- package/dist/editor/plugins/escaping/EscapingRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/escaping/index.d.ts +2 -0
- package/dist/editor/plugins/escaping/index.js +4 -0
- package/dist/editor/plugins/escaping/parse-escaping.d.ts +6 -0
- package/dist/editor/plugins/escaping/parse-escaping.js +26 -0
- package/dist/editor/plugins/escaping/types.d.ts +10 -0
- package/dist/editor/plugins/escaping/types.js +1 -0
- package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte +25 -0
- package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/extended-task-list/index.d.ts +2 -0
- package/dist/editor/plugins/extended-task-list/index.js +4 -0
- package/dist/editor/plugins/extended-task-list/parse-extended-task-list.d.ts +2 -0
- package/dist/editor/plugins/extended-task-list/parse-extended-task-list.js +35 -0
- package/dist/editor/plugins/extended-task-list/types.d.ts +6 -0
- package/dist/editor/plugins/extended-task-list/types.js +1 -0
- package/dist/editor/plugins/highlight/HighlightRenderer.svelte +16 -0
- package/dist/editor/plugins/highlight/HighlightRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/highlight/index.d.ts +2 -0
- package/dist/editor/plugins/highlight/index.js +4 -0
- package/dist/editor/plugins/highlight/parse-highlights.d.ts +4 -0
- package/dist/editor/plugins/highlight/parse-highlights.js +49 -0
- package/dist/editor/plugins/highlight/types.d.ts +6 -0
- package/dist/editor/plugins/highlight/types.js +1 -0
- package/dist/editor/plugins/index.d.ts +1 -0
- package/dist/editor/plugins/index.js +1 -0
- package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte +53 -0
- package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/links-images/index.d.ts +2 -0
- package/dist/editor/plugins/links-images/index.js +4 -0
- package/dist/editor/plugins/links-images/parse-image-layout.d.ts +28 -0
- package/dist/editor/plugins/links-images/parse-image-layout.js +147 -0
- package/dist/editor/plugins/links-images/parse-links-images.d.ts +25 -0
- package/dist/editor/plugins/links-images/parse-links-images.js +236 -0
- package/dist/editor/plugins/links-images/resolve-asset-url.d.ts +5 -0
- package/dist/editor/plugins/links-images/resolve-asset-url.js +21 -0
- package/dist/editor/plugins/links-images/types.d.ts +11 -0
- package/dist/editor/plugins/links-images/types.js +1 -0
- package/dist/editor/plugins/mention/MentionRenderer.svelte +18 -0
- package/dist/editor/plugins/mention/MentionRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/mention/index.d.ts +2 -0
- package/dist/editor/plugins/mention/index.js +4 -0
- package/dist/editor/plugins/mention/parse-mentions.d.ts +2 -0
- package/dist/editor/plugins/mention/parse-mentions.js +54 -0
- package/dist/editor/plugins/mention/types.d.ts +14 -0
- package/dist/editor/plugins/mention/types.js +1 -0
- package/dist/editor/plugins/raw-text/RawTextRenderer.svelte +19 -0
- package/dist/editor/plugins/raw-text/RawTextRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/raw-text/index.d.ts +2 -0
- package/dist/editor/plugins/raw-text/index.js +4 -0
- package/dist/editor/plugins/raw-text/types.d.ts +4 -0
- package/dist/editor/plugins/raw-text/types.js +1 -0
- package/dist/editor/plugins/shared/InlineNodes.svelte +113 -0
- package/dist/editor/plugins/shared/InlineNodes.svelte.d.ts +21 -0
- package/dist/editor/plugins/shared/InlineNodesEdit.svelte +78 -0
- package/dist/editor/plugins/shared/InlineNodesEdit.svelte.d.ts +21 -0
- package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte +9 -0
- package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/strikethrough/index.d.ts +2 -0
- package/dist/editor/plugins/strikethrough/index.js +4 -0
- package/dist/editor/plugins/strikethrough/parse-strikethrough.d.ts +3 -0
- package/dist/editor/plugins/strikethrough/parse-strikethrough.js +38 -0
- package/dist/editor/plugins/strikethrough/types.d.ts +4 -0
- package/dist/editor/plugins/strikethrough/types.js +1 -0
- package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte +16 -0
- package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/synced-block/index.d.ts +2 -0
- package/dist/editor/plugins/synced-block/index.js +4 -0
- package/dist/editor/plugins/synced-block/parse-synced-blocks.d.ts +2 -0
- package/dist/editor/plugins/synced-block/parse-synced-blocks.js +15 -0
- package/dist/editor/plugins/synced-block/types.d.ts +4 -0
- package/dist/editor/plugins/synced-block/types.js +1 -0
- package/dist/editor/plugins/types.d.ts +19 -0
- package/dist/editor/plugins/types.js +1 -0
- package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte +15 -0
- package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/wiki-link/index.d.ts +2 -0
- package/dist/editor/plugins/wiki-link/index.js +4 -0
- package/dist/editor/plugins/wiki-link/parse-wiki-links.d.ts +2 -0
- package/dist/editor/plugins/wiki-link/parse-wiki-links.js +30 -0
- package/dist/editor/plugins/wiki-link/types.d.ts +8 -0
- package/dist/editor/plugins/wiki-link/types.js +1 -0
- package/dist/editor/taskCheckboxStates.d.ts +5 -0
- package/dist/editor/taskCheckboxStates.js +28 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/styles/index.css +6 -0
- package/package.json +84 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ColumnsBlock } from './types';
|
|
2
|
+
declare const columnsRenderer: (block: ColumnsBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { columnsRenderer };
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const ColumnsRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type ColumnsRenderer = InstanceType<typeof ColumnsRenderer>;
|
|
21
|
+
export default ColumnsRenderer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BlockEditProps } from '../types';
|
|
3
|
+
import type { ColumnsBlock } from './types';
|
|
4
|
+
import { columnsRenderer } from './ColumnsRenderer.svelte';
|
|
5
|
+
|
|
6
|
+
let { block }: BlockEditProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div class="rounded-md border border-border-muted/80 bg-surface-base/20 p-2">
|
|
10
|
+
<p class="mb-1 text-xs text-txt-tertiary">Columns</p>
|
|
11
|
+
<p class="mb-2 text-xs text-txt-tertiary">
|
|
12
|
+
Parsed for preview; Markdown is kept verbatim on export. Structured column editing is not
|
|
13
|
+
implemented yet—duplicate the block and edit the raw segment if needed.
|
|
14
|
+
</p>
|
|
15
|
+
{@render columnsRenderer(block.data as ColumnsBlock)}
|
|
16
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const columnsCommands = [];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { columnsCommands } from './commands';
|
|
2
|
+
export { applyColumnsInlineSecondPass } from './inlineSecondPass';
|
|
3
|
+
export { COLUMN_LINE_SCANNER, parseColumns, tryParseColumnsAt } from './parse';
|
|
4
|
+
export { columnsReconcileFingerprint } from './reconcile';
|
|
5
|
+
export { serializeColumnsBlock } from './serialize';
|
|
6
|
+
export type { ColumnsBlock } from './types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { columnsCommands } from './commands';
|
|
2
|
+
export { applyColumnsInlineSecondPass } from './inlineSecondPass';
|
|
3
|
+
export { COLUMN_LINE_SCANNER, parseColumns, tryParseColumnsAt } from './parse';
|
|
4
|
+
export { columnsReconcileFingerprint } from './reconcile';
|
|
5
|
+
export { serializeColumnsBlock } from './serialize';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RichInlineContext } from '../../model/richInlines';
|
|
2
|
+
import type { EditorBlock } from '../../model/types';
|
|
3
|
+
export declare function applyColumnsInlineSecondPass(block: EditorBlock, _source: string, _insideBlockquote: boolean, _ctx: RichInlineContext): EditorBlock;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type LineRow } from '../../model/line-utils';
|
|
2
|
+
import type { EditorBlock } from '../../model/types';
|
|
3
|
+
import type { ColumnsBlock } from './types';
|
|
4
|
+
/** Column segments per md-spec (`|||`). */
|
|
5
|
+
export declare const COLUMN_LINE_SCANNER: RegExp;
|
|
6
|
+
/**
|
|
7
|
+
* Column sections per docs/md-spec.md: lines starting with `|||`.
|
|
8
|
+
* A line that is only `|||` (optional whitespace after) closes the block.
|
|
9
|
+
* Without a closing line, the last column runs to EOF.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseColumns(source: string): ColumnsBlock[];
|
|
12
|
+
type FencedScanResult = {
|
|
13
|
+
openLine: number;
|
|
14
|
+
closeLine: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function tryParseColumnsAt(i: number, rows: LineRow[], source: string, fenceAtOpenLine: Map<number, FencedScanResult>): {
|
|
17
|
+
nextLine: number;
|
|
18
|
+
block: EditorBlock;
|
|
19
|
+
} | null;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { afterLineTerminator } from '../../model/line-utils';
|
|
2
|
+
import { stableBlockId } from '../../model/types';
|
|
3
|
+
/** Line starts a column segment: `|||` plus optional rest (same-line content). */
|
|
4
|
+
const COLUMN_LINE = /^\|\|\|(.*)$/;
|
|
5
|
+
/** Column segments per md-spec (`|||`). */
|
|
6
|
+
export const COLUMN_LINE_SCANNER = /^\s*\|\|\|\s*(.*)$/;
|
|
7
|
+
function trimColumn(text) {
|
|
8
|
+
return text.trimEnd();
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Column sections per docs/md-spec.md: lines starting with `|||`.
|
|
12
|
+
* A line that is only `|||` (optional whitespace after) closes the block.
|
|
13
|
+
* Without a closing line, the last column runs to EOF.
|
|
14
|
+
*/
|
|
15
|
+
export function parseColumns(source) {
|
|
16
|
+
const lines = source.split(/\r?\n/);
|
|
17
|
+
const out = [];
|
|
18
|
+
let i = 0;
|
|
19
|
+
while (i < lines.length) {
|
|
20
|
+
const startMatch = lines[i].match(COLUMN_LINE);
|
|
21
|
+
if (!startMatch) {
|
|
22
|
+
i++;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const startLineIndex = i;
|
|
26
|
+
let current = (startMatch[1] ?? '').replace(/^\s+/, '');
|
|
27
|
+
i++;
|
|
28
|
+
const columns = [];
|
|
29
|
+
let closedWithBare = false;
|
|
30
|
+
while (i < lines.length) {
|
|
31
|
+
const line = lines[i];
|
|
32
|
+
const delim = line.match(COLUMN_LINE);
|
|
33
|
+
if (delim) {
|
|
34
|
+
const rest = delim[1] ?? '';
|
|
35
|
+
if (/^\s*$/.test(rest)) {
|
|
36
|
+
columns.push(trimColumn(current));
|
|
37
|
+
closedWithBare = true;
|
|
38
|
+
i++;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
columns.push(trimColumn(current));
|
|
42
|
+
current = rest.replace(/^\s+/, '');
|
|
43
|
+
i++;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
current = current.length ? `${current}\n${line}` : line;
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
if (!closedWithBare) {
|
|
50
|
+
columns.push(trimColumn(current));
|
|
51
|
+
}
|
|
52
|
+
out.push({ columns, startLineIndex });
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
export function tryParseColumnsAt(i, rows, source, fenceAtOpenLine) {
|
|
57
|
+
const row = rows[i];
|
|
58
|
+
if (!row || fenceAtOpenLine.has(i))
|
|
59
|
+
return null;
|
|
60
|
+
const startMatch = row.line.match(COLUMN_LINE_SCANNER);
|
|
61
|
+
if (!startMatch)
|
|
62
|
+
return null;
|
|
63
|
+
let current = (startMatch[1] ?? '').replace(/^\s+/, '');
|
|
64
|
+
let j = i + 1;
|
|
65
|
+
const columns = [];
|
|
66
|
+
let closedWithBare = false;
|
|
67
|
+
while (j < rows.length) {
|
|
68
|
+
if (fenceAtOpenLine.has(j))
|
|
69
|
+
break;
|
|
70
|
+
const line = rows[j].line;
|
|
71
|
+
const delim = line.match(COLUMN_LINE_SCANNER);
|
|
72
|
+
if (delim) {
|
|
73
|
+
const rest = delim[1] ?? '';
|
|
74
|
+
if (/^\s*$/.test(rest)) {
|
|
75
|
+
columns.push(trimColumn(current));
|
|
76
|
+
closedWithBare = true;
|
|
77
|
+
j++;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
columns.push(trimColumn(current));
|
|
81
|
+
current = rest.replace(/^\s+/, '');
|
|
82
|
+
j++;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
current = current.length ? `${current}\n${line}` : line;
|
|
86
|
+
j++;
|
|
87
|
+
}
|
|
88
|
+
if (!closedWithBare) {
|
|
89
|
+
columns.push(trimColumn(current));
|
|
90
|
+
}
|
|
91
|
+
const endLine = j - 1;
|
|
92
|
+
const sourceRange = {
|
|
93
|
+
start: row.start,
|
|
94
|
+
end: afterLineTerminator(source, rows[endLine]),
|
|
95
|
+
startLine: i,
|
|
96
|
+
endLine
|
|
97
|
+
};
|
|
98
|
+
const data = {
|
|
99
|
+
columns,
|
|
100
|
+
startLineIndex: i
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
nextLine: j,
|
|
104
|
+
block: {
|
|
105
|
+
type: 'columns',
|
|
106
|
+
id: stableBlockId('columns', sourceRange),
|
|
107
|
+
sourceRange,
|
|
108
|
+
data
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function serializeColumnsBlock(block) {
|
|
2
|
+
if (block.type !== 'columns') {
|
|
3
|
+
throw new Error('serializeColumnsBlock expects a columns block');
|
|
4
|
+
}
|
|
5
|
+
const d = block.data;
|
|
6
|
+
const out = [];
|
|
7
|
+
for (const col of d.columns) {
|
|
8
|
+
const ls = col.split('\n');
|
|
9
|
+
out.push(`||| ${ls[0] ?? ''}`.trimEnd());
|
|
10
|
+
for (let i = 1; i < ls.length; i++) {
|
|
11
|
+
out.push(ls[i]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
out.push('|||');
|
|
15
|
+
return out.join('\n');
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import EditableColumns from './columns/EditableColumns.svelte';
|
|
2
|
+
import { columnsCommands } from './columns/commands';
|
|
3
|
+
import { applyColumnsInlineSecondPass } from './columns/inlineSecondPass';
|
|
4
|
+
import { parseColumns, tryParseColumnsAt } from './columns/parse';
|
|
5
|
+
import { columnsReconcileFingerprint } from './columns/reconcile';
|
|
6
|
+
import { serializeColumnsBlock } from './columns/serialize';
|
|
7
|
+
import { columnsRenderer } from './columns/ColumnsRenderer.svelte';
|
|
8
|
+
export const columnsSpec = {
|
|
9
|
+
type: 'columns',
|
|
10
|
+
id: 'columns',
|
|
11
|
+
render: columnsRenderer,
|
|
12
|
+
editComponent: EditableColumns,
|
|
13
|
+
parse: { parseColumns, tryParseColumnsAt },
|
|
14
|
+
serialize: serializeColumnsBlock,
|
|
15
|
+
applyInlineSecondPass: applyColumnsInlineSecondPass,
|
|
16
|
+
reconcileFingerprint: columnsReconcileFingerprint,
|
|
17
|
+
commands: columnsCommands,
|
|
18
|
+
toRenderBlock: (block) => ({
|
|
19
|
+
id: block.id,
|
|
20
|
+
pluginId: 'columns',
|
|
21
|
+
data: block.data,
|
|
22
|
+
render: columnsRenderer
|
|
23
|
+
})
|
|
24
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { EditorBlock } from '../../model/types';
|
|
3
|
+
import { inlineNodesSnippet } from '../../plugins/shared/InlineNodes.svelte';
|
|
4
|
+
import type { HeaderBlock } from './types';
|
|
5
|
+
|
|
6
|
+
const levelClass: Record<HeaderBlock['level'], string> = {
|
|
7
|
+
1: 'mb-4 text-2xl font-semibold tracking-tight text-txt-primary',
|
|
8
|
+
2: 'mb-3 text-xl font-semibold tracking-tight text-txt-primary',
|
|
9
|
+
3: 'mb-3 text-lg font-semibold text-txt-primary',
|
|
10
|
+
4: 'mb-2 text-base font-semibold text-txt-primary',
|
|
11
|
+
5: 'mb-2 text-sm font-semibold text-txt-secondary',
|
|
12
|
+
6: 'mb-2 text-xs font-semibold text-txt-tertiary'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { headerRenderer };
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#snippet headerRenderer(block: EditorBlock)}
|
|
19
|
+
{@const hb = block.data as HeaderBlock}
|
|
20
|
+
<svelte:element
|
|
21
|
+
this={`h${hb.level}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'}
|
|
22
|
+
class={levelClass[hb.level]}
|
|
23
|
+
>
|
|
24
|
+
{#if block.inlines && block.inlines.length > 0}
|
|
25
|
+
{@render inlineNodesSnippet(block.inlines)}
|
|
26
|
+
{:else}
|
|
27
|
+
{hb.text}
|
|
28
|
+
{/if}
|
|
29
|
+
</svelte:element>
|
|
30
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EditorBlock } from '../../model/types';
|
|
2
|
+
declare const headerRenderer: (block: EditorBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { headerRenderer };
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const HeaderRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type HeaderRenderer = InstanceType<typeof HeaderRenderer>;
|
|
21
|
+
export default HeaderRenderer;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function headingLevels() {
|
|
2
|
+
return [1, 2, 3];
|
|
3
|
+
}
|
|
4
|
+
export const headingCommands = [
|
|
5
|
+
{
|
|
6
|
+
id: 'convertHeadingToParagraph',
|
|
7
|
+
label: 'Paragraph',
|
|
8
|
+
group: 'turnInto',
|
|
9
|
+
surfaces: ['slash', 'blockMenu'],
|
|
10
|
+
blockTypes: ['heading'],
|
|
11
|
+
slashKinds: ['heading'],
|
|
12
|
+
isEnabled: () => true,
|
|
13
|
+
run: (ctx) => {
|
|
14
|
+
ctx.editor.convertHeadingToParagraphAt(ctx.blockIndex);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
...headingLevels().map((level) => ({
|
|
18
|
+
id: `convertHeadingLevel${level}`,
|
|
19
|
+
label: `Heading ${level}`,
|
|
20
|
+
group: 'turnInto',
|
|
21
|
+
surfaces: ['slash', 'blockMenu'],
|
|
22
|
+
blockTypes: ['heading'],
|
|
23
|
+
slashKinds: ['heading'],
|
|
24
|
+
isEnabled: () => true,
|
|
25
|
+
run: (ctx) => {
|
|
26
|
+
ctx.editor.convertHeadingLevelAt(ctx.blockIndex, level);
|
|
27
|
+
}
|
|
28
|
+
})),
|
|
29
|
+
{
|
|
30
|
+
id: 'turnIntoTableFromHeading',
|
|
31
|
+
label: 'Table',
|
|
32
|
+
group: 'turnInto',
|
|
33
|
+
surfaces: ['slash', 'blockMenu'],
|
|
34
|
+
blockTypes: ['heading'],
|
|
35
|
+
slashKinds: ['heading'],
|
|
36
|
+
isEnabled: () => true,
|
|
37
|
+
run: (ctx) => {
|
|
38
|
+
ctx.editor.convertBlockToTableAt(ctx.blockIndex);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EditorBlock } from '../../model/types';
|
|
2
|
+
/** Plain heading body for editing (prefers inline AST). */
|
|
3
|
+
export declare function headingDisplayPlain(block: EditorBlock): string;
|
|
4
|
+
export declare function headingMarkdown(level: number, text: string): string;
|
|
5
|
+
/** Absolute source offsets of the heading body (after `#… ` prefix). */
|
|
6
|
+
export declare function headingBodySourceRange(block: EditorBlock, source: string): {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function headingPlainOffsetToSourceOffset(block: EditorBlock, source: string, plainOffset: number): number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { inlineNodesToPlainText } from '../../model/inlinePlain';
|
|
2
|
+
/** Plain heading body for editing (prefers inline AST). */
|
|
3
|
+
export function headingDisplayPlain(block) {
|
|
4
|
+
if (block.type !== 'heading')
|
|
5
|
+
return '';
|
|
6
|
+
if (block.inlines?.length)
|
|
7
|
+
return inlineNodesToPlainText(block.inlines);
|
|
8
|
+
return block.data.text;
|
|
9
|
+
}
|
|
10
|
+
export function headingMarkdown(level, text) {
|
|
11
|
+
return `${'#'.repeat(level)} ${text}`;
|
|
12
|
+
}
|
|
13
|
+
/** Absolute source offsets of the heading body (after `#… ` prefix). */
|
|
14
|
+
export function headingBodySourceRange(block, source) {
|
|
15
|
+
const slice = source.slice(block.sourceRange.start, block.sourceRange.end);
|
|
16
|
+
const m = slice.match(/^(\s*)(#{1,6})([ \t]+)([\s\S]*)$/);
|
|
17
|
+
const hb = block.data;
|
|
18
|
+
if (!m) {
|
|
19
|
+
const fallbackLen = hb.text.length;
|
|
20
|
+
return {
|
|
21
|
+
start: block.sourceRange.end - fallbackLen,
|
|
22
|
+
end: block.sourceRange.end
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const openLen = m[1].length + m[2].length + m[3].length;
|
|
26
|
+
const absStart = block.sourceRange.start + openLen;
|
|
27
|
+
const absEnd = absStart + hb.text.length;
|
|
28
|
+
return { start: absStart, end: absEnd };
|
|
29
|
+
}
|
|
30
|
+
export function headingPlainOffsetToSourceOffset(block, source, plainOffset) {
|
|
31
|
+
const { start } = headingBodySourceRange(block, source);
|
|
32
|
+
return start + plainOffset;
|
|
33
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { headingCommands } from './commands';
|
|
2
|
+
export { headingBodySourceRange, headingDisplayPlain, headingMarkdown, headingPlainOffsetToSourceOffset } from './edit';
|
|
3
|
+
export { applyHeadingInlineSecondPass } from './inlineSecondPass';
|
|
4
|
+
export { ATX_HEADING, parseHeadings, stripClosingHashes } from './parse';
|
|
5
|
+
export { headingReconcileFingerprint } from './reconcile';
|
|
6
|
+
export { serializeHeadingBlock } from './serialize';
|
|
7
|
+
export type { HeaderBlock } from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { headingCommands } from './commands';
|
|
2
|
+
export { headingBodySourceRange, headingDisplayPlain, headingMarkdown, headingPlainOffsetToSourceOffset } from './edit';
|
|
3
|
+
export { applyHeadingInlineSecondPass } from './inlineSecondPass';
|
|
4
|
+
export { ATX_HEADING, parseHeadings, stripClosingHashes } from './parse';
|
|
5
|
+
export { headingReconcileFingerprint } from './reconcile';
|
|
6
|
+
export { serializeHeadingBlock } from './serialize';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorBlock } from '../../model/types';
|
|
2
|
+
import { type RichInlineContext } from '../../model/richInlines';
|
|
3
|
+
import type { LineRow } from '../../model/line-utils';
|
|
4
|
+
export declare function applyHeadingInlineSecondPass(block: EditorBlock, source: string, rows: LineRow[], ctx: RichInlineContext): EditorBlock;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildRichInlinesForRange } from '../../model/richInlines';
|
|
2
|
+
import { ATX_HEADING } from './parse';
|
|
3
|
+
export function applyHeadingInlineSecondPass(block, source, rows, ctx) {
|
|
4
|
+
if (block.type !== 'heading')
|
|
5
|
+
return block;
|
|
6
|
+
const hb = block.data;
|
|
7
|
+
const row = rows[hb.lineIndex];
|
|
8
|
+
if (!row)
|
|
9
|
+
return { ...block };
|
|
10
|
+
const m = row.line.match(ATX_HEADING);
|
|
11
|
+
if (!m)
|
|
12
|
+
return { ...block };
|
|
13
|
+
const open = m[1].length + m[2].length + m[3].length;
|
|
14
|
+
const absStart = row.start + open;
|
|
15
|
+
const absEnd = absStart + hb.text.length;
|
|
16
|
+
return {
|
|
17
|
+
...block,
|
|
18
|
+
inlines: buildRichInlinesForRange(source, absStart, absEnd, ctx)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HeaderBlock } from './types';
|
|
2
|
+
/** ATX heading: optional leading whitespace, 1–6 `#`, space/tab, rest of line. */
|
|
3
|
+
export declare const ATX_HEADING: RegExp;
|
|
4
|
+
export declare function stripClosingHashes(content: string): string;
|
|
5
|
+
export declare function parseHeadings(source: string): HeaderBlock[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** ATX heading: optional leading whitespace, 1–6 `#`, space/tab, rest of line. */
|
|
2
|
+
export const ATX_HEADING = /^(\s*)(#{1,6})([ \t]+)(.*)$/;
|
|
3
|
+
export function stripClosingHashes(content) {
|
|
4
|
+
return content.replace(/\s+(?:#)+\s*$/, '').trimEnd();
|
|
5
|
+
}
|
|
6
|
+
export function parseHeadings(source) {
|
|
7
|
+
const lines = source.split(/\r?\n/);
|
|
8
|
+
const out = [];
|
|
9
|
+
for (let i = 0; i < lines.length; i++) {
|
|
10
|
+
const match = lines[i].match(ATX_HEADING);
|
|
11
|
+
if (!match)
|
|
12
|
+
continue;
|
|
13
|
+
const level = match[2].length;
|
|
14
|
+
const text = stripClosingHashes(match[4]).trim();
|
|
15
|
+
out.push({ level, text, lineIndex: i });
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { inlineNodesToPlainText } from '../../model/inlinePlain';
|
|
2
|
+
export function headingReconcileFingerprint(block) {
|
|
3
|
+
if (block.type !== 'heading')
|
|
4
|
+
return '';
|
|
5
|
+
if (block.inlines?.length)
|
|
6
|
+
return inlineNodesToPlainText(block.inlines);
|
|
7
|
+
return block.data.text;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { serializeInlineNodes } from '../../model/serializeInlineNodes';
|
|
2
|
+
export function serializeHeadingBlock(block) {
|
|
3
|
+
if (block.type !== 'heading') {
|
|
4
|
+
throw new Error('serializeHeadingBlock expects a heading block');
|
|
5
|
+
}
|
|
6
|
+
const d = block.data;
|
|
7
|
+
const body = block.inlines && block.inlines.length > 0 ? serializeInlineNodes(block.inlines) : d.text;
|
|
8
|
+
return `${'#'.repeat(d.level)} ${body}`;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import EditableHeading from '../blocks/EditableHeading.svelte';
|
|
2
|
+
import { splitLinesWithOffsets } from '../model/line-utils';
|
|
3
|
+
import { headingCommands } from './heading/commands';
|
|
4
|
+
import { applyHeadingInlineSecondPass } from './heading/inlineSecondPass';
|
|
5
|
+
import { ATX_HEADING, parseHeadings, stripClosingHashes } from './heading/parse';
|
|
6
|
+
import { headingReconcileFingerprint } from './heading/reconcile';
|
|
7
|
+
import { serializeHeadingBlock } from './heading/serialize';
|
|
8
|
+
import { headerRenderer } from './heading/HeaderRenderer.svelte';
|
|
9
|
+
export const headingSpec = {
|
|
10
|
+
type: 'heading',
|
|
11
|
+
id: 'header',
|
|
12
|
+
render: headerRenderer,
|
|
13
|
+
editComponent: EditableHeading,
|
|
14
|
+
parse: { ATX_HEADING, parseHeadings, stripClosingHashes },
|
|
15
|
+
serialize: serializeHeadingBlock,
|
|
16
|
+
applyInlineSecondPass: (block, source, _insideBlockquote, ctx) => {
|
|
17
|
+
void _insideBlockquote;
|
|
18
|
+
return applyHeadingInlineSecondPass(block, source, splitLinesWithOffsets(source), ctx);
|
|
19
|
+
},
|
|
20
|
+
reconcileFingerprint: headingReconcileFingerprint,
|
|
21
|
+
commands: headingCommands,
|
|
22
|
+
toRenderBlock: (block) => ({
|
|
23
|
+
id: block.id,
|
|
24
|
+
pluginId: 'header',
|
|
25
|
+
data: block,
|
|
26
|
+
render: headerRenderer
|
|
27
|
+
})
|
|
28
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export { horizontalRuleRenderer };
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import type { HorizontalRuleBlock } from './types';
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
{#snippet horizontalRuleRenderer(block: HorizontalRuleBlock)}
|
|
10
|
+
<hr
|
|
11
|
+
class="my-4 border-0 border-t border-border-emphasis"
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
data-source-line={block.lineIndex}
|
|
14
|
+
/>
|
|
15
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { horizontalRuleRenderer };
|
|
2
|
+
import type { HorizontalRuleBlock } from './types';
|
|
3
|
+
declare const horizontalRuleRenderer: (block: HorizontalRuleBlock) => ReturnType<import("svelte").Snippet>;
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const HorizontalRuleRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type HorizontalRuleRenderer = InstanceType<typeof HorizontalRuleRenderer>;
|
|
21
|
+
export default HorizontalRuleRenderer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const horizontalRuleCommands = [];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { horizontalRuleCommands } from './commands';
|
|
2
|
+
export { applyHorizontalRuleInlineSecondPass } from './inlineSecondPass';
|
|
3
|
+
export { isHorizontalRuleLine, parseHorizontalRules } from './parse';
|
|
4
|
+
export { horizontalRuleReconcileFingerprint } from './reconcile';
|
|
5
|
+
export { serializeHorizontalRuleBlock } from './serialize';
|
|
6
|
+
export type { HorizontalRuleBlock } from './types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { horizontalRuleCommands } from './commands';
|
|
2
|
+
export { applyHorizontalRuleInlineSecondPass } from './inlineSecondPass';
|
|
3
|
+
export { isHorizontalRuleLine, parseHorizontalRules } from './parse';
|
|
4
|
+
export { horizontalRuleReconcileFingerprint } from './reconcile';
|
|
5
|
+
export { serializeHorizontalRuleBlock } from './serialize';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RichInlineContext } from '../../model/richInlines';
|
|
2
|
+
import type { EditorBlock } from '../../model/types';
|
|
3
|
+
export declare function applyHorizontalRuleInlineSecondPass(block: EditorBlock, _source: string, _insideBlockquote: boolean, _ctx: RichInlineContext): EditorBlock;
|