@docx-editor.dev/core 2.9.2 → 2.11.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.
Files changed (140) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.cts +14 -5
  3. package/dist/automation.d.ts +14 -5
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.cts +78 -13
  7. package/dist/binding.d.ts +78 -13
  8. package/dist/binding.js +1 -1
  9. package/dist/chunk-34BNQUD4.js +10 -0
  10. package/dist/chunk-5AVHO75P.cjs +19 -0
  11. package/dist/chunk-6HMSC7UV.js +2 -0
  12. package/dist/chunk-6JIJOZDW.js +1 -0
  13. package/dist/chunk-76Y3Y45J.cjs +2 -0
  14. package/dist/chunk-BP7ANXGA.js +1 -0
  15. package/dist/chunk-BTQKU64Q.cjs +1 -0
  16. package/dist/chunk-CRZR6K5Z.js +19 -0
  17. package/dist/chunk-D5EHDHYV.js +1 -0
  18. package/dist/chunk-EJATEGJZ.cjs +1 -0
  19. package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
  20. package/dist/chunk-GRDFEH5Q.cjs +2 -0
  21. package/dist/chunk-GWV65NQW.cjs +10 -0
  22. package/dist/chunk-GXLZCXEH.js +2 -0
  23. package/dist/chunk-JUQOPVSK.cjs +2 -0
  24. package/dist/chunk-LAETEBHD.js +1 -0
  25. package/dist/chunk-M6Z3KFXM.cjs +5 -0
  26. package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
  27. package/dist/chunk-UQFOYZJO.cjs +18 -0
  28. package/dist/chunk-WPQMPHNR.cjs +1 -0
  29. package/dist/chunk-WXQ245MQ.js +18 -0
  30. package/dist/chunk-WZHIFNSU.js +5 -0
  31. package/dist/chunk-X7A5XART.js +2 -0
  32. package/dist/chunk-ZKWRCLT2.cjs +1 -0
  33. package/dist/collaboration/replication.cjs +1 -0
  34. package/dist/collaboration/replication.d.cts +216 -0
  35. package/dist/collaboration/replication.d.ts +216 -0
  36. package/dist/collaboration/replication.js +1 -0
  37. package/dist/collaboration.cjs +1 -0
  38. package/dist/collaboration.d.cts +176 -0
  39. package/dist/collaboration.d.ts +176 -0
  40. package/dist/collaboration.js +1 -0
  41. package/dist/contracts/document.d.cts +6 -1
  42. package/dist/contracts/document.d.ts +6 -1
  43. package/dist/contracts/editor.cjs +1 -1
  44. package/dist/contracts/editor.d.cts +8 -9
  45. package/dist/contracts/editor.d.ts +8 -9
  46. package/dist/contracts/editor.js +1 -1
  47. package/dist/contracts/interaction.d.cts +8 -9
  48. package/dist/contracts/interaction.d.ts +8 -9
  49. package/dist/contracts/modules.cjs +1 -1
  50. package/dist/contracts/modules.d.cts +20 -8
  51. package/dist/contracts/modules.d.ts +20 -8
  52. package/dist/contracts/modules.js +1 -1
  53. package/dist/custom-node-writes-CwkYRw3V.d.cts +310 -0
  54. package/dist/custom-node-writes-JfTn-Sy6.d.ts +310 -0
  55. package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
  56. package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
  57. package/dist/{editor-Cvd7Geoc.d.ts → editor-BogcVHXk.d.ts} +176 -59
  58. package/dist/{editor-cAEf1uXW.d.cts → editor-C8edZgy5.d.cts} +176 -59
  59. package/dist/editor.cjs +1 -1
  60. package/dist/editor.css +1 -7698
  61. package/dist/editor.d.cts +26 -25
  62. package/dist/editor.d.ts +26 -25
  63. package/dist/editor.js +1 -1
  64. package/dist/failure-BnGjoXf0.d.cts +64 -0
  65. package/dist/failure-BnGjoXf0.d.ts +64 -0
  66. package/dist/{index-DRqY5JVF.d.ts → index-BNv-ZLQP.d.ts} +327 -86
  67. package/dist/{index-wb-iOxfh.d.cts → index-Dn0lOp9Z.d.cts} +327 -86
  68. package/dist/index.cjs +1 -1
  69. package/dist/index.d.cts +20 -19
  70. package/dist/index.d.ts +20 -19
  71. package/dist/index.js +1 -1
  72. package/dist/layout.cjs +1 -1
  73. package/dist/layout.d.cts +92 -55
  74. package/dist/layout.d.ts +92 -55
  75. package/dist/layout.js +1 -1
  76. package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-BmoSdyKS.d.ts} +1 -1
  77. package/dist/{note-properties-CQlxjic_.d.cts → note-properties-BvGfHk5e.d.cts} +1 -1
  78. package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-Ciq5rgb7.d.ts} +1 -1
  79. package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-CqQOt_dD.d.cts} +1 -1
  80. package/dist/output.cjs +1 -1
  81. package/dist/output.d.cts +6 -8
  82. package/dist/output.d.ts +6 -8
  83. package/dist/output.js +1 -1
  84. package/dist/{protocol-UuZOcOp7.d.cts → protocol-BB-WP3zk.d.cts} +2 -2
  85. package/dist/{protocol-C7ahrdUx.d.ts → protocol-Ckl7hWsv.d.ts} +2 -2
  86. package/dist/{review-items-bdGxFWNA.d.ts → review-items-BdeLNRi2.d.cts} +1 -2
  87. package/dist/{review-items-B8tffIXj.d.cts → review-items-CkYyXhXM.d.ts} +1 -2
  88. package/dist/{review-reads-Bxz03tHG.d.cts → review-reads-BOLSBm5w.d.cts} +2 -2
  89. package/dist/{review-reads-CHODU0LI.d.ts → review-reads-Crf0Xn42.d.ts} +2 -2
  90. package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-Ae2CWa8E.d.ts} +1 -1
  91. package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-C2S8PSQm.d.cts} +1 -1
  92. package/dist/{semantic-cell-selection-BPzx6DdT.d.cts → semantic-cell-selection-C0OFD4D9.d.cts} +4 -4
  93. package/dist/{semantic-cell-selection-CsHcr-yk.d.ts → semantic-cell-selection-DdmoxC-y.d.ts} +4 -4
  94. package/dist/{semantic-interaction-D-RZ9Ust.d.ts → semantic-interaction-COyhZ9WH.d.ts} +21 -2
  95. package/dist/{semantic-interaction-BfWDD_0V.d.cts → semantic-interaction-Cs2jErnt.d.cts} +21 -2
  96. package/dist/{semantic-paint-WhVtSDJK.d.ts → semantic-paint-UHaj3sBY.d.cts} +2 -2
  97. package/dist/{semantic-paint-Bd7EqzXV.d.cts → semantic-paint-vA-oLSdV.d.ts} +2 -2
  98. package/dist/{semantic-records-DadVT_E1.d.cts → semantic-records-5AOQJmLX.d.cts} +20 -5
  99. package/dist/{semantic-records-DCt-ZwKU.d.ts → semantic-records-9xhwbJ23.d.ts} +20 -5
  100. package/dist/{shaped-measurer-CninrHr_.d.cts → shaped-measurer-NeF2mPSu.d.cts} +1 -1
  101. package/dist/{shaped-measurer-B9f4A7QA.d.ts → shaped-measurer-vzsY88oK.d.ts} +1 -1
  102. package/dist/store.cjs +1 -1
  103. package/dist/store.d.cts +193 -19
  104. package/dist/store.d.ts +193 -19
  105. package/dist/store.js +1 -1
  106. package/dist/tree-op-types-BPyXNxyL.d.cts +3053 -0
  107. package/dist/tree-op-types-DnzAOnc9.d.ts +3053 -0
  108. package/dist/{custom-node-writes-D6SGwebL.d.ts → tree-package-fragment-BjZ3RWAS.d.cts} +128 -312
  109. package/dist/{custom-node-writes-Dy3b20PS.d.cts → tree-package-fragment-CDER0G3B.d.ts} +128 -312
  110. package/dist/{tree-session-ZuBFOhIh.d.ts → tree-session-contract-BF2FVBOM.d.cts} +52 -106
  111. package/dist/{tree-session-Df02ajqc.d.cts → tree-session-contract-DhdsFT_z.d.ts} +52 -106
  112. package/dist/{tree-store-B_sJBMIS.d.cts → tree-store-CNZ3O83s.d.ts} +130 -25
  113. package/dist/{tree-store-DgETo6Mf.d.ts → tree-store-DfZi7FqY.d.cts} +130 -25
  114. package/package.json +14 -3
  115. package/dist/chunk-6JWP2H7K.js +0 -2
  116. package/dist/chunk-6KNLLEUW.cjs +0 -18
  117. package/dist/chunk-7ADTI533.cjs +0 -10
  118. package/dist/chunk-7ETDCPF6.cjs +0 -2
  119. package/dist/chunk-7I3BSGGS.js +0 -1
  120. package/dist/chunk-7UU5YFCD.cjs +0 -2
  121. package/dist/chunk-7VQ7YLW3.cjs +0 -1
  122. package/dist/chunk-CKDAK3MV.js +0 -10
  123. package/dist/chunk-DIMEYVNS.js +0 -2
  124. package/dist/chunk-GQQOL4PV.js +0 -1
  125. package/dist/chunk-H2656QDI.cjs +0 -1
  126. package/dist/chunk-KQGENNL5.cjs +0 -15
  127. package/dist/chunk-LIXPSV4T.js +0 -18
  128. package/dist/chunk-O4UULRAQ.cjs +0 -5
  129. package/dist/chunk-SIIFNE6U.js +0 -15
  130. package/dist/chunk-VXYECPKA.js +0 -5
  131. package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
  132. package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
  133. package/dist/image-resources-BgA9EQxY.d.ts +0 -203
  134. package/dist/image-resources-BiA-IXgo.d.cts +0 -203
  135. package/dist/note-nodes-BNCANoGN.d.ts +0 -108
  136. package/dist/note-nodes-DL-Au22P.d.cts +0 -108
  137. package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
  138. package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
  139. package/dist/tree-op-types-CnRb7AYo.d.ts +0 -1589
  140. package/dist/tree-op-types-D1vNJ7XC.d.cts +0 -1589
