@silurus/ooxml 0.82.0 → 0.83.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 +72 -3
- package/dist/assets/{render-worker-7-Zr7fSw.js → render-worker-Bu31cf1J.js} +4 -4
- package/dist/assets/render-worker-DuztdEcX.js +11 -0
- package/dist/{canvas-viewer-mechanics-CS_qbr6T.js → canvas-viewer-mechanics-h07vpVOQ.js} +42 -2
- package/dist/{comment-ui-runtime-BAe30Ct9.js → comment-ui-runtime-BelHJt73.js} +3 -3
- package/dist/{comment-ui-runtime-BUCj4hWn.js → comment-ui-runtime-DD5a3x3k.js} +3 -3
- package/dist/comment-ui-runtime-DTGN3Vyy.js +2 -0
- package/dist/{comments-Cf9W7r3M.js → comments-AAaNnQTi.js} +7 -2
- package/dist/{document-pull-client-BCgmytqI.js → document-pull-client-BAhqoTmm.js} +4509 -3953
- package/dist/docx-Dg73PGgC.js +2707 -0
- package/dist/docx.mjs +6 -6
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/dom-interaction-boundary-CepOlXt6.js +217 -0
- package/dist/index.mjs +4 -4
- package/dist/line-distribute-D7A_wnJg.js +1003 -0
- package/dist/{line-metrics-B3syvDn2.js → line-metrics-Bpn7OeZD.js} +616 -616
- package/dist/node.mjs +308 -308
- package/dist/pptx-BcUCETmQ.js +2990 -0
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{read-only-comment-margin-Dn2y55W6.js → read-only-comment-margin-DrUX-YrP.js} +1 -1
- package/dist/{render-CenWM4g1.js → render-CL-7V3E8.js} +1 -1
- package/dist/{render-worker-host-BNENN3qP.js → render-worker-host-DDZo0feh.js} +1 -1
- package/dist/{render-worker-host-BmH3kGSj.js → render-worker-host-FJ19-fUI.js} +1 -1
- package/dist/{resource-measurement-CsW4_eYt.js → resource-measurement-DuiFWzam.js} +3 -3
- package/dist/{session-Cky_swUj.js → session-BjydZEDF.js} +107 -94
- package/dist/{slide-pull-client-CqTVFb3W.js → slide-pull-client-CwvvncPA.js} +1199 -970
- package/dist/types/docx.d.ts +99 -7
- package/dist/types/index.d.ts +189 -12
- package/dist/types/node.d.ts +385 -379
- package/dist/types/pptx.d.ts +96 -5
- package/dist/types/xlsx.d.ts +4 -2
- package/dist/{worksheet-pull-client-CYtwXP5D.js → worksheet-pull-client-DyFsDF4A.js} +32 -32
- package/dist/{xlsx-DlV37-0j.js → xlsx-BibrHQ52.js} +477 -477
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +4 -1
- package/dist/assets/render-worker-B5gsW6b5.js +0 -11
- package/dist/comment-ui-runtime-F4a3te6p.js +0 -2
- package/dist/docx-wokGKYfi.js +0 -2162
- package/dist/dom-interaction-boundary-C8F6HO5x.js +0 -119
- package/dist/line-distribute-iXsUCIH-.js +0 -1003
- package/dist/pptx-DU8L8I2T.js +0 -2432
- /package/dist/{comment-occurrence-C34fWs_F.js → comment-occurrence-X54si2ob.js} +0 -0
- /package/dist/{highlight-rect-MaCt0om0.js → highlight-rect-Hes0z_Mj.js} +0 -0
package/dist/types/docx.d.ts
CHANGED
|
@@ -1069,7 +1069,7 @@ interface ChartRegionMapRenderer {
|
|
|
1069
1069
|
render(ctx: CanvasRenderingContext2D, chart: ChartModel, rect: ChartRect, ptToPx: number, shapeRotationDeg?: number): boolean;
|
|
1070
1070
|
}
|
|
1071
1071
|
//#endregion
|
|
1072
|
-
//#region dist/.types-work/hyperlink-
|
|
1072
|
+
//#region dist/.types-work/hyperlink-Bk5fiM_m.d.ts
|
|
1073
1073
|
type OoxmlErrorCode = 'encrypted' | 'invalid-password' | 'unsupported-encryption' | 'legacy-binary-format' | 'not-ooxml';
|
|
1074
1074
|
type OoxmlErrorStage = 'container' | 'decompression' | 'parsing' | 'serialization' | 'layout' | 'rendering' | 'worker';
|
|
1075
1075
|
declare class OoxmlError extends Error {
|
|
@@ -1142,6 +1142,14 @@ interface OoxmlResourceLimits {
|
|
|
1142
1142
|
maxTotalInflatedBytes?: OoxmlResourceLimit;
|
|
1143
1143
|
maxArchiveEntries?: OoxmlResourceLimit;
|
|
1144
1144
|
}
|
|
1145
|
+
interface ProgressiveLayoutProgress {
|
|
1146
|
+
committedUnits: number;
|
|
1147
|
+
}
|
|
1148
|
+
interface ProgressiveLayoutPartial {
|
|
1149
|
+
availableUnits: number;
|
|
1150
|
+
totalUnits?: number;
|
|
1151
|
+
exact: boolean;
|
|
1152
|
+
}
|
|
1145
1153
|
interface LoadOptions$1 {
|
|
1146
1154
|
useGoogleFonts?: boolean;
|
|
1147
1155
|
password?: string;
|
|
@@ -1236,7 +1244,7 @@ interface FindHighlightColors {
|
|
|
1236
1244
|
active?: string;
|
|
1237
1245
|
}
|
|
1238
1246
|
//#endregion
|
|
1239
|
-
//#region dist/.types-work/
|
|
1247
|
+
//#region dist/.types-work/types-B2UaFocY.d.ts
|
|
1240
1248
|
interface DocxDocumentModel {
|
|
1241
1249
|
section: SectionProps;
|
|
1242
1250
|
body: BodyElement[];
|
|
@@ -1979,7 +1987,10 @@ interface RenderPageOptions {
|
|
|
1979
1987
|
defaultTextColor?: string;
|
|
1980
1988
|
onTextRun?: (run: DocxTextRunInfo) => void;
|
|
1981
1989
|
currentDate?: Date | number;
|
|
1990
|
+
showTrackedChanges?: boolean;
|
|
1982
1991
|
}
|
|
1992
|
+
//#endregion
|
|
1993
|
+
//#region dist/.types-work/docx-CBra4_iJ.d.ts
|
|
1983
1994
|
interface CommentAnchorRange {
|
|
1984
1995
|
readonly commentId: string;
|
|
1985
1996
|
readonly source: Readonly<DocxStorySource>;
|
|
@@ -2086,6 +2097,7 @@ declare function readDocxTextSelectionContext(root: HTMLElement, selection: Sele
|
|
|
2086
2097
|
interface DocxElementContextOptions {
|
|
2087
2098
|
readonly maxTextCharacters?: number;
|
|
2088
2099
|
readonly currentDate?: Date | number;
|
|
2100
|
+
readonly showTrackedChanges?: boolean;
|
|
2089
2101
|
}
|
|
2090
2102
|
interface RevisionAnchorRange {
|
|
2091
2103
|
readonly revisionIndex: number;
|
|
@@ -2102,8 +2114,15 @@ declare function resolveRevisionAnchorRuns(anchor: Readonly<RevisionAnchorRange>
|
|
|
2102
2114
|
interface LoadOptions extends LoadOptions$1 {
|
|
2103
2115
|
math?: MathRenderer;
|
|
2104
2116
|
mode?: 'main' | 'worker';
|
|
2117
|
+
sliceLayout?: boolean;
|
|
2118
|
+
onLayoutProgress?: (progress: Readonly<ProgressiveLayoutProgress>) => void;
|
|
2119
|
+
progressiveLayout?: boolean;
|
|
2120
|
+
onLayoutComplete?: (error?: unknown) => void;
|
|
2121
|
+
onLayoutPartial?: (progress: Readonly<ProgressiveLayoutPartial>) => void;
|
|
2122
|
+
showTrackedChanges?: boolean;
|
|
2123
|
+
currentDate?: Date | number;
|
|
2105
2124
|
}
|
|
2106
|
-
type CollectPageRunsOptions = Pick<RenderPageOptions, 'width' | 'currentDate'>;
|
|
2125
|
+
type CollectPageRunsOptions = Pick<RenderPageOptions, 'width' | 'currentDate' | 'showTrackedChanges'>;
|
|
2107
2126
|
interface DocxPageCommentThreadsOptions extends CollectPageRunsOptions, ResolveDocxCommentThreadsOptions {}
|
|
2108
2127
|
type RenderPageToBitmapOptions = Omit<RenderPageOptions, 'onTextRun'> & {
|
|
2109
2128
|
onTextRun?: (run: DocxTextRunInfo) => void;
|
|
@@ -2114,10 +2133,19 @@ declare class DocxDocument {
|
|
|
2114
2133
|
private _source;
|
|
2115
2134
|
private _meta;
|
|
2116
2135
|
private _review;
|
|
2136
|
+
private readonly _layoutLifecycle;
|
|
2137
|
+
private readonly _layoutObservers;
|
|
2138
|
+
private _layoutCompletion;
|
|
2139
|
+
private _layoutAbort;
|
|
2117
2140
|
private _bookmarkPages;
|
|
2118
2141
|
private _commentAnchorRanges;
|
|
2119
2142
|
private _revisionAnchorRanges;
|
|
2120
|
-
private
|
|
2143
|
+
private _reviewProjectionIndex;
|
|
2144
|
+
private _parseRequestId;
|
|
2145
|
+
private _progressive;
|
|
2146
|
+
private _parseWatchdog;
|
|
2147
|
+
private _parseWatchdogMs;
|
|
2148
|
+
private _layoutViewGeneration;
|
|
2121
2149
|
private _mode;
|
|
2122
2150
|
private _threeD;
|
|
2123
2151
|
private _regionMap;
|
|
@@ -2132,6 +2160,18 @@ declare class DocxDocument {
|
|
|
2132
2160
|
private constructor();
|
|
2133
2161
|
static load(source: string | ArrayBuffer, opts?: LoadOptions): Promise<DocxDocument>;
|
|
2134
2162
|
private _parse;
|
|
2163
|
+
private _onWorkerLayoutPush;
|
|
2164
|
+
private _applyLayoutPartial;
|
|
2165
|
+
private _onAuthoritativeMeta;
|
|
2166
|
+
private _invalidateLayoutDerivedCaches;
|
|
2167
|
+
private _replaceMainLayoutPublication;
|
|
2168
|
+
private _isLayoutViewActive;
|
|
2169
|
+
private _rearmParseWatchdog;
|
|
2170
|
+
private _clearParseWatchdog;
|
|
2171
|
+
private _onParseWentSilent;
|
|
2172
|
+
private _failWorkerProgressive;
|
|
2173
|
+
private _parseViewFields;
|
|
2174
|
+
private _parseProgressively;
|
|
2135
2175
|
destroy(): void;
|
|
2136
2176
|
getImage(imagePath: string, mimeType: string): Promise<Blob>;
|
|
2137
2177
|
getFontBytes(partPath: string): Promise<Uint8Array>;
|
|
@@ -2139,6 +2179,8 @@ declare class DocxDocument {
|
|
|
2139
2179
|
getResourceMetrics(): Promise<OoxmlResourceMetrics>;
|
|
2140
2180
|
toMarkdown(): Promise<string>;
|
|
2141
2181
|
get pageCount(): number;
|
|
2182
|
+
get layoutComplete(): boolean;
|
|
2183
|
+
waitUntilLayoutComplete(): Promise<void>;
|
|
2142
2184
|
get mode(): 'main' | 'worker';
|
|
2143
2185
|
get document(): DocxDocumentModel;
|
|
2144
2186
|
get comments(): readonly Readonly<DocComment>[];
|
|
@@ -2149,12 +2191,17 @@ declare class DocxDocument {
|
|
|
2149
2191
|
get footnotes(): DocNote[];
|
|
2150
2192
|
get endnotes(): DocNote[];
|
|
2151
2193
|
private _getLayout;
|
|
2194
|
+
setLayoutView(view?: Readonly<{
|
|
2195
|
+
showTrackedChanges?: boolean;
|
|
2196
|
+
currentDate?: Date | number;
|
|
2197
|
+
}>): Promise<void>;
|
|
2152
2198
|
private _getBookmarkPages;
|
|
2153
2199
|
getBookmarkPage(bookmarkName: string): number | undefined;
|
|
2154
2200
|
pageSize(pageIndex: number): {
|
|
2155
2201
|
widthPt: number;
|
|
2156
2202
|
heightPt: number;
|
|
2157
2203
|
};
|
|
2204
|
+
private _withActiveView;
|
|
2158
2205
|
renderPage(target: HTMLCanvasElement | OffscreenCanvas, pageIndex: number, opts?: RenderPageOptions): Promise<void>;
|
|
2159
2206
|
renderPageToBitmap(pageIndex: number, opts?: RenderPageToBitmapOptions): Promise<ImageBitmap>;
|
|
2160
2207
|
collectPageRuns(pageIndex: number, opts?: CollectPageRunsOptions): Promise<DocxTextRunInfo[]>;
|
|
@@ -2171,7 +2218,7 @@ interface DocxViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>, LoadOp
|
|
|
2171
2218
|
onSelectionContextChange?: (context: DocxSelectionContext | null) => void;
|
|
2172
2219
|
onContextMenu?: (event: ViewerContextMenuEvent<DocxSelectionContext>) => void;
|
|
2173
2220
|
findHighlightColors?: FindHighlightColors;
|
|
2174
|
-
onPageChange?: (index: number, total: number) => void;
|
|
2221
|
+
onPageChange?: (index: number, total: number, layoutComplete: boolean) => void;
|
|
2175
2222
|
zoomMin?: number;
|
|
2176
2223
|
zoomMax?: number;
|
|
2177
2224
|
onScaleChange?: (scale: number) => void;
|
|
@@ -2193,6 +2240,7 @@ declare class DocxViewer implements ZoomableViewer {
|
|
|
2193
2240
|
private _highlightLayer;
|
|
2194
2241
|
private _elementLayer;
|
|
2195
2242
|
private _find;
|
|
2243
|
+
private _findRequestGeneration;
|
|
2196
2244
|
private _measureCtx;
|
|
2197
2245
|
private _opts;
|
|
2198
2246
|
private readonly _mode;
|
|
@@ -2203,6 +2251,13 @@ declare class DocxViewer implements ZoomableViewer {
|
|
|
2203
2251
|
private _selectionContextKey;
|
|
2204
2252
|
private _elementContext;
|
|
2205
2253
|
private _elementHitGeneration;
|
|
2254
|
+
private _layoutViewGeneration;
|
|
2255
|
+
private _navigationGeneration;
|
|
2256
|
+
private _layoutUnsubscribe;
|
|
2257
|
+
private _internalHyperlinkGeneration;
|
|
2258
|
+
private readonly _layoutWaiters;
|
|
2259
|
+
private _layoutFailed;
|
|
2260
|
+
private readonly _loadingLayer;
|
|
2206
2261
|
private _elementClickListener;
|
|
2207
2262
|
private _contextMenuListener;
|
|
2208
2263
|
static fromDocument(canvas: HTMLCanvasElement, document: DocxDocument, opts?: Omit<DocxViewerOptions, keyof LoadOptions>): Omit<DocxViewer, 'load'>;
|
|
@@ -2210,6 +2265,8 @@ declare class DocxViewer implements ZoomableViewer {
|
|
|
2210
2265
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
2211
2266
|
get pageCount(): number;
|
|
2212
2267
|
get currentPage(): number;
|
|
2268
|
+
get layoutComplete(): boolean;
|
|
2269
|
+
waitUntilLayoutComplete(): Promise<void>;
|
|
2213
2270
|
get canvasElement(): HTMLCanvasElement;
|
|
2214
2271
|
goToPage(index: number): Promise<void>;
|
|
2215
2272
|
nextPage(): Promise<void>;
|
|
@@ -2245,12 +2302,21 @@ declare class DocxViewer implements ZoomableViewer {
|
|
|
2245
2302
|
private _render;
|
|
2246
2303
|
private _reportRenderError;
|
|
2247
2304
|
private _renderPage;
|
|
2305
|
+
private _bindLayoutDocument;
|
|
2306
|
+
private _unbindLayoutDocument;
|
|
2307
|
+
private _onLayoutPublication;
|
|
2308
|
+
private _waitForPage;
|
|
2309
|
+
private _wakeLayoutWaiters;
|
|
2310
|
+
private _cancelPendingNavigation;
|
|
2311
|
+
private _setLoading;
|
|
2312
|
+
setShowTrackedChanges(value: boolean): Promise<void>;
|
|
2248
2313
|
private _buildHighlightLayer;
|
|
2249
2314
|
private _canvasCssPx;
|
|
2250
2315
|
private _measureForFont;
|
|
2251
2316
|
private _collectPageRuns;
|
|
2252
2317
|
private _buildTextLayer;
|
|
2253
2318
|
private _hyperlinkHandler;
|
|
2319
|
+
private _navigateInternalHyperlink;
|
|
2254
2320
|
}
|
|
2255
2321
|
interface DocxCommentsOptions extends ViewerCommentsOptions {
|
|
2256
2322
|
readonly cards?: boolean;
|
|
@@ -2266,6 +2332,8 @@ interface DocxScrollViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>,
|
|
|
2266
2332
|
paddingLeft?: number;
|
|
2267
2333
|
paddingRight?: number;
|
|
2268
2334
|
overscan?: number;
|
|
2335
|
+
progressiveLayout?: boolean;
|
|
2336
|
+
sliceLayout?: boolean;
|
|
2269
2337
|
enableTextSelection?: boolean;
|
|
2270
2338
|
comments?: boolean | DocxCommentsOptions;
|
|
2271
2339
|
enableElementSelection?: boolean;
|
|
@@ -2278,7 +2346,7 @@ interface DocxScrollViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>,
|
|
|
2278
2346
|
refitOnResize?: boolean;
|
|
2279
2347
|
background?: string;
|
|
2280
2348
|
pageShadow?: string | false;
|
|
2281
|
-
onVisiblePageChange?: (topIndex: number, total: number) => void;
|
|
2349
|
+
onVisiblePageChange?: (topIndex: number, total: number, layoutComplete: boolean) => void;
|
|
2282
2350
|
onScaleChange?: (scale: number) => void;
|
|
2283
2351
|
onHyperlinkClick?: (target: HyperlinkTarget) => void;
|
|
2284
2352
|
enableHyperlinks?: boolean;
|
|
@@ -2289,6 +2357,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
2289
2357
|
private get _doc();
|
|
2290
2358
|
private readonly _borrowed;
|
|
2291
2359
|
private readonly _opts;
|
|
2360
|
+
private readonly _errorRouter;
|
|
2292
2361
|
private readonly _container;
|
|
2293
2362
|
private readonly _wrapper;
|
|
2294
2363
|
private readonly _scrollHost;
|
|
@@ -2303,6 +2372,11 @@ declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
2303
2372
|
private _scrollGeometry;
|
|
2304
2373
|
private _lastRange;
|
|
2305
2374
|
private _lastTopIndex;
|
|
2375
|
+
private _lastReportedTotal;
|
|
2376
|
+
private _lastReportedLayoutComplete;
|
|
2377
|
+
private _layoutUnsubscribe;
|
|
2378
|
+
private _presentedPageCount;
|
|
2379
|
+
private _pendingLayoutPublication;
|
|
2306
2380
|
private _scrollListener;
|
|
2307
2381
|
private _selectionChangeListener;
|
|
2308
2382
|
private _selectionContextKey;
|
|
@@ -2318,8 +2392,10 @@ declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
2318
2392
|
private readonly _commentIndexedPages;
|
|
2319
2393
|
private _commentScanFrontier;
|
|
2320
2394
|
private _commentNavigationGeneration;
|
|
2395
|
+
private _internalHyperlinkGeneration;
|
|
2321
2396
|
private _commentAnchorRangesForMargin;
|
|
2322
2397
|
private _commentAnchorIds;
|
|
2398
|
+
private _reviewOriginPx;
|
|
2323
2399
|
private _commentGeometryScheduled;
|
|
2324
2400
|
private _commentGeometryFrame;
|
|
2325
2401
|
private readonly _pendingCommentGeometry;
|
|
@@ -2337,10 +2413,22 @@ declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
2337
2413
|
private readonly _pageShadow;
|
|
2338
2414
|
private readonly _find;
|
|
2339
2415
|
private _findActive;
|
|
2416
|
+
private _findRequestGeneration;
|
|
2417
|
+
private _showTrackedChanges;
|
|
2418
|
+
private _layoutViewGeneration;
|
|
2340
2419
|
static fromDocument(container: HTMLElement, document: DocxDocument, opts?: Omit<DocxScrollViewerOptions, keyof LoadOptions>): Omit<DocxScrollViewer, 'load'>;
|
|
2341
2420
|
constructor(container: HTMLElement, opts?: DocxScrollViewerOptions);
|
|
2342
2421
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
2343
2422
|
get pageCount(): number;
|
|
2423
|
+
get layoutComplete(): boolean;
|
|
2424
|
+
waitUntilLayoutComplete(): Promise<void>;
|
|
2425
|
+
private _bindLayoutDocument;
|
|
2426
|
+
private _unbindLayoutDocument;
|
|
2427
|
+
private _onLayoutPublication;
|
|
2428
|
+
private _refreshCommentSurface;
|
|
2429
|
+
private _applyLayoutPublication;
|
|
2430
|
+
private _revealPendingLayoutAtPresentedTail;
|
|
2431
|
+
private _revealPendingLayoutThroughPage;
|
|
2344
2432
|
private _pageWidthPx;
|
|
2345
2433
|
private _pageHeightPx;
|
|
2346
2434
|
private _fitWidthPx;
|
|
@@ -2366,6 +2454,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
2366
2454
|
private _syncSpacerWidth;
|
|
2367
2455
|
private _onScroll;
|
|
2368
2456
|
private _mountVisible;
|
|
2457
|
+
private _emitVisiblePageChange;
|
|
2369
2458
|
private _applyPageShadow;
|
|
2370
2459
|
private _acquireSlot;
|
|
2371
2460
|
private _recycleSlot;
|
|
@@ -2373,6 +2462,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
2373
2462
|
private _dpr;
|
|
2374
2463
|
private _renderSlot;
|
|
2375
2464
|
private _hyperlinkHandler;
|
|
2465
|
+
private _navigateInternalHyperlink;
|
|
2376
2466
|
private _measureForFont;
|
|
2377
2467
|
private _canvasCssPx;
|
|
2378
2468
|
private _reportRenderError;
|
|
@@ -2386,9 +2476,11 @@ declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
2386
2476
|
private _fit;
|
|
2387
2477
|
private _previewVisible;
|
|
2388
2478
|
private _previewSlot;
|
|
2479
|
+
private _clearTextLayerPreview;
|
|
2389
2480
|
private _scheduleSettle;
|
|
2390
2481
|
private _settleRender;
|
|
2391
|
-
private
|
|
2482
|
+
private _refreshSlotAtomically;
|
|
2483
|
+
setShowTrackedChanges(value: boolean): Promise<void>;
|
|
2392
2484
|
scrollToPage(index: number, opts?: {
|
|
2393
2485
|
behavior?: 'auto' | 'smooth';
|
|
2394
2486
|
}): void;
|