@file-viewer/renderer-data 2.0.11

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,44 @@
1
+ # @file-viewer/renderer-data
2
+
3
+ Standalone data asset renderer for Flyfish File Viewer. It covers PSD, SQLite, Parquet, Avro, WASM, fonts, AI/EPS, WebArchive, and other non-document data assets without forcing regular document preview users to install data parsing dependencies.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import FileViewer from '@file-viewer/vue3'
9
+ import { dataRenderer } from '@file-viewer/renderer-data'
10
+
11
+ const options = {
12
+ rendererMode: 'replace',
13
+ renderers: dataRenderer,
14
+ }
15
+ ```
16
+
17
+ You can compose it with other renderers:
18
+
19
+ ```ts
20
+ import { dataRenderer } from '@file-viewer/renderer-data'
21
+ import { textRenderer } from '@file-viewer/renderer-text'
22
+
23
+ const options = {
24
+ rendererMode: 'replace',
25
+ renderers: [dataRenderer, textRenderer],
26
+ }
27
+ ```
28
+
29
+ ## Offline Assets
30
+
31
+ SQLite preview depends on the `sql.js` WASM file. The default URL is still resolved through `@file-viewer/core/assets` as `wasm/data/sql-wasm.wasm`, and applications can override it through `options.data.sqlWasmUrl`.
32
+
33
+ ## Migration Notes
34
+
35
+ `@file-viewer/core` no longer bundles the data asset renderer and no longer installs `ag-psd`, `sql.js`, `hyparquet`, or `avsc` by default. Install this package explicitly, or use `@file-viewer/preset-all`, when you need PSD, SQLite, Parquet, Avro, WASM, font, AI, EPS, or WebArchive previews.
36
+
37
+ ## Scope
38
+
39
+ - PSD uses `ag-psd` for canvas and layer previews with layer visibility toggles, redraw, and unified zoom.
40
+ - SQLite uses `sql.js` for table metadata and sample rows.
41
+ - Parquet uses `hyparquet` for column metadata and sample rows.
42
+ - Avro uses `avsc` for object container schema and sample data.
43
+ - WASM uses browser `WebAssembly.Module` to inspect imports and exports safely.
44
+ - AI/EPS/WebArchive fall back to safe summaries and readable text snippets without executing scripts.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # @file-viewer/renderer-data
2
+
3
+ Flyfish File Viewer 的独立数据资产 renderer 包。它承接 PSD、SQLite、Parquet、Avro、WASM、字体、AI/EPS、WebArchive 等非文档型数据资产预览,避免普通文档预览场景安装数据解析链路。
4
+
5
+ ## 用法
6
+
7
+ ```ts
8
+ import FileViewer from '@file-viewer/vue3'
9
+ import { dataRenderer } from '@file-viewer/renderer-data'
10
+
11
+ const options = {
12
+ rendererMode: 'replace',
13
+ renderers: dataRenderer,
14
+ }
15
+ ```
16
+
17
+ 也可以和其他 renderer 一起组合:
18
+
19
+ ```ts
20
+ import { dataRenderer } from '@file-viewer/renderer-data'
21
+ import { textRenderer } from '@file-viewer/renderer-text'
22
+
23
+ const options = {
24
+ rendererMode: 'replace',
25
+ renderers: [dataRenderer, textRenderer],
26
+ }
27
+ ```
28
+
29
+ ## 离线资产
30
+
31
+ SQLite 预览依赖 `sql.js` WASM。默认路径仍由 `@file-viewer/core/assets` 统一解析为 `wasm/data/sql-wasm.wasm`,也可以通过 `options.data.sqlWasmUrl` 指定自托管地址。
32
+
33
+ ## 迁移说明
34
+
35
+ `@file-viewer/core` 已不再内置数据资产 renderer,也不再默认安装 `ag-psd`、`sql.js`、`hyparquet` 和 `avsc`。需要 PSD / SQLite / Parquet / Avro / WASM / 字体 / AI / EPS / WebArchive 预览时,请显式安装本包,或使用 `@file-viewer/preset-all` 聚合能力。
36
+
37
+ ## 能力边界
38
+
39
+ - PSD 使用 `ag-psd` 读取画布和图层,支持图层选择显隐、重绘和统一缩放。
40
+ - SQLite 使用 `sql.js` 读取表结构和首个表的示例数据。
41
+ - Parquet 使用 `hyparquet` 读取列式元数据和示例行。
42
+ - Avro 使用 `avsc` 读取对象容器 schema 与示例数据。
43
+ - WASM 使用浏览器 `WebAssembly.Module` 安全读取 import/export 摘要。
44
+ - AI/EPS/WebArchive 等格式以摘要和可读文本片段安全展示,不执行脚本。
package/dist/data.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { FileRenderContext, FileViewerRenderedInstance } from '@file-viewer/core';
2
+ declare global {
3
+ interface Window {
4
+ __FLYFISH_DATA_SQL_WASM_URL__?: string;
5
+ }
6
+ }
7
+ export default function renderDataAsset(buffer: ArrayBuffer, target: HTMLDivElement, type?: string, context?: FileRenderContext): Promise<FileViewerRenderedInstance>;
package/dist/data.js ADDED
@@ -0,0 +1,334 @@
1
+ import { resolveFileViewerDataSqlWasmUrl } from '@file-viewer/core/assets';
2
+ const dataStyle = `
3
+ .data-viewer{min-height:100%;padding:28px;background:#eef1f4;color:#132235}
4
+ .data-card{max-width:1080px;margin:0 auto;overflow:hidden;border:1px solid rgba(15,23,42,.08);border-radius:8px;background:#fff;box-shadow:0 18px 48px rgba(15,23,42,.12)}
5
+ .data-header{padding:20px 24px;border-bottom:1px solid rgba(15,23,42,.08)}
6
+ .data-header span{color:#0f766e;font-size:12px;font-weight:800}
7
+ .data-header h2{margin:6px 0 0;font-size:24px}
8
+ .data-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1px;background:rgba(15,23,42,.08)}
9
+ .data-summary div{min-width:0;padding:15px 18px;background:#f8fafc}
10
+ .data-summary span{display:block;color:#64748b;font-size:12px}
11
+ .data-summary strong{display:block;margin-top:5px;overflow:hidden;color:#132235;font-size:15px;text-overflow:ellipsis;white-space:nowrap}
12
+ .font-preview{padding:34px 28px;border-top:1px solid rgba(15,23,42,.08);font-size:42px;line-height:1.45;word-break:break-word}
13
+ .asset-image{padding:24px;border-top:1px solid rgba(15,23,42,.08);background:#f8fafc;text-align:center}
14
+ .asset-image img{max-width:100%;max-height:70vh;box-shadow:0 10px 30px rgba(15,23,42,.16)}
15
+ .asset-text{margin:0;padding:18px 24px;overflow:auto;border-top:1px solid rgba(15,23,42,.08);background:#111827;color:#e5e7eb;font-size:13px;line-height:1.7}
16
+ .data-table-wrap{max-height:520px;overflow:auto;border-top:1px solid rgba(15,23,42,.08)}
17
+ .data-table{width:100%;border-collapse:collapse;font-size:13px}
18
+ .data-table th,.data-table td{max-width:260px;padding:10px 12px;border-bottom:1px solid rgba(15,23,42,.08);overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}
19
+ .data-table th{position:sticky;top:0;background:#f8fafc;color:#64748b;z-index:1}
20
+ `;
21
+ const fontMimeMap = {
22
+ otf: 'font/otf',
23
+ ttf: 'font/ttf',
24
+ woff: 'font/woff',
25
+ woff2: 'font/woff2',
26
+ };
27
+ const sampleText = 'Flyfish Viewer 轻量预览 AaBbCc 1234567890';
28
+ const createStyle = (documentRef) => {
29
+ const style = documentRef.createElement('style');
30
+ style.textContent = dataStyle;
31
+ return style;
32
+ };
33
+ const createElement = (documentRef, tagName, className, text) => {
34
+ const element = documentRef.createElement(tagName);
35
+ if (className) {
36
+ element.className = className;
37
+ }
38
+ if (text !== undefined) {
39
+ element.textContent = text;
40
+ }
41
+ return element;
42
+ };
43
+ const formatBytes = (value) => {
44
+ if (value < 1024) {
45
+ return `${value} B`;
46
+ }
47
+ if (value < 1024 * 1024) {
48
+ return `${(value / 1024).toFixed(1)} KB`;
49
+ }
50
+ return `${(value / 1024 / 1024).toFixed(1)} MB`;
51
+ };
52
+ const makeRows = (rows) => {
53
+ return rows.slice(0, 30).map(row => {
54
+ const next = {};
55
+ Object.entries(row).slice(0, 24).forEach(([key, value]) => {
56
+ if (typeof value === 'bigint') {
57
+ next[key] = value.toString();
58
+ }
59
+ else if (value instanceof Uint8Array) {
60
+ next[key] = `[bytes:${value.byteLength}]`;
61
+ }
62
+ else if (value && typeof value === 'object') {
63
+ next[key] = JSON.stringify(value).slice(0, 180);
64
+ }
65
+ else {
66
+ next[key] = value;
67
+ }
68
+ });
69
+ return next;
70
+ });
71
+ };
72
+ const extractReadableText = (buffer, max = 8000) => {
73
+ const bytes = new Uint8Array(buffer);
74
+ const ascii = Array.from(bytes.slice(0, Math.min(bytes.length, max)))
75
+ .map(byte => (byte >= 32 && byte <= 126) || byte === 10 || byte === 13 || byte === 9
76
+ ? String.fromCharCode(byte)
77
+ : ' ')
78
+ .join('')
79
+ .replace(/[ \t]{3,}/g, ' ');
80
+ return ascii.trim().slice(0, max);
81
+ };
82
+ const readMagic = (buffer, length = 12) => {
83
+ return String.fromCharCode(...new Uint8Array(buffer.slice(0, length)));
84
+ };
85
+ const getWindowSqlWasmOverride = (documentRef) => {
86
+ return documentRef.defaultView?.__FLYFISH_DATA_SQL_WASM_URL__ ||
87
+ (typeof window !== 'undefined' ? window.__FLYFISH_DATA_SQL_WASM_URL__ : undefined);
88
+ };
89
+ const renderFont = async (documentRef, buffer, type) => {
90
+ const family = `FlyfishPreviewFont-${Date.now()}-${Math.random().toString(36).slice(2)}`;
91
+ const ownerWindow = documentRef.defaultView || (typeof window !== 'undefined' ? window : undefined);
92
+ const FontFaceConstructor = ownerWindow?.FontFace || (typeof FontFace !== 'undefined' ? FontFace : undefined);
93
+ if (!FontFaceConstructor) {
94
+ throw new Error('当前浏览器不支持 FontFace API');
95
+ }
96
+ const face = new FontFaceConstructor(family, buffer);
97
+ await face.load();
98
+ documentRef.fonts?.add(face);
99
+ return {
100
+ title: '字体文件预览',
101
+ fontFamily: family,
102
+ summary: [
103
+ { label: '格式', value: type.toUpperCase() },
104
+ { label: '大小', value: formatBytes(buffer.byteLength) },
105
+ { label: '渲染方式', value: 'Browser FontFace API' },
106
+ ],
107
+ };
108
+ };
109
+ const renderSqlite = async (documentRef, buffer, context) => {
110
+ const { default: initSqlJs } = await import('sql.js');
111
+ const sqlWasmUrl = resolveFileViewerDataSqlWasmUrl(context?.options?.data, [
112
+ getWindowSqlWasmOverride(documentRef),
113
+ ], documentRef.baseURI);
114
+ const SQL = await initSqlJs({ locateFile: () => sqlWasmUrl });
115
+ const db = new SQL.Database(new Uint8Array(buffer));
116
+ try {
117
+ const tableResult = db.exec("select name, type from sqlite_master where type in ('table','view') and name not like 'sqlite_%' order by type, name");
118
+ const tables = tableResult[0]?.values || [];
119
+ const firstTable = String(tables[0]?.[0] || '');
120
+ const rows = firstTable
121
+ ? db.exec(`select * from "${firstTable.replace(/"/g, '""')}" limit 30`)[0]
122
+ : null;
123
+ return {
124
+ title: 'SQLite 数据库预览',
125
+ summary: [
126
+ { label: '对象数', value: String(tables.length) },
127
+ { label: '示例表', value: firstTable || '-' },
128
+ { label: '渲染方式', value: 'sql.js WASM' },
129
+ ],
130
+ rows: rows
131
+ ? makeRows(rows.values.map((values) => Object.fromEntries(rows.columns.map((column, index) => [column, values[index]]))))
132
+ : makeRows(tables.map((value) => ({ name: value[0], type: value[1] }))),
133
+ };
134
+ }
135
+ finally {
136
+ db.close();
137
+ }
138
+ };
139
+ const renderParquet = async (buffer) => {
140
+ const { parquetMetadataAsync, parquetReadObjects } = await import('hyparquet');
141
+ const file = {
142
+ byteLength: buffer.byteLength,
143
+ slice: (start, end) => buffer.slice(start, end),
144
+ };
145
+ const metadata = await parquetMetadataAsync(file);
146
+ const rows = await parquetReadObjects({ file, rowFormat: 'object', rowEnd: 30 });
147
+ return {
148
+ title: 'Parquet 列式数据预览',
149
+ summary: [
150
+ { label: '行数', value: metadata.num_rows?.toString?.() || '-' },
151
+ { label: '列数', value: String(metadata.schema?.filter(item => item.name).length || 0) },
152
+ { label: '渲染方式', value: 'hyparquet' },
153
+ ],
154
+ rows: makeRows(rows),
155
+ };
156
+ };
157
+ const renderAvro = async (buffer) => {
158
+ const avro = await import('avsc/etc/browser/avsc.js');
159
+ const decoder = avro.createBlobDecoder(new Blob([buffer]));
160
+ const rows = [];
161
+ let schema = '';
162
+ await new Promise((resolve, reject) => {
163
+ decoder.on('metadata', (type) => {
164
+ schema = type?.toString?.() || '';
165
+ });
166
+ decoder.on('data', (value) => {
167
+ if (rows.length < 30) {
168
+ rows.push(value);
169
+ }
170
+ });
171
+ decoder.on('end', resolve);
172
+ decoder.on('error', reject);
173
+ });
174
+ return {
175
+ title: 'Avro 对象容器预览',
176
+ summary: [
177
+ { label: '示例行', value: String(rows.length) },
178
+ { label: 'Schema', value: schema ? '已读取' : '未读取' },
179
+ { label: '渲染方式', value: 'avsc' },
180
+ ],
181
+ rows: makeRows(rows),
182
+ text: schema.slice(0, 6000),
183
+ };
184
+ };
185
+ const renderWasm = async (buffer) => {
186
+ const module = await WebAssembly.compile(buffer.slice(0));
187
+ const imports = WebAssembly.Module.imports(module);
188
+ const exports = WebAssembly.Module.exports(module);
189
+ return {
190
+ title: 'WebAssembly 模块预览',
191
+ summary: [
192
+ { label: '导入', value: String(imports.length) },
193
+ { label: '导出', value: String(exports.length) },
194
+ { label: '渲染方式', value: 'WebAssembly.Module' },
195
+ ],
196
+ rows: makeRows([
197
+ ...imports.map(item => ({ kind: 'import', module: item.module, name: item.name, type: item.kind })),
198
+ ...exports.map(item => ({ kind: 'export', module: '-', name: item.name, type: item.kind })),
199
+ ]),
200
+ };
201
+ };
202
+ const renderPostScriptLike = async (buffer, type) => ({
203
+ title: type === 'eps' ? 'EPS 矢量文件摘要' : 'Illustrator 文件摘要',
204
+ summary: [
205
+ { label: 'Magic', value: readMagic(buffer).replace(/\s/g, ' ') },
206
+ { label: '大小', value: formatBytes(buffer.byteLength) },
207
+ { label: '说明', value: type === 'ai' ? '非 PDF-compatible AI 按摘要展示' : 'PostScript 摘要展示' },
208
+ ],
209
+ text: extractReadableText(buffer),
210
+ });
211
+ const renderWebArchive = async (buffer) => ({
212
+ title: 'WebArchive 摘要预览',
213
+ summary: [
214
+ { label: '容器', value: readMagic(buffer).startsWith('bplist') ? 'Binary plist' : 'WebArchive' },
215
+ { label: '大小', value: formatBytes(buffer.byteLength) },
216
+ { label: '说明', value: '安全提取可读片段,不执行网页脚本' },
217
+ ],
218
+ text: extractReadableText(buffer),
219
+ });
220
+ const buildPreview = async (documentRef, buffer, type, context) => {
221
+ if (type in fontMimeMap) {
222
+ return renderFont(documentRef, buffer, type);
223
+ }
224
+ if (type === 'sqlite') {
225
+ return renderSqlite(documentRef, buffer, context);
226
+ }
227
+ if (type === 'parquet') {
228
+ return renderParquet(buffer);
229
+ }
230
+ if (type === 'avro') {
231
+ return renderAvro(buffer);
232
+ }
233
+ if (type === 'wasm') {
234
+ return renderWasm(buffer);
235
+ }
236
+ if (type === 'ai' || type === 'eps') {
237
+ return renderPostScriptLike(buffer, type);
238
+ }
239
+ if (type === 'webarchive') {
240
+ return renderWebArchive(buffer);
241
+ }
242
+ return {
243
+ title: '数据资产摘要',
244
+ summary: [
245
+ { label: '格式', value: type.toUpperCase() },
246
+ { label: '大小', value: formatBytes(buffer.byteLength) },
247
+ ],
248
+ text: extractReadableText(buffer),
249
+ };
250
+ };
251
+ const appendSummary = (documentRef, parent, summary) => {
252
+ const summaryRoot = createElement(documentRef, 'div', 'data-summary');
253
+ summary.forEach(item => {
254
+ const cell = createElement(documentRef, 'div');
255
+ cell.append(createElement(documentRef, 'span', undefined, item.label), createElement(documentRef, 'strong', undefined, item.value));
256
+ summaryRoot.appendChild(cell);
257
+ });
258
+ parent.appendChild(summaryRoot);
259
+ };
260
+ const appendRows = (documentRef, parent, rows) => {
261
+ if (!rows?.length) {
262
+ return;
263
+ }
264
+ const keys = Object.keys(rows[0]);
265
+ const wrap = createElement(documentRef, 'div', 'data-table-wrap');
266
+ const table = createElement(documentRef, 'table', 'data-table');
267
+ const thead = createElement(documentRef, 'thead');
268
+ const headRow = createElement(documentRef, 'tr');
269
+ keys.forEach(key => {
270
+ headRow.appendChild(createElement(documentRef, 'th', undefined, key));
271
+ });
272
+ thead.appendChild(headRow);
273
+ const tbody = createElement(documentRef, 'tbody');
274
+ rows.forEach(row => {
275
+ const tr = createElement(documentRef, 'tr');
276
+ keys.forEach(key => {
277
+ tr.appendChild(createElement(documentRef, 'td', undefined, String(row[key] ?? '')));
278
+ });
279
+ tbody.appendChild(tr);
280
+ });
281
+ table.append(thead, tbody);
282
+ wrap.appendChild(table);
283
+ parent.appendChild(wrap);
284
+ };
285
+ const renderPreviewDom = (documentRef, preview, type) => {
286
+ const root = createElement(documentRef, 'div', 'data-viewer');
287
+ const card = createElement(documentRef, 'section', 'data-card');
288
+ const header = createElement(documentRef, 'header', 'data-header');
289
+ header.append(createElement(documentRef, 'span', undefined, type.toUpperCase()), createElement(documentRef, 'h2', undefined, preview.title));
290
+ card.appendChild(header);
291
+ appendSummary(documentRef, card, preview.summary);
292
+ if (preview.fontFamily) {
293
+ const fontPreview = createElement(documentRef, 'div', 'font-preview', sampleText);
294
+ fontPreview.style.fontFamily = preview.fontFamily;
295
+ card.appendChild(fontPreview);
296
+ }
297
+ if (preview.image) {
298
+ const imageWrap = createElement(documentRef, 'div', 'asset-image');
299
+ const image = createElement(documentRef, 'img');
300
+ image.src = preview.image;
301
+ image.alt = '资产预览';
302
+ imageWrap.appendChild(image);
303
+ card.appendChild(imageWrap);
304
+ }
305
+ if (preview.text) {
306
+ card.appendChild(createElement(documentRef, 'pre', 'asset-text', preview.text));
307
+ }
308
+ appendRows(documentRef, card, preview.rows);
309
+ root.appendChild(card);
310
+ return root;
311
+ };
312
+ export default async function renderDataAsset(buffer, target, type = 'bin', context) {
313
+ const documentRef = target.ownerDocument || document;
314
+ const normalizedType = type.toLowerCase();
315
+ if (normalizedType === 'ai' && readMagic(buffer, 5) === '%PDF-' && context?.renderNestedBuffer) {
316
+ const rendered = await context.renderNestedBuffer(buffer, 'pdf', target, context);
317
+ if (rendered) {
318
+ return rendered;
319
+ }
320
+ }
321
+ if (normalizedType === 'psd') {
322
+ const { default: renderPsdAsset } = await import('./psd.js');
323
+ return renderPsdAsset(buffer, target);
324
+ }
325
+ const preview = await buildPreview(documentRef, buffer, normalizedType, context);
326
+ const root = renderPreviewDom(documentRef, preview, normalizedType);
327
+ target.replaceChildren(createStyle(documentRef), root);
328
+ return {
329
+ $el: root,
330
+ unmount() {
331
+ target.replaceChildren();
332
+ },
333
+ };
334
+ }
@@ -0,0 +1,5 @@
1
+ import { type FileRenderHandler, type FileViewerRenderedInstance, type FileViewerRendererPlugin, type RendererDefinition } from '@file-viewer/core';
2
+ export declare const dataRendererDefinition: RendererDefinition;
3
+ export declare const renderFileViewerData: FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>;
4
+ export declare const dataRenderer: FileViewerRendererPlugin<FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>>;
5
+ export default dataRenderer;
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ import { DEFAULT_RENDERER_DEFINITIONS, } from '@file-viewer/core';
2
+ const dataDefinition = DEFAULT_RENDERER_DEFINITIONS.find(definition => definition.id === 'data-asset');
3
+ if (!dataDefinition) {
4
+ throw new Error('@file-viewer/renderer-data could not locate the shared data asset renderer definition.');
5
+ }
6
+ export const dataRendererDefinition = dataDefinition;
7
+ export const renderFileViewerData = (buffer, target, type, context) => import('./data.js').then(({ default: renderDataAsset }) => renderDataAsset(buffer, target, type, context));
8
+ export const dataRenderer = {
9
+ id: 'file-viewer-renderer-data',
10
+ label: 'Flyfish File Viewer data asset renderer',
11
+ definitions: [dataRendererDefinition],
12
+ handlers: [{
13
+ rendererId: dataRendererDefinition.id,
14
+ handler: renderFileViewerData,
15
+ }],
16
+ };
17
+ export default dataRenderer;
package/dist/psd.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { type FileViewerRenderedInstance } from '@file-viewer/core';
2
+ export default function renderPsdAsset(buffer: ArrayBuffer, target: HTMLDivElement): Promise<FileViewerRenderedInstance>;
package/dist/psd.js ADDED
@@ -0,0 +1,247 @@
1
+ import { createFileViewerZoomChangeEmitter, registerFileViewerZoomProvider, unregisterFileViewerZoomProvider } from '@file-viewer/core';
2
+ const psdStyle = `
3
+ .psd-viewer{display:grid;height:100%;min-height:460px;grid-template-rows:auto minmax(0,1fr);--psd-bg:#eef1f4;--psd-surface:#fff;--psd-border:rgba(15,23,42,.1);--psd-text:#132235;--psd-muted:#64748b;--psd-accent:#0f766e;background:var(--psd-bg);color:var(--psd-text);box-sizing:border-box}
4
+ .psd-toolbar{position:sticky;top:0;z-index:2;display:flex;min-height:52px;align-items:center;justify-content:space-between;gap:14px;padding:10px 16px;border-bottom:1px solid var(--psd-border);background:rgba(255,255,255,.92);backdrop-filter:blur(12px);box-sizing:border-box}
5
+ .psd-title{display:flex;min-width:0;flex-direction:column;gap:2px}
6
+ .psd-title strong{overflow:hidden;font-size:14px;text-overflow:ellipsis;white-space:nowrap}
7
+ .psd-title span{color:var(--psd-muted);font-size:12px;font-weight:700}
8
+ .psd-actions{display:flex;flex-shrink:0;align-items:center;gap:6px}
9
+ .psd-actions button{height:30px;min-width:34px;border:1px solid rgba(100,116,139,.28);border-radius:6px;background:#fff;color:#132235;cursor:pointer;font-size:12px;font-weight:800}
10
+ .psd-actions button:hover{border-color:rgba(15,118,110,.45);color:var(--psd-accent)}
11
+ .psd-actions span{min-width:48px;color:var(--psd-muted);font-size:12px;font-weight:800;text-align:center}
12
+ .psd-layout{display:grid;min-height:0;grid-template-columns:280px minmax(0,1fr)}
13
+ .psd-sidebar{min-height:0;overflow:auto;border-right:1px solid var(--psd-border);background:rgba(248,250,252,.86)}
14
+ .psd-sidebar-header{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px;border-bottom:1px solid var(--psd-border);background:rgba(248,250,252,.94);font-size:12px;font-weight:800}
15
+ .psd-layer-list{margin:0;padding:8px;list-style:none}
16
+ .psd-layer{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:start;margin:0 0 6px;padding:8px;border:1px solid transparent;border-radius:8px;background:#fff}
17
+ .psd-layer:hover{border-color:rgba(15,118,110,.24)}
18
+ .psd-layer input{margin-top:2px;accent-color:var(--psd-accent)}
19
+ .psd-layer strong{display:block;overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap}
20
+ .psd-layer span{display:block;margin-top:3px;color:var(--psd-muted);font-size:11px}
21
+ .psd-stage{min-width:0;min-height:0;overflow:auto;padding:28px}
22
+ .psd-canvas-wrap{display:inline-block;transform-origin:top left;transition:transform .18s ease}
23
+ .psd-canvas-shell{display:inline-block;padding:18px;border:1px solid var(--psd-border);border-radius:8px;background:
24
+ linear-gradient(45deg,#e5e7eb 25%,transparent 25%),
25
+ linear-gradient(-45deg,#e5e7eb 25%,transparent 25%),
26
+ linear-gradient(45deg,transparent 75%,#e5e7eb 75%),
27
+ linear-gradient(-45deg,transparent 75%,#e5e7eb 75%);
28
+ background-color:#fff;background-position:0 0,0 10px,10px -10px,-10px 0;background-size:20px 20px;box-shadow:0 18px 48px rgba(15,23,42,.14)}
29
+ .psd-canvas-shell canvas{display:block;max-width:none;background:transparent}
30
+ .psd-empty{padding:20px;color:var(--psd-muted);font-weight:700}
31
+ .file-viewer[data-viewer-theme='dark'] .psd-viewer{--psd-bg:#0d1117;--psd-surface:#161b22;--psd-border:rgba(139,148,158,.24);--psd-text:#e6edf3;--psd-muted:#8b949e}
32
+ .file-viewer[data-viewer-theme='dark'] .psd-toolbar{background:rgba(13,17,23,.92)}
33
+ .file-viewer[data-viewer-theme='dark'] .psd-sidebar,.file-viewer[data-viewer-theme='dark'] .psd-sidebar-header{background:rgba(22,27,34,.92)}
34
+ .file-viewer[data-viewer-theme='dark'] .psd-layer,.file-viewer[data-viewer-theme='dark'] .psd-actions button{background:#161b22;color:#e6edf3}
35
+ @media (prefers-color-scheme:dark){.file-viewer[data-viewer-theme='system'] .psd-viewer{--psd-bg:#0d1117;--psd-surface:#161b22;--psd-border:rgba(139,148,158,.24);--psd-text:#e6edf3;--psd-muted:#8b949e}.file-viewer[data-viewer-theme='system'] .psd-toolbar{background:rgba(13,17,23,.92)}.file-viewer[data-viewer-theme='system'] .psd-sidebar,.file-viewer[data-viewer-theme='system'] .psd-sidebar-header{background:rgba(22,27,34,.92)}.file-viewer[data-viewer-theme='system'] .psd-layer,.file-viewer[data-viewer-theme='system'] .psd-actions button{background:#161b22;color:#e6edf3}}
36
+ @media (max-width:760px){.psd-layout{grid-template-columns:1fr}.psd-sidebar{max-height:240px;border-right:0;border-bottom:1px solid var(--psd-border)}.psd-stage{padding:14px}}
37
+ `;
38
+ const createElement = (documentRef, tagName, className, text) => {
39
+ const element = documentRef.createElement(tagName);
40
+ if (className) {
41
+ element.className = className;
42
+ }
43
+ if (typeof text === 'string') {
44
+ element.textContent = text;
45
+ }
46
+ return element;
47
+ };
48
+ const createStyle = (documentRef) => {
49
+ const style = documentRef.createElement('style');
50
+ style.textContent = psdStyle;
51
+ return style;
52
+ };
53
+ const toCanvas = (documentRef, source) => {
54
+ if (!source) {
55
+ return undefined;
56
+ }
57
+ const ownerWindow = documentRef.defaultView || (typeof window !== 'undefined' ? window : undefined);
58
+ if (ownerWindow && source instanceof ownerWindow.HTMLCanvasElement) {
59
+ return source;
60
+ }
61
+ if (ownerWindow && source instanceof ownerWindow.ImageData) {
62
+ const canvas = documentRef.createElement('canvas');
63
+ canvas.width = source.width;
64
+ canvas.height = source.height;
65
+ canvas.getContext('2d')?.putImageData(source, 0, 0);
66
+ return canvas;
67
+ }
68
+ if (typeof source === 'object' &&
69
+ 'data' in source &&
70
+ 'width' in source &&
71
+ 'height' in source) {
72
+ const pixelData = source;
73
+ const canvas = documentRef.createElement('canvas');
74
+ canvas.width = pixelData.width;
75
+ canvas.height = pixelData.height;
76
+ const clamped = new Uint8ClampedArray(pixelData.data.length);
77
+ clamped.set(pixelData.data);
78
+ const ImageDataConstructor = ownerWindow?.ImageData || ImageData;
79
+ canvas.getContext('2d')?.putImageData(new ImageDataConstructor(clamped, pixelData.width, pixelData.height), 0, 0);
80
+ return canvas;
81
+ }
82
+ return undefined;
83
+ };
84
+ const flattenLayers = (documentRef, layers, depth = 0, path = '') => {
85
+ if (!Array.isArray(layers)) {
86
+ return [];
87
+ }
88
+ return layers.flatMap((layer, index) => {
89
+ const name = String(layer.name || `Layer ${index + 1}`);
90
+ const id = `${path}${index}`;
91
+ const canvas = toCanvas(documentRef, layer.canvas || layer.imageData);
92
+ const item = {
93
+ id,
94
+ name,
95
+ depth,
96
+ left: Number(layer.left || 0),
97
+ top: Number(layer.top || 0),
98
+ width: Math.max(0, Number(layer.right || 0) - Number(layer.left || 0)),
99
+ height: Math.max(0, Number(layer.bottom || 0) - Number(layer.top || 0)),
100
+ hidden: Boolean(layer.hidden),
101
+ canvas
102
+ };
103
+ return [item, ...flattenLayers(documentRef, layer.children, depth + 1, `${id}.`)];
104
+ });
105
+ };
106
+ const clampZoom = (value) => {
107
+ return Math.min(4, Math.max(0.1, Number(value.toFixed(2))));
108
+ };
109
+ export default async function renderPsdAsset(buffer, target) {
110
+ const documentRef = target.ownerDocument || document;
111
+ const { readPsd } = await import('ag-psd');
112
+ const psd = readPsd(buffer, { useImageData: true });
113
+ const compositeCanvas = toCanvas(documentRef, psd.canvas || psd.imageData);
114
+ const layers = flattenLayers(documentRef, psd.children);
115
+ const drawableLayers = layers.filter(layer => layer.canvas);
116
+ const selected = new Set(drawableLayers.filter(layer => !layer.hidden).map(layer => layer.id));
117
+ let zoom = 1;
118
+ const zoomEmitter = createFileViewerZoomChangeEmitter();
119
+ const root = createElement(documentRef, 'div', 'psd-viewer');
120
+ root.dataset.viewerZoomProvider = 'psd';
121
+ const toolbar = createElement(documentRef, 'div', 'psd-toolbar');
122
+ const title = createElement(documentRef, 'div', 'psd-title');
123
+ title.append(createElement(documentRef, 'strong', undefined, 'PSD 图层预览'), createElement(documentRef, 'span', undefined, `${psd.width || 0} x ${psd.height || 0} · ${layers.length} layers · ag-psd`));
124
+ const actions = createElement(documentRef, 'div', 'psd-actions');
125
+ const zoomOut = createElement(documentRef, 'button', undefined, '-');
126
+ const zoomLabel = createElement(documentRef, 'span', undefined, '100%');
127
+ const zoomIn = createElement(documentRef, 'button', undefined, '+');
128
+ const reset = createElement(documentRef, 'button', undefined, '适合');
129
+ const showAll = createElement(documentRef, 'button', undefined, '全显');
130
+ const hideAll = createElement(documentRef, 'button', undefined, '全隐');
131
+ [zoomOut, zoomIn, reset, showAll, hideAll].forEach(button => {
132
+ button.type = 'button';
133
+ });
134
+ actions.append(zoomOut, zoomLabel, zoomIn, reset, showAll, hideAll);
135
+ toolbar.append(title, actions);
136
+ const layout = createElement(documentRef, 'div', 'psd-layout');
137
+ const sidebar = createElement(documentRef, 'aside', 'psd-sidebar');
138
+ const sidebarHeader = createElement(documentRef, 'div', 'psd-sidebar-header');
139
+ sidebarHeader.append(createElement(documentRef, 'span', undefined, '图层'), createElement(documentRef, 'span', undefined, `${drawableLayers.length} 可重绘`));
140
+ const list = createElement(documentRef, 'ul', 'psd-layer-list');
141
+ sidebar.append(sidebarHeader, list);
142
+ const stage = createElement(documentRef, 'main', 'psd-stage');
143
+ const wrap = createElement(documentRef, 'div', 'psd-canvas-wrap');
144
+ const shell = createElement(documentRef, 'div', 'psd-canvas-shell');
145
+ const canvas = createElement(documentRef, 'canvas');
146
+ canvas.width = Math.max(1, Number(psd.width || compositeCanvas?.width || 1));
147
+ canvas.height = Math.max(1, Number(psd.height || compositeCanvas?.height || 1));
148
+ shell.appendChild(canvas);
149
+ wrap.appendChild(shell);
150
+ stage.appendChild(wrap);
151
+ layout.append(sidebar, stage);
152
+ root.append(toolbar, layout);
153
+ target.replaceChildren(createStyle(documentRef), root);
154
+ const redraw = () => {
155
+ const context = canvas.getContext('2d');
156
+ if (!context) {
157
+ return;
158
+ }
159
+ context.clearRect(0, 0, canvas.width, canvas.height);
160
+ const visibleLayerCanvases = drawableLayers.filter(layer => selected.has(layer.id));
161
+ if (!visibleLayerCanvases.length && compositeCanvas) {
162
+ context.drawImage(compositeCanvas, 0, 0);
163
+ return;
164
+ }
165
+ visibleLayerCanvases.slice().reverse().forEach(layer => {
166
+ if (layer.canvas) {
167
+ context.drawImage(layer.canvas, layer.left, layer.top);
168
+ }
169
+ });
170
+ };
171
+ if (!layers.length) {
172
+ list.appendChild(createElement(documentRef, 'li', 'psd-empty', '未发现可展示图层,使用合成图预览。'));
173
+ }
174
+ layers.forEach(layer => {
175
+ const item = createElement(documentRef, 'li', 'psd-layer');
176
+ item.style.paddingLeft = `${8 + layer.depth * 14}px`;
177
+ const checkbox = createElement(documentRef, 'input');
178
+ checkbox.type = 'checkbox';
179
+ checkbox.disabled = !layer.canvas;
180
+ checkbox.checked = selected.has(layer.id);
181
+ checkbox.addEventListener('change', () => {
182
+ if (checkbox.checked) {
183
+ selected.add(layer.id);
184
+ }
185
+ else {
186
+ selected.delete(layer.id);
187
+ }
188
+ redraw();
189
+ });
190
+ const copy = createElement(documentRef, 'div');
191
+ copy.append(createElement(documentRef, 'strong', undefined, layer.name), createElement(documentRef, 'span', undefined, `${layer.left},${layer.top} · ${layer.width} x ${layer.height}${layer.hidden ? ' · hidden' : ''}`));
192
+ item.append(checkbox, copy);
193
+ list.appendChild(item);
194
+ });
195
+ const getZoomState = () => ({
196
+ scale: zoom,
197
+ label: `${Math.round(zoom * 100)}%`,
198
+ canZoomIn: zoom < 4,
199
+ canZoomOut: zoom > 0.1,
200
+ canReset: zoom !== 1,
201
+ minScale: 0.1,
202
+ maxScale: 4
203
+ });
204
+ const setZoom = (scale) => {
205
+ zoom = clampZoom(scale);
206
+ wrap.style.transform = `scale(${zoom})`;
207
+ zoomLabel.textContent = `${Math.round(zoom * 100)}%`;
208
+ zoomEmitter.emit();
209
+ return getZoomState();
210
+ };
211
+ zoomOut.addEventListener('click', () => setZoom(zoom - 0.1));
212
+ zoomIn.addEventListener('click', () => setZoom(zoom + 0.1));
213
+ reset.addEventListener('click', () => setZoom(1));
214
+ showAll.addEventListener('click', () => {
215
+ drawableLayers.forEach(layer => selected.add(layer.id));
216
+ list.querySelectorAll('input[type="checkbox"]').forEach(input => {
217
+ if (!input.disabled)
218
+ input.checked = true;
219
+ });
220
+ redraw();
221
+ });
222
+ hideAll.addEventListener('click', () => {
223
+ selected.clear();
224
+ list.querySelectorAll('input[type="checkbox"]').forEach(input => {
225
+ if (!input.disabled)
226
+ input.checked = false;
227
+ });
228
+ redraw();
229
+ });
230
+ registerFileViewerZoomProvider(root, {
231
+ zoomIn: () => setZoom(zoom + 0.1),
232
+ zoomOut: () => setZoom(zoom - 0.1),
233
+ resetZoom: () => setZoom(1),
234
+ setZoom,
235
+ getState: getZoomState,
236
+ subscribe: zoomEmitter.subscribe
237
+ });
238
+ redraw();
239
+ setZoom(1);
240
+ return {
241
+ $el: root,
242
+ unmount() {
243
+ unregisterFileViewerZoomProvider(root);
244
+ target.replaceChildren();
245
+ }
246
+ };
247
+ }
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@file-viewer/renderer-data",
3
+ "version": "2.0.11",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Standalone data asset renderer plugin for Flyfish File Viewer with PSD, SQLite, Parquet, Avro, WASM, font, AI/EPS, and WebArchive previews.",
7
+ "keywords": [
8
+ "file-viewer",
9
+ "renderer",
10
+ "data",
11
+ "sqlite",
12
+ "parquet",
13
+ "avro",
14
+ "psd",
15
+ "wasm",
16
+ "document-preview",
17
+ "document-viewer",
18
+ "file-preview",
19
+ "self-hosted"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "registry": "https://registry.npmjs.org/"
24
+ },
25
+ "author": {
26
+ "name": "Wangyu",
27
+ "email": "wybaby168@gmail.com"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/flyfish-dev/file-viewer-renderer-data.git",
32
+ "directory": "packages/renderers/data"
33
+ },
34
+ "homepage": "https://doc.file-viewer.app/guide/on-demand-renderers",
35
+ "bugs": {
36
+ "url": "https://github.com/flyfish-dev/file-viewer-renderer-data/issues"
37
+ },
38
+ "funding": {
39
+ "type": "individual",
40
+ "url": "https://dev.flyfish.group/shop"
41
+ },
42
+ "main": "./dist/index.js",
43
+ "module": "./dist/index.js",
44
+ "types": "./dist/index.d.ts",
45
+ "exports": {
46
+ ".": {
47
+ "types": "./dist/index.d.ts",
48
+ "import": "./dist/index.js",
49
+ "default": "./dist/index.js"
50
+ },
51
+ "./package.json": "./package.json"
52
+ },
53
+ "files": [
54
+ "dist",
55
+ "README.md",
56
+ "README.en.md",
57
+ "LICENSE"
58
+ ],
59
+ "dependencies": {
60
+ "@file-viewer/core": "^2.0.11",
61
+ "ag-psd": "^30.1.1",
62
+ "avsc": "^5.7.9",
63
+ "hyparquet": "^1.26.0",
64
+ "sql.js": "^1.14.1"
65
+ },
66
+ "devDependencies": {
67
+ "typescript": "^6.0.3"
68
+ },
69
+ "license": "Apache-2.0",
70
+ "scripts": {
71
+ "build": "tsc -b tsconfig.json",
72
+ "type-check": "tsc -b tsconfig.json"
73
+ }
74
+ }