@@ -1 +1 @@
1
- 'use strict';var chunkH2656QDI_cjs=require('./chunk-H2656QDI.cjs'),chunk7ADTI533_cjs=require('./chunk-7ADTI533.cjs');var I=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),j=Object.freeze({kind:"body"});function D(a,r={}){let o=chunk7ADTI533_cjs.ob(a,r.limits??{});if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let n=o.package.parts.get(o.package.mainDocumentPart);if(!n)return {ok:false,reason:"no-main-document-part",detail:o.package.mainDocumentPart};let e=new chunk7ADTI533_cjs.Rf(o.package,chunk7ADTI533_cjs.Wc(n));return {ok:true,host:chunkH2656QDI_cjs.g({port:M(e),capabilities:I})}}function L(a,r,o){let n=a.partFor(o);if(!n)return null;let e=chunk7ADTI533_cjs.Yc(a.currentPackage(),r,n.name);return e?(a.replacePackageShell(e.pkg),e.relationshipId):null}function M(a){let r=true;return {revision:()=>a.packageRevision,currentPackage:()=>r?a.currentPackage():null,apply(o,n=j){if(!r)return {ok:false,reason:"disposed"};let e=o(i=>L(a,i,n));if(e===null)return {ok:false,reason:"unsupported-target"};let t=a.transact(n,i=>{for(let u of e)i.apply(u);});return t.ok?{ok:true,changed:t.change!==null}:{ok:false,reason:t.detail?`${t.reason}: ${t.detail}`:t.reason}},applyLifecycle(o){if(!r)return {ok:false,reason:"disposed"};let n=a.applyLifecycleOp(o);return n.ok?{ok:true,changed:n.change!==null}:{ok:false,reason:n.detail?`${n.reason}: ${n.detail}`:n.reason}},applyCommentWrites(o,n){if(!r)return {ok:false,reason:"disposed"};if(o.length===0)return {ok:true,changed:false};let e=a.resolveStory(n);if(!e.ok)return {ok:false,reason:e.reason};if(e.store.graftPackage(()=>a.currentPackage()),o.every(u=>u.kind==="delete")){let u=false,l=false,x=e.store.transact(T=>{T.applyPackage(d=>{let m=d;for(let s of o){if(s.kind!=="delete")continue;let A={storyPartName:e.store.part.name,...s.noteId===void 0?{}:{noteId:s.noteId}},p=s.parentCommentId===void 0?chunk7ADTI533_cjs.We(m,s.commentId,A):chunk7ADTI533_cjs.Xe(m,s.commentId,s.parentCommentId,A);if(p===null)return u=true,d;l||=p!==m,m=p;}return m});});return u||!x.ok?{ok:false,reason:"comment-delete-refused"}:(l&&a.installPackageSnapshot(e.store.package),{ok:true,changed:l})}if(o.length!==1)return {ok:false,reason:"mixed-comment-writes"};let t=o[0],i=t.kind==="create"?chunk7ADTI533_cjs.Wf(e.store,{anchor:t.anchor,author:t.author,text:t.text,...t.date===void 0?{}:{date:t.date}}):t.kind==="reply"?chunk7ADTI533_cjs.Wf(e.store,{anchor:t.anchor,author:t.author,text:t.text,...t.date===void 0?{}:{date:t.date},replyToCommentId:t.parentCommentId}):t.kind==="resolve"?chunk7ADTI533_cjs.Xf(e.store,t.commentId,t.resolved):null;return i===null?{ok:false,reason:"unsupported-comment-write"}:i.ok?(a.replacePackageShell(e.store.package),{ok:true,changed:true,..."commentId"in i?{commentId:i.commentId}:{}}):{ok:false,reason:i.reason}},applyCustomNodeWrite(o,n){if(!r)return {ok:false,reason:"disposed"};let e=a.resolveStory(n);if(!e.ok)return {ok:false,reason:e.reason};e.store.graftPackage(()=>a.currentPackage());let t=chunk7ADTI533_cjs.bg(e.store,o);return t.ok?(a.replacePackageShell(e.store.package),{ok:true,changed:t.change!==null}):{ok:false,reason:t.detail?`${t.reason}: ${t.detail}`:t.reason}},save:()=>r?chunk7ADTI533_cjs.pb(a.currentPackage()):null,subscribe:o=>a.subscribe(()=>o()),dispose(){r=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkH2656QDI_cjs.c}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkH2656QDI_cjs.b}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkH2656QDI_cjs.d}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkH2656QDI_cjs.a}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkH2656QDI_cjs.f}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkH2656QDI_cjs.e}});exports.SERVER_AUTOMATION_CAPABILITIES=I;exports.createServerAutomationHost=D;
1
+ 'use strict';var chunkEJATEGJZ_cjs=require('./chunk-EJATEGJZ.cjs'),chunk76Y3Y45J_cjs=require('./chunk-76Y3Y45J.cjs'),chunkWPQMPHNR_cjs=require('./chunk-WPQMPHNR.cjs'),chunkGWV65NQW_cjs=require('./chunk-GWV65NQW.cjs');var N=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),b=Object.freeze({kind:"body"});function U(t,e={}){let s=chunkGWV65NQW_cjs.Sb(t,e.limits??{});if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let u=s.package.parts.get(s.package.mainDocumentPart);if(!u)return {ok:false,reason:"no-main-document-part",detail:s.package.mainDocumentPart};let m=new chunk76Y3Y45J_cjs.f(s.package,chunkGWV65NQW_cjs.yb(u)),f=e.collaborationModel?.session,l=()=>{},n=F(m,f,()=>l()),a=chunkEJATEGJZ_cjs.g({port:n,capabilities:N});return f&&(l=f.attach(chunkWPQMPHNR_cjs.b(m,{documentId:f.documentId}))),{ok:true,host:a}}function W(t,e,s){let u=t.partFor(s);return u?chunkGWV65NQW_cjs.xa(t,()=>{let m=chunkGWV65NQW_cjs.Bd(t.currentPackage(),e,u.name);return m?(t.replacePackageShell(m.pkg),m.relationshipId):null},m=>m!==null):null}function F(t,e,s=()=>{}){let u=true,m=0,f=()=>e?(m+=1,{origin:e.identity.role==="agent"?chunkGWV65NQW_cjs.b.mutationAgent:chunkGWV65NQW_cjs.b.mutationHuman,actorId:e.identity.actorId,operationId:`${e.identity.actorId}:${e.sessionId}:automation:${m}`,recordsHistory:false}):{},l=n=>(e?.flushPendingJournals(),n);return {revision:()=>t.packageRevision,currentPackage:()=>u?t.currentPackage():null,apply(n,a=b){if(!u)return {ok:false,reason:"disposed"};let r=n(i=>chunkGWV65NQW_cjs.Ab(e?.identity.actorId,()=>W(t,i,a)));if(r===null)return {ok:false,reason:"unsupported-target"};let p=e?.gateOperations(r,a);if(p)return {ok:false,reason:p};let o=e?t.partFor(a)?.name:void 0,d=t.transact(a,i=>{for(let A of r)i.apply(A);o&&i.applyPackage(A=>chunkWPQMPHNR_cjs.a(A,o,r));},f());return d.ok?l({ok:true,changed:d.change!==null}):{ok:false,reason:d.detail?`${d.reason}: ${d.detail}`:d.reason}},applyLifecycle(n){if(!u)return {ok:false,reason:"disposed"};let a=e?.gateOperations([n],b);if(a)return {ok:false,reason:a};let r=chunkGWV65NQW_cjs.Ab(e?.identity.actorId,()=>t.applyLifecycleOp(n));return r.ok?l({ok:true,changed:r.change!==null}):{ok:false,reason:r.detail?`${r.reason}: ${r.detail}`:r.reason}},applyCommentWrites(n,a){if(!u)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let r=e?.gateOperations([],a);if(r)return {ok:false,reason:r};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};if(p.store.graftPackage(()=>t.currentPackage()),n.every(i=>i.kind==="delete")){let i=n.find(k=>k.kind==="delete"),A=chunkGWV65NQW_cjs.Ab(e?.identity.actorId,()=>chunk76Y3Y45J_cjs.s(t,n.flatMap(k=>k.kind==="delete"?[{commentId:k.commentId,...k.parentCommentId===void 0?{}:{parentCommentId:k.parentCommentId}}]:[]),a,i?.kind==="delete"?i.noteId:void 0));return A?l({ok:true,changed:A}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let o=n[0];if(o.kind==="create"||o.kind==="reply"){let i=chunkGWV65NQW_cjs.Ab(e?.identity.actorId,()=>chunk76Y3Y45J_cjs.q(t,{anchor:o.anchor,author:o.author,text:o.text,...o.date===void 0?{}:{date:o.date},...o.kind==="reply"?{replyToCommentId:o.parentCommentId}:{}},a));return i.ok?l({ok:true,changed:true,..."commentId"in i?{commentId:i.commentId}:{}}):{ok:false,reason:i.reason}}if(o.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let d=chunkGWV65NQW_cjs.Ab(e?.identity.actorId,()=>chunk76Y3Y45J_cjs.r(t,o.commentId,o.resolved));return d.ok?l({ok:true,changed:true}):{ok:false,reason:d.reason}},applyCustomNodeWrite(n,a){if(!u)return {ok:false,reason:"disposed"};let r=e?.gateOperations([],a);if(r)return {ok:false,reason:r};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};let o=chunkGWV65NQW_cjs.Ab(e?.identity.actorId,()=>chunk76Y3Y45J_cjs.A(t,n,a));return o.ok?l({ok:true,changed:o.change!==null}):{ok:false,reason:o.detail?`${o.reason}: ${o.detail}`:o.reason}},save:()=>u?chunkGWV65NQW_cjs.Tb(t.currentPackage()):null,subscribe:n=>t.subscribe(()=>n()),dispose(){s(),u=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkEJATEGJZ_cjs.c}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkEJATEGJZ_cjs.b}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkEJATEGJZ_cjs.d}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkEJATEGJZ_cjs.a}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkEJATEGJZ_cjs.f}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkEJATEGJZ_cjs.e}});exports.SERVER_AUTOMATION_CAPABILITIES=N;exports.createServerAutomationHost=U;
@@ -1,8 +1,12 @@
1
- import { A as AutomationCapabilities, a as AutomationHost } from './protocol-UuZOcOp7.cjs';
2
- export { b as AUTOMATION_COMMAND_OPERATIONS, c as AUTOMATION_QUERY_OPERATIONS, d as AUTOMATION_SOLITARY_OPERATIONS, e as AutomationAlignment, f as AutomationBatchRequest, g as AutomationBatchResponse, h as AutomationChangeEvent, i as AutomationContentControlLock, j as AutomationContentControlRangeLocation, k as AutomationContentControlScope, l as AutomationContentControlSubtype, m as AutomationContentControlValue, n as AutomationError, o as AutomationErrorCode, p as AutomationFontRead, q as AutomationFontWrite, r as AutomationHandle, s as AutomationHandleRef, t as AutomationObjectKind, u as AutomationOperation, v as AutomationOperationKind, w as AutomationOperationResult, x as AutomationPageOrientation, y as AutomationPageSetupRead, z as AutomationPageSetupWrite, B as AutomationParagraphFormatRead, C as AutomationParagraphFormatWrite, D as AutomationParagraphRef, E as AutomationPoint, F as AutomationSaveResult, G as AutomationSearchOptions, H as AutomationSelectionMode, I as AutomationSpan, J as AutomationSpanRef, K as AutomationTextProjection, L as AutomationUnsubscribe, M as AutomationValue, N as isAutomationCommand, O as isSolitaryAutomationCommand } from './protocol-UuZOcOp7.cjs';
3
- import { H as HeaderFooterVariant } from './hf-references-Dvk6De4Q.cjs';
4
- import { N as NoteKind } from './note-nodes-DL-Au22P.cjs';
5
- import { n as OoxmlPackageLimits, o as OoxmlPackageRejection } from './ooxml-package-CdEy9ufK.cjs';
1
+ import { A as AutomationCapabilities, a as AutomationHost } from './protocol-BB-WP3zk.cjs';
2
+ export { b as AUTOMATION_COMMAND_OPERATIONS, c as AUTOMATION_QUERY_OPERATIONS, d as AUTOMATION_SOLITARY_OPERATIONS, e as AutomationAlignment, f as AutomationBatchRequest, g as AutomationBatchResponse, h as AutomationChangeEvent, i as AutomationContentControlLock, j as AutomationContentControlRangeLocation, k as AutomationContentControlScope, l as AutomationContentControlSubtype, m as AutomationContentControlValue, n as AutomationError, o as AutomationErrorCode, p as AutomationFontRead, q as AutomationFontWrite, r as AutomationHandle, s as AutomationHandleRef, t as AutomationObjectKind, u as AutomationOperation, v as AutomationOperationKind, w as AutomationOperationResult, x as AutomationPageOrientation, y as AutomationPageSetupRead, z as AutomationPageSetupWrite, B as AutomationParagraphFormatRead, C as AutomationParagraphFormatWrite, D as AutomationParagraphRef, E as AutomationPoint, F as AutomationSaveResult, G as AutomationSearchOptions, H as AutomationSelectionMode, I as AutomationSpan, J as AutomationSpanRef, K as AutomationTextProjection, L as AutomationUnsubscribe, M as AutomationValue, N as isAutomationCommand, O as isSolitaryAutomationCommand } from './protocol-BB-WP3zk.cjs';
3
+ import { H as HeaderFooterVariant } from './tree-package-fragment-BjZ3RWAS.cjs';
4
+ import { N as NoteKind } from './tree-store-DfZi7FqY.cjs';
5
+ import { e as OoxmlPackageLimits, f as OoxmlPackageRejection } from './tree-op-types-BPyXNxyL.cjs';
6
+ import { CollaborationModuleContribution } from './collaboration.cjs';
7
+ import './contracts/types.cjs';
8
+ import './collaboration/replication.cjs';
9
+ import './failure-BnGjoXf0.cjs';
6
10
 
