@file-viewer/core 3.3.1 → 3.3.3

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.
Files changed (111) hide show
  1. package/dist/assets.d.ts +2 -2
  2. package/dist/assets.js +1 -5
  3. package/dist/browser/controller.d.ts +1 -2
  4. package/dist/browser/controller.js +8 -39
  5. package/dist/browser/source-feedback.d.ts +1 -2
  6. package/dist/browser/source-feedback.js +2 -3
  7. package/dist/browser/toolbar-focus.d.ts +0 -1
  8. package/dist/browser/toolbar-focus.js +0 -3
  9. package/dist/browser/toolbar-keyboard.d.ts +1 -0
  10. package/dist/browser/toolbar-keyboard.js +63 -0
  11. package/dist/browser.d.ts +2 -2
  12. package/dist/browser.js +2 -2
  13. package/dist/config/options.d.ts +1 -1
  14. package/dist/contracts/types.d.ts +1 -470
  15. package/dist/contracts/xml.d.ts +0 -11
  16. package/dist/export.d.ts +3 -10
  17. package/dist/export.js +2 -9
  18. package/dist/exportDocument.d.ts +1 -12
  19. package/dist/exportDocument.js +2 -31
  20. package/dist/features/document/dom/anchors.d.ts +1 -1
  21. package/dist/features/document/dom/index.d.ts +5 -5
  22. package/dist/features/document/dom/index.js +3 -3
  23. package/dist/features/document/dom/providers.d.ts +1 -1
  24. package/dist/features/document/events.d.ts +2 -2
  25. package/dist/features/document/events.js +3 -3
  26. package/dist/features/document/fit.d.ts +1 -1
  27. package/dist/features/document/fit.js +1 -1
  28. package/dist/features/document/imageHandTool.d.ts +0 -2
  29. package/dist/features/document/imageHandTool.js +1 -5
  30. package/dist/features/document/model.d.ts +1 -1
  31. package/dist/features/document/search.d.ts +1 -1
  32. package/dist/features/document/search.js +2 -2
  33. package/dist/features/document/viewState.d.ts +1 -1
  34. package/dist/features/document/viewState.js +2 -2
  35. package/dist/features/document/zoom.d.ts +1 -1
  36. package/dist/features/document/zoom.js +3 -3
  37. package/dist/features/document/zoomGestures.d.ts +2 -2
  38. package/dist/features/document/zoomGestures.js +0 -2
  39. package/dist/features/printMask.d.ts +1 -1
  40. package/dist/features/printMaskDesigner.d.ts +2 -6
  41. package/dist/features/printMaskDesigner.js +2 -11
  42. package/dist/features/printMaskLoader.d.ts +1 -7
  43. package/dist/features/printMaskLoader.js +1 -7
  44. package/dist/features/watermark.d.ts +1 -1
  45. package/dist/headless.d.ts +29 -29
  46. package/dist/headless.js +16 -21
  47. package/dist/i18n/messages.d.ts +1 -1
  48. package/dist/i18n/messages.de.d.ts +1 -5
  49. package/dist/i18n/messages.de.js +1 -5
  50. package/dist/i18n/messages.ja.d.ts +1 -6
  51. package/dist/i18n/messages.ja.js +1 -6
  52. package/dist/i18n/messages.js +4 -4
  53. package/dist/index.d.ts +77 -77
  54. package/dist/index.js +39 -39
  55. package/dist/lifecycle/facade.d.ts +4 -4
  56. package/dist/lifecycle/facade.js +2 -2
  57. package/dist/lifecycle/operations.d.ts +4 -5
  58. package/dist/lifecycle/operations.js +4 -10
  59. package/dist/output/canvasImage.d.ts +1 -2
  60. package/dist/output/canvasImage.js +1 -4
  61. package/dist/output/export.d.ts +1 -3
  62. package/dist/output/export.js +0 -12
  63. package/dist/output/printLayout.d.ts +0 -5
  64. package/dist/output/printLayout.js +0 -4
  65. package/dist/output/snapshotDownload.d.ts +1 -2
  66. package/dist/output/snapshotDownload.js +2 -3
  67. package/dist/platform/assets.d.ts +4 -11
  68. package/dist/platform/assets.js +20 -45
  69. package/dist/platform/copiedAssets.d.ts +0 -1
  70. package/dist/platform/copiedAssets.js +1 -2
  71. package/dist/presentation/colorScheme.d.ts +1 -2
  72. package/dist/presentation/colorScheme.js +1 -2
  73. package/dist/presentation/state.d.ts +1 -1
  74. package/dist/presentation/state.js +3 -3
  75. package/dist/print-mask.d.ts +2 -2
  76. package/dist/print-mask.js +1 -1
  77. package/dist/registry/capabilities.d.ts +1 -14
  78. package/dist/registry/capabilities.js +2 -15
  79. package/dist/registry/formats.d.ts +1 -1
  80. package/dist/registry/formats.generated.d.ts +2 -3
  81. package/dist/registry/formats.generated.js +2 -3
  82. package/dist/registry/formats.js +2 -2
  83. package/dist/registry/registry.d.ts +1 -15
  84. package/dist/registry/registry.js +2 -10
  85. package/dist/renderers/image.d.ts +1 -1
  86. package/dist/renderers/image.js +5 -7
  87. package/dist/renderers/index.d.ts +3 -3
  88. package/dist/renderers/index.js +5 -11
  89. package/dist/rendering/dispatcher.d.ts +1 -6
  90. package/dist/rendering/dispatcher.js +3 -3
  91. package/dist/rendering/handler.d.ts +3 -13
  92. package/dist/rendering/handler.js +9 -21
  93. package/dist/security/svgResources.d.ts +0 -10
  94. package/dist/security/svgResources.js +0 -12
  95. package/dist/source/index.d.ts +3 -3
  96. package/dist/source/index.js +1 -1
  97. package/dist/source/loading.d.ts +4 -4
  98. package/dist/source/loading.js +4 -7
  99. package/dist/source/precheck.d.ts +1 -13
  100. package/dist/source/precheck.js +2 -9
  101. package/dist/source/textEncoding.d.ts +0 -18
  102. package/dist/source/textEncoding.js +0 -15
  103. package/dist/viewer/createViewer.d.ts +1 -1
  104. package/dist/viewer/createViewer.js +17 -28
  105. package/dist/viewer/loading.d.ts +2 -6
  106. package/dist/viewer/loading.js +1 -9
  107. package/dist/viewer/operations.d.ts +3 -3
  108. package/dist/viewer/operations.js +6 -14
  109. package/dist/viewer/state.d.ts +2 -6
  110. package/dist/viewer/state.js +3 -8
  111. package/package.json +3 -1
