@docx-editor.dev/pro 2.24.0 → 2.25.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-T2MOOMO2.js → chunk-3JW4VNG5.js} +3 -3
- package/dist/{chunk-AWGCPPLT.cjs → chunk-JDLJS5RD.cjs} +3 -3
- package/dist/{chunk-3QCDJ2BW.js → chunk-MRW46GJW.js} +3 -3
- package/dist/{chunk-AKAEBDLM.cjs → chunk-VCMQFPO2.cjs} +3 -3
- package/dist/collaboration/hocuspocus.cjs +1 -1
- package/dist/collaboration/hocuspocus.d.cts +4 -3
- package/dist/collaboration/hocuspocus.d.ts +4 -3
- package/dist/collaboration/hocuspocus.js +1 -1
- package/dist/collaboration/index.cjs +2 -2
- package/dist/collaboration/index.d.cts +5 -4
- package/dist/collaboration/index.d.ts +5 -4
- package/dist/collaboration/index.js +1 -1
- package/dist/collaboration/webrtc.cjs +1 -1
- package/dist/collaboration/webrtc.d.cts +4 -3
- package/dist/collaboration/webrtc.d.ts +4 -3
- package/dist/collaboration/webrtc.js +1 -1
- package/dist/{collaboration-module-BgRxhW5b.d.cts → collaboration-module-DlSv0oAd.d.cts} +2 -1
- package/dist/{collaboration-module-BgRxhW5b.d.ts → collaboration-module-DlSv0oAd.d.ts} +2 -1
- package/dist/{define-custom-node-BehI3jWX.d.ts → define-custom-node-CkjSwcxy.d.cts} +3 -2
- package/dist/{define-custom-node-B_p2nr9T.d.cts → define-custom-node-DA6UEXID.d.ts} +3 -2
- package/dist/document-session-6X24KXAM.js +1 -0
- package/dist/document-session-BDVKTCYX.js +1 -0
- package/dist/{document-session-1VSzWYaC.d.ts → document-session-BKKfJzKB.d.cts} +3 -2
- package/dist/{document-session-KYavjw8A.d.cts → document-session-BQ4nBDTd.d.ts} +3 -2
- package/dist/document-session-NECF3VT6.cjs +1 -0
- package/dist/document-session-RKQQLHEL.cjs +1 -0
- package/dist/{hocuspocus-CCT7ZGAL.cjs → hocuspocus-BCQPTL3M.cjs} +1 -1
- package/dist/{hocuspocus-CFO4XIYM.js → hocuspocus-QIIKEK6J.js} +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/react/hocuspocus.d.cts +4 -3
- package/dist/react/hocuspocus.d.ts +4 -3
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.cts +9 -8
- package/dist/react/index.d.ts +9 -8
- package/dist/react/index.js +1 -1
- package/dist/react/webrtc.d.cts +4 -3
- package/dist/react/webrtc.d.ts +4 -3
- package/dist/{session-BH7Qgyp6.d.cts → session-B-ds4k64.d.cts} +2 -1
- package/dist/{session-BH7Qgyp6.d.ts → session-B-ds4k64.d.ts} +2 -1
- package/dist/vue/hocuspocus.cjs +1 -1
- package/dist/vue/hocuspocus.d.cts +2 -1
- package/dist/vue/hocuspocus.d.ts +2 -1
- package/dist/vue/hocuspocus.js +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.d.cts +46 -49
- package/dist/vue/index.d.ts +46 -49
- package/dist/vue/index.js +1 -1
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.d.cts +2 -1
- package/dist/vue/webrtc.d.ts +2 -1
- package/dist/vue/webrtc.js +1 -1
- package/dist/{webrtc-IGHNHLXV.js → webrtc-54VKWBFN.js} +1 -1
- package/dist/{webrtc-TMW7JV4Q.cjs → webrtc-TIHZFB4K.cjs} +1 -1
- package/package.json +5 -5
- package/dist/document-session-EMWNZSN3.cjs +0 -1
- package/dist/document-session-FPKBLKDC.js +0 -1
- package/dist/document-session-LBJO672O.js +0 -1
- package/dist/document-session-YZRHVYCK.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
3
3
|
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
-
import { D as DocumentCollaborationHandle } from '../document-session-
|
|
5
|
-
import { a as CollaborationBootstrap } from '../session-
|
|
4
|
+
import { D as DocumentCollaborationHandle } from '../document-session-BKKfJzKB.cjs';
|
|
5
|
+
import { a as CollaborationBootstrap } from '../session-B-ds4k64.cjs';
|
|
6
6
|
export { c as createCollaborationRoomId, v as validateRoomId } from '../room-id-BfudXOZz.cjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
8
8
|
|
|
@@ -55,4 +55,5 @@ declare const HOCUSPOCUS_PROVIDER_FOR_TESTS: unique symbol;
|
|
|
55
55
|
/** Create one owned Hocuspocus room and provider-neutral collaboration session. @public */
|
|
56
56
|
declare function createHocuspocusCollaboration(options: CreateHocuspocusCollaborationOptions): Promise<HocuspocusCollaborationRoom>;
|
|
57
57
|
|
|
58
|
-
export {
|
|
58
|
+
export { HOCUSPOCUS_PROVIDER_FOR_TESTS, createHocuspocusCollaboration };
|
|
59
|
+
export type { CreateHocuspocusCollaborationOptions, HocuspocusCollaborationRoom };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
3
3
|
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
-
import { D as DocumentCollaborationHandle } from '../document-session-
|
|
5
|
-
import { a as CollaborationBootstrap } from '../session-
|
|
4
|
+
import { D as DocumentCollaborationHandle } from '../document-session-BQ4nBDTd.js';
|
|
5
|
+
import { a as CollaborationBootstrap } from '../session-B-ds4k64.js';
|
|
6
6
|
export { c as createCollaborationRoomId, v as validateRoomId } from '../room-id-BfudXOZz.js';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
8
8
|
|
|
@@ -55,4 +55,5 @@ declare const HOCUSPOCUS_PROVIDER_FOR_TESTS: unique symbol;
|
|
|
55
55
|
/** Create one owned Hocuspocus room and provider-neutral collaboration session. @public */
|
|
56
56
|
declare function createHocuspocusCollaboration(options: CreateHocuspocusCollaborationOptions): Promise<HocuspocusCollaborationRoom>;
|
|
57
57
|
|
|
58
|
-
export {
|
|
58
|
+
export { HOCUSPOCUS_PROVIDER_FOR_TESTS, createHocuspocusCollaboration };
|
|
59
|
+
export type { CreateHocuspocusCollaborationOptions, HocuspocusCollaborationRoom };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {p,d}from'../chunk-
|
|
1
|
+
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {p,d}from'../chunk-MRW46GJW.js';import*as P from'yjs';import {Awareness}from'y-protocols/awareness';import {HocuspocusProvider}from'@hocuspocus/provider';import {isCollaborationFailureCode}from'@docx-editor.dev/core/collaboration';var S=3e4,O=Symbol("createHocuspocusCollaboration.provider"),F=o=>new HocuspocusProvider({url:o.url,name:o.name,document:o.document,awareness:o.awareness,...o.token!==void 0?{token:o.token}:{}});function I(o,d$1){return new Promise((c,n)=>{if(o.isSynced){c();return}let r=()=>{clearTimeout(i),o.off("synced",s),o.off("authenticationFailed",t);},s=()=>{r(),c();},t=e=>{r(),n(new d(isCollaborationFailureCode(e.reason)?e.reason:"initialization-aborted",`authentication failed: ${e.reason}`));},i=setTimeout(()=>{r(),n(new d("initialization-timeout"));},d$1);o.on("synced",s),o.on("authenticationFailed",t);})}async function _(o){let d=b(o.roomId),c=o[O]??F,n=new P.Doc,r=new Awareness(n),s=()=>c({url:o.url,name:d,document:n,awareness:r,...o.token!==void 0?{token:o.token}:{}}),t=null,i=null;try{o.bootstrap.kind!=="create"&&(t=s(),await I(t,o.syncedTimeoutMs??S)),i=await p({ydoc:n,awareness:r,documentId:d,identity:o.identity,bootstrap:o.bootstrap,offlineEditing:o.offlineEditing}),t||(t=s());}catch(a){throw i?.destroy(),t?.destroy(),r.destroy(),n.destroy(),a}let e=t,u=i,l=u.session,f=a=>{l.setTransportStatus(a.status==="connected"?"ready":"disconnected",a.status==="connected"?void 0:"transport-disconnected",a.status==="connected"?void 0:"websocket disconnected");};e.on("status",f);let p$1=a=>{l.setTransportStatus("error",isCollaborationFailureCode(a.reason)?a.reason:"authentication-failed");};e.on("authenticationFailed",p$1);let b$1=false;return Object.freeze({document:u.document,session:l,ydoc:n,provider:e,destroy(){b$1||(b$1=true,e.off("status",f),e.off("authenticationFailed",p$1),u.destroy(),e.destroy(),r.destroy(),n.destroy());}})}export{O as HOCUSPOCUS_PROVIDER_FOR_TESTS,_ as createHocuspocusCollaboration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkQLZH2Q2C_cjs=require('../chunk-QLZH2Q2C.cjs'),chunkAKAEBDLM_cjs=require('../chunk-AKAEBDLM.cjs'),l=require('yjs'),store=require('@docx-editor.dev/core/store'),collaboration=require('@docx-editor.dev/core/collaboration');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var l__namespace=/*#__PURE__*/_interopNamespace(l);var w="docxEditor",h=256,L=256,v=1e6,$=3e4;function X(n){let t=n.actorId.trim(),a=n.name.trim();if(t.length===0||t.length>h||a.length===0||a.length>h)throw new chunkAKAEBDLM_cjs.d("invalid-identity");if(n.color!==void 0&&n.color.length>64)throw new chunkAKAEBDLM_cjs.d("invalid-identity-color");return Object.freeze({actorId:t,name:a,...n.color?{color:n.color}:{},role:n.role??"human"})}function G(n){let t=n.trim();if(t.length===0||t.length>h)throw new chunkAKAEBDLM_cjs.d("invalid-document-id");return t}function J(n){let t=n?.trim()||globalThis.crypto.randomUUID();if(t.length===0||t.length>h)throw new chunkAKAEBDLM_cjs.d("invalid-session-id");return t}function Z(n,t){let a=n.toString();if(a===t)return;let o=0;for(;o<a.length&&o<t.length&&a.charCodeAt(o)===t.charCodeAt(o);)o+=1;let e=0;for(;e<a.length-o&&e<t.length-o&&a.charCodeAt(a.length-e-1)===t.charCodeAt(t.length-e-1);)e+=1;let r=a.length-o-e;r>0&&n.delete(o,r);let i=t.slice(o,t.length-e);i.length>0&&n.insert(o,i);}function M(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;return typeof t.paragraphId!="string"||t.paragraphId.length!==8||typeof t.position!="string"||t.position.length===0||t.position.length>2048||!/^[A-Za-z0-9_-]+$/.test(t.position)?null:{paragraphId:t.paragraphId,position:t.position}}function W(n){if(n===void 0||typeof n!="object"||n===null||Array.isArray(n))return;let t=n,a=M(t.anchor),o=M(t.head);if(a&&o)return {anchor:a,head:o};if(typeof t.paragraphId=="string"&&t.paragraphId.length===8&&typeof t.anchor=="string"&&typeof t.head=="string"&&t.anchor.length>0&&t.head.length>0&&t.anchor.length<=2048&&t.head.length<=2048&&/^[A-Za-z0-9_-]+$/.test(t.anchor)&&/^[A-Za-z0-9_-]+$/.test(t.head))return {anchor:{paragraphId:t.paragraphId,position:t.anchor},head:{paragraphId:t.paragraphId,position:t.head}}}function _(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;if(typeof t.actorId!="string"||t.actorId.length===0||t.actorId.length>h||typeof t.name!="string"||t.name.length===0||t.name.length>h)return null;let a=typeof t.color=="string"&&t.color.length<=64?t.color:void 0,o=t.role==="agent"?"agent":"human",e=W(t.selection);return {actorId:t.actorId,name:t.name,...a?{color:a}:{},role:o,...e?{selection:e}:{}}}function K(n){let t="";for(let a of n)t+=String.fromCharCode(a);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function q(n){let t=n.replace(/-/g,"+").replace(/_/g,"/"),a=atob(t+"=".repeat((4-t.length%4)%4));return Uint8Array.from(a,o=>o.charCodeAt(0))}var A=class{constructor(t,a,o,e,r,i){this.ydoc=t;this.awareness=a;this.baseline=i;this.documentId=o,this.sessionId=e,this.identity=r;let{root:d,paragraphs:p}=chunkAKAEBDLM_cjs.e(t);this.baselineSha256=String(d.get("baselineSha256")),this.initializedBy=String(d.get("initializedBy")),this.undoManager=new l__namespace.UndoManager([...p.values()],{trackedOrigins:new Set([this.localOrigin]),captureTimeout:0}),t.on("afterTransaction",this.onYjsTransaction),a.on("change",this.onAwarenessChange),this.publishAwareness(),this.setStatus("ready");}ydoc;awareness;baseline;documentId;sessionId;identity;statusState=collaboration.createCollaborationStatusTracker();statusListeners=new Set;selectionListeners=new Set;participantListeners=new Set;localOrigin=Object.freeze({kind:"docx-collaboration-local"});undoManager;baselineSha256;initializedBy;port=null;detachPort=null;applyingSharedState=false;remoteCounter=0;destroyed=false;status(){return this.statusState.status()}statusSnapshot(){return this.statusState.snapshot()}subscribeStatus(t){return this.statusListeners.add(t),()=>this.statusListeners.delete(t)}setTransportStatus(t,a,o){if(!this.destroyed&&!(this.statusState.status()==="error"&&t!=="error")){if(a!==void 0){this.setStatus(t,a,o);return}this.setStatus(t);}}get attached(){return this.port!==null}attach(t){if(this.destroyed)return ()=>{};if(this.port)return ()=>{};if(t.documentId!==this.documentId)return this.setStatus("error","document-id-mismatch"),()=>{};this.validateParagraphSet(t),this.port=t,this.reconcilePortFromYjs();let a=t.subscribe(o=>{if(!(this.destroyed||this.applyingSharedState)&&!(o.origin===store.ORIGIN_IDS.mutationRemote||o.origin===store.ORIGIN_IDS.projection||o.origin===store.ORIGIN_IDS.awareness))try{this.reconcileYjsFromPort();}catch(e){this.setStatus("error",e instanceof chunkAKAEBDLM_cjs.d?e.code:"local-mirror-failed",e instanceof chunkAKAEBDLM_cjs.d?e.detail:void 0);}});return this.detachPort=()=>{this.flushPendingJournals(),a(),this.port===t&&(this.port=null),this.detachPort=null;},()=>this.detachPort?.()}gateOperations(t,a){if(this.destroyed)return "collaboration-session-destroyed";if(this.statusState.status()!=="ready")return "collaboration-session-not-ready";if(!this.port)return "collaboration-session-not-attached";if(a.kind!=="body")return "experimental-collaboration-body-text-only";let o=new Map(this.port.paragraphs().map(e=>[e.nodeId,e.text.length]));for(let e of t){if(e.op!=="insertText"&&e.op!=="deleteText")return "experimental-collaboration-text-only";if("revision"in e&&e.revision!==void 0)return "experimental-collaboration-untracked-text-only";if(!this.port.paragraphByNodeId(e.paragraphId))return "experimental-collaboration-existing-paragraphs-only";let r=o.get(e.paragraphId);if(r===void 0)return "experimental-collaboration-existing-paragraphs-only";let i=e.op==="insertText"?r+e.text.length:r-Math.max(0,e.end-e.start);if(i>v)return "collaboration-text-limit";o.set(e.paragraphId,Math.max(0,i));}return null}canUndo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.undoStack.length>0}canRedo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.redoStack.length>0}undo(){return this.canUndo()?(this.undoManager.undo(),true):false}redo(){return this.canRedo()?(this.undoManager.redo(),true):false}setLocalSelection(t){if(this.destroyed)return;let{paragraphs:a}=chunkAKAEBDLM_cjs.e(this.ydoc),o=(r,i)=>{let d=a.get(r.toUpperCase());if(d)return {paragraphId:r.toUpperCase(),position:K(l__namespace.encodeRelativePosition(l__namespace.createRelativePositionFromTypeIndex(d,Math.max(0,Math.min(i,d.length)))))}},e;if(t){let r=o(t.anchor.paragraphId,t.anchor.offset),i=o(t.head.paragraphId,t.head.offset);r&&i&&(e={anchor:r,head:i});}this.publishAwareness(e);}participants(){let t=[],a=[...this.awareness.getStates().entries()].slice(0,L);for(let[o,e]of a){let r=_(e[w]);r&&t.push({actorId:r.actorId,name:r.name,...r.color?{color:r.color}:{},role:r.role??"human",isLocal:o===this.awareness.clientID});}return Object.freeze(t)}subscribeParticipants(t){return this.participantListeners.add(t),()=>this.participantListeners.delete(t)}remoteSelections(){if(!this.port)return [];let t=[...this.awareness.getStates().entries()].slice(0,L),{paragraphs:a}=chunkAKAEBDLM_cjs.e(this.ydoc),o=[];for(let[e,r]of t){if(e===this.awareness.clientID)continue;let i=_(r[w]);if(!i?.selection)continue;let d=y=>{let T=a.get(y.paragraphId);if(!T)return null;let u;try{u=l__namespace.createAbsolutePositionFromRelativePosition(l__namespace.decodeRelativePosition(q(y.position)),this.ydoc);}catch{return null}if(!u||u.type!==T)return null;let f=this.port?.paragraphs().find(U=>U.paragraphId===y.paragraphId);return f?{paragraphId:f.paragraphId,nodeId:f.nodeId,offset:u.index}:null},p=d(i.selection.anchor),x=d(i.selection.head);!p||!x||o.push(Object.freeze({actorId:i.actorId,name:i.name,...i.color?{color:i.color}:{},anchor:Object.freeze(p),head:Object.freeze(x)}));}return Object.freeze(o)}subscribeRemoteSelections(t){return this.selectionListeners.add(t),()=>this.selectionListeners.delete(t)}destroy(){this.destroyed||(this.flushPendingJournals(),this.detachPort?.(),this.destroyed=true,this.ydoc.off("afterTransaction",this.onYjsTransaction),this.awareness.off("change",this.onAwarenessChange),this.awareness.setLocalState(null),this.undoManager.destroy(),this.setStatus("destroyed"),this.statusListeners.clear(),this.selectionListeners.clear(),this.participantListeners.clear());}flushPendingJournals(){this.port?.flushPendingJournals();}onYjsTransaction=t=>{if(!this.destroyed&&t.origin!==this.localOrigin){try{this.validateImmutableSchema();}catch(a){this.setStatus("error",a instanceof chunkAKAEBDLM_cjs.d?a.code:"shared-schema-invalid",a instanceof chunkAKAEBDLM_cjs.d?a.detail:void 0);return}this.port&&this.reconcilePortFromYjs();}};onAwarenessChange=()=>{if(this.destroyed)return;let t=this.remoteSelections();for(let o of [...this.selectionListeners])o(t);let a=this.participants();for(let o of [...this.participantListeners])o(a);};publishAwareness(t){let a={actorId:this.identity.actorId,name:this.identity.name,...this.identity.color?{color:this.identity.color}:{},role:this.identity.role??"human",...t?{selection:t}:{}};this.awareness.setLocalStateField(w,a);}validateParagraphSet(t){let{paragraphs:a}=chunkAKAEBDLM_cjs.e(this.ydoc),o=t.paragraphs();if(o.length!==a.size||o.some(e=>!a.has(e.paragraphId)||!(a.get(e.paragraphId)instanceof l__namespace.Text)||a.get(e.paragraphId).length>v))throw new chunkAKAEBDLM_cjs.d("paragraph-set-mismatch")}validateImmutableSchema(){let{root:t,paragraphs:a}=chunkAKAEBDLM_cjs.e(this.ydoc),o=new Set(["protocolVersion","schemaVersion","documentId","baselineSha256","baselineByteLength","initializedBy","baseline","initialized"]);if([...t.keys()].some(r=>!o.has(r)))throw new chunkAKAEBDLM_cjs.d("unsupported-root-key");if(t.get("protocolVersion")!==chunkAKAEBDLM_cjs.a||t.get("schemaVersion")!==chunkAKAEBDLM_cjs.b||t.get("documentId")!==this.documentId||t.get("baselineSha256")!==this.baselineSha256||t.get("baselineByteLength")!==this.baseline.bytes.byteLength||t.get("initializedBy")!==this.initializedBy||t.get("initialized")!==true)throw new chunkAKAEBDLM_cjs.d("immutable-metadata-changed");let e=t.get("baseline");if(!(e instanceof Uint8Array)||e.byteLength!==this.baseline.bytes.byteLength||e.some((r,i)=>r!==this.baseline.bytes[i]))throw new chunkAKAEBDLM_cjs.d("immutable-baseline-changed");for(let[r,i]of a)if(!this.baseline.paragraphs.some(d=>d.paragraphId===r)||!(i instanceof l__namespace.Text)||i.length>v)throw new chunkAKAEBDLM_cjs.d("paragraph-set-mismatch")}reconcileYjsFromPort(){let t=this.port;if(!t)return;let{paragraphs:a}=chunkAKAEBDLM_cjs.e(this.ydoc);this.ydoc.transact(()=>{for(let o of t.paragraphs()){let e=a.get(o.paragraphId);if(!e)throw new chunkAKAEBDLM_cjs.d("paragraph-set-mismatch");Z(e,o.text);}},this.localOrigin),this.undoManager.stopCapturing();}reconcilePortFromYjs(){let t=this.port;if(!t||this.applyingSharedState)return;let{paragraphs:a}=chunkAKAEBDLM_cjs.e(this.ydoc);this.applyingSharedState=true;try{this.validateParagraphSet(t);let o=[];for(let e of t.paragraphs()){let r=a.get(e.paragraphId);if(!r)throw new chunkAKAEBDLM_cjs.d("paragraph-set-mismatch");let i=r.toString();i!==e.text&&o.push({paragraphId:e.paragraphId,text:i});}if(o.length>0){this.remoteCounter+=1;let e=t.applyParagraphTexts(o,{origin:store.ORIGIN_IDS.mutationRemote,actorId:"remote",operationId:`remote:${this.remoteCounter}`});if(!e.ok)throw new chunkAKAEBDLM_cjs.d(collaboration.isCollaborationFailureCode(e.reason)?e.reason:"remote-apply-failed",collaboration.isCollaborationFailureCode(e.reason)?void 0:e.reason)}}catch(o){this.setStatus("error",o instanceof chunkAKAEBDLM_cjs.d?o.code:"remote-apply-failed",o instanceof chunkAKAEBDLM_cjs.d?o.detail:void 0);}finally{this.applyingSharedState=false;}}setStatus(t,a,o){if(!this.statusState.set(t,a,o))return;let e=this.statusState.snapshot();for(let r of [...this.statusListeners])r(e.status,e.reason?.code,e.reason?.detail);}};async function Q(n,t,a){if(n.bootstrap.kind==="create-or-join")throw new TypeError("createTextCollaboration does not support bootstrap kind 'create-or-join'. Use createDocumentCollaboration.");if(n.bootstrap.kind==="create"){let o=chunkAKAEBDLM_cjs.f(n.bootstrap.document,t);return await chunkAKAEBDLM_cjs.g(n.ydoc,t,a.actorId,o),chunkAKAEBDLM_cjs.h(n.ydoc,t)}return await chunkAKAEBDLM_cjs.i(n.ydoc,n.bootstrap.timeoutMs??$,n.bootstrap.signal),chunkAKAEBDLM_cjs.h(n.ydoc,t)}async function tt(n){let t=G(n.documentId),a=J(n.sessionId),o=X(n.identity),e=await Q(n,t,o),r=new A(n.ydoc,n.awareness,t,a,o,e);return Object.freeze({document:new Uint8Array(e.bytes),session:r,destroy:()=>r.destroy()})}var D=["protocolVersion","sharedSchemaVersion","repairVersion","canonicalModelVersion"];function Y(n){return `docx-collaboration:${n.join(".")}`}var F=Y(D.map(n=>chunkAKAEBDLM_cjs.j[n]));function et(n){if(n!==F)throw new chunkAKAEBDLM_cjs.d("collaboration-format-mismatch","The collaboration format version is missing or incompatible with this deployment.")}function ot(n){if(!n.share.has(chunkAKAEBDLM_cjs.l))throw new chunkAKAEBDLM_cjs.d("not-initialized");let t;try{t=n.getMap(chunkAKAEBDLM_cjs.l);}catch{throw new chunkAKAEBDLM_cjs.d("collaboration-format-mismatch","The saved room has invalid collaboration version information.")}if(t.get("initialized")!==true||typeof t.get("documentId")!="string")throw new chunkAKAEBDLM_cjs.d("not-initialized");let a=D.map(o=>{let e=t.get(o);if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new chunkAKAEBDLM_cjs.d("collaboration-format-mismatch","The saved room has missing or invalid collaboration version information.");return e});return Y(a)}
|
|
2
|
-
Object.defineProperty(exports,"collaborationModule",{enumerable:true,get:function(){return chunkQLZH2Q2C_cjs.b}});Object.defineProperty(exports,"CollaborationSchemaError",{enumerable:true,get:function(){return
|
|
1
|
+
'use strict';var chunkQLZH2Q2C_cjs=require('../chunk-QLZH2Q2C.cjs'),chunkVCMQFPO2_cjs=require('../chunk-VCMQFPO2.cjs'),l=require('yjs'),store=require('@docx-editor.dev/core/store'),collaboration=require('@docx-editor.dev/core/collaboration');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var l__namespace=/*#__PURE__*/_interopNamespace(l);var w="docxEditor",h=256,L=256,v=1e6,$=3e4;function X(n){let t=n.actorId.trim(),a=n.name.trim();if(t.length===0||t.length>h||a.length===0||a.length>h)throw new chunkVCMQFPO2_cjs.d("invalid-identity");if(n.color!==void 0&&n.color.length>64)throw new chunkVCMQFPO2_cjs.d("invalid-identity-color");return Object.freeze({actorId:t,name:a,...n.color?{color:n.color}:{},role:n.role??"human"})}function G(n){let t=n.trim();if(t.length===0||t.length>h)throw new chunkVCMQFPO2_cjs.d("invalid-document-id");return t}function J(n){let t=n?.trim()||globalThis.crypto.randomUUID();if(t.length===0||t.length>h)throw new chunkVCMQFPO2_cjs.d("invalid-session-id");return t}function Z(n,t){let a=n.toString();if(a===t)return;let o=0;for(;o<a.length&&o<t.length&&a.charCodeAt(o)===t.charCodeAt(o);)o+=1;let e=0;for(;e<a.length-o&&e<t.length-o&&a.charCodeAt(a.length-e-1)===t.charCodeAt(t.length-e-1);)e+=1;let r=a.length-o-e;r>0&&n.delete(o,r);let i=t.slice(o,t.length-e);i.length>0&&n.insert(o,i);}function M(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;return typeof t.paragraphId!="string"||t.paragraphId.length!==8||typeof t.position!="string"||t.position.length===0||t.position.length>2048||!/^[A-Za-z0-9_-]+$/.test(t.position)?null:{paragraphId:t.paragraphId,position:t.position}}function W(n){if(n===void 0||typeof n!="object"||n===null||Array.isArray(n))return;let t=n,a=M(t.anchor),o=M(t.head);if(a&&o)return {anchor:a,head:o};if(typeof t.paragraphId=="string"&&t.paragraphId.length===8&&typeof t.anchor=="string"&&typeof t.head=="string"&&t.anchor.length>0&&t.head.length>0&&t.anchor.length<=2048&&t.head.length<=2048&&/^[A-Za-z0-9_-]+$/.test(t.anchor)&&/^[A-Za-z0-9_-]+$/.test(t.head))return {anchor:{paragraphId:t.paragraphId,position:t.anchor},head:{paragraphId:t.paragraphId,position:t.head}}}function _(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;if(typeof t.actorId!="string"||t.actorId.length===0||t.actorId.length>h||typeof t.name!="string"||t.name.length===0||t.name.length>h)return null;let a=typeof t.color=="string"&&t.color.length<=64?t.color:void 0,o=t.role==="agent"?"agent":"human",e=W(t.selection);return {actorId:t.actorId,name:t.name,...a?{color:a}:{},role:o,...e?{selection:e}:{}}}function K(n){let t="";for(let a of n)t+=String.fromCharCode(a);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function q(n){let t=n.replace(/-/g,"+").replace(/_/g,"/"),a=atob(t+"=".repeat((4-t.length%4)%4));return Uint8Array.from(a,o=>o.charCodeAt(0))}var A=class{constructor(t,a,o,e,r,i){this.ydoc=t;this.awareness=a;this.baseline=i;this.documentId=o,this.sessionId=e,this.identity=r;let{root:d,paragraphs:p}=chunkVCMQFPO2_cjs.e(t);this.baselineSha256=String(d.get("baselineSha256")),this.initializedBy=String(d.get("initializedBy")),this.undoManager=new l__namespace.UndoManager([...p.values()],{trackedOrigins:new Set([this.localOrigin]),captureTimeout:0}),t.on("afterTransaction",this.onYjsTransaction),a.on("change",this.onAwarenessChange),this.publishAwareness(),this.setStatus("ready");}ydoc;awareness;baseline;documentId;sessionId;identity;statusState=collaboration.createCollaborationStatusTracker();statusListeners=new Set;selectionListeners=new Set;participantListeners=new Set;localOrigin=Object.freeze({kind:"docx-collaboration-local"});undoManager;baselineSha256;initializedBy;port=null;detachPort=null;applyingSharedState=false;remoteCounter=0;destroyed=false;status(){return this.statusState.status()}statusSnapshot(){return this.statusState.snapshot()}subscribeStatus(t){return this.statusListeners.add(t),()=>this.statusListeners.delete(t)}setTransportStatus(t,a,o){if(!this.destroyed&&!(this.statusState.status()==="error"&&t!=="error")){if(a!==void 0){this.setStatus(t,a,o);return}this.setStatus(t);}}get attached(){return this.port!==null}attach(t){if(this.destroyed)return ()=>{};if(this.port)return ()=>{};if(t.documentId!==this.documentId)return this.setStatus("error","document-id-mismatch"),()=>{};this.validateParagraphSet(t),this.port=t,this.reconcilePortFromYjs();let a=t.subscribe(o=>{if(!(this.destroyed||this.applyingSharedState)&&!(o.origin===store.ORIGIN_IDS.mutationRemote||o.origin===store.ORIGIN_IDS.projection||o.origin===store.ORIGIN_IDS.awareness))try{this.reconcileYjsFromPort();}catch(e){this.setStatus("error",e instanceof chunkVCMQFPO2_cjs.d?e.code:"local-mirror-failed",e instanceof chunkVCMQFPO2_cjs.d?e.detail:void 0);}});return this.detachPort=()=>{this.flushPendingJournals(),a(),this.port===t&&(this.port=null),this.detachPort=null;},()=>this.detachPort?.()}gateOperations(t,a){if(this.destroyed)return "collaboration-session-destroyed";if(this.statusState.status()!=="ready")return "collaboration-session-not-ready";if(!this.port)return "collaboration-session-not-attached";if(a.kind!=="body")return "experimental-collaboration-body-text-only";let o=new Map(this.port.paragraphs().map(e=>[e.nodeId,e.text.length]));for(let e of t){if(e.op!=="insertText"&&e.op!=="deleteText")return "experimental-collaboration-text-only";if("revision"in e&&e.revision!==void 0)return "experimental-collaboration-untracked-text-only";if(!this.port.paragraphByNodeId(e.paragraphId))return "experimental-collaboration-existing-paragraphs-only";let r=o.get(e.paragraphId);if(r===void 0)return "experimental-collaboration-existing-paragraphs-only";let i=e.op==="insertText"?r+e.text.length:r-Math.max(0,e.end-e.start);if(i>v)return "collaboration-text-limit";o.set(e.paragraphId,Math.max(0,i));}return null}canUndo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.undoStack.length>0}canRedo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.redoStack.length>0}undo(){return this.canUndo()?(this.undoManager.undo(),true):false}redo(){return this.canRedo()?(this.undoManager.redo(),true):false}setLocalSelection(t){if(this.destroyed)return;let{paragraphs:a}=chunkVCMQFPO2_cjs.e(this.ydoc),o=(r,i)=>{let d=a.get(r.toUpperCase());if(d)return {paragraphId:r.toUpperCase(),position:K(l__namespace.encodeRelativePosition(l__namespace.createRelativePositionFromTypeIndex(d,Math.max(0,Math.min(i,d.length)))))}},e;if(t){let r=o(t.anchor.paragraphId,t.anchor.offset),i=o(t.head.paragraphId,t.head.offset);r&&i&&(e={anchor:r,head:i});}this.publishAwareness(e);}participants(){let t=[],a=[...this.awareness.getStates().entries()].slice(0,L);for(let[o,e]of a){let r=_(e[w]);r&&t.push({actorId:r.actorId,name:r.name,...r.color?{color:r.color}:{},role:r.role??"human",isLocal:o===this.awareness.clientID});}return Object.freeze(t)}subscribeParticipants(t){return this.participantListeners.add(t),()=>this.participantListeners.delete(t)}remoteSelections(){if(!this.port)return [];let t=[...this.awareness.getStates().entries()].slice(0,L),{paragraphs:a}=chunkVCMQFPO2_cjs.e(this.ydoc),o=[];for(let[e,r]of t){if(e===this.awareness.clientID)continue;let i=_(r[w]);if(!i?.selection)continue;let d=y=>{let T=a.get(y.paragraphId);if(!T)return null;let u;try{u=l__namespace.createAbsolutePositionFromRelativePosition(l__namespace.decodeRelativePosition(q(y.position)),this.ydoc);}catch{return null}if(!u||u.type!==T)return null;let f=this.port?.paragraphs().find(U=>U.paragraphId===y.paragraphId);return f?{paragraphId:f.paragraphId,nodeId:f.nodeId,offset:u.index}:null},p=d(i.selection.anchor),x=d(i.selection.head);!p||!x||o.push(Object.freeze({actorId:i.actorId,name:i.name,...i.color?{color:i.color}:{},anchor:Object.freeze(p),head:Object.freeze(x)}));}return Object.freeze(o)}subscribeRemoteSelections(t){return this.selectionListeners.add(t),()=>this.selectionListeners.delete(t)}destroy(){this.destroyed||(this.flushPendingJournals(),this.detachPort?.(),this.destroyed=true,this.ydoc.off("afterTransaction",this.onYjsTransaction),this.awareness.off("change",this.onAwarenessChange),this.awareness.setLocalState(null),this.undoManager.destroy(),this.setStatus("destroyed"),this.statusListeners.clear(),this.selectionListeners.clear(),this.participantListeners.clear());}flushPendingJournals(){this.port?.flushPendingJournals();}onYjsTransaction=t=>{if(!this.destroyed&&t.origin!==this.localOrigin){try{this.validateImmutableSchema();}catch(a){this.setStatus("error",a instanceof chunkVCMQFPO2_cjs.d?a.code:"shared-schema-invalid",a instanceof chunkVCMQFPO2_cjs.d?a.detail:void 0);return}this.port&&this.reconcilePortFromYjs();}};onAwarenessChange=()=>{if(this.destroyed)return;let t=this.remoteSelections();for(let o of [...this.selectionListeners])o(t);let a=this.participants();for(let o of [...this.participantListeners])o(a);};publishAwareness(t){let a={actorId:this.identity.actorId,name:this.identity.name,...this.identity.color?{color:this.identity.color}:{},role:this.identity.role??"human",...t?{selection:t}:{}};this.awareness.setLocalStateField(w,a);}validateParagraphSet(t){let{paragraphs:a}=chunkVCMQFPO2_cjs.e(this.ydoc),o=t.paragraphs();if(o.length!==a.size||o.some(e=>!a.has(e.paragraphId)||!(a.get(e.paragraphId)instanceof l__namespace.Text)||a.get(e.paragraphId).length>v))throw new chunkVCMQFPO2_cjs.d("paragraph-set-mismatch")}validateImmutableSchema(){let{root:t,paragraphs:a}=chunkVCMQFPO2_cjs.e(this.ydoc),o=new Set(["protocolVersion","schemaVersion","documentId","baselineSha256","baselineByteLength","initializedBy","baseline","initialized"]);if([...t.keys()].some(r=>!o.has(r)))throw new chunkVCMQFPO2_cjs.d("unsupported-root-key");if(t.get("protocolVersion")!==chunkVCMQFPO2_cjs.a||t.get("schemaVersion")!==chunkVCMQFPO2_cjs.b||t.get("documentId")!==this.documentId||t.get("baselineSha256")!==this.baselineSha256||t.get("baselineByteLength")!==this.baseline.bytes.byteLength||t.get("initializedBy")!==this.initializedBy||t.get("initialized")!==true)throw new chunkVCMQFPO2_cjs.d("immutable-metadata-changed");let e=t.get("baseline");if(!(e instanceof Uint8Array)||e.byteLength!==this.baseline.bytes.byteLength||e.some((r,i)=>r!==this.baseline.bytes[i]))throw new chunkVCMQFPO2_cjs.d("immutable-baseline-changed");for(let[r,i]of a)if(!this.baseline.paragraphs.some(d=>d.paragraphId===r)||!(i instanceof l__namespace.Text)||i.length>v)throw new chunkVCMQFPO2_cjs.d("paragraph-set-mismatch")}reconcileYjsFromPort(){let t=this.port;if(!t)return;let{paragraphs:a}=chunkVCMQFPO2_cjs.e(this.ydoc);this.ydoc.transact(()=>{for(let o of t.paragraphs()){let e=a.get(o.paragraphId);if(!e)throw new chunkVCMQFPO2_cjs.d("paragraph-set-mismatch");Z(e,o.text);}},this.localOrigin),this.undoManager.stopCapturing();}reconcilePortFromYjs(){let t=this.port;if(!t||this.applyingSharedState)return;let{paragraphs:a}=chunkVCMQFPO2_cjs.e(this.ydoc);this.applyingSharedState=true;try{this.validateParagraphSet(t);let o=[];for(let e of t.paragraphs()){let r=a.get(e.paragraphId);if(!r)throw new chunkVCMQFPO2_cjs.d("paragraph-set-mismatch");let i=r.toString();i!==e.text&&o.push({paragraphId:e.paragraphId,text:i});}if(o.length>0){this.remoteCounter+=1;let e=t.applyParagraphTexts(o,{origin:store.ORIGIN_IDS.mutationRemote,actorId:"remote",operationId:`remote:${this.remoteCounter}`});if(!e.ok)throw new chunkVCMQFPO2_cjs.d(collaboration.isCollaborationFailureCode(e.reason)?e.reason:"remote-apply-failed",collaboration.isCollaborationFailureCode(e.reason)?void 0:e.reason)}}catch(o){this.setStatus("error",o instanceof chunkVCMQFPO2_cjs.d?o.code:"remote-apply-failed",o instanceof chunkVCMQFPO2_cjs.d?o.detail:void 0);}finally{this.applyingSharedState=false;}}setStatus(t,a,o){if(!this.statusState.set(t,a,o))return;let e=this.statusState.snapshot();for(let r of [...this.statusListeners])r(e.status,e.reason?.code,e.reason?.detail);}};async function Q(n,t,a){if(n.bootstrap.kind==="create-or-join")throw new TypeError("createTextCollaboration does not support bootstrap kind 'create-or-join'. Use createDocumentCollaboration.");if(n.bootstrap.kind==="create"){let o=chunkVCMQFPO2_cjs.f(n.bootstrap.document,t);return await chunkVCMQFPO2_cjs.g(n.ydoc,t,a.actorId,o),chunkVCMQFPO2_cjs.h(n.ydoc,t)}return await chunkVCMQFPO2_cjs.i(n.ydoc,n.bootstrap.timeoutMs??$,n.bootstrap.signal),chunkVCMQFPO2_cjs.h(n.ydoc,t)}async function tt(n){let t=G(n.documentId),a=J(n.sessionId),o=X(n.identity),e=await Q(n,t,o),r=new A(n.ydoc,n.awareness,t,a,o,e);return Object.freeze({document:new Uint8Array(e.bytes),session:r,destroy:()=>r.destroy()})}var D=["protocolVersion","sharedSchemaVersion","repairVersion","canonicalModelVersion"];function Y(n){return `docx-collaboration:${n.join(".")}`}var F=Y(D.map(n=>chunkVCMQFPO2_cjs.j[n]));function et(n){if(n!==F)throw new chunkVCMQFPO2_cjs.d("collaboration-format-mismatch","The collaboration format version is missing or incompatible with this deployment.")}function ot(n){if(!n.share.has(chunkVCMQFPO2_cjs.l))throw new chunkVCMQFPO2_cjs.d("not-initialized");let t;try{t=n.getMap(chunkVCMQFPO2_cjs.l);}catch{throw new chunkVCMQFPO2_cjs.d("collaboration-format-mismatch","The saved room has invalid collaboration version information.")}if(t.get("initialized")!==true||typeof t.get("documentId")!="string")throw new chunkVCMQFPO2_cjs.d("not-initialized");let a=D.map(o=>{let e=t.get(o);if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new chunkVCMQFPO2_cjs.d("collaboration-format-mismatch","The saved room has missing or invalid collaboration version information.");return e});return Y(a)}
|
|
2
|
+
Object.defineProperty(exports,"collaborationModule",{enumerable:true,get:function(){return chunkQLZH2Q2C_cjs.b}});Object.defineProperty(exports,"CollaborationSchemaError",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.d}});Object.defineProperty(exports,"DOCUMENT_COLLABORATION_VERSIONS",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.j}});Object.defineProperty(exports,"MAX_BASELINE_BYTES",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.c}});Object.defineProperty(exports,"PROTOCOL_VERSION",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.a}});Object.defineProperty(exports,"SCHEMA_VERSION",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.b}});Object.defineProperty(exports,"assertDocumentCollaborationCompatibility",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.k}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.p}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.n}});Object.defineProperty(exports,"readCollaborationResourceUsage",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.m}});exports.COLLABORATION_FORMAT_VERSION=F;exports.assertCollaborationFormatCompatibility=et;exports.createTextCollaboration=tt;exports.readCollaborationFormatVersion=ot;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-
|
|
2
|
-
export { a as CollaborationBootstrap, c as CollaborationHandle, b as CollaborationIdentityUpdate, C as CollaborationSession, d as CreateTextCollaborationOptions, T as TextCollaborationHandle, e as TextCollaborationSession, f as createTextCollaboration } from '../session-
|
|
3
|
-
export { a as CollaborationResourceUsage, C as CreateDocumentCollaborationOptions, D as DocumentCollaborationHandle, b as DocumentCollaborationSession, c as createDocumentCollaboration, r as readCollaborationResourceUsage } from '../document-session-
|
|
1
|
+
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-DlSv0oAd.cjs';
|
|
2
|
+
export { a as CollaborationBootstrap, c as CollaborationHandle, b as CollaborationIdentityUpdate, C as CollaborationSession, d as CreateTextCollaborationOptions, T as TextCollaborationHandle, e as TextCollaborationSession, f as createTextCollaboration } from '../session-B-ds4k64.cjs';
|
|
3
|
+
export { a as CollaborationResourceUsage, C as CreateDocumentCollaborationOptions, D as DocumentCollaborationHandle, b as DocumentCollaborationSession, c as createDocumentCollaboration, r as readCollaborationResourceUsage } from '../document-session-BKKfJzKB.cjs';
|
|
4
4
|
import { CollaborationFailureCode } from '@docx-editor.dev/core/collaboration';
|
|
5
5
|
import * as Y from 'yjs';
|
|
6
6
|
import '@docx-editor.dev/core/editor';
|
|
@@ -132,4 +132,5 @@ declare function assertCollaborationFormatCompatibility(version: unknown): void;
|
|
|
132
132
|
*/
|
|
133
133
|
declare function readCollaborationFormatVersion(ydoc: Y.Doc): string;
|
|
134
134
|
|
|
135
|
-
export { COLLABORATION_FORMAT_VERSION, CollaborationSchemaError, DOCUMENT_COLLABORATION_VERSIONS,
|
|
135
|
+
export { COLLABORATION_FORMAT_VERSION, CollaborationSchemaError, DOCUMENT_COLLABORATION_VERSIONS, MAX_BASELINE_BYTES, PROTOCOL_VERSION, SCHEMA_VERSION, assertCollaborationFormatCompatibility, assertDocumentCollaborationCompatibility, readCollaborationDocument, readCollaborationFormatVersion };
|
|
136
|
+
export type { DocumentCollaborationVersions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-
|
|
2
|
-
export { a as CollaborationBootstrap, c as CollaborationHandle, b as CollaborationIdentityUpdate, C as CollaborationSession, d as CreateTextCollaborationOptions, T as TextCollaborationHandle, e as TextCollaborationSession, f as createTextCollaboration } from '../session-
|
|
3
|
-
export { a as CollaborationResourceUsage, C as CreateDocumentCollaborationOptions, D as DocumentCollaborationHandle, b as DocumentCollaborationSession, c as createDocumentCollaboration, r as readCollaborationResourceUsage } from '../document-session-
|
|
1
|
+
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-DlSv0oAd.js';
|
|
2
|
+
export { a as CollaborationBootstrap, c as CollaborationHandle, b as CollaborationIdentityUpdate, C as CollaborationSession, d as CreateTextCollaborationOptions, T as TextCollaborationHandle, e as TextCollaborationSession, f as createTextCollaboration } from '../session-B-ds4k64.js';
|
|
3
|
+
export { a as CollaborationResourceUsage, C as CreateDocumentCollaborationOptions, D as DocumentCollaborationHandle, b as DocumentCollaborationSession, c as createDocumentCollaboration, r as readCollaborationResourceUsage } from '../document-session-BQ4nBDTd.js';
|
|
4
4
|
import { CollaborationFailureCode } from '@docx-editor.dev/core/collaboration';
|
|
5
5
|
import * as Y from 'yjs';
|
|
6
6
|
import '@docx-editor.dev/core/editor';
|
|
@@ -132,4 +132,5 @@ declare function assertCollaborationFormatCompatibility(version: unknown): void;
|
|
|
132
132
|
*/
|
|
133
133
|
declare function readCollaborationFormatVersion(ydoc: Y.Doc): string;
|
|
134
134
|
|
|
135
|
-
export { COLLABORATION_FORMAT_VERSION, CollaborationSchemaError, DOCUMENT_COLLABORATION_VERSIONS,
|
|
135
|
+
export { COLLABORATION_FORMAT_VERSION, CollaborationSchemaError, DOCUMENT_COLLABORATION_VERSIONS, MAX_BASELINE_BYTES, PROTOCOL_VERSION, SCHEMA_VERSION, assertCollaborationFormatCompatibility, assertDocumentCollaborationCompatibility, readCollaborationDocument, readCollaborationFormatVersion };
|
|
136
|
+
export type { DocumentCollaborationVersions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as collaborationModule}from'../chunk-Q2VBO66F.js';import {j,d,l as l$1,f,g,h as h$1,i,e,a,b}from'../chunk-3QCDJ2BW.js';export{d as CollaborationSchemaError,j as DOCUMENT_COLLABORATION_VERSIONS,c as MAX_BASELINE_BYTES,a as PROTOCOL_VERSION,b as SCHEMA_VERSION,k as assertDocumentCollaborationCompatibility,p as createDocumentCollaboration,n as readCollaborationDocument,m as readCollaborationResourceUsage}from'../chunk-3QCDJ2BW.js';import*as l from'yjs';import {ORIGIN_IDS}from'@docx-editor.dev/core/store';import {createCollaborationStatusTracker,isCollaborationFailureCode}from'@docx-editor.dev/core/collaboration';var w="docxEditor",h=256,L=256,v=1e6,$=3e4;function X(n){let t=n.actorId.trim(),a=n.name.trim();if(t.length===0||t.length>h||a.length===0||a.length>h)throw new d("invalid-identity");if(n.color!==void 0&&n.color.length>64)throw new d("invalid-identity-color");return Object.freeze({actorId:t,name:a,...n.color?{color:n.color}:{},role:n.role??"human"})}function G(n){let t=n.trim();if(t.length===0||t.length>h)throw new d("invalid-document-id");return t}function J(n){let t=n?.trim()||globalThis.crypto.randomUUID();if(t.length===0||t.length>h)throw new d("invalid-session-id");return t}function Z(n,t){let a=n.toString();if(a===t)return;let o=0;for(;o<a.length&&o<t.length&&a.charCodeAt(o)===t.charCodeAt(o);)o+=1;let e=0;for(;e<a.length-o&&e<t.length-o&&a.charCodeAt(a.length-e-1)===t.charCodeAt(t.length-e-1);)e+=1;let r=a.length-o-e;r>0&&n.delete(o,r);let i=t.slice(o,t.length-e);i.length>0&&n.insert(o,i);}function M(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;return typeof t.paragraphId!="string"||t.paragraphId.length!==8||typeof t.position!="string"||t.position.length===0||t.position.length>2048||!/^[A-Za-z0-9_-]+$/.test(t.position)?null:{paragraphId:t.paragraphId,position:t.position}}function W(n){if(n===void 0||typeof n!="object"||n===null||Array.isArray(n))return;let t=n,a=M(t.anchor),o=M(t.head);if(a&&o)return {anchor:a,head:o};if(typeof t.paragraphId=="string"&&t.paragraphId.length===8&&typeof t.anchor=="string"&&typeof t.head=="string"&&t.anchor.length>0&&t.head.length>0&&t.anchor.length<=2048&&t.head.length<=2048&&/^[A-Za-z0-9_-]+$/.test(t.anchor)&&/^[A-Za-z0-9_-]+$/.test(t.head))return {anchor:{paragraphId:t.paragraphId,position:t.anchor},head:{paragraphId:t.paragraphId,position:t.head}}}function _(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;if(typeof t.actorId!="string"||t.actorId.length===0||t.actorId.length>h||typeof t.name!="string"||t.name.length===0||t.name.length>h)return null;let a=typeof t.color=="string"&&t.color.length<=64?t.color:void 0,o=t.role==="agent"?"agent":"human",e=W(t.selection);return {actorId:t.actorId,name:t.name,...a?{color:a}:{},role:o,...e?{selection:e}:{}}}function K(n){let t="";for(let a of n)t+=String.fromCharCode(a);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function q(n){let t=n.replace(/-/g,"+").replace(/_/g,"/"),a=atob(t+"=".repeat((4-t.length%4)%4));return Uint8Array.from(a,o=>o.charCodeAt(0))}var A=class{constructor(t,a,o,e$1,r,i){this.ydoc=t;this.awareness=a;this.baseline=i;this.documentId=o,this.sessionId=e$1,this.identity=r;let{root:d,paragraphs:p}=e(t);this.baselineSha256=String(d.get("baselineSha256")),this.initializedBy=String(d.get("initializedBy")),this.undoManager=new l.UndoManager([...p.values()],{trackedOrigins:new Set([this.localOrigin]),captureTimeout:0}),t.on("afterTransaction",this.onYjsTransaction),a.on("change",this.onAwarenessChange),this.publishAwareness(),this.setStatus("ready");}ydoc;awareness;baseline;documentId;sessionId;identity;statusState=createCollaborationStatusTracker();statusListeners=new Set;selectionListeners=new Set;participantListeners=new Set;localOrigin=Object.freeze({kind:"docx-collaboration-local"});undoManager;baselineSha256;initializedBy;port=null;detachPort=null;applyingSharedState=false;remoteCounter=0;destroyed=false;status(){return this.statusState.status()}statusSnapshot(){return this.statusState.snapshot()}subscribeStatus(t){return this.statusListeners.add(t),()=>this.statusListeners.delete(t)}setTransportStatus(t,a,o){if(!this.destroyed&&!(this.statusState.status()==="error"&&t!=="error")){if(a!==void 0){this.setStatus(t,a,o);return}this.setStatus(t);}}get attached(){return this.port!==null}attach(t){if(this.destroyed)return ()=>{};if(this.port)return ()=>{};if(t.documentId!==this.documentId)return this.setStatus("error","document-id-mismatch"),()=>{};this.validateParagraphSet(t),this.port=t,this.reconcilePortFromYjs();let a=t.subscribe(o=>{if(!(this.destroyed||this.applyingSharedState)&&!(o.origin===ORIGIN_IDS.mutationRemote||o.origin===ORIGIN_IDS.projection||o.origin===ORIGIN_IDS.awareness))try{this.reconcileYjsFromPort();}catch(e){this.setStatus("error",e instanceof d?e.code:"local-mirror-failed",e instanceof d?e.detail:void 0);}});return this.detachPort=()=>{this.flushPendingJournals(),a(),this.port===t&&(this.port=null),this.detachPort=null;},()=>this.detachPort?.()}gateOperations(t,a){if(this.destroyed)return "collaboration-session-destroyed";if(this.statusState.status()!=="ready")return "collaboration-session-not-ready";if(!this.port)return "collaboration-session-not-attached";if(a.kind!=="body")return "experimental-collaboration-body-text-only";let o=new Map(this.port.paragraphs().map(e=>[e.nodeId,e.text.length]));for(let e of t){if(e.op!=="insertText"&&e.op!=="deleteText")return "experimental-collaboration-text-only";if("revision"in e&&e.revision!==void 0)return "experimental-collaboration-untracked-text-only";if(!this.port.paragraphByNodeId(e.paragraphId))return "experimental-collaboration-existing-paragraphs-only";let r=o.get(e.paragraphId);if(r===void 0)return "experimental-collaboration-existing-paragraphs-only";let i=e.op==="insertText"?r+e.text.length:r-Math.max(0,e.end-e.start);if(i>v)return "collaboration-text-limit";o.set(e.paragraphId,Math.max(0,i));}return null}canUndo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.undoStack.length>0}canRedo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.redoStack.length>0}undo(){return this.canUndo()?(this.undoManager.undo(),true):false}redo(){return this.canRedo()?(this.undoManager.redo(),true):false}setLocalSelection(t){if(this.destroyed)return;let{paragraphs:a}=e(this.ydoc),o=(r,i)=>{let d=a.get(r.toUpperCase());if(d)return {paragraphId:r.toUpperCase(),position:K(l.encodeRelativePosition(l.createRelativePositionFromTypeIndex(d,Math.max(0,Math.min(i,d.length)))))}},e$1;if(t){let r=o(t.anchor.paragraphId,t.anchor.offset),i=o(t.head.paragraphId,t.head.offset);r&&i&&(e$1={anchor:r,head:i});}this.publishAwareness(e$1);}participants(){let t=[],a=[...this.awareness.getStates().entries()].slice(0,L);for(let[o,e]of a){let r=_(e[w]);r&&t.push({actorId:r.actorId,name:r.name,...r.color?{color:r.color}:{},role:r.role??"human",isLocal:o===this.awareness.clientID});}return Object.freeze(t)}subscribeParticipants(t){return this.participantListeners.add(t),()=>this.participantListeners.delete(t)}remoteSelections(){if(!this.port)return [];let t=[...this.awareness.getStates().entries()].slice(0,L),{paragraphs:a}=e(this.ydoc),o=[];for(let[e,r]of t){if(e===this.awareness.clientID)continue;let i=_(r[w]);if(!i?.selection)continue;let d=y=>{let T=a.get(y.paragraphId);if(!T)return null;let u;try{u=l.createAbsolutePositionFromRelativePosition(l.decodeRelativePosition(q(y.position)),this.ydoc);}catch{return null}if(!u||u.type!==T)return null;let f=this.port?.paragraphs().find(U=>U.paragraphId===y.paragraphId);return f?{paragraphId:f.paragraphId,nodeId:f.nodeId,offset:u.index}:null},p=d(i.selection.anchor),x=d(i.selection.head);!p||!x||o.push(Object.freeze({actorId:i.actorId,name:i.name,...i.color?{color:i.color}:{},anchor:Object.freeze(p),head:Object.freeze(x)}));}return Object.freeze(o)}subscribeRemoteSelections(t){return this.selectionListeners.add(t),()=>this.selectionListeners.delete(t)}destroy(){this.destroyed||(this.flushPendingJournals(),this.detachPort?.(),this.destroyed=true,this.ydoc.off("afterTransaction",this.onYjsTransaction),this.awareness.off("change",this.onAwarenessChange),this.awareness.setLocalState(null),this.undoManager.destroy(),this.setStatus("destroyed"),this.statusListeners.clear(),this.selectionListeners.clear(),this.participantListeners.clear());}flushPendingJournals(){this.port?.flushPendingJournals();}onYjsTransaction=t=>{if(!this.destroyed&&t.origin!==this.localOrigin){try{this.validateImmutableSchema();}catch(a){this.setStatus("error",a instanceof d?a.code:"shared-schema-invalid",a instanceof d?a.detail:void 0);return}this.port&&this.reconcilePortFromYjs();}};onAwarenessChange=()=>{if(this.destroyed)return;let t=this.remoteSelections();for(let o of [...this.selectionListeners])o(t);let a=this.participants();for(let o of [...this.participantListeners])o(a);};publishAwareness(t){let a={actorId:this.identity.actorId,name:this.identity.name,...this.identity.color?{color:this.identity.color}:{},role:this.identity.role??"human",...t?{selection:t}:{}};this.awareness.setLocalStateField(w,a);}validateParagraphSet(t){let{paragraphs:a}=e(this.ydoc),o=t.paragraphs();if(o.length!==a.size||o.some(e=>!a.has(e.paragraphId)||!(a.get(e.paragraphId)instanceof l.Text)||a.get(e.paragraphId).length>v))throw new d("paragraph-set-mismatch")}validateImmutableSchema(){let{root:t,paragraphs:a$1}=e(this.ydoc),o=new Set(["protocolVersion","schemaVersion","documentId","baselineSha256","baselineByteLength","initializedBy","baseline","initialized"]);if([...t.keys()].some(r=>!o.has(r)))throw new d("unsupported-root-key");if(t.get("protocolVersion")!==a||t.get("schemaVersion")!==b||t.get("documentId")!==this.documentId||t.get("baselineSha256")!==this.baselineSha256||t.get("baselineByteLength")!==this.baseline.bytes.byteLength||t.get("initializedBy")!==this.initializedBy||t.get("initialized")!==true)throw new d("immutable-metadata-changed");let e$1=t.get("baseline");if(!(e$1 instanceof Uint8Array)||e$1.byteLength!==this.baseline.bytes.byteLength||e$1.some((r,i)=>r!==this.baseline.bytes[i]))throw new d("immutable-baseline-changed");for(let[r,i]of a$1)if(!this.baseline.paragraphs.some(d=>d.paragraphId===r)||!(i instanceof l.Text)||i.length>v)throw new d("paragraph-set-mismatch")}reconcileYjsFromPort(){let t=this.port;if(!t)return;let{paragraphs:a}=e(this.ydoc);this.ydoc.transact(()=>{for(let o of t.paragraphs()){let e=a.get(o.paragraphId);if(!e)throw new d("paragraph-set-mismatch");Z(e,o.text);}},this.localOrigin),this.undoManager.stopCapturing();}reconcilePortFromYjs(){let t=this.port;if(!t||this.applyingSharedState)return;let{paragraphs:a}=e(this.ydoc);this.applyingSharedState=true;try{this.validateParagraphSet(t);let o=[];for(let e of t.paragraphs()){let r=a.get(e.paragraphId);if(!r)throw new d("paragraph-set-mismatch");let i=r.toString();i!==e.text&&o.push({paragraphId:e.paragraphId,text:i});}if(o.length>0){this.remoteCounter+=1;let e=t.applyParagraphTexts(o,{origin:ORIGIN_IDS.mutationRemote,actorId:"remote",operationId:`remote:${this.remoteCounter}`});if(!e.ok)throw new d(isCollaborationFailureCode(e.reason)?e.reason:"remote-apply-failed",isCollaborationFailureCode(e.reason)?void 0:e.reason)}}catch(o){this.setStatus("error",o instanceof d?o.code:"remote-apply-failed",o instanceof d?o.detail:void 0);}finally{this.applyingSharedState=false;}}setStatus(t,a,o){if(!this.statusState.set(t,a,o))return;let e=this.statusState.snapshot();for(let r of [...this.statusListeners])r(e.status,e.reason?.code,e.reason?.detail);}};async function Q(n,t,a){if(n.bootstrap.kind==="create-or-join")throw new TypeError("createTextCollaboration does not support bootstrap kind 'create-or-join'. Use createDocumentCollaboration.");if(n.bootstrap.kind==="create"){let o=f(n.bootstrap.document,t);return await g(n.ydoc,t,a.actorId,o),h$1(n.ydoc,t)}return await i(n.ydoc,n.bootstrap.timeoutMs??$,n.bootstrap.signal),h$1(n.ydoc,t)}async function tt(n){let t=G(n.documentId),a=J(n.sessionId),o=X(n.identity),e=await Q(n,t,o),r=new A(n.ydoc,n.awareness,t,a,o,e);return Object.freeze({document:new Uint8Array(e.bytes),session:r,destroy:()=>r.destroy()})}var D=["protocolVersion","sharedSchemaVersion","repairVersion","canonicalModelVersion"];function Y(n){return `docx-collaboration:${n.join(".")}`}var F=Y(D.map(n=>j[n]));function et(n){if(n!==F)throw new d("collaboration-format-mismatch","The collaboration format version is missing or incompatible with this deployment.")}function ot(n){if(!n.share.has(l$1))throw new d("not-initialized");let t;try{t=n.getMap(l$1);}catch{throw new d("collaboration-format-mismatch","The saved room has invalid collaboration version information.")}if(t.get("initialized")!==true||typeof t.get("documentId")!="string")throw new d("not-initialized");let a=D.map(o=>{let e=t.get(o);if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new d("collaboration-format-mismatch","The saved room has missing or invalid collaboration version information.");return e});return Y(a)}
|
|
1
|
+
export{b as collaborationModule}from'../chunk-Q2VBO66F.js';import {j,d,l as l$1,f,g,h as h$1,i,e,a,b}from'../chunk-MRW46GJW.js';export{d as CollaborationSchemaError,j as DOCUMENT_COLLABORATION_VERSIONS,c as MAX_BASELINE_BYTES,a as PROTOCOL_VERSION,b as SCHEMA_VERSION,k as assertDocumentCollaborationCompatibility,p as createDocumentCollaboration,n as readCollaborationDocument,m as readCollaborationResourceUsage}from'../chunk-MRW46GJW.js';import*as l from'yjs';import {ORIGIN_IDS}from'@docx-editor.dev/core/store';import {createCollaborationStatusTracker,isCollaborationFailureCode}from'@docx-editor.dev/core/collaboration';var w="docxEditor",h=256,L=256,v=1e6,$=3e4;function X(n){let t=n.actorId.trim(),a=n.name.trim();if(t.length===0||t.length>h||a.length===0||a.length>h)throw new d("invalid-identity");if(n.color!==void 0&&n.color.length>64)throw new d("invalid-identity-color");return Object.freeze({actorId:t,name:a,...n.color?{color:n.color}:{},role:n.role??"human"})}function G(n){let t=n.trim();if(t.length===0||t.length>h)throw new d("invalid-document-id");return t}function J(n){let t=n?.trim()||globalThis.crypto.randomUUID();if(t.length===0||t.length>h)throw new d("invalid-session-id");return t}function Z(n,t){let a=n.toString();if(a===t)return;let o=0;for(;o<a.length&&o<t.length&&a.charCodeAt(o)===t.charCodeAt(o);)o+=1;let e=0;for(;e<a.length-o&&e<t.length-o&&a.charCodeAt(a.length-e-1)===t.charCodeAt(t.length-e-1);)e+=1;let r=a.length-o-e;r>0&&n.delete(o,r);let i=t.slice(o,t.length-e);i.length>0&&n.insert(o,i);}function M(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;return typeof t.paragraphId!="string"||t.paragraphId.length!==8||typeof t.position!="string"||t.position.length===0||t.position.length>2048||!/^[A-Za-z0-9_-]+$/.test(t.position)?null:{paragraphId:t.paragraphId,position:t.position}}function W(n){if(n===void 0||typeof n!="object"||n===null||Array.isArray(n))return;let t=n,a=M(t.anchor),o=M(t.head);if(a&&o)return {anchor:a,head:o};if(typeof t.paragraphId=="string"&&t.paragraphId.length===8&&typeof t.anchor=="string"&&typeof t.head=="string"&&t.anchor.length>0&&t.head.length>0&&t.anchor.length<=2048&&t.head.length<=2048&&/^[A-Za-z0-9_-]+$/.test(t.anchor)&&/^[A-Za-z0-9_-]+$/.test(t.head))return {anchor:{paragraphId:t.paragraphId,position:t.anchor},head:{paragraphId:t.paragraphId,position:t.head}}}function _(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;let t=n;if(typeof t.actorId!="string"||t.actorId.length===0||t.actorId.length>h||typeof t.name!="string"||t.name.length===0||t.name.length>h)return null;let a=typeof t.color=="string"&&t.color.length<=64?t.color:void 0,o=t.role==="agent"?"agent":"human",e=W(t.selection);return {actorId:t.actorId,name:t.name,...a?{color:a}:{},role:o,...e?{selection:e}:{}}}function K(n){let t="";for(let a of n)t+=String.fromCharCode(a);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function q(n){let t=n.replace(/-/g,"+").replace(/_/g,"/"),a=atob(t+"=".repeat((4-t.length%4)%4));return Uint8Array.from(a,o=>o.charCodeAt(0))}var A=class{constructor(t,a,o,e$1,r,i){this.ydoc=t;this.awareness=a;this.baseline=i;this.documentId=o,this.sessionId=e$1,this.identity=r;let{root:d,paragraphs:p}=e(t);this.baselineSha256=String(d.get("baselineSha256")),this.initializedBy=String(d.get("initializedBy")),this.undoManager=new l.UndoManager([...p.values()],{trackedOrigins:new Set([this.localOrigin]),captureTimeout:0}),t.on("afterTransaction",this.onYjsTransaction),a.on("change",this.onAwarenessChange),this.publishAwareness(),this.setStatus("ready");}ydoc;awareness;baseline;documentId;sessionId;identity;statusState=createCollaborationStatusTracker();statusListeners=new Set;selectionListeners=new Set;participantListeners=new Set;localOrigin=Object.freeze({kind:"docx-collaboration-local"});undoManager;baselineSha256;initializedBy;port=null;detachPort=null;applyingSharedState=false;remoteCounter=0;destroyed=false;status(){return this.statusState.status()}statusSnapshot(){return this.statusState.snapshot()}subscribeStatus(t){return this.statusListeners.add(t),()=>this.statusListeners.delete(t)}setTransportStatus(t,a,o){if(!this.destroyed&&!(this.statusState.status()==="error"&&t!=="error")){if(a!==void 0){this.setStatus(t,a,o);return}this.setStatus(t);}}get attached(){return this.port!==null}attach(t){if(this.destroyed)return ()=>{};if(this.port)return ()=>{};if(t.documentId!==this.documentId)return this.setStatus("error","document-id-mismatch"),()=>{};this.validateParagraphSet(t),this.port=t,this.reconcilePortFromYjs();let a=t.subscribe(o=>{if(!(this.destroyed||this.applyingSharedState)&&!(o.origin===ORIGIN_IDS.mutationRemote||o.origin===ORIGIN_IDS.projection||o.origin===ORIGIN_IDS.awareness))try{this.reconcileYjsFromPort();}catch(e){this.setStatus("error",e instanceof d?e.code:"local-mirror-failed",e instanceof d?e.detail:void 0);}});return this.detachPort=()=>{this.flushPendingJournals(),a(),this.port===t&&(this.port=null),this.detachPort=null;},()=>this.detachPort?.()}gateOperations(t,a){if(this.destroyed)return "collaboration-session-destroyed";if(this.statusState.status()!=="ready")return "collaboration-session-not-ready";if(!this.port)return "collaboration-session-not-attached";if(a.kind!=="body")return "experimental-collaboration-body-text-only";let o=new Map(this.port.paragraphs().map(e=>[e.nodeId,e.text.length]));for(let e of t){if(e.op!=="insertText"&&e.op!=="deleteText")return "experimental-collaboration-text-only";if("revision"in e&&e.revision!==void 0)return "experimental-collaboration-untracked-text-only";if(!this.port.paragraphByNodeId(e.paragraphId))return "experimental-collaboration-existing-paragraphs-only";let r=o.get(e.paragraphId);if(r===void 0)return "experimental-collaboration-existing-paragraphs-only";let i=e.op==="insertText"?r+e.text.length:r-Math.max(0,e.end-e.start);if(i>v)return "collaboration-text-limit";o.set(e.paragraphId,Math.max(0,i));}return null}canUndo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.undoStack.length>0}canRedo(){return !this.destroyed&&this.statusState.status()==="ready"&&this.undoManager.redoStack.length>0}undo(){return this.canUndo()?(this.undoManager.undo(),true):false}redo(){return this.canRedo()?(this.undoManager.redo(),true):false}setLocalSelection(t){if(this.destroyed)return;let{paragraphs:a}=e(this.ydoc),o=(r,i)=>{let d=a.get(r.toUpperCase());if(d)return {paragraphId:r.toUpperCase(),position:K(l.encodeRelativePosition(l.createRelativePositionFromTypeIndex(d,Math.max(0,Math.min(i,d.length)))))}},e$1;if(t){let r=o(t.anchor.paragraphId,t.anchor.offset),i=o(t.head.paragraphId,t.head.offset);r&&i&&(e$1={anchor:r,head:i});}this.publishAwareness(e$1);}participants(){let t=[],a=[...this.awareness.getStates().entries()].slice(0,L);for(let[o,e]of a){let r=_(e[w]);r&&t.push({actorId:r.actorId,name:r.name,...r.color?{color:r.color}:{},role:r.role??"human",isLocal:o===this.awareness.clientID});}return Object.freeze(t)}subscribeParticipants(t){return this.participantListeners.add(t),()=>this.participantListeners.delete(t)}remoteSelections(){if(!this.port)return [];let t=[...this.awareness.getStates().entries()].slice(0,L),{paragraphs:a}=e(this.ydoc),o=[];for(let[e,r]of t){if(e===this.awareness.clientID)continue;let i=_(r[w]);if(!i?.selection)continue;let d=y=>{let T=a.get(y.paragraphId);if(!T)return null;let u;try{u=l.createAbsolutePositionFromRelativePosition(l.decodeRelativePosition(q(y.position)),this.ydoc);}catch{return null}if(!u||u.type!==T)return null;let f=this.port?.paragraphs().find(U=>U.paragraphId===y.paragraphId);return f?{paragraphId:f.paragraphId,nodeId:f.nodeId,offset:u.index}:null},p=d(i.selection.anchor),x=d(i.selection.head);!p||!x||o.push(Object.freeze({actorId:i.actorId,name:i.name,...i.color?{color:i.color}:{},anchor:Object.freeze(p),head:Object.freeze(x)}));}return Object.freeze(o)}subscribeRemoteSelections(t){return this.selectionListeners.add(t),()=>this.selectionListeners.delete(t)}destroy(){this.destroyed||(this.flushPendingJournals(),this.detachPort?.(),this.destroyed=true,this.ydoc.off("afterTransaction",this.onYjsTransaction),this.awareness.off("change",this.onAwarenessChange),this.awareness.setLocalState(null),this.undoManager.destroy(),this.setStatus("destroyed"),this.statusListeners.clear(),this.selectionListeners.clear(),this.participantListeners.clear());}flushPendingJournals(){this.port?.flushPendingJournals();}onYjsTransaction=t=>{if(!this.destroyed&&t.origin!==this.localOrigin){try{this.validateImmutableSchema();}catch(a){this.setStatus("error",a instanceof d?a.code:"shared-schema-invalid",a instanceof d?a.detail:void 0);return}this.port&&this.reconcilePortFromYjs();}};onAwarenessChange=()=>{if(this.destroyed)return;let t=this.remoteSelections();for(let o of [...this.selectionListeners])o(t);let a=this.participants();for(let o of [...this.participantListeners])o(a);};publishAwareness(t){let a={actorId:this.identity.actorId,name:this.identity.name,...this.identity.color?{color:this.identity.color}:{},role:this.identity.role??"human",...t?{selection:t}:{}};this.awareness.setLocalStateField(w,a);}validateParagraphSet(t){let{paragraphs:a}=e(this.ydoc),o=t.paragraphs();if(o.length!==a.size||o.some(e=>!a.has(e.paragraphId)||!(a.get(e.paragraphId)instanceof l.Text)||a.get(e.paragraphId).length>v))throw new d("paragraph-set-mismatch")}validateImmutableSchema(){let{root:t,paragraphs:a$1}=e(this.ydoc),o=new Set(["protocolVersion","schemaVersion","documentId","baselineSha256","baselineByteLength","initializedBy","baseline","initialized"]);if([...t.keys()].some(r=>!o.has(r)))throw new d("unsupported-root-key");if(t.get("protocolVersion")!==a||t.get("schemaVersion")!==b||t.get("documentId")!==this.documentId||t.get("baselineSha256")!==this.baselineSha256||t.get("baselineByteLength")!==this.baseline.bytes.byteLength||t.get("initializedBy")!==this.initializedBy||t.get("initialized")!==true)throw new d("immutable-metadata-changed");let e$1=t.get("baseline");if(!(e$1 instanceof Uint8Array)||e$1.byteLength!==this.baseline.bytes.byteLength||e$1.some((r,i)=>r!==this.baseline.bytes[i]))throw new d("immutable-baseline-changed");for(let[r,i]of a$1)if(!this.baseline.paragraphs.some(d=>d.paragraphId===r)||!(i instanceof l.Text)||i.length>v)throw new d("paragraph-set-mismatch")}reconcileYjsFromPort(){let t=this.port;if(!t)return;let{paragraphs:a}=e(this.ydoc);this.ydoc.transact(()=>{for(let o of t.paragraphs()){let e=a.get(o.paragraphId);if(!e)throw new d("paragraph-set-mismatch");Z(e,o.text);}},this.localOrigin),this.undoManager.stopCapturing();}reconcilePortFromYjs(){let t=this.port;if(!t||this.applyingSharedState)return;let{paragraphs:a}=e(this.ydoc);this.applyingSharedState=true;try{this.validateParagraphSet(t);let o=[];for(let e of t.paragraphs()){let r=a.get(e.paragraphId);if(!r)throw new d("paragraph-set-mismatch");let i=r.toString();i!==e.text&&o.push({paragraphId:e.paragraphId,text:i});}if(o.length>0){this.remoteCounter+=1;let e=t.applyParagraphTexts(o,{origin:ORIGIN_IDS.mutationRemote,actorId:"remote",operationId:`remote:${this.remoteCounter}`});if(!e.ok)throw new d(isCollaborationFailureCode(e.reason)?e.reason:"remote-apply-failed",isCollaborationFailureCode(e.reason)?void 0:e.reason)}}catch(o){this.setStatus("error",o instanceof d?o.code:"remote-apply-failed",o instanceof d?o.detail:void 0);}finally{this.applyingSharedState=false;}}setStatus(t,a,o){if(!this.statusState.set(t,a,o))return;let e=this.statusState.snapshot();for(let r of [...this.statusListeners])r(e.status,e.reason?.code,e.reason?.detail);}};async function Q(n,t,a){if(n.bootstrap.kind==="create-or-join")throw new TypeError("createTextCollaboration does not support bootstrap kind 'create-or-join'. Use createDocumentCollaboration.");if(n.bootstrap.kind==="create"){let o=f(n.bootstrap.document,t);return await g(n.ydoc,t,a.actorId,o),h$1(n.ydoc,t)}return await i(n.ydoc,n.bootstrap.timeoutMs??$,n.bootstrap.signal),h$1(n.ydoc,t)}async function tt(n){let t=G(n.documentId),a=J(n.sessionId),o=X(n.identity),e=await Q(n,t,o),r=new A(n.ydoc,n.awareness,t,a,o,e);return Object.freeze({document:new Uint8Array(e.bytes),session:r,destroy:()=>r.destroy()})}var D=["protocolVersion","sharedSchemaVersion","repairVersion","canonicalModelVersion"];function Y(n){return `docx-collaboration:${n.join(".")}`}var F=Y(D.map(n=>j[n]));function et(n){if(n!==F)throw new d("collaboration-format-mismatch","The collaboration format version is missing or incompatible with this deployment.")}function ot(n){if(!n.share.has(l$1))throw new d("not-initialized");let t;try{t=n.getMap(l$1);}catch{throw new d("collaboration-format-mismatch","The saved room has invalid collaboration version information.")}if(t.get("initialized")!==true||typeof t.get("documentId")!="string")throw new d("not-initialized");let a=D.map(o=>{let e=t.get(o);if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new d("collaboration-format-mismatch","The saved room has missing or invalid collaboration version information.");return e});return Y(a)}
|
|
2
2
|
export{F as COLLABORATION_FORMAT_VERSION,et as assertCollaborationFormatCompatibility,tt as createTextCollaboration,ot as readCollaborationFormatVersion};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkLUUFBXJ5_cjs=require('../chunk-LUUFBXJ5.cjs'),
|
|
1
|
+
'use strict';var chunkLUUFBXJ5_cjs=require('../chunk-LUUFBXJ5.cjs'),chunkVCMQFPO2_cjs=require('../chunk-VCMQFPO2.cjs'),F=require('yjs'),awareness=require('y-protocols/awareness'),yWebrtc=require('y-webrtc');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var F__namespace=/*#__PURE__*/_interopNamespace(F);var D=new WeakSet,T=(e,n)=>(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,w=(e,n,i)=>{e[n]=i>>>24&255,e[n+1]=i>>>16&255,e[n+2]=i>>>8&255,e[n+3]=i&255;},B=e=>e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null,Y=e=>new Promise(n=>{setTimeout(n,e);});function L(e,n){if(D.has(e))return;D.add(e);let i=e.send.bind(e),o=e._onChannelMessage.bind(e),d=n?.partialTimeoutMs,c=typeof d=="number"&&Number.isFinite(d)&&d>0?d:3e4,l=n?.onAbandonedMessage,f=[],s=new Map,b=false,E=1,h=t=>{let r=s.get(t);r&&(r.timer!==void 0&&clearTimeout(r.timer),s.delete(t),e.destroyed!==true&&l?.());},S=t=>{let r=s.get(t);r&&(r.timer!==void 0&&clearTimeout(r.timer),r.timer=setTimeout(()=>{h(t);},c));},u=()=>e._channel?.bufferedAmount??0,p=async()=>{let t=0;for(;u()>1048576;){if(e.destroyed===true||t>=3e4)return false;await Y(20),t+=20;}return e.destroyed!==true},I=async t=>{let r=Math.ceil(t.byteLength/16371);if(r>8192)throw new Error(`collaboration message needs ${r} chunks, above the 8192 limit`);let g=E;E=E+1>>>0||1;for(let A=0;A<r;A+=1){if(!await p())return;let y=A*16371,a=t.subarray(y,Math.min(y+16371,t.byteLength)),m=new Uint8Array(13+a.byteLength);m[0]=251,w(m,1,g),w(m,5,A),w(m,9,r),m.set(a,13),i(m);}},k=async()=>{if(!b){b=true;try{for(;f.length>0;){let t=f.shift();if(t){if(e.destroyed===!0)return;await I(t);}}}finally{b=false;}}};e.send=t=>{if(typeof t=="string"||t.byteLength<=16371){i(t);return}f.push(t),k();},e._onChannelMessage=t=>{let r=B(t.data);if(!r||r.byteLength<13||r[0]!==251){o(t);return}let g=T(r,1),A=T(r,5),y=T(r,9);if(y===0||y>8192||A>=y)return;let a=s.get(g);if(!a){if(s.size>=4){let _=s.keys().next();_.done||h(_.value);}a={chunks:new Array(y),count:y,received:0,bytes:0,timer:void 0},s.set(g,a);}if(a.count!==y||a.chunks[A])return;let m=r.subarray(13);if(a.chunks[A]=m,a.received+=1,a.bytes+=m.byteLength,a.received!==a.count){S(g);return}a.timer!==void 0&&clearTimeout(a.timer),s.delete(g);let v=new Uint8Array(a.bytes),P=0;for(let _ of a.chunks){if(!_)return;v.set(_,P),P+=_.byteLength;}e.destroyed!==true&&e.push(v);};}var W=Object.freeze(["wss://turn.0docker.com/ws"]),R=false;function H(e){e===void 0&&(R||(R=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 V(){R=false;}var G=/^[A-Za-z0-9_-]{24,256}$/,U="#collab=";function X(e){let n=e.password?.trim()??"";return n.length>0?n:K(e.href)}var K=e=>{let n=e??(typeof globalThis.location=="object"&&globalThis.location!==null?String(globalThis.location.href??""):"");if(n.length===0)return;let i;try{i=new URL(n).hash;}catch{return}if(!i.startsWith(U))return;let o;try{o=decodeURIComponent(i.slice(U.length));}catch{return}if(G.test(o))return o},z=(e,n)=>{Promise.resolve(e.key).then(()=>{let i=e.room;if(!i)return;let o=i.webrtcConns,d=l=>{L(l.peer,{onAbandonedMessage:n});};for(let l of o.values())d(l);let c=o.set.bind(o);o.set=(l,f)=>(d(f),c(l,f));});};async function ee(e){let n=chunkLUUFBXJ5_cjs.b(e.roomId);H(e.signaling);let i=X({password:e.password}),o=new F__namespace.Doc,d=new awareness.Awareness(o),c=null,l=()=>{},f=()=>{let u=new yWebrtc.WebrtcProvider(n,o,{awareness:d,signaling:[...e.signaling??W],...i!==void 0?{password:i}:{},...e.iceServers?{peerOpts:{config:{iceServers:e.iceServers.map(p=>({...p}))}}}:{}});return z(u,()=>l()),u},s;try{e.bootstrap.kind!=="create"&&(c=f()),s=await chunkVCMQFPO2_cjs.p({ydoc:o,awareness:d,documentId:n,identity:e.identity,bootstrap:e.bootstrap,offlineEditing:e.offlineEditing}),c||(c=f());}catch(u){throw c?.destroy(),d.destroy(),o.destroy(),u}if(!c)throw s.destroy(),d.destroy(),o.destroy(),new Error("WebRTC provider did not initialize");let b=c,E=s.session;l=()=>{E.setTransportStatus("error","transport","incomplete chunk");};let h=u=>{E.setTransportStatus(u.connected?"ready":"disconnected",u.connected?void 0:"transport-disconnected",u.connected?void 0:"webrtc disconnected");};b.on("status",h);let S=false;return Object.freeze({document:s.document,session:E,ydoc:o,provider:b,destroy(){S||(S=true,b.off("status",h),s.destroy(),b.destroy(),d.destroy(),o.destroy());}})}
|
|
2
2
|
Object.defineProperty(exports,"createCollaborationRoomId",{enumerable:true,get:function(){return chunkLUUFBXJ5_cjs.a}});Object.defineProperty(exports,"validateRoomId",{enumerable:true,get:function(){return chunkLUUFBXJ5_cjs.b}});exports.DEMO_SIGNALING_ENDPOINTS=W;exports.createWebrtcCollaboration=ee;exports.resetDemoSignalingWarningForTests=V;exports.resolveWebrtcRoomPassword=X;exports.warnOnDemoSignalingFallback=H;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import { WebrtcProvider } from 'y-webrtc';
|
|
3
3
|
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
-
import { D as DocumentCollaborationHandle } from '../document-session-
|
|
5
|
-
import { a as CollaborationBootstrap } from '../session-
|
|
4
|
+
import { D as DocumentCollaborationHandle } from '../document-session-BKKfJzKB.cjs';
|
|
5
|
+
import { a as CollaborationBootstrap } from '../session-B-ds4k64.cjs';
|
|
6
6
|
export { c as createCollaborationRoomId, v as validateRoomId } from '../room-id-BfudXOZz.cjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
8
8
|
|
|
@@ -83,4 +83,5 @@ declare function resolveWebrtcRoomPassword(options: {
|
|
|
83
83
|
/** Create one owned `y-webrtc` room and provider-neutral collaboration session. @public */
|
|
84
84
|
declare function createWebrtcCollaboration(options: CreateWebrtcCollaborationOptions): Promise<WebrtcCollaborationHandle>;
|
|
85
85
|
|
|
86
|
-
export {
|
|
86
|
+
export { DEMO_SIGNALING_ENDPOINTS, createWebrtcCollaboration, resetDemoSignalingWarningForTests, resolveWebrtcRoomPassword, warnOnDemoSignalingFallback };
|
|
87
|
+
export type { CreateWebrtcCollaborationOptions, WebrtcCollaborationHandle };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import { WebrtcProvider } from 'y-webrtc';
|
|
3
3
|
import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
|
|
4
|
-
import { D as DocumentCollaborationHandle } from '../document-session-
|
|
5
|
-
import { a as CollaborationBootstrap } from '../session-
|
|
4
|
+
import { D as DocumentCollaborationHandle } from '../document-session-BQ4nBDTd.js';
|
|
5
|
+
import { a as CollaborationBootstrap } from '../session-B-ds4k64.js';
|
|
6
6
|
export { c as createCollaborationRoomId, v as validateRoomId } from '../room-id-BfudXOZz.js';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
8
8
|
|
|
@@ -83,4 +83,5 @@ declare function resolveWebrtcRoomPassword(options: {
|
|
|
83
83
|
/** Create one owned `y-webrtc` room and provider-neutral collaboration session. @public */
|
|
84
84
|
declare function createWebrtcCollaboration(options: CreateWebrtcCollaborationOptions): Promise<WebrtcCollaborationHandle>;
|
|
85
85
|
|
|
86
|
-
export {
|
|
86
|
+
export { DEMO_SIGNALING_ENDPOINTS, createWebrtcCollaboration, resetDemoSignalingWarningForTests, resolveWebrtcRoomPassword, warnOnDemoSignalingFallback };
|
|
87
|
+
export type { CreateWebrtcCollaborationOptions, WebrtcCollaborationHandle };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {p}from'../chunk-
|
|
1
|
+
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {p}from'../chunk-MRW46GJW.js';import*as F from'yjs';import {Awareness}from'y-protocols/awareness';import {WebrtcProvider}from'y-webrtc';var D=new WeakSet,T=(e,n)=>(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,w=(e,n,i)=>{e[n]=i>>>24&255,e[n+1]=i>>>16&255,e[n+2]=i>>>8&255,e[n+3]=i&255;},B=e=>e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null,Y=e=>new Promise(n=>{setTimeout(n,e);});function L(e,n){if(D.has(e))return;D.add(e);let i=e.send.bind(e),o=e._onChannelMessage.bind(e),d=n?.partialTimeoutMs,c=typeof d=="number"&&Number.isFinite(d)&&d>0?d:3e4,l=n?.onAbandonedMessage,f=[],s=new Map,b=false,E=1,h=t=>{let r=s.get(t);r&&(r.timer!==void 0&&clearTimeout(r.timer),s.delete(t),e.destroyed!==true&&l?.());},S=t=>{let r=s.get(t);r&&(r.timer!==void 0&&clearTimeout(r.timer),r.timer=setTimeout(()=>{h(t);},c));},u=()=>e._channel?.bufferedAmount??0,p=async()=>{let t=0;for(;u()>1048576;){if(e.destroyed===true||t>=3e4)return false;await Y(20),t+=20;}return e.destroyed!==true},I=async t=>{let r=Math.ceil(t.byteLength/16371);if(r>8192)throw new Error(`collaboration message needs ${r} chunks, above the 8192 limit`);let g=E;E=E+1>>>0||1;for(let A=0;A<r;A+=1){if(!await p())return;let y=A*16371,a=t.subarray(y,Math.min(y+16371,t.byteLength)),m=new Uint8Array(13+a.byteLength);m[0]=251,w(m,1,g),w(m,5,A),w(m,9,r),m.set(a,13),i(m);}},k=async()=>{if(!b){b=true;try{for(;f.length>0;){let t=f.shift();if(t){if(e.destroyed===!0)return;await I(t);}}}finally{b=false;}}};e.send=t=>{if(typeof t=="string"||t.byteLength<=16371){i(t);return}f.push(t),k();},e._onChannelMessage=t=>{let r=B(t.data);if(!r||r.byteLength<13||r[0]!==251){o(t);return}let g=T(r,1),A=T(r,5),y=T(r,9);if(y===0||y>8192||A>=y)return;let a=s.get(g);if(!a){if(s.size>=4){let _=s.keys().next();_.done||h(_.value);}a={chunks:new Array(y),count:y,received:0,bytes:0,timer:void 0},s.set(g,a);}if(a.count!==y||a.chunks[A])return;let m=r.subarray(13);if(a.chunks[A]=m,a.received+=1,a.bytes+=m.byteLength,a.received!==a.count){S(g);return}a.timer!==void 0&&clearTimeout(a.timer),s.delete(g);let v=new Uint8Array(a.bytes),P=0;for(let _ of a.chunks){if(!_)return;v.set(_,P),P+=_.byteLength;}e.destroyed!==true&&e.push(v);};}var W=Object.freeze(["wss://turn.0docker.com/ws"]),R=false;function H(e){e===void 0&&(R||(R=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 V(){R=false;}var G=/^[A-Za-z0-9_-]{24,256}$/,U="#collab=";function X(e){let n=e.password?.trim()??"";return n.length>0?n:K(e.href)}var K=e=>{let n=e??(typeof globalThis.location=="object"&&globalThis.location!==null?String(globalThis.location.href??""):"");if(n.length===0)return;let i;try{i=new URL(n).hash;}catch{return}if(!i.startsWith(U))return;let o;try{o=decodeURIComponent(i.slice(U.length));}catch{return}if(G.test(o))return o},z=(e,n)=>{Promise.resolve(e.key).then(()=>{let i=e.room;if(!i)return;let o=i.webrtcConns,d=l=>{L(l.peer,{onAbandonedMessage:n});};for(let l of o.values())d(l);let c=o.set.bind(o);o.set=(l,f)=>(d(f),c(l,f));});};async function ee(e){let n=b(e.roomId);H(e.signaling);let i=X({password:e.password}),o=new F.Doc,d=new Awareness(o),c=null,l=()=>{},f=()=>{let u=new WebrtcProvider(n,o,{awareness:d,signaling:[...e.signaling??W],...i!==void 0?{password:i}:{},...e.iceServers?{peerOpts:{config:{iceServers:e.iceServers.map(p=>({...p}))}}}:{}});return z(u,()=>l()),u},s;try{e.bootstrap.kind!=="create"&&(c=f()),s=await p({ydoc:o,awareness:d,documentId:n,identity:e.identity,bootstrap:e.bootstrap,offlineEditing:e.offlineEditing}),c||(c=f());}catch(u){throw c?.destroy(),d.destroy(),o.destroy(),u}if(!c)throw s.destroy(),d.destroy(),o.destroy(),new Error("WebRTC provider did not initialize");let b$1=c,E=s.session;l=()=>{E.setTransportStatus("error","transport","incomplete chunk");};let h=u=>{E.setTransportStatus(u.connected?"ready":"disconnected",u.connected?void 0:"transport-disconnected",u.connected?void 0:"webrtc disconnected");};b$1.on("status",h);let S=false;return Object.freeze({document:s.document,session:E,ydoc:o,provider:b$1,destroy(){S||(S=true,b$1.off("status",h),s.destroy(),b$1.destroy(),d.destroy(),o.destroy());}})}
|
|
2
2
|
export{W as DEMO_SIGNALING_ENDPOINTS,ee as createWebrtcCollaboration,V as resetDemoSignalingWarningForTests,X as resolveWebrtcRoomPassword,H as warnOnDemoSignalingFallback};
|
|
@@ -42,4 +42,5 @@ interface CollaborationModuleOptions extends ProLicenseOptions {
|
|
|
42
42
|
/** Build the collaboration module. Construction never validates the key and never touches the network. */
|
|
43
43
|
declare function collaborationModule(options: CollaborationModuleOptions): EditorModule;
|
|
44
44
|
|
|
45
|
-
export {
|
|
45
|
+
export { collaborationModule as c };
|
|
46
|
+
export type { CollaborationModuleOptions as C, ProLicenseOptions as P };
|
|
@@ -42,4 +42,5 @@ interface CollaborationModuleOptions extends ProLicenseOptions {
|
|
|
42
42
|
/** Build the collaboration module. Construction never validates the key and never touches the network. */
|
|
43
43
|
declare function collaborationModule(options: CollaborationModuleOptions): EditorModule;
|
|
44
44
|
|
|
45
|
-
export {
|
|
45
|
+
export { collaborationModule as c };
|
|
46
|
+
export type { CollaborationModuleOptions as C, ProLicenseOptions as P };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
-
import { P as ProLicenseOptions } from './collaboration-module-
|
|
2
|
+
import { P as ProLicenseOptions } from './collaboration-module-DlSv0oAd.cjs';
|
|
3
3
|
import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -490,4 +490,5 @@ interface RecognizeCustomNodesOptions {
|
|
|
490
490
|
}
|
|
491
491
|
declare function recognizeCustomNodes(part: OoxmlPart, definitions: readonly AnyCustomNodeDefinition[], options?: RecognizeCustomNodesOptions): RecognizedCustomNode[];
|
|
492
492
|
|
|
493
|
-
export {
|
|
493
|
+
export { MAX_CUSTOM_NODE_DATA_LENGTH as M, customNodesModule as m, defineCustomNode as n, isCustomNodeDefinition as o, parseCustomNodeData as p, reviewModule as q, recognizeCustomNodes as r, serializeCustomNodeData as s };
|
|
494
|
+
export type { AnyCustomNodeDefinition as A, CustomNodeDiagnostic as C, InferSchemaInput as I, RecognizedCustomNode as R, StandardSchemaV1 as S, CustomNodeDefinition as a, ActivatedCustomNode as b, CustomNode as c, CustomNodeDataRejection as d, CustomNodeDataResult as e, CustomNodePayloadSource as f, CustomNodesModuleOptions as g, InferSchemaOutput as h, RecognizeCustomNodesOptions as i, ReviewModuleOptions as j, StandardSchemaIssue as k, StandardSchemaResult as l };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
-
import { P as ProLicenseOptions } from './collaboration-module-
|
|
2
|
+
import { P as ProLicenseOptions } from './collaboration-module-DlSv0oAd.js';
|
|
3
3
|
import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -490,4 +490,5 @@ interface RecognizeCustomNodesOptions {
|
|
|
490
490
|
}
|
|
491
491
|
declare function recognizeCustomNodes(part: OoxmlPart, definitions: readonly AnyCustomNodeDefinition[], options?: RecognizeCustomNodesOptions): RecognizedCustomNode[];
|
|
492
492
|
|
|
493
|
-
export {
|
|
493
|
+
export { MAX_CUSTOM_NODE_DATA_LENGTH as M, customNodesModule as m, defineCustomNode as n, isCustomNodeDefinition as o, parseCustomNodeData as p, reviewModule as q, recognizeCustomNodes as r, serializeCustomNodeData as s };
|
|
494
|
+
export type { AnyCustomNodeDefinition as A, CustomNodeDiagnostic as C, InferSchemaInput as I, RecognizedCustomNode as R, StandardSchemaV1 as S, CustomNodeDefinition as a, ActivatedCustomNode as b, CustomNode as c, CustomNodeDataRejection as d, CustomNodeDataResult as e, CustomNodePayloadSource as f, CustomNodesModuleOptions as g, InferSchemaOutput as h, RecognizeCustomNodesOptions as i, ReviewModuleOptions as j, StandardSchemaIssue as k, StandardSchemaResult as l };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as ATTACH_WATCHDOG_MS_FOR_TESTS,d as createDocumentCollaboration,b as readCollaborationDocument}from'./chunk-3JW4VNG5.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{o as ATTACH_WATCHDOG_MS_FOR_TESTS,p as createDocumentCollaboration,n as readCollaborationDocument}from'./chunk-MRW46GJW.js';
|
|
@@ -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, c as CollaborationHandle, e as TextCollaborationSession, b as CollaborationIdentityUpdate } from './session-
|
|
4
|
+
import { a as CollaborationBootstrap, c as CollaborationHandle, e as TextCollaborationSession, b as CollaborationIdentityUpdate } from './session-B-ds4k64.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Room-size observability.
|
|
@@ -120,4 +120,5 @@ interface CreateDocumentCollaborationOptions {
|
|
|
120
120
|
*/
|
|
121
121
|
declare function createDocumentCollaboration(options: CreateDocumentCollaborationOptions): Promise<DocumentCollaborationHandle>;
|
|
122
122
|
|
|
123
|
-
export {
|
|
123
|
+
export { createDocumentCollaboration as c, readCollaborationResourceUsage as r };
|
|
124
|
+
export type { CreateDocumentCollaborationOptions as C, DocumentCollaborationHandle as D, CollaborationResourceUsage as a, DocumentCollaborationSession as b };
|
|
@@ -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, c as CollaborationHandle, e as TextCollaborationSession, b as CollaborationIdentityUpdate } from './session-
|
|
4
|
+
import { a as CollaborationBootstrap, c as CollaborationHandle, e as TextCollaborationSession, b as CollaborationIdentityUpdate } from './session-B-ds4k64.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Room-size observability.
|
|
@@ -120,4 +120,5 @@ interface CreateDocumentCollaborationOptions {
|
|
|
120
120
|
*/
|
|
121
121
|
declare function createDocumentCollaboration(options: CreateDocumentCollaborationOptions): Promise<DocumentCollaborationHandle>;
|
|
122
122
|
|
|
123
|
-
export {
|
|
123
|
+
export { createDocumentCollaboration as c, readCollaborationResourceUsage as r };
|
|
124
|
+
export type { CreateDocumentCollaborationOptions as C, DocumentCollaborationHandle as D, CollaborationResourceUsage as a, DocumentCollaborationSession as b };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkJDLJS5RD_cjs=require('./chunk-JDLJS5RD.cjs');Object.defineProperty(exports,"ATTACH_WATCHDOG_MS_FOR_TESTS",{enumerable:true,get:function(){return chunkJDLJS5RD_cjs.c}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunkJDLJS5RD_cjs.d}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunkJDLJS5RD_cjs.b}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkVCMQFPO2_cjs=require('./chunk-VCMQFPO2.cjs');Object.defineProperty(exports,"ATTACH_WATCHDOG_MS_FOR_TESTS",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.o}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.p}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunkVCMQFPO2_cjs.n}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkLUUFBXJ5_cjs=require('./chunk-LUUFBXJ5.cjs'),
|
|
1
|
+
'use strict';var chunkLUUFBXJ5_cjs=require('./chunk-LUUFBXJ5.cjs'),chunkJDLJS5RD_cjs=require('./chunk-JDLJS5RD.cjs'),P=require('yjs'),awareness=require('y-protocols/awareness'),provider=require('@hocuspocus/provider'),collaboration=require('@docx-editor.dev/core/collaboration');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var P__namespace=/*#__PURE__*/_interopNamespace(P);var S=3e4,O=Symbol("createHocuspocusCollaboration.provider"),F=o=>new provider.HocuspocusProvider({url:o.url,name:o.name,document:o.document,awareness:o.awareness,...o.token!==void 0?{token:o.token}:{}});function I(o,d){return new Promise((c,n)=>{if(o.isSynced){c();return}let r=()=>{clearTimeout(i),o.off("synced",s),o.off("authenticationFailed",t);},s=()=>{r(),c();},t=e=>{r(),n(new chunkJDLJS5RD_cjs.a(collaboration.isCollaborationFailureCode(e.reason)?e.reason:"initialization-aborted",`authentication failed: ${e.reason}`));},i=setTimeout(()=>{r(),n(new chunkJDLJS5RD_cjs.a("initialization-timeout"));},d);o.on("synced",s),o.on("authenticationFailed",t);})}async function _(o){let d=chunkLUUFBXJ5_cjs.b(o.roomId),c=o[O]??F,n=new P__namespace.Doc,r=new awareness.Awareness(n),s=()=>c({url:o.url,name:d,document:n,awareness:r,...o.token!==void 0?{token:o.token}:{}}),t=null,i=null;try{o.bootstrap.kind!=="create"&&(t=s(),await I(t,o.syncedTimeoutMs??S)),i=await chunkJDLJS5RD_cjs.d({ydoc:n,awareness:r,documentId:d,identity:o.identity,bootstrap:o.bootstrap,offlineEditing:o.offlineEditing}),t||(t=s());}catch(a){throw i?.destroy(),t?.destroy(),r.destroy(),n.destroy(),a}let e=t,u=i,l=u.session,f=a=>{l.setTransportStatus(a.status==="connected"?"ready":"disconnected",a.status==="connected"?void 0:"transport-disconnected",a.status==="connected"?void 0:"websocket disconnected");};e.on("status",f);let p=a=>{l.setTransportStatus("error",collaboration.isCollaborationFailureCode(a.reason)?a.reason:"authentication-failed");};e.on("authenticationFailed",p);let b=false;return Object.freeze({document:u.document,session:l,ydoc:n,provider:e,destroy(){b||(b=true,e.off("status",f),e.off("authenticationFailed",p),u.destroy(),e.destroy(),r.destroy(),n.destroy());}})}Object.defineProperty(exports,"createCollaborationRoomId",{enumerable:true,get:function(){return chunkLUUFBXJ5_cjs.a}});Object.defineProperty(exports,"validateRoomId",{enumerable:true,get:function(){return chunkLUUFBXJ5_cjs.b}});exports.HOCUSPOCUS_PROVIDER_FOR_TESTS=O;exports.createHocuspocusCollaboration=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'./chunk-6DEUT2RQ.js';import {d,a}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'./chunk-6DEUT2RQ.js';import {d,a}from'./chunk-3JW4VNG5.js';import*as P from'yjs';import {Awareness}from'y-protocols/awareness';import {HocuspocusProvider}from'@hocuspocus/provider';import {isCollaborationFailureCode}from'@docx-editor.dev/core/collaboration';var S=3e4,O=Symbol("createHocuspocusCollaboration.provider"),F=o=>new HocuspocusProvider({url:o.url,name:o.name,document:o.document,awareness:o.awareness,...o.token!==void 0?{token:o.token}:{}});function I(o,d){return new Promise((c,n)=>{if(o.isSynced){c();return}let r=()=>{clearTimeout(i),o.off("synced",s),o.off("authenticationFailed",t);},s=()=>{r(),c();},t=e=>{r(),n(new a(isCollaborationFailureCode(e.reason)?e.reason:"initialization-aborted",`authentication failed: ${e.reason}`));},i=setTimeout(()=>{r(),n(new a("initialization-timeout"));},d);o.on("synced",s),o.on("authenticationFailed",t);})}async function _(o){let d$1=b(o.roomId),c=o[O]??F,n=new P.Doc,r=new Awareness(n),s=()=>c({url:o.url,name:d$1,document:n,awareness:r,...o.token!==void 0?{token:o.token}:{}}),t=null,i=null;try{o.bootstrap.kind!=="create"&&(t=s(),await I(t,o.syncedTimeoutMs??S)),i=await d({ydoc:n,awareness:r,documentId:d$1,identity:o.identity,bootstrap:o.bootstrap,offlineEditing:o.offlineEditing}),t||(t=s());}catch(a){throw i?.destroy(),t?.destroy(),r.destroy(),n.destroy(),a}let e=t,u=i,l=u.session,f=a=>{l.setTransportStatus(a.status==="connected"?"ready":"disconnected",a.status==="connected"?void 0:"transport-disconnected",a.status==="connected"?void 0:"websocket disconnected");};e.on("status",f);let p=a=>{l.setTransportStatus("error",isCollaborationFailureCode(a.reason)?a.reason:"authentication-failed");};e.on("authenticationFailed",p);let b$1=false;return Object.freeze({document:u.document,session:l,ydoc:n,provider:e,destroy(){b$1||(b$1=true,e.off("status",f),e.off("authenticationFailed",p),u.destroy(),e.destroy(),r.destroy(),n.destroy());}})}export{O as HOCUSPOCUS_PROVIDER_FOR_TESTS,_ as createHocuspocusCollaboration};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-
|
|
2
|
-
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-
|
|
3
|
-
export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-
|
|
1
|
+
import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-CkjSwcxy.cjs';
|
|
2
|
+
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-CkjSwcxy.cjs';
|
|
3
|
+
export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-DlSv0oAd.cjs';
|
|
4
4
|
import { Editor, ExecResult } from '@docx-editor.dev/core/contracts/editor';
|
|
5
5
|
import '@docx-editor.dev/core/editor';
|
|
6
6
|
import '@docx-editor.dev/core/store';
|
|
@@ -461,4 +461,5 @@ type CustomNodeXmlResult = {
|
|
|
461
461
|
*/
|
|
462
462
|
declare function customNodeXml<Schema extends StandardSchemaV1 | undefined = undefined>(definition: CustomNodeDefinition<Schema>, attrs: Readonly<Record<string, string>>, text: string, options?: CustomNodeXmlOptions<Schema>): CustomNodeXmlResult;
|
|
463
463
|
|
|
464
|
-
export { AnyCustomNodeDefinition, CUSTOM_NODE_STORE_ROOT, CustomNodeDefinition, CustomNodeDiagnostic,
|
|
464
|
+
export { AnyCustomNodeDefinition, CUSTOM_NODE_STORE_ROOT, CustomNodeDefinition, CustomNodeDiagnostic, InferSchemaInput, MAX_TAG_LENGTH, RecognizedCustomNode, StandardSchemaV1, customNodeNamespace, customNodeXml, customNodesOf, decodeCustomNodeTag, encodeCustomNodeTag, insertCustomNode, prepareForExport, removeCustomNode, saveForExport, updateCustomNode };
|
|
465
|
+
export type { CustomNodeInput, CustomNodeIssue, CustomNodeUpdate, CustomNodeWriteOutcome, CustomNodeXmlOptions, CustomNodeXmlResult, CustomNodeXmlStore, CustomNodesOfOptions, DecodedCustomNodeTag, DocumentDestination, DocumentExportOptions, DocumentExportResult, EncodeTagResult, SaveForExportOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-
|
|
2
|
-
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-
|
|
3
|
-
export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-
|
|
1
|
+
import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-DA6UEXID.js';
|
|
2
|
+
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-DA6UEXID.js';
|
|
3
|
+
export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-DlSv0oAd.js';
|
|
4
4
|
import { Editor, ExecResult } from '@docx-editor.dev/core/contracts/editor';
|
|
5
5
|
import '@docx-editor.dev/core/editor';
|
|
6
6
|
import '@docx-editor.dev/core/store';
|
|
@@ -461,4 +461,5 @@ type CustomNodeXmlResult = {
|
|
|
461
461
|
*/
|
|
462
462
|
declare function customNodeXml<Schema extends StandardSchemaV1 | undefined = undefined>(definition: CustomNodeDefinition<Schema>, attrs: Readonly<Record<string, string>>, text: string, options?: CustomNodeXmlOptions<Schema>): CustomNodeXmlResult;
|
|
463
463
|
|
|
464
|
-
export { AnyCustomNodeDefinition, CUSTOM_NODE_STORE_ROOT, CustomNodeDefinition, CustomNodeDiagnostic,
|
|
464
|
+
export { AnyCustomNodeDefinition, CUSTOM_NODE_STORE_ROOT, CustomNodeDefinition, CustomNodeDiagnostic, InferSchemaInput, MAX_TAG_LENGTH, RecognizedCustomNode, StandardSchemaV1, customNodeNamespace, customNodeXml, customNodesOf, decodeCustomNodeTag, encodeCustomNodeTag, insertCustomNode, prepareForExport, removeCustomNode, saveForExport, updateCustomNode };
|
|
465
|
+
export type { CustomNodeInput, CustomNodeIssue, CustomNodeUpdate, CustomNodeWriteOutcome, CustomNodeXmlOptions, CustomNodeXmlResult, CustomNodeXmlStore, CustomNodesOfOptions, DecodedCustomNodeTag, DocumentDestination, DocumentExportOptions, DocumentExportResult, EncodeTagResult, SaveForExportOptions };
|
|
@@ -2,8 +2,8 @@ import * as Y from 'yjs';
|
|
|
2
2
|
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
3
3
|
import { CollaborationIdentity, CollaborationFailure } from '@docx-editor.dev/core/collaboration';
|
|
4
4
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
5
|
-
import { a as CollaborationBootstrap, C as CollaborationSession } from '../session-
|
|
6
|
-
export { b as CollaborationIdentityUpdate } from '../session-
|
|
5
|
+
import { a as CollaborationBootstrap, C as CollaborationSession } from '../session-B-ds4k64.cjs';
|
|
6
|
+
export { b as CollaborationIdentityUpdate } from '../session-B-ds4k64.cjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
8
8
|
|
|
9
9
|
/** Bootstrap for one Hocuspocus room. @public */
|
|
@@ -101,4 +101,5 @@ interface UseHocuspocusCollaborationReturn {
|
|
|
101
101
|
*/
|
|
102
102
|
declare function useHocuspocusCollaboration(options?: UseHocuspocusCollaborationOptions): UseHocuspocusCollaborationReturn;
|
|
103
103
|
|
|
104
|
-
export { CollaborationSession,
|
|
104
|
+
export { CollaborationSession, useHocuspocusCollaboration };
|
|
105
|
+
export type { UseHocuspocusCollaborationBootstrap, UseHocuspocusCollaborationConnectOptions, UseHocuspocusCollaborationOptions, UseHocuspocusCollaborationReturn };
|
|
@@ -2,8 +2,8 @@ import * as Y from 'yjs';
|
|
|
2
2
|
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
3
3
|
import { CollaborationIdentity, CollaborationFailure } from '@docx-editor.dev/core/collaboration';
|
|
4
4
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
5
|
-
import { a as CollaborationBootstrap, C as CollaborationSession } from '../session-
|
|
6
|
-
export { b as CollaborationIdentityUpdate } from '../session-
|
|
5
|
+
import { a as CollaborationBootstrap, C as CollaborationSession } from '../session-B-ds4k64.js';
|
|
6
|
+
export { b as CollaborationIdentityUpdate } from '../session-B-ds4k64.js';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
8
8
|
|
|
9
9
|
/** Bootstrap for one Hocuspocus room. @public */
|
|
@@ -101,4 +101,5 @@ interface UseHocuspocusCollaborationReturn {
|
|
|
101
101
|
*/
|
|
102
102
|
declare function useHocuspocusCollaboration(options?: UseHocuspocusCollaborationOptions): UseHocuspocusCollaborationReturn;
|
|
103
103
|
|
|
104
|
-
export { CollaborationSession,
|
|
104
|
+
export { CollaborationSession, useHocuspocusCollaboration };
|
|
105
|
+
export type { UseHocuspocusCollaborationBootstrap, UseHocuspocusCollaborationConnectOptions, UseHocuspocusCollaborationOptions, UseHocuspocusCollaborationReturn };
|