@docx-editor.dev/core 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +6 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +16 -10
- package/dist/binding.js +1 -1
- package/dist/chunk-24APKZAN.cjs +11 -0
- package/dist/chunk-2YH4MSHX.cjs +2 -0
- package/dist/chunk-5Y7AADI6.js +1 -0
- package/dist/chunk-AREFLNUP.js +11 -0
- package/dist/chunk-AS7YZNQE.cjs +2 -0
- package/dist/chunk-AVGCKH6A.cjs +20 -0
- package/dist/chunk-CDYVDQRI.cjs +5 -0
- package/dist/chunk-FGBADUSK.cjs +1 -0
- package/dist/chunk-HOEWFH5U.cjs +1 -0
- package/dist/chunk-KFELX7CN.js +2 -0
- package/dist/{chunk-OKEDGR65.js → chunk-KXPVOPR5.js} +1 -1
- package/dist/chunk-LGFKIF4M.cjs +1 -0
- package/dist/chunk-M52QXFKI.js +1 -0
- package/dist/chunk-MNUKSXRO.js +1 -0
- package/dist/chunk-PBOIGBDO.js +2 -0
- package/dist/chunk-PMHGONET.cjs +1 -0
- package/dist/chunk-PXKZUTHX.cjs +2 -0
- package/dist/chunk-Q4AB7E4O.cjs +1 -0
- package/dist/chunk-QJYH6AYD.js +1 -0
- package/dist/chunk-QRC37MWG.cjs +20 -0
- package/dist/chunk-RJSB6RJ7.js +20 -0
- package/dist/chunk-SB54HLFJ.js +20 -0
- package/dist/chunk-VP7SDFCM.js +1 -0
- package/dist/chunk-XCESLTJL.js +2 -0
- package/dist/{chunk-KIAP7PFQ.cjs → chunk-YL4Q5LZP.cjs} +1 -1
- package/dist/chunk-Z4527AXR.js +5 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -3
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +4 -3
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/interaction.d.ts +7 -7
- package/dist/contracts/modules.d.ts +8 -7
- package/dist/{custom-node-writes-DntmaAVW.d.ts → custom-node-writes-C9ArIlJh.d.ts} +2 -2
- package/dist/{editor-a6VvsfYU.d.ts → editor-sRxrFJd8.d.ts} +29 -21
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.ts +27 -58
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -0
- package/dist/export.d.ts +337 -0
- package/dist/export.js +2 -0
- package/dist/font-resolver-BYEHQGTw.d.ts +251 -0
- package/dist/headless-document-view-DELC4E5v.d.ts +134 -0
- package/dist/hf-references-DTrHkktY.d.ts +70 -0
- package/dist/{index-C5ZnSRkF.d.ts → index-C3Gvq4jN.d.ts} +55 -246
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -16
- package/dist/index.js +1 -1
- package/dist/{shaped-measurer-CFPnXFs9.d.cts → layout-shaping-DoGR5cf8.d.ts} +86 -12
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +1106 -729
- package/dist/layout.js +1 -1
- package/dist/{note-properties-CDFiNXcD.d.ts → note-properties-DSe8igrz.d.ts} +2 -2
- package/dist/{omml-equation-BY49UOIF.d.ts → omml-equation-BpRmfDAf.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-gOY5GA8K.d.cts → protocol-DZzKxH5r.d.ts} +18 -12
- package/dist/{review-items-CCS1h93f.d.ts → review-items-DYRx187i.d.ts} +2 -2
- package/dist/{review-reads-BjZYeMd4.d.ts → review-reads-LbGUdNzn.d.ts} +22 -25
- package/dist/{revision-projection-BeXVrSSV.d.ts → revision-projection-DHRJH48u.d.ts} +1 -1
- package/dist/{semantic-cell-selection-BK91NCCG.d.ts → semantic-cell-selection-BXVWCBYm.d.ts} +4 -4
- package/dist/{semantic-interaction-BmQ7h2cq.d.ts → semantic-interaction-DZsDmPg5.d.ts} +1 -1
- package/dist/{semantic-paint-WJD2KeG1.d.ts → semantic-paint-f7SqN4oW.d.ts} +2 -2
- package/dist/{semantic-records-BpozY7-j.d.cts → semantic-records-EIdwId-a.d.ts} +301 -205
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +15 -65
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-D6HzlPR4.d.ts → tree-op-types-egdarvH_.d.ts} +7 -3
- package/dist/{tree-package-fragment-CWFjgH6a.d.ts → tree-package-fragment-DjkH4ESI.d.ts} +4 -70
- package/dist/{tree-session-contract-B2HfGt79.d.ts → tree-session-contract-CGOOgPjW.d.ts} +29 -23
- package/dist/{tree-store-APgWx6qn.d.ts → tree-store-DKJB0IcA.d.ts} +2 -2
- package/package.json +7 -2
- package/dist/automation.d.cts +0 -82
- package/dist/binding.d.cts +0 -153
- package/dist/chunk-2PIHW2QM.cjs +0 -1
- package/dist/chunk-2QTY5S6T.js +0 -1
- package/dist/chunk-4Z5MODAE.cjs +0 -2
- package/dist/chunk-5TKAPFZT.cjs +0 -2
- package/dist/chunk-DRQHIQ4R.cjs +0 -1
- package/dist/chunk-F2K6SDHA.cjs +0 -20
- package/dist/chunk-FBA57EUJ.js +0 -2
- package/dist/chunk-KTAQ7BRQ.js +0 -20
- package/dist/chunk-LBAHXZCU.cjs +0 -5
- package/dist/chunk-MCDUQYWP.js +0 -5
- package/dist/chunk-MQP26KCF.js +0 -1
- package/dist/chunk-NDJGSR6M.cjs +0 -19
- package/dist/chunk-NJNFJPGB.cjs +0 -11
- package/dist/chunk-O5M4CR4P.cjs +0 -2
- package/dist/chunk-UKUOZXUD.js +0 -19
- package/dist/chunk-VQ4R5LTU.js +0 -2
- package/dist/chunk-ZBEJHJN2.js +0 -11
- package/dist/chunk-ZVTW7RGD.js +0 -2
- package/dist/collaboration/replication.d.cts +0 -216
- package/dist/collaboration.d.cts +0 -176
- package/dist/contracts/document.d.cts +0 -273
- package/dist/contracts/editor.d.cts +0 -10
- package/dist/contracts/interaction.d.cts +0 -10
- package/dist/contracts/modules.d.cts +0 -130
- package/dist/contracts/types.d.cts +0 -562
- package/dist/custom-node-writes-C46r3_5O.d.cts +0 -310
- package/dist/document-properties-D6Ahr8D6.d.cts +0 -28
- package/dist/document-properties-D6Ahr8D6.d.ts +0 -28
- package/dist/editor-AJ06hyyg.d.cts +0 -1994
- package/dist/editor.d.cts +0 -393
- package/dist/failure-BnGjoXf0.d.cts +0 -64
- package/dist/index-Cbw4lkOt.d.cts +0 -3391
- package/dist/index.d.cts +0 -23
- package/dist/layout.d.cts +0 -2486
- package/dist/note-properties-Y6qYh2Hv.d.cts +0 -67
- package/dist/omml-equation-DB8d-jCq.d.cts +0 -84
- package/dist/output.d.cts +0 -74
- package/dist/protocol-BsmQgblT.d.ts +0 -1358
- package/dist/review-items-CaAkgi5s.d.cts +0 -360
- package/dist/review-reads-DEsV0OOW.d.cts +0 -163
- package/dist/revision-projection-DXbrfNGD.d.cts +0 -156
- package/dist/semantic-cell-selection-BMhku3B1.d.cts +0 -451
- package/dist/semantic-interaction-DUAnxbgf.d.cts +0 -160
- package/dist/semantic-paint-DufNL1Zr.d.cts +0 -247
- package/dist/semantic-records-92UnKeU_.d.ts +0 -2821
- package/dist/shaped-measurer-BWbindlI.d.ts +0 -168
- package/dist/store.d.cts +0 -2500
- package/dist/tree-op-types-BUulYD5y.d.cts +0 -3099
- package/dist/tree-package-fragment-Dhyw7oPm.d.cts +0 -732
- package/dist/tree-session-contract-BY9xd7s_.d.cts +0 -613
- package/dist/tree-store-DEEQ9wz_.d.cts +0 -416
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ layout pass, and the paint step directly.
|
|
|
50
50
|
| `./store` | The canonical tree and its transactional store. |
|
|
51
51
|
| `./layout` | The DOM-free layout pass. |
|
|
52
52
|
| `./output` | Serialization. |
|
|
53
|
+
| `./export` | Reusable, DOM-free semantic layout sessions for Markdown, PDF, and future exporters. |
|
|
53
54
|
| `./automation` | The object model behind `@docx-editor.dev/editor-api`. |
|
|
54
55
|
| `./collaboration` | Provider-neutral collaboration session contracts. |
|
|
55
56
|
| `./collaboration/replication` | Replication helpers for collaboration providers. |
|
|
@@ -69,6 +70,47 @@ Nodes are typed where layout needs them and generic everywhere else, preserving
|
|
|
69
70
|
verbatim. Content the engine does not model is carried rather than dropped, so a document full
|
|
70
71
|
of unknown extensions still opens, edits, and saves.
|
|
71
72
|
|
|
73
|
+
Export sessions use the editor's reader-safe revision view by default: `all-markup` keeps both
|
|
74
|
+
halves of pending tracked changes visible. Pass `displayMode: 'proposed'` or
|
|
75
|
+
`displayMode: 'original'` explicitly when the exporter should present a resolved view instead.
|
|
76
|
+
|
|
77
|
+
### Building a physical-page exporter
|
|
78
|
+
|
|
79
|
+
Use the document-aware font composition root for Markdown, PDF, or any exporter whose page breaks
|
|
80
|
+
matter. `openDocumentForExport(bytes)` without a measurer intentionally uses deterministic
|
|
81
|
+
fixed-width approximation. `openFontBackedDocumentForExport` discovers the document's actual run,
|
|
82
|
+
style, header, footer, note, field, symbol, and equation families, then binds the resolved shaping
|
|
83
|
+
snapshot to the layout session.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { readFile } from 'node:fs/promises';
|
|
87
|
+
import { openFontBackedDocumentForExport } from '@docx-editor.dev/core/export';
|
|
88
|
+
import { packagedFonts } from '@docx-editor.dev/fonts';
|
|
89
|
+
|
|
90
|
+
const bytes = new Uint8Array(await readFile('contract.docx'));
|
|
91
|
+
const opened = await openFontBackedDocumentForExport(bytes, {
|
|
92
|
+
// First wins: put caller-supplied licensed fonts first, bundled metric substitutes next,
|
|
93
|
+
// and an optional network resolver last.
|
|
94
|
+
fonts: [callerFonts, packagedFonts({ install: false }), optionalNetworkFonts],
|
|
95
|
+
fontPolicy: 'strict',
|
|
96
|
+
onFontResolution: (report) => auditLogger.info(report),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (!opened.ok) throw new Error(`DOCX rejected: ${opened.reason}`);
|
|
100
|
+
try {
|
|
101
|
+
const layout = await opened.session.layout();
|
|
102
|
+
await writeExporterOutput(layout);
|
|
103
|
+
} finally {
|
|
104
|
+
opened.session.dispose(); // releases document-owned shaping bytes
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Keep font retrieval, substitution, cancellation, diagnostics, and memory ownership in this Core
|
|
109
|
+
lane. Format adapters should consume the resulting semantic pages; Markdown binds Core source
|
|
110
|
+
artifacts to string offsets, while PDF can bind the same artifacts to page rectangles. For a live
|
|
111
|
+
`HeadlessDocumentView`, pass the revision-stable measurer already used by its editor rather than
|
|
112
|
+
starting asynchronous document-specific font resolution against mutable state.
|
|
113
|
+
|
|
72
114
|
## Fidelity
|
|
73
115
|
|
|
74
116
|
Untouched content, unsupported OOXML, and package payloads survive editing and save. The
|
package/dist/automation.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkLGFKIF4M_cjs=require('./chunk-LGFKIF4M.cjs');require('./chunk-Q4AB7E4O.cjs');var chunk2YH4MSHX_cjs=require('./chunk-2YH4MSHX.cjs'),chunkYL4Q5LZP_cjs=require('./chunk-YL4Q5LZP.cjs'),chunk24APKZAN_cjs=require('./chunk-24APKZAN.cjs');var N=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),b=Object.freeze({kind:"body"});function U(t,e={}){let s=chunk24APKZAN_cjs.Wb(t,e.limits??{});if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let u=s.package.parts.get(s.package.mainDocumentPart);if(!u)return {ok:false,reason:"no-main-document-part",detail:s.package.mainDocumentPart};let m=new chunk2YH4MSHX_cjs.G(s.package,chunk24APKZAN_cjs.Cb(u)),f=e.collaborationModel?.session,l=()=>{},n=F(m,f,()=>l()),a=chunkLGFKIF4M_cjs.g({port:n,capabilities:N});return f&&(l=f.attach(chunkYL4Q5LZP_cjs.b(m,{documentId:f.documentId}))),{ok:true,host:a}}function W(t,e,s){let u=t.partFor(s);return u?chunk24APKZAN_cjs.xa(t,()=>{let m=chunk24APKZAN_cjs.Jd(t.currentPackage(),e,u.name);return m?(t.replacePackageShell(m.pkg),m.relationshipId):null},m=>m!==null):null}function F(t,e,s=()=>{}){let u=true,m=0,f=()=>e?(m+=1,{origin:e.identity.role==="agent"?chunk24APKZAN_cjs.b.mutationAgent:chunk24APKZAN_cjs.b.mutationHuman,actorId:e.identity.actorId,operationId:`${e.identity.actorId}:${e.sessionId}:automation:${m}`,recordsHistory:false}):{},l=n=>(e?.flushPendingJournals(),n);return {revision:()=>t.packageRevision,currentPackage:()=>u?t.currentPackage():null,apply(n,a=b){if(!u)return {ok:false,reason:"disposed"};let r=n(i=>chunk24APKZAN_cjs.Eb(e?.identity.actorId,()=>W(t,i,a)));if(r===null)return {ok:false,reason:"unsupported-target"};let p=e?.gateOperations(r,a);if(p)return {ok:false,reason:p};let o=e?t.partFor(a)?.name:void 0,d=t.transact(a,i=>{for(let A of r)i.apply(A);o&&i.applyPackage(A=>chunkYL4Q5LZP_cjs.a(A,o,r));},f());return d.ok?l({ok:true,changed:d.change!==null}):{ok:false,reason:d.detail?`${d.reason}: ${d.detail}`:d.reason}},applyLifecycle(n){if(!u)return {ok:false,reason:"disposed"};let a=e?.gateOperations([n],b);if(a)return {ok:false,reason:a};let r=chunk24APKZAN_cjs.Eb(e?.identity.actorId,()=>t.applyLifecycleOp(n));return r.ok?l({ok:true,changed:r.change!==null}):{ok:false,reason:r.detail?`${r.reason}: ${r.detail}`:r.reason}},applyCommentWrites(n,a){if(!u)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let r=e?.gateOperations([],a);if(r)return {ok:false,reason:r};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};if(p.store.graftPackage(()=>t.currentPackage()),n.every(i=>i.kind==="delete")){let i=n.find(k=>k.kind==="delete"),A=chunk24APKZAN_cjs.Eb(e?.identity.actorId,()=>chunk2YH4MSHX_cjs.T(t,n.flatMap(k=>k.kind==="delete"?[{commentId:k.commentId,...k.parentCommentId===void 0?{}:{parentCommentId:k.parentCommentId}}]:[]),a,i?.kind==="delete"?i.noteId:void 0));return A?l({ok:true,changed:A}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let o=n[0];if(o.kind==="create"||o.kind==="reply"){let i=chunk24APKZAN_cjs.Eb(e?.identity.actorId,()=>chunk2YH4MSHX_cjs.R(t,{anchor:o.anchor,author:o.author,text:o.text,...o.date===void 0?{}:{date:o.date},...o.kind==="reply"?{replyToCommentId:o.parentCommentId}:{}},a));return i.ok?l({ok:true,changed:true,..."commentId"in i?{commentId:i.commentId}:{}}):{ok:false,reason:i.reason}}if(o.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let d=chunk24APKZAN_cjs.Eb(e?.identity.actorId,()=>chunk2YH4MSHX_cjs.S(t,o.commentId,o.resolved));return d.ok?l({ok:true,changed:true}):{ok:false,reason:d.reason}},applyCustomNodeWrite(n,a){if(!u)return {ok:false,reason:"disposed"};let r=e?.gateOperations([],a);if(r)return {ok:false,reason:r};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};let o=chunk24APKZAN_cjs.Eb(e?.identity.actorId,()=>chunk2YH4MSHX_cjs.$(t,n,a));return o.ok?l({ok:true,changed:o.change!==null}):{ok:false,reason:o.detail?`${o.reason}: ${o.detail}`:o.reason}},save:()=>u?chunk24APKZAN_cjs.Xb(t.currentPackage()):null,subscribe:n=>t.subscribe(()=>n()),dispose(){s(),u=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkLGFKIF4M_cjs.c}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkLGFKIF4M_cjs.b}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkLGFKIF4M_cjs.d}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkLGFKIF4M_cjs.a}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkLGFKIF4M_cjs.f}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkLGFKIF4M_cjs.e}});exports.SERVER_AUTOMATION_CAPABILITIES=N;exports.createServerAutomationHost=U;
|
package/dist/automation.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { A as AutomationCapabilities, a as AutomationHost } from './protocol-
|
|
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-
|
|
3
|
-
import { H as HeaderFooterVariant } from './
|
|
4
|
-
import { N as NoteKind } from './tree-store-
|
|
5
|
-
import {
|
|
1
|
+
import { A as AutomationCapabilities, a as AutomationHost } from './protocol-DZzKxH5r.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-DZzKxH5r.js';
|
|
3
|
+
import { H as HeaderFooterVariant } from './hf-references-DTrHkktY.js';
|
|
4
|
+
import { N as NoteKind } from './tree-store-DKJB0IcA.js';
|
|
5
|
+
import { f as OoxmlPackageLimits, g as OoxmlPackageRejection } from './tree-op-types-egdarvH_.js';
|
|
6
6
|
import { CollaborationModuleContribution } from './collaboration.js';
|
|
7
7
|
import './contracts/types.js';
|
|
8
|
+
import './tree-package-fragment-DjkH4ESI.js';
|
|
8
9
|
import './collaboration/replication.js';
|
|
9
10
|
import './failure-BnGjoXf0.js';
|
|
10
11
|
|
package/dist/automation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g}from'./chunk-
|
|
1
|
+
import {g}from'./chunk-5Y7AADI6.js';export{c as AUTOMATION_COMMAND_OPERATIONS,b as AUTOMATION_QUERY_OPERATIONS,d as AUTOMATION_SOLITARY_OPERATIONS,a as HEADER_FOOTER_VARIANTS,f as isAutomationCommand,e as isSolitaryAutomationCommand}from'./chunk-5Y7AADI6.js';import'./chunk-QJYH6AYD.js';import {G,$,T,R,S}from'./chunk-KFELX7CN.js';import {b as b$1,a}from'./chunk-KXPVOPR5.js';import {Wb,Cb,Xb,Eb,xa,Jd,b as b$2}from'./chunk-AREFLNUP.js';var N=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),b=Object.freeze({kind:"body"});function U(t,e={}){let s=Wb(t,e.limits??{});if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let u=s.package.parts.get(s.package.mainDocumentPart);if(!u)return {ok:false,reason:"no-main-document-part",detail:s.package.mainDocumentPart};let m=new G(s.package,Cb(u)),f=e.collaborationModel?.session,l=()=>{},n=F(m,f,()=>l()),a=g({port:n,capabilities:N});return f&&(l=f.attach(b$1(m,{documentId:f.documentId}))),{ok:true,host:a}}function W(t,e,s){let u=t.partFor(s);return u?xa(t,()=>{let m=Jd(t.currentPackage(),e,u.name);return m?(t.replacePackageShell(m.pkg),m.relationshipId):null},m=>m!==null):null}function F(t,e,s=()=>{}){let u=true,m=0,f=()=>e?(m+=1,{origin:e.identity.role==="agent"?b$2.mutationAgent:b$2.mutationHuman,actorId:e.identity.actorId,operationId:`${e.identity.actorId}:${e.sessionId}:automation:${m}`,recordsHistory:false}):{},l=n=>(e?.flushPendingJournals(),n);return {revision:()=>t.packageRevision,currentPackage:()=>u?t.currentPackage():null,apply(n,a$1=b){if(!u)return {ok:false,reason:"disposed"};let r=n(i=>Eb(e?.identity.actorId,()=>W(t,i,a$1)));if(r===null)return {ok:false,reason:"unsupported-target"};let p=e?.gateOperations(r,a$1);if(p)return {ok:false,reason:p};let o=e?t.partFor(a$1)?.name:void 0,d=t.transact(a$1,i=>{for(let A of r)i.apply(A);o&&i.applyPackage(A=>a(A,o,r));},f());return d.ok?l({ok:true,changed:d.change!==null}):{ok:false,reason:d.detail?`${d.reason}: ${d.detail}`:d.reason}},applyLifecycle(n){if(!u)return {ok:false,reason:"disposed"};let a=e?.gateOperations([n],b);if(a)return {ok:false,reason:a};let r=Eb(e?.identity.actorId,()=>t.applyLifecycleOp(n));return r.ok?l({ok:true,changed:r.change!==null}):{ok:false,reason:r.detail?`${r.reason}: ${r.detail}`:r.reason}},applyCommentWrites(n,a){if(!u)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let r=e?.gateOperations([],a);if(r)return {ok:false,reason:r};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};if(p.store.graftPackage(()=>t.currentPackage()),n.every(i=>i.kind==="delete")){let i=n.find(k=>k.kind==="delete"),A=Eb(e?.identity.actorId,()=>T(t,n.flatMap(k=>k.kind==="delete"?[{commentId:k.commentId,...k.parentCommentId===void 0?{}:{parentCommentId:k.parentCommentId}}]:[]),a,i?.kind==="delete"?i.noteId:void 0));return A?l({ok:true,changed:A}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let o=n[0];if(o.kind==="create"||o.kind==="reply"){let i=Eb(e?.identity.actorId,()=>R(t,{anchor:o.anchor,author:o.author,text:o.text,...o.date===void 0?{}:{date:o.date},...o.kind==="reply"?{replyToCommentId:o.parentCommentId}:{}},a));return i.ok?l({ok:true,changed:true,..."commentId"in i?{commentId:i.commentId}:{}}):{ok:false,reason:i.reason}}if(o.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let d=Eb(e?.identity.actorId,()=>S(t,o.commentId,o.resolved));return d.ok?l({ok:true,changed:true}):{ok:false,reason:d.reason}},applyCustomNodeWrite(n,a){if(!u)return {ok:false,reason:"disposed"};let r=e?.gateOperations([],a);if(r)return {ok:false,reason:r};let p=t.resolveStory(a);if(!p.ok)return {ok:false,reason:p.reason};let o=Eb(e?.identity.actorId,()=>$(t,n,a));return o.ok?l({ok:true,changed:o.change!==null}):{ok:false,reason:o.detail?`${o.reason}: ${o.detail}`:o.reason}},save:()=>u?Xb(t.currentPackage()):null,subscribe:n=>t.subscribe(()=>n()),dispose(){s(),u=false;}}}export{N as SERVER_AUTOMATION_CAPABILITIES,U as createServerAutomationHost};
|
package/dist/binding.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCDYVDQRI_cjs=require('./chunk-CDYVDQRI.cjs');require('./chunk-PMHGONET.cjs'),require('./chunk-FGBADUSK.cjs'),require('./chunk-PXKZUTHX.cjs'),require('./chunk-Q4AB7E4O.cjs'),require('./chunk-2YH4MSHX.cjs'),require('./chunk-YL4Q5LZP.cjs'),require('./chunk-24APKZAN.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkCDYVDQRI_cjs.e}});
|
package/dist/binding.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { Node, Schema } from 'prosemirror-model';
|
|
2
|
-
import {
|
|
3
|
-
import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-
|
|
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-
|
|
2
|
+
import { q as OoxmlProperty, g as OoxmlPackageRejection } from './tree-op-types-egdarvH_.js';
|
|
3
|
+
import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-CGOOgPjW.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-CGOOgPjW.js';
|
|
5
5
|
import { ReviewModuleContribution } from './contracts/modules.js';
|
|
6
|
-
export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-
|
|
6
|
+
export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-DjkH4ESI.js';
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
8
8
|
import './contracts/types.js';
|
|
9
|
-
import './
|
|
10
|
-
import './
|
|
11
|
-
import './
|
|
12
|
-
import './
|
|
9
|
+
import './hf-references-DTrHkktY.js';
|
|
10
|
+
import './custom-node-writes-C9ArIlJh.js';
|
|
11
|
+
import './tree-store-DKJB0IcA.js';
|
|
12
|
+
import './headless-document-view-DELC4E5v.js';
|
|
13
|
+
import './review-items-DYRx187i.js';
|
|
13
14
|
import './collaboration/replication.js';
|
|
14
|
-
import './
|
|
15
|
+
import './editor-sRxrFJd8.js';
|
|
16
|
+
import './contracts/document.js';
|
|
17
|
+
import './semantic-interaction-DZsDmPg5.js';
|
|
18
|
+
import './semantic-records-EIdwId-a.js';
|
|
19
|
+
import './revision-projection-DHRJH48u.js';
|
|
20
|
+
import './omml-equation-BpRmfDAf.js';
|
|
15
21
|
import './failure-BnGjoXf0.js';
|
|
16
|
-
import './
|
|
22
|
+
import './collaboration.js';
|
|
17
23
|
|
|
18
24
|
/** Attributes carried by a projected paragraph. */
|
|
19
25
|
interface ParagraphAttrs {
|
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-
|
|
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-Z4527AXR.js';import'./chunk-M52QXFKI.js';import'./chunk-VP7SDFCM.js';import'./chunk-PBOIGBDO.js';import'./chunk-QJYH6AYD.js';import'./chunk-KFELX7CN.js';import'./chunk-KXPVOPR5.js';import'./chunk-AREFLNUP.js';
|