edytor 4.0.0 → 5.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 +2 -2
- package/dist/block/block.svelte.js +6 -21
- package/dist/block/inlineBlock.svelte.js +4 -6
- package/dist/clipboard/moveText.js +6 -8
- package/dist/cloudflare/DocumentRoom.d.ts +10 -3
- package/dist/cloudflare/index.d.ts +1 -1
- package/dist/cloudflare/room/access.d.ts +8 -3
- package/dist/cloudflare/room/access.js +44 -20
- package/dist/cloudflare/room/admission.js +28 -5
- package/dist/cloudflare/room/comments.js +28 -1
- package/dist/cloudflare/room/context.d.ts +115 -106
- package/dist/cloudflare/room/context.js +10 -3
- package/dist/cloudflare/room/forged.d.ts +14 -0
- package/dist/cloudflare/room/forged.js +30 -2
- package/dist/cloudflare/room/frames.d.ts +4 -0
- package/dist/cloudflare/room/frames.js +5 -1
- package/dist/cloudflare/room/purge.js +2 -1
- package/dist/cloudflare/room/replicas.d.ts +4 -2
- package/dist/cloudflare/room/replicas.js +8 -3
- package/dist/cloudflare/room/suggest.d.ts +7 -0
- package/dist/cloudflare/room/suggest.js +143 -0
- package/dist/cloudflare/routeDocumentSocket.d.ts +10 -1
- package/dist/cloudflare/routeDocumentSocket.js +5 -3
- package/dist/components/Content.svelte +9 -1
- package/dist/crdt/anchors.js +3 -2
- package/dist/crdt/attribution/attribution.d.ts +3 -0
- package/dist/crdt/attribution/attribution.js +3 -3
- package/dist/crdt/doc/capability.js +9 -13
- package/dist/crdt/doc/funnel.d.ts +1 -1
- package/dist/crdt/doc/funnel.js +5 -2
- package/dist/crdt/doc/gate.d.ts +1 -1
- package/dist/crdt/doc/history.d.ts +6 -0
- package/dist/crdt/doc/history.js +77 -56
- package/dist/crdt/doc/layout.js +5 -5
- package/dist/crdt/doc/meta.js +6 -7
- package/dist/crdt/doc/reads.d.ts +2 -2
- package/dist/crdt/doc/reads.js +18 -28
- package/dist/crdt/doc/steps.js +4 -4
- package/dist/crdt/doc/suggest.d.ts +167 -0
- package/dist/crdt/doc/suggest.js +579 -0
- package/dist/crdt/document.d.ts +10 -1
- package/dist/crdt/document.js +19 -11
- package/dist/crdt/edytor-doc.d.ts +355 -333
- package/dist/crdt/edytor-doc.js +125 -82
- package/dist/crdt/engine-api.d.ts +8 -2
- package/dist/crdt/engine.d.ts +2 -1
- package/dist/crdt/engine.js +3 -1
- package/dist/crdt/flow.d.ts +1 -1
- package/dist/crdt/flow.js +4 -10
- package/dist/crdt/index.d.ts +111 -105
- package/dist/crdt/index.js +3 -0
- package/dist/crdt/operations.d.ts +12 -3
- package/dist/crdt/parts.d.ts +43 -0
- package/dist/crdt/parts.js +44 -0
- package/dist/crdt/placement/display.d.ts +1 -1
- package/dist/crdt/placement/display.js +3 -3
- package/dist/crdt/placement/keys.d.ts +5 -0
- package/dist/crdt/placement/keys.js +5 -0
- package/dist/crdt/placement/resolve.js +2 -1
- package/dist/crdt/protocol.d.ts +1 -1
- package/dist/crdt/protocol.js +1 -1
- package/dist/crdt/protocols/auth.d.ts +11 -1
- package/dist/crdt/protocols/auth.js +17 -1
- package/dist/crdt/protocols/comments.d.ts +16 -1
- package/dist/crdt/protocols/comments.js +9 -1
- package/dist/crdt/providers/index.d.ts +6 -4
- package/dist/crdt/providers/index.js +3 -1
- package/dist/crdt/providers/websocket.d.ts +6 -4
- package/dist/crdt/providers/websocket.js +9 -4
- package/dist/crdt/purge.d.ts +7 -1
- package/dist/crdt/purge.js +32 -2
- package/dist/crdt/restore.d.ts +2 -1
- package/dist/crdt/restore.js +9 -0
- package/dist/crdt/schema.d.ts +9 -1
- package/dist/crdt/schema.js +13 -3
- package/dist/crdt/structs.d.ts +2 -0
- package/dist/crdt/structs.js +2 -0
- package/dist/crdt/text/index/claims.js +1 -23
- package/dist/crdt/text/index/layout.d.ts +2 -4
- package/dist/crdt/text/index/layout.js +9 -22
- package/dist/crdt/text/index/placement.js +21 -24
- package/dist/crdt/text/index/shared.js +17 -14
- package/dist/crdt/text/model.d.ts +10 -0
- package/dist/crdt/text/model.js +8 -1
- package/dist/crdt/text/runs.d.ts +34 -30
- package/dist/crdt/vendor/yjs/UPSTREAM.md +83 -0
- package/dist/crdt/vendor/yjs/dts/index.d.ts +1 -1
- package/dist/crdt/vendor/yjs/dts/structs/Item.d.ts +6 -3
- package/dist/crdt/vendor/yjs/dts/ynode.d.ts +13 -2
- package/dist/crdt/vendor/yjs/src/index.js +1 -1
- package/dist/crdt/vendor/yjs/src/structs/Item.js +44 -5
- package/dist/crdt/vendor/yjs/src/ynode.js +29 -7
- package/dist/edytor.svelte.d.ts +1 -1
- package/dist/edytor.svelte.js +100 -75
- package/dist/events/beforeInputCommands.d.ts +2 -2
- package/dist/events/nativeInteractiveControl.d.ts +11 -1
- package/dist/events/nativeInteractiveControl.js +41 -1
- package/dist/events/onBeforeInput.js +3 -3
- package/dist/events/onFocus.js +9 -11
- package/dist/export/forms.d.ts +25 -25
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/labels.d.ts +8 -0
- package/dist/labels.js +6 -1
- package/dist/plugins/comments/CommentsController.svelte.d.ts +5 -1
- package/dist/plugins/comments/CommentsController.svelte.js +14 -4
- package/dist/plugins/find/search.js +2 -2
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/suggestions/SuggestionBars.svelte +40 -23
- package/dist/plugins/suggestions/SuggestionBars.svelte.d.ts +3 -1
- package/dist/plugins/suggestions/SuggestionRuns.svelte +77 -0
- package/dist/plugins/suggestions/SuggestionRuns.svelte.d.ts +9 -0
- package/dist/plugins/suggestions/shared.svelte.d.ts +58 -0
- package/dist/plugins/suggestions/shared.svelte.js +421 -0
- package/dist/plugins/suggestions/suggestionsPlugin.d.ts +15 -4
- package/dist/selection/domSelection.d.ts +2 -0
- package/dist/selection/domSelection.js +6 -2
- package/dist/selection/pointer.svelte.js +75 -48
- package/dist/selection/replaceSelection.js +2 -6
- package/dist/selection/selection.svelte.d.ts +3 -3
- package/dist/selection/selection.svelte.js +39 -32
- package/dist/selection/selection.utils.d.ts +14 -0
- package/dist/selection/selection.utils.js +28 -3
- package/dist/session/commands.js +21 -11
- package/dist/session/composition.svelte.d.ts +5 -3
- package/dist/session/composition.svelte.js +21 -17
- package/dist/session/handles.d.ts +4 -17
- package/dist/session/handles.js +11 -37
- package/dist/session/navigation.js +6 -9
- package/dist/session/selection.d.ts +11 -5
- package/dist/session/selection.js +14 -48
- package/dist/session/suggestions.svelte.d.ts +38 -9
- package/dist/session/suggestions.svelte.js +37 -18
- package/dist/session/virtual.d.ts +1 -1
- package/dist/surface/attributes.d.ts +5 -0
- package/dist/surface/attributes.js +2 -2
- package/dist/surface/cells.d.ts +2 -26
- package/dist/surface/cells.js +2 -33
- package/dist/surface/observer.svelte.d.ts +6 -1
- package/dist/surface/observer.svelte.js +128 -81
- package/dist/surface/pin.svelte.d.ts +9 -9
- package/dist/surface/pin.svelte.js +15 -22
- package/dist/surface/projector.svelte.js +8 -14
- package/dist/text/text.svelte.js +14 -19
- package/dist/themes/notion.css +29 -0
- package/package.json +3 -1
|
@@ -6,6 +6,7 @@ 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
8
|
import { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
|
|
9
|
+
import type { SuggestContext } from './doc/suggest.js';
|
|
9
10
|
import type { EngineNode } from './engine-api.js';
|
|
10
11
|
import type { ContentItem, InlineSpec, ModelView, SplitTail } from './placement/model.js';
|
|
11
12
|
import type { Anchor } from './text/model.js';
|
|
@@ -49,125 +50,146 @@ type Layers = {
|
|
|
49
50
|
*/
|
|
50
51
|
export declare const adoptRules: <D extends object>(doc: D) => D;
|
|
51
52
|
export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (doc: EngineDoc, config?: EdytorDocConfig) => {
|
|
53
|
+
init: (opts?: Parameters<(doc: EngineDoc, opts?: {
|
|
54
|
+
content?: import("./index.js").BlockSpec[];
|
|
55
|
+
defaultType?: string;
|
|
56
|
+
}) => void>[1]) => void;
|
|
57
|
+
/** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
|
|
58
|
+
seed: (value: JSONBlock[], data?: JsonObj) => void;
|
|
59
|
+
isInitialized: () => boolean;
|
|
60
|
+
/** Replicated `meta.v` schema version (the module-level read, bound). */
|
|
61
|
+
schemaVersion: () => number | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The schema gate for this doc — throws {@link SchemaMismatchError}
|
|
64
|
+
* on unversioned-content or unsupported-version state. Consumers
|
|
65
|
+
* (`Edytor.sync()`, packed consumers) call it before trusting
|
|
66
|
+
* a synced doc.
|
|
67
|
+
*/
|
|
68
|
+
checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
|
|
69
|
+
assertSchema: () => void;
|
|
70
|
+
dispose: () => void;
|
|
71
|
+
createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
|
|
72
|
+
/** @internal What a part built over the document reads and writes (`doc/suggest.ts`). */
|
|
73
|
+
part: SuggestContext;
|
|
74
|
+
/** Visible children of `parent` with their ranks, in `(rank, id)` order. */
|
|
75
|
+
childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
|
|
76
|
+
slotOf: (id: string) => {
|
|
77
|
+
parent: BlockId | null;
|
|
78
|
+
rank: string;
|
|
79
|
+
} | null;
|
|
80
|
+
crdtId: (id: string) => string | null;
|
|
81
|
+
resolveBlock: (id: string) => EngineNode | null;
|
|
82
|
+
followUndo: (anchor: DocAnchor) => DocAnchor;
|
|
83
|
+
/** Re-read the roles after `roleOf` answers differently (roles adopted later). */
|
|
84
|
+
rolesChanged: (place?: boolean) => void;
|
|
85
|
+
defaultChild: (id: string | null) => string;
|
|
86
|
+
contentJSON: (id: string) => ({
|
|
87
|
+
text: string;
|
|
88
|
+
marks?: Record<string, unknown>;
|
|
89
|
+
} | {
|
|
90
|
+
id?: string;
|
|
91
|
+
type: string;
|
|
92
|
+
data?: unknown;
|
|
93
|
+
})[];
|
|
94
|
+
model: L["model"];
|
|
95
|
+
text: L["text"];
|
|
96
|
+
runsView: RunView;
|
|
97
|
+
/** The public members' names (`EdytorDocument` forwards them). */
|
|
98
|
+
api: object;
|
|
99
|
+
} & {
|
|
52
100
|
/** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
|
|
53
101
|
prepare: {
|
|
54
102
|
insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
|
|
55
103
|
deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
|
|
56
104
|
replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
|
|
57
|
-
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
|
|
58
|
-
moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
|
|
59
105
|
/**
|
|
60
106
|
* Move `id` to the last position under `parent` — under a container
|
|
61
107
|
* it is no item of, under its last item (`nestParent`: Tab after a list).
|
|
62
108
|
*/
|
|
63
109
|
nestBlock: (id: BlockId, parent: BlockId) => Prepared;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
mergeBackward: (id: BlockId) => Prepared;
|
|
75
|
-
mergeForward: (id: BlockId) => Prepared;
|
|
76
|
-
deleteBlock: (id: BlockId, opts?: {
|
|
77
|
-
keepChildren?: boolean;
|
|
78
|
-
}) => Prepared;
|
|
110
|
+
/** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
|
|
111
|
+
deleteBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
112
|
+
insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
|
|
113
|
+
deleteText: (id: BlockId, offset: number, length: number) => Prepared;
|
|
114
|
+
formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
|
|
115
|
+
clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
|
|
116
|
+
insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
|
|
117
|
+
removeInline: (id: BlockId, inlineId: string) => Prepared;
|
|
118
|
+
setBlockType: (id: BlockId, type: string) => Prepared;
|
|
119
|
+
patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
|
|
79
120
|
setBlock: (id: BlockId, value: {
|
|
80
121
|
type?: string;
|
|
81
122
|
data?: Record<string, unknown>;
|
|
82
123
|
content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
|
|
83
124
|
children?: (import("./index.js").BlockSpec | JSONBlock)[];
|
|
84
125
|
}) => Prepared;
|
|
85
|
-
|
|
86
|
-
|
|
126
|
+
deleteBlock: (id: BlockId, opts?: {
|
|
127
|
+
keepChildren?: boolean;
|
|
128
|
+
}) => Prepared;
|
|
129
|
+
splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
|
|
130
|
+
mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
|
|
131
|
+
mergeBackward: (id: BlockId) => Prepared;
|
|
132
|
+
mergeForward: (id: BlockId) => Prepared;
|
|
133
|
+
placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
|
|
134
|
+
wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
|
|
135
|
+
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
|
|
136
|
+
moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
|
|
137
|
+
unNestBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
138
|
+
unNestBlock: (id: BlockId) => Prepared;
|
|
139
|
+
liftOut: (id: BlockId, kind: string, { keep, after }?: {
|
|
140
|
+
keep?: boolean;
|
|
141
|
+
after?: readonly import("./index.js").BlockSpec[];
|
|
142
|
+
}) => Prepared;
|
|
87
143
|
duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
|
|
88
|
-
insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
|
|
89
|
-
deleteText: (id: BlockId, offset: number, length: number) => Prepared;
|
|
90
|
-
formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
|
|
91
|
-
clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
|
|
92
|
-
insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
|
|
93
|
-
removeInline: (id: BlockId, inlineId: string) => Prepared;
|
|
94
|
-
/** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
|
|
95
|
-
deleteBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
96
144
|
};
|
|
97
145
|
/** Write a prepared plan exactly (refusals pass through). */
|
|
98
|
-
apply: (p: Prepared) => OpResult;
|
|
146
|
+
apply: (p: Prepared, quiet?: boolean) => OpResult;
|
|
99
147
|
compose: (...parts: Prepared[]) => Prepared;
|
|
100
148
|
transact: <R>(fn: () => R, origin?: unknown) => R;
|
|
101
|
-
model: L["model"];
|
|
102
|
-
text: L["text"];
|
|
103
|
-
runsView: RunView;
|
|
104
149
|
version: number;
|
|
105
150
|
insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
|
|
106
151
|
deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
|
|
107
152
|
replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
|
|
108
|
-
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
|
|
109
|
-
moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
|
|
110
153
|
nestBlock: (id: string, parent: string) => OpResult;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
121
|
-
mergeBackward: (id: string) => OpResult;
|
|
122
|
-
mergeForward: (id: string) => OpResult;
|
|
123
|
-
deleteBlock: (id: string, opts?: {
|
|
124
|
-
keepChildren?: boolean;
|
|
125
|
-
} | undefined) => OpResult;
|
|
154
|
+
deleteBlocks: (ids: readonly string[]) => OpResult;
|
|
155
|
+
insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
|
|
156
|
+
deleteText: (id: string, offset: number, length: number) => OpResult;
|
|
157
|
+
formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
|
|
158
|
+
clearMarks: (id: string, offset: number, length: number) => OpResult;
|
|
159
|
+
insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
|
|
160
|
+
removeInline: (id: string, inlineId: string) => OpResult;
|
|
161
|
+
setBlockType: (id: string, type: string) => OpResult;
|
|
162
|
+
patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
|
|
126
163
|
setBlock: (id: string, value: {
|
|
127
164
|
type?: string;
|
|
128
165
|
data?: Record<string, unknown>;
|
|
129
166
|
content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
|
|
130
167
|
children?: (import("./index.js").BlockSpec | JSONBlock)[];
|
|
131
168
|
}) => OpResult;
|
|
132
|
-
|
|
133
|
-
|
|
169
|
+
deleteBlock: (id: string, opts?: {
|
|
170
|
+
keepChildren?: boolean;
|
|
171
|
+
} | undefined) => OpResult;
|
|
172
|
+
splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
|
|
173
|
+
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
174
|
+
mergeBackward: (id: string) => OpResult;
|
|
175
|
+
mergeForward: (id: string) => OpResult;
|
|
176
|
+
placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
|
|
177
|
+
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
|
|
178
|
+
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
|
|
179
|
+
moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
|
|
180
|
+
unNestBlocks: (ids: readonly string[]) => OpResult;
|
|
181
|
+
unNestBlock: (id: string) => OpResult;
|
|
182
|
+
liftOut: (id: string, kind: string, args_2?: {
|
|
183
|
+
keep?: boolean;
|
|
184
|
+
after?: readonly import("./index.js").BlockSpec[];
|
|
185
|
+
} | undefined) => OpResult;
|
|
134
186
|
duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
|
|
135
|
-
insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
|
|
136
|
-
deleteText: (id: string, offset: number, length: number) => OpResult;
|
|
137
|
-
formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
|
|
138
|
-
clearMarks: (id: string, offset: number, length: number) => OpResult;
|
|
139
|
-
insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
|
|
140
|
-
removeInline: (id: string, inlineId: string) => OpResult;
|
|
141
|
-
deleteBlocks: (ids: readonly string[]) => OpResult;
|
|
142
|
-
init: (opts?: Parameters<(doc: EngineDoc, opts?: {
|
|
143
|
-
content?: import("./index.js").BlockSpec[];
|
|
144
|
-
defaultType?: string;
|
|
145
|
-
}) => void>[1]) => void;
|
|
146
|
-
/** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
|
|
147
|
-
seed: (value: JSONBlock[], data?: JsonObj) => void;
|
|
148
|
-
isInitialized: () => boolean;
|
|
149
|
-
/** Replicated `meta.v` schema version (the module-level read, bound). */
|
|
150
|
-
schemaVersion: () => number | undefined;
|
|
151
|
-
/**
|
|
152
|
-
* The schema gate for this doc — throws {@link SchemaMismatchError}
|
|
153
|
-
* on unversioned-content or unsupported-version state. Consumers
|
|
154
|
-
* (`Edytor.sync()`, packed consumers) call it before trusting
|
|
155
|
-
* a synced doc.
|
|
156
|
-
*/
|
|
157
|
-
checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
|
|
158
|
-
assertSchema: () => void;
|
|
159
|
-
dispose: () => void;
|
|
160
|
-
createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
|
|
161
187
|
project: () => import("./index.js").ProjectedDoc;
|
|
162
|
-
toJSON: (
|
|
188
|
+
toJSON: (options?: {
|
|
189
|
+
suggestions?: boolean;
|
|
190
|
+
}) => JSONDoc;
|
|
163
191
|
blockJSON: (id: string) => JSONBlock;
|
|
164
192
|
childrenIds: (id: string | null) => string[];
|
|
165
|
-
/** Visible children of `parent` with their ranks, in `(rank, id)` order. */
|
|
166
|
-
childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
|
|
167
|
-
slotOf: (id: string) => {
|
|
168
|
-
parent: BlockId | null;
|
|
169
|
-
rank: string;
|
|
170
|
-
} | null;
|
|
171
193
|
positionOf: (id: string) => import("./index.js").Destination | null;
|
|
172
194
|
pathOf: (id: string) => number[] | null;
|
|
173
195
|
parentOf: (id: string) => string | null;
|
|
@@ -190,8 +212,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
|
|
|
190
212
|
* O(1) per call; live-replicated (remote values read the same).
|
|
191
213
|
*/
|
|
192
214
|
blockAttribution: (id: string) => BlockAttribution | undefined;
|
|
193
|
-
crdtId: (id: string) => string | null;
|
|
194
|
-
resolveBlock: (id: string) => EngineNode | null;
|
|
195
215
|
displayLength: (id: string) => number;
|
|
196
216
|
contentItems: (id: string) => ContentItem[];
|
|
197
217
|
hasBlock: (id: string) => boolean;
|
|
@@ -205,9 +225,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
|
|
|
205
225
|
blockId: BlockId;
|
|
206
226
|
offset: number;
|
|
207
227
|
} | null;
|
|
208
|
-
followUndo: (anchor: DocAnchor) => DocAnchor;
|
|
209
|
-
/** Re-read the roles after `roleOf` answers differently (roles adopted later). */
|
|
210
|
-
rolesChanged: () => void;
|
|
211
228
|
isVoid: (id: string) => boolean;
|
|
212
229
|
isIsland: (id: string) => boolean;
|
|
213
230
|
isLines: (id: string) => boolean;
|
|
@@ -254,16 +271,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
|
|
|
254
271
|
parent: string | null;
|
|
255
272
|
levels: string[];
|
|
256
273
|
};
|
|
257
|
-
defaultChild: (id: string | null) => string;
|
|
258
274
|
runs: (id: string) => readonly ContentRun[];
|
|
259
|
-
contentJSON: (id: string) => ({
|
|
260
|
-
text: string;
|
|
261
|
-
marks?: Record<string, unknown>;
|
|
262
|
-
} | {
|
|
263
|
-
id?: string;
|
|
264
|
-
type: string;
|
|
265
|
-
data?: unknown;
|
|
266
|
-
})[];
|
|
267
275
|
onChange: (cb: (change: DocChange) => void) => (() => void);
|
|
268
276
|
};
|
|
269
277
|
/**
|
|
@@ -275,7 +283,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
|
|
|
275
283
|
export declare const bindDocModel: (Y: EngineApi) => {
|
|
276
284
|
/** The schema manifest constants table. */
|
|
277
285
|
SCHEMA: {
|
|
278
|
-
readonly version:
|
|
286
|
+
readonly version: 11;
|
|
279
287
|
readonly name: "edytor-doc";
|
|
280
288
|
readonly roots: {
|
|
281
289
|
readonly registry: "blocks";
|
|
@@ -286,7 +294,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
286
294
|
readonly schema: "schema";
|
|
287
295
|
};
|
|
288
296
|
};
|
|
289
|
-
SCHEMA_VERSION:
|
|
297
|
+
SCHEMA_VERSION: 11;
|
|
290
298
|
SCHEMA_NAME: "edytor-doc";
|
|
291
299
|
META_KEY: "meta";
|
|
292
300
|
/** Doc-level API (no facade needed). */
|
|
@@ -304,55 +312,47 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
304
312
|
SchemaMismatchError: typeof SchemaMismatchError;
|
|
305
313
|
/** Attach the per-doc facade. */
|
|
306
314
|
create: (doc: EngineDoc, config?: EdytorDocConfig) => {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
removeInline: (id: BlockId, inlineId: string) => Prepared;
|
|
349
|
-
/** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
|
|
350
|
-
deleteBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
351
|
-
};
|
|
352
|
-
/** Write a prepared plan exactly (refusals pass through). */
|
|
353
|
-
apply: (p: Prepared) => OpResult;
|
|
354
|
-
compose: (...parts: Prepared[]) => Prepared;
|
|
355
|
-
transact: <R>(fn: () => R, origin?: unknown) => R;
|
|
315
|
+
init: (opts?: Parameters<(doc: EngineDoc, opts?: {
|
|
316
|
+
content?: import("./index.js").BlockSpec[];
|
|
317
|
+
defaultType?: string;
|
|
318
|
+
}) => void>[1]) => void;
|
|
319
|
+
/** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
|
|
320
|
+
seed: (value: JSONBlock[], data?: JsonObj) => void;
|
|
321
|
+
isInitialized: () => boolean;
|
|
322
|
+
/** Replicated `meta.v` schema version (the module-level read, bound). */
|
|
323
|
+
schemaVersion: () => number | undefined;
|
|
324
|
+
/**
|
|
325
|
+
* The schema gate for this doc — throws {@link SchemaMismatchError}
|
|
326
|
+
* on unversioned-content or unsupported-version state. Consumers
|
|
327
|
+
* (`Edytor.sync()`, packed consumers) call it before trusting
|
|
328
|
+
* a synced doc.
|
|
329
|
+
*/
|
|
330
|
+
checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
|
|
331
|
+
assertSchema: () => void;
|
|
332
|
+
dispose: () => void;
|
|
333
|
+
createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
|
|
334
|
+
/** @internal What a part built over the document reads and writes (`doc/suggest.ts`). */
|
|
335
|
+
part: SuggestContext;
|
|
336
|
+
/** Visible children of `parent` with their ranks, in `(rank, id)` order. */
|
|
337
|
+
childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
|
|
338
|
+
slotOf: (id: string) => {
|
|
339
|
+
parent: BlockId | null;
|
|
340
|
+
rank: string;
|
|
341
|
+
} | null;
|
|
342
|
+
crdtId: (id: string) => string | null;
|
|
343
|
+
resolveBlock: (id: string) => EngineNode | null;
|
|
344
|
+
followUndo: (anchor: DocAnchor) => DocAnchor;
|
|
345
|
+
/** Re-read the roles after `roleOf` answers differently (roles adopted later). */
|
|
346
|
+
rolesChanged: (place?: boolean) => void;
|
|
347
|
+
defaultChild: (id: string | null) => string;
|
|
348
|
+
contentJSON: (id: string) => ({
|
|
349
|
+
text: string;
|
|
350
|
+
marks?: Record<string, unknown>;
|
|
351
|
+
} | {
|
|
352
|
+
id?: string;
|
|
353
|
+
type: string;
|
|
354
|
+
data?: unknown;
|
|
355
|
+
})[];
|
|
356
356
|
model: {
|
|
357
357
|
REGISTRY_KEY: string;
|
|
358
358
|
registryOf: (doc: EngineDoc) => EngineNode;
|
|
@@ -422,73 +422,102 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
422
422
|
};
|
|
423
423
|
};
|
|
424
424
|
runsView: RunView;
|
|
425
|
+
/** The public members' names (`EdytorDocument` forwards them). */
|
|
426
|
+
api: object;
|
|
427
|
+
} & {
|
|
428
|
+
/** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
|
|
429
|
+
prepare: {
|
|
430
|
+
insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
|
|
431
|
+
deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
|
|
432
|
+
replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
|
|
433
|
+
/**
|
|
434
|
+
* Move `id` to the last position under `parent` — under a container
|
|
435
|
+
* it is no item of, under its last item (`nestParent`: Tab after a list).
|
|
436
|
+
*/
|
|
437
|
+
nestBlock: (id: BlockId, parent: BlockId) => Prepared;
|
|
438
|
+
/** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
|
|
439
|
+
deleteBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
440
|
+
insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
|
|
441
|
+
deleteText: (id: BlockId, offset: number, length: number) => Prepared;
|
|
442
|
+
formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
|
|
443
|
+
clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
|
|
444
|
+
insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
|
|
445
|
+
removeInline: (id: BlockId, inlineId: string) => Prepared;
|
|
446
|
+
setBlockType: (id: BlockId, type: string) => Prepared;
|
|
447
|
+
patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
|
|
448
|
+
setBlock: (id: BlockId, value: {
|
|
449
|
+
type?: string;
|
|
450
|
+
data?: Record<string, unknown>;
|
|
451
|
+
content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
|
|
452
|
+
children?: (import("./index.js").BlockSpec | JSONBlock)[];
|
|
453
|
+
}) => Prepared;
|
|
454
|
+
deleteBlock: (id: BlockId, opts?: {
|
|
455
|
+
keepChildren?: boolean;
|
|
456
|
+
}) => Prepared;
|
|
457
|
+
splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
|
|
458
|
+
mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
|
|
459
|
+
mergeBackward: (id: BlockId) => Prepared;
|
|
460
|
+
mergeForward: (id: BlockId) => Prepared;
|
|
461
|
+
placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
|
|
462
|
+
wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
|
|
463
|
+
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
|
|
464
|
+
moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
|
|
465
|
+
unNestBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
466
|
+
unNestBlock: (id: BlockId) => Prepared;
|
|
467
|
+
liftOut: (id: BlockId, kind: string, { keep, after }?: {
|
|
468
|
+
keep?: boolean;
|
|
469
|
+
after?: readonly import("./index.js").BlockSpec[];
|
|
470
|
+
}) => Prepared;
|
|
471
|
+
duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
|
|
472
|
+
};
|
|
473
|
+
/** Write a prepared plan exactly (refusals pass through). */
|
|
474
|
+
apply: (p: Prepared, quiet?: boolean) => OpResult;
|
|
475
|
+
compose: (...parts: Prepared[]) => Prepared;
|
|
476
|
+
transact: <R>(fn: () => R, origin?: unknown) => R;
|
|
425
477
|
version: number;
|
|
426
478
|
insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
|
|
427
479
|
deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
|
|
428
480
|
replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
|
|
429
|
-
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
|
|
430
|
-
moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
|
|
431
481
|
nestBlock: (id: string, parent: string) => OpResult;
|
|
432
|
-
|
|
433
|
-
unNestBlocks: (ids: readonly string[]) => OpResult;
|
|
434
|
-
liftOut: (id: string, kind: string, args_2?: {
|
|
435
|
-
keep?: boolean;
|
|
436
|
-
after?: readonly import("./index.js").BlockSpec[];
|
|
437
|
-
} | undefined) => OpResult;
|
|
438
|
-
placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
|
|
439
|
-
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
|
|
440
|
-
splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
|
|
441
|
-
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
442
|
-
mergeBackward: (id: string) => OpResult;
|
|
443
|
-
mergeForward: (id: string) => OpResult;
|
|
444
|
-
deleteBlock: (id: string, opts?: {
|
|
445
|
-
keepChildren?: boolean;
|
|
446
|
-
} | undefined) => OpResult;
|
|
447
|
-
setBlock: (id: string, value: {
|
|
448
|
-
type?: string;
|
|
449
|
-
data?: Record<string, unknown>;
|
|
450
|
-
content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
|
|
451
|
-
children?: (import("./index.js").BlockSpec | JSONBlock)[];
|
|
452
|
-
}) => OpResult;
|
|
453
|
-
setBlockType: (id: string, type: string) => OpResult;
|
|
454
|
-
patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
|
|
455
|
-
duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
|
|
482
|
+
deleteBlocks: (ids: readonly string[]) => OpResult;
|
|
456
483
|
insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
|
|
457
484
|
deleteText: (id: string, offset: number, length: number) => OpResult;
|
|
458
485
|
formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
|
|
459
486
|
clearMarks: (id: string, offset: number, length: number) => OpResult;
|
|
460
487
|
insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
|
|
461
488
|
removeInline: (id: string, inlineId: string) => OpResult;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
489
|
+
setBlockType: (id: string, type: string) => OpResult;
|
|
490
|
+
patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
|
|
491
|
+
setBlock: (id: string, value: {
|
|
492
|
+
type?: string;
|
|
493
|
+
data?: Record<string, unknown>;
|
|
494
|
+
content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
|
|
495
|
+
children?: (import("./index.js").BlockSpec | JSONBlock)[];
|
|
496
|
+
}) => OpResult;
|
|
497
|
+
deleteBlock: (id: string, opts?: {
|
|
498
|
+
keepChildren?: boolean;
|
|
499
|
+
} | undefined) => OpResult;
|
|
500
|
+
splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
|
|
501
|
+
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
502
|
+
mergeBackward: (id: string) => OpResult;
|
|
503
|
+
mergeForward: (id: string) => OpResult;
|
|
504
|
+
placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
|
|
505
|
+
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
|
|
506
|
+
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
|
|
507
|
+
moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
|
|
508
|
+
unNestBlocks: (ids: readonly string[]) => OpResult;
|
|
509
|
+
unNestBlock: (id: string) => OpResult;
|
|
510
|
+
liftOut: (id: string, kind: string, args_2?: {
|
|
511
|
+
keep?: boolean;
|
|
512
|
+
after?: readonly import("./index.js").BlockSpec[];
|
|
513
|
+
} | undefined) => OpResult;
|
|
514
|
+
duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
|
|
482
515
|
project: () => import("./index.js").ProjectedDoc;
|
|
483
|
-
toJSON: (
|
|
516
|
+
toJSON: (options?: {
|
|
517
|
+
suggestions?: boolean;
|
|
518
|
+
} | undefined) => JSONDoc;
|
|
484
519
|
blockJSON: (id: string) => JSONBlock;
|
|
485
520
|
childrenIds: (id: string | null) => string[];
|
|
486
|
-
/** Visible children of `parent` with their ranks, in `(rank, id)` order. */
|
|
487
|
-
childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
|
|
488
|
-
slotOf: (id: string) => {
|
|
489
|
-
parent: BlockId | null;
|
|
490
|
-
rank: string;
|
|
491
|
-
} | null;
|
|
492
521
|
positionOf: (id: string) => import("./index.js").Destination | null;
|
|
493
522
|
pathOf: (id: string) => number[] | null;
|
|
494
523
|
parentOf: (id: string) => string | null;
|
|
@@ -511,8 +540,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
511
540
|
* O(1) per call; live-replicated (remote values read the same).
|
|
512
541
|
*/
|
|
513
542
|
blockAttribution: (id: string) => BlockAttribution | undefined;
|
|
514
|
-
crdtId: (id: string) => string | null;
|
|
515
|
-
resolveBlock: (id: string) => EngineNode | null;
|
|
516
543
|
displayLength: (id: string) => number;
|
|
517
544
|
contentItems: (id: string) => ContentItem[];
|
|
518
545
|
hasBlock: (id: string) => boolean;
|
|
@@ -526,9 +553,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
526
553
|
blockId: BlockId;
|
|
527
554
|
offset: number;
|
|
528
555
|
} | null;
|
|
529
|
-
followUndo: (anchor: DocAnchor) => DocAnchor;
|
|
530
|
-
/** Re-read the roles after `roleOf` answers differently (roles adopted later). */
|
|
531
|
-
rolesChanged: () => void;
|
|
532
556
|
isVoid: (id: string) => boolean;
|
|
533
557
|
isIsland: (id: string) => boolean;
|
|
534
558
|
isLines: (id: string) => boolean;
|
|
@@ -575,16 +599,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
575
599
|
parent: string | null;
|
|
576
600
|
levels: string[];
|
|
577
601
|
};
|
|
578
|
-
defaultChild: (id: string | null) => string;
|
|
579
602
|
runs: (id: string) => readonly ContentRun[];
|
|
580
|
-
contentJSON: (id: string) => ({
|
|
581
|
-
text: string;
|
|
582
|
-
marks?: Record<string, unknown>;
|
|
583
|
-
} | {
|
|
584
|
-
id?: string;
|
|
585
|
-
type: string;
|
|
586
|
-
data?: unknown;
|
|
587
|
-
})[];
|
|
588
603
|
onChange: (cb: (change: DocChange) => void) => (() => void);
|
|
589
604
|
};
|
|
590
605
|
/**
|
|
@@ -675,7 +690,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
|
|
|
675
690
|
export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
676
691
|
/** The schema manifest constants table. */
|
|
677
692
|
SCHEMA: {
|
|
678
|
-
readonly version:
|
|
693
|
+
readonly version: 11;
|
|
679
694
|
readonly name: "edytor-doc";
|
|
680
695
|
readonly roots: {
|
|
681
696
|
readonly registry: "blocks";
|
|
@@ -686,7 +701,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
686
701
|
readonly schema: "schema";
|
|
687
702
|
};
|
|
688
703
|
};
|
|
689
|
-
SCHEMA_VERSION:
|
|
704
|
+
SCHEMA_VERSION: 11;
|
|
690
705
|
SCHEMA_NAME: "edytor-doc";
|
|
691
706
|
META_KEY: "meta";
|
|
692
707
|
/** Doc-level API (no facade needed). */
|
|
@@ -704,55 +719,47 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
704
719
|
SchemaMismatchError: typeof SchemaMismatchError;
|
|
705
720
|
/** Attach the per-doc facade. */
|
|
706
721
|
create: (doc: EngineDoc, config?: EdytorDocConfig) => {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
removeInline: (id: BlockId, inlineId: string) => Prepared;
|
|
749
|
-
/** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
|
|
750
|
-
deleteBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
751
|
-
};
|
|
752
|
-
/** Write a prepared plan exactly (refusals pass through). */
|
|
753
|
-
apply: (p: Prepared) => OpResult;
|
|
754
|
-
compose: (...parts: Prepared[]) => Prepared;
|
|
755
|
-
transact: <R>(fn: () => R, origin?: unknown) => R;
|
|
722
|
+
init: (opts?: Parameters<(doc: EngineDoc, opts?: {
|
|
723
|
+
content?: import("./index.js").BlockSpec[];
|
|
724
|
+
defaultType?: string;
|
|
725
|
+
}) => void>[1]) => void;
|
|
726
|
+
/** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
|
|
727
|
+
seed: (value: JSONBlock[], data?: JsonObj) => void;
|
|
728
|
+
isInitialized: () => boolean;
|
|
729
|
+
/** Replicated `meta.v` schema version (the module-level read, bound). */
|
|
730
|
+
schemaVersion: () => number | undefined;
|
|
731
|
+
/**
|
|
732
|
+
* The schema gate for this doc — throws {@link SchemaMismatchError}
|
|
733
|
+
* on unversioned-content or unsupported-version state. Consumers
|
|
734
|
+
* (`Edytor.sync()`, packed consumers) call it before trusting
|
|
735
|
+
* a synced doc.
|
|
736
|
+
*/
|
|
737
|
+
checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
|
|
738
|
+
assertSchema: () => void;
|
|
739
|
+
dispose: () => void;
|
|
740
|
+
createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
|
|
741
|
+
/** @internal What a part built over the document reads and writes (`doc/suggest.ts`). */
|
|
742
|
+
part: SuggestContext;
|
|
743
|
+
/** Visible children of `parent` with their ranks, in `(rank, id)` order. */
|
|
744
|
+
childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
|
|
745
|
+
slotOf: (id: string) => {
|
|
746
|
+
parent: BlockId | null;
|
|
747
|
+
rank: string;
|
|
748
|
+
} | null;
|
|
749
|
+
crdtId: (id: string) => string | null;
|
|
750
|
+
resolveBlock: (id: string) => EngineNode | null;
|
|
751
|
+
followUndo: (anchor: DocAnchor) => DocAnchor;
|
|
752
|
+
/** Re-read the roles after `roleOf` answers differently (roles adopted later). */
|
|
753
|
+
rolesChanged: (place?: boolean) => void;
|
|
754
|
+
defaultChild: (id: string | null) => string;
|
|
755
|
+
contentJSON: (id: string) => ({
|
|
756
|
+
text: string;
|
|
757
|
+
marks?: Record<string, unknown>;
|
|
758
|
+
} | {
|
|
759
|
+
id?: string;
|
|
760
|
+
type: string;
|
|
761
|
+
data?: unknown;
|
|
762
|
+
})[];
|
|
756
763
|
model: {
|
|
757
764
|
REGISTRY_KEY: string;
|
|
758
765
|
registryOf: (doc: EngineDoc) => EngineNode;
|
|
@@ -822,73 +829,102 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
822
829
|
};
|
|
823
830
|
};
|
|
824
831
|
runsView: RunView;
|
|
832
|
+
/** The public members' names (`EdytorDocument` forwards them). */
|
|
833
|
+
api: object;
|
|
834
|
+
} & {
|
|
835
|
+
/** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
|
|
836
|
+
prepare: {
|
|
837
|
+
insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
|
|
838
|
+
deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
|
|
839
|
+
replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
|
|
840
|
+
/**
|
|
841
|
+
* Move `id` to the last position under `parent` — under a container
|
|
842
|
+
* it is no item of, under its last item (`nestParent`: Tab after a list).
|
|
843
|
+
*/
|
|
844
|
+
nestBlock: (id: BlockId, parent: BlockId) => Prepared;
|
|
845
|
+
/** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
|
|
846
|
+
deleteBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
847
|
+
insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
|
|
848
|
+
deleteText: (id: BlockId, offset: number, length: number) => Prepared;
|
|
849
|
+
formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
|
|
850
|
+
clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
|
|
851
|
+
insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
|
|
852
|
+
removeInline: (id: BlockId, inlineId: string) => Prepared;
|
|
853
|
+
setBlockType: (id: BlockId, type: string) => Prepared;
|
|
854
|
+
patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
|
|
855
|
+
setBlock: (id: BlockId, value: {
|
|
856
|
+
type?: string;
|
|
857
|
+
data?: Record<string, unknown>;
|
|
858
|
+
content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
|
|
859
|
+
children?: (import("./index.js").BlockSpec | JSONBlock)[];
|
|
860
|
+
}) => Prepared;
|
|
861
|
+
deleteBlock: (id: BlockId, opts?: {
|
|
862
|
+
keepChildren?: boolean;
|
|
863
|
+
}) => Prepared;
|
|
864
|
+
splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
|
|
865
|
+
mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
|
|
866
|
+
mergeBackward: (id: BlockId) => Prepared;
|
|
867
|
+
mergeForward: (id: BlockId) => Prepared;
|
|
868
|
+
placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
|
|
869
|
+
wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
|
|
870
|
+
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
|
|
871
|
+
moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
|
|
872
|
+
unNestBlocks: (ids: readonly BlockId[]) => Prepared;
|
|
873
|
+
unNestBlock: (id: BlockId) => Prepared;
|
|
874
|
+
liftOut: (id: BlockId, kind: string, { keep, after }?: {
|
|
875
|
+
keep?: boolean;
|
|
876
|
+
after?: readonly import("./index.js").BlockSpec[];
|
|
877
|
+
}) => Prepared;
|
|
878
|
+
duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
|
|
879
|
+
};
|
|
880
|
+
/** Write a prepared plan exactly (refusals pass through). */
|
|
881
|
+
apply: (p: Prepared, quiet?: boolean) => OpResult;
|
|
882
|
+
compose: (...parts: Prepared[]) => Prepared;
|
|
883
|
+
transact: <R>(fn: () => R, origin?: unknown) => R;
|
|
825
884
|
version: number;
|
|
826
885
|
insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
|
|
827
886
|
deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
|
|
828
887
|
replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
|
|
829
|
-
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
|
|
830
|
-
moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
|
|
831
888
|
nestBlock: (id: string, parent: string) => OpResult;
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
842
|
-
mergeBackward: (id: string) => OpResult;
|
|
843
|
-
mergeForward: (id: string) => OpResult;
|
|
844
|
-
deleteBlock: (id: string, opts?: {
|
|
845
|
-
keepChildren?: boolean;
|
|
846
|
-
} | undefined) => OpResult;
|
|
889
|
+
deleteBlocks: (ids: readonly string[]) => OpResult;
|
|
890
|
+
insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
|
|
891
|
+
deleteText: (id: string, offset: number, length: number) => OpResult;
|
|
892
|
+
formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
|
|
893
|
+
clearMarks: (id: string, offset: number, length: number) => OpResult;
|
|
894
|
+
insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
|
|
895
|
+
removeInline: (id: string, inlineId: string) => OpResult;
|
|
896
|
+
setBlockType: (id: string, type: string) => OpResult;
|
|
897
|
+
patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
|
|
847
898
|
setBlock: (id: string, value: {
|
|
848
899
|
type?: string;
|
|
849
900
|
data?: Record<string, unknown>;
|
|
850
901
|
content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
|
|
851
902
|
children?: (import("./index.js").BlockSpec | JSONBlock)[];
|
|
852
903
|
}) => OpResult;
|
|
853
|
-
|
|
854
|
-
|
|
904
|
+
deleteBlock: (id: string, opts?: {
|
|
905
|
+
keepChildren?: boolean;
|
|
906
|
+
} | undefined) => OpResult;
|
|
907
|
+
splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
|
|
908
|
+
mergeBlocks: (fromId: string, intoId: string) => OpResult;
|
|
909
|
+
mergeBackward: (id: string) => OpResult;
|
|
910
|
+
mergeForward: (id: string) => OpResult;
|
|
911
|
+
placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
|
|
912
|
+
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
|
|
913
|
+
insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
|
|
914
|
+
moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
|
|
915
|
+
unNestBlocks: (ids: readonly string[]) => OpResult;
|
|
916
|
+
unNestBlock: (id: string) => OpResult;
|
|
917
|
+
liftOut: (id: string, kind: string, args_2?: {
|
|
918
|
+
keep?: boolean;
|
|
919
|
+
after?: readonly import("./index.js").BlockSpec[];
|
|
920
|
+
} | undefined) => OpResult;
|
|
855
921
|
duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
|
|
856
|
-
insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
|
|
857
|
-
deleteText: (id: string, offset: number, length: number) => OpResult;
|
|
858
|
-
formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
|
|
859
|
-
clearMarks: (id: string, offset: number, length: number) => OpResult;
|
|
860
|
-
insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
|
|
861
|
-
removeInline: (id: string, inlineId: string) => OpResult;
|
|
862
|
-
deleteBlocks: (ids: readonly string[]) => OpResult;
|
|
863
|
-
init: (opts?: Parameters<(doc: EngineDoc, opts?: {
|
|
864
|
-
content?: import("./index.js").BlockSpec[];
|
|
865
|
-
defaultType?: string;
|
|
866
|
-
}) => void>[1]) => void;
|
|
867
|
-
/** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
|
|
868
|
-
seed: (value: JSONBlock[], data?: JsonObj) => void;
|
|
869
|
-
isInitialized: () => boolean;
|
|
870
|
-
/** Replicated `meta.v` schema version (the module-level read, bound). */
|
|
871
|
-
schemaVersion: () => number | undefined;
|
|
872
|
-
/**
|
|
873
|
-
* The schema gate for this doc — throws {@link SchemaMismatchError}
|
|
874
|
-
* on unversioned-content or unsupported-version state. Consumers
|
|
875
|
-
* (`Edytor.sync()`, packed consumers) call it before trusting
|
|
876
|
-
* a synced doc.
|
|
877
|
-
*/
|
|
878
|
-
checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
|
|
879
|
-
assertSchema: () => void;
|
|
880
|
-
dispose: () => void;
|
|
881
|
-
createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
|
|
882
922
|
project: () => import("./index.js").ProjectedDoc;
|
|
883
|
-
toJSON: (
|
|
923
|
+
toJSON: (options?: {
|
|
924
|
+
suggestions?: boolean;
|
|
925
|
+
} | undefined) => JSONDoc;
|
|
884
926
|
blockJSON: (id: string) => JSONBlock;
|
|
885
927
|
childrenIds: (id: string | null) => string[];
|
|
886
|
-
/** Visible children of `parent` with their ranks, in `(rank, id)` order. */
|
|
887
|
-
childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
|
|
888
|
-
slotOf: (id: string) => {
|
|
889
|
-
parent: BlockId | null;
|
|
890
|
-
rank: string;
|
|
891
|
-
} | null;
|
|
892
928
|
positionOf: (id: string) => import("./index.js").Destination | null;
|
|
893
929
|
pathOf: (id: string) => number[] | null;
|
|
894
930
|
parentOf: (id: string) => string | null;
|
|
@@ -911,8 +947,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
911
947
|
* O(1) per call; live-replicated (remote values read the same).
|
|
912
948
|
*/
|
|
913
949
|
blockAttribution: (id: string) => BlockAttribution | undefined;
|
|
914
|
-
crdtId: (id: string) => string | null;
|
|
915
|
-
resolveBlock: (id: string) => EngineNode | null;
|
|
916
950
|
displayLength: (id: string) => number;
|
|
917
951
|
contentItems: (id: string) => ContentItem[];
|
|
918
952
|
hasBlock: (id: string) => boolean;
|
|
@@ -926,9 +960,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
926
960
|
blockId: BlockId;
|
|
927
961
|
offset: number;
|
|
928
962
|
} | null;
|
|
929
|
-
followUndo: (anchor: DocAnchor) => DocAnchor;
|
|
930
|
-
/** Re-read the roles after `roleOf` answers differently (roles adopted later). */
|
|
931
|
-
rolesChanged: () => void;
|
|
932
963
|
isVoid: (id: string) => boolean;
|
|
933
964
|
isIsland: (id: string) => boolean;
|
|
934
965
|
isLines: (id: string) => boolean;
|
|
@@ -975,16 +1006,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
975
1006
|
parent: string | null;
|
|
976
1007
|
levels: string[];
|
|
977
1008
|
};
|
|
978
|
-
defaultChild: (id: string | null) => string;
|
|
979
1009
|
runs: (id: string) => readonly ContentRun[];
|
|
980
|
-
contentJSON: (id: string) => ({
|
|
981
|
-
text: string;
|
|
982
|
-
marks?: Record<string, unknown>;
|
|
983
|
-
} | {
|
|
984
|
-
id?: string;
|
|
985
|
-
type: string;
|
|
986
|
-
data?: unknown;
|
|
987
|
-
})[];
|
|
988
1010
|
onChange: (cb: (change: DocChange) => void) => (() => void);
|
|
989
1011
|
};
|
|
990
1012
|
/**
|
|
@@ -1000,7 +1022,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
|
|
|
1000
1022
|
* and the horizon record every history reads (`hist.purge.horizon`).
|
|
1001
1023
|
* The room's purge task runs it; `facade` is a facade over `doc`.
|
|
1002
1024
|
*/
|
|
1003
|
-
purge: (doc: EngineDoc, facade: {
|
|
1025
|
+
purge: (doc: EngineDoc, facade: Partial<import("./doc/suggest.js").SuggestFacade> & {
|
|
1004
1026
|
model: import("./placement/model.js").PlacementModel;
|
|
1005
1027
|
text: import("./text/model.js").TextEngine;
|
|
1006
1028
|
}, horizon: import("./purge.js").Horizon | null) => import("./purge.js").PurgeReport;
|