kviewer 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +47 -0
  2. package/dist/module.d.mts +8 -1
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +25 -3
  5. package/dist/runtime/annotation/engine/canvas-resolution.d.ts +7 -0
  6. package/dist/runtime/annotation/engine/canvas-resolution.js +21 -0
  7. package/dist/runtime/annotation/engine/editor/editor.d.ts +5 -0
  8. package/dist/runtime/annotation/engine/editor/editor.js +14 -0
  9. package/dist/runtime/annotation/engine/editor/selector.d.ts +13 -1
  10. package/dist/runtime/annotation/engine/editor/selector.js +60 -8
  11. package/dist/runtime/annotation/engine/painter.d.ts +31 -0
  12. package/dist/runtime/annotation/engine/painter.js +88 -2
  13. package/dist/runtime/annotation/engine/store.js +3 -0
  14. package/dist/runtime/annotation/engine/tools/arrow.js +0 -1
  15. package/dist/runtime/annotation/engine/tools/circle.js +0 -2
  16. package/dist/runtime/annotation/engine/tools/free-highlight.js +0 -2
  17. package/dist/runtime/annotation/engine/tools/freehand.js +0 -2
  18. package/dist/runtime/annotation/engine/tools/rectangle.js +0 -2
  19. package/dist/runtime/annotation/engine/types.d.ts +5 -0
  20. package/dist/runtime/annotation/font-style.d.ts +15 -0
  21. package/dist/runtime/annotation/font-style.js +19 -0
  22. package/dist/runtime/annotation/parsers/extractCheckboxStyles.d.ts +8 -0
  23. package/dist/runtime/annotation/parsers/extractCheckboxStyles.js +24 -1
  24. package/dist/runtime/annotation/pdf-export/annotation-flags.d.ts +8 -0
  25. package/dist/runtime/annotation/pdf-export/annotation-flags.js +5 -0
  26. package/dist/runtime/annotation/pdf-export/export-form-fields.js +3 -1
  27. package/dist/runtime/annotation/pdf-export/export.js +13 -1
  28. package/dist/runtime/annotation/pdf-export/parse_circle.js +3 -0
  29. package/dist/runtime/annotation/pdf-export/parse_freetext.js +31 -19
  30. package/dist/runtime/annotation/pdf-export/parse_highlight.js +3 -0
  31. package/dist/runtime/annotation/pdf-export/parse_ink.js +5 -1
  32. package/dist/runtime/annotation/pdf-export/parse_line.js +5 -1
  33. package/dist/runtime/annotation/pdf-export/parse_polyline.js +5 -1
  34. package/dist/runtime/annotation/pdf-export/parse_square.js +3 -0
  35. package/dist/runtime/annotation/pdf-export/parse_stamp.js +4 -2
  36. package/dist/runtime/annotation/pdf-export/parse_strikeout.js +3 -0
  37. package/dist/runtime/annotation/pdf-export/parse_text.js +3 -0
  38. package/dist/runtime/annotation/pdf-export/parse_underline.js +3 -0
  39. package/dist/runtime/annotation/pdf-export/unicode-font.d.ts +5 -0
  40. package/dist/runtime/annotation/pdf-export/unicode-font.js +31 -0
  41. package/dist/runtime/annotation/pdf-export/winansi.d.ts +17 -0
  42. package/dist/runtime/annotation/pdf-export/winansi.js +77 -0
  43. package/dist/runtime/annotation/pdf-import/decode_circle.js +0 -1
  44. package/dist/runtime/annotation/pdf-import/decode_ink.js +0 -1
  45. package/dist/runtime/annotation/pdf-import/decode_line.js +0 -1
  46. package/dist/runtime/annotation/pdf-import/decode_square.js +0 -1
  47. package/dist/runtime/annotation/pdf-import/extract_stamp_appearance.d.ts +12 -0
  48. package/dist/runtime/annotation/pdf-import/extract_stamp_appearance.js +17 -4
  49. package/dist/runtime/annotation/pdf-import/types.d.ts +2 -0
  50. package/dist/runtime/assets/fonts/LICENSE-LiberationSans +102 -0
  51. package/dist/runtime/assets/fonts/LiberationSans-Regular.ttf +0 -0
  52. package/dist/runtime/assets/kviewer.css +1 -1
  53. package/dist/runtime/components/AnnotationToolbar.vue +6 -4
  54. package/dist/runtime/components/PdfPage.d.vue.ts +16 -0
  55. package/dist/runtime/components/PdfPage.vue +170 -9
  56. package/dist/runtime/components/PdfPage.vue.d.ts +16 -0
  57. package/dist/runtime/components/PerfHud.d.vue.ts +3 -0
  58. package/dist/runtime/components/PerfHud.vue +97 -0
  59. package/dist/runtime/components/PerfHud.vue.d.ts +3 -0
  60. package/dist/runtime/components/ToolButton.vue +4 -1
  61. package/dist/runtime/components/Viewer.d.vue.ts +37 -2
  62. package/dist/runtime/components/Viewer.vue +208 -13
  63. package/dist/runtime/components/Viewer.vue.d.ts +37 -2
  64. package/dist/runtime/components/ViewerBar.d.vue.ts +21 -1
  65. package/dist/runtime/components/ViewerBar.vue +183 -101
  66. package/dist/runtime/components/ViewerBar.vue.d.ts +21 -1
  67. package/dist/runtime/components/ViewerTabs.d.vue.ts +10 -2
  68. package/dist/runtime/components/ViewerTabs.vue +13 -2
  69. package/dist/runtime/components/ViewerTabs.vue.d.ts +10 -2
  70. package/dist/runtime/components/form-fields/FormDropdown.vue +50 -19
  71. package/dist/runtime/components/form-fields/FormSignatureField.vue +4 -2
  72. package/dist/runtime/components/form-fields/FormTextField.vue +7 -18
  73. package/dist/runtime/components/modals/FreeTextModal.vue +6 -4
  74. package/dist/runtime/components/modals/SignatureDrawModal.vue +6 -4
  75. package/dist/runtime/components/panels/PlacedFieldSidebar.vue +67 -50
  76. package/dist/runtime/components/panels/SignaturePicker.vue +6 -4
  77. package/dist/runtime/components/panels/StampPicker.vue +3 -1
  78. package/dist/runtime/components/tools/AnnotationToolButton.d.vue.ts +10 -0
  79. package/dist/runtime/components/tools/AnnotationToolButton.vue +33 -0
  80. package/dist/runtime/components/tools/AnnotationToolButton.vue.d.ts +10 -0
  81. package/dist/runtime/components/tools/MarqueeTool.vue +3 -1
  82. package/dist/runtime/components/tools/PageSettings.vue +13 -11
  83. package/dist/runtime/components/tools/SearchTool.vue +12 -10
  84. package/dist/runtime/components/tools/ToolProperties.vue +7 -5
  85. package/dist/runtime/components/tools/ToolbarMenu.d.vue.ts +9 -0
  86. package/dist/runtime/components/tools/ToolbarMenu.vue +79 -0
  87. package/dist/runtime/components/tools/ToolbarMenu.vue.d.ts +9 -0
  88. package/dist/runtime/components/tools/ZoomControls.vue +17 -9
  89. package/dist/runtime/composables/canvas-limits.d.ts +22 -0
  90. package/dist/runtime/composables/canvas-limits.js +10 -0
  91. package/dist/runtime/composables/useFormFields.d.ts +6 -0
  92. package/dist/runtime/composables/useFormFields.js +28 -0
  93. package/dist/runtime/composables/useInertiaPanzoom.d.ts +10 -0
  94. package/dist/runtime/composables/useInertiaPanzoom.js +57 -10
  95. package/dist/runtime/composables/useKviewerI18n.d.ts +18 -0
  96. package/dist/runtime/composables/useKviewerI18n.js +29 -0
  97. package/dist/runtime/composables/usePageVirtualization.d.ts +11 -0
  98. package/dist/runtime/composables/usePageVirtualization.js +40 -0
  99. package/dist/runtime/composables/useScriptingManager.d.ts +8 -4
  100. package/dist/runtime/composables/useScriptingManager.js +2 -0
  101. package/dist/runtime/composables/useViewerState.d.ts +4 -0
  102. package/dist/runtime/composables/useViewerState.js +8 -0
  103. package/dist/runtime/embed/bridge-client.d.ts +9 -1
  104. package/dist/runtime/embed/bridge-client.js +13 -0
  105. package/dist/runtime/embed/bridge-host.d.ts +3 -0
  106. package/dist/runtime/embed/bridge-host.js +30 -8
  107. package/dist/runtime/embed/protocol.d.ts +21 -0
  108. package/dist/runtime/i18n/messages.d.ts +252 -0
  109. package/dist/runtime/i18n/messages.js +249 -0
  110. package/dist/runtime/public-types.d.ts +2 -0
  111. package/dist/runtime/toolbar-tools.d.ts +54 -0
  112. package/dist/runtime/toolbar-tools.js +79 -0
  113. package/dist/types.d.mts +1 -1
  114. package/package.json +14 -31
