@silurus/ooxml 0.76.2 → 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-BOSu_OHa.d.ts
752
+ //#region dist/.types-work/docx-BkK3rbgp.d.ts
740
753
  interface DocxDocumentModel {
741
754
  section: SectionProps;
742
755
  body: BodyElement[];
@@ -1093,7 +1106,7 @@ interface ShapeRun {
1093
1106
  stroke: string | null;
1094
1107
  strokeWidth?: number;
1095
1108
  strokeDash?: string | null;
1096
- strokeCap?: CanvasLineCap | null;
1109
+ strokeCap?: 'butt' | 'round' | 'square' | null;
1097
1110
  headEnd?: LineEnd | null;
1098
1111
  tailEnd?: LineEnd | null;
1099
1112
  rotation?: number;
@@ -1388,24 +1401,12 @@ interface CellBorders {
1388
1401
  insideH: BorderSpec | null;
1389
1402
  insideV: BorderSpec | null;
1390
1403
  }
1391
- interface RenderPageOptions {
1392
- width?: number;
1393
- dpr?: number;
1394
- defaultTextColor?: string;
1395
- onTextRun?: (run: {
1396
- text: string;
1397
- x: number;
1398
- y: number;
1399
- w: number;
1400
- h: number;
1401
- fontSize: number;
1402
- font: string;
1403
- transform?: string;
1404
- }) => void;
1405
- showTrackChanges?: boolean;
1406
- currentDate?: Date | number;
1407
- }
1408
1404
  interface DocxTextRunInfo {
1405
+ source?: Readonly<{
1406
+ story: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textbox';
1407
+ storyInstance: string;
1408
+ path: readonly number[];
1409
+ }>;
1409
1410
  paragraphId?: string;
1410
1411
  text: string;
1411
1412
  x: number;
@@ -1419,12 +1420,74 @@ interface DocxTextRunInfo {
1419
1420
  hyperlink?: HyperlinkTarget;
1420
1421
  eastAsianVert?: boolean;
1421
1422
  }
1422
- 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
+ }
1423
1485
  interface LoadOptions$2 extends LoadOptions$3 {
1424
1486
  math?: MathRenderer;
1425
1487
  mode?: 'main' | 'worker';
1426
1488
  }
1427
- type RenderPageToBitmapOptions = WireRenderPageOptions & {
1489
+ type CollectPageRunsOptions = Pick<RenderPageOptions, 'width' | 'currentDate'>;
1490
+ type RenderPageToBitmapOptions = Omit<RenderPageOptions, 'onTextRun'> & {
1428
1491
  onTextRun?: (run: DocxTextRunInfo) => void;
1429
1492
  };
1430
1493
  declare class DocxDocument {
@@ -1465,14 +1528,18 @@ declare class DocxDocument {
1465
1528
  };
1466
1529
  renderPage(target: HTMLCanvasElement | OffscreenCanvas, pageIndex: number, opts?: RenderPageOptions): Promise<void>;
1467
1530
  renderPageToBitmap(pageIndex: number, opts?: RenderPageToBitmapOptions): Promise<ImageBitmap>;
1468
- 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>;
1469
1533
  }
1470
1534
  interface DocxMatchLocation {
1471
1535
  page: number;
1472
1536
  }
1473
- interface DocxViewerOptions extends RenderPageOptions, LoadOptions$2 {
1537
+ interface DocxViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>, LoadOptions$2 {
1474
1538
  container?: HTMLElement;
1475
1539
  enableTextSelection?: boolean;
1540
+ enableElementSelection?: boolean;
1541
+ onSelectionContextChange?: (context: DocxSelectionContext | null) => void;
1542
+ onContextMenu?: (event: ViewerContextMenuEvent<DocxSelectionContext>) => void;
1476
1543
  findHighlightColors?: FindHighlightColors;
1477
1544
  onPageChange?: (index: number, total: number) => void;
1478
1545
  zoomMin?: number;
@@ -1494,6 +1561,7 @@ declare class DocxViewer implements ZoomableViewer {
1494
1561
  private readonly _canvasMount;
1495
1562
  private _textLayer;
1496
1563
  private _highlightLayer;
1564
+ private _elementLayer;
1497
1565
  private _find;
1498
1566
  private _measureCtx;
1499
1567
  private _opts;
@@ -1501,6 +1569,12 @@ declare class DocxViewer implements ZoomableViewer {
1501
1569
  private readonly _renderDispatcher;
1502
1570
  private readonly _errorRouter;
1503
1571
  private _destroyed;
1572
+ private _selectionChangeListener;
1573
+ private _selectionContextKey;
1574
+ private _elementContext;
1575
+ private _elementHitGeneration;
1576
+ private _elementClickListener;
1577
+ private _contextMenuListener;
1504
1578
  static fromDocument(canvas: HTMLCanvasElement, document: DocxDocument, opts?: Omit<DocxViewerOptions, keyof LoadOptions$2>): Omit<DocxViewer, 'load'>;
1505
1579
  constructor(canvas: HTMLCanvasElement, opts?: DocxViewerOptions);
1506
1580
  load(source: string | ArrayBuffer): Promise<void>;
@@ -1529,6 +1603,14 @@ declare class DocxViewer implements ZoomableViewer {
1529
1603
  private _activateMatch;
1530
1604
  private _redrawHighlights;
1531
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;
1532
1614
  destroy(): void;
1533
1615
  private _render;
1534
1616
  private _reportRenderError;
@@ -1549,6 +1631,9 @@ interface DocxScrollViewerOptions extends Omit<RenderPageOptions, 'onTextRun'>,
1549
1631
  paddingRight?: number;
1550
1632
  overscan?: number;
1551
1633
  enableTextSelection?: boolean;
1634
+ enableElementSelection?: boolean;
1635
+ onSelectionContextChange?: (context: DocxSelectionContext | null) => void;
1636
+ onContextMenu?: (event: ViewerContextMenuEvent<DocxSelectionContext>) => void;
1552
1637
  findHighlightColors?: FindHighlightColors;
1553
1638
  zoomMin?: number;
1554
1639
  zoomMax?: number;
@@ -1581,6 +1666,12 @@ declare class DocxScrollViewer implements ZoomableViewer {
1581
1666
  private _lastRange;
1582
1667
  private _lastTopIndex;
1583
1668
  private _scrollListener;
1669
+ private _selectionChangeListener;
1670
+ private _selectionContextKey;
1671
+ private _elementClickListener;
1672
+ private _contextMenuListener;
1673
+ private _elementContext;
1674
+ private _elementHitGeneration;
1584
1675
  private _destroyed;
1585
1676
  private _measureCtx;
1586
1677
  private readonly _bitmapInFlight;
@@ -1603,6 +1694,7 @@ declare class DocxScrollViewer implements ZoomableViewer {
1603
1694
  private _fitWidthPx;
1604
1695
  private _baseScale;
1605
1696
  relayout(): void;
1697
+ private _relayout;
1606
1698
  private _recomputeHeights;
1607
1699
  private _gap;
1608
1700
  private _overscan;
@@ -1652,9 +1744,18 @@ declare class DocxScrollViewer implements ZoomableViewer {
1652
1744
  private _onResize;
1653
1745
  get topVisiblePage(): number;
1654
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;
1655
1756
  destroy(): void;
1656
1757
  }
1657
- 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;
1658
1759
  interface DocxHighlightMatch {
1659
1760
  slices: MatchRunSlice[];
1660
1761
  active: boolean;
@@ -1662,10 +1763,10 @@ interface DocxHighlightMatch {
1662
1763
  type DocxHighlightColors = FindHighlightColors;
1663
1764
  declare function buildDocxHighlightLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[], matches: DocxHighlightMatch[], cssWidth: number, cssHeight: number, measureForFont: (font: string) => (s: string) => number, colors?: DocxHighlightColors): void;
1664
1765
  declare namespace docx_d_exports {
1665
- 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 };
1666
1767
  }
1667
1768
  //#endregion
1668
- //#region dist/.types-work/pptx-CDgwsXLm.d.ts
1769
+ //#region dist/.types-work/pptx-DcrJjm1-.d.ts
1669
1770
  interface BlipBullet {
1670
1771
  type: 'blip';
1671
1772
  imagePath: string;
@@ -1702,11 +1803,16 @@ interface Slide {
1702
1803
  partName?: string;
1703
1804
  background: Fill | null;
1704
1805
  elements: SlideElement[];
1806
+ elementSources?: SlideElementSource[];
1705
1807
  notes?: string;
1706
1808
  comments?: PptxComment[];
1707
1809
  hidden?: boolean;
1708
1810
  parseError?: string;
1709
1811
  }
1812
+ type SlideElementOrigin = 'master' | 'layout' | 'slide';
1813
+ interface SlideElementSource {
1814
+ origin: SlideElementOrigin;
1815
+ }
1710
1816
  interface DimOptions {
1711
1817
  color: string;
1712
1818
  opacity: number;
@@ -1886,6 +1992,8 @@ interface PictureElement {
1886
1992
  sp3d?: Sp3d;
1887
1993
  }
1888
1994
  interface PptxTextRunInfo {
1995
+ elementIndex?: number;
1996
+ origin?: SlideElementOrigin;
1889
1997
  shapeId?: string;
1890
1998
  text: string;
1891
1999
  inShapeX: number;
@@ -1916,6 +2024,68 @@ interface PresentationHandle {
1916
2024
  pause(mediaPath?: string): void;
1917
2025
  destroy(): void;
1918
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;
1919
2089
  type LoadOptions$1 = LoadOptions$3 & {
1920
2090
  mode?: 'main' | 'worker';
1921
2091
  };
@@ -1931,6 +2101,8 @@ interface RenderSlideOptions {
1931
2101
  onTextRun?: TextRunCallback;
1932
2102
  skipMediaControls?: boolean;
1933
2103
  dim?: DimOptions;
2104
+ }
2105
+ interface PresentSlideOptions extends Omit<RenderSlideOptions, 'skipMediaControls'> {
1934
2106
  onError?: (error: Error) => void;
1935
2107
  }
1936
2108
  declare class PptxPresentation {
@@ -1966,16 +2138,17 @@ declare class PptxPresentation {
1966
2138
  renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slideIndex: number, opts?: RenderSlideOptions): Promise<void>;
1967
2139
  renderSlideToBitmap(slideIndex: number, opts?: RenderSlideToBitmapOptions): Promise<ImageBitmap>;
1968
2140
  collectSlideRuns(slideIndex: number, width?: number): Promise<PptxTextRunInfo[]>;
2141
+ getElementContextAt(slideIndex: number, point: PptxSlidePoint, options?: PptxElementContextOptions): Promise<PptxElementContext | null>;
1969
2142
  getMedia(mediaPath: string): Promise<Blob>;
1970
2143
  private _findMimeTypeForPath;
1971
2144
  getImage(imagePath: string, mimeType: string): Promise<Blob>;
1972
2145
  getResourceMetrics(): Promise<OoxmlResourceMetrics>;
1973
2146
  toMarkdown(): Promise<string>;
1974
- presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: RenderSlideOptions): Promise<PresentationHandle>;
2147
+ presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: PresentSlideOptions): Promise<PresentationHandle>;
1975
2148
  destroy(): void;
1976
2149
  }
1977
2150
  type HiddenSlideMode = 'show' | 'skip' | 'dim';
1978
- interface PptxViewerOptions extends RenderOptions, LoadOptions$1 {
2151
+ interface PptxViewerOptions extends Pick<RenderOptions, 'width' | 'dpr'>, LoadOptions$1 {
1979
2152
  onSlideChange?: (index: number, total: number) => void;
1980
2153
  onError?: (err: Error) => void;
1981
2154
  zoomMin?: number;
@@ -1983,6 +2156,10 @@ interface PptxViewerOptions extends RenderOptions, LoadOptions$1 {
1983
2156
  onScaleChange?: (scale: number) => void;
1984
2157
  enableMediaPlayback?: boolean;
1985
2158
  enableTextSelection?: boolean;
2159
+ enableElementSelection?: boolean;
2160
+ elementHitTolerance?: number;
2161
+ onSelectionContextChange?: (context: PptxSelectionContext | null) => void;
2162
+ onContextMenu?: (event: ViewerContextMenuEvent<PptxSelectionContext>) => void;
1986
2163
  findHighlightColors?: FindHighlightColors;
1987
2164
  hiddenSlideMode?: HiddenSlideMode;
1988
2165
  hiddenSlideDim?: Partial<DimOptions>;
@@ -1996,6 +2173,7 @@ declare class PptxViewer implements ZoomableViewer {
1996
2173
  private _scale;
1997
2174
  private textLayer;
1998
2175
  private highlightLayer;
2176
+ private elementLayer;
1999
2177
  private _find;
2000
2178
  private _measureCtx;
2001
2179
  private readonly presentationOwner;
@@ -2010,6 +2188,13 @@ declare class PptxViewer implements ZoomableViewer {
2010
2188
  private readonly renderDispatcher;
2011
2189
  private readonly errorRouter;
2012
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;
2013
2198
  static fromPresentation(canvas: HTMLCanvasElement, presentation: PptxPresentation, opts?: Omit<PptxViewerOptions, keyof LoadOptions$1>): Omit<PptxViewer, 'load'>;
2014
2199
  constructor(canvas: HTMLCanvasElement, opts?: PptxViewerOptions);
2015
2200
  load(source: string | ArrayBuffer): Promise<void>;
@@ -2053,9 +2238,17 @@ declare class PptxViewer implements ZoomableViewer {
2053
2238
  private _resolveInternalSlideIndex;
2054
2239
  private _reportRenderError;
2055
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;
2056
2249
  destroy(): void;
2057
2250
  }
2058
- interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>, LoadOptions$1 {
2251
+ interface PptxScrollViewerOptions extends Pick<RenderSlideOptions, 'width' | 'dpr'>, LoadOptions$1 {
2059
2252
  width?: number;
2060
2253
  gap?: number;
2061
2254
  paddingTop?: number;
@@ -2064,6 +2257,10 @@ interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>,
2064
2257
  paddingRight?: number;
2065
2258
  overscan?: number;
2066
2259
  enableTextSelection?: boolean;
2260
+ enableElementSelection?: boolean;
2261
+ elementHitTolerance?: number;
2262
+ onSelectionContextChange?: (context: PptxSelectionContext | null) => void;
2263
+ onContextMenu?: (event: ViewerContextMenuEvent<PptxSelectionContext>) => void;
2067
2264
  findHighlightColors?: FindHighlightColors;
2068
2265
  enableMediaPlayback?: boolean;
2069
2266
  mediaOverscan?: number;
@@ -2098,6 +2295,13 @@ declare class PptxScrollViewer implements ZoomableViewer {
2098
2295
  private _lastRange;
2099
2296
  private _lastTopIndex;
2100
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;
2101
2305
  private _destroyed;
2102
2306
  private readonly _slideInFlight;
2103
2307
  private _renderEpoch;
@@ -2120,6 +2324,7 @@ declare class PptxScrollViewer implements ZoomableViewer {
2120
2324
  private _fitWidthPx;
2121
2325
  private _baseScale;
2122
2326
  relayout(): void;
2327
+ private _relayout;
2123
2328
  private _recomputeHeights;
2124
2329
  private _gap;
2125
2330
  private _overscan;
@@ -2176,9 +2381,18 @@ declare class PptxScrollViewer implements ZoomableViewer {
2176
2381
  private _onResize;
2177
2382
  get topVisibleSlide(): number;
2178
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;
2179
2393
  destroy(): void;
2180
2394
  }
2181
- 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;
2182
2396
  interface PptxHighlightMatch {
2183
2397
  slices: MatchRunSlice[];
2184
2398
  active: boolean;
@@ -2186,10 +2400,10 @@ interface PptxHighlightMatch {
2186
2400
  type PptxHighlightColors = FindHighlightColors;
2187
2401
  declare function buildPptxHighlightLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], matches: PptxHighlightMatch[], cssWidth: number, cssHeight: number, measureForFont: (font: string) => (s: string) => number, colors?: PptxHighlightColors): void;
2188
2402
  declare namespace pptx_d_exports {
2189
- 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 };
2190
2404
  }
2191
2405
  //#endregion
2192
- //#region dist/.types-work/xlsx-DrRsBH8s.d.ts
2406
+ //#region dist/.types-work/xlsx-DrlamDaR.d.ts
2193
2407
  interface Workbook {
2194
2408
  sheets: SheetMeta[];
2195
2409
  date1904?: boolean;
@@ -2231,7 +2445,7 @@ interface Worksheet {
2231
2445
  rightToLeft?: boolean;
2232
2446
  outlinePr?: OutlinePr;
2233
2447
  tabColor?: string | null;
2234
- autoFilter?: CellRange$1 | null;
2448
+ autoFilter?: WorksheetCellRange | null;
2235
2449
  hyperlinks?: Hyperlink[];
2236
2450
  commentRefs?: string[];
2237
2451
  comments?: XlsxComment[];
@@ -2262,7 +2476,7 @@ interface PivotTableMetadata {
2262
2476
  status: PivotMetadataStatus;
2263
2477
  extensionUris?: string[];
2264
2478
  }
2265
- interface PivotLocation extends CellRange$1 {
2479
+ interface PivotLocation extends WorksheetCellRange {
2266
2480
  firstHeaderRow: number;
2267
2481
  firstDataRow: number;
2268
2482
  firstDataCol: number;
@@ -2405,7 +2619,7 @@ interface SlicerElementStyle {
2405
2619
  borderColor?: string;
2406
2620
  }
2407
2621
  interface TableInfo {
2408
- range: CellRange$1;
2622
+ range: WorksheetCellRange;
2409
2623
  styleName: string;
2410
2624
  headerRowCount: number;
2411
2625
  totalsRowCount: number;
@@ -2450,12 +2664,6 @@ interface DataValidation {
2450
2664
  errorTitle?: string;
2451
2665
  errorMessage?: string;
2452
2666
  }
2453
- type XlsxChartSeries = ChartSeries;
2454
- type SeriesDataLabels = ChartSeriesDataLabels;
2455
- type DataLabelOverride = ChartDataLabelOverride;
2456
- type DataPointOverride = ChartDataPointOverride;
2457
- type ErrBars = ChartErrBars;
2458
- type ManualLayout = ChartManualLayout;
2459
2667
  interface ChartAnchor {
2460
2668
  fromCol: number;
2461
2669
  fromColOff: number;
@@ -2620,7 +2828,7 @@ interface ImageAnchor {
2620
2828
  alpha?: number;
2621
2829
  duotone?: Duotone;
2622
2830
  }
2623
- interface CellRange$1 {
2831
+ interface WorksheetCellRange {
2624
2832
  top: number;
2625
2833
  left: number;
2626
2834
  bottom: number;
@@ -2634,7 +2842,7 @@ interface Hyperlink {
2634
2842
  display?: string | null;
2635
2843
  }
2636
2844
  interface ConditionalFormat {
2637
- sqref: CellRange$1[];
2845
+ sqref: WorksheetCellRange[];
2638
2846
  rules: CfRule[];
2639
2847
  }
2640
2848
  type CfRule = {
@@ -2869,7 +3077,7 @@ interface XlsxTextRunInfo {
2869
3077
  row: number;
2870
3078
  col: number;
2871
3079
  }
2872
- interface RenderViewportOptions {
3080
+ interface XlsxRenderViewportOptions {
2873
3081
  width?: number;
2874
3082
  height?: number;
2875
3083
  dpr?: number;
@@ -2880,8 +3088,6 @@ interface RenderViewportOptions {
2880
3088
  freezeRows?: number;
2881
3089
  freezeCols?: number;
2882
3090
  cellScale?: number;
2883
- loadedImages?: Map<string, CanvasImageSource | null>;
2884
- fetchImage?: (path: string, mimeType: string) => Promise<Blob>;
2885
3091
  onTextRun?: (info: XlsxTextRunInfo) => void;
2886
3092
  selectedRowRange?: {
2887
3093
  start: number;
@@ -2901,12 +3107,9 @@ type ResolvedList = {
2901
3107
  kind: 'formula';
2902
3108
  formula: string;
2903
3109
  };
2904
- interface WireSizeOverrides {
2905
- rows?: Record<number, number | null>;
2906
- cols?: Record<number, number | null>;
2907
- }
2908
- type WireRenderViewportOptions = Omit<RenderViewportOptions, 'onTextRun' | 'loadedImages' | 'fetchImage'> & {
2909
- sizeOverrides?: WireSizeOverrides;
3110
+ type RenderViewportToBitmapOptions = Omit<XlsxRenderViewportOptions, 'onTextRun'> & {
3111
+ width: number;
3112
+ height: number;
2910
3113
  };
2911
3114
  interface LoadOptions extends LoadOptions$3 {
2912
3115
  mode?: 'main' | 'worker';
@@ -2955,16 +3158,97 @@ declare class XlsxWorkbook {
2955
3158
  toMarkdown(): Promise<string>;
2956
3159
  resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
2957
3160
  cellText(ws: Worksheet, cell: Cell): string;
2958
- renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
2959
- renderViewportToBitmap(sheetIndex: number, viewport: ViewportRange, opts: WireRenderViewportOptions & {
2960
- width: number;
2961
- height: number;
2962
- }): 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>;
2963
3163
  private withWorksheetArchiveOperation;
2964
3164
  destroy(): void;
2965
3165
  private assertResourceHealthy;
2966
3166
  }
2967
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;
2968
3252
  interface XlsxMatchLocation {
2969
3253
  sheet: number;
2970
3254
  sheetName: string;
@@ -2973,7 +3257,7 @@ interface XlsxMatchLocation {
2973
3257
  col: number;
2974
3258
  }
2975
3259
  type HiddenSheetMode = 'show' | 'skip' | 'dim';
2976
- interface XlsxSheetViewerOptions extends LoadOptions$3 {
3260
+ interface XlsxSheetViewerOptions extends LoadOptions {
2977
3261
  cellScale?: number;
2978
3262
  resizable?: boolean;
2979
3263
  showScrollbars?: boolean;
@@ -2983,12 +3267,14 @@ interface XlsxSheetViewerOptions extends LoadOptions$3 {
2983
3267
  onReady?: (sheetNames: string[]) => void;
2984
3268
  onSheetChange?: (index: number, total: number) => void;
2985
3269
  onError?: (err: Error) => void;
2986
- 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;
2987
3274
  onHyperlinkClick?: (target: HyperlinkTarget) => void;
2988
3275
  enableHyperlinks?: boolean;
2989
3276
  selectionColor?: string;
2990
3277
  findHighlightColors?: FindHighlightColors;
2991
- mode?: 'main' | 'worker';
2992
3278
  hiddenSheetMode?: HiddenSheetMode;
2993
3279
  onViewportChange?: (offset: XlsxViewportOffset) => void;
2994
3280
  }
@@ -3002,16 +3288,22 @@ interface XlsxViewportOffset {
3002
3288
  interface XlsxScrollToCellOptions {
3003
3289
  readonly align?: 'nearest' | 'start' | 'center' | 'end';
3004
3290
  }
3005
- interface CellAddress {
3006
- row: number;
3007
- col: number;
3008
- }
3009
- type SelectionMode = 'cells' | 'rows' | 'cols' | 'all';
3010
- interface CellRange {
3011
- anchor: CellAddress;
3012
- active: CellAddress;
3013
- mode: SelectionMode;
3014
- }
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
+ }>;
3015
3307
  type XlsxViewerMount = {
3016
3308
  readonly kind: 'composite';
3017
3309
  } | {
@@ -3071,22 +3363,30 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3071
3363
  private resizeObserver;
3072
3364
  private _lastViewportNotification;
3073
3365
  private get anchorCell();
3074
- private set anchorCell(value);
3075
3366
  private get activeCell();
3076
- private set activeCell(value);
3077
3367
  private get selectionMode();
3078
- private set selectionMode(value);
3079
3368
  private get isSelecting();
3080
3369
  private get selectionPointerId();
3081
3370
  private beginSelectionDrag;
3082
3371
  private _pendingZoomAnchor;
3083
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;
3084
3383
  private selectionOverlay;
3085
3384
  private findOverlay;
3086
3385
  private _find;
3087
3386
  private keydownHandler;
3088
3387
  private pendingTap;
3089
3388
  private pendingClick;
3389
+ private pendingElementClick;
3090
3390
  private resizeDrag;
3091
3391
  private selectionAutoScrollPointer;
3092
3392
  private selectionAutoScrollFrame;
@@ -3111,7 +3411,7 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3111
3411
  private get workbook();
3112
3412
  private get wb();
3113
3413
  private set wb(value);
3114
- showSheet(index: number): Promise<void>;
3414
+ private showSheet;
3115
3415
  private isCurrentSheetRequest;
3116
3416
  private buildOutline;
3117
3417
  private layoutGutters;
@@ -3154,9 +3454,18 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3154
3454
  private _stepSheet;
3155
3455
  private _initialSheet;
3156
3456
  getCellAt(clientX: number, clientY: number): CellAddress | null;
3457
+ private elementContextViewport;
3458
+ private elementContextAt;
3157
3459
  private getCellRect;
3158
- get selection(): CellRange | null;
3159
- 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;
3160
3469
  private getHeaderHit;
3161
3470
  private getResizeTarget;
3162
3471
  private applyResize;
@@ -3164,8 +3473,9 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3164
3473
  setHiddenSheetMode(mode: HiddenSheetMode): Promise<void>;
3165
3474
  get hiddenSheetMode(): HiddenSheetMode;
3166
3475
  get visibleSheetCount(): number;
3167
- private copySelection;
3476
+ copySelection(): Promise<XlsxCopyResult>;
3168
3477
  private updateSelectionOverlay;
3478
+ private drawElementContextOverlay;
3169
3479
  private maybeDrawValidationDropdown;
3170
3480
  private updateFindOverlay;
3171
3481
  findText(query: string, opts?: FindMatchesOptions): Promise<FindMatch<XlsxMatchLocation>[]>;
@@ -3196,6 +3506,8 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3196
3506
  private trackSelectionAutoScroll;
3197
3507
  private runSelectionAutoScroll;
3198
3508
  private stopSelectionAutoScroll;
3509
+ private contextMenuTargetIsSelected;
3510
+ private resolveContextMenuContext;
3199
3511
  private setupSelectionEvents;
3200
3512
  private buildTabs;
3201
3513
  private makeNavButton;
@@ -3230,7 +3542,7 @@ declare class XlsxViewerEngine implements ZoomableViewer {
3230
3542
  private destroyedError;
3231
3543
  }
3232
3544
  declare class XlsxViewer extends XlsxViewerEngine {
3233
- 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'>;
3234
3546
  constructor(container: HTMLElement, opts?: XlsxViewerOptions);
3235
3547
  }
3236
3548
  declare class XlsxSheetViewer implements ZoomableViewer {
@@ -3240,7 +3552,7 @@ declare class XlsxSheetViewer implements ZoomableViewer {
3240
3552
  private destroyed;
3241
3553
  private snapshot;
3242
3554
  private lastMetrics;
3243
- 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'>;
3244
3556
  constructor(canvasElement: HTMLCanvasElement, options?: XlsxSheetViewerOptions);
3245
3557
  load(source: string | ArrayBuffer): Promise<void>;
3246
3558
  get sheetIndex(): number;
@@ -3260,8 +3572,10 @@ declare class XlsxSheetViewer implements ZoomableViewer {
3260
3572
  fitWidth(): void;
3261
3573
  fitPage(): void;
3262
3574
  getCellAt(clientX: number, clientY: number): CellAddress | null;
3263
- get selection(): CellRange | null;
3264
- select(ref: string): void;
3575
+ get selectionState(): XlsxSelectionState | null;
3576
+ setSelection(selection: XlsxSelectionInput): void;
3577
+ getSelectionContext(options?: XlsxSelectionContextOptions): XlsxSelectionContext | null;
3578
+ copySelection(): Promise<XlsxCopyResult>;
3265
3579
  setSelectionColor(color: string): void;
3266
3580
  setHiddenSheetMode(mode: HiddenSheetMode): Promise<void>;
3267
3581
  get hiddenSheetMode(): HiddenSheetMode;
@@ -3278,7 +3592,7 @@ declare class XlsxSheetViewer implements ZoomableViewer {
3278
3592
  }
3279
3593
  declare function resolveSharedStrings(ws: Worksheet, sharedStrings: SharedString[]): Worksheet;
3280
3594
  declare namespace xlsx_d_exports {
3281
- 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 };
3282
3596
  }
3283
3597
  //#endregion
3284
3598
  export { docx_d_exports as docx, pptx_d_exports as pptx, xlsx_d_exports as xlsx };