@docmentis/udoc-viewer 0.7.20 → 0.8.1
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/API-COMPARISON.md +441 -0
- package/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +23 -1220
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/dist/worker/worker-source.d.ts +3 -0
- package/dist/worker/worker-source.d.ts.map +1 -0
- package/dist/worker/worker-source.js +11 -0
- package/dist/worker/worker.d.ts +2 -0
- package/dist/worker/worker.d.ts.map +1 -0
- package/dist/worker/worker.js +5 -0
- package/dist/worker/worker.js.map +1 -0
- package/package.json +48 -59
- package/dist/package.json +0 -79
- package/dist/src/UDocClient.d.ts +0 -730
- package/dist/src/UDocClient.d.ts.map +0 -1
- package/dist/src/UDocClient.js +0 -649
- package/dist/src/UDocClient.js.map +0 -1
- package/dist/src/UDocViewer.d.ts +0 -883
- package/dist/src/UDocViewer.d.ts.map +0 -1
- package/dist/src/UDocViewer.js +0 -2180
- package/dist/src/UDocViewer.js.map +0 -1
- package/dist/src/fonts.d.ts +0 -47
- package/dist/src/fonts.d.ts.map +0 -1
- package/dist/src/fonts.js +0 -49
- package/dist/src/fonts.js.map +0 -1
- package/dist/src/index.d.ts +0 -13
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -5
- package/dist/src/index.js.map +0 -1
- package/dist/src/meta-url.d.ts +0 -2
- package/dist/src/meta-url.d.ts.map +0 -1
- package/dist/src/meta-url.js +0 -10
- package/dist/src/meta-url.js.map +0 -1
- package/dist/src/performance/PerformanceCounter.d.ts +0 -132
- package/dist/src/performance/PerformanceCounter.d.ts.map +0 -1
- package/dist/src/performance/PerformanceCounter.js +0 -129
- package/dist/src/performance/PerformanceCounter.js.map +0 -1
- package/dist/src/performance/index.d.ts +0 -2
- package/dist/src/performance/index.d.ts.map +0 -1
- package/dist/src/performance/index.js +0 -2
- package/dist/src/performance/index.js.map +0 -1
- package/dist/src/ui/framework/component.d.ts +0 -68
- package/dist/src/ui/framework/component.d.ts.map +0 -1
- package/dist/src/ui/framework/component.js +0 -97
- package/dist/src/ui/framework/component.js.map +0 -1
- package/dist/src/ui/framework/dom.d.ts +0 -19
- package/dist/src/ui/framework/dom.d.ts.map +0 -1
- package/dist/src/ui/framework/dom.js +0 -29
- package/dist/src/ui/framework/dom.js.map +0 -1
- package/dist/src/ui/framework/events.d.ts +0 -18
- package/dist/src/ui/framework/events.d.ts.map +0 -1
- package/dist/src/ui/framework/events.js +0 -23
- package/dist/src/ui/framework/events.js.map +0 -1
- package/dist/src/ui/framework/index.d.ts +0 -15
- package/dist/src/ui/framework/index.d.ts.map +0 -1
- package/dist/src/ui/framework/index.js +0 -15
- package/dist/src/ui/framework/index.js.map +0 -1
- package/dist/src/ui/framework/selectors.d.ts +0 -51
- package/dist/src/ui/framework/selectors.d.ts.map +0 -1
- package/dist/src/ui/framework/selectors.js +0 -28
- package/dist/src/ui/framework/selectors.js.map +0 -1
- package/dist/src/ui/framework/store.d.ts +0 -44
- package/dist/src/ui/framework/store.d.ts.map +0 -1
- package/dist/src/ui/framework/store.js +0 -79
- package/dist/src/ui/framework/store.js.map +0 -1
- package/dist/src/ui/viewer/a11y.d.ts +0 -26
- package/dist/src/ui/viewer/a11y.d.ts.map +0 -1
- package/dist/src/ui/viewer/a11y.js +0 -116
- package/dist/src/ui/viewer/a11y.js.map +0 -1
- package/dist/src/ui/viewer/actions.d.ts +0 -308
- package/dist/src/ui/viewer/actions.d.ts.map +0 -1
- package/dist/src/ui/viewer/actions.js +0 -2
- package/dist/src/ui/viewer/actions.js.map +0 -1
- package/dist/src/ui/viewer/animation-presets.d.ts +0 -37
- package/dist/src/ui/viewer/animation-presets.d.ts.map +0 -1
- package/dist/src/ui/viewer/animation-presets.js +0 -123
- package/dist/src/ui/viewer/animation-presets.js.map +0 -1
- package/dist/src/ui/viewer/animation.d.ts +0 -162
- package/dist/src/ui/viewer/animation.d.ts.map +0 -1
- package/dist/src/ui/viewer/animation.js +0 -506
- package/dist/src/ui/viewer/animation.js.map +0 -1
- package/dist/src/ui/viewer/annotation/LinkRenderer.d.ts +0 -9
- package/dist/src/ui/viewer/annotation/LinkRenderer.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/LinkRenderer.js +0 -17
- package/dist/src/ui/viewer/annotation/LinkRenderer.js.map +0 -1
- package/dist/src/ui/viewer/annotation/MarkupRenderer.d.ts +0 -21
- package/dist/src/ui/viewer/annotation/MarkupRenderer.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/MarkupRenderer.js +0 -136
- package/dist/src/ui/viewer/annotation/MarkupRenderer.js.map +0 -1
- package/dist/src/ui/viewer/annotation/ShapeRenderer.d.ts +0 -33
- package/dist/src/ui/viewer/annotation/ShapeRenderer.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/ShapeRenderer.js +0 -379
- package/dist/src/ui/viewer/annotation/ShapeRenderer.js.map +0 -1
- package/dist/src/ui/viewer/annotation/TextRenderer.d.ts +0 -23
- package/dist/src/ui/viewer/annotation/TextRenderer.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/TextRenderer.js +0 -196
- package/dist/src/ui/viewer/annotation/TextRenderer.js.map +0 -1
- package/dist/src/ui/viewer/annotation/index.d.ts +0 -9
- package/dist/src/ui/viewer/annotation/index.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/index.js +0 -10
- package/dist/src/ui/viewer/annotation/index.js.map +0 -1
- package/dist/src/ui/viewer/annotation/propertyUtils.d.ts +0 -29
- package/dist/src/ui/viewer/annotation/propertyUtils.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/propertyUtils.js +0 -151
- package/dist/src/ui/viewer/annotation/propertyUtils.js.map +0 -1
- package/dist/src/ui/viewer/annotation/render.d.ts +0 -24
- package/dist/src/ui/viewer/annotation/render.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/render.js +0 -191
- package/dist/src/ui/viewer/annotation/render.js.map +0 -1
- package/dist/src/ui/viewer/annotation/types.d.ts +0 -309
- package/dist/src/ui/viewer/annotation/types.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/types.js +0 -7
- package/dist/src/ui/viewer/annotation/types.js.map +0 -1
- package/dist/src/ui/viewer/annotation/utils.d.ts +0 -75
- package/dist/src/ui/viewer/annotation/utils.d.ts.map +0 -1
- package/dist/src/ui/viewer/annotation/utils.js +0 -250
- package/dist/src/ui/viewer/annotation/utils.js.map +0 -1
- package/dist/src/ui/viewer/components/AnnotationPanel.d.ts +0 -20
- package/dist/src/ui/viewer/components/AnnotationPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/AnnotationPanel.js +0 -276
- package/dist/src/ui/viewer/components/AnnotationPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/AttachmentsPanel.d.ts +0 -8
- package/dist/src/ui/viewer/components/AttachmentsPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/AttachmentsPanel.js +0 -16
- package/dist/src/ui/viewer/components/AttachmentsPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/BookmarksPanel.d.ts +0 -8
- package/dist/src/ui/viewer/components/BookmarksPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/BookmarksPanel.js +0 -16
- package/dist/src/ui/viewer/components/BookmarksPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/Branding.d.ts +0 -49
- package/dist/src/ui/viewer/components/Branding.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/Branding.js +0 -334
- package/dist/src/ui/viewer/components/Branding.js.map +0 -1
- package/dist/src/ui/viewer/components/ColorSelect.d.ts +0 -26
- package/dist/src/ui/viewer/components/ColorSelect.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/ColorSelect.js +0 -120
- package/dist/src/ui/viewer/components/ColorSelect.js.map +0 -1
- package/dist/src/ui/viewer/components/FloatingToolbar.d.ts +0 -10
- package/dist/src/ui/viewer/components/FloatingToolbar.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/FloatingToolbar.js +0 -396
- package/dist/src/ui/viewer/components/FloatingToolbar.js.map +0 -1
- package/dist/src/ui/viewer/components/FontsPanel.d.ts +0 -12
- package/dist/src/ui/viewer/components/FontsPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/FontsPanel.js +0 -141
- package/dist/src/ui/viewer/components/FontsPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/LayersPanel.d.ts +0 -12
- package/dist/src/ui/viewer/components/LayersPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/LayersPanel.js +0 -139
- package/dist/src/ui/viewer/components/LayersPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/LeftPanel.d.ts +0 -11
- package/dist/src/ui/viewer/components/LeftPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/LeftPanel.js +0 -296
- package/dist/src/ui/viewer/components/LeftPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/LoadingOverlay.d.ts +0 -13
- package/dist/src/ui/viewer/components/LoadingOverlay.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/LoadingOverlay.js +0 -146
- package/dist/src/ui/viewer/components/LoadingOverlay.js.map +0 -1
- package/dist/src/ui/viewer/components/NumberInput.d.ts +0 -32
- package/dist/src/ui/viewer/components/NumberInput.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/NumberInput.js +0 -101
- package/dist/src/ui/viewer/components/NumberInput.js.map +0 -1
- package/dist/src/ui/viewer/components/OutlinePanel.d.ts +0 -11
- package/dist/src/ui/viewer/components/OutlinePanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/OutlinePanel.js +0 -307
- package/dist/src/ui/viewer/components/OutlinePanel.js.map +0 -1
- package/dist/src/ui/viewer/components/PasswordDialog.d.ts +0 -16
- package/dist/src/ui/viewer/components/PasswordDialog.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/PasswordDialog.js +0 -179
- package/dist/src/ui/viewer/components/PasswordDialog.js.map +0 -1
- package/dist/src/ui/viewer/components/PermitNoticeOverlay.d.ts +0 -27
- package/dist/src/ui/viewer/components/PermitNoticeOverlay.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/PermitNoticeOverlay.js +0 -79
- package/dist/src/ui/viewer/components/PermitNoticeOverlay.js.map +0 -1
- package/dist/src/ui/viewer/components/PrintDialog.d.ts +0 -34
- package/dist/src/ui/viewer/components/PrintDialog.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/PrintDialog.js +0 -317
- package/dist/src/ui/viewer/components/PrintDialog.js.map +0 -1
- package/dist/src/ui/viewer/components/RightPanel.d.ts +0 -10
- package/dist/src/ui/viewer/components/RightPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/RightPanel.js +0 -154
- package/dist/src/ui/viewer/components/RightPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/SearchPanel.d.ts +0 -21
- package/dist/src/ui/viewer/components/SearchPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/SearchPanel.js +0 -323
- package/dist/src/ui/viewer/components/SearchPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/SheetTabBar.d.ts +0 -9
- package/dist/src/ui/viewer/components/SheetTabBar.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/SheetTabBar.js +0 -57
- package/dist/src/ui/viewer/components/SheetTabBar.js.map +0 -1
- package/dist/src/ui/viewer/components/Spread.d.ts +0 -85
- package/dist/src/ui/viewer/components/Spread.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/Spread.js +0 -749
- package/dist/src/ui/viewer/components/Spread.js.map +0 -1
- package/dist/src/ui/viewer/components/SubToolbar.d.ts +0 -11
- package/dist/src/ui/viewer/components/SubToolbar.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/SubToolbar.js +0 -722
- package/dist/src/ui/viewer/components/SubToolbar.js.map +0 -1
- package/dist/src/ui/viewer/components/ThumbnailPanel.d.ts +0 -12
- package/dist/src/ui/viewer/components/ThumbnailPanel.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/ThumbnailPanel.js +0 -290
- package/dist/src/ui/viewer/components/ThumbnailPanel.js.map +0 -1
- package/dist/src/ui/viewer/components/Toolbar.d.ts +0 -12
- package/dist/src/ui/viewer/components/Toolbar.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/Toolbar.js +0 -761
- package/dist/src/ui/viewer/components/Toolbar.js.map +0 -1
- package/dist/src/ui/viewer/components/ViewModeMenu.d.ts +0 -10
- package/dist/src/ui/viewer/components/ViewModeMenu.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/ViewModeMenu.js +0 -206
- package/dist/src/ui/viewer/components/ViewModeMenu.js.map +0 -1
- package/dist/src/ui/viewer/components/Viewport.d.ts +0 -28
- package/dist/src/ui/viewer/components/Viewport.d.ts.map +0 -1
- package/dist/src/ui/viewer/components/Viewport.js +0 -1721
- package/dist/src/ui/viewer/components/Viewport.js.map +0 -1
- package/dist/src/ui/viewer/effects.d.ts +0 -8
- package/dist/src/ui/viewer/effects.d.ts.map +0 -1
- package/dist/src/ui/viewer/effects.js +0 -452
- package/dist/src/ui/viewer/effects.js.map +0 -1
- package/dist/src/ui/viewer/i18n/ar.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/ar.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/ar.js +0 -198
- package/dist/src/ui/viewer/i18n/ar.js.map +0 -1
- package/dist/src/ui/viewer/i18n/de.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/de.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/de.js +0 -198
- package/dist/src/ui/viewer/i18n/de.js.map +0 -1
- package/dist/src/ui/viewer/i18n/en.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/en.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/en.js +0 -200
- package/dist/src/ui/viewer/i18n/en.js.map +0 -1
- package/dist/src/ui/viewer/i18n/es.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/es.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/es.js +0 -198
- package/dist/src/ui/viewer/i18n/es.js.map +0 -1
- package/dist/src/ui/viewer/i18n/fr.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/fr.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/fr.js +0 -198
- package/dist/src/ui/viewer/i18n/fr.js.map +0 -1
- package/dist/src/ui/viewer/i18n/index.d.ts +0 -27
- package/dist/src/ui/viewer/i18n/index.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/index.js +0 -88
- package/dist/src/ui/viewer/i18n/index.js.map +0 -1
- package/dist/src/ui/viewer/i18n/ja.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/ja.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/ja.js +0 -198
- package/dist/src/ui/viewer/i18n/ja.js.map +0 -1
- package/dist/src/ui/viewer/i18n/ko.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/ko.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/ko.js +0 -198
- package/dist/src/ui/viewer/i18n/ko.js.map +0 -1
- package/dist/src/ui/viewer/i18n/pt-BR.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/pt-BR.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/pt-BR.js +0 -198
- package/dist/src/ui/viewer/i18n/pt-BR.js.map +0 -1
- package/dist/src/ui/viewer/i18n/ru.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/ru.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/ru.js +0 -198
- package/dist/src/ui/viewer/i18n/ru.js.map +0 -1
- package/dist/src/ui/viewer/i18n/types.d.ts +0 -176
- package/dist/src/ui/viewer/i18n/types.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/types.js +0 -2
- package/dist/src/ui/viewer/i18n/types.js.map +0 -1
- package/dist/src/ui/viewer/i18n/zh-CN.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/zh-CN.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/zh-CN.js +0 -198
- package/dist/src/ui/viewer/i18n/zh-CN.js.map +0 -1
- package/dist/src/ui/viewer/i18n/zh-TW.d.ts +0 -3
- package/dist/src/ui/viewer/i18n/zh-TW.d.ts.map +0 -1
- package/dist/src/ui/viewer/i18n/zh-TW.js +0 -198
- package/dist/src/ui/viewer/i18n/zh-TW.js.map +0 -1
- package/dist/src/ui/viewer/icons.d.ts +0 -77
- package/dist/src/ui/viewer/icons.d.ts.map +0 -1
- package/dist/src/ui/viewer/icons.js +0 -109
- package/dist/src/ui/viewer/icons.js.map +0 -1
- package/dist/src/ui/viewer/index.d.ts +0 -6
- package/dist/src/ui/viewer/index.d.ts.map +0 -1
- package/dist/src/ui/viewer/index.js +0 -6
- package/dist/src/ui/viewer/index.js.map +0 -1
- package/dist/src/ui/viewer/layout/index.d.ts +0 -3
- package/dist/src/ui/viewer/layout/index.d.ts.map +0 -1
- package/dist/src/ui/viewer/layout/index.js +0 -3
- package/dist/src/ui/viewer/layout/index.js.map +0 -1
- package/dist/src/ui/viewer/layout/pixelAlign.d.ts +0 -8
- package/dist/src/ui/viewer/layout/pixelAlign.d.ts.map +0 -1
- package/dist/src/ui/viewer/layout/pixelAlign.js +0 -42
- package/dist/src/ui/viewer/layout/pixelAlign.js.map +0 -1
- package/dist/src/ui/viewer/layout/spreadLayout.d.ts +0 -155
- package/dist/src/ui/viewer/layout/spreadLayout.d.ts.map +0 -1
- package/dist/src/ui/viewer/layout/spreadLayout.js +0 -574
- package/dist/src/ui/viewer/layout/spreadLayout.js.map +0 -1
- package/dist/src/ui/viewer/navigation.d.ts +0 -91
- package/dist/src/ui/viewer/navigation.d.ts.map +0 -1
- package/dist/src/ui/viewer/navigation.js +0 -59
- package/dist/src/ui/viewer/navigation.js.map +0 -1
- package/dist/src/ui/viewer/reducer.d.ts +0 -4
- package/dist/src/ui/viewer/reducer.d.ts.map +0 -1
- package/dist/src/ui/viewer/reducer.js +0 -841
- package/dist/src/ui/viewer/reducer.js.map +0 -1
- package/dist/src/ui/viewer/search/index.d.ts +0 -2
- package/dist/src/ui/viewer/search/index.d.ts.map +0 -1
- package/dist/src/ui/viewer/search/index.js +0 -2
- package/dist/src/ui/viewer/search/index.js.map +0 -1
- package/dist/src/ui/viewer/search/search.d.ts +0 -31
- package/dist/src/ui/viewer/search/search.d.ts.map +0 -1
- package/dist/src/ui/viewer/search/search.js +0 -446
- package/dist/src/ui/viewer/search/search.js.map +0 -1
- package/dist/src/ui/viewer/shell.d.ts +0 -65
- package/dist/src/ui/viewer/shell.d.ts.map +0 -1
- package/dist/src/ui/viewer/shell.js +0 -366
- package/dist/src/ui/viewer/shell.js.map +0 -1
- package/dist/src/ui/viewer/state.d.ts +0 -313
- package/dist/src/ui/viewer/state.d.ts.map +0 -1
- package/dist/src/ui/viewer/state.js +0 -157
- package/dist/src/ui/viewer/state.js.map +0 -1
- package/dist/src/ui/viewer/styles-inline.d.ts +0 -2
- package/dist/src/ui/viewer/styles-inline.d.ts.map +0 -1
- package/dist/src/ui/viewer/styles-inline.js +0 -3526
- package/dist/src/ui/viewer/styles-inline.js.map +0 -1
- package/dist/src/ui/viewer/text/index.d.ts +0 -6
- package/dist/src/ui/viewer/text/index.d.ts.map +0 -1
- package/dist/src/ui/viewer/text/index.js +0 -6
- package/dist/src/ui/viewer/text/index.js.map +0 -1
- package/dist/src/ui/viewer/text/render.d.ts +0 -18
- package/dist/src/ui/viewer/text/render.d.ts.map +0 -1
- package/dist/src/ui/viewer/text/render.js +0 -480
- package/dist/src/ui/viewer/text/render.js.map +0 -1
- package/dist/src/ui/viewer/text/selection.d.ts +0 -12
- package/dist/src/ui/viewer/text/selection.d.ts.map +0 -1
- package/dist/src/ui/viewer/text/selection.js +0 -69
- package/dist/src/ui/viewer/text/selection.js.map +0 -1
- package/dist/src/ui/viewer/tools/AnnotationDrawController.d.ts +0 -21
- package/dist/src/ui/viewer/tools/AnnotationDrawController.d.ts.map +0 -1
- package/dist/src/ui/viewer/tools/AnnotationDrawController.js +0 -410
- package/dist/src/ui/viewer/tools/AnnotationDrawController.js.map +0 -1
- package/dist/src/ui/viewer/tools/AnnotationSelectController.d.ts +0 -22
- package/dist/src/ui/viewer/tools/AnnotationSelectController.d.ts.map +0 -1
- package/dist/src/ui/viewer/tools/AnnotationSelectController.js +0 -378
- package/dist/src/ui/viewer/tools/AnnotationSelectController.js.map +0 -1
- package/dist/src/ui/viewer/tools/AnnotationUndoManager.d.ts +0 -29
- package/dist/src/ui/viewer/tools/AnnotationUndoManager.d.ts.map +0 -1
- package/dist/src/ui/viewer/tools/AnnotationUndoManager.js +0 -144
- package/dist/src/ui/viewer/tools/AnnotationUndoManager.js.map +0 -1
- package/dist/src/ui/viewer/tools/ViewToolController.d.ts +0 -20
- package/dist/src/ui/viewer/tools/ViewToolController.d.ts.map +0 -1
- package/dist/src/ui/viewer/tools/ViewToolController.js +0 -179
- package/dist/src/ui/viewer/tools/ViewToolController.js.map +0 -1
- package/dist/src/ui/viewer/transition-gl.d.ts +0 -25
- package/dist/src/ui/viewer/transition-gl.d.ts.map +0 -1
- package/dist/src/ui/viewer/transition-gl.js +0 -823
- package/dist/src/ui/viewer/transition-gl.js.map +0 -1
- package/dist/src/ui/viewer/transition.d.ts +0 -26
- package/dist/src/ui/viewer/transition.d.ts.map +0 -1
- package/dist/src/ui/viewer/transition.js +0 -1383
- package/dist/src/ui/viewer/transition.js.map +0 -1
- package/dist/src/wasm/LICENSE +0 -112
- package/dist/src/wasm/udoc.d.ts +0 -1338
- package/dist/src/wasm/udoc.js +0 -2645
- package/dist/src/wasm/udoc_bg.wasm +0 -0
- package/dist/src/wasm/udoc_bg.wasm.d.ts +0 -58
- package/dist/src/worker/WorkerClient.d.ts +0 -489
- package/dist/src/worker/WorkerClient.d.ts.map +0 -1
- package/dist/src/worker/WorkerClient.js +0 -1383
- package/dist/src/worker/WorkerClient.js.map +0 -1
- package/dist/src/worker/index.d.ts +0 -4
- package/dist/src/worker/index.d.ts.map +0 -1
- package/dist/src/worker/index.js +0 -2
- package/dist/src/worker/index.js.map +0 -1
- package/dist/src/worker/wasmError.d.ts +0 -17
- package/dist/src/worker/wasmError.d.ts.map +0 -1
- package/dist/src/worker/wasmError.js +0 -28
- package/dist/src/worker/wasmError.js.map +0 -1
- package/dist/src/worker/worker-inline.d.ts +0 -2
- package/dist/src/worker/worker-inline.d.ts.map +0 -1
- package/dist/src/worker/worker-inline.js +0 -2
- package/dist/src/worker/worker-inline.js.map +0 -1
- package/dist/src/worker/worker.d.ts +0 -530
- package/dist/src/worker/worker.d.ts.map +0 -1
- package/dist/src/worker/worker.js +0 -2935
- package/dist/src/worker/worker.js.map +0 -1
|
@@ -1,841 +0,0 @@
|
|
|
1
|
-
import { initialState, isLeftPanelTab, isToolSetKind, DEFAULT_TOOL_OPTIONS, ANNOTATION_FORMATS } from "./state";
|
|
2
|
-
import { destinationToNavigationTarget } from "./navigation";
|
|
3
|
-
export function reducer(state, action) {
|
|
4
|
-
switch (action.type) {
|
|
5
|
-
case "__INIT__":
|
|
6
|
-
return state;
|
|
7
|
-
// Document
|
|
8
|
-
case "SET_DOC": {
|
|
9
|
-
if (state.doc === action.doc)
|
|
10
|
-
return state;
|
|
11
|
-
const vd = action.viewDefaults;
|
|
12
|
-
const supportsAnnotations = ANNOTATION_FORMATS.has(action.documentFormat);
|
|
13
|
-
// Reset tool to pointer if switching to a format that doesn't support annotations
|
|
14
|
-
const toolNowUnavailable = !supportsAnnotations && isToolSetKind(state.activeTool.kind);
|
|
15
|
-
return {
|
|
16
|
-
...state,
|
|
17
|
-
doc: action.doc,
|
|
18
|
-
documentFormat: action.documentFormat,
|
|
19
|
-
page: 1,
|
|
20
|
-
pageCount: action.pageCount,
|
|
21
|
-
pageInfos: action.pageInfos,
|
|
22
|
-
pageGroups: action.pageGroups,
|
|
23
|
-
activeGroupIndex: 0,
|
|
24
|
-
activeTool: toolNowUnavailable ? { kind: "pointer" } : state.activeTool,
|
|
25
|
-
// Reset view mode to defaults (format-specific if provided)
|
|
26
|
-
viewMode: vd?.viewMode ?? initialState.viewMode,
|
|
27
|
-
scrollMode: vd?.scrollMode ?? initialState.scrollMode,
|
|
28
|
-
layoutMode: vd?.layoutMode ?? initialState.layoutMode,
|
|
29
|
-
zoomMode: vd?.zoomMode ?? initialState.zoomMode,
|
|
30
|
-
zoom: vd?.zoom ?? initialState.zoom,
|
|
31
|
-
effectiveZoom: vd?.effectiveZoom !== undefined ? vd.effectiveZoom : initialState.effectiveZoom,
|
|
32
|
-
pageRotation: vd?.pageRotation ?? initialState.pageRotation,
|
|
33
|
-
spacingMode: vd?.spacingMode ?? initialState.spacingMode,
|
|
34
|
-
pageSpacing: vd?.pageSpacing ?? initialState.pageSpacing,
|
|
35
|
-
spreadSpacing: vd?.spreadSpacing ?? initialState.spreadSpacing,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
case "UPDATE_PAGE_SIZES": {
|
|
39
|
-
return { ...state, pageInfos: action.pageInfos };
|
|
40
|
-
}
|
|
41
|
-
case "CLEAR_DOC": {
|
|
42
|
-
if (!state.doc && state.pageCount === 0)
|
|
43
|
-
return state;
|
|
44
|
-
return {
|
|
45
|
-
...state,
|
|
46
|
-
doc: null,
|
|
47
|
-
documentFormat: null,
|
|
48
|
-
page: 1,
|
|
49
|
-
pageCount: 0,
|
|
50
|
-
pageInfos: [],
|
|
51
|
-
pageGroups: [],
|
|
52
|
-
activeGroupIndex: 0,
|
|
53
|
-
needsPassword: false,
|
|
54
|
-
passwordError: null,
|
|
55
|
-
isAuthenticating: false,
|
|
56
|
-
outline: null,
|
|
57
|
-
outlineLoading: false,
|
|
58
|
-
visibilityGroups: null,
|
|
59
|
-
visibilityGroupsLoading: false,
|
|
60
|
-
pageAnnotations: new Map(),
|
|
61
|
-
annotationsLoading: new Set(),
|
|
62
|
-
annotationsDirtyPages: new Set(),
|
|
63
|
-
selectedAnnotation: null,
|
|
64
|
-
pageText: new Map(),
|
|
65
|
-
textLoading: new Set(),
|
|
66
|
-
textFailed: new Set(),
|
|
67
|
-
searchQuery: "",
|
|
68
|
-
searchCaseSensitive: false,
|
|
69
|
-
searchMatches: [],
|
|
70
|
-
searchActiveIndex: -1,
|
|
71
|
-
searchTextLoaded: false,
|
|
72
|
-
searchTextLoading: false,
|
|
73
|
-
isProcessing: false,
|
|
74
|
-
// Close panels instantly when clearing a document
|
|
75
|
-
activePanel: null,
|
|
76
|
-
panelTransitionsDisabled: true,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
case "SET_PAGE": {
|
|
80
|
-
const page = clamp(action.page, 1, Math.max(1, state.pageCount || 1));
|
|
81
|
-
if (state.page === page)
|
|
82
|
-
return state;
|
|
83
|
-
return { ...state, page };
|
|
84
|
-
}
|
|
85
|
-
case "SET_ACTIVE_GROUP": {
|
|
86
|
-
const groupIndex = clamp(action.groupIndex, 0, Math.max(0, state.pageGroups.length - 1));
|
|
87
|
-
if (state.activeGroupIndex === groupIndex)
|
|
88
|
-
return state;
|
|
89
|
-
const group = state.pageGroups[groupIndex];
|
|
90
|
-
const firstPage = group ? group.startPageIndex + 1 : 1;
|
|
91
|
-
return { ...state, activeGroupIndex: groupIndex, page: firstPage };
|
|
92
|
-
}
|
|
93
|
-
// Password protection
|
|
94
|
-
case "SET_NEEDS_PASSWORD": {
|
|
95
|
-
if (state.needsPassword === action.needsPassword)
|
|
96
|
-
return state;
|
|
97
|
-
return { ...state, needsPassword: action.needsPassword, passwordError: null };
|
|
98
|
-
}
|
|
99
|
-
// Free-tier usage permit
|
|
100
|
-
case "SET_PERMIT_NOTICE": {
|
|
101
|
-
return { ...state, permitNotice: action.notice };
|
|
102
|
-
}
|
|
103
|
-
case "AUTHENTICATE_START": {
|
|
104
|
-
if (state.isAuthenticating)
|
|
105
|
-
return state;
|
|
106
|
-
return { ...state, isAuthenticating: true, passwordError: null };
|
|
107
|
-
}
|
|
108
|
-
case "AUTHENTICATE_SUCCESS": {
|
|
109
|
-
return { ...state, isAuthenticating: false, needsPassword: false, passwordError: null };
|
|
110
|
-
}
|
|
111
|
-
case "AUTHENTICATE_FAILURE": {
|
|
112
|
-
return { ...state, isAuthenticating: false, passwordError: action.error };
|
|
113
|
-
}
|
|
114
|
-
case "CLEAR_PASSWORD_ERROR": {
|
|
115
|
-
if (state.passwordError === null)
|
|
116
|
-
return state;
|
|
117
|
-
return { ...state, passwordError: null };
|
|
118
|
-
}
|
|
119
|
-
// Outline (on-demand loading)
|
|
120
|
-
case "LOAD_OUTLINE": {
|
|
121
|
-
if (state.outlineLoading)
|
|
122
|
-
return state;
|
|
123
|
-
return { ...state, outlineLoading: true };
|
|
124
|
-
}
|
|
125
|
-
case "SET_OUTLINE": {
|
|
126
|
-
return { ...state, outline: action.outline, outlineLoading: false };
|
|
127
|
-
}
|
|
128
|
-
// Visibility groups (on-demand loading)
|
|
129
|
-
case "LOAD_VISIBILITY_GROUPS": {
|
|
130
|
-
if (state.visibilityGroupsLoading)
|
|
131
|
-
return state;
|
|
132
|
-
return { ...state, visibilityGroupsLoading: true };
|
|
133
|
-
}
|
|
134
|
-
case "SET_VISIBILITY_GROUPS": {
|
|
135
|
-
return { ...state, visibilityGroups: action.groups, visibilityGroupsLoading: false };
|
|
136
|
-
}
|
|
137
|
-
case "SET_VISIBILITY_GROUP_VISIBLE": {
|
|
138
|
-
if (!state.visibilityGroups)
|
|
139
|
-
return state;
|
|
140
|
-
const groups = state.visibilityGroups.map((g) => g.id === action.groupId ? { ...g, visible: action.visible } : g);
|
|
141
|
-
return { ...state, visibilityGroups: groups };
|
|
142
|
-
}
|
|
143
|
-
// Annotations (on-demand loading per page)
|
|
144
|
-
case "LOAD_PAGE_ANNOTATIONS": {
|
|
145
|
-
if (state.annotationsLoading.has(action.pageIndex))
|
|
146
|
-
return state;
|
|
147
|
-
if (state.pageAnnotations.has(action.pageIndex))
|
|
148
|
-
return state;
|
|
149
|
-
const newLoading = new Set(state.annotationsLoading);
|
|
150
|
-
newLoading.add(action.pageIndex);
|
|
151
|
-
return { ...state, annotationsLoading: newLoading };
|
|
152
|
-
}
|
|
153
|
-
case "SET_PAGE_ANNOTATIONS": {
|
|
154
|
-
const newAnnotations = new Map(state.pageAnnotations);
|
|
155
|
-
newAnnotations.set(action.pageIndex, action.annotations);
|
|
156
|
-
const newLoading = new Set(state.annotationsLoading);
|
|
157
|
-
newLoading.delete(action.pageIndex);
|
|
158
|
-
return {
|
|
159
|
-
...state,
|
|
160
|
-
pageAnnotations: newAnnotations,
|
|
161
|
-
annotationsLoading: newLoading,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
case "CLEAR_ANNOTATIONS": {
|
|
165
|
-
if (state.pageAnnotations.size === 0 && state.annotationsLoading.size === 0)
|
|
166
|
-
return state;
|
|
167
|
-
return {
|
|
168
|
-
...state,
|
|
169
|
-
pageAnnotations: new Map(),
|
|
170
|
-
annotationsLoading: new Set(),
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
// Text content (on-demand loading per page)
|
|
174
|
-
case "LOAD_PAGE_TEXT": {
|
|
175
|
-
if (state.textLoading.has(action.pageIndex))
|
|
176
|
-
return state;
|
|
177
|
-
if (state.pageText.has(action.pageIndex))
|
|
178
|
-
return state;
|
|
179
|
-
const newLoading = new Set(state.textLoading);
|
|
180
|
-
newLoading.add(action.pageIndex);
|
|
181
|
-
return { ...state, textLoading: newLoading };
|
|
182
|
-
}
|
|
183
|
-
case "SET_PAGE_TEXT": {
|
|
184
|
-
const newText = new Map(state.pageText);
|
|
185
|
-
newText.set(action.pageIndex, action.text);
|
|
186
|
-
const newLoading = new Set(state.textLoading);
|
|
187
|
-
newLoading.delete(action.pageIndex);
|
|
188
|
-
return {
|
|
189
|
-
...state,
|
|
190
|
-
pageText: newText,
|
|
191
|
-
textLoading: newLoading,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
case "CLEAR_PAGE_TEXT_LOADING": {
|
|
195
|
-
if (!state.textLoading.has(action.pageIndex))
|
|
196
|
-
return state;
|
|
197
|
-
const newLoading = new Set(state.textLoading);
|
|
198
|
-
newLoading.delete(action.pageIndex);
|
|
199
|
-
return { ...state, textLoading: newLoading };
|
|
200
|
-
}
|
|
201
|
-
case "SET_PAGE_TEXT_FAILED": {
|
|
202
|
-
const newLoading = new Set(state.textLoading);
|
|
203
|
-
newLoading.delete(action.pageIndex);
|
|
204
|
-
const newFailed = new Set(state.textFailed);
|
|
205
|
-
newFailed.add(action.pageIndex);
|
|
206
|
-
return { ...state, textLoading: newLoading, textFailed: newFailed };
|
|
207
|
-
}
|
|
208
|
-
case "CLEAR_TEXT": {
|
|
209
|
-
if (state.pageText.size === 0 && state.textLoading.size === 0 && state.textFailed.size === 0)
|
|
210
|
-
return state;
|
|
211
|
-
return {
|
|
212
|
-
...state,
|
|
213
|
-
pageText: new Map(),
|
|
214
|
-
textLoading: new Set(),
|
|
215
|
-
textFailed: new Set(),
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
// Navigation
|
|
219
|
-
case "NAVIGATE_TO_PAGE": {
|
|
220
|
-
const page = clamp(action.page, 1, Math.max(1, state.pageCount || 1));
|
|
221
|
-
const target = { page };
|
|
222
|
-
if (state.navigationTarget?.page === page &&
|
|
223
|
-
!state.navigationTarget.scrollTo &&
|
|
224
|
-
!state.navigationTarget.zoom) {
|
|
225
|
-
return state;
|
|
226
|
-
}
|
|
227
|
-
return { ...state, navigationTarget: target };
|
|
228
|
-
}
|
|
229
|
-
case "NAVIGATE_TO_DESTINATION": {
|
|
230
|
-
const target = destinationToNavigationTarget(action.destination, state.pageCount);
|
|
231
|
-
target.scrollAlignment = action.scrollAlignment ?? state.navigationScrollAlignment;
|
|
232
|
-
if (action.scrollToHeight !== undefined && target.scrollTo) {
|
|
233
|
-
target.scrollTo.height = action.scrollToHeight;
|
|
234
|
-
}
|
|
235
|
-
return { ...state, navigationTarget: target };
|
|
236
|
-
}
|
|
237
|
-
case "CLEAR_NAVIGATION_TARGET": {
|
|
238
|
-
if (state.navigationTarget === null)
|
|
239
|
-
return state;
|
|
240
|
-
return { ...state, navigationTarget: null };
|
|
241
|
-
}
|
|
242
|
-
case "SET_NAVIGATION_SCROLL_ALIGNMENT": {
|
|
243
|
-
if (state.navigationScrollAlignment === action.alignment)
|
|
244
|
-
return state;
|
|
245
|
-
return { ...state, navigationScrollAlignment: action.alignment };
|
|
246
|
-
}
|
|
247
|
-
case "SET_SEARCH_SCROLL_ALIGNMENT": {
|
|
248
|
-
if (state.searchScrollAlignment === action.alignment)
|
|
249
|
-
return state;
|
|
250
|
-
return { ...state, searchScrollAlignment: action.alignment };
|
|
251
|
-
}
|
|
252
|
-
// View modes
|
|
253
|
-
case "SET_VIEW_MODE": {
|
|
254
|
-
if (state.viewMode === action.mode)
|
|
255
|
-
return state;
|
|
256
|
-
switch (action.mode) {
|
|
257
|
-
case "continuous":
|
|
258
|
-
return {
|
|
259
|
-
...state,
|
|
260
|
-
viewMode: "continuous",
|
|
261
|
-
layoutMode: "single-page",
|
|
262
|
-
scrollMode: "continuous",
|
|
263
|
-
spacingMode: "none",
|
|
264
|
-
pageSpacing: 0,
|
|
265
|
-
spreadSpacing: 0,
|
|
266
|
-
pageRotation: 0,
|
|
267
|
-
};
|
|
268
|
-
case "paged":
|
|
269
|
-
return {
|
|
270
|
-
...state,
|
|
271
|
-
viewMode: "paged",
|
|
272
|
-
// Restore paged defaults
|
|
273
|
-
spacingMode: "all",
|
|
274
|
-
pageSpacing: 20,
|
|
275
|
-
spreadSpacing: 20,
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
case "SET_SCROLL_MODE": {
|
|
281
|
-
if (state.scrollMode === action.mode)
|
|
282
|
-
return state;
|
|
283
|
-
return { ...state, scrollMode: action.mode };
|
|
284
|
-
}
|
|
285
|
-
case "SET_LAYOUT_MODE": {
|
|
286
|
-
if (state.layoutMode === action.mode)
|
|
287
|
-
return state;
|
|
288
|
-
return { ...state, layoutMode: action.mode };
|
|
289
|
-
}
|
|
290
|
-
case "SET_ZOOM_MODE": {
|
|
291
|
-
if (state.zoomMode === action.mode)
|
|
292
|
-
return state;
|
|
293
|
-
return { ...state, zoomMode: action.mode };
|
|
294
|
-
}
|
|
295
|
-
case "SET_ZOOM": {
|
|
296
|
-
const zoom = clamp(action.zoom, state.minZoom, state.maxZoom);
|
|
297
|
-
if (state.zoom === zoom && state.zoomMode === "custom")
|
|
298
|
-
return state;
|
|
299
|
-
return { ...state, zoom, zoomMode: "custom" };
|
|
300
|
-
}
|
|
301
|
-
case "SET_EFFECTIVE_ZOOM": {
|
|
302
|
-
if (state.effectiveZoom === action.zoom)
|
|
303
|
-
return state;
|
|
304
|
-
return { ...state, effectiveZoom: action.zoom };
|
|
305
|
-
}
|
|
306
|
-
case "SET_ZOOM_STEPS": {
|
|
307
|
-
if (state.zoomSteps === action.steps)
|
|
308
|
-
return state;
|
|
309
|
-
return { ...state, zoomSteps: action.steps };
|
|
310
|
-
}
|
|
311
|
-
case "ZOOM_IN": {
|
|
312
|
-
const steps = state.zoomSteps;
|
|
313
|
-
const currentZoom = state.effectiveZoom ?? state.zoom;
|
|
314
|
-
const nextStep = steps.find((s) => s > currentZoom + 1e-9) ?? steps[steps.length - 1];
|
|
315
|
-
const clamped = Math.min(nextStep, state.maxZoom);
|
|
316
|
-
if (currentZoom >= clamped - 1e-9 && state.zoomMode === "custom")
|
|
317
|
-
return state;
|
|
318
|
-
return { ...state, zoom: clamped, zoomMode: "custom", zoomAnchor: action.anchor ?? null };
|
|
319
|
-
}
|
|
320
|
-
case "ZOOM_OUT": {
|
|
321
|
-
const steps = state.zoomSteps;
|
|
322
|
-
const currentZoom = state.effectiveZoom ?? state.zoom;
|
|
323
|
-
const prevStep = [...steps].reverse().find((s) => s < currentZoom - 1e-9) ?? steps[0];
|
|
324
|
-
const clamped = Math.max(prevStep, state.minZoom);
|
|
325
|
-
if (currentZoom <= clamped + 1e-9 && state.zoomMode === "custom")
|
|
326
|
-
return state;
|
|
327
|
-
return { ...state, zoom: clamped, zoomMode: "custom", zoomAnchor: action.anchor ?? null };
|
|
328
|
-
}
|
|
329
|
-
case "CLEAR_ZOOM_ANCHOR": {
|
|
330
|
-
if (!state.zoomAnchor)
|
|
331
|
-
return state;
|
|
332
|
-
return { ...state, zoomAnchor: null };
|
|
333
|
-
}
|
|
334
|
-
case "SET_PAGE_ROTATION": {
|
|
335
|
-
if (state.pageRotation === action.rotation)
|
|
336
|
-
return state;
|
|
337
|
-
return { ...state, pageRotation: action.rotation };
|
|
338
|
-
}
|
|
339
|
-
case "SET_SPACING_MODE": {
|
|
340
|
-
if (state.spacingMode === action.mode)
|
|
341
|
-
return state;
|
|
342
|
-
// Apply spacing based on spacing mode
|
|
343
|
-
switch (action.mode) {
|
|
344
|
-
case "all":
|
|
345
|
-
return { ...state, spacingMode: action.mode, pageSpacing: 20, spreadSpacing: 20 };
|
|
346
|
-
case "none":
|
|
347
|
-
return { ...state, spacingMode: action.mode, pageSpacing: 0, spreadSpacing: 0 };
|
|
348
|
-
case "spread-only":
|
|
349
|
-
return { ...state, spacingMode: action.mode, pageSpacing: 0, spreadSpacing: 20 };
|
|
350
|
-
case "page-only":
|
|
351
|
-
return { ...state, spacingMode: action.mode, pageSpacing: 20, spreadSpacing: 0 };
|
|
352
|
-
}
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
// Spacing
|
|
356
|
-
case "SET_PAGE_SPACING": {
|
|
357
|
-
const spacing = Math.max(0, action.spacing);
|
|
358
|
-
if (state.pageSpacing === spacing)
|
|
359
|
-
return state;
|
|
360
|
-
return { ...state, pageSpacing: spacing };
|
|
361
|
-
}
|
|
362
|
-
case "SET_SPREAD_SPACING": {
|
|
363
|
-
const spacing = Math.max(0, action.spacing);
|
|
364
|
-
if (state.spreadSpacing === spacing)
|
|
365
|
-
return state;
|
|
366
|
-
return { ...state, spreadSpacing: spacing };
|
|
367
|
-
}
|
|
368
|
-
// UI
|
|
369
|
-
case "TOGGLE_PANEL": {
|
|
370
|
-
// Prevent opening a panel if its side is disabled
|
|
371
|
-
if (isLeftPanelTab(action.panel) && !state.leftPanelVisible)
|
|
372
|
-
return state;
|
|
373
|
-
if (!isLeftPanelTab(action.panel) && !state.rightPanelVisible)
|
|
374
|
-
return state;
|
|
375
|
-
// Prevent opening an individually disabled panel
|
|
376
|
-
if (state.disabledPanels.has(action.panel))
|
|
377
|
-
return state;
|
|
378
|
-
const newPanel = state.activePanel === action.panel ? null : action.panel;
|
|
379
|
-
if (state.activePanel === newPanel)
|
|
380
|
-
return state;
|
|
381
|
-
// Opening the search panel always searches the entire document —
|
|
382
|
-
// a range set by a prior API call must not leak into the UI.
|
|
383
|
-
if (newPanel === "search" && state.searchPageRange !== null) {
|
|
384
|
-
return {
|
|
385
|
-
...state,
|
|
386
|
-
activePanel: newPanel,
|
|
387
|
-
searchPageRange: null,
|
|
388
|
-
searchMatches: [],
|
|
389
|
-
searchActiveIndex: -1,
|
|
390
|
-
searchTextLoaded: false,
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
return { ...state, activePanel: newPanel };
|
|
394
|
-
}
|
|
395
|
-
case "CLOSE_PANEL": {
|
|
396
|
-
if (state.activePanel === null)
|
|
397
|
-
return state;
|
|
398
|
-
return { ...state, activePanel: null };
|
|
399
|
-
}
|
|
400
|
-
case "SET_LEFT_PANEL_WIDTH": {
|
|
401
|
-
if (state.leftPanelWidth === action.width)
|
|
402
|
-
return state;
|
|
403
|
-
return { ...state, leftPanelWidth: action.width };
|
|
404
|
-
}
|
|
405
|
-
case "SET_RIGHT_PANEL_WIDTH": {
|
|
406
|
-
if (state.rightPanelWidth === action.width)
|
|
407
|
-
return state;
|
|
408
|
-
return { ...state, rightPanelWidth: action.width };
|
|
409
|
-
}
|
|
410
|
-
// Component visibility
|
|
411
|
-
case "SET_TOOLBAR_VISIBLE": {
|
|
412
|
-
if (state.toolbarVisible === action.visible)
|
|
413
|
-
return state;
|
|
414
|
-
return { ...state, toolbarVisible: action.visible };
|
|
415
|
-
}
|
|
416
|
-
case "SET_FLOATING_TOOLBAR_VISIBLE": {
|
|
417
|
-
if (state.floatingToolbarVisible === action.visible)
|
|
418
|
-
return state;
|
|
419
|
-
return { ...state, floatingToolbarVisible: action.visible };
|
|
420
|
-
}
|
|
421
|
-
case "SET_LEFT_PANEL_VISIBLE": {
|
|
422
|
-
if (state.leftPanelVisible === action.visible)
|
|
423
|
-
return state;
|
|
424
|
-
// Close active panel if it's a left tab and we're hiding the left panel
|
|
425
|
-
const activePanel = !action.visible && state.activePanel !== null && isLeftPanelTab(state.activePanel)
|
|
426
|
-
? null
|
|
427
|
-
: state.activePanel;
|
|
428
|
-
return { ...state, leftPanelVisible: action.visible, activePanel };
|
|
429
|
-
}
|
|
430
|
-
case "SET_RIGHT_PANEL_VISIBLE": {
|
|
431
|
-
if (state.rightPanelVisible === action.visible)
|
|
432
|
-
return state;
|
|
433
|
-
// Close active panel if it's a right tab and we're hiding the right panel
|
|
434
|
-
const activePanel = !action.visible && state.activePanel !== null && !isLeftPanelTab(state.activePanel)
|
|
435
|
-
? null
|
|
436
|
-
: state.activePanel;
|
|
437
|
-
return { ...state, rightPanelVisible: action.visible, activePanel };
|
|
438
|
-
}
|
|
439
|
-
case "SET_FULLSCREEN_BUTTON_VISIBLE": {
|
|
440
|
-
if (state.fullscreenButtonVisible === action.visible)
|
|
441
|
-
return state;
|
|
442
|
-
return { ...state, fullscreenButtonVisible: action.visible };
|
|
443
|
-
}
|
|
444
|
-
case "SET_DOWNLOAD_BUTTON_VISIBLE": {
|
|
445
|
-
if (state.downloadButtonVisible === action.visible)
|
|
446
|
-
return state;
|
|
447
|
-
return { ...state, downloadButtonVisible: action.visible };
|
|
448
|
-
}
|
|
449
|
-
case "SET_PRINT_BUTTON_VISIBLE": {
|
|
450
|
-
if (state.printButtonVisible === action.visible)
|
|
451
|
-
return state;
|
|
452
|
-
return { ...state, printButtonVisible: action.visible };
|
|
453
|
-
}
|
|
454
|
-
case "SET_THEME": {
|
|
455
|
-
if (state.theme === action.theme)
|
|
456
|
-
return state;
|
|
457
|
-
return { ...state, theme: action.theme };
|
|
458
|
-
}
|
|
459
|
-
case "SET_THEME_SWITCHING_DISABLED": {
|
|
460
|
-
if (state.themeSwitchingDisabled === action.disabled)
|
|
461
|
-
return state;
|
|
462
|
-
return { ...state, themeSwitchingDisabled: action.disabled };
|
|
463
|
-
}
|
|
464
|
-
case "SET_TEXT_SELECTION_DISABLED": {
|
|
465
|
-
if (state.textSelectionDisabled === action.disabled)
|
|
466
|
-
return state;
|
|
467
|
-
return { ...state, textSelectionDisabled: action.disabled };
|
|
468
|
-
}
|
|
469
|
-
case "SET_MIN_ZOOM": {
|
|
470
|
-
if (state.minZoom === action.zoom)
|
|
471
|
-
return state;
|
|
472
|
-
const zoom = state.zoom < action.zoom ? action.zoom : state.zoom;
|
|
473
|
-
return { ...state, minZoom: action.zoom, zoom };
|
|
474
|
-
}
|
|
475
|
-
case "SET_MAX_ZOOM": {
|
|
476
|
-
if (state.maxZoom === action.zoom)
|
|
477
|
-
return state;
|
|
478
|
-
const zoom = state.zoom > action.zoom ? action.zoom : state.zoom;
|
|
479
|
-
return { ...state, maxZoom: action.zoom, zoom };
|
|
480
|
-
}
|
|
481
|
-
case "SET_PANEL_DISABLED": {
|
|
482
|
-
const alreadyDisabled = state.disabledPanels.has(action.panel);
|
|
483
|
-
if (alreadyDisabled === action.disabled)
|
|
484
|
-
return state;
|
|
485
|
-
const newDisabled = new Set(state.disabledPanels);
|
|
486
|
-
if (action.disabled) {
|
|
487
|
-
newDisabled.add(action.panel);
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
newDisabled.delete(action.panel);
|
|
491
|
-
}
|
|
492
|
-
// If the currently active panel is being disabled, close it
|
|
493
|
-
const activePanel = action.disabled && state.activePanel === action.panel ? null : state.activePanel;
|
|
494
|
-
return { ...state, disabledPanels: newDisabled, activePanel };
|
|
495
|
-
}
|
|
496
|
-
// Annotation highlight
|
|
497
|
-
case "HIGHLIGHT_ANNOTATION": {
|
|
498
|
-
return {
|
|
499
|
-
...state,
|
|
500
|
-
highlightedAnnotation: {
|
|
501
|
-
pageIndex: action.pageIndex,
|
|
502
|
-
bounds: action.bounds,
|
|
503
|
-
},
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
case "CLEAR_ANNOTATION_HIGHLIGHT": {
|
|
507
|
-
if (state.highlightedAnnotation === null)
|
|
508
|
-
return state;
|
|
509
|
-
return { ...state, highlightedAnnotation: null };
|
|
510
|
-
}
|
|
511
|
-
// Fullscreen
|
|
512
|
-
case "SET_FULLSCREEN": {
|
|
513
|
-
if (state.isFullscreen === action.isFullscreen)
|
|
514
|
-
return state;
|
|
515
|
-
return { ...state, isFullscreen: action.isFullscreen };
|
|
516
|
-
}
|
|
517
|
-
// Search
|
|
518
|
-
case "SET_SEARCH_QUERY": {
|
|
519
|
-
if (state.searchQuery === action.query)
|
|
520
|
-
return state;
|
|
521
|
-
return { ...state, searchQuery: action.query };
|
|
522
|
-
}
|
|
523
|
-
case "SET_SEARCH_CASE_SENSITIVE": {
|
|
524
|
-
if (state.searchCaseSensitive === action.caseSensitive)
|
|
525
|
-
return state;
|
|
526
|
-
return { ...state, searchCaseSensitive: action.caseSensitive, searchMatches: [], searchActiveIndex: -1 };
|
|
527
|
-
}
|
|
528
|
-
case "SET_SEARCH_FUZZY": {
|
|
529
|
-
if (state.searchFuzzy === action.fuzzy)
|
|
530
|
-
return state;
|
|
531
|
-
return { ...state, searchFuzzy: action.fuzzy, searchMatches: [], searchActiveIndex: -1 };
|
|
532
|
-
}
|
|
533
|
-
case "SET_SEARCH_MATCHES": {
|
|
534
|
-
const hasMatches = action.matches.length > 0;
|
|
535
|
-
const hadMatches = state.searchActiveIndex >= 0;
|
|
536
|
-
const resetActive = action.resetActiveIndex !== false;
|
|
537
|
-
const shouldReset = resetActive || !hadMatches;
|
|
538
|
-
const activeIndex = hasMatches
|
|
539
|
-
? shouldReset
|
|
540
|
-
? 0
|
|
541
|
-
: Math.min(state.searchActiveIndex, action.matches.length - 1)
|
|
542
|
-
: -1;
|
|
543
|
-
const navChanged = shouldReset && hasMatches;
|
|
544
|
-
return {
|
|
545
|
-
...state,
|
|
546
|
-
searchMatches: action.matches,
|
|
547
|
-
searchActiveIndex: activeIndex,
|
|
548
|
-
searchNavGen: navChanged ? state.searchNavGen + 1 : state.searchNavGen,
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
case "SET_SEARCH_ACTIVE_INDEX": {
|
|
552
|
-
const index = action.index;
|
|
553
|
-
if (index < 0 || index >= state.searchMatches.length)
|
|
554
|
-
return state;
|
|
555
|
-
return {
|
|
556
|
-
...state,
|
|
557
|
-
searchActiveIndex: index,
|
|
558
|
-
searchNavGen: state.searchNavGen + 1,
|
|
559
|
-
searchNavScrollAlignment: action.scrollAlignment ?? null,
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
case "SEARCH_NEXT": {
|
|
563
|
-
if (state.searchMatches.length === 0)
|
|
564
|
-
return state;
|
|
565
|
-
const next = (state.searchActiveIndex + 1) % state.searchMatches.length;
|
|
566
|
-
return {
|
|
567
|
-
...state,
|
|
568
|
-
searchActiveIndex: next,
|
|
569
|
-
searchNavGen: state.searchNavGen + 1,
|
|
570
|
-
searchNavScrollAlignment: action.scrollAlignment ?? null,
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
case "SEARCH_PREV": {
|
|
574
|
-
if (state.searchMatches.length === 0)
|
|
575
|
-
return state;
|
|
576
|
-
const prev = (state.searchActiveIndex - 1 + state.searchMatches.length) % state.searchMatches.length;
|
|
577
|
-
return {
|
|
578
|
-
...state,
|
|
579
|
-
searchActiveIndex: prev,
|
|
580
|
-
searchNavGen: state.searchNavGen + 1,
|
|
581
|
-
searchNavScrollAlignment: action.scrollAlignment ?? null,
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
case "CLEAR_SEARCH": {
|
|
585
|
-
if (state.searchQuery === "" && state.searchMatches.length === 0 && state.searchActiveIndex === -1)
|
|
586
|
-
return state;
|
|
587
|
-
return { ...state, searchQuery: "", searchMatches: [], searchActiveIndex: -1 };
|
|
588
|
-
}
|
|
589
|
-
case "SET_SEARCH_PAGE_RANGE": {
|
|
590
|
-
const prev = state.searchPageRange;
|
|
591
|
-
const next = action.range;
|
|
592
|
-
const same = prev === next || (prev !== null && next !== null && prev.start === next.start && prev.end === next.end);
|
|
593
|
-
if (same)
|
|
594
|
-
return state;
|
|
595
|
-
return {
|
|
596
|
-
...state,
|
|
597
|
-
searchPageRange: next,
|
|
598
|
-
searchMatches: [],
|
|
599
|
-
searchActiveIndex: -1,
|
|
600
|
-
searchTextLoaded: false,
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
case "SET_SEARCH_TEXT_LOADING": {
|
|
604
|
-
if (state.searchTextLoading === action.loading)
|
|
605
|
-
return state;
|
|
606
|
-
return { ...state, searchTextLoading: action.loading };
|
|
607
|
-
}
|
|
608
|
-
case "SET_SEARCH_TEXT_LOADED": {
|
|
609
|
-
if (state.searchTextLoaded === action.loaded)
|
|
610
|
-
return state;
|
|
611
|
-
return { ...state, searchTextLoaded: action.loaded };
|
|
612
|
-
}
|
|
613
|
-
// Download progress
|
|
614
|
-
case "SET_DOWNLOAD_PROGRESS": {
|
|
615
|
-
return {
|
|
616
|
-
...state,
|
|
617
|
-
isDownloading: true,
|
|
618
|
-
downloadLoaded: action.loaded,
|
|
619
|
-
downloadTotal: action.total,
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
case "CLEAR_DOWNLOAD_PROGRESS": {
|
|
623
|
-
if (!state.isDownloading)
|
|
624
|
-
return state;
|
|
625
|
-
return {
|
|
626
|
-
...state,
|
|
627
|
-
isDownloading: false,
|
|
628
|
-
downloadLoaded: 0,
|
|
629
|
-
downloadTotal: 0,
|
|
630
|
-
};
|
|
631
|
-
}
|
|
632
|
-
// Processing state
|
|
633
|
-
case "SET_PROCESSING": {
|
|
634
|
-
if (state.isProcessing === action.processing)
|
|
635
|
-
return state;
|
|
636
|
-
return { ...state, isProcessing: action.processing };
|
|
637
|
-
}
|
|
638
|
-
// Print progress
|
|
639
|
-
case "SET_PRINT_PROGRESS": {
|
|
640
|
-
return {
|
|
641
|
-
...state,
|
|
642
|
-
isPrinting: true,
|
|
643
|
-
printCurrentPage: action.currentPage,
|
|
644
|
-
printTotalPages: action.totalPages,
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
case "CLEAR_PRINT_PROGRESS": {
|
|
648
|
-
if (!state.isPrinting)
|
|
649
|
-
return state;
|
|
650
|
-
return {
|
|
651
|
-
...state,
|
|
652
|
-
isPrinting: false,
|
|
653
|
-
printCurrentPage: 0,
|
|
654
|
-
printTotalPages: 0,
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
case "SHOW_PRINT_DIALOG": {
|
|
658
|
-
if (state.showPrintDialog)
|
|
659
|
-
return state;
|
|
660
|
-
return { ...state, showPrintDialog: true };
|
|
661
|
-
}
|
|
662
|
-
case "HIDE_PRINT_DIALOG": {
|
|
663
|
-
if (!state.showPrintDialog)
|
|
664
|
-
return state;
|
|
665
|
-
return { ...state, showPrintDialog: false };
|
|
666
|
-
}
|
|
667
|
-
case "ENABLE_PANEL_TRANSITIONS": {
|
|
668
|
-
if (!state.panelTransitionsDisabled)
|
|
669
|
-
return state;
|
|
670
|
-
return { ...state, panelTransitionsDisabled: false };
|
|
671
|
-
}
|
|
672
|
-
// Tools
|
|
673
|
-
case "SET_ACTIVE_TOOL": {
|
|
674
|
-
const next = action.tool;
|
|
675
|
-
// Clicking the same tool-set kind again → back to pointer
|
|
676
|
-
if (state.activeTool.kind === next.kind && (next.kind === "annotate" || next.kind === "markup")) {
|
|
677
|
-
return { ...state, activeTool: { kind: "pointer" }, selectedAnnotation: null };
|
|
678
|
-
}
|
|
679
|
-
// Update the per-set memory when landing on a tool set
|
|
680
|
-
const lastSubToolPerSet = next.kind === "annotate" && state.lastSubToolPerSet.annotate !== next.sub
|
|
681
|
-
? { ...state.lastSubToolPerSet, annotate: next.sub }
|
|
682
|
-
: next.kind === "markup" && state.lastSubToolPerSet.markup !== next.sub
|
|
683
|
-
? { ...state.lastSubToolPerSet, markup: next.sub }
|
|
684
|
-
: state.lastSubToolPerSet;
|
|
685
|
-
const keepSelection = (next.kind === "annotate" || next.kind === "markup") && next.sub === "select";
|
|
686
|
-
return {
|
|
687
|
-
...state,
|
|
688
|
-
activeTool: next,
|
|
689
|
-
lastSubToolPerSet,
|
|
690
|
-
selectedAnnotation: keepSelection ? state.selectedAnnotation : null,
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
case "SET_SUB_TOOL": {
|
|
694
|
-
const at = state.activeTool;
|
|
695
|
-
if (at.kind !== "annotate" && at.kind !== "markup")
|
|
696
|
-
return state;
|
|
697
|
-
if (at.sub === action.subTool)
|
|
698
|
-
return state;
|
|
699
|
-
// The toolbar dispatches the right sub-tool family for the active set;
|
|
700
|
-
// narrow by kind to keep the tagged shape sound.
|
|
701
|
-
const nextActive = at.kind === "annotate"
|
|
702
|
-
? { kind: "annotate", sub: action.subTool }
|
|
703
|
-
: { kind: "markup", sub: action.subTool };
|
|
704
|
-
const lastSubToolPerSet = at.kind === "annotate"
|
|
705
|
-
? { ...state.lastSubToolPerSet, annotate: action.subTool }
|
|
706
|
-
: { ...state.lastSubToolPerSet, markup: action.subTool };
|
|
707
|
-
return {
|
|
708
|
-
...state,
|
|
709
|
-
activeTool: nextActive,
|
|
710
|
-
lastSubToolPerSet,
|
|
711
|
-
// Clear selection when switching away from select tool
|
|
712
|
-
selectedAnnotation: action.subTool !== "select" ? null : state.selectedAnnotation,
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
case "SET_TOOL_OPTION": {
|
|
716
|
-
const current = state.toolOptions[action.subTool] ?? { ...DEFAULT_TOOL_OPTIONS };
|
|
717
|
-
const updated = { ...current, [action.key]: action.value };
|
|
718
|
-
return {
|
|
719
|
-
...state,
|
|
720
|
-
toolOptions: { ...state.toolOptions, [action.subTool]: updated },
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
// Annotation editing.
|
|
724
|
-
// Ephemeral annotations live in the same map as real ones so they
|
|
725
|
-
// render through the same path, but they never mark the page dirty —
|
|
726
|
-
// the dirty set drives PDF write-back, and ephemeral annotations
|
|
727
|
-
// exist only in memory.
|
|
728
|
-
case "ADD_ANNOTATION": {
|
|
729
|
-
const existing = state.pageAnnotations.get(action.pageIndex) ?? [];
|
|
730
|
-
const newAnnotations = new Map(state.pageAnnotations);
|
|
731
|
-
newAnnotations.set(action.pageIndex, [...existing, action.annotation]);
|
|
732
|
-
const newDirty = action.annotation.ephemeral
|
|
733
|
-
? state.annotationsDirtyPages
|
|
734
|
-
: new Set(state.annotationsDirtyPages).add(action.pageIndex);
|
|
735
|
-
return { ...state, pageAnnotations: newAnnotations, annotationsDirtyPages: newDirty };
|
|
736
|
-
}
|
|
737
|
-
case "ADD_ANNOTATIONS": {
|
|
738
|
-
if (action.annotations.length === 0)
|
|
739
|
-
return state;
|
|
740
|
-
const existing = state.pageAnnotations.get(action.pageIndex) ?? [];
|
|
741
|
-
const newAnnotations = new Map(state.pageAnnotations);
|
|
742
|
-
newAnnotations.set(action.pageIndex, [...existing, ...action.annotations]);
|
|
743
|
-
const hasReal = action.annotations.some((a) => !a.ephemeral);
|
|
744
|
-
const newDirty = hasReal
|
|
745
|
-
? new Set(state.annotationsDirtyPages).add(action.pageIndex)
|
|
746
|
-
: state.annotationsDirtyPages;
|
|
747
|
-
return { ...state, pageAnnotations: newAnnotations, annotationsDirtyPages: newDirty };
|
|
748
|
-
}
|
|
749
|
-
case "REMOVE_ANNOTATION": {
|
|
750
|
-
const existing = state.pageAnnotations.get(action.pageIndex);
|
|
751
|
-
if (!existing || action.annotationIndex >= existing.length)
|
|
752
|
-
return state;
|
|
753
|
-
const removed = existing[action.annotationIndex];
|
|
754
|
-
const newList = existing.filter((_, i) => i !== action.annotationIndex);
|
|
755
|
-
const newAnnotations = new Map(state.pageAnnotations);
|
|
756
|
-
newAnnotations.set(action.pageIndex, newList);
|
|
757
|
-
const newDirty = removed.ephemeral
|
|
758
|
-
? state.annotationsDirtyPages
|
|
759
|
-
: new Set(state.annotationsDirtyPages).add(action.pageIndex);
|
|
760
|
-
return {
|
|
761
|
-
...state,
|
|
762
|
-
pageAnnotations: newAnnotations,
|
|
763
|
-
annotationsDirtyPages: newDirty,
|
|
764
|
-
selectedAnnotation: null,
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
case "UPDATE_ANNOTATION": {
|
|
768
|
-
const existing = state.pageAnnotations.get(action.pageIndex);
|
|
769
|
-
if (!existing || action.annotationIndex >= existing.length)
|
|
770
|
-
return state;
|
|
771
|
-
const prevAnn = existing[action.annotationIndex];
|
|
772
|
-
const newList = existing.map((a, i) => (i === action.annotationIndex ? action.annotation : a));
|
|
773
|
-
const newAnnotations = new Map(state.pageAnnotations);
|
|
774
|
-
newAnnotations.set(action.pageIndex, newList);
|
|
775
|
-
// Mark dirty if either the prior or new annotation is non-ephemeral —
|
|
776
|
-
// promotion (ephemeral → real) or demotion (real → ephemeral)
|
|
777
|
-
// both change what gets written to the saved PDF.
|
|
778
|
-
const touchesReal = !prevAnn.ephemeral || !action.annotation.ephemeral;
|
|
779
|
-
const newDirty = touchesReal
|
|
780
|
-
? new Set(state.annotationsDirtyPages).add(action.pageIndex)
|
|
781
|
-
: state.annotationsDirtyPages;
|
|
782
|
-
return { ...state, pageAnnotations: newAnnotations, annotationsDirtyPages: newDirty };
|
|
783
|
-
}
|
|
784
|
-
case "UPDATE_ANNOTATIONS": {
|
|
785
|
-
if (action.updates.length === 0)
|
|
786
|
-
return state;
|
|
787
|
-
const existing = state.pageAnnotations.get(action.pageIndex);
|
|
788
|
-
if (!existing)
|
|
789
|
-
return state;
|
|
790
|
-
const newList = existing.slice();
|
|
791
|
-
let touchesReal = false;
|
|
792
|
-
for (const { annotationIndex, annotation } of action.updates) {
|
|
793
|
-
if (annotationIndex < 0 || annotationIndex >= newList.length)
|
|
794
|
-
continue;
|
|
795
|
-
const prevAnn = newList[annotationIndex];
|
|
796
|
-
newList[annotationIndex] = annotation;
|
|
797
|
-
if (!prevAnn.ephemeral || !annotation.ephemeral)
|
|
798
|
-
touchesReal = true;
|
|
799
|
-
}
|
|
800
|
-
const newAnnotations = new Map(state.pageAnnotations);
|
|
801
|
-
newAnnotations.set(action.pageIndex, newList);
|
|
802
|
-
const newDirty = touchesReal
|
|
803
|
-
? new Set(state.annotationsDirtyPages).add(action.pageIndex)
|
|
804
|
-
: state.annotationsDirtyPages;
|
|
805
|
-
return { ...state, pageAnnotations: newAnnotations, annotationsDirtyPages: newDirty };
|
|
806
|
-
}
|
|
807
|
-
case "RESTORE_PAGE_ANNOTATIONS": {
|
|
808
|
-
const newAnnotations = new Map(state.pageAnnotations);
|
|
809
|
-
newAnnotations.set(action.pageIndex, action.annotations);
|
|
810
|
-
const newDirty = new Set(state.annotationsDirtyPages);
|
|
811
|
-
newDirty.add(action.pageIndex);
|
|
812
|
-
return {
|
|
813
|
-
...state,
|
|
814
|
-
pageAnnotations: newAnnotations,
|
|
815
|
-
annotationsDirtyPages: newDirty,
|
|
816
|
-
selectedAnnotation: null,
|
|
817
|
-
};
|
|
818
|
-
}
|
|
819
|
-
// Annotation selection
|
|
820
|
-
case "SELECT_ANNOTATION": {
|
|
821
|
-
const sel = state.selectedAnnotation;
|
|
822
|
-
if (sel && sel.pageIndex === action.pageIndex && sel.annotationIndex === action.annotationIndex)
|
|
823
|
-
return state;
|
|
824
|
-
return {
|
|
825
|
-
...state,
|
|
826
|
-
selectedAnnotation: { pageIndex: action.pageIndex, annotationIndex: action.annotationIndex },
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
case "DESELECT_ANNOTATION": {
|
|
830
|
-
if (state.selectedAnnotation === null)
|
|
831
|
-
return state;
|
|
832
|
-
return { ...state, selectedAnnotation: null };
|
|
833
|
-
}
|
|
834
|
-
default:
|
|
835
|
-
return state;
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
function clamp(value, min, max) {
|
|
839
|
-
return Math.min(max, Math.max(min, value));
|
|
840
|
-
}
|
|
841
|
-
//# sourceMappingURL=reducer.js.map
|