7
11
  /** The variants a section can declare furniture for. */
8
12
  declare const HEADER_FOOTER_VARIANTS: readonly HeaderFooterVariant[];
@@ -61,6 +65,11 @@ interface ServerAutomationHostOptions {
61
65
  * may want smaller limits than the defaults. Omitted means the engine's own defaults.
62
66
  */
63
67
  readonly limits?: OoxmlPackageLimits;
68
+ /**
69
+ * Collaboration replica from the module registry. Absent, this host does
70
+ * not attach a replica.
71
+ */
72
+ readonly collaborationModel?: CollaborationModuleContribution;
64
73
  }
65
74
  /**
66
75
  * Open DOCX bytes into a headless automation host.
@@ -1,8 +1,12 @@
1
- import { A as AutomationCapabilities, a as AutomationHost } from './protocol-C7ahrdUx.js';
2
- export { b as AUTOMATION_COMMAND_OPERATIONS, c as AUTOMATION_QUERY_OPERATIONS, d as AUTOMATION_SOLITARY_OPERATIONS, e as AutomationAlignment, f as AutomationBatchRequest, g as AutomationBatchResponse, h as AutomationChangeEvent, i as AutomationContentControlLock, j as AutomationContentControlRangeLocation, k as AutomationContentControlScope, l as AutomationContentControlSubtype, m as AutomationContentControlValue, n as AutomationError, o as AutomationErrorCode, p as AutomationFontRead, q as AutomationFontWrite, r as AutomationHandle, s as AutomationHandleRef, t as AutomationObjectKind, u as AutomationOperation, v as AutomationOperationKind, w as AutomationOperationResult, x as AutomationPageOrientation, y as AutomationPageSetupRead, z as AutomationPageSetupWrite, B as AutomationParagraphFormatRead, C as AutomationParagraphFormatWrite, D as AutomationParagraphRef, E as AutomationPoint, F as AutomationSaveResult, G as AutomationSearchOptions, H as AutomationSelectionMode, I as AutomationSpan, J as AutomationSpanRef, K as AutomationTextProjection, L as AutomationUnsubscribe, M as AutomationValue, N as isAutomationCommand, O as isSolitaryAutomationCommand } from './protocol-C7ahrdUx.js';
3
- import { H as HeaderFooterVariant } from './hf-references-z5Y4N1ab.js';
4
- import { N as NoteKind } from './note-nodes-BNCANoGN.js';
5
- import { n as OoxmlPackageLimits, o as OoxmlPackageRejection } from './ooxml-package-CdEy9ufK.js';
1
+ import { A as AutomationCapabilities, a as AutomationHost } from './protocol-Ckl7hWsv.js';
2
+ export { b as AUTOMATION_COMMAND_OPERATIONS, c as AUTOMATION_QUERY_OPERATIONS, d as AUTOMATION_SOLITARY_OPERATIONS, e as AutomationAlignment, f as AutomationBatchRequest, g as AutomationBatchResponse, h as AutomationChangeEvent, i as AutomationContentControlLock, j as AutomationContentControlRangeLocation, k as AutomationContentControlScope, l as AutomationContentControlSubtype, m as AutomationContentControlValue, n as AutomationError, o as AutomationErrorCode, p as AutomationFontRead, q as AutomationFontWrite, r as AutomationHandle, s as AutomationHandleRef, t as AutomationObjectKind, u as AutomationOperation, v as AutomationOperationKind, w as AutomationOperationResult, x as AutomationPageOrientation, y as AutomationPageSetupRead, z as AutomationPageSetupWrite, B as AutomationParagraphFormatRead, C as AutomationParagraphFormatWrite, D as AutomationParagraphRef, E as AutomationPoint, F as AutomationSaveResult, G as AutomationSearchOptions, H as AutomationSelectionMode, I as AutomationSpan, J as AutomationSpanRef, K as AutomationTextProjection, L as AutomationUnsubscribe, M as AutomationValue, N as isAutomationCommand, O as isSolitaryAutomationCommand } from './protocol-Ckl7hWsv.js';
3
+ import { H as HeaderFooterVariant } from './tree-package-fragment-CDER0G3B.js';
4
+ import { N as NoteKind } from './tree-store-CNZ3O83s.js';
5
+ import { e as OoxmlPackageLimits, f as OoxmlPackageRejection } from './tree-op-types-DnzAOnc9.js';
6
+ import { CollaborationModuleContribution } from './collaboration.js';
7
+ import './contracts/types.js';
8
+ import './collaboration/replication.js';
9
+ import './failure-BnGjoXf0.js';
6
10
 
7
11
  /** The variants a section can declare furniture for. */
