@silurus/ooxml 0.12.0 → 0.14.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.
- package/README.md +13 -0
- package/dist/{docx-5SgqrF74.cjs → docx-DOf7BLnj.cjs} +1 -1
- package/dist/{docx-BdQTKYcj.js → docx-Q9meJO2G.js} +51 -26
- package/dist/docx.cjs +1 -1
- package/dist/docx.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/pptx-BMJO4Oqg.cjs +1 -0
- package/dist/{pptx-VEtxsakL.js → pptx-DVyrqUyw.js} +152 -88
- package/dist/pptx.cjs +1 -1
- package/dist/pptx.mjs +1 -1
- package/dist/types/docx.d.ts +35 -3
- package/dist/types/index.d.ts +140 -6
- package/dist/types/pptx.d.ts +43 -1
- package/dist/types/xlsx.d.ts +58 -4
- package/dist/{xlsx-eilavpD_.cjs → xlsx-59JnO368.cjs} +3 -2
- package/dist/{xlsx-BWBXfR7z.js → xlsx-DHjDLAqt.js} +297 -7
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.mjs +1 -1
- package/package.json +1 -1
- package/dist/pptx-f3apnG_M.cjs +0 -1
package/dist/pptx.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./autoResize-ggn4hzd8.cjs`),t=require(`./pptx-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./autoResize-ggn4hzd8.cjs`),t=require(`./pptx-BMJO4Oqg.cjs`);exports.PptxPresentation=t.r,exports.PptxViewer=t.n,exports.autoResize=e.t,exports.renderSlide=t.i;
|
package/dist/pptx.mjs
CHANGED
package/dist/types/docx.d.ts
CHANGED
|
@@ -141,23 +141,46 @@ export declare class DocxDocument {
|
|
|
141
141
|
renderPage(target: HTMLCanvasElement | OffscreenCanvas, pageIndex: number, opts?: RenderPageOptions): Promise<void>;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/** Information about a rendered text segment for building a transparent selection overlay. */
|
|
145
|
+
export declare interface DocxTextRunInfo {
|
|
146
|
+
text: string;
|
|
147
|
+
/** Left edge in canvas CSS px. */
|
|
148
|
+
x: number;
|
|
149
|
+
/** Top of line box in canvas CSS px. */
|
|
150
|
+
y: number;
|
|
151
|
+
/** Measured text width in CSS px. */
|
|
152
|
+
w: number;
|
|
153
|
+
/** Line height in CSS px. */
|
|
154
|
+
h: number;
|
|
155
|
+
/** Font size in CSS px. */
|
|
156
|
+
fontSize: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
144
159
|
export declare class DocxViewer {
|
|
145
160
|
private _doc;
|
|
146
161
|
private _currentPage;
|
|
147
162
|
private _canvas;
|
|
163
|
+
private _wrapper;
|
|
164
|
+
private _textLayer;
|
|
148
165
|
private _opts;
|
|
149
166
|
constructor(canvas: HTMLCanvasElement, opts?: DocxViewerOptions);
|
|
150
167
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
151
168
|
get pageCount(): number;
|
|
152
169
|
get currentPage(): number;
|
|
153
|
-
goToPage(index: number): void
|
|
154
|
-
nextPage(): void
|
|
155
|
-
prevPage(): void
|
|
170
|
+
goToPage(index: number): Promise<void>;
|
|
171
|
+
nextPage(): Promise<void>;
|
|
172
|
+
prevPage(): Promise<void>;
|
|
156
173
|
private _render;
|
|
174
|
+
private _buildTextLayer;
|
|
157
175
|
}
|
|
158
176
|
|
|
159
177
|
declare interface DocxViewerOptions extends RenderPageOptions {
|
|
160
178
|
container?: HTMLElement;
|
|
179
|
+
/**
|
|
180
|
+
* When true, adds a transparent text overlay div over the canvas so the
|
|
181
|
+
* browser's native text selection works on document content.
|
|
182
|
+
*/
|
|
183
|
+
enableTextSelection?: boolean;
|
|
161
184
|
}
|
|
162
185
|
|
|
163
186
|
declare interface FieldRun {
|
|
@@ -308,6 +331,15 @@ export declare interface RenderPageOptions {
|
|
|
308
331
|
width?: number;
|
|
309
332
|
dpr?: number;
|
|
310
333
|
defaultTextColor?: string;
|
|
334
|
+
/** Called for each rendered text segment. Used to build a transparent text selection overlay. */
|
|
335
|
+
onTextRun?: (run: {
|
|
336
|
+
text: string;
|
|
337
|
+
x: number;
|
|
338
|
+
y: number;
|
|
339
|
+
w: number;
|
|
340
|
+
h: number;
|
|
341
|
+
fontSize: number;
|
|
342
|
+
}) => void;
|
|
311
343
|
}
|
|
312
344
|
|
|
313
345
|
export declare interface SectionProps {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -95,6 +95,11 @@ declare interface Cell {
|
|
|
95
95
|
formula?: string;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
declare interface CellAddress {
|
|
99
|
+
row: number;
|
|
100
|
+
col: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
98
103
|
declare interface CellBorders {
|
|
99
104
|
top: BorderSpec | null;
|
|
100
105
|
bottom: BorderSpec | null;
|
|
@@ -109,6 +114,12 @@ declare interface CellRange {
|
|
|
109
114
|
right: number;
|
|
110
115
|
}
|
|
111
116
|
|
|
117
|
+
declare interface CellRange_2 {
|
|
118
|
+
anchor: CellAddress;
|
|
119
|
+
active: CellAddress;
|
|
120
|
+
mode: SelectionMode_2;
|
|
121
|
+
}
|
|
122
|
+
|
|
112
123
|
declare type CellValue = {
|
|
113
124
|
type: 'empty';
|
|
114
125
|
} | {
|
|
@@ -471,7 +482,8 @@ export declare namespace docx {
|
|
|
471
482
|
DocRun,
|
|
472
483
|
TextRun_2 as TextRun,
|
|
473
484
|
ImageRun,
|
|
474
|
-
RenderPageOptions
|
|
485
|
+
RenderPageOptions,
|
|
486
|
+
DocxTextRunInfo
|
|
475
487
|
}
|
|
476
488
|
}
|
|
477
489
|
|
|
@@ -489,23 +501,46 @@ declare class DocxDocument {
|
|
|
489
501
|
renderPage(target: HTMLCanvasElement | OffscreenCanvas, pageIndex: number, opts?: RenderPageOptions): Promise<void>;
|
|
490
502
|
}
|
|
491
503
|
|
|
504
|
+
/** Information about a rendered text segment for building a transparent selection overlay. */
|
|
505
|
+
declare interface DocxTextRunInfo {
|
|
506
|
+
text: string;
|
|
507
|
+
/** Left edge in canvas CSS px. */
|
|
508
|
+
x: number;
|
|
509
|
+
/** Top of line box in canvas CSS px. */
|
|
510
|
+
y: number;
|
|
511
|
+
/** Measured text width in CSS px. */
|
|
512
|
+
w: number;
|
|
513
|
+
/** Line height in CSS px. */
|
|
514
|
+
h: number;
|
|
515
|
+
/** Font size in CSS px. */
|
|
516
|
+
fontSize: number;
|
|
517
|
+
}
|
|
518
|
+
|
|
492
519
|
declare class DocxViewer {
|
|
493
520
|
private _doc;
|
|
494
521
|
private _currentPage;
|
|
495
522
|
private _canvas;
|
|
523
|
+
private _wrapper;
|
|
524
|
+
private _textLayer;
|
|
496
525
|
private _opts;
|
|
497
526
|
constructor(canvas: HTMLCanvasElement, opts?: DocxViewerOptions);
|
|
498
527
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
499
528
|
get pageCount(): number;
|
|
500
529
|
get currentPage(): number;
|
|
501
|
-
goToPage(index: number): void
|
|
502
|
-
nextPage(): void
|
|
503
|
-
prevPage(): void
|
|
530
|
+
goToPage(index: number): Promise<void>;
|
|
531
|
+
nextPage(): Promise<void>;
|
|
532
|
+
prevPage(): Promise<void>;
|
|
504
533
|
private _render;
|
|
534
|
+
private _buildTextLayer;
|
|
505
535
|
}
|
|
506
536
|
|
|
507
537
|
declare interface DocxViewerOptions extends RenderPageOptions {
|
|
508
538
|
container?: HTMLElement;
|
|
539
|
+
/**
|
|
540
|
+
* When true, adds a transparent text overlay div over the canvas so the
|
|
541
|
+
* browser's native text selection works on document content.
|
|
542
|
+
*/
|
|
543
|
+
enableTextSelection?: boolean;
|
|
509
544
|
}
|
|
510
545
|
|
|
511
546
|
declare interface Dxf {
|
|
@@ -930,6 +965,8 @@ export declare namespace pptx {
|
|
|
930
965
|
RenderSlideOptions,
|
|
931
966
|
renderSlide,
|
|
932
967
|
RenderOptions,
|
|
968
|
+
TextRunInfo,
|
|
969
|
+
TextRunCallback,
|
|
933
970
|
autoResize,
|
|
934
971
|
AutoResizeOptions,
|
|
935
972
|
Presentation,
|
|
@@ -1013,6 +1050,8 @@ declare class PptxPresentation {
|
|
|
1013
1050
|
*/
|
|
1014
1051
|
declare class PptxViewer {
|
|
1015
1052
|
private readonly canvas;
|
|
1053
|
+
private readonly wrapper;
|
|
1054
|
+
private textLayer;
|
|
1016
1055
|
private engine;
|
|
1017
1056
|
private readonly opts;
|
|
1018
1057
|
private currentSlide;
|
|
@@ -1029,6 +1068,7 @@ declare class PptxViewer {
|
|
|
1029
1068
|
/** The underlying <canvas> element. */
|
|
1030
1069
|
get canvasElement(): HTMLCanvasElement;
|
|
1031
1070
|
private renderCurrentSlide;
|
|
1071
|
+
private _buildTextLayer;
|
|
1032
1072
|
/** Clean up the viewer and terminate the background worker. */
|
|
1033
1073
|
destroy(): void;
|
|
1034
1074
|
}
|
|
@@ -1051,6 +1091,11 @@ declare interface PptxViewerOptions extends RenderOptions {
|
|
|
1051
1091
|
* badge over media posters.
|
|
1052
1092
|
*/
|
|
1053
1093
|
enableMediaPlayback?: boolean;
|
|
1094
|
+
/**
|
|
1095
|
+
* When true, adds a transparent text overlay div over the canvas so the
|
|
1096
|
+
* browser's native text selection works on slide content.
|
|
1097
|
+
*/
|
|
1098
|
+
enableTextSelection?: boolean;
|
|
1054
1099
|
}
|
|
1055
1100
|
|
|
1056
1101
|
declare interface Presentation {
|
|
@@ -1097,13 +1142,22 @@ declare interface RenderPageOptions {
|
|
|
1097
1142
|
width?: number;
|
|
1098
1143
|
dpr?: number;
|
|
1099
1144
|
defaultTextColor?: string;
|
|
1145
|
+
/** Called for each rendered text segment. Used to build a transparent text selection overlay. */
|
|
1146
|
+
onTextRun?: (run: {
|
|
1147
|
+
text: string;
|
|
1148
|
+
x: number;
|
|
1149
|
+
y: number;
|
|
1150
|
+
w: number;
|
|
1151
|
+
h: number;
|
|
1152
|
+
fontSize: number;
|
|
1153
|
+
}) => void;
|
|
1100
1154
|
}
|
|
1101
1155
|
|
|
1102
1156
|
/**
|
|
1103
1157
|
* Render a single slide onto a <canvas> element.
|
|
1104
1158
|
* Returns the canvas for convenience.
|
|
1105
1159
|
*/
|
|
1106
|
-
declare function renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slide: Slide, slideWidth: number, slideHeight: number, opts?: RenderOptions): Promise<HTMLCanvasElement | OffscreenCanvas>;
|
|
1160
|
+
declare function renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slide: Slide, slideWidth: number, slideHeight: number, opts?: RenderOptions, onTextRun?: TextRunCallback): Promise<HTMLCanvasElement | OffscreenCanvas>;
|
|
1107
1161
|
|
|
1108
1162
|
/** Options for rendering a single slide onto a canvas. */
|
|
1109
1163
|
declare interface RenderSlideOptions {
|
|
@@ -1111,6 +1165,8 @@ declare interface RenderSlideOptions {
|
|
|
1111
1165
|
width?: number;
|
|
1112
1166
|
/** Device pixel ratio. Defaults to window.devicePixelRatio or 1. */
|
|
1113
1167
|
dpr?: number;
|
|
1168
|
+
/** Called for each rendered text segment. Used to build a transparent text selection overlay. */
|
|
1169
|
+
onTextRun?: TextRunCallback;
|
|
1114
1170
|
/**
|
|
1115
1171
|
* Skip drawing the play badge overlay on media elements. Used internally by
|
|
1116
1172
|
* {@link PptxPresentation.presentSlide} so its interactive handle can draw
|
|
@@ -1133,6 +1189,8 @@ declare interface RenderViewportOptions {
|
|
|
1133
1189
|
cellScale?: number;
|
|
1134
1190
|
/** Pre-loaded Image elements keyed by their dataUrl (for ImageAnchor rendering). */
|
|
1135
1191
|
loadedImages?: Map<string, HTMLImageElement>;
|
|
1192
|
+
/** Called once per cell that contains text, with canvas-pixel position and cell address. */
|
|
1193
|
+
onTextRun?: (info: TextRunInfo_2) => void;
|
|
1136
1194
|
}
|
|
1137
1195
|
|
|
1138
1196
|
declare interface Row {
|
|
@@ -1175,6 +1233,8 @@ declare interface SectionProps {
|
|
|
1175
1233
|
docGridLinePitch?: number | null;
|
|
1176
1234
|
}
|
|
1177
1235
|
|
|
1236
|
+
declare type SelectionMode_2 = 'cells' | 'rows' | 'cols' | 'all';
|
|
1237
|
+
|
|
1178
1238
|
declare interface Shadow {
|
|
1179
1239
|
color: string;
|
|
1180
1240
|
alpha: number;
|
|
@@ -1497,6 +1557,8 @@ declare interface TextRun_2 {
|
|
|
1497
1557
|
highlight?: string | null;
|
|
1498
1558
|
}
|
|
1499
1559
|
|
|
1560
|
+
declare type TextRunCallback = (run: TextRunInfo) => void;
|
|
1561
|
+
|
|
1500
1562
|
declare interface TextRunData {
|
|
1501
1563
|
type: 'text';
|
|
1502
1564
|
text: string;
|
|
@@ -1517,6 +1579,51 @@ declare interface TextRunData {
|
|
|
1517
1579
|
fieldType?: string;
|
|
1518
1580
|
}
|
|
1519
1581
|
|
|
1582
|
+
/** Information about a rendered text segment for building a transparent selection overlay. */
|
|
1583
|
+
declare interface TextRunInfo {
|
|
1584
|
+
text: string;
|
|
1585
|
+
/** X position in CSS px, relative to the shape's top-left corner. */
|
|
1586
|
+
inShapeX: number;
|
|
1587
|
+
/** Y position (top of line box) in CSS px, relative to the shape's top-left corner. */
|
|
1588
|
+
inShapeY: number;
|
|
1589
|
+
/** Measured text width in CSS px. */
|
|
1590
|
+
w: number;
|
|
1591
|
+
/** Line height in CSS px. */
|
|
1592
|
+
h: number;
|
|
1593
|
+
/** Font size in CSS px. */
|
|
1594
|
+
fontSize: number;
|
|
1595
|
+
/** Shape's left edge in canvas CSS px. */
|
|
1596
|
+
shapeX: number;
|
|
1597
|
+
/** Shape's top edge in canvas CSS px. */
|
|
1598
|
+
shapeY: number;
|
|
1599
|
+
/** Shape's width in canvas CSS px. */
|
|
1600
|
+
shapeW: number;
|
|
1601
|
+
/** Shape's height in canvas CSS px. */
|
|
1602
|
+
shapeH: number;
|
|
1603
|
+
/** Shape rotation in degrees (clockwise). */
|
|
1604
|
+
rotation: number;
|
|
1605
|
+
/**
|
|
1606
|
+
* Additional rotation from a vertical text body (`vert="vert"` → 90,
|
|
1607
|
+
* `vert="vert270"` → -90). The CSS overlay must add this to `rotation`.
|
|
1608
|
+
*/
|
|
1609
|
+
textBodyRotation?: number;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
/** Emitted once per cell that has text, with the cell's canvas-pixel bounds. */
|
|
1613
|
+
declare interface TextRunInfo_2 {
|
|
1614
|
+
text: string;
|
|
1615
|
+
/** Canvas CSS-pixel x of the cell's top-left corner. */
|
|
1616
|
+
x: number;
|
|
1617
|
+
/** Canvas CSS-pixel y of the cell's top-left corner. */
|
|
1618
|
+
y: number;
|
|
1619
|
+
/** Cell width in canvas CSS pixels. */
|
|
1620
|
+
width: number;
|
|
1621
|
+
/** Cell height in canvas CSS pixels. */
|
|
1622
|
+
height: number;
|
|
1623
|
+
row: number;
|
|
1624
|
+
col: number;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1520
1627
|
declare interface ViewportRange {
|
|
1521
1628
|
row: number;
|
|
1522
1629
|
col: number;
|
|
@@ -1578,6 +1685,9 @@ export declare namespace xlsx {
|
|
|
1578
1685
|
XlsxWorkbook,
|
|
1579
1686
|
XlsxViewer,
|
|
1580
1687
|
XlsxViewerOptions,
|
|
1688
|
+
CellAddress,
|
|
1689
|
+
CellRange_2 as CellRange,
|
|
1690
|
+
SelectionMode_2 as SelectionMode,
|
|
1581
1691
|
autoResize,
|
|
1582
1692
|
AutoResizeOptions,
|
|
1583
1693
|
Workbook,
|
|
@@ -1596,7 +1706,8 @@ export declare namespace xlsx {
|
|
|
1596
1706
|
MergeCell,
|
|
1597
1707
|
ParsedWorkbook,
|
|
1598
1708
|
ViewportRange,
|
|
1599
|
-
RenderViewportOptions
|
|
1709
|
+
RenderViewportOptions,
|
|
1710
|
+
TextRunInfo_2 as TextRunInfo
|
|
1600
1711
|
}
|
|
1601
1712
|
}
|
|
1602
1713
|
|
|
@@ -1634,9 +1745,30 @@ declare class XlsxViewer {
|
|
|
1634
1745
|
private currentWorksheet;
|
|
1635
1746
|
private opts;
|
|
1636
1747
|
private resizeObserver;
|
|
1748
|
+
private anchorCell;
|
|
1749
|
+
private activeCell;
|
|
1750
|
+
private selectionMode;
|
|
1751
|
+
private isSelecting;
|
|
1752
|
+
private selectionOverlay;
|
|
1753
|
+
private keydownHandler;
|
|
1637
1754
|
constructor(container: HTMLElement, opts?: XlsxViewerOptions);
|
|
1638
1755
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
1639
1756
|
showSheet(index: number): Promise<void>;
|
|
1757
|
+
/** Returns the cell at canvas-client coordinates, or null if outside the cell grid. */
|
|
1758
|
+
getCellAt(clientX: number, clientY: number): CellAddress | null;
|
|
1759
|
+
/** Returns the CSS-pixel rect of a cell within canvasArea, or null if not computable. */
|
|
1760
|
+
private getCellRect;
|
|
1761
|
+
/** Returns the current selection, including mode. */
|
|
1762
|
+
get selection(): CellRange_2 | null;
|
|
1763
|
+
/**
|
|
1764
|
+
* Returns what the header area contains at the given client coordinates.
|
|
1765
|
+
* Returns null when the point is in the cell grid (not a header).
|
|
1766
|
+
*/
|
|
1767
|
+
private getHeaderHit;
|
|
1768
|
+
/** Copy the selected cell range as tab-separated text to the clipboard. */
|
|
1769
|
+
private copySelection;
|
|
1770
|
+
private updateSelectionOverlay;
|
|
1771
|
+
private setupSelectionEvents;
|
|
1640
1772
|
private buildTabs;
|
|
1641
1773
|
private updateTabActive;
|
|
1642
1774
|
private tabStyle;
|
|
@@ -1652,6 +1784,8 @@ declare interface XlsxViewerOptions {
|
|
|
1652
1784
|
onReady?: (sheetNames: string[]) => void;
|
|
1653
1785
|
onSheetChange?: (index: number, name: string) => void;
|
|
1654
1786
|
onError?: (err: Error) => void;
|
|
1787
|
+
/** Called when the selected cell range changes. null means no selection. */
|
|
1788
|
+
onSelectionChange?: (selection: CellRange_2 | null) => void;
|
|
1655
1789
|
}
|
|
1656
1790
|
|
|
1657
1791
|
declare class XlsxWorkbook {
|
package/dist/types/pptx.d.ts
CHANGED
|
@@ -329,6 +329,8 @@ export declare class PptxPresentation {
|
|
|
329
329
|
*/
|
|
330
330
|
export declare class PptxViewer {
|
|
331
331
|
private readonly canvas;
|
|
332
|
+
private readonly wrapper;
|
|
333
|
+
private textLayer;
|
|
332
334
|
private engine;
|
|
333
335
|
private readonly opts;
|
|
334
336
|
private currentSlide;
|
|
@@ -345,6 +347,7 @@ export declare class PptxViewer {
|
|
|
345
347
|
/** The underlying <canvas> element. */
|
|
346
348
|
get canvasElement(): HTMLCanvasElement;
|
|
347
349
|
private renderCurrentSlide;
|
|
350
|
+
private _buildTextLayer;
|
|
348
351
|
/** Clean up the viewer and terminate the background worker. */
|
|
349
352
|
destroy(): void;
|
|
350
353
|
}
|
|
@@ -367,6 +370,11 @@ export declare interface PptxViewerOptions extends RenderOptions {
|
|
|
367
370
|
* badge over media posters.
|
|
368
371
|
*/
|
|
369
372
|
enableMediaPlayback?: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* When true, adds a transparent text overlay div over the canvas so the
|
|
375
|
+
* browser's native text selection works on slide content.
|
|
376
|
+
*/
|
|
377
|
+
enableTextSelection?: boolean;
|
|
370
378
|
}
|
|
371
379
|
|
|
372
380
|
export declare interface Presentation {
|
|
@@ -412,7 +420,7 @@ export declare interface RenderOptions {
|
|
|
412
420
|
* Render a single slide onto a <canvas> element.
|
|
413
421
|
* Returns the canvas for convenience.
|
|
414
422
|
*/
|
|
415
|
-
export declare function renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slide: Slide, slideWidth: number, slideHeight: number, opts?: RenderOptions): Promise<HTMLCanvasElement | OffscreenCanvas>;
|
|
423
|
+
export declare function renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slide: Slide, slideWidth: number, slideHeight: number, opts?: RenderOptions, onTextRun?: TextRunCallback): Promise<HTMLCanvasElement | OffscreenCanvas>;
|
|
416
424
|
|
|
417
425
|
/** Options for rendering a single slide onto a canvas. */
|
|
418
426
|
export declare interface RenderSlideOptions {
|
|
@@ -420,6 +428,8 @@ export declare interface RenderSlideOptions {
|
|
|
420
428
|
width?: number;
|
|
421
429
|
/** Device pixel ratio. Defaults to window.devicePixelRatio or 1. */
|
|
422
430
|
dpr?: number;
|
|
431
|
+
/** Called for each rendered text segment. Used to build a transparent text selection overlay. */
|
|
432
|
+
onTextRun?: TextRunCallback;
|
|
423
433
|
/**
|
|
424
434
|
* Skip drawing the play badge overlay on media elements. Used internally by
|
|
425
435
|
* {@link PptxPresentation.presentSlide} so its interactive handle can draw
|
|
@@ -581,6 +591,8 @@ export declare interface TextBody {
|
|
|
581
591
|
|
|
582
592
|
export declare type TextRun = TextRunData | LineBreak;
|
|
583
593
|
|
|
594
|
+
export declare type TextRunCallback = (run: TextRunInfo) => void;
|
|
595
|
+
|
|
584
596
|
export declare interface TextRunData {
|
|
585
597
|
type: 'text';
|
|
586
598
|
text: string;
|
|
@@ -601,4 +613,34 @@ export declare interface TextRunData {
|
|
|
601
613
|
fieldType?: string;
|
|
602
614
|
}
|
|
603
615
|
|
|
616
|
+
/** Information about a rendered text segment for building a transparent selection overlay. */
|
|
617
|
+
export declare interface TextRunInfo {
|
|
618
|
+
text: string;
|
|
619
|
+
/** X position in CSS px, relative to the shape's top-left corner. */
|
|
620
|
+
inShapeX: number;
|
|
621
|
+
/** Y position (top of line box) in CSS px, relative to the shape's top-left corner. */
|
|
622
|
+
inShapeY: number;
|
|
623
|
+
/** Measured text width in CSS px. */
|
|
624
|
+
w: number;
|
|
625
|
+
/** Line height in CSS px. */
|
|
626
|
+
h: number;
|
|
627
|
+
/** Font size in CSS px. */
|
|
628
|
+
fontSize: number;
|
|
629
|
+
/** Shape's left edge in canvas CSS px. */
|
|
630
|
+
shapeX: number;
|
|
631
|
+
/** Shape's top edge in canvas CSS px. */
|
|
632
|
+
shapeY: number;
|
|
633
|
+
/** Shape's width in canvas CSS px. */
|
|
634
|
+
shapeW: number;
|
|
635
|
+
/** Shape's height in canvas CSS px. */
|
|
636
|
+
shapeH: number;
|
|
637
|
+
/** Shape rotation in degrees (clockwise). */
|
|
638
|
+
rotation: number;
|
|
639
|
+
/**
|
|
640
|
+
* Additional rotation from a vertical text body (`vert="vert"` → 90,
|
|
641
|
+
* `vert="vert270"` → -90). The CSS overlay must add this to `rotation`.
|
|
642
|
+
*/
|
|
643
|
+
textBodyRotation?: number;
|
|
644
|
+
}
|
|
645
|
+
|
|
604
646
|
export { }
|
package/dist/types/xlsx.d.ts
CHANGED
|
@@ -56,7 +56,18 @@ export declare interface Cell {
|
|
|
56
56
|
formula?: string;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
declare interface
|
|
59
|
+
export declare interface CellAddress {
|
|
60
|
+
row: number;
|
|
61
|
+
col: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare interface CellRange {
|
|
65
|
+
anchor: CellAddress;
|
|
66
|
+
active: CellAddress;
|
|
67
|
+
mode: SelectionMode_2;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare interface CellRange_2 {
|
|
60
71
|
top: number;
|
|
61
72
|
left: number;
|
|
62
73
|
bottom: number;
|
|
@@ -239,7 +250,7 @@ declare interface ChartData {
|
|
|
239
250
|
}
|
|
240
251
|
|
|
241
252
|
declare interface ConditionalFormat {
|
|
242
|
-
sqref:
|
|
253
|
+
sqref: CellRange_2[];
|
|
243
254
|
rules: CfRule[];
|
|
244
255
|
}
|
|
245
256
|
|
|
@@ -398,6 +409,8 @@ export declare interface RenderViewportOptions {
|
|
|
398
409
|
cellScale?: number;
|
|
399
410
|
/** Pre-loaded Image elements keyed by their dataUrl (for ImageAnchor rendering). */
|
|
400
411
|
loadedImages?: Map<string, HTMLImageElement>;
|
|
412
|
+
/** Called once per cell that contains text, with canvas-pixel position and cell address. */
|
|
413
|
+
onTextRun?: (info: TextRunInfo) => void;
|
|
401
414
|
}
|
|
402
415
|
|
|
403
416
|
export declare interface Row {
|
|
@@ -421,6 +434,9 @@ declare interface RunFont {
|
|
|
421
434
|
name?: string | null;
|
|
422
435
|
}
|
|
423
436
|
|
|
437
|
+
declare type SelectionMode_2 = 'cells' | 'rows' | 'cols' | 'all';
|
|
438
|
+
export { SelectionMode_2 as SelectionMode }
|
|
439
|
+
|
|
424
440
|
declare interface ShapeAnchor {
|
|
425
441
|
fromCol: number;
|
|
426
442
|
fromColOff: number;
|
|
@@ -502,7 +518,7 @@ export declare interface Styles {
|
|
|
502
518
|
}
|
|
503
519
|
|
|
504
520
|
declare interface TableInfo {
|
|
505
|
-
range:
|
|
521
|
+
range: CellRange_2;
|
|
506
522
|
styleName: string;
|
|
507
523
|
headerRowCount: number;
|
|
508
524
|
totalsRowCount: number;
|
|
@@ -522,6 +538,21 @@ declare interface TableInfo {
|
|
|
522
538
|
headerRowDxf?: number;
|
|
523
539
|
}
|
|
524
540
|
|
|
541
|
+
/** Emitted once per cell that has text, with the cell's canvas-pixel bounds. */
|
|
542
|
+
export declare interface TextRunInfo {
|
|
543
|
+
text: string;
|
|
544
|
+
/** Canvas CSS-pixel x of the cell's top-left corner. */
|
|
545
|
+
x: number;
|
|
546
|
+
/** Canvas CSS-pixel y of the cell's top-left corner. */
|
|
547
|
+
y: number;
|
|
548
|
+
/** Cell width in canvas CSS pixels. */
|
|
549
|
+
width: number;
|
|
550
|
+
/** Cell height in canvas CSS pixels. */
|
|
551
|
+
height: number;
|
|
552
|
+
row: number;
|
|
553
|
+
col: number;
|
|
554
|
+
}
|
|
555
|
+
|
|
525
556
|
export declare interface ViewportRange {
|
|
526
557
|
row: number;
|
|
527
558
|
col: number;
|
|
@@ -559,7 +590,7 @@ export declare interface Worksheet {
|
|
|
559
590
|
/** Sheet tab color (ECMA-376 §18.3.1.79). */
|
|
560
591
|
tabColor?: string | null;
|
|
561
592
|
/** AutoFilter header range (ECMA-376 §18.3.1.2). */
|
|
562
|
-
autoFilter?:
|
|
593
|
+
autoFilter?: CellRange_2 | null;
|
|
563
594
|
/** Hyperlinks in this worksheet (ECMA-376 §18.3.1.47). */
|
|
564
595
|
hyperlinks?: Hyperlink[];
|
|
565
596
|
/** A1-style cell refs of commented cells (ECMA-376 §18.7.3). Rendered as a
|
|
@@ -612,9 +643,30 @@ export declare class XlsxViewer {
|
|
|
612
643
|
private currentWorksheet;
|
|
613
644
|
private opts;
|
|
614
645
|
private resizeObserver;
|
|
646
|
+
private anchorCell;
|
|
647
|
+
private activeCell;
|
|
648
|
+
private selectionMode;
|
|
649
|
+
private isSelecting;
|
|
650
|
+
private selectionOverlay;
|
|
651
|
+
private keydownHandler;
|
|
615
652
|
constructor(container: HTMLElement, opts?: XlsxViewerOptions);
|
|
616
653
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
617
654
|
showSheet(index: number): Promise<void>;
|
|
655
|
+
/** Returns the cell at canvas-client coordinates, or null if outside the cell grid. */
|
|
656
|
+
getCellAt(clientX: number, clientY: number): CellAddress | null;
|
|
657
|
+
/** Returns the CSS-pixel rect of a cell within canvasArea, or null if not computable. */
|
|
658
|
+
private getCellRect;
|
|
659
|
+
/** Returns the current selection, including mode. */
|
|
660
|
+
get selection(): CellRange | null;
|
|
661
|
+
/**
|
|
662
|
+
* Returns what the header area contains at the given client coordinates.
|
|
663
|
+
* Returns null when the point is in the cell grid (not a header).
|
|
664
|
+
*/
|
|
665
|
+
private getHeaderHit;
|
|
666
|
+
/** Copy the selected cell range as tab-separated text to the clipboard. */
|
|
667
|
+
private copySelection;
|
|
668
|
+
private updateSelectionOverlay;
|
|
669
|
+
private setupSelectionEvents;
|
|
618
670
|
private buildTabs;
|
|
619
671
|
private updateTabActive;
|
|
620
672
|
private tabStyle;
|
|
@@ -630,6 +682,8 @@ export declare interface XlsxViewerOptions {
|
|
|
630
682
|
onReady?: (sheetNames: string[]) => void;
|
|
631
683
|
onSheetChange?: (index: number, name: string) => void;
|
|
632
684
|
onError?: (err: Error) => void;
|
|
685
|
+
/** Called when the selected cell range changes. null means no selection. */
|
|
686
|
+
onSelectionChange?: (selection: CellRange | null) => void;
|
|
633
687
|
}
|
|
634
688
|
|
|
635
689
|
export declare class XlsxWorkbook {
|