@silurus/ooxml 0.82.1 → 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.
Files changed (42) hide show
  1. package/README.md +72 -3
  2. package/dist/assets/{render-worker-Cy-QsDge.js → render-worker-Bu31cf1J.js} +4 -4
  3. package/dist/assets/render-worker-DuztdEcX.js +11 -0
  4. package/dist/{canvas-viewer-mechanics-CS_qbr6T.js → canvas-viewer-mechanics-h07vpVOQ.js} +42 -2
  5. package/dist/{comment-ui-runtime-C1RV_3iu.js → comment-ui-runtime-BelHJt73.js} +2 -2
  6. package/dist/{comment-ui-runtime-DgCZpPR0.js → comment-ui-runtime-DD5a3x3k.js} +2 -2
  7. package/dist/{comments-Cf9W7r3M.js → comments-AAaNnQTi.js} +7 -2
  8. package/dist/{document-pull-client-B1WOjA0z.js → document-pull-client-BAhqoTmm.js} +4508 -3952
  9. package/dist/docx-Dg73PGgC.js +2707 -0
  10. package/dist/docx.mjs +6 -6
  11. package/dist/docx_parser_bg.wasm +0 -0
  12. package/dist/dom-interaction-boundary-CepOlXt6.js +217 -0
  13. package/dist/index.mjs +4 -4
  14. package/dist/line-distribute-D7A_wnJg.js +1003 -0
  15. package/dist/{line-metrics-B3syvDn2.js → line-metrics-Bpn7OeZD.js} +616 -616
  16. package/dist/node.mjs +308 -308
  17. package/dist/pptx-BcUCETmQ.js +2990 -0
  18. package/dist/pptx.mjs +5 -5
  19. package/dist/pptx_parser_bg.wasm +0 -0
  20. package/dist/{render-BC8p7vZQ.js → render-CL-7V3E8.js} +1 -1
  21. package/dist/{render-worker-host-DhnkTyjj.js → render-worker-host-DDZo0feh.js} +1 -1
  22. package/dist/{render-worker-host-BNnXCtAu.js → render-worker-host-FJ19-fUI.js} +1 -1
  23. package/dist/{resource-measurement-CsW4_eYt.js → resource-measurement-DuiFWzam.js} +3 -3
  24. package/dist/{session-Da7LEQUB.js → session-BjydZEDF.js} +107 -94
  25. package/dist/{slide-pull-client-Bg9DusLX.js → slide-pull-client-CwvvncPA.js} +1158 -935
  26. package/dist/types/docx.d.ts +98 -8
  27. package/dist/types/index.d.ts +184 -13
  28. package/dist/types/node.d.ts +2 -2
  29. package/dist/types/pptx.d.ts +94 -5
  30. package/dist/types/xlsx.d.ts +2 -2
  31. package/dist/{worksheet-pull-client-CYtwXP5D.js → worksheet-pull-client-DyFsDF4A.js} +32 -32
  32. package/dist/{xlsx-DMWeXT-c.js → xlsx-BibrHQ52.js} +476 -476
  33. package/dist/xlsx.mjs +5 -5
  34. package/dist/xlsx_parser_bg.wasm +0 -0
  35. package/package.json +3 -1
  36. package/dist/assets/render-worker-aHayzR7v.js +0 -11
  37. package/dist/docx-HoZXZUPA.js +0 -2162
  38. package/dist/dom-interaction-boundary-C8F6HO5x.js +0 -119
  39. package/dist/line-distribute-iXsUCIH-.js +0 -1003
  40. package/dist/pptx-DEUP4Yq5.js +0 -2432
  41. /package/dist/{comment-occurrence-C34fWs_F.js → comment-occurrence-X54si2ob.js} +0 -0
  42. /package/dist/{highlight-rect-MaCt0om0.js → highlight-rect-Hes0z_Mj.js} +0 -0
