edytor 5.0.0 → 7.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 +3 -3
- package/dist/cloudflare/DocumentRoom.d.ts +77 -2
- package/dist/cloudflare/DocumentRoom.js +37 -1
- package/dist/cloudflare/index.d.ts +1 -1
- package/dist/cloudflare/index.js +1 -1
- package/dist/cloudflare/room/access.d.ts +6 -1
- package/dist/cloudflare/room/access.js +30 -4
- package/dist/cloudflare/room/admission.d.ts +11 -0
- package/dist/cloudflare/room/admission.js +43 -10
- package/dist/cloudflare/room/context.d.ts +73 -76
- package/dist/cloudflare/room/context.js +17 -6
- package/dist/cloudflare/room/forged.d.ts +1 -1
- package/dist/cloudflare/room/forged.js +11 -9
- package/dist/cloudflare/room/frames.d.ts +2 -0
- package/dist/cloudflare/room/frames.js +2 -0
- package/dist/cloudflare/room/presence.js +1 -4
- package/dist/cloudflare/room/reseed.d.ts +93 -0
- package/dist/cloudflare/room/reseed.js +500 -0
- package/dist/cloudflare/room/scheduler.d.ts +1 -1
- package/dist/cloudflare/room/scheduler.js +9 -1
- package/dist/cloudflare/room/shared.d.ts +10 -0
- package/dist/cloudflare/room/shared.js +10 -0
- package/dist/cloudflare/room/storage.d.ts +7 -0
- package/dist/cloudflare/room/storage.js +33 -1
- package/dist/components/Edytor.svelte +18 -3
- package/dist/components/Edytor.svelte.d.ts +10 -1
- package/dist/components/EdytorRoot.svelte +17 -0
- package/dist/components/EdytorRoot.svelte.d.ts +4 -0
- package/dist/components/Suggestion.svelte +1 -1
- package/dist/crdt/attribution/block.d.ts +3 -0
- package/dist/crdt/attribution/block.js +3 -2
- package/dist/crdt/doc/history.js +2 -3
- package/dist/crdt/doc/ops.d.ts +81 -0
- package/dist/crdt/doc/ops.js +1898 -0
- package/dist/crdt/doc/suggest.d.ts +6 -2
- package/dist/crdt/doc/suggest.js +6 -5
- package/dist/crdt/edytor-doc.d.ts +157 -157
- package/dist/crdt/edytor-doc.js +15 -43
- package/dist/crdt/engine-room.d.ts +4 -0
- package/dist/crdt/engine-room.js +6 -0
- package/dist/crdt/flow.d.ts +4 -46
- package/dist/crdt/flow.js +2 -262
- package/dist/crdt/index.d.ts +64 -75
- package/dist/crdt/operations.d.ts +1 -1
- package/dist/crdt/placement/resolve.d.ts +1 -1
- package/dist/crdt/protocol.d.ts +2 -2
- package/dist/crdt/protocol.js +2 -2
- package/dist/crdt/protocols/auth.d.ts +8 -1
- package/dist/crdt/protocols/auth.js +14 -1
- package/dist/crdt/protocols/awareness.js +46 -81
- package/dist/crdt/providers/index.d.ts +11 -22
- package/dist/crdt/providers/index.js +22 -3
- package/dist/crdt/providers/indexeddb.d.ts +6 -10
- package/dist/crdt/providers/indexeddb.js +10 -16
- package/dist/crdt/providers/room.d.ts +26 -0
- package/dist/crdt/providers/room.js +41 -12
- package/dist/crdt/providers/websocket.d.ts +10 -14
- package/dist/crdt/providers/websocket.js +43 -23
- package/dist/crdt/rangeDelete.d.ts +2 -47
- package/dist/crdt/rangeDelete.js +1 -169
- package/dist/crdt/reseed.d.ts +127 -0
- package/dist/crdt/reseed.js +533 -0
- package/dist/crdt/restore.d.ts +13 -1
- package/dist/crdt/restore.js +8 -3
- package/dist/crdt/schema.d.ts +6 -0
- package/dist/crdt/schema.js +6 -0
- package/dist/crdt/structs.d.ts +8 -11
- package/dist/crdt/structs.js +25 -44
- package/dist/crdt/text/index/build.d.ts +119 -0
- package/dist/crdt/text/index/build.js +2801 -0
- package/dist/crdt/text/index/shared.d.ts +2 -6
- package/dist/crdt/text/index/shared.js +2 -5
- package/dist/crdt/text/model.js +2 -3
- package/dist/crdt/text/runs.d.ts +9 -12
- package/dist/crdt/text/runs.js +2 -165
- package/dist/crdt/vendor/yjs/UPSTREAM.md +101 -5
- package/dist/crdt/vendor/yjs/dts/index.d.ts +1 -1
- package/dist/crdt/vendor/yjs/dts/utils/Transaction.d.ts +10 -10
- package/dist/crdt/vendor/yjs/dts/utils/encoding.d.ts +1 -0
- package/dist/crdt/vendor/yjs/src/index.js +1 -1
- package/dist/crdt/vendor/yjs/src/structs/Item.js +24 -13
- package/dist/crdt/vendor/yjs/src/utils/Transaction.js +12 -10
- package/dist/crdt/vendor/yjs/src/utils/encoding.js +42 -1
- package/dist/events/domTextOffset.d.ts +2 -0
- package/dist/events/domTextOffset.js +8 -0
- package/dist/export/forms.d.ts +50 -50
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/richtext/RichTextPlugin.svelte +63 -61
- package/dist/plugins/richtext/richTextOperations.js +26 -32
- package/dist/selection/selection.svelte.d.ts +1 -1
- package/dist/selection/selection.svelte.js +87 -106
- package/dist/selection/selection.utils.js +5 -8
- package/dist/session/commands.js +49 -51
- package/dist/session/handles.js +3 -7
- package/dist/surface/attributes.d.ts +3 -3
- package/dist/surface/attributes.js +2 -2
- package/dist/surface/observer.svelte.d.ts +7 -7
- package/dist/surface/observer.svelte.js +225 -336
- package/dist/surface/projector.svelte.js +2 -2
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +7 -0
- package/package.json +1 -1
- package/dist/crdt/doc/capability.d.ts +0 -56
- package/dist/crdt/doc/capability.js +0 -207
- 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 -198
- 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 -203
- 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 -22
- package/dist/crdt/text/index/layout.js +0 -258
- package/dist/crdt/text/index/placement.d.ts +0 -47
- package/dist/crdt/text/index/placement.js +0 -738
- 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/session/handles.js
CHANGED
|
@@ -16,6 +16,7 @@ import { Block } from '../block/block.svelte.js';
|
|
|
16
16
|
import { InlineBlock } from '../block/inlineBlock.svelte.js';
|
|
17
17
|
import { Text } from '../text/text.svelte.js';
|
|
18
18
|
import { partsOf } from '../crdt/parts.js';
|
|
19
|
+
import { getOr } from '../utils.js';
|
|
19
20
|
/**
|
|
20
21
|
* A text segment's items as `JSONText` runs (`text.value`): empty items
|
|
21
22
|
* dropped, adjacent runs with the same marks joined, each run's marks a
|
|
@@ -61,10 +62,7 @@ export class Handles {
|
|
|
61
62
|
block = (id) => {
|
|
62
63
|
if (id === 'root')
|
|
63
64
|
return this.root;
|
|
64
|
-
|
|
65
|
-
if (!block)
|
|
66
|
-
this.#blocks.set(id, (block = new Block(this.edytor, id)));
|
|
67
|
-
return block;
|
|
65
|
+
return getOr(this.#blocks, id, () => new Block(this.edytor, id));
|
|
68
66
|
};
|
|
69
67
|
/** The handle of live block `id`; none for a dead or unknown id. */
|
|
70
68
|
get = (id) => id === 'root' || (id && this.edytor.facade.isVisibleBlock(id)) ? this.block(id) : undefined;
|
|
@@ -84,9 +82,7 @@ export class Handles {
|
|
|
84
82
|
};
|
|
85
83
|
/** The handle of atom `atomId`, shown in block `blockId`. */
|
|
86
84
|
atom = (blockId, atomId) => {
|
|
87
|
-
|
|
88
|
-
if (!atom)
|
|
89
|
-
this.#atoms.set(atomId, (atom = new InlineBlock(this.edytor, blockId, atomId)));
|
|
85
|
+
const atom = getOr(this.#atoms, atomId, () => new InlineBlock(this.edytor, blockId, atomId));
|
|
90
86
|
atom.blockId = blockId;
|
|
91
87
|
return atom;
|
|
92
88
|
};
|
|
@@ -32,12 +32,12 @@ export type Kind = 'block' | 'text' | 'mark' | 'atom' | 'anchor' | 'preview';
|
|
|
32
32
|
* moves the caret by its paragraph's direction, never an inline run's.
|
|
33
33
|
*/
|
|
34
34
|
export declare const blockDir: (text: string) => "rtl" | "ltr" | null;
|
|
35
|
-
/** The text a cell's runs show
|
|
36
|
-
export declare const ownText: (runs: readonly ContentRun[]) => string;
|
|
35
|
+
/** The text a cell's runs show, each atom as `atom` (left out: what `blockDir` reads). */
|
|
36
|
+
export declare const ownText: (runs: readonly ContentRun[], atom?: string) => string;
|
|
37
37
|
/** A text inside a void block is its own editing host (the core sets it at attach). */
|
|
38
38
|
export declare const insideVoid: (edytor: Edytor, block: string) => boolean;
|
|
39
39
|
/** What the table owns on `element` (the root, or a registered element). */
|
|
40
|
-
export declare const ownedOf: (edytor: Edytor, element: Element, entry
|
|
40
|
+
export declare const ownedOf: (edytor: Edytor, element: Element, entry?: {
|
|
41
41
|
kind: Kind;
|
|
42
42
|
block: string;
|
|
43
43
|
name?: string;
|
|
@@ -20,8 +20,8 @@ export const blockDir = (text) => {
|
|
|
20
20
|
const strong = STRONG.exec(text)?.[0];
|
|
21
21
|
return strong === undefined ? null : RTL.test(strong) ? 'rtl' : 'ltr';
|
|
22
22
|
};
|
|
23
|
-
/** The text a cell's runs show
|
|
24
|
-
export const ownText = (runs) => runs.map((run) => (run.kind === 'text' ? run.text :
|
|
23
|
+
/** The text a cell's runs show, each atom as `atom` (left out: what `blockDir` reads). */
|
|
24
|
+
export const ownText = (runs, atom = '') => runs.map((run) => (run.kind === 'text' ? run.text : atom)).join('');
|
|
25
25
|
/** A text inside a void block is its own editing host (the core sets it at attach). */
|
|
26
26
|
export const insideVoid = (edytor, block) => {
|
|
27
27
|
for (let id = block; id; id = edytor.facade.parentOf(id))
|
|
@@ -31,12 +31,12 @@ export declare class SurfaceObserver {
|
|
|
31
31
|
* editing host inside a void).
|
|
32
32
|
*/
|
|
33
33
|
register: (node: Element, kind: Kind, block: string, name?: string, owned?: () => Owned, handle?: Text | InlineBlock) => () => void;
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
/**
|
|
35
|
+
* A view-only element the core renders in the host, never compared: the
|
|
36
|
+
* render anchor (`Edytor.svelte`, a registered child of the strict root),
|
|
37
|
+
* or with its suggestion's `id`, a preview group (`components/Suggestion`).
|
|
38
|
+
*/
|
|
39
|
+
own: (node: HTMLElement, id?: string) => {
|
|
40
40
|
destroy: () => void;
|
|
41
41
|
};
|
|
42
42
|
/** Extension view state rendered into the host, or a re-display request: an epoch bump. */
|
|
@@ -71,4 +71,4 @@ export declare class SurfaceObserver {
|
|
|
71
71
|
* The caret lands where the browser put it (`domCaret`), else, for an
|
|
72
72
|
* attempt, where the change ends — unless a gesture came since.
|
|
73
73
|
*/
|
|
74
|
-
export declare const adopt: (edytor: Edytor, text: Text, dom: string, domCaret?: number, prefer?: number) => Promise<
|
|
74
|
+
export declare const adopt: (edytor: Edytor, text: Text, dom: string, domCaret?: number, prefer?: number) => Promise<void>;
|