@silurus/ooxml 0.76.1 → 0.77.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.
@@ -10,7 +10,7 @@ interface MathRenderer {
10
10
  mathMLToSvg(mathml: string): Promise<MathSvg>;
11
11
  }
12
12
  //#endregion
13
- //#region dist/.types-work/hyperlink-BnJnsq2_.d.ts
13
+ //#region dist/.types-work/hyperlink-BqgLAFOG.d.ts
14
14
  type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
15
15
  interface MathRun {
16
16
  kind: 'run';
@@ -231,7 +231,7 @@ interface Stroke {
231
231
  fillType: 'none';
232
232
  }>;
233
233
  dashStyle?: string;
234
- lineCap?: CanvasLineCap;
234
+ lineCap?: 'butt' | 'round' | 'square';
235
235
  headEnd?: ArrowEnd;
236
236
  tailEnd?: ArrowEnd;
237
237
  cmpd?: string;
@@ -602,9 +602,14 @@ interface LegendManualLayout {
602
602
  w: number;
603
603
  h: number;
604
604
  }
605
+ interface ChartRect {
606
+ x: number;
607
+ y: number;
608
+ w: number;
609
+ h: number;
610
+ }
605
611
  type OoxmlErrorCode = 'encrypted' | 'invalid-password' | 'unsupported-encryption' | 'legacy-binary-format' | 'not-ooxml';
606
612
  type OoxmlErrorStage = 'container' | 'decompression' | 'parsing' | 'serialization' | 'layout' | 'rendering' | 'worker';
607
- type OoxmlErrorSource = 'container' | 'zip-part' | 'parser' | 'serializer' | 'layout' | 'renderer' | 'worker';
608
613
  declare class OoxmlError extends Error {
609
614
  readonly code: OoxmlErrorCode;
610
615
  constructor(code: OoxmlErrorCode, message: string);
@@ -705,7 +710,15 @@ type HyperlinkTarget = {
705
710
  };
706
711
  declare function openExternalHyperlink(url: string, allowed?: readonly string[], win?: Pick<Window, 'open'> | undefined): boolean;
707
712
  //#endregion
708
- //#region dist/.types-work/find-highlight-DkZhNxUb.d.ts
713
+ //#region dist/.types-work/find-highlight-DcNlrW8O.d.ts
714
+ interface TextSelectionContextOptions {
715
+ readonly maxTextCharacters?: number;
716
+ readonly maxRunLocators?: number;
717
+ }
718
+ interface ViewerContextMenuEvent<TContext> {
719
+ readonly originalEvent: MouseEvent;
720
+ getContext(): Promise<TContext | null>;
721
+ }
709
722
  interface AutoResizeOptions {
710
723
  pauseWhenHidden?: boolean;
711
724
  }
@@ -736,7 +749,7 @@ interface FindHighlightColors {
736
749
  active?: string;
737
750
  }
738
751
  //#endregion
739
- //#region dist/.types-work/docx-C5SBoWU-.d.ts
752
+ //#region dist/.types-work/docx-BkK3rbgp.d.ts
740
753
  interface DocxDocumentModel {
741
754
  section: SectionProps;
742
755
  body: BodyElement[];
@@ -907,6 +920,7 @@ interface DocParagraph {
907
920
  markVanish?: boolean;
908
921
  widowControl?: boolean;
909
922
  overflowPunct?: boolean;
923
+ adjustRightInd?: boolean;
910
924
  borders?: ParagraphBorders | null;
911
925
  styleId?: string | null;
912
926
  defaultFontSize?: number;
@@ -1092,7 +1106,7 @@ interface ShapeRun {
1092
1106
  stroke: string | null;
1093
1107
  strokeWidth?: number;
1094
1108
  strokeDash?: string | null;
1095
- strokeCap?: CanvasLineCap | null;
1109
+ strokeCap?: 'butt' | 'round' | 'square' | null;
1096
1110
  headEnd?: LineEnd | null;
1097
1111
  tailEnd?: LineEnd | null;
1098
1112
  rotation?: number;
@@ -1387,24 +1401,12 @@ interface CellBorders {
1387
1401
  insideH: BorderSpec | null;
1388
1402
  insideV: BorderSpec | null;
1389
1403
  }
1390
- interface RenderPageOptions {
1391
- width?: number;
1392
- dpr?: number;
1393
- defaultTextColor?: string;
1394
- onTextRun?: (run: {
1395
- text: string;
1396
- x: number;
1397
- y: number;
1398
- w: number;
1399
- h: number;
1400
- fontSize: number;
1401
- font: string;
1402
- transform?: string;
1403
- }) => void;
1404
- showTrackChanges?: boolean;
1405
- currentDate?: Date | number;
1406
- }
1407
1404
  interface DocxTextRunInfo {
1405
+ source?: Readonly<{
1406
+ story: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textbox';
1407
+ storyInstance: string;
1408
+ path: readonly number[];
1409
+ }>;
1408
1410
  paragraphId?: string;
1409
1411
  text: string;
1410
1412
  x: number;
@@ -1418,12 +1420,74 @@ interface DocxTextRunInfo {
1418
1420
  hyperlink?: HyperlinkTarget;
1419
1421
  eastAsianVert?: boolean;
1420
1422
  }
1421
- type WireRenderPageOptions = Omit<RenderPageOptions, 'onTextRun'>;
1423
+ interface RenderPageOptions {
1424
+ width?: number;
1425
+ dpr?: number;
1426
+ defaultTextColor?: string;
1427
+ onTextRun?: (run: DocxTextRunInfo) => void;
1428
+ currentDate?: Date | number;
1429
+ }
1430
+ type DocxSelectionContextOptions = TextSelectionContextOptions;
1431
+ interface DocxSelectionSourceLocator {
1432
+ readonly story: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textbox';
1433
+ readonly storyInstance: string;
1434
+ readonly path: readonly number[];
1435
+ }
1436
+ interface DocxSelectionRunLocator {
1437
+ readonly pageIndex: number;
1438
+ readonly runIndex: number;
1439
+ readonly paragraphId?: string;
1440
+ readonly source?: DocxSelectionSourceLocator;
1441
+ }
1442
+ interface DocxTextSelectionContext {
1443
+ readonly format: 'docx';
1444
+ readonly kind: 'text';
1445
+ readonly text: string;
1446
+ readonly pageIndexes: readonly number[];
1447
+ readonly paragraphIds: readonly string[];
1448
+ readonly runs: readonly DocxSelectionRunLocator[];
1449
+ readonly truncated: boolean;
1450
+ readonly truncationReasons: readonly ('text' | 'runs')[];
1451
+ readonly textCharacters: number;
1452
+ readonly maxTextCharacters: number;
1453
+ readonly maxRunLocators: number;
1454
+ }
1455
+ interface DocxPagePoint {
1456
+ readonly xPt: number;
1457
+ readonly yPt: number;
1458
+ }
1459
+ interface DocxElementContext {
1460
+ readonly format: 'docx';
1461
+ readonly kind: 'element';
1462
+ readonly pageIndex: number;
1463
+ readonly elementIndex: number;
1464
+ readonly elementType: 'chart' | 'image' | 'shape';
1465
+ readonly point: DocxPagePoint;
1466
+ readonly bounds: Readonly<DocxPagePoint & {
1467
+ widthPt: number;
1468
+ heightPt: number;
1469
+ }>;
1470
+ readonly source: DocxSelectionSourceLocator;
1471
+ readonly text?: string;
1472
+ readonly mimeType?: string;
1473
+ readonly seriesCount?: number;
1474
+ readonly truncated: boolean;
1475
+ readonly truncationReasons: readonly ('text')[];
1476
+ readonly textCharacters: number;
1477
+ readonly maxTextCharacters: number;
1478
+ }
1479
+ type DocxSelectionContext = DocxTextSelectionContext | DocxElementContext;
1480
+ declare function readDocxTextSelectionContext(root: HTMLElement, selection: Selection | null, options?: DocxSelectionContextOptions): DocxTextSelectionContext | null;
1481
+ interface DocxElementContextOptions {
1482
+ readonly maxTextCharacters?: number;
1483
+ readonly currentDate?: Date | number;
1484
+ }
1422
1485
  interface LoadOptions$2 extends LoadOptions$3 {
1423
1486
  math?: MathRenderer;
1424
1487
  mode?: 'main' | 'worker';
1425
1488
  }
1426
- type RenderPageToBitmapOptions = WireRenderPageOptions & {
1489
+ type CollectPageRunsOptions = Pick<RenderPageOptions, 'width' | 'currentDate'>;
1490
+ type RenderPageToBitmapOptions = Omit<RenderPageOptions, 'onTextRun'> & {
1427
1491
  onTextRun?: (run: DocxTextRunInfo) => void;
1428
1492
  };
1429
1493
  declare class DocxDocument {
@@ -1464,14 +1528,18 @@ declare class DocxDocument {
1464
1528
  };
1465
1529
  renderPage(target: HTMLCanvasElement | OffscreenCanvas, pageIndex: number, opts?: RenderPageOptions): Promise<void>;
1466
1530
  renderPageToBitmap(pageIndex: number, opts?: RenderPageToBitmapOptions): Promise<ImageBitmap>;
1467
- collectPageRuns(pageIndex: number, opts?: WireRenderPageOptions): Promise<DocxTextRunInfo[]>;
1531
+ collectPageRuns(pageIndex: number, opts?: CollectPageRunsOptions): Promise<DocxTextRunInfo[]>;
1532
+ getElementContextAt(pageIndex: number, point: DocxPagePoint, opts?: DocxElementContextOptions): Promise<DocxElementContext | null>;
1468
1533
  }
1469
1534
  interface DocxMatchLocation {
1470
1535
  page: number;
1471
1536
  }
1472
- interface DocxViewerOptions extends RenderPageOptions, LoadOptions$2 {
1537
+ interface DocxViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>, LoadOptions$2 {
1473
1538
  container?: HTMLElement;
1474
1539
  enableTextSelection?: boolean;
1540
+ enableElementSelection?: boolean;
1541
+ onSelectionContextChange?: (context: DocxSelectionContext | null) => void;
1542
+ onContextMenu?: (event: ViewerContextMenuEvent<DocxSelectionContext>) => void;
1475
1543
  findHighlightColors?: FindHighlightColors;
1476
1544
  onPageChange?: (index: number, total: number) => void;
1477
1545
  zoomMin?: number;
@@ -1493,6 +1561,7 @@ declare class DocxViewer implements ZoomableViewer {
1493
1561
  private readonly _canvasMount;
1494
1562
  private _textLayer;
1495
1563
  private _highlightLayer;
1564
+ private _elementLayer;
1496
1565
  private _find;
1497
1566
  private _measureCtx;
1498
1567
  private _opts;
@@ -1500,6 +1569,12 @@ declare class DocxViewer implements ZoomableViewer {
1500
1569
  private readonly _renderDispatcher;
1501
1570
  private readonly _errorRouter;
1502
1571
  private _destroyed;
1572
+ private _selectionChangeListener;
1573
+ private _selectionContextKey;
1574
+ private _elementContext;
1575
+ private _elementHitGeneration;
1576
+ private _elementClickListener;
1577
+ private _contextMenuListener;
1503
1578
  static fromDocument(canvas: HTMLCanvasElement, document: DocxDocument, opts?: Omit<DocxViewerOptions, keyof LoadOptions$2>): Omit<DocxViewer, 'load'>;
1504
1579
  constructor(canvas: HTMLCanvasElement, opts?: DocxViewerOptions);
1505
1580
  load(source: string | ArrayBuffer): Promise<void>;
@@ -1528,6 +1603,14 @@ declare class DocxViewer implements ZoomableViewer {
1528
1603
  private _activateMatch;
1529
1604
  private _redrawHighlights;
1530
1605
  getResourceMetrics(): Promise<OoxmlResourceMetrics>;
1606
+ getSelectionContext(options?: DocxSelectionContextOptions): DocxSelectionContext | null;
1607
+ private _emitSelectionContextChange;
1608
+ private _setElementContext;
1609
+ private _invalidateElementContext;
1610
+ private _redrawElementOutline;
1611
+ private _onElementClick;
1612
+ private _onContextMenu;
1613
+ private _resolveContextAt;
1531
1614
  destroy(): void;
1532
1615
  private _render;
1533
1616
  private _reportRenderError;
@@ -1548,6 +1631,9 @@ interface DocxScrollViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>,
1548
1631
  paddingRight?: number;
1549
1632
  overscan?: number;
1550
1633
  enableTextSelection?: boolean;
1634
+ enableElementSelection?: boolean;
1635
+ onSelectionContextChange?: (context: DocxSelectionContext | null) => void;
1636
+ onContextMenu?: (event: ViewerContextMenuEvent<DocxSelectionContext>) => void;
1551
1637
  findHighlightColors?: FindHighlightColors;
1552
1638
  zoomMin?: number;
1553
1639
  zoomMax?: number;
@@ -1580,6 +1666,12 @@ declare class DocxScrollViewer implements ZoomableViewer {
1580
1666
  private _lastRange;
1581
1667
  private _lastTopIndex;
1582
1668
  private _scrollListener;
1669
+ private _selectionChangeListener;
1670
+ private _selectionContextKey;
1671
+ private _elementClickListener;
1672
+ private _contextMenuListener;
1673
+ private _elementContext;
1674
+ private _elementHitGeneration;
1583
1675
  private _destroyed;
1584
1676
  private _measureCtx;
1585
1677
  private readonly _bitmapInFlight;
@@ -1602,6 +1694,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
1602
1694
  private _fitWidthPx;
1603
1695
  private _baseScale;
1604
1696
  relayout(): void;
1697
+ private _relayout;
1605
1698
  private _recomputeHeights;
1606
1699
  private _gap;
1607
1700
  private _overscan;
@@ -1651,9 +1744,18 @@ declare class DocxScrollViewer implements ZoomableViewer {
1651
1744
  private _onResize;
1652
1745
  get topVisiblePage(): number;
1653
1746
  getResourceMetrics(): Promise<OoxmlResourceMetrics>;
1747
+ getSelectionContext(options?: DocxSelectionContextOptions): DocxSelectionContext | null;
1748
+ private _emitSelectionContextChange;
1749
+ private _setElementContext;
1750
+ private _invalidateElementContext;
1751
+ private _redrawElementOutlines;
1752
+ private _redrawElementOutlineForSlot;
1753
+ private _onElementClick;
1754
+ private _onContextMenu;
1755
+ private _resolveContextAt;
1654
1756
  destroy(): void;
1655
1757
  }
1656
- declare function buildDocxTextLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[], cssWidth: number, cssHeight: number, onHyperlinkClick?: (target: HyperlinkTarget) => void, measureForFont?: (font: string) => (s: string) => number): void;
1758
+ declare function buildDocxTextLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[], cssWidth: number, cssHeight: number, onHyperlinkClick?: (target: HyperlinkTarget) => void, measureForFont?: (font: string) => (s: string) => number, pageIndex?: number): void;
1657
1759
  interface DocxHighlightMatch {
1658
1760
  slices: MatchRunSlice[];
1659
1761
  active: boolean;
@@ -1661,10 +1763,10 @@ interface DocxHighlightMatch {
1661
1763
  type DocxHighlightColors = FindHighlightColors;
1662
1764
  declare function buildDocxHighlightLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[], matches: DocxHighlightMatch[], cssWidth: number, cssHeight: number, measureForFont: (font: string) => (s: string) => number, colors?: DocxHighlightColors): void;
1663
1765
  declare namespace docx_d_exports {
1664
- export { AnchorHostMetrics, AutoResizeOptions, BodyElement, BorderSpec, CellBorders, CellElement, ChartRun, ColSpec, ColumnsSpec, DocComment, DocNote, DocParagraph, DocRevision, DocRun, DocSettings, DocTable, DocTableCell, DocTableRow, DocxDocument, DocxDocumentModel, DocxHighlightColors, DocxHighlightMatch, DocxMatchLocation, DocxRunBorder, DocxScrollViewer, DocxScrollViewerOptions, DocxTextRun, DocxTextRunInfo, DocxViewer, DocxViewerOptions, EmbeddedFontRef, FieldRun, FindHighlightColors, FindMatch, FindMatchesOptions, FramePr, GradientStop, HeaderFooter, HeadersFooters, HyperlinkTarget, ImageRun, LineEnd, LineNumbering, LineSpacing, LoadOptions$2 as LoadOptions, NoteRef, NumberingInfo, OoxmlDecodedImageLimitError, OoxmlDecodedImageLimitMetric, OoxmlError, OoxmlErrorCode, OoxmlErrorSource, OoxmlErrorStage, OoxmlFormat, OoxmlResourceLimit, OoxmlResourceLimitError, OoxmlResourceLimitErrorDetails, OoxmlResourceLimits, OoxmlResourceMetric, OoxmlResourceMetrics, OoxmlResourceMetricsCheckpoint, OoxmlResourceName, OoxmlResourcePolicySnapshot, OoxmlResourceUsageSnapshot, OoxmlResourceViolation, PTabRun, PageBorderEdge, PageBorders, PageNumType, ParaBorderEdge, ParagraphBorders, PathCmd$1 as PathCmd, RenderPageOptions, RenderPageToBitmapOptions, RubyAnnotation, RunRevision, SectionGeom, SectionProps, ShapeRun, ShapeText$1 as ShapeText, ShapeTextRun$1 as ShapeTextRun, TabStop, TableBorders, TblpPr, TextPath, WireRenderPageOptions, autoResize, buildDocxHighlightLayer, buildDocxTextLayer, isOoxmlDecodedImageLimitError, noteText, openExternalHyperlink };
1766
+ export { AnchorHostMetrics, AutoResizeOptions, BodyElement, BorderSpec, CellBorders, CellElement, ChartDataLabelOverride, ChartDataPointOverride, ChartErrBars, ChartLabelBox, ChartManualLayout, ChartModel, ChartRect, ChartRun, ChartSeries, ChartSeriesDataLabels, ChartTrendline, ChartType, ChartexBoxSeries, ChartexBoxWhisker, ChartexSunburst, ChartexSunburstRow, ColSpec, CollectPageRunsOptions, ColumnsSpec, DocComment, DocNote, DocParagraph, DocRevision, DocRun, DocSettings, DocTable, DocTableCell, DocTableRow, DocxDocument, DocxDocumentModel, DocxElementContext, DocxElementContextOptions, DocxHighlightColors, DocxHighlightMatch, DocxMatchLocation, DocxPagePoint, DocxRunBorder, DocxScrollViewer, DocxScrollViewerOptions, DocxSelectionContext, DocxSelectionContextOptions, DocxSelectionRunLocator, DocxSelectionSourceLocator, DocxTextRun, DocxTextRunInfo, DocxTextSelectionContext, DocxViewer, DocxViewerOptions, Duotone$1 as Duotone, EmbeddedFontRef, FieldRun, FillRect, FindHighlightColors, FindMatch, FindMatchesOptions, FramePr, GradientStop, HeaderFooter, HeadersFooters, HyperlinkTarget, ImageRun, LegendManualLayout, LineEnd, LineNumbering, LineSpacing, LoadOptions$2 as LoadOptions, MatchRunSlice, MathAccent, MathArray, MathBar, MathBorderBox, MathBox, MathDelimiter, MathFraction, MathFunc, MathGroup, MathGroupChr, MathLimit, MathNary, MathNode, MathPhant, MathRadical, MathRenderer, MathRun, MathSPre, MathScript, MathStyle, MathSvg, NoteRef, NumberingInfo, OoxmlDecodedImageLimitError, OoxmlDecodedImageLimitMetric, OoxmlError, OoxmlErrorCode, OoxmlErrorStage, OoxmlFormat, OoxmlResourceLimit, OoxmlResourceLimitError, OoxmlResourceLimitErrorDetails, OoxmlResourceLimits, OoxmlResourceMetric, OoxmlResourceMetrics, OoxmlResourceMetricsCheckpoint, OoxmlResourceName, OoxmlResourcePolicySnapshot, OoxmlResourceUsageSnapshot, OoxmlResourceViolation, PTabRun, PageBorderEdge, PageBorders, PageNumType, ParaBorderEdge, ParagraphBorders, PathCmd$1 as PathCmd, RenderPageOptions, RenderPageToBitmapOptions, RubyAnnotation, RunRevision, SecondaryValueAxis, SectionGeom, SectionProps, ShapeRun, ShapeText$1 as ShapeText, ShapeTextRun$1 as ShapeTextRun, TabStop, TableBorders, TblpPr, TextPath, TextSelectionContextOptions, TileInfo, ViewerContextMenuEvent, ZoomableViewer, autoResize, buildDocxHighlightLayer, buildDocxTextLayer, isOoxmlDecodedImageLimitError, noteText, openExternalHyperlink, readDocxTextSelectionContext };
1665
1767
  }
1666
1768
  //#endregion
1667
- //#region dist/.types-work/pptx-CDgwsXLm.d.ts
1769
+ //#region dist/.types-work/pptx-DcrJjm1-.d.ts
1668
1770
  interface BlipBullet {
1669
1771
  type: 'blip';
1670
1772
  imagePath: string;
@@ -1701,11 +1803,16 @@ interface Slide {
1701
1803
  partName?: string;
1702
1804
  background: Fill | null;
1703
1805
  elements: SlideElement[];
1806
+ elementSources?: SlideElementSource[];
1704
1807
  notes?: string;
1705
1808
  comments?: PptxComment[];
1706
1809
  hidden?: boolean;
1707
1810
  parseError?: string;
1708
1811
  }
1812
+ type SlideElementOrigin = 'master' | 'layout' | 'slide';
1813
+ interface SlideElementSource {
1814
+ origin: SlideElementOrigin;
1815
+ }
1709
1816
  interface DimOptions {
1710
1817
  color: string;
1711
1818
  opacity: number;
@@ -1885,6 +1992,8 @@ interface PictureElement {
1885
1992
  sp3d?: Sp3d;
1886
1993
  }
1887
1994
  interface PptxTextRunInfo {
1995
+ elementIndex?: number;
1996
+ origin?: SlideElementOrigin;
1888
1997
  shapeId?: string;
1889
1998
  text: string;
1890
1999
  inShapeX: number;
@@ -1915,6 +2024,68 @@ interface PresentationHandle {
1915
2024
  pause(mediaPath?: string): void;
1916
2025
  destroy(): void;
1917
2026
  }
2027
+ interface PptxSelectionRunLocator {
2028
+ readonly slideIndex: number;
2029
+ readonly runIndex: number;
2030
+ readonly shapeId?: string;
2031
+ readonly elementIndex?: number;
2032
+ readonly origin?: SlideElementOrigin;
2033
+ }
2034
+ interface PptxTextSelectionContext {
2035
+ readonly format: 'pptx';
2036
+ readonly kind: 'text';
2037
+ readonly text: string;
2038
+ readonly slideIndexes: readonly number[];
2039
+ readonly shapeIds: readonly string[];
2040
+ readonly runs: readonly PptxSelectionRunLocator[];
2041
+ readonly truncated: boolean;
2042
+ readonly truncationReasons: readonly ('text' | 'runs')[];
2043
+ readonly textCharacters: number;
2044
+ readonly maxTextCharacters: number;
2045
+ readonly maxRunLocators: number;
2046
+ }
2047
+ declare function readPptxTextSelectionContext(root: HTMLElement, selection: Selection | null, options?: TextSelectionContextOptions): PptxTextSelectionContext | null;
2048
+ type PptxSelectionContextOptions = TextSelectionContextOptions;
2049
+ interface PptxSlidePoint {
2050
+ readonly x: number;
2051
+ readonly y: number;
2052
+ }
2053
+ interface PptxElementContextOptions {
2054
+ readonly tolerance?: number;
2055
+ readonly maxTextCharacters?: number;
2056
+ }
2057
+ interface PptxElementContext {
2058
+ readonly format: 'pptx';
2059
+ readonly kind: 'element';
2060
+ readonly slideIndex: number;
2061
+ readonly elementIndex: number;
2062
+ readonly origin: SlideElementOrigin | 'unknown';
2063
+ readonly elementType: SlideElement['type'];
2064
+ readonly point: PptxSlidePoint;
2065
+ readonly bounds: Readonly<{
2066
+ x: number;
2067
+ y: number;
2068
+ width: number;
2069
+ height: number;
2070
+ rotation: number;
2071
+ flipH: boolean;
2072
+ flipV: boolean;
2073
+ }>;
2074
+ readonly shapeId?: string;
2075
+ readonly name?: string;
2076
+ readonly geometry?: string;
2077
+ readonly text?: string;
2078
+ readonly mimeType?: string;
2079
+ readonly mediaKind?: 'audio' | 'video';
2080
+ readonly rowCount?: number;
2081
+ readonly columnCount?: number;
2082
+ readonly seriesCount?: number;
2083
+ readonly truncated: boolean;
2084
+ readonly truncationReasons: readonly ('text')[];
2085
+ readonly textCharacters: number;
2086
+ readonly maxTextCharacters: number;
2087
+ }
2088
+ type PptxSelectionContext = PptxTextSelectionContext | PptxElementContext;
1918
2089
  type LoadOptions$1 = LoadOptions$3 & {
1919
2090
  mode?: 'main' | 'worker';
1920
2091
  };
@@ -1930,6 +2101,8 @@ interface RenderSlideOptions {
1930
2101
  onTextRun?: TextRunCallback;
1931
2102
  skipMediaControls?: boolean;
1932
2103
  dim?: DimOptions;
2104
+ }
2105
+ interface PresentSlideOptions extends Omit<RenderSlideOptions, 'skipMediaControls'> {
1933
2106
  onError?: (error: Error) => void;
1934
2107
  }
1935
2108
  declare class PptxPresentation {
@@ -1965,16 +2138,17 @@ declare class PptxPresentation {
1965
2138
  renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slideIndex: number, opts?: RenderSlideOptions): Promise<void>;
1966
2139
  renderSlideToBitmap(slideIndex: number, opts?: RenderSlideToBitmapOptions): Promise<ImageBitmap>;
1967
2140
  collectSlideRuns(slideIndex: number, width?: number): Promise<PptxTextRunInfo[]>;
2141
+ getElementContextAt(slideIndex: number, point: PptxSlidePoint, options?: PptxElementContextOptions): Promise<PptxElementContext | null>;
1968
2142
  getMedia(mediaPath: string): Promise<Blob>;
1969
2143
  private _findMimeTypeForPath;
1970
2144
  getImage(imagePath: string, mimeType: string): Promise<Blob>;
1971
2145
  getResourceMetrics(): Promise<OoxmlResourceMetrics>;
1972
2146
  toMarkdown(): Promise<string>;
1973
- presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: RenderSlideOptions): Promise<PresentationHandle>;
2147
+ presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: PresentSlideOptions): Promise<PresentationHandle>;
1974
2148
  destroy(): void;
1975
2149
  }
1976
2150
  type HiddenSlideMode = 'show' | 'skip' | 'dim';
1977
- interface PptxViewerOptions extends RenderOptions, LoadOptions$1 {
2151
+ interface PptxViewerOptions extends Pick<RenderOptions, 'width' | 'dpr'>, LoadOptions$1 {
1978
2152
  onSlideChange?: (index: number, total: number) => void;
1979
2153
  onError?: (err: Error) => void;
1980
2154
  zoomMin?: number;
@@ -1982,6 +2156,10 @@ interface PptxViewerOptions extends RenderOptions, LoadOptions$1 {
1982
2156
  onScaleChange?: (scale: number) => void;
1983
2157
  enableMediaPlayback?: boolean;
1984
2158
  enableTextSelection?: boolean;
2159
+ enableElementSelection?: boolean;
2160
+ elementHitTolerance?: number;
2161
+ onSelectionContextChange?: (context: PptxSelectionContext | null) => void;
2162
+ onContextMenu?: (event: ViewerContextMenuEvent<PptxSelectionContext>) => void;
1985
2163
  findHighlightColors?: FindHighlightColors;
1986
2164
  hiddenSlideMode?: HiddenSlideMode;
1987
2165
  hiddenSlideDim?: Partial<DimOptions>;
@@ -1995,6 +2173,7 @@ declare class PptxViewer implements ZoomableViewer {
1995
2173
  private _scale;
1996
2174
  private textLayer;
1997
2175
  private highlightLayer;
2176
+ private elementLayer;
1998
2177
  private _find;
1999
2178
  private _measureCtx;
2000
2179
  private readonly presentationOwner;
@@ -2009,6 +2188,13 @@ declare class PptxViewer implements ZoomableViewer {
2009
2188
  private readonly renderDispatcher;
2010
2189
  private readonly errorRouter;
2011
2190
  private destroyed;
2191
+ private selectionChangeListener;
2192
+ private selectionContextKey;
2193
+ private elementClickListener;
2194
+ private contextMenuListener;
2195
+ private elementContext;
2196
+ private elementHitGeneration;
2197
+ private readonly elementHitTolerance;
2012
2198
  static fromPresentation(canvas: HTMLCanvasElement, presentation: PptxPresentation, opts?: Omit<PptxViewerOptions, keyof LoadOptions$1>): Omit<PptxViewer, 'load'>;
2013
2199
  constructor(canvas: HTMLCanvasElement, opts?: PptxViewerOptions);
2014
2200
  load(source: string | ArrayBuffer): Promise<void>;
@@ -2052,9 +2238,17 @@ declare class PptxViewer implements ZoomableViewer {
2052
2238
  private _resolveInternalSlideIndex;
2053
2239
  private _reportRenderError;
2054
2240
  getResourceMetrics(): Promise<OoxmlResourceMetrics>;
2241
+ getSelectionContext(options?: PptxSelectionContextOptions): PptxSelectionContext | null;
2242
+ private _emitSelectionContextChange;
2243
+ private _setElementContext;
2244
+ private _invalidateElementSelection;
2245
+ private _redrawElementOutline;
2246
+ private _onElementClick;
2247
+ private _onContextMenu;
2248
+ private _resolveContextAt;
2055
2249
  destroy(): void;
2056
2250
  }
2057
- interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>, LoadOptions$1 {
2251
+ interface PptxScrollViewerOptions extends Pick<RenderSlideOptions, 'width' | 'dpr'>, LoadOptions$1 {
2058
2252
  width?: number;
2059
2253
  gap?: number;
2060
2254
  paddingTop?: number;
@@ -2063,6 +2257,10 @@ interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>,
2063
2257
  paddingRight?: number;
2064
2258
  overscan?: number;
2065
2259
  enableTextSelection?: boolean;
2260
+ enableElementSelection?: boolean;
2261
+ elementHitTolerance?: number;
2262
+ onSelectionContextChange?: (context: PptxSelectionContext | null) => void;
2263
+ onContextMenu?: (event: ViewerContextMenuEvent<PptxSelectionContext>) => void;
2066
2264
  findHighlightColors?: FindHighlightColors;
2067
2265
  enableMediaPlayback?: boolean;
2068
2266
  mediaOverscan?: number;
@@ -2097,6 +2295,13 @@ declare class PptxScrollViewer implements ZoomableViewer {
2097
2295
  private _lastRange;
2098
2296
  private _lastTopIndex;
2099
2297
  private _scrollListener;
2298
+ private _selectionChangeListener;
2299
+ private _selectionContextKey;
2300
+ private _elementClickListener;
2301
+ private _contextMenuListener;
2302
+ private _elementContext;
2303
+ private _elementHitGeneration;
2304
+ private readonly _elementHitTolerance;
2100
2305
  private _destroyed;
2101
2306
  private readonly _slideInFlight;
2102
2307
  private _renderEpoch;
@@ -2119,6 +2324,7 @@ declare class PptxScrollViewer implements ZoomableViewer {
2119
2324
  private _fitWidthPx;
2120
2325
  private _baseScale;
2121
2326
  relayout(): void;
2327
+ private _relayout;
2122
2328
  private _recomputeHeights;
2123
2329
  private _gap;
2124
2330
  private _overscan;
@@ -2175,9 +2381,18 @@ declare class PptxScrollViewer implements ZoomableViewer {
2175
2381
  private _onResize;
2176
2382
  get topVisibleSlide(): number;
2177
2383
  getResourceMetrics(): Promise<OoxmlResourceMetrics>;
2384
+ getSelectionContext(options?: PptxSelectionContextOptions): PptxSelectionContext | null;
2385
+ private _emitSelectionContextChange;
2386
+ private _setElementContext;
2387
+ private _invalidateElementSelection;
2388
+ private _redrawElementOutlines;
2389
+ private _redrawElementOutlineForSlot;
2390
+ private _onElementClick;
2391
+ private _onContextMenu;
2392
+ private _resolveContextAt;
2178
2393
  destroy(): void;
2179
2394
  }
2180
- declare function buildPptxTextLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], cssWidth: number, cssHeight: number, onHyperlinkClick?: (target: HyperlinkTarget) => void): void;
2395
+ declare function buildPptxTextLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], cssWidth: number, cssHeight: number, onHyperlinkClick?: (target: HyperlinkTarget) => void, slideIndex?: number): void;
2181
2396
  interface PptxHighlightMatch {
2182
2397
  slices: MatchRunSlice[];
2183
2398
  active: boolean;
@@ -2185,10 +2400,10 @@ interface PptxHighlightMatch {
2185
2400
  type PptxHighlightColors = FindHighlightColors;
2186
2401
  declare function buildPptxHighlightLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], matches: PptxHighlightMatch[], cssWidth: number, cssHeight: number, measureForFont: (font: string) => (s: string) => number, colors?: PptxHighlightColors): void;
2187
2402
  declare namespace pptx_d_exports {
2188
- export { AutoResizeOptions, Bevel3d, BlipBullet, Bullet, Camera3d, ChartElement, ChartModel, ChartSeries, DimOptions, Fill, FillRect, FindHighlightColors, FindMatch, FindMatchesOptions, Glow, GradientFill, GradientStop$1 as GradientStop, HiddenSlideMode, HyperlinkTarget, ImageFill, LightRig, LineBreak, LoadOptions$1 as LoadOptions, MediaElement, NoFill, OoxmlDecodedImageLimitError, OoxmlDecodedImageLimitMetric, OoxmlError, OoxmlErrorCode, OoxmlErrorSource, OoxmlErrorStage, OoxmlFormat, OoxmlResourceLimit, OoxmlResourceLimitError, OoxmlResourceLimitErrorDetails, OoxmlResourceLimits, OoxmlResourceMetric, OoxmlResourceMetrics, OoxmlResourceMetricsCheckpoint, OoxmlResourceName, OoxmlResourcePolicySnapshot, OoxmlResourceUsageSnapshot, OoxmlResourceViolation, Paragraph, PathCmd$2 as PathCmd, PictureElement, PptxComment, PptxHighlightColors, PptxHighlightMatch, PptxMatchLocation, PptxPresentation, PptxScrollViewer, PptxScrollViewerOptions, PptxTextRunInfo, PptxViewer, PptxViewerOptions, Presentation, PresentationHandle, Reflection, RenderOptions, RenderSlideOptions, RenderSlideToBitmapOptions, Rot3d, Scene3d, Shadow, ShapeElement, Slide, SlideElement, SoftEdge, SolidFill, Sp3d, SpaceLine, Stroke, TabStop$1 as TabStop, TableCell, TableElement, TableRow, TextBody, TextRect, TextRun, TextRunCallback, TextRunData, TileInfo, autoResize, buildPptxHighlightLayer, buildPptxTextLayer, isOoxmlDecodedImageLimitError, openExternalHyperlink, renderSlide };
2403
+ export { ArrowEnd, AutoResizeOptions, Bevel3d, BlipBullet, Bullet, Camera3d, ChartDataLabelOverride, ChartDataPointOverride, ChartElement, ChartErrBars, ChartLabelBox, ChartManualLayout, ChartModel, ChartRect, ChartSeries, ChartSeriesDataLabels, ChartTrendline, ChartType, ChartexBoxSeries, ChartexBoxWhisker, ChartexSunburst, ChartexSunburstRow, DimOptions, Duotone$1 as Duotone, EquationRun, Fill, FillRect, FindHighlightColors, FindMatch, FindMatchesOptions, Glow, GradientFill, GradientStop$1 as GradientStop, HiddenSlideMode, HyperlinkTarget, ImageFill, LegendManualLayout, LightRig, LineBreak, LoadOptions$1 as LoadOptions, MatchRunSlice, MathAccent, MathArray, MathBar, MathBorderBox, MathBox, MathDelimiter, MathFraction, MathFunc, MathGroup, MathGroupChr, MathLimit, MathNary, MathNode, MathPhant, MathRadical, MathRenderer, MathRun, MathSPre, MathScript, MathStyle, MathSvg, MediaElement, NoFill, OoxmlDecodedImageLimitError, OoxmlDecodedImageLimitMetric, OoxmlError, OoxmlErrorCode, OoxmlErrorStage, OoxmlFormat, OoxmlResourceLimit, OoxmlResourceLimitError, OoxmlResourceLimitErrorDetails, OoxmlResourceLimits, OoxmlResourceMetric, OoxmlResourceMetrics, OoxmlResourceMetricsCheckpoint, OoxmlResourceName, OoxmlResourcePolicySnapshot, OoxmlResourceUsageSnapshot, OoxmlResourceViolation, Paragraph, PathCmd$2 as PathCmd, PatternFill, PictureElement, PptxComment, PptxElementContext, PptxElementContextOptions, PptxHighlightColors, PptxHighlightMatch, PptxMatchLocation, PptxPresentation, PptxScrollViewer, PptxScrollViewerOptions, PptxSelectionContext, PptxSelectionContextOptions, PptxSelectionRunLocator, PptxSlidePoint, PptxTextRunInfo, PptxTextSelectionContext, PptxViewer, PptxViewerOptions, PresentSlideOptions, Presentation, PresentationHandle, Reflection, RenderOptions, RenderSlideOptions, RenderSlideToBitmapOptions, Rot3d, Scene3d, SecondaryValueAxis, Shadow, ShapeElement, Slide, SlideElement, SlideElementOrigin, SlideElementSource, SlideRenderOptions, SoftEdge, SolidFill, Sp3d, SpaceLine, Stroke, TabStop$1 as TabStop, TableCell, TableElement, TableRow, TextBody, TextOutline, TextRect, TextRun, TextRunCallback, TextRunData, TextSelectionContextOptions, TileInfo, ViewerContextMenuEvent, ZoomableViewer, autoResize, buildPptxHighlightLayer, buildPptxTextLayer, isOoxmlDecodedImageLimitError, openExternalHyperlink, readPptxTextSelectionContext, renderSlide };
2189
2404
  }
2190
2405
  //#endregion
2191
- //#region dist/.types-work/xlsx-D1NhipZN.d.ts
2406
+ //#region dist/.types-work/xlsx-DrlamDaR.d.ts
2192
2407
  interface Workbook {
2193
2408
  sheets: SheetMeta[];
2194
2409
  date1904?: boolean;
@@ -2230,7 +2445,7 @@ interface Worksheet {
2230
2445
  rightToLeft?: boolean;
2231
2446
  outlinePr?: OutlinePr;
2232
2447
  tabColor?: string | null;
2233
- autoFilter?: CellRange$1 | null;
2448
+ autoFilter?: WorksheetCellRange | null;
2234
2449
  hyperlinks?: Hyperlink[];
2235
2450
  commentRefs?: string[];
2236
2451
  comments?: XlsxComment[];
@@ -2261,7 +2476,7 @@ interface PivotTableMetadata {
2261
2476
  status: PivotMetadataStatus;
2262
2477
  extensionUris?: string[];
2263
2478
  }
2264
- interface PivotLocation extends CellRange$1 {
2479
+ interface PivotLocation extends WorksheetCellRange {
2265
2480
  firstHeaderRow: number;
2266
2481
  firstDataRow: number;
2267
2482
  firstDataCol: number;
@@ -2404,7 +2619,7 @@ interface SlicerElementStyle {
2404
2619
  borderColor?: string;
2405
2620
  }
2406
2621
  interface TableInfo {
2407
- range: CellRange$1;
2622
+ range: WorksheetCellRange;
2408
2623
  styleName: string;
2409
2624
  headerRowCount: number;
2410
2625
  totalsRowCount: number;
@@ -2449,12 +2664,6 @@ interface DataValidation {
2449
2664
  errorTitle?: string;
2450
2665
  errorMessage?: string;
2451
2666
  }
2452
- type XlsxChartSeries = ChartSeries;
2453
- type SeriesDataLabels = ChartSeriesDataLabels;
2454
- type DataLabelOverride = ChartDataLabelOverride;
2455
- type DataPointOverride = ChartDataPointOverride;
2456
- type ErrBars = ChartErrBars;
2457
- type ManualLayout = ChartManualLayout;
2458
2667
  interface ChartAnchor {
2459
2668
  fromCol: number;
2460
2669
  fromColOff: number;
@@ -2619,7 +2828,7 @@ interface ImageAnchor {
2619
2828
  alpha?: number;
2620
2829
  duotone?: Duotone;
2621
2830
  }
2622
- interface CellRange$1 {
2831
+ interface WorksheetCellRange {
2623
2832
  top: number;
2624
2833
  left: number;
2625
2834
  bottom: number;
@@ -2633,7 +2842,7 @@ interface Hyperlink {
2633
2842
  display?: string | null;
2634
2843
  }
2635
2844
  interface ConditionalFormat {
2636
- sqref: CellRange$1[];
2845
+ sqref: WorksheetCellRange[];
2637
2846
  rules: CfRule[];
2638
2847
  }
2639
2848
  type CfRule = {
@@ -2868,7 +3077,7 @@ interface XlsxTextRunInfo {
2868
3077
  row: number;
2869
3078
  col: number;
2870
3079
  }
2871
- interface RenderViewportOptions {
3080
+ interface XlsxRenderViewportOptions {
2872
3081
  width?: number;
2873
3082
  height?: number;
2874
3083
  dpr?: number;
@@ -2879,8 +3088,6 @@ interface RenderViewportOptions {
2879
3088
  freezeRows?: number;
2880
3089
  freezeCols?: number;
2881
3090
  cellScale?: number;
2882
- loadedImages?: Map<string, CanvasImageSource | null>;
2883
- fetchImage?: (path: string, mimeType: string) => Promise<Blob>;
2884
3091
  onTextRun?: (info: XlsxTextRunInfo) => void;
2885
3092
  selectedRowRange?: {
2886
3093
  start: number;
@@ -2900,12 +3107,9 @@ type ResolvedList = {
2900
3107
  kind: 'formula';
2901
3108
  formula: string;
2902
3109
  };
2903
- interface WireSizeOverrides {
2904
- rows?: Record<number, number | null>;
2905
- cols?: Record<number, number | null>;
2906
- }
2907
- type WireRenderViewportOptions = Omit<RenderViewportOptions, 'onTextRun' | 'loadedImages' | 'fetchImage'> & {
2908
- sizeOverrides?: WireSizeOverrides;
3110
+ type RenderViewportToBitmapOptions = Omit<XlsxRenderViewportOptions, 'onTextRun'> & {
3111
+ width: number;
3112
+ height: number;
2909
3113
  };
2910
3114
  interface LoadOptions extends LoadOptions$3 {
2911
3115
  mode?: 'main' | 'worker';
@@ -2954,16 +3158,97 @@ declare class XlsxWorkbook {
2954
3158
  toMarkdown(): Promise<string>;
2955
3159
  resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
2956
3160
  cellText(ws: Worksheet, cell: Cell): string;
2957
- renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
2958
- renderViewportToBitmap(sheetIndex: number, viewport: ViewportRange, opts: WireRenderViewportOptions & {
2959
- width: number;
2960
- height: number;
2961
- }): Promise<ImageBitmap>;
3161
+ renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: XlsxRenderViewportOptions): Promise<void>;
3162
+ renderViewportToBitmap(sheetIndex: number, viewport: ViewportRange, opts: RenderViewportToBitmapOptions): Promise<ImageBitmap>;
2962
3163
  private withWorksheetArchiveOperation;
2963
3164
  destroy(): void;
2964
3165
  private assertResourceHealthy;
2965
3166
  }
2966
3167
  type CanvasViewerRenderMode = 'main' | 'worker';
3168
+ interface CellAddress {
3169
+ row: number;
3170
+ col: number;
3171
+ }
3172
+ type XlsxSelectionArea = Readonly<{
3173
+ kind: 'cells';
3174
+ top: number;
3175
+ left: number;
3176
+ bottom: number;
3177
+ right: number;
3178
+ }> | Readonly<{
3179
+ kind: 'rows';
3180
+ firstRow: number;
3181
+ lastRow: number;
3182
+ }> | Readonly<{
3183
+ kind: 'columns';
3184
+ firstColumn: number;
3185
+ lastColumn: number;
3186
+ }> | Readonly<{
3187
+ kind: 'sheet';
3188
+ }>;
3189
+ interface XlsxSelectionState {
3190
+ readonly areas: readonly XlsxSelectionArea[];
3191
+ readonly activeAreaIndex: number;
3192
+ readonly activeCell: CellAddress;
3193
+ readonly extensionAnchor: CellAddress;
3194
+ }
3195
+ type XlsxSelectionInput = string | XlsxSelectionState | null;
3196
+ interface XlsxSelectionContextOptions {
3197
+ readonly maxCells?: number;
3198
+ readonly maxTextCharacters?: number;
3199
+ }
3200
+ interface XlsxSelectionContextCell {
3201
+ readonly address: CellAddress;
3202
+ readonly displayText: string;
3203
+ readonly valueType: 'empty' | 'text' | 'number' | 'bool' | 'error' | 'shared';
3204
+ readonly value: string | number | boolean | null;
3205
+ readonly formula?: string;
3206
+ }
3207
+ interface XlsxRangeSelectionContext {
3208
+ readonly format: 'xlsx';
3209
+ readonly kind: 'range';
3210
+ readonly sheetIndex: number;
3211
+ readonly sheetName: string;
3212
+ readonly selection: XlsxSelectionState;
3213
+ readonly coordinateCountUpperBound: number;
3214
+ readonly cells: readonly XlsxSelectionContextCell[];
3215
+ readonly truncated: boolean;
3216
+ readonly truncationReasons: readonly ('cells' | 'text')[];
3217
+ readonly maxCells: number;
3218
+ readonly textCharacters: number;
3219
+ readonly maxTextCharacters: number;
3220
+ }
3221
+ interface XlsxElementAnchorMarker {
3222
+ readonly row: number;
3223
+ readonly col: number;
3224
+ readonly offsetX: number;
3225
+ readonly offsetY: number;
3226
+ }
3227
+ interface XlsxElementContext {
3228
+ readonly format: 'xlsx';
3229
+ readonly kind: 'element';
3230
+ readonly sheetIndex: number;
3231
+ readonly sheetName: string;
3232
+ readonly elementType: 'chart' | 'image' | 'shape';
3233
+ readonly elementIndex: number;
3234
+ readonly shapeIndex?: number;
3235
+ readonly anchor: Readonly<{
3236
+ from: XlsxElementAnchorMarker;
3237
+ to: XlsxElementAnchorMarker;
3238
+ }>;
3239
+ readonly text?: string;
3240
+ readonly mimeType?: string;
3241
+ readonly seriesCount?: number;
3242
+ readonly shapeCount?: number;
3243
+ readonly truncated: boolean;
3244
+ readonly truncationReasons: readonly ('text')[];
3245
+ readonly textCharacters: number;
3246
+ readonly maxTextCharacters: number;
3247
+ }
3248
+ type XlsxSelectionContext = XlsxRangeSelectionContext | XlsxElementContext;
3249
+ declare const MAX_SELECTION_AREAS = 128;
3250
+ declare const MAX_SELECTION_CONTEXT_CELLS = 10000;
3251
+ declare const MAX_SELECTION_CONTEXT_TEXT_CHARACTERS: number;
2967
3252
  interface XlsxMatchLocation {
2968
3253
  sheet: number;
2969
3254
  sheetName: string;
@@ -2972,21 +3257,24 @@ interface XlsxMatchLocation {
2972
3257
  col: number;
2973
3258
  }
2974
3259
  type HiddenSheetMode = 'show' | 'skip' | 'dim';
2975
- interface XlsxSheetViewerOptions extends LoadOptions$3 {
3260
+ interface XlsxSheetViewerOptions extends LoadOptions {
2976
3261
  cellScale?: number;
2977
3262
  resizable?: boolean;
3263
+ showScrollbars?: boolean;
2978
3264
  zoomMin?: number;
2979
3265
  zoomMax?: number;
2980
3266
  onScaleChange?: (scale: number) => void;
2981
3267
  onReady?: (sheetNames: string[]) => void;
2982
3268
  onSheetChange?: (index: number, total: number) => void;
2983
3269
  onError?: (err: Error) => void;
2984
- onSelectionChange?: (selection: CellRange | null) => void;
3270
+ onSelectionStateChange?: (selection: XlsxSelectionState | null) => void;
3271
+ onSelectionContextChange?: (context: XlsxSelectionContext | null) => void;
3272
+ onContextMenu?: (event: ViewerContextMenuEvent<XlsxSelectionContext>) => void;
3273
+ enableElementSelection?: boolean;
2985
3274
  onHyperlinkClick?: (target: HyperlinkTarget) => void;
2986
3275
  enableHyperlinks?: boolean;
2987
3276
  selectionColor?: string;
2988
3277
  findHighlightColors?: FindHighlightColors;
2989
- mode?: 'main' | 'worker';
2990
3278
  hiddenSheetMode?: HiddenSheetMode;
2991
3279
  onViewportChange?: (offset: XlsxViewportOffset) => void;
2992
3280
  }
@@ -3000,16 +3288,22 @@ interface XlsxViewportOffset {
3000
3288
  interface XlsxScrollToCellOptions {
3001
3289
  readonly align?: 'nearest' | 'start' | 'center' | 'end';
3002
3290
  }
3003
- interface CellAddress {
3004
- row: number;
3005
- col: number;
3006
- }
3007
- type SelectionMode = 'cells' | 'rows' | 'cols' | 'all';
3008
- interface CellRange {
3009
- anchor: CellAddress;
3010
- active: CellAddress;
3011
- mode: SelectionMode;
3012
- }
3291
+ type XlsxCopyResult = Readonly<{
3292
+ status: 'copied';
3293
+ cellCount: number;
3294
+ utf16CodeUnits: number;
3295
+ }> | Readonly<{
3296
+ status: 'empty-selection';
3297
+ }> | Readonly<{
3298
+ status: 'unsupported-multiple-areas';
3299
+ }> | Readonly<{
3300
+ status: 'too-large';
3301
+ limit: 'cells' | 'text';
3302
+ }> | Readonly<{
3303
+ status: 'clipboard-unavailable';
3304
+ }> | Readonly<{
3305
+ status: 'clipboard-denied';
3306
+ }>;
3013
3307
  type XlsxViewerMount = {
3014
3308
  readonly kind: 'composite';
3015
3309
  } | {
@@ -3061,6 +3355,7 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3061
3355
  private sheetViews;
3062
3356
  private opts;
3063
3357
  private readonly _mountKind;
3358
+ private readonly _nativeScrollbars;
3064
3359
  private readonly _mode;
3065
3360
  private _borrowed;
3066
3361
  private preparedWorkbook;
@@ -3068,22 +3363,34 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3068
3363
  private resizeObserver;
3069
3364
  private _lastViewportNotification;
3070
3365
  private get anchorCell();
3071
- private set anchorCell(value);
3072
3366
  private get activeCell();
3073
- private set activeCell(value);
3074
3367
  private get selectionMode();
3075
- private set selectionMode(value);
3076
3368
  private get isSelecting();
3077
- private set isSelecting(value);
3369
+ private get selectionPointerId();
3370
+ private beginSelectionDrag;
3078
3371
  private _pendingZoomAnchor;
3079
3372
  private readonly selectionController;
3373
+ private lastNotifiedSelectionState;
3374
+ private emittingSelectionChange;
3375
+ private pendingSelectionChange;
3376
+ private selectionNotificationScheduled;
3377
+ private selectionNotificationCount;
3378
+ private selectionContextNotificationFrame;
3379
+ private selectionContextNotificationMicrotask;
3380
+ private readonly selectionContextRows;
3381
+ private readonly selectionContextCells;
3382
+ private elementContext;
3080
3383
  private selectionOverlay;
3081
3384
  private findOverlay;
3082
3385
  private _find;
3083
3386
  private keydownHandler;
3084
3387
  private pendingTap;
3085
3388
  private pendingClick;
3389
+ private pendingElementClick;
3086
3390
  private resizeDrag;
3391
+ private selectionAutoScrollPointer;
3392
+ private selectionAutoScrollFrame;
3393
+ private selectionAutoScrollLastTime;
3087
3394
  private commentPopup;
3088
3395
  private commentMap;
3089
3396
  private hyperlinkMap;
@@ -3104,7 +3411,7 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3104
3411
  private get workbook();
3105
3412
  private get wb();
3106
3413
  private set wb(value);
3107
- showSheet(index: number): Promise<void>;
3414
+ private showSheet;
3108
3415
  private isCurrentSheetRequest;
3109
3416
  private buildOutline;
3110
3417
  private layoutGutters;
@@ -3147,9 +3454,18 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3147
3454
  private _stepSheet;
3148
3455
  private _initialSheet;
3149
3456
  getCellAt(clientX: number, clientY: number): CellAddress | null;
3457
+ private elementContextViewport;
3458
+ private elementContextAt;
3150
3459
  private getCellRect;
3151
- get selection(): CellRange | null;
3152
- select(ref: string): void;
3460
+ get selectionState(): XlsxSelectionState | null;
3461
+ setSelection(input: XlsxSelectionInput): void;
3462
+ getSelectionContext(options?: XlsxSelectionContextOptions): XlsxSelectionContext | null;
3463
+ private commitSelection;
3464
+ private setElementContext;
3465
+ private scheduleSelectionContextNotification;
3466
+ private emitSelectionChange;
3467
+ private scheduleSelectionNotification;
3468
+ private finishSelectionNotificationChain;
3153
3469
  private getHeaderHit;
3154
3470
  private getResizeTarget;
3155
3471
  private applyResize;
@@ -3157,8 +3473,9 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3157
3473
  setHiddenSheetMode(mode: HiddenSheetMode): Promise<void>;
3158
3474
  get hiddenSheetMode(): HiddenSheetMode;
3159
3475
  get visibleSheetCount(): number;
3160
- private copySelection;
3476
+ copySelection(): Promise<XlsxCopyResult>;
3161
3477
  private updateSelectionOverlay;
3478
+ private drawElementContextOverlay;
3162
3479
  private maybeDrawValidationDropdown;
3163
3480
  private updateFindOverlay;
3164
3481
  findText(query: string, opts?: FindMatchesOptions): Promise<FindMatch<XlsxMatchLocation>[]>;
@@ -3183,6 +3500,14 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3183
3500
  private renderCommentPopup;
3184
3501
  private hideCommentPopup;
3185
3502
  private applyPointerSelection;
3503
+ private viewportInputBounds;
3504
+ private extendDragSelection;
3505
+ private selectionAutoScrollSpeed;
3506
+ private trackSelectionAutoScroll;
3507
+ private runSelectionAutoScroll;
3508
+ private stopSelectionAutoScroll;
3509
+ private contextMenuTargetIsSelected;
3510
+ private resolveContextMenuContext;
3186
3511
  private setupSelectionEvents;
3187
3512
  private buildTabs;
3188
3513
  private makeNavButton;
@@ -3217,7 +3542,7 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3217
3542
  private destroyedError;
3218
3543
  }
3219
3544
  declare class XlsxViewer extends XlsxViewerEngine {
3220
- static fromWorkbook(container: HTMLElement, workbook: XlsxWorkbook, opts?: Omit<XlsxViewerOptions, keyof LoadOptions$3>): Omit<XlsxViewer, 'load'>;
3545
+ static fromWorkbook(container: HTMLElement, workbook: XlsxWorkbook, opts?: Omit<XlsxViewerOptions, keyof LoadOptions>): Omit<XlsxViewer, 'load'>;
3221
3546
  constructor(container: HTMLElement, opts?: XlsxViewerOptions);
3222
3547
  }
3223
3548
  declare class XlsxSheetViewer implements ZoomableViewer {
@@ -3227,7 +3552,7 @@ declare class XlsxSheetViewer implements ZoomableViewer {
3227
3552
  private destroyed;
3228
3553
  private snapshot;
3229
3554
  private lastMetrics;
3230
- static fromWorkbook(canvasElement: HTMLCanvasElement, workbook: XlsxWorkbook, options?: Omit<XlsxSheetViewerOptions, keyof LoadOptions$3>): Omit<XlsxSheetViewer, 'load'>;
3555
+ static fromWorkbook(canvasElement: HTMLCanvasElement, workbook: XlsxWorkbook, options?: Omit<XlsxSheetViewerOptions, keyof LoadOptions>): Omit<XlsxSheetViewer, 'load'>;
3231
3556
  constructor(canvasElement: HTMLCanvasElement, options?: XlsxSheetViewerOptions);
3232
3557
  load(source: string | ArrayBuffer): Promise<void>;
3233
3558
  get sheetIndex(): number;
@@ -3247,8 +3572,10 @@ declare class XlsxSheetViewer implements ZoomableViewer {
3247
3572
  fitWidth(): void;
3248
3573
  fitPage(): void;
3249
3574
  getCellAt(clientX: number, clientY: number): CellAddress | null;
3250
- get selection(): CellRange | null;
3251
- select(ref: string): void;
3575
+ get selectionState(): XlsxSelectionState | null;
3576
+ setSelection(selection: XlsxSelectionInput): void;
3577
+ getSelectionContext(options?: XlsxSelectionContextOptions): XlsxSelectionContext | null;
3578
+ copySelection(): Promise<XlsxCopyResult>;
3252
3579
  setSelectionColor(color: string): void;
3253
3580
  setHiddenSheetMode(mode: HiddenSheetMode): Promise<void>;
3254
3581
  get hiddenSheetMode(): HiddenSheetMode;
@@ -3265,7 +3592,7 @@ declare class XlsxSheetViewer implements ZoomableViewer {
3265
3592
  }
3266
3593
  declare function resolveSharedStrings(ws: Worksheet, sharedStrings: SharedString[]): Worksheet;
3267
3594
  declare namespace xlsx_d_exports {
3268
- export { AutoResizeOptions, Border, BorderEdge, Cell, CellAddress, CellFill, CellFont, CellRange, CellValue, CellXf, CfIcon, CfRule, CfStop, CfValue, ChartAnchor, ChartDataLabelOverride, ChartDataPointOverride, ChartErrBars, ChartManualLayout, ChartModel, ChartSeries, ChartSeriesDataLabels, ConditionalFormat, DataLabelOverride, DataPointOverride, DataValidation, DefinedName, Duotone, Dxf, ErrBars, FindHighlightColors, FindMatch, FindMatchesOptions, GradientFillSpec, HiddenSheetMode, Hyperlink, HyperlinkTarget, ImageAnchor, LegendManualLayout, LoadOptions, ManualLayout, MergeCell, NumFmt, OoxmlDecodedImageLimitError, OoxmlDecodedImageLimitMetric, OoxmlError, OoxmlErrorCode, OoxmlErrorSource, OoxmlErrorStage, OoxmlFormat, OoxmlResourceLimit, OoxmlResourceLimitError, OoxmlResourceLimitErrorDetails, OoxmlResourceLimits, OoxmlResourceMetric, OoxmlResourceMetrics, OoxmlResourceMetricsCheckpoint, OoxmlResourceName, OoxmlResourcePolicySnapshot, OoxmlResourceUsageSnapshot, OoxmlResourceViolation, OutlinePr, ParsedWorkbook, PathCmd, PathInfo, PhoneticAlignment, PhoneticProperties, PhoneticRun, PhoneticType, PivotCacheSource, PivotDataField, PivotDiagnostic, PivotLocation, PivotMetadataStatus, PivotPageField, PivotPartialReason, PivotTableMetadata, RenderViewportOptions, ResolvedList, Row, Run, RunFont, SelectionMode, SeriesDataLabels, ShapeAnchor, ShapeGeom, ShapeInfo, ShapeParagraph, ShapeText, ShapeTextRun, SharedString, SheetMeta, SheetVisibility, SlicerAnchor, SlicerElementStyle, SlicerItem, SlicerStyle, Sparkline, SparklineGroup, Styles, TableColumnInfo, TableInfo, ViewportRange, WireRenderViewportOptions, WireSizeOverrides, Workbook, Worksheet, XlsxChartSeries, XlsxComment, XlsxMatchLocation, XlsxScrollToCellOptions, XlsxSheetViewer, XlsxSheetViewerOptions, XlsxTextRunInfo, XlsxViewer, XlsxViewerOptions, XlsxViewportOffset, XlsxWorkbook, autoResize, isOoxmlDecodedImageLimitError, openExternalHyperlink, resolveSharedStrings };
3595
+ export { AutoResizeOptions, Border, BorderEdge, Cell, CellAddress, CellFill, CellFont, CellValue, CellXf, CfIcon, CfRule, CfStop, CfValue, ChartAnchor, ChartDataLabelOverride, ChartDataPointOverride, ChartErrBars, ChartLabelBox, ChartManualLayout, ChartModel, ChartRect, ChartSeries, ChartSeriesDataLabels, ChartTrendline, ChartType, ChartexBoxSeries, ChartexBoxWhisker, ChartexSunburst, ChartexSunburstRow, ConditionalFormat, DataValidation, DefinedName, Duotone, Dxf, FindHighlightColors, FindMatch, FindMatchesOptions, GradientFillSpec, HiddenSheetMode, Hyperlink, HyperlinkTarget, ImageAnchor, LegendManualLayout, LoadOptions, MAX_SELECTION_AREAS, MAX_SELECTION_CONTEXT_CELLS, MAX_SELECTION_CONTEXT_TEXT_CHARACTERS, MathAccent, MathArray, MathBar, MathBorderBox, MathBox, MathDelimiter, MathFraction, MathFunc, MathGroup, MathGroupChr, MathLimit, MathNary, MathNode, MathPhant, MathRadical, MathRenderer, MathRun, MathSPre, MathScript, MathStyle, MathSvg, MergeCell, NumFmt, OoxmlDecodedImageLimitError, OoxmlDecodedImageLimitMetric, OoxmlError, OoxmlErrorCode, OoxmlErrorStage, OoxmlFormat, OoxmlResourceLimit, OoxmlResourceLimitError, OoxmlResourceLimitErrorDetails, OoxmlResourceLimits, OoxmlResourceMetric, OoxmlResourceMetrics, OoxmlResourceMetricsCheckpoint, OoxmlResourceName, OoxmlResourcePolicySnapshot, OoxmlResourceUsageSnapshot, OoxmlResourceViolation, OutlinePr, ParsedWorkbook, PathCmd, PathInfo, PhoneticAlignment, PhoneticProperties, PhoneticRun, PhoneticType, PivotCacheSource, PivotDataField, PivotDiagnostic, PivotLocation, PivotMetadataStatus, PivotPageField, PivotPartialReason, PivotTableMetadata, RenderViewportToBitmapOptions, ResolvedList, Row, Run, RunFont, SecondaryValueAxis, ShapeAnchor, ShapeGeom, ShapeInfo, ShapeParagraph, ShapeText, ShapeTextRun, SharedString, SheetMeta, SheetVisibility, SlicerAnchor, SlicerElementStyle, SlicerItem, SlicerStyle, SpaceLine, Sparkline, SparklineGroup, Styles, TableColumnInfo, TableInfo, ViewerContextMenuEvent, ViewportRange, Workbook, Worksheet, WorksheetCellRange, XlsxComment, XlsxCopyResult, XlsxElementAnchorMarker, XlsxElementContext, XlsxMatchLocation, XlsxRangeSelectionContext, XlsxRenderViewportOptions, XlsxScrollToCellOptions, XlsxSelectionArea, XlsxSelectionContext, XlsxSelectionContextCell, XlsxSelectionContextOptions, XlsxSelectionInput, XlsxSelectionState, XlsxSheetViewer, XlsxSheetViewerOptions, XlsxTextRunInfo, XlsxViewer, XlsxViewerOptions, XlsxViewportOffset, XlsxWorkbook, ZoomableViewer, autoResize, isOoxmlDecodedImageLimitError, openExternalHyperlink, resolveSharedStrings };
3269
3596
  }
3270
3597
  //#endregion
3271
3598
  export { docx_d_exports as docx, pptx_d_exports as pptx, xlsx_d_exports as xlsx };