edytor 0.1.0-next.44 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/clipboard/moveText.js +1 -1
- package/dist/cloudflare/DocumentRoom.d.ts +6 -6
- package/dist/cloudflare/room/context.d.ts +128 -128
- package/dist/collaboration/history/HistoryPanel.svelte +2 -2
- package/dist/crdt/document.d.ts +19 -7
- package/dist/crdt/document.js +34 -16
- package/dist/crdt/index.d.ts +1 -0
- package/dist/crdt/index.js +3 -2
- package/dist/crdt/nodes.d.ts +3 -2
- package/dist/crdt/operations.d.ts +161 -0
- package/dist/crdt/operations.js +97 -0
- package/dist/edytor.svelte.js +2 -2
- package/dist/events/onBeforeInput.js +1 -1
- package/dist/events/onFocus.js +7 -0
- package/dist/index.d.ts +18 -2
- package/dist/plugins/blockHandles/blockHandlesPlugin.d.ts +2 -1
- package/dist/plugins/blockHandles/blockHandlesPlugin.js +70 -24
- package/dist/selection/selection.svelte.d.ts +5 -8
- package/dist/selection/selection.svelte.js +12 -5
- package/dist/session/commands.d.ts +5 -53
- package/dist/session/commands.js +30 -7
- package/dist/session/history.js +1 -1
- package/dist/session/selection.d.ts +1 -1
- package/dist/surface/projector.svelte.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
Edytor aims to be for Svelte what Slate.js is for React: a heavily customizable editor with an API to build any kind of collaborative rich text editor.
|
|
19
19
|
|
|
20
|
-
> **
|
|
20
|
+
> **Release candidate.** Edytor `1.0.0-rc.1` is the 1.0 release candidate (`edytor` on npm): its API is frozen, and a change to it before 1.0 is a listed breaking change. It has no production track record yet: read the [limitations](https://edytor.dev/docs/reference/limitations) before you build on it. Issues and PRs are welcome: when you report a bug, include the document's JSON value.
|
|
21
21
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
@@ -42,7 +42,7 @@ Edytor aims to be for Svelte what Slate.js is for React: a heavily customizable
|
|
|
42
42
|
The pre-release is on npm under the `next` tag. Name the tag: a bare `edytor` is the old, incompatible `0.0.11`.
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
pnpm add edytor
|
|
45
|
+
pnpm add edytor
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
`svelte@^5` is a peer dependency. Do not install `yjs`: the v14 engine is vendored (`edytor/crdt`). See [installation](https://edytor.dev/docs/getting-started) and [platform support](https://edytor.dev/docs/reference/platform-support) (Chrome, Edge, Firefox and Safari; real phones are not tested yet).
|
|
@@ -28,7 +28,7 @@ export const dropText = (edytor, drag, to) => {
|
|
|
28
28
|
const { copy } = drag;
|
|
29
29
|
/** Nothing written: the range stays selected (the drop's point is not adopted). */
|
|
30
30
|
const keep = () => {
|
|
31
|
-
edytor.selection.select(drag.range
|
|
31
|
+
edytor.selection.select(drag.range);
|
|
32
32
|
return false;
|
|
33
33
|
};
|
|
34
34
|
// A move onto itself: nothing to write.
|
|
@@ -110,7 +110,7 @@ import { type HistoryEntry, type HistoryOptions, type KVLike, type R2BucketLike
|
|
|
110
110
|
import type { LockOptions } from './locks.js';
|
|
111
111
|
import type { CommitResult, ExportedBlocks, ImportReceipt, ImportRequest, LateEditBatch, MoveNamespace } from './move.js';
|
|
112
112
|
import type { AwarenessEntry } from '../crdt/protocol.js';
|
|
113
|
-
import type { DocumentSemanticsConfig,
|
|
113
|
+
import type { DocumentSemanticsConfig, DocumentOperations, JSONBlock, JSONDoc, YDoc } from '../crdt/index.js';
|
|
114
114
|
import type { CommentActor, CommentChange, CommentOutcome, CommentRequest, CommentSnapshot } from '../crdt/protocols/comments.js';
|
|
115
115
|
/** Under SQLite-backed Durable Objects' 2 MB row cap, with room for the other columns. */
|
|
116
116
|
export declare const DEFAULT_MAX_ROW_BYTES: number;
|
|
@@ -481,7 +481,7 @@ export type FrameValidation = {
|
|
|
481
481
|
/** A block as it is now (`null`: it does not show). */
|
|
482
482
|
after: (id: string) => ValidatedBlock | null;
|
|
483
483
|
/** The live document. Read it; never write from `validate` (defer a `transact` instead). */
|
|
484
|
-
facade:
|
|
484
|
+
facade: DocumentOperations;
|
|
485
485
|
};
|
|
486
486
|
/** The room's comment threads (`comments` of {@link AttachRoomOptions}). */
|
|
487
487
|
export type CommentOptions = {
|
|
@@ -678,7 +678,7 @@ export declare class AttachedDocument {
|
|
|
678
678
|
* first drops a direct write whose append failed (`heal`), so the next
|
|
679
679
|
* write through it is stored.
|
|
680
680
|
*/
|
|
681
|
-
get facade():
|
|
681
|
+
get facade(): DocumentOperations;
|
|
682
682
|
/**
|
|
683
683
|
* Manipulate: run `fn` on the facade in one transaction. The edit is
|
|
684
684
|
* stored, then broadcast to every socket. It is not a rollback, like
|
|
@@ -695,7 +695,7 @@ export declare class AttachedDocument {
|
|
|
695
695
|
* without writing: the engine would queue the write until that one
|
|
696
696
|
* ends, so it could not be stored before returning.
|
|
697
697
|
*/
|
|
698
|
-
transact<T>(fn: (facade:
|
|
698
|
+
transact<T>(fn: (facade: DocumentOperations) => T): T;
|
|
699
699
|
/** The document as JSON. */
|
|
700
700
|
read(): JSONDoc;
|
|
701
701
|
/**
|
|
@@ -1044,10 +1044,10 @@ export declare class DocumentRoom<Env = DocumentRoomEnv> extends DurableObject<E
|
|
|
1044
1044
|
/** Generation cutover, also over RPC — see {@link AttachedDocument.reset}. */
|
|
1045
1045
|
reset(): Promise<void>;
|
|
1046
1046
|
/** Server-side edit — see {@link AttachedDocument.transact}. */
|
|
1047
|
-
transact<T>(fn: (facade:
|
|
1047
|
+
transact<T>(fn: (facade: DocumentOperations) => T): T;
|
|
1048
1048
|
/** The document as JSON. */
|
|
1049
1049
|
read(): JSONDoc;
|
|
1050
|
-
get facade():
|
|
1050
|
+
get facade(): DocumentOperations;
|
|
1051
1051
|
get doc(): YDoc | null;
|
|
1052
1052
|
get failure(): Error | null;
|
|
1053
1053
|
get refusals(): Refusal[];
|
|
@@ -25,7 +25,7 @@ import type { RoomValidation } from './validation.js';
|
|
|
25
25
|
/** The engine API the room is built on (the Worker-safe CRDT entry). */
|
|
26
26
|
export declare const crdt: {
|
|
27
27
|
createDoc: (opts?: ConstructorParameters<E.EngineApi["Doc"]>[0]) => YDoc;
|
|
28
|
-
Awareness: typeof import("../../
|
|
28
|
+
Awareness: typeof import("../../index.js").Awareness;
|
|
29
29
|
doc: {
|
|
30
30
|
SCHEMA: {
|
|
31
31
|
readonly version: 5;
|
|
@@ -43,10 +43,10 @@ export declare const crdt: {
|
|
|
43
43
|
SCHEMA_NAME: "edytor-doc";
|
|
44
44
|
META_KEY: "meta";
|
|
45
45
|
init: (doc: E.EngineDoc, opts?: {
|
|
46
|
-
content?: import("../../
|
|
46
|
+
content?: import("../../index.js").BlockSpec[];
|
|
47
47
|
defaultType?: string;
|
|
48
48
|
}) => void;
|
|
49
|
-
restore: (doc: E.EngineDoc, content: import("../../
|
|
49
|
+
restore: (doc: E.EngineDoc, content: import("../../index.js").BlockSpec[]) => void;
|
|
50
50
|
seed: (doc: E.EngineDoc, value?: import("../../index.js").JSONBlock[], defaultType?: string, data?: import("../../crdt/doc/types.js").JsonObj) => void;
|
|
51
51
|
isInitialized: (doc: E.EngineDoc) => boolean;
|
|
52
52
|
schemaVersion: (doc: E.EngineDoc) => number | undefined;
|
|
@@ -56,56 +56,56 @@ export declare const crdt: {
|
|
|
56
56
|
SchemaMismatchError: typeof E.SchemaMismatchError;
|
|
57
57
|
create: (doc: E.EngineDoc, config?: import("../../crdt/edytor-doc.js").EdytorDocConfig) => {
|
|
58
58
|
prepare: {
|
|
59
|
-
insertFlow: (target: import("../../index.js").FlowTarget, flow: import("../../index.js").Flow, view?: import("../../
|
|
60
|
-
deleteRange: (from: import("../../
|
|
61
|
-
replaceRange: (from: import("../../
|
|
62
|
-
insertTableRow: (table: import("../../
|
|
63
|
-
deleteTableRows: (rows: readonly import("../../
|
|
64
|
-
insertTableColumn: (table: import("../../
|
|
65
|
-
deleteTableColumn: (table: import("../../
|
|
66
|
-
moveTableColumn: (table: import("../../
|
|
67
|
-
moveTableRows: (rows: readonly import("../../
|
|
68
|
-
fillTableCell: (row: import("../../
|
|
69
|
-
insertBlocks: (dest: import("../../
|
|
70
|
-
insertBlock: (dest: import("../../
|
|
71
|
-
moveBlocks: (ids: readonly import("../../
|
|
72
|
-
moveBlock: (id: import("../../
|
|
73
|
-
nestBlock: (id: import("../../
|
|
74
|
-
unNestBlock: (id: import("../../
|
|
75
|
-
unNestBlocks: (ids: readonly import("../../
|
|
76
|
-
liftOut: (id: import("../../
|
|
59
|
+
insertFlow: (target: import("../../index.js").FlowTarget, flow: import("../../index.js").Flow, view?: import("../../index.js").FlowView) => import("../../index.js").Prepared;
|
|
60
|
+
deleteRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView) => import("../../index.js").Prepared;
|
|
61
|
+
replaceRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView) => import("../../index.js").Prepared;
|
|
62
|
+
insertTableRow: (table: import("../../index.js").BlockId, index: number) => import("../../index.js").Prepared;
|
|
63
|
+
deleteTableRows: (rows: readonly import("../../index.js").BlockId[]) => import("../../index.js").Prepared;
|
|
64
|
+
insertTableColumn: (table: import("../../index.js").BlockId, index: number, width?: number) => import("../../index.js").Prepared;
|
|
65
|
+
deleteTableColumn: (table: import("../../index.js").BlockId, column: string | number) => import("../../index.js").Prepared;
|
|
66
|
+
moveTableColumn: (table: import("../../index.js").BlockId, column: string | number, to: number) => import("../../index.js").Prepared;
|
|
67
|
+
moveTableRows: (rows: readonly import("../../index.js").BlockId[], to: number) => import("../../index.js").Prepared;
|
|
68
|
+
fillTableCell: (row: import("../../index.js").BlockId, column: string | number) => import("../../index.js").Prepared;
|
|
69
|
+
insertBlocks: (dest: import("../../index.js").Destination, specs: readonly (import("../../index.js").BlockSpec | import("../../index.js").JSONBlock)[]) => import("../../index.js").Prepared;
|
|
70
|
+
insertBlock: (dest: import("../../index.js").Destination, spec: import("../../index.js").BlockSpec | import("../../index.js").JSONBlock) => import("../../index.js").Prepared;
|
|
71
|
+
moveBlocks: (ids: readonly import("../../index.js").BlockId[], dest: import("../../index.js").Destination) => import("../../index.js").Prepared;
|
|
72
|
+
moveBlock: (id: import("../../index.js").BlockId, dest: import("../../index.js").Destination) => import("../../index.js").Prepared;
|
|
73
|
+
nestBlock: (id: import("../../index.js").BlockId, parent: import("../../index.js").BlockId) => import("../../index.js").Prepared;
|
|
74
|
+
unNestBlock: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
|
|
75
|
+
unNestBlocks: (ids: readonly import("../../index.js").BlockId[]) => import("../../index.js").Prepared;
|
|
76
|
+
liftOut: (id: import("../../index.js").BlockId, kind: string, { keep, after }?: {
|
|
77
77
|
keep?: boolean;
|
|
78
|
-
after?: readonly import("../../
|
|
78
|
+
after?: readonly import("../../index.js").BlockSpec[];
|
|
79
79
|
}) => import("../../index.js").Prepared;
|
|
80
|
-
placeBeside: (ids: readonly import("../../
|
|
81
|
-
wrapInLayout: (ids: readonly import("../../
|
|
82
|
-
splitBlock: (id: import("../../
|
|
83
|
-
mergeBlocks: (fromId: import("../../
|
|
84
|
-
mergeBackward: (id: import("../../
|
|
85
|
-
mergeForward: (id: import("../../
|
|
86
|
-
deleteBlock: (id: import("../../
|
|
80
|
+
placeBeside: (ids: readonly import("../../index.js").BlockId[], target: import("../../index.js").BlockId, side: "left" | "right", kind?: string) => import("../../index.js").Prepared;
|
|
81
|
+
wrapInLayout: (ids: readonly import("../../index.js").BlockId[], kind?: string, columns?: number) => import("../../index.js").Prepared;
|
|
82
|
+
splitBlock: (id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail?: import("../../index.js").SplitTail) => import("../../index.js").Prepared;
|
|
83
|
+
mergeBlocks: (fromId: import("../../index.js").BlockId, intoId: import("../../index.js").BlockId) => import("../../index.js").Prepared;
|
|
84
|
+
mergeBackward: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
|
|
85
|
+
mergeForward: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
|
|
86
|
+
deleteBlock: (id: import("../../index.js").BlockId, opts?: {
|
|
87
87
|
keepChildren?: boolean;
|
|
88
88
|
}) => import("../../index.js").Prepared;
|
|
89
|
-
setBlock: (id: import("../../
|
|
89
|
+
setBlock: (id: import("../../index.js").BlockId, value: {
|
|
90
90
|
type?: string;
|
|
91
91
|
data?: Record<string, unknown>;
|
|
92
|
-
content?: import("../../
|
|
93
|
-
children?: import("../../
|
|
92
|
+
content?: import("../../index.js").ContentItem[];
|
|
93
|
+
children?: import("../../index.js").BlockSpec[];
|
|
94
94
|
}) => import("../../index.js").Prepared;
|
|
95
|
-
setBlockType: (id: import("../../
|
|
96
|
-
patchData: (target: import("../../
|
|
97
|
-
setBlockData: (id: import("../../
|
|
98
|
-
duplicateBlock: (id: import("../../
|
|
99
|
-
insertText: (id: import("../../
|
|
100
|
-
deleteText: (id: import("../../
|
|
101
|
-
formatRange: (id: import("../../
|
|
102
|
-
setMark: (id: import("../../
|
|
103
|
-
unsetMark: (id: import("../../
|
|
104
|
-
clearMarks: (id: import("../../
|
|
105
|
-
insertInline: (id: import("../../
|
|
106
|
-
removeInline: (id: import("../../
|
|
107
|
-
setInlineData: (id: import("../../
|
|
108
|
-
deleteBlocks: (ids: readonly import("../../
|
|
95
|
+
setBlockType: (id: import("../../index.js").BlockId, type: string) => import("../../index.js").Prepared;
|
|
96
|
+
patchData: (target: import("../../index.js").DataTarget, patches: readonly import("../../index.js").DataPatch[]) => import("../../index.js").Prepared;
|
|
97
|
+
setBlockData: (id: import("../../index.js").BlockId, data: Record<string, unknown>) => import("../../index.js").Prepared;
|
|
98
|
+
duplicateBlock: (id: import("../../index.js").BlockId, freshId: (oldId: string, kind: "block" | "inline") => string) => import("../../index.js").Prepared;
|
|
99
|
+
insertText: (id: import("../../index.js").BlockId, offset: number, text: string, marks?: Record<string, unknown>) => import("../../index.js").Prepared;
|
|
100
|
+
deleteText: (id: import("../../index.js").BlockId, offset: number, length: number) => import("../../index.js").Prepared;
|
|
101
|
+
formatRange: (id: import("../../index.js").BlockId, offset: number, length: number, marks: Record<string, unknown>) => import("../../index.js").Prepared;
|
|
102
|
+
setMark: (id: import("../../index.js").BlockId, offset: number, length: number, name: string, value: unknown) => import("../../index.js").Prepared;
|
|
103
|
+
unsetMark: (id: import("../../index.js").BlockId, offset: number, length: number, name: string) => import("../../index.js").Prepared;
|
|
104
|
+
clearMarks: (id: import("../../index.js").BlockId, offset: number, length: number) => import("../../index.js").Prepared;
|
|
105
|
+
insertInline: (id: import("../../index.js").BlockId, offset: number, atom: import("../../index.js").InlineSpec) => import("../../index.js").Prepared;
|
|
106
|
+
removeInline: (id: import("../../index.js").BlockId, inlineId: string) => import("../../index.js").Prepared;
|
|
107
|
+
setInlineData: (id: import("../../index.js").BlockId, inlineId: string, data: Record<string, unknown>) => import("../../index.js").Prepared;
|
|
108
|
+
deleteBlocks: (ids: readonly import("../../index.js").BlockId[]) => import("../../index.js").Prepared;
|
|
109
109
|
};
|
|
110
110
|
apply: (p: import("../../index.js").Prepared) => import("../../index.js").OpResult;
|
|
111
111
|
compose: (...parts: import("../../index.js").Prepared[]) => import("../../index.js").Prepared;
|
|
@@ -113,41 +113,41 @@ export declare const crdt: {
|
|
|
113
113
|
model: {
|
|
114
114
|
REGISTRY_KEY: string;
|
|
115
115
|
registryOf: (doc: E.EngineDoc) => E.EngineNode;
|
|
116
|
-
blockNodeOf: (doc: E.EngineDoc, id: import("../../
|
|
117
|
-
liveNodeOf: (doc: E.EngineDoc, id: import("../../
|
|
118
|
-
isLive: (doc: E.EngineDoc, id: import("../../
|
|
116
|
+
blockNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
|
|
117
|
+
liveNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
|
|
118
|
+
isLive: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => boolean;
|
|
119
119
|
candidatesOf: (node: E.EngineNode) => import("../../crdt/placement/model.js").PlacementCand[];
|
|
120
120
|
view: (doc: E.EngineDoc) => import("../../crdt/placement/model.js").ModelView;
|
|
121
|
-
resolvePlacements: (blocks: Map<import("../../
|
|
122
|
-
childrenIndex: (placements: Map<import("../../
|
|
123
|
-
positionInView: (v: import("../../crdt/placement/model.js").ModelView, id: import("../../
|
|
124
|
-
buildInline: (atom: import("../../
|
|
125
|
-
isSelfOrDescendant: (placements: Map<import("../../
|
|
121
|
+
resolvePlacements: (blocks: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").BlockRec>, ownerOf?: (b: import("../../index.js").BlockId) => import("../../crdt/text/model.js").Owner) => Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>;
|
|
122
|
+
childrenIndex: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/placement/model.js").DisplayOwnership) => Map<import("../../index.js").BlockId | null, import("../../crdt/placement/model.js").ChildSlot[]>;
|
|
123
|
+
positionInView: (v: import("../../crdt/placement/model.js").ModelView, id: import("../../index.js").BlockId) => import("../../index.js").Destination | null;
|
|
124
|
+
buildInline: (atom: import("../../index.js").InlineSpec) => E.EngineNode;
|
|
125
|
+
isSelfOrDescendant: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/text/model.js").Ownership, id: import("../../index.js").BlockId, maybeAncestor: import("../../index.js").BlockId) => boolean;
|
|
126
126
|
ranksAt: (siblings: readonly {
|
|
127
127
|
rank: string;
|
|
128
128
|
}[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
|
|
129
|
-
writePlacement: (doc: E.EngineDoc, node: E.EngineNode, p: import("../../
|
|
129
|
+
writePlacement: (doc: E.EngineDoc, node: E.EngineNode, p: import("../../index.js").BlockId | null, r: string) => void;
|
|
130
130
|
withdrawOnUndo: (doc: E.EngineDoc) => (item: E.EngineItemRef, stackItem: {
|
|
131
131
|
inserts: {
|
|
132
132
|
hasId(id: unknown): boolean;
|
|
133
133
|
};
|
|
134
134
|
}) => boolean;
|
|
135
|
-
materializeSpec: (doc: E.EngineDoc, sp: import("../../
|
|
136
|
-
collides: (doc: E.EngineDoc, specs: readonly import("../../
|
|
137
|
-
writeSplit: (doc: E.EngineDoc, id: import("../../
|
|
138
|
-
ownText: (doc: E.EngineDoc, id: import("../../
|
|
135
|
+
materializeSpec: (doc: E.EngineDoc, sp: import("../../index.js").BlockSpec, parent: import("../../index.js").BlockId | null, rank: string) => void;
|
|
136
|
+
collides: (doc: E.EngineDoc, specs: readonly import("../../index.js").BlockSpec[]) => boolean;
|
|
137
|
+
writeSplit: (doc: E.EngineDoc, id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail: import("../../index.js").SplitTail, place: import("../../crdt/placement/model.js").PlacementValue) => void;
|
|
138
|
+
ownText: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => {
|
|
139
139
|
from: unknown;
|
|
140
140
|
to: number;
|
|
141
141
|
};
|
|
142
|
-
insertBlocks: (doc: E.EngineDoc, dest: import("../../
|
|
143
|
-
insertBlock: (doc: E.EngineDoc, dest: import("../../
|
|
144
|
-
restoreBlocks: (doc: E.EngineDoc, specs: import("../../
|
|
145
|
-
project: (doc: E.EngineDoc) => import("../../
|
|
146
|
-
positionOf: (doc: E.EngineDoc, id: import("../../
|
|
147
|
-
listBlockIds: (doc: E.EngineDoc) => import("../../
|
|
148
|
-
blockText: (doc: E.EngineDoc, id: import("../../
|
|
149
|
-
crdtId: (doc: E.EngineDoc, id: import("../../
|
|
150
|
-
resolveBlock: (doc: E.EngineDoc, id: import("../../
|
|
142
|
+
insertBlocks: (doc: E.EngineDoc, dest: import("../../index.js").Destination, specs: import("../../index.js").BlockSpec[]) => boolean;
|
|
143
|
+
insertBlock: (doc: E.EngineDoc, dest: import("../../index.js").Destination, spec: import("../../index.js").BlockSpec) => boolean;
|
|
144
|
+
restoreBlocks: (doc: E.EngineDoc, specs: import("../../index.js").BlockSpec[]) => void;
|
|
145
|
+
project: (doc: E.EngineDoc) => import("../../index.js").ProjectedDoc;
|
|
146
|
+
positionOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => import("../../index.js").Destination | null;
|
|
147
|
+
listBlockIds: (doc: E.EngineDoc) => import("../../index.js").BlockId[];
|
|
148
|
+
blockText: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => string | null;
|
|
149
|
+
crdtId: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => string | null;
|
|
150
|
+
resolveBlock: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
|
|
151
151
|
};
|
|
152
152
|
text: {
|
|
153
153
|
newNode: (name: string) => E.EngineNode;
|
|
@@ -179,10 +179,10 @@ export declare const crdt: {
|
|
|
179
179
|
};
|
|
180
180
|
runsView: import("../../crdt/text/runs.js").RunView;
|
|
181
181
|
version: number;
|
|
182
|
-
block: (id: import("../../
|
|
183
|
-
insertFlow: (target: import("../../index.js").FlowTarget, flow: import("../../index.js").Flow, view?: import("../../
|
|
184
|
-
deleteRange: (from: import("../../
|
|
185
|
-
replaceRange: (from: import("../../
|
|
182
|
+
block: (id: import("../../index.js").BlockId) => import("../../index.js").DocBlock;
|
|
183
|
+
insertFlow: (target: import("../../index.js").FlowTarget, flow: import("../../index.js").Flow, view?: import("../../index.js").FlowView | undefined) => import("../../index.js").OpResult;
|
|
184
|
+
deleteRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView | undefined) => import("../../index.js").OpResult;
|
|
185
|
+
replaceRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView | undefined) => import("../../index.js").OpResult;
|
|
186
186
|
insertTableRow: (table: string, index: number) => import("../../index.js").OpResult;
|
|
187
187
|
deleteTableRows: (rows: readonly string[]) => import("../../index.js").OpResult;
|
|
188
188
|
insertTableColumn: (table: string, index: number, width?: number | undefined) => import("../../index.js").OpResult;
|
|
@@ -190,20 +190,20 @@ export declare const crdt: {
|
|
|
190
190
|
moveTableColumn: (table: string, column: string | number, to: number) => import("../../index.js").OpResult;
|
|
191
191
|
moveTableRows: (rows: readonly string[], to: number) => import("../../index.js").OpResult;
|
|
192
192
|
fillTableCell: (row: string, column: string | number) => import("../../index.js").OpResult;
|
|
193
|
-
insertBlocks: (dest: import("../../
|
|
194
|
-
insertBlock: (dest: import("../../
|
|
195
|
-
moveBlocks: (ids: readonly string[], dest: import("../../
|
|
196
|
-
moveBlock: (id: string, dest: import("../../
|
|
193
|
+
insertBlocks: (dest: import("../../index.js").Destination, specs: readonly (import("../../index.js").JSONBlock | import("../../index.js").BlockSpec)[]) => import("../../index.js").OpResult;
|
|
194
|
+
insertBlock: (dest: import("../../index.js").Destination, spec: import("../../index.js").JSONBlock | import("../../index.js").BlockSpec) => import("../../index.js").OpResult;
|
|
195
|
+
moveBlocks: (ids: readonly string[], dest: import("../../index.js").Destination) => import("../../index.js").OpResult;
|
|
196
|
+
moveBlock: (id: string, dest: import("../../index.js").Destination) => import("../../index.js").OpResult;
|
|
197
197
|
nestBlock: (id: string, parent: string) => import("../../index.js").OpResult;
|
|
198
198
|
unNestBlock: (id: string) => import("../../index.js").OpResult;
|
|
199
199
|
unNestBlocks: (ids: readonly string[]) => import("../../index.js").OpResult;
|
|
200
200
|
liftOut: (id: string, kind: string, args_2?: {
|
|
201
201
|
keep?: boolean;
|
|
202
|
-
after?: readonly import("../../
|
|
202
|
+
after?: readonly import("../../index.js").BlockSpec[];
|
|
203
203
|
} | undefined) => import("../../index.js").OpResult;
|
|
204
204
|
placeBeside: (ids: readonly string[], target: string, side: "right" | "left", kind?: string | undefined) => import("../../index.js").OpResult;
|
|
205
205
|
wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => import("../../index.js").OpResult;
|
|
206
|
-
splitBlock: (id: string, offset: number, newId: string, tail?: import("../../
|
|
206
|
+
splitBlock: (id: string, offset: number, newId: string, tail?: import("../../index.js").SplitTail | undefined) => import("../../index.js").OpResult;
|
|
207
207
|
mergeBlocks: (fromId: string, intoId: string) => import("../../index.js").OpResult;
|
|
208
208
|
mergeBackward: (id: string) => import("../../index.js").OpResult;
|
|
209
209
|
mergeForward: (id: string) => import("../../index.js").OpResult;
|
|
@@ -213,11 +213,11 @@ export declare const crdt: {
|
|
|
213
213
|
setBlock: (id: string, value: {
|
|
214
214
|
type?: string;
|
|
215
215
|
data?: Record<string, unknown>;
|
|
216
|
-
content?: import("../../
|
|
217
|
-
children?: import("../../
|
|
216
|
+
content?: import("../../index.js").ContentItem[];
|
|
217
|
+
children?: import("../../index.js").BlockSpec[];
|
|
218
218
|
}) => import("../../index.js").OpResult;
|
|
219
219
|
setBlockType: (id: string, type: string) => import("../../index.js").OpResult;
|
|
220
|
-
patchData: (target: import("../../
|
|
220
|
+
patchData: (target: import("../../index.js").DataTarget, patches: readonly import("../../index.js").DataPatch[]) => import("../../index.js").OpResult;
|
|
221
221
|
setBlockData: (id: string, data: Record<string, unknown>) => import("../../index.js").OpResult;
|
|
222
222
|
duplicateBlock: (id: string, freshId: (oldId: string, kind: "block" | "inline") => string) => import("../../index.js").OpResult;
|
|
223
223
|
insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => import("../../index.js").OpResult;
|
|
@@ -226,12 +226,12 @@ export declare const crdt: {
|
|
|
226
226
|
setMark: (id: string, offset: number, length: number, name: string, value: unknown) => import("../../index.js").OpResult;
|
|
227
227
|
unsetMark: (id: string, offset: number, length: number, name: string) => import("../../index.js").OpResult;
|
|
228
228
|
clearMarks: (id: string, offset: number, length: number) => import("../../index.js").OpResult;
|
|
229
|
-
insertInline: (id: string, offset: number, atom: import("../../
|
|
229
|
+
insertInline: (id: string, offset: number, atom: import("../../index.js").InlineSpec) => import("../../index.js").OpResult;
|
|
230
230
|
removeInline: (id: string, inlineId: string) => import("../../index.js").OpResult;
|
|
231
231
|
setInlineData: (id: string, inlineId: string, data: Record<string, unknown>) => import("../../index.js").OpResult;
|
|
232
232
|
deleteBlocks: (ids: readonly string[]) => import("../../index.js").OpResult;
|
|
233
233
|
init: (opts?: Parameters<(doc: E.EngineDoc, opts?: {
|
|
234
|
-
content?: import("../../
|
|
234
|
+
content?: import("../../index.js").BlockSpec[];
|
|
235
235
|
defaultType?: string;
|
|
236
236
|
}) => void>[1]) => void;
|
|
237
237
|
seed: (value: import("../../index.js").JSONBlock[], data?: import("../../crdt/doc/types.js").JsonObj) => void;
|
|
@@ -244,16 +244,16 @@ export declare const crdt: {
|
|
|
244
244
|
limit?: number;
|
|
245
245
|
}) => E.YUndoManager;
|
|
246
246
|
releaseHistory: (um: E.YUndoManager) => void;
|
|
247
|
-
project: () => import("../../
|
|
247
|
+
project: () => import("../../index.js").ProjectedDoc;
|
|
248
248
|
toJSON: () => JSONDoc;
|
|
249
249
|
blockJSON: (id: string) => import("../../index.js").JSONBlock;
|
|
250
250
|
childrenIds: (id: string | null) => string[];
|
|
251
|
-
childSlots: (parent: import("../../
|
|
251
|
+
childSlots: (parent: import("../../index.js").BlockId | null) => import("../../crdt/placement/model.js").ChildSlot[];
|
|
252
252
|
slotOf: (id: string) => {
|
|
253
|
-
parent: import("../../
|
|
253
|
+
parent: import("../../index.js").BlockId | null;
|
|
254
254
|
rank: string;
|
|
255
255
|
} | null;
|
|
256
|
-
positionOf: (id: string) => import("../../
|
|
256
|
+
positionOf: (id: string) => import("../../index.js").Destination | null;
|
|
257
257
|
pathOf: (id: string) => number[] | null;
|
|
258
258
|
parentOf: (id: string) => string | null;
|
|
259
259
|
ancestorsOf: (id: string) => string[];
|
|
@@ -262,21 +262,21 @@ export declare const crdt: {
|
|
|
262
262
|
blockTypeOf: (id: string) => string | undefined;
|
|
263
263
|
blockDataOf: (id: string) => Record<string, unknown> | undefined;
|
|
264
264
|
docData: () => import("../../crdt/doc/types.js").JsonObj;
|
|
265
|
-
dataItemIds: (target: import("../../
|
|
265
|
+
dataItemIds: (target: import("../../index.js").DataTarget, path: readonly string[]) => string[];
|
|
266
266
|
blockAttribution: (id: string) => import("../../index.js").BlockAttribution | undefined;
|
|
267
267
|
crdtId: (id: string) => string | null;
|
|
268
268
|
resolveBlock: (id: string) => E.EngineNode | null;
|
|
269
269
|
displayLength: (id: string) => number;
|
|
270
|
-
contentItems: (id: string) => import("../../
|
|
270
|
+
contentItems: (id: string) => import("../../index.js").ContentItem[];
|
|
271
271
|
hasBlock: (id: string) => boolean;
|
|
272
272
|
isVisibleBlock: (id: string) => boolean;
|
|
273
|
-
order: () => readonly import("../../
|
|
274
|
-
compare: (a: import("../../
|
|
275
|
-
next: (id: string, policy?: import("../../
|
|
276
|
-
previous: (id: string, policy?: import("../../
|
|
273
|
+
order: () => readonly import("../../index.js").BlockId[];
|
|
274
|
+
compare: (a: import("../../index.js").BlockId, b: import("../../index.js").BlockId) => number;
|
|
275
|
+
next: (id: string, policy?: import("../../index.js").OrderPolicy | undefined) => string | null;
|
|
276
|
+
previous: (id: string, policy?: import("../../index.js").OrderPolicy | undefined) => string | null;
|
|
277
277
|
anchorAt: (id: string, offset: number, affinity?: import("../../index.js").AnchorAffinity | undefined) => import("../../index.js").DocAnchor | null;
|
|
278
278
|
resolveAnchor: (anchor: import("../../index.js").DocAnchor) => {
|
|
279
|
-
blockId: import("../../
|
|
279
|
+
blockId: import("../../index.js").BlockId;
|
|
280
280
|
offset: number;
|
|
281
281
|
} | null;
|
|
282
282
|
followUndo: (anchor: import("../../index.js").DocAnchor) => import("../../index.js").DocAnchor;
|
|
@@ -286,7 +286,7 @@ export declare const crdt: {
|
|
|
286
286
|
isLines: (id: string) => boolean;
|
|
287
287
|
isLayout: (id: string) => boolean;
|
|
288
288
|
isLayoutItem: (id: string) => boolean;
|
|
289
|
-
besideAt: (id: import("../../
|
|
289
|
+
besideAt: (id: import("../../index.js").BlockId, kind?: string) => string;
|
|
290
290
|
islandOf: (id: string) => string | null;
|
|
291
291
|
isTable: (id: string) => boolean;
|
|
292
292
|
isTableRow: (id: string) => boolean;
|
|
@@ -299,21 +299,21 @@ export declare const crdt: {
|
|
|
299
299
|
tableGrid: (id: string) => {
|
|
300
300
|
columns: string[];
|
|
301
301
|
rows: {
|
|
302
|
-
id: import("../../
|
|
303
|
-
cells: (import("../../
|
|
302
|
+
id: import("../../index.js").BlockId;
|
|
303
|
+
cells: (import("../../index.js").BlockId | null)[];
|
|
304
304
|
}[];
|
|
305
305
|
} | null;
|
|
306
306
|
insideIsland: (id: string) => boolean;
|
|
307
|
-
canPlace: (ids: readonly import("../../
|
|
308
|
-
canMerge: (from: import("../../
|
|
309
|
-
fits: (parent: import("../../
|
|
310
|
-
nestParent: (ids: readonly import("../../
|
|
311
|
-
landingOf: (id: import("../../
|
|
307
|
+
canPlace: (ids: readonly import("../../index.js").BlockId[], parent?: import("../../index.js").BlockId | null) => boolean;
|
|
308
|
+
canMerge: (from: import("../../index.js").BlockId, into: import("../../index.js").BlockId) => boolean;
|
|
309
|
+
fits: (parent: import("../../index.js").BlockId | null, kind: string) => boolean;
|
|
310
|
+
nestParent: (ids: readonly import("../../index.js").BlockId[], parent: import("../../index.js").BlockId) => string;
|
|
311
|
+
landingOf: (id: import("../../index.js").BlockId, kind: string, after?: boolean) => {
|
|
312
312
|
parent: string | null;
|
|
313
313
|
levels: string[];
|
|
314
314
|
};
|
|
315
315
|
defaultChild: (id: string | null) => string;
|
|
316
|
-
runs: (id: string) => readonly import("../../
|
|
316
|
+
runs: (id: string) => readonly import("../../index.js").ContentRun[];
|
|
317
317
|
contentJSON: (id: string) => ({
|
|
318
318
|
text: string;
|
|
319
319
|
marks?: Record<string, unknown>;
|
|
@@ -335,41 +335,41 @@ export declare const crdt: {
|
|
|
335
335
|
model: {
|
|
336
336
|
REGISTRY_KEY: string;
|
|
337
337
|
registryOf: (doc: E.EngineDoc) => E.EngineNode;
|
|
338
|
-
blockNodeOf: (doc: E.EngineDoc, id: import("../../
|
|
339
|
-
liveNodeOf: (doc: E.EngineDoc, id: import("../../
|
|
340
|
-
isLive: (doc: E.EngineDoc, id: import("../../
|
|
338
|
+
blockNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
|
|
339
|
+
liveNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
|
|
340
|
+
isLive: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => boolean;
|
|
341
341
|
candidatesOf: (node: E.EngineNode) => import("../../crdt/placement/model.js").PlacementCand[];
|
|
342
342
|
view: (doc: E.EngineDoc) => import("../../crdt/placement/model.js").ModelView;
|
|
343
|
-
resolvePlacements: (blocks: Map<import("../../
|
|
344
|
-
childrenIndex: (placements: Map<import("../../
|
|
345
|
-
positionInView: (v: import("../../crdt/placement/model.js").ModelView, id: import("../../
|
|
346
|
-
buildInline: (atom: import("../../
|
|
347
|
-
isSelfOrDescendant: (placements: Map<import("../../
|
|
343
|
+
resolvePlacements: (blocks: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").BlockRec>, ownerOf?: (b: import("../../index.js").BlockId) => import("../../crdt/text/model.js").Owner) => Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>;
|
|
344
|
+
childrenIndex: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/placement/model.js").DisplayOwnership) => Map<import("../../index.js").BlockId | null, import("../../crdt/placement/model.js").ChildSlot[]>;
|
|
345
|
+
positionInView: (v: import("../../crdt/placement/model.js").ModelView, id: import("../../index.js").BlockId) => import("../../index.js").Destination | null;
|
|
346
|
+
buildInline: (atom: import("../../index.js").InlineSpec) => E.EngineNode;
|
|
347
|
+
isSelfOrDescendant: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/text/model.js").Ownership, id: import("../../index.js").BlockId, maybeAncestor: import("../../index.js").BlockId) => boolean;
|
|
348
348
|
ranksAt: (siblings: readonly {
|
|
349
349
|
rank: string;
|
|
350
350
|
}[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
|
|
351
|
-
writePlacement: (doc: E.EngineDoc, node: E.EngineNode, p: import("../../
|
|
351
|
+
writePlacement: (doc: E.EngineDoc, node: E.EngineNode, p: import("../../index.js").BlockId | null, r: string) => void;
|
|
352
352
|
withdrawOnUndo: (doc: E.EngineDoc) => (item: E.EngineItemRef, stackItem: {
|
|
353
353
|
inserts: {
|
|
354
354
|
hasId(id: unknown): boolean;
|
|
355
355
|
};
|
|
356
356
|
}) => boolean;
|
|
357
|
-
materializeSpec: (doc: E.EngineDoc, sp: import("../../
|
|
358
|
-
collides: (doc: E.EngineDoc, specs: readonly import("../../
|
|
359
|
-
writeSplit: (doc: E.EngineDoc, id: import("../../
|
|
360
|
-
ownText: (doc: E.EngineDoc, id: import("../../
|
|
357
|
+
materializeSpec: (doc: E.EngineDoc, sp: import("../../index.js").BlockSpec, parent: import("../../index.js").BlockId | null, rank: string) => void;
|
|
358
|
+
collides: (doc: E.EngineDoc, specs: readonly import("../../index.js").BlockSpec[]) => boolean;
|
|
359
|
+
writeSplit: (doc: E.EngineDoc, id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail: import("../../index.js").SplitTail, place: import("../../crdt/placement/model.js").PlacementValue) => void;
|
|
360
|
+
ownText: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => {
|
|
361
361
|
from: unknown;
|
|
362
362
|
to: number;
|
|
363
363
|
};
|
|
364
|
-
insertBlocks: (doc: E.EngineDoc, dest: import("../../
|
|
365
|
-
insertBlock: (doc: E.EngineDoc, dest: import("../../
|
|
366
|
-
restoreBlocks: (doc: E.EngineDoc, specs: import("../../
|
|
367
|
-
project: (doc: E.EngineDoc) => import("../../
|
|
368
|
-
positionOf: (doc: E.EngineDoc, id: import("../../
|
|
369
|
-
listBlockIds: (doc: E.EngineDoc) => import("../../
|
|
370
|
-
blockText: (doc: E.EngineDoc, id: import("../../
|
|
371
|
-
crdtId: (doc: E.EngineDoc, id: import("../../
|
|
372
|
-
resolveBlock: (doc: E.EngineDoc, id: import("../../
|
|
364
|
+
insertBlocks: (doc: E.EngineDoc, dest: import("../../index.js").Destination, specs: import("../../index.js").BlockSpec[]) => boolean;
|
|
365
|
+
insertBlock: (doc: E.EngineDoc, dest: import("../../index.js").Destination, spec: import("../../index.js").BlockSpec) => boolean;
|
|
366
|
+
restoreBlocks: (doc: E.EngineDoc, specs: import("../../index.js").BlockSpec[]) => void;
|
|
367
|
+
project: (doc: E.EngineDoc) => import("../../index.js").ProjectedDoc;
|
|
368
|
+
positionOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => import("../../index.js").Destination | null;
|
|
369
|
+
listBlockIds: (doc: E.EngineDoc) => import("../../index.js").BlockId[];
|
|
370
|
+
blockText: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => string | null;
|
|
371
|
+
crdtId: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => string | null;
|
|
372
|
+
resolveBlock: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
|
|
373
373
|
};
|
|
374
374
|
text: {
|
|
375
375
|
newNode: (name: string) => E.EngineNode;
|
|
@@ -426,7 +426,7 @@ export declare const crdt: {
|
|
|
426
426
|
_storeTimeout: number;
|
|
427
427
|
_storeTimeoutId: ReturnType<typeof setTimeout> | null;
|
|
428
428
|
_storeUpdate: (update: Uint8Array, origin: unknown) => void;
|
|
429
|
-
awareness: import("../../
|
|
429
|
+
awareness: import("../../index.js").Awareness;
|
|
430
430
|
bcconnected: boolean;
|
|
431
431
|
disableBc: boolean;
|
|
432
432
|
_ownsAwareness: boolean;
|
|
@@ -490,7 +490,7 @@ export declare const crdt: {
|
|
|
490
490
|
serverUrl: string;
|
|
491
491
|
roomname: string;
|
|
492
492
|
doc: YDoc;
|
|
493
|
-
awareness: import("../../
|
|
493
|
+
awareness: import("../../index.js").Awareness;
|
|
494
494
|
params: Record<string, string>;
|
|
495
495
|
maxBackoffTime: number;
|
|
496
496
|
connectTimeout: number;
|
|
@@ -675,7 +675,7 @@ declare const lookups: (semantics: DocumentSemanticsConfig) => {
|
|
|
675
675
|
kinds: () => string[];
|
|
676
676
|
defaultChildOf: (type: string) => string | undefined;
|
|
677
677
|
rendersContent: (type: string) => boolean;
|
|
678
|
-
markEdge: (mark: string) => import("../../
|
|
678
|
+
markEdge: (mark: string) => import("../../index.js").MarkEdge | undefined;
|
|
679
679
|
defaultType: string | undefined;
|
|
680
680
|
};
|
|
681
681
|
/** The room's limits, resolved from its options (`AttachedDocument`'s public knobs). */
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
current = null;
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
current = document.
|
|
62
|
-
return document.
|
|
61
|
+
current = document.toJSON();
|
|
62
|
+
return document.onChange(() => (current = document.toJSON()));
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
const diff = $derived(shown && current ? versionDiff(shown, current) : null);
|