@silurus/ooxml 0.57.0 → 0.59.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.
@@ -514,7 +514,20 @@ declare interface EquationRun {
514
514
  color?: string | null;
515
515
  }
516
516
 
517
- export declare type Fill = SolidFill | NoFill | GradientFill | PatternFill;
517
+ export declare type Fill = SolidFill | NoFill | GradientFill | PatternFill | ImageFill;
518
+
519
+ /**
520
+ * ECMA-376 §20.1.8.30 (CT_RelativeRect) — the destination rectangle a stretched
521
+ * blip is mapped into, as edge insets relative to the fill region. Values are
522
+ * fractions (ST_Percentage / 100000); **negative values let the image bleed
523
+ * past the box (overscan)**. Absent edges default to 0.
524
+ */
525
+ export declare interface FillRect {
526
+ l?: number;
527
+ t?: number;
528
+ r?: number;
529
+ b?: number;
530
+ }
518
531
 
519
532
  /** ECMA-376 §20.1.8.17 (CT_GlowEffect) — coloured halo with blur radius. */
520
533
  export declare interface Glow {
@@ -538,6 +551,30 @@ export declare interface GradientStop {
538
551
  color: string;
539
552
  }
540
553
 
554
+ /**
555
+ * Image fill — ECMA-376 §20.1.8.14 (CT_BlipFillProperties). The embedded blip
556
+ * is resolved to a base64 data URL at parse time. Both fill-modes are modelled
557
+ * and mutually exclusive: `stretch` (§20.1.8.56) carries {@link ImageFill.fillRect};
558
+ * `tile` (§20.1.8.58) carries {@link ImageFill.tile}.
559
+ */
560
+ export declare interface ImageFill {
561
+ fillType: 'image';
562
+ /** `data:<mime>;base64,…` of the embedded blip. */
563
+ dataUrl: string;
564
+ /**
565
+ * `<a:stretch><a:fillRect>` insets. Absent → fills the whole box (or the
566
+ * fill is tiled — see {@link ImageFill.tile}).
567
+ */
568
+ fillRect?: FillRect;
569
+ /**
570
+ * `<a:tile>` descriptor. Present only when the blipFill is tiled; mutually
571
+ * exclusive with {@link ImageFill.fillRect}.
572
+ */
573
+ tile?: TileInfo;
574
+ /** `a:blip > a:alphaModFix@amt` as a fraction (0.0–1.0). Absent = opaque. */
575
+ alpha?: number;
576
+ }
577
+
541
578
  declare interface LegendManualLayout {
542
579
  /** `"edge"` = `x`/`y` are fractions from top-left of chart space;
543
580
  * `"factor"` = fractions offset from the default position. */
@@ -551,8 +588,8 @@ declare interface LegendManualLayout {
551
588
  }
552
589
 
553
590
  /**
554
- * `<a:lightRig>` — ECMA-376 §20.1.5.9 (`CT_LightRig`). Parsed for Phase B
555
- * (lighting/bevel shading); the Phase A camera renderer ignores it.
591
+ * `<a:lightRig>` — ECMA-376 §20.1.5.9 (`CT_LightRig`). Drives the bevel-lip
592
+ * lighting (Phase B): `dir` selects the key-light octant.
556
593
  */
557
594
  export declare interface LightRig {
558
595
  /** Light-rig preset (`ST_LightRigType`), e.g. "threePt". */
@@ -567,9 +604,16 @@ export declare interface LineBreak {
567
604
  type: 'break';
568
605
  }
569
606
 
570
- /** Options for {@link PptxPresentation.load}. The shared load-options type
571
- * from `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`). */
572
- export declare type LoadOptions = LoadOptions_2;
607
+ /** Options for {@link PptxPresentation.load}. */
608
+ export declare type LoadOptions = LoadOptions_2 & {
609
+ /**
610
+ * 'main' (default): parse in a worker, render on the main thread (current
611
+ * behaviour). 'worker': parse AND render inside the worker; use
612
+ * {@link PptxPresentation.renderSlideToBitmap} and paint the returned
613
+ * ImageBitmap via an `ImageBitmapRenderingContext`. Requires OffscreenCanvas.
614
+ */
615
+ mode?: 'main' | 'worker';
616
+ };
573
617
 
574
618
  /**
575
619
  * Common load-time options shared by the docx / pptx / xlsx
@@ -914,6 +958,17 @@ export declare interface PictureElement {
914
958
  sp3d?: Sp3d;
915
959
  }
916
960
 
961
+ /** A single legacy slide comment (`<p:cm>` in `ppt/comments/commentN.xml`). */
962
+ export declare interface PptxComment {
963
+ /** Resolved author name from `ppt/commentAuthors.xml`. Absent when the
964
+ * authors file is missing or the `authorId` is out of range. */
965
+ author?: string;
966
+ /** `<p:cm @dt>` — ISO-8601 timestamp the comment was authored. */
967
+ date?: string;
968
+ /** Plain-text comment body (`<p:text>`). */
969
+ text: string;
970
+ }
971
+
917
972
  /**
918
973
  * Headless PPTX rendering engine.
919
974
  *
@@ -932,7 +987,9 @@ export declare interface PictureElement {
932
987
  export declare class PptxPresentation {
933
988
  private readonly _worker;
934
989
  private readonly _bridge;
990
+ private _mode;
935
991
  private _presentation;
992
+ private _meta;
936
993
  private _mediaCache;
937
994
  private _workerReady;
938
995
  private _workerReadyCallbacks;
@@ -951,8 +1008,38 @@ export declare class PptxPresentation {
951
1008
  get slideWidth(): number;
952
1009
  /** Slide height in EMU. */
953
1010
  get slideHeight(): number;
1011
+ /**
1012
+ * Speaker-notes text for a slide (`ppt/notesSlides/notesSlideN.xml`,
1013
+ * ECMA-376 §13.3.5 — Notes Slide). Returns the notes-body text as a single
1014
+ * string (paragraphs joined with `\n`), or `null` when the slide has no
1015
+ * notes part. The notes are parsed at {@link load} time, so this is a
1016
+ * synchronous lookup.
1017
+ *
1018
+ * `slideIndex` is 0-based. Unlike navigation methods it is *not* clamped:
1019
+ * an out-of-range or non-integer index returns `null` rather than the notes
1020
+ * of the nearest slide (so a tool iterating by index gets an honest "no
1021
+ * notes" instead of a duplicated neighbour).
1022
+ *
1023
+ * @example
1024
+ * const pres = await PptxPresentation.load(buffer);
1025
+ * for (let i = 0; i < pres.slideCount; i++) {
1026
+ * const notes = pres.getNotes(i);
1027
+ * if (notes) console.log(`Slide ${i + 1} notes:`, notes);
1028
+ * }
1029
+ */
1030
+ getNotes(slideIndex: number): string | null;
954
1031
  /** Render a slide onto the given canvas. */
955
- renderSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: RenderSlideOptions): Promise<void>;
1032
+ renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slideIndex: number, opts?: RenderSlideOptions): Promise<void>;
1033
+ /**
1034
+ * Render a slide and return it as an ImageBitmap. Works in both modes; in
1035
+ * worker mode the entire render runs off the main thread. Paint with:
1036
+ * `canvas.getContext('bitmaprenderer').transferFromImageBitmap(bitmap)`.
1037
+ *
1038
+ * The returned ImageBitmap is owned by the caller: pass it to
1039
+ * `transferFromImageBitmap` (which consumes it) or call `bitmap.close()`
1040
+ * when done, or its backing memory is held until GC.
1041
+ */
1042
+ renderSlideToBitmap(slideIndex: number, opts?: RenderSlideToBitmapOptions): Promise<ImageBitmap>;
956
1043
  /**
957
1044
  * Extract raw media bytes for a zip path referenced by {@link MediaElement}.
958
1045
  * Results are cached by path for the lifetime of this instance.
@@ -1020,6 +1107,12 @@ export declare class PptxViewer {
1020
1107
  private readonly opts;
1021
1108
  private currentSlide;
1022
1109
  private handle;
1110
+ private readonly _mode;
1111
+ /** The canvas's bitmaprenderer context, used only by the static worker-mode
1112
+ * render path. The media-playback path keeps a 2d context (via presentSlide),
1113
+ * so this is obtained only when worker mode renders without media playback. */
1114
+ private _bitmapCtx;
1115
+ private _warnedNoTextSelection;
1023
1116
  constructor(canvas: HTMLCanvasElement, opts?: PptxViewerOptions);
1024
1117
  /**
1025
1118
  * Load a PPTX from URL or ArrayBuffer and render the first slide.
@@ -1035,6 +1128,13 @@ export declare class PptxViewer {
1035
1128
  prevSlide(): Promise<void>;
1036
1129
  get slideIndex(): number;
1037
1130
  get slideCount(): number;
1131
+ /**
1132
+ * Speaker-notes text for a slide (`ppt/notesSlides/notesSlideN.xml`,
1133
+ * ECMA-376 §13.3.5). Passthrough to {@link PptxPresentation.getNotes}:
1134
+ * 0-based index, returns `null` when the slide has no notes part, the index
1135
+ * is out of range, or nothing is loaded yet.
1136
+ */
1137
+ getNotes(slideIndex: number): string | null;
1038
1138
  /** The underlying <canvas> element. */
1039
1139
  get canvasElement(): HTMLCanvasElement;
1040
1140
  private renderCurrentSlide;
@@ -1158,6 +1258,15 @@ export declare interface RenderSlideOptions {
1158
1258
  skipMediaControls?: boolean;
1159
1259
  }
1160
1260
 
1261
+ /** Options for {@link PptxPresentation.renderSlideToBitmap}. */
1262
+ export declare interface RenderSlideToBitmapOptions {
1263
+ /** Slide width in CSS pixels. Defaults to 960. */
1264
+ width?: number;
1265
+ /** Device pixel ratio. Defaults to window.devicePixelRatio (workers have none). */
1266
+ dpr?: number;
1267
+ /* Excluded from this release type: skipMediaControls */
1268
+ }
1269
+
1161
1270
  /**
1162
1271
  * 3D rotation in sphere coordinates — ECMA-376 §20.1.5.11 (`CT_SphereCoords`).
1163
1272
  * Angles are in **degrees** (the XML carries 60000ths of a degree; the parser
@@ -1255,6 +1364,20 @@ export declare interface Slide {
1255
1364
  slideNumber: number;
1256
1365
  background: Fill | null;
1257
1366
  elements: SlideElement[];
1367
+ /**
1368
+ * Speaker-notes pane text from `ppt/notesSlides/notesSlideN.xml`
1369
+ * (ECMA-376 §13.3.5 — Notes Slide). The full notes-body text as a single
1370
+ * string, paragraphs joined with `\n`. Absent (`undefined`) when the slide
1371
+ * has no notes part. The renderer ignores this — it is surfaced for tools;
1372
+ * read it via {@link PptxPresentation.getNotes}.
1373
+ */
1374
+ notes?: string;
1375
+ /**
1376
+ * Legacy slide comments (`ppt/comments/commentN.xml`, ECMA-376 §13.3.4).
1377
+ * Modern Office 365 threaded comments are not parsed. Omitted from the JSON
1378
+ * when the slide has no comments.
1379
+ */
1380
+ comments?: PptxComment[];
1258
1381
  }
