kviewer 0.2.1 → 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 (107) hide show
  1. package/README.md +19 -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 +25 -2
  62. package/dist/runtime/components/Viewer.vue +173 -11
  63. package/dist/runtime/components/Viewer.vue.d.ts +25 -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/useScriptingManager.d.ts +8 -4
  98. package/dist/runtime/composables/useScriptingManager.js +2 -0
  99. package/dist/runtime/composables/useViewerState.d.ts +4 -0
  100. package/dist/runtime/composables/useViewerState.js +8 -0
  101. package/dist/runtime/i18n/messages.d.ts +252 -0
  102. package/dist/runtime/i18n/messages.js +249 -0
  103. package/dist/runtime/public-types.d.ts +2 -0
  104. package/dist/runtime/toolbar-tools.d.ts +54 -0
  105. package/dist/runtime/toolbar-tools.js +79 -0
  106. package/dist/types.d.mts +1 -1
  107. package/package.json +14 -31
@@ -41,7 +41,12 @@ export function provideViewerState() {
41
41
  function setFitMode(mode) {
42
42
  fitMode.value = mode;
43
43
  }
44
+ let _applyScaleFn = null;
44
45
  function setScale(value) {
46
+ if (_applyScaleFn) {
47
+ _applyScaleFn(value);
48
+ return;
49
+ }
45
50
  fitMode.value = "custom";
46
51
  scale.value = value;
47
52
  }
@@ -212,6 +217,9 @@ export function provideViewerState() {
212
217
  },
213
218
  setDownloadPdfFn(fn) {
214
219
  _downloadPdfFn = fn;
220
+ },
221
+ setApplyScaleFn(fn) {
222
+ _applyScaleFn = fn;
215
223
  }
216
224
  };
