@docx-editor.dev/core 2.25.0 → 2.27.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 (115) hide show
  1. package/README.md +9 -3
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +31 -16
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +8 -8
  7. package/dist/binding.js +1 -1
  8. package/dist/chunk-2GK7YQB2.cjs +2 -0
  9. package/dist/chunk-4KZ6L5YF.cjs +15 -0
  10. package/dist/chunk-55AT3MOU.cjs +25 -0
  11. package/dist/chunk-6ZQMII6V.js +1 -0
  12. package/dist/chunk-7IGCWG4H.js +2 -0
  13. package/dist/chunk-7MYITTAH.js +5 -0
  14. package/dist/chunk-AVKVRU7Z.cjs +5 -0
  15. package/dist/chunk-CWRBFNK5.cjs +5 -0
  16. package/dist/chunk-DGPA3TST.cjs +27 -0
  17. package/dist/{chunk-WVJRO4WY.js → chunk-DNXVNQEO.js} +1 -1
  18. package/dist/chunk-FQN4KSFL.cjs +7 -0
  19. package/dist/{chunk-MEF2AK5L.cjs → chunk-GVUOWHTO.cjs} +1 -1
  20. package/dist/chunk-GWQJ5774.js +5 -0
  21. package/dist/chunk-HAQ72KD7.js +1 -0
  22. package/dist/chunk-HO5XFO32.cjs +3 -0
  23. package/dist/chunk-IGR23DV2.js +1 -0
  24. package/dist/chunk-JSIX2EOH.js +3 -0
  25. package/dist/chunk-K246T47S.cjs +1 -0
  26. package/dist/chunk-KAXOGCGA.js +1 -0
  27. package/dist/chunk-LZLTN5A3.cjs +1 -0
  28. package/dist/chunk-NBCVVZOM.cjs +1 -0
  29. package/dist/{chunk-AJCCS53D.js → chunk-O5INAWZQ.js} +1 -1
  30. package/dist/chunk-OHAXVTWG.cjs +1 -0
  31. package/dist/chunk-S74GRBNE.js +7 -0
  32. package/dist/chunk-UBLUVNZR.js +27 -0
  33. package/dist/chunk-UMRSBLO7.js +15 -0
  34. package/dist/chunk-VIPMGGUT.js +25 -0
  35. package/dist/chunk-WG4KMSX2.cjs +2 -0
  36. package/dist/chunk-WRLKVNNR.cjs +1 -0
  37. package/dist/chunk-ZU7IVN6G.js +2 -0
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +14 -5
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/collaboration.d.ts +3 -3
  42. package/dist/contracts/document.d.ts +2 -2
  43. package/dist/contracts/editor.d.ts +8 -8
  44. package/dist/contracts/modules.cjs +1 -1
  45. package/dist/contracts/modules.d.ts +20 -31
  46. package/dist/contracts/modules.js +1 -1
  47. package/dist/contracts/types.d.ts +1 -1
  48. package/dist/{custom-node-writes-Cy9imOjA.d.ts → custom-node-writes-Vzpq9I8_.d.ts} +2 -2
  49. package/dist/{document-protection-Bp19Ad4I.d.ts → document-protection-9zpIHWTE.d.ts} +1 -1
  50. package/dist/{editor-DkfCCTxA.d.ts → editor-B3OBYNrF.d.ts} +29 -34
  51. package/dist/editor.cjs +1 -1
  52. package/dist/editor.css +14 -2
  53. package/dist/editor.d.ts +28 -27
  54. package/dist/editor.js +1 -1
  55. package/dist/export.cjs +2 -2
  56. package/dist/export.d.ts +26 -14
  57. package/dist/export.js +2 -2
  58. package/dist/{font-resolver-C295obND.d.ts → font-resolver-DN0xNOf_.d.ts} +5 -3
  59. package/dist/{headless-document-view-R9bzzepb.d.ts → headless-document-view-ICYqNkQ1.d.ts} +2 -2
  60. package/dist/{image-resources-DfagDguq.d.ts → image-resources-BDFxcu7W.d.ts} +1 -1
  61. package/dist/{index-3KAxeSic.d.ts → index-CkQVRJtJ.d.ts} +53 -21
  62. package/dist/index.cjs +1 -1
  63. package/dist/index.d.ts +18 -17
  64. package/dist/index.js +1 -1
  65. package/dist/{layout-shaping-C889tgmj.d.ts → layout-shaping-BvZD_VKP.d.ts} +1 -1
  66. package/dist/layout.cjs +1 -1
  67. package/dist/layout.d.ts +104 -202
  68. package/dist/layout.js +1 -1
  69. package/dist/{note-properties-CmfvOJsi.d.ts → note-properties-CkAk7g-n.d.ts} +1 -1
  70. package/dist/{omml-equation-CZ6IG2ja.d.ts → omml-equation-DuczgG5o.d.ts} +1 -1
  71. package/dist/output.cjs +1 -1
  72. package/dist/output.d.ts +8 -7
  73. package/dist/output.js +1 -1
  74. package/dist/{protocol-BhmenALD.d.ts → protocol-aKYr8r3u.d.ts} +34 -6
  75. package/dist/{review-paragraph-order-BwhRT264.d.ts → review-paragraph-order-Ddj5d6rp.d.ts} +6 -2
  76. package/dist/{revision-projection-DfWxdBqA.d.ts → revision-projection-CSNFudZY.d.ts} +74 -3
  77. package/dist/{semantic-cell-selection-CC3NwCtx.d.ts → semantic-cell-selection-DoqYCz_F.d.ts} +25 -7
  78. package/dist/{semantic-interaction-BHlV61hK.d.ts → semantic-interaction-G0bjmmmk.d.ts} +1 -1
  79. package/dist/{semantic-paint-DfWIWUs6.d.ts → semantic-paint-CsMzF8-O.d.ts} +57 -5
  80. package/dist/semantic-record-queries-1du6lQqS.d.ts +177 -0
  81. package/dist/{semantic-records-DrExlBy-.d.ts → semantic-records-B9OolWGN.d.ts} +91 -74
  82. package/dist/store.cjs +1 -1
  83. package/dist/store.d.ts +74 -17
  84. package/dist/store.js +1 -1
  85. package/dist/{tree-package-fragment-YPyYC1aD.d.ts → tree-package-fragment-DYZIk1rY.d.ts} +3 -3
  86. package/dist/{tree-session-contract-AeY2v0x9.d.ts → tree-session-contract-DQVJOOkv.d.ts} +5 -5
  87. package/dist/{types-barrel-BO73JqHG.d.ts → types-barrel-BFKR8Pzp.d.ts} +134 -110
  88. package/package.json +4 -4
  89. package/dist/chunk-3RMHRNDA.cjs +0 -1
  90. package/dist/chunk-42N7OV3G.cjs +0 -1
  91. package/dist/chunk-47ZJEEBT.js +0 -2
  92. package/dist/chunk-4B3SXBV6.js +0 -4
  93. package/dist/chunk-5MWFZ7F4.cjs +0 -11
  94. package/dist/chunk-AS2OC6J4.cjs +0 -26
  95. package/dist/chunk-B7SYEMZ7.cjs +0 -1
  96. package/dist/chunk-BME2KUNL.cjs +0 -1
  97. package/dist/chunk-CDGVVEUK.js +0 -26
  98. package/dist/chunk-E4RAPI5J.cjs +0 -2
  99. package/dist/chunk-FZJTQPH4.js +0 -2
  100. package/dist/chunk-H7XMRUAO.cjs +0 -5
  101. package/dist/chunk-ILUE2SI5.js +0 -1
  102. package/dist/chunk-IZT3C23R.js +0 -1
  103. package/dist/chunk-KJLPVGSX.cjs +0 -4
  104. package/dist/chunk-LF5LPZOP.cjs +0 -18
  105. package/dist/chunk-N5WE5O5Q.js +0 -1
  106. package/dist/chunk-OVDW4XQD.cjs +0 -2
  107. package/dist/chunk-SNN53UPD.js +0 -1
  108. package/dist/chunk-TKQH7BNE.cjs +0 -1
  109. package/dist/chunk-V7LBEUVW.js +0 -5
  110. package/dist/chunk-VE7YBFQD.js +0 -5
  111. package/dist/chunk-VOVDX7GW.js +0 -18
  112. package/dist/chunk-VQ33XGNP.cjs +0 -5
  113. package/dist/chunk-XUJINXW6.js +0 -1
  114. package/dist/chunk-Y3TPAITU.cjs +0 -1
  115. package/dist/chunk-Z65JJLLF.js +0 -11
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  <p align="center">
2
2
  <a href="https://www.docx-editor.dev/">
