@open-file-viewer/core 0.1.6 → 0.1.8
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.md +48 -1
- package/dist/index.cjs +5137 -645
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +5137 -645
- package/dist/index.js.map +1 -1
- package/dist/style.css +734 -54
- package/package.json +12 -2
package/dist/index.d.cts
CHANGED
|
@@ -62,6 +62,7 @@ interface PreviewToolbarRenderContext {
|
|
|
62
62
|
next: () => Promise<void>;
|
|
63
63
|
command: (command: PreviewCommand) => void | boolean | undefined;
|
|
64
64
|
canCommand: (command: PreviewCommand) => boolean;
|
|
65
|
+
refreshCommandSupport: () => void;
|
|
65
66
|
setZoom: (zoom?: number) => void;
|
|
66
67
|
download: () => void;
|
|
67
68
|
fullscreen: () => void;
|
|
@@ -156,7 +157,46 @@ declare function emailPlugin(): PreviewPlugin;
|
|
|
156
157
|
|
|
157
158
|
declare function drawingPlugin(): PreviewPlugin;
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
interface LibreDwgPreviewOptions {
|
|
161
|
+
/**
|
|
162
|
+
* Enable the built-in LibreDWG WASM preview for DWG files.
|
|
163
|
+
*
|
|
164
|
+
* It is best-effort and intentionally lower priority than `binaryRenderer`.
|
|
165
|
+
*/
|
|
166
|
+
enabled?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Public URL that contains libredwg-web.wasm.
|
|
169
|
+
*
|
|
170
|
+
* Example: `/vendor/libredwg-web`
|
|
171
|
+
*/
|
|
172
|
+
wasmBaseUrl?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
interface CadBinaryPreviewContext {
|
|
176
|
+
panel: HTMLElement;
|
|
177
|
+
fileName: string;
|
|
178
|
+
extension: "dwg" | "dwf";
|
|
179
|
+
arrayBuffer: ArrayBuffer;
|
|
180
|
+
bytes: Uint8Array;
|
|
181
|
+
preview: PreviewContext;
|
|
182
|
+
}
|
|
183
|
+
interface CadPluginOptions {
|
|
184
|
+
/**
|
|
185
|
+
* Optional high-fidelity renderer for proprietary binary CAD files. When it
|
|
186
|
+
* returns a preview instance, it takes over DWG/DWF rendering completely.
|
|
187
|
+
*
|
|
188
|
+
* Use it for custom front-end engines or server-side CAD conversion services.
|
|
189
|
+
*/
|
|
190
|
+
binaryRenderer?: (ctx: CadBinaryPreviewContext) => Promise<PreviewInstance | void> | PreviewInstance | void;
|
|
191
|
+
/**
|
|
192
|
+
* Built-in best-effort DWG preview powered by LibreDWG WASM.
|
|
193
|
+
*
|
|
194
|
+
* Pass `false` to keep the old metadata-only DWG behavior. Pass an object to
|
|
195
|
+
* configure the public WASM asset path.
|
|
196
|
+
*/
|
|
197
|
+
libreDwg?: false | LibreDwgPreviewOptions;
|
|
198
|
+
}
|
|
199
|
+
declare function cadPlugin(options?: CadPluginOptions): PreviewPlugin;
|
|
160
200
|
|
|
161
201
|
declare function model3dPlugin(): PreviewPlugin;
|
|
162
202
|
|
|
@@ -166,4 +206,4 @@ declare function assetPlugin(): PreviewPlugin;
|
|
|
166
206
|
|
|
167
207
|
declare function fallbackPlugin(): PreviewPlugin;
|
|
168
208
|
|
|
169
|
-
export { type FileViewer, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|
|
209
|
+
export { type CadBinaryPreviewContext, type CadPluginOptions, type FileViewer, type LibreDwgPreviewOptions, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ interface PreviewToolbarRenderContext {
|
|
|
62
62
|
next: () => Promise<void>;
|
|
63
63
|
command: (command: PreviewCommand) => void | boolean | undefined;
|
|
64
64
|
canCommand: (command: PreviewCommand) => boolean;
|
|
65
|
+
refreshCommandSupport: () => void;
|
|
65
66
|
setZoom: (zoom?: number) => void;
|
|
66
67
|
download: () => void;
|
|
67
68
|
fullscreen: () => void;
|
|
@@ -156,7 +157,46 @@ declare function emailPlugin(): PreviewPlugin;
|
|
|
156
157
|
|
|
157
158
|
declare function drawingPlugin(): PreviewPlugin;
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
interface LibreDwgPreviewOptions {
|
|
161
|
+
/**
|
|
162
|
+
* Enable the built-in LibreDWG WASM preview for DWG files.
|
|
163
|
+
*
|
|
164
|
+
* It is best-effort and intentionally lower priority than `binaryRenderer`.
|
|
165
|
+
*/
|
|
166
|
+
enabled?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Public URL that contains libredwg-web.wasm.
|
|
169
|
+
*
|
|
170
|
+
* Example: `/vendor/libredwg-web`
|
|
171
|
+
*/
|
|
172
|
+
wasmBaseUrl?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
interface CadBinaryPreviewContext {
|
|
176
|
+
panel: HTMLElement;
|
|
177
|
+
fileName: string;
|
|
178
|
+
extension: "dwg" | "dwf";
|
|
179
|
+
arrayBuffer: ArrayBuffer;
|
|
180
|
+
bytes: Uint8Array;
|
|
181
|
+
preview: PreviewContext;
|
|
182
|
+
}
|
|
183
|
+
interface CadPluginOptions {
|
|
184
|
+
/**
|
|
185
|
+
* Optional high-fidelity renderer for proprietary binary CAD files. When it
|
|
186
|
+
* returns a preview instance, it takes over DWG/DWF rendering completely.
|
|
187
|
+
*
|
|
188
|
+
* Use it for custom front-end engines or server-side CAD conversion services.
|
|
189
|
+
*/
|
|
190
|
+
binaryRenderer?: (ctx: CadBinaryPreviewContext) => Promise<PreviewInstance | void> | PreviewInstance | void;
|
|
191
|
+
/**
|
|
192
|
+
* Built-in best-effort DWG preview powered by LibreDWG WASM.
|
|
193
|
+
*
|
|
194
|
+
* Pass `false` to keep the old metadata-only DWG behavior. Pass an object to
|
|
195
|
+
* configure the public WASM asset path.
|
|
196
|
+
*/
|
|
197
|
+
libreDwg?: false | LibreDwgPreviewOptions;
|
|
198
|
+
}
|
|
199
|
+
declare function cadPlugin(options?: CadPluginOptions): PreviewPlugin;
|
|
160
200
|
|
|
161
201
|
declare function model3dPlugin(): PreviewPlugin;
|
|
162
202
|
|
|
@@ -166,4 +206,4 @@ declare function assetPlugin(): PreviewPlugin;
|
|
|
166
206
|
|
|
167
207
|
declare function fallbackPlugin(): PreviewPlugin;
|
|
168
208
|
|
|
169
|
-
export { type FileViewer, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|
|
209
|
+
export { type CadBinaryPreviewContext, type CadPluginOptions, type FileViewer, type LibreDwgPreviewOptions, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|