@file-viewer/renderer-pptx 3.0.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/LICENSE ADDED
@@ -0,0 +1,160 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work by
47
+ the copyright owner or by an individual or Legal Entity authorized to submit on
48
+ behalf of the copyright owner. For the purposes of this definition, "submitted"
49
+ means any form of electronic, verbal, or written communication sent to the
50
+ Licensor or its representatives, including but not limited to communication on
51
+ electronic mailing lists, source code control systems, and issue tracking systems
52
+ that are managed by, or on behalf of, the Licensor for the purpose of discussing
53
+ and improving the Work, but excluding communication that is conspicuously marked
54
+ or otherwise designated in writing by the copyright owner as "Not a
55
+ Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable (except as stated in this section) patent
71
+ license to make, have made, use, offer to sell, sell, import, and otherwise
72
+ transfer the Work, where such license applies only to those patent claims
73
+ licensable by such Contributor that are necessarily infringed by their
74
+ Contribution(s) alone or by combination of their Contribution(s) with the Work to
75
+ which such Contribution(s) was submitted. If You institute patent litigation
76
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
77
+ alleging that the Work or a Contribution incorporated within the Work
78
+ constitutes direct or contributory patent infringement, then any patent licenses
79
+ granted to You under this License for that Work shall terminate as of the date
80
+ such litigation is filed.
81
+
82
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
83
+ Derivative Works thereof in any medium, with or without modifications, and in
84
+ Source or Object form, provided that You meet the following conditions:
85
+
86
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
87
+ this License; and
88
+
89
+ (b) You must cause any modified files to carry prominent notices stating that
90
+ You changed the files; and
91
+
92
+ (c) You must retain, in the Source form of any Derivative Works that You
93
+ distribute, all copyright, patent, trademark, and attribution notices from the
94
+ Source form of the Work, excluding those notices that do not pertain to any part
95
+ of the Derivative Works; and
96
+
97
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
98
+ any Derivative Works that You distribute must include a readable copy of the
99
+ attribution notices contained within such NOTICE file, excluding those notices
100
+ that do not pertain to any part of the Derivative Works, in at least one of the
101
+ following places: within a NOTICE text file distributed as part of the Derivative
102
+ Works; within the Source form or documentation, if provided along with the
103
+ Derivative Works; or, within a display generated by the Derivative Works, if and
104
+ wherever such third-party notices normally appear. The contents of the NOTICE
105
+ file are for informational purposes only and do not modify the License. You may
106
+ add Your own attribution notices within Derivative Works that You distribute,
107
+ alongside or as an addendum to the NOTICE text from the Work, provided that such
108
+ additional attribution notices cannot be construed as modifying the License.
109
+
110
+ You may add Your own copyright statement to Your modifications and may provide
111
+ additional or different license terms and conditions for use, reproduction, or
112
+ distribution of Your modifications, or for any such Derivative Works as a whole,
113
+ provided Your use, reproduction, and distribution of the Work otherwise complies
114
+ with the conditions stated in this License.
115
+
116
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
117
+ Contribution intentionally submitted for inclusion in the Work by You to the
118
+ Licensor shall be under the terms and conditions of this License, without any
119
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
120
+ supersede or modify the terms of any separate license agreement you may have
121
+ executed with Licensor regarding such Contributions.
122
+
123
+ 6. Trademarks. This License does not grant permission to use the trade names,
124
+ trademarks, service marks, or product names of the Licensor, except as required
125
+ for reasonable and customary use in describing the origin of the Work and
126
+ reproducing the content of the NOTICE file.
127
+
128
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
129
+ writing, Licensor provides the Work (and each Contributor provides its
130
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
131
+ KIND, either express or implied, including, without limitation, any warranties or
132
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
133
+ PARTICULAR PURPOSE. You are solely responsible for determining the
134
+ appropriateness of using or redistributing the Work and assume any risks
135
+ associated with Your exercise of permissions under this License.
136
+
137
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
138
+ tort (including negligence), contract, or otherwise, unless required by
139
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
140
+ writing, shall any Contributor be liable to You for damages, including any
141
+ direct, indirect, special, incidental, or consequential damages of any character
142
+ arising as a result of this License or out of the use or inability to use the
143
+ Work (including but not limited to damages for loss of goodwill, work stoppage,
144
+ computer failure or malfunction, or any and all other commercial damages or
145
+ losses), even if such Contributor has been advised of the possibility of such
146
+ damages.
147
+
148
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
149
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
150
+ acceptance of support, warranty, indemnity, or other liability obligations and/or
151
+ rights consistent with this License. However, in accepting such obligations, You
152
+ may act only on Your own behalf and on Your sole responsibility, not on behalf of
153
+ any other Contributor, and only if You agree to indemnify, defend, and hold each
154
+ Contributor harmless for any liability incurred by, or claims asserted against,
155
+ such Contributor by reason of your accepting any such warranty or additional
156
+ liability.
157
+
158
+ END OF TERMS AND CONDITIONS
159
+
160
+ Copyright 2026 Flyfish Viewer
package/README.en.md ADDED
@@ -0,0 +1,9 @@
1
+ # @file-viewer/renderer-pptx
2
+
3
+ This renderer contains only modern OpenXML PowerPoint support. It does not install the legacy binary-PPT WASM, font, or runtime.
4
+
5
+ ```ts
6
+ import { pptxRenderer } from '@file-viewer/renderer-pptx'
7
+ ```
8
+
9
+ Install `@file-viewer/renderer-ppt` explicitly for legacy `.ppt`, or keep using the compatibility aggregate `@file-viewer/renderer-presentation` when both are required.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @file-viewer/renderer-pptx
2
+
3
+ 仅包含现代 OpenXML PowerPoint 格式的渲染器。该包不会安装旧版二进制 PPT 的 WASM、字体或运行时。
4
+
5
+ ```ts
6
+ import { pptxRenderer } from '@file-viewer/renderer-pptx'
7
+ ```
8
+
9
+ 需要同时支持旧 `.ppt` 时,可显式安装 `@file-viewer/renderer-ppt`,或继续使用兼容聚合包 `@file-viewer/renderer-presentation`。
@@ -0,0 +1,6 @@
1
+ import type { FileRenderContext, FileRenderHandler, FileViewerRenderedInstance, FileViewerRendererPlugin, RendererDefinition } from '@file-viewer/core';
2
+ export declare const resolvePptxPreviewErrorMessage: (error: unknown, fallback: string, context?: FileRenderContext) => string;
3
+ export default function renderPptx(buffer: ArrayBuffer, target: HTMLDivElement, _type?: string, context?: FileRenderContext): Promise<FileViewerRenderedInstance>;
4
+ export declare const presentationRendererDefinition: RendererDefinition;
5
+ export declare const renderFileViewerPresentation: FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>;
6
+ export declare const pptxRenderer: FileViewerRendererPlugin<FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>>;
package/dist/index.js ADDED
@@ -0,0 +1,651 @@
1
+ import { PptxViewer, RECOMMENDED_ZIP_LIMITS } from '@file-viewer/pptx';
2
+ import { DEFAULT_RENDERER_DEFINITIONS, createFileViewerTranslator, createFileViewerZoomChangeEmitter, getFileViewerShadowRootForNode, normalizeFileViewerErrorMessage, registerFileViewerZoomProvider, resolveFileViewerLocale, resolveFileViewerPresentationWorkerUrl, resolveFileViewerRuntimeAssetBaseUrl, waitForFileViewerNextPaint, unregisterFileViewerZoomProvider, } from '@file-viewer/core';
3
+ const pptxStyle = `
4
+ .pptx-viewer-shell{position:relative;box-sizing:border-box;min-height:100%;padding:24px 20px;background:var(--file-viewer-render-surface-background,#eef3f8);color:#1f2d3b;font-family:Aptos,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif}
5
+ .pptx-render-surface{min-height:240px}
6
+ .pptx-render-surface.is-loading{opacity:.72}
7
+ .pptx-loading{position:sticky;top:12px;z-index:3;box-sizing:border-box;display:inline-flex;align-items:center;gap:10px;margin:0 0 16px 50%;padding:10px 14px;border:1px solid rgba(42,94,144,.14);border-radius:999px;background:rgba(255,255,255,.92);color:#41556b;box-shadow:0 12px 32px rgba(24,44,64,.12);transform:translateX(-50%)}
8
+ .pptx-loading[hidden],.pptx-error[hidden]{display:none!important}
9
+ .pptx-loading-dot{width:9px;height:9px;border-radius:999px;background:#1f9d67;box-shadow:0 0 0 6px rgba(31,157,103,.13)}
10
+ .pptx-error{box-sizing:border-box;width:min(680px,calc(100% - 32px));margin:48px auto;padding:24px;border:1px solid rgba(28,43,58,.12);border-radius:14px;background:#fff;color:#1f2d3b;box-shadow:0 16px 42px rgba(25,42,54,.08)}
11
+ .pptx-slideshow-button{position:sticky;top:12px;z-index:4;float:right;display:inline-flex;align-items:center;gap:8px;margin:0 0 12px;padding:8px 14px;border:1px solid rgba(42,94,144,.16);border-radius:999px;background:rgba(255,255,255,.94);color:#2a5e90;font:13px/1.2 inherit;cursor:pointer;box-shadow:0 10px 26px rgba(24,44,64,.12)}
12
+ .pptx-slideshow-button:hover{border-color:rgba(42,94,144,.34);color:#1d4a75}
13
+ .pptx-slideshow-button:focus-visible{outline:2px solid #2a5e90;outline-offset:2px}
14
+ .pptx-slideshow-button[hidden]{display:none!important}
15
+ .pptx-slideshow-button-glyph{font-size:11px;line-height:1}
16
+ .pptx-slideshow-button-key{padding:1px 6px;border-radius:6px;background:rgba(42,94,144,.1);font-size:11px;letter-spacing:.04em}
17
+ [data-viewer-theme='dark'] .pptx-slideshow-button{border-color:rgba(148,163,184,.2);background:rgba(15,23,42,.92);color:#cbd5e1}
18
+ [data-viewer-theme='dark'] .pptx-slideshow-button-key{background:rgba(148,163,184,.16)}
19
+ .pptx-error strong{display:block;margin-bottom:10px;font-size:18px}
20
+ .pptx-error p{margin:0;color:#607282;line-height:1.7}
21
+ [data-viewer-theme='dark'] .pptx-viewer-shell{background:var(--file-viewer-render-surface-background,#101820);color:#e5eef8}
22
+ [data-viewer-theme='dark'] .pptx-loading{border-color:rgba(148,163,184,.18);background:rgba(15,23,42,.9);color:#cbd5e1;box-shadow:0 18px 44px rgba(0,0,0,.26)}
23
+ [data-viewer-theme='dark'] .pptx-error{border-color:rgba(148,163,184,.18);background:#151f2b;color:#f8fafc;box-shadow:0 22px 56px rgba(0,0,0,.32)}
24
+ [data-viewer-theme='dark'] .pptx-error p{color:#94a3b8}
25
+ [data-viewer-theme='dark'] .pptx-render-surface .slide,[data-viewer-theme='dark'] .pptx-render-surface [data-slide-index]{color-scheme:only light;forced-color-adjust:none}
26
+ @media (prefers-color-scheme:dark){[data-viewer-theme='system'] .pptx-viewer-shell{background:var(--file-viewer-render-surface-background,#101820);color:#e5eef8}[data-viewer-theme='system'] .pptx-loading{border-color:rgba(148,163,184,.18);background:rgba(15,23,42,.9);color:#cbd5e1;box-shadow:0 18px 44px rgba(0,0,0,.26)}[data-viewer-theme='system'] .pptx-error{border-color:rgba(148,163,184,.18);background:#151f2b;color:#f8fafc;box-shadow:0 22px 56px rgba(0,0,0,.32)}[data-viewer-theme='system'] .pptx-error p{color:#94a3b8}[data-viewer-theme='system'] .pptx-render-surface .slide,[data-viewer-theme='system'] .pptx-render-surface [data-slide-index]{color-scheme:only light;forced-color-adjust:none}}
27
+ `;
28
+ const pptxPrintStyle = `
29
+ .pptx-viewer-shell {
30
+ background: #fff !important;
31
+ padding: 0 !important;
32
+ }
33
+ .pptx-render-surface {
34
+ display: block !important;
35
+ overflow: visible !important;
36
+ }
37
+ .pptx-render-surface [data-slide-index] {
38
+ break-after: page;
39
+ page-break-after: always;
40
+ margin: 0 auto !important;
41
+ }
42
+ .pptx-render-surface [data-slide-index]:last-child {
43
+ break-after: auto;
44
+ page-break-after: auto;
45
+ }
46
+ `;
47
+ const SLIDESHOW_HOTKEY_LABEL = 'F5 / P';
48
+ // With several viewers on one page each renderer installs a document-level
49
+ // F5/P listener. Keep one explicitly activated shell per document so shortcuts
50
+ // never leak across viewers, host controls, or iframe documents.
51
+ const activePptxShells = new WeakMap();
52
+ const createStyle = (documentRef) => {
53
+ const style = documentRef.createElement('style');
54
+ style.textContent = pptxStyle;
55
+ return style;
56
+ };
57
+ const createElement = (documentRef, tagName, className, text) => {
58
+ const element = documentRef.createElement(tagName);
59
+ if (className) {
60
+ element.className = className;
61
+ }
62
+ if (text !== undefined) {
63
+ element.textContent = text;
64
+ }
65
+ return element;
66
+ };
67
+ const resolvePptxStyleRoot = (surface, context) => {
68
+ var _a, _b;
69
+ return ((_a = context === null || context === void 0 ? void 0 : context.surface) === null || _a === void 0 ? void 0 : _a.shadowRoot) ||
70
+ getFileViewerShadowRootForNode((_b = context === null || context === void 0 ? void 0 : context.surface) === null || _b === void 0 ? void 0 : _b.container) ||
71
+ getFileViewerShadowRootForNode(surface) ||
72
+ undefined;
73
+ };
74
+ const clampZoomPercent = (value) => {
75
+ return Math.min(300, Math.max(25, Math.round(value)));
76
+ };
77
+ const pptxDiagnosticMessages = {
78
+ PPTX_FILE_EMPTY: {
79
+ zh: '文件为空或过小,无法读取。',
80
+ en: 'The file is empty or too small to read.',
81
+ ja: 'ファイルが空であるか小さすぎるため、読み込めません。',
82
+ de: 'Die Datei ist leer oder zu klein zum Lesen.',
83
+ },
84
+ PPTX_FILE_TOO_LARGE: {
85
+ zh: '文件超过浏览器安全预览体积限制。',
86
+ en: 'The file is larger than the browser-safe preview limit.',
87
+ ja: 'ファイルがブラウザーで安全にプレビューできるサイズ上限を超えています。',
88
+ de: 'Die Datei überschreitet die sichere Vorschaugröße des Browsers.',
89
+ },
90
+ PPTX_INVALID_ZIP: {
91
+ zh: '文件不是有效的 PowerPoint OpenXML 压缩包。',
92
+ en: 'The file is not a valid PowerPoint OpenXML package.',
93
+ ja: '有効な PowerPoint OpenXML パッケージではありません。',
94
+ de: 'Die Datei ist kein gültiges PowerPoint-OpenXML-Paket.',
95
+ },
96
+ PPTX_MISSING_CONTENT_TYPES: {
97
+ zh: '文件缺少 [Content_Types].xml,无法识别内部结构。',
98
+ en: 'The package is missing [Content_Types].xml, so its structure cannot be identified.',
99
+ ja: '[Content_Types].xml がないため、内部構造を識別できません。',
100
+ de: '[Content_Types].xml fehlt; die Paketstruktur kann nicht erkannt werden.',
101
+ },
102
+ PPTX_MISSING_PRESENTATION: {
103
+ zh: '文件缺少 ppt/presentation.xml,无法读取幻灯片列表。',
104
+ en: 'The package is missing ppt/presentation.xml, so the slide list cannot be read.',
105
+ ja: 'ppt/presentation.xml がないため、スライド一覧を読み込めません。',
106
+ de: 'ppt/presentation.xml fehlt; die Folienliste kann nicht gelesen werden.',
107
+ },
108
+ PPTX_NO_SLIDES: {
109
+ zh: '文件中没有找到可预览的幻灯片。',
110
+ en: 'No previewable slides were found in the file.',
111
+ ja: 'プレビュー可能なスライドが見つかりませんでした。',
112
+ de: 'Es wurden keine Folien für die Vorschau gefunden.',
113
+ },
114
+ PPTX_MISSING_SLIDE: {
115
+ zh: '文件缺少某一页幻灯片内容。',
116
+ en: 'The package is missing one of the slide parts.',
117
+ ja: 'スライド部品の一部がありません。',
118
+ de: 'Ein Folienbestandteil fehlt im Paket.',
119
+ },
120
+ PPTX_SLIDE_RENDER_FAILED: {
121
+ zh: '某一页幻灯片解析失败。',
122
+ en: 'One slide failed to parse.',
123
+ ja: 'スライドの解析に失敗しました。',
124
+ de: 'Eine Folie konnte nicht verarbeitet werden.',
125
+ },
126
+ PPTX_WORKER_FAILED: {
127
+ zh: 'PPTX Worker 启动或运行失败。',
128
+ en: 'The PPTX Worker failed to start or run.',
129
+ ja: 'PPTX Worker の起動または実行に失敗しました。',
130
+ de: 'Der PPTX-Worker konnte nicht gestartet oder ausgeführt werden.',
131
+ },
132
+ PPTX_PARSE_FAILED: {
133
+ zh: 'PPTX 文件解析失败。',
134
+ en: 'The PPTX file could not be parsed.',
135
+ ja: 'PPTX ファイルを解析できませんでした。ファイルを再保存するか、入力元を確認してください。',
136
+ de: 'Die PPTX-Datei konnte nicht verarbeitet werden.',
137
+ },
138
+ };
139
+ const pptxDiagnosticFallbackHints = {
140
+ PPTX_INVALID_ZIP: {
141
+ zh: '请确认接口返回的是原始 .pptx 二进制文件,而不是登录页、HTML/JSON 错误响应或被截断的内容。',
142
+ en: 'Confirm that the response is the original .pptx binary, not a login page, HTML/JSON error response, or truncated download.',
143
+ ja: 'レスポンスがログインページや HTML/JSON エラー、途中で切れたデータではなく、元の .pptx バイナリであることを確認してください。',
144
+ de: 'Prüfen Sie, ob die Antwort die ursprüngliche .pptx-Datei und keine Anmeldeseite, HTML/JSON-Fehlerantwort oder unvollständige Datei enthält.',
145
+ },
146
+ PPTX_WORKER_FAILED: {
147
+ zh: '请检查 presentation.workerUrl、Worker 文件路径、MIME 类型、CSP 和跨域策略。',
148
+ en: 'Check presentation.workerUrl, the Worker file path, MIME type, CSP, and cross-origin policy.',
149
+ ja: 'presentation.workerUrl、Worker のパス、MIME type、CSP、cross-origin policy を確認してください。',
150
+ de: 'Prüfen Sie presentation.workerUrl, den Worker-Pfad, den MIME-Typ, CSP und die Cross-Origin-Richtlinie.',
151
+ },
152
+ PPTX_NO_SLIDES: {
153
+ zh: '请重新保存演示文稿,或检查包内是否存在 ppt/slides/slide*.xml。',
154
+ en: 'Re-save the presentation, or check whether ppt/slides/slide*.xml exists inside the package.',
155
+ ja: 'プレゼンテーションを再保存するか、パッケージに ppt/slides/slide*.xml があるか確認してください。',
156
+ de: 'Speichern Sie die Präsentation erneut oder prüfen Sie, ob ppt/slides/slide*.xml im Paket vorhanden ist.',
157
+ },
158
+ };
159
+ const localizePptxDiagnosticCopy = (copy, locale) => {
160
+ if (!copy) {
161
+ return '';
162
+ }
163
+ return locale === 'zh-CN' ? copy.zh : locale === 'ja-JP' ? copy.ja : locale === 'de-DE' ? copy.de : copy.en;
164
+ };
165
+ const sanitizePptxDiagnosticText = (value) => {
166
+ if (typeof value !== 'string') {
167
+ return '';
168
+ }
169
+ return value.replace(/^Error:\s*/i, '').trim();
170
+ };
171
+ const isPptxDiagnosticErrorLike = (error) => {
172
+ return Boolean(error &&
173
+ typeof error === 'object' &&
174
+ (error.name === 'PptxDiagnosticError' ||
175
+ error.code ||
176
+ error.stage));
177
+ };
178
+ const classifyPptxErrorString = (message) => {
179
+ const lower = message.toLowerCase();
180
+ if (lower.includes('end of central directory') ||
181
+ lower.includes('corrupt zip') ||
182
+ lower.includes('invalid zip') ||
183
+ lower.includes('not a zip') ||
184
+ lower.includes('jszip')) {
185
+ return {
186
+ name: 'PptxDiagnosticError',
187
+ code: 'PPTX_INVALID_ZIP',
188
+ stage: 'read-zip',
189
+ detail: message,
190
+ };
191
+ }
192
+ if (lower.includes('worker') ||
193
+ lower.includes('script error') ||
194
+ lower.includes('failed to construct') ||
195
+ lower.includes('failed to load')) {
196
+ return {
197
+ name: 'PptxDiagnosticError',
198
+ code: 'PPTX_WORKER_FAILED',
199
+ stage: 'worker-runtime',
200
+ detail: message,
201
+ };
202
+ }
203
+ if (lower.includes('[content_types].xml')) {
204
+ return {
205
+ name: 'PptxDiagnosticError',
206
+ code: 'PPTX_MISSING_CONTENT_TYPES',
207
+ stage: 'read-content-types',
208
+ detail: message,
209
+ };
210
+ }
211
+ if (lower.includes('ppt/presentation.xml')) {
212
+ return {
213
+ name: 'PptxDiagnosticError',
214
+ code: 'PPTX_MISSING_PRESENTATION',
215
+ stage: 'read-presentation',
216
+ detail: message,
217
+ };
218
+ }
219
+ if (lower.includes('slide') || lower.includes('ppt/slides/')) {
220
+ return {
221
+ name: 'PptxDiagnosticError',
222
+ code: 'PPTX_SLIDE_RENDER_FAILED',
223
+ stage: 'render-slide',
224
+ detail: message,
225
+ };
226
+ }
227
+ return null;
228
+ };
229
+ const formatPptxDiagnosticError = (error, fallback, context) => {
230
+ const locale = resolveFileViewerLocale(context === null || context === void 0 ? void 0 : context.options);
231
+ const code = String(error.code || 'PPTX_PARSE_FAILED');
232
+ const localizedReason = localizePptxDiagnosticCopy(pptxDiagnosticMessages[code], locale);
233
+ const rawReason = sanitizePptxDiagnosticText(error.message);
234
+ const reason = (locale === 'zh-CN'
235
+ ? rawReason || localizedReason
236
+ : localizedReason || rawReason) || fallback;
237
+ const detail = sanitizePptxDiagnosticText(error.detail);
238
+ const hint = sanitizePptxDiagnosticText(error.hint) ||
239
+ localizePptxDiagnosticCopy(pptxDiagnosticFallbackHints[code], locale);
240
+ const stage = sanitizePptxDiagnosticText(error.stage);
241
+ const usesWesternPunctuation = locale === 'en-US' || locale === 'de-DE';
242
+ const separator = usesWesternPunctuation ? ': ' : ':';
243
+ const parts = [`${fallback}${separator}${reason}`];
244
+ if (stage) {
245
+ parts.push(locale === 'zh-CN' ? `阶段:${stage}` : locale === 'ja-JP' ? `段階:${stage}` : locale === 'de-DE' ? `Phase: ${stage}` : `Stage: ${stage}`);
246
+ }
247
+ if (detail && detail !== reason) {
248
+ parts.push(locale === 'zh-CN' ? `详情:${detail}` : locale === 'ja-JP' ? `詳細:${detail}` : locale === 'de-DE' ? `Details: ${detail}` : `Detail: ${detail}`);
249
+ }
250
+ if (hint) {
251
+ parts.push(locale === 'zh-CN' ? `建议:${hint}` : locale === 'ja-JP' ? `対処:${hint}` : locale === 'de-DE' ? `Hinweis: ${hint}` : `Hint: ${hint}`);
252
+ }
253
+ return parts.join(usesWesternPunctuation ? '; ' : ';');
254
+ };
255
+ const formatErrorMessage = (error, fallback, context) => {
256
+ if (isPptxDiagnosticErrorLike(error)) {
257
+ return formatPptxDiagnosticError(error, fallback, context);
258
+ }
259
+ if (error instanceof Error || typeof error === 'string') {
260
+ const normalized = normalizeFileViewerErrorMessage(error, context === null || context === void 0 ? void 0 : context.options);
261
+ const classified = classifyPptxErrorString(normalized);
262
+ if (classified) {
263
+ return formatPptxDiagnosticError(classified, fallback, context);
264
+ }
265
+ return normalized || fallback;
266
+ }
267
+ if (error === undefined || error === null) {
268
+ return fallback;
269
+ }
270
+ try {
271
+ const serialized = JSON.stringify(error) || '';
272
+ if (serialized) {
273
+ const classified = classifyPptxErrorString(serialized);
274
+ if (classified) {
275
+ return formatPptxDiagnosticError(classified, fallback, context);
276
+ }
277
+ }
278
+ return serialized || fallback;
279
+ }
280
+ catch {
281
+ return String(error || fallback);
282
+ }
283
+ };
284
+ export const resolvePptxPreviewErrorMessage = formatErrorMessage;
285
+ const collectPptxPrintMaskPages = (surface) => {
286
+ const slots = Array.from(surface.querySelectorAll('.flyfish-pptx-slide-slot'));
287
+ return slots.length
288
+ ? slots
289
+ : Array.from(surface.querySelectorAll('[data-slide-index], .slide'));
290
+ };
291
+ const buildExportAdapter = (surface, targetWindow, getViewer) => ({
292
+ print: true,
293
+ exportHtml: true,
294
+ includeDocumentStyles: true,
295
+ beforeSnapshot: () => waitForFileViewerNextPaint(targetWindow || undefined),
296
+ getPrintMaskPages: () => collectPptxPrintMaskPages(surface),
297
+ printStyle: pptxPrintStyle,
298
+ toHtml: async () => {
299
+ var _a;
300
+ const clone = await ((_a = getViewer()) === null || _a === void 0 ? void 0 : _a.cloneForExport()) || surface.cloneNode(true);
301
+ collectPptxPrintMaskPages(clone).forEach((page, index) => {
302
+ page.dataset.viewerPrintPageIndex = String(index);
303
+ });
304
+ return clone.outerHTML;
305
+ },
306
+ });
307
+ export default async function renderPptx(buffer, target, _type, context) {
308
+ var _a;
309
+ const t = createFileViewerTranslator(context === null || context === void 0 ? void 0 : context.options);
310
+ const documentRef = target.ownerDocument || document;
311
+ const targetWindow = documentRef.defaultView || (typeof window !== 'undefined' ? window : null);
312
+ const zoomEmitter = createFileViewerZoomChangeEmitter();
313
+ let viewer = null;
314
+ let state = 'loading';
315
+ let errorMessage = '';
316
+ let zoomPercent = 100;
317
+ let progressiveReady = false;
318
+ let disposed = false;
319
+ const style = createStyle(documentRef);
320
+ const shell = createElement(documentRef, 'div', 'pptx-viewer-shell');
321
+ shell.dataset.viewerZoomProvider = 'pptx';
322
+ const loading = createElement(documentRef, 'div', 'pptx-loading');
323
+ loading.setAttribute('aria-live', 'polite');
324
+ loading.append(createElement(documentRef, 'span', 'pptx-loading-dot'), createElement(documentRef, 'span', undefined, t('presentation.state.loading')));
325
+ const error = createElement(documentRef, 'div', 'pptx-error');
326
+ const errorTitle = createElement(documentRef, 'strong', undefined, t('presentation.error.title'));
327
+ const errorText = createElement(documentRef, 'p');
328
+ error.append(errorTitle, errorText);
329
+ const slideshowButton = createElement(documentRef, 'button', 'pptx-slideshow-button');
330
+ slideshowButton.type = 'button';
331
+ slideshowButton.hidden = true;
332
+ const slideshowGlyph = createElement(documentRef, 'span', 'pptx-slideshow-button-glyph', '▶');
333
+ const slideshowText = createElement(documentRef, 'span', undefined, t('presentation.slideshow.start'));
334
+ const slideshowKey = createElement(documentRef, 'span', 'pptx-slideshow-button-key', SLIDESHOW_HOTKEY_LABEL);
335
+ slideshowButton.append(slideshowGlyph, slideshowText, slideshowKey);
336
+ slideshowButton.addEventListener('click', () => {
337
+ void (viewer === null || viewer === void 0 ? void 0 : viewer.togglePresentation());
338
+ });
339
+ const surface = createElement(documentRef, 'div', 'pptx-render-surface');
340
+ shell.append(loading, error, slideshowButton, surface);
341
+ target.replaceChildren(style, shell);
342
+ // A viewer owns the shortcut only after the user interacts with it. Moving
343
+ // focus or the pointer back to the host page releases that ownership.
344
+ const activateShell = () => {
345
+ activePptxShells.set(documentRef, shell);
346
+ };
347
+ const deactivateShell = (event) => {
348
+ if ((viewer === null || viewer === void 0 ? void 0 : viewer.presenting) || activePptxShells.get(documentRef) !== shell) {
349
+ return;
350
+ }
351
+ if (event.composedPath().includes(shell)) {
352
+ return;
353
+ }
354
+ const targetElement = event.target;
355
+ if (event.type === 'focusin' &&
356
+ !(targetElement === null || targetElement === void 0 ? void 0 : targetElement.matches('button, a, input, textarea, select, [contenteditable], [tabindex]'))) {
357
+ return;
358
+ }
359
+ activePptxShells.delete(documentRef);
360
+ };
361
+ shell.addEventListener('pointerdown', activateShell);
362
+ shell.addEventListener('focusin', activateShell);
363
+ documentRef.addEventListener('pointerdown', deactivateShell);
364
+ documentRef.addEventListener('focusin', deactivateShell);
365
+ // F5 mirrors PowerPoint; P is the keyboard-only toggle for browsers where F5 is spoken for.
366
+ // Typing in a field must never start a slideshow, so editable targets are skipped.
367
+ const isEditableTarget = (node) => {
368
+ const element = node;
369
+ if (!element || typeof element.closest !== 'function') {
370
+ return false;
371
+ }
372
+ return Boolean(element.closest('input, textarea, select, [contenteditable=""], [contenteditable="true"]'));
373
+ };
374
+ const handleShortcut = (event) => {
375
+ if (disposed || !viewer || event.altKey || event.ctrlKey || event.metaKey) {
376
+ return;
377
+ }
378
+ if (event.key !== 'F5' && event.key !== 'p' && event.key !== 'P') {
379
+ return;
380
+ }
381
+ if (!shell.isConnected || isEditableTarget(event.target)) {
382
+ return;
383
+ }
384
+ // Only the focused/last-activated shell answers, and a key pressed inside
385
+ // another shell belongs to that shell.
386
+ if (activePptxShells.get(documentRef) !== shell) {
387
+ return;
388
+ }
389
+ const targetElement = event.target;
390
+ if (targetElement && typeof targetElement.closest === 'function') {
391
+ const targetShell = targetElement.closest('.pptx-viewer-shell');
392
+ if (targetShell && targetShell !== shell) {
393
+ return;
394
+ }
395
+ }
396
+ event.preventDefault();
397
+ void viewer.togglePresentation();
398
+ };
399
+ documentRef.addEventListener('keydown', handleShortcut);
400
+ (_a = context === null || context === void 0 ? void 0 : context.registerThumbnailAdapter) === null || _a === void 0 ? void 0 : _a.call(context, {
401
+ captureSource: 'embedded',
402
+ beforeCapture: async ({ signal }) => {
403
+ const hasFirstVisual = () => Boolean((viewer === null || viewer === void 0 ? void 0 : viewer.thumbnailDataUrl) || surface.querySelector('.slide, .flyfish-pptx-thumbnail'));
404
+ while ((state === 'loading' || (state === 'ready' && !hasFirstVisual())) && !disposed) {
405
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
406
+ throw signal.reason;
407
+ }
408
+ await new Promise(resolve => {
409
+ if (targetWindow)
410
+ targetWindow.setTimeout(resolve, 16);
411
+ else
412
+ setTimeout(resolve, 16);
413
+ });
414
+ }
415
+ if (state === 'error') {
416
+ throw new Error(errorMessage || t('presentation.error.parseFailed'));
417
+ }
418
+ },
419
+ capture: () => (viewer === null || viewer === void 0 ? void 0 : viewer.thumbnailDataUrl)
420
+ ? fetch(viewer.thumbnailDataUrl).then(response => response.blob())
421
+ : null,
422
+ // Keep the renderer ancestry in the snapshot: slide CSS is scoped below
423
+ // .pptx-render-surface and loses layout when the slide node is cloned alone.
424
+ getTarget: () => surface,
425
+ });
426
+ const getCurrentZoomPercent = () => { var _a; return clampZoomPercent((_a = viewer === null || viewer === void 0 ? void 0 : viewer.zoomPercent) !== null && _a !== void 0 ? _a : zoomPercent); };
427
+ const getZoomState = () => {
428
+ const percent = getCurrentZoomPercent();
429
+ return {
430
+ scale: percent / 100,
431
+ label: `${percent}%`,
432
+ canZoomIn: percent < 300,
433
+ canZoomOut: percent > 25,
434
+ canReset: percent !== 100,
435
+ minScale: 0.25,
436
+ maxScale: 3,
437
+ };
438
+ };
439
+ const setZoom = async (percent) => {
440
+ const nextPercent = clampZoomPercent(percent);
441
+ zoomPercent = nextPercent;
442
+ if (viewer) {
443
+ await viewer.setZoom(nextPercent);
444
+ zoomPercent = getCurrentZoomPercent();
445
+ }
446
+ zoomEmitter.emit();
447
+ return getZoomState();
448
+ };
449
+ const notifyProgressiveReady = () => {
450
+ var _a, _b;
451
+ if (progressiveReady || disposed || ((_a = context === null || context === void 0 ? void 0 : context.signal) === null || _a === void 0 ? void 0 : _a.aborted)) {
452
+ return;
453
+ }
454
+ progressiveReady = true;
455
+ (_b = context === null || context === void 0 ? void 0 : context.onProgressiveRender) === null || _b === void 0 ? void 0 : _b.call(context);
456
+ };
457
+ const syncUi = () => {
458
+ var _a;
459
+ loading.hidden = !(state === 'loading' && !errorMessage);
460
+ error.hidden = state !== 'error';
461
+ errorText.textContent = errorMessage;
462
+ surface.classList.toggle('is-loading', state === 'loading');
463
+ const presenting = Boolean(viewer === null || viewer === void 0 ? void 0 : viewer.presenting);
464
+ slideshowButton.hidden = state !== 'ready' || ((_a = viewer === null || viewer === void 0 ? void 0 : viewer.slideCount) !== null && _a !== void 0 ? _a : 0) === 0;
465
+ slideshowText.textContent = presenting
466
+ ? t('presentation.slideshow.exit')
467
+ : t('presentation.slideshow.start');
468
+ slideshowButton.setAttribute('aria-pressed', presenting ? 'true' : 'false');
469
+ };
470
+ const registerExportAdapter = () => {
471
+ var _a;
472
+ (_a = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _a === void 0 ? void 0 : _a.call(context, buildExportAdapter(surface, targetWindow, () => viewer));
473
+ };
474
+ registerFileViewerZoomProvider(shell, {
475
+ zoomIn: () => setZoom(getCurrentZoomPercent() + 15),
476
+ zoomOut: () => setZoom(getCurrentZoomPercent() - 15),
477
+ resetZoom: () => setZoom(100),
478
+ setZoom: scale => setZoom(scale * 100),
479
+ getState: getZoomState,
480
+ subscribe: zoomEmitter.subscribe,
481
+ });
482
+ const openPresentation = async () => {
483
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
484
+ state = 'loading';
485
+ errorMessage = '';
486
+ progressiveReady = false;
487
+ syncUi();
488
+ const presentationOptions = (_a = context === null || context === void 0 ? void 0 : context.options) === null || _a === void 0 ? void 0 : _a.presentation;
489
+ let resolveCompletion;
490
+ let rejectCompletion;
491
+ const completion = new Promise((resolve, reject) => {
492
+ resolveCompletion = resolve;
493
+ rejectCompletion = reject;
494
+ });
495
+ // Abort/error may arrive while PptxViewer.open() is still resolving. Mark
496
+ // the completion promise handled immediately, then await the same promise
497
+ // below so cancellation cannot surface as a transient unhandled rejection.
498
+ void completion.catch(() => { });
499
+ const abort = () => {
500
+ var _a;
501
+ const reason = ((_a = context === null || context === void 0 ? void 0 : context.signal) === null || _a === void 0 ? void 0 : _a.reason) || new DOMException('PPTX rendering aborted.', 'AbortError');
502
+ viewer === null || viewer === void 0 ? void 0 : viewer.destroy();
503
+ viewer = null;
504
+ rejectCompletion(reason);
505
+ };
506
+ (_b = context === null || context === void 0 ? void 0 : context.signal) === null || _b === void 0 ? void 0 : _b.addEventListener('abort', abort, { once: true });
507
+ try {
508
+ if ((_c = context === null || context === void 0 ? void 0 : context.signal) === null || _c === void 0 ? void 0 : _c.aborted) {
509
+ throw context.signal.reason || new DOMException('PPTX rendering aborted.', 'AbortError');
510
+ }
511
+ const nextViewer = await PptxViewer.open(buffer, surface, {
512
+ styleRoot: resolvePptxStyleRoot(surface, context),
513
+ fitMode: 'contain',
514
+ zoomPercent,
515
+ // Keep the PPTX package's own worker fallback when the host did not
516
+ // configure a self-hosted worker. Resolving the generic default here
517
+ // would point Vite development at /vendor/pptx/pptx.worker.js, where
518
+ // the SPA fallback is HTML rather than worker JavaScript.
519
+ workerUrl: (presentationOptions === null || presentationOptions === void 0 ? void 0 : presentationOptions.workerUrl)
520
+ ? resolveFileViewerPresentationWorkerUrl(presentationOptions, resolveFileViewerRuntimeAssetBaseUrl(documentRef))
521
+ : undefined,
522
+ workerType: presentationOptions === null || presentationOptions === void 0 ? void 0 : presentationOptions.workerType,
523
+ zipLimits: RECOMMENDED_ZIP_LIMITS,
524
+ lazySlides: true,
525
+ lazyMedia: true,
526
+ listOptions: {
527
+ windowed: true,
528
+ initialSlides: 3,
529
+ batchSize: 4,
530
+ overscanViewport: 1.5,
531
+ },
532
+ presentationLabels: {
533
+ exit: t('presentation.slideshow.exit'),
534
+ hint: t('presentation.slideshow.hint'),
535
+ },
536
+ onPresentationChange: state => {
537
+ if (!disposed) {
538
+ if (state.active) {
539
+ activePptxShells.set(documentRef, shell);
540
+ }
541
+ syncUi();
542
+ }
543
+ },
544
+ onSlideRendered: () => notifyProgressiveReady(),
545
+ onRenderComplete: () => {
546
+ var _a;
547
+ if (disposed || ((_a = context === null || context === void 0 ? void 0 : context.signal) === null || _a === void 0 ? void 0 : _a.aborted)) {
548
+ return;
549
+ }
550
+ state = 'ready';
551
+ notifyProgressiveReady();
552
+ zoomPercent = getCurrentZoomPercent();
553
+ syncUi();
554
+ zoomEmitter.emit();
555
+ resolveCompletion();
556
+ },
557
+ onSlideError: (_index, error) => {
558
+ console.warn('PPTX slide render warning:', error);
559
+ },
560
+ onError: error => {
561
+ var _a, _b;
562
+ if (disposed || ((_a = context === null || context === void 0 ? void 0 : context.signal) === null || _a === void 0 ? void 0 : _a.aborted)) {
563
+ return;
564
+ }
565
+ state = 'error';
566
+ errorMessage = formatErrorMessage(error, t('presentation.error.parseFailed'), context);
567
+ (_b = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _b === void 0 ? void 0 : _b.call(context, null);
568
+ syncUi();
569
+ rejectCompletion(error);
570
+ },
571
+ });
572
+ if (disposed || ((_d = context === null || context === void 0 ? void 0 : context.signal) === null || _d === void 0 ? void 0 : _d.aborted)) {
573
+ nextViewer.destroy();
574
+ throw ((_e = context === null || context === void 0 ? void 0 : context.signal) === null || _e === void 0 ? void 0 : _e.reason) || new DOMException('PPTX rendering aborted.', 'AbortError');
575
+ }
576
+ viewer = nextViewer;
577
+ await completion;
578
+ if (disposed || ((_f = context === null || context === void 0 ? void 0 : context.signal) === null || _f === void 0 ? void 0 : _f.aborted)) {
579
+ throw ((_g = context === null || context === void 0 ? void 0 : context.signal) === null || _g === void 0 ? void 0 : _g.reason) || new DOMException('PPTX rendering aborted.', 'AbortError');
580
+ }
581
+ zoomPercent = getCurrentZoomPercent();
582
+ registerExportAdapter();
583
+ syncUi();
584
+ zoomEmitter.emit();
585
+ }
586
+ catch (error) {
587
+ if (disposed || ((_h = context === null || context === void 0 ? void 0 : context.signal) === null || _h === void 0 ? void 0 : _h.aborted)) {
588
+ throw error;
589
+ }
590
+ viewer === null || viewer === void 0 ? void 0 : viewer.destroy();
591
+ viewer = null;
592
+ state = 'error';
593
+ errorMessage = formatErrorMessage(error, t('presentation.error.parseFailed'), context);
594
+ (_j = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _j === void 0 ? void 0 : _j.call(context, null);
595
+ syncUi();
596
+ throw error;
597
+ }
598
+ finally {
599
+ (_k = context === null || context === void 0 ? void 0 : context.signal) === null || _k === void 0 ? void 0 : _k.removeEventListener('abort', abort);
600
+ }
601
+ };
602
+ const cleanup = () => {
603
+ var _a, _b;
604
+ if (disposed) {
605
+ return;
606
+ }
607
+ disposed = true;
608
+ documentRef.removeEventListener('keydown', handleShortcut);
609
+ documentRef.removeEventListener('pointerdown', deactivateShell);
610
+ documentRef.removeEventListener('focusin', deactivateShell);
611
+ shell.removeEventListener('pointerdown', activateShell);
612
+ shell.removeEventListener('focusin', activateShell);
613
+ if (activePptxShells.get(documentRef) === shell) {
614
+ activePptxShells.delete(documentRef);
615
+ }
616
+ (_a = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _a === void 0 ? void 0 : _a.call(context, null);
617
+ (_b = context === null || context === void 0 ? void 0 : context.registerThumbnailAdapter) === null || _b === void 0 ? void 0 : _b.call(context, null);
618
+ unregisterFileViewerZoomProvider(shell);
619
+ viewer === null || viewer === void 0 ? void 0 : viewer.destroy();
620
+ viewer = null;
621
+ target.replaceChildren();
622
+ };
623
+ try {
624
+ await openPresentation();
625
+ }
626
+ catch (error) {
627
+ cleanup();
628
+ throw error;
629
+ }
630
+ return {
631
+ $el: shell,
632
+ unmount: cleanup,
633
+ };
634
+ }
635
+ const presentationDefinition = DEFAULT_RENDERER_DEFINITIONS.find(definition => definition.id === 'office-presentation');
636
+ if (!presentationDefinition) {
637
+ throw new Error('@file-viewer/renderer-pptx could not locate the core PPTX renderer definition.');
638
+ }
639
+ export const presentationRendererDefinition = presentationDefinition;
640
+ export const renderFileViewerPresentation = renderPptx;
641
+ export const pptxRenderer = {
642
+ id: 'file-viewer-renderer-presentation-pptx',
643
+ label: 'Flyfish File Viewer PPTX renderer',
644
+ definitions: [presentationRendererDefinition],
645
+ handlers: [
646
+ {
647
+ rendererId: presentationRendererDefinition.id,
648
+ handler: renderFileViewerPresentation,
649
+ },
650
+ ],
651
+ };
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "../../../ecosystem/capability-manifest.schema.json",
3
+ "schemaVersion": 1,
4
+ "id": "presentation-openxml",
5
+ "packageName": "@file-viewer/renderer-pptx",
6
+ "rendererIds": ["office-presentation"],
7
+ "formats": ["pptx", "pptm", "potx", "potm", "ppsx", "ppsm"],
8
+ "assets": {
9
+ "rendererIds": ["office-presentation"],
10
+ "packageName": "@file-viewer/assets-standard",
11
+ "bin": "file-viewer-assets-standard",
12
+ "apiExport": "installFileViewerStandardAssets",
13
+ "target": "public/file-viewer",
14
+ "copyGroups": ["office-presentation"],
15
+ "copyMode": "profile-pack",
16
+ "receiptFilename": "file-viewer-assets-standard.receipt.json",
17
+ "notice": "Native PPTX parsing Worker."
18
+ },
19
+ "license": { "spdx": "Apache-2.0", "policy": "permissive" },
20
+ "weight": "standard",
21
+ "profiles": ["standard", "office", "all"]
22
+ }
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@file-viewer/renderer-pptx",
3
+ "version": "3.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Standalone OpenXML PowerPoint renderer for PPTX, PPTM, POTX, POTM, PPSX, and PPSM files.",
7
+ "keywords": [
8
+ "file-viewer",
9
+ "renderer",
10
+ "pptx",
11
+ "presentation",
12
+ "document-preview",
13
+ "powerpoint",
14
+ "self-hosted"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
20
+ "author": {
21
+ "name": "Yu Wang",
22
+ "email": "admin@flyfish.dev"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/flyfish-dev/file-viewer.git",
27
+ "directory": "packages/renderers/presentation-pptx"
28
+ },
29
+ "homepage": "https://doc.file-viewer.app/guide/on-demand-renderers",
30
+ "bugs": {
31
+ "url": "https://github.com/flyfish-dev/file-viewer/issues"
32
+ },
33
+ "funding": {
34
+ "type": "individual",
35
+ "url": "https://dev.flyfish.group/donate?source=npm"
36
+ },
37
+ "main": "./dist/index.js",
38
+ "module": "./dist/index.js",
39
+ "types": "./dist/index.d.ts",
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/index.d.ts",
43
+ "import": "./dist/index.js",
44
+ "default": "./dist/index.js"
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
48
+ "files": [
49
+ "dist",
50
+ "file-viewer.capability.json",
51
+ "README.md",
52
+ "README.en.md",
53
+ "LICENSE"
54
+ ],
55
+ "dependencies": {
56
+ "@file-viewer/core": "3.0.0",
57
+ "@file-viewer/pptx": "3.0.0"
58
+ },
59
+ "devDependencies": {
60
+ "typescript": "^6.0.3"
61
+ },
62
+ "fileViewer": {
63
+ "capabilityManifest": "./file-viewer.capability.json"
64
+ },
65
+ "license": "Apache-2.0",
66
+ "scripts": {
67
+ "build": "tsc -b tsconfig.json",
68
+ "type-check": "tsc -b tsconfig.json"
69
+ }
70
+ }