@jacktea/pdf-viewer-component 0.1.5
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.md +45 -0
- package/dist/annotations/annotation-layer.d.ts +40 -0
- package/dist/annotations/annotation-layer.d.ts.map +1 -0
- package/dist/annotations/annotation-layer.test.d.ts +2 -0
- package/dist/annotations/annotation-layer.test.d.ts.map +1 -0
- package/dist/annotations/interaction/annotation-interaction-controller.d.ts +59 -0
- package/dist/annotations/interaction/annotation-interaction-controller.d.ts.map +1 -0
- package/dist/annotations/interaction/tool-utils.d.ts +11 -0
- package/dist/annotations/interaction/tool-utils.d.ts.map +1 -0
- package/dist/annotations/rendering/annotation-svg-renderer.d.ts +28 -0
- package/dist/annotations/rendering/annotation-svg-renderer.d.ts.map +1 -0
- package/dist/annotations/rendering/annotation-svg-renderer.test.d.ts +2 -0
- package/dist/annotations/rendering/annotation-svg-renderer.test.d.ts.map +1 -0
- package/dist/annotations/rendering/geometry-utils.d.ts +6 -0
- package/dist/annotations/rendering/geometry-utils.d.ts.map +1 -0
- package/dist/annotations/rendering/hit-testing.d.ts +10 -0
- package/dist/annotations/rendering/hit-testing.d.ts.map +1 -0
- package/dist/annotations/rendering/index.d.ts +3 -0
- package/dist/annotations/rendering/index.d.ts.map +1 -0
- package/dist/annotations/settings.d.ts +46 -0
- package/dist/annotations/settings.d.ts.map +1 -0
- package/dist/annotations/types.d.ts +3 -0
- package/dist/annotations/types.d.ts.map +1 -0
- package/dist/annotations/ui/annotation-metadata.d.ts +12 -0
- package/dist/annotations/ui/annotation-metadata.d.ts.map +1 -0
- package/dist/annotations/ui/appearance-editor.d.ts +16 -0
- package/dist/annotations/ui/appearance-editor.d.ts.map +1 -0
- package/dist/annotations/ui/arrow-style-editor.d.ts +17 -0
- package/dist/annotations/ui/arrow-style-editor.d.ts.map +1 -0
- package/dist/annotations/ui/header-card.d.ts +4 -0
- package/dist/annotations/ui/header-card.d.ts.map +1 -0
- package/dist/annotations/ui/index.d.ts +8 -0
- package/dist/annotations/ui/index.d.ts.map +1 -0
- package/dist/annotations/ui/popup-toolbar.d.ts +53 -0
- package/dist/annotations/ui/popup-toolbar.d.ts.map +1 -0
- package/dist/annotations/ui/popup-toolbar.test.d.ts +2 -0
- package/dist/annotations/ui/popup-toolbar.test.d.ts.map +1 -0
- package/dist/annotations/ui/stroke-style-editor.d.ts +16 -0
- package/dist/annotations/ui/stroke-style-editor.d.ts.map +1 -0
- package/dist/annotations/ui/style-pickers.d.ts +82 -0
- package/dist/annotations/ui/style-pickers.d.ts.map +1 -0
- package/dist/annotations/ui/text-style-editor.d.ts +22 -0
- package/dist/annotations/ui/text-style-editor.d.ts.map +1 -0
- package/dist/annotations/ui/tool-selector.d.ts +8 -0
- package/dist/annotations/ui/tool-selector.d.ts.map +1 -0
- package/dist/components/popover.d.ts +25 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/tooltip.d.ts +28 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/coordinators/annotation-coordinator.d.ts +281 -0
- package/dist/coordinators/annotation-coordinator.d.ts.map +1 -0
- package/dist/coordinators/annotation-coordinator.test.d.ts +2 -0
- package/dist/coordinators/annotation-coordinator.test.d.ts.map +1 -0
- package/dist/coordinators/event-dispatcher.d.ts +93 -0
- package/dist/coordinators/event-dispatcher.d.ts.map +1 -0
- package/dist/coordinators/index.d.ts +20 -0
- package/dist/coordinators/index.d.ts.map +1 -0
- package/dist/coordinators/mode-coordinator.d.ts +74 -0
- package/dist/coordinators/mode-coordinator.d.ts.map +1 -0
- package/dist/coordinators/panel-coordinator-v2.d.ts +138 -0
- package/dist/coordinators/panel-coordinator-v2.d.ts.map +1 -0
- package/dist/coordinators/state-sync-manager.d.ts +37 -0
- package/dist/coordinators/state-sync-manager.d.ts.map +1 -0
- package/dist/coordinators/state-tracker.d.ts +48 -0
- package/dist/coordinators/state-tracker.d.ts.map +1 -0
- package/dist/coordinators/state-types.d.ts +56 -0
- package/dist/coordinators/state-types.d.ts.map +1 -0
- package/dist/coordinators/ui-initializer.d.ts +130 -0
- package/dist/coordinators/ui-initializer.d.ts.map +1 -0
- package/dist/di/container.d.ts +77 -0
- package/dist/di/container.d.ts.map +1 -0
- package/dist/di/container.test.d.ts +5 -0
- package/dist/di/container.test.d.ts.map +1 -0
- package/dist/di/index.d.ts +11 -0
- package/dist/di/index.d.ts.map +1 -0
- package/dist/di/tokens.d.ts +88 -0
- package/dist/di/tokens.d.ts.map +1 -0
- package/dist/domains/annotation/index.d.ts +9 -0
- package/dist/domains/annotation/index.d.ts.map +1 -0
- package/dist/domains/annotation/styles.d.ts +23 -0
- package/dist/domains/annotation/styles.d.ts.map +1 -0
- package/dist/domains/annotation/sync.d.ts +68 -0
- package/dist/domains/annotation/sync.d.ts.map +1 -0
- package/dist/domains/annotation/sync.test.d.ts +2 -0
- package/dist/domains/annotation/sync.test.d.ts.map +1 -0
- package/dist/domains/export/index.d.ts +10 -0
- package/dist/domains/export/index.d.ts.map +1 -0
- package/dist/domains/export/metadata.d.ts +31 -0
- package/dist/domains/export/metadata.d.ts.map +1 -0
- package/dist/domains/export/metadata.test.d.ts +2 -0
- package/dist/domains/export/metadata.test.d.ts.map +1 -0
- package/dist/domains/export/pdf-export.d.ts +70 -0
- package/dist/domains/export/pdf-export.d.ts.map +1 -0
- package/dist/domains/export/pdf-export.test.d.ts +2 -0
- package/dist/domains/export/pdf-export.test.d.ts.map +1 -0
- package/dist/domains/export/watermark.d.ts +24 -0
- package/dist/domains/export/watermark.d.ts.map +1 -0
- package/dist/domains/export/watermark.test.d.ts +2 -0
- package/dist/domains/export/watermark.test.d.ts.map +1 -0
- package/dist/domains/index.d.ts +18 -0
- package/dist/domains/index.d.ts.map +1 -0
- package/dist/domains/ui/dialogs.d.ts +49 -0
- package/dist/domains/ui/dialogs.d.ts.map +1 -0
- package/dist/domains/ui/dialogs.test.d.ts +2 -0
- package/dist/domains/ui/dialogs.test.d.ts.map +1 -0
- package/dist/domains/ui/editors.d.ts +120 -0
- package/dist/domains/ui/editors.d.ts.map +1 -0
- package/dist/domains/ui/index.d.ts +9 -0
- package/dist/domains/ui/index.d.ts.map +1 -0
- package/dist/domains/viewer/actions.d.ts +90 -0
- package/dist/domains/viewer/actions.d.ts.map +1 -0
- package/dist/domains/viewer/actions.test.d.ts +2 -0
- package/dist/domains/viewer/actions.test.d.ts.map +1 -0
- package/dist/domains/viewer/index.d.ts +10 -0
- package/dist/domains/viewer/index.d.ts.map +1 -0
- package/dist/domains/viewer/persistence.d.ts +122 -0
- package/dist/domains/viewer/persistence.d.ts.map +1 -0
- package/dist/domains/viewer/persistence.test.d.ts +2 -0
- package/dist/domains/viewer/persistence.test.d.ts.map +1 -0
- package/dist/domains/viewer/types.d.ts +42 -0
- package/dist/domains/viewer/types.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +77 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/locales/en.d.ts +3 -0
- package/dist/i18n/locales/en.d.ts.map +1 -0
- package/dist/i18n/locales/zh-CN.d.ts +3 -0
- package/dist/i18n/locales/zh-CN.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +231 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/icons/icon-registry.d.ts +69 -0
- package/dist/icons/icon-registry.d.ts.map +1 -0
- package/dist/icons/toolbar-icons.d.ts +38 -0
- package/dist/icons/toolbar-icons.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +1 -0
- package/dist/layers/canvas-layer.d.ts +44 -0
- package/dist/layers/canvas-layer.d.ts.map +1 -0
- package/dist/layers/canvas-layer.test.d.ts +2 -0
- package/dist/layers/canvas-layer.test.d.ts.map +1 -0
- package/dist/layers/canvas-utils.d.ts +80 -0
- package/dist/layers/canvas-utils.d.ts.map +1 -0
- package/dist/layers/template-layer.d.ts +41 -0
- package/dist/layers/template-layer.d.ts.map +1 -0
- package/dist/panels/annotation-comments-panel.d.ts +80 -0
- package/dist/panels/annotation-comments-panel.d.ts.map +1 -0
- package/dist/panels/annotation-settings-panel.d.ts +60 -0
- package/dist/panels/annotation-settings-panel.d.ts.map +1 -0
- package/dist/panels/annotation-summary-panel.d.ts +127 -0
- package/dist/panels/annotation-summary-panel.d.ts.map +1 -0
- package/dist/panels/annotation-summary-panel.test.d.ts +2 -0
- package/dist/panels/annotation-summary-panel.test.d.ts.map +1 -0
- package/dist/panels/comment-input.d.ts +34 -0
- package/dist/panels/comment-input.d.ts.map +1 -0
- package/dist/panels/comment-input.test.d.ts +2 -0
- package/dist/panels/comment-input.test.d.ts.map +1 -0
- package/dist/panels/container-panel.d.ts +136 -0
- package/dist/panels/container-panel.d.ts.map +1 -0
- package/dist/panels/content-panel.d.ts +95 -0
- package/dist/panels/content-panel.d.ts.map +1 -0
- package/dist/panels/document-properties-panel.d.ts +54 -0
- package/dist/panels/document-properties-panel.d.ts.map +1 -0
- package/dist/panels/index.d.ts +26 -0
- package/dist/panels/index.d.ts.map +1 -0
- package/dist/panels/outline-panel.d.ts +32 -0
- package/dist/panels/outline-panel.d.ts.map +1 -0
- package/dist/panels/panel-factory.d.ts +37 -0
- package/dist/panels/panel-factory.d.ts.map +1 -0
- package/dist/panels/panel-integration-example.d.ts +49 -0
- package/dist/panels/panel-integration-example.d.ts.map +1 -0
- package/dist/panels/panel-manager.d.ts +98 -0
- package/dist/panels/panel-manager.d.ts.map +1 -0
- package/dist/panels/template-field-panel.d.ts +27 -0
- package/dist/panels/template-field-panel.d.ts.map +1 -0
- package/dist/panels/template-property-panel.d.ts +30 -0
- package/dist/panels/template-property-panel.d.ts.map +1 -0
- package/dist/panels/template-ui-helpers.d.ts +32 -0
- package/dist/panels/template-ui-helpers.d.ts.map +1 -0
- package/dist/panels/thumbnail-panel.d.ts +49 -0
- package/dist/panels/thumbnail-panel.d.ts.map +1 -0
- package/dist/pdfjs.d.ts +15 -0
- package/dist/pdfjs.d.ts.map +1 -0
- package/dist/plugins/examples/custom-tool-plugin.d.ts +12 -0
- package/dist/plugins/examples/custom-tool-plugin.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +108 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -0
- package/dist/plugins/plugin-manager.test.d.ts +5 -0
- package/dist/plugins/plugin-manager.test.d.ts.map +1 -0
- package/dist/plugins/types.d.ts +167 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/render/page-renderer.d.ts +16 -0
- package/dist/render/page-renderer.d.ts.map +1 -0
- package/dist/render/scale.d.ts +3 -0
- package/dist/render/scale.d.ts.map +1 -0
- package/dist/render/text-layer.d.ts +4 -0
- package/dist/render/text-layer.d.ts.map +1 -0
- package/dist/render/thumb-renderer.d.ts +3 -0
- package/dist/render/thumb-renderer.d.ts.map +1 -0
- package/dist/toolbar/button-registry.d.ts +56 -0
- package/dist/toolbar/button-registry.d.ts.map +1 -0
- package/dist/toolbar/toolbar-helpers.d.ts +168 -0
- package/dist/toolbar/toolbar-helpers.d.ts.map +1 -0
- package/dist/toolbar/toolbar-icons.d.ts +3 -0
- package/dist/toolbar/toolbar-icons.d.ts.map +1 -0
- package/dist/toolbar/toolbar.d.ts +116 -0
- package/dist/toolbar/toolbar.d.ts.map +1 -0
- package/dist/ui/color-picker.d.ts +72 -0
- package/dist/ui/color-picker.d.ts.map +1 -0
- package/dist/ui/slider.d.ts +25 -0
- package/dist/ui/slider.d.ts.map +1 -0
- package/dist/utils/annotation-utils.d.ts +13 -0
- package/dist/utils/annotation-utils.d.ts.map +1 -0
- package/dist/utils/color-utils.d.ts +42 -0
- package/dist/utils/color-utils.d.ts.map +1 -0
- package/dist/utils/confirm-dialog.d.ts +10 -0
- package/dist/utils/confirm-dialog.d.ts.map +1 -0
- package/dist/utils/deep-equal.d.ts +2 -0
- package/dist/utils/deep-equal.d.ts.map +1 -0
- package/dist/utils/deep-equal.test.d.ts +2 -0
- package/dist/utils/deep-equal.test.d.ts.map +1 -0
- package/dist/utils/document-utils.d.ts +63 -0
- package/dist/utils/document-utils.d.ts.map +1 -0
- package/dist/utils/id-generator.d.ts +41 -0
- package/dist/utils/id-generator.d.ts.map +1 -0
- package/dist/utils/image-preview.d.ts +7 -0
- package/dist/utils/image-preview.d.ts.map +1 -0
- package/dist/utils/timestamp.d.ts +3 -0
- package/dist/utils/timestamp.d.ts.map +1 -0
- package/dist/viewer/collaboration-runtime.d.ts +29 -0
- package/dist/viewer/collaboration-runtime.d.ts.map +1 -0
- package/dist/viewer/config.d.ts +481 -0
- package/dist/viewer/config.d.ts.map +1 -0
- package/dist/viewer/document-load-pipeline.d.ts +43 -0
- package/dist/viewer/document-load-pipeline.d.ts.map +1 -0
- package/dist/viewer/document-load-pipeline.test.d.ts +2 -0
- package/dist/viewer/document-load-pipeline.test.d.ts.map +1 -0
- package/dist/viewer/element.d.ts +174 -0
- package/dist/viewer/element.d.ts.map +1 -0
- package/dist/viewer/element.test.d.ts +2 -0
- package/dist/viewer/element.test.d.ts.map +1 -0
- package/dist/viewer/events.d.ts +212 -0
- package/dist/viewer/events.d.ts.map +1 -0
- package/dist/viewer/export-orchestrator.d.ts +9 -0
- package/dist/viewer/export-orchestrator.d.ts.map +1 -0
- package/dist/viewer/headless.d.ts +108 -0
- package/dist/viewer/headless.d.ts.map +1 -0
- package/dist/viewer/internal-event-bindings.d.ts +26 -0
- package/dist/viewer/internal-event-bindings.d.ts.map +1 -0
- package/dist/viewer/internal-event-bindings.test.d.ts +2 -0
- package/dist/viewer/internal-event-bindings.test.d.ts.map +1 -0
- package/dist/viewer/modal.d.ts +22 -0
- package/dist/viewer/modal.d.ts.map +1 -0
- package/dist/viewer/page-indicator.d.ts +56 -0
- package/dist/viewer/page-indicator.d.ts.map +1 -0
- package/dist/viewer/pdfjs-resources.d.ts +12 -0
- package/dist/viewer/pdfjs-resources.d.ts.map +1 -0
- package/dist/viewer/server-writeback.d.ts +23 -0
- package/dist/viewer/server-writeback.d.ts.map +1 -0
- package/dist/viewer/server-writeback.test.d.ts +2 -0
- package/dist/viewer/server-writeback.test.d.ts.map +1 -0
- package/dist/viewer/ui-handler-helpers.d.ts +19 -0
- package/dist/viewer/ui-handler-helpers.d.ts.map +1 -0
- package/dist/viewer/ui-handler-helpers.test.d.ts +2 -0
- package/dist/viewer/ui-handler-helpers.test.d.ts.map +1 -0
- package/dist/viewer/viewer-header.d.ts +67 -0
- package/dist/viewer/viewer-header.d.ts.map +1 -0
- package/dist/virtual/page-position-cache.d.ts +24 -0
- package/dist/virtual/page-position-cache.d.ts.map +1 -0
- package/dist/virtual/render-pool.d.ts +23 -0
- package/dist/virtual/render-pool.d.ts.map +1 -0
- package/dist/virtual/render-pool.test.d.ts +2 -0
- package/dist/virtual/render-pool.test.d.ts.map +1 -0
- package/dist/virtual/types.d.ts +16 -0
- package/dist/virtual/types.d.ts.map +1 -0
- package/dist/virtual/virtual-page-manager.d.ts +54 -0
- package/dist/virtual/virtual-page-manager.d.ts.map +1 -0
- package/dist/watermark/watermark-layer.d.ts +58 -0
- package/dist/watermark/watermark-layer.d.ts.map +1 -0
- package/dist/watermark/watermark-settings.d.ts +79 -0
- package/dist/watermark/watermark-settings.d.ts.map +1 -0
- package/dist/watermark/watermark-ui-helpers.d.ts +78 -0
- package/dist/watermark/watermark-ui-helpers.d.ts.map +1 -0
- package/package.json +29 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AnnotationStyle, AnnotationType } from '@jacktea/pdf-viewer-core';
|
|
2
|
+
import { AnnotationSettings } from '../../annotations/settings';
|
|
3
|
+
/**
|
|
4
|
+
* Get annotation style from settings
|
|
5
|
+
* @param type - Annotation type
|
|
6
|
+
* @param settings - Current annotation settings
|
|
7
|
+
* @returns Annotation style
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAnnotationStyle(type: AnnotationType, settings: AnnotationSettings): AnnotationStyle;
|
|
10
|
+
/**
|
|
11
|
+
* Extract color value from annotation style
|
|
12
|
+
* @param style - Annotation style
|
|
13
|
+
* @param fallback - Fallback color
|
|
14
|
+
* @returns Color value
|
|
15
|
+
*/
|
|
16
|
+
export declare function extractColor(style: AnnotationStyle, fallback: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Check if annotation has fill color
|
|
19
|
+
* @param style - Annotation style
|
|
20
|
+
* @returns Whether style has fill color
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasFillColor(style: AnnotationStyle): boolean;
|
|
23
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/domains/annotation/styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,kBAAkB,GAC3B,eAAe,CAyDjB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAE5D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Annotation, AnnotationStyle } from '@jacktea/pdf-viewer-core';
|
|
2
|
+
import { AnnotationTool } from '../../annotations/types';
|
|
3
|
+
import { AnnotationSettings } from '../../annotations/settings';
|
|
4
|
+
/**
|
|
5
|
+
* Result of settings synchronization with annotation
|
|
6
|
+
*/
|
|
7
|
+
export interface SyncedSettings {
|
|
8
|
+
settings: AnnotationSettings;
|
|
9
|
+
tool: AnnotationTool;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Apply settings to selected annotation
|
|
13
|
+
* @param settings - Annotation settings to apply
|
|
14
|
+
* @param annotation - Target annotation
|
|
15
|
+
* @returns Updated annotation style and metadata
|
|
16
|
+
*/
|
|
17
|
+
export declare function applySettingsToAnnotation(settings: AnnotationSettings, annotation: Annotation): {
|
|
18
|
+
style: AnnotationStyle;
|
|
19
|
+
metadata: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Check if two annotation states are effectively equal (ignoring timestamps)
|
|
23
|
+
*/
|
|
24
|
+
export declare function areAnnotationsEqual(a: Annotation, b: Annotation): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Sync annotation settings with selected annotation
|
|
27
|
+
* @param currentSettings - Current annotation settings
|
|
28
|
+
* @param annotation - Selected annotation
|
|
29
|
+
* @returns Synced settings and tool
|
|
30
|
+
*/
|
|
31
|
+
export declare function syncSettingsWithAnnotation(currentSettings: AnnotationSettings, annotation: Annotation): SyncedSettings;
|
|
32
|
+
/**
|
|
33
|
+
* Update settings when annotation tool changes
|
|
34
|
+
* @param currentSettings - Current annotation settings
|
|
35
|
+
* @param newTool - New annotation tool
|
|
36
|
+
* @returns Updated annotation settings
|
|
37
|
+
*/
|
|
38
|
+
export declare function updateSettingsForTool(currentSettings: AnnotationSettings, newTool: AnnotationTool): AnnotationSettings;
|
|
39
|
+
/**
|
|
40
|
+
* Calculate navigation state for annotation panel
|
|
41
|
+
* @param annotation - Current annotation
|
|
42
|
+
* @param allAnnotations - All annotations (sorted)
|
|
43
|
+
* @returns Navigation state
|
|
44
|
+
*/
|
|
45
|
+
export interface NavigationState {
|
|
46
|
+
isFirst: boolean;
|
|
47
|
+
isLast: boolean;
|
|
48
|
+
totalCount: number;
|
|
49
|
+
}
|
|
50
|
+
export declare function calculateNavigationState(annotation: Annotation | null, allAnnotations: Annotation[]): NavigationState;
|
|
51
|
+
/**
|
|
52
|
+
* Get neighboring annotations for navigation
|
|
53
|
+
* @param currentAnnotation - Current annotation
|
|
54
|
+
* @param allAnnotations - All annotations (sorted)
|
|
55
|
+
* @returns Previous and next annotations
|
|
56
|
+
*/
|
|
57
|
+
export interface NeighboringAnnotations {
|
|
58
|
+
previous: Annotation | null;
|
|
59
|
+
next: Annotation | null;
|
|
60
|
+
}
|
|
61
|
+
export declare function getNeighboringAnnotations(currentAnnotation: Annotation | null, allAnnotations: Annotation[]): NeighboringAnnotations;
|
|
62
|
+
/**
|
|
63
|
+
* Sort annotations by page and position
|
|
64
|
+
* @param annotations - Annotations to sort
|
|
65
|
+
* @returns Sorted annotations
|
|
66
|
+
*/
|
|
67
|
+
export declare function sortAnnotations(annotations: Annotation[]): Annotation[];
|
|
68
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/domains/annotation/sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,kBAAkB,EAC5B,UAAU,EAAE,UAAU,GACrB;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAoD/D;AAGD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAoBzE;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,kBAAkB,EACnC,UAAU,EAAE,UAAU,GACrB,cAAc,CAkDhB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,kBAAkB,EACnC,OAAO,EAAE,cAAc,GACtB,kBAAkB,CAQpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,UAAU,GAAG,IAAI,EAC7B,cAAc,EAAE,UAAU,EAAE,GAC3B,eAAe,CAejB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;CACzB;AAED,wBAAgB,yBAAyB,CACvC,iBAAiB,EAAE,UAAU,GAAG,IAAI,EACpC,cAAc,EAAE,UAAU,EAAE,GAC3B,sBAAsB,CAcxB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAUvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.test.d.ts","sourceRoot":"","sources":["../../../src/domains/annotation/sync.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export Domain
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for PDF export, watermark rendering, and metadata extraction.
|
|
5
|
+
* Following domain-driven design: state is external, passed as parameters.
|
|
6
|
+
*/
|
|
7
|
+
export * from './watermark';
|
|
8
|
+
export * from './metadata';
|
|
9
|
+
export * from './pdf-export';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domains/export/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PDFDocumentProxy } from '../../pdfjs';
|
|
2
|
+
import { DocumentInfo } from '../../panels/document-properties-panel';
|
|
3
|
+
/**
|
|
4
|
+
* Extract document metadata from PDF document
|
|
5
|
+
* @param doc - PDF document proxy
|
|
6
|
+
* @param pageCount - Page count from state
|
|
7
|
+
* @param documentName - Document file name
|
|
8
|
+
* @returns Document info or null if extraction fails
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadDocumentMetadata(doc: PDFDocumentProxy, pageCount: number, documentName: string): Promise<DocumentInfo | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Create document info object with minimal data
|
|
13
|
+
* @param documentName - Document file name
|
|
14
|
+
* @param pageCount - Page count
|
|
15
|
+
* @returns Minimal document info
|
|
16
|
+
*/
|
|
17
|
+
export declare function createMinimalDocumentInfo(documentName: string, pageCount: number): DocumentInfo;
|
|
18
|
+
/**
|
|
19
|
+
* Format file size for display
|
|
20
|
+
* @param bytes - File size in bytes
|
|
21
|
+
* @returns Formatted file size string
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatFileSize(bytes: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Format page dimensions for display
|
|
26
|
+
* @param width - Page width in points
|
|
27
|
+
* @param height - Page height in points
|
|
28
|
+
* @returns Formatted dimensions string
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatPageDimensions(width: number, height: number): string;
|
|
31
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/domains/export/metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAmD9B;AAqBD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,YAAY,CASd;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.test.d.ts","sourceRoot":"","sources":["../../../src/domains/export/metadata.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { PDFDocumentProxy } from '../../pdfjs';
|
|
2
|
+
import { Watermark, TextWatermark } from '@jacktea/pdf-viewer-core';
|
|
3
|
+
export interface PdfExportConfig {
|
|
4
|
+
controller: {
|
|
5
|
+
getDocument: () => PDFDocumentProxy | undefined;
|
|
6
|
+
setEditableDocumentData: (data: Uint8Array | ArrayBuffer, options?: {
|
|
7
|
+
preserveOrder?: boolean;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
exportPdf: () => Promise<Uint8Array>;
|
|
10
|
+
};
|
|
11
|
+
watermark: Watermark | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Export result with optional watermark embedding
|
|
15
|
+
*/
|
|
16
|
+
export interface PdfExportResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
data?: Uint8Array;
|
|
19
|
+
error?: Error;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check if watermark needs fresh document copy
|
|
23
|
+
* @param watermark - Current watermark
|
|
24
|
+
* @returns Whether to reload document
|
|
25
|
+
*/
|
|
26
|
+
export declare function shouldReloadDocumentForWatermark(watermark: Watermark | null): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if text watermark needs image rendering
|
|
29
|
+
* @param watermark - Watermark to check
|
|
30
|
+
* @returns Whether to render to image
|
|
31
|
+
*/
|
|
32
|
+
export declare function needsImageRendering(watermark: TextWatermark): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Render text watermark to image if needed
|
|
35
|
+
* @param watermark - Text watermark
|
|
36
|
+
* @returns Image data or undefined
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderWatermarkImageIfNeeded(watermark: TextWatermark): Uint8Array | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Create export configuration from element state
|
|
41
|
+
* @param controller - Viewer controller
|
|
42
|
+
* @param watermark - Current watermark
|
|
43
|
+
* @returns Export configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare function createExportConfig(controller: PdfExportConfig["controller"], watermark: Watermark | null): PdfExportConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Prepare PDF data for blob download
|
|
48
|
+
* @param data - PDF bytes
|
|
49
|
+
* @returns Blob-compatible ArrayBuffer
|
|
50
|
+
*/
|
|
51
|
+
export declare function preparePdfForBlob(data: Uint8Array): ArrayBuffer;
|
|
52
|
+
/**
|
|
53
|
+
* Create download filename
|
|
54
|
+
* @param baseName - Base filename (without extension)
|
|
55
|
+
* @returns Download filename
|
|
56
|
+
*/
|
|
57
|
+
export declare function createDownloadFilename(baseName?: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Trigger browser download for PDF data
|
|
60
|
+
* @param data - PDF bytes
|
|
61
|
+
* @param filename - Download filename
|
|
62
|
+
*/
|
|
63
|
+
export declare function triggerPdfDownload(data: Uint8Array, filename?: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Handle export error
|
|
66
|
+
* @param error - Error object
|
|
67
|
+
* @param dispatchEvent - Event dispatcher function
|
|
68
|
+
*/
|
|
69
|
+
export declare function handleExportError(error: unknown, dispatchEvent: (event: Event) => void): void;
|
|
70
|
+
//# sourceMappingURL=pdf-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-export.d.ts","sourceRoot":"","sources":["../../../src/domains/export/pdf-export.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzE,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE;QACV,WAAW,EAAE,MAAM,gBAAgB,GAAG,SAAS,CAAC;QAChD,uBAAuB,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,EAAE,OAAO,CAAC,EAAE;YAAE,aAAa,CAAC,EAAE,OAAO,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAClH,SAAS,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;KACtC,CAAC;IACF,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAErF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAErE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,aAAa,GACvB,UAAU,GAAG,SAAS,CAKxB;AAID;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,EACzC,SAAS,EAAE,SAAS,GAAG,IAAI,GAC1B,eAAe,CAKjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,CAM/D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,GAAE,MAAiB,GAAG,MAAM,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,GAAE,MAAqB,GAAG,IAAI,CAQ1F;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GACpC,IAAI,CAMN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-export.test.d.ts","sourceRoot":"","sources":["../../../src/domains/export/pdf-export.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TextWatermark } from '@jacktea/pdf-viewer-core';
|
|
2
|
+
/**
|
|
3
|
+
* Render text watermark to PNG image for CJK/Unicode support
|
|
4
|
+
* Supports multi-line text with alignment
|
|
5
|
+
* @param watermark - Text watermark configuration
|
|
6
|
+
* @returns PNG image bytes
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderTextToImage(watermark: TextWatermark): Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* Calculate canvas dimensions for text watermark
|
|
11
|
+
* @param watermark - Text watermark configuration
|
|
12
|
+
* @returns Canvas width and height
|
|
13
|
+
*/
|
|
14
|
+
export declare function calculateWatermarkCanvasSize(watermark: TextWatermark): {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Check if watermark has non-ASCII characters
|
|
20
|
+
* @param watermark - Text watermark configuration
|
|
21
|
+
* @returns Whether watermark contains non-ASCII characters
|
|
22
|
+
*/
|
|
23
|
+
export declare function hasNonAsciiChars(watermark: TextWatermark): boolean;
|
|
24
|
+
//# sourceMappingURL=watermark.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watermark.d.ts","sourceRoot":"","sources":["../../../src/domains/export/watermark.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,UAAU,CAwDtE;AAqED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,aAAa,GACvB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAqBnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAElE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watermark.test.d.ts","sourceRoot":"","sources":["../../../src/domains/export/watermark.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Modules
|
|
3
|
+
*
|
|
4
|
+
* Pure functions organized by domain following domain-driven design.
|
|
5
|
+
* All state is external - functions receive state as parameters.
|
|
6
|
+
*
|
|
7
|
+
* This architecture provides:
|
|
8
|
+
* - Clear separation of concerns by domain
|
|
9
|
+
* - Pure functions for core logic
|
|
10
|
+
* - Excellent testability (no hidden state)
|
|
11
|
+
* - Easy composition and reusability
|
|
12
|
+
* - Simple extensibility (add new domains as needed)
|
|
13
|
+
*/
|
|
14
|
+
export * from './viewer';
|
|
15
|
+
export * from './annotation';
|
|
16
|
+
export * from './export';
|
|
17
|
+
export * from './ui';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domains/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,cAAc,UAAU,CAAC;AAGzB,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Modal } from '../../viewer/modal';
|
|
2
|
+
import { DocumentSource, PdfPasswordRequestReason } from '@jacktea/pdf-viewer-core';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for remote file dialog
|
|
5
|
+
*/
|
|
6
|
+
export interface RemoteFileDialogConfig {
|
|
7
|
+
ModalClass: typeof Modal;
|
|
8
|
+
shadowRoot: ShadowRoot;
|
|
9
|
+
onLoadDocument: (source: DocumentSource | string) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PdfPasswordDialogConfig {
|
|
12
|
+
ModalClass: typeof Modal;
|
|
13
|
+
shadowRoot: ShadowRoot;
|
|
14
|
+
reason: PdfPasswordRequestReason;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create and open remote file dialog
|
|
18
|
+
* @param config - Dialog configuration
|
|
19
|
+
* @returns Modal instance with close method
|
|
20
|
+
*/
|
|
21
|
+
export declare function openRemoteFileDialog(config: RemoteFileDialogConfig): {
|
|
22
|
+
close: () => void;
|
|
23
|
+
};
|
|
24
|
+
export declare function openPdfPasswordDialog(config: PdfPasswordDialogConfig): Promise<string | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Create modal button element
|
|
27
|
+
* @param text - Button text
|
|
28
|
+
* @param primary - Whether button is primary style
|
|
29
|
+
* @returns Button element
|
|
30
|
+
*/
|
|
31
|
+
export declare function createModalButton(text: string, primary: boolean): HTMLButtonElement;
|
|
32
|
+
/**
|
|
33
|
+
* Create modal input container
|
|
34
|
+
* @param labelText - Label text
|
|
35
|
+
* @param placeholder - Input placeholder
|
|
36
|
+
* @param inputType - Input type (default: "text")
|
|
37
|
+
* @returns Container with label and input
|
|
38
|
+
*/
|
|
39
|
+
export declare function createModalInput(labelText: string, placeholder: string, inputType?: string): {
|
|
40
|
+
container: HTMLElement;
|
|
41
|
+
input: HTMLInputElement;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Setup Enter key submission for input
|
|
45
|
+
* @param input - Input element
|
|
46
|
+
* @param onSubmit - Submit callback
|
|
47
|
+
*/
|
|
48
|
+
export declare function setupEnterKeySubmission(input: HTMLInputElement, onSubmit: () => void): void;
|
|
49
|
+
//# sourceMappingURL=dialogs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../../src/domains/ui/dialogs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAGlC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,OAAO,KAAK,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,OAAO,KAAK,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,wBAAwB,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAmE1F;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsDxB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAKnF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAAe,GACzB;IAAE,SAAS,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CAoBrD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,MAAM,IAAI,GACnB,IAAI,CAMN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogs.test.d.ts","sourceRoot":"","sources":["../../../src/domains/ui/dialogs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Annotation, AnnotationStyle } from '@jacktea/pdf-viewer-core';
|
|
2
|
+
import { AnnotationSettings } from '../../annotations/settings';
|
|
3
|
+
/**
|
|
4
|
+
* Text editor configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface TextEditorConfig {
|
|
7
|
+
annotation: Annotation;
|
|
8
|
+
settings: AnnotationSettings;
|
|
9
|
+
page: HTMLElement;
|
|
10
|
+
fontSize: number;
|
|
11
|
+
fontWeight: number;
|
|
12
|
+
fontFamily?: string;
|
|
13
|
+
color: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Text editor result with element and cleanup function
|
|
17
|
+
*/
|
|
18
|
+
export interface TextEditorResult {
|
|
19
|
+
editor: HTMLElement;
|
|
20
|
+
commit: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Calculate text editor rectangle from page element
|
|
24
|
+
* @param page - Page element
|
|
25
|
+
* @param editor - Editor element
|
|
26
|
+
* @param fontSize - Font size
|
|
27
|
+
* @returns Normalized rectangle or null
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Measure text dimensions using canvas
|
|
31
|
+
* Identical logic to SVG rendering (no soft wrap, split by newline)
|
|
32
|
+
*/
|
|
33
|
+
export declare function measureTextAnnotationSize(content: string, fontSize: number, fontWeight: number, fontFamily: string): {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Calculate text editor rectangle from page element
|
|
39
|
+
* @param page - Page element
|
|
40
|
+
* @param editor - Editor element
|
|
41
|
+
* @param options - Text options for measurement
|
|
42
|
+
* @returns Normalized rectangle or null
|
|
43
|
+
*/
|
|
44
|
+
export declare function getTextEditorRect(page: HTMLElement, editor: HTMLElement, options: {
|
|
45
|
+
fontSize: number;
|
|
46
|
+
fontWeight: number;
|
|
47
|
+
fontFamily: string;
|
|
48
|
+
content: string;
|
|
49
|
+
}): {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
} | null;
|
|
55
|
+
/**
|
|
56
|
+
* Create text editor element for annotation
|
|
57
|
+
* @param config - Editor configuration
|
|
58
|
+
* @returns Editor element
|
|
59
|
+
*/
|
|
60
|
+
export declare function createTextEditor(config: TextEditorConfig): HTMLElement;
|
|
61
|
+
/**
|
|
62
|
+
* Position text editor on page
|
|
63
|
+
* @param editor - Editor element
|
|
64
|
+
* @param page - Page element
|
|
65
|
+
* @param geometry - Annotation geometry
|
|
66
|
+
* @param fontSize - Font size
|
|
67
|
+
* @returns Nothing (positions editor in-place)
|
|
68
|
+
*/
|
|
69
|
+
export declare function positionTextEditor(editor: HTMLElement, page: HTMLElement, geometry: Annotation["geometry"], fontSize: number): void;
|
|
70
|
+
/**
|
|
71
|
+
* Setup text editor event listeners
|
|
72
|
+
* @param editor - Editor element
|
|
73
|
+
* @param onCommit - Commit callback
|
|
74
|
+
* @returns Cleanup function
|
|
75
|
+
*/
|
|
76
|
+
export declare function setupTextEditorListeners(editor: HTMLElement, onCommit: () => void): () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Validate text editor content
|
|
79
|
+
* @param value - Editor value
|
|
80
|
+
* @returns Whether content is valid (non-empty)
|
|
81
|
+
*/
|
|
82
|
+
export declare function validateTextEditorContent(value: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Extract text editor styles from annotation
|
|
85
|
+
* @param annotation - Text annotation
|
|
86
|
+
* @param defaultSettings - Default annotation settings
|
|
87
|
+
* @returns Text editor styles
|
|
88
|
+
*/
|
|
89
|
+
export declare function extractTextEditorStyles(annotation: Annotation, defaultSettings: AnnotationSettings): {
|
|
90
|
+
fontSize: number;
|
|
91
|
+
fontWeight: number;
|
|
92
|
+
fontFamily: string | undefined;
|
|
93
|
+
color: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Check if geometry supports text editor
|
|
97
|
+
* @param geometry - Annotation geometry
|
|
98
|
+
* @returns Whether geometry supports text editor
|
|
99
|
+
*/
|
|
100
|
+
export declare function supportsTextEditor(geometry: Annotation["geometry"]): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Create updated annotation from editor content
|
|
103
|
+
* @param annotation - Original annotation
|
|
104
|
+
* @param editorValue - Editor content value
|
|
105
|
+
* @param editorRect - Editor rectangle (from getTextEditorRect)
|
|
106
|
+
* @param styles - Editor styles
|
|
107
|
+
* @returns Updated annotation
|
|
108
|
+
*/
|
|
109
|
+
export declare function createUpdatedAnnotationFromEditor(annotation: Annotation, editorValue: string, editorRect: {
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
width: number;
|
|
113
|
+
height: number;
|
|
114
|
+
} | null, styles: Partial<AnnotationStyle>): Annotation;
|
|
115
|
+
/**
|
|
116
|
+
* Set cursor to end of content editable element
|
|
117
|
+
* @param element - Content editable element
|
|
118
|
+
*/
|
|
119
|
+
export declare function setCursorToEnd(element: HTMLElement): void;
|
|
120
|
+
//# sourceMappingURL=editors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editors.d.ts","sourceRoot":"","sources":["../../../src/domains/ui/editors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;;GAMG;AACH;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAgBnC;AAeD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,GACA;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA8BhE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,CA2BtE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,EAChC,QAAQ,EAAE,MAAM,GACf,IAAI,CAkBN;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,IAAI,GACnB,MAAM,IAAI,CA2BZ;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,kBAAkB,GAClC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAOzF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,GAAG,OAAO,CAE5E;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAC1E,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAC/B,UAAU,CAcZ;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAkBzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domains/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ViewerState } from '@jacktea/pdf-viewer-core';
|
|
2
|
+
import { PageIndicatorElements, SyncFlags, PreviousState, ViewerContext, PageIndicatorSyncResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Sync HTML attributes with viewer state
|
|
5
|
+
* @param state - Current viewer state
|
|
6
|
+
* @param context - Viewer context (element, connection state)
|
|
7
|
+
* @param isSyncing - Current syncing flag (to prevent loops)
|
|
8
|
+
* @returns Tuple of [shouldUpdate, newSyncingFlag]
|
|
9
|
+
*/
|
|
10
|
+
export declare function syncAttributes(state: ViewerState, context: ViewerContext, isSyncing: boolean): [boolean, boolean];
|
|
11
|
+
/**
|
|
12
|
+
* Check if initial scale should be applied
|
|
13
|
+
* @param state - Current viewer state
|
|
14
|
+
* @param lastState - Previous viewer state
|
|
15
|
+
* @param hasAppliedInitialScale - Whether initial scale was already applied
|
|
16
|
+
* @returns Whether to apply initial scale now
|
|
17
|
+
*/
|
|
18
|
+
export declare function shouldApplyInitialScale(state: ViewerState, lastState: PreviousState, hasAppliedInitialScale: boolean): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check if page indicator should be visible
|
|
21
|
+
* @param state - Current viewer state
|
|
22
|
+
* @returns Whether page indicator should be visible
|
|
23
|
+
*/
|
|
24
|
+
export declare function isPageIndicatorVisible(state: ViewerState): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Sync page indicator UI with viewer state
|
|
27
|
+
* @param state - Current viewer state
|
|
28
|
+
* @param elements - Page indicator DOM elements
|
|
29
|
+
* @returns Sync result
|
|
30
|
+
*/
|
|
31
|
+
export declare function syncPageIndicator(state: ViewerState, elements: PageIndicatorElements): PageIndicatorSyncResult;
|
|
32
|
+
/**
|
|
33
|
+
* Determine if scroll should be forced for page change
|
|
34
|
+
* @param currentPage - Current page in state
|
|
35
|
+
* @param lastPage - Previous page in state
|
|
36
|
+
* @param currentFlags - Current sync flags
|
|
37
|
+
* @returns Updated sync flags
|
|
38
|
+
*/
|
|
39
|
+
export declare function determineScrollBehavior(currentPage: number, lastPage: number | undefined, currentFlags: SyncFlags): SyncFlags;
|
|
40
|
+
/**
|
|
41
|
+
* Commit page indicator input value
|
|
42
|
+
* @param input - Page indicator input element
|
|
43
|
+
* @param targetPage - Page to navigate to
|
|
44
|
+
* @returns Valid page number or null
|
|
45
|
+
*/
|
|
46
|
+
export declare function commitPageIndicator(input: HTMLInputElement, targetPage: number): number | null;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate page input value from user input
|
|
49
|
+
* @param inputValue - Raw input value string
|
|
50
|
+
* @returns Valid page number or null
|
|
51
|
+
*/
|
|
52
|
+
export declare function parsePageInput(inputValue: string): number | null;
|
|
53
|
+
/**
|
|
54
|
+
* Check if document has changed
|
|
55
|
+
* @param lastState - Previous viewer state
|
|
56
|
+
* @param currentState - Current viewer state
|
|
57
|
+
* @returns Whether document changed (pageCount or source)
|
|
58
|
+
*/
|
|
59
|
+
export declare function hasDocumentChanged(lastState: PreviousState, currentState: ViewerState): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Check if scale has changed
|
|
62
|
+
* @param lastState - Previous viewer state
|
|
63
|
+
* @param currentState - Current viewer state
|
|
64
|
+
* @returns Whether scale changed
|
|
65
|
+
*/
|
|
66
|
+
export declare function hasScaleChanged(lastState: PreviousState, currentState: ViewerState): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Check if page has changed
|
|
69
|
+
* @param lastState - Previous viewer state
|
|
70
|
+
* @param currentState - Current viewer state
|
|
71
|
+
* @returns Whether page changed
|
|
72
|
+
*/
|
|
73
|
+
export declare function hasPageChanged(lastState: PreviousState, currentState: ViewerState): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Check if should trigger page change event
|
|
76
|
+
* @param state - Current viewer state
|
|
77
|
+
* @param lastState - Previous viewer state
|
|
78
|
+
* @returns Whether to trigger page change event
|
|
79
|
+
*/
|
|
80
|
+
export declare function shouldTriggerPageChangeEvent(state: ViewerState, lastState: PreviousState): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Calculate scroll behavior for page change
|
|
83
|
+
* @param flags - Current sync flags
|
|
84
|
+
* @returns Scroll behavior and whether to ignore sync
|
|
85
|
+
*/
|
|
86
|
+
export declare function calculateScrollBehavior(flags: SyncFlags): {
|
|
87
|
+
behavior: ScrollBehavior;
|
|
88
|
+
ignoreSync: boolean;
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/domains/viewer/actions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACT,aAAa,EACb,aAAa,EACb,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,OAAO,GACjB,CAAC,OAAO,EAAE,OAAO,CAAC,CASpB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,aAAa,EACxB,sBAAsB,EAAE,OAAO,GAC9B,OAAO,CAMT;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,qBAAqB,GAC9B,uBAAuB,CAiBzB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,YAAY,EAAE,SAAS,GACtB,SAAS,CAQX;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,gBAAgB,EACvB,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAIf;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIhE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,WAAW,GACxB,OAAO,CAKT;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,WAAW,GACxB,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,WAAW,GACxB,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,aAAa,GACvB,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,GACf;IAAE,QAAQ,EAAE,cAAc,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAiBnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.test.d.ts","sourceRoot":"","sources":["../../../src/domains/viewer/actions.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer Domain
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for PDF viewer state operations.
|
|
5
|
+
* Following domain-driven design: state is external, passed as parameters.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types';
|
|
8
|
+
export * from './actions';
|
|
9
|
+
export * from './persistence';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domains/viewer/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|