@vue-pdf-viewer/annotation 0.0.0-experimental.7 → 0.0.0-experimental.9
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/dist/index.js +187 -180
- package/dist/index.umd.cjs +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-
|
|
2
|
-
import { defineComponent as T, inject as
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-02d3ae06]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-02d3ae06] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-02d3ae06],.slide-leave-active[data-v-02d3ae06]{transition:all .3s ease-out}.slide-enter-from[data-v-02d3ae06],.slide-leave-to[data-v-02d3ae06]{opacity:0}.slide-enter-from[data-v-02d3ae06],.slide-leave-to[data-v-02d3ae06]{transform:translateY(-20px)}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { defineComponent as T, inject as O, computed as d, openBlock as r, createBlock as p, resolveDynamicComponent as f, normalizeProps as b, mergeProps as $, createSlots as E, withCtx as i, renderSlot as g, renderList as oe, createElementBlock as N, defineAsyncComponent as ae, unref as h, ref as x, createTextVNode as B, toDisplayString as w, createVNode as v, normalizeClass as j, createCommentVNode as C, mergeModels as ie, useModel as M, watchEffect as le, createElementVNode as q, reactive as se, Transition as re, h as ce } from "vue";
|
|
3
3
|
var P;
|
|
4
4
|
(function(n) {
|
|
5
5
|
n.highlight = "vpv:annotation:highlight", n.freeText = "vpv:annotation:freeText", n.signature = "vpv:annotation:signature", n.image = "vpv:annotation:image";
|
|
@@ -8,42 +8,42 @@ var z;
|
|
|
8
8
|
(function(n) {
|
|
9
9
|
n.Purple = "#7862FF", n.Cyan = "#3FE9E3", n.Red = "#F87777", n.Orange = "#FE9639", n.Yellow = "#FBDA15", n.Green = "#88F526";
|
|
10
10
|
})(z || (z = {}));
|
|
11
|
-
const
|
|
11
|
+
const ue = {
|
|
12
12
|
ANNOTATIONS: "annotations"
|
|
13
|
-
}, S = Symbol("VPV Shared UIs"), R = Symbol("VPV Current Localization"),
|
|
13
|
+
}, S = Symbol("VPV Shared UIs"), R = Symbol("VPV Current Localization"), pe = (n, o) => `${n}-${o}`, L = /* @__PURE__ */ T({
|
|
14
14
|
__name: "AppTooltip",
|
|
15
15
|
setup(n) {
|
|
16
|
-
const o =
|
|
17
|
-
return (t, a) => e.value ? (
|
|
18
|
-
default:
|
|
19
|
-
|
|
16
|
+
const o = O(S), e = d(() => o?.AppTooltip);
|
|
17
|
+
return (t, a) => e.value ? (r(), p(f(e.value), b($({ key: 0 }, t.$attrs)), E({
|
|
18
|
+
default: i(() => [
|
|
19
|
+
g(t.$slots, "default")
|
|
20
20
|
]),
|
|
21
21
|
_: 2
|
|
22
22
|
}, [
|
|
23
|
-
|
|
24
|
-
name:
|
|
25
|
-
fn:
|
|
26
|
-
|
|
23
|
+
oe(t.$slots, (l, u) => ({
|
|
24
|
+
name: u,
|
|
25
|
+
fn: i(() => [
|
|
26
|
+
g(t.$slots, u)
|
|
27
27
|
])
|
|
28
28
|
}))
|
|
29
|
-
]), 1040)) : (
|
|
30
|
-
|
|
29
|
+
]), 1040)) : (r(), N("div", b($({ key: 1 }, t.$attrs)), [
|
|
30
|
+
g(t.$slots, "default")
|
|
31
31
|
], 16));
|
|
32
32
|
}
|
|
33
33
|
}), V = /* @__PURE__ */ T({
|
|
34
34
|
__name: "AppButton",
|
|
35
35
|
setup(n) {
|
|
36
|
-
const o =
|
|
37
|
-
return (t, a) => e.value ? (
|
|
38
|
-
default:
|
|
39
|
-
|
|
36
|
+
const o = O(S), e = d(() => o?.AppButton);
|
|
37
|
+
return (t, a) => e.value ? (r(), p(f(e.value), b($({ key: 0 }, t.$attrs)), {
|
|
38
|
+
default: i(() => [
|
|
39
|
+
g(t.$slots, "default")
|
|
40
40
|
]),
|
|
41
41
|
_: 3
|
|
42
|
-
}, 16)) : (
|
|
43
|
-
|
|
42
|
+
}, 16)) : (r(), N("button", b($({ key: 1 }, t.$attrs)), [
|
|
43
|
+
g(t.$slots, "default")
|
|
44
44
|
], 16));
|
|
45
45
|
}
|
|
46
|
-
}),
|
|
46
|
+
}), ge = (n, o) => {
|
|
47
47
|
const e = n[o];
|
|
48
48
|
return e ? typeof e == "function" ? e() : Promise.resolve(e) : new Promise((t, a) => {
|
|
49
49
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(a.bind(null, new Error("Unknown variable dynamic import: " + o)));
|
|
@@ -54,10 +54,10 @@ const ce = {
|
|
|
54
54
|
name: {}
|
|
55
55
|
},
|
|
56
56
|
setup(n) {
|
|
57
|
-
const o = n, e =
|
|
58
|
-
loader: () =>
|
|
57
|
+
const o = n, e = ae({
|
|
58
|
+
loader: () => ge(/* @__PURE__ */ Object.assign({ "../assets/icons/annotations.svg": () => import("./annotations.1313e99f.js"), "../assets/icons/tool-comment.svg": () => import("./tool-comment.d0e017dc.js"), "../assets/icons/tool-free-text.svg": () => import("./tool-free-text.bcc03e9a.js"), "../assets/icons/tool-highlight.svg": () => import("./tool-highlight.d3ea6f0b.js"), "../assets/icons/tool-image.svg": () => import("./tool-image.72fd3197.js"), "../assets/icons/tool-signature.svg": () => import("./tool-signature.85da0b98.js") }), `../assets/icons/${o.name}.svg`)
|
|
59
59
|
});
|
|
60
|
-
return (t, a) => (
|
|
60
|
+
return (t, a) => (r(), p(f(h(e)), { class: "vp-text-xl" }));
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
const D = (n, o) => {
|
|
@@ -66,39 +66,39 @@ const D = (n, o) => {
|
|
|
66
66
|
e[t] = a;
|
|
67
67
|
return e;
|
|
68
68
|
}, F = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-c6e40782"]]), H = () => {
|
|
69
|
-
const n =
|
|
69
|
+
const n = O(
|
|
70
70
|
R,
|
|
71
|
-
|
|
71
|
+
d(() => ({}))
|
|
72
72
|
);
|
|
73
73
|
return {
|
|
74
|
-
t:
|
|
74
|
+
t: d(() => (e) => {
|
|
75
75
|
const t = e.split(".").pop() || e;
|
|
76
76
|
return n.value && t in n.value ? n.value[t] : (console.warn(`useLocalization - Translation not found for key: ${e}`), e);
|
|
77
77
|
}).value,
|
|
78
|
-
currentLocale:
|
|
78
|
+
currentLocale: d(() => n.value)
|
|
79
79
|
};
|
|
80
|
-
},
|
|
80
|
+
}, de = /* @__PURE__ */ T({
|
|
81
81
|
__name: "ToolAnnotation",
|
|
82
82
|
emits: ["toggle"],
|
|
83
83
|
setup(n, { emit: o }) {
|
|
84
|
-
const { t: e } = H(), t = o, a = x(!1),
|
|
84
|
+
const { t: e } = H(), t = o, a = x(!1), l = () => {
|
|
85
85
|
a.value = !a.value, t("toggle", a.value);
|
|
86
86
|
};
|
|
87
|
-
return (
|
|
87
|
+
return (u, c) => u.$slots.default ? g(u.$slots, "default", {
|
|
88
88
|
key: 0,
|
|
89
|
-
onClick:
|
|
90
|
-
}, void 0, !0) : (
|
|
91
|
-
content:
|
|
92
|
-
B(
|
|
89
|
+
onClick: l
|
|
90
|
+
}, void 0, !0) : (r(), p(L, { key: 1 }, {
|
|
91
|
+
content: i(() => [
|
|
92
|
+
B(w(a.value ? h(e)("annotationToggleHideTooltip") : h(e)("annotationToggleShowTooltip")), 1)
|
|
93
93
|
]),
|
|
94
|
-
default:
|
|
95
|
-
|
|
94
|
+
default: i(() => [
|
|
95
|
+
v(V, {
|
|
96
96
|
"aria-label": a.value ? h(e)("annotationToggleHideTooltip") : h(e)("annotationToggleShowTooltip"),
|
|
97
97
|
class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": a.value }]),
|
|
98
|
-
onClick:
|
|
98
|
+
onClick: l
|
|
99
99
|
}, {
|
|
100
|
-
default:
|
|
101
|
-
|
|
100
|
+
default: i(() => [
|
|
101
|
+
v(F, {
|
|
102
102
|
name: "annotations",
|
|
103
103
|
class: "vp-text-xl"
|
|
104
104
|
})
|
|
@@ -110,67 +110,67 @@ const D = (n, o) => {
|
|
|
110
110
|
}));
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
const fe = /* @__PURE__ */ D(
|
|
113
|
+
const fe = /* @__PURE__ */ D(de, [["__scopeId", "data-v-52907777"]]), Y = /* @__PURE__ */ T({
|
|
114
114
|
__name: "AppPopover",
|
|
115
115
|
setup(n) {
|
|
116
|
-
const o =
|
|
117
|
-
return (t, a) => e.value ? (
|
|
118
|
-
trigger:
|
|
119
|
-
|
|
116
|
+
const o = O(S), e = d(() => o?.AppPopover);
|
|
117
|
+
return (t, a) => e.value ? (r(), p(f(e.value), b($({ key: 0 }, t.$attrs)), {
|
|
118
|
+
trigger: i(() => [
|
|
119
|
+
g(t.$slots, "trigger")
|
|
120
120
|
]),
|
|
121
|
-
default:
|
|
122
|
-
|
|
121
|
+
default: i(() => [
|
|
122
|
+
g(t.$slots, "default")
|
|
123
123
|
]),
|
|
124
124
|
_: 3
|
|
125
|
-
}, 16)) : (
|
|
126
|
-
|
|
125
|
+
}, 16)) : (r(), N("button", b($({ key: 1 }, t.$attrs)), [
|
|
126
|
+
g(t.$slots, "default")
|
|
127
127
|
], 16));
|
|
128
128
|
}
|
|
129
|
-
}),
|
|
129
|
+
}), he = /* @__PURE__ */ T({
|
|
130
130
|
__name: "AppHighlightColorPicker",
|
|
131
131
|
setup(n) {
|
|
132
|
-
const o =
|
|
133
|
-
return (t, a) => e.value ? (
|
|
132
|
+
const o = O(S), e = d(() => o?.AppHighlightColorPicker);
|
|
133
|
+
return (t, a) => e.value ? (r(), p(f(e.value), b($({ key: 0 }, t.$attrs)), null, 16)) : C("", !0);
|
|
134
134
|
}
|
|
135
|
-
}),
|
|
135
|
+
}), me = { class: "vpv-annotation-highlight__color-picker-wrapper" }, _e = /* @__PURE__ */ T({
|
|
136
136
|
__name: "ToolAnnotationHighlight",
|
|
137
137
|
props: {
|
|
138
138
|
active: { type: Boolean, required: !0 },
|
|
139
139
|
activeModifiers: {}
|
|
140
140
|
},
|
|
141
|
-
emits: /* @__PURE__ */
|
|
141
|
+
emits: /* @__PURE__ */ ie(["change"], ["update:active"]),
|
|
142
142
|
setup(n, { emit: o }) {
|
|
143
|
-
const e = M(n, "active"), t = x(!1), a = o, { t:
|
|
143
|
+
const e = M(n, "active"), t = x(!1), a = o, { t: l } = H(), u = x(z.Purple), c = () => {
|
|
144
144
|
!e.value && !t.value && (t.value = !0), e.value = !e.value;
|
|
145
|
-
}, k = (
|
|
145
|
+
}, k = (_) => {
|
|
146
146
|
t.value = !1;
|
|
147
147
|
};
|
|
148
148
|
return le(() => {
|
|
149
|
-
!e.value || a("change",
|
|
150
|
-
}), (
|
|
149
|
+
!e.value || a("change", u.value);
|
|
150
|
+
}), (_, A) => _.$slots.default ? g(_.$slots, "default", {
|
|
151
151
|
key: 0,
|
|
152
152
|
onClick: c
|
|
153
|
-
}) : (
|
|
153
|
+
}) : (r(), p(Y, {
|
|
154
154
|
key: 1,
|
|
155
155
|
open: t.value,
|
|
156
156
|
side: "right",
|
|
157
157
|
sideOffset: 10,
|
|
158
158
|
onInteractOutside: k
|
|
159
159
|
}, {
|
|
160
|
-
trigger:
|
|
161
|
-
|
|
162
|
-
content:
|
|
163
|
-
B(
|
|
160
|
+
trigger: i(() => [
|
|
161
|
+
v(L, null, {
|
|
162
|
+
content: i(() => [
|
|
163
|
+
B(w(h(l)("annotationHighlightTooltip")), 1)
|
|
164
164
|
]),
|
|
165
|
-
default:
|
|
166
|
-
|
|
167
|
-
"aria-label": h(
|
|
165
|
+
default: i(() => [
|
|
166
|
+
v(V, {
|
|
167
|
+
"aria-label": h(l)("annotationHighlightLabel"),
|
|
168
168
|
class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": e.value }]),
|
|
169
169
|
onClick: c
|
|
170
170
|
}, {
|
|
171
|
-
default:
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
default: i(() => [
|
|
172
|
+
g(_.$slots, "icon", {}, () => [
|
|
173
|
+
v(F, { name: "tool-highlight" })
|
|
174
174
|
])
|
|
175
175
|
]),
|
|
176
176
|
_: 3
|
|
@@ -179,25 +179,25 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
179
179
|
_: 3
|
|
180
180
|
})
|
|
181
181
|
]),
|
|
182
|
-
default:
|
|
183
|
-
q("div",
|
|
184
|
-
q("p", null,
|
|
185
|
-
|
|
186
|
-
color:
|
|
187
|
-
"onUpdate:color": A[0] || (A[0] = (I) =>
|
|
182
|
+
default: i(() => [
|
|
183
|
+
q("div", me, [
|
|
184
|
+
q("p", null, w(h(l)("annotationHighlightColorPickerLabel")), 1),
|
|
185
|
+
v(he, {
|
|
186
|
+
color: u.value,
|
|
187
|
+
"onUpdate:color": A[0] || (A[0] = (I) => u.value = I)
|
|
188
188
|
}, null, 8, ["color"])
|
|
189
189
|
])
|
|
190
190
|
]),
|
|
191
191
|
_: 3
|
|
192
192
|
}, 8, ["open"]));
|
|
193
193
|
}
|
|
194
|
-
}),
|
|
194
|
+
}), Te = /* @__PURE__ */ T({
|
|
195
195
|
__name: "AppSignatures",
|
|
196
196
|
setup(n) {
|
|
197
|
-
const o =
|
|
198
|
-
return (t, a) => e.value ? (
|
|
197
|
+
const o = O(S), e = d(() => o?.AppSignatures);
|
|
198
|
+
return (t, a) => e.value ? (r(), p(f(e.value), b($({ key: 0 }, t.$attrs)), null, 16)) : C("", !0);
|
|
199
199
|
}
|
|
200
|
-
}),
|
|
200
|
+
}), ke = /* @__PURE__ */ T({
|
|
201
201
|
__name: "ToolAnnotationSignature",
|
|
202
202
|
props: {
|
|
203
203
|
active: { type: Boolean, required: !0 },
|
|
@@ -207,34 +207,34 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
207
207
|
setup(n) {
|
|
208
208
|
const o = M(n, "active"), { t: e } = H(), t = x(!1), a = () => {
|
|
209
209
|
!o.value && !t.value && (t.value = !0), o.value = !o.value;
|
|
210
|
-
},
|
|
210
|
+
}, l = (u) => {
|
|
211
211
|
t.value = !1;
|
|
212
212
|
};
|
|
213
|
-
return (
|
|
213
|
+
return (u, c) => u.$slots.default ? g(u.$slots, "default", {
|
|
214
214
|
key: 0,
|
|
215
215
|
onClick: a
|
|
216
|
-
}) : (
|
|
216
|
+
}) : (r(), p(Y, {
|
|
217
217
|
key: 1,
|
|
218
218
|
open: t.value,
|
|
219
219
|
side: "right",
|
|
220
220
|
sideOffset: 10,
|
|
221
221
|
class: "vpv-annotation-signatures__popover",
|
|
222
|
-
onInteractOutside:
|
|
222
|
+
onInteractOutside: l
|
|
223
223
|
}, {
|
|
224
|
-
trigger:
|
|
225
|
-
|
|
226
|
-
content:
|
|
227
|
-
B(
|
|
224
|
+
trigger: i(() => [
|
|
225
|
+
v(L, null, {
|
|
226
|
+
content: i(() => [
|
|
227
|
+
B(w(h(e)("annotationSignatureTooltip")), 1)
|
|
228
228
|
]),
|
|
229
|
-
default:
|
|
230
|
-
|
|
229
|
+
default: i(() => [
|
|
230
|
+
v(V, {
|
|
231
231
|
"aria-label": h(e)("annotationSignatureLabel"),
|
|
232
232
|
class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
|
|
233
233
|
onClick: a
|
|
234
234
|
}, {
|
|
235
|
-
default:
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
default: i(() => [
|
|
236
|
+
g(u.$slots, "icon", {}, () => [
|
|
237
|
+
v(F, { name: "tool-signature" })
|
|
238
238
|
])
|
|
239
239
|
]),
|
|
240
240
|
_: 3
|
|
@@ -243,13 +243,13 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
243
243
|
_: 3
|
|
244
244
|
})
|
|
245
245
|
]),
|
|
246
|
-
default:
|
|
247
|
-
|
|
246
|
+
default: i(() => [
|
|
247
|
+
v(Te)
|
|
248
248
|
]),
|
|
249
249
|
_: 3
|
|
250
250
|
}, 8, ["open"]));
|
|
251
251
|
}
|
|
252
|
-
}),
|
|
252
|
+
}), ye = /* @__PURE__ */ T({
|
|
253
253
|
__name: "ToolAnnotationFreeText",
|
|
254
254
|
props: {
|
|
255
255
|
active: { type: Boolean, required: !0 },
|
|
@@ -260,22 +260,22 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
260
260
|
const o = M(n, "active"), { t: e } = H(), t = () => {
|
|
261
261
|
o.value = !o.value;
|
|
262
262
|
};
|
|
263
|
-
return (a,
|
|
263
|
+
return (a, l) => a.$slots.default ? g(a.$slots, "default", {
|
|
264
264
|
key: 0,
|
|
265
265
|
onClick: t
|
|
266
|
-
}) : (
|
|
267
|
-
content:
|
|
268
|
-
B(
|
|
266
|
+
}) : (r(), p(L, { key: 1 }, {
|
|
267
|
+
content: i(() => [
|
|
268
|
+
B(w(h(e)("annotationFreeTextTooltip")), 1)
|
|
269
269
|
]),
|
|
270
|
-
default:
|
|
271
|
-
|
|
270
|
+
default: i(() => [
|
|
271
|
+
v(V, {
|
|
272
272
|
"aria-label": h(e)("annotationFreeTextLabel"),
|
|
273
273
|
class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
|
|
274
274
|
onClick: t
|
|
275
275
|
}, {
|
|
276
|
-
default:
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
default: i(() => [
|
|
277
|
+
g(a.$slots, "icon", {}, () => [
|
|
278
|
+
v(F, { name: "tool-free-text" })
|
|
279
279
|
])
|
|
280
280
|
]),
|
|
281
281
|
_: 3
|
|
@@ -284,31 +284,33 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
284
284
|
_: 3
|
|
285
285
|
}));
|
|
286
286
|
}
|
|
287
|
-
}),
|
|
287
|
+
}), be = /* @__PURE__ */ T({
|
|
288
288
|
__name: "ToolAnnotationImage",
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
289
|
+
emits: ["change"],
|
|
290
|
+
setup(n, { emit: o }) {
|
|
291
|
+
const { t: e } = H(), t = o, a = () => {
|
|
292
|
+
const l = document.createElement("input");
|
|
293
|
+
l.type = "file", l.accept = "image/*", l.onchange = (u) => {
|
|
294
|
+
const c = u.target.files?.[0];
|
|
295
|
+
t("change", c);
|
|
296
|
+
}, l.click();
|
|
295
297
|
};
|
|
296
|
-
return (
|
|
298
|
+
return (l, u) => l.$slots.default ? g(l.$slots, "default", {
|
|
297
299
|
key: 0,
|
|
298
|
-
onClick:
|
|
299
|
-
}) : (
|
|
300
|
-
content:
|
|
301
|
-
B(
|
|
300
|
+
onClick: a
|
|
301
|
+
}) : (r(), p(L, { key: 1 }, {
|
|
302
|
+
content: i(() => [
|
|
303
|
+
B(w(h(e)("annotationImageTooltip")), 1)
|
|
302
304
|
]),
|
|
303
|
-
default:
|
|
304
|
-
|
|
305
|
-
"aria-label": h(
|
|
305
|
+
default: i(() => [
|
|
306
|
+
v(V, {
|
|
307
|
+
"aria-label": h(e)("annotationImageLabel"),
|
|
306
308
|
class: "vpv-toolbar-btn",
|
|
307
|
-
onClick:
|
|
309
|
+
onClick: a
|
|
308
310
|
}, {
|
|
309
|
-
default:
|
|
310
|
-
|
|
311
|
-
|
|
311
|
+
default: i(() => [
|
|
312
|
+
g(l.$slots, "icon", {}, () => [
|
|
313
|
+
v(F, { name: "tool-image" })
|
|
312
314
|
])
|
|
313
315
|
]),
|
|
314
316
|
_: 3
|
|
@@ -317,10 +319,10 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
317
319
|
_: 3
|
|
318
320
|
}));
|
|
319
321
|
}
|
|
320
|
-
}),
|
|
322
|
+
}), $e = { class: "vpv-annotation-tools-container" }, Ae = {
|
|
321
323
|
key: 0,
|
|
322
324
|
class: "vpv-annotation-tools"
|
|
323
|
-
},
|
|
325
|
+
}, Ce = {
|
|
324
326
|
highlight: {
|
|
325
327
|
type: [Object, Boolean],
|
|
326
328
|
default: () => !0
|
|
@@ -341,12 +343,12 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
341
343
|
type: Number,
|
|
342
344
|
required: !0
|
|
343
345
|
}
|
|
344
|
-
},
|
|
346
|
+
}, Ie = /* @__PURE__ */ T({
|
|
345
347
|
__name: "VPdfAnnotationTools",
|
|
346
|
-
props:
|
|
347
|
-
emits: ["highlight", "freeText", "signature"],
|
|
348
|
+
props: Ce,
|
|
349
|
+
emits: ["highlight", "freeText", "signature", "image"],
|
|
348
350
|
setup(n, { emit: o }) {
|
|
349
|
-
const e = n, t = o, a = (s) =>
|
|
351
|
+
const e = n, t = o, a = (s) => pe(e.instanceId, s), l = {
|
|
350
352
|
highlight: new CustomEvent(
|
|
351
353
|
a(P.highlight),
|
|
352
354
|
{
|
|
@@ -366,115 +368,120 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
366
368
|
}
|
|
367
369
|
),
|
|
368
370
|
image: new CustomEvent(a(P.image), {
|
|
369
|
-
detail: {
|
|
371
|
+
detail: { file: void 0 }
|
|
370
372
|
})
|
|
371
|
-
},
|
|
373
|
+
}, u = x(!1), c = se({
|
|
372
374
|
highlight: !1,
|
|
373
375
|
freeText: !1,
|
|
374
376
|
signature: !1
|
|
375
|
-
}), k = x(null),
|
|
377
|
+
}), k = x(null), _ = d({
|
|
376
378
|
get: () => c.highlight,
|
|
377
379
|
set: (s) => {
|
|
378
380
|
c.highlight = s, s ? (c.freeText = !1, c.signature = !1) : (k.value = null, U());
|
|
379
381
|
}
|
|
380
|
-
}), A =
|
|
382
|
+
}), A = d({
|
|
381
383
|
get: () => c.freeText,
|
|
382
384
|
set: (s) => {
|
|
383
385
|
s && (c.highlight = !1, c.signature = !1), c.freeText = s, U();
|
|
384
386
|
}
|
|
385
|
-
}), I =
|
|
387
|
+
}), I = d({
|
|
386
388
|
get: () => c.signature,
|
|
387
389
|
set: (s) => {
|
|
388
390
|
s && (c.highlight = !1, c.freeText = !1), c.signature = s, U();
|
|
389
391
|
}
|
|
390
|
-
}), G =
|
|
391
|
-
|
|
392
|
+
}), G = d(() => e.highlight), K = d(() => e.freeText), Z = d(() => e.signature), J = d(() => e.image), Q = (s) => {
|
|
393
|
+
u.value = s, s || (_.value = !1, A.value = !1, I.value = !1, k.value = null);
|
|
392
394
|
}, W = (s) => {
|
|
393
395
|
k.value = s, U();
|
|
394
396
|
}, X = (s, y) => {
|
|
395
|
-
t("highlight", s),
|
|
397
|
+
t("highlight", s), l.highlight.detail.active = s, l.highlight.detail.color = y, window.dispatchEvent(l.highlight);
|
|
396
398
|
}, ee = (s) => {
|
|
397
|
-
t("freeText", s),
|
|
399
|
+
t("freeText", s), l.freeText.detail.active = s, window.dispatchEvent(l.freeText);
|
|
398
400
|
}, te = (s) => {
|
|
399
|
-
t("signature", s),
|
|
401
|
+
t("signature", s), l.signature.detail.active = s, window.dispatchEvent(l.signature);
|
|
402
|
+
}, ne = (s) => {
|
|
403
|
+
t("image", s), l.image.detail.file = s, window.dispatchEvent(l.image);
|
|
400
404
|
};
|
|
401
405
|
function U() {
|
|
402
|
-
X(
|
|
406
|
+
X(_.value, k.value), ee(A.value), te(I.value);
|
|
403
407
|
}
|
|
404
|
-
return (s, y) => (
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
default:
|
|
408
|
-
|
|
409
|
-
G.value ? (
|
|
408
|
+
return (s, y) => (r(), N("div", $e, [
|
|
409
|
+
v(fe, { onToggle: Q }),
|
|
410
|
+
v(re, { name: "slide" }, {
|
|
411
|
+
default: i(() => [
|
|
412
|
+
u.value ? (r(), N("div", Ae, [
|
|
413
|
+
G.value ? (r(), p(_e, {
|
|
410
414
|
key: 0,
|
|
411
|
-
active:
|
|
412
|
-
"onUpdate:active": y[0] || (y[0] = (
|
|
415
|
+
active: _.value,
|
|
416
|
+
"onUpdate:active": y[0] || (y[0] = (m) => _.value = m),
|
|
413
417
|
onChange: W
|
|
414
418
|
}, E({ _: 2 }, [
|
|
415
419
|
e.highlight?.props?.icon ? {
|
|
416
420
|
name: "icon",
|
|
417
|
-
fn:
|
|
418
|
-
(
|
|
421
|
+
fn: i(() => [
|
|
422
|
+
(r(), p(f(e.highlight.props.icon)))
|
|
419
423
|
]),
|
|
420
424
|
key: "0"
|
|
421
425
|
} : typeof e.highlight == "object" ? {
|
|
422
426
|
name: "default",
|
|
423
|
-
fn:
|
|
424
|
-
(
|
|
427
|
+
fn: i(({ onClick: m }) => [
|
|
428
|
+
(r(), p(f(e.highlight), { onClick: m }, null, 8, ["onClick"]))
|
|
425
429
|
]),
|
|
426
430
|
key: "1"
|
|
427
431
|
} : void 0
|
|
428
432
|
]), 1032, ["active"])) : C("", !0),
|
|
429
|
-
K.value ? (
|
|
433
|
+
K.value ? (r(), p(ye, {
|
|
430
434
|
key: 1,
|
|
431
435
|
active: A.value,
|
|
432
|
-
"onUpdate:active": y[1] || (y[1] = (
|
|
436
|
+
"onUpdate:active": y[1] || (y[1] = (m) => A.value = m)
|
|
433
437
|
}, E({ _: 2 }, [
|
|
434
438
|
e.freeText?.props?.icon ? {
|
|
435
439
|
name: "icon",
|
|
436
|
-
fn:
|
|
437
|
-
(
|
|
440
|
+
fn: i(() => [
|
|
441
|
+
(r(), p(f(e.freeText.props.icon)))
|
|
438
442
|
]),
|
|
439
443
|
key: "0"
|
|
440
444
|
} : typeof e.freeText == "object" ? {
|
|
441
445
|
name: "default",
|
|
442
|
-
fn:
|
|
443
|
-
(
|
|
446
|
+
fn: i(({ onClick: m }) => [
|
|
447
|
+
(r(), p(f(e.freeText), { onClick: m }, null, 8, ["onClick"]))
|
|
444
448
|
]),
|
|
445
449
|
key: "1"
|
|
446
450
|
} : void 0
|
|
447
451
|
]), 1032, ["active"])) : C("", !0),
|
|
448
|
-
J.value ? (
|
|
452
|
+
J.value ? (r(), p(be, {
|
|
453
|
+
key: 2,
|
|
454
|
+
onChange: ne
|
|
455
|
+
}, E({ _: 2 }, [
|
|
449
456
|
e.image?.props?.icon ? {
|
|
450
457
|
name: "icon",
|
|
451
|
-
fn:
|
|
452
|
-
(
|
|
458
|
+
fn: i(() => [
|
|
459
|
+
(r(), p(f(e.image.props.icon)))
|
|
453
460
|
]),
|
|
454
461
|
key: "0"
|
|
455
462
|
} : typeof e.image == "object" ? {
|
|
456
463
|
name: "default",
|
|
457
|
-
fn:
|
|
458
|
-
(
|
|
464
|
+
fn: i(({ onClick: m }) => [
|
|
465
|
+
(r(), p(f(e.image), { onClick: m }, null, 8, ["onClick"]))
|
|
459
466
|
]),
|
|
460
467
|
key: "1"
|
|
461
468
|
} : void 0
|
|
462
469
|
]), 1024)) : C("", !0),
|
|
463
|
-
Z.value ? (
|
|
470
|
+
Z.value ? (r(), p(ke, {
|
|
464
471
|
key: 3,
|
|
465
472
|
active: I.value,
|
|
466
|
-
"onUpdate:active": y[2] || (y[2] = (
|
|
473
|
+
"onUpdate:active": y[2] || (y[2] = (m) => I.value = m)
|
|
467
474
|
}, E({ _: 2 }, [
|
|
468
475
|
e.signature?.props?.icon ? {
|
|
469
476
|
name: "icon",
|
|
470
|
-
fn:
|
|
471
|
-
(
|
|
477
|
+
fn: i(() => [
|
|
478
|
+
(r(), p(f(e.signature.props.icon)))
|
|
472
479
|
]),
|
|
473
480
|
key: "0"
|
|
474
481
|
} : typeof e.signature == "object" ? {
|
|
475
482
|
name: "default",
|
|
476
|
-
fn:
|
|
477
|
-
(
|
|
483
|
+
fn: i(({ onClick: m }) => [
|
|
484
|
+
(r(), p(f(e.signature), { onClick: m }, null, 8, ["onClick"]))
|
|
478
485
|
]),
|
|
479
486
|
key: "1"
|
|
480
487
|
} : void 0
|
|
@@ -486,16 +493,16 @@ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__
|
|
|
486
493
|
]));
|
|
487
494
|
}
|
|
488
495
|
});
|
|
489
|
-
const
|
|
496
|
+
const Pe = /* @__PURE__ */ D(Ie, [["__scopeId", "data-v-02d3ae06"]]), we = (n = {}) => {
|
|
490
497
|
const { highlight: o, freeText: e, signature: t, image: a } = n;
|
|
491
498
|
return {
|
|
492
499
|
name: "annotation",
|
|
493
|
-
setup(
|
|
494
|
-
const { componentInstance:
|
|
495
|
-
|
|
496
|
-
id:
|
|
500
|
+
setup(l) {
|
|
501
|
+
const { componentInstance: u, shared: c } = l, k = u?.uid ?? 0;
|
|
502
|
+
l.toolbar.addItem({
|
|
503
|
+
id: ue.ANNOTATIONS,
|
|
497
504
|
toolbarDirection: "left",
|
|
498
|
-
component:
|
|
505
|
+
component: ce(Pe, {
|
|
499
506
|
highlight: o,
|
|
500
507
|
freeText: !1,
|
|
501
508
|
signature: !1,
|
|
@@ -503,18 +510,18 @@ const Ie = /* @__PURE__ */ D(Ce, [["__scopeId", "data-v-a94f1d40"]]), xe = (n =
|
|
|
503
510
|
instanceId: k
|
|
504
511
|
})
|
|
505
512
|
});
|
|
506
|
-
const
|
|
507
|
-
c.ui ? (
|
|
513
|
+
const _ = u?.appContext.app;
|
|
514
|
+
c.ui ? (_.provide(S, c.ui), console.log(
|
|
508
515
|
"VPdfAnnotationPlugin - Provided UI context at plugin level"
|
|
509
516
|
)) : console.warn(
|
|
510
517
|
"VPdfAnnotationPlugin - No UI context found in plugin context"
|
|
511
|
-
), c.localization?.value ?
|
|
518
|
+
), c.localization?.value ? _.provide(R, c.localization) : console.warn(
|
|
512
519
|
"VPdfAnnotationPlugin - No localization found in plugin context"
|
|
513
520
|
);
|
|
514
521
|
}
|
|
515
522
|
};
|
|
516
523
|
};
|
|
517
524
|
export {
|
|
518
|
-
|
|
519
|
-
|
|
525
|
+
Pe as VPdfAnnotationTools,
|
|
526
|
+
we as default
|
|
520
527
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-
|
|
2
|
-
(function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m["@vue-pdf-viewer/annotation"]={},m.Vue))})(this,function(m,e){"use strict";var _;(function(l){l.highlight="vpv:annotation:highlight",l.freeText="vpv:annotation:freeText",l.signature="vpv:annotation:signature",l.image="vpv:annotation:image"})(_||(_={}));var x;(function(l){l.Purple="#7862FF",l.Cyan="#3FE9E3",l.Red="#F87777",l.Orange="#FE9639",l.Yellow="#FBDA15",l.Green="#88F526"})(x||(x={}));const I={ANNOTATIONS:"annotations"},k=Symbol("VPV Shared UIs"),S=Symbol("VPV Current Localization"),M=(l,o)=>`${l}-${o}`,C=e.defineComponent({__name:"AppTooltip",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppTooltip);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),e.createSlots({default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:2},[e.renderList(n.$slots,(c,s)=>({name:s,fn:e.withCtx(()=>[e.renderSlot(n.$slots,s)])}))]),1040)):(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),w=e.defineComponent({__name:"AppButton",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppButton);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),j=(l,o)=>{const t=l[o];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((n,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+o)))})},D=e.defineComponent({__name:"Icon",props:{name:{}},setup(l){const o=l,t=e.defineAsyncComponent({loader:()=>j(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>ee),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>oe),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>le),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>re),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>ce),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>pe)}),`../assets/icons/${o.name}.svg`)});return(n,a)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),{class:"vp-text-xl"}))}}),we="",b=(l,o)=>{const t=l.__vccOpts||l;for(const[n,a]of o)t[n]=a;return t},y=b(D,[["__scopeId","data-v-c6e40782"]]),B=()=>{const l=e.inject(S,e.computed(()=>({})));return{t:e.computed(()=>t=>{const n=t.split(".").pop()||t;return l.value&&n in l.value?l.value[n]:(console.warn(`useLocalization - Translation not found for key: ${t}`),t)}).value,currentLocale:e.computed(()=>l.value)}},L=e.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(l,{emit:o}){const{t}=B(),n=o,a=e.ref(!1),c=()=>{a.value=!a.value,n("toggle",a.value)};return(s,i)=>s.$slots.default?e.renderSlot(s.$slots,"default",{key:0,onClick:c},void 0,!0):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":a.value}]),onClick:c},{default:e.withCtx(()=>[e.createVNode(y,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),ye="",H=b(L,[["__scopeId","data-v-52907777"]]),$=e.defineComponent({__name:"AppPopover",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppPopover);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{trigger:e.withCtx(()=>[e.renderSlot(n.$slots,"trigger")]),default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),F=e.defineComponent({__name:"AppHighlightColorPicker",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppHighlightColorPicker);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),null,16)):e.createCommentVNode("",!0)}}),U={class:"vpv-annotation-highlight__color-picker-wrapper"},q=e.defineComponent({__name:"ToolAnnotationHighlight",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:e.mergeModels(["change"],["update:active"]),setup(l,{emit:o}){const t=e.useModel(l,"active"),n=e.ref(!1),a=o,{t:c}=B(),s=e.ref(x.Purple),i=()=>{!t.value&&!n.value&&(n.value=!0),t.value=!t.value},f=d=>{n.value=!1};return e.watchEffect(()=>{!t.value||a("change",s.value)}),(d,h)=>d.$slots.default?e.renderSlot(d.$slots,"default",{key:0,onClick:i}):(e.openBlock(),e.createBlock($,{key:1,open:n.value,side:"right",sideOffset:10,onInteractOutside:f},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("annotationHighlightTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(c)("annotationHighlightLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]),onClick:i},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-highlight"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createElementVNode("p",null,e.toDisplayString(e.unref(c)("annotationHighlightColorPickerLabel")),1),e.createVNode(F,{color:s.value,"onUpdate:color":h[0]||(h[0]=u=>s.value=u)},null,8,["color"])])]),_:3},8,["open"]))}}),R=e.defineComponent({__name:"AppSignatures",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppSignatures);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),null,16)):e.createCommentVNode("",!0)}}),Y=e.defineComponent({__name:"ToolAnnotationSignature",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const o=e.useModel(l,"active"),{t}=B(),n=e.ref(!1),a=()=>{!o.value&&!n.value&&(n.value=!0),o.value=!o.value},c=s=>{n.value=!1};return(s,i)=>s.$slots.default?e.renderSlot(s.$slots,"default",{key:0,onClick:a}):(e.openBlock(),e.createBlock($,{key:1,open:n.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationSignatureTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(t)("annotationSignatureLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":o.value}]),onClick:a},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-signature"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createVNode(R)]),_:3},8,["open"]))}}),G=e.defineComponent({__name:"ToolAnnotationFreeText",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const o=e.useModel(l,"active"),{t}=B(),n=()=>{o.value=!o.value};return(a,c)=>a.$slots.default?e.renderSlot(a.$slots,"default",{key:0,onClick:n}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationFreeTextTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(t)("annotationFreeTextLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":o.value}]),onClick:n},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-free-text"})])]),_:3},8,["aria-label","class"])]),_:3}))}}),K=e.defineComponent({__name:"ToolAnnotationImage",setup(l){const{t:o}=B(),t=()=>{const n=document.createElement("input");n.type="file",n.accept="image/*",n.onchange=a=>{a.target.files?.[0]},n.click()};return(n,a)=>n.$slots.default?e.renderSlot(n.$slots,"default",{key:0,onClick:t}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("annotationImageTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(o)("annotationImageLabel"),class:"vpv-toolbar-btn",onClick:t},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-image"})])]),_:3},8,["aria-label"])]),_:3}))}}),Z={class:"vpv-annotation-tools-container"},J={key:0,class:"vpv-annotation-tools"},Q={highlight:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!0},image:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0}},W=e.defineComponent({__name:"VPdfAnnotationTools",props:Q,emits:["highlight","freeText","signature"],setup(l,{emit:o}){const t=l,n=o,a=r=>M(t.instanceId,r),c={highlight:new CustomEvent(a(_.highlight),{detail:{active:!1,color:null}}),freeText:new CustomEvent(a(_.freeText),{detail:{active:!1}}),signature:new CustomEvent(a(_.signature),{detail:{active:!1}}),image:new CustomEvent(a(_.image),{detail:{active:!1}})},s=e.ref(!1),i=e.reactive({highlight:!1,freeText:!1,signature:!1}),f=e.ref(null),d=e.computed({get:()=>i.highlight,set:r=>{i.highlight=r,r?(i.freeText=!1,i.signature=!1):(f.value=null,T())}}),h=e.computed({get:()=>i.freeText,set:r=>{r&&(i.highlight=!1,i.signature=!1),i.freeText=r,T()}}),u=e.computed({get:()=>i.signature,set:r=>{r&&(i.highlight=!1,i.freeText=!1),i.signature=r,T()}}),de=e.computed(()=>t.highlight),me=e.computed(()=>t.freeText),fe=e.computed(()=>t.signature),ge=e.computed(()=>t.image),he=r=>{s.value=r,r||(d.value=!1,h.value=!1,u.value=!1,f.value=null)},_e=r=>{f.value=r,T()},ke=(r,g)=>{n("highlight",r),c.highlight.detail.active=r,c.highlight.detail.color=g,window.dispatchEvent(c.highlight)},ue=r=>{n("freeText",r),c.freeText.detail.active=r,window.dispatchEvent(c.freeText)},Ce=r=>{n("signature",r),c.signature.detail.active=r,window.dispatchEvent(c.signature)};function T(){ke(d.value,f.value),ue(h.value),Ce(u.value)}return(r,g)=>(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(H,{onToggle:he}),e.createVNode(e.Transition,{name:"slide"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",J,[de.value?(e.openBlock(),e.createBlock(q,{key:0,active:d.value,"onUpdate:active":g[0]||(g[0]=p=>d.value=p),onChange:_e},e.createSlots({_:2},[t.highlight?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight.props.icon)))]),key:"0"}:typeof t.highlight=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),me.value?(e.openBlock(),e.createBlock(G,{key:1,active:h.value,"onUpdate:active":g[1]||(g[1]=p=>h.value=p)},e.createSlots({_:2},[t.freeText?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText.props.icon)))]),key:"0"}:typeof t.freeText=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),ge.value?(e.openBlock(),e.createBlock(K,{key:2},e.createSlots({_:2},[t.image?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.image.props.icon)))]),key:"0"}:typeof t.image=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.image),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1024)):e.createCommentVNode("",!0),fe.value?(e.openBlock(),e.createBlock(Y,{key:3,active:u.value,"onUpdate:active":g[2]||(g[2]=p=>u.value=p)},e.createSlots({_:2},[t.signature?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature.props.icon)))]),key:"0"}:typeof t.signature=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:1})]))}}),Be="",V=b(W,[["__scopeId","data-v-a94f1d40"]]),X=(l={})=>{const{highlight:o,freeText:t,signature:n,image:a}=l;return{name:"annotation",setup(c){const{componentInstance:s,shared:i}=c,f=s?.uid??0;c.toolbar.addItem({id:I.ANNOTATIONS,toolbarDirection:"left",component:e.h(V,{highlight:o,freeText:!1,signature:!1,image:a,instanceId:f})});const d=s?.appContext.app;i.ui?(d.provide(k,i.ui),console.log("VPdfAnnotationPlugin - Provided UI context at plugin level")):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),i.localization?.value?d.provide(S,i.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context")}}},v={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function P(l,o){return e.openBlock(),e.createElementBlock("svg",v,o[0]||(o[0]=[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)]))}const ee=Object.freeze(Object.defineProperty({__proto__:null,render:P,default:{render:P}},Symbol.toStringTag,{value:"Module"})),te={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function N(l,o){return e.openBlock(),e.createElementBlock("svg",te,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),e.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)]))}const oe=Object.freeze(Object.defineProperty({__proto__:null,render:N,default:{render:N}},Symbol.toStringTag,{value:"Module"})),ne={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function A(l,o){return e.openBlock(),e.createElementBlock("svg",ne,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)]))}const le=Object.freeze(Object.defineProperty({__proto__:null,render:A,default:{render:A}},Symbol.toStringTag,{value:"Module"})),ae={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function E(l,o){return e.openBlock(),e.createElementBlock("svg",ae,o[0]||(o[0]=[e.createElementVNode("g",{"clip-path":"url(#a)"},[e.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),e.createElementVNode("defs",null,[e.createElementVNode("clipPath",{id:"a"},[e.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)]))}const re=Object.freeze(Object.defineProperty({__proto__:null,render:E,default:{render:E}},Symbol.toStringTag,{value:"Module"})),ie={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function O(l,o){return e.openBlock(),e.createElementBlock("svg",ie,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"},null,-1)]))}const ce=Object.freeze(Object.defineProperty({__proto__:null,render:O,default:{render:O}},Symbol.toStringTag,{value:"Module"})),se={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function z(l,o){return e.openBlock(),e.createElementBlock("svg",se,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)]))}const pe=Object.freeze(Object.defineProperty({__proto__:null,render:z,default:{render:z}},Symbol.toStringTag,{value:"Module"}));m.VPdfAnnotationTools=V,m.default=X,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-02d3ae06]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-02d3ae06] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-02d3ae06],.slide-leave-active[data-v-02d3ae06]{transition:all .3s ease-out}.slide-enter-from[data-v-02d3ae06],.slide-leave-to[data-v-02d3ae06]{opacity:0}.slide-enter-from[data-v-02d3ae06],.slide-leave-to[data-v-02d3ae06]{transform:translateY(-20px)}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
(function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m["@vue-pdf-viewer/annotation"]={},m.Vue))})(this,function(m,e){"use strict";var _;(function(l){l.highlight="vpv:annotation:highlight",l.freeText="vpv:annotation:freeText",l.signature="vpv:annotation:signature",l.image="vpv:annotation:image"})(_||(_={}));var x;(function(l){l.Purple="#7862FF",l.Cyan="#3FE9E3",l.Red="#F87777",l.Orange="#FE9639",l.Yellow="#FBDA15",l.Green="#88F526"})(x||(x={}));const I={ANNOTATIONS:"annotations"},k=Symbol("VPV Shared UIs"),S=Symbol("VPV Current Localization"),M=(l,o)=>`${l}-${o}`,C=e.defineComponent({__name:"AppTooltip",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppTooltip);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),e.createSlots({default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:2},[e.renderList(n.$slots,(r,s)=>({name:s,fn:e.withCtx(()=>[e.renderSlot(n.$slots,s)])}))]),1040)):(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),w=e.defineComponent({__name:"AppButton",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppButton);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),j=(l,o)=>{const t=l[o];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((n,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+o)))})},D=e.defineComponent({__name:"Icon",props:{name:{}},setup(l){const o=l,t=e.defineAsyncComponent({loader:()=>j(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>ee),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>oe),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>le),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>re),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>ce),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>de)}),`../assets/icons/${o.name}.svg`)});return(n,a)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),{class:"vp-text-xl"}))}}),ye="",b=(l,o)=>{const t=l.__vccOpts||l;for(const[n,a]of o)t[n]=a;return t},y=b(D,[["__scopeId","data-v-c6e40782"]]),B=()=>{const l=e.inject(S,e.computed(()=>({})));return{t:e.computed(()=>t=>{const n=t.split(".").pop()||t;return l.value&&n in l.value?l.value[n]:(console.warn(`useLocalization - Translation not found for key: ${t}`),t)}).value,currentLocale:e.computed(()=>l.value)}},L=e.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(l,{emit:o}){const{t}=B(),n=o,a=e.ref(!1),r=()=>{a.value=!a.value,n("toggle",a.value)};return(s,c)=>s.$slots.default?e.renderSlot(s.$slots,"default",{key:0,onClick:r},void 0,!0):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":a.value}]),onClick:r},{default:e.withCtx(()=>[e.createVNode(y,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),Be="",H=b(L,[["__scopeId","data-v-52907777"]]),$=e.defineComponent({__name:"AppPopover",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppPopover);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{trigger:e.withCtx(()=>[e.renderSlot(n.$slots,"trigger")]),default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),F=e.defineComponent({__name:"AppHighlightColorPicker",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppHighlightColorPicker);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),null,16)):e.createCommentVNode("",!0)}}),U={class:"vpv-annotation-highlight__color-picker-wrapper"},q=e.defineComponent({__name:"ToolAnnotationHighlight",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:e.mergeModels(["change"],["update:active"]),setup(l,{emit:o}){const t=e.useModel(l,"active"),n=e.ref(!1),a=o,{t:r}=B(),s=e.ref(x.Purple),c=()=>{!t.value&&!n.value&&(n.value=!0),t.value=!t.value},g=p=>{n.value=!1};return e.watchEffect(()=>{!t.value||a("change",s.value)}),(p,h)=>p.$slots.default?e.renderSlot(p.$slots,"default",{key:0,onClick:c}):(e.openBlock(),e.createBlock($,{key:1,open:n.value,side:"right",sideOffset:10,onInteractOutside:g},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("annotationHighlightTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(r)("annotationHighlightLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]),onClick:c},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-highlight"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createElementVNode("p",null,e.toDisplayString(e.unref(r)("annotationHighlightColorPickerLabel")),1),e.createVNode(F,{color:s.value,"onUpdate:color":h[0]||(h[0]=u=>s.value=u)},null,8,["color"])])]),_:3},8,["open"]))}}),R=e.defineComponent({__name:"AppSignatures",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppSignatures);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),null,16)):e.createCommentVNode("",!0)}}),Y=e.defineComponent({__name:"ToolAnnotationSignature",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const o=e.useModel(l,"active"),{t}=B(),n=e.ref(!1),a=()=>{!o.value&&!n.value&&(n.value=!0),o.value=!o.value},r=s=>{n.value=!1};return(s,c)=>s.$slots.default?e.renderSlot(s.$slots,"default",{key:0,onClick:a}):(e.openBlock(),e.createBlock($,{key:1,open:n.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:r},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationSignatureTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(t)("annotationSignatureLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":o.value}]),onClick:a},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-signature"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createVNode(R)]),_:3},8,["open"]))}}),G=e.defineComponent({__name:"ToolAnnotationFreeText",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const o=e.useModel(l,"active"),{t}=B(),n=()=>{o.value=!o.value};return(a,r)=>a.$slots.default?e.renderSlot(a.$slots,"default",{key:0,onClick:n}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationFreeTextTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(t)("annotationFreeTextLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":o.value}]),onClick:n},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-free-text"})])]),_:3},8,["aria-label","class"])]),_:3}))}}),K=e.defineComponent({__name:"ToolAnnotationImage",emits:["change"],setup(l,{emit:o}){const{t}=B(),n=o,a=()=>{const r=document.createElement("input");r.type="file",r.accept="image/*",r.onchange=s=>{const c=s.target.files?.[0];n("change",c)},r.click()};return(r,s)=>r.$slots.default?e.renderSlot(r.$slots,"default",{key:0,onClick:a}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationImageTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(t)("annotationImageLabel"),class:"vpv-toolbar-btn",onClick:a},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-image"})])]),_:3},8,["aria-label"])]),_:3}))}}),Z={class:"vpv-annotation-tools-container"},J={key:0,class:"vpv-annotation-tools"},Q={highlight:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!0},image:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0}},W=e.defineComponent({__name:"VPdfAnnotationTools",props:Q,emits:["highlight","freeText","signature","image"],setup(l,{emit:o}){const t=l,n=o,a=i=>M(t.instanceId,i),r={highlight:new CustomEvent(a(_.highlight),{detail:{active:!1,color:null}}),freeText:new CustomEvent(a(_.freeText),{detail:{active:!1}}),signature:new CustomEvent(a(_.signature),{detail:{active:!1}}),image:new CustomEvent(a(_.image),{detail:{file:void 0}})},s=e.ref(!1),c=e.reactive({highlight:!1,freeText:!1,signature:!1}),g=e.ref(null),p=e.computed({get:()=>c.highlight,set:i=>{c.highlight=i,i?(c.freeText=!1,c.signature=!1):(g.value=null,T())}}),h=e.computed({get:()=>c.freeText,set:i=>{i&&(c.highlight=!1,c.signature=!1),c.freeText=i,T()}}),u=e.computed({get:()=>c.signature,set:i=>{i&&(c.highlight=!1,c.freeText=!1),c.signature=i,T()}}),pe=e.computed(()=>t.highlight),me=e.computed(()=>t.freeText),ge=e.computed(()=>t.signature),fe=e.computed(()=>t.image),he=i=>{s.value=i,i||(p.value=!1,h.value=!1,u.value=!1,g.value=null)},_e=i=>{g.value=i,T()},ke=(i,f)=>{n("highlight",i),r.highlight.detail.active=i,r.highlight.detail.color=f,window.dispatchEvent(r.highlight)},ue=i=>{n("freeText",i),r.freeText.detail.active=i,window.dispatchEvent(r.freeText)},Ce=i=>{n("signature",i),r.signature.detail.active=i,window.dispatchEvent(r.signature)},we=i=>{n("image",i),r.image.detail.file=i,window.dispatchEvent(r.image)};function T(){ke(p.value,g.value),ue(h.value),Ce(u.value)}return(i,f)=>(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(H,{onToggle:he}),e.createVNode(e.Transition,{name:"slide"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",J,[pe.value?(e.openBlock(),e.createBlock(q,{key:0,active:p.value,"onUpdate:active":f[0]||(f[0]=d=>p.value=d),onChange:_e},e.createSlots({_:2},[t.highlight?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight.props.icon)))]),key:"0"}:typeof t.highlight=="object"?{name:"default",fn:e.withCtx(({onClick:d})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight),{onClick:d},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),me.value?(e.openBlock(),e.createBlock(G,{key:1,active:h.value,"onUpdate:active":f[1]||(f[1]=d=>h.value=d)},e.createSlots({_:2},[t.freeText?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText.props.icon)))]),key:"0"}:typeof t.freeText=="object"?{name:"default",fn:e.withCtx(({onClick:d})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText),{onClick:d},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),fe.value?(e.openBlock(),e.createBlock(K,{key:2,onChange:we},e.createSlots({_:2},[t.image?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.image.props.icon)))]),key:"0"}:typeof t.image=="object"?{name:"default",fn:e.withCtx(({onClick:d})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.image),{onClick:d},null,8,["onClick"]))]),key:"1"}:void 0]),1024)):e.createCommentVNode("",!0),ge.value?(e.openBlock(),e.createBlock(Y,{key:3,active:u.value,"onUpdate:active":f[2]||(f[2]=d=>u.value=d)},e.createSlots({_:2},[t.signature?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature.props.icon)))]),key:"0"}:typeof t.signature=="object"?{name:"default",fn:e.withCtx(({onClick:d})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature),{onClick:d},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:1})]))}}),Te="",V=b(W,[["__scopeId","data-v-02d3ae06"]]),X=(l={})=>{const{highlight:o,freeText:t,signature:n,image:a}=l;return{name:"annotation",setup(r){const{componentInstance:s,shared:c}=r,g=s?.uid??0;r.toolbar.addItem({id:I.ANNOTATIONS,toolbarDirection:"left",component:e.h(V,{highlight:o,freeText:!1,signature:!1,image:a,instanceId:g})});const p=s?.appContext.app;c.ui?(p.provide(k,c.ui),console.log("VPdfAnnotationPlugin - Provided UI context at plugin level")):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),c.localization?.value?p.provide(S,c.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context")}}},v={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function P(l,o){return e.openBlock(),e.createElementBlock("svg",v,o[0]||(o[0]=[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)]))}const ee=Object.freeze(Object.defineProperty({__proto__:null,render:P,default:{render:P}},Symbol.toStringTag,{value:"Module"})),te={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function N(l,o){return e.openBlock(),e.createElementBlock("svg",te,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),e.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)]))}const oe=Object.freeze(Object.defineProperty({__proto__:null,render:N,default:{render:N}},Symbol.toStringTag,{value:"Module"})),ne={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function A(l,o){return e.openBlock(),e.createElementBlock("svg",ne,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)]))}const le=Object.freeze(Object.defineProperty({__proto__:null,render:A,default:{render:A}},Symbol.toStringTag,{value:"Module"})),ae={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function E(l,o){return e.openBlock(),e.createElementBlock("svg",ae,o[0]||(o[0]=[e.createElementVNode("g",{"clip-path":"url(#a)"},[e.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),e.createElementVNode("defs",null,[e.createElementVNode("clipPath",{id:"a"},[e.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)]))}const re=Object.freeze(Object.defineProperty({__proto__:null,render:E,default:{render:E}},Symbol.toStringTag,{value:"Module"})),ie={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function O(l,o){return e.openBlock(),e.createElementBlock("svg",ie,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"},null,-1)]))}const ce=Object.freeze(Object.defineProperty({__proto__:null,render:O,default:{render:O}},Symbol.toStringTag,{value:"Module"})),se={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function z(l,o){return e.openBlock(),e.createElementBlock("svg",se,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)]))}const de=Object.freeze(Object.defineProperty({__proto__:null,render:z,default:{render:z}},Symbol.toStringTag,{value:"Module"}));m.VPdfAnnotationTools=V,m.default=X,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-pdf-viewer/annotation",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.0-experimental.
|
|
4
|
+
"version": "0.0.0-experimental.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"vue": "^3.2.37"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@vue-pdf-viewer/shared": "0.0.0-experimental.
|
|
32
|
+
"@vue-pdf-viewer/shared": "0.0.0-experimental.20",
|
|
33
33
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
34
34
|
"vue": "^3.2.37"
|
|
35
35
|
},
|