@docx-editor.dev/pro 2.31.0 → 2.32.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 +24 -0
- package/dist/chunk-3WTOHPAB.js +1 -0
- package/dist/chunk-AVZO5ZHZ.js +1 -0
- package/dist/chunk-GAGYRL3L.js +5 -0
- package/dist/chunk-HMSOWKXT.js +1 -0
- package/dist/chunk-I6HVINA4.cjs +1 -0
- package/dist/chunk-MHB6ID2P.cjs +1 -0
- package/dist/chunk-PMS3PGOE.cjs +1 -0
- package/dist/chunk-YOWEY5F3.cjs +5 -0
- package/dist/collaboration/hocuspocus.cjs +1 -1
- package/dist/collaboration/hocuspocus.d.cts +3 -3
- package/dist/collaboration/hocuspocus.d.ts +3 -3
- package/dist/collaboration/hocuspocus.js +1 -1
- package/dist/collaboration/index.cjs +2 -2
- package/dist/collaboration/index.d.cts +63 -7
- package/dist/collaboration/index.d.ts +63 -7
- package/dist/collaboration/index.js +2 -2
- package/dist/collaboration/webrtc.cjs +1 -1
- package/dist/collaboration/webrtc.d.cts +3 -3
- package/dist/collaboration/webrtc.d.ts +3 -3
- package/dist/collaboration/webrtc.js +1 -1
- package/dist/{document-session-_v9vqiSX.d.cts → document-session-B-MlORjE.d.cts} +105 -9
- package/dist/{document-session-Bxs4_GgX.d.ts → document-session-B-iH-YCU.d.ts} +105 -9
- package/dist/document-session-B35ZX2W4.js +1 -0
- package/dist/document-session-V3O7XBJY.cjs +1 -0
- package/dist/{document-session-options-DelOC7PX.d.ts → document-session-options-CdOH-TNn.d.ts} +1 -1
- package/dist/{document-session-options-CfKypp9c.d.cts → document-session-options-CxR0F5xT.d.cts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react/hocuspocus.d.cts +2 -2
- package/dist/react/hocuspocus.d.ts +2 -2
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +95 -12
- package/dist/react/index.d.ts +95 -12
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.d.cts +2 -2
- package/dist/react/webrtc.d.ts +2 -2
- package/dist/{types-BQ1vBt5Q.d.ts → types-DvGpDOcZ.d.cts} +9 -1
- package/dist/{types-BQ1vBt5Q.d.cts → types-DvGpDOcZ.d.ts} +9 -1
- package/dist/{types-6EmrEn4n.d.cts → types-bt2k1VO0.d.cts} +9 -1
- package/dist/{types-6EmrEn4n.d.ts → types-bt2k1VO0.d.ts} +9 -1
- package/dist/vue/hocuspocus.d.cts +2 -2
- package/dist/vue/hocuspocus.d.ts +2 -2
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +89 -13
- package/dist/vue/index.d.ts +89 -13
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.d.cts +2 -2
- package/dist/vue/webrtc.d.ts +2 -2
- package/docs/accept-reject-without-scrolling.md +95 -0
- package/docs/comment-on-found-text.md +72 -0
- package/docs/custom-review-cards.md +178 -0
- package/docs/highlight-ranges.md +48 -0
- package/docs/index.md +36 -0
- package/docs/propose-rewrite.md +247 -0
- package/docs/tracked-replacement.md +68 -0
- package/package.json +5 -4
- package/dist/chunk-32WEH2XH.cjs +0 -1
- package/dist/chunk-FD2KDBHX.cjs +0 -1
- package/dist/chunk-L567WP3J.js +0 -5
- package/dist/chunk-MJECUVHQ.cjs +0 -5
- package/dist/chunk-Q5JTCGJI.js +0 -1
- package/dist/chunk-SNQCYZLT.js +0 -1
- package/dist/chunk-UOAEJRVX.js +0 -1
- package/dist/chunk-ZSAAX6HV.cjs +0 -1
- package/dist/document-session-3VC43WNI.cjs +0 -1
- package/dist/document-session-J2YKWERI.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { b as CollaborationIdentityUpdate, c as CollaborationHandle } from './types-DvGpDOcZ.cjs';
|
|
1
2
|
import { EditorCollaborationSession, CollaborationFailureCode } from '@docx-editor.dev/core/collaboration';
|
|
2
3
|
import * as Y from 'yjs';
|
|
3
|
-
import {
|
|
4
|
-
import { C as CreateDocumentCollaborationOptions } from './document-session-options-CfKypp9c.cjs';
|
|
4
|
+
import { C as CreateDocumentCollaborationOptions } from './document-session-options-CxR0F5xT.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Room-size observability.
|
|
@@ -63,13 +63,48 @@ interface CollaborationResourceUsage {
|
|
|
63
63
|
declare function readCollaborationResourceUsage(ydoc: Y.Doc): CollaborationResourceUsage;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Why `beginUndoGroup` refused.
|
|
67
67
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
68
|
+
* - `undo-group-already-open`: this session already has an open group. Groups do not nest
|
|
69
|
+
* and two operations cannot share one session's group. End the open group first, or give
|
|
70
|
+
* each concurrent operation its own session.
|
|
71
|
+
* - `editor-attached`: an editor that people edit through is attached to this session. Use
|
|
72
|
+
* the editor's own `beginHistoryGroup()` there.
|
|
73
|
+
* - `collaboration-session-destroyed`: the session was destroyed.
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
type CollaborationUndoGroupErrorCode = 'undo-group-already-open' | 'editor-attached' | 'collaboration-session-destroyed';
|
|
77
|
+
/**
|
|
78
|
+
* Thrown by `beginUndoGroup` when the session cannot open a group. Branch on `code`.
|
|
79
|
+
* @public
|
|
72
80
|
*/
|
|
81
|
+
declare class CollaborationUndoGroupError extends Error {
|
|
82
|
+
/** Stable refusal code. */
|
|
83
|
+
readonly code: CollaborationUndoGroupErrorCode;
|
|
84
|
+
constructor(
|
|
85
|
+
/** Stable refusal code. */
|
|
86
|
+
code: CollaborationUndoGroupErrorCode);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* One open undo group of a collaboration session.
|
|
90
|
+
*
|
|
91
|
+
* Every local write the session publishes while the group is open becomes part of one undo
|
|
92
|
+
* step, however long the group stays open. `end()` closes the step, so the next write
|
|
93
|
+
* starts a new one, however soon it follows.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
interface CollaborationUndoGroup {
|
|
97
|
+
/** `closed` after `end()`, after the session is destroyed, or after an editor attaches. */
|
|
98
|
+
readonly state: 'open' | 'closed';
|
|
99
|
+
/**
|
|
100
|
+
* Publish committed local writes into the group, then close it. Reverts nothing. Safe to
|
|
101
|
+
* call more than once, and after the session is destroyed.
|
|
102
|
+
*
|
|
103
|
+
* Commands a runtime still queues are not committed yet. Call `end()` after
|
|
104
|
+
* `runtime.run()` resolves, so its last `context.sync()` lands inside the group.
|
|
105
|
+
*/
|
|
106
|
+
end(): void;
|
|
107
|
+
}
|
|
73
108
|
|
|
74
109
|
/**
|
|
75
110
|
* Full-document collaboration session: the engine-facing seam, the transport status a
|
|
@@ -105,7 +140,68 @@ interface DocumentCollaborationSession extends EditorCollaborationSession {
|
|
|
105
140
|
* schedule rather than per keystroke.
|
|
106
141
|
*/
|
|
107
142
|
resourceUsage(): CollaborationResourceUsage;
|
|
143
|
+
/**
|
|
144
|
+
* Open an explicit undo group: every local write this session publishes until `end()` is
|
|
145
|
+
* one undo step. For a server or headless replica, such as an agent's.
|
|
146
|
+
*
|
|
147
|
+
* Without a group, local writes that land within 500 ms of each other share one undo step.
|
|
148
|
+
* A group replaces that timing rule. Its first write starts a new step, however soon it
|
|
149
|
+
* follows the previous write. Its later writes join that step, however long the group
|
|
150
|
+
* stays open. The first write after `end()` starts a new step.
|
|
151
|
+
*
|
|
152
|
+
* Each boundary publishes the writes that are already committed. A runtime commits its
|
|
153
|
+
* queued commands only at `context.sync()`, so call `end()` after `runtime.run()` resolves,
|
|
154
|
+
* not inside the callback before its last sync.
|
|
155
|
+
*
|
|
156
|
+
* - Undo and redo refuse while the group is open: `undo()` and `redo()` return false, and
|
|
157
|
+
* `canUndo()` and `canRedo()` report false. {@link DocumentCollaborationSession.undoGroupOpen}
|
|
158
|
+
* tells this refusal apart from an empty history. End the group first.
|
|
159
|
+
* - A refused write does not end the group. Later writes join the same step as the
|
|
160
|
+
* earlier ones. To revert the whole operation, end the group and call `undo()` once.
|
|
161
|
+
* - Only local writes join the group. Other participants' edits stay out of it, and an
|
|
162
|
+
* undo of the group keeps them. It can also remove text that others typed in a
|
|
163
|
+
* paragraph the group inserted (#1398). When they removed everything the group wrote,
|
|
164
|
+
* its undo changes nothing and never reverts an older step.
|
|
165
|
+
* - An undo of an ungrouped step never reverts a group's step below it. Ungrouped history
|
|
166
|
+
* otherwise undoes as it does without groups. If a peer removed everything that the top
|
|
167
|
+
* ungrouped step wrote, that `undo()` changes nothing and returns true. Call `undo()`
|
|
168
|
+
* again to revert the group.
|
|
169
|
+
* - Destroying the session, or attaching an editor to it, closes an open group.
|
|
170
|
+
*
|
|
171
|
+
* @throws CollaborationUndoGroupError with `undo-group-already-open` when this session
|
|
172
|
+
* already has an open group, `editor-attached` when an editor that people edit through is
|
|
173
|
+
* attached (use the editor's `beginHistoryGroup()` there), or
|
|
174
|
+
* `collaboration-session-destroyed` after `destroy()`. Groups do not nest. Give each
|
|
175
|
+
* concurrent operation its own session.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* const group = session.beginUndoGroup();
|
|
180
|
+
* try {
|
|
181
|
+
* await runtime.run(async (context) => {
|
|
182
|
+
* context.document.body.insertParagraph('Task A', 'End');
|
|
183
|
+
* await context.sync();
|
|
184
|
+
* });
|
|
185
|
+
* } finally {
|
|
186
|
+
* group.end();
|
|
187
|
+
* }
|
|
188
|
+
* session.undo(); // reverts Task A only
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
beginUndoGroup(): CollaborationUndoGroup;
|
|
192
|
+
/** Whether an undo group from {@link DocumentCollaborationSession.beginUndoGroup} is open. */
|
|
193
|
+
readonly undoGroupOpen: boolean;
|
|
108
194
|
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Full-document collaboration over the canonical primitive journal.
|
|
198
|
+
*
|
|
199
|
+
* Local direction: the canonical store commits, emits ONE journal, and the journal is applied
|
|
200
|
+
* to shared state in one Yjs transaction. Remote direction: a shared-state change materializes
|
|
201
|
+
* one canonical package, which the port publishes as one revision. The two never chase each
|
|
202
|
+
* other, because a remote publication deliberately emits no journal.
|
|
203
|
+
*/
|
|
204
|
+
|
|
109
205
|
/** Owned full-document collaboration replica. @public */
|
|
110
206
|
type DocumentCollaborationHandle = CollaborationHandle<DocumentCollaborationSession>;
|
|
111
207
|
|
|
@@ -142,5 +238,5 @@ type DocumentCollaborationHandle = CollaborationHandle<DocumentCollaborationSess
|
|
|
142
238
|
*/
|
|
143
239
|
declare function createDocumentCollaboration(options: CreateDocumentCollaborationOptions): Promise<DocumentCollaborationHandle>;
|
|
144
240
|
|
|
145
|
-
export { createDocumentCollaboration as
|
|
146
|
-
export type { CollaborationResourceUsage as C, DocumentCollaborationHandle as D,
|
|
241
|
+
export { CollaborationUndoGroupError as b, createDocumentCollaboration as e, readCollaborationResourceUsage as r };
|
|
242
|
+
export type { CollaborationResourceUsage as C, DocumentCollaborationHandle as D, CollaborationUndoGroup as a, CollaborationUndoGroupErrorCode as c, DocumentCollaborationSession as d };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { b as CollaborationIdentityUpdate, c as CollaborationHandle } from './types-DvGpDOcZ.js';
|
|
1
2
|
import { EditorCollaborationSession, CollaborationFailureCode } from '@docx-editor.dev/core/collaboration';
|
|
2
3
|
import * as Y from 'yjs';
|
|
3
|
-
import {
|
|
4
|
-
import { C as CreateDocumentCollaborationOptions } from './document-session-options-DelOC7PX.js';
|
|
4
|
+
import { C as CreateDocumentCollaborationOptions } from './document-session-options-CdOH-TNn.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Room-size observability.
|
|
@@ -63,13 +63,48 @@ interface CollaborationResourceUsage {
|
|
|
63
63
|
declare function readCollaborationResourceUsage(ydoc: Y.Doc): CollaborationResourceUsage;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Why `beginUndoGroup` refused.
|
|
67
67
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
68
|
+
* - `undo-group-already-open`: this session already has an open group. Groups do not nest
|
|
69
|
+
* and two operations cannot share one session's group. End the open group first, or give
|
|
70
|
+
* each concurrent operation its own session.
|
|
71
|
+
* - `editor-attached`: an editor that people edit through is attached to this session. Use
|
|
72
|
+
* the editor's own `beginHistoryGroup()` there.
|
|
73
|
+
* - `collaboration-session-destroyed`: the session was destroyed.
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
type CollaborationUndoGroupErrorCode = 'undo-group-already-open' | 'editor-attached' | 'collaboration-session-destroyed';
|
|
77
|
+
/**
|
|
78
|
+
* Thrown by `beginUndoGroup` when the session cannot open a group. Branch on `code`.
|
|
79
|
+
* @public
|
|
72
80
|
*/
|
|
81
|
+
declare class CollaborationUndoGroupError extends Error {
|
|
82
|
+
/** Stable refusal code. */
|
|
83
|
+
readonly code: CollaborationUndoGroupErrorCode;
|
|
84
|
+
constructor(
|
|
85
|
+
/** Stable refusal code. */
|
|
86
|
+
code: CollaborationUndoGroupErrorCode);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* One open undo group of a collaboration session.
|
|
90
|
+
*
|
|
91
|
+
* Every local write the session publishes while the group is open becomes part of one undo
|
|
92
|
+
* step, however long the group stays open. `end()` closes the step, so the next write
|
|
93
|
+
* starts a new one, however soon it follows.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
interface CollaborationUndoGroup {
|
|
97
|
+
/** `closed` after `end()`, after the session is destroyed, or after an editor attaches. */
|
|
98
|
+
readonly state: 'open' | 'closed';
|
|
99
|
+
/**
|
|
100
|
+
* Publish committed local writes into the group, then close it. Reverts nothing. Safe to
|
|
101
|
+
* call more than once, and after the session is destroyed.
|
|
102
|
+
*
|
|
103
|
+
* Commands a runtime still queues are not committed yet. Call `end()` after
|
|
104
|
+
* `runtime.run()` resolves, so its last `context.sync()` lands inside the group.
|
|
105
|
+
*/
|
|
106
|
+
end(): void;
|
|
107
|
+
}
|
|
73
108
|
|
|
74
109
|
/**
|
|
75
110
|
* Full-document collaboration session: the engine-facing seam, the transport status a
|
|
@@ -105,7 +140,68 @@ interface DocumentCollaborationSession extends EditorCollaborationSession {
|
|
|
105
140
|
* schedule rather than per keystroke.
|
|
106
141
|
*/
|
|
107
142
|
resourceUsage(): CollaborationResourceUsage;
|
|
143
|
+
/**
|
|
144
|
+
* Open an explicit undo group: every local write this session publishes until `end()` is
|
|
145
|
+
* one undo step. For a server or headless replica, such as an agent's.
|
|
146
|
+
*
|
|
147
|
+
* Without a group, local writes that land within 500 ms of each other share one undo step.
|
|
148
|
+
* A group replaces that timing rule. Its first write starts a new step, however soon it
|
|
149
|
+
* follows the previous write. Its later writes join that step, however long the group
|
|
150
|
+
* stays open. The first write after `end()` starts a new step.
|
|
151
|
+
*
|
|
152
|
+
* Each boundary publishes the writes that are already committed. A runtime commits its
|
|
153
|
+
* queued commands only at `context.sync()`, so call `end()` after `runtime.run()` resolves,
|
|
154
|
+
* not inside the callback before its last sync.
|
|
155
|
+
*
|
|
156
|
+
* - Undo and redo refuse while the group is open: `undo()` and `redo()` return false, and
|
|
157
|
+
* `canUndo()` and `canRedo()` report false. {@link DocumentCollaborationSession.undoGroupOpen}
|
|
158
|
+
* tells this refusal apart from an empty history. End the group first.
|
|
159
|
+
* - A refused write does not end the group. Later writes join the same step as the
|
|
160
|
+
* earlier ones. To revert the whole operation, end the group and call `undo()` once.
|
|
161
|
+
* - Only local writes join the group. Other participants' edits stay out of it, and an
|
|
162
|
+
* undo of the group keeps them. It can also remove text that others typed in a
|
|
163
|
+
* paragraph the group inserted (#1398). When they removed everything the group wrote,
|
|
164
|
+
* its undo changes nothing and never reverts an older step.
|
|
165
|
+
* - An undo of an ungrouped step never reverts a group's step below it. Ungrouped history
|
|
166
|
+
* otherwise undoes as it does without groups. If a peer removed everything that the top
|
|
167
|
+
* ungrouped step wrote, that `undo()` changes nothing and returns true. Call `undo()`
|
|
168
|
+
* again to revert the group.
|
|
169
|
+
* - Destroying the session, or attaching an editor to it, closes an open group.
|
|
170
|
+
*
|
|
171
|
+
* @throws CollaborationUndoGroupError with `undo-group-already-open` when this session
|
|
172
|
+
* already has an open group, `editor-attached` when an editor that people edit through is
|
|
173
|
+
* attached (use the editor's `beginHistoryGroup()` there), or
|
|
174
|
+
* `collaboration-session-destroyed` after `destroy()`. Groups do not nest. Give each
|
|
175
|
+
* concurrent operation its own session.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* const group = session.beginUndoGroup();
|
|
180
|
+
* try {
|
|
181
|
+
* await runtime.run(async (context) => {
|
|
182
|
+
* context.document.body.insertParagraph('Task A', 'End');
|
|
183
|
+
* await context.sync();
|
|
184
|
+
* });
|
|
185
|
+
* } finally {
|
|
186
|
+
* group.end();
|
|
187
|
+
* }
|
|
188
|
+
* session.undo(); // reverts Task A only
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
beginUndoGroup(): CollaborationUndoGroup;
|
|
192
|
+
/** Whether an undo group from {@link DocumentCollaborationSession.beginUndoGroup} is open. */
|
|
193
|
+
readonly undoGroupOpen: boolean;
|
|
108
194
|
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Full-document collaboration over the canonical primitive journal.
|
|
198
|
+
*
|
|
199
|
+
* Local direction: the canonical store commits, emits ONE journal, and the journal is applied
|
|
200
|
+
* to shared state in one Yjs transaction. Remote direction: a shared-state change materializes
|
|
201
|
+
* one canonical package, which the port publishes as one revision. The two never chase each
|
|
202
|
+
* other, because a remote publication deliberately emits no journal.
|
|
203
|
+
*/
|
|
204
|
+
|
|
109
205
|
/** Owned full-document collaboration replica. @public */
|
|
110
206
|
type DocumentCollaborationHandle = CollaborationHandle<DocumentCollaborationSession>;
|
|
111
207
|
|
|
@@ -142,5 +238,5 @@ type DocumentCollaborationHandle = CollaborationHandle<DocumentCollaborationSess
|
|
|
142
238
|
*/
|
|
143
239
|
declare function createDocumentCollaboration(options: CreateDocumentCollaborationOptions): Promise<DocumentCollaborationHandle>;
|
|
144
240
|
|
|
145
|
-
export { createDocumentCollaboration as
|
|
146
|
-
export type { CollaborationResourceUsage as C, DocumentCollaborationHandle as D,
|
|
241
|
+
export { CollaborationUndoGroupError as b, createDocumentCollaboration as e, readCollaborationResourceUsage as r };
|
|
242
|
+
export type { CollaborationResourceUsage as C, DocumentCollaborationHandle as D, CollaborationUndoGroup as a, CollaborationUndoGroupErrorCode as c, DocumentCollaborationSession as d };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{q as ATTACH_WATCHDOG_MS_FOR_TESTS,r as createDocumentCollaboration,p as readCollaborationDocument}from'./chunk-GAGYRL3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkYOWEY5F3_cjs=require('./chunk-YOWEY5F3.cjs');Object.defineProperty(exports,"ATTACH_WATCHDOG_MS_FOR_TESTS",{enumerable:true,get:function(){return chunkYOWEY5F3_cjs.q}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunkYOWEY5F3_cjs.r}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunkYOWEY5F3_cjs.p}});
|
package/dist/{document-session-options-DelOC7PX.d.ts → document-session-options-CdOH-TNn.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import { Awareness } from 'y-protocols/awareness';
|
|
3
3
|
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
-
import { a as CollaborationBootstrap } from './types-
|
|
4
|
+
import { a as CollaborationBootstrap } from './types-DvGpDOcZ.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Options for one full-document collaboration replica.
|
package/dist/{document-session-options-CfKypp9c.d.cts → document-session-options-CxR0F5xT.d.cts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import { Awareness } from 'y-protocols/awareness';
|
|
3
3
|
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
-
import { a as CollaborationBootstrap } from './types-
|
|
4
|
+
import { a as CollaborationBootstrap } from './types-DvGpDOcZ.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Options for one full-document collaboration replica.
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkI6HVINA4_cjs=require('./chunk-I6HVINA4.cjs'),chunkQLZH2Q2C_cjs=require('./chunk-QLZH2Q2C.cjs'),store=require('@docx-editor.dev/core/store');function U(t,n={}){let r=L(t);if(!r)return [];let o=n.nodes??t.getCustomNodeDefinitions().filter(chunkI6HVINA4_cjs.j);if(o.length===0)return [];let s=r.session.currentPackage(),d=r.session.part().name,m=n.onDiagnostic??(e=>{t.reportCustomNodeDiagnostic(e);});return r.session.storyParts().flatMap(e=>chunkI6HVINA4_cjs.n(e,o,{payloads:store.customNodePayloadsByControl(s,e.name,d),onDiagnostic:m}))}function L(t){return t.surface??null}function E(t,n,r={}){if(r.destination==="internal")return {ok:true,bytes:t,unwrapped:0,removed:0};let o=store.readOoxmlPackage(t);if(!o.ok)return {ok:false,reason:`the document could not be read: ${o.reason}`};let s=new Map;for(let i of n)s.set(`${i.tagPrefix}:${i.name}`,i);let d=i=>{let p=chunkI6HVINA4_cjs.c(i);if(!p)return "keep";let x=s.get(`${p.prefix}:${p.name}`);return x?x.preserveOnExport==="text"?"text":x.preserveOnExport===false?"remove":"keep":"keep"},m=[...new Set(n.filter(i=>i.preserveOnExport!==void 0).filter(i=>i.preserveOnExport!==true).map(chunkI6HVINA4_cjs.h))],e=o.package,u=0,c=0,g=V(e);for(let i of g){let p=store.withExportedCustomNodes(e,{storyPartName:i,namespaces:[],decide:d});if(!p.ok)return {ok:false,reason:p.reason};e=p.pkg,u+=p.unwrapped,c+=p.removed;}let l=store.withExportedCustomNodes(e,{storyPartName:e.mainDocumentPart,namespaces:m,decide:()=>"keep"});return l.ok?(e=l.pkg,{ok:true,bytes:store.writeOoxmlPackage(e),unwrapped:u,removed:c}):{ok:false,reason:l.reason}}function V(t){let n=[];for(let[r,o]of t.parts)r!==t.mainDocumentPart&&store.isStoryPart(o)&&n.push(r);return [t.mainDocumentPart,...n]}async function G(t,n={}){let r=n.nodes??t.getCustomNodeDefinitions().filter(chunkI6HVINA4_cjs.j),o=await t.save();return E(new Uint8Array(o),r,{...n.destination===void 0?{}:{destination:n.destination}})}function a(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function K(t,n,r,o={}){if(!chunkI6HVINA4_cjs.k.test(t.tagPrefix)||!chunkI6HVINA4_cjs.k.test(t.name))return {ok:false,code:"invalidArgs",reason:"the definition identity must match defineCustomNode\u2019s charset ([A-Za-z0-9_.-])"};let s=chunkI6HVINA4_cjs.b(t.tagPrefix,t.name,n);if(!s.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${s.length} characters; Word caps w:tag at 64 \u2014 shorten the attrs`};let d=o.lock===void 0?"contentLocked":o.lock,m=o.id!==void 0&&Number.isInteger(o.id)&&o.id>0?o.id:store.fnv1a32(`${s.tag}\0${r}`)&2147483647||1,e=o.data===void 0?null:Q(t,o,r);if(e&&"reason"in e)return {ok:false,code:"invalidArgs",reason:e.reason};let u=(o.alias!==void 0?`<w:alias w:val="${a(o.alias)}"/>`:"")+`<w:tag w:val="${a(s.tag)}"/><w:id w:val="${m}"/>`+(d===false?"":`<w:lock w:val="${d}"/>`)+(e?`<w:dataBinding w:prefixMappings="${a(e.binding.prefixMappings)}" w:xpath="${a(e.binding.xpath)}" w:storeItemID="${a(e.binding.storeItemId)}"/>`:""),c=`<w:r><w:t xml:space="preserve">${a(r)}</w:t></w:r>`;return {ok:true,xml:`<w:sdt><w:sdtPr>${u}</w:sdtPr><w:sdtContent>${c}</w:sdtContent></w:sdt>`,...e?{store:e.store}:{}}}function Q(t,n,r){let o=chunkI6HVINA4_cjs.i(t,n.data);if(!o.ok)return {reason:o.reason};let s=chunkI6HVINA4_cjs.h(t),d=n.storeIndex!==void 0&&Number.isInteger(n.storeIndex)&&n.storeIndex>0?n.storeIndex:1,m=n.nodeId??"cx1",e=`/customXml/item${String(d)}.xml`,u=`/customXml/itemProps${String(d)}.xml`,c=store.datastoreItemIdFor(`${s} ${e} ${m}`),g=store.customNodeBinding({partName:e,propsPartName:u,itemId:c,namespaceUri:s},chunkI6HVINA4_cjs.g,m);if(!g)return {reason:`the payload cannot be addressed by an XPath: check nodeId (${m}) and payloadNamespace`};let l=r===r.trim()?`<label>${a(r)}</label>`:`<label xml:space="preserve">${a(r)}</label>`;return {binding:g,store:{itemPartName:e,itemXml:`<${chunkI6HVINA4_cjs.g} xmlns="${a(s)}"><node id="${a(m)}">${l}<data>${a(o.data)}</data></node></${chunkI6HVINA4_cjs.g}>`,propsPartName:u,propsXml:`<ds:datastoreItem ds:itemID="${a(c)}" xmlns:ds="${store.DATASTORE_NAMESPACE_URI}"><ds:schemaRefs><ds:schemaRef ds:uri="${a(s)}"/></ds:schemaRefs></ds:datastoreItem>`,storeItemId:c,relationships:[{from:"/word/document.xml",type:store.CUSTOM_XML_REL,target:`../customXml/item${String(d)}.xml`},{from:e,type:store.CUSTOM_XML_PROPS_REL,target:`itemProps${String(d)}.xml`}],contentTypeOverride:{partName:u,contentType:store.CUSTOM_XML_PROPS_TYPE}}}}Object.defineProperty(exports,"CUSTOM_NODE_STORE_ROOT",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.g}});Object.defineProperty(exports,"MAX_CUSTOM_NODE_DATA_LENGTH",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.d}});Object.defineProperty(exports,"MAX_TAG_LENGTH",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.a}});Object.defineProperty(exports,"customNodeNamespace",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.h}});Object.defineProperty(exports,"customNodesModule",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.m}});Object.defineProperty(exports,"decodeCustomNodeTag",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.c}});Object.defineProperty(exports,"defineCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.l}});Object.defineProperty(exports,"encodeCustomNodeTag",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.b}});Object.defineProperty(exports,"insertCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.p}});Object.defineProperty(exports,"isCustomNodeDefinition",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.j}});Object.defineProperty(exports,"parseCustomNodeData",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.e}});Object.defineProperty(exports,"recognizeCustomNodes",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.n}});Object.defineProperty(exports,"removeCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.q}});Object.defineProperty(exports,"reviewModule",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.o}});Object.defineProperty(exports,"serializeCustomNodeData",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.f}});Object.defineProperty(exports,"updateCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.r}});Object.defineProperty(exports,"collaborationModule",{enumerable:true,get:function(){return chunkQLZH2Q2C_cjs.b}});exports.customNodeXml=K;exports.customNodesOf=U;exports.prepareForExport=E;exports.saveForExport=G;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {j,n,h,k,b,i,g,c}from'./chunk-
|
|
1
|
+
import {j,n,h,k,b,i,g,c}from'./chunk-AVZO5ZHZ.js';export{g as CUSTOM_NODE_STORE_ROOT,d as MAX_CUSTOM_NODE_DATA_LENGTH,a as MAX_TAG_LENGTH,h as customNodeNamespace,m as customNodesModule,c as decodeCustomNodeTag,l as defineCustomNode,b as encodeCustomNodeTag,p as insertCustomNode,j as isCustomNodeDefinition,e as parseCustomNodeData,n as recognizeCustomNodes,q as removeCustomNode,o as reviewModule,f as serializeCustomNodeData,r as updateCustomNode}from'./chunk-AVZO5ZHZ.js';export{b as collaborationModule}from'./chunk-Q2VBO66F.js';import {customNodePayloadsByControl,readOoxmlPackage,withExportedCustomNodes,writeOoxmlPackage,isStoryPart,fnv1a32,datastoreItemIdFor,customNodeBinding,CUSTOM_XML_PROPS_TYPE,CUSTOM_XML_REL,CUSTOM_XML_PROPS_REL,DATASTORE_NAMESPACE_URI}from'@docx-editor.dev/core/store';function U(t,n$1={}){let r=L(t);if(!r)return [];let o=n$1.nodes??t.getCustomNodeDefinitions().filter(j);if(o.length===0)return [];let s=r.session.currentPackage(),d=r.session.part().name,m=n$1.onDiagnostic??(e=>{t.reportCustomNodeDiagnostic(e);});return r.session.storyParts().flatMap(e=>n(e,o,{payloads:customNodePayloadsByControl(s,e.name,d),onDiagnostic:m}))}function L(t){return t.surface??null}function E(t,n,r={}){if(r.destination==="internal")return {ok:true,bytes:t,unwrapped:0,removed:0};let o=readOoxmlPackage(t);if(!o.ok)return {ok:false,reason:`the document could not be read: ${o.reason}`};let s=new Map;for(let i of n)s.set(`${i.tagPrefix}:${i.name}`,i);let d=i=>{let p=c(i);if(!p)return "keep";let x=s.get(`${p.prefix}:${p.name}`);return x?x.preserveOnExport==="text"?"text":x.preserveOnExport===false?"remove":"keep":"keep"},m=[...new Set(n.filter(i=>i.preserveOnExport!==void 0).filter(i=>i.preserveOnExport!==true).map(h))],e=o.package,u=0,c$1=0,g=V(e);for(let i of g){let p=withExportedCustomNodes(e,{storyPartName:i,namespaces:[],decide:d});if(!p.ok)return {ok:false,reason:p.reason};e=p.pkg,u+=p.unwrapped,c$1+=p.removed;}let l=withExportedCustomNodes(e,{storyPartName:e.mainDocumentPart,namespaces:m,decide:()=>"keep"});return l.ok?(e=l.pkg,{ok:true,bytes:writeOoxmlPackage(e),unwrapped:u,removed:c$1}):{ok:false,reason:l.reason}}function V(t){let n=[];for(let[r,o]of t.parts)r!==t.mainDocumentPart&&isStoryPart(o)&&n.push(r);return [t.mainDocumentPart,...n]}async function G(t,n={}){let r=n.nodes??t.getCustomNodeDefinitions().filter(j),o=await t.save();return E(new Uint8Array(o),r,{...n.destination===void 0?{}:{destination:n.destination}})}function a(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function K(t,n,r,o={}){if(!k.test(t.tagPrefix)||!k.test(t.name))return {ok:false,code:"invalidArgs",reason:"the definition identity must match defineCustomNode\u2019s charset ([A-Za-z0-9_.-])"};let s=b(t.tagPrefix,t.name,n);if(!s.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${s.length} characters; Word caps w:tag at 64 \u2014 shorten the attrs`};let d=o.lock===void 0?"contentLocked":o.lock,m=o.id!==void 0&&Number.isInteger(o.id)&&o.id>0?o.id:fnv1a32(`${s.tag}\0${r}`)&2147483647||1,e=o.data===void 0?null:Q(t,o,r);if(e&&"reason"in e)return {ok:false,code:"invalidArgs",reason:e.reason};let u=(o.alias!==void 0?`<w:alias w:val="${a(o.alias)}"/>`:"")+`<w:tag w:val="${a(s.tag)}"/><w:id w:val="${m}"/>`+(d===false?"":`<w:lock w:val="${d}"/>`)+(e?`<w:dataBinding w:prefixMappings="${a(e.binding.prefixMappings)}" w:xpath="${a(e.binding.xpath)}" w:storeItemID="${a(e.binding.storeItemId)}"/>`:""),c=`<w:r><w:t xml:space="preserve">${a(r)}</w:t></w:r>`;return {ok:true,xml:`<w:sdt><w:sdtPr>${u}</w:sdtPr><w:sdtContent>${c}</w:sdtContent></w:sdt>`,...e?{store:e.store}:{}}}function Q(t,n,r){let o=i(t,n.data);if(!o.ok)return {reason:o.reason};let s=h(t),d=n.storeIndex!==void 0&&Number.isInteger(n.storeIndex)&&n.storeIndex>0?n.storeIndex:1,m=n.nodeId??"cx1",e=`/customXml/item${String(d)}.xml`,u=`/customXml/itemProps${String(d)}.xml`,c=datastoreItemIdFor(`${s} ${e} ${m}`),g$1=customNodeBinding({partName:e,propsPartName:u,itemId:c,namespaceUri:s},g,m);if(!g$1)return {reason:`the payload cannot be addressed by an XPath: check nodeId (${m}) and payloadNamespace`};let l=r===r.trim()?`<label>${a(r)}</label>`:`<label xml:space="preserve">${a(r)}</label>`;return {binding:g$1,store:{itemPartName:e,itemXml:`<${g} xmlns="${a(s)}"><node id="${a(m)}">${l}<data>${a(o.data)}</data></node></${g}>`,propsPartName:u,propsXml:`<ds:datastoreItem ds:itemID="${a(c)}" xmlns:ds="${DATASTORE_NAMESPACE_URI}"><ds:schemaRefs><ds:schemaRef ds:uri="${a(s)}"/></ds:schemaRefs></ds:datastoreItem>`,storeItemId:c,relationships:[{from:"/word/document.xml",type:CUSTOM_XML_REL,target:`../customXml/item${String(d)}.xml`},{from:e,type:CUSTOM_XML_PROPS_REL,target:`itemProps${String(d)}.xml`}],contentTypeOverride:{partName:u,contentType:CUSTOM_XML_PROPS_TYPE}}}}export{K as customNodeXml,U as customNodesOf,E as prepareForExport,G as saveForExport};
|
|
@@ -11,8 +11,8 @@ import * as Y from 'yjs';
|
|
|
11
11
|
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
12
12
|
import { CollaborationIdentity, CollaborationFailure } from '@docx-editor.dev/core/collaboration';
|
|
13
13
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
14
|
-
import { a as CollaborationBootstrap, C as CollaborationSession } from '../types-
|
|
15
|
-
export { b as CollaborationIdentityUpdate } from '../types-
|
|
14
|
+
import { a as CollaborationBootstrap, C as CollaborationSession } from '../types-DvGpDOcZ.cjs';
|
|
15
|
+
export { b as CollaborationIdentityUpdate } from '../types-DvGpDOcZ.cjs';
|
|
16
16
|
|
|
17
17
|
/** Bootstrap for one Hocuspocus room. @public */
|
|
18
18
|
type UseHocuspocusCollaborationBootstrap = CollaborationBootstrap;
|
|
@@ -11,8 +11,8 @@ import * as Y from 'yjs';
|
|
|
11
11
|
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
12
12
|
import { CollaborationIdentity, CollaborationFailure } from '@docx-editor.dev/core/collaboration';
|
|
13
13
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
14
|
-
import { a as CollaborationBootstrap, C as CollaborationSession } from '../types-
|
|
15
|
-
export { b as CollaborationIdentityUpdate } from '../types-
|
|
14
|
+
import { a as CollaborationBootstrap, C as CollaborationSession } from '../types-DvGpDOcZ.js';
|
|
15
|
+
export { b as CollaborationIdentityUpdate } from '../types-DvGpDOcZ.js';
|
|
16
16
|
|
|
17
17
|
/** Bootstrap for one Hocuspocus room. @public */
|
|
18
18
|
type UseHocuspocusCollaborationBootstrap = CollaborationBootstrap;
|