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
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Phormat
|
|
2
|
+
|
|
3
|
+
Source-canonical block Markdown editor for Svelte 5. Markdown source is the persisted representation; a typed block tree is the in-memory editing model.
|
|
4
|
+
|
|
5
|
+
> **Monorepo note:** The npm package is `phormat`. This repository folder may still be named `md-editor`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install phormat
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Peer dependencies** (install in your app):
|
|
14
|
+
|
|
15
|
+
- `svelte` ^5.0.0
|
|
16
|
+
- `phoundry-ui` >=0.0.18
|
|
17
|
+
- `@iconify/svelte` ^4.0.0 || ^5.0.0
|
|
18
|
+
|
|
19
|
+
In a Phoundry monorepo, use a `file:` dependency (e.g. `"phormat": "file:../md-editor"`) and run `npm run prepack` in this repo after editing package source.
|
|
20
|
+
|
|
21
|
+
## Publishing
|
|
22
|
+
|
|
23
|
+
Maintainers: see [docs/publishing.md](docs/publishing.md). Quick path: `npm run release` after `npm login` and ensuring `phoundry-ui@>=0.0.18` is on npm.
|
|
24
|
+
|
|
25
|
+
## Styles
|
|
26
|
+
|
|
27
|
+
Import Phormat styles once in your app CSS (chains `phoundry-ui` theme and Tailwind `@source` for packaged components):
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
@import 'phormat/styles';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Overlay setup
|
|
34
|
+
|
|
35
|
+
Phormat uses phoundry-ui context menus and inline formatting popovers. Call `setupOverlays()` once in your root layout and render the overlay hosts:
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<script>
|
|
39
|
+
import { ContextMenuOverlay, PopoverOverlay, setupOverlays } from 'phoundry-ui';
|
|
40
|
+
|
|
41
|
+
setupOverlays();
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<ContextMenuOverlay />
|
|
45
|
+
<PopoverOverlay>
|
|
46
|
+
<!-- Optional: mount your inline toolbar as PopoverOverlay default child -->
|
|
47
|
+
</PopoverOverlay>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
See the [demo layout](src/routes/+layout.svelte) in this repo for a working example.
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
```svelte
|
|
55
|
+
<script>
|
|
56
|
+
import { PhormatEditor } from 'phormat';
|
|
57
|
+
|
|
58
|
+
let source = $state('# Hello\n\nEdit me.');
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<PhormatEditor
|
|
62
|
+
value={source}
|
|
63
|
+
onchange={(next) => (source = next)}
|
|
64
|
+
showToolbar={true}
|
|
65
|
+
/>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
For file-backed apps, the parent owns load/save and passes `value` / `onchange`; call `markSaved()` on the internal state only if you use `MarkdownEditor` directly. With `PhormatEditor`, track dirty state against your own on-disk baseline (see [package usage](docs/package-usage.md)).
|
|
69
|
+
|
|
70
|
+
## Package exports
|
|
71
|
+
|
|
72
|
+
| Import | Purpose |
|
|
73
|
+
|--------|---------|
|
|
74
|
+
| `phormat` | `PhormatEditor`, `MarkdownEditor` state class, model types and helpers |
|
|
75
|
+
| `phormat/styles` | CSS entry (theme + Tailwind scan) |
|
|
76
|
+
| `phormat/demo` | Browser-only demo helpers (file load, localStorage drafts, download) — not for production file I/O |
|
|
77
|
+
|
|
78
|
+
## Documentation
|
|
79
|
+
|
|
80
|
+
- [Package usage](docs/package-usage.md) — embedder API, props, dirty baseline, demo vs production boundaries
|
|
81
|
+
- [Architecture overview](docs/architecture-overview.md) — internal pipeline and extension points (contributors)
|
|
82
|
+
- [Context glossary](docs/context/CONTEXT.md) — domain terms
|
|
83
|
+
|
|
84
|
+
## Demo app
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm install
|
|
88
|
+
npm run dev
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The SvelteKit route at `src/routes/+page.svelte` is a reference implementation using `phormat/demo` for browser file upload, draft recovery, and export.
|
|
92
|
+
|
|
93
|
+
## Scripts
|
|
94
|
+
|
|
95
|
+
| Command | Description |
|
|
96
|
+
|---------|-------------|
|
|
97
|
+
| `npm run dev` | Demo dev server |
|
|
98
|
+
| `npm run check` | Typecheck |
|
|
99
|
+
| `npm run test` | Unit tests |
|
|
100
|
+
| `npm run prepack` | Build library (`dist/`) |
|
|
101
|
+
| `npm run pack:local` | Build + create `.tgz` for inspection |
|
|
102
|
+
| `npm run release` | Patch version, build, `npm publish` |
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
|
|
2
|
+
<h1>Markdown specification examples</h1>
|
|
3
|
+
<p>Exercises every construct described in <code>docs/md-spec.md</code>.</p>
|
|
4
|
+
<h2>Paragraphs and line breaks</h2>
|
|
5
|
+
<p>First paragraph with a soft break:<br>
|
|
6
|
+
continues on the next line without a new block.</p>
|
|
7
|
+
<p>Second paragraph after a blank line.</p>
|
|
8
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
9
|
+
<hr>
|
|
10
|
+
<h2>Headings</h2>
|
|
11
|
+
<h1>Heading 1</h1>
|
|
12
|
+
<h2>Heading 2</h2>
|
|
13
|
+
<h3>Heading 3</h3>
|
|
14
|
+
<h4>Heading 4</h4>
|
|
15
|
+
<h5>Heading 5</h5>
|
|
16
|
+
<h6>Heading 6</h6>
|
|
17
|
+
<hr>
|
|
18
|
+
<h2>Emphasis and strong emphasis</h2>
|
|
19
|
+
<p><em>italic</em>
|
|
20
|
+
<strong>bold</strong>
|
|
21
|
+
<strong><em>bold italic</em></strong>
|
|
22
|
+
<del>crossed out</del></p>
|
|
23
|
+
<hr>
|
|
24
|
+
<h2>Lists</h2>
|
|
25
|
+
<p><strong>Unordered</strong> (<code>-</code>, <code>*</code>, <code>+</code>):</p>
|
|
26
|
+
<ul>
|
|
27
|
+
<li>Item one</li>
|
|
28
|
+
<li>Item two
|
|
29
|
+
<ul>
|
|
30
|
+
<li>Nested item</li>
|
|
31
|
+
</ul>
|
|
32
|
+
</li>
|
|
33
|
+
</ul>
|
|
34
|
+
<ul>
|
|
35
|
+
<li>Star marker item</li>
|
|
36
|
+
</ul>
|
|
37
|
+
<ul>
|
|
38
|
+
<li>Plus marker item</li>
|
|
39
|
+
</ul>
|
|
40
|
+
<p><strong>Ordered:</strong></p>
|
|
41
|
+
<ol>
|
|
42
|
+
<li>First</li>
|
|
43
|
+
<li>Second</li>
|
|
44
|
+
<li>Nested ordered item</li>
|
|
45
|
+
</ol>
|
|
46
|
+
<hr>
|
|
47
|
+
<h2>Links and images</h2>
|
|
48
|
+
<p>Inline link: <a
|
|
49
|
+
href="https://example.com"
|
|
50
|
+
title="optional title"
|
|
51
|
+
rel="nofollow"
|
|
52
|
+
>link text</a></p>
|
|
53
|
+
<p>Reference-style link: <a
|
|
54
|
+
href="https://example.com"
|
|
55
|
+
title="optional title"
|
|
56
|
+
rel="nofollow"
|
|
57
|
+
>link text</a></p>
|
|
58
|
+
<p>Unresolved reference (expect parse warning): [missing link][nope]</p>
|
|
59
|
+
<p>Image
|
|
60
|
+
<img
|
|
61
|
+
src="https://picsum.photos/400/200"
|
|
62
|
+
alt="alt text"
|
|
63
|
+
title="optional title"
|
|
64
|
+
></p>
|
|
65
|
+
<p>Image 100px
|
|
66
|
+
<img
|
|
67
|
+
src="https://picsum.photos/400/200"
|
|
68
|
+
alt="alt text|100"
|
|
69
|
+
title="optional title"
|
|
70
|
+
></p>
|
|
71
|
+
<p>Image 200px left-aligned
|
|
72
|
+
<img
|
|
73
|
+
src="https://picsum.photos/400/200"
|
|
74
|
+
alt="alt text|200:"
|
|
75
|
+
title="optional title"
|
|
76
|
+
></p>
|
|
77
|
+
<p>Image 200px center-aligned
|
|
78
|
+
<img
|
|
79
|
+
src="https://picsum.photos/400/200"
|
|
80
|
+
alt="alt text|:200:"
|
|
81
|
+
title="optional title"
|
|
82
|
+
></p>
|
|
83
|
+
<p>Image full width
|
|
84
|
+
<img
|
|
85
|
+
src="https://picsum.photos/400/200"
|
|
86
|
+
alt="alt text|-1"
|
|
87
|
+
title="optional title"
|
|
88
|
+
></p>
|
|
89
|
+
<hr>
|
|
90
|
+
<h2>Code</h2>
|
|
91
|
+
<p>Inline code: use <code>code</code> in a sentence.</p>
|
|
92
|
+
<p>Fenced code block:</p>
|
|
93
|
+
<pre class="language-javascript">{@html `<code class="language-javascript"><span class="token keyword">const</span> x <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code>`}</pre>
|
|
94
|
+
<p>Indented code block (four spaces — deferred in parser):</p>
|
|
95
|
+
<p> const y = 2;</p>
|
|
96
|
+
<hr>
|
|
97
|
+
<h2>Blockquotes</h2>
|
|
98
|
+
<blockquote>
|
|
99
|
+
<p>Quoted text
|
|
100
|
+
More quoted text</p>
|
|
101
|
+
</blockquote>
|
|
102
|
+
<blockquote>
|
|
103
|
+
<p>Outer quote</p>
|
|
104
|
+
<blockquote>
|
|
105
|
+
<p>Inner nested quote</p>
|
|
106
|
+
</blockquote>
|
|
107
|
+
</blockquote>
|
|
108
|
+
<hr>
|
|
109
|
+
<h2>Escaping</h2>
|
|
110
|
+
<p>Literal characters: *asterisk*, # hash, backslash \</p>
|
|
111
|
+
<hr>
|
|
112
|
+
<h2>Tables</h2>
|
|
113
|
+
<table>
|
|
114
|
+
<thead>
|
|
115
|
+
<tr>
|
|
116
|
+
<th align="left">Work item</th>
|
|
117
|
+
<th align="left">Owner</th>
|
|
118
|
+
<th align="left">Status</th>
|
|
119
|
+
</tr>
|
|
120
|
+
</thead>
|
|
121
|
+
<tbody>
|
|
122
|
+
<tr>
|
|
123
|
+
<td align="left"><strong>Ship</strong> <code>EditableTable</code> — Tab/Enter cell navigation</td>
|
|
124
|
+
<td align="left">@alice</td>
|
|
125
|
+
<td align="left">==In review==</td>
|
|
126
|
+
</tr>
|
|
127
|
+
<tr>
|
|
128
|
+
<td align="left"><em>Document</em> table editing in <a href="docs/context/editor/tables.md">tables.md</a></td>
|
|
129
|
+
<td align="left">@bob</td>
|
|
130
|
+
<td align="left"><strong>Done</strong></td>
|
|
131
|
+
</tr>
|
|
132
|
+
<tr>
|
|
133
|
+
<td align="left">Run <code>npm run check</code> + Vitest table specs before merge</td>
|
|
134
|
+
<td align="left">CI</td>
|
|
135
|
+
<td align="left"><strong>Required</strong></td>
|
|
136
|
+
</tr>
|
|
137
|
+
<tr>
|
|
138
|
+
<td align="left">Replace <del>plain-text</del> cells with inline AST on parse</td>
|
|
139
|
+
<td align="left">@carol</td>
|
|
140
|
+
<td align="left">Blocked</td>
|
|
141
|
+
</tr>
|
|
142
|
+
<tr>
|
|
143
|
+
<td align="left">Smoke-test upload of <code>example-test.md</code> in the editor</td>
|
|
144
|
+
<td align="left">QA</td>
|
|
145
|
+
<td align="left">Pending</td>
|
|
146
|
+
</tr>
|
|
147
|
+
</tbody>
|
|
148
|
+
</table>
|
|
149
|
+
<p>Alignment:</p>
|
|
150
|
+
<table>
|
|
151
|
+
<thead>
|
|
152
|
+
<tr>
|
|
153
|
+
<th align="left">Left</th>
|
|
154
|
+
<th align="center">Center</th>
|
|
155
|
+
<th align="right">Right</th>
|
|
156
|
+
</tr>
|
|
157
|
+
</thead>
|
|
158
|
+
<tbody>
|
|
159
|
+
<tr>
|
|
160
|
+
<td align="left">L</td>
|
|
161
|
+
<td align="center">C</td>
|
|
162
|
+
<td align="right">R</td>
|
|
163
|
+
</tr>
|
|
164
|
+
</tbody>
|
|
165
|
+
</table>
|
|
166
|
+
<hr>
|
|
167
|
+
<h2>Autolinks</h2>
|
|
168
|
+
<h4>Angle-bracket link</h4>
|
|
169
|
+
<p><a href="https://example.com" rel="nofollow">https://example.com</a></p>
|
|
170
|
+
<h4>Angle-bracket email</h4>
|
|
171
|
+
<p><a href="mailto:test@example.com">test@example.com</a></p>
|
|
172
|
+
<h4>Bare URL (deferred)</h4>
|
|
173
|
+
<p><a href="https://example.com/bare" rel="nofollow">https://example.com/bare</a></p>
|
|
174
|
+
<hr>
|
|
175
|
+
<h2>Callouts</h2>
|
|
176
|
+
<blockquote>
|
|
177
|
+
<p>[!note] Note title
|
|
178
|
+
Callout body continues here.</p>
|
|
179
|
+
</blockquote>
|
|
180
|
+
<blockquote>
|
|
181
|
+
<p>[!warning] Warning title
|
|
182
|
+
Be careful with this.</p>
|
|
183
|
+
</blockquote>
|
|
184
|
+
<blockquote>
|
|
185
|
+
<p>[!tip] Tip title
|
|
186
|
+
Helpful hint.</p>
|
|
187
|
+
</blockquote>
|
|
188
|
+
<h2>Toggle</h2>
|
|
189
|
+
<p>+++ Toggle title
|
|
190
|
+
Hidden or collapsible body content.
|
|
191
|
+
+++</p>
|
|
192
|
+
<h2>Columns</h2>
|
|
193
|
+
<p>||| First column content
|
|
194
|
+
||| Second column content
|
|
195
|
+
|||</p>
|
|
196
|
+
<h2>Highlight</h2>
|
|
197
|
+
<p>Plain highlight: ==highlighted text==</p>
|
|
198
|
+
<p>Colored highlight: ==yellow:colored highlight==</p>
|
|
199
|
+
<h2>Wiki links</h2>
|
|
200
|
+
<p>Page link
|
|
201
|
+
[[Page Title]]</p>
|
|
202
|
+
<p>Suppressed toc wiki link
|
|
203
|
+
[[toc]]</p>
|
|
204
|
+
<hr>
|
|
205
|
+
<h2>Mentions</h2>
|
|
206
|
+
<p>User mention
|
|
207
|
+
@username</p>
|
|
208
|
+
<p>Page mention
|
|
209
|
+
@[Page Reference]</p>
|
|
210
|
+
<hr>
|
|
211
|
+
<h2>Synced block</h2>
|
|
212
|
+
<p>Embedded block reference (deferred — expect parse warning): {{block:example-id}}</p>
|
|
213
|
+
<hr>
|
|
214
|
+
<h2>Table of contents</h2>
|
|
215
|
+
<p>::toc</p>
|
|
216
|
+
<hr>
|
|
217
|
+
<h2>Extended task list markers</h2>
|
|
218
|
+
<ul class="contains-task-list">
|
|
219
|
+
<li class="task-list-item"><input type="checkbox" disabled> Todo</li>
|
|
220
|
+
<li class="task-list-item"><input type="checkbox" checked disabled> Done</li>
|
|
221
|
+
<li>[/] In progress</li>
|
|
222
|
+
<li>[>] Deferred</li>
|
|
223
|
+
<li>[?] Other marker</li>
|
|
224
|
+
</ul>
|
|
225
|
+
<p>Ordered task item:</p>
|
|
226
|
+
<ol class="contains-task-list">
|
|
227
|
+
<li class="task-list-item"><input type="checkbox" disabled> Ordered todo</li>
|
|
228
|
+
</ol>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import JsonDebugNode from './JsonDebugNode.svelte';
|
|
3
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
4
|
+
|
|
5
|
+
let { data }: { data: unknown } = $props();
|
|
6
|
+
|
|
7
|
+
let expanded = $state(new SvelteSet<string>(['$']));
|
|
8
|
+
|
|
9
|
+
function toggle(path: string) {
|
|
10
|
+
if (expanded.has(path)) expanded.delete(path);
|
|
11
|
+
else expanded.add(path);
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
class="overflow-x-auto rounded-lg border border-border-muted bg-surface-sunken p-3 font-mono text-xs leading-relaxed text-txt-secondary"
|
|
17
|
+
>
|
|
18
|
+
<JsonDebugNode value={data} path="$" {expanded} {toggle} ancestors={new SvelteSet()} />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import JsonDebugNode from './JsonDebugNode.svelte';
|
|
3
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
value: unknown;
|
|
7
|
+
path: string;
|
|
8
|
+
expanded: Set<string>;
|
|
9
|
+
toggle: (path: string) => void;
|
|
10
|
+
ancestors: Set<object>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let { value, path, expanded, toggle, ancestors }: Props = $props();
|
|
14
|
+
|
|
15
|
+
const isOpen = $derived(expanded.has(path));
|
|
16
|
+
|
|
17
|
+
function childPathSegment(key: string | number): string {
|
|
18
|
+
if (typeof key === 'number') return `[${key}]`;
|
|
19
|
+
return `[${JSON.stringify(key)}]`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function formatLeaf(v: unknown): string {
|
|
23
|
+
if (v === null) return 'null';
|
|
24
|
+
if (v === undefined) return 'undefined';
|
|
25
|
+
if (typeof v === 'string') return JSON.stringify(v);
|
|
26
|
+
if (typeof v === 'number' || typeof v === 'boolean') return String(v);
|
|
27
|
+
if (typeof v === 'bigint') return `${String(v)}n`;
|
|
28
|
+
if (v instanceof Date) return v.toISOString();
|
|
29
|
+
if (typeof v === 'function') return '[Function]';
|
|
30
|
+
if (typeof v === 'symbol') return String(v);
|
|
31
|
+
return String(v);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isPlainObject(v: unknown): v is Record<string, unknown> {
|
|
35
|
+
return (
|
|
36
|
+
typeof v === 'object' &&
|
|
37
|
+
v !== null &&
|
|
38
|
+
!Array.isArray(v) &&
|
|
39
|
+
Object.getPrototypeOf(v) === Object.prototype
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const nextAncestors = $derived.by(() => {
|
|
44
|
+
if (value !== null && typeof value === 'object') {
|
|
45
|
+
const next = new SvelteSet(ancestors);
|
|
46
|
+
next.add(value as object);
|
|
47
|
+
return next;
|
|
48
|
+
}
|
|
49
|
+
return ancestors;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const arraySummary = $derived(Array.isArray(value) ? `Array(${value.length})` : '');
|
|
53
|
+
|
|
54
|
+
const objectSummary = $derived.by(() => {
|
|
55
|
+
if (!isPlainObject(value)) return '';
|
|
56
|
+
const keys = Object.keys(value);
|
|
57
|
+
const label = keys.length === 1 ? 'key' : 'keys';
|
|
58
|
+
return `Object(${keys.length} ${label})`;
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
{#if value === undefined}
|
|
63
|
+
<span class="text-txt-tertiary">undefined</span>
|
|
64
|
+
{:else if value === null}
|
|
65
|
+
<span class="text-txt-tertiary">null</span>
|
|
66
|
+
{:else if typeof value !== 'object'}
|
|
67
|
+
{#if typeof value === 'string'}
|
|
68
|
+
<span class="text-semantic-success/90">{formatLeaf(value)}</span>
|
|
69
|
+
{:else if typeof value === 'number' || typeof value === 'bigint'}
|
|
70
|
+
<span class="text-semantic-warning/90">{formatLeaf(value)}</span>
|
|
71
|
+
{:else if typeof value === 'boolean'}
|
|
72
|
+
<span class="text-accent-primary/90">{formatLeaf(value)}</span>
|
|
73
|
+
{:else}
|
|
74
|
+
<span class="text-txt-secondary">{formatLeaf(value)}</span>
|
|
75
|
+
{/if}
|
|
76
|
+
{:else if ancestors.has(value as object)}
|
|
77
|
+
<span class="text-semantic-warning">[Circular]</span>
|
|
78
|
+
{:else if Array.isArray(value)}
|
|
79
|
+
<div class="min-w-0">
|
|
80
|
+
<button
|
|
81
|
+
type="button"
|
|
82
|
+
class="flex w-full min-w-0 items-start gap-1 rounded px-0.5 py-0.5 text-left text-txt-primary hover:bg-surface-raised/80"
|
|
83
|
+
onclick={() => toggle(path)}
|
|
84
|
+
>
|
|
85
|
+
<span class="w-4 shrink-0 text-txt-tertiary select-none">{isOpen ? '▾' : '▸'}</span>
|
|
86
|
+
<span class="text-txt-secondary">{arraySummary}</span>
|
|
87
|
+
</button>
|
|
88
|
+
{#if isOpen}
|
|
89
|
+
<ul class="ml-4 border-l border-border-muted pl-2">
|
|
90
|
+
{#each value as item, i (i)}
|
|
91
|
+
<li class="flex gap-2 py-0.5">
|
|
92
|
+
<span class="shrink-0 text-txt-tertiary">{i}:</span>
|
|
93
|
+
<div class="min-w-0 flex-1">
|
|
94
|
+
<JsonDebugNode
|
|
95
|
+
value={item}
|
|
96
|
+
path={`${path}${childPathSegment(i)}`}
|
|
97
|
+
{expanded}
|
|
98
|
+
{toggle}
|
|
99
|
+
ancestors={nextAncestors}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</li>
|
|
103
|
+
{/each}
|
|
104
|
+
</ul>
|
|
105
|
+
{/if}
|
|
106
|
+
</div>
|
|
107
|
+
{:else if isPlainObject(value)}
|
|
108
|
+
<div class="min-w-0">
|
|
109
|
+
<button
|
|
110
|
+
type="button"
|
|
111
|
+
class="flex w-full min-w-0 items-start gap-1 rounded px-0.5 py-0.5 text-left text-txt-primary hover:bg-surface-raised/80"
|
|
112
|
+
onclick={() => toggle(path)}
|
|
113
|
+
>
|
|
114
|
+
<span class="w-4 shrink-0 text-txt-tertiary select-none">{isOpen ? '▾' : '▸'}</span>
|
|
115
|
+
<span class="text-txt-secondary">{objectSummary}</span>
|
|
116
|
+
</button>
|
|
117
|
+
{#if isOpen}
|
|
118
|
+
<ul class="ml-4 border-l border-border-muted pl-2">
|
|
119
|
+
{#each Object.keys(value).sort() as key (key)}
|
|
120
|
+
<li class="flex gap-2 py-0.5">
|
|
121
|
+
<span class="shrink-0 text-txt-tertiary">{JSON.stringify(key)}:</span>
|
|
122
|
+
<div class="min-w-0 flex-1">
|
|
123
|
+
<JsonDebugNode
|
|
124
|
+
value={value[key]}
|
|
125
|
+
path={`${path}${childPathSegment(key)}`}
|
|
126
|
+
{expanded}
|
|
127
|
+
{toggle}
|
|
128
|
+
ancestors={nextAncestors}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
</li>
|
|
132
|
+
{/each}
|
|
133
|
+
</ul>
|
|
134
|
+
{/if}
|
|
135
|
+
</div>
|
|
136
|
+
{:else}
|
|
137
|
+
<span class="text-option-purple/90">{formatLeaf(value)}</span>
|
|
138
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import JsonDebugNode from './JsonDebugNode.svelte';
|
|
2
|
+
type Props = {
|
|
3
|
+
value: unknown;
|
|
4
|
+
path: string;
|
|
5
|
+
expanded: Set<string>;
|
|
6
|
+
toggle: (path: string) => void;
|
|
7
|
+
ancestors: Set<object>;
|
|
8
|
+
};
|
|
9
|
+
declare const JsonDebugNode: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type JsonDebugNode = ReturnType<typeof JsonDebugNode>;
|
|
11
|
+
export default JsonDebugNode;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { MarkdownEditor } from '../editor/MarkdownEditor.svelte.js';
|
|
2
|
+
import { type StoredDraft } from '../editor/draftPersistence.js';
|
|
3
|
+
export type DemoSessionOrigin = 'new' | 'loaded_from_file' | 'draft_restored';
|
|
4
|
+
export type DemoPersistenceKind = 'none' | 'marked_saved' | 'exported';
|
|
5
|
+
export type LoadMDFileInput = Event | HTMLInputElement | File | null | undefined;
|
|
6
|
+
export type LoadMarkdownFileResult = {
|
|
7
|
+
ok: true;
|
|
8
|
+
source: string;
|
|
9
|
+
fileName: string;
|
|
10
|
+
fingerprint: string;
|
|
11
|
+
pendingDraft: StoredDraft | null;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
error: string;
|
|
15
|
+
};
|
|
16
|
+
/** Browser demo session metadata (draft keys, conflict banners, export badges). */
|
|
17
|
+
export type DemoDocumentSession = {
|
|
18
|
+
fingerprint: string | null;
|
|
19
|
+
origin: DemoSessionOrigin;
|
|
20
|
+
persistenceKind: DemoPersistenceKind;
|
|
21
|
+
lastMarkedSavedAt: number | null;
|
|
22
|
+
lastExportedAt: number | null;
|
|
23
|
+
pendingFileDraft: StoredDraft | null;
|
|
24
|
+
fileConflictDismissed: boolean;
|
|
25
|
+
diskSourceAtConflictDecision: string | null;
|
|
26
|
+
};
|
|
27
|
+
export declare function createDemoDocumentSession(): DemoDocumentSession;
|
|
28
|
+
export declare function demoDraftStorageKey(session: DemoDocumentSession): string;
|
|
29
|
+
export declare function shouldDeferDraftAutosave(session: DemoDocumentSession, currentSource: string): boolean;
|
|
30
|
+
export declare function fileFromInput(input: LoadMDFileInput): File | null;
|
|
31
|
+
export declare function loadMarkdownFile(file: File): Promise<LoadMarkdownFileResult>;
|
|
32
|
+
export declare function loadMarkdownFileFromInput(input: LoadMDFileInput): Promise<LoadMarkdownFileResult>;
|
|
33
|
+
export declare function applyLoadedFileToEditor(editor: MarkdownEditor, result: Extract<LoadMarkdownFileResult, {
|
|
34
|
+
ok: true;
|
|
35
|
+
}>, session: DemoDocumentSession): void;
|
|
36
|
+
export declare function restoreLocalDraft(editor: MarkdownEditor, session: DemoDocumentSession, source: string): void;
|
|
37
|
+
export declare function discardLocalDraftSnapshot(session: DemoDocumentSession): void;
|
|
38
|
+
export declare function restorePendingFileDraft(editor: MarkdownEditor, session: DemoDocumentSession): void;
|
|
39
|
+
export declare function discardPendingFileDraft(session: DemoDocumentSession): void;
|
|
40
|
+
export declare function dismissPendingFileDraftConflict(editor: MarkdownEditor, session: DemoDocumentSession): void;
|
|
41
|
+
export declare function downloadMarkdownFile(editor: MarkdownEditor, session: DemoDocumentSession, fileName?: string | null): void;
|
|
42
|
+
export declare function markDocumentSaved(editor: MarkdownEditor, session: DemoDocumentSession): void;
|
|
43
|
+
/** Controlled demo: mark session saved without a {@link MarkdownEditor} instance. */
|
|
44
|
+
export declare function markDemoSessionSaved(session: DemoDocumentSession): void;
|
|
45
|
+
/** Controlled demo: restore local draft — returns source to assign to `value`. */
|
|
46
|
+
export declare function restoreLocalDraftControlled(session: DemoDocumentSession, source: string): string;
|
|
47
|
+
/** Controlled demo: apply pending file draft — returns draft source or null. */
|
|
48
|
+
export declare function restorePendingFileDraftControlled(session: DemoDocumentSession): string | null;
|
|
49
|
+
export declare function dismissPendingFileDraftConflictControlled(session: DemoDocumentSession, currentSource: string): void;
|
|
50
|
+
/** Controlled demo: download source string as .md file. */
|
|
51
|
+
export declare function downloadMarkdownSource(source: string, session: DemoDocumentSession, fileName?: string | null): void;
|
|
52
|
+
export declare function applyLoadedFileControlled(result: Extract<LoadMarkdownFileResult, {
|
|
53
|
+
ok: true;
|
|
54
|
+
}>, session: DemoDocumentSession): {
|
|
55
|
+
source: string;
|
|
56
|
+
fileName: string;
|
|
57
|
+
};
|