@docx-editor.dev/core 2.20.0 → 2.21.1

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 +38 -59
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +11 -10
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +9 -9
  7. package/dist/binding.js +1 -1
  8. package/dist/chunk-25OQBAKA.js +2 -0
  9. package/dist/chunk-3B3DQMSL.js +11 -0
  10. package/dist/chunk-3P3DNJYM.js +5 -0
  11. package/dist/chunk-3PA64KPK.js +5 -0
  12. package/dist/chunk-4TYA4RLP.cjs +1 -0
  13. package/dist/chunk-7N77EN2Z.cjs +2 -0
  14. package/dist/{chunk-GSEUM6AI.cjs → chunk-AGWWNVIJ.cjs} +1 -1
  15. package/dist/chunk-AJCCS53D.js +1 -0
  16. package/dist/chunk-BF2TOG2V.js +1 -0
  17. package/dist/chunk-DFTVN25X.cjs +5 -0
  18. package/dist/chunk-DGONGMAV.js +2 -0
  19. package/dist/chunk-DZYKU2HG.js +1 -0
  20. package/dist/chunk-E5OUYRNM.cjs +5 -0
  21. package/dist/chunk-F4H3LC6M.cjs +2 -0
  22. package/dist/{chunk-CAIWEQLC.js → chunk-FPDIJ4RF.js} +1 -1
  23. package/dist/chunk-IUTTOBQW.cjs +20 -0
  24. package/dist/{chunk-OA6LFCTG.cjs → chunk-IYCXQAFT.cjs} +3 -3
  25. package/dist/chunk-JL3SI5SZ.js +18 -0
  26. package/dist/chunk-OFWUHH52.js +20 -0
  27. package/dist/chunk-OKY6JRJL.js +4 -0
  28. package/dist/{chunk-PIBYJZIH.cjs → chunk-P24FHMQW.cjs} +1 -1
  29. package/dist/chunk-QBKAOSVF.cjs +18 -0
  30. package/dist/{chunk-2HQXLL5L.cjs → chunk-RA2TDTEQ.cjs} +1 -1
  31. package/dist/chunk-S6J4O5XP.js +1 -0
  32. package/dist/{chunk-WTILOUPG.cjs → chunk-T5B4NMKF.cjs} +1 -1
  33. package/dist/chunk-TKQH7BNE.cjs +1 -0
  34. package/dist/{chunk-OHVJYJOA.js → chunk-U5GUJKTS.js} +1 -1
  35. package/dist/chunk-UKVVUHZL.cjs +1 -0
  36. package/dist/chunk-XRYSPKKC.js +1 -0
  37. package/dist/chunk-ZZRCVDQU.cjs +11 -0
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +13 -4
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/collaboration.d.ts +4 -3
  42. package/dist/contracts/document.d.ts +3 -2
  43. package/dist/contracts/editor.cjs +1 -1
  44. package/dist/contracts/editor.d.ts +9 -9
  45. package/dist/contracts/editor.js +1 -1
  46. package/dist/contracts/interaction.d.ts +2 -2
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.ts +9 -7
  49. package/dist/contracts/modules.js +1 -1
  50. package/dist/contracts/types.d.ts +2 -1
  51. package/dist/{custom-node-writes-piokwVR5.d.ts → custom-node-writes-CncR6KfC.d.ts} +2 -2
  52. package/dist/{document-protection-C6RvCHx-.d.ts → document-protection-DM6mA8Rf.d.ts} +1 -1
  53. package/dist/{editor-BgtcHulQ.d.ts → editor-BRh7GuZF.d.ts} +33 -30
  54. package/dist/editor-scope-OHPwVQ5l.d.ts +84 -0
  55. package/dist/editor.cjs +1 -1
  56. package/dist/editor.css +1 -1
  57. package/dist/editor.d.ts +130 -27
  58. package/dist/editor.js +1 -1
  59. package/dist/export.cjs +2 -2
  60. package/dist/export.d.ts +13 -13
  61. package/dist/export.js +1 -1
  62. package/dist/{font-resolver-Bv2Z25-J.d.ts → font-resolver-DwuQYj3P.d.ts} +1 -1
  63. package/dist/{headless-document-view-DHKMN_3Y.d.ts → headless-document-view-C3fc_jV0.d.ts} +2 -2
  64. package/dist/{image-resources-C51LuAAu.d.ts → image-resources-DxF-SN_8.d.ts} +1 -1
  65. package/dist/{index-3lr8xXF8.d.ts → index-3pNnG4z4.d.ts} +122 -30
  66. package/dist/index.cjs +1 -1
  67. package/dist/index.d.ts +18 -18
  68. package/dist/index.js +1 -1
  69. package/dist/{layout-shaping-CKBUSaS7.d.ts → layout-shaping-_GGjhhVc.d.ts} +1 -1
  70. package/dist/layout.cjs +1 -1
  71. package/dist/layout.d.ts +43 -18
  72. package/dist/layout.js +1 -1
  73. package/dist/{note-properties-CcXUgqr8.d.ts → note-properties-CjT31AuP.d.ts} +1 -1
  74. package/dist/{omml-equation-C5P6Ym3v.d.ts → omml-equation-Bk3OP1fv.d.ts} +1 -1
  75. package/dist/output.cjs +1 -1
  76. package/dist/output.d.ts +8 -7
  77. package/dist/output.js +1 -1
  78. package/dist/{protocol-CsawNZkt.d.ts → protocol-CrbTIW2Z.d.ts} +2 -2
  79. package/dist/{review-paragraph-order-BCIqjopY.d.ts → review-paragraph-order-D3KZohIL.d.ts} +1 -1
  80. package/dist/{revision-projection-BcRnC4Yj.d.ts → revision-projection-kVd7p6Wd.d.ts} +16 -2
  81. package/dist/{semantic-cell-selection-R9wrenwR.d.ts → semantic-cell-selection-CkSsZHDL.d.ts} +11 -4
  82. package/dist/{semantic-interaction-B7beVwH7.d.ts → semantic-interaction-Z2Xa68U5.d.ts} +1 -1
  83. package/dist/{semantic-paint-CLvHwf8y.d.ts → semantic-paint-BHKprI9P.d.ts} +18 -2
  84. package/dist/{semantic-records-CbXwnS80.d.ts → semantic-records-StH-AnHK.d.ts} +153 -10
  85. package/dist/store.cjs +1 -1
  86. package/dist/store.d.ts +468 -439
  87. package/dist/store.js +1 -1
  88. package/dist/{note-lifecycle-D4AOFCAt.d.ts → tree-package-fragment-CpEV1gl3.d.ts} +183 -143
  89. package/dist/{tree-session-contract-DTQxw2zL.d.ts → tree-session-contract-CTT9nM7Z.d.ts} +13 -8
  90. package/dist/{types-barrel-CEOy-Jv0.d.ts → types-barrel-PwcfEkaX.d.ts} +1481 -1433
  91. package/package.json +2 -2
  92. package/dist/chunk-2H4ABRMB.cjs +0 -20
  93. package/dist/chunk-3EZO3O6I.js +0 -4
  94. package/dist/chunk-44SIVFJT.cjs +0 -5
  95. package/dist/chunk-6UCDHGXI.js +0 -1
  96. package/dist/chunk-7VMVDRRU.js +0 -2
  97. package/dist/chunk-CEXC2VHI.cjs +0 -1
  98. package/dist/chunk-CF3JR35B.js +0 -11
  99. package/dist/chunk-D2V4YBWJ.cjs +0 -2
  100. package/dist/chunk-D5EHDHYV.js +0 -1
  101. package/dist/chunk-DGSJZMAE.cjs +0 -11
  102. package/dist/chunk-EHBPYFRE.js +0 -20
  103. package/dist/chunk-GOEBQ26R.js +0 -1
  104. package/dist/chunk-H6WDEAOJ.js +0 -18
  105. package/dist/chunk-I6LSEDUL.cjs +0 -18
  106. package/dist/chunk-IW35GWJN.js +0 -1
  107. package/dist/chunk-JRBGCIR2.js +0 -5
  108. package/dist/chunk-K5HIOS6J.cjs +0 -3
  109. package/dist/chunk-KLQXP27K.js +0 -3
  110. package/dist/chunk-MZFFU66H.cjs +0 -2
  111. package/dist/chunk-MZPNLIP3.js +0 -2
  112. package/dist/chunk-OHJQ7GPZ.cjs +0 -1
  113. package/dist/chunk-P4TGGDK3.js +0 -1
  114. package/dist/chunk-ZKWRCLT2.cjs +0 -1
  115. package/dist/editor-scope-DZJT4ukT.d.ts +0 -53