@@ -0,0 +1,17 @@
1
+ /**
2
+ * WinAnsiEncoding (≈ Windows-1252) helpers.
3
+ *
4
+ * PDF standard fonts (Helvetica & friends) declared with WinAnsiEncoding
5
+ * can only show characters from CP1252. Appearance-stream text must be
6
+ * written as CP1252 BYTES — encoding it as UTF-8 (TextEncoder) turns
7
+ * "ü" into "ü" in every viewer. Text outside CP1252 (€-adjacent
8
+ * symbols already in, but ą, ł, 日 … not) needs an embedded Unicode font.
9
+ */
10
+ /** True when every character of `text` exists in WinAnsi/CP1252. */
11
+ export declare function isWinAnsiEncodable(text: string): boolean;
12
+ /**
13
+ * Encode a string as CP1252 bytes for a PDF content stream.
14
+ * Unencodable characters are replaced with '?' — callers should check
15
+ * isWinAnsiEncodable() first and use an embedded font instead.
16
+ */
17
+ export declare function encodeWinAnsi(text: string): Uint8Array;
@@ -0,0 +1,77 @@
1
+ const CP1252_SPECIALS = /* @__PURE__ */ new Map([
2
+ [8364, 128],
3
+ // €
4
+ [8218, 130],
5
+ // ‚
6
+ [402, 131],
7
+ // ƒ
8
+ [8222, 132],
9
+ // „
10
+ [8230, 133],
11
+ // …
12
+ [8224, 134],
13
+ // †
14
+ [8225, 135],
15
+ // ‡
16
+ [710, 136],
17
+ // ˆ
18
+ [8240, 137],
19
+ // ‰
20
+ [352, 138],
21
+ // Š
22
+ [8249, 139],
23
+ // ‹
24
+ [338, 140],
25
+ // Œ
26
+ [381, 142],
27
+ // Ž
28
+ [8216, 145],
29
+ // '
30
+ [8217, 146],
31
+ // '
32
+ [8220, 147],
33
+ // "
34
+ [8221, 148],
35
+ // "
36
+ [8226, 149],
37
+ // •
38
+ [8211, 150],
39
+ // –
40
+ [8212, 151],
41
+ // —
42
+ [732, 152],
43
+ // ˜
44
+ [8482, 153],
45
+ // ™
46
+ [353, 154],
47
+ // š
48
+ [8250, 155],
49
+ // ›
50
+ [339, 156],
51
+ // œ
52
+ [382, 158],
53
+ // ž
54
+ [376, 159]
55
+ // Ÿ
56
+ ]);
57
+ function winAnsiByte(codePoint) {
58
+ if (codePoint <= 127) return codePoint;
59
+ if (codePoint >= 160 && codePoint <= 255) return codePoint;
60
+ return CP1252_SPECIALS.get(codePoint) ?? null;
61
+ }
62
+ export function isWinAnsiEncodable(text) {
63
+ for (const char of text) {
64
+ if (winAnsiByte(char.codePointAt(0)) === null) return false;
65
+ }
66
+ return true;
67
+ }
68
+ export function encodeWinAnsi(text) {
69
+ const bytes = [];
70
+ for (const char of text) {
71
+ bytes.push(
72
+ winAnsiByte(char.codePointAt(0)) ?? 63
73
+ /* ? */
74
+ );
75
+ }
76
+ return new Uint8Array(bytes);
77
+ }
@@ -18,7 +18,6 @@ export function decodeCircleAnnotation(annotation, context) {
18
18
  y: rect.y + rect.height / 2,
19
19
  radiusX: rect.width / 2,
20
20
  radiusY: rect.height / 2,
21
- strokeScaleEnabled: false,
22
21
  strokeWidth,
23
22
  stroke: color
24
23
  }));