1259
1382
 
1260
1383
  export declare type SlideElement = ShapeElement | PictureElement | TableElement | ChartElement | MediaElement;
@@ -1280,9 +1403,10 @@ export declare interface SolidFill {
1280
1403
  }
1281
1404
 
1282
1405
  /**
1283
- * `<a:sp3d>` — ECMA-376 §20.1.5.12 (`CT_Shape3D`). Parsed in full but **not
1284
- * rendered in Phase A** (camera-only). bevel/contour/extrusion are Phase B.
1285
- * Numeric fields are omitted from JSON when zero.
1406
+ * `<a:sp3d>` — ECMA-376 §20.1.5.12 (`CT_Shape3D`). Rendered in Phase B: bevelT/
1407
+ * bevelB are shaded as a lit lip (distance-field + lightRig), extrusionH as a
1408
+ * swept side wall, and contour as a flat outline approximation. Numeric fields
1409
+ * are omitted from JSON when zero.
1286
1410
  */
1287
1411
  export declare interface Sp3d {
1288
1412
  /** Z position of the front face in EMU (default 0). */
@@ -1528,4 +1652,27 @@ export declare interface TextRunData {
1528
1652
  outline?: TextOutline;
1529
1653
  }
1530
1654
 
1655
+ /**
1656
+ * ECMA-376 §20.1.8.58 (CT_TileInfoProperties) — tiled blip-fill placement.
1657
+ * The blip repeats at its native size (scaled by sx/sy) across the fill box.
1658
+ * Mutually exclusive with {@link ImageFill.fillRect} (the `stretch` mode).
1659
+ */
1660
+ export declare interface TileInfo {
1661
+ /** Horizontal offset of the first tile, in EMU (`tx`). Default 0. */
1662
+ tx: number;
1663
+ /** Vertical offset of the first tile, in EMU (`ty`). Default 0. */
1664
+ ty: number;
1665
+ /** Horizontal tile scale as a fraction (`sx` / 100000). Default 1.0. */
1666
+ sx: number;
1667
+ /** Vertical tile scale as a fraction (`sy` / 100000). Default 1.0. */
1668
+ sy: number;
1669
+ /** Mirror mode: `'none' | 'x' | 'y' | 'xy'` (`flip`). Default `'none'`. */
1670
+ flip: string;
1671
+ /**
1672
+ * Anchor corner the tile grid registers against:
1673
+ * `tl|t|tr|l|ctr|r|bl|b|br` (`algn`). Default `'tl'`.
1674
+ */
1675
+ algn: string;
1676
+ }
1677
+
1531
1678
  export { }
@@ -169,6 +169,8 @@ export declare type CfRule = {
169
169
  } | {
170
170
  type: 'aboveAverage';
171
171
  aboveAverage: boolean;
172
+ equalAverage?: boolean;
173
+ stdDev?: number;
172
174
  dxfId: number | null;
173
175
  priority: number;
174
176
  } | {
@@ -345,6 +347,28 @@ export declare interface DataPointOverride {
345
347
  markerLine?: string;
346
348
  }
347
349
 
350
+ /** One `<dataValidation>` rule (ECMA-376 §18.3.1.33). `type` is the constraint
351
+ * class (`list` | `whole` | `decimal` | `date` | `time` | `textLength` |
352
+ * `custom`); `operator` qualifies it (`between` | `notBetween` | `equal` | …).
353
+ * `formula1` / `formula2` are the operands (for `list`, `formula1` is the
354
+ * comma-separated literal list or a range/named reference). 1:1 with the Rust
355
+ * `DataValidation` (serde camelCase). */
356
+ export declare interface DataValidation {
357
+ /** Affected cell ranges, verbatim from `@sqref` (space-separated A1 refs). */
358
+ sqref: string;
359
+ /** Constraint class. Absent means the spec default (`none`, no constraint). */
360
+ validationType?: string;
361
+ operator?: string;
362
+ formula1?: string;
363
+ formula2?: string;
364
+ /** `@allowBlank` — empty input is permitted. */
365
+ allowBlank?: boolean;
366
+ promptTitle?: string;
367
+ prompt?: string;
368
+ errorTitle?: string;
369
+ errorMessage?: string;
370
+ }
371
+
348
372
  export declare interface DefinedName {
349
373
  name: string;
350
374
  formula: string;
@@ -432,9 +456,19 @@ export declare interface LegendManualLayout {
432
456
  h: number;
433
457
  }
434
458
 
435
- /** Options for {@link XlsxWorkbook.load}. The shared load-options type from
436
- * `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`). */
437
- export declare type LoadOptions = LoadOptions_2;
459
+ /** Options for {@link XlsxWorkbook.load}. Extends the shared load-options type
460
+ * from `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`, `math`)
461
+ * with the worker-rendering mode. */
462
+ export declare interface LoadOptions extends LoadOptions_2 {
463
+ /**
464
+ * 'main' (default): parse in a worker, render on the main thread (current
465
+ * behaviour). 'worker': parse AND render inside the worker; use
466
+ * {@link XlsxWorkbook.renderViewportToBitmap} and paint the returned
467
+ * ImageBitmap via an `ImageBitmapRenderingContext`. Requires OffscreenCanvas.
468
+ * The math engine is unavailable in this mode (equations are skipped).
469
+ */
470
+ mode?: 'main' | 'worker';
471
+ }
438
472
 
439
473
  /**
440
474
  * Common load-time options shared by the docx / pptx / xlsx
@@ -690,8 +724,8 @@ export declare interface RenderViewportOptions {
690
724
  freezeCols?: number;
691
725
  /** Scale factor applied to all cell/header dimensions (default 1). */
692
726
  cellScale?: number;
693
- /** Pre-loaded Image elements keyed by their dataUrl (for ImageAnchor rendering). */
694
- loadedImages?: Map<string, HTMLImageElement>;
727
+ /** Pre-decoded image sources keyed by their dataUrl (for ImageAnchor rendering). */
728
+ loadedImages?: Map<string, CanvasImageSource>;
695
729
  /** Called once per cell that contains text, with canvas-pixel position and cell address. */
696
730
  onTextRun?: (info: XlsxTextRunInfo) => void;
697
731
  /** Highlighted row range for selected row headers (1-indexed inclusive).
@@ -710,6 +744,20 @@ export declare interface RenderViewportOptions {
710
744
  } | null;
711
745
  }
712
746
 
747
+ /**
748
+ * Resolved allowed-value set for a list validation. Either concrete display
749
+ * `values` (inline list or expanded range), or — when the operand is a defined
750
+ * name / complex formula we cannot expand — the raw `formula` text so the panel
751
+ * can disclose it instead of showing nothing.
752
+ */
753
+ export declare type ResolvedList = {
754
+ kind: 'values';
755
+ values: string[];
756
+ } | {
757
+ kind: 'formula';
758
+ formula: string;
759
+ };
760
+
713
761
  export declare interface Row {
714
762
  index: number;
715
763
  height: number | null;
@@ -1006,6 +1054,10 @@ export declare interface ViewportRange {
1006
1054
  cols: number;
1007
1055
  }
1008
1056
 
1057
+ /** Serializable subset of RenderViewportOptions: drop the callback and the
1058
+ * image cache (the worker owns its own). */
1059
+ export declare type WireRenderViewportOptions = Omit<RenderViewportOptions, 'onTextRun' | 'loadedImages'>;
1060
+
1009
1061
  export declare interface Workbook {
1010
1062
  sheets: SheetMeta[];
1011
1063
  }
@@ -1046,6 +1098,17 @@ export declare interface Worksheet {
1046
1098
  /** A1-style cell refs of commented cells (ECMA-376 §18.7.3). Rendered as a
1047
1099
  * small red triangle in each cell's top-right corner. */
1048
1100
  commentRefs?: string[];
1101
+ /** Full-fidelity comment bodies (cell ref + author + plain text) for every
1102
+ * `<comment>` in `xl/commentsN.xml` (ECMA-376 §18.7). Parallel to
1103
+ * {@link commentRefs} (one entry per ref). Consume this to read the note
1104
+ * text; the renderer uses {@link commentRefs} for the red indicator and the
1105
+ * viewer surfaces these bodies in an Excel-style hover popup. */
1106
+ comments?: XlsxComment[];
1107
+ /** Data-validation rules on this sheet (ECMA-376 §18.3.1.32–33). Exposed for
1108
+ * tooling. The viewer draws a list-dropdown arrow on the active cell when the
1109
+ * selection intersects a `list`-type rule's `sqref` (display only — opening
1110
+ * the list / picking a value is out of scope for a viewer). */
1111
+ dataValidations?: DataValidation[];
1049
1112
  /** Defined names in scope for this sheet (ECMA-376 §18.2.5). Used by
1050
1113
  * conditional-formatting `expression` rules that call named ranges
1051
1114
  * (e.g. `task_start`, `today`). */
@@ -1118,6 +1181,24 @@ export declare interface XlsxChartSeries {
1118
1181
  errBars?: ErrBars[];
1119
1182
  }
1120
1183
 
1184
+ /** One cell comment. Sourced from the classic notes file `xl/commentsN.xml`
1185
+ * (ECMA-376 §18.7) when present, otherwise from the Office-365 threaded
1186
+ * comments part `xl/threadedComments/` (MS-XLSX schema
1187
+ * `…/spreadsheetml/2018/threadedcomments`, `personId` resolved via
1188
+ * `xl/persons/`). `text` is the joined plain text — every `<r><t>` run for
1189
+ * classic notes, every reply in the thread (newline-joined) for threaded
1190
+ * comments; rich-text formatting is dropped. 1:1 with the Rust `XlsxComment`
1191
+ * (serde camelCase). */
1192
+ export declare interface XlsxComment {
1193
+ /** A1-style cell reference (`@ref` on the comment element). */
1194
+ cellRef: string;
1195
+ /** Resolved author name — the `<authors>` entry (classic) or the `<person>`
1196
+ * `displayName` (threaded). Absent when unresolved. */
1197
+ author?: string;
1198
+ /** Concatenated plain text of every run / threaded reply. */
1199
+ text: string;
1200
+ }
1201
+
1121
1202
  /** Emitted once per cell that has text, with the cell's canvas-pixel bounds. */
1122
1203
  export declare interface XlsxTextRunInfo {
1123
1204
  text: string;
@@ -1152,6 +1233,12 @@ export declare class XlsxViewer {
1152
1233
  private currentSheet;
1153
1234
  private currentWorksheet;
1154
1235
  private opts;
1236
+ /** 'main' renders on this thread; 'worker' paints worker-produced bitmaps. */
1237
+ private readonly _mode;
1238
+ /** The canvas's bitmaprenderer context, used only in worker mode. A canvas
1239
+ * holds one context type for its lifetime, so this is obtained once and the
1240
+ * main-mode 2d render path is never used on the same canvas. */
1241
+ private _bitmapCtx;
1155
1242
  private resizeObserver;
1156
1243
  /**
1157
1244
  * Start-anchored horizontal scroll position (the {@link effectiveScrollLeft}
@@ -1171,6 +1258,32 @@ export declare class XlsxViewer {
1171
1258
  private selectionOverlay;
1172
1259
  private keydownHandler;
1173
1260
  private pendingTap;
1261
+ /** DOM overlay element that shows the hovered cell's comment. Lives in
1262
+ * canvasArea above the scrollHost; `pointer-events:none` so it never blocks
1263
+ * cell interaction. */
1264
+ private commentPopup;
1265
+ /** `"row:col"` → comment for the current sheet, rebuilt on every showSheet. */
1266
+ private commentMap;
1267
+ /** `"row:col"` of the cell whose popup is currently shown (or pending), so a
1268
+ * pointermove within the same cell doesn't restart the show timer. */
1269
+ private commentPopupKey;
1270
+ /** Pending show timer (see {@link COMMENT_POPUP_DELAY_MS}). */
1271
+ private commentPopupTimer;
1272
+ /** DOM overlay listing a list-validated cell's allowed values. Lives in
1273
+ * canvasArea above the scrollHost; unlike the comment popup this is a click
1274
+ * target (`pointer-events:auto`). Read-only: hovering an item highlights it
1275
+ * but selecting does NOT change the cell. */
1276
+ private validationPanel;
1277
+ /** `"row:col"` of the cell whose panel is currently open, or null. Lets a
1278
+ * re-click on the same arrow toggle the panel closed. */
1279
+ private validationPanelKey;
1280
+ /** Screen rect (canvasArea CSS px) of the dropdown arrow button last drawn by
1281
+ * {@link maybeDrawValidationDropdown}, so pointerdown can hit-test it. Null
1282
+ * when no arrow is currently visible. */
1283
+ private validationArrowRect;
1284
+ /** Document-level pointerdown listener that closes the panel on an outside
1285
+ * click; installed only while the panel is open. */
1286
+ private validationOutsideHandler;
1174
1287
  constructor(container: HTMLElement, opts?: XlsxViewerOptions);
1175
1288
  /**
1176
1289
  * Load an XLSX from URL or ArrayBuffer and render the first sheet.
@@ -1245,6 +1358,14 @@ export declare class XlsxViewer {
1245
1358
  private getCellRect;
1246
1359
  /** Returns the current selection, including mode. */
1247
1360
  get selection(): CellRange | null;
1361
+ /**
1362
+ * Programmatically select a single cell by A1 reference (e.g. `"B2"`), as if
1363
+ * the user had clicked it: updates the active/anchor cell, redraws the
1364
+ * selection overlay (including any list-validation dropdown arrow), and fires
1365
+ * `onSelectionChange`. A no-op for malformed refs. Closes any open validation
1366
+ * panel, matching the click path.
1367
+ */
1368
+ select(ref: string): void;
1248
1369
  /**
1249
1370
  * Returns what the header area contains at the given client coordinates.
1250
1371
  * Returns null when the point is in the cell grid (not a header).
@@ -1253,6 +1374,49 @@ export declare class XlsxViewer {
1253
1374
  /** Copy the selected cell range as tab-separated text to the clipboard. */
1254
1375
  private copySelection;
1255
1376
  private updateSelectionOverlay;
1377
+ /** Draw the Excel list-validation dropdown button just outside the
1378
+ * bottom-right corner of the *active* cell when that cell is covered by a
1379
+ * `list` data-validation rule. Anchored to the single active cell (not the
1380
+ * whole range) to mirror Excel, which attaches the button to the active
1381
+ * cell of the selection. */
1382
+ private maybeDrawValidationDropdown;
1383
+ /** Toggle the dropdown panel for the active cell's list validation. Called
1384
+ * from pointerdown when the arrow rect is hit. Re-clicking the same arrow
1385
+ * closes it. */
1386
+ private toggleValidationPanel;
1387
+ /** Resolve the allowed values for `formula1` (relative to the current sheet)
1388
+ * and render them in the panel anchored below the active cell. Async because
1389
+ * cross-sheet range references may need a lazily-parsed worksheet. */
1390
+ private openValidationPanel;
1391
+ /** Build the panel's children. Uses textContent throughout (no HTML injection
1392
+ * from cell values). Items highlight on hover but are NOT selectable —
1393
+ * this is a read-only viewer, so clicking a value must not change the cell. */
1394
+ private renderValidationPanel;
1395
+ /** Position the (already-populated, visible-or-becoming-visible) panel below
1396
+ * the dropdown arrow / active cell using the pure geometry calculator. */
1397
+ private positionValidationPanel;
1398
+ /** Install a document-level pointerdown listener that closes the panel on a
1399
+ * click outside it (and outside the arrow, which toggles via its own path).
1400
+ * Removed by {@link hideValidationPanel}. */
1401
+ private installValidationOutsideHandler;
1402
+ /** Hide the panel and detach its outside-click listener. Called on re-click,
1403
+ * outside click, Esc, scroll, selection change, sheet switch and destroy. */
1404
+ private hideValidationPanel;
1405
+ /** Build the `"row:col"` → comment index for the given sheet. Parses each
1406
+ * `XlsxComment.cellRef` with the shared {@link parseA1}; later refs win on a
1407
+ * collision (Excel allows at most one note per cell, so this is moot in
1408
+ * practice). */
1409
+ private buildCommentMap;
1410
+ /** Show the popup for the comment on `cell` after the hover dwell, anchored to
1411
+ * the cell's current on-screen rect. No-op when the cell carries no comment.
1412
+ * Re-hovering the same cell does not restart the timer. */
1413
+ private scheduleCommentPopup;
1414
+ /** Immediately render the popup for `comment` anchored to `cell` (used by the
1415
+ * hover-dwell timer and by touch selection, which has no hover). */
1416
+ private renderCommentPopup;
1417
+ /** Hide the popup and cancel any pending show. Called on cell-out, scroll,
1418
+ * sheet switch and destroy. */
1419
+ private hideCommentPopup;
1256
1420
  private applyPointerSelection;
1257
1421
  private setupSelectionEvents;
1258
1422
  private buildTabs;
@@ -1329,6 +1493,15 @@ export declare interface XlsxViewerOptions {
1329
1493
  * dependency-injection contract as the docx/pptx viewers.
1330
1494
  */
1331
1495
  math?: MathRenderer;
1496
+ /**
1497
+ * `'main'` (default): parse in a worker, render on the main thread. `'worker'`:
1498
+ * parse AND render entirely inside the worker and paint the returned
1499
+ * ImageBitmap onto the viewer's canvas, so document rendering never blocks the
1500
+ * UI thread. All interaction (scroll, sheet tabs, frozen panes, zoom, cell
1501
+ * selection) is unchanged. Requires `Worker` + `OffscreenCanvas`. Equations
1502
+ * require `'main'` (the math engine cannot cross the worker boundary).
1503
+ */
1504
+ mode?: 'main' | 'worker';
1332
1505
  }
1333
1506
 
1334
1507
  export declare class XlsxWorkbook {
@@ -1336,7 +1509,7 @@ export declare class XlsxWorkbook {
1336
1509
  private bridge;
1337
1510
  private parsedWorkbook;
1338
1511
  private sheetCache;
1339
- /** Cache of loaded images keyed by their data URL. Shared across sheets. */
1512
+ /** Cache of decoded image bitmaps keyed by their data URL. Shared across sheets. */
1340
1513
  private imageCache;
1341
1514
  private rawData;
1342
1515
  private maxZipEntryBytes;
@@ -1344,6 +1517,7 @@ export declare class XlsxWorkbook {
1344
1517
  * `renderViewport` call reuses it — equations in shapes render when present,
1345
1518
  * and are skipped (engine tree-shaken) when omitted. */
1346
1519
  private math;
1520
+ private _mode;
1347
1521
  private constructor();
1348
1522
  /** Parse an XLSX from a URL or ArrayBuffer. */
1349
1523
  static load(source: string | ArrayBuffer, opts?: LoadOptions): Promise<XlsxWorkbook>;
@@ -1354,7 +1528,38 @@ export declare class XlsxWorkbook {
1354
1528
  * `null` for sheets that declare no tab color. */
1355
1529
  get tabColors(): (string | null)[];
1356
1530
  getWorksheet(sheetIndex: number): Promise<Worksheet>;
1531
+ /**
1532
+ * Resolve a `list`-type data-validation `formula1` (ECMA-376 §18.3.1.32) into
1533
+ * the set of allowed values to display, evaluated relative to `sheetIndex`
1534
+ * (the sheet that owns the validation, used to resolve unqualified ranges):
1535
+ *
1536
+ * - Inline quoted list `"A,B,C"` → the literal values.
1537
+ * - Range ref `$B$2:$B$5` → each non-empty cell's *display
1538
+ * string* (the same formatted text the grid shows, via {@link formatCellValue}),
1539
+ * walked row-major. `Sheet2!$A$1:$A$9` resolves against the named sheet
1540
+ * (lazily parsed via {@link getWorksheet}, hence async).
1541
+ * - Named range / complex formula → `{ kind: 'formula' }` carrying the
1542
+ * raw text so the caller can disclose it rather than blanking it.
1543
+ *
1544
+ * Read-only: this only reads cell values for display; it never writes.
1545
+ */
1546
+ resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
1357
1547
  renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
1548
+ /**
1549
+ * Render a sheet viewport and return it as an ImageBitmap (both modes; in
1550
+ * worker mode the render runs entirely off the main thread). `opts.width` /
1551
+ * `opts.height` are required: there is no DOM element to measure in a worker
1552
+ * or on an OffscreenCanvas. Paint with
1553
+ * `canvas.getContext('bitmaprenderer').transferFromImageBitmap(bitmap)`.
1554
+ *
1555
+ * The returned ImageBitmap is owned by the caller: pass it to
1556
+ * `transferFromImageBitmap` (which consumes it) or call `bitmap.close()`
1557
+ * when done, or its backing memory is held until GC.
1558
+ */
1559
+ renderViewportToBitmap(sheetIndex: number, viewport: ViewportRange, opts: WireRenderViewportOptions & {
1560
+ width: number;
1561
+ height: number;
1562
+ }): Promise<ImageBitmap>;
1358
1563
  destroy(): void;
1359
1564
  }
1360
1565