@betteroffice/docx 0.2.1 → 0.4.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 +586 -3
- package/dist/chunk-24Z6ZVFZ.mjs +1 -0
- package/dist/chunk-2QHGQA3V.mjs +1 -0
- package/dist/{chunk-ACGKK7IB.mjs → chunk-3CYO46ML.mjs} +1 -1
- package/dist/chunk-6CHGYCFU.mjs +1 -0
- package/dist/chunk-AOWJ4WDE.mjs +1 -0
- package/dist/chunk-DLXIZBB6.mjs +1 -0
- package/dist/chunk-F2VBW6RB.mjs +1 -0
- package/dist/chunk-HPZFJGGM.mjs +0 -0
- package/dist/chunk-L2ML3DDI.mjs +1 -0
- package/dist/chunk-LIGZ75FP.mjs +1 -0
- package/dist/chunk-LT2GCWZ3.mjs +0 -0
- package/dist/chunk-ND3FBCB3.mjs +16 -0
- package/dist/chunk-NMDQHUQB.mjs +57 -0
- package/dist/chunk-NVN26RHH.mjs +1 -0
- package/dist/chunk-OK5UFGX3.mjs +1 -0
- package/dist/chunk-RZQ3OXZY.mjs +2 -0
- package/dist/chunk-YLFKV2NT.mjs +1 -0
- package/dist/collaboration/index.d.mts +9 -6
- package/dist/compareDocx-IHFPGIGV.mjs +1 -0
- package/dist/computeLayout-4MNWHE2T.mjs +1 -0
- package/dist/{content-CvEtPl0c.d.mts → content-BzoC6bSz.d.mts} +48 -8
- package/dist/core.d.mts +172 -9
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-DF8F6fMl.d.mts → displayListQueries-H5YnU_hX.d.mts} +23 -5
- package/dist/docx/index.d.mts +5 -4
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +19 -9
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-b8eicJKV.d.mts → fontLoader-BNSs0E8K.d.mts} +55 -2
- package/dist/{formatting-7zKCTu5a.d.mts → formatting-gqLFeJ9X.d.mts} +8 -0
- package/dist/{frameDelta-pA4jrQ1G.d.mts → frameDelta-ByU7HBuB.d.mts} +34 -3
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/index-CHy6_Yuo.d.mts +2026 -0
- package/dist/layout/index.d.mts +6 -6
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +4 -4
- package/dist/layout/render/index.d.mts +122 -33
- package/dist/layout/render/index.mjs +1 -1
- package/dist/loadWasmAsset-Cr95TImt.d.mts +25 -0
- package/dist/pagedExport---0Dlmzo.d.mts +907 -0
- package/dist/parseWasm-NLAG22EU.mjs +1 -0
- package/dist/plugin-api/RenderedDomContext.d.mts +12 -9
- package/dist/plugin-api/RenderedDomContext.mjs +1 -1
- package/dist/plugin-api/index.d.mts +21 -4
- package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
- package/dist/rezip-Bxiq4Z_R.d.mts +24 -0
- package/dist/{rustDisplayList-BJqaN9tt.d.mts → rustDisplayList-LcRZHCSL.d.mts} +12 -4
- package/dist/{rustMeasureSource-C0EZB055.d.mts → rustMeasureSource-BkCx1FDx.d.mts} +14 -4
- package/dist/{selectiveSave-CRh-_Y_C.d.mts → selectiveSave-r-NMK6aI.d.mts} +1 -22
- package/dist/styles/index.d.mts +2 -2
- package/dist/{styles-7e-mq3c-.d.mts → styles-AryxLAhx.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +9 -6
- package/dist/{types-C4A8mWjU.d.mts → types-D6Pra38E.d.mts} +31 -5
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +20 -5
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/wasm-GSI2XMOH.mjs +1 -0
- package/dist/wasm-K6DRABAA.mjs +1 -0
- package/dist/wasm-NF6B3AH7.mjs +1 -0
- package/dist/wasm-edit.d.mts +420 -28
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +9 -2
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.d.mts +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.d.mts +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +8 -5
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-5F6DLQZP.mjs +0 -1
- package/dist/chunk-6LQJAKOC.mjs +0 -1
- package/dist/chunk-AFMVSI4Z.mjs +0 -57
- package/dist/chunk-GD4VNJ64.mjs +0 -1
- package/dist/chunk-HLDJMU3R.mjs +0 -1
- package/dist/chunk-J7LNO6SM.mjs +0 -1
- package/dist/chunk-JHJLG4I6.mjs +0 -16
- package/dist/chunk-PGMXWI5X.mjs +0 -1
- package/dist/chunk-WRWRCBLK.mjs +0 -1
- package/dist/chunk-WTFRNX5K.mjs +0 -1
- package/dist/index-CHl2zLJ7.d.mts +0 -1142
- package/dist/loadWasmAsset-CMvnVkfA.d.mts +0 -3
- package/dist/wasm-7SOSHNGP.mjs +0 -1
- package/dist/wasm-ZQAVP7P2.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'./chunk-LT2GCWZ3.mjs';export{h as decodeTiffImage,b as parseDocxS9Wire,c as parseRelationshipsXmlWire,a as preloadParseWasm,d as serializeDocxS10Wire,e as serializeDocxS11Wire,f as serializeDocxS12Wire,g as writeDocxS13Wire}from'./chunk-3CYO46ML.mjs';import'./chunk-6CHGYCFU.mjs';import'./chunk-TTRUPDAB.mjs';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RenderedDomContext, PositionCoordinates } from './index.mjs';
|
|
2
|
-
import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-
|
|
1
|
+
import { RenderedDomContext, PositionCoordinates, PointPosition } from './index.mjs';
|
|
2
|
+
import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-H5YnU_hX.mjs';
|
|
3
3
|
import '../types/document.mjs';
|
|
4
|
-
import '../content-
|
|
5
|
-
import '../formatting-
|
|
4
|
+
import '../content-BzoC6bSz.mjs';
|
|
5
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
6
6
|
import '../docx/wrapTypes.mjs';
|
|
7
|
-
import '../styles-
|
|
8
|
-
import '../frameDelta-
|
|
9
|
-
import '../rustDisplayList-
|
|
10
|
-
import '../types-
|
|
7
|
+
import '../styles-AryxLAhx.mjs';
|
|
8
|
+
import '../frameDelta-ByU7HBuB.mjs';
|
|
9
|
+
import '../rustDisplayList-LcRZHCSL.mjs';
|
|
10
|
+
import '../types-D6Pra38E.mjs';
|
|
11
11
|
import '../layout/pagination/index.mjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -62,6 +62,8 @@ declare class RenderedDomContextImpl implements RenderedDomContext {
|
|
|
62
62
|
private readonly queries;
|
|
63
63
|
private readonly projector;
|
|
64
64
|
constructor(pagesContainer: HTMLElement, zoom?: number, options?: RenderedDomContextOptions);
|
|
65
|
+
/** Client pixels per unit of this context: its zoom times the container's ancestor CSS zoom. */
|
|
66
|
+
private clientScale;
|
|
65
67
|
/**
|
|
66
68
|
* Run spans (`data-doc-start`/`data-doc-end`) in reading order, deep-queried
|
|
67
69
|
* from the a11y mirror subtree nested under `.canvas-pages`.
|
|
@@ -74,6 +76,7 @@ declare class RenderedDomContextImpl implements RenderedDomContext {
|
|
|
74
76
|
* Uses the browser's text rendering via Range API for precise positioning.
|
|
75
77
|
*/
|
|
76
78
|
getCoordinatesForPosition(position: number): PositionCoordinates | null;
|
|
79
|
+
getPositionAtPoint(clientX: number, clientY: number): PointPosition | null;
|
|
77
80
|
/**
|
|
78
81
|
* Find DOM elements that overlap with a display-position range.
|
|
79
82
|
*/
|
|
@@ -109,6 +112,6 @@ declare class RenderedDomContextImpl implements RenderedDomContext {
|
|
|
109
112
|
* @param options - query/projector backend options. Omit for the mirror-DOM
|
|
110
113
|
* fallback.
|
|
111
114
|
*/
|
|
112
|
-
declare function createRenderedDomContext(pagesContainer: HTMLElement, zoom?: number, options?: RenderedDomContextOptions): RenderedDomContext
|
|
115
|
+
declare function createRenderedDomContext(pagesContainer: HTMLElement, zoom?: number, options?: RenderedDomContextOptions): RenderedDomContext & Required<Pick<RenderedDomContext, 'getPositionAtPoint'>>;
|
|
113
116
|
|
|
114
117
|
export { type DisplayListPageProjector, type ProjectedDisplayListRect, RenderedDomContextImpl, type RenderedDomContextOptions, createCanvasHostProjector, createRenderedDomContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a,h,d,g}from'../chunk-AOWJ4WDE.mjs';import {b}from'../chunk-TTRUPDAB.mjs';function D(h,r,o=1){let i=o>0?o:1,e=t=>{let n=r.pageSize(t.pageIndex),s=g(h,r,t.pageIndex);if(!s||!n||n.width<=0||n.height<=0)return null;let a$1=h.getBoundingClientRect(),c=s.width/n.width,l=s.height/n.height,u=i*a(h);return {x:(s.left-a$1.left+t.x*c)/u,y:(s.top-a$1.top+t.y*l)/u,width:t.width*c/u,height:t.height*l/u}};return {projectRect:e,getPageBounds:t=>{let n=r.pageBounds(t);return n?e(n):null}}}var R=class{constructor(r,o=1,i){b(this,"pagesContainer");b(this,"zoom");b(this,"queries");b(this,"projector");if(this.pagesContainer=r,this.zoom=o,this.queries=i?.displayListQueries??null,this.projector=i?.projector??null,this.queries===null!=(this.projector===null))throw new Error("RenderedDomContext requires displayListQueries and projector together")}clientScale(){return this.zoom*a(this.pagesContainer)}spanEntries(){let r=[],o=Array.from(this.pagesContainer.querySelectorAll(".layout-page-content")),i=o.length>0?o:[this.pagesContainer];for(let e of i)for(let t of Array.from(e.querySelectorAll("span[data-doc-start][data-doc-end]")))r.push({el:t,start:Number(t.dataset.docStart),end:Number(t.dataset.docEnd)});return r}emptyRuns(){return Array.from(this.pagesContainer.querySelectorAll(".layout-empty-run"))}getCoordinatesForPosition(r){if(this.queries&&this.projector){let e=this.queries.caretRect(r),t=e?this.projector.projectRect(e):null;return t?{x:t.x,y:t.y,height:t.height}:null}let o=this.pagesContainer.getBoundingClientRect(),i=this.clientScale();for(let{el:e,start:t,end:n}of this.spanEntries()){let s=e;if(e.classList.contains("layout-run-tab")){if(r>=t&&r<n){let a=e.getBoundingClientRect(),c=e.closest(".layout-line"),l=c?c.offsetHeight:16;return {x:(a.left-o.left)/i,y:(a.top-o.top)/i,height:l/this.zoom}}continue}if(r>=t&&r<=n&&s.firstChild?.nodeType===Node.TEXT_NODE){let a=s.firstChild,c=Math.min(r-t,a.length),l=e.ownerDocument;if(!l)continue;let u=l.createRange();u.setStart(a,c),u.setEnd(a,c);let d=u.getBoundingClientRect(),g=e.closest(".layout-line"),p=g?g.offsetHeight:16;return {x:(d.left-o.left)/i,y:(d.top-o.top)/i,height:p/this.zoom}}}for(let e of this.emptyRuns()){let t=e.closest(".layout-paragraph");if(!t)continue;let n=Number(t.dataset.docStart),s=Number(t.dataset.docEnd);if(r>=n&&r<=s){let a=e.getBoundingClientRect(),c=e.closest(".layout-line"),l=c?c.offsetHeight:16;return {x:(a.left-o.left)/i,y:(a.top-o.top)/i,height:l/this.zoom}}}return null}getPositionAtPoint(r,o){if(!this.queries||!Number.isFinite(r)||!Number.isFinite(o))return null;let i=h(this.pagesContainer,this.queries,r,o),e=i?.hit;return !i||!e||e.pos===null||e.target!=="text"||(e.region==="header"||e.region==="footer")&&!e.rId||(e.region==="footnote"||e.region==="endnote")&&e.noteId===void 0?null:{position:e.pos,pageIndex:i.pageIndex,region:e.region,...e.rId===void 0?{}:{rId:e.rId},...e.noteId===void 0?{}:{noteId:e.noteId}}}findElementsForRange(r,o){if(this.queries){let e=new Set(this.queries.rangeRects(r,o).map(t=>t.pageIndex));d(this.pagesContainer,[...e]);}let i=[];for(let{el:e,start:t,end:n}of this.spanEntries())n>r&&t<o&&i.push(e);return i}getRectsForRange(r,o){if(this.queries&&this.projector)return this.queries.rangeRects(r,o).map(n=>this.projector.projectRect(n)).filter(n=>n!==null);let i=this.pagesContainer.getBoundingClientRect(),e=this.clientScale(),t=[];for(let{el:n,start:s,end:a}of this.spanEntries()){let c=n;if(a>r&&s<o){if(n.classList.contains("layout-run-tab")){let p=n.getBoundingClientRect();t.push({x:(p.left-i.left)/e,y:(p.top-i.top)/e,width:p.width/e,height:p.height/e});continue}if(c.firstChild?.nodeType!==Node.TEXT_NODE)continue;let l=c.firstChild,u=n.ownerDocument;if(!u)continue;let d=Math.max(0,r-s),g=Math.min(l.length,o-s);if(d<g){let p=u.createRange();p.setStart(l,d),p.setEnd(l,g);let E=p.getClientRects();for(let m of Array.from(E))t.push({x:(m.left-i.left)/e,y:(m.top-i.top)/e,width:m.width/e,height:m.height/e});}}}return t}getCoordinatesForHfPosition(r,o,i,e){if(!this.queries||!this.projector)return null;let t=this.queries.hfCaretRects(r,o,i).find(s=>s.pageIndex===e),n=t?this.projector.projectRect(t):null;return n?{x:n.x,y:n.y,height:n.height}:null}getRectsForHfRange(r,o,i,e,t){return !this.queries||!this.projector?[]:this.queries.hfRangeRects(r,o,i,e).filter(n=>n.pageIndex===t).map(n=>this.projector.projectRect(n)).filter(n=>n!==null)}getPageBounds(r){if(this.projector)return this.projector.getPageBounds(r);let o=this.pagesContainer.querySelectorAll(".layout-page"),i=Array.from(o).find((s,a)=>Number(s.dataset.pageIndex??a)===r);if(!i)return null;let e=i.getBoundingClientRect(),t=this.pagesContainer.getBoundingClientRect(),n=this.clientScale();return {x:(e.left-t.left)/n,y:(e.top-t.top)/n,width:e.width/n,height:e.height/n}}getContainerOffset(){let r=this.pagesContainer.parentElement;if(!r)return {x:0,y:0};let o=this.pagesContainer.getBoundingClientRect(),i=r.getBoundingClientRect(),e=this.clientScale();return {x:(o.left-i.left)/e,y:(o.top-i.top)/e}}};function H(h,r=1,o){return new R(h,r,o)}export{R as RenderedDomContextImpl,D as createCanvasHostProjector,H as createRenderedDomContext};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Document } from '../types/document.mjs';
|
|
2
|
-
import '../content-
|
|
3
|
-
import '../formatting-
|
|
2
|
+
import '../content-BzoC6bSz.mjs';
|
|
3
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
4
4
|
import '../docx/wrapTypes.mjs';
|
|
5
|
-
import '../styles-
|
|
5
|
+
import '../styles-AryxLAhx.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Framework-Agnostic Plugin Interface for the DOCX Editor
|
|
@@ -22,6 +22,14 @@ interface PositionCoordinates {
|
|
|
22
22
|
y: number;
|
|
23
23
|
height: number;
|
|
24
24
|
}
|
|
25
|
+
/** A caret position within a page's body, header, footer, or note. */
|
|
26
|
+
interface PointPosition {
|
|
27
|
+
position: number;
|
|
28
|
+
pageIndex: number;
|
|
29
|
+
region: 'body' | 'header' | 'footer' | 'footnote' | 'endnote';
|
|
30
|
+
rId?: string;
|
|
31
|
+
noteId?: number;
|
|
32
|
+
}
|
|
25
33
|
/**
|
|
26
34
|
* Context for accessing rendered-page geometry in the paged editor.
|
|
27
35
|
*
|
|
@@ -41,6 +49,11 @@ interface RenderedDomContext {
|
|
|
41
49
|
* Returns null if the position cannot be found.
|
|
42
50
|
*/
|
|
43
51
|
getCoordinatesForPosition(position: number): PositionCoordinates | null;
|
|
52
|
+
/**
|
|
53
|
+
* Client coordinates to a region-local caret; null outside text or without ready canvas queries.
|
|
54
|
+
* Optional so contexts written before it keep compiling; a context without it answers null.
|
|
55
|
+
*/
|
|
56
|
+
getPositionAtPoint?(clientX: number, clientY: number): PointPosition | null;
|
|
44
57
|
/**
|
|
45
58
|
* Find DOM elements that overlap with a display-position range.
|
|
46
59
|
*/
|
|
@@ -83,6 +96,7 @@ interface RenderedDomContext {
|
|
|
83
96
|
}
|
|
84
97
|
/**
|
|
85
98
|
* Props passed to plugin panel components (framework-agnostic base).
|
|
99
|
+
* @deprecated Use `DocxPluginPanel` from `@betteroffice/docx-react`.
|
|
86
100
|
*/
|
|
87
101
|
interface PluginPanelProps<TState = unknown> {
|
|
88
102
|
/** Current serializer-facing document snapshot. */
|
|
@@ -103,6 +117,7 @@ interface PluginPanelProps<TState = unknown> {
|
|
|
103
117
|
}
|
|
104
118
|
/**
|
|
105
119
|
* Configuration for plugin panel rendering.
|
|
120
|
+
* @deprecated Use `DocxPluginPanel` from `@betteroffice/docx-react`.
|
|
106
121
|
*/
|
|
107
122
|
interface PanelConfig {
|
|
108
123
|
/** Where to render the panel */
|
|
@@ -130,6 +145,7 @@ interface PanelConfig {
|
|
|
130
145
|
*
|
|
131
146
|
* Framework adapters (ReactEditorPlugin, VueEditorPlugin) extend this
|
|
132
147
|
* with their own Panel component type and renderOverlay function.
|
|
148
|
+
* @deprecated Use `defineDocxPlugin` and the `plugins` prop of `@betteroffice/docx-react`.
|
|
133
149
|
*/
|
|
134
150
|
interface EditorPluginCore<TState = any> {
|
|
135
151
|
/** Unique plugin identifier */
|
|
@@ -180,6 +196,7 @@ interface SidebarItem {
|
|
|
180
196
|
}
|
|
181
197
|
/**
|
|
182
198
|
* Context provided to plugins when computing sidebar items.
|
|
199
|
+
* @deprecated Use `DocxPluginSidebarItem` from `@betteroffice/docx-react`.
|
|
183
200
|
*/
|
|
184
201
|
interface SidebarItemContext {
|
|
185
202
|
document: Document | null;
|
|
@@ -189,4 +206,4 @@ interface SidebarItemContext {
|
|
|
189
206
|
zoom: number;
|
|
190
207
|
}
|
|
191
208
|
|
|
192
|
-
export type { EditorPluginCore, PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext, SidebarItem, SidebarItemContext };
|
|
209
|
+
export type { EditorPluginCore, PanelConfig, PluginPanelProps, PointPosition, PositionCoordinates, RenderedDomContext, SidebarItem, SidebarItemContext };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SidebarItem, RenderedDomContext } from './index.mjs';
|
|
2
2
|
import '../types/document.mjs';
|
|
3
|
-
import '../content-
|
|
4
|
-
import '../formatting-
|
|
3
|
+
import '../content-BzoC6bSz.mjs';
|
|
4
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
5
5
|
import '../docx/wrapTypes.mjs';
|
|
6
|
-
import '../styles-
|
|
6
|
+
import '../styles-AryxLAhx.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Pure layout algorithm: given a list of sidebar items + their
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Document } from './types/document.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Public DOCX package I/O wrappers.
|
|
5
|
+
*
|
|
6
|
+
* Model serialization and selective package writing are Rust-owned. The
|
|
7
|
+
* TypeScript kept here is compatibility glue for public ZIP utilities and host
|
|
8
|
+
* values; package inflation/deflation continues through `docx-container` wasm.
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface RepackOptions {
|
|
14
|
+
/** Retained for signature compatibility; `docx-container` chooses compression. */
|
|
15
|
+
compressionLevel?: number;
|
|
16
|
+
updateModifiedDate?: boolean;
|
|
17
|
+
modifiedBy?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Repack a public Document through the Rust package writer. */
|
|
20
|
+
declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
21
|
+
declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
22
|
+
declare function createDocx(doc: Document): Promise<ArrayBuffer>;
|
|
23
|
+
|
|
24
|
+
export { type RepackOptions as R, createDocx as c, repackDocx as r, updateMultipleFiles as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as Layout } from './types-
|
|
1
|
+
import { L as Layout } from './types-D6Pra38E.mjs';
|
|
2
2
|
import { MeasuredBlock } from './layout/pagination/index.mjs';
|
|
3
|
-
import { D as DisplayList, R as RetainedFrame } from './frameDelta-
|
|
3
|
+
import { D as DisplayList, R as RetainedFrame } from './frameDelta-ByU7HBuB.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* JS seam to the Rust display-list builder.
|
|
@@ -205,6 +205,13 @@ interface RustDisplayListEngine {
|
|
|
205
205
|
displayVerticalMoveJson?(position: number, direction: 'up' | 'down', goalX: number): string;
|
|
206
206
|
displayRangeRectsJson?(from: number, to: number): string;
|
|
207
207
|
displayRangeRectsRegionJson?(region: string, partId: string, from: number, to: number): string;
|
|
208
|
+
/** The bytes and media type of the part a `media:{n}` image source names. */
|
|
209
|
+
mediaSource?(token: string): {
|
|
210
|
+
bytes: Uint8Array;
|
|
211
|
+
mimeType: string;
|
|
212
|
+
} | null;
|
|
213
|
+
/** Changes whenever the package `mediaSource` reads changes. */
|
|
214
|
+
mediaScope?(): number;
|
|
208
215
|
}
|
|
209
216
|
type RustDisplayListSourceErrorStage = 'load' | 'build' | 'parse' | 'decode' | 'apply';
|
|
210
217
|
interface RustDisplayFrameResult {
|
|
@@ -295,13 +302,14 @@ declare function buildRustDisplayList(inputs: DisplayListBuildInputs, engine?: R
|
|
|
295
302
|
* Build one display frame. An engine that retains pagination returns a binary
|
|
296
303
|
* FrameDelta, decoded and applied on top of `previous` so unchanged pages keep
|
|
297
304
|
* object identity; `previous` also supplies the frame epoch the engine checks
|
|
298
|
-
* before sending a delta rather than a full frame
|
|
305
|
+
* before sending a delta rather than a full frame, unless `expectedFrameEpoch`
|
|
306
|
+
* overrides it (the engine numbers its frame after that epoch). An engine without
|
|
299
307
|
* `buildDisplayListFrame` takes the full-JSON path, and its result carries
|
|
300
308
|
* `frame: null` and `transport: 'json'`.
|
|
301
309
|
*
|
|
302
310
|
* Throws {@link RustDisplayListSourceError} tagged with the failing stage:
|
|
303
311
|
* `load`, `build`, `decode` or `apply`.
|
|
304
312
|
*/
|
|
305
|
-
declare function buildRustDisplayFrame(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine, previous?: RetainedFrame | null): Promise<RustDisplayFrameResult>;
|
|
313
|
+
declare function buildRustDisplayFrame(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine, previous?: RetainedFrame | null, expectedFrameEpoch?: number): Promise<RustDisplayFrameResult>;
|
|
306
314
|
|
|
307
315
|
export { type DisplayListHeadersFooters as D, type RustDisplayListQueryEngine as R, type DisplayListBuildInputs as a, type DisplayListHfVariant as b, type DisplayListPictureWatermark as c, type DisplayListTextWatermark as d, type DisplayListWatermark as e, type RustDisplayFrameResult as f, type RustDisplayListEngine as g, RustDisplayListSourceError as h, type RustDisplayListSourceErrorStage as i, buildRustDisplayFrame as j, buildRustDisplayList as k, encodeDisplayListFrameExtras as l, loadRustDisplayListQueryEngine as m };
|
|
@@ -20,6 +20,8 @@ type FontScript = 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr' | 'arabic' | 'hebrew
|
|
|
20
20
|
interface BundledFontProvider {
|
|
21
21
|
/** Resolve a Word family to bundled metric-compatible face byte loaders, or undefined. */
|
|
22
22
|
resolve(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
23
|
+
/** Like {@link BundledFontProvider.resolve}, but also accepts bundled family names such as `"Gelasio"`, and never substitutes another style. */
|
|
24
|
+
resolveFamily?(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
23
25
|
/**
|
|
24
26
|
* Optional per-script coverage fallback (Noto CJK/RTL faces). Same loader
|
|
25
27
|
* contract as {@link BundledFontProvider.resolve}; providers without
|
|
@@ -42,9 +44,10 @@ interface BundledFontProvider {
|
|
|
42
44
|
* Optional so mock/partial providers can omit it; when absent (or returning
|
|
43
45
|
* undefined) an unmapped family still yields an empty chain and the caller
|
|
44
46
|
* browser-falls-back that run — the pre-policy behavior. Same lazy loader
|
|
45
|
-
* contract as {@link BundledFontProvider.resolve}.
|
|
47
|
+
* contract as {@link BundledFontProvider.resolve}. This registry passes
|
|
48
|
+
* `office: 'word'` so the pick follows Word's substitution.
|
|
46
49
|
*/
|
|
47
|
-
resolveLastResort?(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
50
|
+
resolveLastResort?(family: string, bold: boolean, italic: boolean, office?: 'word' | 'powerpoint'): (() => Promise<ArrayBuffer>) | undefined;
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
53
|
* One embedded face extracted from the open document. Structurally identical
|
|
@@ -71,6 +74,13 @@ type BundledFontProviderSource = BundledFontProvider | (() => Promise<BundledFon
|
|
|
71
74
|
|
|
72
75
|
interface RustTextEngine {
|
|
73
76
|
registerFont(bytes: Uint8Array): number;
|
|
77
|
+
/**
|
|
78
|
+
* Measurement view of `id` carrying the vertical metrics and advance pitch
|
|
79
|
+
* Word measures `family` with; `id` when the engine knows none. Optional so
|
|
80
|
+
* a host that predates it still measures, with the substitute's own
|
|
81
|
+
* metrics.
|
|
82
|
+
*/
|
|
83
|
+
registerSubstituteFont?(id: number, family: string): number;
|
|
74
84
|
clearFonts(): void;
|
|
75
85
|
}
|
|
76
86
|
interface ResidentFontRequirement {
|
|
@@ -83,8 +93,8 @@ interface ResidentFontRequirement {
|
|
|
83
93
|
interface ResidentMeasurementConfig {
|
|
84
94
|
fontChains: Record<string, number[]>;
|
|
85
95
|
defaults: {
|
|
86
|
-
fontSize:
|
|
87
|
-
fontFamily:
|
|
96
|
+
fontSize: number;
|
|
97
|
+
fontFamily: string;
|
|
88
98
|
};
|
|
89
99
|
compat: {
|
|
90
100
|
noLeading: boolean;
|
|
@@ -19,27 +19,6 @@ interface ParseOptions {
|
|
|
19
19
|
}
|
|
20
20
|
declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Public DOCX package I/O wrappers.
|
|
24
|
-
*
|
|
25
|
-
* Model serialization and selective package writing are Rust-owned. The
|
|
26
|
-
* TypeScript kept here is compatibility glue for public ZIP utilities and host
|
|
27
|
-
* values; package inflation/deflation continues through `docx-container` wasm.
|
|
28
|
-
* @packageDocumentation
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
interface RepackOptions {
|
|
33
|
-
/** Retained for signature compatibility; `docx-container` chooses compression. */
|
|
34
|
-
compressionLevel?: number;
|
|
35
|
-
updateModifiedDate?: boolean;
|
|
36
|
-
modifiedBy?: string;
|
|
37
|
-
}
|
|
38
|
-
/** Repack a public Document through the Rust package writer. */
|
|
39
|
-
declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
40
|
-
declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
41
|
-
declare function createDocx(doc: Document): Promise<ArrayBuffer>;
|
|
42
|
-
|
|
43
22
|
/** Rust-backed selective DOCX save compatibility wrapper. */
|
|
44
23
|
|
|
45
24
|
interface SelectiveSaveOptions {
|
|
@@ -53,4 +32,4 @@ interface SelectiveSaveOptions {
|
|
|
53
32
|
*/
|
|
54
33
|
declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;
|
|
55
34
|
|
|
56
|
-
export { attemptSelectiveSave as a,
|
|
35
|
+
export { attemptSelectiveSave as a, parseDocx as p };
|
package/dist/styles/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-
|
|
2
|
-
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-
|
|
1
|
+
import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-gqLFeJ9X.mjs';
|
|
2
|
+
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-AryxLAhx.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Style Resolver
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-
|
|
1
|
+
import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-gqLFeJ9X.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Styles, Theme, Font Table, Relationships & Media Types
|
package/dist/types/content.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, d as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, M as ComplexField, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, g as DocumentBody, U as DrawingContent, j as Endnote, X as EndnotePosition, E as EndnoteProperties, Y as Field, Z as FieldCharContent, a0 as FieldType, a1 as FooterReference, i as Footnote, a2 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a3 as HeaderFooterType, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, a9 as ImageCrop, ac as ImagePadding, ad as ImagePosition, af as ImageSize, ag as ImageTransform, ah as ImageWrap, aj as InlineSdt, ak as Insertion, al as InstrTextContent, an as LineNumberRestart, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, bi as RawXml, aK as Run, aL as RunContent, aM as RunPropertyChange, aO as SdtDataBinding, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, aZ as ShapeTextBody, a_ as SimpleField, a$ as SoftHyphenContent, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-
|
|
2
|
-
export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-
|
|
1
|
+
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, d as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, M as ComplexField, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, g as DocumentBody, U as DrawingContent, j as Endnote, X as EndnotePosition, E as EndnoteProperties, Y as Field, Z as FieldCharContent, a0 as FieldType, a1 as FooterReference, i as Footnote, a2 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a3 as HeaderFooterType, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, a9 as ImageCrop, ac as ImagePadding, ad as ImagePosition, af as ImageSize, ag as ImageTransform, ah as ImageWrap, aj as InlineSdt, ak as Insertion, al as InstrTextContent, an as LineNumberRestart, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, bi as RawXml, aK as Run, aL as RunContent, aM as RunPropertyChange, aO as SdtDataBinding, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, aZ as ShapeTextBody, a_ as SimpleField, a$ as SoftHyphenContent, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-BzoC6bSz.mjs';
|
|
2
|
+
export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-gqLFeJ9X.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, d as Chart, k as BookmarkRange } from '../content-
|
|
2
|
-
export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartDataLabels, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartPointLabel, x as ChartSeries, y as ChartType, z as Column, e as Comment, G as CommentAnchorRange, I as CommentAuthor, J as CommentRangeEnd, K as CommentRangeStart, L as CommentReferenceContent, M as ComplexField, O as ContentPosition, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, U as DrawingContent, D as DrawingScene, V as DrawingSceneNode, X as EndnotePosition, Y as Field, Z as FieldCharContent, _ as FieldFormData, $ as FieldInlineContent, a0 as FieldType, a1 as FooterReference, a2 as FootnotePosition, a3 as HeaderFooterType, a4 as HeaderReference, a5 as HorizontalRuleContent, a6 as Hyperlink, a7 as HyperlinkContent, a8 as Image, a9 as ImageCrop, aa as ImageEffect, ab as ImageHyperlink, ac as ImagePadding, ad as ImagePosition, ae as ImageRotationBounds, af as ImageSize, ag as ImageTransform, ah as ImageWrap, ai as ImageWrapPoint, aj as InlineSdt, ak as Insertion, al as InstrTextContent, am as LevelSuffix, an as LineNumberRestart, ao as ListLevel, ap as ListRendering, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, N as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as PageNumberingProperties, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, aK as Run, aL as RunContent, aM as RunPropertyChange, aN as SdtCheckboxGlyph, S as SdtControlState, aO as SdtDataBinding, aP as SdtDateState, aQ as SdtGalleryState, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, b as ShapeEffect, aX as ShapeFillPaint, aY as ShapeStrokePaint, aZ as ShapeTextBody, c as ShapeTextBodyProperties, a_ as SimpleField, a$ as SoftHyphenContent, b0 as StructuredFieldContent, b1 as StructuredFieldTree, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-
|
|
3
|
-
import { f as Theme, C as ColorValue } from '../formatting-
|
|
4
|
-
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, a as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as ShapeFill, l as ShapeOutline, m as ShapeType, n as TabLeader, o as TabStop, p as TabStopAlignment, q as TableBorders, e as TableCellFormatting, c as TableFormatting, r as TableLook, s as TableMeasurement, d as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, b as TextFormatting, T as TextModernEffects, x as ThemeColorScheme, y as ThemeColorSlot, z as ThemeFont, A as ThemeFontScheme, U as UnderlineStyle } from '../formatting-
|
|
5
|
-
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-
|
|
6
|
-
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-
|
|
1
|
+
import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, d as Chart, k as BookmarkRange } from '../content-BzoC6bSz.mjs';
|
|
2
|
+
export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartDataLabels, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartPointLabel, x as ChartSeries, y as ChartType, z as Column, e as Comment, G as CommentAnchorRange, I as CommentAuthor, J as CommentRangeEnd, K as CommentRangeStart, L as CommentReferenceContent, M as ComplexField, O as ContentPosition, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, U as DrawingContent, D as DrawingScene, V as DrawingSceneNode, X as EndnotePosition, Y as Field, Z as FieldCharContent, _ as FieldFormData, $ as FieldInlineContent, a0 as FieldType, a1 as FooterReference, a2 as FootnotePosition, a3 as HeaderFooterType, a4 as HeaderReference, a5 as HorizontalRuleContent, a6 as Hyperlink, a7 as HyperlinkContent, a8 as Image, a9 as ImageCrop, aa as ImageEffect, ab as ImageHyperlink, ac as ImagePadding, ad as ImagePosition, ae as ImageRotationBounds, af as ImageSize, ag as ImageTransform, ah as ImageWrap, ai as ImageWrapPoint, aj as InlineSdt, ak as Insertion, al as InstrTextContent, am as LevelSuffix, an as LineNumberRestart, ao as ListLevel, ap as ListRendering, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, N as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as PageNumberingProperties, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, aK as Run, aL as RunContent, aM as RunPropertyChange, aN as SdtCheckboxGlyph, S as SdtControlState, aO as SdtDataBinding, aP as SdtDateState, aQ as SdtGalleryState, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, b as ShapeEffect, aX as ShapeFillPaint, aY as ShapeStrokePaint, aZ as ShapeTextBody, c as ShapeTextBodyProperties, a_ as SimpleField, a$ as SoftHyphenContent, b0 as StructuredFieldContent, b1 as StructuredFieldTree, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-BzoC6bSz.mjs';
|
|
3
|
+
import { f as Theme, C as ColorValue } from '../formatting-gqLFeJ9X.mjs';
|
|
4
|
+
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, a as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as ShapeFill, l as ShapeOutline, m as ShapeType, n as TabLeader, o as TabStop, p as TabStopAlignment, q as TableBorders, e as TableCellFormatting, c as TableFormatting, r as TableLook, s as TableMeasurement, d as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, b as TextFormatting, T as TextModernEffects, x as ThemeColorScheme, y as ThemeColorSlot, z as ThemeFont, A as ThemeFontScheme, U as UnderlineStyle } from '../formatting-gqLFeJ9X.mjs';
|
|
5
|
+
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-AryxLAhx.mjs';
|
|
6
|
+
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-AryxLAhx.mjs';
|
|
7
7
|
import '../docx/wrapTypes.mjs';
|
|
8
8
|
|
|
9
9
|
interface CompatibilityFlags {
|
|
@@ -12,6 +12,9 @@ interface CompatibilityFlags {
|
|
|
12
12
|
doNotExpandShiftReturn: boolean;
|
|
13
13
|
useWord97LineBreakRules: boolean;
|
|
14
14
|
balanceSingleByteDoubleByteWidth: boolean;
|
|
15
|
+
doNotUseHTMLParagraphAutoSpacing?: boolean;
|
|
16
|
+
suppressSpBfAfterPgBrk?: boolean;
|
|
17
|
+
allowSpaceOfSameStyleInTable?: boolean;
|
|
15
18
|
}
|
|
16
19
|
/** Public model contract rehydrated by the Rust parser. */
|
|
17
20
|
interface DocumentSettings {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SdtControlState, a as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, b as ShapeEffect, c as ShapeTextBodyProperties, d as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-
|
|
2
|
-
import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-
|
|
1
|
+
import { S as SdtControlState, a as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, b as ShapeEffect, c as ShapeTextBodyProperties, d as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-BzoC6bSz.mjs';
|
|
2
|
+
import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-gqLFeJ9X.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Inline SDT widget metadata carried by a painted text run.
|
|
@@ -128,6 +128,8 @@ type RunFormatting = {
|
|
|
128
128
|
emphasisMark?: 'dot' | 'comma' | 'circle' | 'underDot';
|
|
129
129
|
/** Hidden run (OOXML w:vanish, §17.3.2.41). Painter skips the run. */
|
|
130
130
|
hidden?: boolean;
|
|
131
|
+
/** Run-level document-grid opt-out (OOXML w:snapToGrid, §17.3.2). Absent = on. */
|
|
132
|
+
snapToGrid?: boolean;
|
|
131
133
|
/**
|
|
132
134
|
* Per-run right-to-left direction (OOXML w:rtl, §17.3.2.30). Independent
|
|
133
135
|
* from the paragraph's bidi flag — a single run may flip direction within
|
|
@@ -330,6 +332,8 @@ type ImageRun = {
|
|
|
330
332
|
changeRevisionId?: number;
|
|
331
333
|
pmStart?: number;
|
|
332
334
|
pmEnd?: number;
|
|
335
|
+
/** Native inline DrawingML payload; present only for textless inline shapes. */
|
|
336
|
+
inlineShape?: unknown;
|
|
333
337
|
};
|
|
334
338
|
/** Run for an explicit w:br — ends the line, not the paragraph. */
|
|
335
339
|
type LineBreakRun = {
|
|
@@ -346,16 +350,22 @@ type FieldRun = RunFormatting & {
|
|
|
346
350
|
fieldType: 'PAGE' | 'NUMPAGES' | 'DATE' | 'TIME' | 'OTHER';
|
|
347
351
|
/**
|
|
348
352
|
* Raw Word field type token (e.g. `TOC`, `PAGEREF`) when `fieldType`
|
|
349
|
-
* collapsed it to a painter category. Carried for a11y announcement
|
|
353
|
+
* collapsed it to a painter category. Carried for a11y announcement, and
|
|
354
|
+
* read to number `SEQ` fields.
|
|
350
355
|
*/
|
|
351
356
|
rawType?: string;
|
|
352
357
|
/**
|
|
353
358
|
* Raw field instruction text (`w:instrText`), carried INERT so the display
|
|
354
|
-
* list can announce field identity. Never
|
|
359
|
+
* list can announce field identity. Never executed; only a `SEQ` field's is
|
|
360
|
+
* parsed, to number it.
|
|
355
361
|
*/
|
|
356
362
|
instruction?: string;
|
|
357
|
-
/**
|
|
363
|
+
/** Text shown when the painter doesn't resolve the field: Word's cached result, or a `SEQ` field's number. */
|
|
358
364
|
fallback?: string;
|
|
365
|
+
/** `w:fldLock`: the field keeps its cached result. */
|
|
366
|
+
locked?: boolean;
|
|
367
|
+
/** Sequences of `SEQ` fields nested in this field; they keep their cached results. */
|
|
368
|
+
nestedSequences?: string[];
|
|
359
369
|
pmStart?: number;
|
|
360
370
|
pmEnd?: number;
|
|
361
371
|
};
|
|
@@ -438,6 +448,11 @@ type ParagraphAttrs = {
|
|
|
438
448
|
/** w:widowControl, a toggle defaulting on: only an authored off is carried. */
|
|
439
449
|
widowControl?: boolean;
|
|
440
450
|
pageBreakBefore?: boolean;
|
|
451
|
+
/**
|
|
452
|
+
* The paragraph opens with a hard `w:br w:type="page"` run rather than
|
|
453
|
+
* carrying `w:pageBreakBefore`; Word keeps its space-before.
|
|
454
|
+
*/
|
|
455
|
+
pageBreakBeforeRun?: boolean;
|
|
441
456
|
styleId?: string;
|
|
442
457
|
effectiveStyleId?: string;
|
|
443
458
|
contextualSpacing?: boolean;
|
|
@@ -484,6 +499,14 @@ type ParagraphAttrs = {
|
|
|
484
499
|
pPrIns?: RevisionInfo | null;
|
|
485
500
|
/** Tracked-change marker on the paragraph mark (`<w:pPr><w:rPr><w:del/>`). */
|
|
486
501
|
pPrDel?: RevisionInfo | null;
|
|
502
|
+
/** Paragraph-level document-grid opt-out (OOXML w:snapToGrid, §17.3.1). Absent = on. */
|
|
503
|
+
snapToGrid?: boolean;
|
|
504
|
+
/** East Asian / Latin auto-spacing opt-out (OOXML w:autoSpaceDE, §17.3.1.11). Absent = on. */
|
|
505
|
+
autoSpaceDE?: boolean;
|
|
506
|
+
/** East Asian / number auto-spacing opt-out (OOXML w:autoSpaceDN, §17.3.1.12). Absent = on. */
|
|
507
|
+
autoSpaceDN?: boolean;
|
|
508
|
+
/** Section grid pitch in px (w:docGrid w:linePitch), gated to an activating grid type. Absent = no snap. */
|
|
509
|
+
docGridPitchPx?: number;
|
|
487
510
|
};
|
|
488
511
|
/**
|
|
489
512
|
* Flow block for one paragraph: its runs plus resolved attributes.
|
|
@@ -818,6 +841,7 @@ type ShapeBlock = {
|
|
|
818
841
|
y?: number;
|
|
819
842
|
/** Optional inner paragraphs for future text-bearing shape rendering. */
|
|
820
843
|
innerText?: ParagraphBlock[];
|
|
844
|
+
nestedSequences?: string[];
|
|
821
845
|
/** Pre-measured inner paragraph measures for display-list shape text. */
|
|
822
846
|
innerMeasures?: ParagraphExtent[];
|
|
823
847
|
/** Child shapes positioned relative to this shape's top-left corner. */
|
|
@@ -1498,6 +1522,8 @@ type Layout = {
|
|
|
1498
1522
|
footers?: Record<string, HeaderFooterLayout>;
|
|
1499
1523
|
/** Gap between pages in pixels (for rendering). */
|
|
1500
1524
|
pageGap?: number;
|
|
1525
|
+
/** Lays out only part of the document, so its page count is not the document's. */
|
|
1526
|
+
partial?: boolean;
|
|
1501
1527
|
};
|
|
1502
1528
|
/**
|
|
1503
1529
|
* Measured header/footer heights keyed by variant.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Paragraph, B as BlockContent, e as Comment } from '../content-
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { P as Paragraph, B as BlockContent, e as Comment } from '../content-BzoC6bSz.mjs';
|
|
2
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
|
|
2
|
-
|
|
2
|
+
import { F as FontLoadScope } from '../fontLoader-BNSs0E8K.mjs';
|
|
3
|
+
export { C as BufferFaceInput, D as FONT_MAPPING, E as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, G as createFontLoadScope, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, H as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, I as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, J as loadDocumentFonts, r as loadFont, K as loadFontDefinitions, s as loadFontFromBuffer, L as loadFontFromUrl, M as loadFontWithMapping, t as loadFonts, N as loadFontsWithMapping, O as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, P as registerDocumentFaces, x as resolveColor, Q as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-BNSs0E8K.mjs';
|
|
3
4
|
export { D as DocxInput, t as toArrayBuffer } from '../docxInput-DTbCa48g.mjs';
|
|
4
|
-
import { F as FontTable } from '../styles-
|
|
5
|
+
import { F as FontTable } from '../styles-AryxLAhx.mjs';
|
|
5
6
|
import { Document } from '../types/document.mjs';
|
|
6
7
|
import { FontOption } from './fontOptions.mjs';
|
|
7
8
|
export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH } from './sidebarConstants.mjs';
|
|
8
|
-
import { e as Comment } from '../content-
|
|
9
|
-
import '../formatting-
|
|
9
|
+
import { e as Comment } from '../content-BzoC6bSz.mjs';
|
|
10
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
10
11
|
import '../docx/wrapTypes.mjs';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -109,6 +110,17 @@ declare function extractEmbeddedFontFaces(document: Document): Promise<EmbeddedF
|
|
|
109
110
|
* @public
|
|
110
111
|
*/
|
|
111
112
|
declare function loadEmbeddedFonts(fontTable: FontTable | undefined, rawFonts: ReadonlyMap<string, ArrayBuffer>, fontTableRelsXml: string | null | undefined): Promise<Set<string>>;
|
|
113
|
+
/**
|
|
114
|
+
* {@link loadEmbeddedFonts}, resolving to the CSS family each embedded family
|
|
115
|
+
* was registered under: its own name, or an alias when another live document
|
|
116
|
+
* registered different faces under that name (see {@link registerDocumentFaces}).
|
|
117
|
+
* With a scope, the faces are held until its next document or its disposal,
|
|
118
|
+
* and a call that a later document load into the scope overtook resolves to
|
|
119
|
+
* an empty map.
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
declare function loadEmbeddedFontFamilies(fontTable: FontTable | undefined, rawFonts: ReadonlyMap<string, ArrayBuffer>, fontTableRelsXml: string | null | undefined, scope?: FontLoadScope): Promise<Map<string, string>>;
|
|
112
124
|
|
|
113
125
|
/**
|
|
114
126
|
* Discover the fonts a document actually references and that the browser can
|
|
@@ -208,6 +220,9 @@ interface HeadingInfo {
|
|
|
208
220
|
* Detection logic:
|
|
209
221
|
* 1. Check `outlineLevel` attr (set by OOXML parsing or style resolution)
|
|
210
222
|
* 2. Fallback to `styleId` matching /^[Hh]eading(\d)$/
|
|
223
|
+
*
|
|
224
|
+
* @deprecated A legacy tree walker kept for compatibility. `YrsSession.headings(story)` classifies
|
|
225
|
+
* headings with the engine's resolver, which also reads style inheritance and document defaults.
|
|
211
226
|
*/
|
|
212
227
|
declare function collectHeadings(doc: EditorTreeNode): HeadingInfo[];
|
|
213
228
|
|
|
@@ -485,4 +500,4 @@ declare function createComment(allocator: CommentIdAllocator, text: string, auth
|
|
|
485
500
|
*/
|
|
486
501
|
declare function sanitizeHref(href: string | null | undefined): string | undefined;
|
|
487
502
|
|
|
488
|
-
export { type CellAnchor, type ColorMode, type CommentIdAllocator, DEFAULT_PARAGRAPH_FLASH_COLOR, DEFAULT_PARAGRAPH_FLASH_DURATION_MS, type EmbeddedFontFace, type HeadingInfo, PARAGRAPH_FLASH_CLASS_NAME, PENDING_COMMENT_ID, type ParagraphHighlightOptions, type ReadDocxFileResult, type RenderableFontOptions, type ScrollToParaIdOptions, type SplitLayoutResult, type SplitTarget, type WordSelectionResult, buildAnchorMaps, collectHeadings, computeSplitDialogDefaults, computeSplitLayout, createComment, createCommentIdAllocator, createDoubleClickWordSelector, createTripleClickParagraphSelector, deobfuscateFont, excludeFontsByName, expandSelectionToWordBoundaries, extractEmbeddedFontFaces, findParagraphFragmentsByParaId, findWordAt, findWordBoundaries, flashParagraphElements, flashParagraphFragmentsByParaId, getEmbeddedFontFaces, getEmbeddedFontFamilies, getRenderableDocumentFonts, getWordAt, handleClickForMultiClick, isValidFontKey, loadEmbeddedFonts, prefersColorSchemeDark, readDocxFileFromInput, redistributeColumnWidths, resolveIsDark, sanitizeHref, selectParagraphAtCursor, selectRenderableFonts, selectWordAtCursor, selectWordInTextNode, subscribeSystemDark, sumColumnWidths };
|
|
503
|
+
export { type CellAnchor, type ColorMode, type CommentIdAllocator, DEFAULT_PARAGRAPH_FLASH_COLOR, DEFAULT_PARAGRAPH_FLASH_DURATION_MS, type EmbeddedFontFace, FontLoadScope, type HeadingInfo, PARAGRAPH_FLASH_CLASS_NAME, PENDING_COMMENT_ID, type ParagraphHighlightOptions, type ReadDocxFileResult, type RenderableFontOptions, type ScrollToParaIdOptions, type SplitLayoutResult, type SplitTarget, type WordSelectionResult, buildAnchorMaps, collectHeadings, computeSplitDialogDefaults, computeSplitLayout, createComment, createCommentIdAllocator, createDoubleClickWordSelector, createTripleClickParagraphSelector, deobfuscateFont, excludeFontsByName, expandSelectionToWordBoundaries, extractEmbeddedFontFaces, findParagraphFragmentsByParaId, findWordAt, findWordBoundaries, flashParagraphElements, flashParagraphFragmentsByParaId, getEmbeddedFontFaces, getEmbeddedFontFamilies, getRenderableDocumentFonts, getWordAt, handleClickForMultiClick, isValidFontKey, loadEmbeddedFontFamilies, loadEmbeddedFonts, prefersColorSchemeDark, readDocxFileFromInput, redistributeColumnWidths, resolveIsDark, sanitizeHref, selectParagraphAtCursor, selectRenderableFonts, selectWordAtCursor, selectWordInTextNode, subscribeSystemDark, sumColumnWidths };
|