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
|
@@ -5,7 +5,7 @@ import { bindText } from './text/model.js';
|
|
|
5
5
|
import { type RunView } from './text/runs.js';
|
|
6
6
|
import { type BlockAttribution } from './attribution/block.js';
|
|
7
7
|
import type { JSONBlock, JSONDoc } from '../utils/json.js';
|
|
8
|
-
import { assertSchema,
|
|
8
|
+
import { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
|
|
9
9
|
import type { EngineNode } from './engine-api.js';
|
|
10
10
|
import type { ContentItem, InlineSpec, ModelView, SplitTail } from './placement/model.js';
|
|
11
11
|
import type { Anchor } from './text/model.js';
|
|
@@ -14,10 +14,10 @@ import type { DocPosition } from './rangeDelete.js';
|
|
|
14
14
|
import type { DataPatch } from './data.js';
|
|
15
15
|
import type { AnchorAffinity, BlockRole, DataTarget, DocAnchor, DocChange, EdytorDocConfig, JsonObj, OpResult, OrderPolicy, Plan, PlanEffect, PlanStep, Prepared, TextRange } from './doc/types.js';
|
|
16
16
|
export { SCHEMA };
|
|
17
|
-
export { assertSchema,
|
|
18
|
-
export {
|
|
17
|
+
export { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion };
|
|
18
|
+
export type { SchemaProblem } from './doc/gate.js';
|
|
19
19
|
export { SEED_ORIGIN } from './doc/seed.js';
|
|
20
|
-
export {
|
|
20
|
+
export { DocumentDestroyedError } from './doc/funnel.js';
|
|
21
21
|
export { DEFAULT_HISTORY_LIMIT } from './doc/history.js';
|
|
22
22
|
export type { AnchorAffinity, BlockRole, DataTarget, DocAnchor, DocChange, EdytorDocConfig, OpResult, OrderPolicy, Plan, PlanEffect, PlanStep, Prepared, TextRange };
|
|
23
23
|
export type EdytorDoc = ReturnType<EdytorDocBinding['create']>;
|
|
@@ -38,6 +38,16 @@ type Layers = {
|
|
|
38
38
|
* The per-doc facade factory over the engine `Y` (the editor's documents
|
|
39
39
|
* use it directly; {@link bindDocModel} is the public binding around it).
|
|
40
40
|
*/
|
|
41
|
+
/**
|
|
42
|
+
* Give `doc` edytor's rule — a registry value a concurrent creation replaced
|
|
43
|
+
* keeps its subtree (fork patch YP14, `keepingReplaced`) — or refuse it
|
|
44
|
+
* loudly when it has integrated updates without it: the engine decides what
|
|
45
|
+
* a replaced value keeps when it integrates, so a document that took updates
|
|
46
|
+
* under the engine's default could lose a subtree its peers keep, forever.
|
|
47
|
+
* Create it with `createDoc()` (or `createDocument`/`loadDocument`), never
|
|
48
|
+
* `new Y.Doc()`.
|
|
49
|
+
*/
|
|
50
|
+
export declare const adoptRules: <D extends object>(doc: D) => D;
|
|
41
51
|
export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (doc: EngineDoc, config?: EdytorDocConfig) => {
|
|
42
52
|
/** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
|
|
43
53
|
prepare: {
|
|
@@ -104,7 +114,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
|
|
|
104
114
|
keep?: boolean;
|
|
105
115
|
after?: readonly import("./index.js").BlockSpec[];
|
|
106
116
|
} | undefined) => OpResult;
|
|
107
|
-
placeBeside: (ids: readonly string[], target: string, side: "
|
|
117
|
+
placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
|
|
108
118
|
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
|
|
109
119
|
splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
|
|
110
120
|
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
@@ -265,7 +275,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
|
|
|
265
275
|
export declare const bindDocModel: (Y: EngineApi) => {
|
|
266
276
|
/** The schema manifest constants table. */
|
|
267
277
|
SCHEMA: {
|
|
268
|
-
readonly version:
|
|
278
|
+
readonly version: 10;
|
|
269
279
|
readonly name: "edytor-doc";
|
|
270
280
|
readonly roots: {
|
|
271
281
|
readonly registry: "blocks";
|
|
@@ -276,7 +286,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
276
286
|
readonly schema: "schema";
|
|
277
287
|
};
|
|
278
288
|
};
|
|
279
|
-
SCHEMA_VERSION:
|
|
289
|
+
SCHEMA_VERSION: 10;
|
|
280
290
|
SCHEMA_NAME: "edytor-doc";
|
|
281
291
|
META_KEY: "meta";
|
|
282
292
|
/** Doc-level API (no facade needed). */
|
|
@@ -349,29 +359,30 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
349
359
|
blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
350
360
|
liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
351
361
|
isLive: (doc: EngineDoc, id: BlockId) => boolean;
|
|
352
|
-
candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
|
|
353
362
|
view: (doc: EngineDoc) => ModelView;
|
|
354
|
-
resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
|
|
355
363
|
childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
|
|
356
364
|
positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
|
|
357
365
|
buildInline: (atom: InlineSpec) => EngineNode;
|
|
358
366
|
isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
|
|
367
|
+
placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
|
|
368
|
+
moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
|
|
369
|
+
insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
|
|
363
370
|
withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
|
|
364
371
|
inserts: {
|
|
365
372
|
has(client: number, clock: number): boolean;
|
|
366
373
|
};
|
|
367
374
|
}) => boolean;
|
|
368
|
-
materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
|
|
369
375
|
collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
|
|
370
|
-
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail,
|
|
376
|
+
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
|
|
371
377
|
ownText: (doc: EngineDoc, id: BlockId) => {
|
|
372
378
|
from: unknown;
|
|
373
379
|
to: number;
|
|
374
380
|
};
|
|
381
|
+
recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
|
|
382
|
+
item: import("./placement/slots.js").SeqItem;
|
|
383
|
+
stamp: import("./placement/slots.js").Stamp;
|
|
384
|
+
wins: boolean;
|
|
385
|
+
}[];
|
|
375
386
|
insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
|
|
376
387
|
insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
|
|
377
388
|
restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
|
|
@@ -403,8 +414,8 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
403
414
|
at: number;
|
|
404
415
|
node: EngineNode;
|
|
405
416
|
} | null;
|
|
406
|
-
splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) =>
|
|
407
|
-
claimInto: (
|
|
417
|
+
splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
|
|
418
|
+
claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
|
|
408
419
|
ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
|
|
409
420
|
from: unknown;
|
|
410
421
|
to: number;
|
|
@@ -424,7 +435,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
424
435
|
keep?: boolean;
|
|
425
436
|
after?: readonly import("./index.js").BlockSpec[];
|
|
426
437
|
} | undefined) => OpResult;
|
|
427
|
-
placeBeside: (ids: readonly string[], target: string, side: "
|
|
438
|
+
placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
|
|
428
439
|
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
|
|
429
440
|
splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
|
|
430
441
|
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
@@ -584,14 +595,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
584
595
|
* not have integrated anything yet.
|
|
585
596
|
*/
|
|
586
597
|
newDoc: (opts?: ConstructorParameters<EngineApi["Doc"]>[0]) => YDoc;
|
|
587
|
-
/**
|
|
588
|
-
* Keep, on `doc`, the text a replica may have to copy again: its
|
|
589
|
-
* `gcFilter` then spares a deleted copy's content, as every facade's
|
|
590
|
-
* history does. A doc that only relays updates (the room) calls it
|
|
591
|
-
* before applying anything, so what it collects and encodes matches
|
|
592
|
-
* what an editing replica keeps.
|
|
593
|
-
*/
|
|
594
|
-
keepCopies: (doc: EngineDoc) => void;
|
|
595
598
|
/** The bound engine layers (same instances the facades use). */
|
|
596
599
|
model: {
|
|
597
600
|
REGISTRY_KEY: string;
|
|
@@ -599,29 +602,30 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
599
602
|
blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
600
603
|
liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
601
604
|
isLive: (doc: EngineDoc, id: BlockId) => boolean;
|
|
602
|
-
candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
|
|
603
605
|
view: (doc: EngineDoc) => ModelView;
|
|
604
|
-
resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
|
|
605
606
|
childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
|
|
606
607
|
positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
|
|
607
608
|
buildInline: (atom: InlineSpec) => EngineNode;
|
|
608
609
|
isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
|
|
610
|
+
placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
|
|
611
|
+
moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
|
|
612
|
+
insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
|
|
613
613
|
withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
|
|
614
614
|
inserts: {
|
|
615
615
|
has(client: number, clock: number): boolean;
|
|
616
616
|
};
|
|
617
617
|
}) => boolean;
|
|
618
|
-
materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
|
|
619
618
|
collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
|
|
620
|
-
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail,
|
|
619
|
+
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
|
|
621
620
|
ownText: (doc: EngineDoc, id: BlockId) => {
|
|
622
621
|
from: unknown;
|
|
623
622
|
to: number;
|
|
624
623
|
};
|
|
624
|
+
recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
|
|
625
|
+
item: import("./placement/slots.js").SeqItem;
|
|
626
|
+
stamp: import("./placement/slots.js").Stamp;
|
|
627
|
+
wins: boolean;
|
|
628
|
+
}[];
|
|
625
629
|
insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
|
|
626
630
|
insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
|
|
627
631
|
restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
|
|
@@ -653,8 +657,8 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
653
657
|
at: number;
|
|
654
658
|
node: EngineNode;
|
|
655
659
|
} | null;
|
|
656
|
-
splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) =>
|
|
657
|
-
claimInto: (
|
|
660
|
+
splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
|
|
661
|
+
claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
|
|
658
662
|
ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
|
|
659
663
|
from: unknown;
|
|
660
664
|
to: number;
|
|
@@ -671,7 +675,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
671
675
|
export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
672
676
|
/** The schema manifest constants table. */
|
|
673
677
|
SCHEMA: {
|
|
674
|
-
readonly version:
|
|
678
|
+
readonly version: 10;
|
|
675
679
|
readonly name: "edytor-doc";
|
|
676
680
|
readonly roots: {
|
|
677
681
|
readonly registry: "blocks";
|
|
@@ -682,7 +686,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
682
686
|
readonly schema: "schema";
|
|
683
687
|
};
|
|
684
688
|
};
|
|
685
|
-
SCHEMA_VERSION:
|
|
689
|
+
SCHEMA_VERSION: 10;
|
|
686
690
|
SCHEMA_NAME: "edytor-doc";
|
|
687
691
|
META_KEY: "meta";
|
|
688
692
|
/** Doc-level API (no facade needed). */
|
|
@@ -755,29 +759,30 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
755
759
|
blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
756
760
|
liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
757
761
|
isLive: (doc: EngineDoc, id: BlockId) => boolean;
|
|
758
|
-
candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
|
|
759
762
|
view: (doc: EngineDoc) => ModelView;
|
|
760
|
-
resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
|
|
761
763
|
childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
|
|
762
764
|
positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
|
|
763
765
|
buildInline: (atom: InlineSpec) => EngineNode;
|
|
764
766
|
isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
|
|
767
|
+
placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
|
|
768
|
+
moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
|
|
769
|
+
insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
|
|
769
770
|
withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
|
|
770
771
|
inserts: {
|
|
771
772
|
has(client: number, clock: number): boolean;
|
|
772
773
|
};
|
|
773
774
|
}) => boolean;
|
|
774
|
-
materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
|
|
775
775
|
collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
|
|
776
|
-
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail,
|
|
776
|
+
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
|
|
777
777
|
ownText: (doc: EngineDoc, id: BlockId) => {
|
|
778
778
|
from: unknown;
|
|
779
779
|
to: number;
|
|
780
780
|
};
|
|
781
|
+
recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
|
|
782
|
+
item: import("./placement/slots.js").SeqItem;
|
|
783
|
+
stamp: import("./placement/slots.js").Stamp;
|
|
784
|
+
wins: boolean;
|
|
785
|
+
}[];
|
|
781
786
|
insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
|
|
782
787
|
insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
|
|
783
788
|
restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
|
|
@@ -809,8 +814,8 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
809
814
|
at: number;
|
|
810
815
|
node: EngineNode;
|
|
811
816
|
} | null;
|
|
812
|
-
splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) =>
|
|
813
|
-
claimInto: (
|
|
817
|
+
splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
|
|
818
|
+
claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
|
|
814
819
|
ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
|
|
815
820
|
from: unknown;
|
|
816
821
|
to: number;
|
|
@@ -830,7 +835,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
830
835
|
keep?: boolean;
|
|
831
836
|
after?: readonly import("./index.js").BlockSpec[];
|
|
832
837
|
} | undefined) => OpResult;
|
|
833
|
-
placeBeside: (ids: readonly string[], target: string, side: "
|
|
838
|
+
placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
|
|
834
839
|
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
|
|
835
840
|
splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
|
|
836
841
|
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
@@ -990,14 +995,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
990
995
|
* not have integrated anything yet.
|
|
991
996
|
*/
|
|
992
997
|
newDoc: (opts?: ConstructorParameters<EngineApi["Doc"]>[0]) => YDoc;
|
|
993
|
-
/**
|
|
994
|
-
* Keep, on `doc`, the text a replica may have to copy again: its
|
|
995
|
-
* `gcFilter` then spares a deleted copy's content, as every facade's
|
|
996
|
-
* history does. A doc that only relays updates (the room) calls it
|
|
997
|
-
* before applying anything, so what it collects and encodes matches
|
|
998
|
-
* what an editing replica keeps.
|
|
999
|
-
*/
|
|
1000
|
-
keepCopies: (doc: EngineDoc) => void;
|
|
1001
998
|
/**
|
|
1002
999
|
* Purge from `doc` what was deleted before `horizon` (`room.purge.what`): real deletes, inside the caller's transaction,
|
|
1003
1000
|
* and the horizon record every history reads (`hist.purge.horizon`).
|
|
@@ -1006,7 +1003,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
1006
1003
|
purge: (doc: EngineDoc, facade: {
|
|
1007
1004
|
model: import("./placement/model.js").PlacementModel;
|
|
1008
1005
|
text: import("./text/model.js").TextEngine;
|
|
1009
|
-
}, horizon: import("./purge.js").Horizon) => import("./purge.js").PurgeReport;
|
|
1006
|
+
}, horizon: import("./purge.js").Horizon | null) => import("./purge.js").PurgeReport;
|
|
1010
1007
|
/** The purge horizon `doc` holds, or `null`. */
|
|
1011
1008
|
horizonOf: (doc: EngineDoc) => import("./purge.js").Horizon | null;
|
|
1012
1009
|
/**
|
|
@@ -1020,29 +1017,30 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
1020
1017
|
blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
1021
1018
|
liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
|
|
1022
1019
|
isLive: (doc: EngineDoc, id: BlockId) => boolean;
|
|
1023
|
-
candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
|
|
1024
1020
|
view: (doc: EngineDoc) => ModelView;
|
|
1025
|
-
resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
|
|
1026
1021
|
childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
|
|
1027
1022
|
positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
|
|
1028
1023
|
buildInline: (atom: InlineSpec) => EngineNode;
|
|
1029
1024
|
isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
|
|
1025
|
+
placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
|
|
1026
|
+
moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
|
|
1027
|
+
insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
|
|
1034
1028
|
withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
|
|
1035
1029
|
inserts: {
|
|
1036
1030
|
has(client: number, clock: number): boolean;
|
|
1037
1031
|
};
|
|
1038
1032
|
}) => boolean;
|
|
1039
|
-
materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
|
|
1040
1033
|
collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
|
|
1041
|
-
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail,
|
|
1034
|
+
writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
|
|
1042
1035
|
ownText: (doc: EngineDoc, id: BlockId) => {
|
|
1043
1036
|
from: unknown;
|
|
1044
1037
|
to: number;
|
|
1045
1038
|
};
|
|
1039
|
+
recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
|
|
1040
|
+
item: import("./placement/slots.js").SeqItem;
|
|
1041
|
+
stamp: import("./placement/slots.js").Stamp;
|
|
1042
|
+
wins: boolean;
|
|
1043
|
+
}[];
|
|
1046
1044
|
insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
|
|
1047
1045
|
insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
|
|
1048
1046
|
restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
|
|
@@ -1074,8 +1072,8 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
1074
1072
|
at: number;
|
|
1075
1073
|
node: EngineNode;
|
|
1076
1074
|
} | null;
|
|
1077
|
-
splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) =>
|
|
1078
|
-
claimInto: (
|
|
1075
|
+
splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
|
|
1076
|
+
claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
|
|
1079
1077
|
ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
|
|
1080
1078
|
from: unknown;
|
|
1081
1079
|
to: number;
|
package/dist/crdt/edytor-doc.js
CHANGED
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
*/
|
|
49
49
|
import { setMarkEdges } from './text/marks.js';
|
|
50
50
|
import { keepingReplaced } from './incarnations.js';
|
|
51
|
+
import { clientsOf } from './structs.js';
|
|
51
52
|
import { SCHEMA } from './schema.js';
|
|
52
53
|
import { bindModel, blockText, crdtId, listBlockIds, project, resolveBlock } from './placement/model.js';
|
|
53
54
|
import { bindText } from './text/model.js';
|
|
54
|
-
import { bindDeletes } from './text/deletes.js';
|
|
55
55
|
import { bindPurge, readHorizon } from './purge.js';
|
|
56
56
|
import { restoreDocument } from './restore.js';
|
|
57
57
|
import { bindRuns, indexOf } from './text/runs.js';
|
|
58
58
|
import { bindBlockAttribution, blockAttributionOf } from './attribution/block.js';
|
|
59
59
|
import { rangeDeleteOps } from './rangeDelete.js';
|
|
60
60
|
import { flowOps } from './flow.js';
|
|
61
|
-
import { assertSchema,
|
|
61
|
+
import { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
|
|
62
62
|
import { bindSeed, restore } from './doc/seed.js';
|
|
63
63
|
import { applied, ref } from './doc/plan.js';
|
|
64
64
|
import { docReads } from './doc/reads.js';
|
|
@@ -76,27 +76,37 @@ import { metaOps } from './doc/meta.js';
|
|
|
76
76
|
import { contentOps } from './doc/content.js';
|
|
77
77
|
// ── schema manifest and gate (`doc/gate.ts`) ────────────────────────────
|
|
78
78
|
export { SCHEMA };
|
|
79
|
-
export { assertSchema,
|
|
80
|
-
export { UnsupportedDocError } from './doc/gate.js';
|
|
79
|
+
export { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion };
|
|
81
80
|
export { SEED_ORIGIN } from './doc/seed.js';
|
|
82
|
-
export {
|
|
81
|
+
export { DocumentDestroyedError } from './doc/funnel.js';
|
|
83
82
|
export { DEFAULT_HISTORY_LIMIT } from './doc/history.js';
|
|
84
83
|
/**
|
|
85
84
|
* The per-doc facade factory over the engine `Y` (the editor's documents
|
|
86
85
|
* use it directly; {@link bindDocModel} is the public binding around it).
|
|
87
86
|
*/
|
|
87
|
+
/**
|
|
88
|
+
* Give `doc` edytor's rule — a registry value a concurrent creation replaced
|
|
89
|
+
* keeps its subtree (fork patch YP14, `keepingReplaced`) — or refuse it
|
|
90
|
+
* loudly when it has integrated updates without it: the engine decides what
|
|
91
|
+
* a replaced value keeps when it integrates, so a document that took updates
|
|
92
|
+
* under the engine's default could lose a subtree its peers keep, forever.
|
|
93
|
+
* Create it with `createDoc()` (or `createDocument`/`loadDocument`), never
|
|
94
|
+
* `new Y.Doc()`.
|
|
95
|
+
*/
|
|
96
|
+
export const adoptRules = (doc) => {
|
|
97
|
+
const d = doc;
|
|
98
|
+
if (d.keepReplaced == null && clientsOf(doc).size > 0)
|
|
99
|
+
throw new TypeError("edytor: this document took updates before it carried edytor's rules (create it with createDoc(), createDocument or loadDocument, not new Y.Doc())");
|
|
100
|
+
return keepingReplaced(d);
|
|
101
|
+
};
|
|
88
102
|
export const docFacade = (Y, layers) => {
|
|
89
|
-
const D = bindDeletes(Y);
|
|
90
103
|
// Compact per-block attribution writes (`attribution/block.ts`).
|
|
91
104
|
// One bound instance per engine binding; its suppression memory is
|
|
92
105
|
// per-doc (WeakMap-keyed), so facades on the same doc share it.
|
|
93
106
|
const BA = bindBlockAttribution(Y);
|
|
94
107
|
const { init, seed } = bindSeed(Y, BA);
|
|
95
108
|
return (doc, config = {}) => {
|
|
96
|
-
|
|
97
|
-
// Document-boundary check — foreign (v13-engine) and legacy-schema docs
|
|
98
|
-
// fail fast here rather than inside the runs view (see assertUsableDoc).
|
|
99
|
-
assertUsableDoc(doc);
|
|
109
|
+
adoptRules(doc);
|
|
100
110
|
setMarkEdges(doc, config.markEdge ?? (() => undefined));
|
|
101
111
|
const roleOf = config.roleOf ?? (() => undefined);
|
|
102
112
|
const defaultType = config.defaultType ?? 'paragraph';
|
|
@@ -145,7 +155,7 @@ export const docFacade = (Y, layers) => {
|
|
|
145
155
|
funnel.dispose();
|
|
146
156
|
events.close();
|
|
147
157
|
};
|
|
148
|
-
const { createUndoManager } = docHistory({ ...base, ...funnel,
|
|
158
|
+
const { createUndoManager } = docHistory({ ...base, ...funnel, init });
|
|
149
159
|
const { anchorAt, followUndo, resolveAnchor } = docAnchors(reads);
|
|
150
160
|
const steps = { ...shape, ...planSteps(shape) };
|
|
151
161
|
const { plan } = steps;
|
|
@@ -365,7 +375,6 @@ export const bindDocModel = (Y) => {
|
|
|
365
375
|
const M = bindModel(Y);
|
|
366
376
|
const T = bindText(Y);
|
|
367
377
|
const R = bindRuns(Y);
|
|
368
|
-
const D = bindDeletes(Y);
|
|
369
378
|
const { init, seed } = bindSeed(Y, bindBlockAttribution(Y));
|
|
370
379
|
const create = docFacade(Y, { model: M, text: T });
|
|
371
380
|
return {
|
|
@@ -394,14 +403,6 @@ export const bindDocModel = (Y) => {
|
|
|
394
403
|
* not have integrated anything yet.
|
|
395
404
|
*/
|
|
396
405
|
newDoc: (opts) => keepingReplaced(new Y.Doc(opts)),
|
|
397
|
-
/**
|
|
398
|
-
* Keep, on `doc`, the text a replica may have to copy again: its
|
|
399
|
-
* `gcFilter` then spares a deleted copy's content, as every facade's
|
|
400
|
-
* history does. A doc that only relays updates (the room) calls it
|
|
401
|
-
* before applying anything, so what it collects and encodes matches
|
|
402
|
-
* what an editing replica keeps.
|
|
403
|
-
*/
|
|
404
|
-
keepCopies: (doc) => void D.scope(doc),
|
|
405
406
|
/** The bound engine layers (same instances the facades use). */
|
|
406
407
|
model: M,
|
|
407
408
|
text: T,
|
|
@@ -49,6 +49,10 @@ export type EngineItemRef = {
|
|
|
49
49
|
*/
|
|
50
50
|
export interface EngineTransaction {
|
|
51
51
|
changed?: Map<unknown, Set<string | null>>;
|
|
52
|
+
/** The visibility changes hold records made, in order: `client, clock, ±len` per item (`> 0` shown). */
|
|
53
|
+
holds?: number[];
|
|
54
|
+
/** The units whose mover changed (the fork's move records), in order: `client, clock, len` per item. */
|
|
55
|
+
moves?: number[];
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
54
58
|
* Structural minimum of the vendored `Y.Node` (v14) used by the placement
|
|
@@ -70,7 +74,28 @@ export interface EngineNode {
|
|
|
70
74
|
forEachAttr(f: (value: unknown, key: string, node: EngineNode) => void): void;
|
|
71
75
|
attrKeys(): IterableIterator<string>;
|
|
72
76
|
insert(index: number, content: unknown): void;
|
|
73
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Delete `length` live units at `index`. With `into` (the document's
|
|
79
|
+
* records list), they are held by one record appended there instead (a
|
|
80
|
+
* delete its writer can take back), except those `fresh` names, which are
|
|
81
|
+
* removed.
|
|
82
|
+
*/
|
|
83
|
+
delete(index: number, length?: number, into?: EngineNode | null, fresh?: unknown): void;
|
|
84
|
+
/** Append one hold record of `ids` (`client, clock, len` triples) to this records list: they read as deleted while it lives. */
|
|
85
|
+
hold(ids: number[]): void;
|
|
86
|
+
/**
|
|
87
|
+
* Move the units `ids` names (`client, clock, len` triples, in order) to
|
|
88
|
+
* live index `index` of this sequence: one move record there (the fork's
|
|
89
|
+
* `ContentMove`); `side` is its class among the items of its origin (`0`
|
|
90
|
+
* after, `1` before), `at` the chain it stands at for the sort of two
|
|
91
|
+
* records at one origin — the units from the root sequence down to the
|
|
92
|
+
* unit it stands at, outermost first (`null`: the first unit it names) —
|
|
93
|
+
* and `part` its order among the records standing there.
|
|
94
|
+
*/
|
|
95
|
+
move(index: number, ids: number[], side?: number, part?: number, at?: ReadonlyArray<{
|
|
96
|
+
client: number;
|
|
97
|
+
clock: number;
|
|
98
|
+
}> | null): void;
|
|
74
99
|
}
|
|
75
100
|
/** Structural minimum of the vendored `Y.Doc`. */
|
|
76
101
|
export interface EngineDoc {
|
|
@@ -98,6 +123,13 @@ export interface EngineDoc {
|
|
|
98
123
|
*/
|
|
99
124
|
on(name: 'commit', f: (transaction: never) => void): void;
|
|
100
125
|
off(name: 'commit', f: (transaction: never) => void): void;
|
|
126
|
+
/**
|
|
127
|
+
* Doc-level `beforeCommit` channel (the fork's) — fires once per
|
|
128
|
+
* outermost transaction, after its function returned and while the
|
|
129
|
+
* transaction is still open: a listener's writes join it.
|
|
130
|
+
*/
|
|
131
|
+
on(name: 'beforeCommit', f: (transaction: never) => void): void;
|
|
132
|
+
off(name: 'beforeCommit', f: (transaction: never) => void): void;
|
|
101
133
|
/** Doc destruction event — doc-scoped state must release on destroy. */
|
|
102
134
|
on(name: 'destroy', f: () => void): void;
|
|
103
135
|
off(name: 'destroy', f: () => void): void;
|
package/dist/crdt/engine.d.ts
CHANGED
package/dist/crdt/engine.js
CHANGED
|
@@ -37,16 +37,13 @@ export const Y = {
|
|
|
37
37
|
createIdSet: V.createIdSet,
|
|
38
38
|
diffIdSet: V.diffIdSet,
|
|
39
39
|
insertIntoIdSet: V.insertIntoIdSet,
|
|
40
|
-
//
|
|
40
|
+
// the document's undo manager (`doc/history.ts`, fork patch YP18)
|
|
41
41
|
iterateStructsByIdSet: V.iterateStructsByIdSet,
|
|
42
42
|
getItemCleanStart: V.getItemCleanStart,
|
|
43
43
|
redoItem: V.redoItem,
|
|
44
|
-
// the document's undo manager (`doc/history.ts`, fork patch YP18)
|
|
45
44
|
keepItem: V.keepItem,
|
|
46
45
|
followRedone: V.followRedone,
|
|
47
46
|
isParentOf: V.isParentOf,
|
|
48
47
|
mergeIdSets: V.mergeIdSets,
|
|
49
|
-
// a folded delete record appended after the one it replaces
|
|
50
|
-
ContentAny: V.ContentAny,
|
|
51
48
|
createID: V.createID
|
|
52
49
|
};
|
package/dist/crdt/flow.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* - a `whole` flow (a block-selection copy) goes after the block, replacing
|
|
22
22
|
* it when empty (`flow.whole`); over selected blocks the lines take their
|
|
23
23
|
* slot (`flow.slot`), and at a slot they are placed with nothing replaced
|
|
24
|
-
* (`flow.place`: an accepted suggestion),
|
|
24
|
+
* (`flow.place`: an accepted suggestion), as plain inserts (`insertBlocks`: their order
|
|
25
25
|
* against a peer's split beside them is not claimed); a void
|
|
26
26
|
* takes one run (`flow.void`);
|
|
27
27
|
* - a table's cell is never split: it takes the lines a flow shows, nested
|