8
12
  declare const HEADER_FOOTER_VARIANTS: readonly HeaderFooterVariant[];
@@ -61,6 +65,11 @@ interface ServerAutomationHostOptions {
61
65
  * may want smaller limits than the defaults. Omitted means the engine's own defaults.
62
66
  */
63
67
  readonly limits?: OoxmlPackageLimits;
68
+ /**
69
+ * Collaboration replica from the module registry. Absent, this host does
70
+ * not attach a replica.
71
+ */
72
+ readonly collaborationModel?: CollaborationModuleContribution;
64
73
  }
65
74
  /**
66
75
  * Open DOCX bytes into a headless automation host.
@@ -1 +1 @@
1
- import {g}from'./chunk-7I3BSGGS.js';export{c as AUTOMATION_COMMAND_OPERATIONS,b as AUTOMATION_QUERY_OPERATIONS,d as AUTOMATION_SOLITARY_OPERATIONS,a as HEADER_FOOTER_VARIANTS,f as isAutomationCommand,e as isSolitaryAutomationCommand}from'./chunk-7I3BSGGS.js';import {ob,Rf,Wc,pb,bg,We,Xe,Wf,Xf,Yc}from'./chunk-CKDAK3MV.js';var I=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),j=Object.freeze({kind:"body"});function D(a,r={}){let o=ob(a,r.limits??{});if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let n=o.package.parts.get(o.package.mainDocumentPart);if(!n)return {ok:false,reason:"no-main-document-part",detail:o.package.mainDocumentPart};let e=new Rf(o.package,Wc(n));return {ok:true,host:g({port:M(e),capabilities:I})}}function L(a,r,o){let n=a.partFor(o);if(!n)return null;let e=Yc(a.currentPackage(),r,n.name);return e?(a.replacePackageShell(e.pkg),e.relationshipId):null}function M(a){let r=true;return {revision:()=>a.packageRevision,currentPackage:()=>r?a.currentPackage():null,apply(o,n=j){if(!r)return {ok:false,reason:"disposed"};let e=o(i=>L(a,i,n));if(e===null)return {ok:false,reason:"unsupported-target"};let t=a.transact(n,i=>{for(let u of e)i.apply(u);});return t.ok?{ok:true,changed:t.change!==null}:{ok:false,reason:t.detail?`${t.reason}: ${t.detail}`:t.reason}},applyLifecycle(o){if(!r)return {ok:false,reason:"disposed"};let n=a.applyLifecycleOp(o);return n.ok?{ok:true,changed:n.change!==null}:{ok:false,reason:n.detail?`${n.reason}: ${n.detail}`:n.reason}},applyCommentWrites(o,n){if(!r)return {ok:false,reason:"disposed"};if(o.length===0)return {ok:true,changed:false};let e=a.resolveStory(n);if(!e.ok)return {ok:false,reason:e.reason};if(e.store.graftPackage(()=>a.currentPackage()),o.every(u=>u.kind==="delete")){let u=false,l=false,x=e.store.transact(T=>{T.applyPackage(d=>{let m=d;for(let s of o){if(s.kind!=="delete")continue;let A={storyPartName:e.store.part.name,...s.noteId===void 0?{}:{noteId:s.noteId}},p=s.parentCommentId===void 0?We(m,s.commentId,A):Xe(m,s.commentId,s.parentCommentId,A);if(p===null)return u=true,d;l||=p!==m,m=p;}return m});});return u||!x.ok?{ok:false,reason:"comment-delete-refused"}:(l&&a.installPackageSnapshot(e.store.package),{ok:true,changed:l})}if(o.length!==1)return {ok:false,reason:"mixed-comment-writes"};let t=o[0],i=t.kind==="create"?Wf(e.store,{anchor:t.anchor,author:t.author,text:t.text,...t.date===void 0?{}:{date:t.date}}):t.kind==="reply"?Wf(e.store,{anchor:t.anchor,author:t.author,text:t.text,...t.date===void 0?{}:{date:t.date},replyToCommentId:t.parentCommentId}):t.kind==="resolve"?Xf(e.store,t.commentId,t.resolved):null;return i===null?{ok:false,reason:"unsupported-comment-write"}:i.ok?(a.replacePackageShell(e.store.package),{ok:true,changed:true,..."commentId"in i?{commentId:i.commentId}:{}}):{ok:false,reason:i.reason}},applyCustomNodeWrite(o,n){if(!r)return {ok:false,reason:"disposed"};let e=a.resolveStory(n);if(!e.ok)return {ok:false,reason:e.reason};e.store.graftPackage(()=>a.currentPackage());let t=bg(e.store,o);return t.ok?(a.replacePackageShell(e.store.package),{ok:true,changed:t.change!==null}):{ok:false,reason:t.detail?`${t.reason}: ${t.detail}`:t.reason}},save:()=>r?pb(a.currentPackage()):null,subscribe:o=>a.subscribe(()=>o()),dispose(){r=false;}}}export{I as SERVER_AUTOMATION_CAPABILITIES,D as createServerAutomationHost};
1
+ import {g}from'./chunk-LAETEBHD.js';export{c as AUTOMATION_COMMAND_OPERATIONS,b as AUTOMATION_QUERY_OPERATIONS,d as AUTOMATION_SOLITARY_OPERATIONS,a as HEADER_FOOTER_VARIANTS,f as isAutomationCommand,e as isSolitaryAutomationCommand}from'./chunk-LAETEBHD.js';import {f,A,s,q,r}from'./chunk-X7A5XART.js';import {b as b$1,a}from'./chunk-BP7ANXGA.js';import {Sb,yb,Tb,Ab,xa,Bd,b as b$2}from'./chunk-34BNQUD4.js';var N=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),b=Object.freeze({kind:"body"});function U(t,e={}){let s=Sb(t,e.limits??{});if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let u=s.package.parts.get(s.package.mainDocumentPart);if(!u)return {ok:false,reason:"no-main-document-part",detail:s.package.mainDocumentPart};let m=new f(s.package,yb(u)),f$1=e.collaborationModel?.session,l=()=>{},n=F(m,f$1,()=>l()),a=g({port:n,capabilities:N});return f$1&&(l=f$1.attach(b$1(m,{documentId:f$1.documentId}))),{ok:true,host:a}}function W(t,e,s){let u=t.partFor(s);return u?xa(t,()=>{let m=Bd(t.currentPackage(),e,u.name);return m?(t.replacePackageShell(m.pkg),m.relationshipId):null},m=>m!==null):null}function F(t,e,s$1=()=>{}){let u=true,m=0,f=()=>e?(m+=1,{origin:e.identity.role==="agent"?b$2.mutationAgent:b$2.mutationHuman,actorId:e.identity.actorId,operationId:`${e.identity.actorId}:${e.sessionId}:automation:${m}`,recordsHistory:false}):{},l=n=>(e?.flushPendingJournals(),n);return {revision:()=>t.packageRevision,currentPackage:()=>u?t.currentPackage():null,apply(n,a$1=b){if(!u)return {ok:false,reason:"disposed"};let r=n(i=>Ab(e?.identity.actorId,()=>W(t,i,a$1)));if(r===null)return {ok:false,reason:"unsupported-target"};let p=e?.gateOperations(r,a$1);if(p)return {ok:false,reason:p};let o=e?t.partFor(a$1)?.name:void 0,d=t.transact(a$1,i=>{for(let A of r)i.apply(A);o&&i.applyPackage(A=>a(A,o,r));},f());return d.ok?l({ok:true,changed:d.change!==null}):{ok:false,reason:d.detail?`${d.reason}: ${d.detail}`:d.reason}},applyLifecycle(n){if(!u)return {ok:false,reason:"disposed"};let a=e?.gateOperations([n],b);if(a)return {ok:false,reason:a};let r=Ab(e?.identity.actorId,()=>t.applyLifecycleOp(n));return r.ok?l({ok:true,changed:r.change!==null}):{ok:false,reason:r.detail?`${r.reason}: ${r.detail}`:r.reason}},applyCommentWrites(n,a){if(!u)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let r$1=e?.gateOperations([],a);if(r$1)return {ok:false,reason:r$1};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};if(p.store.graftPackage(()=>t.currentPackage()),n.every(i=>i.kind==="delete")){let i=n.find(k=>k.kind==="delete"),A=Ab(e?.identity.actorId,()=>s(t,n.flatMap(k=>k.kind==="delete"?[{commentId:k.commentId,...k.parentCommentId===void 0?{}:{parentCommentId:k.parentCommentId}}]:[]),a,i?.kind==="delete"?i.noteId:void 0));return A?l({ok:true,changed:A}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let o=n[0];if(o.kind==="create"||o.kind==="reply"){let i=Ab(e?.identity.actorId,()=>q(t,{anchor:o.anchor,author:o.author,text:o.text,...o.date===void 0?{}:{date:o.date},...o.kind==="reply"?{replyToCommentId:o.parentCommentId}:{}},a));return i.ok?l({ok:true,changed:true,..."commentId"in i?{commentId:i.commentId}:{}}):{ok:false,reason:i.reason}}if(o.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let d=Ab(e?.identity.actorId,()=>r(t,o.commentId,o.resolved));return d.ok?l({ok:true,changed:true}):{ok:false,reason:d.reason}},applyCustomNodeWrite(n,a){if(!u)return {ok:false,reason:"disposed"};let r=e?.gateOperations([],a);if(r)return {ok:false,reason:r};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};let o=Ab(e?.identity.actorId,()=>A(t,n,a));return o.ok?l({ok:true,changed:o.change!==null}):{ok:false,reason:o.detail?`${o.reason}: ${o.detail}`:o.reason}},save:()=>u?Tb(t.currentPackage()):null,subscribe:n=>t.subscribe(()=>n()),dispose(){s$1(),u=false;}}}export{N as SERVER_AUTOMATION_CAPABILITIES,U as createServerAutomationHost};
package/dist/binding.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkO4UULRAQ_cjs=require('./chunk-O4UULRAQ.cjs');require('./chunk-7UU5YFCD.cjs'),require('./chunk-7ADTI533.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkO4UULRAQ_cjs.e}});
1
+ 'use strict';var chunkM6Z3KFXM_cjs=require('./chunk-M6Z3KFXM.cjs');require('./chunk-GRDFEH5Q.cjs'),require('./chunk-76Y3Y45J.cjs'),require('./chunk-WPQMPHNR.cjs'),require('./chunk-GWV65NQW.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkM6Z3KFXM_cjs.e}});
@@ -1,18 +1,19 @@
1
1
  import { Node, Schema } from 'prosemirror-model';
2
- import { O as OoxmlProperty } from './tree-op-types-D1vNJ7XC.cjs';
3
- import { T as TreeDocxSession } from './tree-session-Df02ajqc.cjs';
4
- export { D as DocumentStyleEntry, M as MapResult, O as OpenTreeSessionResult, P as PROJECTION_ORIGIN, a as TreeApplyResult, b as TreeBindingRejection, c as TreeDocxSessionView, d as TreeSessionRejection, e as bodyParagraphs, f as docToTreeOps, o as openTreeSession, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-Df02ajqc.cjs';
5
- export { S as StoryScope, a as StoryTargetRejection } from './custom-node-writes-Dy3b20PS.cjs';
2
+ import { s as OoxmlProperty, f as OoxmlPackageRejection } from './tree-op-types-BPyXNxyL.cjs';
3
+ import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-BF2FVBOM.cjs';
4
+ export { D as DocumentStyleEntry, M as MapResult, b as TreeApplyOptions, c as TreeBindingRejection, d as bodyParagraphs, e as docToTreeOps, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-contract-BF2FVBOM.cjs';
5
+ import { ReviewModuleContribution } from './contracts/modules.cjs';
6
+ export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-BjZ3RWAS.cjs';
6
7
  import { EditorView } from 'prosemirror-view';
7
8
  import './contracts/types.cjs';
8
- import './ooxml-package-CdEy9ufK.cjs';
9
- import './image-resources-BiA-IXgo.cjs';
10
- import './hf-references-Dvk6De4Q.cjs';
11
- import './tree-store-B_sJBMIS.cjs';
12
- import './review-items-B8tffIXj.cjs';
13
- import './contracts/modules.cjs';
14
- import './revision-projection-Cc4wz30g.cjs';
15
- import './note-nodes-DL-Au22P.cjs';
9
+ import './custom-node-writes-CwkYRw3V.cjs';
10
+ import './tree-store-DfZi7FqY.cjs';
11
+ import './document-properties-D6Ahr8D6.cjs';
12
+ import './review-items-BdeLNRi2.cjs';
13
+ import './collaboration/replication.cjs';
14
+ import './collaboration.cjs';
15
+ import './failure-BnGjoXf0.cjs';
16
+ import './revision-projection-C2S8PSQm.cjs';
16
17
 
17
18
  /** Attributes carried by a projected paragraph. */
