@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.
- package/README.md +144 -32
- package/dist/{canvas-viewer-mechanics-CwVSOYke.js → canvas-viewer-mechanics-DTkBvITv.js} +318 -152
- package/dist/{document-pull-client-AAnwzlig.js → document-pull-client-iWr8-S7P.js} +4829 -4210
- package/dist/{docx-CCksIXd5.js → docx-B1gYS6eU.js} +612 -191
- package/dist/docx.mjs +3 -3
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/index.mjs +3 -3
- package/dist/node.mjs +5 -5
- package/dist/{pptx-CKAk5e-J.js → pptx-CQjtK_o7.js} +646 -258
- package/dist/pptx.mjs +4 -4
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{render-CLcpSi0m.js → render-Ca80nlG5.js} +1 -1
- package/dist/{render-worker-host-Bkf1jUcW.js → render-worker-host-BozYMmxO.js} +1 -1
- package/dist/render-worker-host-C96AiK8e.js +27 -0
- package/dist/{render-worker-host-CKOmXdyr.js → render-worker-host-EHG5j8FK.js} +1 -1
- package/dist/{session-B4Y54cbT.js → session-KvKxQAeL.js} +1 -1
- package/dist/{slide-pull-client-WCuYCjio.js → slide-pull-client-BXb67StB.js} +15 -11
- package/dist/types/docx.d.ts +130 -28
- package/dist/types/index.d.ts +414 -87
- package/dist/types/node.d.ts +36 -20
- package/dist/types/pptx.d.ts +136 -10
- package/dist/types/xlsx.d.ts +176 -55
- package/dist/{xlsx-BBmmZNQn.js → xlsx-RLCmd1Bm.js} +2074 -1140
- package/dist/xlsx.mjs +4 -4
- package/package.json +3 -2
- package/dist/render-worker-host-B8HAb_sK.js +0 -27
package/dist/types/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region dist/.types-work/hyperlink-
|
|
1
|
+
//#region dist/.types-work/hyperlink-BqgLAFOG.d.ts
|
|
2
2
|
type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
|
|
3
3
|
interface MathRun {
|
|
4
4
|
kind: 'run';
|
|
@@ -219,7 +219,7 @@ interface Stroke {
|
|
|
219
219
|
fillType: 'none';
|
|
220
220
|
}>;
|
|
221
221
|
dashStyle?: string;
|
|
222
|
-
lineCap?:
|
|
222
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
223
223
|
headEnd?: ArrowEnd;
|
|
224
224
|
tailEnd?: ArrowEnd;
|
|
225
225
|
cmpd?: string;
|
|
@@ -693,11 +693,16 @@ interface Slide {
|
|
|
693
693
|
partName?: string;
|
|
694
694
|
background: Fill | null;
|
|
695
695
|
elements: SlideElement[];
|
|
696
|
+
elementSources?: SlideElementSource[];
|
|
696
697
|
notes?: string;
|
|
697
698
|
comments?: PptxComment[];
|
|
698
699
|
hidden?: boolean;
|
|
699
700
|
parseError?: string;
|
|
700
701
|
}
|
|
702
|
+
type SlideElementOrigin = 'master' | 'layout' | 'slide';
|
|
703
|
+
interface SlideElementSource {
|
|
704
|
+
origin: SlideElementOrigin;
|
|
705
|
+
}
|
|
701
706
|
interface PptxComment {
|
|
702
707
|
author?: string;
|
|
703
708
|
date?: string;
|
|
@@ -879,11 +884,17 @@ interface OoxmlNodeSessionOptions {
|
|
|
879
884
|
onResourceMetrics?: (metrics: OoxmlResourceMetrics) => void;
|
|
880
885
|
signal?: AbortSignal;
|
|
881
886
|
}
|
|
887
|
+
interface NodeTextMetricsLike {
|
|
888
|
+
readonly width: number;
|
|
889
|
+
}
|
|
890
|
+
interface NodeCanvasContext2D {
|
|
891
|
+
measureText(text: string): NodeTextMetricsLike;
|
|
892
|
+
}
|
|
882
893
|
interface NodeCanvasLike {
|
|
883
894
|
width: number;
|
|
884
895
|
height: number;
|
|
885
|
-
getContext(kind: '2d'):
|
|
886
|
-
toBuffer?(format?: string):
|
|
896
|
+
getContext(kind: '2d'): NodeCanvasContext2D;
|
|
897
|
+
toBuffer?(format?: string): Uint8Array | Promise<Uint8Array>;
|
|
887
898
|
}
|
|
888
899
|
interface NodeImageLike {
|
|
889
900
|
width: number;
|
|
@@ -891,7 +902,7 @@ interface NodeImageLike {
|
|
|
891
902
|
}
|
|
892
903
|
interface NodeCanvasFactory {
|
|
893
904
|
createCanvas(width: number, height: number): NodeCanvasLike;
|
|
894
|
-
loadImage(buffer: ArrayBuffer | Uint8Array
|
|
905
|
+
loadImage(buffer: ArrayBuffer | Uint8Array): Promise<NodeImageLike>;
|
|
895
906
|
}
|
|
896
907
|
declare function installOffscreenCanvasShim(factory: NodeCanvasFactory): () => void;
|
|
897
908
|
declare function installImageBitmapShim(factory: NodeCanvasFactory): () => void;
|
|
@@ -919,8 +930,8 @@ interface PptxPresentationSession extends AsyncIterable<Slide> {
|
|
|
919
930
|
slides(): AsyncGenerator<Slide, void, void>;
|
|
920
931
|
close(): Promise<void>;
|
|
921
932
|
}
|
|
922
|
-
declare function openPptxPresentation(buffer: ArrayBuffer | Uint8Array
|
|
923
|
-
declare function materializePptxPresentation(buffer: ArrayBuffer | Uint8Array
|
|
933
|
+
declare function openPptxPresentation(buffer: ArrayBuffer | Uint8Array, options?: OpenPptxPresentationOptions): Promise<PptxPresentationSession>;
|
|
934
|
+
declare function materializePptxPresentation(buffer: ArrayBuffer | Uint8Array, options?: OpenPptxPresentationOptions): Promise<Presentation>;
|
|
924
935
|
interface DocxDocumentModel {
|
|
925
936
|
section: SectionProps;
|
|
926
937
|
body: BodyElement[];
|
|
@@ -1090,6 +1101,7 @@ interface DocParagraph {
|
|
|
1090
1101
|
markVanish?: boolean;
|
|
1091
1102
|
widowControl?: boolean;
|
|
1092
1103
|
overflowPunct?: boolean;
|
|
1104
|
+
adjustRightInd?: boolean;
|
|
1093
1105
|
borders?: ParagraphBorders | null;
|
|
1094
1106
|
styleId?: string | null;
|
|
1095
1107
|
defaultFontSize?: number;
|
|
@@ -1275,7 +1287,7 @@ interface ShapeRun {
|
|
|
1275
1287
|
stroke: string | null;
|
|
1276
1288
|
strokeWidth?: number;
|
|
1277
1289
|
strokeDash?: string | null;
|
|
1278
|
-
strokeCap?:
|
|
1290
|
+
strokeCap?: 'butt' | 'round' | 'square' | null;
|
|
1279
1291
|
headEnd?: LineEnd | null;
|
|
1280
1292
|
tailEnd?: LineEnd | null;
|
|
1281
1293
|
rotation?: number;
|
|
@@ -1571,6 +1583,11 @@ interface CellBorders {
|
|
|
1571
1583
|
insideV: BorderSpec | null;
|
|
1572
1584
|
}
|
|
1573
1585
|
interface DocxTextRunInfo {
|
|
1586
|
+
source?: Readonly<{
|
|
1587
|
+
story: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textbox';
|
|
1588
|
+
storyInstance: string;
|
|
1589
|
+
path: readonly number[];
|
|
1590
|
+
}>;
|
|
1574
1591
|
paragraphId?: string;
|
|
1575
1592
|
text: string;
|
|
1576
1593
|
x: number;
|
|
@@ -1592,7 +1609,6 @@ interface DocxPageRenderOptions {
|
|
|
1592
1609
|
width?: number;
|
|
1593
1610
|
dpr?: number;
|
|
1594
1611
|
defaultTextColor?: string;
|
|
1595
|
-
showTrackChanges?: boolean;
|
|
1596
1612
|
onTextRun?: (run: DocxTextRunInfo) => void;
|
|
1597
1613
|
}
|
|
1598
1614
|
interface DocxRenderedPage {
|
|
@@ -1612,8 +1628,8 @@ interface DocxDocumentSession extends AsyncIterable<DocxRenderedPage> {
|
|
|
1612
1628
|
pages(options?: DocxPageRenderOptions): AsyncGenerator<DocxRenderedPage, void, void>;
|
|
1613
1629
|
close(): Promise<void>;
|
|
1614
1630
|
}
|
|
1615
|
-
declare function openDocxDocument(buffer: ArrayBuffer | Uint8Array
|
|
1616
|
-
declare function materializeDocxDocument(buffer: ArrayBuffer | Uint8Array
|
|
1631
|
+
declare function openDocxDocument(buffer: ArrayBuffer | Uint8Array, options: OpenDocxDocumentOptions): Promise<DocxDocumentSession>;
|
|
1632
|
+
declare function materializeDocxDocument(buffer: ArrayBuffer | Uint8Array, options?: OoxmlNodeSessionOptions): Promise<DocxDocumentModel>;
|
|
1617
1633
|
interface Workbook {
|
|
1618
1634
|
sheets: SheetMeta[];
|
|
1619
1635
|
date1904?: boolean;
|
|
@@ -1654,7 +1670,7 @@ interface Worksheet {
|
|
|
1654
1670
|
rightToLeft?: boolean;
|
|
1655
1671
|
outlinePr?: OutlinePr;
|
|
1656
1672
|
tabColor?: string | null;
|
|
1657
|
-
autoFilter?:
|
|
1673
|
+
autoFilter?: WorksheetCellRange | null;
|
|
1658
1674
|
hyperlinks?: Hyperlink[];
|
|
1659
1675
|
commentRefs?: string[];
|
|
1660
1676
|
comments?: XlsxComment[];
|
|
@@ -1685,7 +1701,7 @@ interface PivotTableMetadata {
|
|
|
1685
1701
|
status: PivotMetadataStatus;
|
|
1686
1702
|
extensionUris?: string[];
|
|
1687
1703
|
}
|
|
1688
|
-
interface PivotLocation extends
|
|
1704
|
+
interface PivotLocation extends WorksheetCellRange {
|
|
1689
1705
|
firstHeaderRow: number;
|
|
1690
1706
|
firstDataRow: number;
|
|
1691
1707
|
firstDataCol: number;
|
|
@@ -1828,7 +1844,7 @@ interface SlicerElementStyle {
|
|
|
1828
1844
|
borderColor?: string;
|
|
1829
1845
|
}
|
|
1830
1846
|
interface TableInfo {
|
|
1831
|
-
range:
|
|
1847
|
+
range: WorksheetCellRange;
|
|
1832
1848
|
styleName: string;
|
|
1833
1849
|
headerRowCount: number;
|
|
1834
1850
|
totalsRowCount: number;
|
|
@@ -2037,7 +2053,7 @@ interface ImageAnchor {
|
|
|
2037
2053
|
alpha?: number;
|
|
2038
2054
|
duotone?: Duotone;
|
|
2039
2055
|
}
|
|
2040
|
-
interface
|
|
2056
|
+
interface WorksheetCellRange {
|
|
2041
2057
|
top: number;
|
|
2042
2058
|
left: number;
|
|
2043
2059
|
bottom: number;
|
|
@@ -2051,7 +2067,7 @@ interface Hyperlink {
|
|
|
2051
2067
|
display?: string | null;
|
|
2052
2068
|
}
|
|
2053
2069
|
interface ConditionalFormat {
|
|
2054
|
-
sqref:
|
|
2070
|
+
sqref: WorksheetCellRange[];
|
|
2055
2071
|
rules: CfRule[];
|
|
2056
2072
|
}
|
|
2057
2073
|
type CfRule = {
|
|
@@ -2297,9 +2313,9 @@ interface XlsxWorkbookSession {
|
|
|
2297
2313
|
worksheetRows(sheetIndex: number): AsyncGenerator<XlsxWorksheetRowChunk, void, void>;
|
|
2298
2314
|
close(): Promise<void>;
|
|
2299
2315
|
}
|
|
2300
|
-
declare function openXlsxWorkbook(buffer: ArrayBuffer | Uint8Array
|
|
2301
|
-
declare function materializeXlsxWorkbookIndex(buffer: ArrayBuffer | Uint8Array
|
|
2302
|
-
declare function materializeXlsxWorksheet(buffer: ArrayBuffer | Uint8Array
|
|
2303
|
-
declare function materializeXlsxWorkbook(buffer: ArrayBuffer | Uint8Array
|
|
2316
|
+
declare function openXlsxWorkbook(buffer: ArrayBuffer | Uint8Array, options?: OpenXlsxWorkbookOptions): Promise<XlsxWorkbookSession>;
|
|
2317
|
+
declare function materializeXlsxWorkbookIndex(buffer: ArrayBuffer | Uint8Array, options?: OpenXlsxWorkbookOptions): Promise<ParsedWorkbook>;
|
|
2318
|
+
declare function materializeXlsxWorksheet(buffer: ArrayBuffer | Uint8Array, sheetIndex: number, options?: OpenXlsxWorkbookOptions): Promise<Worksheet>;
|
|
2319
|
+
declare function materializeXlsxWorkbook(buffer: ArrayBuffer | Uint8Array, options?: OpenXlsxWorkbookOptions): Promise<MaterializedXlsxWorkbook>;
|
|
2304
2320
|
//#endregion
|
|
2305
2321
|
export { type DeepReadonly, type DocxDocumentSession, type DocxPageRenderOptions, type DocxRenderedPage, type MaterializedXlsxWorkbook, type NodeCanvasFactory, type NodeCanvasLike, type NodeImageLike, OoxmlDecodedImageLimitError, type OoxmlDecodedImageLimitMetric, type OoxmlNodeSessionOptions, type OoxmlResourceLimit, OoxmlResourceLimitError, type OoxmlResourceLimitErrorDetails, type OoxmlResourceLimits, type OoxmlResourceMetrics, type OoxmlResourceMetricsCheckpoint, type OoxmlResourcePolicySnapshot, type OoxmlResourceUsageSnapshot, type OpenDocxDocumentOptions, type OpenPptxPresentationOptions, type OpenXlsxWorkbookOptions, type PptxPresentationSession, type PptxSessionRenderOptions, type ReadonlyParsedWorkbook, type XlsxWorkbookSession, type XlsxWorksheetRowChunk, installImageBitmapShim, installOffscreenCanvasShim, isOoxmlDecodedImageLimitError, materializeDocxDocument, materializePptxPresentation, materializeXlsxWorkbook, materializeXlsxWorkbookIndex, materializeXlsxWorksheet, openDocxDocument, openPptxPresentation, openXlsxWorkbook, renderSlideNode };
|
package/dist/types/pptx.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface MathRenderer {
|
|
|
10
10
|
mathMLToSvg(mathml: string): Promise<MathSvg>;
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region dist/.types-work/hyperlink-
|
|
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?:
|
|
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-
|
|
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/pptx-
|
|
752
|
+
//#region dist/.types-work/pptx-DcrJjm1-.d.ts
|
|
740
753
|
interface BlipBullet {
|
|
741
754
|
type: 'blip';
|
|
742
755
|
imagePath: string;
|
|
@@ -773,11 +786,16 @@ interface Slide {
|
|
|
773
786
|
partName?: string;
|
|
774
787
|
background: Fill | null;
|
|
775
788
|
elements: SlideElement[];
|
|
789
|
+
elementSources?: SlideElementSource[];
|
|
776
790
|
notes?: string;
|
|
777
791
|
comments?: PptxComment[];
|
|
778
792
|
hidden?: boolean;
|
|
779
793
|
parseError?: string;
|
|
780
794
|
}
|
|
795
|
+
type SlideElementOrigin = 'master' | 'layout' | 'slide';
|
|
796
|
+
interface SlideElementSource {
|
|
797
|
+
origin: SlideElementOrigin;
|
|
798
|
+
}
|
|
781
799
|
interface DimOptions {
|
|
782
800
|
color: string;
|
|
783
801
|
opacity: number;
|
|
@@ -957,6 +975,8 @@ interface PictureElement {
|
|
|
957
975
|
sp3d?: Sp3d;
|
|
958
976
|
}
|
|
959
977
|
interface PptxTextRunInfo {
|
|
978
|
+
elementIndex?: number;
|
|
979
|
+
origin?: SlideElementOrigin;
|
|
960
980
|
shapeId?: string;
|
|
961
981
|
text: string;
|
|
962
982
|
inShapeX: number;
|
|
@@ -987,6 +1007,68 @@ interface PresentationHandle {
|
|
|
987
1007
|
pause(mediaPath?: string): void;
|
|
988
1008
|
destroy(): void;
|
|
989
1009
|
}
|
|
1010
|
+
interface PptxSelectionRunLocator {
|
|
1011
|
+
readonly slideIndex: number;
|
|
1012
|
+
readonly runIndex: number;
|
|
1013
|
+
readonly shapeId?: string;
|
|
1014
|
+
readonly elementIndex?: number;
|
|
1015
|
+
readonly origin?: SlideElementOrigin;
|
|
1016
|
+
}
|
|
1017
|
+
interface PptxTextSelectionContext {
|
|
1018
|
+
readonly format: 'pptx';
|
|
1019
|
+
readonly kind: 'text';
|
|
1020
|
+
readonly text: string;
|
|
1021
|
+
readonly slideIndexes: readonly number[];
|
|
1022
|
+
readonly shapeIds: readonly string[];
|
|
1023
|
+
readonly runs: readonly PptxSelectionRunLocator[];
|
|
1024
|
+
readonly truncated: boolean;
|
|
1025
|
+
readonly truncationReasons: readonly ('text' | 'runs')[];
|
|
1026
|
+
readonly textCharacters: number;
|
|
1027
|
+
readonly maxTextCharacters: number;
|
|
1028
|
+
readonly maxRunLocators: number;
|
|
1029
|
+
}
|
|
1030
|
+
declare function readPptxTextSelectionContext(root: HTMLElement, selection: Selection | null, options?: TextSelectionContextOptions): PptxTextSelectionContext | null;
|
|
1031
|
+
type PptxSelectionContextOptions = TextSelectionContextOptions;
|
|
1032
|
+
interface PptxSlidePoint {
|
|
1033
|
+
readonly x: number;
|
|
1034
|
+
readonly y: number;
|
|
1035
|
+
}
|
|
1036
|
+
interface PptxElementContextOptions {
|
|
1037
|
+
readonly tolerance?: number;
|
|
1038
|
+
readonly maxTextCharacters?: number;
|
|
1039
|
+
}
|
|
1040
|
+
interface PptxElementContext {
|
|
1041
|
+
readonly format: 'pptx';
|
|
1042
|
+
readonly kind: 'element';
|
|
1043
|
+
readonly slideIndex: number;
|
|
1044
|
+
readonly elementIndex: number;
|
|
1045
|
+
readonly origin: SlideElementOrigin | 'unknown';
|
|
1046
|
+
readonly elementType: SlideElement['type'];
|
|
1047
|
+
readonly point: PptxSlidePoint;
|
|
1048
|
+
readonly bounds: Readonly<{
|
|
1049
|
+
x: number;
|
|
1050
|
+
y: number;
|
|
1051
|
+
width: number;
|
|
1052
|
+
height: number;
|
|
1053
|
+
rotation: number;
|
|
1054
|
+
flipH: boolean;
|
|
1055
|
+
flipV: boolean;
|
|
1056
|
+
}>;
|
|
1057
|
+
readonly shapeId?: string;
|
|
1058
|
+
readonly name?: string;
|
|
1059
|
+
readonly geometry?: string;
|
|
1060
|
+
readonly text?: string;
|
|
1061
|
+
readonly mimeType?: string;
|
|
1062
|
+
readonly mediaKind?: 'audio' | 'video';
|
|
1063
|
+
readonly rowCount?: number;
|
|
1064
|
+
readonly columnCount?: number;
|
|
1065
|
+
readonly seriesCount?: number;
|
|
1066
|
+
readonly truncated: boolean;
|
|
1067
|
+
readonly truncationReasons: readonly ('text')[];
|
|
1068
|
+
readonly textCharacters: number;
|
|
1069
|
+
readonly maxTextCharacters: number;
|
|
1070
|
+
}
|
|
1071
|
+
type PptxSelectionContext = PptxTextSelectionContext | PptxElementContext;
|
|
990
1072
|
type LoadOptions = LoadOptions$1 & {
|
|
991
1073
|
mode?: 'main' | 'worker';
|
|
992
1074
|
};
|
|
@@ -1002,6 +1084,8 @@ interface RenderSlideOptions {
|
|
|
1002
1084
|
onTextRun?: TextRunCallback;
|
|
1003
1085
|
skipMediaControls?: boolean;
|
|
1004
1086
|
dim?: DimOptions;
|
|
1087
|
+
}
|
|
1088
|
+
interface PresentSlideOptions extends Omit<RenderSlideOptions, 'skipMediaControls'> {
|
|
1005
1089
|
onError?: (error: Error) => void;
|
|
1006
1090
|
}
|
|
1007
1091
|
declare class PptxPresentation {
|
|
@@ -1037,16 +1121,17 @@ declare class PptxPresentation {
|
|
|
1037
1121
|
renderSlide(canvas: HTMLCanvasElement | OffscreenCanvas, slideIndex: number, opts?: RenderSlideOptions): Promise<void>;
|
|
1038
1122
|
renderSlideToBitmap(slideIndex: number, opts?: RenderSlideToBitmapOptions): Promise<ImageBitmap>;
|
|
1039
1123
|
collectSlideRuns(slideIndex: number, width?: number): Promise<PptxTextRunInfo[]>;
|
|
1124
|
+
getElementContextAt(slideIndex: number, point: PptxSlidePoint, options?: PptxElementContextOptions): Promise<PptxElementContext | null>;
|
|
1040
1125
|
getMedia(mediaPath: string): Promise<Blob>;
|
|
1041
1126
|
private _findMimeTypeForPath;
|
|
1042
1127
|
getImage(imagePath: string, mimeType: string): Promise<Blob>;
|
|
1043
1128
|
getResourceMetrics(): Promise<OoxmlResourceMetrics>;
|
|
1044
1129
|
toMarkdown(): Promise<string>;
|
|
1045
|
-
presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?:
|
|
1130
|
+
presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: PresentSlideOptions): Promise<PresentationHandle>;
|
|
1046
1131
|
destroy(): void;
|
|
1047
1132
|
}
|
|
1048
1133
|
type HiddenSlideMode = 'show' | 'skip' | 'dim';
|
|
1049
|
-
interface PptxViewerOptions extends RenderOptions, LoadOptions {
|
|
1134
|
+
interface PptxViewerOptions extends Pick<RenderOptions, 'width' | 'dpr'>, LoadOptions {
|
|
1050
1135
|
onSlideChange?: (index: number, total: number) => void;
|
|
1051
1136
|
onError?: (err: Error) => void;
|
|
1052
1137
|
zoomMin?: number;
|
|
@@ -1054,6 +1139,10 @@ interface PptxViewerOptions extends RenderOptions, LoadOptions {
|
|
|
1054
1139
|
onScaleChange?: (scale: number) => void;
|
|
1055
1140
|
enableMediaPlayback?: boolean;
|
|
1056
1141
|
enableTextSelection?: boolean;
|
|
1142
|
+
enableElementSelection?: boolean;
|
|
1143
|
+
elementHitTolerance?: number;
|
|
1144
|
+
onSelectionContextChange?: (context: PptxSelectionContext | null) => void;
|
|
1145
|
+
onContextMenu?: (event: ViewerContextMenuEvent<PptxSelectionContext>) => void;
|
|
1057
1146
|
findHighlightColors?: FindHighlightColors;
|
|
1058
1147
|
hiddenSlideMode?: HiddenSlideMode;
|
|
1059
1148
|
hiddenSlideDim?: Partial<DimOptions>;
|
|
@@ -1067,6 +1156,7 @@ declare class PptxViewer implements ZoomableViewer {
|
|
|
1067
1156
|
private _scale;
|
|
1068
1157
|
private textLayer;
|
|
1069
1158
|
private highlightLayer;
|
|
1159
|
+
private elementLayer;
|
|
1070
1160
|
private _find;
|
|
1071
1161
|
private _measureCtx;
|
|
1072
1162
|
private readonly presentationOwner;
|
|
@@ -1081,6 +1171,13 @@ declare class PptxViewer implements ZoomableViewer {
|
|
|
1081
1171
|
private readonly renderDispatcher;
|
|
1082
1172
|
private readonly errorRouter;
|
|
1083
1173
|
private destroyed;
|
|
1174
|
+
private selectionChangeListener;
|
|
1175
|
+
private selectionContextKey;
|
|
1176
|
+
private elementClickListener;
|
|
1177
|
+
private contextMenuListener;
|
|
1178
|
+
private elementContext;
|
|
1179
|
+
private elementHitGeneration;
|
|
1180
|
+
private readonly elementHitTolerance;
|
|
1084
1181
|
static fromPresentation(canvas: HTMLCanvasElement, presentation: PptxPresentation, opts?: Omit<PptxViewerOptions, keyof LoadOptions>): Omit<PptxViewer, 'load'>;
|
|
1085
1182
|
constructor(canvas: HTMLCanvasElement, opts?: PptxViewerOptions);
|
|
1086
1183
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
@@ -1124,9 +1221,17 @@ declare class PptxViewer implements ZoomableViewer {
|
|
|
1124
1221
|
private _resolveInternalSlideIndex;
|
|
1125
1222
|
private _reportRenderError;
|
|
1126
1223
|
getResourceMetrics(): Promise<OoxmlResourceMetrics>;
|
|
1224
|
+
getSelectionContext(options?: PptxSelectionContextOptions): PptxSelectionContext | null;
|
|
1225
|
+
private _emitSelectionContextChange;
|
|
1226
|
+
private _setElementContext;
|
|
1227
|
+
private _invalidateElementSelection;
|
|
1228
|
+
private _redrawElementOutline;
|
|
1229
|
+
private _onElementClick;
|
|
1230
|
+
private _onContextMenu;
|
|
1231
|
+
private _resolveContextAt;
|
|
1127
1232
|
destroy(): void;
|
|
1128
1233
|
}
|
|
1129
|
-
interface PptxScrollViewerOptions extends
|
|
1234
|
+
interface PptxScrollViewerOptions extends Pick<RenderSlideOptions, 'width' | 'dpr'>, LoadOptions {
|
|
1130
1235
|
width?: number;
|
|
1131
1236
|
gap?: number;
|
|
1132
1237
|
paddingTop?: number;
|
|
@@ -1135,6 +1240,10 @@ interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>,
|
|
|
1135
1240
|
paddingRight?: number;
|
|
1136
1241
|
overscan?: number;
|
|
1137
1242
|
enableTextSelection?: boolean;
|
|
1243
|
+
enableElementSelection?: boolean;
|
|
1244
|
+
elementHitTolerance?: number;
|
|
1245
|
+
onSelectionContextChange?: (context: PptxSelectionContext | null) => void;
|
|
1246
|
+
onContextMenu?: (event: ViewerContextMenuEvent<PptxSelectionContext>) => void;
|
|
1138
1247
|
findHighlightColors?: FindHighlightColors;
|
|
1139
1248
|
enableMediaPlayback?: boolean;
|
|
1140
1249
|
mediaOverscan?: number;
|
|
@@ -1169,6 +1278,13 @@ declare class PptxScrollViewer implements ZoomableViewer {
|
|
|
1169
1278
|
private _lastRange;
|
|
1170
1279
|
private _lastTopIndex;
|
|
1171
1280
|
private _scrollListener;
|
|
1281
|
+
private _selectionChangeListener;
|
|
1282
|
+
private _selectionContextKey;
|
|
1283
|
+
private _elementClickListener;
|
|
1284
|
+
private _contextMenuListener;
|
|
1285
|
+
private _elementContext;
|
|
1286
|
+
private _elementHitGeneration;
|
|
1287
|
+
private readonly _elementHitTolerance;
|
|
1172
1288
|
private _destroyed;
|
|
1173
1289
|
private readonly _slideInFlight;
|
|
1174
1290
|
private _renderEpoch;
|
|
@@ -1191,6 +1307,7 @@ declare class PptxScrollViewer implements ZoomableViewer {
|
|
|
1191
1307
|
private _fitWidthPx;
|
|
1192
1308
|
private _baseScale;
|
|
1193
1309
|
relayout(): void;
|
|
1310
|
+
private _relayout;
|
|
1194
1311
|
private _recomputeHeights;
|
|
1195
1312
|
private _gap;
|
|
1196
1313
|
private _overscan;
|
|
@@ -1247,9 +1364,18 @@ declare class PptxScrollViewer implements ZoomableViewer {
|
|
|
1247
1364
|
private _onResize;
|
|
1248
1365
|
get topVisibleSlide(): number;
|
|
1249
1366
|
getResourceMetrics(): Promise<OoxmlResourceMetrics>;
|
|
1367
|
+
getSelectionContext(options?: PptxSelectionContextOptions): PptxSelectionContext | null;
|
|
1368
|
+
private _emitSelectionContextChange;
|
|
1369
|
+
private _setElementContext;
|
|
1370
|
+
private _invalidateElementSelection;
|
|
1371
|
+
private _redrawElementOutlines;
|
|
1372
|
+
private _redrawElementOutlineForSlot;
|
|
1373
|
+
private _onElementClick;
|
|
1374
|
+
private _onContextMenu;
|
|
1375
|
+
private _resolveContextAt;
|
|
1250
1376
|
destroy(): void;
|
|
1251
1377
|
}
|
|
1252
|
-
declare function buildPptxTextLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], cssWidth: number, cssHeight: number, onHyperlinkClick?: (target: HyperlinkTarget) => void): void;
|
|
1378
|
+
declare function buildPptxTextLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], cssWidth: number, cssHeight: number, onHyperlinkClick?: (target: HyperlinkTarget) => void, slideIndex?: number): void;
|
|
1253
1379
|
interface PptxHighlightMatch {
|
|
1254
1380
|
slices: MatchRunSlice[];
|
|
1255
1381
|
active: boolean;
|
|
@@ -1257,4 +1383,4 @@ interface PptxHighlightMatch {
|
|
|
1257
1383
|
type PptxHighlightColors = FindHighlightColors;
|
|
1258
1384
|
declare function buildPptxHighlightLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], matches: PptxHighlightMatch[], cssWidth: number, cssHeight: number, measureForFont: (font: string) => (s: string) => number, colors?: PptxHighlightColors): void;
|
|
1259
1385
|
//#endregion
|
|
1260
|
-
export { type AutoResizeOptions, type Bevel3d, type BlipBullet, type Bullet, type Camera3d, type ChartElement, type ChartModel, type ChartSeries, type DimOptions, type Fill, type FillRect, type FindHighlightColors, type FindMatch, type FindMatchesOptions, type Glow, type GradientFill, type GradientStop, type HiddenSlideMode, type HyperlinkTarget, type ImageFill, type LightRig, type LineBreak, type LoadOptions, type MediaElement, type NoFill, OoxmlDecodedImageLimitError, type OoxmlDecodedImageLimitMetric, OoxmlError, type OoxmlErrorCode, type
|
|
1386
|
+
export { type ArrowEnd, type AutoResizeOptions, type Bevel3d, type BlipBullet, type Bullet, type Camera3d, type ChartDataLabelOverride, type ChartDataPointOverride, type ChartElement, type ChartErrBars, type ChartLabelBox, type ChartManualLayout, type ChartModel, type ChartRect, type ChartSeries, type ChartSeriesDataLabels, type ChartTrendline, type ChartType, type ChartexBoxSeries, type ChartexBoxWhisker, type ChartexSunburst, type ChartexSunburstRow, type DimOptions, type Duotone, type EquationRun, type Fill, type FillRect, type FindHighlightColors, type FindMatch, type FindMatchesOptions, type Glow, type GradientFill, type GradientStop, type HiddenSlideMode, type HyperlinkTarget, type ImageFill, type LegendManualLayout, type LightRig, type LineBreak, type LoadOptions, type MatchRunSlice, type MathAccent, type MathArray, type MathBar, type MathBorderBox, type MathBox, type MathDelimiter, type MathFraction, type MathFunc, type MathGroup, type MathGroupChr, type MathLimit, type MathNary, type MathNode, type MathPhant, type MathRadical, type MathRenderer, type MathRun, type MathSPre, type MathScript, type MathStyle, type MathSvg, type MediaElement, type NoFill, OoxmlDecodedImageLimitError, type OoxmlDecodedImageLimitMetric, OoxmlError, type OoxmlErrorCode, type OoxmlErrorStage, type OoxmlFormat, type OoxmlResourceLimit, OoxmlResourceLimitError, type OoxmlResourceLimitErrorDetails, type OoxmlResourceLimits, type OoxmlResourceMetric, type OoxmlResourceMetrics, type OoxmlResourceMetricsCheckpoint, type OoxmlResourceName, type OoxmlResourcePolicySnapshot, type OoxmlResourceUsageSnapshot, type OoxmlResourceViolation, type Paragraph, type PathCmd, type PatternFill, type PictureElement, type PptxComment, type PptxElementContext, type PptxElementContextOptions, type PptxHighlightColors, type PptxHighlightMatch, type PptxMatchLocation, PptxPresentation, PptxScrollViewer, type PptxScrollViewerOptions, type PptxSelectionContext, type PptxSelectionContextOptions, type PptxSelectionRunLocator, type PptxSlidePoint, type PptxTextRunInfo, type PptxTextSelectionContext, PptxViewer, type PptxViewerOptions, type PresentSlideOptions, type Presentation, type PresentationHandle, type Reflection, type RenderOptions, type RenderSlideOptions, type RenderSlideToBitmapOptions, type Rot3d, type Scene3d, type SecondaryValueAxis, type Shadow, type ShapeElement, type Slide, type SlideElement, type SlideElementOrigin, type SlideElementSource, type SlideRenderOptions, type SoftEdge, type SolidFill, type Sp3d, type SpaceLine, type Stroke, type TabStop, type TableCell, type TableElement, type TableRow, type TextBody, type TextOutline, type TextRect, type TextRun, type TextRunCallback, type TextRunData, type TextSelectionContextOptions, type TileInfo, type ViewerContextMenuEvent, type ZoomableViewer, autoResize, buildPptxHighlightLayer, buildPptxTextLayer, isOoxmlDecodedImageLimitError, openExternalHyperlink, readPptxTextSelectionContext, renderSlide };
|