@@ -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-CZoV-4B8.d.ts
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/types-HfeSaZtq.d.ts
1247
+ //#region dist/.types-work/types-B2UaFocY.d.ts
1240
1248
  interface DocxDocumentModel {
1241
1249
  section: SectionProps;
1242
1250
  body: BodyElement[];
@@ -1979,9 +1987,10 @@ interface RenderPageOptions {
1979
1987
  defaultTextColor?: string;
1980
1988
  onTextRun?: (run: DocxTextRunInfo) => void;
1981
1989
  currentDate?: Date | number;
1990
+ showTrackedChanges?: boolean;
1982
1991
  }
1983
1992
  //#endregion
1984
- //#region dist/.types-work/docx-CDchTe6F.d.ts
1993
+ //#region dist/.types-work/docx-CBra4_iJ.d.ts
1985
1994
  interface CommentAnchorRange {
1986
1995
  readonly commentId: string;
1987
1996
  readonly source: Readonly<DocxStorySource>;
@@ -2088,6 +2097,7 @@ declare function readDocxTextSelectionContext(root: HTMLElement, selection: Sele
2088
2097
  interface DocxElementContextOptions {
2089
2098
  readonly maxTextCharacters?: number;
2090
2099
  readonly currentDate?: Date | number;
2100
+ readonly showTrackedChanges?: boolean;
2091
2101
  }
2092
2102
  interface RevisionAnchorRange {
2093
2103
  readonly revisionIndex: number;
@@ -2104,8 +2114,15 @@ declare function resolveRevisionAnchorRuns(anchor: Readonly<RevisionAnchorRange>
2104
2114
  interface LoadOptions extends LoadOptions$1 {
2105
2115
  math?: MathRenderer;
2106
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;
2107
2124
  }
2108
- type CollectPageRunsOptions = Pick<RenderPageOptions, 'width' | 'currentDate'>;
2125
+ type CollectPageRunsOptions = Pick<RenderPageOptions, 'width' | 'currentDate' | 'showTrackedChanges'>;
2109
2126
  interface DocxPageCommentThreadsOptions extends CollectPageRunsOptions, ResolveDocxCommentThreadsOptions {}
2110
2127
  type RenderPageToBitmapOptions = Omit<RenderPageOptions, 'onTextRun'> & {
2111
2128
  onTextRun?: (run: DocxTextRunInfo) => void;
@@ -2116,10 +2133,19 @@ declare class DocxDocument {
2116
2133
  private _source;
2117
2134
  private _meta;
2118
2135
  private _review;
2136
+ private readonly _layoutLifecycle;
2137
+ private readonly _layoutObservers;
2138
+ private _layoutCompletion;
2139
+ private _layoutAbort;
2119
2140
  private _bookmarkPages;
2120
2141
  private _commentAnchorRanges;
2121
2142
  private _revisionAnchorRanges;
2122
- private _reviewTextRunSourceIndex;
2143
+ private _reviewProjectionIndex;
2144
+ private _parseRequestId;
2145
+ private _progressive;
2146
+ private _parseWatchdog;
2147
+ private _parseWatchdogMs;
2148
+ private _layoutViewGeneration;
2123
2149
  private _mode;
2124
2150
  private _threeD;
2125
2151
  private _regionMap;
@@ -2134,6 +2160,18 @@ declare class DocxDocument {
2134
2160
  private constructor();
2135
2161
  static load(source: string | ArrayBuffer, opts?: LoadOptions): Promise<DocxDocument>;
2136
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;
2137
2175
  destroy(): void;
2138
2176
  getImage(imagePath: string, mimeType: string): Promise<Blob>;
2139
2177
  getFontBytes(partPath: string): Promise<Uint8Array>;
@@ -2141,6 +2179,8 @@ declare class DocxDocument {
2141
2179
  getResourceMetrics(): Promise<OoxmlResourceMetrics>;
2142
2180
  toMarkdown(): Promise<string>;
2143
2181
  get pageCount(): number;
2182
+ get layoutComplete(): boolean;
2183
+ waitUntilLayoutComplete(): Promise<void>;
2144
2184
  get mode(): 'main' | 'worker';
2145
2185
  get document(): DocxDocumentModel;
2146
2186
  get comments(): readonly Readonly<DocComment>[];
@@ -2151,12 +2191,17 @@ declare class DocxDocument {
2151
2191
  get footnotes(): DocNote[];
2152
2192
  get endnotes(): DocNote[];
2153
2193
  private _getLayout;
2194
+ setLayoutView(view?: Readonly<{
2195
+ showTrackedChanges?: boolean;
2196
+ currentDate?: Date | number;
2197
+ }>): Promise<void>;
2154
2198
  private _getBookmarkPages;
2155
2199
  getBookmarkPage(bookmarkName: string): number | undefined;
2156
2200
  pageSize(pageIndex: number): {
2157
2201
  widthPt: number;
2158
2202
  heightPt: number;
2159
2203
  };
2204
+ private _withActiveView;
2160
2205
  renderPage(target: HTMLCanvasElement | OffscreenCanvas, pageIndex: number, opts?: RenderPageOptions): Promise<void>;
2161
2206
  renderPageToBitmap(pageIndex: number, opts?: RenderPageToBitmapOptions): Promise<ImageBitmap>;
2162
2207
  collectPageRuns(pageIndex: number, opts?: CollectPageRunsOptions): Promise<DocxTextRunInfo[]>;
@@ -2173,7 +2218,7 @@ interface DocxViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>, LoadOp
2173
2218
  onSelectionContextChange?: (context: DocxSelectionContext | null) => void;
2174
2219
  onContextMenu?: (event: ViewerContextMenuEvent<DocxSelectionContext>) => void;
2175
2220
  findHighlightColors?: FindHighlightColors;
2176
- onPageChange?: (index: number, total: number) => void;
2221
+ onPageChange?: (index: number, total: number, layoutComplete: boolean) => void;
2177
2222
  zoomMin?: number;
2178
2223
  zoomMax?: number;
2179
2224
  onScaleChange?: (scale: number) => void;
@@ -2195,6 +2240,7 @@ declare class DocxViewer implements ZoomableViewer {
2195
2240
  private _highlightLayer;
2196
2241
  private _elementLayer;
2197
2242
  private _find;
2243
+ private _findRequestGeneration;
2198
2244
  private _measureCtx;
2199
2245
  private _opts;
2200
2246
  private readonly _mode;
@@ -2205,6 +2251,13 @@ declare class DocxViewer implements ZoomableViewer {
2205
2251
  private _selectionContextKey;
2206
2252
  private _elementContext;
2207
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;
2208
2261
  private _elementClickListener;
2209
2262
  private _contextMenuListener;
2210
2263
  static fromDocument(canvas: HTMLCanvasElement, document: DocxDocument, opts?: Omit<DocxViewerOptions, keyof LoadOptions>): Omit<DocxViewer, 'load'>;
@@ -2212,6 +2265,8 @@ declare class DocxViewer implements ZoomableViewer {
2212
2265
  load(source: string | ArrayBuffer): Promise<void>;
2213
2266
  get pageCount(): number;
2214
2267
  get currentPage(): number;
2268
+ get layoutComplete(): boolean;
2269
+ waitUntilLayoutComplete(): Promise<void>;
2215
2270
  get canvasElement(): HTMLCanvasElement;
2216
2271
  goToPage(index: number): Promise<void>;
2217
2272
  nextPage(): Promise<void>;
@@ -2247,12 +2302,21 @@ declare class DocxViewer implements ZoomableViewer {
2247
2302
  private _render;
2248
2303
  private _reportRenderError;
2249
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>;
2250
2313
  private _buildHighlightLayer;
2251
2314
  private _canvasCssPx;
2252
2315
  private _measureForFont;
2253
2316
  private _collectPageRuns;
2254
2317
  private _buildTextLayer;
2255
2318
  private _hyperlinkHandler;
2319
+ private _navigateInternalHyperlink;
2256
2320
  }
2257
2321
  interface DocxCommentsOptions extends ViewerCommentsOptions {
2258
2322
  readonly cards?: boolean;
@@ -2268,6 +2332,8 @@ interface DocxScrollViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>,
2268
2332
  paddingLeft?: number;
2269
2333
  paddingRight?: number;
2270
2334
  overscan?: number;
2335
+ progressiveLayout?: boolean;
2336
+ sliceLayout?: boolean;
2271
2337
  enableTextSelection?: boolean;
2272
2338
  comments?: boolean | DocxCommentsOptions;
2273
2339
  enableElementSelection?: boolean;
@@ -2280,7 +2346,7 @@ interface DocxScrollViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>,
2280
2346
  refitOnResize?: boolean;
2281
2347
  background?: string;
2282
2348
  pageShadow?: string | false;
2283
- onVisiblePageChange?: (topIndex: number, total: number) => void;
2349
+ onVisiblePageChange?: (topIndex: number, total: number, layoutComplete: boolean) => void;
2284
2350
  onScaleChange?: (scale: number) => void;
2285
2351
  onHyperlinkClick?: (target: HyperlinkTarget) => void;
2286
2352
  enableHyperlinks?: boolean;
@@ -2291,6 +2357,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
2291
2357
  private get _doc();
2292
2358
  private readonly _borrowed;
2293
2359
  private readonly _opts;
2360
+ private readonly _errorRouter;
2294
2361
  private readonly _container;
2295
2362
  private readonly _wrapper;
2296
2363
  private readonly _scrollHost;
@@ -2305,6 +2372,11 @@ declare class DocxScrollViewer implements ZoomableViewer {
2305
2372
  private _scrollGeometry;
2306
2373
  private _lastRange;
2307
2374
  private _lastTopIndex;
2375
+ private _lastReportedTotal;
2376
+ private _lastReportedLayoutComplete;
2377
+ private _layoutUnsubscribe;
2378
+ private _presentedPageCount;
2379
+ private _pendingLayoutPublication;
2308
2380
  private _scrollListener;
2309
2381
  private _selectionChangeListener;
2310
2382
  private _selectionContextKey;
@@ -2320,8 +2392,10 @@ declare class DocxScrollViewer implements ZoomableViewer {
2320
2392
  private readonly _commentIndexedPages;
2321
2393
  private _commentScanFrontier;
2322
2394
  private _commentNavigationGeneration;
2395
+ private _internalHyperlinkGeneration;
2323
2396
  private _commentAnchorRangesForMargin;
2324
2397
  private _commentAnchorIds;
2398
+ private _reviewOriginPx;
2325
2399
  private _commentGeometryScheduled;
2326
2400
  private _commentGeometryFrame;
2327
2401
  private readonly _pendingCommentGeometry;
@@ -2339,10 +2413,22 @@ declare class DocxScrollViewer implements ZoomableViewer {
2339
2413
  private readonly _pageShadow;
2340
2414
  private readonly _find;
2341
2415
  private _findActive;
2416
+ private _findRequestGeneration;
2417
+ private _showTrackedChanges;
2418
+ private _layoutViewGeneration;
2342
2419
  static fromDocument(container: HTMLElement, document: DocxDocument, opts?: Omit<DocxScrollViewerOptions, keyof LoadOptions>): Omit<DocxScrollViewer, 'load'>;
2343
2420
  constructor(container: HTMLElement, opts?: DocxScrollViewerOptions);
2344
2421
  load(source: string | ArrayBuffer): Promise<void>;
2345
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;
2346
2432
  private _pageWidthPx;
2347
2433
  private _pageHeightPx;
2348
2434
  private _fitWidthPx;
@@ -2368,6 +2454,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
2368
2454
  private _syncSpacerWidth;
2369
2455
  private _onScroll;
2370
2456
  private _mountVisible;
2457
+ private _emitVisiblePageChange;
2371
2458
  private _applyPageShadow;
2372
2459
  private _acquireSlot;
2373
2460
  private _recycleSlot;
@@ -2375,6 +2462,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
2375
2462
  private _dpr;
2376
2463
  private _renderSlot;
2377
2464
  private _hyperlinkHandler;
2465
+ private _navigateInternalHyperlink;
2378
2466
  private _measureForFont;
2379
2467
  private _canvasCssPx;
2380
2468
  private _reportRenderError;
@@ -2388,9 +2476,11 @@ declare class DocxScrollViewer implements ZoomableViewer {
2388
2476
  private _fit;
2389
2477
  private _previewVisible;
2390
2478
  private _previewSlot;
2479
+ private _clearTextLayerPreview;
2391
2480
  private _scheduleSettle;
2392
2481
  private _settleRender;
2393
- private _settleSlot;
2482
+ private _refreshSlotAtomically;
2483
+ setShowTrackedChanges(value: boolean): Promise<void>;
2394
2484
  scrollToPage(index: number, opts?: {
2395
2485
  behavior?: 'auto' | 'smooth';
2396
2486
  }): void;