@docx-editor.dev/pro 2.32.0 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist/{chunk-3WTOHPAB.js → chunk-25A5N6OL.js} +1 -1
- package/dist/chunk-3HW2VWFW.js +1 -0
- package/dist/chunk-3MIZFGHH.cjs +1 -0
- package/dist/chunk-46N5DWZV.cjs +1 -0
- package/dist/chunk-65JEI6FY.cjs +5 -0
- package/dist/chunk-ENMURXLJ.js +1 -0
- package/dist/chunk-EOZ44UA7.js +1 -0
- package/dist/chunk-GLYQ72LS.cjs +6 -0
- package/dist/{chunk-RYF4SNKX.cjs → chunk-GOUTDQFX.cjs} +1 -1
- package/dist/chunk-HMU7J34H.js +1 -0
- package/dist/chunk-IULA3QRZ.cjs +1 -0
- package/dist/chunk-QEULTKCT.cjs +1 -0
- package/dist/{chunk-OT5R3IYV.cjs → chunk-QOXYHVBM.cjs} +1 -1
- package/dist/chunk-SINNHH3H.js +1 -0
- package/dist/chunk-SL6K2CUL.js +6 -0
- package/dist/chunk-STTJA26X.js +1 -0
- package/dist/chunk-VY7374QP.cjs +1 -0
- package/dist/chunk-WGBOER6G.js +1 -0
- package/dist/{chunk-MHB6ID2P.cjs → chunk-WX43PF3Z.cjs} +1 -1
- package/dist/chunk-WYVEFRAM.js +5 -0
- package/dist/collaboration/hocuspocus.cjs +1 -1
- package/dist/collaboration/hocuspocus.js +1 -1
- package/dist/collaboration/index.cjs +2 -2
- package/dist/collaboration/index.d.cts +2 -1
- package/dist/collaboration/index.d.ts +2 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/collaboration/webrtc.cjs +1 -1
- package/dist/collaboration/webrtc.js +1 -1
- package/dist/{collaboration-module-DWn2heE1.d.cts → collaboration-module-02CIP5sN.d.cts} +2 -20
- package/dist/{collaboration-module-DWn2heE1.d.ts → collaboration-module-COZAgqwg.d.ts} +2 -20
- package/dist/{define-custom-node-D0c36PpZ.d.ts → define-custom-node-CISpZvVB.d.cts} +8 -3
- package/dist/{define-custom-node-CNRQG1TI.d.cts → define-custom-node-DE1KjR1r.d.ts} +8 -3
- package/dist/document-session-4NUOLWKQ.cjs +1 -0
- package/dist/document-session-5VAD24RH.js +1 -0
- package/dist/drawing/index.cjs +1 -0
- package/dist/drawing/index.d.cts +112 -0
- package/dist/drawing/index.d.ts +112 -0
- package/dist/drawing/index.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/license-D-ds5Y7c.d.cts +20 -0
- package/dist/license-D-ds5Y7c.d.ts +20 -0
- package/dist/metafile-raster-3MCAHWYO.js +1 -0
- package/dist/metafile-raster-DWGCWQTU.cjs +1 -0
- package/dist/metafile-replay-GHPEUR2W.js +1 -0
- package/dist/metafile-replay-NZWGGGZR.cjs +1 -0
- package/dist/react/hocuspocus.cjs +1 -1
- package/dist/react/hocuspocus.js +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +81 -22
- package/dist/react/index.d.ts +81 -22
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.cjs +1 -1
- package/dist/react/webrtc.js +1 -1
- package/dist/vue/hocuspocus.cjs +1 -1
- package/dist/vue/hocuspocus.js +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +61 -18
- package/dist/vue/index.d.ts +61 -18
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.js +1 -1
- package/package.json +11 -5
- package/dist/chunk-AVZO5ZHZ.js +0 -1
- package/dist/chunk-DLYVBBO7.js +0 -1
- package/dist/chunk-GAGYRL3L.js +0 -5
- package/dist/chunk-HMSOWKXT.js +0 -1
- package/dist/chunk-I6HVINA4.cjs +0 -1
- package/dist/chunk-MWO2ZUEJ.js +0 -1
- package/dist/chunk-PMS3PGOE.cjs +0 -1
- package/dist/chunk-Q2VBO66F.js +0 -1
- package/dist/chunk-QLZH2Q2C.cjs +0 -1
- package/dist/chunk-YOWEY5F3.cjs +0 -5
- package/dist/document-session-B35ZX2W4.js +0 -1
- package/dist/document-session-V3O7XBJY.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkWX43PF3Z_cjs=require('../chunk-WX43PF3Z.cjs'),chunkLUUFBXJ5_cjs=require('../chunk-LUUFBXJ5.cjs'),chunk65JEI6FY_cjs=require('../chunk-65JEI6FY.cjs'),H=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 H__namespace=/*#__PURE__*/_interopNamespace(H);var S=Symbol("createHocuspocusCollaboration.provider");var E=3e4,I=o=>new provider.HocuspocusProvider({url:o.url,name:o.name,document:o.document,awareness:o.awareness,...o.token!==void 0?{token:o.token}:{}});function R(o,m,l){return new Promise((n,r)=>{if(l?.aborted){r(new chunk65JEI6FY_cjs.b("initialization-aborted"));return}if(o.isSynced){n();return}let i=()=>{clearTimeout(u),o.off("synced",d),o.off("authenticationFailed",t),l?.removeEventListener("abort",s);},s=()=>{i(),r(new chunk65JEI6FY_cjs.b("initialization-aborted"));},d=()=>{i(),n();},t=a=>{i(),r(new chunk65JEI6FY_cjs.b(collaboration.isCollaborationFailureCode(a.reason)?a.reason:"initialization-aborted",`authentication failed: ${a.reason}`));},u=setTimeout(()=>{i(),r(new chunk65JEI6FY_cjs.b("initialization-timeout"));},m);o.on("synced",d),o.on("authenticationFailed",t),l?.addEventListener("abort",s,{once:true});})}async function L(o){let m=chunkLUUFBXJ5_cjs.b(o.roomId),l=o[S]??I,n=new H__namespace.Doc,r=new awareness.Awareness(n),i=()=>{let e=l({url:o.url,name:m,document:n,awareness:r,...o.token!==void 0?{token:o.token}:{}});return e.on("open",()=>e.sendStateless?.(chunkWX43PF3Z_cjs.d(n))),e},s=null,d=null;try{if(o.bootstrap.kind!=="create"&&o.bootstrap.signal?.aborted)throw new chunk65JEI6FY_cjs.b("initialization-aborted");s=i(),await R(s,o.syncedTimeoutMs??E,o.bootstrap.kind==="create"?void 0:o.bootstrap.signal);let e=o.bootstrap.kind==="create-or-join"&&o.bootstrap.probeTimeoutMs===void 0?{...o.bootstrap,probeTimeoutMs:0}:o.bootstrap;d=await chunk65JEI6FY_cjs.r({ydoc:n,awareness:r,documentId:m,identity:o.identity,bootstrap:e,offlineEditing:o.offlineEditing});}catch(e){throw d?.destroy(),s?.destroy(),r.destroy(),n.destroy(),e}let t=s,u=d,a=u.session,b=e=>{a.setTransportStatus(e.status==="connected"?"ready":"disconnected",e.status==="connected"?void 0:"transport-disconnected",e.status==="connected"?void 0:"websocket disconnected");};t.on("status",b);let p=e=>{a.setTransportStatus("error",collaboration.isCollaborationFailureCode(e.reason)?e.reason:"authentication-failed",`authentication failed: ${e.reason}`);};t.on("authenticationFailed",p);let y=false,v=e=>{y||!e.event||!chunkWX43PF3Z_cjs.e(e.event)||(y=true,a.setTransportStatus("error","room-generation-changed"),t.destroy());};t.on("close",v);let g=false;return Object.freeze({document:u.document,session:a,ydoc:n,provider:t,destroy(){g||(g=true,t.off("status",b),t.off("authenticationFailed",p),t.off("close",v),u.destroy(),y||t.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.createHocuspocusCollaboration=L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d,e}from'../chunk-
|
|
1
|
+
import {d,e}from'../chunk-25A5N6OL.js';import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {b as b$1,r}from'../chunk-WYVEFRAM.js';import*as H from'yjs';import {Awareness}from'y-protocols/awareness';import {HocuspocusProvider}from'@hocuspocus/provider';import {isCollaborationFailureCode}from'@docx-editor.dev/core/collaboration';var S=Symbol("createHocuspocusCollaboration.provider");var E=3e4,I=o=>new HocuspocusProvider({url:o.url,name:o.name,document:o.document,awareness:o.awareness,...o.token!==void 0?{token:o.token}:{}});function R(o,m,l){return new Promise((n,r)=>{if(l?.aborted){r(new b$1("initialization-aborted"));return}if(o.isSynced){n();return}let i=()=>{clearTimeout(u),o.off("synced",d),o.off("authenticationFailed",t),l?.removeEventListener("abort",s);},s=()=>{i(),r(new b$1("initialization-aborted"));},d=()=>{i(),n();},t=a=>{i(),r(new b$1(isCollaborationFailureCode(a.reason)?a.reason:"initialization-aborted",`authentication failed: ${a.reason}`));},u=setTimeout(()=>{i(),r(new b$1("initialization-timeout"));},m);o.on("synced",d),o.on("authenticationFailed",t),l?.addEventListener("abort",s,{once:true});})}async function L(o){let m=b(o.roomId),l=o[S]??I,n=new H.Doc,r$1=new Awareness(n),i=()=>{let e=l({url:o.url,name:m,document:n,awareness:r$1,...o.token!==void 0?{token:o.token}:{}});return e.on("open",()=>e.sendStateless?.(d(n))),e},s=null,d$1=null;try{if(o.bootstrap.kind!=="create"&&o.bootstrap.signal?.aborted)throw new b$1("initialization-aborted");s=i(),await R(s,o.syncedTimeoutMs??E,o.bootstrap.kind==="create"?void 0:o.bootstrap.signal);let e=o.bootstrap.kind==="create-or-join"&&o.bootstrap.probeTimeoutMs===void 0?{...o.bootstrap,probeTimeoutMs:0}:o.bootstrap;d$1=await r({ydoc:n,awareness:r$1,documentId:m,identity:o.identity,bootstrap:e,offlineEditing:o.offlineEditing});}catch(e){throw d$1?.destroy(),s?.destroy(),r$1.destroy(),n.destroy(),e}let t=s,u=d$1,a=u.session,b$2=e=>{a.setTransportStatus(e.status==="connected"?"ready":"disconnected",e.status==="connected"?void 0:"transport-disconnected",e.status==="connected"?void 0:"websocket disconnected");};t.on("status",b$2);let p=e=>{a.setTransportStatus("error",isCollaborationFailureCode(e.reason)?e.reason:"authentication-failed",`authentication failed: ${e.reason}`);};t.on("authenticationFailed",p);let y=false,v=e$1=>{y||!e$1.event||!e(e$1.event)||(y=true,a.setTransportStatus("error","room-generation-changed"),t.destroy());};t.on("close",v);let g=false;return Object.freeze({document:u.document,session:a,ydoc:n,provider:t,destroy(){g||(g=true,t.off("status",b$2),t.off("authenticationFailed",p),t.off("close",v),u.destroy(),y||t.destroy(),r$1.destroy(),n.destroy());}})}export{L as createHocuspocusCollaboration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
Object.defineProperty(exports,"
|
|
1
|
+
'use strict';var chunkQEULTKCT_cjs=require('../chunk-QEULTKCT.cjs'),chunkWX43PF3Z_cjs=require('../chunk-WX43PF3Z.cjs'),chunk65JEI6FY_cjs=require('../chunk-65JEI6FY.cjs');require('../chunk-IULA3QRZ.cjs');var O=require('yjs'),store=require('@docx-editor.dev/core/store');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 O__namespace=/*#__PURE__*/_interopNamespace(O);var j=1,K=1,M=20971520;function J(o){return chunk65JEI6FY_cjs.a(o)}async function W(o,t){let n=chunk65JEI6FY_cjs.h(t.documentId),a=t.maxBytes??20971520;if(!Number.isSafeInteger(a)||a<=0||a>20971520)throw new TypeError(`maxBytes must be a whole number of bytes from 1 to ${20971520}`);return chunkWX43PF3Z_cjs.c(o,n,a)}var A=["protocolVersion","sharedSchemaVersion","repairVersion","canonicalModelVersion"];function T(o){return `docx-collaboration:${o.join(".")}`}var b=T(A.map(o=>chunk65JEI6FY_cjs.c[o]));function q(o){if(o!==b)throw new chunk65JEI6FY_cjs.b("collaboration-format-mismatch","The collaboration format version is missing or incompatible with this deployment.")}function R(o){if(!o.share.has(chunk65JEI6FY_cjs.e))throw new chunk65JEI6FY_cjs.b("not-initialized");let t;try{t=o.getMap(chunk65JEI6FY_cjs.e);}catch{throw new chunk65JEI6FY_cjs.b("collaboration-format-mismatch","The saved room has invalid collaboration version information.")}if(t.get("initialized")!==true||typeof t.get("documentId")!="string")throw new chunk65JEI6FY_cjs.b("not-initialized");let n=A.map(a=>{let r=t.get(a);if(typeof r!="number"||!Number.isSafeInteger(r)||r<0)throw new chunk65JEI6FY_cjs.b("collaboration-format-mismatch","The saved room has missing or invalid collaboration version information.");return r});return T(n)}function Z(o){return w(o,t=>U(P(t)))}async function oo(o){let t=w(o.state,l=>({format:P(l),documentId:to(l)})),n=U(t.format);if(n==="current")return {ok:false,reason:"current"};if(n==="later-format")return {ok:false,reason:"later-format"};let a=o.documentId??t.documentId;if(typeof a!="string")throw new chunk65JEI6FY_cjs.b("invalid-document-id","The earlier room holds no document ID. Pass the ID its clients use as documentId.");let r=chunk65JEI6FY_cjs.h(a),i=await chunkWX43PF3Z_cjs.c(o.exported,r),p=w(i,l=>chunk65JEI6FY_cjs.p(l)),m=await _(o.exported),e=ro(m,await _(p),{from:t.format??"unversioned",to:b,documentId:r});return e.ok?{ok:true,state:i,report:e}:{ok:false,reason:"check-failed",report:e}}function w(o,t){let n=new O__namespace.Doc;try{try{O__namespace.applyUpdate(n,o);}catch{throw new chunk65JEI6FY_cjs.b("invalid-baseline","The bytes are not room state.")}return t(n)}finally{n.destroy();}}function to(o){try{return o.getMap(chunk65JEI6FY_cjs.e).get("documentId")}catch{return}}function P(o){try{return R(o)}catch(t){if(t instanceof chunk65JEI6FY_cjs.b&&t.code==="collaboration-format-mismatch")return null;throw t}}function U(o){if(o===null)return "earlier-format";let t=so(o,b);return t===0?"current":t<0?"earlier-format":"later-format"}var D=20;function ro(o,t,n){let a=[],r=0,i=new Set;o.paragraphs.length!==t.paragraphs.length&&i.add("paragraphs");let p=Math.max(o.paragraphs.length,t.paragraphs.length);for(let d=0;d<p;d+=1){let g=o.paragraphs[d],u=t.paragraphs[d],y=u?g?g.text!==u.text?"text":g.formatting!==u.formatting?"formatting":null:"added":"missing";if(y===null||((y==="text"||y==="formatting")&&i.add(y),r+=1,a.length>=D))continue;let v=g??u;a.push({part:v.part,paragraph:v.index,kind:y,expected:g?.text??null,actual:u?.text??null});}let m=[...o.media].filter(([d])=>!t.media.has(d)).map(([,d])=>d).sort();m.length>0&&i.add("media");let e=eo(o.links,t.links);e.length>0&&i.add("links");let l=[...new Set([...o.parts.keys(),...t.parts.keys()])].filter(d=>o.parts.get(d)!==t.parts.get(d)).sort();l.length>0&&i.add("structure");let c=t.paragraphs.filter(d=>!d.shown),s=["paragraphs","text","formatting","structure","media","links"];return {ok:i.size===0,failed:s.filter(d=>i.has(d)),from:n.from,to:n.to,documentId:n.documentId,paragraphs:o.paragraphs.length,hidden:c.length,hiddenAt:c.slice(0,D).map(d=>({part:d.part,paragraph:d.index})),changedParts:l,differenceCount:r,differences:a,missingMedia:m,missingLinks:e}}function eo(o,t){let n=new Map;for(let r of t)n.set(r,(n.get(r)??0)+1);let a=new Set;for(let r of o){let i=n.get(r)??0;i===0?a.add(r):n.set(r,i-1);}return [...a].sort()}function I(o){if(o.kind==="textValue")return o.value;let t=a=>o.attributes.find(r=>r.localName===a)?.value??"";return (o.localName==="fldSimple"?`[${t("instr")}]`:o.localName==="sym"?`[${t("font")} ${t("char")}]`:"")+o.children.map(I).join("")}function no(o){let t=[],n=[],a=r=>{if(!(r.kind==="textValue"||r.localName==="p")){if(r.localName==="r"){let i=I(r);if(i==="")return;let p=r.children.find(c=>c.kind!=="textValue"&&c.localName==="rPr"),e=!p||p.kind==="textValue"||p.children.length===0&&p.attributes.length===0?"":store.canonicalOoxmlFingerprint(p),l=n.at(-1);l&&l.format===e?l.text+=i:n.push({format:e,text:i});return}for(let i of r.children)a(i);}};for(let r of o.children)r.kind!=="textValue"&&r.localName==="pPr"?t.push(store.canonicalOoxmlFingerprint(r)):a(r);return JSON.stringify([t,n.map(r=>[r.format,r.text.length])])}async function _(o){let t=store.readOoxmlPackage(o);if(!t.ok)throw new chunk65JEI6FY_cjs.b("invalid-baseline",t.reason);let n=io(t.package.parts),a=[];for(let[m,e]of n){let l=0,c=s=>{if(s.kind!=="textValue"){if(s.localName==="p"){l+=1,a.push({part:m,index:l,text:I(s),formatting:no(s),shown:s.kind==="paragraph"});return}for(let d of s.children)c(d);}};c(e);}let r=new Map;for(let[m,e]of [...t.package.partBytes].sort(([l],[c])=>l<c?-1:1)){if(t.package.parts.has(m)||/\.(xml|rels)$/i.test(m))continue;let l=await lo(e);r.has(l)||r.set(l,m);}let i=t.package.externalTargets.map(m=>`${m.type} ${m.rawTarget}`),p=new Map;for(let[m,e]of n)/\.rels$/i.test(m)||p.set(m,store.canonicalOoxmlFingerprint(e));return {paragraphs:a,media:r,links:i,parts:p}}var ao="http://schemas.openxmlformats.org/wordprocessingml/2006/main",V=new Set(["paraId","paraIdParent"]),F={moveFromRangeStart:"moveFrom",moveFromRangeEnd:"moveFrom",moveToRangeStart:"moveTo",moveToRangeEnd:"moveTo",customXmlInsRangeStart:"customXmlIns",customXmlInsRangeEnd:"customXmlIns",customXmlDelRangeStart:"customXmlDel",customXmlDelRangeEnd:"customXmlDel",customXmlMoveFromRangeStart:"customXmlMoveFrom",customXmlMoveFromRangeEnd:"customXmlMoveFrom",customXmlMoveToRangeStart:"customXmlMoveTo",customXmlMoveToRangeEnd:"customXmlMoveTo",comment:"comment",commentRangeStart:"comment",commentRangeEnd:"comment",commentReference:"comment",footnote:"footnote",footnoteReference:"footnote",endnote:"endnote",endnoteReference:"endnote",bookmarkStart:"bookmark",bookmarkEnd:"bookmark",permStart:"permission",permEnd:"permission"};function io(o){let t=new Map,n=(e,l)=>{let c=t.get(e);c||t.set(e,c=new Map);let s=c.get(l);return s===void 0&&c.set(l,s=c.size),String(s)},a=[...o.keys()].sort(),r=new Map,i=e=>{if(e.kind!=="textValue"){if(e.localName==="p"){let l=e.attributes.find(c=>c.localName==="paraId")?.value;l!==void 0&&!r.has(l)&&r.set(l,r.size);}for(let l of e.children)i(l);}};for(let e of a)i(o.get(e).root);let p=e=>{if(e.kind==="textValue")return e;let l=Object.hasOwn(F,e.localName)?F[e.localName]:null,c=e.localName==="p";return {...e,attributes:e.attributes.filter(s=>s.localName!=="textId"&&!(c&&V.has(s.localName))).map(s=>s.localName==="id"&&s.namespaceUri===ao?{...s,value:l?n(l,s.value):""}:V.has(s.localName)?{...s,value:`p${r.get(s.value)??"?"}`}:s),children:e.children.map(p)}},m=new Map;for(let e of a)m.set(e,p(o.get(e).root));return m}async function lo(o){let t=o.buffer instanceof ArrayBuffer?o:o.slice(),n=new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",t)),a="";for(let r of n)a+=r.toString(16).padStart(2,"0");return a}function so(o,t){let n=i=>i.slice(i.indexOf(":")+1).split(".").map(Number),a=n(o),r=n(t);for(let i=0;i<Math.max(a.length,r.length);i+=1){let p=(a[i]??0)-(r[i]??0);if(p!==0)return p}return 0}
|
|
2
|
+
Object.defineProperty(exports,"collaborationModule",{enumerable:true,get:function(){return chunkQEULTKCT_cjs.a}});Object.defineProperty(exports,"checkCollaborationRoomGeneration",{enumerable:true,get:function(){return chunkWX43PF3Z_cjs.f}});Object.defineProperty(exports,"compactCollaborationState",{enumerable:true,get:function(){return chunkWX43PF3Z_cjs.b}});Object.defineProperty(exports,"readCollaborationRoomGeneration",{enumerable:true,get:function(){return chunkWX43PF3Z_cjs.a}});Object.defineProperty(exports,"CollaborationSchemaError",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.b}});Object.defineProperty(exports,"CollaborationUndoGroupError",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.o}});Object.defineProperty(exports,"DOCUMENT_COLLABORATION_VERSIONS",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.c}});Object.defineProperty(exports,"assertDocumentCollaborationCompatibility",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.d}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.r}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.p}});Object.defineProperty(exports,"readCollaborationResourceUsage",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.n}});exports.COLLABORATION_FORMAT_VERSION=b;exports.MAX_BASELINE_BYTES=M;exports.PROTOCOL_VERSION=j;exports.SCHEMA_VERSION=K;exports.assertCollaborationFormatCompatibility=q;exports.collaborationMigrationNeed=Z;exports.createCollaborationState=W;exports.migrateCollaborationRoom=oo;exports.prepareCollaborationServerDocument=J;exports.readCollaborationFormatVersion=R;
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-
|
|
11
|
+
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-02CIP5sN.cjs';
|
|
12
12
|
export { a as CollaborationBootstrap, c as CollaborationHandle, b as CollaborationIdentityUpdate, C as CollaborationSession } from '../types-DvGpDOcZ.cjs';
|
|
13
13
|
export { C as CollaborationResourceUsage, a as CollaborationUndoGroup, b as CollaborationUndoGroupError, c as CollaborationUndoGroupErrorCode, D as DocumentCollaborationHandle, d as DocumentCollaborationSession, e as createDocumentCollaboration, r as readCollaborationResourceUsage } from '../document-session-B-MlORjE.cjs';
|
|
14
14
|
import * as Y from 'yjs';
|
|
15
15
|
import { CollaborationFailureCode, EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
|
|
16
16
|
export { C as CreateDocumentCollaborationOptions } from '../document-session-options-CxR0F5xT.cjs';
|
|
17
17
|
import '@docx-editor.dev/core/editor';
|
|
18
|
+
import '../license-D-ds5Y7c.cjs';
|
|
18
19
|
import 'y-protocols/awareness';
|
|
19
20
|
|
|
20
21
|
/** Version contract for full-document collaboration clients and export workers. @public */
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-
|
|
11
|
+
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-COZAgqwg.js';
|
|
12
12
|
export { a as CollaborationBootstrap, c as CollaborationHandle, b as CollaborationIdentityUpdate, C as CollaborationSession } from '../types-DvGpDOcZ.js';
|
|
13
13
|
export { C as CollaborationResourceUsage, a as CollaborationUndoGroup, b as CollaborationUndoGroupError, c as CollaborationUndoGroupErrorCode, D as DocumentCollaborationHandle, d as DocumentCollaborationSession, e as createDocumentCollaboration, r as readCollaborationResourceUsage } from '../document-session-B-iH-YCU.js';
|
|
14
14
|
import * as Y from 'yjs';
|
|
15
15
|
import { CollaborationFailureCode, EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
|
|
16
16
|
export { C as CreateDocumentCollaborationOptions } from '../document-session-options-CdOH-TNn.js';
|
|
17
17
|
import '@docx-editor.dev/core/editor';
|
|
18
|
+
import '../license-D-ds5Y7c.js';
|
|
18
19
|
import 'y-protocols/awareness';
|
|
19
20
|
|
|
20
21
|
/** Version contract for full-document collaboration clients and export workers. @public */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {c as c$1}from'../chunk-
|
|
1
|
+
export{a as collaborationModule}from'../chunk-EOZ44UA7.js';import {c as c$1}from'../chunk-25A5N6OL.js';export{f as checkCollaborationRoomGeneration,b as compactCollaborationState,a as readCollaborationRoomGeneration}from'../chunk-25A5N6OL.js';import {c,a,h,b as b$1,e,p}from'../chunk-WYVEFRAM.js';export{b as CollaborationSchemaError,o as CollaborationUndoGroupError,c as DOCUMENT_COLLABORATION_VERSIONS,d as assertDocumentCollaborationCompatibility,r as createDocumentCollaboration,p as readCollaborationDocument,n as readCollaborationResourceUsage}from'../chunk-WYVEFRAM.js';import'../chunk-HMU7J34H.js';import*as O from'yjs';import {readOoxmlPackage,canonicalOoxmlFingerprint}from'@docx-editor.dev/core/store';var j=1,K=1,M=20971520;function J(o){return a(o)}async function W(o,t){let n=h(t.documentId),a=t.maxBytes??20971520;if(!Number.isSafeInteger(a)||a<=0||a>20971520)throw new TypeError(`maxBytes must be a whole number of bytes from 1 to ${20971520}`);return c$1(o,n,a)}var A=["protocolVersion","sharedSchemaVersion","repairVersion","canonicalModelVersion"];function T(o){return `docx-collaboration:${o.join(".")}`}var b=T(A.map(o=>c[o]));function q(o){if(o!==b)throw new b$1("collaboration-format-mismatch","The collaboration format version is missing or incompatible with this deployment.")}function R(o){if(!o.share.has(e))throw new b$1("not-initialized");let t;try{t=o.getMap(e);}catch{throw new b$1("collaboration-format-mismatch","The saved room has invalid collaboration version information.")}if(t.get("initialized")!==true||typeof t.get("documentId")!="string")throw new b$1("not-initialized");let n=A.map(a=>{let r=t.get(a);if(typeof r!="number"||!Number.isSafeInteger(r)||r<0)throw new b$1("collaboration-format-mismatch","The saved room has missing or invalid collaboration version information.");return r});return T(n)}function Z(o){return w(o,t=>U(P(t)))}async function oo(o){let t=w(o.state,l=>({format:P(l),documentId:to(l)})),n=U(t.format);if(n==="current")return {ok:false,reason:"current"};if(n==="later-format")return {ok:false,reason:"later-format"};let a=o.documentId??t.documentId;if(typeof a!="string")throw new b$1("invalid-document-id","The earlier room holds no document ID. Pass the ID its clients use as documentId.");let r=h(a),i=await c$1(o.exported,r),p$1=w(i,l=>p(l)),m=await _(o.exported),e=ro(m,await _(p$1),{from:t.format??"unversioned",to:b,documentId:r});return e.ok?{ok:true,state:i,report:e}:{ok:false,reason:"check-failed",report:e}}function w(o,t){let n=new O.Doc;try{try{O.applyUpdate(n,o);}catch{throw new b$1("invalid-baseline","The bytes are not room state.")}return t(n)}finally{n.destroy();}}function to(o){try{return o.getMap(e).get("documentId")}catch{return}}function P(o){try{return R(o)}catch(t){if(t instanceof b$1&&t.code==="collaboration-format-mismatch")return null;throw t}}function U(o){if(o===null)return "earlier-format";let t=so(o,b);return t===0?"current":t<0?"earlier-format":"later-format"}var D=20;function ro(o,t,n){let a=[],r=0,i=new Set;o.paragraphs.length!==t.paragraphs.length&&i.add("paragraphs");let p=Math.max(o.paragraphs.length,t.paragraphs.length);for(let d=0;d<p;d+=1){let g=o.paragraphs[d],u=t.paragraphs[d],y=u?g?g.text!==u.text?"text":g.formatting!==u.formatting?"formatting":null:"added":"missing";if(y===null||((y==="text"||y==="formatting")&&i.add(y),r+=1,a.length>=D))continue;let v=g??u;a.push({part:v.part,paragraph:v.index,kind:y,expected:g?.text??null,actual:u?.text??null});}let m=[...o.media].filter(([d])=>!t.media.has(d)).map(([,d])=>d).sort();m.length>0&&i.add("media");let e=eo(o.links,t.links);e.length>0&&i.add("links");let l=[...new Set([...o.parts.keys(),...t.parts.keys()])].filter(d=>o.parts.get(d)!==t.parts.get(d)).sort();l.length>0&&i.add("structure");let c=t.paragraphs.filter(d=>!d.shown),s=["paragraphs","text","formatting","structure","media","links"];return {ok:i.size===0,failed:s.filter(d=>i.has(d)),from:n.from,to:n.to,documentId:n.documentId,paragraphs:o.paragraphs.length,hidden:c.length,hiddenAt:c.slice(0,D).map(d=>({part:d.part,paragraph:d.index})),changedParts:l,differenceCount:r,differences:a,missingMedia:m,missingLinks:e}}function eo(o,t){let n=new Map;for(let r of t)n.set(r,(n.get(r)??0)+1);let a=new Set;for(let r of o){let i=n.get(r)??0;i===0?a.add(r):n.set(r,i-1);}return [...a].sort()}function I(o){if(o.kind==="textValue")return o.value;let t=a=>o.attributes.find(r=>r.localName===a)?.value??"";return (o.localName==="fldSimple"?`[${t("instr")}]`:o.localName==="sym"?`[${t("font")} ${t("char")}]`:"")+o.children.map(I).join("")}function no(o){let t=[],n=[],a=r=>{if(!(r.kind==="textValue"||r.localName==="p")){if(r.localName==="r"){let i=I(r);if(i==="")return;let p=r.children.find(c=>c.kind!=="textValue"&&c.localName==="rPr"),e=!p||p.kind==="textValue"||p.children.length===0&&p.attributes.length===0?"":canonicalOoxmlFingerprint(p),l=n.at(-1);l&&l.format===e?l.text+=i:n.push({format:e,text:i});return}for(let i of r.children)a(i);}};for(let r of o.children)r.kind!=="textValue"&&r.localName==="pPr"?t.push(canonicalOoxmlFingerprint(r)):a(r);return JSON.stringify([t,n.map(r=>[r.format,r.text.length])])}async function _(o){let t=readOoxmlPackage(o);if(!t.ok)throw new b$1("invalid-baseline",t.reason);let n=io(t.package.parts),a=[];for(let[m,e]of n){let l=0,c=s=>{if(s.kind!=="textValue"){if(s.localName==="p"){l+=1,a.push({part:m,index:l,text:I(s),formatting:no(s),shown:s.kind==="paragraph"});return}for(let d of s.children)c(d);}};c(e);}let r=new Map;for(let[m,e]of [...t.package.partBytes].sort(([l],[c])=>l<c?-1:1)){if(t.package.parts.has(m)||/\.(xml|rels)$/i.test(m))continue;let l=await lo(e);r.has(l)||r.set(l,m);}let i=t.package.externalTargets.map(m=>`${m.type} ${m.rawTarget}`),p=new Map;for(let[m,e]of n)/\.rels$/i.test(m)||p.set(m,canonicalOoxmlFingerprint(e));return {paragraphs:a,media:r,links:i,parts:p}}var ao="http://schemas.openxmlformats.org/wordprocessingml/2006/main",V=new Set(["paraId","paraIdParent"]),F={moveFromRangeStart:"moveFrom",moveFromRangeEnd:"moveFrom",moveToRangeStart:"moveTo",moveToRangeEnd:"moveTo",customXmlInsRangeStart:"customXmlIns",customXmlInsRangeEnd:"customXmlIns",customXmlDelRangeStart:"customXmlDel",customXmlDelRangeEnd:"customXmlDel",customXmlMoveFromRangeStart:"customXmlMoveFrom",customXmlMoveFromRangeEnd:"customXmlMoveFrom",customXmlMoveToRangeStart:"customXmlMoveTo",customXmlMoveToRangeEnd:"customXmlMoveTo",comment:"comment",commentRangeStart:"comment",commentRangeEnd:"comment",commentReference:"comment",footnote:"footnote",footnoteReference:"footnote",endnote:"endnote",endnoteReference:"endnote",bookmarkStart:"bookmark",bookmarkEnd:"bookmark",permStart:"permission",permEnd:"permission"};function io(o){let t=new Map,n=(e,l)=>{let c=t.get(e);c||t.set(e,c=new Map);let s=c.get(l);return s===void 0&&c.set(l,s=c.size),String(s)},a=[...o.keys()].sort(),r=new Map,i=e=>{if(e.kind!=="textValue"){if(e.localName==="p"){let l=e.attributes.find(c=>c.localName==="paraId")?.value;l!==void 0&&!r.has(l)&&r.set(l,r.size);}for(let l of e.children)i(l);}};for(let e of a)i(o.get(e).root);let p=e=>{if(e.kind==="textValue")return e;let l=Object.hasOwn(F,e.localName)?F[e.localName]:null,c=e.localName==="p";return {...e,attributes:e.attributes.filter(s=>s.localName!=="textId"&&!(c&&V.has(s.localName))).map(s=>s.localName==="id"&&s.namespaceUri===ao?{...s,value:l?n(l,s.value):""}:V.has(s.localName)?{...s,value:`p${r.get(s.value)??"?"}`}:s),children:e.children.map(p)}},m=new Map;for(let e of a)m.set(e,p(o.get(e).root));return m}async function lo(o){let t=o.buffer instanceof ArrayBuffer?o:o.slice(),n=new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",t)),a="";for(let r of n)a+=r.toString(16).padStart(2,"0");return a}function so(o,t){let n=i=>i.slice(i.indexOf(":")+1).split(".").map(Number),a=n(o),r=n(t);for(let i=0;i<Math.max(a.length,r.length);i+=1){let p=(a[i]??0)-(r[i]??0);if(p!==0)return p}return 0}
|
|
2
2
|
export{b as COLLABORATION_FORMAT_VERSION,M as MAX_BASELINE_BYTES,j as PROTOCOL_VERSION,K as SCHEMA_VERSION,q as assertCollaborationFormatCompatibility,Z as collaborationMigrationNeed,W as createCollaborationState,oo as migrateCollaborationRoom,J as prepareCollaborationServerDocument,R 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'),chunk65JEI6FY_cjs=require('../chunk-65JEI6FY.cjs'),Q=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 Q__namespace=/*#__PURE__*/_interopNamespace(Q);function N(e,n){let t=0,o=null,i=new Set,a=()=>{o!==null&&clearInterval(o),o=null;},r=l=>{if(l!==t){t=l,t===0&&a();for(let f of [...i])f();}},s=()=>{let l=n.room;if(l===null)return false;if(l.bcConns.size>0)return true;for(let f of l.webrtcConns.values())if(f.connected&&f.synced)return true;return false},b=()=>{t>0&&s()&&r(0);},g=(l,f)=>{f===n.room||s()||(r(t+1),o??=setInterval(b,1e3));};return e.on("update",g),n.on("peers",b),n.on("synced",b),{count:()=>t,subscribe(l){return i.add(l),()=>{i.delete(l);}},destroy(){a(),e.off("update",g),n.off("peers",b),n.off("synced",b),i.clear();}}}var O=new WeakSet,k=(e,n)=>(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,P=(e,n,t)=>{e[n]=t>>>24&255,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=t&255;},te=e=>e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null,oe=e=>new Promise(n=>{setTimeout(n,e);});function W(e,n){if(O.has(e))return;O.add(e);let t=e.send.bind(e),o=e._onChannelMessage.bind(e),i=n?.partialTimeoutMs,a=typeof i=="number"&&Number.isFinite(i)&&i>0?i:3e4,r=n?.onAbandonedMessage,s=n?.onDeliveredMessage,b=Math.min(n?.maxPartialBytes??1/0,134111232),g=[],l=new Map,f=false,_=1,E=0,C=(c,d)=>{d.timer!==void 0&&clearTimeout(d.timer),l.delete(c),E-=d.bytes;},m=c=>{let d=l.get(c);d&&(C(c,d),e.destroyed!==true&&(r?.(),e.destroy?.()));},R=c=>{let d=l.get(c);d&&(d.timer!==void 0&&clearTimeout(d.timer),d.timer=setTimeout(()=>{m(c);},a));},y=()=>e._channel?.bufferedAmount??0,v=async()=>{let c=0;for(;y()>1048576;){if(e.destroyed===true||c>=3e4)return false;await oe(20),c+=20;}return e.destroyed!==true},V=async c=>{let d=Math.ceil(c.byteLength/16371);if(d>8192)throw new Error(`collaboration message needs ${d} chunks, above the 8192 limit`);let S=_;_=_+1>>>0||1;for(let A=0;A<d;A+=1){if(!await v()){e.destroyed!==true&&e.destroy?.();return}let h=A*16371,u=c.subarray(h,Math.min(h+16371,c.byteLength)),p=new Uint8Array(13+u.byteLength);p[0]=251,P(p,1,S),P(p,5,A),P(p,9,d),p.set(u,13),t(p);}},ee=async()=>{if(!f){f=true;try{for(;g.length>0;){let c=g.shift();if(c){if(e.destroyed===!0)return;await V(c);}}}finally{f=false;}}};e.send=c=>{if(typeof c=="string"||c.byteLength<=16371){t(c);return}g.push(c),ee();},e._onChannelMessage=c=>{let d=te(c.data);if(!d||d.byteLength<13||d[0]!==251){o(c);return}let S=k(d,1),A=k(d,5),h=k(d,9);if(h===0||h>8192||A>=h)return;if(d.byteLength>16384){m(S);return}let u=l.get(S);if(!u){if(l.size>=4){let M=l.keys().next();M.done||m(M.value);}u={chunks:new Array(h),count:h,received:0,bytes:0,timer:void 0},l.set(S,u);}if(u.count!==h||u.chunks[A])return;let p=d.subarray(13);if(u.chunks[A]=p,u.received+=1,u.bytes+=p.byteLength,E+=p.byteLength,E>b){m(S);return}if(u.received!==u.count){R(S);return}C(S,u);let Y=new Uint8Array(u.bytes),F=0;for(let M of u.chunks){if(!M)return;Y.set(M,F),F+=M.byteLength;}e.destroyed!==true&&(e.push(Y),s?.());};}function j(e,n){return t=>{n()&&(t?e.setTransportStatus("ready","transport-disconnected","a peer link cannot carry large updates"):e.setTransportStatus("ready"));}}var re=3,ie=6e4;function X(e,n={set:(t,o)=>setTimeout(t,o),clear:t=>clearTimeout(t)}){let t=new Map,o=new Map,i=new Set,a=r=>{t.delete(r);let s=o.get(r);s!==void 0&&n.clear(s),o.delete(r),i.delete(r)&&i.size===0&&e(false);};return {abandoned(r){let s=(t.get(r)??0)+1;t.set(r,s);let b=o.get(r);b!==void 0&&n.clear(b),o.set(r,n.set(()=>a(r),ie)),!(s<re||i.has(r))&&(i.add(r),i.size===1&&e(true));},delivered:a,reset(){for(let r of [...t.keys(),...i])a(r);},destroy(){for(let r of o.values())n.clear(r);o.clear(),t.clear(),i.clear();}}}var K=Symbol.for("docx-editor.webrtc-signaling-scope"),U=new WeakMap,I=new WeakSet,B=new WeakSet,z=new WeakSet,q=e=>{let n=U.get(e);return n||(n=new Set,U.set(e,n)),n};function se(e){B.add(e),I.add(e);}function ae(e){B.add(e),I.delete(e);}var ce=e=>e?B.has(e)?I.has(e):e.bcconnected===true:false;function x(e,n){if(typeof n!="string")return false;for(let t of e.providers)if(t.roomName===n&&t.shouldConnect!==false&&ce(t.room))return true;return false}var $=e=>Array.isArray(e)?e.filter(n=>typeof n=="string"):[];function de(e,n){if(n===null||typeof n!="object")return n;let{type:t,topic:o,topics:i}=n;switch(t){case "subscribe":{let a=$(i).filter(s=>x(e,s));if(a.length===0)return null;let r=q(e);for(let s of a)r.add(s);return {...n,topics:a}}case "unsubscribe":{let a=q(e),r=$(i).filter(s=>a.has(s));if(r.length===0)return null;for(let s of r)a.delete(s);return {...n,topics:r}}case "publish":return x(e,o)?n:null;default:return n}}function le(e,n){if(n===null||typeof n!="object")return true;let{type:t,topic:o}=n;return t!=="publish"||x(e,o)}function ue(e){U.delete(e);}var w=(e,n,t)=>{let o=e;o[n]=t(o[n]);};function Z(){let e=yWebrtc.SignalingConn.prototype;e[K]||(e[K]=true,w(yWebrtc.SignalingConn.prototype,"send",n=>function(o){let i=de(this,o);i!==null&&n.call(this,i);}),w(yWebrtc.SignalingConn.prototype,"emit",n=>function(o,i){o==="disconnect"&&ue(this);let a=Array.isArray(i)?i[0]:void 0;if(!(o==="message"&&!le(this,a)))return n.call(this,o,i)}),w(yWebrtc.Room.prototype,"connect",n=>function(){return se(this),n.call(this)}),w(yWebrtc.Room.prototype,"disconnect",n=>function(){return ae(this),n.call(this)}),w(yWebrtc.WebrtcProvider.prototype,"disconnect",n=>function(){this.shouldConnect&&(n.call(this),this.signalingConns=[...new Set(this.signalingConns.filter(o=>o.providers.has(this)))]);}),w(yWebrtc.WebrtcProvider.prototype,"destroy",n=>function(){return z.add(this),this.shouldConnect&&this.disconnect(),n.call(this)}),w(yWebrtc.WebrtcProvider.prototype,"connect",n=>function(){if(!z.has(this))return n.call(this)}));}var Ue=Object.freeze(["wss://turn.0docker.com/ws"]);function be(e){if(!Array.isArray(e))throw new TypeError("WebRTC collaboration requires `signaling`, an array of signaling server URLs. Pass your own URLs in production. For demos, pass `signaling: DEMO_SIGNALING_ENDPOINTS` from '@docx-editor.dev/pro/collaboration/webrtc'. To connect only tabs of the same browser, pass `signaling: []`.");return e.forEach((n,t)=>{if(!ge(n))throw new TypeError(`WebRTC collaboration needs signaling[${t}] to be a ws:// or wss:// URL without a #fragment.`)}),e}var ge=e=>{if(typeof e!="string")return false;try{let{protocol:n}=new URL(e);return (n==="ws:"||n==="wss:")&&!e.includes("#")}catch{return false}},pe=/^[A-Za-z0-9_-]{24,256}$/,J="#collab=";function he(e){let n=e.password?.trim()??"";return n.length>0?n:me(e.href)}var me=e=>{let n=e??(typeof globalThis.location=="object"&&globalThis.location!==null?String(globalThis.location.href??""):"");if(n.length===0)return;let t;try{t=new URL(n).hash;}catch{return}if(!t.startsWith(J))return;let o;try{o=decodeURIComponent(t.slice(J.length));}catch{return}if(pe.test(o))return o},Se=(e,n)=>{Promise.resolve(e.key).then(()=>{let t=e.room;if(!t)return;let o=t.webrtcConns,i=(r,s)=>{W(s.peer,{onAbandonedMessage:()=>n.abandoned(r),onDeliveredMessage:()=>n.delivered(r)});};for(let[r,s]of o)i(r,s);let a=o.set.bind(o);o.set=(r,s)=>(i(r,s),a(r,s));});};async function xe(e){let n=chunkLUUFBXJ5_cjs.b(e.roomId),t=be(e.signaling);Z();let o=he({password:e.password}),i=new Q__namespace.Doc,a=new awareness.Awareness(i),r=null,s={abandoned(){},delivered(){}},b=()=>{let y=new yWebrtc.WebrtcProvider(n,i,{awareness:a,signaling:[...t],...o!==void 0?{password:o}:{},...e.iceServers?{peerOpts:{config:{iceServers:e.iceServers.map(v=>({...v}))}}}:{}});return Se(y,{abandoned:v=>s.abandoned(v),delivered:v=>s.delivered(v)}),y},g;try{e.bootstrap.kind!=="create"&&(r=b()),g=await chunk65JEI6FY_cjs.r({ydoc:i,awareness:a,documentId:n,identity:e.identity,bootstrap:e.bootstrap,offlineEditing:e.offlineEditing}),r||(r=b());}catch(y){throw r?.destroy(),a.destroy(),i.destroy(),y}if(!r)throw g.destroy(),a.destroy(),i.destroy(),new Error("WebRTC provider did not initialize");let l=r,f=g.session,_=true,E=X(j(f,()=>_));s=E;let C=y=>{_=y.connected,y.connected&&E.reset(),f.setTransportStatus(y.connected?"ready":"disconnected",y.connected?void 0:"transport-disconnected",y.connected?void 0:"webrtc disconnected");};l.on("status",C);let m=N(i,l),R=false;return Object.freeze({document:g.document,session:f,ydoc:i,provider:l,unsyncedChanges:()=>m.count(),subscribeUnsyncedChanges:y=>m.subscribe(y),destroy(){R||(R=true,l.off("status",C),m.destroy(),E.destroy(),g.destroy(),l.destroy(),a.destroy(),i.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=Ue;exports.createWebrtcCollaboration=xe;exports.requireSignaling=be;exports.resolveWebrtcRoomPassword=he;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {r}from'../chunk-
|
|
1
|
+
import {b}from'../chunk-6DEUT2RQ.js';export{a as createCollaborationRoomId,b as validateRoomId}from'../chunk-6DEUT2RQ.js';import {r}from'../chunk-WYVEFRAM.js';import*as Q from'yjs';import {Awareness}from'y-protocols/awareness';import {WebrtcProvider,SignalingConn,Room}from'y-webrtc';function N(e,n){let t=0,o=null,i=new Set,a=()=>{o!==null&&clearInterval(o),o=null;},r=l=>{if(l!==t){t=l,t===0&&a();for(let f of [...i])f();}},s=()=>{let l=n.room;if(l===null)return false;if(l.bcConns.size>0)return true;for(let f of l.webrtcConns.values())if(f.connected&&f.synced)return true;return false},b=()=>{t>0&&s()&&r(0);},g=(l,f)=>{f===n.room||s()||(r(t+1),o??=setInterval(b,1e3));};return e.on("update",g),n.on("peers",b),n.on("synced",b),{count:()=>t,subscribe(l){return i.add(l),()=>{i.delete(l);}},destroy(){a(),e.off("update",g),n.off("peers",b),n.off("synced",b),i.clear();}}}var O=new WeakSet,k=(e,n)=>(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,P=(e,n,t)=>{e[n]=t>>>24&255,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=t&255;},te=e=>e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null,oe=e=>new Promise(n=>{setTimeout(n,e);});function W(e,n){if(O.has(e))return;O.add(e);let t=e.send.bind(e),o=e._onChannelMessage.bind(e),i=n?.partialTimeoutMs,a=typeof i=="number"&&Number.isFinite(i)&&i>0?i:3e4,r=n?.onAbandonedMessage,s=n?.onDeliveredMessage,b=Math.min(n?.maxPartialBytes??1/0,134111232),g=[],l=new Map,f=false,_=1,E=0,C=(c,d)=>{d.timer!==void 0&&clearTimeout(d.timer),l.delete(c),E-=d.bytes;},m=c=>{let d=l.get(c);d&&(C(c,d),e.destroyed!==true&&(r?.(),e.destroy?.()));},R=c=>{let d=l.get(c);d&&(d.timer!==void 0&&clearTimeout(d.timer),d.timer=setTimeout(()=>{m(c);},a));},y=()=>e._channel?.bufferedAmount??0,v=async()=>{let c=0;for(;y()>1048576;){if(e.destroyed===true||c>=3e4)return false;await oe(20),c+=20;}return e.destroyed!==true},V=async c=>{let d=Math.ceil(c.byteLength/16371);if(d>8192)throw new Error(`collaboration message needs ${d} chunks, above the 8192 limit`);let S=_;_=_+1>>>0||1;for(let A=0;A<d;A+=1){if(!await v()){e.destroyed!==true&&e.destroy?.();return}let h=A*16371,u=c.subarray(h,Math.min(h+16371,c.byteLength)),p=new Uint8Array(13+u.byteLength);p[0]=251,P(p,1,S),P(p,5,A),P(p,9,d),p.set(u,13),t(p);}},ee=async()=>{if(!f){f=true;try{for(;g.length>0;){let c=g.shift();if(c){if(e.destroyed===!0)return;await V(c);}}}finally{f=false;}}};e.send=c=>{if(typeof c=="string"||c.byteLength<=16371){t(c);return}g.push(c),ee();},e._onChannelMessage=c=>{let d=te(c.data);if(!d||d.byteLength<13||d[0]!==251){o(c);return}let S=k(d,1),A=k(d,5),h=k(d,9);if(h===0||h>8192||A>=h)return;if(d.byteLength>16384){m(S);return}let u=l.get(S);if(!u){if(l.size>=4){let M=l.keys().next();M.done||m(M.value);}u={chunks:new Array(h),count:h,received:0,bytes:0,timer:void 0},l.set(S,u);}if(u.count!==h||u.chunks[A])return;let p=d.subarray(13);if(u.chunks[A]=p,u.received+=1,u.bytes+=p.byteLength,E+=p.byteLength,E>b){m(S);return}if(u.received!==u.count){R(S);return}C(S,u);let Y=new Uint8Array(u.bytes),F=0;for(let M of u.chunks){if(!M)return;Y.set(M,F),F+=M.byteLength;}e.destroyed!==true&&(e.push(Y),s?.());};}function j(e,n){return t=>{n()&&(t?e.setTransportStatus("ready","transport-disconnected","a peer link cannot carry large updates"):e.setTransportStatus("ready"));}}var re=3,ie=6e4;function X(e,n={set:(t,o)=>setTimeout(t,o),clear:t=>clearTimeout(t)}){let t=new Map,o=new Map,i=new Set,a=r=>{t.delete(r);let s=o.get(r);s!==void 0&&n.clear(s),o.delete(r),i.delete(r)&&i.size===0&&e(false);};return {abandoned(r){let s=(t.get(r)??0)+1;t.set(r,s);let b=o.get(r);b!==void 0&&n.clear(b),o.set(r,n.set(()=>a(r),ie)),!(s<re||i.has(r))&&(i.add(r),i.size===1&&e(true));},delivered:a,reset(){for(let r of [...t.keys(),...i])a(r);},destroy(){for(let r of o.values())n.clear(r);o.clear(),t.clear(),i.clear();}}}var K=Symbol.for("docx-editor.webrtc-signaling-scope"),U=new WeakMap,I=new WeakSet,B=new WeakSet,z=new WeakSet,q=e=>{let n=U.get(e);return n||(n=new Set,U.set(e,n)),n};function se(e){B.add(e),I.add(e);}function ae(e){B.add(e),I.delete(e);}var ce=e=>e?B.has(e)?I.has(e):e.bcconnected===true:false;function x(e,n){if(typeof n!="string")return false;for(let t of e.providers)if(t.roomName===n&&t.shouldConnect!==false&&ce(t.room))return true;return false}var $=e=>Array.isArray(e)?e.filter(n=>typeof n=="string"):[];function de(e,n){if(n===null||typeof n!="object")return n;let{type:t,topic:o,topics:i}=n;switch(t){case "subscribe":{let a=$(i).filter(s=>x(e,s));if(a.length===0)return null;let r=q(e);for(let s of a)r.add(s);return {...n,topics:a}}case "unsubscribe":{let a=q(e),r=$(i).filter(s=>a.has(s));if(r.length===0)return null;for(let s of r)a.delete(s);return {...n,topics:r}}case "publish":return x(e,o)?n:null;default:return n}}function le(e,n){if(n===null||typeof n!="object")return true;let{type:t,topic:o}=n;return t!=="publish"||x(e,o)}function ue(e){U.delete(e);}var w=(e,n,t)=>{let o=e;o[n]=t(o[n]);};function Z(){let e=SignalingConn.prototype;e[K]||(e[K]=true,w(SignalingConn.prototype,"send",n=>function(o){let i=de(this,o);i!==null&&n.call(this,i);}),w(SignalingConn.prototype,"emit",n=>function(o,i){o==="disconnect"&&ue(this);let a=Array.isArray(i)?i[0]:void 0;if(!(o==="message"&&!le(this,a)))return n.call(this,o,i)}),w(Room.prototype,"connect",n=>function(){return se(this),n.call(this)}),w(Room.prototype,"disconnect",n=>function(){return ae(this),n.call(this)}),w(WebrtcProvider.prototype,"disconnect",n=>function(){this.shouldConnect&&(n.call(this),this.signalingConns=[...new Set(this.signalingConns.filter(o=>o.providers.has(this)))]);}),w(WebrtcProvider.prototype,"destroy",n=>function(){return z.add(this),this.shouldConnect&&this.disconnect(),n.call(this)}),w(WebrtcProvider.prototype,"connect",n=>function(){if(!z.has(this))return n.call(this)}));}var Ue=Object.freeze(["wss://turn.0docker.com/ws"]);function be(e){if(!Array.isArray(e))throw new TypeError("WebRTC collaboration requires `signaling`, an array of signaling server URLs. Pass your own URLs in production. For demos, pass `signaling: DEMO_SIGNALING_ENDPOINTS` from '@docx-editor.dev/pro/collaboration/webrtc'. To connect only tabs of the same browser, pass `signaling: []`.");return e.forEach((n,t)=>{if(!ge(n))throw new TypeError(`WebRTC collaboration needs signaling[${t}] to be a ws:// or wss:// URL without a #fragment.`)}),e}var ge=e=>{if(typeof e!="string")return false;try{let{protocol:n}=new URL(e);return (n==="ws:"||n==="wss:")&&!e.includes("#")}catch{return false}},pe=/^[A-Za-z0-9_-]{24,256}$/,J="#collab=";function he(e){let n=e.password?.trim()??"";return n.length>0?n:me(e.href)}var me=e=>{let n=e??(typeof globalThis.location=="object"&&globalThis.location!==null?String(globalThis.location.href??""):"");if(n.length===0)return;let t;try{t=new URL(n).hash;}catch{return}if(!t.startsWith(J))return;let o;try{o=decodeURIComponent(t.slice(J.length));}catch{return}if(pe.test(o))return o},Se=(e,n)=>{Promise.resolve(e.key).then(()=>{let t=e.room;if(!t)return;let o=t.webrtcConns,i=(r,s)=>{W(s.peer,{onAbandonedMessage:()=>n.abandoned(r),onDeliveredMessage:()=>n.delivered(r)});};for(let[r,s]of o)i(r,s);let a=o.set.bind(o);o.set=(r,s)=>(i(r,s),a(r,s));});};async function xe(e){let n=b(e.roomId),t=be(e.signaling);Z();let o=he({password:e.password}),i=new Q.Doc,a=new Awareness(i),r$1=null,s={abandoned(){},delivered(){}},b$1=()=>{let y=new WebrtcProvider(n,i,{awareness:a,signaling:[...t],...o!==void 0?{password:o}:{},...e.iceServers?{peerOpts:{config:{iceServers:e.iceServers.map(v=>({...v}))}}}:{}});return Se(y,{abandoned:v=>s.abandoned(v),delivered:v=>s.delivered(v)}),y},g;try{e.bootstrap.kind!=="create"&&(r$1=b$1()),g=await r({ydoc:i,awareness:a,documentId:n,identity:e.identity,bootstrap:e.bootstrap,offlineEditing:e.offlineEditing}),r$1||(r$1=b$1());}catch(y){throw r$1?.destroy(),a.destroy(),i.destroy(),y}if(!r$1)throw g.destroy(),a.destroy(),i.destroy(),new Error("WebRTC provider did not initialize");let l=r$1,f=g.session,_=true,E=X(j(f,()=>_));s=E;let C=y=>{_=y.connected,y.connected&&E.reset(),f.setTransportStatus(y.connected?"ready":"disconnected",y.connected?void 0:"transport-disconnected",y.connected?void 0:"webrtc disconnected");};l.on("status",C);let m=N(i,l),R=false;return Object.freeze({document:g.document,session:f,ydoc:i,provider:l,unsyncedChanges:()=>m.count(),subscribeUnsyncedChanges:y=>m.subscribe(y),destroy(){R||(R=true,l.off("status",C),m.destroy(),E.destroy(),g.destroy(),l.destroy(),a.destroy(),i.destroy());}})}
|
|
2
2
|
export{Ue as DEMO_SIGNALING_ENDPOINTS,xe as createWebrtcCollaboration,be as requireSignaling,he as resolveWebrtcRoomPassword};
|
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
2
|
import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Licensing, v1: honor system.
|
|
6
|
-
*
|
|
7
|
-
* The key is accepted and remembered so that adding offline (Ed25519)
|
|
8
|
-
* verification later is not a breaking change — but nothing validates it,
|
|
9
|
-
* nothing warns, nothing renders differently, and NOTHING EVER LEAVES THE
|
|
10
|
-
* PROCESS: no network request is made for licensing, ever. That last property
|
|
11
|
-
* is a spec requirement (`pro-licensing`), not an implementation detail.
|
|
12
|
-
*/
|
|
13
|
-
/** Accepted by every pro entry point. */
|
|
14
|
-
interface ProLicenseOptions {
|
|
15
|
-
/**
|
|
16
|
-
* Your license key from docx-editor.dev. Optional in v1: unlicensed use in
|
|
17
|
-
* development and evaluation is permitted, production use requires a
|
|
18
|
-
* license (see LICENSE.md) — the package trusts you either way.
|
|
19
|
-
*/
|
|
20
|
-
readonly licenseKey?: string;
|
|
21
|
-
}
|
|
3
|
+
import { P as ProLicenseOptions } from './license-D-ds5Y7c.cjs';
|
|
22
4
|
|
|
23
5
|
/**
|
|
24
6
|
* The collaboration module: a replica as an `EditorModule` for
|
|
@@ -44,4 +26,4 @@ interface CollaborationModuleOptions extends ProLicenseOptions {
|
|
|
44
26
|
declare function collaborationModule(options: CollaborationModuleOptions): EditorModule;
|
|
45
27
|
|
|
46
28
|
export { collaborationModule as c };
|
|
47
|
-
export type { CollaborationModuleOptions as C
|
|
29
|
+
export type { CollaborationModuleOptions as C };
|
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
2
|
import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Licensing, v1: honor system.
|
|
6
|
-
*
|
|
7
|
-
* The key is accepted and remembered so that adding offline (Ed25519)
|
|
8
|
-
* verification later is not a breaking change — but nothing validates it,
|
|
9
|
-
* nothing warns, nothing renders differently, and NOTHING EVER LEAVES THE
|
|
10
|
-
* PROCESS: no network request is made for licensing, ever. That last property
|
|
11
|
-
* is a spec requirement (`pro-licensing`), not an implementation detail.
|
|
12
|
-
*/
|
|
13
|
-
/** Accepted by every pro entry point. */
|
|
14
|
-
interface ProLicenseOptions {
|
|
15
|
-
/**
|
|
16
|
-
* Your license key from docx-editor.dev. Optional in v1: unlicensed use in
|
|
17
|
-
* development and evaluation is permitted, production use requires a
|
|
18
|
-
* license (see LICENSE.md) — the package trusts you either way.
|
|
19
|
-
*/
|
|
20
|
-
readonly licenseKey?: string;
|
|
21
|
-
}
|
|
3
|
+
import { P as ProLicenseOptions } from './license-D-ds5Y7c.js';
|
|
22
4
|
|
|
23
5
|
/**
|
|
24
6
|
* The collaboration module: a replica as an `EditorModule` for
|
|
@@ -44,4 +26,4 @@ interface CollaborationModuleOptions extends ProLicenseOptions {
|
|
|
44
26
|
declare function collaborationModule(options: CollaborationModuleOptions): EditorModule;
|
|
45
27
|
|
|
46
28
|
export { collaborationModule as c };
|
|
47
|
-
export type { CollaborationModuleOptions as C
|
|
29
|
+
export type { CollaborationModuleOptions as C };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReviewPaneOptions, EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
-
import { P as ProLicenseOptions } from './
|
|
2
|
+
import { P as ProLicenseOptions } from './license-D-ds5Y7c.cjs';
|
|
3
3
|
import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -9,7 +9,8 @@ import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
|
9
9
|
* Registering it is the whole enablement story: the review chrome slots light
|
|
10
10
|
* up through the same `toolbarCommandState` they were disabled by, suggesting
|
|
11
11
|
* mode becomes reachable, and the editor renders revisions in markup rather
|
|
12
|
-
* than the free tier's final-state projection.
|
|
12
|
+
* than the free tier's final-state projection. It also installs the drawing renderers, as
|
|
13
|
+
* `drawingModule()` from `@docx-editor.dev/pro/drawing` does.
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -28,7 +29,11 @@ interface ReviewModuleOptions extends ProLicenseOptions {
|
|
|
28
29
|
*/
|
|
29
30
|
readonly pane?: ReviewPaneOptions;
|
|
30
31
|
}
|
|
31
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Build the review module. Construction never validates the key and never touches the network.
|
|
34
|
+
* It installs the drawing renderers process-wide, so charts, SmartArt layout, drawing effects,
|
|
35
|
+
* WordArt, and metafile pictures render without a separate `drawingModule()`.
|
|
36
|
+
*/
|
|
32
37
|
declare function reviewModule(options?: ReviewModuleOptions): EditorModule;
|
|
33
38
|
|
|
34
39
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReviewPaneOptions, EditorModule } from '@docx-editor.dev/core/editor';
|
|
2
|
-
import { P as ProLicenseOptions } from './
|
|
2
|
+
import { P as ProLicenseOptions } from './license-D-ds5Y7c.js';
|
|
3
3
|
import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -9,7 +9,8 @@ import { OoxmlPart } from '@docx-editor.dev/core/store';
|
|
|
9
9
|
* Registering it is the whole enablement story: the review chrome slots light
|
|
10
10
|
* up through the same `toolbarCommandState` they were disabled by, suggesting
|
|
11
11
|
* mode becomes reachable, and the editor renders revisions in markup rather
|
|
12
|
-
* than the free tier's final-state projection.
|
|
12
|
+
* than the free tier's final-state projection. It also installs the drawing renderers, as
|
|
13
|
+
* `drawingModule()` from `@docx-editor.dev/pro/drawing` does.
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -28,7 +29,11 @@ interface ReviewModuleOptions extends ProLicenseOptions {
|
|
|
28
29
|
*/
|
|
29
30
|
readonly pane?: ReviewPaneOptions;
|
|
30
31
|
}
|
|
31
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Build the review module. Construction never validates the key and never touches the network.
|
|
34
|
+
* It installs the drawing renderers process-wide, so charts, SmartArt layout, drawing effects,
|
|
35
|
+
* WordArt, and metafile pictures render without a separate `drawingModule()`.
|
|
36
|
+
*/
|
|
32
37
|
declare function reviewModule(options?: ReviewModuleOptions): EditorModule;
|
|
33
38
|
|
|
34
39
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk65JEI6FY_cjs=require('./chunk-65JEI6FY.cjs');Object.defineProperty(exports,"ATTACH_WATCHDOG_MS_FOR_TESTS",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.q}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.r}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunk65JEI6FY_cjs.p}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{q as ATTACH_WATCHDOG_MS_FOR_TESTS,r as createDocumentCollaboration,p as readCollaborationDocument}from'./chunk-WYVEFRAM.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkGLYQ72LS_cjs=require('../chunk-GLYQ72LS.cjs');require('../chunk-IULA3QRZ.cjs');Object.defineProperty(exports,"drawingModule",{enumerable:true,get:function(){return chunkGLYQ72LS_cjs.b}});Object.defineProperty(exports,"installDrawing",{enumerable:true,get:function(){return chunkGLYQ72LS_cjs.a}});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/pro/drawing` — advanced drawing rendering.
|
|
3
|
+
*
|
|
4
|
+
* The free engine paints pictures, shapes with fills, gradients, patterns, lines and outer
|
|
5
|
+
* shadows, text boxes, groups, canvases, text watermarks, and every SmartArt diagram saved
|
|
6
|
+
* with its drawing. This module adds:
|
|
7
|
+
*
|
|
8
|
+
* - charts, drawn from the values cached in their chart parts. Treemap, sunburst and map
|
|
9
|
+
* charts, and charts that mix a pie or radar plot with other plot types, do not render;
|
|
10
|
+
* - the layout of a SmartArt diagram saved without its drawing;
|
|
11
|
+
* - shape and picture effects: glow, inner shadow, reflection, soft edge, and the rim of a
|
|
12
|
+
* dark-edged bevel;
|
|
13
|
+
* - WordArt: VML text paths outside a watermark, fitted to the shape, between two guides, or
|
|
14
|
+
* along an arch, with gradient fills, shadows and 3-D extrusion;
|
|
15
|
+
* - EMF and WMF pictures: a vector replay for PDF export, and a browser raster that honors a
|
|
16
|
+
* metafile's own drawing origin.
|
|
17
|
+
*
|
|
18
|
+
* Without it, or for a chart it does not render, a chart saved with a fallback picture or
|
|
19
|
+
* drawing shows that fallback. In every state a chart selects as an object: picture commands
|
|
20
|
+
* are refused, and deleting it removes the chart with its fallback, as one tracked deletion
|
|
21
|
+
* of the whole chart when change tracking is on. Copy and cut of a selection that includes a
|
|
22
|
+
* chart are refused. The editor shows a labeled placeholder for other visible charts with
|
|
23
|
+
* usable bounds, including a skipped `mc:Choice` with an empty `mc:Fallback`, and a diagram
|
|
24
|
+
* saved without its drawing, and inline WordArt; floating WordArt does not show. The editor still rasterizes
|
|
25
|
+
* EMF and WMF pictures, and a shape paints without those effects. PDF export always includes
|
|
26
|
+
* this module.
|
|
27
|
+
*
|
|
28
|
+
* The renderers serve every editor and export in the process. Install them before any
|
|
29
|
+
* document opens; a later install logs a console warning once. `reviewModule()` installs them
|
|
30
|
+
* too. The metafile replay and `emf-converter` load on first use, only when a document holds a
|
|
31
|
+
* metafile picture.
|
|
32
|
+
*
|
|
33
|
+
* @example Enable advanced drawing rendering in an editor
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { createDocxEditor } from '@docx-editor.dev/core/editor';
|
|
36
|
+
* import { drawingModule } from '@docx-editor.dev/pro/drawing';
|
|
37
|
+
*
|
|
38
|
+
* // Next.js; with Vite, read import.meta.env.VITE_DOCX_LICENSE.
|
|
39
|
+
* const modules = [drawingModule({ licenseKey: process.env.NEXT_PUBLIC_DOCX_LICENSE })];
|
|
40
|
+
* const editor = createDocxEditor({ document: bytes, modules });
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @packageDocumentation
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
47
|
+
import { P as ProLicenseOptions } from '../license-D-ds5Y7c.cjs';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `@docx-editor.dev/pro/drawing` — advanced drawing rendering.
|
|
51
|
+
*
|
|
52
|
+
* The free engine paints pictures, shapes with fills, gradients, patterns, lines and outer
|
|
53
|
+
* shadows, text boxes, groups, canvases, text watermarks, and every SmartArt diagram saved
|
|
54
|
+
* with its drawing. This module adds:
|
|
55
|
+
*
|
|
56
|
+
* - charts, drawn from the values cached in their chart parts. Treemap, sunburst and map
|
|
57
|
+
* charts, and charts that mix a pie or radar plot with other plot types, do not render;
|
|
58
|
+
* - the layout of a SmartArt diagram saved without its drawing;
|
|
59
|
+
* - shape and picture effects: glow, inner shadow, reflection, soft edge, and the rim of a
|
|
60
|
+
* dark-edged bevel;
|
|
61
|
+
* - WordArt: VML text paths outside a watermark, fitted to the shape, between two guides, or
|
|
62
|
+
* along an arch, with gradient fills, shadows and 3-D extrusion;
|
|
63
|
+
* - EMF and WMF pictures: a vector replay for PDF export, and a browser raster that honors a
|
|
64
|
+
* metafile's own drawing origin.
|
|
65
|
+
*
|
|
66
|
+
* Without it, or for a chart it does not render, a chart saved with a fallback picture or
|
|
67
|
+
* drawing shows that fallback. In every state a chart selects as an object: picture commands
|
|
68
|
+
* are refused, and deleting it removes the chart with its fallback, as one tracked deletion
|
|
69
|
+
* of the whole chart when change tracking is on. Copy and cut of a selection that includes a
|
|
70
|
+
* chart are refused. The editor shows a labeled placeholder for other visible charts with
|
|
71
|
+
* usable bounds, including a skipped `mc:Choice` with an empty `mc:Fallback`, and a diagram
|
|
72
|
+
* saved without its drawing, and inline WordArt; floating WordArt does not show. The editor still rasterizes
|
|
73
|
+
* EMF and WMF pictures, and a shape paints without those effects. PDF export always includes
|
|
74
|
+
* this module.
|
|
75
|
+
*
|
|
76
|
+
* The renderers serve every editor and export in the process. Install them before any
|
|
77
|
+
* document opens; a later install logs a console warning once. `reviewModule()` installs them
|
|
78
|
+
* too. The metafile replay and `emf-converter` load on first use, only when a document holds a
|
|
79
|
+
* metafile picture.
|
|
80
|
+
*
|
|
81
|
+
* @example Enable advanced drawing rendering in an editor
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { createDocxEditor } from '@docx-editor.dev/core/editor';
|
|
84
|
+
* import { drawingModule } from '@docx-editor.dev/pro/drawing';
|
|
85
|
+
*
|
|
86
|
+
* // Next.js; with Vite, read import.meta.env.VITE_DOCX_LICENSE.
|
|
87
|
+
* const modules = [drawingModule({ licenseKey: process.env.NEXT_PUBLIC_DOCX_LICENSE })];
|
|
88
|
+
* const editor = createDocxEditor({ document: bytes, modules });
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @packageDocumentation
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Install the drawing renderers (charts, SmartArt layout, effects, WordArt, and metafiles) for
|
|
97
|
+
* every editor and export in this process, without an editor module: for headless
|
|
98
|
+
* conversion. Installing again is harmless. A host without the EigenPal Pro License leaves
|
|
99
|
+
* this call out; its charts then show their fallback pictures or drawings, or placeholders.
|
|
100
|
+
*
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
declare function installDrawing(options?: ProLicenseOptions): void;
|
|
104
|
+
/**
|
|
105
|
+
* The drawing module for `createDocxEditor({ modules })`. Creating it installs the drawing
|
|
106
|
+
* renderers process-wide, as {@link installDrawing} does.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
declare function drawingModule(options?: ProLicenseOptions): EditorModule;
|
|
111
|
+
|
|
112
|
+
export { ProLicenseOptions, drawingModule, installDrawing };
|