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,113 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { InlineNode } from '../../model/types';
|
|
3
|
+
import { hrefForDisplay } from '../../context/assetBaseUrl.js';
|
|
4
|
+
import { imageLayoutCss } from '../links-images/parse-image-layout.js';
|
|
5
|
+
|
|
6
|
+
function inlinePlain(nodes: InlineNode[]): string {
|
|
7
|
+
let s = '';
|
|
8
|
+
for (const n of nodes) {
|
|
9
|
+
switch (n.type) {
|
|
10
|
+
case 'text':
|
|
11
|
+
case 'code':
|
|
12
|
+
s += n.text;
|
|
13
|
+
break;
|
|
14
|
+
case 'autolink':
|
|
15
|
+
s += n.href;
|
|
16
|
+
break;
|
|
17
|
+
case 'wikiLink':
|
|
18
|
+
s += n.label;
|
|
19
|
+
break;
|
|
20
|
+
case 'mention':
|
|
21
|
+
s += n.kind === 'page' ? `@[${n.name}]` : `@${n.name}`;
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
s += inlinePlain(n.children);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return s;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { inlineNodesSnippet };
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
{#snippet renderChild(n: InlineNode)}
|
|
35
|
+
{#if n.type === 'text'}
|
|
36
|
+
{n.text}
|
|
37
|
+
{:else if n.type === 'code'}
|
|
38
|
+
<code class="rounded bg-surface-raised px-1 py-0.5 font-mono text-[0.9em] text-txt-secondary"
|
|
39
|
+
>{n.text}</code
|
|
40
|
+
>
|
|
41
|
+
{:else if n.type === 'emphasis'}
|
|
42
|
+
<em class="text-txt-primary italic">{@render inlineNodesSnippet(n.children)}</em>
|
|
43
|
+
{:else if n.type === 'strong'}
|
|
44
|
+
<strong class="font-semibold text-txt-primary">{@render inlineNodesSnippet(n.children)}</strong>
|
|
45
|
+
{:else if n.type === 'strikethrough'}
|
|
46
|
+
<del class="text-txt-tertiary line-through">{@render inlineNodesSnippet(n.children)}</del>
|
|
47
|
+
{:else if n.type === 'highlight'}
|
|
48
|
+
<mark
|
|
49
|
+
class="rounded px-0.5 text-surface-base {!n.color ? 'bg-option-yellow' : ''}"
|
|
50
|
+
style={n.color ? `background-color: var(--hl-${n.color}, #fde68a)` : undefined}
|
|
51
|
+
>{@render inlineNodesSnippet(n.children)}</mark
|
|
52
|
+
>
|
|
53
|
+
{:else if n.type === 'autolink'}
|
|
54
|
+
{@const href = hrefForDisplay(n.href)}
|
|
55
|
+
{#if href}
|
|
56
|
+
<a
|
|
57
|
+
class="text-accent-primary underline decoration-accent-primary/50 underline-offset-2 hover:text-accent-secondary"
|
|
58
|
+
{href}
|
|
59
|
+
target="_blank"
|
|
60
|
+
rel="noopener noreferrer">{n.href}</a
|
|
61
|
+
>
|
|
62
|
+
{:else}
|
|
63
|
+
<span class="text-txt-secondary">{n.href}</span>
|
|
64
|
+
{/if}
|
|
65
|
+
{:else if n.type === 'wikiLink'}
|
|
66
|
+
<a
|
|
67
|
+
class="text-option-purple underline decoration-option-purple/40 underline-offset-2 hover:text-option-purple"
|
|
68
|
+
href={`/?wiki=${encodeURIComponent(n.target)}`}>{n.label}</a
|
|
69
|
+
>
|
|
70
|
+
{:else if n.type === 'mention'}
|
|
71
|
+
<span class="font-medium text-option-cyan"
|
|
72
|
+
>{n.kind === 'page' ? '@[' : '@'}{n.name}{n.kind === 'page' ? ']' : ''}</span
|
|
73
|
+
>
|
|
74
|
+
{:else if n.type === 'link'}
|
|
75
|
+
{@const href = n.href ? hrefForDisplay(n.href) : null}
|
|
76
|
+
{#if href}
|
|
77
|
+
<a
|
|
78
|
+
class="text-accent-primary underline decoration-accent-primary/50 underline-offset-2 hover:text-accent-secondary"
|
|
79
|
+
{href}
|
|
80
|
+
title={n.title ?? undefined}
|
|
81
|
+
target="_blank"
|
|
82
|
+
rel="noopener noreferrer">{@render inlineNodesSnippet(n.children)}</a
|
|
83
|
+
>
|
|
84
|
+
{:else}
|
|
85
|
+
<span class="text-txt-secondary">{@render inlineNodesSnippet(n.children)}</span>
|
|
86
|
+
{/if}
|
|
87
|
+
{:else if n.type === 'image'}
|
|
88
|
+
{@const href = n.href ? hrefForDisplay(n.href) : null}
|
|
89
|
+
{@const alt = inlinePlain(n.children)}
|
|
90
|
+
{@const layout = imageLayoutCss(n.displayWidth, n.floatAlign)}
|
|
91
|
+
{#if href}
|
|
92
|
+
<span class="ph-image-layout {layout.wrapperClass}">
|
|
93
|
+
<img
|
|
94
|
+
class="{layout.imgClass}"
|
|
95
|
+
style={layout.imgStyle}
|
|
96
|
+
src={href}
|
|
97
|
+
{alt}
|
|
98
|
+
title={n.title ?? undefined}
|
|
99
|
+
loading="lazy"
|
|
100
|
+
decoding="async"
|
|
101
|
+
/>
|
|
102
|
+
</span>
|
|
103
|
+
{:else}
|
|
104
|
+
<span class="text-txt-tertiary italic">({@render inlineNodesSnippet(n.children)})</span>
|
|
105
|
+
{/if}
|
|
106
|
+
{/if}
|
|
107
|
+
{/snippet}
|
|
108
|
+
|
|
109
|
+
{#snippet inlineNodesSnippet(nodes: InlineNode[])}
|
|
110
|
+
{#each nodes as n (n)}
|
|
111
|
+
{@render renderChild(n)}
|
|
112
|
+
{/each}
|
|
113
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InlineNode } from '../../model/types';
|
|
2
|
+
declare const inlineNodesSnippet: (nodes: InlineNode[]) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { inlineNodesSnippet };
|
|
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 InlineNodes: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type InlineNodes = InstanceType<typeof InlineNodes>;
|
|
21
|
+
export default InlineNodes;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { InlineNode } from '../../model/types';
|
|
3
|
+
import { isInlineAtom, nodePlainLength } from '../../model/inlineEditCommands';
|
|
4
|
+
import { inlineNodesSnippet } from './InlineNodes.svelte';
|
|
5
|
+
|
|
6
|
+
function plainOffsetAt(nodes: InlineNode[], index: number): number {
|
|
7
|
+
let o = 0;
|
|
8
|
+
for (let j = 0; j < index; j++) o += nodePlainLength(nodes[j]!);
|
|
9
|
+
return o;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { inlineNodesEditSnippet };
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { hrefForDisplay } from '../../context/assetBaseUrl.js';
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#snippet renderEditChild(n: InlineNode, offset: number)}
|
|
20
|
+
{#if n.type === 'link'}
|
|
21
|
+
{@const href = n.href ? hrefForDisplay(n.href) : null}
|
|
22
|
+
<span
|
|
23
|
+
contenteditable="false"
|
|
24
|
+
class="inline-atom"
|
|
25
|
+
data-inline-atom="true"
|
|
26
|
+
data-md-inline-link="true"
|
|
27
|
+
data-md-plain-start={offset}
|
|
28
|
+
data-md-plain-end={offset + nodePlainLength(n)}
|
|
29
|
+
data-md-link-href={n.href}
|
|
30
|
+
>
|
|
31
|
+
{#if href}
|
|
32
|
+
<a
|
|
33
|
+
class="text-accent-primary underline decoration-accent-primary/50 underline-offset-2 hover:text-accent-secondary"
|
|
34
|
+
{href}
|
|
35
|
+
title={n.title ?? undefined}
|
|
36
|
+
target="_blank"
|
|
37
|
+
rel="noopener noreferrer">{@render renderEditNodes(n.children, offset)}</a
|
|
38
|
+
>
|
|
39
|
+
{:else}
|
|
40
|
+
<span class="text-txt-secondary">{@render renderEditNodes(n.children, offset)}</span>
|
|
41
|
+
{/if}
|
|
42
|
+
</span>
|
|
43
|
+
{:else if n.type === 'text'}
|
|
44
|
+
{n.text}
|
|
45
|
+
{:else if n.type === 'code'}
|
|
46
|
+
<code class="rounded bg-surface-raised px-1 py-0.5 font-mono text-[0.9em] text-txt-secondary"
|
|
47
|
+
>{n.text}</code
|
|
48
|
+
>
|
|
49
|
+
{:else if n.type === 'emphasis'}
|
|
50
|
+
<em class="text-txt-primary italic">{@render renderEditNodes(n.children, offset)}</em>
|
|
51
|
+
{:else if n.type === 'strong'}
|
|
52
|
+
<strong class="font-semibold text-txt-primary">{@render renderEditNodes(n.children, offset)}</strong>
|
|
53
|
+
{:else if n.type === 'strikethrough'}
|
|
54
|
+
<del class="text-txt-tertiary line-through">{@render renderEditNodes(n.children, offset)}</del>
|
|
55
|
+
{:else if n.type === 'highlight'}
|
|
56
|
+
<mark
|
|
57
|
+
class="rounded px-0.5 text-surface-base {!n.color ? 'bg-option-yellow' : ''}"
|
|
58
|
+
style={n.color ? `background-color: var(--hl-${n.color}, #fde68a)` : undefined}
|
|
59
|
+
>{@render renderEditNodes(n.children, offset)}</mark
|
|
60
|
+
>
|
|
61
|
+
{:else if isInlineAtom(n)}
|
|
62
|
+
<span contenteditable="false" class="inline-atom" data-inline-atom="true">
|
|
63
|
+
{@render inlineNodesSnippet([n])}
|
|
64
|
+
</span>
|
|
65
|
+
{:else}
|
|
66
|
+
{@render inlineNodesSnippet([n])}
|
|
67
|
+
{/if}
|
|
68
|
+
{/snippet}
|
|
69
|
+
|
|
70
|
+
{#snippet renderEditNodes(nodes: InlineNode[], start: number)}
|
|
71
|
+
{#each nodes as n, i (n)}
|
|
72
|
+
{@render renderEditChild(n, start + plainOffsetAt(nodes, i))}
|
|
73
|
+
{/each}
|
|
74
|
+
{/snippet}
|
|
75
|
+
|
|
76
|
+
{#snippet inlineNodesEditSnippet(nodes: InlineNode[])}
|
|
77
|
+
{@render renderEditNodes(nodes, 0)}
|
|
78
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InlineNode } from '../../model/types';
|
|
2
|
+
export { inlineNodesEditSnippet };
|
|
3
|
+
declare const inlineNodesEditSnippet: (nodes: InlineNode[]) => 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 InlineNodesEdit: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type InlineNodesEdit = InstanceType<typeof InlineNodesEdit>;
|
|
21
|
+
export default InlineNodesEdit;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { StrikethroughBlock } from './types';
|
|
3
|
+
|
|
4
|
+
export { strikethroughRenderer };
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#snippet strikethroughRenderer(block: StrikethroughBlock)}
|
|
8
|
+
<del class="text-txt-secondary line-through decoration-txt-tertiary">{block.text}</del>
|
|
9
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StrikethroughBlock } from './types';
|
|
2
|
+
declare const strikethroughRenderer: (block: StrikethroughBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { strikethroughRenderer };
|
|
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 StrikethroughRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type StrikethroughRenderer = InstanceType<typeof StrikethroughRenderer>;
|
|
21
|
+
export default StrikethroughRenderer;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Odd count of `\` immediately before `index` means the character at `index` is escaped. */
|
|
2
|
+
function isEscaped(source, index) {
|
|
3
|
+
let backs = 0;
|
|
4
|
+
for (let j = index - 1; j >= 0 && source[j] === '\\'; j--)
|
|
5
|
+
backs++;
|
|
6
|
+
return backs % 2 === 1;
|
|
7
|
+
}
|
|
8
|
+
/** GFM-style `~~` … `~~` spans; escaped tildes do not open/close. */
|
|
9
|
+
export function parseStrikethrough(source) {
|
|
10
|
+
const out = [];
|
|
11
|
+
let i = 0;
|
|
12
|
+
while (i < source.length - 1) {
|
|
13
|
+
if (source[i] !== '~' || source[i + 1] !== '~' || isEscaped(source, i)) {
|
|
14
|
+
i++;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const open = i;
|
|
18
|
+
i += 2;
|
|
19
|
+
const contentStart = i;
|
|
20
|
+
let closed = false;
|
|
21
|
+
while (i < source.length - 1) {
|
|
22
|
+
if (source[i] === '~' && source[i + 1] === '~' && !isEscaped(source, i)) {
|
|
23
|
+
out.push({
|
|
24
|
+
text: source.slice(contentStart, i),
|
|
25
|
+
startIndex: open
|
|
26
|
+
});
|
|
27
|
+
i += 2;
|
|
28
|
+
closed = true;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
i++;
|
|
32
|
+
}
|
|
33
|
+
if (!closed) {
|
|
34
|
+
i = open + 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { SyncedBlockData } from './types';
|
|
3
|
+
|
|
4
|
+
export { syncedBlockRenderer };
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#snippet syncedBlockRenderer(block: SyncedBlockData)}
|
|
8
|
+
<div class="mb-4 border-l border-option-purple/50 py-1 pl-3" aria-label={`Synced block ${block.id}`}>
|
|
9
|
+
<p class="text-[0.65rem] font-semibold tracking-[0.12em] text-option-purple/90 uppercase">
|
|
10
|
+
Synced block
|
|
11
|
+
</p>
|
|
12
|
+
<p class="mt-1.5 font-mono text-xl font-semibold break-all text-txt-primary tabular-nums">
|
|
13
|
+
{block.id}
|
|
14
|
+
</p>
|
|
15
|
+
</div>
|
|
16
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SyncedBlockData } from './types';
|
|
2
|
+
declare const syncedBlockRenderer: (block: SyncedBlockData) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { syncedBlockRenderer };
|
|
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 SyncedBlockRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type SyncedBlockRenderer = InstanceType<typeof SyncedBlockRenderer>;
|
|
21
|
+
export default SyncedBlockRenderer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Extended synced block: `{{block:id}}` (see docs/md-spec.md). */
|
|
2
|
+
const SYNCED_BLOCK = /\{\{block:([^}]*)\}\}/g;
|
|
3
|
+
export function parseSyncedBlocks(source) {
|
|
4
|
+
const out = [];
|
|
5
|
+
let match;
|
|
6
|
+
while ((match = SYNCED_BLOCK.exec(source)) !== null) {
|
|
7
|
+
const id = match[1].trim();
|
|
8
|
+
if (!id)
|
|
9
|
+
continue;
|
|
10
|
+
const before = source.slice(0, match.index);
|
|
11
|
+
const lineIndex = before.split(/\r?\n/).length - 1;
|
|
12
|
+
out.push({ id, lineIndex });
|
|
13
|
+
}
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type MarkdownDocument = {
|
|
3
|
+
source: string;
|
|
4
|
+
fileName: string | null;
|
|
5
|
+
};
|
|
6
|
+
export type EditorRenderBlock<Data = unknown> = {
|
|
7
|
+
id: string;
|
|
8
|
+
pluginId: string;
|
|
9
|
+
data: Data;
|
|
10
|
+
render: Snippet<[Data]>;
|
|
11
|
+
};
|
|
12
|
+
export type AnyEditorRenderBlock = Omit<EditorRenderBlock<never>, 'data'> & {
|
|
13
|
+
data: unknown;
|
|
14
|
+
};
|
|
15
|
+
/** Render-snippet metadata only; upload parsing is owned by the central scanner and BlockSpec modules. */
|
|
16
|
+
export type BlockRenderAdapter = {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { WikiLinkBlock } from './types';
|
|
3
|
+
|
|
4
|
+
export { wikiLinkRenderer };
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#snippet wikiLinkRenderer(block: WikiLinkBlock)}
|
|
8
|
+
<a
|
|
9
|
+
class="mb-4 inline-block text-sm font-medium text-option-purple underline-offset-2 hover:underline"
|
|
10
|
+
href={`#${encodeURIComponent(block.target)}`}
|
|
11
|
+
title={block.target}
|
|
12
|
+
>
|
|
13
|
+
{block.label}
|
|
14
|
+
</a>
|
|
15
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WikiLinkBlock } from './types';
|
|
2
|
+
declare const wikiLinkRenderer: (block: WikiLinkBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { wikiLinkRenderer };
|
|
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 WikiLinkRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type WikiLinkRenderer = InstanceType<typeof WikiLinkRenderer>;
|
|
21
|
+
export default WikiLinkRenderer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** `[[page]]` or `[[page|label]]` — inner must not contain `[` or `]`. */
|
|
2
|
+
const WIKI_LINK = /\[\[([^[\]]+?)\]\]/g;
|
|
3
|
+
export function parseWikiLinks(source) {
|
|
4
|
+
const out = [];
|
|
5
|
+
for (const match of source.matchAll(WIKI_LINK)) {
|
|
6
|
+
const rawInner = match[1]?.trim() ?? '';
|
|
7
|
+
if (!rawInner)
|
|
8
|
+
continue;
|
|
9
|
+
const startIndex = match.index ?? 0;
|
|
10
|
+
const pipe = rawInner.indexOf('|');
|
|
11
|
+
let target;
|
|
12
|
+
let label;
|
|
13
|
+
if (pipe === -1) {
|
|
14
|
+
target = rawInner;
|
|
15
|
+
label = rawInner;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
target = rawInner.slice(0, pipe).trim();
|
|
19
|
+
label = rawInner.slice(pipe + 1).trim();
|
|
20
|
+
if (!target)
|
|
21
|
+
continue;
|
|
22
|
+
if (!label)
|
|
23
|
+
label = target;
|
|
24
|
+
}
|
|
25
|
+
if (target.toLowerCase() === 'toc')
|
|
26
|
+
continue;
|
|
27
|
+
out.push({ target, label, startIndex });
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type WikiLinkBlock = {
|
|
2
|
+
/** Page title / link target (left of `|` when present). */
|
|
3
|
+
target: string;
|
|
4
|
+
/** Text shown in the document (`|` suffix or same as target). */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Start offset of `[[` in the source (document order). */
|
|
7
|
+
startIndex: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StatusCheckboxStateDef } from 'phoundry-ui';
|
|
2
|
+
import type { TaskCheckboxState } from './model/types.js';
|
|
3
|
+
/** Interactive cycle order for standard task markers (excludes `other`). */
|
|
4
|
+
export declare const TASK_CHECKBOX_CYCLE: TaskCheckboxState[];
|
|
5
|
+
export declare const taskCheckboxStates: StatusCheckboxStateDef[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Interactive cycle order for standard task markers (excludes `other`). */
|
|
2
|
+
export const TASK_CHECKBOX_CYCLE = [
|
|
3
|
+
'todo',
|
|
4
|
+
'in_progress',
|
|
5
|
+
'deferred',
|
|
6
|
+
'done'
|
|
7
|
+
];
|
|
8
|
+
export const taskCheckboxStates = [
|
|
9
|
+
{ key: 'todo', label: 'Todo' },
|
|
10
|
+
{
|
|
11
|
+
key: 'in_progress',
|
|
12
|
+
label: 'In progress',
|
|
13
|
+
icon: 'material-symbols:refresh',
|
|
14
|
+
color: 'var(--color-option-yellow)'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: 'deferred',
|
|
18
|
+
label: 'Deferred',
|
|
19
|
+
icon: 'material-symbols:arrow-forward',
|
|
20
|
+
color: 'var(--color-option-orange)'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: 'done',
|
|
24
|
+
label: 'Done',
|
|
25
|
+
icon: 'material-symbols:check',
|
|
26
|
+
color: 'var(--color-option-green)'
|
|
27
|
+
}
|
|
28
|
+
];
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as PhormatEditor } from './editor/PhormatEditor.svelte';
|
|
2
|
+
/** @deprecated Use {@link PhormatEditor} for embeddable controlled editing. */
|
|
3
|
+
export { default as Editor } from './editor/Editor.svelte';
|
|
4
|
+
export { MarkdownEditor, type SetSourceOptions } from './editor/MarkdownEditor.svelte.js';
|
|
5
|
+
export { createEditorHistoryHandle, type EditorHistoryHandle, type EditorHistoryHandleWithSync } from './editor/editorHistoryHandle.js';
|
|
6
|
+
export * from './editor/model/index.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Primary controlled editor component
|
|
2
|
+
export { default as PhormatEditor } from './editor/PhormatEditor.svelte';
|
|
3
|
+
// Editor shell and state
|
|
4
|
+
/** @deprecated Use {@link PhormatEditor} for embeddable controlled editing. */
|
|
5
|
+
export { default as Editor } from './editor/Editor.svelte';
|
|
6
|
+
export { MarkdownEditor } from './editor/MarkdownEditor.svelte.js';
|
|
7
|
+
export { createEditorHistoryHandle } from './editor/editorHistoryHandle.js';
|
|
8
|
+
// Document model and serialization
|
|
9
|
+
export * from './editor/model/index.js';
|