217
225
  }
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Built-in UI message catalog.
3
+ *
4
+ * kviewer is consumed both as a Nuxt module (wrench) and through the
5
+ * iframe embed bridge by non-Nuxt hosts (esign/React), so it cannot
6
+ * depend on a host i18n library. The catalog is intentionally tiny:
7
+ * locale comes from the Viewer `locale` prop (or the module option),
8
+ * and hosts may override individual strings via the `messages` prop.
9
+ */
10
+ export declare const messages: {
11
+ readonly en: {
12
+ readonly cancel: "Cancel";
13
+ readonly ok: "OK";
14
+ readonly save: "Save";
15
+ readonly clear: "Clear";
16
+ readonly delete: "Delete";
17
+ readonly download: "Download";
18
+ readonly search: "Search";
19
+ readonly marqueeSelect: "Marquee select";
20
+ readonly eraser: "Eraser";
21
+ readonly color: "Color";
22
+ readonly editText: "Edit text";
23
+ readonly strokeWidth: "Stroke width";
24
+ readonly decreaseStrokeWidth: "Decrease stroke width";
25
+ readonly increaseStrokeWidth: "Increase stroke width";
26
+ readonly noProperties: "No properties";
27
+ readonly detectFormFields: "Detect form fields";
28
+ readonly disableFormFieldDetection: "Disable form field detection";
29
+ readonly fitWidth: "Fit width";
30
+ readonly fitPage: "Fit page";
31
+ readonly stamp: "Stamp";
32
+ readonly signature: "Signature";
33
+ readonly searchPlaceholder: "Find in document...";
34
+ readonly previousMatch: "Previous match";
35
+ readonly nextMatch: "Next match";
36
+ readonly matchCase: "Match case";
37
+ readonly wholeWord: "Whole word";
38
+ readonly highlightAll: "Highlight all";
39
+ readonly closeSearch: "Close search";
40
+ readonly noResults: "No results";
41
+ readonly typeToSearch: "Type to search";
42
+ readonly freeText: "Free text";
43
+ readonly startTyping: "Start typing...";
44
+ readonly drawSignature: "Draw signature";
45
+ readonly noSavedSignatures: "No saved signatures";
46
+ readonly addSignature: "Add signature";
47
+ readonly selectedCount: "{count} selected";
48
+ readonly pageTransition: "Page transition";
49
+ readonly continuous: "Continuous";
50
+ readonly pageByPage: "Page by page";
51
+ readonly rotate: "Rotate";
52
+ readonly rotateClockwise: "Clockwise";
53
+ readonly rotateCounterclockwise: "Counterclockwise";
54
+ readonly layout: "Layout";
55
+ readonly singlePage: "Single page";
56
+ readonly twoPages: "Two pages";
57
+ readonly stylusMode: "Stylus mode";
58
+ readonly fullscreen: "Fullscreen";
59
+ readonly fieldProperties: "Field properties";
60
+ readonly fieldName: "Field name";
61
+ readonly fieldNameHint: "Shared names group radio buttons and bind multiple widgets to the same value.";
62
+ readonly required: "Required";
63
+ readonly readOnly: "Read-only";
64
+ readonly multiLine: "Multi-line";
65
+ readonly maxLength: "Max length";
66
+ readonly noLimit: "No limit";
67
+ readonly style: "Style";
68
+ readonly checkboxStyleHint: "Glyph drawn when checked. Saved as /MK /CA on export.";
69
+ readonly options: "Options";
70
+ readonly optionLabelPlaceholder: "Label";
71
+ readonly addOption: "Add option";
72
+ readonly comboBox: "Combo box (collapsible)";
73
+ readonly allowCustomText: "Allow custom text";
74
+ readonly multiSelect: "Multi-select";
75
+ readonly promptText: "Prompt text";
76
+ readonly clickToSign: "Click to sign";
77
+ readonly promptTextHint: "Shown on the unsigned widget. Defaults to \"{default}\".";
78
+ readonly lockFieldsAfterSigning: "Lock fields after signing";
79
+ readonly lockFieldsHint: "Once this signature is filled, listed fields become read-only inside the viewer. Not preserved on PDF export.";
80
+ readonly lockNone: "None";
81
+ readonly lockAllOther: "All other fields";
82
+ readonly lockSelectedOnly: "Selected fields only";
83
+ readonly lockAllExceptSelected: "All except selected";
84
+ readonly lockTheseFields: "Lock these fields";
85
+ readonly lockAllFieldsExcept: "Lock all fields except";
86
+ readonly noOtherNamedFields: "No other named fields in the document.";
87
+ readonly group: "Group";
88
+ readonly newGroup: "+ New group";
89
+ readonly radioGroupHint: "Radios sharing a group act as one — picking one clears the others.";
90
+ readonly optionValue: "Option value";
91
+ readonly optionValueHint: "Value stored when this option is selected. Must be unique inside the group.";
92
+ readonly typeLabel: "Type";
93
+ readonly pageLabel: "Page";
94
+ readonly deleteField: "Delete field";
95
+ readonly selectFieldHint: "Select a placed field to edit its properties.";
96
+ readonly fieldTypeText: "Text field";
97
+ readonly fieldTypeCheckbox: "Checkbox";
98
+ readonly fieldTypeRadio: "Radio button";
99
+ readonly fieldTypeSignature: "Signature field";
100
+ readonly fieldTypeDropdown: "Dropdown";
101
+ readonly fieldTypeButton: "Button";
102
+ readonly fieldTypeGeneric: "Field";
103
+ readonly fieldOnPage: "{type} on page {page}";
104
+ readonly styleCheck: "Check";
105
+ readonly styleCross: "Cross";
106
+ readonly styleDiamond: "Diamond";
107
+ readonly styleCircle: "Circle";
108
+ readonly styleStar: "Star";
109
+ readonly styleSquare: "Square";
110
+ readonly toolSelect: "Select";
111
+ readonly toolHighlight: "Highlight";
112
+ readonly toolStrikeout: "Strike out";
113
+ readonly toolUnderline: "Underline";
114
+ readonly toolRectangle: "Rectangle";
115
+ readonly toolCircle: "Ellipse";
116
+ readonly toolNote: "Note";
117
+ readonly toolArrow: "Arrow";
118
+ readonly toolCloud: "Cloud";
119
+ readonly toolFreehand: "Pen";
120
+ readonly toolFreeHighlight: "Highlighter";
121
+ readonly toolFreeText: "Text";
122
+ readonly toolSignature: "Signature";
123
+ readonly toolStamp: "Stamp";
124
+ readonly toolFormText: "Text field";
125
+ readonly toolFormCheckbox: "Checkbox";
126
+ readonly toolFormSignature: "Signature field";
127
+ readonly toolFormRadio: "Radio button";
128
+ readonly toolEraser: "Eraser";
129
+ };
130
+ readonly de: {
131
+ readonly cancel: "Abbrechen";
132
+ readonly ok: "OK";
133
+ readonly save: "Speichern";
134
+ readonly clear: "Leeren";
135
+ readonly delete: "Löschen";
136
+ readonly download: "Herunterladen";
137
+ readonly search: "Suchen";
138
+ readonly marqueeSelect: "Mehrfachauswahl";
139
+ readonly eraser: "Radierer";
140
+ readonly color: "Farbe";
141
+ readonly editText: "Text bearbeiten";
142
+ readonly strokeWidth: "Linienstärke";
143
+ readonly decreaseStrokeWidth: "Linienstärke verringern";
144
+ readonly increaseStrokeWidth: "Linienstärke erhöhen";
145
+ readonly noProperties: "Keine Eigenschaften";
146
+ readonly detectFormFields: "Formularfelder erkennen";
147
+ readonly disableFormFieldDetection: "Formularfeld-Erkennung deaktivieren";
148
+ readonly fitWidth: "Seitenbreite";
149
+ readonly fitPage: "Ganze Seite";
150
+ readonly stamp: "Stempel";
151
+ readonly signature: "Unterschrift";
152
+ readonly searchPlaceholder: "Im Dokument suchen...";
153
+ readonly previousMatch: "Vorheriger Treffer";
154
+ readonly nextMatch: "Nächster Treffer";
155
+ readonly matchCase: "Groß-/Kleinschreibung";
156
+ readonly wholeWord: "Ganzes Wort";
157
+ readonly highlightAll: "Alle hervorheben";
158
+ readonly closeSearch: "Suche schließen";
159
+ readonly noResults: "Keine Treffer";
160
+ readonly typeToSearch: "Suchbegriff eingeben";
161
+ readonly freeText: "Freitext";
162
+ readonly startTyping: "Text eingeben...";
163
+ readonly drawSignature: "Unterschrift zeichnen";
164
+ readonly noSavedSignatures: "Keine gespeicherten Unterschriften";
165
+ readonly addSignature: "Unterschrift hinzufügen";
166
+ readonly selectedCount: "{count} ausgewählt";
167
+ readonly pageTransition: "Seitenübergang";
168
+ readonly continuous: "Fortlaufend";
169
+ readonly pageByPage: "Seite für Seite";
170
+ readonly rotate: "Drehen";
171
+ readonly rotateClockwise: "Im Uhrzeigersinn";
172
+ readonly rotateCounterclockwise: "Gegen den Uhrzeigersinn";
173
+ readonly layout: "Layout";
174
+ readonly singlePage: "Einseitig";
175
+ readonly twoPages: "Zweiseitig";
176
+ readonly stylusMode: "Stiftmodus";
177
+ readonly fullscreen: "Vollbildansicht";
178
+ readonly fieldProperties: "Feldeigenschaften";
179
+ readonly fieldName: "Feldname";
180
+ readonly fieldNameHint: "Gleiche Namen gruppieren Optionsfelder und verbinden mehrere Widgets mit demselben Wert.";
181
+ readonly required: "Pflichtfeld";
182
+ readonly readOnly: "Schreibgeschützt";
183
+ readonly multiLine: "Mehrzeilig";
184
+ readonly maxLength: "Maximale Länge";
185
+ readonly noLimit: "Kein Limit";
186
+ readonly style: "Stil";
187
+ readonly checkboxStyleHint: "Symbol im angekreuzten Zustand. Wird beim Export als /MK /CA gespeichert.";
188
+ readonly options: "Optionen";
189
+ readonly optionLabelPlaceholder: "Beschriftung";
190
+ readonly addOption: "Option hinzufügen";
191
+ readonly comboBox: "Kombinationsfeld (aufklappbar)";
192
+ readonly allowCustomText: "Eigenen Text erlauben";
193
+ readonly multiSelect: "Mehrfachauswahl";
194
+ readonly promptText: "Hinweistext";
195
+ readonly clickToSign: "Zum Unterschreiben klicken";
196
+ readonly promptTextHint: "Wird auf dem nicht unterschriebenen Feld angezeigt. Standard: \"{default}\".";
197
+ readonly lockFieldsAfterSigning: "Felder nach Unterschrift sperren";
198
+ readonly lockFieldsHint: "Sobald diese Unterschrift ausgefüllt ist, werden die gewählten Felder im Viewer schreibgeschützt. Wird beim PDF-Export nicht übernommen.";
199
+ readonly lockNone: "Keine";
200
+ readonly lockAllOther: "Alle anderen Felder";
201
+ readonly lockSelectedOnly: "Nur ausgewählte Felder";
202
+ readonly lockAllExceptSelected: "Alle außer ausgewählte";
203
+ readonly lockTheseFields: "Diese Felder sperren";
204
+ readonly lockAllFieldsExcept: "Alle Felder sperren außer";
205
+ readonly noOtherNamedFields: "Keine weiteren benannten Felder im Dokument.";
206
+ readonly group: "Gruppe";
207
+ readonly newGroup: "+ Neue Gruppe";
208
+ readonly radioGroupHint: "Optionsfelder derselben Gruppe wirken als eines — die Auswahl eines Feldes hebt die anderen auf.";
209
+ readonly optionValue: "Optionswert";
210
+ readonly optionValueHint: "Wert, der bei Auswahl dieser Option gespeichert wird. Muss innerhalb der Gruppe eindeutig sein.";
211
+ readonly typeLabel: "Typ";
212
+ readonly pageLabel: "Seite";
213
+ readonly deleteField: "Feld löschen";
214
+ readonly selectFieldHint: "Wählen Sie ein platziertes Feld aus, um seine Eigenschaften zu bearbeiten.";
215
+ readonly fieldTypeText: "Textfeld";
216
+ readonly fieldTypeCheckbox: "Kontrollkästchen";
217
+ readonly fieldTypeRadio: "Optionsfeld";
218
+ readonly fieldTypeSignature: "Unterschriftsfeld";
219
+ readonly fieldTypeDropdown: "Auswahlliste";
220
+ readonly fieldTypeButton: "Schaltfläche";
221
+ readonly fieldTypeGeneric: "Feld";
222
+ readonly fieldOnPage: "{type} auf Seite {page}";
223
+ readonly styleCheck: "Haken";
224
+ readonly styleCross: "Kreuz";
225
+ readonly styleDiamond: "Raute";
226
+ readonly styleCircle: "Kreis";
227
+ readonly styleStar: "Stern";
228
+ readonly styleSquare: "Quadrat";
229
+ readonly toolSelect: "Auswählen";
230
+ readonly toolHighlight: "Hervorheben";
231
+ readonly toolStrikeout: "Durchstreichen";
232
+ readonly toolUnderline: "Unterstreichen";
233
+ readonly toolRectangle: "Rechteck";
234
+ readonly toolCircle: "Ellipse";
235
+ readonly toolNote: "Notiz";
236
+ readonly toolArrow: "Pfeil";
237
+ readonly toolCloud: "Wolke";
238
+ readonly toolFreehand: "Stift";
239
+ readonly toolFreeHighlight: "Marker";
240
+ readonly toolFreeText: "Text";
241
+ readonly toolSignature: "Unterschrift";
242
+ readonly toolStamp: "Stempel";
243
+ readonly toolFormText: "Textfeld";
244
+ readonly toolFormCheckbox: "Kontrollkästchen";
245
+ readonly toolFormSignature: "Unterschriftsfeld";
246
+ readonly toolFormRadio: "Optionsfeld";
247
+ readonly toolEraser: "Radierer";
248
+ };
249
+ };
250
+ export type KviewerLocale = keyof typeof messages;
251
+ export type MessageKey = keyof typeof messages.en;
252
+ export declare const KVIEWER_LOCALES: KviewerLocale[];
@@ -0,0 +1,249 @@
1
+ export const messages = {
2
+ en: {
3
+ // Common actions
4
+ cancel: "Cancel",
5
+ ok: "OK",
6
+ save: "Save",
7
+ clear: "Clear",
8
+ delete: "Delete",
9
+ download: "Download",
10
+ // Toolbar
11
+ search: "Search",
12
+ marqueeSelect: "Marquee select",
13
+ eraser: "Eraser",
14
+ color: "Color",
15
+ editText: "Edit text",
16
+ strokeWidth: "Stroke width",
17
+ decreaseStrokeWidth: "Decrease stroke width",
18
+ increaseStrokeWidth: "Increase stroke width",
19
+ noProperties: "No properties",
20
+ detectFormFields: "Detect form fields",
21
+ disableFormFieldDetection: "Disable form field detection",
22
+ fitWidth: "Fit width",
23
+ fitPage: "Fit page",
24
+ stamp: "Stamp",
25
+ signature: "Signature",
26
+ // Search panel
27
+ searchPlaceholder: "Find in document...",
28
+ previousMatch: "Previous match",
29
+ nextMatch: "Next match",
30
+ matchCase: "Match case",
31
+ wholeWord: "Whole word",
32
+ highlightAll: "Highlight all",
33
+ closeSearch: "Close search",
34
+ noResults: "No results",
35
+ typeToSearch: "Type to search",
36
+ // Modals
37
+ freeText: "Free text",
38
+ startTyping: "Start typing...",
39
+ drawSignature: "Draw signature",
40
+ noSavedSignatures: "No saved signatures",
41
+ addSignature: "Add signature",
42
+ selectedCount: "{count} selected",
43
+ // Page settings menu
44
+ pageTransition: "Page transition",
45
+ continuous: "Continuous",
46
+ pageByPage: "Page by page",
47
+ rotate: "Rotate",
48
+ rotateClockwise: "Clockwise",
49
+ rotateCounterclockwise: "Counterclockwise",
50
+ layout: "Layout",
51
+ singlePage: "Single page",
52
+ twoPages: "Two pages",
53
+ stylusMode: "Stylus mode",
54
+ fullscreen: "Fullscreen",
55
+ // Form-field sidebar
56
+ fieldProperties: "Field properties",
57
+ fieldName: "Field name",
58
+ fieldNameHint: "Shared names group radio buttons and bind multiple widgets to the same value.",
59
+ required: "Required",
60
+ readOnly: "Read-only",
61
+ multiLine: "Multi-line",
62
+ maxLength: "Max length",
63
+ noLimit: "No limit",
64
+ style: "Style",
65
+ checkboxStyleHint: "Glyph drawn when checked. Saved as /MK /CA on export.",
66
+ options: "Options",
67
+ optionLabelPlaceholder: "Label",
68
+ addOption: "Add option",
69
+ comboBox: "Combo box (collapsible)",
70
+ allowCustomText: "Allow custom text",
71
+ multiSelect: "Multi-select",
72
+ promptText: "Prompt text",
73
+ clickToSign: "Click to sign",
74
+ promptTextHint: 'Shown on the unsigned widget. Defaults to "{default}".',
75
+ lockFieldsAfterSigning: "Lock fields after signing",
76
+ lockFieldsHint: "Once this signature is filled, listed fields become read-only inside the viewer. Not preserved on PDF export.",
77
+ lockNone: "None",
78
+ lockAllOther: "All other fields",
79
+ lockSelectedOnly: "Selected fields only",
80
+ lockAllExceptSelected: "All except selected",
81
+ lockTheseFields: "Lock these fields",
82
+ lockAllFieldsExcept: "Lock all fields except",
83
+ noOtherNamedFields: "No other named fields in the document.",
84
+ group: "Group",
85
+ newGroup: "+ New group",
86
+ radioGroupHint: "Radios sharing a group act as one \u2014 picking one clears the others.",
87
+ optionValue: "Option value",
88
+ optionValueHint: "Value stored when this option is selected. Must be unique inside the group.",
89
+ typeLabel: "Type",
90
+ pageLabel: "Page",
91
+ deleteField: "Delete field",
92
+ selectFieldHint: "Select a placed field to edit its properties.",
93
+ fieldTypeText: "Text field",
94
+ fieldTypeCheckbox: "Checkbox",
95
+ fieldTypeRadio: "Radio button",
96
+ fieldTypeSignature: "Signature field",
97
+ fieldTypeDropdown: "Dropdown",
98
+ fieldTypeButton: "Button",
99
+ fieldTypeGeneric: "Field",
100
+ fieldOnPage: "{type} on page {page}",
101
+ // Checkbox glyph styles
102
+ styleCheck: "Check",
103
+ styleCross: "Cross",
104
+ styleDiamond: "Diamond",
105
+ styleCircle: "Circle",
106
+ styleStar: "Star",
107
+ styleSquare: "Square",
108
+ // Tool tooltips (keyed from the engine tool `name`)
109
+ toolSelect: "Select",
110
+ toolHighlight: "Highlight",
111
+ toolStrikeout: "Strike out",
112
+ toolUnderline: "Underline",
113
+ toolRectangle: "Rectangle",
114
+ toolCircle: "Ellipse",
115
+ toolNote: "Note",
116
+ toolArrow: "Arrow",
117
+ toolCloud: "Cloud",
118
+ toolFreehand: "Pen",
119
+ toolFreeHighlight: "Highlighter",
120
+ toolFreeText: "Text",
121
+ toolSignature: "Signature",
122
+ toolStamp: "Stamp",
123
+ toolFormText: "Text field",
124
+ toolFormCheckbox: "Checkbox",
125
+ toolFormSignature: "Signature field",
126
+ toolFormRadio: "Radio button",
127
+ toolEraser: "Eraser"
128
+ },
129
+ de: {
130
+ cancel: "Abbrechen",
131
+ ok: "OK",
132
+ save: "Speichern",
133
+ clear: "Leeren",
134
+ delete: "L\xF6schen",
135
+ download: "Herunterladen",
136
+ search: "Suchen",
137
+ marqueeSelect: "Mehrfachauswahl",
138
+ eraser: "Radierer",
139
+ color: "Farbe",
140
+ editText: "Text bearbeiten",
141
+ strokeWidth: "Linienst\xE4rke",
142
+ decreaseStrokeWidth: "Linienst\xE4rke verringern",
143
+ increaseStrokeWidth: "Linienst\xE4rke erh\xF6hen",
144
+ noProperties: "Keine Eigenschaften",
145
+ detectFormFields: "Formularfelder erkennen",
146
+ disableFormFieldDetection: "Formularfeld-Erkennung deaktivieren",
147
+ fitWidth: "Seitenbreite",
148
+ fitPage: "Ganze Seite",
149
+ stamp: "Stempel",
150
+ signature: "Unterschrift",
151
+ searchPlaceholder: "Im Dokument suchen...",
152
+ previousMatch: "Vorheriger Treffer",
153
+ nextMatch: "N\xE4chster Treffer",
154
+ matchCase: "Gro\xDF-/Kleinschreibung",
155
+ wholeWord: "Ganzes Wort",
156
+ highlightAll: "Alle hervorheben",
157
+ closeSearch: "Suche schlie\xDFen",
158
+ noResults: "Keine Treffer",
159
+ typeToSearch: "Suchbegriff eingeben",
160
+ freeText: "Freitext",
161
+ startTyping: "Text eingeben...",
162
+ drawSignature: "Unterschrift zeichnen",
163
+ noSavedSignatures: "Keine gespeicherten Unterschriften",
164
+ addSignature: "Unterschrift hinzuf\xFCgen",
165
+ selectedCount: "{count} ausgew\xE4hlt",
166
+ pageTransition: "Seiten\xFCbergang",
167
+ continuous: "Fortlaufend",
168
+ pageByPage: "Seite f\xFCr Seite",
169
+ rotate: "Drehen",
170
+ rotateClockwise: "Im Uhrzeigersinn",
171
+ rotateCounterclockwise: "Gegen den Uhrzeigersinn",
172
+ layout: "Layout",
173
+ singlePage: "Einseitig",
174
+ twoPages: "Zweiseitig",
175
+ stylusMode: "Stiftmodus",
176
+ fullscreen: "Vollbildansicht",
177
+ fieldProperties: "Feldeigenschaften",
178
+ fieldName: "Feldname",
179
+ fieldNameHint: "Gleiche Namen gruppieren Optionsfelder und verbinden mehrere Widgets mit demselben Wert.",
180
+ required: "Pflichtfeld",
181
+ readOnly: "Schreibgesch\xFCtzt",
182
+ multiLine: "Mehrzeilig",
183
+ maxLength: "Maximale L\xE4nge",
184
+ noLimit: "Kein Limit",
185
+ style: "Stil",
186
+ checkboxStyleHint: "Symbol im angekreuzten Zustand. Wird beim Export als /MK /CA gespeichert.",
187
+ options: "Optionen",
188
+ optionLabelPlaceholder: "Beschriftung",
189
+ addOption: "Option hinzuf\xFCgen",
190
+ comboBox: "Kombinationsfeld (aufklappbar)",
191
+ allowCustomText: "Eigenen Text erlauben",
192
+ multiSelect: "Mehrfachauswahl",
193
+ promptText: "Hinweistext",
194
+ clickToSign: "Zum Unterschreiben klicken",
195
+ promptTextHint: 'Wird auf dem nicht unterschriebenen Feld angezeigt. Standard: "{default}".',
196
+ lockFieldsAfterSigning: "Felder nach Unterschrift sperren",
197
+ lockFieldsHint: "Sobald diese Unterschrift ausgef\xFCllt ist, werden die gew\xE4hlten Felder im Viewer schreibgesch\xFCtzt. Wird beim PDF-Export nicht \xFCbernommen.",
198
+ lockNone: "Keine",
199
+ lockAllOther: "Alle anderen Felder",
200
+ lockSelectedOnly: "Nur ausgew\xE4hlte Felder",
201
+ lockAllExceptSelected: "Alle au\xDFer ausgew\xE4hlte",
202
+ lockTheseFields: "Diese Felder sperren",
203
+ lockAllFieldsExcept: "Alle Felder sperren au\xDFer",
204
+ noOtherNamedFields: "Keine weiteren benannten Felder im Dokument.",
205
+ group: "Gruppe",
206
+ newGroup: "+ Neue Gruppe",
207
+ radioGroupHint: "Optionsfelder derselben Gruppe wirken als eines \u2014 die Auswahl eines Feldes hebt die anderen auf.",
208
+ optionValue: "Optionswert",
209
+ optionValueHint: "Wert, der bei Auswahl dieser Option gespeichert wird. Muss innerhalb der Gruppe eindeutig sein.",
210
+ typeLabel: "Typ",
211
+ pageLabel: "Seite",
212
+ deleteField: "Feld l\xF6schen",
213
+ selectFieldHint: "W\xE4hlen Sie ein platziertes Feld aus, um seine Eigenschaften zu bearbeiten.",
214
+ fieldTypeText: "Textfeld",
215
+ fieldTypeCheckbox: "Kontrollk\xE4stchen",
216
+ fieldTypeRadio: "Optionsfeld",
217
+ fieldTypeSignature: "Unterschriftsfeld",
218
+ fieldTypeDropdown: "Auswahlliste",
219
+ fieldTypeButton: "Schaltfl\xE4che",
220
+ fieldTypeGeneric: "Feld",
221
+ fieldOnPage: "{type} auf Seite {page}",
222
+ styleCheck: "Haken",
223
+ styleCross: "Kreuz",
224
+ styleDiamond: "Raute",
225
+ styleCircle: "Kreis",
226
+ styleStar: "Stern",
227
+ styleSquare: "Quadrat",
228
+ toolSelect: "Ausw\xE4hlen",
229
+ toolHighlight: "Hervorheben",
230
+ toolStrikeout: "Durchstreichen",
231
+ toolUnderline: "Unterstreichen",
232
+ toolRectangle: "Rechteck",
233
+ toolCircle: "Ellipse",
234
+ toolNote: "Notiz",
235
+ toolArrow: "Pfeil",
236
+ toolCloud: "Wolke",
237
+ toolFreehand: "Stift",
238
+ toolFreeHighlight: "Marker",
239
+ toolFreeText: "Text",
240
+ toolSignature: "Unterschrift",
241
+ toolStamp: "Stempel",
242
+ toolFormText: "Textfeld",
243
+ toolFormCheckbox: "Kontrollk\xE4stchen",
244
+ toolFormSignature: "Unterschriftsfeld",
245
+ toolFormRadio: "Optionsfeld",
246
+ toolEraser: "Radierer"
247
+ }
248
+ };
249
+ export const KVIEWER_LOCALES = Object.keys(messages);
@@ -2,6 +2,7 @@ export type { ExportPdfOptions } from './annotation/pdf-export/export.js';
2
2
  export type { ViewerTabItem, AddTabOptions } from './components/ViewerTabs.vue.js';