package/README.md CHANGED
@@ -13,71 +13,60 @@
13
13
 
14
14
  # @docx-editor.dev/core
15
15
 
16
- The engine behind [docx-editor.dev](https://docx-editor.dev). It reads a `.docx` into a
17
- canonical document tree, lays that tree out into pages, paints them, and writes the tree back
18
- to OOXML. No framework dependency and no UI.
16
+ The engine behind [docx-editor.dev](https://docx-editor.dev). It reads a `.docx` into a canonical document tree, lays that tree out into pages, paints them, and writes the tree back to OOXML. No framework dependency and no UI.
19
17
 
20
- Most apps never install this directly — [`@docx-editor.dev/react`](https://www.npmjs.com/package/@docx-editor.dev/react)
21
- carries it. Reach for it when you are writing your own adapter, or when you need the contract
22
- types to write a function signature.
18
+ Install this package alongside the React or Vue adapter. Both adapters require it as a peer dependency. You can also use its public contracts to build your own adapter.
23
19
 
24
20
  ```bash
25
21
  npm install @docx-editor.dev/core
26
22
  ```
27
23
 
28
- Node use requires `^20.16.0 || >=22.3.0`.
24
+ Node.js requires `^20.16.0 || >=22.3.0`.
29
25
 
30
26
  ## Entry points
31
27
 
28
+ Import editor creation, font helpers, and contract types from the package root:
29
+
32
30
  ```ts
33
31
  import { createDocxEditor, loadFonts, WORD_DEFAULT_FONT } from '@docx-editor.dev/core';
34
32
  import type { Editor, EditorSnapshot } from '@docx-editor.dev/core';
35
33
  ```
36
34
 
37
- The root covers most uses: creating an editor, the `Editor` contract it implements, fonts,
38
- the chrome registry, and the document model types. Subpaths expose the canonical tree, the
39
- layout pass, and the paint step directly.
40
-
41
- | Subpath | What's there |
42
- | ----------------------------- | -------------------------------------------------------------------------------------------- |
43
- | `.` | Create an editor, the contract, fonts, the chrome registry, the document model. |
44
- | `./editor` | Everything the root re-exports, plus the paginated surface and ruler geometry. |
45
- | `./contracts/editor` | `Editor`, `EditorCommand`, `EditorQuery`, `EditorSnapshot`, `PageSetup`. |
46
- | `./contracts/document` | The document-level edit and query vocabulary. |
47
- | `./contracts/interaction` | Semantic addressing (`SemanticTarget`) and the `InteractionOutcome` an attempt answers with. |
48
- | `./contracts/types` | Document model types. |
49
- | `./contracts/modules` | `EditorModule` — the shape `@docx-editor.dev/pro` implements. |
50
- | `./store` | The canonical tree and its transactional store. |
51
- | `./layout` | The DOM-free layout pass. |
52
- | `./output` | Serialization. |
53
- | `./export` | Document layout sessions for exporters. No DOM required. |
54
- | `./automation` | The object model behind `@docx-editor.dev/editor-api`. |
55
- | `./collaboration` | Provider-neutral collaboration session contracts. |
56
- | `./collaboration/replication` | Replication helpers for collaboration providers. |
57
- | `./styles/editor.css` | The one editor stylesheet, shared by packaged and custom chrome. |
35
+ The root covers most uses: creating an editor, the `Editor` contract it implements, fonts, the chrome registry, and the document model types. Subpaths expose the canonical tree, the layout pass, and the paint step directly.
36
+
37
+ | Subpath | What's there |
38
+ | --- | --- |
39
+ | `.` | Create an editor, the contract, fonts, the chrome registry, the document model. |
40
+ | `./editor` | Everything the root re-exports, plus the paginated surface and ruler geometry. |
41
+ | `./contracts/editor` | `Editor`, `EditorCommand`, `EditorQuery`, `EditorSnapshot`, `PageSetup`. |
42
+ | `./contracts/document` | The document-level edit and query vocabulary. |
43
+ | `./contracts/interaction` | Semantic addressing (`SemanticTarget`) and the `InteractionOutcome` an attempt answers with. |
44
+ | `./contracts/types` | Document model types. |
45
+ | `./contracts/modules` | `EditorModule` — the shape `@docx-editor.dev/pro` implements. |
46
+ | `./store` | The canonical tree and its transactional store. |
47
+ | `./layout` | The DOM-free layout pass. |
48
+ | `./output` | Paint layouts and selection overlays into the DOM. |
49
+ | `./export` | Document layout sessions for exporters. No DOM required. |
50
+ | `./automation` | The object model behind `@docx-editor.dev/editor-api`. |
51
+ | `./collaboration` | Provider-neutral collaboration session contracts. |
52
+ | `./collaboration/replication` | Replication helpers for collaboration providers. |
53
+ | `./styles/editor.css` | The one editor stylesheet, shared by packaged and custom chrome. |
58
54
 
59
55
  ## Architecture
60
56
 
61
- ```
62
- bytes → bounded OPC/XML read → canonical OOXML tree → layout → painted pages → serialize
63
- ```
57
+ The engine reads DOCX bytes into a canonical OOXML tree. Layout reads the tree and produces painted pages. Saving serializes the tree back into a DOCX package.
64
58
 
65
- There is one document model. The painted pages are the editable surface: they are
66
- `contenteditable`, but the DOM is a picture. Browser mutations are prevented and re-expressed
67
- as tree operations, so the browser never invents markup inside your document.
59
+ There is one document model. The painted pages are the editable surface: they are `contenteditable`, but the DOM is a picture. Browser mutations are prevented and re-expressed as tree operations, so the browser never invents markup inside your document.
68
60
 
69
- Nodes are typed where layout needs them and generic everywhere else, preserving the element
70
- verbatim. Content the engine does not model is carried rather than dropped, so a document full
71
- of unknown extensions still opens, edits, and saves.
61
+ Nodes are typed where layout needs them and generic everywhere else, preserving the element structure. Content the engine does not model is carried rather than dropped, so a document full of unknown extensions still opens, edits, and saves.
72
62
 
73
- Export sessions default to `all-markup`, which shows inserted and deleted text.
74
- Use `displayMode: 'proposed'` for the accepted view or `displayMode: 'original'` for the rejected view.
63
+ Export sessions default to `all-markup`, which shows inserted and deleted text. Use `displayMode: 'proposed'` for the accepted view or `displayMode: 'original'` for the rejected view.
75
64
 
76
65
  ### Build a paginated exporter
77
66
 
78
- For exports that need accurate page breaks, use `openFontBackedDocumentForExport`. It resolves
79
- the fonts used throughout the document before layout. Without a measurer,
80
- `openDocumentForExport(bytes)` uses a fixed-width approximation.
67
+ For exports that need font-based page breaks, use `openFontBackedDocumentForExport`. It resolves the fonts used throughout the document before layout. Without a measurer, `openDocumentForExport(bytes)` uses a fixed-width approximation.
68
+
69
+ Install `@docx-editor.dev/fonts` to use packaged substitutes in this example:
81
70
 
82
71
  ```ts
83
72
  import { readFile } from 'node:fs/promises';
@@ -86,41 +75,31 @@ import { packagedFonts } from '@docx-editor.dev/fonts';
86
75
 
87
76
  const bytes = new Uint8Array(await readFile('contract.docx'));
88
77
  const opened = await openFontBackedDocumentForExport(bytes, {
89
- // First wins: put caller-supplied licensed fonts first, bundled metric substitutes next,
90
- // and an optional network resolver last.
91
- fonts: [callerFonts, packagedFonts(), optionalNetworkFonts],
78
+ fonts: packagedFonts(),
92
79
  fontPolicy: 'strict',
93
- onFontResolution: (report) => auditLogger.info(report),
80
+ onFontResolution: (report) => console.info(report),
94
81
  });
95
82
 
96
83
  if (!opened.ok) throw new Error(`DOCX rejected: ${opened.reason}`);
97
84
  try {
98
85
  const layout = await opened.session.layout();
99
- await writeExporterOutput(layout);
86
+ console.log(layout); // Replace this with your exporter.
100
87
  } finally {
101
88
  opened.session.dispose(); // releases document-owned shaping bytes
102
89
  }
103
90
  ```
104
91
 
105
- Let Core manage fonts, resources, and layout. Build your output from the returned pages.
106
- For a live `HeadlessDocumentView`, pass the editor's revision-stable measurer.
92
+ Let the engine manage fonts, resources, and layout. Build your output from the returned pages. For a live `HeadlessDocumentView`, pass the editor's revision-stable measurer.
107
93
 
108
94
  ## Fidelity
109
95
 
110
- Untouched content, unsupported OOXML, and package payloads survive editing and save. The
111
- canonical tree preserves document structure while embedded fonts, macros, media, and other
112
- payloads pass through untouched. Two oracles gate this in CI: a canonical fingerprint over the
113
- tree, and a save-and-reopen semantic digest.
96
+ Untouched content, unsupported OOXML, and package payloads survive editing and save. The canonical tree preserves document structure while embedded fonts, macros, media, and other payloads pass through untouched. Two oracles gate this in CI: a canonical fingerprint over the tree, and a save-and-reopen semantic digest.
114
97
 
115
98
  ## Untrusted input
116
99
 
117
- A `.docx` is a zip of XML that whoever sent it controls end to end. The engine sanitizes at the
118
- parse boundary: URL allowlisting, entity and zip-bomb limits, recursion and element caps, no
119
- zero-click external fetches, escaping on the way back out.
100
+ Treat DOCX files as untrusted input. The engine validates URLs and limits XML entities, archive expansion, nesting, and element counts. It does not automatically fetch external document relationships. Serialization escapes document text.
120
101
 
121
- Anything you render from document data (a font name, a hyperlink target, a comment body) is
122
- still attacker-controlled at your boundary. Render it as text; do not build markup or URLs
123
- from it.
102
+ Anything you render from document data (a font name, a hyperlink target, a comment body) is still attacker-controlled at your boundary. Render it as text; do not build markup or URLs from it.
124
103
 
125
104
  ## Documentation
126
105
 
@@ -1 +1 @@
1
- 'use strict';var chunkD2V4YBWJ_cjs=require('./chunk-D2V4YBWJ.cjs');require('./chunk-GSEUM6AI.cjs'),require('./chunk-I6LSEDUL.cjs'),require('./chunk-2HQXLL5L.cjs'),require('./chunk-FGBADUSK.cjs');var chunkK5HIOS6J_cjs=require('./chunk-K5HIOS6J.cjs'),chunkCEXC2VHI_cjs=require('./chunk-CEXC2VHI.cjs'),chunkDGSJZMAE_cjs=require('./chunk-DGSJZMAE.cjs');var D=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),_=Object.freeze({kind:"body"});function V(o,t={}){let m=chunkDGSJZMAE_cjs.dc(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 chunkK5HIOS6J_cjs.O(m.package,chunkDGSJZMAE_cjs.Kb(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(chunkK5HIOS6J_cjs.$a(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=chunkD2V4YBWJ_cjs.e(u.currentPackage()).story(f);return s?chunkD2V4YBWJ_cjs.b(i,s.part,a,d):null};}let r=chunkD2V4YBWJ_cjs.k({port:n,capabilities:D});return y&&(c=y.attach(chunkCEXC2VHI_cjs.b(u,{documentId:y.documentId}))),{ok:true,host:r}}function Y(o,t,m){let p=o.partFor(m);return p?chunkDGSJZMAE_cjs.Ba(o,()=>{let u=chunkDGSJZMAE_cjs.sf(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"?chunkDGSJZMAE_cjs.b.mutationAgent:chunkDGSJZMAE_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,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=_,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>chunkDGSJZMAE_cjs.Mb(t?.identity.actorId,()=>Y(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=>chunkCEXC2VHI_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],_);if(r)return {ok:false,reason:r};let i=chunkDGSJZMAE_cjs.Mb(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=chunkDGSJZMAE_cjs.Mb(t?.identity.actorId,()=>chunkK5HIOS6J_cjs.$(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=chunkDGSJZMAE_cjs.Mb(t?.identity.actorId,()=>chunkK5HIOS6J_cjs.Z(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=chunkDGSJZMAE_cjs.Mb(t?.identity.actorId,()=>chunkK5HIOS6J_cjs._(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=chunkDGSJZMAE_cjs.Mb(t?.identity.actorId,()=>chunkK5HIOS6J_cjs.ha(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?chunkDGSJZMAE_cjs.ec(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.g}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.f}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.h}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.d}});Object.defineProperty(exports,"createAutomationPaginationProvider",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.c}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.j}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.i}});Object.defineProperty(exports,"paginationSnapshotOf",{enumerable:true,get:function(){return chunkD2V4YBWJ_cjs.a}});exports.SERVER_AUTOMATION_CAPABILITIES=D;exports.createServerAutomationHost=V;
1
+ 'use strict';var chunk7N77EN2Z_cjs=require('./chunk-7N77EN2Z.cjs');require('./chunk-AGWWNVIJ.cjs'),require('./chunk-QBKAOSVF.cjs'),require('./chunk-RA2TDTEQ.cjs'),require('./chunk-FGBADUSK.cjs');var chunkDFTVN25X_cjs=require('./chunk-DFTVN25X.cjs'),chunk4TYA4RLP_cjs=require('./chunk-4TYA4RLP.cjs'),chunkZZRCVDQU_cjs=require('./chunk-ZZRCVDQU.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=chunkZZRCVDQU_cjs.ec(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 chunkDFTVN25X_cjs.O(m.package,chunkDFTVN25X_cjs.Za(m.package,chunkZZRCVDQU_cjs.Lb(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(chunkDFTVN25X_cjs.ab(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=chunk7N77EN2Z_cjs.e(u.currentPackage()).story(f);return s?chunk7N77EN2Z_cjs.b(i,s.part,a,d):null};}let r=chunk7N77EN2Z_cjs.k({port:n,capabilities:j});return y&&(c=y.attach(chunk4TYA4RLP_cjs.b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?chunkZZRCVDQU_cjs.Ca(o,()=>{let u=chunkZZRCVDQU_cjs.zf(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"?chunkZZRCVDQU_cjs.b.mutationAgent:chunkZZRCVDQU_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,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>chunkZZRCVDQU_cjs.Nb(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=>chunk4TYA4RLP_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=chunkZZRCVDQU_cjs.Nb(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=chunkZZRCVDQU_cjs.Nb(t?.identity.actorId,()=>chunkDFTVN25X_cjs.$(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=chunkZZRCVDQU_cjs.Nb(t?.identity.actorId,()=>chunkDFTVN25X_cjs.Z(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=chunkZZRCVDQU_cjs.Nb(t?.identity.actorId,()=>chunkDFTVN25X_cjs._(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=chunkZZRCVDQU_cjs.Nb(t?.identity.actorId,()=>chunkDFTVN25X_cjs.ha(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?chunkZZRCVDQU_cjs.fc(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.g}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.f}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.h}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.d}});Object.defineProperty(exports,"createAutomationPaginationProvider",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.c}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.j}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.i}});Object.defineProperty(exports,"paginationSnapshotOf",{enumerable:true,get:function(){return chunk7N77EN2Z_cjs.a}});exports.SERVER_AUTOMATION_CAPABILITIES=j;exports.createServerAutomationHost=Y;
@@ -1,14 +1,15 @@
1
- import { A as AutomationCapabilities, a as AutomationHost } from './protocol-CsawNZkt.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-CsawNZkt.js';
3
- import { H as HeaderFooterVariant, N as NoteKind } from './note-lifecycle-D4AOFCAt.js';
4
- import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-CbXwnS80.js';
5
- import { H as HeadlessDocumentView } from './headless-document-view-DHKMN_3Y.js';
6
- import { X as OoxmlPackageLimits, Y as OoxmlPackageRejection } from './types-barrel-CEOy-Jv0.js';
7
- export { Z as RevisionBatchEntry, _ as RevisionBatchResult, $ as RevisionBatchSkipReason } from './types-barrel-CEOy-Jv0.js';
1
+ import { A as AutomationCapabilities, a as AutomationHost } from './protocol-CrbTIW2Z.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-CrbTIW2Z.js';
3
+ import { H as HeaderFooterVariant, N as NoteKind } from './tree-package-fragment-CpEV1gl3.js';
4
+ import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-StH-AnHK.js';
5
+ import { H as HeadlessDocumentView } from './headless-document-view-C3fc_jV0.js';
6
+ import { X as OoxmlPackageLimits, Y as OoxmlPackageRejection } from './types-barrel-PwcfEkaX.js';
7
+ export { Z as RevisionBatchEntry, _ as RevisionBatchResult, $ as RevisionBatchSkipReason } from './types-barrel-PwcfEkaX.js';
8
8
  import { CollaborationModuleContribution } from './collaboration.js';
9
- import './image-resources-C51LuAAu.js';
10
- import './revision-projection-BcRnC4Yj.js';
11
- import './omml-equation-C5P6Ym3v.js';
9
+ import './image-resources-DxF-SN_8.js';
10
+ import './revision-projection-kVd7p6Wd.js';
11
+ import './omml-equation-Bk3OP1fv.js';
12
+ import './editor-scope-OHPwVQ5l.js';
12
13
  import './collaboration/replication.js';
13
14
  import './failure-DNNmwsgD.js';
14
15
 
@@ -1 +1 @@
1
- import {k,e,b as b$1}from'./chunk-7VMVDRRU.js';export{g as AUTOMATION_COMMAND_OPERATIONS,f as AUTOMATION_QUERY_OPERATIONS,h as AUTOMATION_SOLITARY_OPERATIONS,d as HEADER_FOOTER_VARIANTS,c as createAutomationPaginationProvider,j as isAutomationCommand,i as isSolitaryAutomationCommand,a as paginationSnapshotOf}from'./chunk-7VMVDRRU.js';import'./chunk-6UCDHGXI.js';import'./chunk-H6WDEAOJ.js';import'./chunk-P4TGGDK3.js';import'./chunk-VP7SDFCM.js';import {O,$a,ha,$,Z,_ as _$1}from'./chunk-KLQXP27K.js';import {b,a}from'./chunk-IW35GWJN.js';import {dc,Kb,ec,Mb,Ba,sf,b as b$2}from'./chunk-CF3JR35B.js';var D=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),_=Object.freeze({kind:"body"});function V(o,t={}){let m=dc(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 O(m.package,Kb(p)),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e$1=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$1($a(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=e(u.currentPackage()).story(f);return s?b$1(i,s.part,a,d):null};}let r=k({port:n,capabilities:D});return y&&(c=y.attach(b(u,{documentId:y.documentId}))),{ok:true,host:r}}function Y(o,t,m){let p=o.partFor(m);return p?Ba(o,()=>{let u=sf(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$2.mutationAgent:b$2.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=_,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>Mb(t?.identity.actorId,()=>Y(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],_);if(r)return {ok:false,reason:r};let i=Mb(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=Mb(t?.identity.actorId,()=>$(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=Mb(t?.identity.actorId,()=>Z(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=Mb(t?.identity.actorId,()=>_$1(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=Mb(t?.identity.actorId,()=>ha(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?ec(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}export{D as SERVER_AUTOMATION_CAPABILITIES,V as createServerAutomationHost};
1
+ import {k,e,b as b$1}from'./chunk-25OQBAKA.js';export{g as AUTOMATION_COMMAND_OPERATIONS,f as AUTOMATION_QUERY_OPERATIONS,h as AUTOMATION_SOLITARY_OPERATIONS,d as HEADER_FOOTER_VARIANTS,c as createAutomationPaginationProvider,j as isAutomationCommand,i as isSolitaryAutomationCommand,a as paginationSnapshotOf}from'./chunk-25OQBAKA.js';import'./chunk-XRYSPKKC.js';import'./chunk-JL3SI5SZ.js';import'./chunk-DZYKU2HG.js';import'./chunk-VP7SDFCM.js';import {O,Za,ab,ha,$,Z,_}from'./chunk-3P3DNJYM.js';import {b,a}from'./chunk-BF2TOG2V.js';import {ec,Lb,fc,Nb,Ca,zf,b as b$2}from'./chunk-3B3DQMSL.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=ec(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 O(m.package,Za(m.package,Lb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e$1=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$1(ab(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=e(u.currentPackage()).story(f);return s?b$1(i,s.part,a,d):null};}let r=k({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?Ca(o,()=>{let u=zf(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$2.mutationAgent:b$2.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>Nb(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=Nb(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=Nb(t?.identity.actorId,()=>$(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=Nb(t?.identity.actorId,()=>Z(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=Nb(t?.identity.actorId,()=>_(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=Nb(t?.identity.actorId,()=>ha(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?fc(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 chunk44SIVFJT_cjs=require('./chunk-44SIVFJT.cjs');require('./chunk-WTILOUPG.cjs'),require('./chunk-2HQXLL5L.cjs'),require('./chunk-FGBADUSK.cjs'),require('./chunk-K5HIOS6J.cjs'),require('./chunk-CEXC2VHI.cjs'),require('./chunk-DGSJZMAE.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunk44SIVFJT_cjs.e}});
1
+ 'use strict';var chunkE5OUYRNM_cjs=require('./chunk-E5OUYRNM.cjs');require('./chunk-T5B4NMKF.cjs'),require('./chunk-RA2TDTEQ.cjs'),require('./chunk-FGBADUSK.cjs'),require('./chunk-DFTVN25X.cjs'),require('./chunk-4TYA4RLP.cjs'),require('./chunk-ZZRCVDQU.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkE5OUYRNM_cjs.e}});
package/dist/binding.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { Node, Schema } from 'prosemirror-model';
2
- import { a0 as OoxmlProperty, Y as OoxmlPackageRejection } from './types-barrel-CEOy-Jv0.js';
3
- import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-DTQxw2zL.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-DTQxw2zL.js';
2
+ import { a0 as OoxmlProperty, Y as OoxmlPackageRejection } from './types-barrel-PwcfEkaX.js';
3
+ import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-CTT9nM7Z.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-CTT9nM7Z.js';
5
5
  import { ReviewModuleContribution } from './contracts/modules.js';
6
- export { S as StoryScope, a as StoryTargetRejection } from './note-lifecycle-D4AOFCAt.js';
6
+ export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-CpEV1gl3.js';
7
7
  import { EditorView } from 'prosemirror-view';
8
- import './image-resources-C51LuAAu.js';
9
- import './custom-node-writes-piokwVR5.js';
10
- import './headless-document-view-DHKMN_3Y.js';
8
+ import './editor-scope-OHPwVQ5l.js';
9
+ import './image-resources-DxF-SN_8.js';
10
+ import './custom-node-writes-CncR6KfC.js';
11
+ import './headless-document-view-C3fc_jV0.js';
11
12
  import './collaboration/replication.js';
12
- import './editor-scope-DZJT4ukT.js';
13
- import './revision-projection-BcRnC4Yj.js';
13
+ import './revision-projection-kVd7p6Wd.js';
14
14
  import './collaboration.js';
15
15
  import './failure-DNNmwsgD.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-JRBGCIR2.js';import'./chunk-CAIWEQLC.js';import'./chunk-P4TGGDK3.js';import'./chunk-VP7SDFCM.js';import'./chunk-KLQXP27K.js';import'./chunk-IW35GWJN.js';import'./chunk-CF3JR35B.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-3PA64KPK.js';import'./chunk-FPDIJ4RF.js';import'./chunk-DZYKU2HG.js';import'./chunk-VP7SDFCM.js';import'./chunk-3P3DNJYM.js';import'./chunk-BF2TOG2V.js';import'./chunk-3B3DQMSL.js';