@file-viewer/jquery-full 2.1.9 → 2.1.10

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.ts CHANGED
@@ -1,3 +1,15 @@
1
- import '@file-viewer/preset-all';
1
+ import { mountViewer as mountBaseViewer, type ViewerMountOptions, type ViewerOptions } from '@file-viewer/jquery';
2
2
  export * from '@file-viewer/jquery';
3
- export { default } from '@file-viewer/jquery';
3
+ export declare const fileViewerFullPreset: import("@file-viewer/core").FileViewerRendererPreset<(buffer: ArrayBuffer, target: HTMLDivElement, type?: string, context?: import("@file-viewer/core").FileRenderContext) => Promise<import("@file-viewer/core").FileViewerRenderedInstance>>;
4
+ type ViewerCoreOptions = NonNullable<Parameters<typeof mountBaseViewer>[2]>;
5
+ export declare function withFullViewerOptions(options?: ViewerOptions): ViewerOptions;
6
+ export declare function withFullMountOptions(options?: ViewerMountOptions): ViewerMountOptions;
7
+ export declare const mountViewer: (container: HTMLElement, options?: ViewerMountOptions, coreOptions?: ViewerCoreOptions) => import("@file-viewer/jquery").ViewerController;
8
+ export declare const installJQueryFileViewer: (jqueryInstance?: JQueryStatic | undefined) => boolean;
9
+ declare global {
10
+ interface Window {
11
+ jQuery?: JQueryStatic;
12
+ $?: JQueryStatic;
13
+ }
14
+ }
15
+ export default installJQueryFileViewer;
package/dist/index.js CHANGED
@@ -1,3 +1,59 @@
1
- import '@file-viewer/preset-all';
1
+ import allRenderers from '@file-viewer/preset-all';
2
+ import installBaseJQueryFileViewer, { mountViewer as mountBaseViewer } from '@file-viewer/jquery';
2
3
  export * from '@file-viewer/jquery';
3
- export { default } from '@file-viewer/jquery';
4
+ export const fileViewerFullPreset = allRenderers;
5
+ export function withFullViewerOptions(options = {}) {
6
+ var _a;
7
+ const { preset = allRenderers, rendererMode = 'replace', ...rest } = options;
8
+ return {
9
+ ...rest,
10
+ preset,
11
+ rendererMode,
12
+ autoRenderers: (_a = rest.autoRenderers) !== null && _a !== void 0 ? _a : true
13
+ };
14
+ }
15
+ export function withFullMountOptions(options = {}) {
16
+ return {
17
+ ...options,
18
+ options: withFullViewerOptions(options.options)
19
+ };
20
+ }
21
+ const withFullJQueryOptions = (options = {}) => {
22
+ return {
23
+ ...options,
24
+ options: withFullViewerOptions(options.options)
25
+ };
26
+ };
27
+ export const mountViewer = (container, options = {}, coreOptions = {}) => mountBaseViewer(container, withFullMountOptions(options), coreOptions);
28
+ const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';
29
+ const getGlobalJQuery = () => {
30
+ if (!isBrowser()) {
31
+ return undefined;
32
+ }
33
+ return window.jQuery || window.$;
34
+ };
35
+ export const installJQueryFileViewer = (jqueryInstance = getGlobalJQuery()) => {
36
+ if (!jqueryInstance) {
37
+ return false;
38
+ }
39
+ installBaseJQueryFileViewer(jqueryInstance);
40
+ const basePlugin = jqueryInstance.fn.fileViewer;
41
+ if (!basePlugin || basePlugin.__flyfishFileViewerFull) {
42
+ return !!basePlugin;
43
+ }
44
+ const plugin = function fileViewer(options = {}, ...args) {
45
+ if (typeof options === 'string') {
46
+ if (options === 'load' || options === 'update') {
47
+ return basePlugin.call(this, options, withFullMountOptions((args[0] || {})), ...args.slice(1));
48
+ }
49
+ return basePlugin.call(this, options, ...args);
50
+ }
51
+ return basePlugin.call(this, withFullJQueryOptions(options));
52
+ };
53
+ plugin.__flyfishFileViewer = true;
54
+ plugin.__flyfishFileViewerFull = true;
55
+ jqueryInstance.fn.fileViewer = plugin;
56
+ return true;
57
+ };
58
+ installJQueryFileViewer();
59
+ export default installJQueryFileViewer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/jquery-full",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Full jQuery package for Flyfish File Viewer with the complete preset enabled by default.",
@@ -56,8 +56,8 @@
56
56
  "jquery": ">=3 <5"
57
57
  },
58
58
  "dependencies": {
59
- "@file-viewer/jquery": "^2.1.9",
60
- "@file-viewer/preset-all": "^2.1.9"
59
+ "@file-viewer/jquery": "^2.1.10",
60
+ "@file-viewer/preset-all": "^2.1.10"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/jquery": "^4.0.1",