3
3
  export type { AddFormFieldPayload, CheckboxStyle, FormFieldDefinition, FormFieldOrigin, FormFieldType, FormFieldValue, SignatureData, SignatureHandlers, } from './annotation/engine/types.js';
4
4
  export type { ViewMode } from './composables/viewMode.js';
5
+ export type { ViewerState, ActiveTool } from './composables/useViewerState.js';
5
6
  export type { KViewerApi, KViewerEmbedBridgeOptions, } from './embed/bridge-host.js';
6
7
  export { useKViewerEmbedBridge } from './embed/bridge-host.js';
7
8
  export type { KViewerEmbedClientOptions } from './embed/bridge-client.js';
@@ -9,3 +10,4 @@ export { KViewerEmbedClient } from './embed/bridge-client.js';
9
10
  export type { EventName as KViewerEmbedEventName, EventPayloads as KViewerEmbedEventPayloads, MethodName as KViewerEmbedMethodName, } from './embed/protocol.js';
10
11
  export { KVIEWER_EMBED_PROTOCOL_VERSION } from './embed/protocol.js';
11
12
  export type { ViewerMenuItem, ViewerMenuButtonItem, ViewerMenuCheckboxItem, ViewerMenuSeparatorItem, } from './menu-items.js';
13
+ export type { ViewerToolId, ViewerTopToolId, ViewerBottomToolId, ViewerLayoutToolId, ViewerToolEntry, ViewerToolSlot, } from './toolbar-tools.js';
@@ -0,0 +1,54 @@
1
+ import type { InjectionKey, Ref } from 'vue';
2
+ import { AnnotationType } from './annotation/engine/types.js';
3
+ /** Built-in tools that live in the top navigation row. Each maps to a
4
+ * whole self-contained sub-component. `hand` / `marquee` are readonly-gated. */
5
+ export type ViewerTopToolId = 'menu' | 'pageSettings' | 'zoom' | 'hand' | 'marquee' | 'pageInfo' | 'search';
6
+ /** Built-in tools that live in the second (annotation) row, controlled
7
+ * per individual button. IDs match the annotation `name` in
8
+ * `annotation/engine/config.ts` (so `freeHighlight` never collides with
9
+ * the text-selection `highlight`). The `select`/`highlight`/`strikeout`/
10
+ * `underline`/`circle`/`note`/`arrow`/`cloud` entries have no button in
11
+ * the default toolbar — they are opt-in extras a host may add. */
12
+ export type ViewerBottomToolId = 'properties' | 'freehand' | 'freeHighlight' | 'freeText' | 'stamp' | 'signature' | 'rectangle' | 'formText' | 'formCheckbox' | 'formRadio' | 'formSignature' | 'undo' | 'redo' | 'eraser' | 'select' | 'highlight' | 'strikeout' | 'underline' | 'circle' | 'note' | 'arrow' | 'cloud';
13
+ /** Layout primitives usable in either row. `separator` draws a vertical
14
+ * divider; `spacer` pushes everything after it to the right (flex
15
+ * `ml-auto`) — this is how you reproduce today's right-aligned group. */
16
+ export type ViewerLayoutToolId = 'separator' | 'spacer';
17
+ export type ViewerToolId = ViewerTopToolId | ViewerBottomToolId | ViewerLayoutToolId;
18
+ /** A custom toolbar button, rendered from the host-supplied `#tool-<name>`
19
+ * slot at this position. Mirrors the `menuItems` discriminated-union
20
+ * pattern. See {@link ViewerToolEntry}. */
21
+ export interface ViewerToolSlot {
22
+ type: 'slot';
23
+ /** Stable key for v-for; also the slot name unless `name` is set. */
24
+ key: string;
25
+ /** Slot-name suffix — the host fills `#tool-<name>`. Defaults to `key`. */
26
+ name?: string;
27
+ /** Which row to place this custom button in. When omitted it inherits
28
+ * the row of the preceding entry (top until the first bottom tool). */
29
+ row?: 'top' | 'bottom';
30
+ }
31
+ /** One entry in the `tools` prop: either a built-in tool ID (a plain
32
+ * string — controls presence + order) or a {@link ViewerToolSlot} object
33
+ * that injects a custom button via a named slot. */
34
+ export type ViewerToolEntry = ViewerToolId | ViewerToolSlot;
35
+ /** Top-row built-in IDs. */
36
+ export declare const TOP_TOOL_IDS: ReadonlySet<string>;
37
+ /** Top-row tools hidden whenever `readonly` is true. */
38
+ export declare const READONLY_HIDDEN_TOP: ReadonlySet<string>;
39
+ /** Form-mode bottom-row tools — render only when `formEditMode` is on. */
40
+ export declare const FORM_TOOLS: ReadonlySet<string>;
41
+ /** Draw/annotate-mode bottom-row tools — render only when `formEditMode`
42
+ * is off (matches today's center swap). */
43
+ export declare const DRAW_TOOLS: ReadonlySet<string>;
44
+ /** Bottom-row built-in IDs (everything that is not top-row or layout). */
45
+ export declare const BOTTOM_TOOL_IDS: ReadonlySet<string>;
46
+ /** Maps an annotation-button ID to the {@link AnnotationType} it selects.
47
+ * `stamp`/`signature` are pickers and `undo`/`redo`/`properties` are not
48
+ * annotation tools, so they are intentionally absent. `eraser` is handled
49
+ * separately (it is not an annotation type). */
50
+ export declare const ANNOTATION_TOOL_TYPES: Partial<Record<string, AnnotationType>>;
51
+ /** Injection key for the toolbar `styleVersion` ref. `ViewerBar` provides
52
+ * it (bumped when `ToolProperties` edits a tool's style) so standalone
53
+ * `AnnotationToolButton`s refresh their color indicator. */
54
+ export declare const STYLE_VERSION_KEY: InjectionKey<Ref<number>>;
@@ -0,0 +1,79 @@
1
+ import { AnnotationType } from "./annotation/engine/types.js";
2
+ export const TOP_TOOL_IDS = /* @__PURE__ */ new Set([
3
+ "menu",
4
+ "pageSettings",
5
+ "zoom",
6
+ "hand",
7
+ "marquee",
8
+ "pageInfo",
9
+ "search"
10
+ ]);
11
+ export const READONLY_HIDDEN_TOP = /* @__PURE__ */ new Set([
12
+ "hand",
13
+ "marquee"
14
+ ]);
15
+ export const FORM_TOOLS = /* @__PURE__ */ new Set([
16
+ "formText",
17
+ "formCheckbox",
18
+ "formRadio",
19
+ "formSignature"
20
+ ]);
21
+ export const DRAW_TOOLS = /* @__PURE__ */ new Set([
22
+ "freehand",
23
+ "freeHighlight",
24
+ "freeText",
25
+ "stamp",
26
+ "signature",
27
+ "rectangle",
28
+ "select",
29
+ "highlight",
30
+ "strikeout",
31
+ "underline",
32
+ "circle",
33
+ "note",
34
+ "arrow",
35
+ "cloud"
36
+ ]);
37
+ export const BOTTOM_TOOL_IDS = /* @__PURE__ */ new Set([
38
+ "properties",
39
+ "freehand",
40
+ "freeHighlight",
41
+ "freeText",
42
+ "stamp",
43
+ "signature",
44
+ "rectangle",
45
+ "formText",
46
+ "formCheckbox",
47
+ "formRadio",
48
+ "formSignature",
49
+ "undo",
50
+ "redo",
51
+ "eraser",
52
+ "select",
53
+ "highlight",
54
+ "strikeout",
55
+ "underline",
56
+ "circle",
57
+ "note",
58
+ "arrow",
59
+ "cloud"
60
+ ]);
61
+ export const ANNOTATION_TOOL_TYPES = {
62
+ freehand: AnnotationType.FREEHAND,
63
+ freeHighlight: AnnotationType.FREE_HIGHLIGHT,
64
+ freeText: AnnotationType.FREETEXT,
65
+ rectangle: AnnotationType.RECTANGLE,
66
+ formText: AnnotationType.FORM_TEXT,
67
+ formCheckbox: AnnotationType.FORM_CHECKBOX,
68
+ formRadio: AnnotationType.FORM_RADIO,
69
+ formSignature: AnnotationType.FORM_SIGNATURE,
70
+ select: AnnotationType.SELECT,
71
+ highlight: AnnotationType.HIGHLIGHT,
72
+ strikeout: AnnotationType.STRIKEOUT,
73
+ underline: AnnotationType.UNDERLINE,
74
+ circle: AnnotationType.CIRCLE,
75
+ note: AnnotationType.NOTE,
76
+ arrow: AnnotationType.ARROW,
77
+ cloud: AnnotationType.CLOUD
78
+ };
79
+ export const STYLE_VERSION_KEY = Symbol("kviewer-style-version");