@open-file-viewer/core 0.1.5 → 0.1.7

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/dist/index.d.cts CHANGED
@@ -156,7 +156,46 @@ declare function emailPlugin(): PreviewPlugin;
156
156
 
157
157
  declare function drawingPlugin(): PreviewPlugin;
158
158
 
159
- declare function cadPlugin(): PreviewPlugin;
159
+ interface LibreDwgPreviewOptions {
160
+ /**
161
+ * Enable the built-in LibreDWG WASM preview for DWG files.
162
+ *
163
+ * It is best-effort and intentionally lower priority than `binaryRenderer`.
164
+ */
165
+ enabled?: boolean;
166
+ /**
167
+ * Public URL that contains libredwg-web.wasm.
168
+ *
169
+ * Example: `/vendor/libredwg-web`
170
+ */
171
+ wasmBaseUrl?: string;
172
+ }
173
+
174
+ interface CadBinaryPreviewContext {
175
+ panel: HTMLElement;
176
+ fileName: string;
177
+ extension: "dwg" | "dwf";
178
+ arrayBuffer: ArrayBuffer;
179
+ bytes: Uint8Array;
180
+ preview: PreviewContext;
181
+ }
182
+ interface CadPluginOptions {
183
+ /**
184
+ * Optional high-fidelity renderer for proprietary binary CAD files. When it
185
+ * returns a preview instance, it takes over DWG/DWF rendering completely.
186
+ *
187
+ * Use it for custom front-end engines or server-side CAD conversion services.
188
+ */
189
+ binaryRenderer?: (ctx: CadBinaryPreviewContext) => Promise<PreviewInstance | void> | PreviewInstance | void;
190
+ /**
191
+ * Built-in best-effort DWG preview powered by LibreDWG WASM.
192
+ *
193
+ * Pass `false` to keep the old metadata-only DWG behavior. Pass an object to
194
+ * configure the public WASM asset path.
195
+ */
196
+ libreDwg?: false | LibreDwgPreviewOptions;
197
+ }
198
+ declare function cadPlugin(options?: CadPluginOptions): PreviewPlugin;
160
199
 
161
200
  declare function model3dPlugin(): PreviewPlugin;
162
201
 
@@ -166,4 +205,4 @@ declare function assetPlugin(): PreviewPlugin;
166
205
 
167
206
  declare function fallbackPlugin(): PreviewPlugin;
168
207
 
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 };
208
+ 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
@@ -156,7 +156,46 @@ declare function emailPlugin(): PreviewPlugin;
156
156
 
157
157
  declare function drawingPlugin(): PreviewPlugin;
158
158
 
159
- declare function cadPlugin(): PreviewPlugin;
159
+ interface LibreDwgPreviewOptions {
160
+ /**
161
+ * Enable the built-in LibreDWG WASM preview for DWG files.
162
+ *
163
+ * It is best-effort and intentionally lower priority than `binaryRenderer`.
164
+ */
165
+ enabled?: boolean;
166
+ /**
167
+ * Public URL that contains libredwg-web.wasm.
168
+ *
169
+ * Example: `/vendor/libredwg-web`
170
+ */
171
+ wasmBaseUrl?: string;
172
+ }
173
+
174
+ interface CadBinaryPreviewContext {
175
+ panel: HTMLElement;
176
+ fileName: string;
177
+ extension: "dwg" | "dwf";
178
+ arrayBuffer: ArrayBuffer;
179
+ bytes: Uint8Array;
180
+ preview: PreviewContext;
181
+ }
182
+ interface CadPluginOptions {
183
+ /**
184
+ * Optional high-fidelity renderer for proprietary binary CAD files. When it
185
+ * returns a preview instance, it takes over DWG/DWF rendering completely.
186
+ *
187
+ * Use it for custom front-end engines or server-side CAD conversion services.
188
+ */
189
+ binaryRenderer?: (ctx: CadBinaryPreviewContext) => Promise<PreviewInstance | void> | PreviewInstance | void;
190
+ /**
191
+ * Built-in best-effort DWG preview powered by LibreDWG WASM.
192
+ *
193
+ * Pass `false` to keep the old metadata-only DWG behavior. Pass an object to
194
+ * configure the public WASM asset path.
195
+ */
196
+ libreDwg?: false | LibreDwgPreviewOptions;
197
+ }
198
+ declare function cadPlugin(options?: CadPluginOptions): PreviewPlugin;
160
199
 
161
200
  declare function model3dPlugin(): PreviewPlugin;
162
201
 
@@ -166,4 +205,4 @@ declare function assetPlugin(): PreviewPlugin;
166
205
 
167
206
  declare function fallbackPlugin(): PreviewPlugin;
168
207
 
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 };
208
+ 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 };