@file-viewer/web 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -98,7 +98,7 @@ Every standard component package shares `@file-viewer/core` as the only common f
98
98
 
99
99
  ## Format Support Matrix
100
100
 
101
- The shared catalog registers 244 file extensions (221 stable and 23 experimental) across 34 preview pipelines. Experimental formats do not count toward stable support; full capability is assembled through renderer packages or presets.
101
+ The shared catalog registers 266 file extensions (224 stable and 42 experimental) across 45 preview pipelines. Experimental formats do not count toward stable support; full capability is assembled through renderer packages or presets.
102
102
 
103
103
  | Preview pipeline | Category | Extensions | Level / status | Capabilities | Loading |
104
104
  | --- | --- | --- | --- | --- | --- |
@@ -118,6 +118,7 @@ The shared catalog registers 244 file extensions (221 stable and 23 experimental
118
118
  | Hancom Hangul | office | `.hwp`, `.hwpx` | structured / stable | download, print(adapter), HTML export(adapter), zoom(provider), search | lazy async |
119
119
  | Typst | document | `.typ`, `.typst` | high-fidelity / stable | download, print(adapter), HTML export(adapter), zoom(provider), search | lazy async |
120
120
  | Archive | archive | `.zip`, `.zipx`, `.7z`, `.rar`, `.tar`, `.gz`, `.gzip`, `.tgz`, `.bz2`, `.bzip2`, `.tbz`, `.tbz2`, `.xz`, `.txz`, `.lzma`, `.zst`, `.tzst`, `.cab`, `.ar`, `.cpio`, `.iso`, `.xar`, `.lha`, `.lzh`, `.jar`, `.war`, `.ear`, `.apk`, `.cbz`, `.cbr` | structured / stable | download, search | lazy async |
121
+ | Compiled HTML Help | ebook | `.chm` | structured / stable | download, print(adapter), HTML export(adapter), search | lazy async |
121
122
  | Email | email | `.eml`, `.msg`, `.mbox` | structured / stable | download, HTML export, search | lazy async |
122
123
  | EDA | eda | `.olb`, `.dra`, `.gds`, `.oas`, `.oasis` | structured / stable | download, print, HTML export, search | lazy async |
123
124
  | CAD | cad | `.dxf`, `.dwg`, `.dwf`, `.dwfx`, `.xps` | high-fidelity / stable | download, print, HTML export, zoom(provider) | lazy async |
@@ -135,6 +136,16 @@ The shared catalog registers 244 file extensions (221 stable and 23 experimental
135
136
  | Code and Text | code | `.txt`, `.json`, `.js`, `.mjs`, `.cjs`, `.css`, `.java`, `.py`, `.html`, `.htm`, `.jsx`, `.ts`, `.tsx`, `.xml`, `.log`, `.vue`, `.yaml`, `.yml`, `.ini`, `.sh`, `.bash`, `.sql`, `.go`, `.rs`, `.php`, `.c`, `.cpp`, `.cc`, `.h`, `.hpp`, `.cs`, `.diff`, `.patch`, `.bundle`, `.bdl`, `.jsonc`, `.json5`, `.ipynb`, `.toml`, `.proto`, `.hcl`, `.tex`, `.gv`, `.http`, `.react`, `.rb`, `.swift`, `.kt` | structured / stable | download, print, HTML export, search | lazy async |
136
137
  | Video | media | `.mp4`, `.webm`, `.m3u8` | high-fidelity / stable | download | lazy async |
137
138
  | Audio | media | `.mp3`, `.mpeg`, `.wav`, `.ogg`, `.oga`, `.opus`, `.m4a`, `.aac`, `.flac`, `.weba`, `.midi`, `.mid` | high-fidelity / stable | download | lazy async |
139
+ | Adobe Photoshop | asset | `.psb`, `.pdd`, `.psdt`, `.psd` (enhances `data-asset`) | experimental / experimental | download, print, zoom | lazy async |
140
+ | Adobe Illustrator AI/AIT | asset | `.ait`, `.ai` (enhances `data-asset`) | experimental / experimental | download, print, zoom, search | lazy async |
141
+ | Adobe InDesign IDML | asset | `.idml` | experimental / experimental | download, print, zoom | lazy async |
142
+ | Adobe InCopy and InDesign Exchange | asset | `.icml`, `.idms`, `.inx` | structured / experimental | download, print, HTML export, search | lazy async |
143
+ | Adobe Animate XFL | asset | `.fla`, `.xfl` | structured / experimental | download | lazy async |
144
+ | Adobe XD Package | asset | `.xd` | structured / experimental | download | lazy async |
145
+ | Adobe InDesign Native | asset | `.indd`, `.indt` | structured / experimental | download | lazy async |
146
+ | Adobe EPS and PostScript | asset | `.ps`, `.eps` (enhances `data-asset`) | experimental / experimental | download, print, zoom | lazy async |
147
+ | Adobe Color Palettes | asset | `.ase`, `.aco` | structured / stable | download, print, HTML export, search | lazy async |
148
+ | Adobe Photoshop Resources and Presets | asset | `.abr`, `.csh`, `.pat`, `.grd`, `.asl` | structured / experimental | download, print, search | lazy async |
138
149
  | Data Asset | asset | `.ttf`, `.otf`, `.woff`, `.woff2`, `.psd`, `.ai`, `.eps`, `.sqlite`, `.wasm`, `.parquet`, `.avro`, `.webarchive` | structured / stable | download, HTML export, search | lazy async |
139
150
 
140
151
  ## Engineering-Grade On-Demand Renderer Assembly
package/README.md CHANGED
@@ -98,7 +98,7 @@ npx --yes file-viewer-copy-assets ./public/file-viewer
98
98
 
99
99
  ## 格式支持矩阵
100
100
 
101
- 共享格式目录当前注册 244 个扩展名(221 个稳定、23 个实验),映射到 34 条预览链路。实验格式不计入稳定支持数量;完整能力通过 renderer / preset 按需装配。
101
+ 共享格式目录当前注册 266 个扩展名(224 个稳定、42 个实验),映射到 45 条预览链路。实验格式不计入稳定支持数量;完整能力通过 renderer / preset 按需装配。
102
102
 
103
103
  | 预览链路 | 分类 | 扩展名 | 等级 / 状态 | 能力 | 加载 |
104
104
  | --- | --- | --- | --- | --- | --- |
@@ -118,6 +118,7 @@ npx --yes file-viewer-copy-assets ./public/file-viewer
118
118
  | Hancom Hangul | office | `.hwp`, `.hwpx` | structured / stable | 下载, 打印(适配器), HTML(适配器), 缩放(Provider), 搜索 | 按需异步 |
119
119
  | Typst | document | `.typ`, `.typst` | high-fidelity / stable | 下载, 打印(适配器), HTML(适配器), 缩放(Provider), 搜索 | 按需异步 |
120
120
  | Archive | archive | `.zip`, `.zipx`, `.7z`, `.rar`, `.tar`, `.gz`, `.gzip`, `.tgz`, `.bz2`, `.bzip2`, `.tbz`, `.tbz2`, `.xz`, `.txz`, `.lzma`, `.zst`, `.tzst`, `.cab`, `.ar`, `.cpio`, `.iso`, `.xar`, `.lha`, `.lzh`, `.jar`, `.war`, `.ear`, `.apk`, `.cbz`, `.cbr` | structured / stable | 下载, 搜索 | 按需异步 |
121
+ | Compiled HTML Help | ebook | `.chm` | structured / stable | 下载, 打印(适配器), HTML(适配器), 搜索 | 按需异步 |
121
122
  | Email | email | `.eml`, `.msg`, `.mbox` | structured / stable | 下载, HTML, 搜索 | 按需异步 |
122
123
  | EDA | eda | `.olb`, `.dra`, `.gds`, `.oas`, `.oasis` | structured / stable | 下载, 打印, HTML, 搜索 | 按需异步 |
123
124
  | CAD | cad | `.dxf`, `.dwg`, `.dwf`, `.dwfx`, `.xps` | high-fidelity / stable | 下载, 打印, HTML, 缩放(Provider) | 按需异步 |
@@ -135,6 +136,16 @@ npx --yes file-viewer-copy-assets ./public/file-viewer
135
136
  | Code and Text | code | `.txt`, `.json`, `.js`, `.mjs`, `.cjs`, `.css`, `.java`, `.py`, `.html`, `.htm`, `.jsx`, `.ts`, `.tsx`, `.xml`, `.log`, `.vue`, `.yaml`, `.yml`, `.ini`, `.sh`, `.bash`, `.sql`, `.go`, `.rs`, `.php`, `.c`, `.cpp`, `.cc`, `.h`, `.hpp`, `.cs`, `.diff`, `.patch`, `.bundle`, `.bdl`, `.jsonc`, `.json5`, `.ipynb`, `.toml`, `.proto`, `.hcl`, `.tex`, `.gv`, `.http`, `.react`, `.rb`, `.swift`, `.kt` | structured / stable | 下载, 打印, HTML, 搜索 | 按需异步 |
136
137
  | Video | media | `.mp4`, `.webm`, `.m3u8` | high-fidelity / stable | 下载 | 按需异步 |
137
138
  | Audio | media | `.mp3`, `.mpeg`, `.wav`, `.ogg`, `.oga`, `.opus`, `.m4a`, `.aac`, `.flac`, `.weba`, `.midi`, `.mid` | high-fidelity / stable | 下载 | 按需异步 |
139
+ | Adobe Photoshop | asset | `.psb`, `.pdd`, `.psdt`, `.psd`(增强 `data-asset`) | experimental / experimental | 下载, 打印, 缩放 | 按需异步 |
140
+ | Adobe Illustrator AI/AIT | asset | `.ait`, `.ai`(增强 `data-asset`) | experimental / experimental | 下载, 打印, 缩放, 搜索 | 按需异步 |
141
+ | Adobe InDesign IDML | asset | `.idml` | experimental / experimental | 下载, 打印, 缩放 | 按需异步 |
142
+ | Adobe InCopy and InDesign Exchange | asset | `.icml`, `.idms`, `.inx` | structured / experimental | 下载, 打印, HTML, 搜索 | 按需异步 |
143
+ | Adobe Animate XFL | asset | `.fla`, `.xfl` | structured / experimental | 下载 | 按需异步 |
144
+ | Adobe XD Package | asset | `.xd` | structured / experimental | 下载 | 按需异步 |
145
+ | Adobe InDesign Native | asset | `.indd`, `.indt` | structured / experimental | 下载 | 按需异步 |
146
+ | Adobe EPS and PostScript | asset | `.ps`, `.eps`(增强 `data-asset`) | experimental / experimental | 下载, 打印, 缩放 | 按需异步 |
147
+ | Adobe Color Palettes | asset | `.ase`, `.aco` | structured / stable | 下载, 打印, HTML, 搜索 | 按需异步 |
148
+ | Adobe Photoshop Resources and Presets | asset | `.abr`, `.csh`, `.pat`, `.grd`, `.asl` | structured / experimental | 下载, 打印, 搜索 | 按需异步 |
138
149
  | Data Asset | asset | `.ttf`, `.otf`, `.woff`, `.woff2`, `.psd`, `.ai`, `.eps`, `.sqlite`, `.wasm`, `.parquet`, `.avro`, `.webarchive` | structured / stable | 下载, HTML, 搜索 | 按需异步 |
139
150
 
140
151
  ## 工程级按需 renderer 装配
@@ -0,0 +1,4 @@
1
+ export type FileViewerCustomEventOwner = {
2
+ ownerDocument?: Document | null;
3
+ };
4
+ export declare function createFileViewerCustomEvent<Detail>(owner: FileViewerCustomEventOwner, name: string, detail: Detail): CustomEvent<Detail>;
@@ -0,0 +1,45 @@
1
+ export function createFileViewerCustomEvent(owner, name, detail) {
2
+ var _a;
3
+ const init = {
4
+ bubbles: true,
5
+ composed: true,
6
+ detail,
7
+ };
8
+ const ownerWindow = (_a = owner.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
9
+ const ownerCustomEvent = ownerWindow === null || ownerWindow === void 0 ? void 0 : ownerWindow.CustomEvent;
10
+ const CustomEventConstructor = typeof ownerCustomEvent === 'function'
11
+ ? ownerCustomEvent
12
+ : typeof globalThis.CustomEvent === 'function'
13
+ ? globalThis.CustomEvent
14
+ : undefined;
15
+ if (CustomEventConstructor) {
16
+ return new CustomEventConstructor(name, init);
17
+ }
18
+ const ownerDocument = owner.ownerDocument;
19
+ if (ownerDocument && typeof ownerDocument.createEvent === 'function') {
20
+ try {
21
+ const legacyEvent = ownerDocument.createEvent('CustomEvent');
22
+ legacyEvent.initCustomEvent(name, true, false, detail);
23
+ return legacyEvent;
24
+ }
25
+ catch {
26
+ // Fall through to the standard Event constructor for partial DOM shims.
27
+ }
28
+ }
29
+ const ownerEvent = ownerWindow === null || ownerWindow === void 0 ? void 0 : ownerWindow.Event;
30
+ const EventConstructor = typeof ownerEvent === 'function'
31
+ ? ownerEvent
32
+ : typeof globalThis.Event === 'function'
33
+ ? globalThis.Event
34
+ : undefined;
35
+ if (!EventConstructor) {
36
+ throw new Error(`Cannot dispatch ${name}: this runtime does not provide an Event constructor.`);
37
+ }
38
+ const event = new EventConstructor(name, { bubbles: true, composed: true });
39
+ Object.defineProperty(event, 'detail', {
40
+ configurable: false,
41
+ enumerable: true,
42
+ value: detail,
43
+ });
44
+ return event;
45
+ }
package/dist/element.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { fileViewerCoreRendererRegistry, } from '@file-viewer/core';
2
+ import { createFileViewerCustomEvent } from './custom-event.js';
2
3
  import { mountViewer as mountCoreViewer, } from './controller.js';
3
4
  export const FILE_VIEWER_ELEMENT_TAG = 'flyfish-file-viewer';
4
5
  const ElementBase = (typeof HTMLElement === 'undefined'
@@ -591,11 +592,7 @@ export class FileViewerElement extends ElementBase {
591
592
  this.dispatchTypedEvent('viewer-error', { error });
592
593
  }
593
594
  dispatchTypedEvent(name, detail) {
594
- this.dispatchEvent(new CustomEvent(name, {
595
- bubbles: true,
596
- composed: true,
597
- detail,
598
- }));
595
+ this.dispatchEvent(createFileViewerCustomEvent(this, name, detail));
599
596
  }
600
597
  }
601
598
  export const defineFileViewerElement = (tagName = FILE_VIEWER_ELEMENT_TAG) => {