@@ -20,7 +20,6 @@ export function decodeInkAnnotation(annotation, context) {
20
20
  if (points.length < 4) continue;
21
21
  group.add(new Konva.Line({
22
22
  points,
23
- strokeScaleEnabled: false,
24
23
  stroke: color,
25
24
  strokeWidth,
26
25
  opacity,
@@ -21,7 +21,6 @@ export function decodeLineAnnotation(annotation, context) {
21
21
  const group = createGhostGroup(annotation.id);
22
22
  group.add(new Konva.Arrow({
23
23
  points,
24
- strokeScaleEnabled: false,
25
24
  stroke: color,
26
25
  fill: color,
27
26
  strokeWidth,
@@ -19,7 +19,6 @@ export function decodeSquareAnnotation(annotation, context) {
19
19
  y: rect.y,
20
20
  width: rect.width,
21
21
  height: rect.height,
22
- strokeScaleEnabled: false,
23
22
  stroke: color,
24
23
  strokeWidth,
25
24
  fill: isFilled ? color : void 0,
@@ -4,6 +4,9 @@ import { type RawPdfAnnotation, type StampAppearance } from './types.js';
4
4
  export interface StampExtractionOptions {
5
5
  scale?: number;
6
6
  diffThreshold?: number;
7
+ /** Skip annotations whose appearance changes no pixels instead of
8
+ * falling back to the raw crop (which would capture page content). */
9
+ skipEmptyDiff?: boolean;
7
10
  }
8
11
  export interface PixelBounds {
9
12
  x: number;
@@ -22,3 +25,12 @@ export declare function applyMaskOrFallback(annotated: Uint8ClampedArray, mask:
22
25
  usedMask: boolean;
23
26
  };
24
27
  export declare function extractStampAppearancesForPage(page: PDFPageProxy, pageTransform: PageTransform, annotations: RawPdfAnnotation[], options?: StampExtractionOptions): Promise<Map<string, StampAppearance>>;
28
+ /**
29
+ * Extract the rendered appearance of signature widgets on a page. The
30
+ * page canvas renders with annotations disabled, so a signature stamp
31
+ * already present in the source PDF is invisible behind the interactive
32
+ * form layer without this. Widgets whose appearance draws nothing (e.g.
33
+ * unsigned fields with an empty `/AP`) are skipped — callers decide
34
+ * which fields are actually signed via the AcroForm `/V` side-channel.
35
+ */
36
+ export declare function extractSignedSignatureAppearancesForPage(page: PDFPageProxy, pageTransform: PageTransform, annotations: RawPdfAnnotation[], options?: StampExtractionOptions): Promise<Map<string, StampAppearance>>;
@@ -95,11 +95,23 @@ async function renderPageToCanvas(page, canvas, annotationMode, scale) {
95
95
  await task.promise;
96
96
  }
97
97
  export async function extractStampAppearancesForPage(page, pageTransform, annotations, options = {}) {
98
- const appearances = /* @__PURE__ */ new Map();
99
98
  const stampAnnotations = annotations.filter(
100
99
  (annotation) => annotation.annotationType === PdfjsAnnotationType.STAMP && typeof annotation.id === "string"
101
100
  );
102
- if (stampAnnotations.length === 0) return appearances;
101
+ return extractAppearancesForAnnotations(page, pageTransform, stampAnnotations, options);
102
+ }
103
+ export async function extractSignedSignatureAppearancesForPage(page, pageTransform, annotations, options = {}) {
104
+ const signedWidgets = annotations.filter(
105
+ (annotation) => annotation.annotationType === PdfjsAnnotationType.WIDGET && typeof annotation.id === "string" && annotation.fieldType === "Sig"
106
+ );
107
+ return extractAppearancesForAnnotations(page, pageTransform, signedWidgets, {
108
+ ...options,
109
+ skipEmptyDiff: true
110
+ });
111
+ }
112
+ async function extractAppearancesForAnnotations(page, pageTransform, targetAnnotations, options = {}) {
113
+ const appearances = /* @__PURE__ */ new Map();
114
+ if (targetAnnotations.length === 0) return appearances;
103
115
  const scale = options.scale ?? DEFAULT_RENDER_SCALE;
104
116
  const diffThreshold = options.diffThreshold ?? DEFAULT_DIFF_THRESHOLD;
105
117
  const viewport = page.getViewport({ scale });
@@ -118,7 +130,7 @@ export async function extractStampAppearancesForPage(page, pageTransform, annota
118
130
  const baseContext = baseCanvas.getContext("2d", { willReadFrequently: true });
119
131
  const annotatedContext = annotatedCanvas.getContext("2d", { willReadFrequently: true });
120
132
  if (!baseContext || !annotatedContext) return appearances;
121
- for (const annotation of stampAnnotations) {
133
+ for (const annotation of targetAnnotations) {
122
134
  try {
123
135
  const id = annotation.id;
124
136
  const bounds = stampRectToPixelBounds(
@@ -138,7 +150,8 @@ export async function extractStampAppearancesForPage(page, pageTransform, annota
138
150
  bounds.height,
139
151
  diffThreshold
140
152
  );
141
- const { data: maskedData } = applyMaskOrFallback(annotatedData.data, mask);
153
+ const { data: maskedData, usedMask } = applyMaskOrFallback(annotatedData.data, mask);
154
+ if (!usedMask && options.skipEmptyDiff) continue;
142
155
  const outputCanvas = createCanvas(bounds.width, bounds.height);
143
156
  if (!outputCanvas) continue;
144
157
  const outputContext = outputCanvas.getContext("2d");
@@ -29,6 +29,8 @@ export interface RawPdfAnnotation {
29
29
  modificationDate?: unknown;
30
30
  inReplyTo?: unknown;
31
31
  quadPoints?: unknown;
32
+ fieldType?: unknown;
33
+ fieldValue?: unknown;
32
34
  defaultAppearanceData?: unknown;
33
35
  inkLists?: unknown;
34
36
  lineCoordinates?: unknown;
@@ -0,0 +1,102 @@
1
+ Digitized data copyright (c) 2010 Google Corporation
2
+ with Reserved Font Arimo, Tinos and Cousine.
3
+ Copyright (c) 2012 Red Hat, Inc.
4
+ with Reserved Font Name Liberation.
5
+
6
+ This Font Software is licensed under the SIL Open Font License,
7
+ Version 1.1.
8
+
9
+ This license is copied below, and is also available with a FAQ at:
10
+ http://scripts.sil.org/OFL
11
+
12
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
13
+
14
+ PREAMBLE The goals of the Open Font License (OFL) are to stimulate
15
+ worldwide development of collaborative font projects, to support the font
16
+ creation efforts of academic and linguistic communities, and to provide
17
+ a free and open framework in which fonts may be shared and improved in
18
+ partnership with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves.
22
+ The fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply to
27
+ any document created using the fonts or their derivatives.
28
+
29
+
30
+
31
+ DEFINITIONS
32
+ "Font Software" refers to the set of files released by the Copyright
33
+ Holder(s) under this license and clearly marked as such.
34
+ This may include source files, build scripts and documentation.
35
+
36
+ "Reserved Font Name" refers to any names specified as such after the
37
+ copyright statement(s).
38
+
39
+ "Original Version" refers to the collection of Font Software components
40
+ as distributed by the Copyright Holder(s).
41
+
42
+ "Modified Version" refers to any derivative made by adding to, deleting,
43
+ or substituting ? in part or in whole ?
44
+ any of the components of the Original Version, by changing formats or
45
+ by porting the Font Software to a new environment.
46
+
47
+ "Author" refers to any designer, engineer, programmer, technical writer
48
+ or other person who contributed to the Font Software.
49
+
50
+
51
+ PERMISSION & CONDITIONS
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining a
54
+ copy of the Font Software, to use, study, copy, merge, embed, modify,
55
+ redistribute, and sell modified and unmodified copies of the Font
56
+ Software, subject to the following conditions:
57
+
58
+ 1) Neither the Font Software nor any of its individual components,in
59
+ Original or Modified Versions, may be sold by itself.
60
+
61
+ 2) Original or Modified Versions of the Font Software may be bundled,
62
+ redistributed and/or sold with any software, provided that each copy
63
+ contains the above copyright notice and this license. These can be
64
+ included either as stand-alone text files, human-readable headers or
65
+ in the appropriate machine-readable metadata fields within text or
66
+ binary files as long as those fields can be easily viewed by the user.
67
+
68
+ 3) No Modified Version of the Font Software may use the Reserved Font
69
+ Name(s) unless explicit written permission is granted by the
70
+ corresponding Copyright Holder. This restriction only applies to the
71
+ primary font name as presented to the users.
72
+
73
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
74
+ Software shall not be used to promote, endorse or advertise any
75
+ Modified Version, except to acknowledge the contribution(s) of the
76
+ Copyright Holder(s) and the Author(s) or with their explicit written
77
+ permission.
78
+
79
+ 5) The Font Software, modified or unmodified, in part or in whole, must
80
+ be distributed entirely under this license, and must not be distributed
81
+ under any other license. The requirement for fonts to remain under
82
+ this license does not apply to any document created using the Font
83
+ Software.
84
+
85
+
86
+
87
+ TERMINATION
88
+ This license becomes null and void if any of the above conditions are not met.
89
+
90
+
91
+
92
+ DISCLAIMER
93
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
94
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
95
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
96
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
97
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
98
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
99
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
100
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
101
+ DEALINGS IN THE FONT SOFTWARE.
102
+
@@ -1 +1 @@
1
- .kviewer-text-layer{left:0;line-height:1;overflow:hidden;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}.kviewer-text-layer--interactive{cursor:text;-webkit-user-select:text;-moz-user-select:text;user-select:text}.KViewer_is_painting.KViewer_painting_type_12 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_12 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_13 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_13 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_5 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_5 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_6 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_6 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_7 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_7 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_8 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_8 .kviewer-annotation-layer *{cursor:crosshair!important}.KViewer_is_painting.KViewer_painting_type_4 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_4 .kviewer-annotation-layer *{cursor:text!important}.KViewer_is_painting.KViewer_painting_type_11 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_11 .kviewer-annotation-layer *{cursor:crosshair!important}.KViewer_selector_hover{cursor:pointer!important}.kviewer-form-layer{left:0;overflow:hidden;position:absolute;top:0}.kviewer-form-field{box-sizing:border-box;position:absolute}.kviewer-form-input{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 14%,transparent);border:1px solid transparent;box-sizing:border-box;color:#000;display:block;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial,sans-serif;font-weight:500;height:100%;line-height:normal;margin:0;outline:none;padding:1px 2px;resize:none;width:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;vertical-align:top}.kviewer-form-input:hover{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 22%,transparent);border-color:rgba(0,0,0,.2)}.kviewer-form-input:focus{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 28%,transparent);border-color:var(--kvw-field-color,var(--color-primary,#3b82f6));outline:2px solid var(--kvw-field-color,var(--color-primary,#3b82f6))}.kviewer-form-select{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto;cursor:pointer}.kviewer-form-listbox{overflow-y:auto;padding:0}.kviewer-form-listbox option{padding:1px 3px}.kviewer-form-editable-combo{height:100%;position:relative;width:100%}.kviewer-form-editable-combo input{height:100%;width:100%}.kviewer-form-checkbox,.kviewer-form-radio{align-items:center;background:#fff;box-sizing:border-box;cursor:pointer;display:flex;height:100%;justify-content:center;width:100%}.kviewer-form-checkbox input,.kviewer-form-radio input{accent-color:var(--kvw-field-color,var(--color-primary,#3b82f6));cursor:pointer;height:80%;margin:0;max-height:18px;max-width:18px;width:80%}.kviewer-form-checkbox--detected{background:transparent}.kviewer-form-checkbox--circle{border-radius:50%}.kviewer-form-checkbox__icon{color:#1a1a1a;height:65%;width:65%}.kviewer-form-checkbox--circle .kviewer-form-checkbox__icon{height:50%;width:50%}.kviewer-form-radio input{accent-color:var(--kvw-field-color,var(--color-primary,#3b82f6));cursor:pointer;height:80%;margin:0;max-height:18px;max-width:18px;width:80%}.kviewer-form-button{align-items:center;background:#c8c8c8;border:1px solid rgba(0,0,0,.35);box-sizing:border-box;color:#000;cursor:pointer;display:flex;font-family:inherit;font-weight:700;height:100%;justify-content:center;line-height:1;padding:0 6px;text-align:center;width:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.kviewer-form-button:hover{background:#bdbdbd}.kviewer-form-button:active{background:#b0b0b0}.kviewer-form-signature{align-items:center;background:rgba(255,255,200,.15);border:1px dashed rgba(0,0,0,.2);cursor:pointer;display:flex;height:100%;justify-content:center;width:100%}.kviewer-form-signature:hover{background:color-mix(in srgb,var(--kvw-field-color,#3b82f6) 8%,transparent);border-color:var(--kvw-field-color,var(--color-primary,#3b82f6))}.kviewer-form-signature--filled{background:transparent;border-color:transparent;border-style:solid}.kviewer-form-signature__preview{max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain}.kviewer-form-signature__placeholder{color:rgba(0,0,0,.4);font-size:10px;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}
1
+ .kviewer-text-layer{left:0;line-height:1;overflow:hidden;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}.kviewer-text-layer--interactive{cursor:text;-webkit-user-select:text;-moz-user-select:text;user-select:text}.KViewer_is_painting.KViewer_painting_type_12 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_12 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_13 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_13 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_5 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_5 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_6 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_6 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_7 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_7 .kviewer-annotation-layer *,.KViewer_is_painting.KViewer_painting_type_8 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_8 .kviewer-annotation-layer *{cursor:crosshair!important}.KViewer_is_painting.KViewer_painting_type_4 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_4 .kviewer-annotation-layer *{cursor:text!important}.KViewer_is_painting.KViewer_painting_type_11 .kviewer-annotation-layer,.KViewer_is_painting.KViewer_painting_type_11 .kviewer-annotation-layer *{cursor:crosshair!important}.KViewer_selector_hover{cursor:pointer!important}.kviewer-form-layer{left:0;overflow:hidden;position:absolute;top:0}.kviewer-form-field{box-sizing:border-box;position:absolute}.kviewer-form-input{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 14%,transparent);border:1px solid transparent;box-sizing:border-box;color:#000;display:block;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial,sans-serif;font-weight:500;height:100%;line-height:normal;margin:0;outline:none;padding:1px 2px;resize:none;width:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;vertical-align:top}.kviewer-form-input:hover{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 22%,transparent);border-color:rgba(0,0,0,.2)}.kviewer-form-input:focus{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 28%,transparent);border-color:var(--kvw-field-color,var(--color-primary,#3b82f6));outline:2px solid var(--kvw-field-color,var(--color-primary,#3b82f6))}.kviewer-form-uselect{align-items:center;background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 14%,transparent);border:1px solid transparent;border-radius:0;box-sizing:border-box;color:#000;cursor:pointer;display:flex;height:100%;line-height:1;padding:0 11px 0 2px;width:100%}.kviewer-form-uselect:hover{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 22%,transparent);border-color:rgba(0,0,0,.2)}.kviewer-form-uselect:focus-visible{background-color:color-mix(in srgb,var(--kvw-field-color,#1677ff) 28%,transparent);outline:2px solid var(--kvw-field-color,var(--color-primary,#3b82f6));outline-offset:-2px}.kviewer-form-uselect:disabled{cursor:default}.kviewer-form-listbox{overflow-y:auto;padding:0}.kviewer-form-listbox option{padding:1px 3px}.kviewer-form-editable-combo{height:100%;position:relative;width:100%}.kviewer-form-editable-combo input{height:100%;width:100%}.kviewer-form-checkbox,.kviewer-form-radio{align-items:center;background:#fff;box-sizing:border-box;cursor:pointer;display:flex;height:100%;justify-content:center;width:100%}.kviewer-form-checkbox input,.kviewer-form-radio input{accent-color:var(--kvw-field-color,var(--color-primary,#3b82f6));cursor:pointer;height:80%;margin:0;max-height:18px;max-width:18px;width:80%}.kviewer-form-checkbox--detected{background:transparent}.kviewer-form-checkbox--circle{border-radius:50%}.kviewer-form-checkbox__icon{color:#1a1a1a;height:65%;width:65%}.kviewer-form-checkbox--circle .kviewer-form-checkbox__icon{height:50%;width:50%}.kviewer-form-radio input{accent-color:var(--kvw-field-color,var(--color-primary,#3b82f6));cursor:pointer;height:80%;margin:0;max-height:18px;max-width:18px;width:80%}.kviewer-form-button{align-items:center;background:#c8c8c8;border:1px solid rgba(0,0,0,.35);box-sizing:border-box;color:#000;cursor:pointer;display:flex;font-family:inherit;font-weight:700;height:100%;justify-content:center;line-height:1;padding:0 6px;text-align:center;width:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.kviewer-form-button:hover{background:#bdbdbd}.kviewer-form-button:active{background:#b0b0b0}.kviewer-form-signature{align-items:center;background:rgba(255,255,200,.15);border:1px dashed rgba(0,0,0,.2);cursor:pointer;display:flex;height:100%;justify-content:center;width:100%}.kviewer-form-signature:hover{background:color-mix(in srgb,var(--kvw-field-color,#3b82f6) 8%,transparent);border-color:var(--kvw-field-color,var(--color-primary,#3b82f6))}.kviewer-form-signature--filled{background:transparent;border-color:transparent;border-style:solid}.kviewer-form-signature__preview{max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain}.kviewer-form-signature__placeholder{color:rgba(0,0,0,.4);font-size:10px;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}
@@ -9,7 +9,7 @@
9
9
  <UPopover v-if="hasColorEdit && !isMultiSelect">
10
10
  <button
11
11
  class="flex items-center justify-center w-7 h-7 rounded-md hover:bg-default cursor-pointer"
12
- title="Color"
12
+ :title="t('color')"
13
13
  >
14
14
  <UIcon name="i-lucide-palette" class="text-sm text-muted" />
15
15
  </button>
@@ -41,14 +41,14 @@
41
41
 
42
42
  <!-- Selection count badge for multi-select -->
43
43
  <span v-if="isMultiSelect" class="text-xs text-muted px-1.5">
44
- {{ state.selectedAnnotations.value.length }} selected
44
+ {{ t("selectedCount", { count: state.selectedAnnotations.value.length }) }}
45
45
  </span>
46
46
 
47
47
  <!-- Edit text (free text only) -->
48
48
  <button
49
49
  v-if="isFreeText"
50
50
  class="flex items-center justify-center w-7 h-7 rounded-md hover:bg-default cursor-pointer"
51
- title="Edit text"
51
+ :title="t('editText')"
52
52
  data-testid="annotation-edit-text"
53
53
  @click="onEditText"
54
54
  >
@@ -58,7 +58,7 @@
58
58
  <!-- Delete -->
59
59
  <button
60
60
  class="flex items-center justify-center w-7 h-7 rounded-md hover:bg-default cursor-pointer"
61
- title="Delete"
61
+ :title="t('delete')"
62
62
  data-testid="annotation-delete"
63
63
  @click="onDelete"
64
64
  >
@@ -71,9 +71,11 @@
71
71
  <script setup>
72
72
  import { computed } from "vue";
73
73
  import { useViewerState } from "../composables/useViewerState";
74
+ import { useKviewerI18n } from "../composables/useKviewerI18n";
74
75
  import { defaultOptions, annotationDefinitions } from "../annotation/engine/config";
75
76
  import { AnnotationType } from "../annotation/engine/types";
76
77
  const state = useViewerState();
78
+ const { t } = useKviewerI18n();
77
79
  const colors = defaultOptions.colors;
78
80
  const isMultiSelect = computed(() => state.selectedAnnotations.value.length > 1);
79
81
  const hasSelection = computed(
@@ -6,9 +6,25 @@ type __VLS_Props = {
6
6
  /** Canvas internal resolution multiplier (CSS size unchanged).
7
7
  * Used by panzoom to sharpen the PDF when visually zoomed in. */
8
8
  renderQuality?: number;
9
+ /** Visible region of this page in page-CSS coordinates (already
10
+ * includes margin), supplied by the viewer's panzoom. Drives the
11
+ * viewport-window raster at high zoom. Null = unknown/inapplicable
12
+ * (e.g. rotated pages), full-page rendering only. */
13
+ viewWindow?: {
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ } | null;
9
19
  };
10
20
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
21
  renderQuality: number;
22
+ viewWindow: {
23
+ x: number;
24
+ y: number;
25
+ width: number;
26
+ height: number;
27
+ } | null;
12
28
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
29
  declare const _default: typeof __VLS_export;
14
30
  export default _default;