@@ -1,6 +1,6 @@
1
- import { triggerFileViewerBlobDownload, triggerFileViewerUrlDownload, waitForFileViewerPrintWindowReady, } from '../output/export.js';
2
- import { DEFAULT_FILE_VIEWER_SOURCE_FILENAME } from '../source/index.js';
3
- import { translateFileViewerMessage, } from '../i18n/messages.js';
1
+ import { triggerFileViewerBlobDownload, triggerFileViewerUrlDownload, waitForFileViewerPrintWindowReady, } from "../output/export.js";
2
+ import { DEFAULT_FILE_VIEWER_SOURCE_FILENAME } from "../source/index.js";
3
+ import { translateFileViewerMessage, } from "../i18n/messages.js";
4
4
  export const DEFAULT_FILE_VIEWER_PREVIEW_TITLE = 'file-viewer-preview';
5
5
  export const DEFAULT_FILE_VIEWER_EXPORT_FILENAME = 'preview';
6
6
  export const DEFAULT_FILE_VIEWER_DOWNLOAD_FILENAME = DEFAULT_FILE_VIEWER_SOURCE_FILENAME;
@@ -65,7 +65,7 @@ const buildRenderedHtmlDocumentFromOperation = async (mode, { source, title, fil
65
65
  if (!source) {
66
66
  throw new Error(translateFileViewerMessage(i18n, 'error.noExportContent'));
67
67
  }
68
- const { buildFileViewerRenderedHtmlDocument } = await import('../export.js');
68
+ const { buildFileViewerRenderedHtmlDocument } = await import("../export.js");
69
69
  return buildFileViewerRenderedHtmlDocument({
70
70
  source,
71
71
  mode,
@@ -82,7 +82,7 @@ const buildRenderedDomDocumentFromOperation = async ({ source, title, filename,
82
82
  if (!source) {
83
83
  throw new Error(translateFileViewerMessage(i18n, 'error.noExportContent'));
84
84
  }
85
- const { buildFileViewerRenderedDomDocument } = await import('../export.js');
85
+ const { buildFileViewerRenderedDomDocument } = await import("../export.js");
86
86
  return buildFileViewerRenderedDomDocument({
87
87
  source,
88
88
  mode: 'print',
@@ -157,11 +157,6 @@ export const executeFileViewerDownloadOperation = async ({ source, filename, bef
157
157
  source,
158
158
  fallback: DEFAULT_FILE_VIEWER_DOWNLOAD_FILENAME,
159
159
  });
160
- // PDF.js transfers ArrayBuffer-backed data to its worker. After a successful
161
- // render the original buffer can therefore be detached (byteLength === 0),
162
- // while the File or URL retained by the viewer is still the complete source.
163
- // Preserve the existing buffer-first contract for non-empty buffers, but do
164
- // not turn a detached buffer into a zero-byte download.
165
160
  if (source.buffer &&
166
161
  (source.buffer.byteLength > 0 || (!source.file && !source.url))) {
167
162
  triggerFileViewerBlobDownload(new Blob([source.buffer], { type: source.mimeType || ((_a = source.file) === null || _a === void 0 ? void 0 : _a.type) || 'application/octet-stream' }), resolvedFilename);
@@ -175,8 +170,6 @@ export const executeFileViewerDownloadOperation = async ({ source, filename, bef
175
170
  triggerFileViewerUrlDownload(source.url, resolvedFilename);
176
171
  return true;
177
172
  }
178
- // Empty local files are valid sources. These final fallbacks preserve their
179
- // intentional zero-byte downloads when no complete File or URL is available.
180
173
  if (source.file) {
181
174
  triggerFileViewerBlobDownload(source.file, resolvedFilename);
182
175
  return true;
@@ -210,7 +203,6 @@ export const executeFileViewerPrintOperation = async ({ autoPrint = true, before
210
203
  if (beforeResult === false) {
211
204
  return false;
212
205
  }
213
- // Preserve the browser's transient user activation while the snapshot is built.
214
206
  const ownsPrintWindow = !printWindow;
215
207
  const targetWindow = printWindow ||
216
208
  (openWindow === null || openWindow === void 0 ? void 0 : openWindow()) ||
@@ -348,7 +340,7 @@ export const createFileViewerOperationActionHandlers = ({ getBuffer, getFile, ge
348
340
  if (!source) {
349
341
  throw new Error(translateFileViewerMessage(resolveI18n(), 'error.noExportContent'));
350
342
  }
351
- const { openFileViewerPrintMaskDesignerAsync } = await import('../features/printMaskLoader.js');
343
+ const { openFileViewerPrintMaskDesignerAsync } = await import("../features/printMaskLoader.js");
352
344
  const adapter = (_a = getAdapter === null || getAdapter === void 0 ? void 0 : getAdapter()) !== null && _a !== void 0 ? _a : null;
353
345
  const result = await openFileViewerPrintMaskDesignerAsync({
354
346
  root: source,
@@ -1,10 +1,6 @@
1
- import { type FileViewerI18nInput } from '../i18n/messages.js';
2
- import type { FileViewerRendererCategory, FileViewerStateDescriptor, FileViewerStateTheme } from '../contracts/types.js';
1
+ import { type FileViewerI18nInput } from "../i18n/messages.js";
2
+ import type { FileViewerRendererCategory, FileViewerStateDescriptor, FileViewerStateTheme } from "../contracts/types.js";
3
3
  export type FileViewerErrorMessageFormatter = (prefix: string, error: unknown, i18n?: FileViewerI18nInput) => string;
4
- /**
5
- * Renderers can attach a localized, user-safe explanation without replacing
6
- * the original error object that hosts use for diagnostics and recovery.
7
- */
8
4
  export declare const FILE_VIEWER_ERROR_MESSAGE: "fileViewerErrorMessage";
9
5
  export interface FileViewerErrorMessageCarrier {
10
6
  [FILE_VIEWER_ERROR_MESSAGE]?: string;
@@ -1,10 +1,6 @@
1
- import { normalizeFileExtension } from '../source/index.js';
2
- import { DEFAULT_RENDERER_DEFINITIONS } from '../registry/formats.js';
3
- import { resolveFileViewerLocale, translateFileViewerMessage, } from '../i18n/messages.js';
4
- /**
5
- * Renderers can attach a localized, user-safe explanation without replacing
6
- * the original error object that hosts use for diagnostics and recovery.
7
- */
1
+ import { normalizeFileExtension } from "../source/index.js";
2
+ import { DEFAULT_RENDERER_DEFINITIONS } from "../registry/formats.js";
3
+ import { resolveFileViewerLocale, translateFileViewerMessage, } from "../i18n/messages.js";
8
4
  export const FILE_VIEWER_ERROR_MESSAGE = 'fileViewerErrorMessage';
9
5
  export const attachFileViewerErrorMessage = (error, message) => {
10
6
  const normalizedMessage = message.trim();
@@ -20,7 +16,6 @@ export const attachFileViewerErrorMessage = (error, message) => {
20
16
  return error;
21
17
  }
22
18
  catch {
23
- // Frozen cross-realm errors retain their original value as the cause below.
24
19
  }
25
20
  }
26
21
  const presented = new Error(normalizedMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/core",
3
- "version": "3.3.1",
3
+ "version": "3.3.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Framework-neutral TypeScript APIs for browser-side file preview, renderer presets, search, zoom, page navigation, print and export.",
@@ -88,6 +88,8 @@
88
88
  "dist/browser/source-feedback.js",
89
89
  "dist/browser/toolbar-focus.d.ts",
90
90
  "dist/browser/toolbar-focus.js",
91
+ "dist/browser/toolbar-keyboard.d.ts",
92
+ "dist/browser/toolbar-keyboard.js",
91
93
  "dist/config/options.d.ts",
92
94
  "dist/config/options.js",
93
95
  "dist/contracts/types.d.ts",