@file-viewer/ppt 0.2.0 → 0.3.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/NOTICE +3 -2
- package/README.md +318 -101
- package/frame-cache.mjs +731 -0
- package/index.d.ts +106 -33
- package/index.mjs +626 -94
- package/manifest.json +17 -6
- package/package.json +7 -2
- package/ppt-font-cjk.otf +0 -0
- package/ppt-native.wasm +0 -0
- package/worker.mjs +920 -0
package/index.d.ts
CHANGED
|
@@ -1,32 +1,45 @@
|
|
|
1
|
+
export interface PptFontPackManifest {
|
|
2
|
+
readonly kind: 'flyfish-cjk-font-pack-v1';
|
|
3
|
+
readonly file: 'ppt-font-cjk.otf';
|
|
4
|
+
readonly bytes: number;
|
|
5
|
+
readonly sha256: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
export interface PptPackageManifest {
|
|
2
|
-
kind: 'flyfish-ppt-public-native-wasm-
|
|
3
|
-
product: 'Flyfish PPT Viewer';
|
|
4
|
-
format: 'PowerPoint 97-2003 (.ppt)';
|
|
5
|
-
packageName: '@file-viewer/ppt';
|
|
6
|
-
packageVersion: string;
|
|
7
|
-
engine: 'flyfish-classic-ppt-native-engine';
|
|
8
|
-
engineBuild: string;
|
|
9
|
-
id: 'FV-PPT-PUBLIC-WATERMARKED-V2';
|
|
10
|
-
feature: 'ppt';
|
|
11
|
-
edition: 'public-watermarked';
|
|
12
|
-
holder: 'Individual Personal Non-Commercial Use';
|
|
13
|
-
distribution: 'proprietary-public-binary';
|
|
14
|
-
commercialUse: false;
|
|
15
|
-
publicAnyOrigin: true;
|
|
16
|
-
watermarkRequired: true;
|
|
17
|
-
watermarkText: 'Flyfish Viewer';
|
|
18
|
-
usePolicy: 'public-individual-noncommercial-watermarked';
|
|
19
|
-
licensePolicy: 'flyfish-public-watermarked-binary-license-v1';
|
|
20
|
-
sourceCodeRights: false;
|
|
21
|
-
sourceDeliveryRights: false;
|
|
22
|
-
apacheLicenseApplies: false;
|
|
23
|
-
redistributionAllowed: false;
|
|
24
|
-
runtimeLicenseRequired: false;
|
|
25
|
-
renderer: 'native-wasm-
|
|
26
|
-
integrity: 'native-wasm-sha256-
|
|
27
|
-
wasmFile: 'ppt-native.wasm';
|
|
28
|
-
|
|
29
|
-
wasmSha256: string;
|
|
9
|
+
readonly kind: 'flyfish-ppt-public-native-wasm-v2';
|
|
10
|
+
readonly product: 'Flyfish PPT Viewer';
|
|
11
|
+
readonly format: 'PowerPoint 97-2003 (.ppt)';
|
|
12
|
+
readonly packageName: '@file-viewer/ppt';
|
|
13
|
+
readonly packageVersion: string;
|
|
14
|
+
readonly engine: 'flyfish-classic-ppt-native-engine';
|
|
15
|
+
readonly engineBuild: string;
|
|
16
|
+
readonly id: 'FV-PPT-PUBLIC-WATERMARKED-V2';
|
|
17
|
+
readonly feature: 'ppt';
|
|
18
|
+
readonly edition: 'public-watermarked';
|
|
19
|
+
readonly holder: 'Individual Personal Non-Commercial Use';
|
|
20
|
+
readonly distribution: 'proprietary-public-binary';
|
|
21
|
+
readonly commercialUse: false;
|
|
22
|
+
readonly publicAnyOrigin: true;
|
|
23
|
+
readonly watermarkRequired: true;
|
|
24
|
+
readonly watermarkText: 'Flyfish Viewer';
|
|
25
|
+
readonly usePolicy: 'public-individual-noncommercial-watermarked';
|
|
26
|
+
readonly licensePolicy: 'flyfish-public-watermarked-binary-license-v1';
|
|
27
|
+
readonly sourceCodeRights: false;
|
|
28
|
+
readonly sourceDeliveryRights: false;
|
|
29
|
+
readonly apacheLicenseApplies: false;
|
|
30
|
+
readonly redistributionAllowed: false;
|
|
31
|
+
readonly runtimeLicenseRequired: false;
|
|
32
|
+
readonly renderer: 'native-wasm-worker-offscreen-canvas';
|
|
33
|
+
readonly integrity: 'native-wasm-font-sha256-v2';
|
|
34
|
+
readonly wasmFile: 'ppt-native.wasm';
|
|
35
|
+
readonly wasmBytes: number;
|
|
36
|
+
readonly wasmSha256: string;
|
|
37
|
+
readonly workerFile: 'worker.mjs';
|
|
38
|
+
readonly fontPack: PptFontPackManifest;
|
|
39
|
+
readonly workerDefault: true;
|
|
40
|
+
readonly virtualScrollDefault: true;
|
|
41
|
+
readonly frameCache: 'indexeddb-final-watermarked-png-lru';
|
|
42
|
+
readonly watermarkEnforcement: 'native-final-frame';
|
|
30
43
|
}
|
|
31
44
|
|
|
32
45
|
export interface PptRuntimeLicenseSummary {
|
|
@@ -58,9 +71,48 @@ export interface PptMountOptions extends PptRenderOptions {
|
|
|
58
71
|
replace?: boolean;
|
|
59
72
|
/** Optional class name for the generated viewer root. */
|
|
60
73
|
className?: string;
|
|
74
|
+
/** Render only the viewport and overscan window. Defaults to true. */
|
|
75
|
+
virtualize?: boolean;
|
|
76
|
+
/** IntersectionObserver root. Defaults to the browser viewport. */
|
|
77
|
+
scrollRoot?: Element | Document | null;
|
|
78
|
+
/** IntersectionObserver overscan. Defaults to `150% 0px`. */
|
|
79
|
+
rootMargin?: string;
|
|
80
|
+
/** Delay before a hidden Canvas is persisted and released. Defaults to 1200 ms. */
|
|
81
|
+
releaseDelayMs?: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PptFrameCacheOptions {
|
|
85
|
+
enabled?: boolean;
|
|
86
|
+
dbName?: string;
|
|
87
|
+
/** Total IndexedDB frame budget. Defaults to 256 MiB. */
|
|
88
|
+
maxBytes?: number;
|
|
89
|
+
/** Maximum number of cached pages. Defaults to 200. */
|
|
90
|
+
maxEntries?: number;
|
|
91
|
+
/** Maximum encoded PNG size for one page. Defaults to 32 MiB. */
|
|
92
|
+
maxEntryBytes?: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface PptFrameCacheStats {
|
|
96
|
+
readonly enabled: boolean;
|
|
97
|
+
readonly available: boolean;
|
|
98
|
+
readonly disabledReason: string | null;
|
|
99
|
+
readonly entries: number;
|
|
100
|
+
readonly bytes: number;
|
|
101
|
+
readonly maxBytes: number;
|
|
102
|
+
readonly maxEntries: number;
|
|
103
|
+
readonly maxEntryBytes: number;
|
|
104
|
+
readonly hits: number;
|
|
105
|
+
readonly misses: number;
|
|
106
|
+
readonly writes: number;
|
|
107
|
+
readonly nativeRenders: number;
|
|
108
|
+
readonly cancellations: number;
|
|
109
|
+
readonly attachedCanvases: number;
|
|
110
|
+
readonly activeCanvases: number;
|
|
111
|
+
readonly wasmMemoryBytes: number;
|
|
61
112
|
}
|
|
62
113
|
|
|
63
114
|
export interface PptRenderResult {
|
|
115
|
+
readonly cancelled?: boolean;
|
|
64
116
|
readonly slideIndex: number;
|
|
65
117
|
readonly width: number;
|
|
66
118
|
readonly height: number;
|
|
@@ -68,9 +120,12 @@ export interface PptRenderResult {
|
|
|
68
120
|
readonly logicalHeight: number;
|
|
69
121
|
readonly scale: number;
|
|
70
122
|
readonly pixelRatio: number;
|
|
123
|
+
readonly source?: 'native' | 'indexeddb';
|
|
71
124
|
}
|
|
72
125
|
|
|
73
126
|
export interface PptDocument {
|
|
127
|
+
readonly mode: 'worker' | 'direct';
|
|
128
|
+
readonly documentId: string;
|
|
74
129
|
readonly slideCount: number;
|
|
75
130
|
readonly width: number;
|
|
76
131
|
readonly height: number;
|
|
@@ -79,30 +134,48 @@ export interface PptDocument {
|
|
|
79
134
|
slideIndex: number,
|
|
80
135
|
canvas: HTMLCanvasElement | OffscreenCanvas,
|
|
81
136
|
options?: PptRenderOptions
|
|
82
|
-
): PptRenderResult
|
|
83
|
-
|
|
137
|
+
): Promise<PptRenderResult>;
|
|
138
|
+
releaseSlide(slideIndex: number): Promise<boolean>;
|
|
139
|
+
cacheStats(): Promise<PptFrameCacheStats>;
|
|
140
|
+
close(): Promise<void>;
|
|
84
141
|
}
|
|
85
142
|
|
|
86
143
|
export interface MountedPptViewer {
|
|
87
144
|
readonly document: PptDocument;
|
|
88
145
|
readonly root: HTMLElement;
|
|
89
146
|
readonly canvases: readonly HTMLCanvasElement[];
|
|
90
|
-
|
|
147
|
+
readonly virtualized: boolean;
|
|
148
|
+
renderSlide(slideIndex: number): Promise<PptRenderResult | void>;
|
|
149
|
+
cacheStats(): Promise<PptFrameCacheStats>;
|
|
150
|
+
close(): Promise<void>;
|
|
91
151
|
}
|
|
92
152
|
|
|
153
|
+
export type PptAssetSource = string | URL | Response | ArrayBuffer | Uint8Array;
|
|
154
|
+
|
|
93
155
|
export interface LoadPptViewerOptions {
|
|
94
|
-
wasmUrl?:
|
|
156
|
+
wasmUrl?: PptAssetSource;
|
|
157
|
+
fontUrl?: PptAssetSource;
|
|
158
|
+
workerUrl?: string | URL;
|
|
159
|
+
/** `auto` uses a module Worker when Worker and OffscreenCanvas are supported. */
|
|
160
|
+
worker?: 'auto' | boolean;
|
|
161
|
+
/** Transfer ownership of full-buffer inputs to the Worker to avoid a main-thread copy. The input becomes detached. */
|
|
162
|
+
transferInputOwnership?: boolean;
|
|
163
|
+
/** Stores only final, native-watermarked PNG frames in bounded IndexedDB. */
|
|
164
|
+
cache?: false | PptFrameCacheOptions;
|
|
95
165
|
}
|
|
96
166
|
|
|
97
167
|
export interface PptViewerRuntime {
|
|
168
|
+
readonly mode: 'worker' | 'direct';
|
|
98
169
|
readonly license: Readonly<PptRuntimeLicenseSummary>;
|
|
99
170
|
readonly watermark: Readonly<PptWatermarkSummary>;
|
|
100
|
-
open(input: ArrayBuffer | Uint8Array): PptDocument
|
|
171
|
+
open(input: ArrayBuffer | Uint8Array): Promise<PptDocument>;
|
|
101
172
|
mount(
|
|
102
173
|
target: string | HTMLElement,
|
|
103
174
|
input: ArrayBuffer | Uint8Array,
|
|
104
175
|
options?: PptMountOptions
|
|
105
176
|
): Promise<MountedPptViewer>;
|
|
177
|
+
cacheStats(): Promise<PptFrameCacheStats>;
|
|
178
|
+
close(): Promise<void>;
|
|
106
179
|
}
|
|
107
180
|
|
|
108
181
|
export declare function getPptPackageManifest(): PptPackageManifest;
|