3
- <img src="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/header.png" alt="DOCX Editor — .docx in, .docx out. Open source, client-side." width="500" />
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/readme-logo-dark.svg" />
5
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/readme-logo-light.svg" />
6
+ <img src="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/readme-logo-light.svg" alt="DOCX Editor by EigenPal" width="320" height="90" />
7
+ </picture>
4
8
  </a>
5
9
  </p>
6
10
 
@@ -35,10 +39,12 @@ Node.js requires `^20.16.0 || >=22.3.0`.
35
39
  Import editor creation, font helpers, and contract types from the package root:
36
40
 
37
41
  ```ts
38
- import { createDocxEditor, loadFonts, WORD_DEFAULT_FONT } from '@docx-editor.dev/core';
42
+ import { createDocxEditor, loadFonts, DEFAULT_FONT } from '@docx-editor.dev/core';
39
43
  import type { Editor, EditorSnapshot } from '@docx-editor.dev/core';
40
44
  ```
41
45
 
46
+ `DEFAULT_FONT` provides the default font configuration: Calibri at 11 points. `WORD_DEFAULT_FONT` is its deprecated alias. Document formatting and document-default rules determine the text size used for layout. Missing defaults and explicitly empty defaults can produce different results.
47
+
42
48
  The root exports editor creation, contracts, font helpers, control definitions, and document types. Use subpaths to access storage, layout, and rendering.
43
49
 
44
50
  | Subpath | Exports |
