@silurus/ooxml 0.67.0 → 0.68.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.
@@ -4387,6 +4387,7 @@ declare class XlsxViewer {
4387
4387
  private selectionOverlay;
4388
4388
  private keydownHandler;
4389
4389
  private pendingTap;
4390
+ private resizeDrag;
4390
4391
  /** DOM overlay element that shows the hovered cell's comment. Lives in
4391
4392
  * canvasArea above the scrollHost; `pointer-events:none` so it never blocks
4392
4393
  * cell interaction. */
@@ -4500,6 +4501,33 @@ declare class XlsxViewer {
4500
4501
  * Returns null when the point is in the cell grid (not a header).
4501
4502
  */
4502
4503
  private getHeaderHit;
4504
+ /**
4505
+ * If the pointer sits on a column/row-header border (within {@link
4506
+ * RESIZE_GRAB_PX}), return the resize target: which index to resize and the
4507
+ * fixed LTR edge it grows from (in canvasArea CSS px). Excel resizes the band
4508
+ * whose *trailing* border you grab — the column to the left of a vertical
4509
+ * border, the row above a horizontal one — so both that band and its
4510
+ * neighbour-to-the-far-side are checked. Geometry comes straight from {@link
4511
+ * getCellRect}, so the grab line always coincides with the drawn border at any
4512
+ * scroll offset / zoom / RTL. Returns null off the header borders.
4513
+ */
4514
+ private getResizeTarget;
4515
+ /**
4516
+ * Apply a live resize drag: size the band from its fixed origin edge to the
4517
+ * current pointer, clamp to {@link RESIZE_MIN_PX}, and write the result back
4518
+ * into the in-memory worksheet model in its native unit (Excel column widths /
4519
+ * points). This is a *view-only* mutation — the file is never written. The
4520
+ * memoized axis cache for this sheet is invalidated so every geometry read
4521
+ * (spacer, hit-test, overlay, renderer) sees the new size on the next frame.
4522
+ */
4523
+ private applyResize;
4524
+ /**
4525
+ * Change the cell-selection highlight color at runtime (see {@link
4526
+ * XlsxViewerOptions.selectionColor}). The border takes the color as-is and the
4527
+ * fill becomes a translucent shade of it; the current selection repaints
4528
+ * immediately.
4529
+ */
4530
+ setSelectionColor(color: string): void;
4503
4531
  /** Copy the selected cell range as tab-separated text to the clipboard. */
4504
4532
  private copySelection;
4505
4533
  private updateSelectionOverlay;
@@ -4576,9 +4604,15 @@ declare class XlsxViewer {
4576
4604
  destroy(): void;
4577
4605
  }
4578
4606
 
4579
- declare interface XlsxViewerOptions {
4607
+ declare interface XlsxViewerOptions extends LoadOptions_2 {
4580
4608
  /** Scale factor for cell/header dimensions (default 1). 0.5 = half size. */
4581
4609
  cellScale?: number;
4610
+ /**
4611
+ * Enable drag-to-resize of column widths / row heights by dragging header
4612
+ * borders. Resizing only changes the on-screen view — it never modifies the
4613
+ * loaded file. Default: true.
4614
+ */
4615
+ resizable?: boolean;
4582
4616
  /** Show the Excel-style zoom slider at the right end of the sheet-tab bar.
4583
4617
  * Default `true`. Set `false` to hide it (e.g. when the host supplies its
4584
4618
  * own zoom control). */
@@ -4601,27 +4635,15 @@ declare interface XlsxViewerOptions {
4601
4635
  /** Called when the selected cell range changes. null means no selection. */
4602
4636
  onSelectionChange?: (selection: CellRange_2 | null) => void;
4603
4637
  /**
4604
- * Opt in to Google-Fonts-hosted, metric-compatible substitutes for the
4605
- * Office default fonts (Carlito for Calibri, Caladea for Cambria) so
4606
- * column layouts match Excel on systems without Office installed.
4607
- * Default `false`. See `XlsxWorkbook.LoadOptions.useGoogleFonts` for the
4608
- * privacy implications.
4638
+ * Color of the cell-selection highlight. A single CSS color drives both the
4639
+ * selection rectangle's border (drawn in this color) and its fill (the same
4640
+ * color made translucent see {@link selectionOverlayStyle}), so callers pick
4641
+ * one accent color instead of a separate border + background. Any CSS color
4642
+ * string works (`#1a73e8`, `rgb(...)`, `tomato`, …). Default `#1a73e8`
4643
+ * (Google blue), matching the historical look. Can also be changed at runtime
4644
+ * via {@link XlsxViewer.setSelectionColor}.
4609
4645
  */
4610
- useGoogleFonts?: boolean;
4611
- /**
4612
- * Override the per-entry ZIP decompression cap (bytes) used by the
4613
- * zip-bomb guard in the Rust parser. Defaults to 512 MiB. Zero / negative
4614
- * values fall back to the default.
4615
- */
4616
- maxZipEntryBytes?: number;
4617
- /**
4618
- * Opt-in OMML equation engine for rendering math in shapes/text boxes.
4619
- * Import it from the separate `@silurus/ooxml/math` entry and pass it in
4620
- * (`import { math } from '@silurus/ooxml/math'`). When omitted, equations are
4621
- * skipped and the ~3 MB engine never enters the bundle (tree-shaken). Same
4622
- * dependency-injection contract as the docx/pptx viewers.
4623
- */
4624
- math?: MathRenderer;
4646
+ selectionColor?: string;
4625
4647
  /**
4626
4648
  * `'main'` (default): parse in a worker, render on the main thread. `'worker'`:
4627
4649
  * parse AND render entirely inside the worker and paint the returned
@@ -1329,6 +1329,7 @@ export declare class XlsxViewer {
1329
1329
  private selectionOverlay;
1330
1330
  private keydownHandler;
1331
1331
  private pendingTap;
1332
+ private resizeDrag;
1332
1333
  /** DOM overlay element that shows the hovered cell's comment. Lives in
1333
1334
  * canvasArea above the scrollHost; `pointer-events:none` so it never blocks
1334
1335
  * cell interaction. */
@@ -1442,6 +1443,33 @@ export declare class XlsxViewer {
1442
1443
  * Returns null when the point is in the cell grid (not a header).
1443
1444
  */
1444
1445
  private getHeaderHit;
1446
+ /**
1447
+ * If the pointer sits on a column/row-header border (within {@link
1448
+ * RESIZE_GRAB_PX}), return the resize target: which index to resize and the
1449
+ * fixed LTR edge it grows from (in canvasArea CSS px). Excel resizes the band
1450
+ * whose *trailing* border you grab — the column to the left of a vertical
1451
+ * border, the row above a horizontal one — so both that band and its
1452
+ * neighbour-to-the-far-side are checked. Geometry comes straight from {@link
1453
+ * getCellRect}, so the grab line always coincides with the drawn border at any
1454
+ * scroll offset / zoom / RTL. Returns null off the header borders.
1455
+ */
1456
+ private getResizeTarget;
1457
+ /**
1458
+ * Apply a live resize drag: size the band from its fixed origin edge to the
1459
+ * current pointer, clamp to {@link RESIZE_MIN_PX}, and write the result back
1460
+ * into the in-memory worksheet model in its native unit (Excel column widths /
1461
+ * points). This is a *view-only* mutation — the file is never written. The
1462
+ * memoized axis cache for this sheet is invalidated so every geometry read
1463
+ * (spacer, hit-test, overlay, renderer) sees the new size on the next frame.
1464
+ */
1465
+ private applyResize;
1466
+ /**
1467
+ * Change the cell-selection highlight color at runtime (see {@link
1468
+ * XlsxViewerOptions.selectionColor}). The border takes the color as-is and the
1469
+ * fill becomes a translucent shade of it; the current selection repaints
1470
+ * immediately.
1471
+ */
1472
+ setSelectionColor(color: string): void;
1445
1473
  /** Copy the selected cell range as tab-separated text to the clipboard. */
1446
1474
  private copySelection;
1447
1475
  private updateSelectionOverlay;
@@ -1518,9 +1546,15 @@ export declare class XlsxViewer {
1518
1546
  destroy(): void;
1519
1547
  }
1520
1548
 
1521
- export declare interface XlsxViewerOptions {
1549
+ export declare interface XlsxViewerOptions extends LoadOptions_2 {
1522
1550
  /** Scale factor for cell/header dimensions (default 1). 0.5 = half size. */
1523
1551
  cellScale?: number;
1552
+ /**
1553
+ * Enable drag-to-resize of column widths / row heights by dragging header
1554
+ * borders. Resizing only changes the on-screen view — it never modifies the
1555
+ * loaded file. Default: true.
1556
+ */
1557
+ resizable?: boolean;
1524
1558
  /** Show the Excel-style zoom slider at the right end of the sheet-tab bar.
1525
1559
  * Default `true`. Set `false` to hide it (e.g. when the host supplies its
1526
1560
  * own zoom control). */
@@ -1543,27 +1577,15 @@ export declare interface XlsxViewerOptions {
1543
1577
  /** Called when the selected cell range changes. null means no selection. */
1544
1578
  onSelectionChange?: (selection: CellRange | null) => void;
1545
1579
  /**
1546
- * Opt in to Google-Fonts-hosted, metric-compatible substitutes for the
1547
- * Office default fonts (Carlito for Calibri, Caladea for Cambria) so
1548
- * column layouts match Excel on systems without Office installed.
1549
- * Default `false`. See `XlsxWorkbook.LoadOptions.useGoogleFonts` for the
1550
- * privacy implications.
1580
+ * Color of the cell-selection highlight. A single CSS color drives both the
1581
+ * selection rectangle's border (drawn in this color) and its fill (the same
1582
+ * color made translucent see {@link selectionOverlayStyle}), so callers pick
1583
+ * one accent color instead of a separate border + background. Any CSS color
1584
+ * string works (`#1a73e8`, `rgb(...)`, `tomato`, …). Default `#1a73e8`
1585
+ * (Google blue), matching the historical look. Can also be changed at runtime
1586
+ * via {@link XlsxViewer.setSelectionColor}.
1551
1587
  */
1552
- useGoogleFonts?: boolean;
1553
- /**
1554
- * Override the per-entry ZIP decompression cap (bytes) used by the
1555
- * zip-bomb guard in the Rust parser. Defaults to 512 MiB. Zero / negative
1556
- * values fall back to the default.
1557
- */
1558
- maxZipEntryBytes?: number;
1559
- /**
1560
- * Opt-in OMML equation engine for rendering math in shapes/text boxes.
1561
- * Import it from the separate `@silurus/ooxml/math` entry and pass it in
1562
- * (`import { math } from '@silurus/ooxml/math'`). When omitted, equations are
1563
- * skipped and the ~3 MB engine never enters the bundle (tree-shaken). Same
1564
- * dependency-injection contract as the docx/pptx viewers.
1565
- */
1566
- math?: MathRenderer;
1588
+ selectionColor?: string;
1567
1589
  /**
1568
1590
  * `'main'` (default): parse in a worker, render on the main thread. `'worker'`:
1569
1591
  * parse AND render entirely inside the worker and paint the returned