@voithos-labs/aragonite 0.10.1
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/LICENSE +661 -0
- package/README.md +365 -0
- package/THIRD-PARTY-NOTICES.md +102 -0
- package/dist/a11y-strings.d.ts +46 -0
- package/dist/a11y-strings.js +62 -0
- package/dist/action-contracts.d.ts +301 -0
- package/dist/action-contracts.js +5 -0
- package/dist/active-editor.d.ts +16 -0
- package/dist/active-editor.js +67 -0
- package/dist/ambient/ambient-cursor.d.ts +41 -0
- package/dist/ambient/ambient-cursor.js +120 -0
- package/dist/ambient/ambient-dom.d.ts +9 -0
- package/dist/ambient/ambient-dom.js +102 -0
- package/dist/assert.d.ts +6 -0
- package/dist/assert.js +17 -0
- package/dist/block-component.d.ts +274 -0
- package/dist/block-component.js +43 -0
- package/dist/block-id.d.ts +14 -0
- package/dist/block-id.js +34 -0
- package/dist/bounded-memo.d.ts +14 -0
- package/dist/bounded-memo.js +32 -0
- package/dist/components/BlockDragHandle.svelte +66 -0
- package/dist/components/BlockDragHandle.svelte.d.ts +18 -0
- package/dist/components/BlockHost.svelte +328 -0
- package/dist/components/BlockHost.svelte.d.ts +15 -0
- package/dist/components/BlockList.svelte +114 -0
- package/dist/components/BlockList.svelte.d.ts +16 -0
- package/dist/components/DecorationOverlay.svelte +156 -0
- package/dist/components/DecorationOverlay.svelte.d.ts +14 -0
- package/dist/components/Editor.svelte +1849 -0
- package/dist/components/Editor.svelte.d.ts +49 -0
- package/dist/components/GapCaret.svelte +226 -0
- package/dist/components/GapCaret.svelte.d.ts +9 -0
- package/dist/components/SearchBar.svelte +243 -0
- package/dist/components/SearchBar.svelte.d.ts +7 -0
- package/dist/components/SelectionOverlay.svelte +171 -0
- package/dist/components/SelectionOverlay.svelte.d.ts +14 -0
- package/dist/components/block-content-selector.d.ts +12 -0
- package/dist/components/block-content-selector.js +12 -0
- package/dist/components/blocks/BlockquoteBlock.svelte +32 -0
- package/dist/components/blocks/BlockquoteBlock.svelte.d.ts +11 -0
- package/dist/components/blocks/ThematicBreakBlock.svelte +156 -0
- package/dist/components/blocks/ThematicBreakBlock.svelte.d.ts +17 -0
- package/dist/components/blocks/code/CodeBlock.svelte +726 -0
- package/dist/components/blocks/code/CodeBlock.svelte.d.ts +23 -0
- package/dist/components/blocks/code/CodeLanguageChip.svelte +127 -0
- package/dist/components/blocks/code/CodeLanguageChip.svelte.d.ts +14 -0
- package/dist/components/blocks/code/code-beforeinput.d.ts +30 -0
- package/dist/components/blocks/code/code-beforeinput.js +40 -0
- package/dist/components/blocks/code/code-bootstrap.d.ts +8 -0
- package/dist/components/blocks/code/code-bootstrap.js +54 -0
- package/dist/components/blocks/code/code-editing.d.ts +28 -0
- package/dist/components/blocks/code/code-editing.js +79 -0
- package/dist/components/blocks/code/code-enter.d.ts +22 -0
- package/dist/components/blocks/code/code-enter.js +19 -0
- package/dist/components/blocks/code/code-fence-boundary.d.ts +77 -0
- package/dist/components/blocks/code/code-fence-boundary.js +169 -0
- package/dist/components/blocks/code/code-fence-exit.d.ts +24 -0
- package/dist/components/blocks/code/code-fence-exit.js +36 -0
- package/dist/components/blocks/code/code-indent.d.ts +14 -0
- package/dist/components/blocks/code/code-indent.js +87 -0
- package/dist/components/blocks/code/code-languages.d.ts +15 -0
- package/dist/components/blocks/code/code-languages.js +30 -0
- package/dist/components/blocks/code/code-paste-surface.d.ts +6 -0
- package/dist/components/blocks/code/code-paste-surface.js +29 -0
- package/dist/components/blocks/code/code-paste.d.ts +24 -0
- package/dist/components/blocks/code/code-paste.js +21 -0
- package/dist/components/blocks/code/code-renderer.d.ts +18 -0
- package/dist/components/blocks/code/code-renderer.js +249 -0
- package/dist/components/blocks/directive/DirectiveContainerBlock.svelte +51 -0
- package/dist/components/blocks/directive/DirectiveContainerBlock.svelte.d.ts +11 -0
- package/dist/components/blocks/directive/activate-directives.d.ts +7 -0
- package/dist/components/blocks/directive/activate-directives.js +23 -0
- package/dist/components/blocks/editable-leaf.d.ts +126 -0
- package/dist/components/blocks/editable-leaf.js +410 -0
- package/dist/components/blocks/editable-surface.d.ts +209 -0
- package/dist/components/blocks/editable-surface.js +331 -0
- package/dist/components/blocks/list/ListBlock.svelte +162 -0
- package/dist/components/blocks/list/ListBlock.svelte.d.ts +11 -0
- package/dist/components/blocks/list/ListItemBlock.svelte +324 -0
- package/dist/components/blocks/list/ListItemBlock.svelte.d.ts +14 -0
- package/dist/components/blocks/list/task-checkbox.d.ts +3 -0
- package/dist/components/blocks/list/task-checkbox.js +33 -0
- package/dist/components/blocks/plain-text-backend.d.ts +21 -0
- package/dist/components/blocks/plain-text-backend.js +47 -0
- package/dist/components/blocks/surface-wiring.svelte.d.ts +18 -0
- package/dist/components/blocks/surface-wiring.svelte.js +68 -0
- package/dist/components/blocks/table/TableActionMenu.svelte +267 -0
- package/dist/components/blocks/table/TableActionMenu.svelte.d.ts +15 -0
- package/dist/components/blocks/table/TableBlock.svelte +765 -0
- package/dist/components/blocks/table/TableBlock.svelte.d.ts +30 -0
- package/dist/components/blocks/table/TableCellBlock.svelte +1075 -0
- package/dist/components/blocks/table/TableCellBlock.svelte.d.ts +30 -0
- package/dist/components/blocks/table/TableGrip.svelte +91 -0
- package/dist/components/blocks/table/TableGrip.svelte.d.ts +8 -0
- package/dist/components/blocks/table/TableRowBlock.svelte +233 -0
- package/dist/components/blocks/table/TableRowBlock.svelte.d.ts +34 -0
- package/dist/components/blocks/table/cell-clipboard.d.ts +23 -0
- package/dist/components/blocks/table/cell-clipboard.js +34 -0
- package/dist/components/blocks/table/cell-keydown-plan.d.ts +37 -0
- package/dist/components/blocks/table/cell-keydown-plan.js +66 -0
- package/dist/components/blocks/table/cell-pointer.d.ts +58 -0
- package/dist/components/blocks/table/cell-pointer.js +153 -0
- package/dist/components/blocks/table/cell-render.d.ts +51 -0
- package/dist/components/blocks/table/cell-render.js +98 -0
- package/dist/components/blocks/table/cell-table-commands.d.ts +12 -0
- package/dist/components/blocks/table/cell-table-commands.js +21 -0
- package/dist/components/blocks/table/cell-x-mapping.d.ts +6 -0
- package/dist/components/blocks/table/cell-x-mapping.js +16 -0
- package/dist/components/blocks/table/selected-cells.d.ts +19 -0
- package/dist/components/blocks/table/selected-cells.js +35 -0
- package/dist/components/blocks/table/table-caret-at-point.d.ts +8 -0
- package/dist/components/blocks/table/table-caret-at-point.js +35 -0
- package/dist/components/blocks/table/table-cell-paste.d.ts +16 -0
- package/dist/components/blocks/table/table-cell-paste.js +75 -0
- package/dist/components/blocks/table/table-drag-hit-test.d.ts +5 -0
- package/dist/components/blocks/table/table-drag-hit-test.js +20 -0
- package/dist/components/blocks/table/table-drop-target.d.ts +1 -0
- package/dist/components/blocks/table/table-drop-target.js +16 -0
- package/dist/components/blocks/table/table-menu-model.d.ts +52 -0
- package/dist/components/blocks/table/table-menu-model.js +78 -0
- package/dist/components/blocks/table/table-navigation.d.ts +8 -0
- package/dist/components/blocks/table/table-navigation.js +22 -0
- package/dist/components/blocks/table/table-reorder-drag.d.ts +78 -0
- package/dist/components/blocks/table/table-reorder-drag.js +97 -0
- package/dist/components/blocks/text/TextEditableBlock.svelte +1012 -0
- package/dist/components/blocks/text/TextEditableBlock.svelte.d.ts +33 -0
- package/dist/components/blocks/text/click-snap-guard.d.ts +8 -0
- package/dist/components/blocks/text/click-snap-guard.js +19 -0
- package/dist/components/blocks/text/composition-seat.d.ts +50 -0
- package/dist/components/blocks/text/composition-seat.js +65 -0
- package/dist/components/blocks/text/construct-edge-delete.d.ts +47 -0
- package/dist/components/blocks/text/construct-edge-delete.js +164 -0
- package/dist/components/blocks/text/construct-reveal.d.ts +39 -0
- package/dist/components/blocks/text/construct-reveal.js +164 -0
- package/dist/components/blocks/text/edge-policy-dispatch.d.ts +91 -0
- package/dist/components/blocks/text/edge-policy-dispatch.js +457 -0
- package/dist/components/blocks/text/edge-seat.d.ts +42 -0
- package/dist/components/blocks/text/edge-seat.js +197 -0
- package/dist/components/blocks/text/hidden-suffix.d.ts +10 -0
- package/dist/components/blocks/text/hidden-suffix.js +15 -0
- package/dist/components/blocks/text/link-at-point.d.ts +33 -0
- package/dist/components/blocks/text/link-at-point.js +47 -0
- package/dist/components/blocks/text/link-source-bytes.d.ts +37 -0
- package/dist/components/blocks/text/link-source-bytes.js +161 -0
- package/dist/components/blocks/text/live-join-seam.d.ts +15 -0
- package/dist/components/blocks/text/live-join-seam.js +327 -0
- package/dist/components/blocks/text/live-selection-edit.d.ts +68 -0
- package/dist/components/blocks/text/live-selection-edit.js +120 -0
- package/dist/components/blocks/text/live-split-rebalance.d.ts +56 -0
- package/dist/components/blocks/text/live-split-rebalance.js +239 -0
- package/dist/components/blocks/text/marker-completion.d.ts +18 -0
- package/dist/components/blocks/text/marker-completion.js +29 -0
- package/dist/components/blocks/text/pending-mark-insert.d.ts +37 -0
- package/dist/components/blocks/text/pending-mark-insert.js +188 -0
- package/dist/components/blocks/text/screen-diff.d.ts +20 -0
- package/dist/components/blocks/text/screen-diff.js +39 -0
- package/dist/components/blocks/text/text-clipboard.d.ts +70 -0
- package/dist/components/blocks/text/text-clipboard.js +131 -0
- package/dist/components/blocks/text/text-keydown.d.ts +39 -0
- package/dist/components/blocks/text/text-keydown.js +80 -0
- package/dist/components/blocks/text/text-render.d.ts +67 -0
- package/dist/components/blocks/text/text-render.js +215 -0
- package/dist/components/blocks/text/widget-adjacency.d.ts +30 -0
- package/dist/components/blocks/text/widget-adjacency.js +68 -0
- package/dist/components/blocks/text/widget-interaction.d.ts +90 -0
- package/dist/components/blocks/text/widget-interaction.js +591 -0
- package/dist/components/blocks/widget-portal.d.ts +54 -0
- package/dist/components/blocks/widget-portal.js +136 -0
- package/dist/components/built-in-blocks.d.ts +7 -0
- package/dist/components/built-in-blocks.js +77 -0
- package/dist/components/editor-root-clipboard.d.ts +29 -0
- package/dist/components/editor-root-clipboard.js +105 -0
- package/dist/components/editor-root-keydown.d.ts +47 -0
- package/dist/components/editor-root-keydown.js +88 -0
- package/dist/components/editor-root-listeners.d.ts +44 -0
- package/dist/components/editor-root-listeners.js +112 -0
- package/dist/components/image/ImageOverlayHost.svelte +115 -0
- package/dist/components/image/ImageOverlayHost.svelte.d.ts +20 -0
- package/dist/components/image/ImageProperties.svelte +153 -0
- package/dist/components/image/ImageProperties.svelte.d.ts +14 -0
- package/dist/components/image/ImageResizeHandles.svelte +188 -0
- package/dist/components/image/ImageResizeHandles.svelte.d.ts +10 -0
- package/dist/components/image/image-edit-commit.d.ts +38 -0
- package/dist/components/image/image-edit-commit.js +159 -0
- package/dist/components/image/image-resize.d.ts +11 -0
- package/dist/components/image/image-resize.js +38 -0
- package/dist/components/image/image-source-bytes.d.ts +15 -0
- package/dist/components/image/image-source-bytes.js +73 -0
- package/dist/components/image/image-widget-editing.d.ts +7 -0
- package/dist/components/image/image-widget-editing.js +41 -0
- package/dist/components/image/widget-dom.d.ts +11 -0
- package/dist/components/image/widget-dom.js +110 -0
- package/dist/components/image/widget-selection-state.svelte.d.ts +18 -0
- package/dist/components/image/widget-selection-state.svelte.js +26 -0
- package/dist/components/link-card/LinkCard.svelte +190 -0
- package/dist/components/link-card/LinkCard.svelte.d.ts +18 -0
- package/dist/components/link-card/LinkCardHost.svelte +181 -0
- package/dist/components/link-card/LinkCardHost.svelte.d.ts +25 -0
- package/dist/components/link-card/link-card-commit.d.ts +50 -0
- package/dist/components/link-card/link-card-commit.js +134 -0
- package/dist/components/link-card/link-card-entry.d.ts +39 -0
- package/dist/components/link-card/link-card-entry.js +51 -0
- package/dist/components/link-card/link-card-state.svelte.d.ts +44 -0
- package/dist/components/link-card/link-card-state.svelte.js +46 -0
- package/dist/components/lrd-map-gate.d.ts +18 -0
- package/dist/components/lrd-map-gate.js +22 -0
- package/dist/components/paste-image-arm.d.ts +29 -0
- package/dist/components/paste-image-arm.js +61 -0
- package/dist/components/portal.d.ts +11 -0
- package/dist/components/portal.js +29 -0
- package/dist/core/directive/activate.d.ts +8 -0
- package/dist/core/directive/activate.js +25 -0
- package/dist/core/directive/container-opener.d.ts +7 -0
- package/dist/core/directive/container-opener.js +162 -0
- package/dist/core/directive/grammar.d.ts +50 -0
- package/dist/core/directive/grammar.js +88 -0
- package/dist/core/directive/kinds.d.ts +31 -0
- package/dist/core/directive/kinds.js +137 -0
- package/dist/core/directive/registry.d.ts +39 -0
- package/dist/core/directive/registry.js +49 -0
- package/dist/core/directive/text-recognizer.d.ts +8 -0
- package/dist/core/directive/text-recognizer.js +87 -0
- package/dist/core/escapable.d.ts +6 -0
- package/dist/core/escapable.js +6 -0
- package/dist/core/inline/backticks.d.ts +16 -0
- package/dist/core/inline/backticks.js +62 -0
- package/dist/core/inline/character-refs.d.ts +7 -0
- package/dist/core/inline/character-refs.js +70 -0
- package/dist/core/inline/destination-bytes.d.ts +7 -0
- package/dist/core/inline/destination-bytes.js +14 -0
- package/dist/core/inline/entity-widget.d.ts +11 -0
- package/dist/core/inline/entity-widget.js +21 -0
- package/dist/core/inline/format-toggle.d.ts +50 -0
- package/dist/core/inline/format-toggle.js +533 -0
- package/dist/core/inline/html-entities.d.ts +8 -0
- package/dist/core/inline/html-entities.js +2134 -0
- package/dist/core/inline/html-tag-grammar.d.ts +16 -0
- package/dist/core/inline/html-tag-grammar.js +58 -0
- package/dist/core/inline/image-dimensions.d.ts +6 -0
- package/dist/core/inline/image-dimensions.js +42 -0
- package/dist/core/inline/index.d.ts +42 -0
- package/dist/core/inline/index.js +77 -0
- package/dist/core/inline/inline-cache.d.ts +20 -0
- package/dist/core/inline/inline-cache.js +28 -0
- package/dist/core/inline/inline-widgets.d.ts +124 -0
- package/dist/core/inline/inline-widgets.js +131 -0
- package/dist/core/inline/link-reference-resolver.d.ts +21 -0
- package/dist/core/inline/link-reference-resolver.js +46 -0
- package/dist/core/inline/raw-html-widget.d.ts +10 -0
- package/dist/core/inline/raw-html-widget.js +22 -0
- package/dist/core/inline/scan/autolinks.d.ts +23 -0
- package/dist/core/inline/scan/autolinks.js +354 -0
- package/dist/core/inline/scan/brackets.d.ts +11 -0
- package/dist/core/inline/scan/brackets.js +284 -0
- package/dist/core/inline/scan/code-spans.d.ts +7 -0
- package/dist/core/inline/scan/code-spans.js +27 -0
- package/dist/core/inline/scan/emphasis.d.ts +10 -0
- package/dist/core/inline/scan/emphasis.js +276 -0
- package/dist/core/inline/scan/index.d.ts +7 -0
- package/dist/core/inline/scan/index.js +176 -0
- package/dist/core/inline/scan/plugin-syntax.d.ts +62 -0
- package/dist/core/inline/scan/plugin-syntax.js +150 -0
- package/dist/core/inline/scan/scan-state.d.ts +47 -0
- package/dist/core/inline/scan/scan-state.js +48 -0
- package/dist/core/inline/scan/simple-nodes.d.ts +14 -0
- package/dist/core/inline/scan/simple-nodes.js +53 -0
- package/dist/core/inline/scan/url.d.ts +12 -0
- package/dist/core/inline/scan/url.js +82 -0
- package/dist/core/inline/transparency.d.ts +8 -0
- package/dist/core/inline/transparency.js +39 -0
- package/dist/core/inline/visibility.d.ts +81 -0
- package/dist/core/inline/visibility.js +144 -0
- package/dist/core/inline/walk.d.ts +14 -0
- package/dist/core/inline/walk.js +29 -0
- package/dist/core/inline-render.d.ts +48 -0
- package/dist/core/inline-render.js +322 -0
- package/dist/core/lines.d.ts +44 -0
- package/dist/core/lines.js +91 -0
- package/dist/core/node-views.d.ts +22 -0
- package/dist/core/node-views.js +8 -0
- package/dist/core/nodes.d.ts +297 -0
- package/dist/core/nodes.js +83 -0
- package/dist/core/parser.d.ts +68 -0
- package/dist/core/parser.js +189 -0
- package/dist/core/parsers/blockquote.d.ts +17 -0
- package/dist/core/parsers/blockquote.js +69 -0
- package/dist/core/parsers/built-in-openers.d.ts +8 -0
- package/dist/core/parsers/built-in-openers.js +124 -0
- package/dist/core/parsers/fence-syntax.d.ts +24 -0
- package/dist/core/parsers/fence-syntax.js +44 -0
- package/dist/core/parsers/fenced-code.d.ts +7 -0
- package/dist/core/parsers/fenced-code.js +29 -0
- package/dist/core/parsers/heading.d.ts +3 -0
- package/dist/core/parsers/heading.js +6 -0
- package/dist/core/parsers/html-block.d.ts +17 -0
- package/dist/core/parsers/html-block.js +94 -0
- package/dist/core/parsers/indented-code.d.ts +4 -0
- package/dist/core/parsers/indented-code.js +41 -0
- package/dist/core/parsers/link-reference.d.ts +7 -0
- package/dist/core/parsers/link-reference.js +152 -0
- package/dist/core/parsers/list.d.ts +19 -0
- package/dist/core/parsers/list.js +133 -0
- package/dist/core/parsers/paragraph.d.ts +10 -0
- package/dist/core/parsers/paragraph.js +42 -0
- package/dist/core/parsers/table-completion.d.ts +13 -0
- package/dist/core/parsers/table-completion.js +48 -0
- package/dist/core/parsers/table.d.ts +18 -0
- package/dist/core/parsers/table.js +110 -0
- package/dist/core/parsers/thematic-break.d.ts +1 -0
- package/dist/core/parsers/thematic-break.js +19 -0
- package/dist/core/serializer.d.ts +15 -0
- package/dist/core/serializer.js +11 -0
- package/dist/core/terminator-escalation.d.ts +8 -0
- package/dist/core/terminator-escalation.js +18 -0
- package/dist/core/url-policy.d.ts +14 -0
- package/dist/core/url-policy.js +44 -0
- package/dist/cursor/content-offsets.d.ts +29 -0
- package/dist/cursor/content-offsets.js +151 -0
- package/dist/cursor/coordinate-spaces.d.ts +65 -0
- package/dist/cursor/coordinate-spaces.js +66 -0
- package/dist/cursor/dom-walk.d.ts +18 -0
- package/dist/cursor/dom-walk.js +31 -0
- package/dist/cursor/edge-affinity.d.ts +44 -0
- package/dist/cursor/edge-affinity.js +60 -0
- package/dist/cursor/focused-caret.d.ts +10 -0
- package/dist/cursor/focused-caret.js +24 -0
- package/dist/cursor/height-model.d.ts +24 -0
- package/dist/cursor/height-model.js +72 -0
- package/dist/cursor/height-oracle.d.ts +24 -0
- package/dist/cursor/height-oracle.js +94 -0
- package/dist/cursor/overlay-rects.d.ts +8 -0
- package/dist/cursor/overlay-rects.js +19 -0
- package/dist/cursor/overlay-remeasure.d.ts +17 -0
- package/dist/cursor/overlay-remeasure.js +31 -0
- package/dist/cursor/pending-marks.d.ts +24 -0
- package/dist/cursor/pending-marks.js +36 -0
- package/dist/cursor/point-offset.d.ts +21 -0
- package/dist/cursor/point-offset.js +48 -0
- package/dist/cursor/reveal-anchor.d.ts +30 -0
- package/dist/cursor/reveal-anchor.js +31 -0
- package/dist/cursor/reveal-source.d.ts +35 -0
- package/dist/cursor/reveal-source.js +51 -0
- package/dist/cursor/scroll-ancestors.d.ts +28 -0
- package/dist/cursor/scroll-ancestors.js +89 -0
- package/dist/cursor/scrollport.d.ts +20 -0
- package/dist/cursor/scrollport.js +41 -0
- package/dist/cursor/sticky-column.d.ts +35 -0
- package/dist/cursor/sticky-column.js +64 -0
- package/dist/cursor/sticky-measure.d.ts +16 -0
- package/dist/cursor/sticky-measure.js +97 -0
- package/dist/cursor/typography-estimates.d.ts +21 -0
- package/dist/cursor/typography-estimates.js +21 -0
- package/dist/cursor/visual-lines.d.ts +25 -0
- package/dist/cursor/visual-lines.js +125 -0
- package/dist/cursor/widget-offset.d.ts +132 -0
- package/dist/cursor/widget-offset.js +543 -0
- package/dist/debug/diagnostics-report.d.ts +17 -0
- package/dist/debug/diagnostics-report.js +25 -0
- package/dist/debug/dump-tree.d.ts +6 -0
- package/dist/debug/dump-tree.js +114 -0
- package/dist/debug/inspect.d.ts +19 -0
- package/dist/debug/inspect.js +116 -0
- package/dist/debug/interaction-trace.d.ts +39 -0
- package/dist/debug/interaction-trace.js +105 -0
- package/dist/debug/operations-log.d.ts +14 -0
- package/dist/debug/operations-log.js +30 -0
- package/dist/decorations/buckets.d.ts +40 -0
- package/dist/decorations/buckets.js +87 -0
- package/dist/decorations/decoration-state.svelte.d.ts +20 -0
- package/dist/decorations/decoration-state.svelte.js +195 -0
- package/dist/decorations/island-dom.d.ts +35 -0
- package/dist/decorations/island-dom.js +148 -0
- package/dist/decorations/reserved-attrs.d.ts +12 -0
- package/dist/decorations/reserved-attrs.js +47 -0
- package/dist/decorations/types.d.ts +68 -0
- package/dist/decorations/types.js +5 -0
- package/dist/decorations/widget-dom.d.ts +15 -0
- package/dist/decorations/widget-dom.js +35 -0
- package/dist/dev-warn.d.ts +13 -0
- package/dist/dev-warn.js +28 -0
- package/dist/editor-actions/ancestry-folds.d.ts +32 -0
- package/dist/editor-actions/ancestry-folds.js +106 -0
- package/dist/editor-actions/block-edit-core.d.ts +29 -0
- package/dist/editor-actions/block-edit-core.js +277 -0
- package/dist/editor-actions/block-edit-scope.d.ts +79 -0
- package/dist/editor-actions/block-edit-scope.js +76 -0
- package/dist/editor-actions/block-edit.d.ts +8 -0
- package/dist/editor-actions/block-edit.js +111 -0
- package/dist/editor-actions/commit/history.d.ts +9 -0
- package/dist/editor-actions/commit/history.js +77 -0
- package/dist/editor-actions/commit/text-batch.d.ts +34 -0
- package/dist/editor-actions/commit/text-batch.js +61 -0
- package/dist/editor-actions/commit/undo-controller.d.ts +7 -0
- package/dist/editor-actions/commit/undo-controller.js +570 -0
- package/dist/editor-actions/container-block-component.d.ts +85 -0
- package/dist/editor-actions/container-block-component.js +228 -0
- package/dist/editor-actions/container-edit.d.ts +7 -0
- package/dist/editor-actions/container-edit.js +49 -0
- package/dist/editor-actions/container-exit-overrides.d.ts +16 -0
- package/dist/editor-actions/container-exit-overrides.js +38 -0
- package/dist/editor-actions/deps.d.ts +60 -0
- package/dist/editor-actions/deps.js +1 -0
- package/dist/editor-actions/enter-completion.d.ts +25 -0
- package/dist/editor-actions/enter-completion.js +76 -0
- package/dist/editor-actions/focus/focus-dispatch.d.ts +36 -0
- package/dist/editor-actions/focus/focus-dispatch.js +106 -0
- package/dist/editor-actions/focus/focus-landing.d.ts +7 -0
- package/dist/editor-actions/focus/focus-landing.js +39 -0
- package/dist/editor-actions/focus/focus.d.ts +7 -0
- package/dist/editor-actions/focus/focus.js +74 -0
- package/dist/editor-actions/index.d.ts +15 -0
- package/dist/editor-actions/index.js +19 -0
- package/dist/editor-actions/inline-range-commit.d.ts +20 -0
- package/dist/editor-actions/inline-range-commit.js +63 -0
- package/dist/editor-actions/list-context.d.ts +25 -0
- package/dist/editor-actions/list-context.js +285 -0
- package/dist/editor-actions/list-overrides.d.ts +13 -0
- package/dist/editor-actions/list-overrides.js +26 -0
- package/dist/editor-actions/merge-fallback.d.ts +19 -0
- package/dist/editor-actions/merge-fallback.js +27 -0
- package/dist/editor-actions/nested/nested-actions.d.ts +65 -0
- package/dist/editor-actions/nested/nested-actions.js +59 -0
- package/dist/editor-actions/nested/nested-block-edit.d.ts +10 -0
- package/dist/editor-actions/nested/nested-block-edit.js +181 -0
- package/dist/editor-actions/nested/nested-focus.d.ts +9 -0
- package/dist/editor-actions/nested/nested-focus.js +30 -0
- package/dist/editor-actions/paste-coordinator.d.ts +4 -0
- package/dist/editor-actions/paste-coordinator.js +20 -0
- package/dist/editor-actions/plugin/chrome-leaf.d.ts +25 -0
- package/dist/editor-actions/plugin/chrome-leaf.js +80 -0
- package/dist/editor-actions/plugin/container.d.ts +137 -0
- package/dist/editor-actions/plugin/container.js +351 -0
- package/dist/editor-actions/plugin/directive-container.d.ts +13 -0
- package/dist/editor-actions/plugin/directive-container.js +31 -0
- package/dist/editor-actions/reorder-action.d.ts +17 -0
- package/dist/editor-actions/reorder-action.js +104 -0
- package/dist/editor-actions/reorder-drag.d.ts +34 -0
- package/dist/editor-actions/reorder-drag.js +152 -0
- package/dist/editor-actions/replacement-focus.d.ts +27 -0
- package/dist/editor-actions/replacement-focus.js +60 -0
- package/dist/editor-actions/search-replace.d.ts +6 -0
- package/dist/editor-actions/search-replace.js +145 -0
- package/dist/editor-actions/table-context.d.ts +34 -0
- package/dist/editor-actions/table-context.js +292 -0
- package/dist/editor-actions/unwrap-strategies.d.ts +14 -0
- package/dist/editor-actions/unwrap-strategies.js +131 -0
- package/dist/editor-actions/whole-block-focus-surface.d.ts +51 -0
- package/dist/editor-actions/whole-block-focus-surface.js +171 -0
- package/dist/editor-events.d.ts +89 -0
- package/dist/editor-events.js +96 -0
- package/dist/editor-keys.d.ts +197 -0
- package/dist/editor-keys.js +40 -0
- package/dist/editor-props.d.ts +164 -0
- package/dist/editor-props.js +1 -0
- package/dist/editor-rects.d.ts +58 -0
- package/dist/editor-rects.js +114 -0
- package/dist/env.d.ts +12 -0
- package/dist/env.js +20 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +19 -0
- package/dist/invariants/commit-paths.d.ts +10 -0
- package/dist/invariants/commit-paths.js +25 -0
- package/dist/invariants/commit-scope.d.ts +9 -0
- package/dist/invariants/commit-scope.js +16 -0
- package/dist/invariants/context-keys.d.ts +7 -0
- package/dist/invariants/context-keys.js +14 -0
- package/dist/invariants/descriptor.d.ts +10 -0
- package/dist/invariants/descriptor.js +24 -0
- package/dist/invariants/inline-transitions.d.ts +23 -0
- package/dist/invariants/inline-transitions.js +52 -0
- package/dist/invariants/install.d.ts +36 -0
- package/dist/invariants/install.js +66 -0
- package/dist/invariants/landable-caret.d.ts +12 -0
- package/dist/invariants/landable-caret.js +31 -0
- package/dist/invariants/marker-css-parity.d.ts +10 -0
- package/dist/invariants/marker-css-parity.js +87 -0
- package/dist/invariants/node-shape.d.ts +44 -0
- package/dist/invariants/node-shape.js +258 -0
- package/dist/invariants/registry.d.ts +126 -0
- package/dist/invariants/registry.js +349 -0
- package/dist/invariants/render-fidelity.d.ts +8 -0
- package/dist/invariants/render-fidelity.js +33 -0
- package/dist/invariants/selection-endpoints.d.ts +19 -0
- package/dist/invariants/selection-endpoints.js +78 -0
- package/dist/invariants/single-node-sink.d.ts +9 -0
- package/dist/invariants/single-node-sink.js +16 -0
- package/dist/invariants/snapshot-integrity.d.ts +17 -0
- package/dist/invariants/snapshot-integrity.js +24 -0
- package/dist/invariants/split-landing.d.ts +8 -0
- package/dist/invariants/split-landing.js +15 -0
- package/dist/invariants/structural-descriptor.d.ts +21 -0
- package/dist/invariants/structural-descriptor.js +50 -0
- package/dist/perf/instruments.d.ts +49 -0
- package/dist/perf/instruments.js +154 -0
- package/dist/perf/use-mount-gauge.svelte.d.ts +1 -0
- package/dist/perf/use-mount-gauge.svelte.js +15 -0
- package/dist/plugin.d.ts +102 -0
- package/dist/plugin.js +156 -0
- package/dist/plugins/admonitions/AdmonitionBlock.svelte +144 -0
- package/dist/plugins/admonitions/AdmonitionBlock.svelte.d.ts +11 -0
- package/dist/plugins/admonitions/admonition-kind.d.ts +8 -0
- package/dist/plugins/admonitions/admonition-kind.js +97 -0
- package/dist/plugins/admonitions/convert-document.d.ts +11 -0
- package/dist/plugins/admonitions/convert-document.js +39 -0
- package/dist/plugins/admonitions/gh-alert.d.ts +13 -0
- package/dist/plugins/admonitions/gh-alert.js +83 -0
- package/dist/plugins/admonitions/github-alert-kind.d.ts +12 -0
- package/dist/plugins/admonitions/github-alert-kind.js +125 -0
- package/dist/plugins/admonitions/index.d.ts +6 -0
- package/dist/plugins/admonitions/index.js +8 -0
- package/dist/plugins/admonitions/kinds.d.ts +26 -0
- package/dist/plugins/admonitions/kinds.js +18 -0
- package/dist/plugins/admonitions/register.d.ts +7 -0
- package/dist/plugins/admonitions/register.js +12 -0
- package/dist/plugins/details/DetailsBlock.svelte +129 -0
- package/dist/plugins/details/DetailsBlock.svelte.d.ts +11 -0
- package/dist/plugins/details/details-disclosure.svelte.d.ts +17 -0
- package/dist/plugins/details/details-disclosure.svelte.js +24 -0
- package/dist/plugins/details/details-kind.d.ts +25 -0
- package/dist/plugins/details/details-kind.js +237 -0
- package/dist/plugins/details/index.d.ts +2 -0
- package/dist/plugins/details/index.js +2 -0
- package/dist/plugins/details/register.d.ts +6 -0
- package/dist/plugins/details/register.js +15 -0
- package/dist/plugins/emoji/emoji-plugin.d.ts +2 -0
- package/dist/plugins/emoji/emoji-plugin.js +10 -0
- package/dist/plugins/emoji/emoji-recognizer.d.ts +18 -0
- package/dist/plugins/emoji/emoji-recognizer.js +63 -0
- package/dist/plugins/emoji/emoji-table.d.ts +1 -0
- package/dist/plugins/emoji/emoji-table.js +1919 -0
- package/dist/plugins/emoji/index.d.ts +3 -0
- package/dist/plugins/emoji/index.js +4 -0
- package/dist/plugins/footnotes/FootnoteDefinition.svelte +103 -0
- package/dist/plugins/footnotes/FootnoteDefinition.svelte.d.ts +13 -0
- package/dist/plugins/footnotes/FootnoteReference.svelte +50 -0
- package/dist/plugins/footnotes/FootnoteReference.svelte.d.ts +4 -0
- package/dist/plugins/footnotes/constants.d.ts +2 -0
- package/dist/plugins/footnotes/constants.js +4 -0
- package/dist/plugins/footnotes/footnote-definition.d.ts +14 -0
- package/dist/plugins/footnotes/footnote-definition.js +147 -0
- package/dist/plugins/footnotes/footnote-lookup.d.ts +9 -0
- package/dist/plugins/footnotes/footnote-lookup.js +33 -0
- package/dist/plugins/footnotes/footnote-numbering.d.ts +23 -0
- package/dist/plugins/footnotes/footnote-numbering.js +78 -0
- package/dist/plugins/footnotes/footnote-reference.d.ts +7 -0
- package/dist/plugins/footnotes/footnote-reference.js +54 -0
- package/dist/plugins/footnotes/footnotes-plugin.d.ts +7 -0
- package/dist/plugins/footnotes/footnotes-plugin.js +17 -0
- package/dist/plugins/footnotes/index.d.ts +5 -0
- package/dist/plugins/footnotes/index.js +6 -0
- package/dist/plugins/highlight-occurrences/highlight-occurrences-plugin.d.ts +17 -0
- package/dist/plugins/highlight-occurrences/highlight-occurrences-plugin.js +31 -0
- package/dist/plugins/highlight-occurrences/index.d.ts +1 -0
- package/dist/plugins/highlight-occurrences/index.js +1 -0
- package/dist/plugins/highlight-occurrences/occurrence-source.d.ts +26 -0
- package/dist/plugins/highlight-occurrences/occurrence-source.js +54 -0
- package/dist/plugins/highlight-occurrences/occurrences.d.ts +33 -0
- package/dist/plugins/highlight-occurrences/occurrences.js +108 -0
- package/dist/plugins/latex/BlockMath.svelte +119 -0
- package/dist/plugins/latex/BlockMath.svelte.d.ts +21 -0
- package/dist/plugins/latex/MathInline.svelte +28 -0
- package/dist/plugins/latex/MathInline.svelte.d.ts +4 -0
- package/dist/plugins/latex/index.d.ts +3 -0
- package/dist/plugins/latex/index.js +4 -0
- package/dist/plugins/latex/latex-kind.d.ts +17 -0
- package/dist/plugins/latex/latex-kind.js +224 -0
- package/dist/plugins/latex/math-completion.d.ts +10 -0
- package/dist/plugins/latex/math-completion.js +19 -0
- package/dist/plugins/latex/math-renderer.d.ts +26 -0
- package/dist/plugins/latex/math-renderer.js +42 -0
- package/dist/plugins/latex/register.d.ts +10 -0
- package/dist/plugins/latex/register.js +23 -0
- package/dist/plugins/latex/renderer.d.ts +13 -0
- package/dist/plugins/latex/renderer.js +34 -0
- package/dist/plugins/mermaid/MermaidBlock.svelte +572 -0
- package/dist/plugins/mermaid/MermaidBlock.svelte.d.ts +11 -0
- package/dist/plugins/mermaid/index.d.ts +3 -0
- package/dist/plugins/mermaid/index.js +3 -0
- package/dist/plugins/mermaid/mermaid-kind.d.ts +38 -0
- package/dist/plugins/mermaid/mermaid-kind.js +176 -0
- package/dist/plugins/mermaid/mermaid-renderer.d.ts +28 -0
- package/dist/plugins/mermaid/mermaid-renderer.js +35 -0
- package/dist/plugins/mermaid/register.d.ts +10 -0
- package/dist/plugins/mermaid/register.js +20 -0
- package/dist/plugins/mermaid/renderer.d.ts +11 -0
- package/dist/plugins/mermaid/renderer.js +53 -0
- package/dist/plugins/parrot/ParrotBlock.svelte +342 -0
- package/dist/plugins/parrot/ParrotBlock.svelte.d.ts +21 -0
- package/dist/plugins/parrot/index.d.ts +1 -0
- package/dist/plugins/parrot/index.js +2 -0
- package/dist/plugins/parrot/parrot-plugin.d.ts +3 -0
- package/dist/plugins/parrot/parrot-plugin.js +49 -0
- package/dist/plugins/toc/TocBlock.svelte +218 -0
- package/dist/plugins/toc/TocBlock.svelte.d.ts +24 -0
- package/dist/plugins/toc/heading-outline.d.ts +28 -0
- package/dist/plugins/toc/heading-outline.js +65 -0
- package/dist/plugins/toc/index.d.ts +2 -0
- package/dist/plugins/toc/index.js +2 -0
- package/dist/plugins/toc/navigation-queue.d.ts +12 -0
- package/dist/plugins/toc/navigation-queue.js +21 -0
- package/dist/plugins/toc/toc-plugin.d.ts +16 -0
- package/dist/plugins/toc/toc-plugin.js +71 -0
- package/dist/presentation-mode.d.ts +32 -0
- package/dist/presentation-mode.js +50 -0
- package/dist/reactivity/block-list-state.svelte.d.ts +22 -0
- package/dist/reactivity/block-list-state.svelte.js +46 -0
- package/dist/reactivity/block-window.svelte.d.ts +41 -0
- package/dist/reactivity/block-window.svelte.js +93 -0
- package/dist/reactivity/content-version.svelte.d.ts +14 -0
- package/dist/reactivity/content-version.svelte.js +16 -0
- package/dist/reactivity/list-windowing.svelte.d.ts +100 -0
- package/dist/reactivity/list-windowing.svelte.js +402 -0
- package/dist/reactivity/measure-batch.d.ts +15 -0
- package/dist/reactivity/measure-batch.js +18 -0
- package/dist/reactivity/publish-ref.svelte.d.ts +54 -0
- package/dist/reactivity/publish-ref.svelte.js +128 -0
- package/dist/reactivity/scope-geometry.d.ts +18 -0
- package/dist/reactivity/scope-geometry.js +29 -0
- package/dist/reactivity/state-registry.d.ts +10 -0
- package/dist/reactivity/state-registry.js +44 -0
- package/dist/reactivity/use-container-windowing.svelte.d.ts +35 -0
- package/dist/reactivity/use-container-windowing.svelte.js +95 -0
- package/dist/reactivity/window-slice.d.ts +11 -0
- package/dist/reactivity/window-slice.js +9 -0
- package/dist/scan-index.d.ts +11 -0
- package/dist/scan-index.js +27 -0
- package/dist/schema/block-commands.d.ts +105 -0
- package/dist/schema/block-commands.js +179 -0
- package/dist/schema/block-completions.d.ts +33 -0
- package/dist/schema/block-completions.js +49 -0
- package/dist/schema/block-component-registry.d.ts +33 -0
- package/dist/schema/block-component-registry.js +33 -0
- package/dist/schema/block-kind-descriptor.d.ts +281 -0
- package/dist/schema/block-kind-descriptor.js +187 -0
- package/dist/schema/block-openers.d.ts +94 -0
- package/dist/schema/block-openers.js +150 -0
- package/dist/schema/built-in-descriptors.d.ts +8 -0
- package/dist/schema/built-in-descriptors.js +560 -0
- package/dist/schema/child-spans.d.ts +25 -0
- package/dist/schema/child-spans.js +161 -0
- package/dist/schema/closure.d.ts +39 -0
- package/dist/schema/closure.js +55 -0
- package/dist/schema/command-id.d.ts +20 -0
- package/dist/schema/command-id.js +42 -0
- package/dist/schema/commands.d.ts +147 -0
- package/dist/schema/commands.js +294 -0
- package/dist/schema/container-raw.d.ts +21 -0
- package/dist/schema/container-raw.js +43 -0
- package/dist/schema/container-rebuilders.d.ts +32 -0
- package/dist/schema/container-rebuilders.js +95 -0
- package/dist/schema/define-plugin-block.d.ts +15 -0
- package/dist/schema/define-plugin-block.js +18 -0
- package/dist/schema/fenced-code-raw.d.ts +43 -0
- package/dist/schema/fenced-code-raw.js +220 -0
- package/dist/schema/global-commands.d.ts +11 -0
- package/dist/schema/global-commands.js +40 -0
- package/dist/schema/inline-construct-policy.d.ts +131 -0
- package/dist/schema/inline-construct-policy.js +96 -0
- package/dist/schema/keybinding-overrides.d.ts +39 -0
- package/dist/schema/keybinding-overrides.js +43 -0
- package/dist/schema/keybindings.d.ts +36 -0
- package/dist/schema/keybindings.js +75 -0
- package/dist/schema/merge-rules.d.ts +28 -0
- package/dist/schema/merge-rules.js +57 -0
- package/dist/schema/opener-priorities.d.ts +16 -0
- package/dist/schema/opener-priorities.js +16 -0
- package/dist/schema/operations.d.ts +110 -0
- package/dist/schema/operations.js +6 -0
- package/dist/schema/plugin-activation.d.ts +13 -0
- package/dist/schema/plugin-activation.js +18 -0
- package/dist/schema/plugin-editor-context.d.ts +33 -0
- package/dist/schema/plugin-editor-context.js +65 -0
- package/dist/schema/plugin-install.d.ts +58 -0
- package/dist/schema/plugin-install.js +132 -0
- package/dist/schema/plugin-kind.d.ts +21 -0
- package/dist/schema/plugin-kind.js +86 -0
- package/dist/schema/plugin-name.d.ts +1 -0
- package/dist/schema/plugin-name.js +7 -0
- package/dist/schema/register-once.d.ts +9 -0
- package/dist/schema/register-once.js +35 -0
- package/dist/schema/registration-checks.d.ts +32 -0
- package/dist/schema/registration-checks.js +122 -0
- package/dist/schema/registration-pending.d.ts +28 -0
- package/dist/schema/registration-pending.js +48 -0
- package/dist/schema/registry-reset.d.ts +7 -0
- package/dist/schema/registry-reset.js +30 -0
- package/dist/schema/registry-view.d.ts +30 -0
- package/dist/schema/registry-view.js +39 -0
- package/dist/schema/reserved-chords.d.ts +35 -0
- package/dist/schema/reserved-chords.js +313 -0
- package/dist/schema/reserved-chrome.d.ts +23 -0
- package/dist/schema/reserved-chrome.js +33 -0
- package/dist/schema/table-cell-raw.d.ts +14 -0
- package/dist/schema/table-cell-raw.js +30 -0
- package/dist/schema/whole-block-unit.d.ts +8 -0
- package/dist/schema/whole-block-unit.js +12 -0
- package/dist/search/document-scan.d.ts +22 -0
- package/dist/search/document-scan.js +39 -0
- package/dist/search/matcher.d.ts +31 -0
- package/dist/search/matcher.js +70 -0
- package/dist/search/regex-executor.d.ts +41 -0
- package/dist/search/regex-executor.js +165 -0
- package/dist/search/replace.d.ts +15 -0
- package/dist/search/replace.js +29 -0
- package/dist/search/search-state.svelte.d.ts +59 -0
- package/dist/search/search-state.svelte.js +231 -0
- package/dist/selection/autoscroll.d.ts +26 -0
- package/dist/selection/autoscroll.js +91 -0
- package/dist/selection/block-hit-test.d.ts +37 -0
- package/dist/selection/block-hit-test.js +59 -0
- package/dist/selection/caret-doors.d.ts +20 -0
- package/dist/selection/caret-doors.js +44 -0
- package/dist/selection/caret-restore.d.ts +15 -0
- package/dist/selection/caret-restore.js +32 -0
- package/dist/selection/char-endpoint-snap.d.ts +15 -0
- package/dist/selection/char-endpoint-snap.js +39 -0
- package/dist/selection/clipboard-text.d.ts +13 -0
- package/dist/selection/clipboard-text.js +314 -0
- package/dist/selection/cross-block/clipboard.d.ts +14 -0
- package/dist/selection/cross-block/clipboard.js +20 -0
- package/dist/selection/cross-block/dispatch.d.ts +78 -0
- package/dist/selection/cross-block/dispatch.js +57 -0
- package/dist/selection/cross-block/format-range.d.ts +38 -0
- package/dist/selection/cross-block/format-range.js +193 -0
- package/dist/selection/cross-block/format-toggle.d.ts +27 -0
- package/dist/selection/cross-block/format-toggle.js +109 -0
- package/dist/selection/cross-block/keydown.d.ts +11 -0
- package/dist/selection/cross-block/keydown.js +339 -0
- package/dist/selection/cross-block/ops.d.ts +56 -0
- package/dist/selection/cross-block/ops.js +210 -0
- package/dist/selection/cross-block/paste.d.ts +8 -0
- package/dist/selection/cross-block/paste.js +156 -0
- package/dist/selection/cross-block/pointer.d.ts +19 -0
- package/dist/selection/cross-block/pointer.js +80 -0
- package/dist/selection/cross-block/type-replace.d.ts +10 -0
- package/dist/selection/cross-block/type-replace.js +129 -0
- package/dist/selection/dead-space-caret.d.ts +39 -0
- package/dist/selection/dead-space-caret.js +173 -0
- package/dist/selection/drag-pointer.d.ts +22 -0
- package/dist/selection/drag-pointer.js +89 -0
- package/dist/selection/gap-caret.d.ts +47 -0
- package/dist/selection/gap-caret.js +72 -0
- package/dist/selection/keyboard-extend.d.ts +43 -0
- package/dist/selection/keyboard-extend.js +257 -0
- package/dist/selection/native-bridge.d.ts +47 -0
- package/dist/selection/native-bridge.js +204 -0
- package/dist/selection/nearest-block.d.ts +43 -0
- package/dist/selection/nearest-block.js +73 -0
- package/dist/selection/path-lookup.d.ts +32 -0
- package/dist/selection/path-lookup.js +132 -0
- package/dist/selection/path-math.d.ts +35 -0
- package/dist/selection/path-math.js +90 -0
- package/dist/selection/pointer-session.d.ts +43 -0
- package/dist/selection/pointer-session.js +111 -0
- package/dist/selection/primitives.d.ts +75 -0
- package/dist/selection/primitives.js +91 -0
- package/dist/selection/range-delete-ceremony.d.ts +85 -0
- package/dist/selection/range-delete-ceremony.js +197 -0
- package/dist/selection/range-delete-chrome.d.ts +39 -0
- package/dist/selection/range-delete-chrome.js +105 -0
- package/dist/selection/range-delete-table-coverage.d.ts +28 -0
- package/dist/selection/range-delete-table-coverage.js +168 -0
- package/dist/selection/range-delete-table.d.ts +16 -0
- package/dist/selection/range-delete-table.js +347 -0
- package/dist/selection/range-delete.d.ts +33 -0
- package/dist/selection/range-delete.js +121 -0
- package/dist/selection/selection-description.d.ts +7 -0
- package/dist/selection/selection-description.js +18 -0
- package/dist/selection/selection-restore.d.ts +46 -0
- package/dist/selection/selection-restore.js +66 -0
- package/dist/selection/selection-state.svelte.d.ts +72 -0
- package/dist/selection/selection-state.svelte.js +247 -0
- package/dist/selection/shared-keydown.d.ts +61 -0
- package/dist/selection/shared-keydown.js +150 -0
- package/dist/selection/table-endpoint-snap.d.ts +55 -0
- package/dist/selection/table-endpoint-snap.js +143 -0
- package/dist/selection/table-rect-extend.d.ts +23 -0
- package/dist/selection/table-rect-extend.js +46 -0
- package/dist/selection/widget-range-paint.d.ts +12 -0
- package/dist/selection/widget-range-paint.js +44 -0
- package/dist/styles/editor-theme.css +151 -0
- package/dist/styles/editor.css +585 -0
- package/dist/testing/conformance-core.d.ts +45 -0
- package/dist/testing/conformance-core.js +105 -0
- package/dist/testing/container-conformance.d.ts +137 -0
- package/dist/testing/container-conformance.js +533 -0
- package/dist/testing/headless-actions.d.ts +37 -0
- package/dist/testing/headless-actions.js +118 -0
- package/dist/testing/inline-conformance.d.ts +50 -0
- package/dist/testing/inline-conformance.js +442 -0
- package/dist/testing/kind-conformance.d.ts +54 -0
- package/dist/testing/kind-conformance.js +325 -0
- package/dist/testing/mount-dom-stubs.d.ts +8 -0
- package/dist/testing/mount-dom-stubs.js +19 -0
- package/dist/testing/parse-convergence.d.ts +14 -0
- package/dist/testing/parse-convergence.js +81 -0
- package/dist/testing.d.ts +20 -0
- package/dist/testing.js +61 -0
- package/dist/tree-operations/blockquote.d.ts +18 -0
- package/dist/tree-operations/blockquote.js +59 -0
- package/dist/tree-operations/children.d.ts +17 -0
- package/dist/tree-operations/children.js +56 -0
- package/dist/tree-operations/cleanup.d.ts +10 -0
- package/dist/tree-operations/cleanup.js +25 -0
- package/dist/tree-operations/clone.d.ts +5 -0
- package/dist/tree-operations/clone.js +43 -0
- package/dist/tree-operations/container-lift.d.ts +9 -0
- package/dist/tree-operations/container-lift.js +29 -0
- package/dist/tree-operations/index.d.ts +16 -0
- package/dist/tree-operations/index.js +14 -0
- package/dist/tree-operations/list/empty-check.d.ts +7 -0
- package/dist/tree-operations/list/empty-check.js +19 -0
- package/dist/tree-operations/list/exit-replacement.d.ts +13 -0
- package/dist/tree-operations/list/exit-replacement.js +49 -0
- package/dist/tree-operations/list/item-partition.d.ts +13 -0
- package/dist/tree-operations/list/item-partition.js +33 -0
- package/dist/tree-operations/list/list-builders.d.ts +44 -0
- package/dist/tree-operations/list/list-builders.js +129 -0
- package/dist/tree-operations/list/ordered-markers.d.ts +36 -0
- package/dist/tree-operations/list/ordered-markers.js +114 -0
- package/dist/tree-operations/list/reconcile-task.d.ts +12 -0
- package/dist/tree-operations/list/reconcile-task.js +47 -0
- package/dist/tree-operations/list/sublist-separator.d.ts +13 -0
- package/dist/tree-operations/list/sublist-separator.js +34 -0
- package/dist/tree-operations/list/terminator.d.ts +17 -0
- package/dist/tree-operations/list/terminator.js +60 -0
- package/dist/tree-operations/list/unwrap-merge.d.ts +29 -0
- package/dist/tree-operations/list/unwrap-merge.js +202 -0
- package/dist/tree-operations/node-ops.d.ts +296 -0
- package/dist/tree-operations/node-ops.js +1428 -0
- package/dist/tree-operations/parse-block.d.ts +3 -0
- package/dist/tree-operations/parse-block.js +8 -0
- package/dist/tree-operations/paste/apply.d.ts +12 -0
- package/dist/tree-operations/paste/apply.js +75 -0
- package/dist/tree-operations/paste/body-write.d.ts +19 -0
- package/dist/tree-operations/paste/body-write.js +53 -0
- package/dist/tree-operations/paste/container-match.d.ts +32 -0
- package/dist/tree-operations/paste/container-match.js +238 -0
- package/dist/tree-operations/paste/container-paste.d.ts +10 -0
- package/dist/tree-operations/paste/container-paste.js +27 -0
- package/dist/tree-operations/paste/dispatch.d.ts +61 -0
- package/dist/tree-operations/paste/dispatch.js +138 -0
- package/dist/tree-operations/paste/find-enclosing-list.d.ts +8 -0
- package/dist/tree-operations/paste/find-enclosing-list.js +30 -0
- package/dist/tree-operations/paste/focus-target.d.ts +27 -0
- package/dist/tree-operations/paste/focus-target.js +40 -0
- package/dist/tree-operations/paste/hooks.d.ts +17 -0
- package/dist/tree-operations/paste/hooks.js +80 -0
- package/dist/tree-operations/paste/list-absorb.d.ts +29 -0
- package/dist/tree-operations/paste/list-absorb.js +106 -0
- package/dist/tree-operations/paste/list-break-out.d.ts +42 -0
- package/dist/tree-operations/paste/list-break-out.js +136 -0
- package/dist/tree-operations/paste/parent-scope.d.ts +17 -0
- package/dist/tree-operations/paste/parent-scope.js +35 -0
- package/dist/tree-operations/paste/paste-deps.d.ts +20 -0
- package/dist/tree-operations/paste/paste-deps.js +6 -0
- package/dist/tree-operations/paste/paste-replacement.d.ts +8 -0
- package/dist/tree-operations/paste/paste-replacement.js +60 -0
- package/dist/tree-operations/paste/paste-transforms.d.ts +25 -0
- package/dist/tree-operations/paste/paste-transforms.js +72 -0
- package/dist/tree-operations/paste/replace-block-at-parent.d.ts +29 -0
- package/dist/tree-operations/paste/replace-block-at-parent.js +75 -0
- package/dist/tree-operations/paste/strategy.d.ts +9 -0
- package/dist/tree-operations/paste/strategy.js +20 -0
- package/dist/tree-operations/paste/table-slice.d.ts +10 -0
- package/dist/tree-operations/paste/table-slice.js +39 -0
- package/dist/tree-operations/paste-surfaces.d.ts +61 -0
- package/dist/tree-operations/paste-surfaces.js +15 -0
- package/dist/tree-operations/path-mutate.d.ts +12 -0
- package/dist/tree-operations/path-mutate.js +20 -0
- package/dist/tree-operations/reorder-unit.d.ts +17 -0
- package/dist/tree-operations/reorder-unit.js +37 -0
- package/dist/tree-operations/reorder.d.ts +13 -0
- package/dist/tree-operations/reorder.js +57 -0
- package/dist/tree-operations/sharing.d.ts +18 -0
- package/dist/tree-operations/sharing.js +14 -0
- package/dist/tree-operations/splice-many.d.ts +9 -0
- package/dist/tree-operations/splice-many.js +22 -0
- package/dist/tree-operations/structural-change.d.ts +65 -0
- package/dist/tree-operations/structural-change.js +117 -0
- package/dist/tree-operations/sub-table-copy.d.ts +6 -0
- package/dist/tree-operations/sub-table-copy.js +43 -0
- package/dist/tree-operations/table-mutations.d.ts +17 -0
- package/dist/tree-operations/table-mutations.js +101 -0
- package/dist/tree-operations/unshare.d.ts +101 -0
- package/dist/tree-operations/unshare.js +248 -0
- package/dist/undo/manager.d.ts +2 -0
- package/dist/undo/manager.js +50 -0
- package/dist/undo/types.d.ts +44 -0
- package/dist/undo/types.js +7 -0
- package/docs/guide/consumer-guide.md +1098 -0
- package/docs/guide/directives.md +223 -0
- package/docs/guide/plugin-api.md +329 -0
- package/docs/guide/plugin-guide/conspiracy.gif +0 -0
- package/docs/guide/plugin-guide/parrot-frames.md +209 -0
- package/docs/guide/plugin-guide/parrot.gif +0 -0
- package/docs/guide/plugin-guide.md +1693 -0
- package/docs/guide/plugin-testing.md +463 -0
- package/package.json +238 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reserved-chrome branch of rangeDelete, the wall rule: nothing merges across a
|
|
3
|
+
* `reservedChrome` container's wall. Outside endpoints truncate in place, covered chrome clears
|
|
4
|
+
* (never node-deletes, G1.14), covered body children delete, and the container dies only when
|
|
5
|
+
* the range consumes its whole subtree, then as ONE splice with children intact.
|
|
6
|
+
*/
|
|
7
|
+
import { displayLength } from '../core/lines';
|
|
8
|
+
import { comparePaths, pathsEqual } from './path-math';
|
|
9
|
+
import { resolveEndWall, planCrossBlockDeletion, applyPlannedDeletion, truncateEndInPlace, truncateStartInPlace } from './range-delete-ceremony';
|
|
10
|
+
import { ensureUnsharedPath, rebuildUnsharedChain } from '../tree-operations/unshare';
|
|
11
|
+
import { reservedChromeKindOf, isReservedChromeChild } from '../schema/reserved-chrome';
|
|
12
|
+
// ── Public API ──────────────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* True when the range must take the wall path: an endpoint sits inside a `reservedChrome`
|
|
15
|
+
* container the range crosses out of or into, or the range starts in the chrome leaf itself.
|
|
16
|
+
* Same-block, body-only, and enclose-from-outside ranges stay on the generic path.
|
|
17
|
+
*/
|
|
18
|
+
export function involvesReservedChrome(doc, start, end) {
|
|
19
|
+
if (comparePaths(start.path, end.path) === 0)
|
|
20
|
+
return false;
|
|
21
|
+
const startC = nearestChromeContainer(doc, start.path);
|
|
22
|
+
const endC = nearestChromeContainer(doc, end.path);
|
|
23
|
+
if (!startC && !endC)
|
|
24
|
+
return false;
|
|
25
|
+
if (startC && endC && pathsEqual(startC.path, endC.path)) {
|
|
26
|
+
return isChromeChild(startC, start.path);
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Delete [start, end] under the wall rule. Both endpoints truncate in place (chrome by a raw
|
|
32
|
+
* write, keeping the kind via contextDependentKind; prose by a reparse of the surviving slice),
|
|
33
|
+
* and nothing merges across the wall. Collapsed caret keeps generic start-position semantics.
|
|
34
|
+
*/
|
|
35
|
+
export function chromeAwareRangeDelete(doc, start, end, sharing, grammar, presentationMode, linkRef) {
|
|
36
|
+
const startC = nearestChromeContainer(doc, start.path);
|
|
37
|
+
const endC = nearestChromeContainer(doc, end.path);
|
|
38
|
+
const live = { presentationMode, linkRef };
|
|
39
|
+
// Own every written spine BEFORE identities are captured (G1.9): chains stay valid across
|
|
40
|
+
// splices, paths don't.
|
|
41
|
+
const startChain = ensureUnsharedPath(doc, start.path, sharing);
|
|
42
|
+
const endChain = ensureUnsharedPath(doc, end.path, sharing);
|
|
43
|
+
// Shared deletion plan (range-delete-ceremony.ts). Chrome marks no endpoint paths for
|
|
44
|
+
// deletion: both endpoints truncate in place below. resolveEndWall returns null when start
|
|
45
|
+
// sits inside the end container, which needs no chrome-clear either way, since that
|
|
46
|
+
// container's chrome child 0 never lands in the strictly-between walk.
|
|
47
|
+
const wall = resolveEndWall(doc, start, end, null);
|
|
48
|
+
const endConsumed = wall?.consumed ?? false;
|
|
49
|
+
const { plan, lcaPath } = planCrossBlockDeletion(doc, start, end, [], wall, sharing);
|
|
50
|
+
// End truncates in place first (its path is still live), the wall: its tail never merges
|
|
51
|
+
// into start. Skipped when its container dies whole.
|
|
52
|
+
if (!endConsumed) {
|
|
53
|
+
truncateEndInPlace(doc, end, endChain[endChain.length - 1], endC !== null && isChromeChild(endC, end.path), live, sharing, 'chromeAwareRangeDelete:end');
|
|
54
|
+
}
|
|
55
|
+
applyPlannedDeletion(doc, plan, lcaPath);
|
|
56
|
+
// Start truncates in place; every deletion sits after it in doc order, so start.path is
|
|
57
|
+
// still live.
|
|
58
|
+
const seam = truncateStartInPlace(doc, start, startChain[startChain.length - 1], startC !== null && isChromeChild(startC, start.path), live, sharing, 'chromeAwareRangeDelete:start');
|
|
59
|
+
// Chain-based rebuilds: node references survive the splices above where paths may not, and
|
|
60
|
+
// every touched container re-emits raw (G1.12).
|
|
61
|
+
rebuildUnsharedChain(doc, startChain, sharing, null, grammar);
|
|
62
|
+
rebuildUnsharedChain(doc, endChain, sharing, null, grammar);
|
|
63
|
+
return {
|
|
64
|
+
newDoc: doc,
|
|
65
|
+
collapsedCaret: { path: start.path.slice(), offset: seam }
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Deepest strict ancestor of `path` whose kind declares reservedChrome. */
|
|
69
|
+
export function nearestChromeContainer(doc, path) {
|
|
70
|
+
let found = null;
|
|
71
|
+
let children = doc.children;
|
|
72
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
73
|
+
const node = children[path[i]];
|
|
74
|
+
if (!node)
|
|
75
|
+
break;
|
|
76
|
+
if (reservedChromeKindOf(node.kind) !== undefined) {
|
|
77
|
+
found = { path: path.slice(0, i + 1), node };
|
|
78
|
+
}
|
|
79
|
+
children = node.children ?? [];
|
|
80
|
+
}
|
|
81
|
+
return found;
|
|
82
|
+
}
|
|
83
|
+
export function isChromeChild(container, leafPath) {
|
|
84
|
+
return (leafPath.length === container.path.length + 1 &&
|
|
85
|
+
isReservedChromeChild(container.node, leafPath[container.path.length]));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The range's end lands on the container's last byte: every step from the container is a
|
|
89
|
+
* last-child edge and the offset consumes the block's visible text.
|
|
90
|
+
*/
|
|
91
|
+
export function rangeConsumesContainer(container, end) {
|
|
92
|
+
const endNode = lastChildDescendant(container, end.path);
|
|
93
|
+
return endNode !== null && end.offset >= displayLength(endNode.raw);
|
|
94
|
+
}
|
|
95
|
+
/** The node at `path` when every step from the container is a last-child edge, else null. */
|
|
96
|
+
export function lastChildDescendant(container, path) {
|
|
97
|
+
let node = container.node;
|
|
98
|
+
for (let i = container.path.length; i < path.length; i++) {
|
|
99
|
+
const children = node.children ?? [];
|
|
100
|
+
if (path[i] !== children.length - 1)
|
|
101
|
+
return null;
|
|
102
|
+
node = children[path[i]];
|
|
103
|
+
}
|
|
104
|
+
return node;
|
|
105
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intra-table coverage-driven delete: a full-table/row/column selection lands inside one table
|
|
3
|
+
* block, so it routes to a structural delete of that table/row/column rather than the
|
|
4
|
+
* cross-block range delete. Subset (cell) coverage returns null for the caller's cell-clear.
|
|
5
|
+
*/
|
|
6
|
+
import { type SelectionPoint } from './primitives';
|
|
7
|
+
import type { CstNode } from '../core/nodes';
|
|
8
|
+
import type { CrossBlockDeleteOptions, CrossBlockMutationContext } from './cross-block/ops';
|
|
9
|
+
/**
|
|
10
|
+
* Coverage of an intra-table cell-index range, driving the Backspace dispatch: a full
|
|
11
|
+
* table/row/column deletes structurally, anything else clears cells.
|
|
12
|
+
*/
|
|
13
|
+
export type TableCoverage = {
|
|
14
|
+
kind: 'table';
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'row';
|
|
17
|
+
rowIdx: number;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'column';
|
|
20
|
+
colIdx: number;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'cells';
|
|
23
|
+
};
|
|
24
|
+
export declare function classifyTableSelectionCoverage(startCellIdx: number, endCellIdx: number, columnCount: number, rowCount: number): TableCoverage;
|
|
25
|
+
/** Null when the selection doesn't qualify (subset coverage, or a guard refusal). */
|
|
26
|
+
export declare function maybeCommitTableCoverageDelete(ctx: CrossBlockMutationContext, table: CstNode, start: SelectionPoint, end: SelectionPoint, options: Pick<CrossBlockDeleteOptions, 'undoEntry'> | undefined, caretRestore: ((caret: SelectionPoint | null) => void) | undefined): Promise<{
|
|
27
|
+
caret: SelectionPoint | null;
|
|
28
|
+
} | null>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intra-table coverage-driven delete: a full-table/row/column selection lands inside one table
|
|
3
|
+
* block, so it routes to a structural delete of that table/row/column rather than the
|
|
4
|
+
* cross-block range delete. Subset (cell) coverage returns null for the caller's cell-clear.
|
|
5
|
+
*/
|
|
6
|
+
import { deleteSnapshot } from './primitives';
|
|
7
|
+
import { metadataOf } from '../core/nodes';
|
|
8
|
+
import { deleteNode, emptyParagraph } from '../tree-operations/node-ops';
|
|
9
|
+
import { trailingLineEnding } from '../core/lines';
|
|
10
|
+
import { expectStateForNode, getStateForNode } from '../reactivity/state-registry';
|
|
11
|
+
import { deleteRow as mutDeleteRow, deleteColumn as mutDeleteColumn, canDeleteRow, canDeleteColumn } from '../tree-operations/table-mutations';
|
|
12
|
+
import { ensureUnsharedChildren } from '../tree-operations/unshare';
|
|
13
|
+
import { cellRowCol, docPathFrom } from '../cursor/coordinate-spaces';
|
|
14
|
+
export function classifyTableSelectionCoverage(startCellIdx, endCellIdx, columnCount, rowCount) {
|
|
15
|
+
const lo = Math.min(startCellIdx, endCellIdx);
|
|
16
|
+
const hi = Math.max(startCellIdx, endCellIdx);
|
|
17
|
+
const cellCount = columnCount * rowCount;
|
|
18
|
+
if (lo === 0 && hi === cellCount - 1)
|
|
19
|
+
return { kind: 'table' };
|
|
20
|
+
const { row: startRow, col: startCol } = cellRowCol(lo, columnCount);
|
|
21
|
+
const { row: endRow, col: endCol } = cellRowCol(hi, columnCount);
|
|
22
|
+
if (startRow === endRow && startCol === 0 && endCol === columnCount - 1) {
|
|
23
|
+
return { kind: 'row', rowIdx: startRow };
|
|
24
|
+
}
|
|
25
|
+
if (startCol === endCol && startRow === 0 && endRow === rowCount - 1) {
|
|
26
|
+
return { kind: 'column', colIdx: startCol };
|
|
27
|
+
}
|
|
28
|
+
return { kind: 'cells' };
|
|
29
|
+
}
|
|
30
|
+
/** Null when the selection doesn't qualify (subset coverage, or a guard refusal). */
|
|
31
|
+
export async function maybeCommitTableCoverageDelete(ctx, table, start, end, options, caretRestore) {
|
|
32
|
+
const meta = metadataOf(table, 'table');
|
|
33
|
+
const columnCount = meta.columnCount;
|
|
34
|
+
const rowCount = table.children?.length ?? 0;
|
|
35
|
+
// Same-path intra-table endpoints are context-established, not flagged, so they read directly.
|
|
36
|
+
const coverage = classifyTableSelectionCoverage(start.offset, end.offset, columnCount, rowCount);
|
|
37
|
+
switch (coverage.kind) {
|
|
38
|
+
case 'cells':
|
|
39
|
+
return null;
|
|
40
|
+
case 'table':
|
|
41
|
+
return { caret: await commitFullTableDelete(ctx, start, options, caretRestore) };
|
|
42
|
+
case 'row': {
|
|
43
|
+
// Mirror Ctrl+Shift+Backspace: ≥1 body row must remain. Refusal is a silent no-op, since
|
|
44
|
+
// falling through to a cell-clear would rewrite the user's intent.
|
|
45
|
+
if (!canDeleteRow(coverage.rowIdx, rowCount))
|
|
46
|
+
return { caret: null };
|
|
47
|
+
const caret = await commitRowDelete(ctx, table, start, coverage.rowIdx, options, caretRestore);
|
|
48
|
+
return { caret };
|
|
49
|
+
}
|
|
50
|
+
case 'column': {
|
|
51
|
+
// Mirror Alt+Shift+Backspace: ≥2 columns must remain.
|
|
52
|
+
if (!canDeleteColumn(columnCount))
|
|
53
|
+
return { caret: null };
|
|
54
|
+
const caret = await commitColumnDelete(ctx, table, start, coverage.colIdx, options, caretRestore);
|
|
55
|
+
return { caret };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async function commitFullTableDelete(ctx, start, options, caretRestore) {
|
|
60
|
+
const tableIdx = start.path[0];
|
|
61
|
+
const snapshot = deleteSnapshot(options, [tableIdx]);
|
|
62
|
+
let collapsedCaret = null;
|
|
63
|
+
await ctx.controller.commitStructural({
|
|
64
|
+
snapshot,
|
|
65
|
+
mutate: (children) => {
|
|
66
|
+
// Read before the delete: with the table gone no block is left to take an ending
|
|
67
|
+
// from, and the filler below IS a line ending (G4.20).
|
|
68
|
+
const lineEnding = trailingLineEnding(children[tableIdx]?.raw ?? '\n');
|
|
69
|
+
const change = deleteNode({ children, ownerKind: undefined, owner: undefined }, tableIdx, ctx.controller.sharing);
|
|
70
|
+
ctx.selection.collapse();
|
|
71
|
+
// A sole-table doc empties to zero blocks, stranding the caret on <body>. Materialize
|
|
72
|
+
// a filler in the same commit so undo restores the table in one step.
|
|
73
|
+
if (children.length === 0) {
|
|
74
|
+
const filler = emptyParagraph('', lineEnding);
|
|
75
|
+
ctx.controller.sharing.stamp(filler);
|
|
76
|
+
children.push(filler);
|
|
77
|
+
collapsedCaret = { path: [0], offset: 0 };
|
|
78
|
+
return { op: 'replace', at: 0, count: 1, newCount: 1 };
|
|
79
|
+
}
|
|
80
|
+
const survivorIdx = Math.min(tableIdx, children.length - 1);
|
|
81
|
+
collapsedCaret = { path: [survivorIdx], offset: 0 };
|
|
82
|
+
return change;
|
|
83
|
+
},
|
|
84
|
+
op: {
|
|
85
|
+
kind: 'delete',
|
|
86
|
+
detail: { crossBlock: true, table: 'whole' },
|
|
87
|
+
eventPath: docPathFrom([tableIdx])
|
|
88
|
+
},
|
|
89
|
+
afterTick: caretRestore ? () => caretRestore(collapsedCaret) : undefined
|
|
90
|
+
});
|
|
91
|
+
return collapsedCaret;
|
|
92
|
+
}
|
|
93
|
+
async function commitRowDelete(ctx, table, start, rowIdx, options, caretRestore) {
|
|
94
|
+
const tableIdx = start.path[0];
|
|
95
|
+
const rowsState = expectStateForNode(table);
|
|
96
|
+
const snapshot = deleteSnapshot(options, [tableIdx, rowIdx]);
|
|
97
|
+
let collapsedCaret = null;
|
|
98
|
+
await ctx.controller.commitContainerStructural({
|
|
99
|
+
containerNode: table,
|
|
100
|
+
path: [tableIdx],
|
|
101
|
+
state: rowsState,
|
|
102
|
+
snapshot,
|
|
103
|
+
mutate: (scope) => {
|
|
104
|
+
// deleteRow promotes the next row to header (a metadata write).
|
|
105
|
+
ensureUnsharedChildren(scope.node, scope.sharing);
|
|
106
|
+
mutDeleteRow(scope.node, rowIdx);
|
|
107
|
+
const newRowCount = scope.node.children?.length ?? 0;
|
|
108
|
+
const targetRow = Math.min(rowIdx, Math.max(0, newRowCount - 1));
|
|
109
|
+
collapsedCaret = { path: [tableIdx, targetRow, 0], offset: 0 };
|
|
110
|
+
ctx.selection.collapse();
|
|
111
|
+
return { op: 'delete', at: rowIdx, count: 1 };
|
|
112
|
+
},
|
|
113
|
+
op: {
|
|
114
|
+
kind: 'tableDeleteRow',
|
|
115
|
+
detail: { rowIdx, crossBlock: true },
|
|
116
|
+
eventPath: docPathFrom([tableIdx, rowIdx])
|
|
117
|
+
},
|
|
118
|
+
afterTick: caretRestore ? () => caretRestore(collapsedCaret) : undefined
|
|
119
|
+
});
|
|
120
|
+
return collapsedCaret;
|
|
121
|
+
}
|
|
122
|
+
async function commitColumnDelete(ctx, table, start, colIdx, options, caretRestore) {
|
|
123
|
+
const tableIdx = start.path[0];
|
|
124
|
+
const rowsState = expectStateForNode(table);
|
|
125
|
+
const rows = table.children ?? [];
|
|
126
|
+
// A row's BlockListState registers on mount, so a windowed-out row has none. Scope only the
|
|
127
|
+
// mounted rows for reactivity; the ensureUnsharedChildren below copy-path-on-writes EVERY
|
|
128
|
+
// row, so the per-row cell splice stays G1.9-safe regardless of mount state.
|
|
129
|
+
const mountedRowScopes = [];
|
|
130
|
+
for (let i = 0; i < rows.length; i++) {
|
|
131
|
+
const state = getStateForNode(rows[i]);
|
|
132
|
+
if (state)
|
|
133
|
+
mountedRowScopes.push({ node: rows[i], state, path: [tableIdx, i] });
|
|
134
|
+
}
|
|
135
|
+
const scopes = [
|
|
136
|
+
{ node: table, state: rowsState, path: [tableIdx] },
|
|
137
|
+
...mountedRowScopes
|
|
138
|
+
];
|
|
139
|
+
const snapshot = deleteSnapshot(options, [tableIdx]);
|
|
140
|
+
let collapsedCaret = null;
|
|
141
|
+
await ctx.controller.commitMultiScope({
|
|
142
|
+
scopes,
|
|
143
|
+
snapshot,
|
|
144
|
+
mutate: (scopeViews) => {
|
|
145
|
+
const ownedTable = scopeViews[0].node;
|
|
146
|
+
// Unshare every row before the splice: mounted rows are already owned via their
|
|
147
|
+
// scope, and this reaches the windowed-out rows the scopes skip.
|
|
148
|
+
ensureUnsharedChildren(ownedTable, scopeViews[0].sharing);
|
|
149
|
+
mutDeleteColumn(ownedTable, colIdx);
|
|
150
|
+
const newColumnCount = metadataOf(ownedTable, 'table').columnCount;
|
|
151
|
+
const targetCol = Math.min(colIdx, Math.max(0, newColumnCount - 1));
|
|
152
|
+
collapsedCaret = { path: [tableIdx, 0, targetCol], offset: 0 };
|
|
153
|
+
ctx.selection.collapse();
|
|
154
|
+
// Every mounted row loses the same cell; the table scope is a no-op.
|
|
155
|
+
const rowDelete = { op: 'delete', at: colIdx, count: 1 };
|
|
156
|
+
return [{ op: 'noop' }, ...mountedRowScopes.map(() => rowDelete)];
|
|
157
|
+
},
|
|
158
|
+
// Event targets the TABLE: a column index is not a child path (parity with
|
|
159
|
+
// table-context's column ops), so colIdx rides in the detail.
|
|
160
|
+
op: {
|
|
161
|
+
kind: 'tableDeleteColumn',
|
|
162
|
+
detail: { colIdx, crossBlock: true },
|
|
163
|
+
eventPath: docPathFrom([tableIdx])
|
|
164
|
+
},
|
|
165
|
+
afterTick: caretRestore ? () => caretRestore(collapsedCaret) : undefined
|
|
166
|
+
});
|
|
167
|
+
return collapsedCaret;
|
|
168
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table-aware branch of rangeDelete: tables encode selection offsets as cell indices, so prose
|
|
3
|
+
* raw-merge doesn't apply. Post-delete survivors are located by identity scan
|
|
4
|
+
* ({@link survivorPath}), not index arithmetic, because deletions and cascade cleanup shift
|
|
5
|
+
* sibling indices at arbitrary depths. One early-exiting scan per delete, and it rides the cold
|
|
6
|
+
* Backspace/Delete gesture, so the linear cost is accepted.
|
|
7
|
+
*/
|
|
8
|
+
import type { GrammarView } from '../schema/block-openers';
|
|
9
|
+
import type { PresentationMode } from '../presentation-mode';
|
|
10
|
+
import type { InlineResolverRef } from '../schema/inline-construct-policy';
|
|
11
|
+
import type { CstNode, Document } from '../core/nodes';
|
|
12
|
+
import type { SelectionPoint } from './primitives';
|
|
13
|
+
import type { RangeDeleteResult } from './range-delete';
|
|
14
|
+
import type { SharingState } from '../tree-operations/sharing';
|
|
15
|
+
export declare function involvesTable(startBlock: CstNode, endBlock: CstNode): boolean;
|
|
16
|
+
export declare function tableAwareRangeDelete(doc: Document, start: SelectionPoint, end: SelectionPoint, sharing: SharingState, grammar: GrammarView | undefined, presentationMode?: PresentationMode, linkRef?: InlineResolverRef): RangeDeleteResult;
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table-aware branch of rangeDelete: tables encode selection offsets as cell indices, so prose
|
|
3
|
+
* raw-merge doesn't apply. Post-delete survivors are located by identity scan
|
|
4
|
+
* ({@link survivorPath}), not index arithmetic, because deletions and cascade cleanup shift
|
|
5
|
+
* sibling indices at arbitrary depths. One early-exiting scan per delete, and it rides the cold
|
|
6
|
+
* Backspace/Delete gesture, so the linear cost is accepted.
|
|
7
|
+
*/
|
|
8
|
+
import { metadataOf } from '../core/nodes';
|
|
9
|
+
import { displayLength, trailingLineEnding } from '../core/lines';
|
|
10
|
+
import { cellRowCol } from '../cursor/coordinate-spaces';
|
|
11
|
+
import { cellIndexOf } from './primitives';
|
|
12
|
+
import { resolveEndWall, planCrossBlockDeletion, applyPlannedDeletion, rebuildSharedAncestries, truncateEndInPlace, truncateStartInPlace } from './range-delete-ceremony';
|
|
13
|
+
import { comparePaths } from './path-math';
|
|
14
|
+
import { blockNodeAt, emptyParagraph } from '../tree-operations/node-ops';
|
|
15
|
+
import { ensureUnsharedNode, ensureUnsharedPath, ensureUnsharedSubtree, rebuildOwnedContainer, rebuildUnsharedAncestry } from '../tree-operations/unshare';
|
|
16
|
+
import { rebuildTableRowRaw } from '../schema/container-rebuilders';
|
|
17
|
+
import { isCollapsedContainer } from '../schema/reserved-chrome';
|
|
18
|
+
import { nearestChromeContainer, isChromeChild } from './range-delete-chrome';
|
|
19
|
+
// ── Public API ──────────────────────────────────────────────────────────────
|
|
20
|
+
export function involvesTable(startBlock, endBlock) {
|
|
21
|
+
return startBlock.kind === 'table' || endBlock.kind === 'table';
|
|
22
|
+
}
|
|
23
|
+
export function tableAwareRangeDelete(doc, start, end, sharing, grammar, presentationMode, linkRef) {
|
|
24
|
+
const sameBlock = comparePaths(start.path, end.path) === 0;
|
|
25
|
+
const live = { presentationMode, linkRef };
|
|
26
|
+
// Own both endpoint spines (and table subtrees: cell raws, row splices, and header promotion
|
|
27
|
+
// all write at depth) before any capture or mutation.
|
|
28
|
+
const startChain = ensureUnsharedPath(doc, start.path, sharing);
|
|
29
|
+
const startBlock = startChain[startChain.length - 1] ?? ownedEndpoint(doc, start.path, sharing);
|
|
30
|
+
const endBlock = sameBlock
|
|
31
|
+
? startBlock
|
|
32
|
+
: (ensureUnsharedPath(doc, end.path, sharing).pop() ?? ownedEndpoint(doc, end.path, sharing));
|
|
33
|
+
if (startBlock.kind === 'table')
|
|
34
|
+
ensureUnsharedSubtree(startBlock, sharing);
|
|
35
|
+
if (!sameBlock && endBlock.kind === 'table')
|
|
36
|
+
ensureUnsharedSubtree(endBlock, sharing);
|
|
37
|
+
if (sameBlock) {
|
|
38
|
+
return deleteWithinTable(doc, start, end, startBlock, sharing, grammar);
|
|
39
|
+
}
|
|
40
|
+
if (startBlock.kind === 'table' && endBlock.kind === 'table') {
|
|
41
|
+
return deleteAcrossTwoTables(doc, start, end, startBlock, endBlock, sharing, grammar);
|
|
42
|
+
}
|
|
43
|
+
if (startBlock.kind === 'table') {
|
|
44
|
+
return deleteFromTableIntoProse(doc, start, end, startBlock, endBlock, sharing, grammar, live);
|
|
45
|
+
}
|
|
46
|
+
return deleteFromProseIntoTable(doc, start, end, startBlock, endBlock, sharing, grammar, live);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Owned fallback for an endpoint whose unshare chain came back short: routes through the
|
|
50
|
+
* unshare seam, never a raw live-tree capture. A miss here is a caller bug.
|
|
51
|
+
*/
|
|
52
|
+
function ownedEndpoint(doc, path, sharing) {
|
|
53
|
+
const node = blockNodeAt(doc, path);
|
|
54
|
+
if (!node)
|
|
55
|
+
throw new Error('rangeDelete(table): endpoint path does not resolve to a block node');
|
|
56
|
+
return ensureUnsharedNode(node, sharing);
|
|
57
|
+
}
|
|
58
|
+
// ── Same-block: whole-table or partial-table intra-table ───────────────────
|
|
59
|
+
// Caret returns as a deep [...tablePath, row, col] path so the follow-up paste / focus restore
|
|
60
|
+
// lands inside the anchor cell's contenteditable instead of the table wrapper.
|
|
61
|
+
function deleteWithinTable(doc, start, end, table, sharing, grammar) {
|
|
62
|
+
// Same-path intra-table endpoints are context-established, not flagged, so they read
|
|
63
|
+
// `.offset` directly; cellIndexOf would warn spuriously here.
|
|
64
|
+
clearRectangularCells(table, start.offset, end.offset);
|
|
65
|
+
rebuildUnsharedAncestry(doc, start.path, sharing, null, grammar);
|
|
66
|
+
const meta = metadataOf(table, 'table');
|
|
67
|
+
const cellsPerRow = meta.columnCount;
|
|
68
|
+
const { row: anchorRow, col: anchorCol } = cellRowCol(start.offset, cellsPerRow);
|
|
69
|
+
return {
|
|
70
|
+
newDoc: doc,
|
|
71
|
+
collapsedCaret: { path: [...start.path, anchorRow, anchorCol], offset: 0 },
|
|
72
|
+
tableRowSplices: []
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function clearRectangularCells(table, anchorCellIdx, focusCellIdx) {
|
|
76
|
+
const meta = metadataOf(table, 'table');
|
|
77
|
+
const cellsPerRow = meta.columnCount;
|
|
78
|
+
const { row: aRow, col: aCol } = cellRowCol(anchorCellIdx, cellsPerRow);
|
|
79
|
+
const { row: fRow, col: fCol } = cellRowCol(focusCellIdx, cellsPerRow);
|
|
80
|
+
const minRow = Math.min(aRow, fRow);
|
|
81
|
+
const maxRow = Math.max(aRow, fRow);
|
|
82
|
+
const minCol = Math.min(aCol, fCol);
|
|
83
|
+
const maxCol = Math.max(aCol, fCol);
|
|
84
|
+
const rows = table.children;
|
|
85
|
+
for (let r = minRow; r <= maxRow; r++) {
|
|
86
|
+
const row = rows[r];
|
|
87
|
+
for (let c = minCol; c <= maxCol; c++) {
|
|
88
|
+
row.children[c].raw = '';
|
|
89
|
+
}
|
|
90
|
+
rebuildTableRowRaw(row);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// ── Case 1: prose start, table end ─────────────────────────────────────────
|
|
94
|
+
function deleteFromProseIntoTable(doc, start, end, startBlock, table, sharing, grammar, live) {
|
|
95
|
+
const startC = nearestChromeContainer(doc, start.path);
|
|
96
|
+
const startIsChrome = startC !== null && isChromeChild(startC, start.path);
|
|
97
|
+
// The snapped end cell is the whole-row inclusive last cell; deleteCellsAndCollapse takes an
|
|
98
|
+
// exclusive end, so +1 clears the same rows the clipboard copied.
|
|
99
|
+
const { result, splice } = deleteCellsAndCollapse(table, 0, cellIndexOf(end, 'deleteFromProseIntoTable:end') + 1);
|
|
100
|
+
const wall = resolveEndWall(doc, start, end, result === 'tableEmpty');
|
|
101
|
+
const { plan, lcaPath } = planCrossBlockDeletion(doc, start, end, result === 'tableEmpty' ? [end.path] : [], wall, sharing);
|
|
102
|
+
applyPlannedDeletion(doc, plan, lcaPath);
|
|
103
|
+
const seam = truncateStartInPlace(doc, start, startBlock, startIsChrome, live, sharing, 'deleteFromProseIntoTable:start');
|
|
104
|
+
const tableSurvives = result === 'tableSurvives';
|
|
105
|
+
if (tableSurvives)
|
|
106
|
+
rebuildOwnedContainer(table, sharing);
|
|
107
|
+
rebuildUnsharedAncestry(doc, start.path, sharing, null, grammar);
|
|
108
|
+
rebuildSharedAncestries(doc, plan, sharing, grammar);
|
|
109
|
+
if (tableSurvives)
|
|
110
|
+
rebuildUnsharedAncestry(doc, survivorPath(doc, table), sharing, null, grammar);
|
|
111
|
+
return {
|
|
112
|
+
newDoc: doc,
|
|
113
|
+
collapsedCaret: { path: start.path.slice(), offset: seam },
|
|
114
|
+
tableRowSplices: splice ? [{ table, ...splice }] : []
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// ── Case 2: table start, prose end ─────────────────────────────────────────
|
|
118
|
+
function deleteFromTableIntoProse(doc, start, end, table, endBlock, sharing, grammar, live) {
|
|
119
|
+
const lineEnding = trailingLineEnding(table.raw);
|
|
120
|
+
const startCell = cellIndexOf(start, 'deleteFromTableIntoProse:start');
|
|
121
|
+
const { result: tableResult, splice } = deleteCellsAndCollapse(table, startCell, totalCellCount(table));
|
|
122
|
+
const wall = resolveEndWall(doc, start, end, null);
|
|
123
|
+
const consumed = wall?.consumed ?? false;
|
|
124
|
+
const endIsChrome = wall !== null && !consumed && isChromeChild(wall.container, end.path);
|
|
125
|
+
const { plan, lcaPath } = planCrossBlockDeletion(doc, start, end, tableResult === 'tableEmpty' ? [start.path] : [], wall, sharing);
|
|
126
|
+
// Truncate end first: its path is later in doc order, so deleting strictly-between doesn't
|
|
127
|
+
// shift it. Skipped when the container dies whole.
|
|
128
|
+
const tailNode = consumed
|
|
129
|
+
? null
|
|
130
|
+
: truncateEndInPlace(doc, end, endBlock, endIsChrome, live, sharing, 'deleteFromTableIntoProse:end');
|
|
131
|
+
applyPlannedDeletion(doc, plan, lcaPath);
|
|
132
|
+
const tailPath = tailNode ? survivorPath(doc, tailNode) : null;
|
|
133
|
+
if (tableResult === 'tableSurvives') {
|
|
134
|
+
rebuildOwnedContainer(table, sharing);
|
|
135
|
+
rebuildUnsharedAncestry(doc, start.path, sharing, null, grammar);
|
|
136
|
+
}
|
|
137
|
+
if (tailPath)
|
|
138
|
+
rebuildUnsharedAncestry(doc, tailPath, sharing, null, grammar);
|
|
139
|
+
rebuildSharedAncestries(doc, plan, sharing, grammar);
|
|
140
|
+
// A fully consumed table lands the caret at the start of the surviving tail; otherwise in the
|
|
141
|
+
// table's surviving anchor cell, or the nearest survivor when the tail went too.
|
|
142
|
+
const collapsedCaret = tableResult === 'tableEmpty'
|
|
143
|
+
? tailPath
|
|
144
|
+
? { path: tailPath, offset: 0 }
|
|
145
|
+
: caretNearestSurvivor(doc, start.path, sharing, lineEnding)
|
|
146
|
+
: survivingAnchorCellCaret(table, start.path, startCell);
|
|
147
|
+
return {
|
|
148
|
+
newDoc: doc,
|
|
149
|
+
collapsedCaret,
|
|
150
|
+
tableRowSplices: splice ? [{ table, ...splice }] : []
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// Deep [...tablePath, row, col] caret into the surviving table's anchor cell: the cell is
|
|
154
|
+
// cleared from the anchor onward, so its end offset is its displayLength. anchorCol === 0 means
|
|
155
|
+
// the anchor row itself was removed, so fall back to the previous row's last cell.
|
|
156
|
+
function survivingAnchorCellCaret(table, startPath, anchorCellIdx) {
|
|
157
|
+
const cellsPerRow = metadataOf(table, 'table').columnCount;
|
|
158
|
+
const { row: anchorRow, col: anchorCol } = cellRowCol(anchorCellIdx, cellsPerRow);
|
|
159
|
+
if (anchorCol > 0) {
|
|
160
|
+
const cell = table.children[anchorRow].children[anchorCol];
|
|
161
|
+
return { path: [...startPath, anchorRow, anchorCol], offset: displayLength(cell.raw) };
|
|
162
|
+
}
|
|
163
|
+
const survivorRow = anchorRow - 1;
|
|
164
|
+
const survivorCol = cellsPerRow - 1;
|
|
165
|
+
if (survivorRow < 0) {
|
|
166
|
+
// Defensive: anchor in row 0 and that row removed. Callers collapse to 'tableEmpty'
|
|
167
|
+
// first, but the contract must not index table.children[-1].
|
|
168
|
+
return { path: [...startPath, 0, 0], offset: 0 };
|
|
169
|
+
}
|
|
170
|
+
const survivor = table.children[survivorRow].children[survivorCol];
|
|
171
|
+
return { path: [...startPath, survivorRow, survivorCol], offset: displayLength(survivor.raw) };
|
|
172
|
+
}
|
|
173
|
+
// ── Case 1+2 hybrid: both endpoints are tables ─────────────────────────────
|
|
174
|
+
function deleteAcrossTwoTables(doc, start, end, startTable, endTable, sharing, grammar) {
|
|
175
|
+
const lineEnding = trailingLineEnding(startTable.raw);
|
|
176
|
+
const startCell = cellIndexOf(start, 'deleteAcrossTwoTables:start');
|
|
177
|
+
const { result: startResult, splice: startSplice } = deleteCellsAndCollapse(startTable, startCell, totalCellCount(startTable));
|
|
178
|
+
// The snapped end cell is the whole-row inclusive last cell; +1 for the exclusive end.
|
|
179
|
+
const { result: endResult, splice: endSplice } = deleteCellsAndCollapse(endTable, 0, cellIndexOf(end, 'deleteAcrossTwoTables:end') + 1);
|
|
180
|
+
const wall = resolveEndWall(doc, start, end, endResult === 'tableEmpty');
|
|
181
|
+
const emptiedEndpoints = [];
|
|
182
|
+
if (startResult === 'tableEmpty')
|
|
183
|
+
emptiedEndpoints.push(start.path);
|
|
184
|
+
if (endResult === 'tableEmpty')
|
|
185
|
+
emptiedEndpoints.push(end.path);
|
|
186
|
+
const { plan, lcaPath } = planCrossBlockDeletion(doc, start, end, emptiedEndpoints, wall, sharing);
|
|
187
|
+
applyPlannedDeletion(doc, plan, lcaPath);
|
|
188
|
+
const endTablePath = endResult === 'tableSurvives' ? survivorPath(doc, endTable) : null;
|
|
189
|
+
if (startResult === 'tableSurvives') {
|
|
190
|
+
rebuildOwnedContainer(startTable, sharing);
|
|
191
|
+
rebuildUnsharedAncestry(doc, start.path, sharing, null, grammar);
|
|
192
|
+
}
|
|
193
|
+
if (endTablePath) {
|
|
194
|
+
rebuildOwnedContainer(endTable, sharing);
|
|
195
|
+
rebuildUnsharedAncestry(doc, endTablePath, sharing, null, grammar);
|
|
196
|
+
}
|
|
197
|
+
rebuildSharedAncestries(doc, plan, sharing, grammar);
|
|
198
|
+
let collapsedCaret;
|
|
199
|
+
if (startResult === 'tableSurvives') {
|
|
200
|
+
// Start table keeps its slot (deletions are all at or after start.path).
|
|
201
|
+
collapsedCaret = survivingAnchorCellCaret(startTable, start.path, startCell);
|
|
202
|
+
}
|
|
203
|
+
else if (endTablePath) {
|
|
204
|
+
// Start emptied, so its block went and the end table shifted; land in its first cell.
|
|
205
|
+
collapsedCaret = { path: [...endTablePath, 0, 0], offset: 0 };
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
collapsedCaret = caretNearestSurvivor(doc, start.path, sharing, lineEnding);
|
|
209
|
+
}
|
|
210
|
+
const tableRowSplices = [
|
|
211
|
+
...(startSplice ? [{ table: startTable, ...startSplice }] : []),
|
|
212
|
+
...(endSplice ? [{ table: endTable, ...endSplice }] : [])
|
|
213
|
+
];
|
|
214
|
+
return { newDoc: doc, collapsedCaret, tableRowSplices };
|
|
215
|
+
}
|
|
216
|
+
// Every block the caret could land in was removed, so survivors are sought in the deleted block's
|
|
217
|
+
// OWN container, walking outward when cascade cleanup took that too. `lineEnding` is the deleted
|
|
218
|
+
// start table's, captured before the mutation (G4.20): nothing survives to read one from, so a
|
|
219
|
+
// defaulted LF would flip a CRLF doc.
|
|
220
|
+
function caretNearestSurvivor(doc, startPath, sharing, lineEnding) {
|
|
221
|
+
let containerPath = startPath.slice(0, -1);
|
|
222
|
+
let childIdx = startPath[startPath.length - 1];
|
|
223
|
+
let siblings = survivingChildren(doc, containerPath);
|
|
224
|
+
while (siblings === null && containerPath.length > 0) {
|
|
225
|
+
childIdx = containerPath[containerPath.length - 1];
|
|
226
|
+
containerPath = containerPath.slice(0, -1);
|
|
227
|
+
siblings = survivingChildren(doc, containerPath);
|
|
228
|
+
}
|
|
229
|
+
if (siblings) {
|
|
230
|
+
const beforeIdx = childIdx - 1;
|
|
231
|
+
if (beforeIdx >= 0) {
|
|
232
|
+
const before = siblings[beforeIdx];
|
|
233
|
+
const beforePath = [...containerPath, beforeIdx];
|
|
234
|
+
return before.kind === 'table'
|
|
235
|
+
? lastCellCaret(before, beforePath)
|
|
236
|
+
: survivorEndCaret(before, beforePath);
|
|
237
|
+
}
|
|
238
|
+
return survivorStartCaret(siblings[0], [...containerPath, 0]);
|
|
239
|
+
}
|
|
240
|
+
const filler = emptyParagraph('', lineEnding);
|
|
241
|
+
sharing.stamp(filler);
|
|
242
|
+
doc.children.push(filler);
|
|
243
|
+
return { path: [0], offset: 0 };
|
|
244
|
+
}
|
|
245
|
+
/** A container's children when it survived with any, else null. */
|
|
246
|
+
function survivingChildren(doc, path) {
|
|
247
|
+
const node = path.length === 0 ? doc : blockNodeAt(doc, path);
|
|
248
|
+
const children = node?.children;
|
|
249
|
+
return children && children.length > 0 ? children : null;
|
|
250
|
+
}
|
|
251
|
+
// End-of-survivor caret, descending to the leaf a caret lands in: last child at each step,
|
|
252
|
+
// collapse-aware (a collapsed container's visible target is chrome child 0). The gate is
|
|
253
|
+
// FOCUSABILITY, not merge-eligibility: a fenced-code leaf is editable but not merge-eligible,
|
|
254
|
+
// and the merge walk would strand the caret on the container's own path.
|
|
255
|
+
function survivorEndCaret(node, path) {
|
|
256
|
+
let leaf = node;
|
|
257
|
+
const leafPath = path.slice();
|
|
258
|
+
while (leaf.children && leaf.children.length > 0) {
|
|
259
|
+
const next = isCollapsedContainer(leaf) ? 0 : leaf.children.length - 1;
|
|
260
|
+
leaf = leaf.children[next];
|
|
261
|
+
leafPath.push(next);
|
|
262
|
+
}
|
|
263
|
+
return { path: leafPath, offset: displayLength(leaf.raw) };
|
|
264
|
+
}
|
|
265
|
+
// Start-of-survivor caret, the twin of survivorEndCaret. First child at each level is also the
|
|
266
|
+
// collapse-visible chrome child, so no collapse case is needed.
|
|
267
|
+
function survivorStartCaret(node, path) {
|
|
268
|
+
let leaf = node;
|
|
269
|
+
const leafPath = path.slice();
|
|
270
|
+
while (leaf.children && leaf.children.length > 0) {
|
|
271
|
+
leaf = leaf.children[0];
|
|
272
|
+
leafPath.push(0);
|
|
273
|
+
}
|
|
274
|
+
return { path: leafPath, offset: 0 };
|
|
275
|
+
}
|
|
276
|
+
function lastCellCaret(table, tablePath) {
|
|
277
|
+
const lastRow = table.children.length - 1;
|
|
278
|
+
const lastCol = metadataOf(table, 'table').columnCount - 1;
|
|
279
|
+
const cell = table.children[lastRow].children[lastCol];
|
|
280
|
+
return { path: [...tablePath, lastRow, lastCol], offset: displayLength(cell.raw) };
|
|
281
|
+
}
|
|
282
|
+
// ── Post-delete path resolution (identity scan; cost class in the file header) ─
|
|
283
|
+
function survivorPath(doc, node) {
|
|
284
|
+
const path = pathOfNode(doc, node);
|
|
285
|
+
if (!path) {
|
|
286
|
+
throw new Error('tableAwareRangeDelete: surviving block not found after deletions');
|
|
287
|
+
}
|
|
288
|
+
return path;
|
|
289
|
+
}
|
|
290
|
+
function pathOfNode(parent, target) {
|
|
291
|
+
const children = parent.children ?? [];
|
|
292
|
+
for (let i = 0; i < children.length; i++) {
|
|
293
|
+
if (children[i] === target)
|
|
294
|
+
return [i];
|
|
295
|
+
const sub = pathOfNode(children[i], target);
|
|
296
|
+
if (sub)
|
|
297
|
+
return [i, ...sub];
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Clear cells in `[startCellIdx, endCellIdx)`, remove rows fully inside the range, promote the
|
|
303
|
+
* next surviving row to header when row 0 goes. Mutates in place. Reports whether the table
|
|
304
|
+
* itself should be removed and the row window it spliced, so the commit can sync row state.
|
|
305
|
+
*/
|
|
306
|
+
function deleteCellsAndCollapse(table, startCellIdx, endCellIdx) {
|
|
307
|
+
if (startCellIdx >= endCellIdx)
|
|
308
|
+
return { result: 'tableSurvives', splice: null };
|
|
309
|
+
clearCellsInRange(table, startCellIdx, endCellIdx);
|
|
310
|
+
const meta = metadataOf(table, 'table');
|
|
311
|
+
const rows = table.children;
|
|
312
|
+
const cellsPerRow = meta.columnCount;
|
|
313
|
+
const { row: startRow, col: startCol } = cellRowCol(startCellIdx, cellsPerRow);
|
|
314
|
+
const { row: lastRowInRange, col: lastColInRange } = cellRowCol(endCellIdx - 1, cellsPerRow);
|
|
315
|
+
// First range row is fully covered iff startCol === 0; last iff
|
|
316
|
+
// lastColInRange === cellsPerRow - 1; middle rows always are.
|
|
317
|
+
const firstFull = startCol === 0 ? startRow : startRow + 1;
|
|
318
|
+
const lastFull = lastColInRange === cellsPerRow - 1 ? lastRowInRange : lastRowInRange - 1;
|
|
319
|
+
const headerRemoved = firstFull <= 0 && lastFull >= 0;
|
|
320
|
+
const splice = firstFull <= lastFull ? { at: firstFull, count: lastFull - firstFull + 1 } : null;
|
|
321
|
+
if (splice) {
|
|
322
|
+
rows.splice(splice.at, splice.count);
|
|
323
|
+
}
|
|
324
|
+
if (rows.length === 0)
|
|
325
|
+
return { result: 'tableEmpty', splice };
|
|
326
|
+
if (headerRemoved) {
|
|
327
|
+
metadataOf(rows[0], 'tableRow').isHeader = true;
|
|
328
|
+
}
|
|
329
|
+
return { result: 'tableSurvives', splice };
|
|
330
|
+
}
|
|
331
|
+
function clearCellsInRange(table, startCellIdx, endCellIdx) {
|
|
332
|
+
const meta = metadataOf(table, 'table');
|
|
333
|
+
const cellsPerRow = meta.columnCount;
|
|
334
|
+
const rows = table.children;
|
|
335
|
+
const touchedRows = new Set();
|
|
336
|
+
for (let i = startCellIdx; i < endCellIdx; i++) {
|
|
337
|
+
const { row: r, col: c } = cellRowCol(i, cellsPerRow);
|
|
338
|
+
rows[r].children[c].raw = '';
|
|
339
|
+
touchedRows.add(r);
|
|
340
|
+
}
|
|
341
|
+
for (const r of touchedRows)
|
|
342
|
+
rebuildTableRowRaw(rows[r]);
|
|
343
|
+
}
|
|
344
|
+
function totalCellCount(table) {
|
|
345
|
+
const meta = metadataOf(table, 'table');
|
|
346
|
+
return (table.children?.length ?? 0) * meta.columnCount;
|
|
347
|
+
}
|