@file-viewer/core 3.2.1 → 3.3.0
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.en.md +162 -3
- package/README.md +162 -3
- package/README.zh-CN.md +171 -0
- package/dist/browser/controller.js +58 -25
- package/dist/browser/toolbar-focus.d.ts +1 -0
- package/dist/browser/toolbar-focus.js +43 -0
- package/dist/contracts/types.d.ts +22 -0
- package/dist/features/document/imageHandTool.d.ts +1 -0
- package/dist/features/document/imageHandTool.js +137 -0
- package/dist/features/document/viewState.js +20 -2
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +4 -2
- package/dist/lifecycle/operations.d.ts +1 -0
- package/dist/lifecycle/operations.js +11 -0
- package/dist/platform/assets.d.ts +9 -1
- package/dist/platform/assets.js +50 -2
- package/dist/presentation/colorScheme.d.ts +2 -0
- package/dist/presentation/colorScheme.js +39 -0
- package/dist/registry/formats.generated.d.ts +1 -1
- package/dist/registry/formats.generated.js +1 -1
- package/dist/renderers/image.js +7 -3
- package/dist/renderers/index.d.ts +1 -1
- package/dist/source/loading.d.ts +8 -3
- package/dist/source/loading.js +16 -14
- package/dist/viewer/createViewer.js +2 -0
- package/package.json +10 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { appendFileViewerStyle, applyFileViewerZoomAvailability, createViewer, isFileViewerShadowRoot, normalizeFileViewerUiDensity, normalizeFileViewerTheme, normalizeFileViewerStyleIsolation, syncFileViewerRenderSurfaceBackground, } from "../index.js";
|
|
2
|
-
import { DEFAULT_FILE_VIEWER_SOURCE_FILENAME, createFileViewerTranslator, getExtension, normalizeFileViewerSourceUrl, hasVisibleFileViewerToolbarActions, isFileViewerZoomButtonDisabled, normalizeFileViewerToolbar, normalizeFilename, readFileViewerBuffer, resolveFileViewerSourceFilename, resolveFileViewerColorScheme, resolveFileViewerToolbarOrder, resolveFileViewerToolbarPosition, resolveVisibleFileViewerToolbar, toggleFileViewerColorScheme, wrapFileViewerFileRef, } from "../index.js";
|
|
1
|
+
import { appendFileViewerStyle, cloneFileViewerViewState, applyFileViewerZoomAvailability, createViewer, isFileViewerShadowRoot, normalizeFileViewerUiDensity, normalizeFileViewerTheme, normalizeFileViewerStyleIsolation, syncFileViewerRenderSurfaceBackground, } from "../index.js";
|
|
2
|
+
import { DEFAULT_FILE_VIEWER_SOURCE_FILENAME, createFileViewerTranslator, getExtension, normalizeFileViewerSourceUrl, hasVisibleFileViewerToolbarActions, isFileViewerZoomButtonDisabled, normalizeFileViewerToolbar, normalizeFilename, readFileViewerBuffer, resolveFileViewerSourceFilename, resolveFileViewerRemoteSourcePlan, resolveFileViewerColorScheme, resolveFileViewerToolbarOrder, resolveFileViewerToolbarPosition, resolveVisibleFileViewerToolbar, toggleFileViewerColorScheme, wrapFileViewerFileRef, } from "../index.js";
|
|
3
|
+
import { resolveFileViewerToolbarZoomButtons } from "../lifecycle/operations.js";
|
|
4
|
+
import { createToolbarFocusRestorer } from "./toolbar-focus.js";
|
|
3
5
|
const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
4
6
|
const hasSource = (options = {}) => {
|
|
5
7
|
return !!(options.url || options.file || options.buffer);
|
|
@@ -25,6 +27,7 @@ const RENDER_AFFECTING_VIEWER_OPTION_KEYS = [
|
|
|
25
27
|
'archive',
|
|
26
28
|
'chm',
|
|
27
29
|
'pdf',
|
|
30
|
+
'epub',
|
|
28
31
|
'docx',
|
|
29
32
|
'presentation',
|
|
30
33
|
'spreadsheet',
|
|
@@ -137,6 +140,13 @@ const resolveViewerLoadSource = async (source, options = {}) => {
|
|
|
137
140
|
};
|
|
138
141
|
}
|
|
139
142
|
if (source.url) {
|
|
143
|
+
const plan = resolveFileViewerRemoteSourcePlan({
|
|
144
|
+
url: source.url, filename, type,
|
|
145
|
+
pageHref: options.pageHref, streaming: options.streaming,
|
|
146
|
+
});
|
|
147
|
+
if (!options.fetchFile && options.acceptsPdfUrl && plan.streamPdf) {
|
|
148
|
+
return { url: plan.url, filename: plan.filename, type: plan.extension, size: source.size };
|
|
149
|
+
}
|
|
140
150
|
const fileRef = await (options.fetchFile || defaultFetchFile)({
|
|
141
151
|
url: source.url,
|
|
142
152
|
signal: options.signal,
|
|
@@ -280,9 +290,6 @@ const callApi = async (api, action, fallback) => {
|
|
|
280
290
|
}
|
|
281
291
|
return action(api);
|
|
282
292
|
};
|
|
283
|
-
const isAbortError = (error) => {
|
|
284
|
-
return Boolean(error && typeof error === 'object' && error.name === 'AbortError');
|
|
285
|
-
};
|
|
286
293
|
const DEFAULT_TOOLBAR_AVAILABILITY = {
|
|
287
294
|
download: false,
|
|
288
295
|
print: false,
|
|
@@ -486,15 +493,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
486
493
|
: null,
|
|
487
494
|
zoom: state.zoom ? { ...state.zoom } : null,
|
|
488
495
|
location: state.location ? { ...state.location } : null,
|
|
489
|
-
viewState: state.viewState
|
|
490
|
-
? {
|
|
491
|
-
...state.viewState,
|
|
492
|
-
zoom: state.viewState.zoom ? { ...state.viewState.zoom } : undefined,
|
|
493
|
-
scroll: state.viewState.scroll ? { ...state.viewState.scroll } : undefined,
|
|
494
|
-
navigation: state.viewState.navigation ? { ...state.viewState.navigation } : undefined,
|
|
495
|
-
extra: state.viewState.extra ? { ...state.viewState.extra } : undefined,
|
|
496
|
-
}
|
|
497
|
-
: null,
|
|
496
|
+
viewState: cloneFileViewerViewState(state.viewState),
|
|
498
497
|
});
|
|
499
498
|
const syncShellTheme = () => {
|
|
500
499
|
var _a, _b, _c;
|
|
@@ -502,6 +501,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
502
501
|
shell.dataset.viewerDensity = normalizeFileViewerUiDensity((_c = (_b = currentOptions.options) === null || _b === void 0 ? void 0 : _b.ui) === null || _c === void 0 ? void 0 : _c.density);
|
|
503
502
|
syncFileViewerRenderSurfaceBackground(shell, currentOptions.options);
|
|
504
503
|
};
|
|
504
|
+
const captureToolbarFocus = createToolbarFocusRestorer(toolbarEl, contentEl);
|
|
505
505
|
let controller = null;
|
|
506
506
|
let searchDraft = '';
|
|
507
507
|
const isSearchToolbarVisible = (toolbar, options) => {
|
|
@@ -519,21 +519,30 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
519
519
|
if (disposed) {
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
|
+
const restoreToolbarFocus = captureToolbarFocus();
|
|
522
523
|
syncShellTheme();
|
|
523
524
|
const options = currentOptions.options || {};
|
|
524
525
|
const toolbar = normalizeFileViewerToolbar(options);
|
|
525
526
|
const availability = getToolbarAvailability();
|
|
526
527
|
const showSearchToolbar = isSearchToolbarVisible(toolbar, options);
|
|
528
|
+
const zoomState = getToolbarZoomState();
|
|
529
|
+
const zoomButtons = resolveFileViewerToolbarZoomButtons({
|
|
530
|
+
toolbar,
|
|
531
|
+
zoomState,
|
|
532
|
+
renderedReady: state.ready,
|
|
533
|
+
hasError: !!state.error,
|
|
534
|
+
});
|
|
527
535
|
const visibleToolbar = resolveVisibleFileViewerToolbar(toolbar, availability, showSearchToolbar);
|
|
536
|
+
visibleToolbar.zoom = zoomButtons.zoomIn || zoomButtons.zoomOut || zoomButtons.zoomReset;
|
|
528
537
|
const showToolbar = hasVisibleFileViewerToolbarActions(visibleToolbar);
|
|
529
538
|
const toolbarPosition = resolveFileViewerToolbarPosition(options, getCurrentExtension());
|
|
530
539
|
const toolbarDisabled = state.loading || !!state.error;
|
|
531
|
-
const zoomState = getToolbarZoomState();
|
|
532
540
|
const t = createFileViewerTranslator(options);
|
|
533
541
|
toolbarEl.hidden = !showToolbar;
|
|
534
542
|
toolbarEl.dataset.toolbarPosition = toolbarPosition;
|
|
535
543
|
toolbarEl.replaceChildren();
|
|
536
544
|
if (!showToolbar) {
|
|
545
|
+
restoreToolbarFocus();
|
|
537
546
|
return;
|
|
538
547
|
}
|
|
539
548
|
const appendSearchToolbar = () => {
|
|
@@ -551,6 +560,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
551
560
|
group.setAttribute('aria-label', t('toolbar.search'));
|
|
552
561
|
const input = documentRef.createElement('input');
|
|
553
562
|
input.type = 'search';
|
|
563
|
+
input.dataset.viewerToolbarKey = 'search-input';
|
|
554
564
|
addPart(input, 'input');
|
|
555
565
|
input.value = searchDraft;
|
|
556
566
|
input.placeholder = t('toolbar.searchPlaceholder');
|
|
@@ -562,16 +572,19 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
562
572
|
});
|
|
563
573
|
const searchButton = documentRef.createElement('button');
|
|
564
574
|
searchButton.type = 'submit';
|
|
575
|
+
searchButton.dataset.viewerToolbarKey = 'search-submit';
|
|
565
576
|
addPart(searchButton, 'button');
|
|
566
577
|
searchButton.textContent = t('toolbar.search');
|
|
567
578
|
searchButton.title = t('toolbar.search');
|
|
568
579
|
searchButton.setAttribute('aria-label', t('toolbar.search'));
|
|
569
580
|
searchButton.disabled = toolbarDisabled;
|
|
570
581
|
const previousButton = createButton(documentRef, '<', 'file-viewer-web-icon-button', () => controller === null || controller === void 0 ? void 0 : controller.previousSearchResult());
|
|
582
|
+
previousButton.dataset.viewerToolbarKey = 'search-previous';
|
|
571
583
|
previousButton.title = t('toolbar.searchPrevious');
|
|
572
584
|
previousButton.setAttribute('aria-label', t('toolbar.searchPrevious'));
|
|
573
585
|
previousButton.disabled = toolbarDisabled || searchTotal < 1;
|
|
574
586
|
const nextButton = createButton(documentRef, '>', 'file-viewer-web-icon-button', () => controller === null || controller === void 0 ? void 0 : controller.nextSearchResult());
|
|
587
|
+
nextButton.dataset.viewerToolbarKey = 'search-next';
|
|
575
588
|
nextButton.title = t('toolbar.searchNext');
|
|
576
589
|
nextButton.setAttribute('aria-label', t('toolbar.searchNext'));
|
|
577
590
|
nextButton.disabled = toolbarDisabled || searchTotal < 1;
|
|
@@ -579,6 +592,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
579
592
|
searchDraft = '';
|
|
580
593
|
await (controller === null || controller === void 0 ? void 0 : controller.clearDocumentSearch());
|
|
581
594
|
});
|
|
595
|
+
clearButton.dataset.viewerToolbarKey = 'search-clear';
|
|
582
596
|
clearButton.title = t('toolbar.searchClear');
|
|
583
597
|
clearButton.setAttribute('aria-label', t('toolbar.searchClear'));
|
|
584
598
|
clearButton.disabled = toolbarDisabled || (!searchDraft && !(searchState === null || searchState === void 0 ? void 0 : searchState.query));
|
|
@@ -604,9 +618,10 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
604
618
|
group.className = 'file-viewer-web-toolbar-group';
|
|
605
619
|
addPart(group, 'toolbar-group');
|
|
606
620
|
group.setAttribute('aria-label', t('toolbar.zoomGroup'));
|
|
607
|
-
if (
|
|
621
|
+
if (zoomButtons.zoomOut) {
|
|
608
622
|
const button = createButton(documentRef, '-', 'file-viewer-web-icon-button', () => controller === null || controller === void 0 ? void 0 : controller.zoomOut());
|
|
609
623
|
button.title = t('toolbar.zoomOut');
|
|
624
|
+
button.dataset.viewerToolbarKey = 'zoom-out';
|
|
610
625
|
button.setAttribute('aria-label', t('toolbar.zoomOut'));
|
|
611
626
|
button.disabled = isFileViewerZoomButtonDisabled({
|
|
612
627
|
action: 'canZoomOut',
|
|
@@ -616,9 +631,10 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
616
631
|
});
|
|
617
632
|
group.appendChild(button);
|
|
618
633
|
}
|
|
619
|
-
if (
|
|
634
|
+
if (zoomButtons.zoomReset) {
|
|
620
635
|
const meter = createButton(documentRef, zoomState.label, 'file-viewer-web-zoom-meter', () => controller === null || controller === void 0 ? void 0 : controller.resetZoom());
|
|
621
636
|
meter.title = t('toolbar.zoomReset');
|
|
637
|
+
meter.dataset.viewerToolbarKey = 'zoom-meter';
|
|
622
638
|
meter.disabled = isFileViewerZoomButtonDisabled({
|
|
623
639
|
action: 'canReset',
|
|
624
640
|
availability,
|
|
@@ -630,9 +646,10 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
630
646
|
else {
|
|
631
647
|
group.appendChild(createReadonlyMeter(documentRef, zoomState.label, 'file-viewer-web-zoom-meter'));
|
|
632
648
|
}
|
|
633
|
-
if (
|
|
649
|
+
if (zoomButtons.zoomReset) {
|
|
634
650
|
const button = createButton(documentRef, '1:1', 'file-viewer-web-icon-button', () => controller === null || controller === void 0 ? void 0 : controller.resetZoom());
|
|
635
651
|
button.title = t('toolbar.zoomReset');
|
|
652
|
+
button.dataset.viewerToolbarKey = 'zoom-reset';
|
|
636
653
|
button.setAttribute('aria-label', t('toolbar.zoomReset'));
|
|
637
654
|
button.disabled = isFileViewerZoomButtonDisabled({
|
|
638
655
|
action: 'canReset',
|
|
@@ -642,9 +659,10 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
642
659
|
});
|
|
643
660
|
group.appendChild(button);
|
|
644
661
|
}
|
|
645
|
-
if (
|
|
662
|
+
if (zoomButtons.zoomIn) {
|
|
646
663
|
const button = createButton(documentRef, '+', 'file-viewer-web-icon-button', () => controller === null || controller === void 0 ? void 0 : controller.zoomIn());
|
|
647
664
|
button.title = t('toolbar.zoomIn');
|
|
665
|
+
button.dataset.viewerToolbarKey = 'zoom-in';
|
|
648
666
|
button.setAttribute('aria-label', t('toolbar.zoomIn'));
|
|
649
667
|
button.disabled = isFileViewerZoomButtonDisabled({
|
|
650
668
|
action: 'canZoomIn',
|
|
@@ -658,11 +676,12 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
658
676
|
toolbarEl.appendChild(group);
|
|
659
677
|
}
|
|
660
678
|
};
|
|
661
|
-
const appendToolbarButton = (visible, label, title, onClick) => {
|
|
679
|
+
const appendToolbarButton = (visible, key, label, title, onClick) => {
|
|
662
680
|
if (!visible) {
|
|
663
681
|
return;
|
|
664
682
|
}
|
|
665
683
|
const button = createButton(documentRef, label, '', onClick);
|
|
684
|
+
button.dataset.viewerToolbarKey = key;
|
|
666
685
|
button.title = title;
|
|
667
686
|
button.disabled = toolbarDisabled;
|
|
668
687
|
toolbarEl.appendChild(button);
|
|
@@ -699,6 +718,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
699
718
|
}
|
|
700
719
|
});
|
|
701
720
|
addPart(button, 'theme-toggle');
|
|
721
|
+
button.dataset.viewerToolbarKey = 'theme';
|
|
702
722
|
setThemeButtonIcon(button, currentTheme);
|
|
703
723
|
button.title = title;
|
|
704
724
|
button.setAttribute('aria-label', title);
|
|
@@ -714,7 +734,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
714
734
|
appendZoomToolbar();
|
|
715
735
|
}
|
|
716
736
|
else if (item === 'download') {
|
|
717
|
-
appendToolbarButton(visibleToolbar.download, t('toolbar.download'), t('toolbar.downloadTitle'), () => controller === null || controller === void 0 ? void 0 : controller.downloadOriginalFile());
|
|
737
|
+
appendToolbarButton(visibleToolbar.download, 'download', t('toolbar.download'), t('toolbar.downloadTitle'), () => controller === null || controller === void 0 ? void 0 : controller.downloadOriginalFile());
|
|
718
738
|
}
|
|
719
739
|
else if (item === 'print') {
|
|
720
740
|
if (!visibleToolbar.print) {
|
|
@@ -727,6 +747,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
727
747
|
menu.dataset.open = menu.dataset.open === 'true' ? 'false' : 'true';
|
|
728
748
|
});
|
|
729
749
|
trigger.title = t('toolbar.printTitle');
|
|
750
|
+
trigger.dataset.viewerToolbarKey = 'print';
|
|
730
751
|
trigger.setAttribute('aria-label', t('toolbar.printTitle'));
|
|
731
752
|
trigger.setAttribute('aria-haspopup', 'menu');
|
|
732
753
|
trigger.disabled = toolbarDisabled;
|
|
@@ -741,6 +762,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
741
762
|
await (controller === null || controller === void 0 ? void 0 : controller.printRenderedHtml());
|
|
742
763
|
});
|
|
743
764
|
directButton.title = t('toolbar.printTitle');
|
|
765
|
+
directButton.dataset.viewerToolbarKey = 'print-direct';
|
|
744
766
|
directButton.setAttribute('role', 'menuitem');
|
|
745
767
|
directButton.disabled = toolbarDisabled;
|
|
746
768
|
const maskButton = createButton(documentRef, t('toolbar.printMask'), '', async () => {
|
|
@@ -748,6 +770,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
748
770
|
await (controller === null || controller === void 0 ? void 0 : controller.printWithMask());
|
|
749
771
|
});
|
|
750
772
|
maskButton.title = t('toolbar.printMaskTitle');
|
|
773
|
+
maskButton.dataset.viewerToolbarKey = 'print-mask';
|
|
751
774
|
maskButton.setAttribute('role', 'menuitem');
|
|
752
775
|
maskButton.disabled = toolbarDisabled;
|
|
753
776
|
panel.append(directButton, maskButton);
|
|
@@ -761,12 +784,13 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
761
784
|
toolbarEl.appendChild(menu);
|
|
762
785
|
}
|
|
763
786
|
else if (item === 'exportHtml') {
|
|
764
|
-
appendToolbarButton(visibleToolbar.exportHtml, t('toolbar.exportHtml'), t('toolbar.exportHtmlTitle'), () => controller === null || controller === void 0 ? void 0 : controller.exportRenderedHtml());
|
|
787
|
+
appendToolbarButton(visibleToolbar.exportHtml, 'export-html', t('toolbar.exportHtml'), t('toolbar.exportHtmlTitle'), () => controller === null || controller === void 0 ? void 0 : controller.exportRenderedHtml());
|
|
765
788
|
}
|
|
766
789
|
else if (item === 'theme') {
|
|
767
790
|
appendThemeToolbar();
|
|
768
791
|
}
|
|
769
792
|
});
|
|
793
|
+
restoreToolbarFocus(state.loading || (!state.ready && !state.error));
|
|
770
794
|
};
|
|
771
795
|
let refreshSystemThemeDocument = null;
|
|
772
796
|
const handleViewerColorSchemeChange = () => {
|
|
@@ -840,7 +864,7 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
840
864
|
abortController = null;
|
|
841
865
|
};
|
|
842
866
|
const loadSource = async (nextSource) => {
|
|
843
|
-
var _a;
|
|
867
|
+
var _a, _b, _c, _d, _e, _f;
|
|
844
868
|
cancel();
|
|
845
869
|
currentSource = nextSource;
|
|
846
870
|
abortController = typeof AbortController !== 'undefined' ? new AbortController() : null;
|
|
@@ -849,9 +873,18 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
849
873
|
state.loading = true;
|
|
850
874
|
state.error = null;
|
|
851
875
|
notifyState();
|
|
876
|
+
await ((_a = instance.prepare) === null || _a === void 0 ? void 0 : _a.call(instance));
|
|
877
|
+
if (disposed || (controller === null || controller === void 0 ? void 0 : controller.signal.aborted) || abortController !== controller) {
|
|
878
|
+
return null;
|
|
879
|
+
}
|
|
880
|
+
const extension = nextSource.type || getExtension(resolveViewerSourceFilename(nextSource));
|
|
881
|
+
const renderer = instance.getRenderer(extension);
|
|
852
882
|
const resolvedSource = await resolveViewerLoadSource(nextSource, {
|
|
883
|
+
acceptsPdfUrl: (renderer === null || renderer === void 0 ? void 0 : renderer.sourceAccess) === 'stream-preferred' && Boolean(renderer.load),
|
|
853
884
|
fetchFile: coreOptions.fetchFile,
|
|
854
885
|
signal: controller === null || controller === void 0 ? void 0 : controller.signal,
|
|
886
|
+
streaming: (_c = (_b = currentOptions.options) === null || _b === void 0 ? void 0 : _b.pdf) === null || _c === void 0 ? void 0 : _c.streaming,
|
|
887
|
+
pageHref: (_e = (_d = documentRef.defaultView) === null || _d === void 0 ? void 0 : _d.location) === null || _e === void 0 ? void 0 : _e.href,
|
|
855
888
|
});
|
|
856
889
|
if (disposed || (controller === null || controller === void 0 ? void 0 : controller.signal.aborted) || abortController !== controller) {
|
|
857
890
|
return null;
|
|
@@ -859,14 +892,14 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
859
892
|
return await instance.load(resolvedSource);
|
|
860
893
|
}
|
|
861
894
|
catch (error) {
|
|
862
|
-
if (
|
|
895
|
+
if (disposed || (controller === null || controller === void 0 ? void 0 : controller.signal.aborted) || abortController !== controller) {
|
|
863
896
|
return null;
|
|
864
897
|
}
|
|
865
898
|
state.loading = false;
|
|
866
899
|
state.ready = false;
|
|
867
900
|
state.error = error;
|
|
868
901
|
notifyState();
|
|
869
|
-
(
|
|
902
|
+
(_f = coreOptions.onError) === null || _f === void 0 ? void 0 : _f.call(coreOptions, error, nextSource);
|
|
870
903
|
throw error;
|
|
871
904
|
}
|
|
872
905
|
finally {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createToolbarFocusRestorer(toolbar: HTMLElement, content: HTMLElement): () => (temporarilyUnavailable?: boolean) => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function createToolbarFocusRestorer(toolbar, content) {
|
|
2
|
+
let pendingKey = null;
|
|
3
|
+
const controls = () => Array.from(toolbar.querySelectorAll('[data-viewer-toolbar-key]'));
|
|
4
|
+
return () => {
|
|
5
|
+
const root = toolbar.getRootNode();
|
|
6
|
+
const active = root.activeElement;
|
|
7
|
+
const key = active === toolbar ? pendingKey : active && toolbar.contains(active)
|
|
8
|
+
? active.dataset.viewerToolbarKey : null;
|
|
9
|
+
pendingKey = null;
|
|
10
|
+
if (!key)
|
|
11
|
+
return (_temporarilyUnavailable = false) => undefined;
|
|
12
|
+
const oldIndex = controls().indexOf(active);
|
|
13
|
+
const input = (active === null || active === void 0 ? void 0 : active.tagName) === 'INPUT' ? active : null;
|
|
14
|
+
const selection = input && input.selectionStart !== null
|
|
15
|
+
? [input.selectionStart, input.selectionEnd, input.selectionDirection] : null;
|
|
16
|
+
return (temporarilyUnavailable = false) => {
|
|
17
|
+
if (!toolbar.isConnected)
|
|
18
|
+
return;
|
|
19
|
+
if (toolbar.hidden) {
|
|
20
|
+
content.tabIndex = -1;
|
|
21
|
+
content.focus({ preventScroll: true });
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const all = controls();
|
|
25
|
+
const original = all.find(element => element.dataset.viewerToolbarKey === key);
|
|
26
|
+
const available = (element) => !element.disabled && element.getClientRects().length > 0;
|
|
27
|
+
const index = original ? all.indexOf(original) : Math.max(0, oldIndex);
|
|
28
|
+
const target = original && available(original) ? original
|
|
29
|
+
: temporarilyUnavailable ? undefined
|
|
30
|
+
: all.slice(index).find(available) || all.slice(0, index).reverse().find(available);
|
|
31
|
+
if (target) {
|
|
32
|
+
target.focus({ preventScroll: true });
|
|
33
|
+
if (target === original && target.tagName === 'INPUT' && selection)
|
|
34
|
+
target.setSelectionRange(selection[0], selection[1], selection[2] || undefined);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
pendingKey = key;
|
|
38
|
+
toolbar.tabIndex = -1;
|
|
39
|
+
toolbar.focus({ preventScroll: true });
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -106,8 +106,10 @@ export interface FileViewerArchivePasswordRequestContext {
|
|
|
106
106
|
error?: unknown;
|
|
107
107
|
}
|
|
108
108
|
export interface FileViewerPdfOptions {
|
|
109
|
+
darkMode?: boolean;
|
|
109
110
|
handTool?: boolean;
|
|
110
111
|
toolbar?: boolean;
|
|
112
|
+
zoomToolbar?: boolean;
|
|
111
113
|
navigation?: boolean;
|
|
112
114
|
defaultNavigationVisible?: boolean;
|
|
113
115
|
thumbnails?: boolean;
|
|
@@ -115,6 +117,8 @@ export interface FileViewerPdfOptions {
|
|
|
115
117
|
bbox?: FileViewerPdfBoundingBox | readonly FileViewerPdfBoundingBox[];
|
|
116
118
|
initialViewState?: FileViewerViewState;
|
|
117
119
|
streaming?: boolean | 'same-origin';
|
|
120
|
+
disableStream?: boolean;
|
|
121
|
+
disableAutoFetch?: boolean;
|
|
118
122
|
rangeChunkSize?: number;
|
|
119
123
|
withCredentials?: boolean;
|
|
120
124
|
assetBaseUrl?: string | URL;
|
|
@@ -166,6 +170,9 @@ export interface FileViewerDocxOptions {
|
|
|
166
170
|
externalResourcePolicy?: 'allow' | 'block';
|
|
167
171
|
darkMode?: boolean;
|
|
168
172
|
}
|
|
173
|
+
export interface FileViewerEpubOptions {
|
|
174
|
+
darkMode?: boolean;
|
|
175
|
+
}
|
|
169
176
|
export interface FileViewerSpreadsheetOptions {
|
|
170
177
|
worker?: boolean | 'auto';
|
|
171
178
|
workerUrl?: string;
|
|
@@ -605,10 +612,12 @@ export interface FileViewerOptions {
|
|
|
605
612
|
archive?: FileViewerArchiveOptions;
|
|
606
613
|
chm?: FileViewerChmOptions;
|
|
607
614
|
pdf?: FileViewerPdfOptions;
|
|
615
|
+
epub?: FileViewerEpubOptions;
|
|
608
616
|
docx?: FileViewerDocxOptions;
|
|
609
617
|
presentation?: FileViewerPresentationOptions;
|
|
610
618
|
spreadsheet?: FileViewerSpreadsheetOptions;
|
|
611
619
|
image?: {
|
|
620
|
+
handTool?: boolean;
|
|
612
621
|
rotation?: boolean;
|
|
613
622
|
};
|
|
614
623
|
iwork?: FileViewerIworkOptions;
|
|
@@ -727,7 +736,20 @@ export interface FileViewerNavigationState {
|
|
|
727
736
|
visible?: boolean;
|
|
728
737
|
mode?: string;
|
|
729
738
|
}
|
|
739
|
+
export interface FileViewerSpreadsheetRange {
|
|
740
|
+
sheetId: number;
|
|
741
|
+
startRow: number;
|
|
742
|
+
startCol: number;
|
|
743
|
+
endRow: number;
|
|
744
|
+
endCol: number;
|
|
745
|
+
}
|
|
746
|
+
export type FileViewerSpreadsheetNavigationStatus = 'idle' | 'pending' | 'applied' | 'rejected' | 'cancelled' | 'failed' | 'disposed';
|
|
730
747
|
export interface FileViewerViewState {
|
|
748
|
+
spreadsheet?: {
|
|
749
|
+
sheetId?: number;
|
|
750
|
+
range?: FileViewerSpreadsheetRange;
|
|
751
|
+
status?: FileViewerSpreadsheetNavigationStatus;
|
|
752
|
+
};
|
|
731
753
|
renderer?: string;
|
|
732
754
|
page?: number;
|
|
733
755
|
pageCount?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function installFileViewerImageHandTool(container: HTMLElement, signal?: AbortSignal): () => void;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export function installFileViewerImageHandTool(container, signal) {
|
|
2
|
+
const view = container.ownerDocument.defaultView;
|
|
3
|
+
if (!view || (signal === null || signal === void 0 ? void 0 : signal.aborted))
|
|
4
|
+
return () => { };
|
|
5
|
+
const cursor = container.style.getPropertyValue('cursor');
|
|
6
|
+
const cursorPriority = container.style.getPropertyPriority('cursor');
|
|
7
|
+
const selection = container.style.getPropertyValue('user-select');
|
|
8
|
+
const selectionPriority = container.style.getPropertyPriority('user-select');
|
|
9
|
+
const previousMode = container.getAttribute('data-viewer-image-hand-tool');
|
|
10
|
+
const previousPanning = container.getAttribute('data-viewer-image-panning');
|
|
11
|
+
const style = container.ownerDocument.createElement('style');
|
|
12
|
+
style.textContent = '[data-viewer-image-hand-tool="true"] img{cursor:grab!important}[data-viewer-image-panning="true"] img{cursor:grabbing!important}';
|
|
13
|
+
container.append(style);
|
|
14
|
+
const interactive = 'a,button,input,textarea,select,option,[contenteditable]:not([contenteditable="false"]),[role="button"]:not(img),[role="link"],[role="textbox"]';
|
|
15
|
+
let drag = null;
|
|
16
|
+
let disposed = false;
|
|
17
|
+
let suppressClick = false;
|
|
18
|
+
let clickTimer = 0;
|
|
19
|
+
const canPan = () => container.scrollWidth > container.clientWidth || container.scrollHeight > container.clientHeight;
|
|
20
|
+
const syncCursor = () => {
|
|
21
|
+
if (disposed || (drag === null || drag === void 0 ? void 0 : drag.moved))
|
|
22
|
+
return;
|
|
23
|
+
const enabled = canPan();
|
|
24
|
+
container.setAttribute('data-viewer-image-hand-tool', String(enabled));
|
|
25
|
+
container.style.setProperty('cursor', enabled ? 'grab' : cursor, enabled ? '' : cursorPriority);
|
|
26
|
+
};
|
|
27
|
+
const finish = () => {
|
|
28
|
+
var _a;
|
|
29
|
+
const state = drag;
|
|
30
|
+
if (!state)
|
|
31
|
+
return;
|
|
32
|
+
drag = null;
|
|
33
|
+
container.style.setProperty('user-select', selection, selectionPriority);
|
|
34
|
+
container.removeAttribute('data-viewer-image-panning');
|
|
35
|
+
view.removeEventListener('pointermove', move, true);
|
|
36
|
+
view.removeEventListener('pointerup', up, true);
|
|
37
|
+
view.removeEventListener('pointercancel', up, true);
|
|
38
|
+
view.removeEventListener('blur', finish);
|
|
39
|
+
if ((_a = container.hasPointerCapture) === null || _a === void 0 ? void 0 : _a.call(container, state.id))
|
|
40
|
+
container.releasePointerCapture(state.id);
|
|
41
|
+
suppressClick = state.moved;
|
|
42
|
+
view.clearTimeout(clickTimer);
|
|
43
|
+
clickTimer = view.setTimeout(() => { suppressClick = false; }, 250);
|
|
44
|
+
syncCursor();
|
|
45
|
+
};
|
|
46
|
+
const move = (event) => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (!drag || event.pointerId !== drag.id)
|
|
49
|
+
return;
|
|
50
|
+
if (!(event.buttons & 1)) {
|
|
51
|
+
finish();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const dx = (event.clientX - drag.x) / drag.ratioX;
|
|
55
|
+
const dy = (event.clientY - drag.y) / drag.ratioY;
|
|
56
|
+
if (!drag.moved && Math.hypot(dx, dy) < 3)
|
|
57
|
+
return;
|
|
58
|
+
if (!drag.moved) {
|
|
59
|
+
drag.moved = true;
|
|
60
|
+
container.setAttribute('data-viewer-image-panning', 'true');
|
|
61
|
+
container.style.cursor = 'grabbing';
|
|
62
|
+
container.style.setProperty('user-select', 'none');
|
|
63
|
+
try {
|
|
64
|
+
(_a = container.setPointerCapture) === null || _a === void 0 ? void 0 : _a.call(container, event.pointerId);
|
|
65
|
+
}
|
|
66
|
+
catch { }
|
|
67
|
+
}
|
|
68
|
+
container.scrollLeft = drag.left - dx;
|
|
69
|
+
container.scrollTop = drag.top - dy;
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
};
|
|
72
|
+
const up = (event) => { if (event.pointerId === (drag === null || drag === void 0 ? void 0 : drag.id))
|
|
73
|
+
finish(); };
|
|
74
|
+
const down = (event) => {
|
|
75
|
+
if (disposed || event.defaultPrevented || event.pointerType !== 'mouse' || event.button !== 0 || event.isPrimary === false || event.ctrlKey || event.metaKey || event.altKey || event.shiftKey)
|
|
76
|
+
return;
|
|
77
|
+
if (event.composedPath().some(node => { var _a, _b; return node !== container && ((_b = (_a = node).matches) === null || _b === void 0 ? void 0 : _b.call(_a, interactive)); }))
|
|
78
|
+
return;
|
|
79
|
+
finish();
|
|
80
|
+
suppressClick = false;
|
|
81
|
+
syncCursor();
|
|
82
|
+
if (!canPan())
|
|
83
|
+
return;
|
|
84
|
+
const rect = container.getBoundingClientRect();
|
|
85
|
+
const ratioX = container.offsetWidth ? rect.width / container.offsetWidth : 1;
|
|
86
|
+
const ratioY = container.offsetHeight ? rect.height / container.offsetHeight : 1;
|
|
87
|
+
if (![ratioX, ratioY].every(value => Number.isFinite(value) && value > 0))
|
|
88
|
+
return;
|
|
89
|
+
const x = (event.clientX - rect.left) / ratioX - container.clientLeft;
|
|
90
|
+
const y = (event.clientY - rect.top) / ratioY - container.clientTop;
|
|
91
|
+
if (x < 0 || y < 0 || x >= container.clientWidth || y >= container.clientHeight)
|
|
92
|
+
return;
|
|
93
|
+
drag = { id: event.pointerId, x: event.clientX, y: event.clientY, left: container.scrollLeft, top: container.scrollTop, ratioX, ratioY, moved: false };
|
|
94
|
+
view.addEventListener('pointermove', move, { capture: true, passive: false });
|
|
95
|
+
view.addEventListener('pointerup', up, true);
|
|
96
|
+
view.addEventListener('pointercancel', up, true);
|
|
97
|
+
view.addEventListener('blur', finish);
|
|
98
|
+
};
|
|
99
|
+
const click = (event) => {
|
|
100
|
+
if (suppressClick && event.detail > 0) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
event.stopImmediatePropagation();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const nativeDrag = (event) => { if (drag)
|
|
106
|
+
event.preventDefault(); };
|
|
107
|
+
const restoreAttribute = (name, value) => value === null ? container.removeAttribute(name) : container.setAttribute(name, value);
|
|
108
|
+
const dispose = () => {
|
|
109
|
+
if (disposed)
|
|
110
|
+
return;
|
|
111
|
+
finish();
|
|
112
|
+
disposed = true;
|
|
113
|
+
view.clearTimeout(clickTimer);
|
|
114
|
+
suppressClick = false;
|
|
115
|
+
container.style.setProperty('cursor', cursor, cursorPriority);
|
|
116
|
+
container.style.setProperty('user-select', selection, selectionPriority);
|
|
117
|
+
restoreAttribute('data-viewer-image-hand-tool', previousMode);
|
|
118
|
+
restoreAttribute('data-viewer-image-panning', previousPanning);
|
|
119
|
+
container.removeEventListener('pointerdown', down);
|
|
120
|
+
container.removeEventListener('pointermove', syncCursor);
|
|
121
|
+
container.removeEventListener('pointerover', syncCursor);
|
|
122
|
+
container.removeEventListener('lostpointercapture', up);
|
|
123
|
+
container.removeEventListener('click', click, true);
|
|
124
|
+
container.removeEventListener('dragstart', nativeDrag);
|
|
125
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', dispose);
|
|
126
|
+
style.remove();
|
|
127
|
+
};
|
|
128
|
+
container.addEventListener('pointerdown', down);
|
|
129
|
+
container.addEventListener('pointermove', syncCursor);
|
|
130
|
+
container.addEventListener('pointerover', syncCursor);
|
|
131
|
+
container.addEventListener('lostpointercapture', up);
|
|
132
|
+
container.addEventListener('click', click, true);
|
|
133
|
+
container.addEventListener('dragstart', nativeDrag);
|
|
134
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', dispose, { once: true });
|
|
135
|
+
syncCursor();
|
|
136
|
+
return dispose;
|
|
137
|
+
}
|
|
@@ -6,6 +6,10 @@ export const cloneFileViewerViewState = (state) => {
|
|
|
6
6
|
}
|
|
7
7
|
return {
|
|
8
8
|
...state,
|
|
9
|
+
spreadsheet: state.spreadsheet ? {
|
|
10
|
+
...state.spreadsheet,
|
|
11
|
+
range: state.spreadsheet.range ? { ...state.spreadsheet.range } : undefined,
|
|
12
|
+
} : undefined,
|
|
9
13
|
zoom: state.zoom ? { ...state.zoom } : undefined,
|
|
10
14
|
scroll: state.scroll ? { ...state.scroll } : undefined,
|
|
11
15
|
navigation: state.navigation ? { ...state.navigation } : undefined,
|
|
@@ -253,6 +257,8 @@ export const createFileViewerViewStateController = ({ root, enabled, onChange, }
|
|
|
253
257
|
let unsubscribe = null;
|
|
254
258
|
let observer = null;
|
|
255
259
|
let state = null;
|
|
260
|
+
let applySequence = 0;
|
|
261
|
+
let destroyed = false;
|
|
256
262
|
const readProviderState = () => { var _a; return cloneFileViewerViewState(((_a = provider === null || provider === void 0 ? void 0 : provider.getState) === null || _a === void 0 ? void 0 : _a.call(provider)) || null); };
|
|
257
263
|
const commitState = (nextState, change) => {
|
|
258
264
|
state = cloneFileViewerViewState(nextState);
|
|
@@ -265,6 +271,7 @@ export const createFileViewerViewStateController = ({ root, enabled, onChange, }
|
|
|
265
271
|
return cloneFileViewerViewState(state);
|
|
266
272
|
};
|
|
267
273
|
const clearProvider = () => {
|
|
274
|
+
applySequence += 1;
|
|
268
275
|
unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
|
|
269
276
|
unsubscribe = null;
|
|
270
277
|
provider = null;
|
|
@@ -272,15 +279,18 @@ export const createFileViewerViewStateController = ({ root, enabled, onChange, }
|
|
|
272
279
|
};
|
|
273
280
|
const syncProvider = () => {
|
|
274
281
|
var _a;
|
|
275
|
-
if ((enabled === null || enabled === void 0 ? void 0 : enabled()) === false) {
|
|
282
|
+
if (destroyed || (enabled === null || enabled === void 0 ? void 0 : enabled()) === false) {
|
|
276
283
|
clearProvider();
|
|
277
284
|
return null;
|
|
278
285
|
}
|
|
279
286
|
const nextProvider = findFileViewerViewStateProvider(root());
|
|
280
287
|
if (nextProvider !== provider) {
|
|
288
|
+
applySequence += 1;
|
|
281
289
|
unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
|
|
282
290
|
provider = nextProvider;
|
|
283
291
|
unsubscribe = ((_a = nextProvider === null || nextProvider === void 0 ? void 0 : nextProvider.subscribe) === null || _a === void 0 ? void 0 : _a.call(nextProvider, change => {
|
|
292
|
+
if (destroyed || provider !== nextProvider)
|
|
293
|
+
return;
|
|
284
294
|
commitState(change.state, change);
|
|
285
295
|
})) || null;
|
|
286
296
|
}
|
|
@@ -329,11 +339,19 @@ export const createFileViewerViewStateController = ({ root, enabled, onChange, }
|
|
|
329
339
|
if (!(nextProvider === null || nextProvider === void 0 ? void 0 : nextProvider.applyState)) {
|
|
330
340
|
return cloneFileViewerViewState(state);
|
|
331
341
|
}
|
|
332
|
-
const
|
|
342
|
+
const sequence = ++applySequence;
|
|
343
|
+
const appliedState = await nextProvider.applyState(cloneFileViewerViewState(nextState) || {}, options);
|
|
344
|
+
if (destroyed || nextProvider !== syncProvider()) {
|
|
345
|
+
return cloneFileViewerViewState(state);
|
|
346
|
+
}
|
|
347
|
+
if (sequence !== applySequence) {
|
|
348
|
+
return cloneFileViewerViewState(appliedState || nextProvider.getState());
|
|
349
|
+
}
|
|
333
350
|
commitState(appliedState || nextProvider.getState());
|
|
334
351
|
return cloneFileViewerViewState(state);
|
|
335
352
|
},
|
|
336
353
|
destroy() {
|
|
354
|
+
destroyed = true;
|
|
337
355
|
disconnectObserver();
|
|
338
356
|
clearProvider();
|
|
339
357
|
},
|
package/dist/headless.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { DEFAULT_FILE_VIEWER_TEXT_CHUNK_OVERLAP, DEFAULT_FILE_VIEWER_TEXT_CHUNK_
|
|
|
5
5
|
export { ARCHIVE_EXTENSIONS, DEFAULT_REGISTERED_EXTENSIONS, DEFAULT_RENDERER_DEFINITIONS, DEFAULT_STABLE_SUPPORTED_EXTENSIONS, DEFAULT_SUPPORTED_EXTENSIONS, IMAGE_EXTENSIONS, MODEL_EXTENSIONS, TEXT_EXTENSIONS, } from "./registry/formats.js";
|
|
6
6
|
export { precheckFileViewerSource } from "./source/precheck.js";
|
|
7
7
|
export type { FileViewerPrecheckOptions, FileViewerPrecheckReason, FileViewerPrecheckResult, FileViewerPrecheckStatus, } from "./source/precheck.js";
|
|
8
|
-
export { FILE_VIEWER_BEFORE_OPERATION_ERROR_PREFIX, DEFAULT_FILE_VIEWER_TOOLBAR_ORDER, FILE_VIEWER_LIFECYCLE_HOOK_ERROR_MESSAGE_PREFIX, FILE_VIEWER_LIFECYCLE_HOOKS, FILE_VIEWER_OPERATION_LABELS, buildFileViewerLifecycleContext, buildFileViewerLifecycleContextFromNormalizedSource, buildFileViewerOperationContext, buildFileViewerOperationContextFromLifecycleState, cloneFileViewerOperationAvailability, createFileViewerLifecycleActions, createFileViewerLifecycleStateController, createFileViewerPublicApi, createFileViewerToolbarActions, createFileViewerToolbarControllerActionHandlers, createFileViewerToolbarZoomSyncSnapshot, DEFAULT_FILE_VIEWER_LIFECYCLE_HOOK_ERROR_LOGGER, DEFAULT_FILE_VIEWER_OPERATION_ERROR_LOGGER, dispatchFileViewerLifecycleEvent, dispatchFileViewerOperationAvailabilityChange, dispatchFileViewerOperationContextEvent, dispatchFileViewerZoomChange, emitFileViewerComponentLifecycleEvent, getFileViewerBeforeOperationHooks, getFileViewerLifecycleHookName, hasVisibleFileViewerToolbarActions, isFileViewerToolbarOperationPermitted, isFileViewerZoomButtonDisabled, normalizeFileViewerToolbar, reportFileViewerLifecycleHookError, reportFileViewerOperationError, resolveFileViewerBeforeOperationErrorMessage, resolveFileViewerLifecycleFallbackSource, resolveFileViewerLifecycleHookErrorMessage, resolveFileViewerOperationAvailability, resolveFileViewerToolbarPosition, resolveFileViewerToolbarOrder, resolveFileViewerToolbarState, resolveVisibleFileViewerToolbar, runFileViewerActiveUnloadComplete, runFileViewerActiveUnloadStart, runFileViewerBeforeOperation, runFileViewerLifecycleHook, runFileViewerToolbarAvailabilitySync, runFileViewerToolbarZoomSync, serializeFileViewerContext, } from "./lifecycle/operations.js";
|
|
8
|
+
export { FILE_VIEWER_BEFORE_OPERATION_ERROR_PREFIX, DEFAULT_FILE_VIEWER_TOOLBAR_ORDER, FILE_VIEWER_LIFECYCLE_HOOK_ERROR_MESSAGE_PREFIX, FILE_VIEWER_LIFECYCLE_HOOKS, FILE_VIEWER_OPERATION_LABELS, buildFileViewerLifecycleContext, buildFileViewerLifecycleContextFromNormalizedSource, buildFileViewerOperationContext, buildFileViewerOperationContextFromLifecycleState, cloneFileViewerOperationAvailability, createFileViewerLifecycleActions, createFileViewerLifecycleStateController, createFileViewerPublicApi, createFileViewerToolbarActions, createFileViewerToolbarControllerActionHandlers, createFileViewerToolbarZoomSyncSnapshot, DEFAULT_FILE_VIEWER_LIFECYCLE_HOOK_ERROR_LOGGER, DEFAULT_FILE_VIEWER_OPERATION_ERROR_LOGGER, dispatchFileViewerLifecycleEvent, dispatchFileViewerOperationAvailabilityChange, dispatchFileViewerOperationContextEvent, dispatchFileViewerZoomChange, emitFileViewerComponentLifecycleEvent, getFileViewerBeforeOperationHooks, getFileViewerLifecycleHookName, hasVisibleFileViewerToolbarActions, isFileViewerToolbarOperationPermitted, isFileViewerZoomButtonDisabled, normalizeFileViewerToolbar, reportFileViewerLifecycleHookError, reportFileViewerOperationError, resolveFileViewerBeforeOperationErrorMessage, resolveFileViewerLifecycleFallbackSource, resolveFileViewerLifecycleHookErrorMessage, resolveFileViewerOperationAvailability, resolveFileViewerToolbarZoomButtons, resolveFileViewerToolbarPosition, resolveFileViewerToolbarOrder, resolveFileViewerToolbarState, resolveVisibleFileViewerToolbar, runFileViewerActiveUnloadComplete, runFileViewerActiveUnloadStart, runFileViewerBeforeOperation, runFileViewerLifecycleHook, runFileViewerToolbarAvailabilitySync, runFileViewerToolbarZoomSync, serializeFileViewerContext, } from "./lifecycle/operations.js";
|
|
9
9
|
export { FILE_VIEWER_BUILTIN_MESSAGES, FILE_VIEWER_DEFAULT_LOCALE, FILE_VIEWER_FALLBACK_LOCALE, FILE_VIEWER_SUPPORTED_LOCALES, createFileViewerTranslator, formatFileViewerMessage, normalizeFileViewerLocale, resolveFileViewerLocale, translateFileViewerMessage, } from "./i18n/messages.js";
|
|
10
10
|
export type { FileViewerI18nInput, FileViewerResolvedLocale, ResolveFileViewerI18nInput, } from "./i18n/messages.js";
|
|
11
11
|
export type { BuildFileViewerLifecycleContextFromNormalizedSourceInput, BuildFileViewerOperationContextFromLifecycleStateInput, BuildFileViewerLifecycleContextInput, BuiltFileViewerLifecycleContext, BuiltFileViewerOperationContext, CreateFileViewerLifecycleActionsInput, CreateFileViewerPublicApiInput, CreateFileViewerToolbarActionsInput, CreateFileViewerToolbarControllerActionHandlersInput, DispatchFileViewerLifecycleEventInput, DispatchFileViewerOperationAvailabilityChangeInput, DispatchFileViewerOperationContextEventInput, DispatchFileViewerZoomChangeInput, FileViewerActiveUnloadState, FileViewerLifecycleActions, FileViewerLifecycleComponentEmit, FileViewerLifecycleHookErrorLogger, FileViewerLifecycleStateController, FileViewerOperationErrorLogger, FileViewerToolbarActions, FileViewerToolbarControllerActionHandlers, FileViewerToolbarState, FileViewerToolbarZoomSyncSnapshot, FileViewerZoomButtonAction, ReportFileViewerLifecycleHookErrorInput, ReportFileViewerOperationErrorInput, ResolveFileViewerBeforeOperationErrorMessageInput, ResolveFileViewerLifecycleHookErrorMessageInput, ResolveFileViewerOperationAvailabilityInput, ResolveFileViewerToolbarStateInput, RunFileViewerActiveUnloadCompleteInput, RunFileViewerActiveUnloadStartInput, RunFileViewerBeforeOperationInput, RunFileViewerToolbarAvailabilitySyncInput, RunFileViewerToolbarZoomSyncInput, SerializedFileViewerContext, } from "./lifecycle/operations.js";
|
|
@@ -26,4 +26,4 @@ export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRI
|
|
|
26
26
|
export type { FileViewerErrorMessageCarrier, FileViewerErrorMessageFormatter, } from "./viewer/state.js";
|
|
27
27
|
export { buildFileViewerWatermarkBackgroundImage, buildFileViewerWatermarkInlineStyle, buildFileViewerWatermarkStyle, buildFileViewerWatermarkSvg, normalizeFileViewerWatermark, resolveFileViewerWatermarkPresentationState, } from "./features/watermark.js";
|
|
28
28
|
export type { FileViewerWatermarkPresentationState, FileViewerWatermarkStyle, } from "./features/watermark.js";
|
|
29
|
-
export type { FileRenderContext, FileRenderExportAdapter, FileRenderExportMode, FileRenderExportOptions, FileRenderHandler, FileRenderHandlerComposite, FileViewerBuiltinRendererPreset, FileViewerAiOptions, FileViewerArchiveEntryActionContext, FileViewerArchiveEntryActionPolicy, FileViewerArchiveEntryActionsOptions, FileViewerArchiveOptions, FileViewerChmOptions, FileViewerApplyViewStateOptions, FileViewerBeforeOperation, FileViewerCadColorMode, FileViewerCadDwfLineWeightMode, FileViewerCadOptions, FileViewerCadRenderer, FileViewerComponentEmits, FileViewerComponentEventMap, FileViewerComponentProps, FileViewerDocumentAnchor, FileViewerDocumentChunk, FileViewerDocxOptions, FileViewerDrawingOptions, FileViewerDownloadOptions, FileViewerEvent, FileViewerEventHandler, FileViewerEventType, FileViewerExportHtmlOptions, FileViewerFileRef, FileViewerFitMode, FileViewerFitOptions, FileViewerFitRequest, FileViewerFitResize, FileViewerFitResult, FileViewerFormatStatus, FileViewerFormatSupportLevel, FileViewerGeoOptions, FileViewerInstance, FileViewerLifecycleContext, FileViewerLifecycleHooks, FileViewerLifecyclePhase, FileViewerI18nOptions, FileViewerIworkEmbeddedPreviewMode, FileViewerIworkOptions, FileViewerHangulOptions, FileViewerDiagnostic, FileViewerLocale, FileViewerMessageKey, FileViewerMessageParams, FileViewerMessageResolver, FileViewerMessages, FileViewerNavigationState, FileViewerOperationAvailability, FileViewerOperationContext, FileViewerOperationType, FileViewerOptions, FileViewerPdfBoundingBox, FileViewerPdfBoundingBoxOrigin, FileViewerPdfBoundingBoxUnit, FileViewerPdfOptions, FileViewerPresentationOptions, FileViewerPrintMaskOptions, FileViewerPrintMaskRegion, FileViewerPrintOptions, FileViewerPrintStamp, FileViewerPublicApi, FileViewerRenderStateKind, FileViewerRenderedInstance, FileViewerRendererCategory, FileViewerSearchMatch, FileViewerSearchOptions, FileViewerSearchProvider, FileViewerSearchState, FileViewerSource, FileViewerSourceKind, FileViewerSpreadsheetOptions, FileViewerStateDescriptor, FileViewerStateTheme, FileViewerTextOptions, FileViewerResolvedThemeMode, FileViewerThemeMode, FileViewerToolbarActionMap, FileViewerToolbarItem, FileViewerToolbarOptions, FileViewerToolbarPosition, FileViewerResolvedToolbarItem, FileViewerUiDensity, FileViewerUiOptions, FileViewerTypstOptions, FileViewerViewScrollState, FileViewerViewState, FileViewerViewStateChange, FileViewerViewStateChangeAction, FileViewerViewStateChangeSource, FileViewerViewStateProvider, FileViewerWatermarkOptions, FileViewerWordPerfectOptions, FileViewerZoomProvider, FileViewerZoomState, NormalizedFileViewerSource, RenderSurface, RendererCapability, RendererSourceTypeProbe, RendererSourceTypeProbeInput, RendererDefinition, RendererLoadContext, RendererLoader, RendererPlugin, RendererRegistry, RendererSession, ViewerCapabilityState, ViewerLifecycleContext, ViewerOperationContext, } from "./contracts/types.js";
|
|
29
|
+
export type { FileRenderContext, FileRenderExportAdapter, FileRenderExportMode, FileRenderExportOptions, FileRenderHandler, FileRenderHandlerComposite, FileViewerBuiltinRendererPreset, FileViewerAiOptions, FileViewerArchiveEntryActionContext, FileViewerArchiveEntryActionPolicy, FileViewerArchiveEntryActionsOptions, FileViewerArchiveOptions, FileViewerChmOptions, FileViewerApplyViewStateOptions, FileViewerBeforeOperation, FileViewerCadColorMode, FileViewerCadDwfLineWeightMode, FileViewerCadOptions, FileViewerCadRenderer, FileViewerComponentEmits, FileViewerComponentEventMap, FileViewerComponentProps, FileViewerDocumentAnchor, FileViewerDocumentChunk, FileViewerDocxOptions, FileViewerDrawingOptions, FileViewerDownloadOptions, FileViewerEvent, FileViewerEventHandler, FileViewerEventType, FileViewerExportHtmlOptions, FileViewerFileRef, FileViewerFitMode, FileViewerFitOptions, FileViewerFitRequest, FileViewerFitResize, FileViewerFitResult, FileViewerFormatStatus, FileViewerFormatSupportLevel, FileViewerGeoOptions, FileViewerInstance, FileViewerLifecycleContext, FileViewerLifecycleHooks, FileViewerLifecyclePhase, FileViewerI18nOptions, FileViewerIworkEmbeddedPreviewMode, FileViewerIworkOptions, FileViewerHangulOptions, FileViewerDiagnostic, FileViewerLocale, FileViewerMessageKey, FileViewerMessageParams, FileViewerMessageResolver, FileViewerMessages, FileViewerNavigationState, FileViewerOperationAvailability, FileViewerOperationContext, FileViewerOperationType, FileViewerOptions, FileViewerPdfBoundingBox, FileViewerPdfBoundingBoxOrigin, FileViewerPdfBoundingBoxUnit, FileViewerPdfOptions, FileViewerEpubOptions, FileViewerPresentationOptions, FileViewerPrintMaskOptions, FileViewerPrintMaskRegion, FileViewerPrintOptions, FileViewerPrintStamp, FileViewerPublicApi, FileViewerRenderStateKind, FileViewerRenderedInstance, FileViewerRendererCategory, FileViewerSearchMatch, FileViewerSearchOptions, FileViewerSearchProvider, FileViewerSearchState, FileViewerSource, FileViewerSourceKind, FileViewerSpreadsheetOptions, FileViewerStateDescriptor, FileViewerStateTheme, FileViewerTextOptions, FileViewerResolvedThemeMode, FileViewerThemeMode, FileViewerToolbarActionMap, FileViewerToolbarItem, FileViewerToolbarOptions, FileViewerToolbarPosition, FileViewerResolvedToolbarItem, FileViewerUiDensity, FileViewerUiOptions, FileViewerTypstOptions, FileViewerViewScrollState, FileViewerViewState, FileViewerViewStateChange, FileViewerViewStateChangeAction, FileViewerViewStateChangeSource, FileViewerViewStateProvider, FileViewerWatermarkOptions, FileViewerWordPerfectOptions, FileViewerZoomProvider, FileViewerZoomState, NormalizedFileViewerSource, RenderSurface, RendererCapability, RendererSourceTypeProbe, RendererSourceTypeProbeInput, RendererDefinition, RendererLoadContext, RendererLoader, RendererPlugin, RendererRegistry, RendererSession, ViewerCapabilityState, ViewerLifecycleContext, ViewerOperationContext, } from "./contracts/types.js";
|