edytor 2.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -4
- package/dist/block/block.svelte.js +2 -4
- package/dist/clipboard/htmlFlow.d.ts +20 -7
- package/dist/clipboard/htmlFlow.js +23 -15
- package/dist/clipboard/serializeClipboardFragment.d.ts +37 -4
- package/dist/clipboard/serializeClipboardFragment.js +6 -4
- package/dist/clipboard/textBlocks.d.ts +8 -0
- package/dist/clipboard/textBlocks.js +6 -2
- package/dist/cloudflare/DocumentRoom.d.ts +13 -9
- package/dist/cloudflare/DocumentRoom.js +10 -6
- package/dist/cloudflare/room/admission.js +3 -3
- package/dist/cloudflare/room/context.d.ts +28 -27
- package/dist/cloudflare/room/context.js +2 -2
- package/dist/cloudflare/room/purge.d.ts +6 -3
- package/dist/cloudflare/room/purge.js +44 -19
- package/dist/cloudflare/room/updates.d.ts +3 -4
- package/dist/cloudflare/room/updates.js +6 -8
- package/dist/cloudflare/routeDocumentSocket.d.ts +17 -0
- package/dist/cloudflare/routeDocumentSocket.js +53 -0
- package/dist/collaboration/comments/client.d.ts +1 -1
- package/dist/collaboration/comments/client.js +1 -1
- package/dist/collaboration/remoteSelection.js +3 -3
- package/dist/components/Edytor.svelte +2 -10
- package/dist/components/Edytor.svelte.d.ts +1 -3
- package/dist/crdt/admission.d.ts +5 -10
- package/dist/crdt/admission.js +5 -11
- package/dist/crdt/attribution/attribution.d.ts +31 -12
- package/dist/crdt/attribution/attribution.js +56 -18
- package/dist/crdt/attribution/block.d.ts +3 -3
- package/dist/crdt/attribution/block.js +7 -8
- package/dist/crdt/attribution/index.d.ts +1 -1
- package/dist/crdt/attribution/index.js +1 -1
- package/dist/crdt/data.d.ts +62 -31
- package/dist/crdt/data.js +211 -103
- package/dist/crdt/doc/delete.d.ts +1 -1
- package/dist/crdt/doc/delete.js +13 -30
- package/dist/crdt/doc/funnel.d.ts +7 -6
- package/dist/crdt/doc/funnel.js +39 -33
- package/dist/crdt/doc/gate.d.ts +3 -20
- package/dist/crdt/doc/gate.js +2 -41
- package/dist/crdt/doc/history.d.ts +25 -9
- package/dist/crdt/doc/history.js +152 -42
- package/dist/crdt/doc/layout.js +11 -22
- package/dist/crdt/doc/meta.js +12 -17
- package/dist/crdt/doc/moves.d.ts +1 -1
- package/dist/crdt/doc/moves.js +52 -32
- package/dist/crdt/doc/reads.js +2 -2
- package/dist/crdt/doc/seed.js +2 -2
- package/dist/crdt/doc/split-merge.js +12 -15
- package/dist/crdt/doc/steps.d.ts +25 -13
- package/dist/crdt/doc/steps.js +52 -122
- package/dist/crdt/doc/types.d.ts +21 -9
- package/dist/crdt/document.d.ts +21 -19
- package/dist/crdt/document.js +26 -23
- package/dist/crdt/edytor-doc.d.ts +66 -68
- package/dist/crdt/edytor-doc.js +21 -20
- package/dist/crdt/engine-api.d.ts +33 -1
- package/dist/crdt/engine.d.ts +0 -1
- package/dist/crdt/engine.js +1 -4
- package/dist/crdt/flow.d.ts +1 -1
- package/dist/crdt/flow.js +25 -27
- package/dist/crdt/index.d.ts +29 -28
- package/dist/crdt/index.js +3 -3
- package/dist/crdt/placement/display.d.ts +5 -30
- package/dist/crdt/placement/display.js +39 -144
- package/dist/crdt/placement/keys.d.ts +58 -0
- package/dist/crdt/placement/keys.js +90 -0
- package/dist/crdt/placement/model.d.ts +119 -118
- package/dist/crdt/placement/model.js +242 -142
- package/dist/crdt/placement/resolve.d.ts +123 -35
- package/dist/crdt/placement/resolve.js +187 -153
- package/dist/crdt/placement/slots.d.ts +134 -0
- package/dist/crdt/placement/slots.js +152 -0
- package/dist/crdt/protocol.d.ts +2 -2
- package/dist/crdt/protocol.js +2 -2
- package/dist/crdt/providers/index.d.ts +1 -1
- package/dist/crdt/providers/room.d.ts +26 -11
- package/dist/crdt/providers/room.js +77 -27
- package/dist/crdt/providers/websocket.d.ts +1 -1
- package/dist/crdt/providers/websocket.js +33 -32
- package/dist/crdt/purge.d.ts +17 -8
- package/dist/crdt/purge.js +236 -126
- package/dist/crdt/restore.d.ts +2 -2
- package/dist/crdt/restore.js +18 -34
- package/dist/crdt/schema.d.ts +22 -21
- package/dist/crdt/schema.js +29 -23
- package/dist/crdt/semantics.js +3 -1
- package/dist/crdt/storage.d.ts +1 -1
- package/dist/crdt/storage.js +1 -1
- package/dist/crdt/structs.d.ts +15 -15
- package/dist/crdt/structs.js +8 -22
- package/dist/crdt/text/index/cache.js +4 -0
- package/dist/crdt/text/index/claims.js +12 -0
- package/dist/crdt/text/index/fold.d.ts +2 -3
- package/dist/crdt/text/index/fold.js +194 -44
- package/dist/crdt/text/index/layout.js +5 -8
- package/dist/crdt/text/index/placement.d.ts +26 -18
- package/dist/crdt/text/index/placement.js +404 -138
- package/dist/crdt/text/index/records.d.ts +3 -3
- package/dist/crdt/text/index/records.js +24 -31
- package/dist/crdt/text/index/shared.d.ts +11 -3
- package/dist/crdt/text/index/shared.js +12 -3
- package/dist/crdt/text/index/state.d.ts +21 -17
- package/dist/crdt/text/index/state.js +15 -17
- package/dist/crdt/text/index/streams.d.ts +10 -5
- package/dist/crdt/text/index/streams.js +78 -27
- package/dist/crdt/text/items.d.ts +10 -3
- package/dist/crdt/text/items.js +7 -0
- package/dist/crdt/text/model.d.ts +77 -62
- package/dist/crdt/text/model.js +84 -169
- package/dist/crdt/text/ranges.d.ts +1 -1
- package/dist/crdt/text/ranges.js +3 -3
- package/dist/crdt/text/rows.d.ts +13 -7
- package/dist/crdt/text/rows.js +24 -7
- package/dist/crdt/text/runs.d.ts +17 -12
- package/dist/crdt/text/runs.js +24 -7
- package/dist/crdt/text/streams.d.ts +26 -13
- package/dist/crdt/text/streams.js +41 -14
- package/dist/crdt/vendor/yjs/UPSTREAM.md +568 -21
- package/dist/crdt/vendor/yjs/dts/global.d.ts +2 -0
- package/dist/crdt/vendor/yjs/dts/index.d.ts +1 -1
- package/dist/crdt/vendor/yjs/dts/structs/AbstractStruct.d.ts +7 -0
- package/dist/crdt/vendor/yjs/dts/structs/Item.d.ts +194 -10
- package/dist/crdt/vendor/yjs/dts/utils/Doc.d.ts +6 -3
- package/dist/crdt/vendor/yjs/dts/utils/StructStore.d.ts +5 -18
- package/dist/crdt/vendor/yjs/dts/utils/Transaction.d.ts +15 -1
- package/dist/crdt/vendor/yjs/dts/utils/UpdateDecoder.d.ts +14 -6
- package/dist/crdt/vendor/yjs/dts/utils/UpdateEncoder.d.ts +33 -6
- package/dist/crdt/vendor/yjs/dts/utils/ids.d.ts +1 -65
- package/dist/crdt/vendor/yjs/dts/utils/marks.d.ts +6 -1
- package/dist/crdt/vendor/yjs/dts/ynode.d.ts +43 -7
- package/dist/crdt/vendor/yjs/global.d.ts +2 -0
- package/dist/crdt/vendor/yjs/src/index.js +1 -1
- package/dist/crdt/vendor/yjs/src/structs/AbstractStruct.js +10 -0
- package/dist/crdt/vendor/yjs/src/structs/Item.js +610 -51
- package/dist/crdt/vendor/yjs/src/utils/BlockSet.js +18 -9
- package/dist/crdt/vendor/yjs/src/utils/Doc.js +5 -3
- package/dist/crdt/vendor/yjs/src/utils/StructStore.js +5 -0
- package/dist/crdt/vendor/yjs/src/utils/Transaction.js +36 -13
- package/dist/crdt/vendor/yjs/src/utils/UpdateDecoder.js +88 -18
- package/dist/crdt/vendor/yjs/src/utils/UpdateEncoder.js +119 -32
- package/dist/crdt/vendor/yjs/src/utils/encoding.js +13 -1
- package/dist/crdt/vendor/yjs/src/utils/ids.js +7 -7
- package/dist/crdt/vendor/yjs/src/utils/marks.js +193 -8
- package/dist/crdt/vendor/yjs/src/utils/redo.js +1 -1
- package/dist/crdt/vendor/yjs/src/utils/transaction-helpers.js +1 -1
- package/dist/crdt/vendor/yjs/src/utils/updates.js +3 -3
- package/dist/crdt/vendor/yjs/src/ynode.js +177 -12
- package/dist/dnd/autoScroll.d.ts +15 -7
- package/dist/dnd/autoScroll.js +10 -15
- package/dist/dnd/dropIndicator.js +2 -5
- package/dist/dnd/external.d.ts +6 -0
- package/dist/dnd/external.js +17 -0
- package/dist/dnd/geometry.d.ts +2 -0
- package/dist/dnd/geometry.js +3 -4
- package/dist/dnd/placement.d.ts +1 -1
- package/dist/dnd/pragmatic.d.ts +3 -1
- package/dist/dnd/pragmatic.js +12 -2
- package/dist/dnd/vendor/pragmatic/UPSTREAM.md +51 -18
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.d.ts +0 -2
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.js +4 -22
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter-types.d.ts +26 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.d.ts +30 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.js +203 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-items.js +13 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-types.js +9 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/is-an-available-type.js +19 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/make-honey-pot-fix.js +4 -16
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/internal-types.d.ts +1 -8
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-drop-target.js +5 -6
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-monitor.js +2 -3
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.d.ts +1 -1
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.js +6 -24
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.d.ts +2 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.js +5 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.d.ts +3 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.js +12 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/native-types.d.ts +12 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window-in-safari.js +10 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window.js +55 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.js +8 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/internal-types.d.ts +0 -4
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/get-scroll-by.js +16 -72
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/try-scroll.js +1 -9
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/configuration.js +4 -29
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/get-scroll-change.js +2 -3
- package/dist/edytor.svelte.d.ts +2 -5
- package/dist/edytor.svelte.js +21 -32
- package/dist/events/beforeInputCommands.js +2 -2
- package/dist/events/onBeforeInput.js +1 -1
- package/dist/events/onDrop.d.ts +0 -6
- package/dist/events/onDrop.js +10 -23
- package/dist/events/onInput.d.ts +0 -12
- package/dist/events/onInput.js +1 -67
- package/dist/events/onPageHide.d.ts +3 -0
- package/dist/events/onPageHide.js +16 -0
- package/dist/export/forms.d.ts +627 -0
- package/dist/export/forms.js +749 -0
- package/dist/export/index.d.ts +170 -0
- package/dist/export/index.js +161 -0
- package/dist/export/markdown.d.ts +41 -0
- package/dist/export/markdown.js +585 -0
- package/dist/export/markdownWriter.d.ts +9 -0
- package/dist/export/markdownWriter.js +133 -0
- package/dist/export/mdx.d.ts +15 -0
- package/dist/export/mdx.js +33 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/kinds.js +1 -1
- package/dist/plugins/anchored.svelte.d.ts +21 -25
- package/dist/plugins/anchored.svelte.js +23 -39
- package/dist/plugins/blockHandles/BlockHandleController.svelte.js +24 -32
- package/dist/plugins/blockHandles/dragPreview.d.ts +26 -7
- package/dist/plugins/blockHandles/dragPreview.js +33 -0
- package/dist/plugins/blockMenu/BlockMenuController.svelte.d.ts +5 -0
- package/dist/plugins/blockMenu/BlockMenuController.svelte.js +7 -2
- package/dist/plugins/blockMenu/blockMenuPlugin.js +5 -50
- package/dist/plugins/chrome.d.ts +27 -5
- package/dist/plugins/chrome.js +24 -9
- package/dist/plugins/code/CodePlugin.svelte +12 -9
- package/dist/plugins/code/header.svelte.js +7 -11
- package/dist/plugins/code/languageMenu.svelte.d.ts +5 -2
- package/dist/plugins/code/languageMenu.svelte.js +13 -20
- package/dist/plugins/columns/ColumnsPlugin.svelte +7 -20
- package/dist/plugins/columns/resize.svelte.d.ts +2 -3
- package/dist/plugins/columns/resize.svelte.js +2 -5
- package/dist/plugins/comments/CommentsController.svelte.d.ts +6 -0
- package/dist/plugins/comments/CommentsController.svelte.js +20 -0
- package/dist/plugins/equation/EquationPlugin.svelte +12 -22
- package/dist/plugins/equation/equation.svelte.d.ts +7 -15
- package/dist/plugins/equation/equation.svelte.js +13 -50
- package/dist/plugins/equation/tex.d.ts +17 -0
- package/dist/plugins/equation/tex.js +42 -0
- package/dist/plugins/fileDrop.d.ts +38 -23
- package/dist/plugins/fileDrop.js +82 -76
- package/dist/plugins/find/FindController.svelte.d.ts +5 -0
- package/dist/plugins/find/FindController.svelte.js +14 -14
- package/dist/plugins/find/findPlugin.js +1 -15
- package/dist/plugins/image/ImageChrome.svelte +8 -2
- package/dist/plugins/image/ImagePlugin.svelte +15 -52
- package/dist/plugins/image/controls.svelte.js +16 -2
- package/dist/plugins/image/toolbar.svelte.d.ts +5 -4
- package/dist/plugins/image/toolbar.svelte.js +21 -31
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/list.svelte.d.ts +9 -0
- package/dist/plugins/list.svelte.js +18 -0
- package/dist/plugins/marquee/marqueePlugin.js +0 -4
- package/dist/plugins/media/AudioPlugin.svelte +1 -1
- package/dist/plugins/media/BookmarkPlugin.svelte +6 -97
- package/dist/plugins/media/EmbedPlugin.svelte +5 -90
- package/dist/plugins/media/EmptySlot.svelte +36 -20
- package/dist/plugins/media/EmptySlot.svelte.d.ts +6 -15
- package/dist/plugins/media/FilePlugin.svelte +1 -19
- package/dist/plugins/media/MediaEmpty.svelte +2 -55
- package/dist/plugins/media/MediaEmpty.svelte.d.ts +18 -14
- package/dist/plugins/media/SourceBlock.svelte +142 -52
- package/dist/plugins/media/SourceBlock.svelte.d.ts +10 -4
- package/dist/plugins/media/VideoPlugin.svelte +1 -1
- package/dist/plugins/media/empty.svelte.js +2 -7
- package/dist/plugins/media/media.d.ts +2 -63
- package/dist/plugins/media/media.js +1 -194
- package/dist/plugins/media/sources.d.ts +60 -0
- package/dist/plugins/media/sources.js +165 -0
- package/dist/plugins/media/urlPaste.svelte.d.ts +2 -1
- package/dist/plugins/media/urlPaste.svelte.js +12 -21
- package/dist/plugins/mention/MentionPlugin.svelte +8 -35
- package/dist/plugins/page/PagePlugin.svelte +2 -9
- package/dist/plugins/page/page.js +1 -1
- package/dist/plugins/pageLink/PageLinkPlugin.svelte +6 -13
- package/dist/plugins/richtext/RichTextPlugin.svelte +85 -197
- package/dist/plugins/richtext/body.js +1 -1
- package/dist/plugins/richtext/calloutIcons.svelte.d.ts +2 -2
- package/dist/plugins/richtext/calloutIcons.svelte.js +5 -7
- package/dist/plugins/richtext/richTextOperations.d.ts +1 -19
- package/dist/plugins/richtext/richTextOperations.js +3 -49
- package/dist/plugins/slashMenu/SlashMenuController.svelte.d.ts +2 -0
- package/dist/plugins/slashMenu/SlashMenuController.svelte.js +7 -0
- package/dist/plugins/slashMenu/slashMenuPlugin.js +5 -14
- package/dist/plugins/table/TableChrome.svelte +2 -3
- package/dist/plugins/table/TablePlugin.svelte +20 -54
- package/dist/plugins/table/chrome.svelte.d.ts +5 -2
- package/dist/plugins/table/chrome.svelte.js +30 -54
- package/dist/plugins/table/table.js +3 -3
- package/dist/plugins/toc/TocPlugin.svelte +2 -4
- package/dist/plugins/toolbar/ToolbarController.svelte.d.ts +7 -0
- package/dist/plugins/toolbar/ToolbarController.svelte.js +20 -13
- package/dist/plugins/toolbar/toolbarPlugin.js +19 -53
- package/dist/plugins/triggers/TriggerController.svelte.d.ts +7 -2
- package/dist/plugins/triggers/TriggerController.svelte.js +11 -4
- package/dist/plugins/triggers/place.js +1 -2
- package/dist/plugins/triggers/triggers.d.ts +6 -1
- package/dist/plugins/triggers/triggers.js +12 -13
- package/dist/plugins/uploads.svelte.d.ts +5 -2
- package/dist/plugins/uploads.svelte.js +25 -15
- package/dist/plugins.d.ts +26 -0
- package/dist/plugins.js +0 -24
- package/dist/selection/replaceSelection.js +2 -2
- package/dist/selection/selection.svelte.d.ts +4 -10
- package/dist/selection/selection.svelte.js +7 -11
- package/dist/session/bindings.js +1 -1
- package/dist/session/commands.d.ts +7 -11
- package/dist/session/commands.js +13 -19
- package/dist/session/inputRules.js +1 -1
- package/dist/session/navigation.js +1 -1
- package/dist/session/suggestions.svelte.d.ts +0 -11
- package/dist/session/suggestions.svelte.js +15 -3
- package/dist/session/uploads.d.ts +8 -8
- package/dist/surface/lines.js +1 -3
- package/dist/surface/observer.svelte.d.ts +17 -1
- package/dist/surface/observer.svelte.js +74 -19
- package/dist/surface/overlay.d.ts +0 -14
- package/dist/surface/overlay.js +0 -25
- package/dist/surface/projector.svelte.d.ts +15 -3
- package/dist/surface/projector.svelte.js +60 -9
- package/dist/text/text.svelte.js +3 -13
- package/dist/utils/sanitize.d.ts +38 -0
- package/dist/utils/sanitize.js +82 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +5 -0
- package/package.json +19 -2
- package/dist/crdt/placement/rank.d.ts +0 -87
- package/dist/crdt/placement/rank.js +0 -332
- package/dist/crdt/placement/source.d.ts +0 -43
- package/dist/crdt/placement/source.js +0 -66
- package/dist/crdt/text/delete-index.d.ts +0 -129
- package/dist/crdt/text/delete-index.js +0 -365
- package/dist/crdt/text/deletes.d.ts +0 -76
- package/dist/crdt/text/deletes.js +0 -362
- package/dist/crdt/text/index/anchored.d.ts +0 -17
- package/dist/crdt/text/index/anchored.js +0 -197
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/max-z-index.js +0 -3
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/supports-popover.js +0 -16
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/is-axis-allowed.js +0 -3
- package/dist/plugins/code/LanguageMenu.svelte +0 -25
- package/dist/plugins/code/LanguageMenu.svelte.d.ts +0 -9
- package/dist/plugins/equation/EquationEditor.svelte +0 -27
- package/dist/plugins/equation/EquationEditor.svelte.d.ts +0 -9
- package/dist/plugins/image/ImageToolbarHost.svelte +0 -37
- package/dist/plugins/image/ImageToolbarHost.svelte.d.ts +0 -9
- package/dist/plugins/richtext/CalloutIconPicker.svelte +0 -26
- package/dist/plugins/richtext/CalloutIconPicker.svelte.d.ts +0 -9
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order keys — the in-memory keys the index sorts a parent's children by.
|
|
3
|
+
*
|
|
4
|
+
* A block's place is its slot in its parent's sequence (fork patch YP22:
|
|
5
|
+
* the engine orders slots and move records); nothing about the order is
|
|
6
|
+
* stored. The index still needs a comparable key per child, so that
|
|
7
|
+
* `displaySlotOf`'s promotion, the layout rules, `positionInView`'s binary
|
|
8
|
+
* search and `anchors.seam` keep working over `(rank, id)`-sorted lists:
|
|
9
|
+
* each child gets a key between its sequence neighbours' when it is placed
|
|
10
|
+
* (`keyBetween`), or a dense one when a whole sequence is read
|
|
11
|
+
* (`denseKey`). Keys are plain strings compared with `<`; they are local to
|
|
12
|
+
* one index and never leave it (two replicas may hold different keys for
|
|
13
|
+
* one order).
|
|
14
|
+
*
|
|
15
|
+
* Three key spaces compose with them:
|
|
16
|
+
*
|
|
17
|
+
* - a promoted child's key is its slot's key, {@link PROMOTED} and its own
|
|
18
|
+
* ({@link promotedRank}): `PROMOTED` sorts below every key character, so
|
|
19
|
+
* the promoted children follow the slot and precede the next sibling;
|
|
20
|
+
* - a merged-away block's children show after the owner's own children,
|
|
21
|
+
* by the owner's claim order ({@link claimedRank}): {@link CLAIMED} sorts
|
|
22
|
+
* above every key character;
|
|
23
|
+
* - a table's cells show in column order ({@link cellKey}).
|
|
24
|
+
*/
|
|
25
|
+
/** Sorts below every key character: the separator of a promoted child's key. */
|
|
26
|
+
export declare const PROMOTED = "!";
|
|
27
|
+
/**
|
|
28
|
+
* A key strictly between `a` and `b` (`undefined`: no bound). Both bounds
|
|
29
|
+
* are keys of this alphabet with `a < b`: place by place, a digit halfway
|
|
30
|
+
* between theirs when one fits, else `a`'s digit and one place deeper
|
|
31
|
+
* (classic fractional indexing). A key never ends in the lowest digit
|
|
32
|
+
* (`denseKey` writes none), so a key fits between any two.
|
|
33
|
+
*/
|
|
34
|
+
export declare const keyBetween: (a: string | undefined, b: string | undefined) => string;
|
|
35
|
+
/** The `i`-th of a whole sequence's dense keys, in order (none ends in the lowest digit). */
|
|
36
|
+
export declare const denseKey: (i: number) => string;
|
|
37
|
+
/**
|
|
38
|
+
* The key of a block promoted into the slot keyed `slot` (read-time
|
|
39
|
+
* promotion, `del.blocks.promote`): after the slot, before every later key of
|
|
40
|
+
* the slot's list, in the promoted children's own order.
|
|
41
|
+
*/
|
|
42
|
+
export declare const promotedRank: (slot: string, rank: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* The key of a child of a merged-away block shown under its owner: after the
|
|
45
|
+
* owner's own children, by the owner's claims (`path`: the claim index at
|
|
46
|
+
* each hop down to the child's parent), then the child's own key.
|
|
47
|
+
*/
|
|
48
|
+
export declare const claimedRank: (path: readonly number[], rank: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* The key a table's cell displays at (`table.columns`): its column's
|
|
51
|
+
* position, before every unlisted column (`unlistedCellKey`) and the cells
|
|
52
|
+
* of no listed column (`LAST_CELL`).
|
|
53
|
+
*/
|
|
54
|
+
export declare const cellKey: (at: number) => string;
|
|
55
|
+
/** A withdrawn cell's column the table no longer lists: after the listed ones, by `unlistedRank`. */
|
|
56
|
+
export declare const unlistedCellKey: (hash: number) => string;
|
|
57
|
+
/** A cell of no listed column: last (it does not display, `table.cell`). */
|
|
58
|
+
export declare const LAST_CELL = "2";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order keys — the in-memory keys the index sorts a parent's children by.
|
|
3
|
+
*
|
|
4
|
+
* A block's place is its slot in its parent's sequence (fork patch YP22:
|
|
5
|
+
* the engine orders slots and move records); nothing about the order is
|
|
6
|
+
* stored. The index still needs a comparable key per child, so that
|
|
7
|
+
* `displaySlotOf`'s promotion, the layout rules, `positionInView`'s binary
|
|
8
|
+
* search and `anchors.seam` keep working over `(rank, id)`-sorted lists:
|
|
9
|
+
* each child gets a key between its sequence neighbours' when it is placed
|
|
10
|
+
* (`keyBetween`), or a dense one when a whole sequence is read
|
|
11
|
+
* (`denseKey`). Keys are plain strings compared with `<`; they are local to
|
|
12
|
+
* one index and never leave it (two replicas may hold different keys for
|
|
13
|
+
* one order).
|
|
14
|
+
*
|
|
15
|
+
* Three key spaces compose with them:
|
|
16
|
+
*
|
|
17
|
+
* - a promoted child's key is its slot's key, {@link PROMOTED} and its own
|
|
18
|
+
* ({@link promotedRank}): `PROMOTED` sorts below every key character, so
|
|
19
|
+
* the promoted children follow the slot and precede the next sibling;
|
|
20
|
+
* - a merged-away block's children show after the owner's own children,
|
|
21
|
+
* by the owner's claim order ({@link claimedRank}): {@link CLAIMED} sorts
|
|
22
|
+
* above every key character;
|
|
23
|
+
* - a table's cells show in column order ({@link cellKey}).
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Order-preserving alphabet: charCode order equals numeric order (64
|
|
27
|
+
* characters, all safe inside a JSON string).
|
|
28
|
+
*/
|
|
29
|
+
const ALPHABET = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
30
|
+
const BASE = ALPHABET.length;
|
|
31
|
+
/** Sorts below every key character: the separator of a promoted child's key. */
|
|
32
|
+
export const PROMOTED = '!';
|
|
33
|
+
/** Sorts above every key character: the prefix of a merged-away block's children. */
|
|
34
|
+
const CLAIMED = '~';
|
|
35
|
+
/** The index of a key character in the alphabet (`-1`: none). */
|
|
36
|
+
const digit = (s, i) => (i < s.length ? ALPHABET.indexOf(s[i]) : -1);
|
|
37
|
+
/**
|
|
38
|
+
* A key strictly between `a` and `b` (`undefined`: no bound). Both bounds
|
|
39
|
+
* are keys of this alphabet with `a < b`: place by place, a digit halfway
|
|
40
|
+
* between theirs when one fits, else `a`'s digit and one place deeper
|
|
41
|
+
* (classic fractional indexing). A key never ends in the lowest digit
|
|
42
|
+
* (`denseKey` writes none), so a key fits between any two.
|
|
43
|
+
*/
|
|
44
|
+
export const keyBetween = (a, b) => {
|
|
45
|
+
let out = '';
|
|
46
|
+
for (let i = 0;; i++) {
|
|
47
|
+
// Past a bound's end: below every digit (`a`), above every digit (`b`).
|
|
48
|
+
const da = a !== undefined && i < a.length ? digit(a, i) : 0;
|
|
49
|
+
const db = b === undefined ? BASE : i < b.length ? digit(b, i) : 0;
|
|
50
|
+
if (db - da > 1)
|
|
51
|
+
return out + ALPHABET[da + ((db - da) >> 1)];
|
|
52
|
+
out += ALPHABET[da];
|
|
53
|
+
// Below `b` already at this place: it bounds the deeper places no more.
|
|
54
|
+
if (db - da === 1)
|
|
55
|
+
b = undefined;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** The `i`-th of a whole sequence's dense keys, in order (none ends in the lowest digit). */
|
|
59
|
+
export const denseKey = (i) => {
|
|
60
|
+
// Four places of 63 digits (the lowest left out): 15M positions of one length.
|
|
61
|
+
let out = '';
|
|
62
|
+
let x = i;
|
|
63
|
+
for (let k = 0; k < 4; k++) {
|
|
64
|
+
out = ALPHABET[1 + (x % (BASE - 1))] + out;
|
|
65
|
+
x = Math.floor(x / (BASE - 1));
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The key of a block promoted into the slot keyed `slot` (read-time
|
|
71
|
+
* promotion, `del.blocks.promote`): after the slot, before every later key of
|
|
72
|
+
* the slot's list, in the promoted children's own order.
|
|
73
|
+
*/
|
|
74
|
+
export const promotedRank = (slot, rank) => slot + PROMOTED + rank;
|
|
75
|
+
/**
|
|
76
|
+
* The key of a child of a merged-away block shown under its owner: after the
|
|
77
|
+
* owner's own children, by the owner's claims (`path`: the claim index at
|
|
78
|
+
* each hop down to the child's parent), then the child's own key.
|
|
79
|
+
*/
|
|
80
|
+
export const claimedRank = (path, rank) => path.map((i) => CLAIMED + denseKey(i)).join('') + PROMOTED + rank;
|
|
81
|
+
/**
|
|
82
|
+
* The key a table's cell displays at (`table.columns`): its column's
|
|
83
|
+
* position, before every unlisted column (`unlistedCellKey`) and the cells
|
|
84
|
+
* of no listed column (`LAST_CELL`).
|
|
85
|
+
*/
|
|
86
|
+
export const cellKey = (at) => '0' + denseKey(at);
|
|
87
|
+
/** A withdrawn cell's column the table no longer lists: after the listed ones, by `unlistedRank`. */
|
|
88
|
+
export const unlistedCellKey = (hash) => '1' + denseKey(hash % 2 ** 24);
|
|
89
|
+
/** A cell of no listed column: last (it does not display, `table.cell`). */
|
|
90
|
+
export const LAST_CELL = '2';
|
|
@@ -2,63 +2,71 @@
|
|
|
2
2
|
* Placement engine — the Edytor document model on vendored Yjs v14.
|
|
3
3
|
*
|
|
4
4
|
* Architecture: every block is a stable registry entry keyed by its logical
|
|
5
|
-
* id; displayed structure is DERIVED from
|
|
6
|
-
*
|
|
5
|
+
* id; displayed structure is DERIVED from the order sequences (fork patch
|
|
6
|
+
* YP22), never from physical nesting.
|
|
7
7
|
*
|
|
8
8
|
* ```
|
|
9
9
|
* doc.get('blocks') registry — flat map, block-id → node
|
|
10
|
+
* │ [ {b: id}, {b: id}, R, … ] its list part: the top-level blocks' home slots and move records
|
|
10
11
|
* └ <blockId> node('block') stable identity; survives every move
|
|
11
|
-
* ├ id / type /
|
|
12
|
+
* ├ id / type / n payload attrs (n: incarnation nonce)
|
|
13
|
+
* ├ d/<pointer> data leaves (`crdt/data.ts`)
|
|
12
14
|
* ├ del.<writer> per-writer delete marks (any live mark = deleted)
|
|
13
15
|
* ├ content → node('content') BACKING text of a block created fresh
|
|
14
|
-
*
|
|
15
|
-
* └
|
|
16
|
-
*
|
|
16
|
+
* │ (its streams' boundaries `{s, n}`, claim items `{m}`)
|
|
17
|
+
* └ [ {b: child}, {p, i}, R, … ] its list part: its children's home slots, its data
|
|
18
|
+
* arrays' item slots, and move records
|
|
17
19
|
* ```
|
|
18
20
|
*
|
|
19
|
-
* Placement
|
|
21
|
+
* Placement semantics (`placement/slots.ts`, `placement/resolve.ts`):
|
|
20
22
|
*
|
|
21
|
-
* - `{
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `(
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* - Projection resolves
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
23
|
+
* - A block's home slot `{b: id}` is written once, at its creation, in its
|
|
24
|
+
* parent's sequence right after its left sibling's unit (YATA's origin
|
|
25
|
+
* rule). A move is one record in the destination's sequence naming the
|
|
26
|
+
* moved blocks' home slots in order; each slot shows at the record that
|
|
27
|
+
* wins its movers — the greatest `(priority, client, clock)` — and is
|
|
28
|
+
* hidden at home; deleting a record (an undo) hands the slot to the next
|
|
29
|
+
* record, else home. Replicas converge in any delivery order.
|
|
30
|
+
* - Projection resolves the display edges greedily in that order: a block's
|
|
31
|
+
* candidates are its live records, strongest first, then its home slot,
|
|
32
|
+
* and it takes the first whose DISPLAY parent chain cannot reach back to
|
|
33
|
+
* the block through already accepted edges — the later move wins, and a
|
|
34
|
+
* block whose move a cycle drops is back where it stood (its previous
|
|
35
|
+
* record, else home); only a block every candidate of which closes a cycle
|
|
36
|
+
* shows at the root after the last top-level block (deterministic,
|
|
37
|
+
* acyclic, pure — no repair writes). The acyclic relation is the COMPOSED
|
|
38
|
+
* one — raw edges are acyclic but merge claims can redirect a display edge
|
|
39
|
+
* back into the block's own subtree.
|
|
35
40
|
* - Delete marks `del.<writer>` are independent replicated attrs: a marked
|
|
36
|
-
* block is hidden regardless of
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* block is hidden regardless of where its slot shows — explicit deletion
|
|
42
|
+
* beats concurrent move. Deleting marks the block and every block it
|
|
43
|
+
* displays through merge claims, a whole-subtree delete every member; undo
|
|
44
|
+
* removes only the undoer's mark. An unmarked block under a marked one is
|
|
45
|
+
* promoted into its slot at read time (`displaySlotOf`), so a concurrent
|
|
46
|
+
* child is never hidden with it; a block under a void kind
|
|
47
|
+
* (`DisplayOwnership.childless`) likewise.
|
|
43
48
|
*
|
|
44
49
|
* Content ownership (`text/model.ts`): a block displays its stream —
|
|
45
50
|
* delimited by boundary items in a backing text — then the displays of the
|
|
46
|
-
* blocks it claims. A split inserts one boundary; a merge
|
|
47
|
-
* no text is ever copied.
|
|
51
|
+
* blocks it claims. A split inserts one boundary; a merge one claim item at
|
|
52
|
+
* the end of the stream; no text is ever copied.
|
|
48
53
|
*
|
|
49
54
|
* The engine is the vendored one, read through `engine.js` (structural
|
|
50
55
|
* types, `engine-api.ts`): this file never imports vendor `.js` (which
|
|
51
56
|
* `pnpm check` must not traverse).
|
|
52
57
|
*
|
|
53
|
-
*
|
|
54
|
-
* `placement/
|
|
55
|
-
* (re-exported here); this module declares
|
|
56
|
-
* and read primitives, each a function
|
|
57
|
-
* public binding's `model` lists them,
|
|
58
|
+
* The placement reads are `placement/resolve.ts` (the index decides), the sequences
|
|
59
|
+
* `placement/slots.ts`, the order keys `placement/keys.ts`, where a block
|
|
60
|
+
* displays `placement/display.ts` (re-exported here); this module declares
|
|
61
|
+
* the model's types and its write and read primitives, each a function
|
|
62
|
+
* edytor's modules import (the public binding's `model` lists them,
|
|
63
|
+
* `bindModel`).
|
|
58
64
|
*/
|
|
59
65
|
import type { EngineApi, EngineDoc, EngineItemRef, EngineNode } from '../engine-api.js';
|
|
60
66
|
import { REGISTRY_KEY } from '../schema.js';
|
|
61
67
|
import { type Ownership, type TextBlockRec } from '../text/model.js';
|
|
68
|
+
import { type BlockSlot, type Unit, type SeqItem, type Stamp } from './slots.js';
|
|
69
|
+
import { type SlotRef } from './resolve.js';
|
|
62
70
|
/** Logical block identifier — caller-assigned, immutable per block. */
|
|
63
71
|
export type BlockId = string;
|
|
64
72
|
/** Where a block goes: `parent` = logical block id or `null` for root. */
|
|
@@ -109,33 +117,23 @@ export type ProjectedDoc = {
|
|
|
109
117
|
children: ProjectedBlock[];
|
|
110
118
|
};
|
|
111
119
|
export { REGISTRY_KEY };
|
|
112
|
-
export {
|
|
113
|
-
export { promotedRank
|
|
114
|
-
export { bySlot, childrenIndex, displayParentOf, displaySlotOf, documentOrder, isLiveIn
|
|
115
|
-
/** Placement value written atomically as one attr: `{p, r}`. */
|
|
116
|
-
export type PlacementValue = {
|
|
117
|
-
p: BlockId | null;
|
|
118
|
-
r: string;
|
|
119
|
-
};
|
|
120
|
-
/** A parsed placement candidate (key + value). */
|
|
121
|
-
export type PlacementCand = {
|
|
122
|
-
key: string;
|
|
123
|
-
seq: number;
|
|
124
|
-
client: number;
|
|
125
|
-
p: BlockId | null;
|
|
126
|
-
r: string;
|
|
127
|
-
};
|
|
120
|
+
export type { SlotRef, Edge } from './resolve.js';
|
|
121
|
+
export { promotedRank } from './keys.js';
|
|
122
|
+
export { bySlot, childrenIndex, displayParentOf, displaySlotOf, documentOrder, isLiveIn } from './display.js';
|
|
128
123
|
/**
|
|
129
|
-
* Internal per-block record: the registry node
|
|
130
|
-
*
|
|
131
|
-
* the text-ownership facts (nonce, own text, merge claims).
|
|
124
|
+
* Internal per-block record: the registry node, its home slot (`null`: none
|
|
125
|
+
* found), plus the text-ownership facts (nonce, own text, merge claims).
|
|
132
126
|
*/
|
|
133
127
|
export type BlockRec = TextBlockRec & {
|
|
134
128
|
type: string;
|
|
135
129
|
data: unknown;
|
|
136
|
-
|
|
130
|
+
home: SlotRef | null;
|
|
137
131
|
};
|
|
138
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Resolved placement after acyclic acceptance: the owner of the sequence
|
|
134
|
+
* that shows the block (`null`: the root) and its order key there (an
|
|
135
|
+
* in-memory key, `placement/keys.ts`: never stored).
|
|
136
|
+
*/
|
|
139
137
|
export type ResolvedPlacement = {
|
|
140
138
|
parent: BlockId | null;
|
|
141
139
|
rank: string;
|
|
@@ -180,12 +178,6 @@ export type DisplayOwnership = Ownership & {
|
|
|
180
178
|
* it ({@link displaySlotOf}).
|
|
181
179
|
*/
|
|
182
180
|
sheds?: (owner: BlockId, child: BlockId) => boolean;
|
|
183
|
-
/**
|
|
184
|
-
* The rank `id` displays at directly under `parent` (its placement's own
|
|
185
|
-
* parent) — `rank` unless it is a piece of a text (`order.split.text`,
|
|
186
|
-
* {@link textRanker}).
|
|
187
|
-
*/
|
|
188
|
-
textRank?: (id: BlockId, parent: BlockId | null, rank: string) => string;
|
|
189
181
|
/**
|
|
190
182
|
* The rank `id` displays at directly under `owner`, its placement's own
|
|
191
183
|
* parent, when a rule other than its placement orders it there (a
|
|
@@ -253,10 +245,11 @@ export declare const isLive: (doc: EngineDoc, id: BlockId) => boolean;
|
|
|
253
245
|
/**
|
|
254
246
|
* The history's creation rule (`doc/history.ts`, `hist.undo.withdraw`): an
|
|
255
247
|
* undo never deletes a block the undone step created. Its node and
|
|
256
|
-
* structure (attrs,
|
|
257
|
-
* stay and the undoer's withdraw mark is written on it; what the step
|
|
258
|
-
* inside the content
|
|
259
|
-
*
|
|
248
|
+
* structure (attrs, its home slot in its parent's sequence, the content
|
|
249
|
+
* node) stay and the undoer's withdraw mark is written on it; what the step
|
|
250
|
+
* wrote inside the content node (the undoer's own text, atoms, boundaries,
|
|
251
|
+
* claims) is deleted as usual, and so are the move records and data slots
|
|
252
|
+
* the step wrote in the created node's sequence. The index shows a withdrawn
|
|
260
253
|
* block while it holds another writer's content.
|
|
261
254
|
*/
|
|
262
255
|
export declare const withdrawOnUndo: (doc: EngineDoc) => (item: EngineItemRef, stackItem: {
|
|
@@ -264,14 +257,6 @@ export declare const withdrawOnUndo: (doc: EngineDoc) => (item: EngineItemRef, s
|
|
|
264
257
|
has(client: number, clock: number): boolean;
|
|
265
258
|
};
|
|
266
259
|
}) => boolean;
|
|
267
|
-
/**
|
|
268
|
-
* Atomically append one placement candidate `{p, r}` to a block's `at`
|
|
269
|
-
* map, stamped `seq = localMax+1, client = doc.clientID`, then compact:
|
|
270
|
-
* candidates below the top-2 are tombstoned (the runner-up survives as
|
|
271
|
-
* the acyclic fallback; deeper history is re-created by undo anyway).
|
|
272
|
-
* Must run inside a transaction.
|
|
273
|
-
*/
|
|
274
|
-
export declare const writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
|
|
275
260
|
/** The doc's index as a `ModelView` — folded up to the open transaction's last write. */
|
|
276
261
|
export declare const view: (doc: EngineDoc) => ModelView;
|
|
277
262
|
/** A detached inline-atom node (inputs arrive normalized by the facade's ingress). */
|
|
@@ -282,48 +267,50 @@ export declare const buildInline: (atom: InlineSpec) => EngineNode;
|
|
|
282
267
|
* (`displayParentOf`), not the raw placement chain. A merge claim can
|
|
283
268
|
* place a block inside another's display subtree without appearing in
|
|
284
269
|
* its raw ancestry, so the merge refusal must see through the claim
|
|
285
|
-
* redirect — this is exactly the relation
|
|
270
|
+
* redirect — this is exactly the relation the index's placements keep
|
|
286
271
|
* acyclic: a merge that would close a cycle is refused without mutation.
|
|
287
272
|
*/
|
|
288
273
|
export declare const isSelfOrDescendant: (placements: Map<BlockId, ResolvedPlacement>, own: Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
|
|
289
274
|
/**
|
|
290
|
-
* `
|
|
291
|
-
* `
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
* callers must guard. No string sorts strictly between equal strings,
|
|
298
|
-
* so each new member takes `left` verbatim: it JOINS the tie and the
|
|
299
|
-
* `(rank, id)` display sort orders the whole group deterministically.
|
|
300
|
-
* On a valid seam the emitted chain is `rankBetween(left, right)` then
|
|
301
|
-
* `rankBetween(prev, right)` — with `run`, `rankAfter` (an insert: after a
|
|
302
|
-
* block this client ranked, in its run there).
|
|
275
|
+
* Write `slots` (new blocks' home slots) and/or a move of `moved` (their
|
|
276
|
+
* home units, as `client, clock, len` triples) under `parent`, right after
|
|
277
|
+
* the displayed child `left` (`null`: first) and before `right`: into the
|
|
278
|
+
* sequence that holds `left`'s displaying unit (a promoted or claimed
|
|
279
|
+
* neighbour's own parent), after it — or before `right`'s — else into
|
|
280
|
+
* `parent`'s own sequence. `side` is the record's class among the items of
|
|
281
|
+
* its origin (`placement/slots.ts`: `0` after, `1` before).
|
|
303
282
|
*/
|
|
304
|
-
export declare const
|
|
305
|
-
|
|
306
|
-
|
|
283
|
+
export declare const placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: Unit | null) => void;
|
|
284
|
+
/**
|
|
285
|
+
* Move `ids` (in order) to display index `index` among `parent`'s children
|
|
286
|
+
* (themselves left out): one record naming their home slots, after the
|
|
287
|
+
* child before that index. `at` is the block the record stands at for the
|
|
288
|
+
* engine's sort of two records at one origin (its home slot; `null`: the
|
|
289
|
+
* first moved) and `part` its order among the records standing there.
|
|
290
|
+
*/
|
|
291
|
+
export declare const moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
|
|
292
|
+
/**
|
|
293
|
+
* Materialize `specs` (whole subtrees, in order) under `parent` at display
|
|
294
|
+
* index `index`: each spec's node with its children, then their home slots
|
|
295
|
+
* in one run after the child before that index. `split`: the boundary of
|
|
296
|
+
* the split these blocks come with (a paste's lines at a split point), their
|
|
297
|
+
* slots' sort key among the slots of one origin ({@link BlockSlot}).
|
|
298
|
+
*/
|
|
299
|
+
export declare const insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly BlockSpec[], split?: Unit | null) => void;
|
|
307
300
|
/**
|
|
308
301
|
* Restore definition (migration only; a first import
|
|
309
302
|
* restores into an empty doc): make `specs` the whole visible document
|
|
310
303
|
* under their own ids, in ONE transaction. An existing id keeps its
|
|
311
304
|
* registry entry: every delete mark is cleared and its type, data,
|
|
312
|
-
*
|
|
313
|
-
* the spec's content
|
|
305
|
+
* place and content are rewritten in place — its claims deleted, a
|
|
306
|
+
* fresh own text holding the spec's content; a block whose stream still
|
|
314
307
|
* starts at a live boundary gets a new nonce, so that boundary goes inert
|
|
315
308
|
* and the own text is its stream. An absent id is created. Every other
|
|
316
|
-
* block gets this writer's delete mark.
|
|
317
|
-
*
|
|
309
|
+
* block gets this writer's delete mark. The places are written in the
|
|
310
|
+
* tree's order and the rewrites are last-writer-wins attrs, so two replicas
|
|
318
311
|
* restoring the same specs converge on one copy.
|
|
319
312
|
*/
|
|
320
313
|
export declare const restoreBlocks: (doc: EngineDoc, specs: BlockSpec[]) => void;
|
|
321
|
-
/**
|
|
322
|
-
* Materialize one spec subtree: the block owns its backing text (its
|
|
323
|
-
* stream from index 0); children recurse under a fresh sequential rank
|
|
324
|
-
* chain (a new block has no siblings to interleave with).
|
|
325
|
-
*/
|
|
326
|
-
export declare const materializeSpec: (doc: EngineDoc, sp: BlockSpec, parent: BlockId | null, rank: string) => void;
|
|
327
314
|
/**
|
|
328
315
|
* Does any id of `specs` (whole subtrees) collide — with another spec id,
|
|
329
316
|
* or with any registry entry, live or deleted? The registry is keyed by
|
|
@@ -342,15 +329,17 @@ export declare const insertBlocks: (doc: EngineDoc, dest: Destination, specs: Bl
|
|
|
342
329
|
/** {@link insertBlocks} of one spec. */
|
|
343
330
|
export declare const insertBlock: (doc: EngineDoc, dest: Destination, spec: BlockSpec) => boolean;
|
|
344
331
|
/**
|
|
345
|
-
* Split `id` at content `offset` into the new block `newId` placed
|
|
346
|
-
* `
|
|
347
|
-
* (fork patch YP7) and the merge claims that follow it
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
* the new block
|
|
351
|
-
* separate step. `id` must have a
|
|
332
|
+
* Split `id` at content `offset` into the new block `newId` placed under
|
|
333
|
+
* `parent` at display `index`: one boundary item for `newId` at the end of
|
|
334
|
+
* the gap at `offset` (fork patch YP7) and the merge claims that follow it
|
|
335
|
+
* written again in the new block's stream — no text is copied, so an
|
|
336
|
+
* offline edit to the tail keeps landing on the same items and displays in
|
|
337
|
+
* the new block after convergence. `tail` is the new block's type/data,
|
|
338
|
+
* decided once by the plan. Children are a separate step. `id` must have a
|
|
339
|
+
* stream or a claim ({@link ownText}).
|
|
340
|
+
* Returns the split's boundary unit (the key of the slots a paste adds at it).
|
|
352
341
|
*/
|
|
353
|
-
export declare const writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail,
|
|
342
|
+
export declare const writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => Unit;
|
|
354
343
|
/**
|
|
355
344
|
* Give the streamless block `id` its own text (`T.ownText`: a derived
|
|
356
345
|
* writer, a re-minted nonce) — before the first write that needs a stream.
|
|
@@ -361,7 +350,7 @@ export declare const ownText: (doc: EngineDoc, id: BlockId) => {
|
|
|
361
350
|
};
|
|
362
351
|
/**
|
|
363
352
|
* Canonical projection: pure derivation from replicated state — the
|
|
364
|
-
* visible tree of live blocks
|
|
353
|
+
* visible tree of live blocks in their sequences' order, children of a
|
|
365
354
|
* merged-away parent under its owner, those of a deleted parent in its
|
|
366
355
|
* slot ({@link displaySlotOf}). Content is each block's display.
|
|
367
356
|
*/
|
|
@@ -390,6 +379,17 @@ export declare const blockText: (doc: EngineDoc, id: BlockId) => string | null;
|
|
|
390
379
|
export declare const crdtId: (doc: EngineDoc, id: BlockId) => string | null;
|
|
391
380
|
/** Engine handle for a logical id, or null when absent or delete-marked (debug surface). */
|
|
392
381
|
export declare const resolveBlock: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
382
|
+
/**
|
|
383
|
+
* The live move records of `node`'s sequence (the room's purge, tests):
|
|
384
|
+
* each with its stamp and whether some unit still shows at it — the
|
|
385
|
+
* engine's mover of a unit, or (with `v`) the record a block shows at in
|
|
386
|
+
* `v` (a cycle sent it back to an older one).
|
|
387
|
+
*/
|
|
388
|
+
export declare const recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
|
|
389
|
+
item: SeqItem;
|
|
390
|
+
stamp: Stamp;
|
|
391
|
+
wins: boolean;
|
|
392
|
+
}[];
|
|
393
393
|
/**
|
|
394
394
|
* The placement model as one object (the public binding's `model`): the
|
|
395
395
|
* primitives above. Edytor's own modules import them directly.
|
|
@@ -400,30 +400,31 @@ export declare const bindModel: (_Y: EngineApi) => {
|
|
|
400
400
|
blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
401
401
|
liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
402
402
|
isLive: (doc: EngineDoc, id: BlockId) => boolean;
|
|
403
|
-
candidatesOf: (node: EngineNode) => PlacementCand[];
|
|
404
403
|
/** The doc's index as a `ModelView`. */
|
|
405
404
|
view: (doc: EngineDoc) => ModelView;
|
|
406
|
-
resolvePlacements: (blocks: Map<BlockId, BlockRec>, ownerOf?: (b: BlockId) => import("../text/model.js").Owner) => Map<BlockId, ResolvedPlacement>;
|
|
407
405
|
childrenIndex: (placements: Map<BlockId, ResolvedPlacement>, own: DisplayOwnership) => Map<BlockId | null, ChildSlot[]>;
|
|
408
406
|
positionInView: (v: ModelView, id: BlockId) => Destination | null;
|
|
409
407
|
buildInline: (atom: InlineSpec) => EngineNode;
|
|
410
408
|
isSelfOrDescendant: (placements: Map<BlockId, ResolvedPlacement>, own: Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
|
|
409
|
+
placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: Unit | null) => void;
|
|
410
|
+
moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
|
|
411
|
+
insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly BlockSpec[], split?: Unit | null) => void;
|
|
415
412
|
withdrawOnUndo: (doc: EngineDoc) => (item: EngineItemRef, stackItem: {
|
|
416
413
|
inserts: {
|
|
417
414
|
has(client: number, clock: number): boolean;
|
|
418
415
|
};
|
|
419
416
|
}) => boolean;
|
|
420
|
-
materializeSpec: (doc: EngineDoc, sp: BlockSpec, parent: BlockId | null, rank: string) => void;
|
|
421
417
|
collides: (doc: EngineDoc, specs: readonly BlockSpec[]) => boolean;
|
|
422
|
-
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail,
|
|
418
|
+
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => Unit;
|
|
423
419
|
ownText: (doc: EngineDoc, id: BlockId) => {
|
|
424
420
|
from: unknown;
|
|
425
421
|
to: number;
|
|
426
422
|
};
|
|
423
|
+
recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
|
|
424
|
+
item: SeqItem;
|
|
425
|
+
stamp: Stamp;
|
|
426
|
+
wins: boolean;
|
|
427
|
+
}[];
|
|
427
428
|
insertBlocks: (doc: EngineDoc, dest: Destination, specs: BlockSpec[]) => boolean;
|
|
428
429
|
insertBlock: (doc: EngineDoc, dest: Destination, spec: BlockSpec) => boolean;
|
|
429
430
|
restoreBlocks: (doc: EngineDoc, specs: BlockSpec[]) => void;
|