@docx-editor.dev/core 2.21.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.
- package/README.md +31 -31
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +10 -10
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +8 -8
- package/dist/binding.js +1 -1
- package/dist/chunk-25OQBAKA.js +2 -0
- package/dist/chunk-3B3DQMSL.js +11 -0
- package/dist/chunk-3P3DNJYM.js +5 -0
- package/dist/chunk-3PA64KPK.js +5 -0
- package/dist/{chunk-4EHMMSFR.cjs → chunk-4TYA4RLP.cjs} +1 -1
- package/dist/chunk-7N77EN2Z.cjs +2 -0
- package/dist/{chunk-TE43S3LX.cjs → chunk-AGWWNVIJ.cjs} +1 -1
- package/dist/{chunk-Q2B6HX3R.js → chunk-BF2TOG2V.js} +1 -1
- package/dist/chunk-DFTVN25X.cjs +5 -0
- package/dist/{chunk-BQXF2PFF.js → chunk-DGONGMAV.js} +1 -1
- package/dist/{chunk-BDAY2ETZ.js → chunk-DZYKU2HG.js} +1 -1
- package/dist/chunk-E5OUYRNM.cjs +5 -0
- package/dist/{chunk-S35UK656.cjs → chunk-F4H3LC6M.cjs} +1 -1
- package/dist/{chunk-X5QNSISI.js → chunk-FPDIJ4RF.js} +1 -1
- package/dist/chunk-IUTTOBQW.cjs +20 -0
- package/dist/{chunk-WQFNWLNY.cjs → chunk-IYCXQAFT.cjs} +2 -2
- package/dist/chunk-JL3SI5SZ.js +18 -0
- package/dist/chunk-OFWUHH52.js +20 -0
- package/dist/chunk-OKY6JRJL.js +4 -0
- package/dist/{chunk-XZY4Q6PJ.cjs → chunk-P24FHMQW.cjs} +1 -1
- package/dist/chunk-QBKAOSVF.cjs +18 -0
- package/dist/{chunk-PYXMAUNR.cjs → chunk-RA2TDTEQ.cjs} +1 -1
- package/dist/{chunk-Z2ETEZRU.cjs → chunk-T5B4NMKF.cjs} +1 -1
- package/dist/{chunk-VUNFWXHF.js → chunk-U5GUJKTS.js} +1 -1
- package/dist/chunk-XRYSPKKC.js +1 -0
- package/dist/chunk-ZZRCVDQU.cjs +11 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -4
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +3 -3
- package/dist/contracts/document.d.ts +2 -2
- package/dist/contracts/editor.d.ts +8 -8
- package/dist/contracts/modules.d.ts +6 -6
- package/dist/contracts/types.d.ts +1 -1
- package/dist/{custom-node-writes-05qS32px.d.ts → custom-node-writes-CncR6KfC.d.ts} +2 -2
- package/dist/{document-protection-Cr59VKLO.d.ts → document-protection-DM6mA8Rf.d.ts} +1 -1
- package/dist/{editor-BsLSz_7y.d.ts → editor-BRh7GuZF.d.ts} +10 -6
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -1
- package/dist/editor.d.ts +25 -25
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +12 -12
- package/dist/export.js +1 -1
- package/dist/{font-resolver-CzwdBJDE.d.ts → font-resolver-DwuQYj3P.d.ts} +1 -1
- package/dist/{headless-document-view-B7nAiR7P.d.ts → headless-document-view-C3fc_jV0.d.ts} +2 -2
- package/dist/{image-resources-C4ilLzog.d.ts → image-resources-DxF-SN_8.d.ts} +1 -1
- package/dist/{index-zkvqBQ9o.d.ts → index-3pNnG4z4.d.ts} +19 -18
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-BJKVTI6i.d.ts → layout-shaping-_GGjhhVc.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +19 -17
- package/dist/layout.js +1 -1
- package/dist/{note-properties-MNztEj5s.d.ts → note-properties-CjT31AuP.d.ts} +1 -1
- package/dist/{omml-equation-CbnW9yXd.d.ts → omml-equation-Bk3OP1fv.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +7 -7
- package/dist/output.js +1 -1
- package/dist/{protocol-Co_r0SZQ.d.ts → protocol-CrbTIW2Z.d.ts} +2 -2
- package/dist/{review-paragraph-order-EFaU7TqH.d.ts → review-paragraph-order-D3KZohIL.d.ts} +1 -1
- package/dist/{revision-projection-DEIvpxiq.d.ts → revision-projection-kVd7p6Wd.d.ts} +1 -1
- package/dist/{semantic-cell-selection-DXmfnDCw.d.ts → semantic-cell-selection-CkSsZHDL.d.ts} +6 -4
- package/dist/{semantic-interaction-BLu3M6Nn.d.ts → semantic-interaction-Z2Xa68U5.d.ts} +1 -1
- package/dist/{semantic-paint-CPsihA6k.d.ts → semantic-paint-BHKprI9P.d.ts} +2 -2
- package/dist/{semantic-records-CqD0b5Ex.d.ts → semantic-records-StH-AnHK.d.ts} +11 -8
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +19 -25
- package/dist/store.js +1 -1
- package/dist/{tree-package-fragment-CwJDixNs.d.ts → tree-package-fragment-CpEV1gl3.d.ts} +2 -2
- package/dist/{tree-session-contract-D9RRWE0C.d.ts → tree-session-contract-CTT9nM7Z.d.ts} +10 -5
- package/dist/{types-barrel-DLB11iSY.d.ts → types-barrel-PwcfEkaX.d.ts} +8 -4
- package/package.json +2 -2
- package/dist/chunk-44LQJIKH.cjs +0 -20
- package/dist/chunk-AFG7Q622.cjs +0 -2
- package/dist/chunk-AYMSP25Q.js +0 -4
- package/dist/chunk-B4KZSKF7.cjs +0 -5
- package/dist/chunk-BNZF6DYC.cjs +0 -18
- package/dist/chunk-GIHKVXEO.js +0 -2
- package/dist/chunk-ITNK6C5M.cjs +0 -3
- package/dist/chunk-MP3K4LC5.js +0 -1
- package/dist/chunk-MXOO7KRI.cjs +0 -11
- package/dist/chunk-NG6IQ4SI.js +0 -11
- package/dist/chunk-Q5JPPUNR.js +0 -5
- package/dist/chunk-VH2DLEZK.js +0 -20
- package/dist/chunk-WZX4UGRQ.js +0 -3
- package/dist/chunk-XS4FOHH6.js +0 -18
package/README.md
CHANGED
|
@@ -15,16 +15,18 @@
|
|
|
15
15
|
|
|
16
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.
|
|
17
17
|
|
|
18
|
-
|
|
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.
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npm install @docx-editor.dev/core
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Node
|
|
24
|
+
Node.js requires `^20.16.0 || >=22.3.0`.
|
|
25
25
|
|
|
26
26
|
## Entry points
|
|
27
27
|
|
|
28
|
+
Import editor creation, font helpers, and contract types from the package root:
|
|
29
|
+
|
|
28
30
|
```ts
|
|
29
31
|
import { createDocxEditor, loadFonts, WORD_DEFAULT_FONT } from '@docx-editor.dev/core';
|
|
30
32
|
import type { Editor, EditorSnapshot } from '@docx-editor.dev/core';
|
|
@@ -32,39 +34,39 @@ import type { Editor, EditorSnapshot } from '@docx-editor.dev/core';
|
|
|
32
34
|
|
|
33
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.
|
|
34
36
|
|
|
35
|
-
| Subpath
|
|
36
|
-
|
|
|
37
|
-
| `.`
|
|
38
|
-
| `./editor`
|
|
39
|
-
| `./contracts/editor`
|
|
40
|
-
| `./contracts/document`
|
|
41
|
-
| `./contracts/interaction`
|
|
42
|
-
| `./contracts/types`
|
|
43
|
-
| `./contracts/modules`
|
|
44
|
-
| `./store`
|
|
45
|
-
| `./layout`
|
|
46
|
-
| `./output`
|
|
47
|
-
| `./export`
|
|
48
|
-
| `./automation`
|
|
49
|
-
| `./collaboration`
|
|
50
|
-
| `./collaboration/replication` | Replication helpers for collaboration providers.
|
|
51
|
-
| `./styles/editor.css`
|
|
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. |
|
|
52
54
|
|
|
53
55
|
## Architecture
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
bytes → bounded OPC/XML read → canonical OOXML tree → layout → painted pages → serialize
|
|
57
|
-
```
|
|
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.
|
|
58
58
|
|
|
59
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.
|
|
60
60
|
|
|
61
|
-
Nodes are typed where layout needs them and generic everywhere else, preserving the element
|
|
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.
|
|
62
62
|
|
|
63
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.
|
|
64
64
|
|
|
65
65
|
### Build a paginated exporter
|
|
66
66
|
|
|
67
|
-
For exports that need
|
|
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:
|
|
68
70
|
|
|
69
71
|
```ts
|
|
70
72
|
import { readFile } from 'node:fs/promises';
|
|
@@ -73,23 +75,21 @@ import { packagedFonts } from '@docx-editor.dev/fonts';
|
|
|
73
75
|
|
|
74
76
|
const bytes = new Uint8Array(await readFile('contract.docx'));
|
|
75
77
|
const opened = await openFontBackedDocumentForExport(bytes, {
|
|
76
|
-
|
|
77
|
-
// and an optional network resolver last.
|
|
78
|
-
fonts: [callerFonts, packagedFonts(), optionalNetworkFonts],
|
|
78
|
+
fonts: packagedFonts(),
|
|
79
79
|
fontPolicy: 'strict',
|
|
80
|
-
onFontResolution: (report) =>
|
|
80
|
+
onFontResolution: (report) => console.info(report),
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
if (!opened.ok) throw new Error(`DOCX rejected: ${opened.reason}`);
|
|
84
84
|
try {
|
|
85
85
|
const layout = await opened.session.layout();
|
|
86
|
-
|
|
86
|
+
console.log(layout); // Replace this with your exporter.
|
|
87
87
|
} finally {
|
|
88
88
|
opened.session.dispose(); // releases document-owned shaping bytes
|
|
89
89
|
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
Let
|
|
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.
|
|
93
93
|
|
|
94
94
|
## Fidelity
|
|
95
95
|
|
|
@@ -97,7 +97,7 @@ Untouched content, unsupported OOXML, and package payloads survive editing and s
|
|
|
97
97
|
|
|
98
98
|
## Untrusted input
|
|
99
99
|
|
|
100
|
-
|
|
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.
|
|
101
101
|
|
|
102
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.
|
|
103
103
|
|
package/dist/automation.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
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;
|
package/dist/automation.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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, N as NoteKind } from './tree-package-fragment-
|
|
4
|
-
import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-
|
|
5
|
-
import { H as HeadlessDocumentView } from './headless-document-view-
|
|
6
|
-
import { X as OoxmlPackageLimits, Y as OoxmlPackageRejection } from './types-barrel-
|
|
7
|
-
export { Z as RevisionBatchEntry, _ as RevisionBatchResult, $ as RevisionBatchSkipReason } from './types-barrel-
|
|
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-
|
|
10
|
-
import './revision-projection-
|
|
11
|
-
import './omml-equation-
|
|
9
|
+
import './image-resources-DxF-SN_8.js';
|
|
10
|
+
import './revision-projection-kVd7p6Wd.js';
|
|
11
|
+
import './omml-equation-Bk3OP1fv.js';
|
|
12
12
|
import './editor-scope-OHPwVQ5l.js';
|
|
13
13
|
import './collaboration/replication.js';
|
|
14
14
|
import './failure-DNNmwsgD.js';
|
package/dist/automation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {k,e,b as b$1}from'./chunk-
|
|
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
|
|
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-
|
|
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 { 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 './tree-package-fragment-
|
|
6
|
+
export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-CpEV1gl3.js';
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
8
8
|
import './editor-scope-OHPwVQ5l.js';
|
|
9
|
-
import './image-resources-
|
|
10
|
-
import './custom-node-writes-
|
|
11
|
-
import './headless-document-view-
|
|
9
|
+
import './image-resources-DxF-SN_8.js';
|
|
10
|
+
import './custom-node-writes-CncR6KfC.js';
|
|
11
|
+
import './headless-document-view-C3fc_jV0.js';
|
|
12
12
|
import './collaboration/replication.js';
|
|
13
|
-
import './revision-projection-
|
|
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-
|
|
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';
|