@@ -112,7 +118,7 @@ Anything you render from document data (a font name, a hyperlink target, a comme
112
118
 
113
119
  - [Core overview](https://www.docx-editor.dev/docs/2.x/core)
114
120
  - [Architecture](https://www.docx-editor.dev/docs/2.x/core/architecture)
115
- - [Word fidelity](https://www.docx-editor.dev/docs/2.x/word-fidelity)
121
+ - [Feature support and fidelity](https://www.docx-editor.dev/docs/2.x/word-fidelity)
116
122
 
117
123
  ## License
118
124
 
@@ -1 +1 @@
1
- 'use strict';var chunkE4RAPI5J_cjs=require('./chunk-E4RAPI5J.cjs');require('./chunk-Y3TPAITU.cjs'),require('./chunk-LF5LPZOP.cjs'),require('./chunk-3RMHRNDA.cjs'),require('./chunk-BME2KUNL.cjs');var chunkH7XMRUAO_cjs=require('./chunk-H7XMRUAO.cjs'),chunkMEF2AK5L_cjs=require('./chunk-MEF2AK5L.cjs'),chunk5MWFZ7F4_cjs=require('./chunk-5MWFZ7F4.cjs');var j=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),D=Object.freeze({kind:"body"});function Y(o,t={}){let m=chunk5MWFZ7F4_cjs.Vd(o,t.limits??{});if(!m.ok)return {ok:false,reason:m.reason,...m.limit===void 0?{}:{limit:m.limit},...m.detail?{detail:m.detail}:{}};let p=m.package.parts.get(m.package.mainDocumentPart);if(!p)return {ok:false,reason:"no-main-document-part",detail:m.package.mainDocumentPart};let u=new chunkH7XMRUAO_cjs.Q(m.package,chunkH7XMRUAO_cjs.Ia(m.package,chunk5MWFZ7F4_cjs.eb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(chunkH7XMRUAO_cjs.La(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=chunkE4RAPI5J_cjs.g(u.currentPackage()).story(f);return s?chunkE4RAPI5J_cjs.d(i,s.part,a,d):null};}let r=chunkE4RAPI5J_cjs.m({port:n,capabilities:j});return y&&(c=y.attach(chunkMEF2AK5L_cjs.b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?chunk5MWFZ7F4_cjs.Ea(o,()=>{let u=chunk5MWFZ7F4_cjs.Uf(o.currentPackage(),t,p.name);return u?(o.replacePackageShell(u.pkg),u.relationshipId):null},u=>u!==null):null}function K(o,t,m=()=>{}){let p=true,u=0,y=()=>t?(u+=1,{origin:t.identity.role==="agent"?chunk5MWFZ7F4_cjs.b.mutationAgent:chunk5MWFZ7F4_cjs.b.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>chunk5MWFZ7F4_cjs.xb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>chunkMEF2AK5L_cjs.a(s,f,l));},y());return a.ok?c({ok:true,changed:a.change!==null}):{ok:false,reason:a.detail?`${a.reason}: ${a.detail}`:a.reason}},applyLifecycle(n){if(!p)return {ok:false,reason:"disposed"};let r=t?.gateOperations([n],D);if(r)return {ok:false,reason:r};let i=chunk5MWFZ7F4_cjs.xb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=chunk5MWFZ7F4_cjs.xb(t?.identity.actorId,()=>chunkH7XMRUAO_cjs.ba(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=chunk5MWFZ7F4_cjs.xb(t?.identity.actorId,()=>chunkH7XMRUAO_cjs.$(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=chunk5MWFZ7F4_cjs.xb(t?.identity.actorId,()=>chunkH7XMRUAO_cjs.aa(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=chunk5MWFZ7F4_cjs.xb(t?.identity.actorId,()=>chunkH7XMRUAO_cjs.ja(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?chunk5MWFZ7F4_cjs.Wd(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.i}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.h}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.j}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.f}});Object.defineProperty(exports,"createAutomationPaginationProvider",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.e}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.l}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.k}});Object.defineProperty(exports,"paginationSnapshotOf",{enumerable:true,get:function(){return chunkE4RAPI5J_cjs.c}});exports.SERVER_AUTOMATION_CAPABILITIES=j;exports.createServerAutomationHost=Y;
1
+ 'use strict';var chunkFQN4KSFL_cjs=require('./chunk-FQN4KSFL.cjs');require('./chunk-WRLKVNNR.cjs'),require('./chunk-55AT3MOU.cjs'),require('./chunk-2GK7YQB2.cjs'),require('./chunk-K246T47S.cjs');var chunkAVKVRU7Z_cjs=require('./chunk-AVKVRU7Z.cjs'),chunkGVUOWHTO_cjs=require('./chunk-GVUOWHTO.cjs'),chunk4KZ6L5YF_cjs=require('./chunk-4KZ6L5YF.cjs');var j=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),D=Object.freeze({kind:"body"});function Y(o,t={}){let m=chunk4KZ6L5YF_cjs.ne(o,t.limits??{});if(!m.ok)return {ok:false,reason:m.reason,...m.limit===void 0?{}:{limit:m.limit},...m.detail?{detail:m.detail}:{}};let p=m.package.parts.get(m.package.mainDocumentPart);if(!p)return {ok:false,reason:"no-main-document-part",detail:m.package.mainDocumentPart};let u=new chunkAVKVRU7Z_cjs.X(m.package,chunkAVKVRU7Z_cjs.Xa(m.package,chunk4KZ6L5YF_cjs.qb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(chunkAVKVRU7Z_cjs.bb(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=chunkFQN4KSFL_cjs.g(u.currentPackage()).story(f);return s?chunkFQN4KSFL_cjs.d(i,s.part,a,d):null};}let r=chunkFQN4KSFL_cjs.m({port:n,capabilities:j});return y&&(c=y.attach(chunkGVUOWHTO_cjs.b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?chunk4KZ6L5YF_cjs.Fa(o,()=>{let u=chunk4KZ6L5YF_cjs.og(o.currentPackage(),t,p.name);return u?(o.replacePackageShell(u.pkg),u.relationshipId):null},u=>u!==null):null}function K(o,t,m=()=>{}){let p=true,u=0,y=()=>t?(u+=1,{origin:t.identity.role==="agent"?chunk4KZ6L5YF_cjs.b.mutationAgent:chunk4KZ6L5YF_cjs.b.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>chunk4KZ6L5YF_cjs.tb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>chunkGVUOWHTO_cjs.a(s,f,l));},y());return a.ok?c({ok:true,changed:a.change!==null}):{ok:false,reason:a.detail?`${a.reason}: ${a.detail}`:a.reason}},applyLifecycle(n){if(!p)return {ok:false,reason:"disposed"};let r=t?.gateOperations([n],D);if(r)return {ok:false,reason:r};let i=chunk4KZ6L5YF_cjs.tb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=chunk4KZ6L5YF_cjs.tb(t?.identity.actorId,()=>chunkAVKVRU7Z_cjs.ia(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=chunk4KZ6L5YF_cjs.tb(t?.identity.actorId,()=>chunkAVKVRU7Z_cjs.ga(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=chunk4KZ6L5YF_cjs.tb(t?.identity.actorId,()=>chunkAVKVRU7Z_cjs.ha(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=chunk4KZ6L5YF_cjs.tb(t?.identity.actorId,()=>chunkAVKVRU7Z_cjs.qa(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?chunk4KZ6L5YF_cjs.oe(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.i}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.h}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.j}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.f}});Object.defineProperty(exports,"createAutomationPaginationProvider",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.e}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.l}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.k}});Object.defineProperty(exports,"paginationSnapshotOf",{enumerable:true,get:function(){return chunkFQN4KSFL_cjs.c}});exports.SERVER_AUTOMATION_CAPABILITIES=j;exports.createServerAutomationHost=Y;
@@ -1,14 +1,14 @@
1
- import { A as AutomationOperation, a as AutomationCapabilities, b as AutomationHost } from './protocol-BhmenALD.js';
2
- export { c as AutomationAlignment, d as AutomationBatchRequest, e as AutomationBatchResponse, f as AutomationChangeEvent, g as AutomationContentControlLock, h as AutomationContentControlRangeLocation, i as AutomationContentControlScope, j as AutomationContentControlSubtype, k as AutomationContentControlValue, l as AutomationError, m as AutomationErrorCode, n as AutomationFontRead, o as AutomationFontWrite, p as AutomationHandle, q as AutomationHandleRef, r as AutomationObjectKind, s as AutomationOperationKind, t as AutomationOperationResult, u as AutomationPageOrientation, v as AutomationPageSetupRead, w as AutomationPageSetupWrite, x as AutomationParagraphFormatRead, y as AutomationParagraphFormatWrite, z as AutomationParagraphRef, B as AutomationPoint, C as AutomationSaveResult, D as AutomationSearchOptions, E as AutomationSelectionMode, F as AutomationSpan, G as AutomationSpanRef, H as AutomationTextProjection, I as AutomationUnsubscribe, J as AutomationValue } from './protocol-BhmenALD.js';
3
- import { e as HeaderFooterVariant, N as NoteKind } from './tree-package-fragment-YPyYC1aD.js';
4
- import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-DrExlBy-.js';
5
- import { H as HeadlessDocumentView } from './headless-document-view-R9bzzepb.js';
6
- import { a1 as OoxmlPackageLimits, Y as OoxmlPackageRejection } from './types-barrel-BO73JqHG.js';
7
- export { a2 as RevisionBatchEntry, a3 as RevisionBatchResult, a4 as RevisionBatchSkipReason } from './types-barrel-BO73JqHG.js';
1
+ import { A as AutomationOperation, a as AutomationCapabilities, b as AutomationHost } from './protocol-aKYr8r3u.js';
2
+ export { c as AutomationAlignment, d as AutomationBatchRequest, e as AutomationBatchResponse, f as AutomationChangeEvent, g as AutomationContentControlLock, h as AutomationContentControlRangeLocation, i as AutomationContentControlScope, j as AutomationContentControlSubtype, k as AutomationContentControlValue, l as AutomationError, m as AutomationErrorCode, n as AutomationFontRead, o as AutomationFontWrite, p as AutomationHandle, q as AutomationHandleRef, r as AutomationObjectKind, s as AutomationOperationKind, t as AutomationOperationResult, u as AutomationPageOrientation, v as AutomationPageSetupRead, w as AutomationPageSetupWrite, x as AutomationParagraphFormatRead, y as AutomationParagraphFormatWrite, z as AutomationParagraphRef, B as AutomationPoint, C as AutomationSaveResult, D as AutomationSearchOptions, E as AutomationSelectionMode, F as AutomationSpan, G as AutomationSpanRef, H as AutomationTextProjection, I as AutomationUnsubscribe, J as AutomationValue } from './protocol-aKYr8r3u.js';
3
+ import { c as HeaderFooterVariant, N as NoteKind } from './tree-package-fragment-DYZIk1rY.js';
4
+ import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-B9OolWGN.js';
5
+ import { H as HeadlessDocumentView } from './headless-document-view-ICYqNkQ1.js';
6
+ import { a1 as OoxmlPackageLimits, Y as OoxmlPackageRejection } from './types-barrel-BFKR8Pzp.js';
7
+ export { a2 as RevisionBatchEntry, a3 as RevisionBatchResult, a4 as RevisionBatchSkipReason } from './types-barrel-BFKR8Pzp.js';
8
8
  import { CollaborationModuleContribution } from './collaboration.js';
9
- import './image-resources-DfagDguq.js';
10
- import './revision-projection-DfWxdBqA.js';
11
- import './omml-equation-CZ6IG2ja.js';
9
+ import './image-resources-BDFxcu7W.js';
10
+ import './revision-projection-CSNFudZY.js';
11
+ import './omml-equation-DuczgG5o.js';
12
12
  import './editor-scope-OHPwVQ5l.js';
13
13
  import './collaboration/replication.js';
14
14
  import './failure-BIPVQbRm.js';
@@ -23,21 +23,32 @@ declare const HEADER_FOOTER_VARIANTS: readonly HeaderFooterVariant[];
23
23
  * that is how a caller thinks about it and because a section inheriting its predecessor's header
24
24
  * has no relationship of its own to name.
25
25
  */
26
- type AutomationStoryId = {
26
+ type AutomationStoryId = AutomationShapeOwnerStory | {
27
+ readonly kind: 'note';
28
+ readonly noteKind: NoteKind;
29
+ readonly noteId: number;
30
+ }
31
+ /**
32
+ * A text box: the `w:txbxContent` of the floating shape whose `wp:docPr/@id` is `shapeId`,
33
+ * anchored in `owner`. Its paragraphs live in the owner's part and commit through its scope.
34
+ */
35
+ | {
36
+ readonly kind: 'textbox';
37
+ readonly owner: AutomationShapeOwnerStory;
38
+ readonly shapeId: number;
39
+ };
40
+ /** A story that can anchor shapes: the main body, or one header/footer variant of a section. */
41
+ type AutomationShapeOwnerStory = {
27
42
  readonly kind: 'body';
28
43
  } | {
29
44
  readonly kind: 'header' | 'footer';
30
45
  /** Position of the section in the document, from zero. */
31
46
  readonly sectionIndex: number;
32
47
  readonly variant: HeaderFooterVariant;
33
- } | {
34
- readonly kind: 'note';
35
- readonly noteKind: NoteKind;
36
- readonly noteId: number;
37
48
  };
38
49
 
39
50
  /** Operations that read. They never open a transaction. */
40
- declare const AUTOMATION_QUERY_OPERATIONS: readonly ["getTables", "getTable", "getTableRows", "getTableCells", "getTableCell", "getTableCellProperties", "getTableCellBody", "getFields", "getField", "getInlinePictures", "getInlinePicture", "getChangeTrackingMode", "getDocument", "getDocumentProperty", "getBody", "getParagraphs", "getRange", "getSpanParagraphs", "getText", "getSpanText", "getParagraphId", "search", "getFont", "getParagraphFormat", "getStyle", "getSections", "getPageSetup", "getFurniture", "getNotes", "getNoteBody", "getNoteText", "getNoteKind", "getLists", "getListId", "getListById", "getListParagraphs", "getParagraphList", "getListLevel", "getHyperlink", "getBookmarks", "getBookmarkName", "getBookmarkRange", "getComments", "getCommentReplies", "getCommentId", "getCommentAuthor", "getCommentDate", "getCommentText", "getCommentRange", "getCommentResolved", "getRevisions", "getRevisionType", "getRevisionAuthor", "getRevisionDate", "getRevisionRange", "getContentControls", "getContentControlById", "getContentControlsByTag", "getContentControlsByTitle", "getContentControlTag", "getContentControlTitle", "getContentControlFileId", "getContentControlSubtype", "getContentControlLock", "getContentControlIsBound", "getContentControlPlaceholderShown", "getContentControlTemporary", "getContentControlText", "getContentControlParagraphs", "getContentControlRange"];
51
+ declare const AUTOMATION_QUERY_OPERATIONS: readonly ["getTables", "getTable", "getTableRows", "getTableCells", "getTableCell", "getTableCellProperties", "getTableCellBody", "getFields", "getField", "getInlinePictures", "getInlinePicture", "getShapes", "getShape", "getShapeBody", "getChangeTrackingMode", "getDocument", "getDocumentProperty", "getBody", "getParagraphs", "getRange", "getSpanParagraphs", "getText", "getSpanText", "getParagraphId", "search", "getFont", "getParagraphFormat", "getStyle", "getSections", "getPageSetup", "getFurniture", "getNotes", "getNoteBody", "getNoteText", "getNoteKind", "getLists", "getListId", "getListById", "getListParagraphs", "getParagraphList", "getListLevel", "getHyperlink", "getBookmarks", "getBookmarkName", "getBookmarkRange", "getComments", "getCommentReplies", "getCommentId", "getCommentAuthor", "getCommentDate", "getCommentText", "getCommentRange", "getCommentResolved", "getRevisions", "getRevisionType", "getRevisionAuthor", "getRevisionDate", "getRevisionRange", "getContentControls", "getContentControlById", "getContentControlsByTag", "getContentControlsByTitle", "getContentControlTag", "getContentControlTitle", "getContentControlFileId", "getContentControlSubtype", "getContentControlLock", "getContentControlIsBound", "getContentControlPlaceholderShown", "getContentControlTemporary", "getContentControlText", "getContentControlParagraphs", "getContentControlRange"];
41
52
  /** Operations that write. Every one of these goes through the single transaction path. */
42
53
  declare const AUTOMATION_COMMAND_OPERATIONS: readonly ["removeDocumentInformation", "setDocumentProperties", "insertTableRows", "insertTable", "updateTable", "updateTableCell", "setInlinePicture", "deleteInlinePicture", "insertField", "setFieldCode", "deleteField", "updateFieldResult", "insertInlinePicture", "insertBreak", "setChangeTrackingMode", "proposeInsertion", "proposeDeletion", "proposeReplacement", "insertText", "replaceSpan", "replaceStoryBlocks", "insertParagraph", "splitParagraph", "deleteParagraph", "selectSpan", "selectBookmark", "setFont", "setParagraphFormat", "setStyle", "setPageSetup", "deleteNote", "setListLevel", "startNewList", "attachToList", "detachFromList", "setListLevelFormat", "insertListParagraph", "setHyperlink", "insertComment", "setCommentResolved", "replyToComment", "deleteComment", "acceptRevision", "rejectRevision", "resolveRevisionBatch", "acceptAllRevisions", "rejectAllRevisions", "setContentControlValue", "setContentControlProperties", "deleteContentControl", "insertContentControlText", "insertContentControl", "insertCustomNode"];
43
54
  /**
@@ -48,6 +59,10 @@ declare const AUTOMATION_COMMAND_OPERATIONS: readonly ["removeDocumentInformatio
48
59
  * that as its own undo unit rather than as ops inside a story transaction. Two of them, or one
49
60
  * beside a story command, would be two commits: two revisions, and a moment where half the
50
61
  * caller's batch is published. Refused while planning instead.
62
+ *
63
+ * Some operations are solitary only in some forms: an `insertBreak` with `Line` is a text write
64
+ * and shares its batch, and some `updateTable` mutations travel alone. Classify one operation
65
+ * with {@link isSolitaryAutomationCommand}, not by membership here.
51
66
  */
52
67
  declare const AUTOMATION_SOLITARY_OPERATIONS: readonly ["removeDocumentInformation", "insertTableRows", "resolveRevisionBatch", "insertTable", "insertInlinePicture", "insertBreak", "startNewList", "deleteNote", "insertComment", "setCommentResolved", "replyToComment", "insertCustomNode"];
53
68
  /** Whether an operation must be the only one in its batch. */
@@ -1 +1 @@
1
- import {m,g,d}from'./chunk-47ZJEEBT.js';export{i as AUTOMATION_COMMAND_OPERATIONS,h as AUTOMATION_QUERY_OPERATIONS,j as AUTOMATION_SOLITARY_OPERATIONS,f as HEADER_FOOTER_VARIANTS,e as createAutomationPaginationProvider,l as isAutomationCommand,k as isSolitaryAutomationCommand,c as paginationSnapshotOf}from'./chunk-47ZJEEBT.js';import'./chunk-XUJINXW6.js';import'./chunk-VOVDX7GW.js';import'./chunk-N5WE5O5Q.js';import'./chunk-SNN53UPD.js';import {Q,Ia,La,ja,ba,$,aa}from'./chunk-VE7YBFQD.js';import {b,a}from'./chunk-WVJRO4WY.js';import {Vd,eb,Wd,xb,Ea,Uf,b as b$1}from'./chunk-Z65JJLLF.js';var j=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),D=Object.freeze({kind:"body"});function Y(o,t={}){let m$1=Vd(o,t.limits??{});if(!m$1.ok)return {ok:false,reason:m$1.reason,...m$1.limit===void 0?{}:{limit:m$1.limit},...m$1.detail?{detail:m$1.detail}:{}};let p=m$1.package.parts.get(m$1.package.mainDocumentPart);if(!p)return {ok:false,reason:"no-main-document-part",detail:m$1.package.mainDocumentPart};let u=new Q(m$1.package,Ia(m$1.package,eb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(La(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d$1)=>{if(u.packageRevision!==l)return null;let s=g(u.currentPackage()).story(f);return s?d(i,s.part,a,d$1):null};}let r=m({port:n,capabilities:j});return y&&(c=y.attach(b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?Ea(o,()=>{let u=Uf(o.currentPackage(),t,p.name);return u?(o.replacePackageShell(u.pkg),u.relationshipId):null},u=>u!==null):null}function K(o,t,m=()=>{}){let p=true,u=0,y=()=>t?(u+=1,{origin:t.identity.role==="agent"?b$1.mutationAgent:b$1.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>xb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a$1=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>a(s,f,l));},y());return a$1.ok?c({ok:true,changed:a$1.change!==null}):{ok:false,reason:a$1.detail?`${a$1.reason}: ${a$1.detail}`:a$1.reason}},applyLifecycle(n){if(!p)return {ok:false,reason:"disposed"};let r=t?.gateOperations([n],D);if(r)return {ok:false,reason:r};let i=xb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=xb(t?.identity.actorId,()=>ba(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=xb(t?.identity.actorId,()=>$(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=xb(t?.identity.actorId,()=>aa(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=xb(t?.identity.actorId,()=>ja(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?Wd(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}export{j as SERVER_AUTOMATION_CAPABILITIES,Y as createServerAutomationHost};
1
+ import {m,g,d}from'./chunk-S74GRBNE.js';export{i as AUTOMATION_COMMAND_OPERATIONS,h as AUTOMATION_QUERY_OPERATIONS,j as AUTOMATION_SOLITARY_OPERATIONS,f as HEADER_FOOTER_VARIANTS,e as createAutomationPaginationProvider,l as isAutomationCommand,k as isSolitaryAutomationCommand,c as paginationSnapshotOf}from'./chunk-S74GRBNE.js';import'./chunk-KAXOGCGA.js';import'./chunk-VIPMGGUT.js';import'./chunk-ZU7IVN6G.js';import'./chunk-6ZQMII6V.js';import {X,Xa,bb,qa,ia,ga,ha}from'./chunk-GWQJ5774.js';import {b,a}from'./chunk-DNXVNQEO.js';import {ne,qb,oe,tb,Fa,og,b as b$1}from'./chunk-UMRSBLO7.js';var j=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),D=Object.freeze({kind:"body"});function Y(o,t={}){let m$1=ne(o,t.limits??{});if(!m$1.ok)return {ok:false,reason:m$1.reason,...m$1.limit===void 0?{}:{limit:m$1.limit},...m$1.detail?{detail:m$1.detail}:{}};let p=m$1.package.parts.get(m$1.package.mainDocumentPart);if(!p)return {ok:false,reason:"no-main-document-part",detail:m$1.package.mainDocumentPart};let u=new X(m$1.package,Xa(m$1.package,qb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(bb(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d$1)=>{if(u.packageRevision!==l)return null;let s=g(u.currentPackage()).story(f);return s?d(i,s.part,a,d$1):null};}let r=m({port:n,capabilities:j});return y&&(c=y.attach(b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?Fa(o,()=>{let u=og(o.currentPackage(),t,p.name);return u?(o.replacePackageShell(u.pkg),u.relationshipId):null},u=>u!==null):null}function K(o,t,m=()=>{}){let p=true,u=0,y=()=>t?(u+=1,{origin:t.identity.role==="agent"?b$1.mutationAgent:b$1.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>tb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a$1=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>a(s,f,l));},y());return a$1.ok?c({ok:true,changed:a$1.change!==null}):{ok:false,reason:a$1.detail?`${a$1.reason}: ${a$1.detail}`:a$1.reason}},applyLifecycle(n){if(!p)return {ok:false,reason:"disposed"};let r=t?.gateOperations([n],D);if(r)return {ok:false,reason:r};let i=tb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=tb(t?.identity.actorId,()=>ia(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=tb(t?.identity.actorId,()=>ga(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=tb(t?.identity.actorId,()=>ha(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=tb(t?.identity.actorId,()=>qa(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?oe(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}export{j as SERVER_AUTOMATION_CAPABILITIES,Y as createServerAutomationHost};
package/dist/binding.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkVQ33XGNP_cjs=require('./chunk-VQ33XGNP.cjs');require('./chunk-42N7OV3G.cjs'),require('./chunk-3RMHRNDA.cjs'),require('./chunk-BME2KUNL.cjs'),require('./chunk-H7XMRUAO.cjs'),require('./chunk-MEF2AK5L.cjs'),require('./chunk-5MWFZ7F4.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkVQ33XGNP_cjs.e}});
1
+ 'use strict';var chunkCWRBFNK5_cjs=require('./chunk-CWRBFNK5.cjs');require('./chunk-LZLTN5A3.cjs'),require('./chunk-2GK7YQB2.cjs'),require('./chunk-K246T47S.cjs'),require('./chunk-AVKVRU7Z.cjs'),require('./chunk-GVUOWHTO.cjs'),require('./chunk-4KZ6L5YF.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkCWRBFNK5_cjs.e}});
package/dist/binding.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { Node, Schema } from 'prosemirror-model';
2
- import { X as OoxmlProperty, Y as OoxmlPackageRejection } from './types-barrel-BO73JqHG.js';
3
- import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-AeY2v0x9.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-AeY2v0x9.js';
2
+ import { X as OoxmlProperty, Y as OoxmlPackageRejection } from './types-barrel-BFKR8Pzp.js';
3
+ import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-DQVJOOkv.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-DQVJOOkv.js';
5
5
  import { ReviewModuleContribution } from './contracts/modules.js';
6
- export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-YPyYC1aD.js';
6
+ export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-DYZIk1rY.js';
7
7
  import { EditorView } from 'prosemirror-view';
8
8
  import './editor-scope-OHPwVQ5l.js';
9
- import './image-resources-DfagDguq.js';
10
- import './custom-node-writes-Cy9imOjA.js';
11
- import './headless-document-view-R9bzzepb.js';
9
+ import './image-resources-BDFxcu7W.js';
10
+ import './custom-node-writes-Vzpq9I8_.js';
11
+ import './headless-document-view-ICYqNkQ1.js';
12
12
  import './collaboration/replication.js';
13
- import './revision-projection-DfWxdBqA.js';
13
+ import './revision-projection-CSNFudZY.js';
14
14
  import './collaboration.js';
15
15
  import './failure-BIPVQbRm.js';
16
16
 
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-V7LBEUVW.js';import'./chunk-IZT3C23R.js';import'./chunk-N5WE5O5Q.js';import'./chunk-SNN53UPD.js';import'./chunk-VE7YBFQD.js';import'./chunk-WVJRO4WY.js';import'./chunk-Z65JJLLF.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-7MYITTAH.js';import'./chunk-HAQ72KD7.js';import'./chunk-ZU7IVN6G.js';import'./chunk-6ZQMII6V.js';import'./chunk-GWQJ5774.js';import'./chunk-DNXVNQEO.js';import'./chunk-UMRSBLO7.js';
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkK246T47S_cjs=require('./chunk-K246T47S.cjs'),chunkAVKVRU7Z_cjs=require('./chunk-AVKVRU7Z.cjs'),chunk4KZ6L5YF_cjs=require('./chunk-4KZ6L5YF.cjs');function z(n){let r=[],s=0;for(let t of n){let o=s+t.text.length;t.resultRuns?r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,resultRuns:t.resultRuns,...t.symbolOffsets?{symbolOffsets:t.symbolOffsets}:{},...t.symbolDisplays?{symbolDisplays:t.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}):t.floatingObject?r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,floatingObject:true,projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}):r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,...t.symbol?{symbol:true}:{},...t.symbolOffsets?{symbolOffsets:t.symbolOffsets}:{},...t.symbolDisplays?{symbolDisplays:t.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}),s=o;}return r}function G(n,r){return r<=n.rawStart?n.projectedStart:r>=n.rawEnd?n.projectedEnd:n.expansion?n.projectedStart:n.projectedStart+r-n.rawStart}function I(n,r){return n.expansion?n.rawStart:n.rawStart+r-n.projectedStart}function L(n,r){return n.expansion?n.rawEnd:n.rawStart+r-n.projectedStart}var K=new Set([chunk4KZ6L5YF_cjs.Ta,"\u2011"]),Q=/[\u001e\u001f\u2011]/,Y="\uFFFF";function W(n,r){if(!Q.test(n)&&!r?.size)return {text:n,at:null};let s="",t=[];for(let o=0;o<n.length;o+=1){let l=n[o];if(r?.has(o))s+=Y;else {if(l===chunk4KZ6L5YF_cjs.Ua)continue;s+=K.has(l)?"-":l;}t.push(o);}return {text:s,at:t}}function U(n){let r;for(let s of n){if(s.symbol){r??=new Set;for(let t=s.projectedStart;t<s.projectedEnd;t+=1)r.add(t);}for(let t of s.symbolOffsets??[])(r??=new Set).add(s.projectedStart+t);}return r}function O(n){let r=z(n),s="";for(let o of n)s+=o.text;let t=null;return {text:s,projectedOffset(o){let l=0;for(let i of r){if(o<=i.rawEnd)return G(i,o);l=i.projectedEnd;}return l},rawRange(o,l){if(o<0||o>=l||l>s.length)return null;let i=r.find(d=>o>=d.projectedStart&&o<d.projectedEnd),e=r.find(d=>l>d.projectedStart&&l<=d.projectedEnd);return !i||!e?null:{start:I(i,o),end:L(e,l)}},sliceRaw(o,l){if(o>=l)return "";let i="";for(let e of r){if(e.expansion){o<=e.rawStart&&l>=e.rawEnd&&(i+=e.text);continue}let d=Math.max(o,e.rawStart),a=Math.min(l,e.rawEnd);d<a&&(i+=e.text.slice(d-e.rawStart,a-e.rawStart));}return i},displaySlice(o,l){let i="";for(let e of r){if(e.projectedEnd<=o||e.projectedStart>=l)continue;let d=Math.max(o,e.projectedStart)-e.projectedStart,a=Math.min(l,e.projectedEnd)-e.projectedStart;if(e.symbol){i+=e.symbolDisplays?.[0]??"";continue}let u=new Map;e.symbolOffsets?.forEach((f,c)=>u.set(f,e.symbolDisplays?.[c]??""));for(let f=d;f<a;f+=1)i+=u.get(f)??e.text[f];}return i},resultRunAddressAt(o){let l=r.find(e=>e.resultRuns!==void 0&&o>=e.projectedStart&&o<e.projectedEnd);if(!l?.resultRuns)return null;let i=o-l.projectedStart;for(let e of l.resultRuns)if(i>=e.start&&i<e.end)return {runId:e.runId,offset:i-e.start};return null},findOccurrences(o,l,i={}){let e=[];if(l<=0||!chunkAVKVRU7Z_cjs.Va(o)||s.length===0)return {matches:e,truncated:false};let d=i.matchCase===true,a=i.wholeWord===true;t??=W(s,U(r));let u=t,f=W(o).text;if(f.length===0||f.includes(Y))return {matches:e,truncated:false};let c=d?f:chunkAVKVRU7Z_cjs.Ta(f),j=d?u.text:chunkAVKVRU7Z_cjs.Ta(u.text),R=p=>u.at?.[p]??p,X=p=>{if(!u.at)return p;let m=0;for(;m<u.at.length&&u.at[m]<p;)m+=1;return m},v=Math.min(s.length,i.to??s.length),D=new Set,b=j.indexOf(c,X(Math.max(0,i.from??0)));for(;b>=0;){let p=b+c.length,m=R(b),x=R(p-1)+1;if(x>v)return {matches:e,truncated:false};if(r.some(y=>y.floatingObject===true&&y.projectedStart>m&&y.projectedStart<x)){b=j.indexOf(c,b+1);continue}if(!a||chunkAVKVRU7Z_cjs.Ua(u.text,b,p)){let y=r.find(h=>m>=h.projectedStart&&m<h.projectedEnd),E=r.find(h=>x>h.projectedStart&&x<=h.projectedEnd);if(!y||!E)return {matches:e,truncated:false};let S=y===E&&y.expansion?y:null;if(!S||!D.has(S)){if(e.length>=l)return {matches:e,truncated:true};e.push({start:m,length:x-m,rawStart:I(y,m),rawEnd:L(E,x)}),S&&D.add(S);}}b=j.indexOf(c,p);}return {matches:e,truncated:false}}}}function q(n){return n.length===0?O([]):O([{text:n,rawStart:0,rawEnd:n.length}])}var J="http://schemas.openxmlformats.org/markup-compatibility/2006";function Z(n){if(n.kind==="textValue")return false;if(chunk4KZ6L5YF_cjs.$c(n))return chunk4KZ6L5YF_cjs.ad(n);let r=s=>s.kind!=="textValue"&&s.children.some(t=>t.kind==="anchoredDrawing"||t.kind!=="textValue"&&t.localName==="anchor");if(n.kind==="drawing")return r(n);if(n.namespaceUri!==J||n.localName!=="AlternateContent")return false;for(let s of n.children){if(s.kind==="textValue"||s.localName!=="Choice")continue;let t=s.children.find(o=>o.kind==="drawing"||o.kind!=="textValue"&&o.localName==="drawing");if(t)return r(t)}return false}function $(n,r,s="allMarkup"){if(!r.includes(chunk4KZ6L5YF_cjs.Ve)&&!r.includes(chunk4KZ6L5YF_cjs.Va))return r.length===0?[]:[{text:r,rawStart:0,rawEnd:r.length}];let t=chunk4KZ6L5YF_cjs.of(n),o=chunk4KZ6L5YF_cjs.Qf(n,t),l=chunkK246T47S_cjs.c(n,t,s),i=new Map;for(let a of t)i.set(a.node.id,a);let e=[],d=0;for(let a of o){let u=i.get(a.node.id),f=!u&&chunk4KZ6L5YF_cjs.Wa(a.node);if(!u&&!f){Z(a.node)&&(d<a.start&&e.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),e.push({text:"",rawStart:a.start,rawEnd:a.end,floatingObject:true}),d=a.end);continue}if(d<a.start&&e.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),!u){e.push({text:chunk4KZ6L5YF_cjs.Va,rawStart:a.start,rawEnd:a.end,symbol:true,symbolDisplays:[chunkAVKVRU7Z_cjs.Ga(a.node)]}),d=a.end;continue}let c=l.get(u.node.id);u.kind==="simple"&&c?e.push({text:c.text,rawStart:a.start,rawEnd:a.end,resultRuns:c.runs,...c.symbols?{symbolOffsets:c.symbols}:{},...c.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}):e.push({text:c?.text??chunk4KZ6L5YF_cjs.Ve,rawStart:a.start,rawEnd:a.end,...c?.symbols?{symbolOffsets:c.symbols}:{},...c?.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}),d=a.end;}return d<r.length&&e.push({text:r.slice(d),rawStart:d,rawEnd:r.length}),e}function it(n,r,s="allMarkup"){return !r.includes(chunk4KZ6L5YF_cjs.Ve)&&!r.includes(chunk4KZ6L5YF_cjs.Va)?q(r):O($(n,r,s))}
2
+ exports.a=O;exports.b=q;exports.c=$;exports.d=it;