18
19
  interface ParagraphAttrs {
@@ -39,6 +40,70 @@ declare const treeSchema: Schema<'doc' | 'paragraph' | 'text' | 'tab' | 'hardBre
39
40
  /** The accepted run properties carried by a text node, or an empty list. */
40
41
  declare function runPropsOf(node: Node): readonly OoxmlProperty[];
41
42
 
43
+ /**
44
+ * Binding-only session methods that exchange ProseMirror projections.
45
+ *
46
+ * Editor surfaces expose {@link TreeDocxSessionView}. Only the binding lane sees this extension.
47
+ */
48
+ interface TreeDocxSession extends TreeDocxSessionView {
49
+ /** Project the current BODY revision into a ProseMirror doc. */
50
+ projectDoc(): Node;
51
+ /** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
52
+ reconcile(previousDoc: Node): Node;
53
+ /**
54
+ * Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
55
+ *
56
+ * A host needs this to decide whether the view must be re-projected at all. After a pure
57
+ * text edit, the view already holds what the model holds. Re-projecting wastes work and
58
+ * races the next keystroke.
59
+ */
60
+ lastCommitWasStructural(): boolean;
61
+ /** Map an edited BODY doc to tree ops and commit them as one transaction. */
62
+ applyPmDoc(doc: Node): TreeApplyResult;
63
+ }
64
+
65
+ /**
66
+ * Why bytes could not be opened: any bounded-reader rejection, plus the package that parsed but
67
+ * carried no main document tree.
68
+ */
69
+ type TreeSessionRejection = OoxmlPackageRejection | 'no-main-document-tree';
70
+ /**
71
+ * An open session, or a typed refusal.
72
+ *
73
+ * A result rather than a throw: every failure here is a property of the FILE, and a host needs to
74
+ * tell "this is not a package" from "this package is malicious" from "this document has no body".
75
+ */
76
+ type OpenTreeSessionResult = {
77
+ readonly ok: true;
78
+ readonly session: TreeDocxSession;
79
+ } | {
80
+ readonly ok: false;
81
+ readonly reason: TreeSessionRejection;
82
+ readonly detail?: string;
83
+ };
84
+ interface OpenTreeSessionOptions {
85
+ /**
86
+ * The review module's derivation hooks, contributed through the editor's
87
+ * `EditorModule` seam. Absent — the free engine — the session's
88
+ * `reviewItems()` reports the typed empty queue; parse, preservation, and
89
+ * `hasReviewContent` are unaffected.
90
+ */
91
+ readonly reviewModel?: ReviewModuleContribution;
92
+ }
93
+ /**
94
+ * Open DOCX bytes into a tree-backed session.
95
+ *
96
+ * Returns a typed rejection rather than throwing: every failure here is a property of the FILE,
97
+ * and a host needs to tell "this is not a package" from "this package is malicious" from "this
98
+ * document has no body".
99
+ *
100
+ * The read is BOUNDED — decompression ratio, part count, XML depth and element counts are all
101
+ * capped — because the bytes are untrusted by definition.
102
+ */
103
+ declare function openTreeSession(bytes: Uint8Array, options?: OpenTreeSessionOptions): OpenTreeSessionResult;
104
+ /** The origin a host should use when committing a reconciliation rather than a user edit. */
105
+ declare const PROJECTION_ORIGIN: "dev.docx-editor.core.origin.projection";
106
+
42
107
  /** How a tree surface is mounted. */
43
108
  interface TreeSurfaceOptions {
44
109
  /** Called after every commit or refusal, so a host can show revision and rejection state. */
@@ -85,4 +150,4 @@ interface TreeSurface {
85
150
  */
86
151
  declare function mountTreeSurface(mount: HTMLElement, session: TreeDocxSession, options?: TreeSurfaceOptions): TreeSurface;
87
152
 
88
- export { type ParagraphAttrs, TreeDocxSession, type TreeSurface, type TreeSurfaceOptions, type TreeSurfaceState, mountTreeSurface, runPropsOf, treeSchema };
153
+ export { type OpenTreeSessionResult, PROJECTION_ORIGIN, type ParagraphAttrs, TreeApplyResult, type TreeDocxSession, TreeDocxSessionView, type TreeSessionRejection, type TreeSurface, type TreeSurfaceOptions, type TreeSurfaceState, mountTreeSurface, openTreeSession, runPropsOf, treeSchema };
package/dist/binding.d.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  import { Node, Schema } from 'prosemirror-model';
2
- import { O as OoxmlProperty } from './tree-op-types-CnRb7AYo.js';
3
- import { T as TreeDocxSession } from './tree-session-ZuBFOhIh.js';
4
- export { D as DocumentStyleEntry, M as MapResult, O as OpenTreeSessionResult, P as PROJECTION_ORIGIN, a as TreeApplyResult, b as TreeBindingRejection, c as TreeDocxSessionView, d as TreeSessionRejection, e as bodyParagraphs, f as docToTreeOps, o as openTreeSession, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-ZuBFOhIh.js';
5
- export { S as StoryScope, a as StoryTargetRejection } from './custom-node-writes-D6SGwebL.js';
2
+ import { s as OoxmlProperty, f as OoxmlPackageRejection } from './tree-op-types-DnzAOnc9.js';
3
+ import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-DhdsFT_z.js';
4
+ export { D as DocumentStyleEntry, M as MapResult, b as TreeApplyOptions, c as TreeBindingRejection, d as bodyParagraphs, e as docToTreeOps, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-contract-DhdsFT_z.js';
5
+ import { ReviewModuleContribution } from './contracts/modules.js';
6
+ export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-CDER0G3B.js';
6
7
  import { EditorView } from 'prosemirror-view';
7
8
  import './contracts/types.js';
8
- import './ooxml-package-CdEy9ufK.js';
9
- import './image-resources-BgA9EQxY.js';
10
- import './hf-references-z5Y4N1ab.js';
11
- import './tree-store-DgETo6Mf.js';
12
- import './review-items-bdGxFWNA.js';
13
- import './contracts/modules.js';
14
- import './revision-projection-CILpvv4M.js';
15
- import './note-nodes-BNCANoGN.js';
9
+ import './custom-node-writes-JfTn-Sy6.js';
10
+ import './tree-store-CNZ3O83s.js';
11
+ import './document-properties-D6Ahr8D6.js';
12
+ import './review-items-CkYyXhXM.js';
13
+ import './collaboration/replication.js';
14
+ import './collaboration.js';
15
+ import './failure-BnGjoXf0.js';
16
+ import './revision-projection-Ae2CWa8E.js';
16
17
 
17
18
  /** Attributes carried by a projected paragraph. */
18
19
  interface ParagraphAttrs {
@@ -39,6 +40,70 @@ declare const treeSchema: Schema<'doc' | 'paragraph' | 'text' | 'tab' | 'hardBre
39
40
  /** The accepted run properties carried by a text node, or an empty list. */
40
41
  declare function runPropsOf(node: Node): readonly OoxmlProperty[];
41
42
 
43
+ /**
44
+ * Binding-only session methods that exchange ProseMirror projections.
45
+ *
46
+ * Editor surfaces expose {@link TreeDocxSessionView}. Only the binding lane sees this extension.
47
+ */
48
+ interface TreeDocxSession extends TreeDocxSessionView {
49
+ /** Project the current BODY revision into a ProseMirror doc. */
50
+ projectDoc(): Node;
51
+ /** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
52
+ reconcile(previousDoc: Node): Node;
53
+ /**
54
+ * Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
55
+ *
56
+ * A host needs this to decide whether the view must be re-projected at all. After a pure
57
+ * text edit, the view already holds what the model holds. Re-projecting wastes work and
58
+ * races the next keystroke.
59
+ */
60
+ lastCommitWasStructural(): boolean;
61
+ /** Map an edited BODY doc to tree ops and commit them as one transaction. */
62
+ applyPmDoc(doc: Node): TreeApplyResult;
63
+ }
64
+
65
+ /**
66
+ * Why bytes could not be opened: any bounded-reader rejection, plus the package that parsed but
67
+ * carried no main document tree.
68
+ */
69
+ type TreeSessionRejection = OoxmlPackageRejection | 'no-main-document-tree';
70
+ /**
71
+ * An open session, or a typed refusal.
72
+ *
73
+ * A result rather than a throw: every failure here is a property of the FILE, and a host needs to
74
+ * tell "this is not a package" from "this package is malicious" from "this document has no body".
75
+ */
76
+ type OpenTreeSessionResult = {
77
+ readonly ok: true;
78
+ readonly session: TreeDocxSession;
79
+ } | {
80
+ readonly ok: false;
81
+ readonly reason: TreeSessionRejection;
82
+ readonly detail?: string;
83
+ };
84
+ interface OpenTreeSessionOptions {
85
+ /**
86
+ * The review module's derivation hooks, contributed through the editor's
87
+ * `EditorModule` seam. Absent — the free engine — the session's
88
+ * `reviewItems()` reports the typed empty queue; parse, preservation, and
89
+ * `hasReviewContent` are unaffected.
90
+ */
91
+ readonly reviewModel?: ReviewModuleContribution;
92
+ }
93
+ /**
94
+ * Open DOCX bytes into a tree-backed session.
95
+ *
96
+ * Returns a typed rejection rather than throwing: every failure here is a property of the FILE,
97
+ * and a host needs to tell "this is not a package" from "this package is malicious" from "this
98
+ * document has no body".
99
+ *
100
+ * The read is BOUNDED — decompression ratio, part count, XML depth and element counts are all
101
+ * capped — because the bytes are untrusted by definition.
102
+ */
103
+ declare function openTreeSession(bytes: Uint8Array, options?: OpenTreeSessionOptions): OpenTreeSessionResult;
104
+ /** The origin a host should use when committing a reconciliation rather than a user edit. */
105
+ declare const PROJECTION_ORIGIN: "dev.docx-editor.core.origin.projection";
106
+
42
107
  /** How a tree surface is mounted. */
43
108
  interface TreeSurfaceOptions {
44
109
  /** Called after every commit or refusal, so a host can show revision and rejection state. */
@@ -85,4 +150,4 @@ interface TreeSurface {
85
150
  */
86
151
  declare function mountTreeSurface(mount: HTMLElement, session: TreeDocxSession, options?: TreeSurfaceOptions): TreeSurface;
87
152
 
88
- export { type ParagraphAttrs, TreeDocxSession, type TreeSurface, type TreeSurfaceOptions, type TreeSurfaceState, mountTreeSurface, runPropsOf, treeSchema };
153
+ export { type OpenTreeSessionResult, PROJECTION_ORIGIN, type ParagraphAttrs, TreeApplyResult, type TreeDocxSession, TreeDocxSessionView, type TreeSessionRejection, type TreeSurface, type TreeSurfaceOptions, type TreeSurfaceState, mountTreeSurface, openTreeSession, runPropsOf, treeSchema };
package/dist/binding.js CHANGED
@@ -1 +1 @@
1
- export{k as PROJECTION_ORIGIN,c as bodyParagraphs,f as docToTreeOps,l as mountTreeSurface,j as openTreeSession,g as partHasNode,h as reconcileDoc,b as runPropsOf,a as treeSchema,e as treeToDoc}from'./chunk-VXYECPKA.js';import'./chunk-DIMEYVNS.js';import'./chunk-CKDAK3MV.js';
1
+ export{k as PROJECTION_ORIGIN,c as bodyParagraphs,f as docToTreeOps,l as mountTreeSurface,j as openTreeSession,g as partHasNode,h as reconcileDoc,b as runPropsOf,a as treeSchema,e as treeToDoc}from'./chunk-WZHIFNSU.js';import'./chunk-6HMSC7UV.js';import'./chunk-X7A5XART.js';import'./chunk-BP7ANXGA.js';import'./chunk-34BNQUD4.js';