@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as ImagePrimitive, D as DisplayList } from './frameDelta-
|
|
2
|
-
import { R as RustDisplayListQueryEngine } from './rustDisplayList-
|
|
1
|
+
import { I as ImagePrimitive, D as DisplayList } from './frameDelta-ByU7HBuB.mjs';
|
|
2
|
+
import { R as RustDisplayListQueryEngine } from './rustDisplayList-LcRZHCSL.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Locate an image primitive in a built DisplayList by its document position.
|
|
@@ -33,7 +33,7 @@ interface LocatedImagePrimitive {
|
|
|
33
33
|
* edge of a one-atom text selection).
|
|
34
34
|
*/
|
|
35
35
|
declare function findImagePrimitiveByDocPos(list: DisplayList, pos: number, region?: DisplayListImageRegion, rId?: string): LocatedImagePrimitive | null;
|
|
36
|
-
/** Topmost positioned image under a page-local point, or null. */
|
|
36
|
+
/** Topmost positioned image painted under a page-local point, or null. */
|
|
37
37
|
declare function findImagePrimitiveAtPoint(list: DisplayList, pageIndex: number, x: number, y: number, region?: DisplayListImageRegion, rId?: string): LocatedImagePrimitive | null;
|
|
38
38
|
/**
|
|
39
39
|
* Capture an inline body's authored anchor offsets from display-list geometry.
|
|
@@ -159,6 +159,10 @@ interface DisplayListParagraphGeometry extends DisplayListRect {
|
|
|
159
159
|
paraId?: string;
|
|
160
160
|
}
|
|
161
161
|
/** One ordered visual line reconstructed from authoritative primitives. */
|
|
162
|
+
interface VisualLineExtent {
|
|
163
|
+
top: number;
|
|
164
|
+
bottom: number;
|
|
165
|
+
}
|
|
162
166
|
interface DisplayListVisualLine extends DisplayListRect {
|
|
163
167
|
baseline: number;
|
|
164
168
|
from: number;
|
|
@@ -196,6 +200,10 @@ interface DisplayListQueries {
|
|
|
196
200
|
paragraphRects(pos: number): DisplayListParagraphGeometry[];
|
|
197
201
|
/** Ordered body visual lines across all pages. */
|
|
198
202
|
visualLines(): readonly DisplayListVisualLine[];
|
|
203
|
+
/** The part of {@link visualLines} on one page, computed for that page alone. */
|
|
204
|
+
visualLinesOnPage(pageIndex: number): readonly DisplayListVisualLine[];
|
|
205
|
+
/** Vertical span of the page's visual lines in page coordinates, or null when it has none. */
|
|
206
|
+
visualLineExtent(pageIndex: number): VisualLineExtent | null;
|
|
199
207
|
/** Visual line containing `pos`, or null. */
|
|
200
208
|
visualLineAtPosition(pos: number): DisplayListVisualLine | null;
|
|
201
209
|
/** Topmost image under a page-local point. Body by default. */
|
|
@@ -267,6 +275,11 @@ interface DisplayListQueries {
|
|
|
267
275
|
*/
|
|
268
276
|
dispose(): void;
|
|
269
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Ends `line`: its superseded facades answer nothing until a facade of the same
|
|
280
|
+
* line is built. Call it when the session behind the line goes away.
|
|
281
|
+
*/
|
|
282
|
+
declare function endDisplayListQueriesLine(line: object): void;
|
|
270
283
|
type DisplayListQuerySource = RustDisplayListQueryEngine | ResidentDisplayListQueryEngine;
|
|
271
284
|
/** True once a query trapped in this engine's wasm instance. */
|
|
272
285
|
declare function isDisplayListQuerySourceDead(engine: DisplayListQuerySource | null | undefined): boolean;
|
|
@@ -282,7 +295,12 @@ declare function onDisplayListQuerySourceFailure(listener: (error: Error) => voi
|
|
|
282
295
|
* facade takes over the previous parsed list and patches only the pages that
|
|
283
296
|
* changed. The donor facade's remaining queries degrade to its own JSON-arg
|
|
284
297
|
* path (same stale-list semantics it always had after replacement).
|
|
298
|
+
*
|
|
299
|
+
* `line` names the document the list lays out, such as its load. A facade of another
|
|
300
|
+
* document starts a new line and ends the previous one, so a facade of the
|
|
301
|
+
* replaced document never answers from the new one. Without `line` a superseded
|
|
302
|
+
* facade answers from its own list.
|
|
285
303
|
*/
|
|
286
|
-
declare function createDisplayListQueries(list: DisplayList, engine?: RustDisplayListQueryEngine | ResidentDisplayListQueryEngine, previous?: DisplayListQueries | null): DisplayListQueries;
|
|
304
|
+
declare function createDisplayListQueries(list: DisplayList, engine?: RustDisplayListQueryEngine | ResidentDisplayListQueryEngine, previous?: DisplayListQueries | null, line?: object | null): DisplayListQueries;
|
|
287
305
|
|
|
288
|
-
export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListHoverTarget as d, type DisplayListImageGeometry as e, type DisplayListImageRegion as f, type DisplayListParagraphGeometry as g, type DisplayListQuerySourceState as h, type DisplayListVerticalMove as i, type DisplayListVisualLine as j, captureInlinePositionEmuFromDisplayList as k, createDisplayListQueries as l,
|
|
306
|
+
export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type VisualLineExtent as V, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListHoverTarget as d, type DisplayListImageGeometry as e, type DisplayListImageRegion as f, type DisplayListParagraphGeometry as g, type DisplayListQuerySourceState as h, type DisplayListVerticalMove as i, type DisplayListVisualLine as j, captureInlinePositionEmuFromDisplayList as k, createDisplayListQueries as l, endDisplayListQueriesLine as m, findImagePrimitiveAtPoint as n, findImagePrimitiveByDocPos as o, isDisplayListQuerySourceDead as p, onDisplayListQuerySourceFailure as q };
|
package/dist/docx/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { a as attemptSelectiveSave,
|
|
1
|
+
export { a as attemptSelectiveSave, p as parseDocx } from '../selectiveSave-r-NMK6aI.mjs';
|
|
2
|
+
export { c as createDocx, r as repackDocx, u as updateMultipleFiles } from '../rezip-Bxiq4Z_R.mjs';
|
|
2
3
|
import { WrapType } from './wrapTypes.mjs';
|
|
3
|
-
import { B as BlockContent, e as Comment, W as Watermark } from '../content-
|
|
4
|
+
import { B as BlockContent, e as Comment, W as Watermark } from '../content-BzoC6bSz.mjs';
|
|
4
5
|
import { Document } from '../types/document.mjs';
|
|
5
6
|
import '../docxInput-DTbCa48g.mjs';
|
|
6
|
-
import '../formatting-
|
|
7
|
-
import '../styles-
|
|
7
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
8
|
+
import '../styles-AryxLAhx.mjs';
|
|
8
9
|
|
|
9
10
|
type AnchorWrapType = Exclude<WrapType, 'inline'>;
|
|
10
11
|
type ImageLayoutTarget = AnchorWrapType | 'squareLeft' | 'squareRight' | 'inline';
|
package/dist/docx/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export{h as attemptSelectiveSave,g as createDocx,a as parseDocx,e as repackDocx,f as updateMultipleFiles}from'../chunk-NMDQHUQB.mjs';import {a}from'../chunk-RZQ3OXZY.mjs';import'../chunk-ND3FBCB3.mjs';import'../chunk-YLFKV2NT.mjs';import'../chunk-LT2GCWZ3.mjs';import'../chunk-HPZFJGGM.mjs';import'../chunk-2QHGQA3V.mjs';import'../chunk-3CYO46ML.mjs';import'../chunk-6CHGYCFU.mjs';import'../chunk-DLXIZBB6.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e,t){let o=e.package,r=o.document,i=o.headers,p=j(e),a$1=new Set;if(i)for(let n of i.values())a$1.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a$1.has("first"),d=l&&!a$1.has("even");if(!m&&!f&&!d)return e;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:a.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
|
|
2
2
|
export{_ as IMAGE_LAYOUT_OPTIONS,E as calculateResizedImageDimensions,W as deriveLayoutChoice,$ as getDocumentWatermark,K as injectReplyRangeMarkers,X as injectTCReplyRangeMarkers,B as isImageLayoutOptionEnabled,q as resolveImageLayoutAttrs,Y as setDocumentWatermark,z as toolbarValueToLayoutTarget};
|
package/dist/editor/index.d.mts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { R as ResidentMeasurementConfig } from '../rustMeasureSource-
|
|
2
|
-
import { L as Layout, a as LayoutOptions } from '../types-
|
|
1
|
+
import { R as ResidentMeasurementConfig } from '../rustMeasureSource-BkCx1FDx.mjs';
|
|
2
|
+
import { L as Layout, a as LayoutOptions } from '../types-D6Pra38E.mjs';
|
|
3
3
|
import { MeasuredBlock } from '../layout/pagination/index.mjs';
|
|
4
|
-
import { D as DisplayListHeadersFooters } from '../rustDisplayList-
|
|
4
|
+
import { D as DisplayListHeadersFooters } from '../rustDisplayList-LcRZHCSL.mjs';
|
|
5
5
|
import { Document } from '../types/document.mjs';
|
|
6
|
-
import { Y as YrsSession, a as YrsRenderEnv } from '../index-
|
|
7
|
-
import { f as SectionProperties, N as NoteKind, g as DocumentBody } from '../content-
|
|
8
|
-
import '../formatting-
|
|
9
|
-
import '../frameDelta-
|
|
10
|
-
import '../styles-
|
|
6
|
+
import { Y as YrsSession, a as YrsRenderEnv } from '../index-CHy6_Yuo.mjs';
|
|
7
|
+
import { f as SectionProperties, N as NoteKind, g as DocumentBody } from '../content-BzoC6bSz.mjs';
|
|
8
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
9
|
+
import '../frameDelta-ByU7HBuB.mjs';
|
|
10
|
+
import '../styles-AryxLAhx.mjs';
|
|
11
|
+
import '../pagedExport---0Dlmzo.mjs';
|
|
12
|
+
import '../loadWasmAsset-Cr95TImt.mjs';
|
|
13
|
+
import '../rezip-Bxiq4Z_R.mjs';
|
|
11
14
|
import '../docx/wrapTypes.mjs';
|
|
12
15
|
|
|
13
16
|
interface ResidentRegionLayoutRequest {
|
|
@@ -47,8 +50,15 @@ declare function getLayoutKernelInputs(layout: Layout): {
|
|
|
47
50
|
measured: MeasuredBlock[];
|
|
48
51
|
options: unknown;
|
|
49
52
|
headersFooters?: DisplayListHeadersFooters;
|
|
53
|
+
layoutRevision?: number;
|
|
50
54
|
} | undefined;
|
|
51
55
|
declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;
|
|
56
|
+
/**
|
|
57
|
+
* The layout a resident worker ran, from its region layout reply. The
|
|
58
|
+
* measured blocks stay in the worker, so the main-thread display fallback has
|
|
59
|
+
* to lay the document out on this thread first.
|
|
60
|
+
*/
|
|
61
|
+
declare function workerLayoutComputation(layoutJson: string, layoutRevision?: number): LayoutComputation;
|
|
52
62
|
|
|
53
63
|
/**
|
|
54
64
|
* The last section with inherited references; `finalSectionProperties`
|
|
@@ -61,4 +71,4 @@ declare function resolvedFinalSectionProperties(body: DocumentBody | null | unde
|
|
|
61
71
|
*/
|
|
62
72
|
declare function updateFinalSectionProperties(body: DocumentBody, update: (properties: SectionProperties) => SectionProperties): DocumentBody;
|
|
63
73
|
|
|
64
|
-
export { type ComputeLayoutInputs, type LayoutComputation, buildResidentRegionLayoutRequest, computeLayout, getLayoutKernelInputs, resolvedFinalSectionProperties, updateFinalSectionProperties };
|
|
74
|
+
export { type ComputeLayoutInputs, type LayoutComputation, buildResidentRegionLayoutRequest, computeLayout, getLayoutKernelInputs, resolvedFinalSectionProperties, updateFinalSectionProperties, workerLayoutComputation };
|
package/dist/editor/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{c as buildResidentRegionLayoutRequest,e as computeLayout,d as getLayoutKernelInputs,a as resolvedFinalSectionProperties,b as updateFinalSectionProperties,f as workerLayoutComputation}from'../chunk-NVN26RHH.mjs';import'../chunk-TTRUPDAB.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-
|
|
1
|
+
import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-gqLFeJ9X.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Color primitives and math shared across OOXML formats.
|
|
@@ -222,6 +222,28 @@ declare function colorsEqual(color1: ColorValue | undefined | null, color2: Colo
|
|
|
222
222
|
* - Callback notifications
|
|
223
223
|
* - Font availability detection
|
|
224
224
|
*/
|
|
225
|
+
/**
|
|
226
|
+
* The loads and notifications of one editor instance; see
|
|
227
|
+
* {@link createFontLoadScope}.
|
|
228
|
+
*
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
231
|
+
interface FontLoadScope {
|
|
232
|
+
/** Hears the loads this scope asked for and module-level loads, not other scopes' loads. */
|
|
233
|
+
onFontsLoaded(callback: (fonts: string[]) => void): () => void;
|
|
234
|
+
/** Hears the failures of this scope's loads and of module-level loads. */
|
|
235
|
+
onFontError(callback: (error: Error) => void): () => void;
|
|
236
|
+
/** {@link loadDocumentFonts} on behalf of this scope. */
|
|
237
|
+
loadDocumentFonts(document: unknown): Promise<void>;
|
|
238
|
+
/** {@link loadFontsWithMapping} on behalf of this scope. */
|
|
239
|
+
loadFontsWithMapping(families: string[]): Promise<void>;
|
|
240
|
+
/** {@link loadFontDefinitions} on behalf of this scope. */
|
|
241
|
+
loadFontDefinitions(defs: ReadonlyArray<FontDefinition> | undefined): Promise<void>;
|
|
242
|
+
/** Drops the listeners and releases the embedded faces this scope holds; a later listener revives it. */
|
|
243
|
+
dispose(): void;
|
|
244
|
+
/** Whether it is disposed and not revived since. */
|
|
245
|
+
readonly disposed: boolean;
|
|
246
|
+
}
|
|
225
247
|
/**
|
|
226
248
|
* Load a font from Google Fonts
|
|
227
249
|
*
|
|
@@ -341,6 +363,28 @@ declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, opt
|
|
|
341
363
|
weight?: number | string;
|
|
342
364
|
style?: 'normal' | 'italic';
|
|
343
365
|
}): Promise<boolean>;
|
|
366
|
+
/** One face of a font file's bytes, as {@link registerDocumentFaces} takes it. */
|
|
367
|
+
interface BufferFaceInput {
|
|
368
|
+
family: string;
|
|
369
|
+
data: ArrayBuffer;
|
|
370
|
+
weight?: number | string;
|
|
371
|
+
style?: 'normal' | 'italic';
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Registers one document's font faces from their bytes. Each family takes its
|
|
375
|
+
* own name, as {@link loadFontFromBuffer} registers it, unless a live
|
|
376
|
+
* registration holds different bytes under that name; then all its faces take
|
|
377
|
+
* an alias, so both documents keep their own glyphs. Faces with the same bytes
|
|
378
|
+
* are registered once. With a scope, the faces are held until the scope loads
|
|
379
|
+
* its next document or is disposed; without one, for the page's lifetime.
|
|
380
|
+
* `faces` may be a promise: the scope's next document is the one whose call
|
|
381
|
+
* came last, whichever faces arrive first. Resolves to the CSS family each
|
|
382
|
+
* family was registered under, for the families with at least one face that
|
|
383
|
+
* loaded, or to an empty map once a later document or disposal replaced it.
|
|
384
|
+
*
|
|
385
|
+
* @public
|
|
386
|
+
*/
|
|
387
|
+
declare function registerDocumentFaces(faces: readonly BufferFaceInput[] | PromiseLike<readonly BufferFaceInput[]>, scope?: FontLoadScope): Promise<Map<string, string>>;
|
|
344
388
|
/**
|
|
345
389
|
* Load a font face from a URL (woff2, woff, ttf, otf).
|
|
346
390
|
*
|
|
@@ -450,5 +494,14 @@ declare function extractFontsFromDocument(document: unknown): Set<string>;
|
|
|
450
494
|
* @returns Promise resolving when fonts are loaded
|
|
451
495
|
*/
|
|
452
496
|
declare function loadDocumentFonts(document: unknown): Promise<void>;
|
|
497
|
+
/**
|
|
498
|
+
* A scope for one editor instance's font loads. Loads made through it notify
|
|
499
|
+
* its own `onFontsLoaded` / `onFontError` listeners and the module-level ones,
|
|
500
|
+
* never another scope's; module-level loads still reach every scope, so a
|
|
501
|
+
* single editor hears what it heard before. Dedupe and caches stay shared.
|
|
502
|
+
*
|
|
503
|
+
* @public
|
|
504
|
+
*/
|
|
505
|
+
declare function createFontLoadScope(): FontLoadScope;
|
|
453
506
|
|
|
454
|
-
export { resolveShadingColor as A, setGoogleFontsEnabled as B, type
|
|
507
|
+
export { resolveShadingColor as A, setGoogleFontsEnabled as B, type BufferFaceInput as C, FONT_MAPPING as D, type FontDefinition as E, type FontLoadScope as F, createFontLoadScope as G, extractFontsFromDocument as H, getGoogleFontEquivalent as I, loadDocumentFonts as J, loadFontDefinitions as K, loadFontFromUrl as L, loadFontWithMapping as M, loadFontsWithMapping as N, onFontError as O, registerDocumentFaces as P, resolveColorToHex as Q, type ThemeMatrixCell as T, colorsEqual as a, blendColors as b, canRenderFont as c, createRgbColor as d, createThemeColor as e, darkenColor as f, ensureHexPrefix as g, generateThemeTintShadeMatrix as h, getContrastingColor as i, getLoadedFonts as j, getThemeTintShadeHex as k, isBlack as l, isFontLoaded as m, isLoading as n, isGoogleFontsEnabled as o, isWhite as p, lightenColor as q, loadFont as r, loadFontFromBuffer as s, loadFonts as t, onFontsLoaded as u, parseColorString as v, preloadCommonFonts as w, resolveColor as x, resolveHighlightColor as y, resolveHighlightToCss as z };
|
|
@@ -331,6 +331,8 @@ interface TextFormatting {
|
|
|
331
331
|
rtl?: boolean;
|
|
332
332
|
/** Complex script formatting (w:cs) */
|
|
333
333
|
cs?: boolean;
|
|
334
|
+
/** Snap to document grid (w:snapToGrid). Absent is the OOXML default (on). */
|
|
335
|
+
snapToGrid?: boolean;
|
|
334
336
|
/** Character style ID (w:rStyle) */
|
|
335
337
|
styleId?: string;
|
|
336
338
|
}
|
|
@@ -443,6 +445,12 @@ interface ParagraphFormatting {
|
|
|
443
445
|
pageBreakBefore?: boolean;
|
|
444
446
|
/** Contextual spacing — suppress space between paragraphs of the same style (w:contextualSpacing) */
|
|
445
447
|
contextualSpacing?: boolean;
|
|
448
|
+
/** Snap to document grid (w:snapToGrid on pPr). Absent is the OOXML default (on). */
|
|
449
|
+
snapToGrid?: boolean;
|
|
450
|
+
/** Space between East Asian and Latin text (w:autoSpaceDE). Absent is the OOXML default (on). */
|
|
451
|
+
autoSpaceDE?: boolean;
|
|
452
|
+
/** Space between East Asian text and numbers (w:autoSpaceDN). Absent is the OOXML default (on). */
|
|
453
|
+
autoSpaceDN?: boolean;
|
|
446
454
|
/** Numbering properties (w:numPr) */
|
|
447
455
|
numPr?: {
|
|
448
456
|
/** Numbering definition ID (w:numId) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TextModernEffects } from './formatting-
|
|
2
|
-
import { D as DrawingScene, c as ShapeTextBodyProperties } from './content-
|
|
1
|
+
import { T as TextModernEffects } from './formatting-gqLFeJ9X.mjs';
|
|
2
|
+
import { D as DrawingScene, c as ShapeTextBodyProperties } from './content-BzoC6bSz.mjs';
|
|
3
3
|
|
|
4
4
|
interface DisplayList {
|
|
5
5
|
/** Contract version. Undefined reads as legacy version 0. */
|
|
@@ -31,6 +31,8 @@ interface DisplayPage {
|
|
|
31
31
|
/** Formatted PAGE label (for example, "vii"). */
|
|
32
32
|
pageLabel?: string;
|
|
33
33
|
primitives: DisplayPrimitive[];
|
|
34
|
+
/** Leading primitives painted beneath the header and footer. */
|
|
35
|
+
watermarkPrimitiveCount?: number;
|
|
34
36
|
/** Resolved page background. Undefined = transparent/host white. */
|
|
35
37
|
background?: string;
|
|
36
38
|
pageBorders?: PageBorderPrimitive[];
|
|
@@ -38,6 +40,10 @@ interface DisplayPage {
|
|
|
38
40
|
footer?: HfRegion;
|
|
39
41
|
/** Footnote/endnote regions in page coordinates. Undefined = none. */
|
|
40
42
|
noteAreas?: NoteRegion[];
|
|
43
|
+
/** Geometry only: the page's content is built when the host asks for it. */
|
|
44
|
+
unbuilt?: boolean;
|
|
45
|
+
/** For an unbuilt page, the lowest and highest body position its layout places. */
|
|
46
|
+
positionSpan?: [number, number];
|
|
41
47
|
}
|
|
42
48
|
/** A page-local rectangle emitted as display-list metadata. */
|
|
43
49
|
interface DisplayBounds {
|
|
@@ -299,6 +305,8 @@ interface DocAttrs {
|
|
|
299
305
|
clipGroup?: DisplayClipGroupMetadata;
|
|
300
306
|
/** Enclosing table-fragment identity and accessibility semantics. */
|
|
301
307
|
table?: DisplayTableMetadata;
|
|
308
|
+
/** Inline native-shape atom; true only for paragraph-inline shapes. */
|
|
309
|
+
inlineShapeAtom?: boolean;
|
|
302
310
|
}
|
|
303
311
|
interface TextRunPrimitive extends DocAttrs {
|
|
304
312
|
kind: 'text';
|
|
@@ -714,12 +722,20 @@ interface FramePositionShiftRun {
|
|
|
714
722
|
readonly changedMask: number;
|
|
715
723
|
readonly delta: number;
|
|
716
724
|
}
|
|
725
|
+
/** A note region note's new backlink anchor; null clears the field. */
|
|
726
|
+
interface FrameNoteAnchor {
|
|
727
|
+
readonly area: number;
|
|
728
|
+
readonly note: number;
|
|
729
|
+
readonly start: number | null;
|
|
730
|
+
readonly end: number | null;
|
|
731
|
+
}
|
|
717
732
|
interface FramePagePositionShift {
|
|
718
733
|
readonly kind: 'shift-positions';
|
|
719
734
|
readonly pageIndex: number;
|
|
720
735
|
readonly pageId: bigint;
|
|
721
736
|
readonly fingerprint: bigint;
|
|
722
737
|
readonly runs: readonly FramePositionShiftRun[];
|
|
738
|
+
readonly anchors: readonly FrameNoteAnchor[];
|
|
723
739
|
}
|
|
724
740
|
type FramePageOperation = FramePageUpsert | FramePageRemove | FramePageMove | FramePagePositionPatch | FramePagePositionShift;
|
|
725
741
|
interface DecodedFrameDelta {
|
|
@@ -769,5 +785,20 @@ declare function applyFrameDelta(previous: RetainedFrame | null, delta: DecodedF
|
|
|
769
785
|
* geometry shifts from creating periodic multi-megabyte GC stalls.
|
|
770
786
|
*/
|
|
771
787
|
declare function applyFrameDeltaOwned(previous: RetainedFrame | null, delta: DecodedFrameDelta): RetainedFrame;
|
|
788
|
+
/**
|
|
789
|
+
* Hidden in-place mutation counter for one display page. The owned delta path
|
|
790
|
+
* (`applyFrameDeltaOwned`) patches primitive positions through the SAME page
|
|
791
|
+
* object, so page identity alone cannot prove content equality; identity-based
|
|
792
|
+
* consumers (query-facade handle adoption) must compare this revision too. The
|
|
793
|
+
* property is non-enumerable, so serialization and structural reads never see
|
|
794
|
+
* it.
|
|
795
|
+
*/
|
|
796
|
+
declare function displayPageRevision(page: DisplayPage): number;
|
|
797
|
+
/**
|
|
798
|
+
* Counts the owned shifts that moved this page's note anchors in place, for
|
|
799
|
+
* consumers that render the anchors (the accessibility mirror) and otherwise
|
|
800
|
+
* key on page identity.
|
|
801
|
+
*/
|
|
802
|
+
declare function displayPageNoteAnchorRevision(page: DisplayPage): number;
|
|
772
803
|
|
|
773
|
-
export { type DisplayList as D, FRAME_DELTA_HEADER_BYTES as F, type GlyphRunPrimitive as G, type HfRegion as H, type ImagePrimitive as I, type LinePrimitive as L, type PositionedGlyph as P, type RetainedFrame as R, type TextRunPrimitive as T, type DisplayPage as a, type DisplayPrimitive as b, type DecodedFrameDelta as c, type DecorationPrimitive as d, type DisplayBounds as e, type DocAttrs as f, FRAME_DELTA_PAGE_OP_BYTES as g, FRAME_DELTA_VERSION as h, FrameDeltaError as i, type FrameDeltaErrorCode as j, type FramePageOperation as k, type RectPrimitive as l, type RetainedFramePage as m, type TableCellRef as n, applyFrameDelta as o, applyFrameDeltaOwned as p, decodeFrameDelta as q };
|
|
804
|
+
export { type DisplayList as D, FRAME_DELTA_HEADER_BYTES as F, type GlyphRunPrimitive as G, type HfRegion as H, type ImagePrimitive as I, type LinePrimitive as L, type PositionedGlyph as P, type RetainedFrame as R, type TextRunPrimitive as T, type DisplayPage as a, type DisplayPrimitive as b, type DecodedFrameDelta as c, type DecorationPrimitive as d, type DisplayBounds as e, type DocAttrs as f, FRAME_DELTA_PAGE_OP_BYTES as g, FRAME_DELTA_VERSION as h, FrameDeltaError as i, type FrameDeltaErrorCode as j, type FramePageOperation as k, type RectPrimitive as l, type RetainedFramePage as m, type TableCellRef as n, applyFrameDelta as o, applyFrameDeltaOwned as p, decodeFrameDelta as q, displayPageNoteAnchorRevision as r, displayPageRevision as s };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|