@docx-editor.dev/pro 2.26.0 → 2.28.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/dist/chunk-CNXDNDD3.js +1 -0
- package/dist/chunk-FD2KDBHX.cjs +1 -0
- package/dist/chunk-JRHEYVVY.cjs +1 -0
- package/dist/chunk-L567WP3J.js +5 -0
- package/dist/chunk-MJECUVHQ.cjs +5 -0
- package/dist/chunk-MWO2ZUEJ.js +1 -0
- package/dist/chunk-N34IUO36.cjs +1 -0
- package/dist/chunk-OT5R3IYV.cjs +1 -0
- package/dist/chunk-P2EF7WMV.js +1 -0
- package/dist/chunk-Q5JTCGJI.js +1 -0
- package/dist/chunk-SNQCYZLT.js +1 -0
- package/dist/chunk-ZSAAX6HV.cjs +1 -0
- package/dist/collaboration/hocuspocus.cjs +1 -1
- package/dist/collaboration/hocuspocus.d.cts +18 -11
- package/dist/collaboration/hocuspocus.d.ts +18 -11
- package/dist/collaboration/hocuspocus.js +1 -1
- package/dist/collaboration/index.cjs +2 -2
- package/dist/collaboration/index.d.cts +333 -18
- package/dist/collaboration/index.d.ts +333 -18
- package/dist/collaboration/index.js +2 -2
- package/dist/collaboration/webrtc.cjs +2 -2
- package/dist/collaboration/webrtc.d.cts +26 -3
- package/dist/collaboration/webrtc.d.ts +26 -3
- package/dist/collaboration/webrtc.js +2 -2
- package/dist/{collaboration-module-DlSv0oAd.d.cts → collaboration-module-DWn2heE1.d.cts} +1 -0
- package/dist/{collaboration-module-DlSv0oAd.d.ts → collaboration-module-DWn2heE1.d.ts} +1 -0
- package/dist/{define-custom-node-DA6UEXID.d.ts → define-custom-node-CNRQG1TI.d.cts} +14 -4
- package/dist/{define-custom-node-CkjSwcxy.d.cts → define-custom-node-D0c36PpZ.d.ts} +14 -4
- package/dist/document-session-3VC43WNI.cjs +1 -0
- package/dist/{document-session-BKKfJzKB.d.cts → document-session-Bxs4_GgX.d.ts} +55 -33
- package/dist/document-session-J2YKWERI.js +1 -0
- package/dist/{document-session-BQ4nBDTd.d.ts → document-session-_v9vqiSX.d.cts} +55 -33
- package/dist/document-session-options-CfKypp9c.d.cts +37 -0
- package/dist/document-session-options-DelOC7PX.d.ts +37 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +1 -1
- package/dist/react/hocuspocus.cjs +1 -1
- package/dist/react/hocuspocus.d.cts +52 -8
- package/dist/react/hocuspocus.d.ts +52 -8
- package/dist/react/hocuspocus.js +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +354 -156
- package/dist/react/index.d.ts +354 -156
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.cjs +1 -1
- package/dist/react/webrtc.d.cts +35 -7
- package/dist/react/webrtc.d.ts +35 -7
- package/dist/react/webrtc.js +1 -1
- package/dist/{session-okdqygLg.d.cts → types-6EmrEn4n.d.cts} +26 -4
- package/dist/{session-okdqygLg.d.ts → types-6EmrEn4n.d.ts} +26 -4
- package/dist/{session-B-ds4k64.d.cts → types-BQ1vBt5Q.d.cts} +32 -54
- package/dist/{session-B-ds4k64.d.ts → types-BQ1vBt5Q.d.ts} +32 -54
- package/dist/vue/hocuspocus.cjs +1 -1
- package/dist/vue/hocuspocus.d.cts +52 -7
- package/dist/vue/hocuspocus.d.ts +52 -7
- package/dist/vue/hocuspocus.js +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +237 -24
- package/dist/vue/index.d.ts +237 -24
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.d.cts +36 -6
- package/dist/vue/webrtc.d.ts +36 -6
- package/dist/vue/webrtc.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-3JW4VNG5.js +0 -4
- package/dist/chunk-GDTCNTK7.cjs +0 -1
- package/dist/chunk-HJB77VBO.js +0 -1
- package/dist/chunk-JDLJS5RD.cjs +0 -4
- package/dist/chunk-MRW46GJW.js +0 -4
- package/dist/chunk-OMUXC73J.cjs +0 -1
- package/dist/chunk-PQNLQ2P2.js +0 -1
- package/dist/chunk-Q4YPX2DT.cjs +0 -1
- package/dist/chunk-VCMQFPO2.cjs +0 -4
- package/dist/chunk-W3V54DWZ.js +0 -1
- package/dist/document-session-6X24KXAM.js +0 -1
- package/dist/document-session-BDVKTCYX.js +0 -1
- package/dist/document-session-NECF3VT6.cjs +0 -1
- package/dist/document-session-RKQQLHEL.cjs +0 -1
- package/dist/hocuspocus-BCQPTL3M.cjs +0 -1
- package/dist/hocuspocus-QIIKEK6J.js +0 -1
- package/dist/webrtc-54VKWBFN.js +0 -2
- package/dist/webrtc-TIHZFB4K.cjs +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {
|
|
2
|
-
export{
|
|
1
|
+
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {q}from'../chunk-L567WP3J.js';import*as H from'yjs';import {Awareness}from'y-protocols/awareness';import {WebrtcProvider}from'y-webrtc';function U(e,n){let t=0,r=null,i=new Set,l=()=>{r!==null&&clearInterval(r),r=null;},o=d=>{if(d!==t){t=d,t===0&&l();for(let b of [...i])b();}},c=()=>{let d=n.room;if(d===null)return false;if(d.bcConns.size>0)return true;for(let b of d.webrtcConns.values())if(b.connected&&b.synced)return true;return false},u=()=>{t>0&&c()&&o(0);},m=(d,b)=>{b===n.room||c()||(o(t+1),r??=setInterval(u,1e3));};return e.on("update",m),n.on("peers",u),n.on("synced",u),{count:()=>t,subscribe(d){return i.add(d),()=>{i.delete(d);}},destroy(){l(),e.off("update",m),n.off("peers",u),n.off("synced",u),i.clear();}}}var x=new WeakSet,R=(e,n)=>(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,C=(e,n,t)=>{e[n]=t>>>24&255,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=t&255;},G=e=>e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null,K=e=>new Promise(n=>{setTimeout(n,e);});function B(e,n){if(x.has(e))return;x.add(e);let t=e.send.bind(e),r=e._onChannelMessage.bind(e),i=n?.partialTimeoutMs,l=typeof i=="number"&&Number.isFinite(i)&&i>0?i:3e4,o=n?.onAbandonedMessage,c=n?.onDeliveredMessage,u=Math.min(n?.maxPartialBytes??1/0,134111232),m=[],d=new Map,b=false,_=1,p=0,M=(s,a)=>{a.timer!==void 0&&clearTimeout(a.timer),d.delete(s),p-=a.bytes;},S=s=>{let a=d.get(s);a&&(M(s,a),e.destroyed!==true&&(o?.(),e.destroy?.()));},y=s=>{let a=d.get(s);a&&(a.timer!==void 0&&clearTimeout(a.timer),a.timer=setTimeout(()=>{S(s);},l));},v=()=>e._channel?.bufferedAmount??0,O=async()=>{let s=0;for(;v()>1048576;){if(e.destroyed===true||s>=3e4)return false;await K(20),s+=20;}return e.destroyed!==true},N=async s=>{let a=Math.ceil(s.byteLength/16371);if(a>8192)throw new Error(`collaboration message needs ${a} chunks, above the 8192 limit`);let h=_;_=_+1>>>0||1;for(let E=0;E<a;E+=1){if(!await O()){e.destroyed!==true&&e.destroy?.();return}let A=E*16371,f=s.subarray(A,Math.min(A+16371,s.byteLength)),g=new Uint8Array(13+f.byteLength);g[0]=251,C(g,1,h),C(g,5,E),C(g,9,a),g.set(f,13),t(g);}},W=async()=>{if(!b){b=true;try{for(;m.length>0;){let s=m.shift();if(s){if(e.destroyed===!0)return;await N(s);}}}finally{b=false;}}};e.send=s=>{if(typeof s=="string"||s.byteLength<=16371){t(s);return}m.push(s),W();},e._onChannelMessage=s=>{let a=G(s.data);if(!a||a.byteLength<13||a[0]!==251){r(s);return}let h=R(a,1),E=R(a,5),A=R(a,9);if(A===0||A>8192||E>=A)return;if(a.byteLength>16384){S(h);return}let f=d.get(h);if(!f){if(d.size>=4){let T=d.keys().next();T.done||S(T.value);}f={chunks:new Array(A),count:A,received:0,bytes:0,timer:void 0},d.set(h,f);}if(f.count!==A||f.chunks[E])return;let g=a.subarray(13);if(f.chunks[E]=g,f.received+=1,f.bytes+=g.byteLength,p+=g.byteLength,p>u){S(h);return}if(f.received!==f.count){y(h);return}M(h,f);let k=new Uint8Array(f.bytes),L=0;for(let T of f.chunks){if(!T)return;k.set(T,L),L+=T.byteLength;}e.destroyed!==true&&(e.push(k),c?.());};}function F(e,n){return t=>{n()&&(t?e.setTransportStatus("ready","transport-disconnected","a peer link cannot carry large updates"):e.setTransportStatus("ready"));}}var z=3,j=6e4;function Y(e,n={set:(t,r)=>setTimeout(t,r),clear:t=>clearTimeout(t)}){let t=new Map,r=new Map,i=new Set,l=o=>{t.delete(o);let c=r.get(o);c!==void 0&&n.clear(c),r.delete(o),i.delete(o)&&i.size===0&&e(false);};return {abandoned(o){let c=(t.get(o)??0)+1;t.set(o,c);let u=r.get(o);u!==void 0&&n.clear(u),r.set(o,n.set(()=>l(o),j)),!(c<z||i.has(o))&&(i.add(o),i.size===1&&e(true));},delivered:l,reset(){for(let o of [...t.keys(),...i])l(o);},destroy(){for(let o of r.values())n.clear(o);r.clear(),t.clear(),i.clear();}}}var Z=Object.freeze(["wss://turn.0docker.com/ws"]),P=false;function J(e){e===void 0&&(P||(P=true,console.warn("[docx-editor] createWebrtcCollaboration was called without `signaling`, so it uses the public demo endpoints. They are shared, unauthenticated, and can go away. Pass your own `signaling` URLs (and TURN `iceServers`) in production, or pass `signaling: DEMO_SIGNALING_ENDPOINTS` explicitly to accept the demo endpoints.")));}function fe(){P=false;}var Q=/^[A-Za-z0-9_-]{24,256}$/,I="#collab=";function V(e){let n=e.password?.trim()??"";return n.length>0?n:ee(e.href)}var ee=e=>{let n=e??(typeof globalThis.location=="object"&&globalThis.location!==null?String(globalThis.location.href??""):"");if(n.length===0)return;let t;try{t=new URL(n).hash;}catch{return}if(!t.startsWith(I))return;let r;try{r=decodeURIComponent(t.slice(I.length));}catch{return}if(Q.test(r))return r},ne=(e,n)=>{Promise.resolve(e.key).then(()=>{let t=e.room;if(!t)return;let r=t.webrtcConns,i=(o,c)=>{B(c.peer,{onAbandonedMessage:()=>n.abandoned(o),onDeliveredMessage:()=>n.delivered(o)});};for(let[o,c]of r)i(o,c);let l=r.set.bind(r);r.set=(o,c)=>(i(o,c),l(o,c));});};async function ye(e){let n=b(e.roomId);J(e.signaling);let t=V({password:e.password}),r=new H.Doc,i=new Awareness(r),l=null,o={abandoned(){},delivered(){}},c=()=>{let y=new WebrtcProvider(n,r,{awareness:i,signaling:[...e.signaling??Z],...t!==void 0?{password:t}:{},...e.iceServers?{peerOpts:{config:{iceServers:e.iceServers.map(v=>({...v}))}}}:{}});return ne(y,{abandoned:v=>o.abandoned(v),delivered:v=>o.delivered(v)}),y},u;try{e.bootstrap.kind!=="create"&&(l=c()),u=await q({ydoc:r,awareness:i,documentId:n,identity:e.identity,bootstrap:e.bootstrap,offlineEditing:e.offlineEditing}),l||(l=c());}catch(y){throw l?.destroy(),i.destroy(),r.destroy(),y}if(!l)throw u.destroy(),i.destroy(),r.destroy(),new Error("WebRTC provider did not initialize");let m=l,d=u.session,b$1=true,_=Y(F(d,()=>b$1));o=_;let p=y=>{b$1=y.connected,y.connected&&_.reset(),d.setTransportStatus(y.connected?"ready":"disconnected",y.connected?void 0:"transport-disconnected",y.connected?void 0:"webrtc disconnected");};m.on("status",p);let M=U(r,m),S=false;return Object.freeze({document:u.document,session:d,ydoc:r,provider:m,unsyncedChanges:()=>M.count(),subscribeUnsyncedChanges:y=>M.subscribe(y),destroy(){S||(S=true,m.off("status",p),M.destroy(),_.destroy(),u.destroy(),m.destroy(),i.destroy(),r.destroy());}})}
|
|
2
|
+
export{Z as DEMO_SIGNALING_ENDPOINTS,ye as createWebrtcCollaboration,fe as resetDemoSignalingWarningForTests,V as resolveWebrtcRoomPassword,J as warnOnDemoSignalingFallback};
|
|
@@ -37,6 +37,7 @@ interface ProLicenseOptions {
|
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
39
|
interface CollaborationModuleOptions extends ProLicenseOptions {
|
|
40
|
+
/** The session from a collaboration factory. The editor attaches its document port to it. */
|
|
40
41
|
readonly session: EditorCollaborationSession;
|
|
41
42
|
}
|
|
42
43
|
/** Build the collaboration module. Construction never validates the key and never touches the network. */
|
|
@@ -37,6 +37,7 @@ interface ProLicenseOptions {
|
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
39
|
interface CollaborationModuleOptions extends ProLicenseOptions {
|
|
40
|
+
/** The session from a collaboration factory. The editor attaches its document port to it. */
|
|
40
41
|
readonly session: EditorCollaborationSession;
|
|
41
42
|
}
|
|
42
43
|
/** Build the collaboration module. Construction never validates the key and never touches the network. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
-
import { P as ProLicenseOptions } from './collaboration-module-
|
|
1
|
+
import { ReviewPaneOptions, EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
+
import { P as ProLicenseOptions } from './collaboration-module-DWn2heE1.cjs';
|
|
3
3
|
import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,12 +13,20 @@ import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* How {@link reviewModule} is configured.
|
|
17
|
-
*
|
|
16
|
+
* How {@link reviewModule} is configured. Every field is optional, so `reviewModule()`
|
|
17
|
+
* with no argument is the ordinary call.
|
|
18
18
|
*
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
interface ReviewModuleOptions extends ProLicenseOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The review pane settings the editor starts with. Change them later with
|
|
24
|
+
* `editor.setReviewPaneOptions()`, and read them from `snapshot.reviewPane`. Pass
|
|
25
|
+
* `{ opening: 'manual' }` when the host shows review items its own way, for example in
|
|
26
|
+
* balloons or margin markers, and opens the pane only on demand. An unknown field or
|
|
27
|
+
* value throws a `TypeError`.
|
|
28
|
+
*/
|
|
29
|
+
readonly pane?: ReviewPaneOptions;
|
|
22
30
|
}
|
|
23
31
|
/** Build the review module. Construction never validates the key and never touches the network. */
|
|
24
32
|
declare function reviewModule(options?: ReviewModuleOptions): EditorModule;
|
|
@@ -267,6 +275,8 @@ interface CustomNodeDefinition<Schema extends StandardSchemaV1 | undefined = any
|
|
|
267
275
|
/**
|
|
268
276
|
* Contribute a card to the review sidebar for every recognized node of this
|
|
269
277
|
* definition, anchored at the node's range. Return null to skip one node.
|
|
278
|
+
* Without this hook the node has no card: it never becomes the active review
|
|
279
|
+
* item, so placing the cursor inside it shows no active highlight.
|
|
270
280
|
*
|
|
271
281
|
* `attrs` and `text` originate in the file — untrusted; the returned strings
|
|
272
282
|
* are rendered as TEXT by the pane, never markup. The context-menu section
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
-
import { P as ProLicenseOptions } from './collaboration-module-
|
|
1
|
+
import { ReviewPaneOptions, EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
+
import { P as ProLicenseOptions } from './collaboration-module-DWn2heE1.js';
|
|
3
3
|
import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,12 +13,20 @@ import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* How {@link reviewModule} is configured.
|
|
17
|
-
*
|
|
16
|
+
* How {@link reviewModule} is configured. Every field is optional, so `reviewModule()`
|
|
17
|
+
* with no argument is the ordinary call.
|
|
18
18
|
*
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
interface ReviewModuleOptions extends ProLicenseOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The review pane settings the editor starts with. Change them later with
|
|
24
|
+
* `editor.setReviewPaneOptions()`, and read them from `snapshot.reviewPane`. Pass
|
|
25
|
+
* `{ opening: 'manual' }` when the host shows review items its own way, for example in
|
|
26
|
+
* balloons or margin markers, and opens the pane only on demand. An unknown field or
|
|
27
|
+
* value throws a `TypeError`.
|
|
28
|
+
*/
|
|
29
|
+
readonly pane?: ReviewPaneOptions;
|
|
22
30
|
}
|
|
23
31
|
/** Build the review module. Construction never validates the key and never touches the network. */
|
|
24
32
|
declare function reviewModule(options?: ReviewModuleOptions): EditorModule;
|
|
@@ -267,6 +275,8 @@ interface CustomNodeDefinition<Schema extends StandardSchemaV1 | undefined = any
|
|
|
267
275
|
/**
|
|
268
276
|
* Contribute a card to the review sidebar for every recognized node of this
|
|
269
277
|
* definition, anchored at the node's range. Return null to skip one node.
|
|
278
|
+
* Without this hook the node has no card: it never becomes the active review
|
|
279
|
+
* item, so placing the cursor inside it shows no active highlight.
|
|
270
280
|
*
|
|
271
281
|
* `attrs` and `text` originate in the file — untrusted; the returned strings
|
|
272
282
|
* are rendered as TEXT by the pane, never markup. The context-menu section
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkMJECUVHQ_cjs=require('./chunk-MJECUVHQ.cjs');Object.defineProperty(exports,"ATTACH_WATCHDOG_MS_FOR_TESTS",{enumerable:true,get:function(){return chunkMJECUVHQ_cjs.p}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunkMJECUVHQ_cjs.q}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunkMJECUVHQ_cjs.o}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { EditorCollaborationSession, CollaborationFailureCode } from '@docx-editor.dev/core/collaboration';
|
|
1
2
|
import * as Y from 'yjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as CollaborationBootstrap, c as CollaborationHandle, e as TextCollaborationSession, b as CollaborationIdentityUpdate } from './session-B-ds4k64.cjs';
|
|
3
|
+
import { c as CollaborationHandle, b as CollaborationIdentityUpdate } from './types-BQ1vBt5Q.js';
|
|
4
|
+
import { C as CreateDocumentCollaborationOptions } from './document-session-options-DelOC7PX.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Room-size observability.
|
|
@@ -29,14 +29,27 @@ interface CollaborationResourceUsage {
|
|
|
29
29
|
readonly nodes: number;
|
|
30
30
|
/** The subset of `nodes` that is tombstoned: permanent, and only compaction reclaims it. */
|
|
31
31
|
readonly tombstonedNodes: number;
|
|
32
|
+
/** Node limit. Shared state over it is a terminal `too-many-nodes`. */
|
|
32
33
|
readonly maxNodes: number;
|
|
34
|
+
/** Replicated relationship records. */
|
|
33
35
|
readonly relationships: number;
|
|
36
|
+
/** Relationship limit. Shared state over it is a terminal `too-many-relationships`. */
|
|
34
37
|
readonly maxRelationships: number;
|
|
38
|
+
/** Replicated package parts. */
|
|
35
39
|
readonly parts: number;
|
|
40
|
+
/** Part limit. Shared state over it is a terminal `too-many-parts`. */
|
|
36
41
|
readonly maxParts: number;
|
|
37
42
|
/** Bytes in the shared blob map, unreferenced bytes included. */
|
|
38
43
|
readonly blobBytes: number;
|
|
44
|
+
/** Blob byte limit. Shared state over it is a terminal `blob-store-full`. */
|
|
39
45
|
readonly maxBlobBytes: number;
|
|
46
|
+
/**
|
|
47
|
+
* Formatting markers in paragraph text. Each formatting change leaves some, and deleting the
|
|
48
|
+
* text does not remove them, because a participant who edited offline may still depend on
|
|
49
|
+
* them. They have no cap, but every reader walks them, so a room whose count keeps growing
|
|
50
|
+
* far past its text is one to move to a new room.
|
|
51
|
+
*/
|
|
52
|
+
readonly formattingMarkers: number;
|
|
40
53
|
}
|
|
41
54
|
/**
|
|
42
55
|
* Read a room's resource usage from a synchronized `Y.Doc`, joining nothing.
|
|
@@ -59,12 +72,20 @@ declare function readCollaborationResourceUsage(ydoc: Y.Doc): CollaborationResou
|
|
|
59
72
|
*/
|
|
60
73
|
|
|
61
74
|
/**
|
|
62
|
-
* Full-document collaboration session
|
|
63
|
-
*
|
|
64
|
-
* The seam matches {@link TextCollaborationSession}, plus a live display-identity update.
|
|
75
|
+
* Full-document collaboration session: the engine-facing seam, the transport status a
|
|
76
|
+
* provider sets, and a live display-identity update.
|
|
65
77
|
* @public
|
|
66
78
|
*/
|
|
67
|
-
interface DocumentCollaborationSession extends
|
|
79
|
+
interface DocumentCollaborationSession extends EditorCollaborationSession {
|
|
80
|
+
/**
|
|
81
|
+
* Provider convenience seam. Low-level consumers normally leave the session ready.
|
|
82
|
+
*
|
|
83
|
+
* `reason` is a typed code so a host can branch on it: pass `'transport-disconnected'` for
|
|
84
|
+
* a socket that will retry itself and `'authentication-failed'` for a credential the server
|
|
85
|
+
* rejected, because those need opposite responses. The provider's own phrasing goes in
|
|
86
|
+
* `detail`.
|
|
87
|
+
*/
|
|
88
|
+
setTransportStatus(status: 'ready' | 'disconnected' | 'error', reason?: CollaborationFailureCode, detail?: string): void;
|
|
68
89
|
/**
|
|
69
90
|
* Update the display identity for the rest of this session and republish presence.
|
|
70
91
|
*
|
|
@@ -87,38 +108,39 @@ interface DocumentCollaborationSession extends TextCollaborationSession {
|
|
|
87
108
|
}
|
|
88
109
|
/** Owned full-document collaboration replica. @public */
|
|
89
110
|
type DocumentCollaborationHandle = CollaborationHandle<DocumentCollaborationSession>;
|
|
90
|
-
/**
|
|
91
|
-
* Options for one full-document collaboration replica.
|
|
92
|
-
*
|
|
93
|
-
* The caller owns `ydoc`.
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
interface CreateDocumentCollaborationOptions {
|
|
97
|
-
readonly ydoc: Y.Doc;
|
|
98
|
-
readonly awareness: Awareness;
|
|
99
|
-
readonly documentId: string;
|
|
100
|
-
/** Unique attachment identity. Omit it to generate a new identity for this session. */
|
|
101
|
-
readonly sessionId?: string;
|
|
102
|
-
readonly identity: CollaborationIdentity;
|
|
103
|
-
readonly bootstrap: CollaborationBootstrap;
|
|
104
|
-
/**
|
|
105
|
-
* Admit local edits while the transport is `disconnected`.
|
|
106
|
-
*
|
|
107
|
-
* A journal applies to the local `Y.Doc` either way, so buffered offline edits merge on
|
|
108
|
-
* reconnect exactly as concurrent online edits do. Off by default: a host that shows no
|
|
109
|
-
* offline indicator would let users type into a document no peer receives yet. `error`
|
|
110
|
-
* stays terminal and `initializing` stays refused regardless of this option.
|
|
111
|
-
*/
|
|
112
|
-
readonly offlineEditing?: boolean;
|
|
113
|
-
}
|
|
114
111
|
|
|
115
112
|
/**
|
|
116
113
|
* Create or join one full-document collaboration replica.
|
|
117
114
|
*
|
|
118
|
-
* The caller owns `ydoc
|
|
115
|
+
* The caller owns `ydoc`, `awareness`, and the provider, and destroys them after
|
|
116
|
+
* `handle.destroy()`.
|
|
117
|
+
*
|
|
118
|
+
* @throws CollaborationSchemaError when the replica cannot start:
|
|
119
|
+
* `invalid-document-id`, `invalid-session-id`, `invalid-identity`, or
|
|
120
|
+
* `invalid-identity-color` for a bad option; `initialization-timeout` or
|
|
121
|
+
* `initialization-aborted` when no room arrived; `already-initialized` for `create` on a
|
|
122
|
+
* seeded room; `document-id-mismatch` for a room of another document;
|
|
123
|
+
* `protocol-version-mismatch` or `schema-version-mismatch` for a room of another format;
|
|
124
|
+
* `baseline-too-large`, `invalid-baseline`, or `no-main-document-part` for seed bytes that
|
|
125
|
+
* cannot open; `concurrent-seed` or `blob-digest-mismatch` for a damaged room; a resource
|
|
126
|
+
* limit code such as `too-many-nodes` or `blob-store-full`; or `missing-blob`,
|
|
127
|
+
* `missing-root`, or `invalid-relationships` for shared state that does not form a document.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* await new Promise((resolve) => provider.once('sync', resolve));
|
|
132
|
+
* const room = await createDocumentCollaboration({
|
|
133
|
+
* ydoc,
|
|
134
|
+
* awareness,
|
|
135
|
+
* documentId: 'room-1',
|
|
136
|
+
* identity: { actorId: 'user-1', name: 'Ada' },
|
|
137
|
+
* bootstrap: { kind: 'join' },
|
|
138
|
+
* });
|
|
139
|
+
* // Mount the editor with room.document and collaborationModule({ session: room.session }).
|
|
140
|
+
* ```
|
|
119
141
|
* @public
|
|
120
142
|
*/
|
|
121
143
|
declare function createDocumentCollaboration(options: CreateDocumentCollaborationOptions): Promise<DocumentCollaborationHandle>;
|
|
122
144
|
|
|
123
145
|
export { createDocumentCollaboration as c, readCollaborationResourceUsage as r };
|
|
124
|
-
export type {
|
|
146
|
+
export type { CollaborationResourceUsage as C, DocumentCollaborationHandle as D, DocumentCollaborationSession as a };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{p as ATTACH_WATCHDOG_MS_FOR_TESTS,q as createDocumentCollaboration,o as readCollaborationDocument}from'./chunk-L567WP3J.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { EditorCollaborationSession, CollaborationFailureCode } from '@docx-editor.dev/core/collaboration';
|
|
1
2
|
import * as Y from 'yjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as CollaborationBootstrap, c as CollaborationHandle, e as TextCollaborationSession, b as CollaborationIdentityUpdate } from './session-B-ds4k64.js';
|
|
3
|
+
import { c as CollaborationHandle, b as CollaborationIdentityUpdate } from './types-BQ1vBt5Q.cjs';
|
|
4
|
+
import { C as CreateDocumentCollaborationOptions } from './document-session-options-CfKypp9c.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Room-size observability.
|
|
@@ -29,14 +29,27 @@ interface CollaborationResourceUsage {
|
|
|
29
29
|
readonly nodes: number;
|
|
30
30
|
/** The subset of `nodes` that is tombstoned: permanent, and only compaction reclaims it. */
|
|
31
31
|
readonly tombstonedNodes: number;
|
|
32
|
+
/** Node limit. Shared state over it is a terminal `too-many-nodes`. */
|
|
32
33
|
readonly maxNodes: number;
|
|
34
|
+
/** Replicated relationship records. */
|
|
33
35
|
readonly relationships: number;
|
|
36
|
+
/** Relationship limit. Shared state over it is a terminal `too-many-relationships`. */
|
|
34
37
|
readonly maxRelationships: number;
|
|
38
|
+
/** Replicated package parts. */
|
|
35
39
|
readonly parts: number;
|
|
40
|
+
/** Part limit. Shared state over it is a terminal `too-many-parts`. */
|
|
36
41
|
readonly maxParts: number;
|
|
37
42
|
/** Bytes in the shared blob map, unreferenced bytes included. */
|
|
38
43
|
readonly blobBytes: number;
|
|
44
|
+
/** Blob byte limit. Shared state over it is a terminal `blob-store-full`. */
|
|
39
45
|
readonly maxBlobBytes: number;
|
|
46
|
+
/**
|
|
47
|
+
* Formatting markers in paragraph text. Each formatting change leaves some, and deleting the
|
|
48
|
+
* text does not remove them, because a participant who edited offline may still depend on
|
|
49
|
+
* them. They have no cap, but every reader walks them, so a room whose count keeps growing
|
|
50
|
+
* far past its text is one to move to a new room.
|
|
51
|
+
*/
|
|
52
|
+
readonly formattingMarkers: number;
|
|
40
53
|
}
|
|
41
54
|
/**
|
|
42
55
|
* Read a room's resource usage from a synchronized `Y.Doc`, joining nothing.
|
|
@@ -59,12 +72,20 @@ declare function readCollaborationResourceUsage(ydoc: Y.Doc): CollaborationResou
|
|
|
59
72
|
*/
|
|
60
73
|
|
|
61
74
|
/**
|
|
62
|
-
* Full-document collaboration session
|
|
63
|
-
*
|
|
64
|
-
* The seam matches {@link TextCollaborationSession}, plus a live display-identity update.
|
|
75
|
+
* Full-document collaboration session: the engine-facing seam, the transport status a
|
|
76
|
+
* provider sets, and a live display-identity update.
|
|
65
77
|
* @public
|
|
66
78
|
*/
|
|
67
|
-
interface DocumentCollaborationSession extends
|
|
79
|
+
interface DocumentCollaborationSession extends EditorCollaborationSession {
|
|
80
|
+
/**
|
|
81
|
+
* Provider convenience seam. Low-level consumers normally leave the session ready.
|
|
82
|
+
*
|
|
83
|
+
* `reason` is a typed code so a host can branch on it: pass `'transport-disconnected'` for
|
|
84
|
+
* a socket that will retry itself and `'authentication-failed'` for a credential the server
|
|
85
|
+
* rejected, because those need opposite responses. The provider's own phrasing goes in
|
|
86
|
+
* `detail`.
|
|
87
|
+
*/
|
|
88
|
+
setTransportStatus(status: 'ready' | 'disconnected' | 'error', reason?: CollaborationFailureCode, detail?: string): void;
|
|
68
89
|
/**
|
|
69
90
|
* Update the display identity for the rest of this session and republish presence.
|
|
70
91
|
*
|
|
@@ -87,38 +108,39 @@ interface DocumentCollaborationSession extends TextCollaborationSession {
|
|
|
87
108
|
}
|
|
88
109
|
/** Owned full-document collaboration replica. @public */
|
|
89
110
|
type DocumentCollaborationHandle = CollaborationHandle<DocumentCollaborationSession>;
|
|
90
|
-
/**
|
|
91
|
-
* Options for one full-document collaboration replica.
|
|
92
|
-
*
|
|
93
|
-
* The caller owns `ydoc`.
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
interface CreateDocumentCollaborationOptions {
|
|
97
|
-
readonly ydoc: Y.Doc;
|
|
98
|
-
readonly awareness: Awareness;
|
|
99
|
-
readonly documentId: string;
|
|
100
|
-
/** Unique attachment identity. Omit it to generate a new identity for this session. */
|
|
101
|
-
readonly sessionId?: string;
|
|
102
|
-
readonly identity: CollaborationIdentity;
|
|
103
|
-
readonly bootstrap: CollaborationBootstrap;
|
|
104
|
-
/**
|
|
105
|
-
* Admit local edits while the transport is `disconnected`.
|
|
106
|
-
*
|
|
107
|
-
* A journal applies to the local `Y.Doc` either way, so buffered offline edits merge on
|
|
108
|
-
* reconnect exactly as concurrent online edits do. Off by default: a host that shows no
|
|
109
|
-
* offline indicator would let users type into a document no peer receives yet. `error`
|
|
110
|
-
* stays terminal and `initializing` stays refused regardless of this option.
|
|
111
|
-
*/
|
|
112
|
-
readonly offlineEditing?: boolean;
|
|
113
|
-
}
|
|
114
111
|
|
|
115
112
|
/**
|
|
116
113
|
* Create or join one full-document collaboration replica.
|
|
117
114
|
*
|
|
118
|
-
* The caller owns `ydoc
|
|
115
|
+
* The caller owns `ydoc`, `awareness`, and the provider, and destroys them after
|
|
116
|
+
* `handle.destroy()`.
|
|
117
|
+
*
|
|
118
|
+
* @throws CollaborationSchemaError when the replica cannot start:
|
|
119
|
+
* `invalid-document-id`, `invalid-session-id`, `invalid-identity`, or
|
|
120
|
+
* `invalid-identity-color` for a bad option; `initialization-timeout` or
|
|
121
|
+
* `initialization-aborted` when no room arrived; `already-initialized` for `create` on a
|
|
122
|
+
* seeded room; `document-id-mismatch` for a room of another document;
|
|
123
|
+
* `protocol-version-mismatch` or `schema-version-mismatch` for a room of another format;
|
|
124
|
+
* `baseline-too-large`, `invalid-baseline`, or `no-main-document-part` for seed bytes that
|
|
125
|
+
* cannot open; `concurrent-seed` or `blob-digest-mismatch` for a damaged room; a resource
|
|
126
|
+
* limit code such as `too-many-nodes` or `blob-store-full`; or `missing-blob`,
|
|
127
|
+
* `missing-root`, or `invalid-relationships` for shared state that does not form a document.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* await new Promise((resolve) => provider.once('sync', resolve));
|
|
132
|
+
* const room = await createDocumentCollaboration({
|
|
133
|
+
* ydoc,
|
|
134
|
+
* awareness,
|
|
135
|
+
* documentId: 'room-1',
|
|
136
|
+
* identity: { actorId: 'user-1', name: 'Ada' },
|
|
137
|
+
* bootstrap: { kind: 'join' },
|
|
138
|
+
* });
|
|
139
|
+
* // Mount the editor with room.document and collaborationModule({ session: room.session }).
|
|
140
|
+
* ```
|
|
119
141
|
* @public
|
|
120
142
|
*/
|
|
121
143
|
declare function createDocumentCollaboration(options: CreateDocumentCollaborationOptions): Promise<DocumentCollaborationHandle>;
|
|
122
144
|
|
|
123
145
|
export { createDocumentCollaboration as c, readCollaborationResourceUsage as r };
|
|
124
|
-
export type {
|
|
146
|
+
export type { CollaborationResourceUsage as C, DocumentCollaborationHandle as D, DocumentCollaborationSession as a };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
+
import { a as CollaborationBootstrap } from './types-BQ1vBt5Q.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for one full-document collaboration replica.
|
|
8
|
+
*
|
|
9
|
+
* The caller owns `ydoc`.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
interface CreateDocumentCollaborationOptions {
|
|
13
|
+
/** The room's Yjs document. Connect its provider before a `join` bootstrap. */
|
|
14
|
+
readonly ydoc: Y.Doc;
|
|
15
|
+
/** Presence channel for participants and remote selections, from `y-protocols/awareness`. */
|
|
16
|
+
readonly awareness: Awareness;
|
|
17
|
+
/** The room's document id, 1 to 256 characters. A room seeded with another id refuses. */
|
|
18
|
+
readonly documentId: string;
|
|
19
|
+
/** Unique attachment identity. Omit it to generate a new identity for this session. */
|
|
20
|
+
readonly sessionId?: string;
|
|
21
|
+
/** The local participant. Recorded as the author of this replica's changes. */
|
|
22
|
+
readonly identity: CollaborationIdentity;
|
|
23
|
+
/** Whether to seed the room, join it, or let the peers decide. */
|
|
24
|
+
readonly bootstrap: CollaborationBootstrap;
|
|
25
|
+
/**
|
|
26
|
+
* Admit local edits while the transport is `disconnected`.
|
|
27
|
+
*
|
|
28
|
+
* A journal applies to the local `Y.Doc` either way, so buffered offline edits merge on
|
|
29
|
+
* reconnect exactly as concurrent online edits do. On by default, as in other Yjs editors:
|
|
30
|
+
* a dropped connection should not stop anyone typing. Show the `disconnected` status so
|
|
31
|
+
* users know their edits have not reached the room yet. Pass `false` to pause editing
|
|
32
|
+
* while disconnected. `error` and `initializing` refuse edits regardless of this option.
|
|
33
|
+
*/
|
|
34
|
+
readonly offlineEditing?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type { CreateDocumentCollaborationOptions as C };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
+
import { a as CollaborationBootstrap } from './types-BQ1vBt5Q.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for one full-document collaboration replica.
|
|
8
|
+
*
|
|
9
|
+
* The caller owns `ydoc`.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
interface CreateDocumentCollaborationOptions {
|
|
13
|
+
/** The room's Yjs document. Connect its provider before a `join` bootstrap. */
|
|
14
|
+
readonly ydoc: Y.Doc;
|
|
15
|
+
/** Presence channel for participants and remote selections, from `y-protocols/awareness`. */
|
|
16
|
+
readonly awareness: Awareness;
|
|
17
|
+
/** The room's document id, 1 to 256 characters. A room seeded with another id refuses. */
|
|
18
|
+
readonly documentId: string;
|
|
19
|
+
/** Unique attachment identity. Omit it to generate a new identity for this session. */
|
|
20
|
+
readonly sessionId?: string;
|
|
21
|
+
/** The local participant. Recorded as the author of this replica's changes. */
|
|
22
|
+
readonly identity: CollaborationIdentity;
|
|
23
|
+
/** Whether to seed the room, join it, or let the peers decide. */
|
|
24
|
+
readonly bootstrap: CollaborationBootstrap;
|
|
25
|
+
/**
|
|
26
|
+
* Admit local edits while the transport is `disconnected`.
|
|
27
|
+
*
|
|
28
|
+
* A journal applies to the local `Y.Doc` either way, so buffered offline edits merge on
|
|
29
|
+
* reconnect exactly as concurrent online edits do. On by default, as in other Yjs editors:
|
|
30
|
+
* a dropped connection should not stop anyone typing. Show the `disconnected` status so
|
|
31
|
+
* users know their edits have not reached the room yet. Pass `false` to pause editing
|
|
32
|
+
* while disconnected. `error` and `initializing` refuse edits regardless of this option.
|
|
33
|
+
*/
|
|
34
|
+
readonly offlineEditing?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type { CreateDocumentCollaborationOptions as C };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkFD2KDBHX_cjs=require('./chunk-FD2KDBHX.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(chunkFD2KDBHX_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=>chunkFD2KDBHX_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=chunkFD2KDBHX_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(chunkFD2KDBHX_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(chunkFD2KDBHX_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(!chunkFD2KDBHX_cjs.k.test(t.tagPrefix)||!chunkFD2KDBHX_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=chunkFD2KDBHX_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=chunkFD2KDBHX_cjs.i(t,n.data);if(!o.ok)return {reason:o.reason};let s=chunkFD2KDBHX_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},chunkFD2KDBHX_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:`<${chunkFD2KDBHX_cjs.g} xmlns="${a(s)}"><node id="${a(m)}">${l}<data>${a(o.data)}</data></node></${chunkFD2KDBHX_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 chunkFD2KDBHX_cjs.g}});Object.defineProperty(exports,"MAX_CUSTOM_NODE_DATA_LENGTH",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.d}});Object.defineProperty(exports,"MAX_TAG_LENGTH",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.a}});Object.defineProperty(exports,"customNodeNamespace",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.h}});Object.defineProperty(exports,"customNodesModule",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.m}});Object.defineProperty(exports,"decodeCustomNodeTag",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.c}});Object.defineProperty(exports,"defineCustomNode",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.l}});Object.defineProperty(exports,"encodeCustomNodeTag",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.b}});Object.defineProperty(exports,"insertCustomNode",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.p}});Object.defineProperty(exports,"isCustomNodeDefinition",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.j}});Object.defineProperty(exports,"parseCustomNodeData",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.e}});Object.defineProperty(exports,"recognizeCustomNodes",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.n}});Object.defineProperty(exports,"removeCustomNode",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.q}});Object.defineProperty(exports,"reviewModule",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.o}});Object.defineProperty(exports,"serializeCustomNodeData",{enumerable:true,get:function(){return chunkFD2KDBHX_cjs.f}});Object.defineProperty(exports,"updateCustomNode",{enumerable:true,get:function(){return chunkFD2KDBHX_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.d.cts
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/pro` — review, custom nodes, and realtime collaboration.
|
|
3
|
+
*
|
|
4
|
+
* Registering a module is the whole enablement story: the review chrome slots light up through
|
|
5
|
+
* the same `toolbarCommandState` that disabled them, the editor renders revisions as markup
|
|
6
|
+
* rather than the free tier's final-state projection, and a collaboration module attaches a replica.
|
|
7
|
+
*
|
|
8
|
+
* @example Enable comments, tracked changes, and a custom node type
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { reviewModule, customNodesModule, defineCustomNode } from '@docx-editor.dev/pro';
|
|
11
|
+
*
|
|
12
|
+
* const citation = defineCustomNode({ name: 'citation', tagPrefix: 'acme' });
|
|
13
|
+
* const editor = createDocxEditor({
|
|
14
|
+
* document: bytes,
|
|
15
|
+
* modules: [reviewModule(), customNodesModule({ nodes: [citation] })],
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* Framework-neutral entry: the review module and custom nodes. React chrome
|
|
21
|
+
* lives under `@docx-editor.dev/pro/react`.
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-CNRQG1TI.cjs';
|
|
27
|
+
export { b as ActivatedCustomNode, c as CustomNode, d as CustomNodeDataRejection, e as CustomNodeDataResult, f as CustomNodePayloadSource, g as CustomNodesModuleOptions, h as InferSchemaOutput, M as MAX_CUSTOM_NODE_DATA_LENGTH, i as RecognizeCustomNodesOptions, j as ReviewModuleOptions, k as StandardSchemaIssue, l as StandardSchemaResult, m as customNodesModule, n as defineCustomNode, o as isCustomNodeDefinition, p as parseCustomNodeData, r as recognizeCustomNodes, q as reviewModule, s as serializeCustomNodeData } from './define-custom-node-CNRQG1TI.cjs';
|
|
28
|
+
export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-DWn2heE1.cjs';
|
|
4
29
|
import { Editor, ExecResult } from '@docx-editor.dev/core/contracts/editor';
|
|
5
|
-
|
|
30
|
+
export { CommentMarkerStyle, ResolvedReviewPane, ReviewPaneOpening, ReviewPaneOptions, ReviewPaneOverflow, RevisionDisplay } from '@docx-editor.dev/core/editor';
|
|
6
31
|
import '@docx-editor.dev/core/store';
|
|
7
32
|
import '@docx-editor.dev/core/collaboration';
|
|
8
33
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/pro` — review, custom nodes, and realtime collaboration.
|
|
3
|
+
*
|
|
4
|
+
* Registering a module is the whole enablement story: the review chrome slots light up through
|
|
5
|
+
* the same `toolbarCommandState` that disabled them, the editor renders revisions as markup
|
|
6
|
+
* rather than the free tier's final-state projection, and a collaboration module attaches a replica.
|
|
7
|
+
*
|
|
8
|
+
* @example Enable comments, tracked changes, and a custom node type
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { reviewModule, customNodesModule, defineCustomNode } from '@docx-editor.dev/pro';
|
|
11
|
+
*
|
|
12
|
+
* const citation = defineCustomNode({ name: 'citation', tagPrefix: 'acme' });
|
|
13
|
+
* const editor = createDocxEditor({
|
|
14
|
+
* document: bytes,
|
|
15
|
+
* modules: [reviewModule(), customNodesModule({ nodes: [citation] })],
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* Framework-neutral entry: the review module and custom nodes. React chrome
|
|
21
|
+
* lives under `@docx-editor.dev/pro/react`.
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-D0c36PpZ.js';
|
|
27
|
+
export { b as ActivatedCustomNode, c as CustomNode, d as CustomNodeDataRejection, e as CustomNodeDataResult, f as CustomNodePayloadSource, g as CustomNodesModuleOptions, h as InferSchemaOutput, M as MAX_CUSTOM_NODE_DATA_LENGTH, i as RecognizeCustomNodesOptions, j as ReviewModuleOptions, k as StandardSchemaIssue, l as StandardSchemaResult, m as customNodesModule, n as defineCustomNode, o as isCustomNodeDefinition, p as parseCustomNodeData, r as recognizeCustomNodes, q as reviewModule, s as serializeCustomNodeData } from './define-custom-node-D0c36PpZ.js';
|
|
28
|
+
export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-DWn2heE1.js';
|
|
4
29
|
import { Editor, ExecResult } from '@docx-editor.dev/core/contracts/editor';
|
|
5
|
-
|
|
30
|
+
export { CommentMarkerStyle, ResolvedReviewPane, ReviewPaneOpening, ReviewPaneOptions, ReviewPaneOverflow, RevisionDisplay } from '@docx-editor.dev/core/editor';
|
|
6
31
|
import '@docx-editor.dev/core/store';
|
|
7
32
|
import '@docx-editor.dev/core/collaboration';
|
|
8
33
|
|