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