edytor 4.0.0 → 6.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 +106 -109
- 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/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 +79 -59
- package/dist/crdt/doc/ops.d.ts +81 -0
- package/dist/crdt/doc/ops.js +1898 -0
- package/dist/crdt/doc/reads.d.ts +2 -2
- package/dist/crdt/doc/reads.js +18 -28
- 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 +294 -272
- package/dist/crdt/edytor-doc.js +123 -108
- 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 +5 -47
- package/dist/crdt/flow.js +3 -269
- package/dist/crdt/index.d.ts +102 -108
- package/dist/crdt/index.js +3 -0
- package/dist/crdt/operations.d.ts +13 -4
- 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.d.ts +1 -1
- 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/awareness.js +46 -81
- package/dist/crdt/protocols/comments.d.ts +16 -1
- package/dist/crdt/protocols/comments.js +9 -1
- package/dist/crdt/providers/index.d.ts +12 -22
- package/dist/crdt/providers/index.js +3 -1
- package/dist/crdt/providers/indexeddb.d.ts +6 -10
- package/dist/crdt/providers/indexeddb.js +10 -16
- package/dist/crdt/providers/room.d.ts +11 -0
- package/dist/crdt/providers/room.js +26 -12
- package/dist/crdt/providers/websocket.d.ts +8 -12
- package/dist/crdt/providers/websocket.js +17 -19
- package/dist/crdt/purge.d.ts +7 -1
- package/dist/crdt/purge.js +32 -2
- package/dist/crdt/rangeDelete.d.ts +2 -47
- package/dist/crdt/rangeDelete.js +1 -169
- 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/build.d.ts +125 -0
- package/dist/crdt/text/index/build.js +2895 -0
- package/dist/crdt/text/index/shared.d.ts +2 -6
- package/dist/crdt/text/index/shared.js +19 -19
- package/dist/crdt/text/model.d.ts +10 -0
- package/dist/crdt/text/model.js +10 -4
- package/dist/crdt/text/runs.d.ts +43 -42
- package/dist/crdt/text/runs.js +2 -165
- 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/domTextOffset.d.ts +2 -0
- package/dist/events/domTextOffset.js +8 -0
- 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 +75 -75
- 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/richtext/RichTextPlugin.svelte +63 -61
- package/dist/plugins/richtext/richTextOperations.js +26 -32
- 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 +33 -11
- 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 +14 -44
- 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 +143 -111
- package/dist/surface/pin.svelte.d.ts +9 -9
- package/dist/surface/pin.svelte.js +15 -22
- package/dist/surface/projector.svelte.js +10 -16
- package/dist/text/text.svelte.js +14 -19
- package/dist/themes/notion.css +29 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +7 -0
- package/package.json +3 -1
- package/dist/crdt/doc/capability.d.ts +0 -56
- package/dist/crdt/doc/capability.js +0 -211
- package/dist/crdt/doc/content.d.ts +0 -16
- package/dist/crdt/doc/content.js +0 -77
- package/dist/crdt/doc/delete.d.ts +0 -15
- package/dist/crdt/doc/delete.js +0 -84
- package/dist/crdt/doc/layout.d.ts +0 -9
- package/dist/crdt/doc/layout.js +0 -178
- package/dist/crdt/doc/meta.d.ts +0 -19
- package/dist/crdt/doc/meta.js +0 -199
- package/dist/crdt/doc/moves.d.ts +0 -21
- package/dist/crdt/doc/moves.js +0 -274
- package/dist/crdt/doc/split-merge.d.ts +0 -10
- package/dist/crdt/doc/split-merge.js +0 -179
- package/dist/crdt/doc/steps.d.ts +0 -65
- package/dist/crdt/doc/steps.js +0 -311
- package/dist/crdt/text/index/cache.d.ts +0 -16
- package/dist/crdt/text/index/cache.js +0 -175
- package/dist/crdt/text/index/claims.d.ts +0 -18
- package/dist/crdt/text/index/claims.js +0 -225
- package/dist/crdt/text/index/fold.d.ts +0 -21
- package/dist/crdt/text/index/fold.js +0 -656
- package/dist/crdt/text/index/layout.d.ts +0 -24
- package/dist/crdt/text/index/layout.js +0 -271
- package/dist/crdt/text/index/placement.d.ts +0 -47
- package/dist/crdt/text/index/placement.js +0 -741
- package/dist/crdt/text/index/records.d.ts +0 -13
- package/dist/crdt/text/index/records.js +0 -139
- package/dist/crdt/text/index/report.d.ts +0 -18
- package/dist/crdt/text/index/report.js +0 -337
- package/dist/crdt/text/index/state.d.ts +0 -197
- package/dist/crdt/text/index/state.js +0 -116
- package/dist/crdt/text/index/streams.d.ts +0 -25
- package/dist/crdt/text/index/streams.js +0 -248
package/dist/crdt/structs.d.ts
CHANGED
|
@@ -212,6 +212,8 @@ export declare const engineOps: (Y: EngineApi) => {
|
|
|
212
212
|
merge: (sets: IdSetLike[]) => IdSetOf;
|
|
213
213
|
/** Whether a store struct is an item (not a GC or a Skip). */
|
|
214
214
|
isItem: (struct: unknown) => struct is StoreStruct;
|
|
215
|
+
/** Show again what a suggestion's deletes in `tr` proposed (fork patch YP32). */
|
|
216
|
+
unhide: (tr: unknown) => void;
|
|
215
217
|
/** Whether `item` sits in `node`'s subtree. */
|
|
216
218
|
inside: (node: EngineNode, item: StoreStruct) => boolean;
|
|
217
219
|
/** Keep `item` (and its parents) from collection (`keepItem`). */
|
package/dist/crdt/structs.js
CHANGED
|
@@ -238,6 +238,8 @@ export const engineOps = (Y) => {
|
|
|
238
238
|
merge: (sets) => Y.mergeIdSets(sets),
|
|
239
239
|
/** Whether a store struct is an item (not a GC or a Skip). */
|
|
240
240
|
isItem: (struct) => struct instanceof Y.Item,
|
|
241
|
+
/** Show again what a suggestion's deletes in `tr` proposed (fork patch YP32). */
|
|
242
|
+
unhide: (tr) => Y.unhide(tr),
|
|
241
243
|
/** Whether `item` sits in `node`'s subtree. */
|
|
242
244
|
inside: (node, item) => Y.isParentOf(asYNode(node), item),
|
|
243
245
|
/** Keep `item` (and its parents) from collection (`keepItem`). */
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-document index (`indexOf`) as ONE closure: its state, then its
|
|
3
|
+
* parts — the claim graph, the stream table and each block's claims, the
|
|
4
|
+
* layout and table rules, placements and the children index (with THE
|
|
5
|
+
* shown-kind rule, `typeOf`), block records, the run cache, the fold and the
|
|
6
|
+
* change report — each reading the state and the parts before it as closure
|
|
7
|
+
* variables, then the view (`RunView`) over them. `../runs.ts` declares the
|
|
8
|
+
* index's types and contracts. The self-checks (`indexChecks`) read the
|
|
9
|
+
* maintained facts through {@link IndexFacts} and rebuild their own.
|
|
10
|
+
*/
|
|
11
|
+
import type { EngineDoc, EngineNode, EngineTransaction } from '../../engine-api.js';
|
|
12
|
+
import { type BlockId, type BlockRec, type ChildSlot, type DisplayOwnership, type ResolvedPlacement } from '../../placement/model.js';
|
|
13
|
+
import { type IdSetLike } from '../../structs.js';
|
|
14
|
+
import { type LiveRow, type RowItem } from '../rows.js';
|
|
15
|
+
import type { ContentRun, RunView } from '../runs.js';
|
|
16
|
+
import { type Cached } from './shared.js';
|
|
17
|
+
import { type Claim, type Owner, type Stream } from '../model.js';
|
|
18
|
+
import { type Edge, type SlotRef } from '../../placement/resolve.js';
|
|
19
|
+
export type TextEdit = {
|
|
20
|
+
item: RowItem;
|
|
21
|
+
len: number;
|
|
22
|
+
del: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type TextEdits = {
|
|
25
|
+
edits: TextEdit[];
|
|
26
|
+
scan: boolean;
|
|
27
|
+
opaque: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** One fold's effects: invalidated blocks, rescanned texts, rebuilt facets. */
|
|
30
|
+
export type FoldCtx = {
|
|
31
|
+
invalidated: Set<BlockId>;
|
|
32
|
+
/** Per home block: its text's edits, whether it rescans, whether every reader re-reads. */
|
|
33
|
+
texts: Map<BlockId, {
|
|
34
|
+
edits: TextEdit[];
|
|
35
|
+
scan: boolean;
|
|
36
|
+
opaque: boolean;
|
|
37
|
+
seen: Set<TextEdits>;
|
|
38
|
+
}>;
|
|
39
|
+
/** The blocks whose entry or nonce changed: their delimiters are re-decided. */
|
|
40
|
+
named: Set<BlockId>;
|
|
41
|
+
table: boolean;
|
|
42
|
+
/** The winning parents, before and after, of the blocks the fold touched. */
|
|
43
|
+
parents: Set<BlockId>;
|
|
44
|
+
};
|
|
45
|
+
/** A slot in a children index: its display parent, rank and the island it displays out of. */
|
|
46
|
+
export type Slot = {
|
|
47
|
+
parent: BlockId | null;
|
|
48
|
+
rank: string;
|
|
49
|
+
reset?: BlockId;
|
|
50
|
+
};
|
|
51
|
+
/** Each row's segments at its last placement: segment 0's block, then each cut's key and block. */
|
|
52
|
+
export type Placed = {
|
|
53
|
+
head: BlockId | null;
|
|
54
|
+
keys: string[];
|
|
55
|
+
blocks: (BlockId | null)[];
|
|
56
|
+
};
|
|
57
|
+
/** The tree the change report last published. */
|
|
58
|
+
export type Published = {
|
|
59
|
+
nodes: Map<BlockId, {
|
|
60
|
+
parent: BlockId | null;
|
|
61
|
+
index: number;
|
|
62
|
+
type: string;
|
|
63
|
+
data: unknown;
|
|
64
|
+
runs: readonly ContentRun[];
|
|
65
|
+
key?: string;
|
|
66
|
+
}>;
|
|
67
|
+
order: Map<BlockId | null, readonly BlockId[]>;
|
|
68
|
+
/** The children index version it was taken at. */
|
|
69
|
+
kids: number;
|
|
70
|
+
};
|
|
71
|
+
/** A transaction as the fold reads it. */
|
|
72
|
+
export type Tx = {
|
|
73
|
+
insertSet?: IdSetLike;
|
|
74
|
+
deleteSet?: IdSetLike;
|
|
75
|
+
changed?: EngineTransaction['changed'];
|
|
76
|
+
/** The visibility changes hold records made, in order (fork patch YP20). */
|
|
77
|
+
holds?: number[];
|
|
78
|
+
/** The units whose mover changed, in order (fork patch YP22). */
|
|
79
|
+
moves?: number[];
|
|
80
|
+
};
|
|
81
|
+
/** The index's self-checks (`indexChecks`), run after each fold and each report. */
|
|
82
|
+
export type SelfChecks = {
|
|
83
|
+
check: () => void;
|
|
84
|
+
checkPublished: (pub: Published) => void;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* What the self-checks read of one index: the facts it maintains
|
|
88
|
+
* incrementally (compared with their rebuild from the replicated state) and
|
|
89
|
+
* the reads they compare through.
|
|
90
|
+
*/
|
|
91
|
+
export type IndexFacts = {
|
|
92
|
+
doc: EngineDoc;
|
|
93
|
+
registry: EngineNode;
|
|
94
|
+
blocks: ReadonlyMap<BlockId, BlockRec>;
|
|
95
|
+
displaysMap: ReadonlyMap<BlockId, ReadonlySet<BlockId>>;
|
|
96
|
+
rows: ReadonlyMap<BlockId, LiveRow>;
|
|
97
|
+
streamIx: ReadonlyMap<BlockId, unknown>;
|
|
98
|
+
delim: ReadonlyMap<BlockId, string>;
|
|
99
|
+
placementsMap: ReadonlyMap<BlockId, ResolvedPlacement>;
|
|
100
|
+
slotsByBlock: ReadonlyMap<BlockId, SlotRef[]>;
|
|
101
|
+
edges: ReadonlyMap<BlockId, Edge | null>;
|
|
102
|
+
rejected: ReadonlySet<BlockId>;
|
|
103
|
+
kids0: Map<BlockId | null, ChildSlot[]>;
|
|
104
|
+
kidsMap: Map<BlockId | null, ChildSlot[]>;
|
|
105
|
+
slots: ReadonlyMap<BlockId, Slot>;
|
|
106
|
+
dissolved: ReadonlySet<BlockId>;
|
|
107
|
+
following: ReadonlySet<BlockId>;
|
|
108
|
+
cache: ReadonlyMap<BlockId, Cached>;
|
|
109
|
+
dirty: ReadonlySet<BlockId>;
|
|
110
|
+
ownShim: DisplayOwnership;
|
|
111
|
+
own0: DisplayOwnership;
|
|
112
|
+
ownerOf: (b: BlockId) => Owner;
|
|
113
|
+
streamOf: (b: BlockId) => Stream | undefined;
|
|
114
|
+
sameClaims: (x: readonly Claim[], y: readonly Claim[]) => boolean;
|
|
115
|
+
dissolve: (kids: Map<BlockId | null, ChildSlot[]>) => Set<BlockId>;
|
|
116
|
+
noteFollowing: (id: BlockId) => void;
|
|
117
|
+
ensurePlacements: () => void;
|
|
118
|
+
computeFresh: (b: BlockId) => {
|
|
119
|
+
fresh: readonly ContentRun[];
|
|
120
|
+
};
|
|
121
|
+
unfolded: () => boolean;
|
|
122
|
+
reachable: (prev?: Published['nodes']) => Published;
|
|
123
|
+
};
|
|
124
|
+
/** The doc's index — built on first use, torn down when the doc is destroyed. */
|
|
125
|
+
export declare const indexOf: (doc: EngineDoc) => RunView;
|