@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.
- package/dist/assets.d.ts +2 -2
- package/dist/assets.js +1 -5
- package/dist/browser/controller.d.ts +1 -2
- package/dist/browser/controller.js +8 -39
- package/dist/browser/source-feedback.d.ts +1 -2
- package/dist/browser/source-feedback.js +2 -3
- package/dist/browser/toolbar-focus.d.ts +0 -1
- package/dist/browser/toolbar-focus.js +0 -3
- package/dist/browser/toolbar-keyboard.d.ts +1 -0
- package/dist/browser/toolbar-keyboard.js +63 -0
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +2 -2
- package/dist/config/options.d.ts +1 -1
- package/dist/contracts/types.d.ts +1 -470
- package/dist/contracts/xml.d.ts +0 -11
- package/dist/export.d.ts +3 -10
- package/dist/export.js +2 -9
- package/dist/exportDocument.d.ts +1 -12
- package/dist/exportDocument.js +2 -31
- package/dist/features/document/dom/anchors.d.ts +1 -1
- package/dist/features/document/dom/index.d.ts +5 -5
- package/dist/features/document/dom/index.js +3 -3
- package/dist/features/document/dom/providers.d.ts +1 -1
- package/dist/features/document/events.d.ts +2 -2
- package/dist/features/document/events.js +3 -3
- package/dist/features/document/fit.d.ts +1 -1
- package/dist/features/document/fit.js +1 -1
- package/dist/features/document/imageHandTool.d.ts +0 -2
- package/dist/features/document/imageHandTool.js +1 -5
- package/dist/features/document/model.d.ts +1 -1
- package/dist/features/document/search.d.ts +1 -1
- package/dist/features/document/search.js +2 -2
- package/dist/features/document/viewState.d.ts +1 -1
- package/dist/features/document/viewState.js +2 -2
- package/dist/features/document/zoom.d.ts +1 -1
- package/dist/features/document/zoom.js +3 -3
- package/dist/features/document/zoomGestures.d.ts +2 -2
- package/dist/features/document/zoomGestures.js +0 -2
- package/dist/features/printMask.d.ts +1 -1
- package/dist/features/printMaskDesigner.d.ts +2 -6
- package/dist/features/printMaskDesigner.js +2 -11
- package/dist/features/printMaskLoader.d.ts +1 -7
- package/dist/features/printMaskLoader.js +1 -7
- package/dist/features/watermark.d.ts +1 -1
- package/dist/headless.d.ts +29 -29
- package/dist/headless.js +16 -21
- package/dist/i18n/messages.d.ts +1 -1
- package/dist/i18n/messages.de.d.ts +1 -5
- package/dist/i18n/messages.de.js +1 -5
- package/dist/i18n/messages.ja.d.ts +1 -6
- package/dist/i18n/messages.ja.js +1 -6
- package/dist/i18n/messages.js +4 -4
- package/dist/index.d.ts +77 -77
- package/dist/index.js +39 -39
- package/dist/lifecycle/facade.d.ts +4 -4
- package/dist/lifecycle/facade.js +2 -2
- package/dist/lifecycle/operations.d.ts +4 -5
- package/dist/lifecycle/operations.js +4 -10
- package/dist/output/canvasImage.d.ts +1 -2
- package/dist/output/canvasImage.js +1 -4
- package/dist/output/export.d.ts +1 -3
- package/dist/output/export.js +0 -12
- package/dist/output/printLayout.d.ts +0 -5
- package/dist/output/printLayout.js +0 -4
- package/dist/output/snapshotDownload.d.ts +1 -2
- package/dist/output/snapshotDownload.js +2 -3
- package/dist/platform/assets.d.ts +4 -11
- package/dist/platform/assets.js +20 -45
- package/dist/platform/copiedAssets.d.ts +0 -1
- package/dist/platform/copiedAssets.js +1 -2
- package/dist/presentation/colorScheme.d.ts +1 -2
- package/dist/presentation/colorScheme.js +1 -2
- package/dist/presentation/state.d.ts +1 -1
- package/dist/presentation/state.js +3 -3
- package/dist/print-mask.d.ts +2 -2
- package/dist/print-mask.js +1 -1
- package/dist/registry/capabilities.d.ts +1 -14
- package/dist/registry/capabilities.js +2 -15
- package/dist/registry/formats.d.ts +1 -1
- package/dist/registry/formats.generated.d.ts +2 -3
- package/dist/registry/formats.generated.js +2 -3
- package/dist/registry/formats.js +2 -2
- package/dist/registry/registry.d.ts +1 -15
- package/dist/registry/registry.js +2 -10
- package/dist/renderers/image.d.ts +1 -1
- package/dist/renderers/image.js +5 -7
- package/dist/renderers/index.d.ts +3 -3
- package/dist/renderers/index.js +5 -11
- package/dist/rendering/dispatcher.d.ts +1 -6
- package/dist/rendering/dispatcher.js +3 -3
- package/dist/rendering/handler.d.ts +3 -13
- package/dist/rendering/handler.js +9 -21
- package/dist/security/svgResources.d.ts +0 -10
- package/dist/security/svgResources.js +0 -12
- package/dist/source/index.d.ts +3 -3
- package/dist/source/index.js +1 -1
- package/dist/source/loading.d.ts +4 -4
- package/dist/source/loading.js +4 -7
- package/dist/source/precheck.d.ts +1 -13
- package/dist/source/precheck.js +2 -9
- package/dist/source/textEncoding.d.ts +0 -18
- package/dist/source/textEncoding.js +0 -15
- package/dist/viewer/createViewer.d.ts +1 -1
- package/dist/viewer/createViewer.js +17 -28
- package/dist/viewer/loading.d.ts +2 -6
- package/dist/viewer/loading.js +1 -9
- package/dist/viewer/operations.d.ts +3 -3
- package/dist/viewer/operations.js +6 -14
- package/dist/viewer/state.d.ts +2 -6
- package/dist/viewer/state.js +3 -8
- package/package.json +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { triggerFileViewerBlobDownload, triggerFileViewerUrlDownload, waitForFileViewerPrintWindowReady, } from
|
|
2
|
-
import { DEFAULT_FILE_VIEWER_SOURCE_FILENAME } from
|
|
3
|
-
import { translateFileViewerMessage, } from
|
|
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(
|
|
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(
|
|
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(
|
|
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,
|
package/dist/viewer/state.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { type FileViewerI18nInput } from
|
|
2
|
-
import type { FileViewerRendererCategory, FileViewerStateDescriptor, FileViewerStateTheme } from
|
|
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;
|
package/dist/viewer/state.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { normalizeFileExtension } from
|
|
2
|
-
import { DEFAULT_RENDERER_DEFINITIONS } from
|
|
3
|
-
import { resolveFileViewerLocale, translateFileViewerMessage, } from
|
|
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.
|
|
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",
|