@docx-editor.dev/core 2.25.0 → 2.26.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 +9 -3
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +20 -9
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.js +1 -1
- package/dist/chunk-2BK4G4ZN.js +2 -0
- package/dist/chunk-2SJX44PC.cjs +2 -0
- package/dist/chunk-5BIASAN3.js +1 -0
- package/dist/{chunk-WVJRO4WY.js → chunk-6SEIXJTX.js} +1 -1
- package/dist/chunk-73PG6L2X.js +1 -0
- package/dist/chunk-7RJSH72J.cjs +5 -0
- package/dist/chunk-AGKIHLWQ.cjs +1 -0
- package/dist/chunk-AN6WM4X4.js +2 -0
- package/dist/chunk-ANZ44KQT.cjs +12 -0
- package/dist/chunk-CYT3OQFZ.cjs +1 -0
- package/dist/chunk-DDGGSBAN.js +12 -0
- package/dist/chunk-EEAV3WIN.js +3 -0
- package/dist/{chunk-MEF2AK5L.cjs → chunk-ELQFXMJ5.cjs} +1 -1
- package/dist/chunk-EYK4K2J6.js +1 -0
- package/dist/chunk-JNTETUNZ.cjs +1 -0
- package/dist/chunk-L6V3IJ3S.js +5 -0
- package/dist/chunk-LWCI65EL.js +1 -0
- package/dist/chunk-LZDI4P6I.cjs +1 -0
- package/dist/chunk-NS22DVWT.cjs +2 -0
- package/dist/chunk-QIE3YTU4.cjs +2 -0
- package/dist/chunk-QVBFPAGO.js +5 -0
- package/dist/chunk-RCCOLZEQ.js +2 -0
- package/dist/chunk-SUN62YU6.cjs +5 -0
- package/dist/chunk-TKR2MXX4.cjs +3 -0
- package/dist/chunk-UJL2GDIM.cjs +25 -0
- package/dist/chunk-WQTADNHK.cjs +27 -0
- package/dist/chunk-XSHXBJ2J.js +25 -0
- package/dist/chunk-YXZEBTDF.js +27 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.js +1 -1
- package/dist/contracts/editor.d.ts +3 -3
- package/dist/{editor-DkfCCTxA.d.ts → editor-DYUlyKmb.d.ts} +1 -1
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +14 -2
- package/dist/editor.d.ts +13 -13
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +5 -5
- package/dist/export.js +2 -2
- package/dist/{font-resolver-C295obND.d.ts → font-resolver-u_nE0PI1.d.ts} +5 -3
- package/dist/{index-3KAxeSic.d.ts → index-Docw8Dcb.d.ts} +6 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-C889tgmj.d.ts → layout-shaping-DWitwY73.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +89 -23
- package/dist/layout.js +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +3 -3
- package/dist/output.js +1 -1
- package/dist/{protocol-BhmenALD.d.ts → protocol-DniKeDb8.d.ts} +28 -1
- package/dist/{review-paragraph-order-BwhRT264.d.ts → review-paragraph-order-Dc8Q6tfM.d.ts} +5 -1
- package/dist/{semantic-cell-selection-CC3NwCtx.d.ts → semantic-cell-selection-Dy_BmmpL.d.ts} +23 -5
- package/dist/{semantic-interaction-BHlV61hK.d.ts → semantic-interaction-CvFAj0GR.d.ts} +1 -1
- package/dist/{semantic-paint-DfWIWUs6.d.ts → semantic-paint-Bk9wIXdZ.d.ts} +1 -1
- package/dist/{semantic-records-DrExlBy-.d.ts → semantic-records-COqi8pjP.d.ts} +77 -70
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +57 -5
- package/dist/store.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-3RMHRNDA.cjs +0 -1
- package/dist/chunk-42N7OV3G.cjs +0 -1
- package/dist/chunk-47ZJEEBT.js +0 -2
- package/dist/chunk-4B3SXBV6.js +0 -4
- package/dist/chunk-5MWFZ7F4.cjs +0 -11
- package/dist/chunk-AS2OC6J4.cjs +0 -26
- package/dist/chunk-B7SYEMZ7.cjs +0 -1
- package/dist/chunk-BME2KUNL.cjs +0 -1
- package/dist/chunk-CDGVVEUK.js +0 -26
- package/dist/chunk-E4RAPI5J.cjs +0 -2
- package/dist/chunk-FZJTQPH4.js +0 -2
- package/dist/chunk-H7XMRUAO.cjs +0 -5
- package/dist/chunk-ILUE2SI5.js +0 -1
- package/dist/chunk-IZT3C23R.js +0 -1
- package/dist/chunk-KJLPVGSX.cjs +0 -4
- package/dist/chunk-LF5LPZOP.cjs +0 -18
- package/dist/chunk-N5WE5O5Q.js +0 -1
- package/dist/chunk-OVDW4XQD.cjs +0 -2
- package/dist/chunk-SNN53UPD.js +0 -1
- package/dist/chunk-V7LBEUVW.js +0 -5
- package/dist/chunk-VE7YBFQD.js +0 -5
- package/dist/chunk-VOVDX7GW.js +0 -18
- package/dist/chunk-VQ33XGNP.cjs +0 -5
- package/dist/chunk-XUJINXW6.js +0 -1
- package/dist/chunk-Y3TPAITU.cjs +0 -1
- package/dist/chunk-Z65JJLLF.js +0 -11
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.docx-editor.dev/">
|
|
3
|
-
<
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/readme-logo-dark.svg" />
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/readme-logo-light.svg" />
|
|
6
|
+
<img src="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/readme-logo-light.svg" alt="DOCX Editor by EigenPal" width="320" height="90" />
|
|
7
|
+
</picture>
|
|
4
8
|
</a>
|
|
5
9
|
</p>
|
|
6
10
|
|
|
@@ -35,10 +39,12 @@ Node.js requires `^20.16.0 || >=22.3.0`.
|
|
|
35
39
|
Import editor creation, font helpers, and contract types from the package root:
|
|
36
40
|
|
|
37
41
|
```ts
|
|
38
|
-
import { createDocxEditor, loadFonts,
|
|
42
|
+
import { createDocxEditor, loadFonts, DEFAULT_FONT } from '@docx-editor.dev/core';
|
|
39
43
|
import type { Editor, EditorSnapshot } from '@docx-editor.dev/core';
|
|
40
44
|
```
|
|
41
45
|
|
|
46
|
+
`DEFAULT_FONT` provides the default font configuration: Calibri at 11 points. `WORD_DEFAULT_FONT` is its deprecated alias. Document formatting and document-default rules determine the text size used for layout. Missing defaults and explicitly empty defaults can produce different results.
|
|
47
|
+
|
|
42
48
|
The root exports editor creation, contracts, font helpers, control definitions, and document types. Use subpaths to access storage, layout, and rendering.
|
|
43
49
|
|
|
44
50
|
| Subpath | Exports |
|
|
@@ -112,7 +118,7 @@ Anything you render from document data (a font name, a hyperlink target, a comme
|
|
|
112
118
|
|
|
113
119
|
- [Core overview](https://www.docx-editor.dev/docs/2.x/core)
|
|
114
120
|
- [Architecture](https://www.docx-editor.dev/docs/2.x/core/architecture)
|
|
115
|
-
- [
|
|
121
|
+
- [Feature support and fidelity](https://www.docx-editor.dev/docs/2.x/word-fidelity)
|
|
116
122
|
|
|
117
123
|
## License
|
|
118
124
|
|
package/dist/automation.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk2SJX44PC_cjs=require('./chunk-2SJX44PC.cjs');require('./chunk-JNTETUNZ.cjs'),require('./chunk-UJL2GDIM.cjs'),require('./chunk-QIE3YTU4.cjs'),require('./chunk-CYT3OQFZ.cjs');var chunkSUN62YU6_cjs=require('./chunk-SUN62YU6.cjs'),chunkELQFXMJ5_cjs=require('./chunk-ELQFXMJ5.cjs'),chunkANZ44KQT_cjs=require('./chunk-ANZ44KQT.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=chunkANZ44KQT_cjs.le(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 chunkSUN62YU6_cjs.X(m.package,chunkSUN62YU6_cjs.Xa(m.package,chunkANZ44KQT_cjs.qb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(chunkSUN62YU6_cjs.bb(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=chunk2SJX44PC_cjs.g(u.currentPackage()).story(f);return s?chunk2SJX44PC_cjs.d(i,s.part,a,d):null};}let r=chunk2SJX44PC_cjs.m({port:n,capabilities:j});return y&&(c=y.attach(chunkELQFXMJ5_cjs.b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?chunkANZ44KQT_cjs.Fa(o,()=>{let u=chunkANZ44KQT_cjs.lg(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"?chunkANZ44KQT_cjs.b.mutationAgent:chunkANZ44KQT_cjs.b.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>chunkANZ44KQT_cjs.tb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>chunkELQFXMJ5_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=chunkANZ44KQT_cjs.tb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=chunkANZ44KQT_cjs.tb(t?.identity.actorId,()=>chunkSUN62YU6_cjs.ia(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=chunkANZ44KQT_cjs.tb(t?.identity.actorId,()=>chunkSUN62YU6_cjs.ga(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=chunkANZ44KQT_cjs.tb(t?.identity.actorId,()=>chunkSUN62YU6_cjs.ha(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=chunkANZ44KQT_cjs.tb(t?.identity.actorId,()=>chunkSUN62YU6_cjs.qa(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?chunkANZ44KQT_cjs.me(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.i}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.h}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.j}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.f}});Object.defineProperty(exports,"createAutomationPaginationProvider",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.e}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.l}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.k}});Object.defineProperty(exports,"paginationSnapshotOf",{enumerable:true,get:function(){return chunk2SJX44PC_cjs.c}});exports.SERVER_AUTOMATION_CAPABILITIES=j;exports.createServerAutomationHost=Y;
|
package/dist/automation.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AutomationOperation, a as AutomationCapabilities, b as AutomationHost } from './protocol-
|
|
2
|
-
export { c as AutomationAlignment, d as AutomationBatchRequest, e as AutomationBatchResponse, f as AutomationChangeEvent, g as AutomationContentControlLock, h as AutomationContentControlRangeLocation, i as AutomationContentControlScope, j as AutomationContentControlSubtype, k as AutomationContentControlValue, l as AutomationError, m as AutomationErrorCode, n as AutomationFontRead, o as AutomationFontWrite, p as AutomationHandle, q as AutomationHandleRef, r as AutomationObjectKind, s as AutomationOperationKind, t as AutomationOperationResult, u as AutomationPageOrientation, v as AutomationPageSetupRead, w as AutomationPageSetupWrite, x as AutomationParagraphFormatRead, y as AutomationParagraphFormatWrite, z as AutomationParagraphRef, B as AutomationPoint, C as AutomationSaveResult, D as AutomationSearchOptions, E as AutomationSelectionMode, F as AutomationSpan, G as AutomationSpanRef, H as AutomationTextProjection, I as AutomationUnsubscribe, J as AutomationValue } from './protocol-
|
|
1
|
+
import { A as AutomationOperation, a as AutomationCapabilities, b as AutomationHost } from './protocol-DniKeDb8.js';
|
|
2
|
+
export { c as AutomationAlignment, d as AutomationBatchRequest, e as AutomationBatchResponse, f as AutomationChangeEvent, g as AutomationContentControlLock, h as AutomationContentControlRangeLocation, i as AutomationContentControlScope, j as AutomationContentControlSubtype, k as AutomationContentControlValue, l as AutomationError, m as AutomationErrorCode, n as AutomationFontRead, o as AutomationFontWrite, p as AutomationHandle, q as AutomationHandleRef, r as AutomationObjectKind, s as AutomationOperationKind, t as AutomationOperationResult, u as AutomationPageOrientation, v as AutomationPageSetupRead, w as AutomationPageSetupWrite, x as AutomationParagraphFormatRead, y as AutomationParagraphFormatWrite, z as AutomationParagraphRef, B as AutomationPoint, C as AutomationSaveResult, D as AutomationSearchOptions, E as AutomationSelectionMode, F as AutomationSpan, G as AutomationSpanRef, H as AutomationTextProjection, I as AutomationUnsubscribe, J as AutomationValue } from './protocol-DniKeDb8.js';
|
|
3
3
|
import { e as HeaderFooterVariant, N as NoteKind } from './tree-package-fragment-YPyYC1aD.js';
|
|
4
|
-
import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-
|
|
4
|
+
import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-COqi8pjP.js';
|
|
5
5
|
import { H as HeadlessDocumentView } from './headless-document-view-R9bzzepb.js';
|
|
6
6
|
import { a1 as OoxmlPackageLimits, Y as OoxmlPackageRejection } from './types-barrel-BO73JqHG.js';
|
|
7
7
|
export { a2 as RevisionBatchEntry, a3 as RevisionBatchResult, a4 as RevisionBatchSkipReason } from './types-barrel-BO73JqHG.js';
|
|
@@ -23,21 +23,32 @@ declare const HEADER_FOOTER_VARIANTS: readonly HeaderFooterVariant[];
|
|
|
23
23
|
* that is how a caller thinks about it and because a section inheriting its predecessor's header
|
|
24
24
|
* has no relationship of its own to name.
|
|
25
25
|
*/
|
|
26
|
-
type AutomationStoryId = {
|
|
26
|
+
type AutomationStoryId = AutomationShapeOwnerStory | {
|
|
27
|
+
readonly kind: 'note';
|
|
28
|
+
readonly noteKind: NoteKind;
|
|
29
|
+
readonly noteId: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A text box: the `w:txbxContent` of the floating shape whose `wp:docPr/@id` is `shapeId`,
|
|
33
|
+
* anchored in `owner`. Its paragraphs live in the owner's part and commit through its scope.
|
|
34
|
+
*/
|
|
35
|
+
| {
|
|
36
|
+
readonly kind: 'textbox';
|
|
37
|
+
readonly owner: AutomationShapeOwnerStory;
|
|
38
|
+
readonly shapeId: number;
|
|
39
|
+
};
|
|
40
|
+
/** A story that can anchor shapes: the main body, or one header/footer variant of a section. */
|
|
41
|
+
type AutomationShapeOwnerStory = {
|
|
27
42
|
readonly kind: 'body';
|
|
28
43
|
} | {
|
|
29
44
|
readonly kind: 'header' | 'footer';
|
|
30
45
|
/** Position of the section in the document, from zero. */
|
|
31
46
|
readonly sectionIndex: number;
|
|
32
47
|
readonly variant: HeaderFooterVariant;
|
|
33
|
-
} | {
|
|
34
|
-
readonly kind: 'note';
|
|
35
|
-
readonly noteKind: NoteKind;
|
|
36
|
-
readonly noteId: number;
|
|
37
48
|
};
|
|
38
49
|
|
|
39
50
|
/** Operations that read. They never open a transaction. */
|
|
40
|
-
declare const AUTOMATION_QUERY_OPERATIONS: readonly ["getTables", "getTable", "getTableRows", "getTableCells", "getTableCell", "getTableCellProperties", "getTableCellBody", "getFields", "getField", "getInlinePictures", "getInlinePicture", "getChangeTrackingMode", "getDocument", "getDocumentProperty", "getBody", "getParagraphs", "getRange", "getSpanParagraphs", "getText", "getSpanText", "getParagraphId", "search", "getFont", "getParagraphFormat", "getStyle", "getSections", "getPageSetup", "getFurniture", "getNotes", "getNoteBody", "getNoteText", "getNoteKind", "getLists", "getListId", "getListById", "getListParagraphs", "getParagraphList", "getListLevel", "getHyperlink", "getBookmarks", "getBookmarkName", "getBookmarkRange", "getComments", "getCommentReplies", "getCommentId", "getCommentAuthor", "getCommentDate", "getCommentText", "getCommentRange", "getCommentResolved", "getRevisions", "getRevisionType", "getRevisionAuthor", "getRevisionDate", "getRevisionRange", "getContentControls", "getContentControlById", "getContentControlsByTag", "getContentControlsByTitle", "getContentControlTag", "getContentControlTitle", "getContentControlFileId", "getContentControlSubtype", "getContentControlLock", "getContentControlIsBound", "getContentControlPlaceholderShown", "getContentControlTemporary", "getContentControlText", "getContentControlParagraphs", "getContentControlRange"];
|
|
51
|
+
declare const AUTOMATION_QUERY_OPERATIONS: readonly ["getTables", "getTable", "getTableRows", "getTableCells", "getTableCell", "getTableCellProperties", "getTableCellBody", "getFields", "getField", "getInlinePictures", "getInlinePicture", "getShapes", "getShape", "getShapeBody", "getChangeTrackingMode", "getDocument", "getDocumentProperty", "getBody", "getParagraphs", "getRange", "getSpanParagraphs", "getText", "getSpanText", "getParagraphId", "search", "getFont", "getParagraphFormat", "getStyle", "getSections", "getPageSetup", "getFurniture", "getNotes", "getNoteBody", "getNoteText", "getNoteKind", "getLists", "getListId", "getListById", "getListParagraphs", "getParagraphList", "getListLevel", "getHyperlink", "getBookmarks", "getBookmarkName", "getBookmarkRange", "getComments", "getCommentReplies", "getCommentId", "getCommentAuthor", "getCommentDate", "getCommentText", "getCommentRange", "getCommentResolved", "getRevisions", "getRevisionType", "getRevisionAuthor", "getRevisionDate", "getRevisionRange", "getContentControls", "getContentControlById", "getContentControlsByTag", "getContentControlsByTitle", "getContentControlTag", "getContentControlTitle", "getContentControlFileId", "getContentControlSubtype", "getContentControlLock", "getContentControlIsBound", "getContentControlPlaceholderShown", "getContentControlTemporary", "getContentControlText", "getContentControlParagraphs", "getContentControlRange"];
|
|
41
52
|
/** Operations that write. Every one of these goes through the single transaction path. */
|
|
42
53
|
declare const AUTOMATION_COMMAND_OPERATIONS: readonly ["removeDocumentInformation", "setDocumentProperties", "insertTableRows", "insertTable", "updateTable", "updateTableCell", "setInlinePicture", "deleteInlinePicture", "insertField", "setFieldCode", "deleteField", "updateFieldResult", "insertInlinePicture", "insertBreak", "setChangeTrackingMode", "proposeInsertion", "proposeDeletion", "proposeReplacement", "insertText", "replaceSpan", "replaceStoryBlocks", "insertParagraph", "splitParagraph", "deleteParagraph", "selectSpan", "selectBookmark", "setFont", "setParagraphFormat", "setStyle", "setPageSetup", "deleteNote", "setListLevel", "startNewList", "attachToList", "detachFromList", "setListLevelFormat", "insertListParagraph", "setHyperlink", "insertComment", "setCommentResolved", "replyToComment", "deleteComment", "acceptRevision", "rejectRevision", "resolveRevisionBatch", "acceptAllRevisions", "rejectAllRevisions", "setContentControlValue", "setContentControlProperties", "deleteContentControl", "insertContentControlText", "insertContentControl", "insertCustomNode"];
|
|
43
54
|
/**
|
package/dist/automation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {m,g,d}from'./chunk-
|
|
1
|
+
import {m,g,d}from'./chunk-RCCOLZEQ.js';export{i as AUTOMATION_COMMAND_OPERATIONS,h as AUTOMATION_QUERY_OPERATIONS,j as AUTOMATION_SOLITARY_OPERATIONS,f as HEADER_FOOTER_VARIANTS,e as createAutomationPaginationProvider,l as isAutomationCommand,k as isSolitaryAutomationCommand,c as paginationSnapshotOf}from'./chunk-RCCOLZEQ.js';import'./chunk-EYK4K2J6.js';import'./chunk-XSHXBJ2J.js';import'./chunk-2BK4G4ZN.js';import'./chunk-73PG6L2X.js';import {X,Xa,bb,qa,ia,ga,ha}from'./chunk-L6V3IJ3S.js';import {b,a}from'./chunk-6SEIXJTX.js';import {le,qb,me,tb,Fa,lg,b as b$1}from'./chunk-DDGGSBAN.js';var j=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),D=Object.freeze({kind:"body"});function Y(o,t={}){let m$1=le(o,t.limits??{});if(!m$1.ok)return {ok:false,reason:m$1.reason,...m$1.limit===void 0?{}:{limit:m$1.limit},...m$1.detail?{detail:m$1.detail}:{}};let p=m$1.package.parts.get(m$1.package.mainDocumentPart);if(!p)return {ok:false,reason:"no-main-document-part",detail:m$1.package.mainDocumentPart};let u=new X(m$1.package,Xa(m$1.package,qb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(bb(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d$1)=>{if(u.packageRevision!==l)return null;let s=g(u.currentPackage()).story(f);return s?d(i,s.part,a,d$1):null};}let r=m({port:n,capabilities:j});return y&&(c=y.attach(b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?Fa(o,()=>{let u=lg(o.currentPackage(),t,p.name);return u?(o.replacePackageShell(u.pkg),u.relationshipId):null},u=>u!==null):null}function K(o,t,m=()=>{}){let p=true,u=0,y=()=>t?(u+=1,{origin:t.identity.role==="agent"?b$1.mutationAgent:b$1.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>tb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a$1=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>a(s,f,l));},y());return a$1.ok?c({ok:true,changed:a$1.change!==null}):{ok:false,reason:a$1.detail?`${a$1.reason}: ${a$1.detail}`:a$1.reason}},applyLifecycle(n){if(!p)return {ok:false,reason:"disposed"};let r=t?.gateOperations([n],D);if(r)return {ok:false,reason:r};let i=tb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=tb(t?.identity.actorId,()=>ia(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=tb(t?.identity.actorId,()=>ga(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=tb(t?.identity.actorId,()=>ha(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=tb(t?.identity.actorId,()=>qa(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?me(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 chunk7RJSH72J_cjs=require('./chunk-7RJSH72J.cjs');require('./chunk-AGKIHLWQ.cjs'),require('./chunk-QIE3YTU4.cjs'),require('./chunk-CYT3OQFZ.cjs'),require('./chunk-SUN62YU6.cjs'),require('./chunk-ELQFXMJ5.cjs'),require('./chunk-ANZ44KQT.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunk7RJSH72J_cjs.e}});
|
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-QVBFPAGO.js';import'./chunk-5BIASAN3.js';import'./chunk-2BK4G4ZN.js';import'./chunk-73PG6L2X.js';import'./chunk-L6V3IJ3S.js';import'./chunk-6SEIXJTX.js';import'./chunk-DDGGSBAN.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c}from'./chunk-73PG6L2X.js';import {Va,Ta,Ua,Ga}from'./chunk-L6V3IJ3S.js';import {Te,Va as Va$1,mf,Nf,Wa,Ua as Ua$1,Ta as Ta$1}from'./chunk-DDGGSBAN.js';function X(n){let r=[],s=0;for(let e of n){let o=s+e.text.length;e.resultRuns?r.push({text:e.text,rawStart:e.rawStart,rawEnd:e.rawEnd,resultRuns:e.resultRuns,...e.symbolOffsets?{symbolOffsets:e.symbolOffsets}:{},...e.symbolDisplays?{symbolDisplays:e.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:e.text.length!==e.rawEnd-e.rawStart}):e.floatingObject?r.push({text:e.text,rawStart:e.rawStart,rawEnd:e.rawEnd,floatingObject:true,projectedStart:s,projectedEnd:o,expansion:e.text.length!==e.rawEnd-e.rawStart}):r.push({text:e.text,rawStart:e.rawStart,rawEnd:e.rawEnd,...e.symbol?{symbol:true}:{},...e.symbolOffsets?{symbolOffsets:e.symbolOffsets}:{},...e.symbolDisplays?{symbolDisplays:e.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:e.text.length!==e.rawEnd-e.rawStart}),s=o;}return r}function v(n,r){return r<=n.rawStart?n.projectedStart:r>=n.rawEnd?n.projectedEnd:n.expansion?n.projectedStart:n.projectedStart+r-n.rawStart}function F(n,r){return n.expansion?n.rawStart:n.rawStart+r-n.projectedStart}function B(n,r){return n.expansion?n.rawEnd:n.rawStart+r-n.projectedStart}var z=new Set([Ta$1,"\u2011"]),G=/[\u001e\u001f\u2011]/,L="\uFFFF";function I(n,r){if(!G.test(n)&&!r?.size)return {text:n,at:null};let s="",e=[];for(let o=0;o<n.length;o+=1){let l=n[o];if(r?.has(o))s+=L;else {if(l===Ua$1)continue;s+=z.has(l)?"-":l;}e.push(o);}return {text:s,at:e}}function K(n){let r;for(let s of n){if(s.symbol){r??=new Set;for(let e=s.projectedStart;e<s.projectedEnd;e+=1)r.add(e);}for(let e of s.symbolOffsets??[])(r??=new Set).add(s.projectedStart+e);}return r}function O(n){let r=X(n),s="";for(let o of n)s+=o.text;let e=null;return {text:s,projectedOffset(o){let l=0;for(let i of r){if(o<=i.rawEnd)return v(i,o);l=i.projectedEnd;}return l},rawRange(o,l){if(o<0||o>=l||l>s.length)return null;let i=r.find(d=>o>=d.projectedStart&&o<d.projectedEnd),t=r.find(d=>l>d.projectedStart&&l<=d.projectedEnd);return !i||!t?null:{start:F(i,o),end:B(t,l)}},sliceRaw(o,l){if(o>=l)return "";let i="";for(let t of r){if(t.expansion){o<=t.rawStart&&l>=t.rawEnd&&(i+=t.text);continue}let d=Math.max(o,t.rawStart),a=Math.min(l,t.rawEnd);d<a&&(i+=t.text.slice(d-t.rawStart,a-t.rawStart));}return i},displaySlice(o,l){let i="";for(let t of r){if(t.projectedEnd<=o||t.projectedStart>=l)continue;let d=Math.max(o,t.projectedStart)-t.projectedStart,a=Math.min(l,t.projectedEnd)-t.projectedStart;if(t.symbol){i+=t.symbolDisplays?.[0]??"";continue}let u=new Map;t.symbolOffsets?.forEach((f,c)=>u.set(f,t.symbolDisplays?.[c]??""));for(let f=d;f<a;f+=1)i+=u.get(f)??t.text[f];}return i},resultRunAddressAt(o){let l=r.find(t=>t.resultRuns!==void 0&&o>=t.projectedStart&&o<t.projectedEnd);if(!l?.resultRuns)return null;let i=o-l.projectedStart;for(let t of l.resultRuns)if(i>=t.start&&i<t.end)return {runId:t.runId,offset:i-t.start};return null},findOccurrences(o,l,i={}){let t=[];if(l<=0||!Va(o)||s.length===0)return {matches:t,truncated:false};let d=i.matchCase===true,a=i.wholeWord===true;e??=I(s,K(r));let u=e,f=I(o).text;if(f.length===0||f.includes(L))return {matches:t,truncated:false};let c=d?f:Ta(f),j=d?u.text:Ta(u.text),R=p=>u.at?.[p]??p,W=p=>{if(!u.at)return p;let m=0;for(;m<u.at.length&&u.at[m]<p;)m+=1;return m},Y=Math.min(s.length,i.to??s.length),D=new Set,b=j.indexOf(c,W(Math.max(0,i.from??0)));for(;b>=0;){let p=b+c.length,m=R(b),x=R(p-1)+1;if(x>Y)return {matches:t,truncated:false};if(r.some(y=>y.floatingObject===true&&y.projectedStart>m&&y.projectedStart<x)){b=j.indexOf(c,b+1);continue}if(!a||Ua(u.text,b,p)){let y=r.find(h=>m>=h.projectedStart&&m<h.projectedEnd),E=r.find(h=>x>h.projectedStart&&x<=h.projectedEnd);if(!y||!E)return {matches:t,truncated:false};let S=y===E&&y.expansion?y:null;if(!S||!D.has(S)){if(t.length>=l)return {matches:t,truncated:true};t.push({start:m,length:x-m,rawStart:F(y,m),rawEnd:B(E,x)}),S&&D.add(S);}}b=j.indexOf(c,p);}return {matches:t,truncated:false}}}}function Q(n){return n.length===0?O([]):O([{text:n,rawStart:0,rawEnd:n.length}])}var U="http://schemas.openxmlformats.org/markup-compatibility/2006";function q(n){if(n.kind==="textValue")return false;let r=s=>s.kind!=="textValue"&&s.children.some(e=>e.kind==="anchoredDrawing"||e.kind!=="textValue"&&e.localName==="anchor");if(n.kind==="drawing")return r(n);if(n.namespaceUri!==U||n.localName!=="AlternateContent")return false;for(let s of n.children){if(s.kind==="textValue"||s.localName!=="Choice")continue;let e=s.children.find(o=>o.kind==="drawing"||o.kind!=="textValue"&&o.localName==="drawing");if(e)return r(e)}return false}function J(n,r,s="allMarkup"){if(!r.includes(Te)&&!r.includes(Va$1))return r.length===0?[]:[{text:r,rawStart:0,rawEnd:r.length}];let e=mf(n),o=Nf(n,e),l=c(n,e,s),i=new Map;for(let a of e)i.set(a.node.id,a);let t=[],d=0;for(let a of o){let u=i.get(a.node.id),f=!u&&Wa(a.node);if(!u&&!f){q(a.node)&&(d<a.start&&t.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),t.push({text:"",rawStart:a.start,rawEnd:a.end,floatingObject:true}),d=a.end);continue}if(d<a.start&&t.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),!u){t.push({text:Va$1,rawStart:a.start,rawEnd:a.end,symbol:true,symbolDisplays:[Ga(a.node)]}),d=a.end;continue}let c=l.get(u.node.id);u.kind==="simple"&&c?t.push({text:c.text,rawStart:a.start,rawEnd:a.end,resultRuns:c.runs,...c.symbols?{symbolOffsets:c.symbols}:{},...c.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}):t.push({text:c?.text??Te,rawStart:a.start,rawEnd:a.end,...c?.symbols?{symbolOffsets:c.symbols}:{},...c?.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}),d=a.end;}return d<r.length&&t.push({text:r.slice(d),rawStart:d,rawEnd:r.length}),t}function se(n,r,s="allMarkup"){return !r.includes(Te)&&!r.includes(Va$1)?Q(r):O(J(n,r,s))}
|
|
2
|
+
export{O as a,Q as b,J as c,se as d};
|