@fileverse-dev/ddoc 5.0.7 → 5.1.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/dist/headless-editor-utils.es.js +1 -1
- package/dist/{index-D4hYioav.mjs → index-mGcKslYf.mjs} +1 -1
- package/dist/index.es.js +4716 -4548
- package/dist/{markdown-source-pane-DslilGqY.mjs → markdown-source-pane-Czkf5b3H.mjs} +1 -1
- package/dist/package/extensions/caret-marks/caret-marks.d.ts +13 -0
- package/dist/package/extensions/caret-marks/caret-style.d.ts +24 -0
- package/dist/package/extensions/caret-marks/dispatch-context.d.ts +32 -0
- package/dist/package/extensions/caret-marks/index.d.ts +3 -0
- package/dist/package/extensions/caret-marks/split-declaration.d.ts +11 -0
- package/dist/package/extensions/caret-marks/test-helpers.d.ts +72 -0
- package/dist/package/sync-local/SyncManager.d.ts +23 -3
- package/dist/package/sync-local/socketClient.d.ts +3 -0
- package/dist/{split-view-toolbar-BGeKurwZ.mjs → split-view-toolbar-hec3sLWd.mjs} +1 -1
- package/dist/{use-headless-editor-CPt0mRmF.mjs → use-headless-editor-CZD1x_Re.mjs} +13605 -13436
- package/package.json +2 -2
- package/dist/package/extensions/typography-persistence.d.ts +0 -20
|
@@ -3,7 +3,7 @@ var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
|
|
4
4
|
import { jsx as Cr } from "react/jsx-runtime";
|
|
5
5
|
import { useRef as pe, useEffect as St } from "react";
|
|
6
|
-
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-
|
|
6
|
+
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-mGcKslYf.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { PluginKey } from '@tiptap/pm/state';
|
|
3
|
+
import { DecorationSet } from '@tiptap/pm/view';
|
|
4
|
+
import { DispatchContext } from './dispatch-context';
|
|
5
|
+
|
|
6
|
+
export declare const caretMarksPluginKey: PluginKey<DispatchContext>;
|
|
7
|
+
export declare const caretMarksDecorationKey: PluginKey<DecorationSet>;
|
|
8
|
+
/**
|
|
9
|
+
* Google-Docs paragraph mark: an empty block remembers its caret style in
|
|
10
|
+
* `caretMarks` (JSON marks; '[]' = explicitly cleared, null = never stamped).
|
|
11
|
+
* See docs/FORMATTING_INHERITANCE.md.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CaretMarks: Extension<any, any>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { Mark, Node as ProseMirrorNode, Schema } from '@tiptap/pm/model';
|
|
3
|
+
import { Selection } from '@tiptap/pm/state';
|
|
4
|
+
|
|
5
|
+
export declare const CARET_MARKS_ATTR = "caretMarks";
|
|
6
|
+
/** Both EditorState and Transaction have this shape. */
|
|
7
|
+
export type CaretSource = {
|
|
8
|
+
storedMarks: readonly Mark[] | null;
|
|
9
|
+
selection: Selection;
|
|
10
|
+
doc: ProseMirrorNode;
|
|
11
|
+
};
|
|
12
|
+
export declare const serializeMarks: (marks: readonly Mark[]) => string;
|
|
13
|
+
export declare const parseMarks: (schema: Schema, value: unknown) => Mark[];
|
|
14
|
+
/**
|
|
15
|
+
* Fill the font properties the marks leave unset from a legacy paragraph's
|
|
16
|
+
* fontFamily / fontSize attrs (old docs). Explicit marks win.
|
|
17
|
+
*/
|
|
18
|
+
export declare const fillLegacyFont: (schema: Schema, marks: readonly Mark[], legacyBlock: ProseMirrorNode | null) => Mark[];
|
|
19
|
+
/** What typing a character would produce right now, legacy font filled in. */
|
|
20
|
+
export declare const caretStyle: (source: CaretSource, legacyBlock: ProseMirrorNode | null) => Mark[];
|
|
21
|
+
/** Marks Tiptap lets cross a split (everything but link). */
|
|
22
|
+
export declare const filterSplittable: (marks: readonly Mark[], editor: Editor) => Mark[];
|
|
23
|
+
/** A stamp carries the font; a block never holds both the stamp and the legacy attrs. */
|
|
24
|
+
export declare const stampAttrs: (attrs: Record<string, unknown>, style: readonly Mark[]) => Record<string, unknown>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Mark } from '@tiptap/pm/model';
|
|
2
|
+
import { EditorState, PluginKey, Transaction } from '@tiptap/pm/state';
|
|
3
|
+
|
|
4
|
+
export type OldCaret = {
|
|
5
|
+
wasEmpty: boolean;
|
|
6
|
+
/** Opening position of the pre-root caret block, tracked per step; null once its opening token went. */
|
|
7
|
+
pos: number | null;
|
|
8
|
+
/**
|
|
9
|
+
* marksAcross of the last deletion inside that block; null when nothing was
|
|
10
|
+
* deleted there. Meaningful only while `pos !== null` (the block survived).
|
|
11
|
+
*/
|
|
12
|
+
deletedMarks: readonly Mark[] | null;
|
|
13
|
+
};
|
|
14
|
+
export type Pending = {
|
|
15
|
+
marks: readonly Mark[] | null;
|
|
16
|
+
explicit: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Provenance of the dispatch in progress. ProseMirror's append loop hands a
|
|
20
|
+
* hook only the transactions it has not seen, so the root's origin, stored
|
|
21
|
+
* marks and steps live here, rebuilt at every root transaction.
|
|
22
|
+
*/
|
|
23
|
+
export type DispatchContext = {
|
|
24
|
+
local: boolean;
|
|
25
|
+
docChanged: boolean;
|
|
26
|
+
oldCaret: OldCaret | null;
|
|
27
|
+
pending: Pending | null;
|
|
28
|
+
};
|
|
29
|
+
export declare const EMPTY_CONTEXT: DispatchContext;
|
|
30
|
+
export declare const isRootTransaction: (tr: Transaction) => boolean;
|
|
31
|
+
export declare const isLocalRoot: (tr: Transaction) => boolean;
|
|
32
|
+
export declare const applyDispatchContext: (tr: Transaction, prev: DispatchContext, oldState: EditorState, key: PluginKey) => DispatchContext;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CaretMarks, caretMarksPluginKey, caretMarksDecorationKey, } from './caret-marks';
|
|
2
|
+
export { CARET_MARKS_ATTR, caretStyle, fillLegacyFont, filterSplittable, parseMarks, serializeMarks, stampAttrs, } from './caret-style';
|
|
3
|
+
export { captureSplit, declareSplit, type SplitCapture, } from './split-declaration';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { Mark } from '@tiptap/pm/model';
|
|
3
|
+
import { Transaction } from '@tiptap/pm/state';
|
|
4
|
+
|
|
5
|
+
export type SplitCapture = {
|
|
6
|
+
style: Mark[];
|
|
7
|
+
pos: number;
|
|
8
|
+
sourceWasEmpty: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const captureSplit: (tr: Transaction, editor: Editor) => SplitCapture | null;
|
|
11
|
+
export declare const declareSplit: (tr: Transaction, capture: SplitCapture) => void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { AnyExtension } from '@tiptap/core';
|
|
3
|
+
import { Mark, Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
4
|
+
import { Plugin, Transaction } from '@tiptap/pm/state';
|
|
5
|
+
import { UndoManager } from 'yjs';
|
|
6
|
+
|
|
7
|
+
import * as Y from 'yjs';
|
|
8
|
+
/**
|
|
9
|
+
* Mounted, Collaboration-backed editor with the production extension set.
|
|
10
|
+
* Collaboration owns the doc, so content is set after construction; pass
|
|
11
|
+
* `null` to leave it to a Yjs sync.
|
|
12
|
+
*/
|
|
13
|
+
export declare const makeEditor: (schemaVersion: number, content?: string | null, options?: {
|
|
14
|
+
ydoc?: Y.Doc;
|
|
15
|
+
extensions?: AnyExtension[];
|
|
16
|
+
}) => Editor;
|
|
17
|
+
export declare const track: (editor: Editor) => Editor;
|
|
18
|
+
export declare const destroyTracked: () => void;
|
|
19
|
+
/** Position just after the first occurrence of `text`. */
|
|
20
|
+
export declare const endOf: (editor: Editor, text: string) => number;
|
|
21
|
+
export declare const startOf: (editor: Editor, text: string) => number;
|
|
22
|
+
export declare const selectText: (editor: Editor, text: string) => boolean;
|
|
23
|
+
/** A click or arrow key: a selection change and nothing else. */
|
|
24
|
+
export declare const caretTo: (editor: Editor, pos: number) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The real keydown path. `commands.keyboardShortcut('Enter')` replays only
|
|
27
|
+
* the handler's steps and drops its selection and stored marks.
|
|
28
|
+
*/
|
|
29
|
+
export declare const pressKey: (editor: Editor, key: string) => boolean;
|
|
30
|
+
export declare const pressEnter: (editor: Editor) => boolean;
|
|
31
|
+
/** The transaction the browser produces for typed text (uses storedMarks). */
|
|
32
|
+
export declare const type: (editor: Editor, text?: string) => void;
|
|
33
|
+
export declare const markNames: (marks: readonly Mark[] | null | undefined) => string[];
|
|
34
|
+
/**
|
|
35
|
+
* Types `x` and reports what the character got — what the user sees. One
|
|
36
|
+
* character, so a test can read names and textStyle off the same caret.
|
|
37
|
+
*/
|
|
38
|
+
export declare const typedRun: (editor: Editor) => {
|
|
39
|
+
names: string[];
|
|
40
|
+
textStyle: import('prosemirror-model').Attrs | null;
|
|
41
|
+
};
|
|
42
|
+
export declare const typedMarks: (editor: Editor) => string[];
|
|
43
|
+
export declare const typedTextStyle: (editor: Editor) => import('prosemirror-model').Attrs | null;
|
|
44
|
+
/**
|
|
45
|
+
* jsdom has no DOM-change path; this is what prosemirror-view dispatches
|
|
46
|
+
* for a native deletion: delete, then ensureMarks(marksAcross).
|
|
47
|
+
*/
|
|
48
|
+
export declare const nativeDelete: (editor: Editor, from: number, to: number) => void;
|
|
49
|
+
export declare const backspace: (editor: Editor) => void;
|
|
50
|
+
/** Every textblock in document order, with its opening position. */
|
|
51
|
+
export declare const textblocks: (editor: Editor) => {
|
|
52
|
+
node: ProseMirrorNode;
|
|
53
|
+
pos: number;
|
|
54
|
+
}[];
|
|
55
|
+
/** The block Enter created: always the one after the original. */
|
|
56
|
+
export declare const createdBlock: (editor: Editor) => {
|
|
57
|
+
node: ProseMirrorNode;
|
|
58
|
+
pos: number;
|
|
59
|
+
};
|
|
60
|
+
export declare const caretBlock: (editor: Editor) => {
|
|
61
|
+
node: ProseMirrorNode;
|
|
62
|
+
pos: number;
|
|
63
|
+
};
|
|
64
|
+
export declare const stampOf: (node: ProseMirrorNode | undefined) => string | null;
|
|
65
|
+
export declare const storedMarkNames: (editor: Editor) => string[] | null;
|
|
66
|
+
/** Write a stamp by hand (test setup for stale / pre-existing stamps). */
|
|
67
|
+
export declare const stampBlock: (editor: Editor, pos: number, marks: readonly Mark[] | string) => void;
|
|
68
|
+
/** The y-sync plugin Collaboration registered (its key name is 'y-sync$…'). */
|
|
69
|
+
export declare const ySyncPlugin: (editor: Editor) => Plugin;
|
|
70
|
+
/** Dispatch a transaction tagged as a remote (y-sync) change. */
|
|
71
|
+
export declare const applyRemote: (editor: Editor, mutate: (tr: Transaction) => Transaction) => void;
|
|
72
|
+
export declare const undoManager: (editor: Editor) => UndoManager;
|
|
@@ -29,6 +29,14 @@ export declare class SyncManager {
|
|
|
29
29
|
private hydrationIncomplete;
|
|
30
30
|
private wireFormat;
|
|
31
31
|
private lastReportedWriteFormat;
|
|
32
|
+
private sessionGen;
|
|
33
|
+
private sendFailures;
|
|
34
|
+
private sendRetryTimer;
|
|
35
|
+
private lastConnectConfig;
|
|
36
|
+
private resumable;
|
|
37
|
+
private resuming;
|
|
38
|
+
private resumeFailures;
|
|
39
|
+
private nextResumeAt;
|
|
32
40
|
getWireFormat(): WireFormat;
|
|
33
41
|
private encryptForWire;
|
|
34
42
|
private emitWireTelemetry;
|
|
@@ -54,6 +62,7 @@ export declare class SyncManager {
|
|
|
54
62
|
updateRefs(_services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void;
|
|
55
63
|
get isConnected(): boolean;
|
|
56
64
|
get isReady(): boolean;
|
|
65
|
+
get isResuming(): boolean;
|
|
57
66
|
get awareness(): Awareness | null;
|
|
58
67
|
get status(): CollabStatus;
|
|
59
68
|
get collabState(): CollabState;
|
|
@@ -64,6 +73,11 @@ export declare class SyncManager {
|
|
|
64
73
|
private runEntryActions;
|
|
65
74
|
connect(config: CollabConnectionConfig): Promise<void>;
|
|
66
75
|
disconnect(): Promise<void>;
|
|
76
|
+
/** Reopens a session that ended on a transient loss (see dropToResumableIdle). A cheap
|
|
77
|
+
* no-op in every other state, so hosts can call it on each local edit, tab focus and
|
|
78
|
+
* network return. */
|
|
79
|
+
resume(): void;
|
|
80
|
+
private dropToResumableIdle;
|
|
67
81
|
/** Owner rename mid-session — see SocketClient.updateDocumentMeta. */
|
|
68
82
|
updateTitle(args: {
|
|
69
83
|
encryptedTitle: string;
|
|
@@ -80,11 +94,16 @@ export declare class SyncManager {
|
|
|
80
94
|
private flushUpdates;
|
|
81
95
|
private awaitFlush;
|
|
82
96
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
97
|
+
* Live path: merge the queued updates, encrypt, and emit via Socket.IO without waiting on
|
|
98
|
+
* earlier acks, so peers see typing at the flush cadence. A batch the server does not ack
|
|
99
|
+
* is re-queued, never dropped.
|
|
86
100
|
*/
|
|
87
101
|
private sendUpdateBatch;
|
|
102
|
+
private takeBatch;
|
|
103
|
+
private isUndeliverable;
|
|
104
|
+
private requeueUnacked;
|
|
105
|
+
private markSendSucceeded;
|
|
106
|
+
private scheduleSendRetry;
|
|
88
107
|
private sendUpdateBatchAttempt;
|
|
89
108
|
private isRevocationResponse;
|
|
90
109
|
private isSessionTerminatedResponse;
|
|
@@ -112,6 +131,7 @@ export declare class SyncManager {
|
|
|
112
131
|
private cleanupAwareness;
|
|
113
132
|
private broadcastLocalContents;
|
|
114
133
|
private processUpdateQueue;
|
|
134
|
+
private removeFromQueue;
|
|
115
135
|
private processNextUpdate;
|
|
116
136
|
private handleRemoteContentUpdate;
|
|
117
137
|
private applyRemoteYjsUpdate;
|
|
@@ -57,7 +57,9 @@ export declare class SocketClient {
|
|
|
57
57
|
private _socket;
|
|
58
58
|
private _webSocketStatus;
|
|
59
59
|
private _isIntentionalDisconnect;
|
|
60
|
+
private _pendingAckFailures;
|
|
60
61
|
get isConnected(): boolean;
|
|
62
|
+
get isSocketOpen(): boolean;
|
|
61
63
|
get status(): SocketStatusEnum;
|
|
62
64
|
private _websocketServiceDid;
|
|
63
65
|
private roomId;
|
|
@@ -94,6 +96,7 @@ export declare class SocketClient {
|
|
|
94
96
|
registerAwareness(awareness: Awareness): void;
|
|
95
97
|
private _stampSocketId;
|
|
96
98
|
private _emitWithAck;
|
|
99
|
+
private _failPendingAcks;
|
|
97
100
|
private _fetchRoomMembers;
|
|
98
101
|
private _recomputePresence;
|
|
99
102
|
sendUpdate({ update }: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as m, jsxs as L } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as D, useState as E, useEffect as A } from "react";
|
|
3
3
|
import { DynamicDropdown as P, Tooltip as O, IconButton as T } from "@fileverse/ui";
|
|
4
|
-
import { a3 as _, a4 as w, c as R } from "./index-
|
|
4
|
+
import { a3 as _, a4 as w, c as R } from "./index-mGcKslYf.mjs";
|
|
5
5
|
const p = (e, n, o = n) => {
|
|
6
6
|
const { state: i } = e, l = i.changeByRange((t) => {
|
|
7
7
|
const d = i.sliceDoc(t.from, t.to), r = i.sliceDoc(
|