@embedpdf/plugin-signature 2.13.0

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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.cjs +2 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +516 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/lib/actions.d.ts +14 -0
  8. package/dist/lib/handlers/signature-ink.handler.d.ts +4 -0
  9. package/dist/lib/handlers/signature-stamp.handler.d.ts +4 -0
  10. package/dist/lib/index.d.ts +12 -0
  11. package/dist/lib/manifest.d.ts +4 -0
  12. package/dist/lib/reducer.d.ts +5 -0
  13. package/dist/lib/serialization.d.ts +30 -0
  14. package/dist/lib/signature-plugin.d.ts +27 -0
  15. package/dist/lib/tools.d.ts +113 -0
  16. package/dist/lib/types.d.ts +114 -0
  17. package/dist/preact/adapter.d.ts +5 -0
  18. package/dist/preact/annotation.d.ts +1 -0
  19. package/dist/preact/core.d.ts +1 -0
  20. package/dist/preact/index.cjs +2 -0
  21. package/dist/preact/index.cjs.map +1 -0
  22. package/dist/preact/index.d.ts +1 -0
  23. package/dist/preact/index.js +464 -0
  24. package/dist/preact/index.js.map +1 -0
  25. package/dist/react/adapter.d.ts +2 -0
  26. package/dist/react/annotation.d.ts +1 -0
  27. package/dist/react/core.d.ts +1 -0
  28. package/dist/react/index.cjs +2 -0
  29. package/dist/react/index.cjs.map +1 -0
  30. package/dist/react/index.d.ts +1 -0
  31. package/dist/react/index.js +463 -0
  32. package/dist/react/index.js.map +1 -0
  33. package/dist/shared/components/crop-canvas.d.ts +14 -0
  34. package/dist/shared/components/index.d.ts +2 -0
  35. package/dist/shared/components/signature-draw-pad.d.ts +12 -0
  36. package/dist/shared/components/signature-type-pad.d.ts +14 -0
  37. package/dist/shared/hooks/index.d.ts +2 -0
  38. package/dist/shared/hooks/use-signature-upload.d.ts +21 -0
  39. package/dist/shared/hooks/use-signature.d.ts +16 -0
  40. package/dist/shared/index.d.ts +4 -0
  41. package/dist/shared-preact/components/crop-canvas.d.ts +14 -0
  42. package/dist/shared-preact/components/index.d.ts +2 -0
  43. package/dist/shared-preact/components/signature-draw-pad.d.ts +12 -0
  44. package/dist/shared-preact/components/signature-type-pad.d.ts +14 -0
  45. package/dist/shared-preact/hooks/index.d.ts +2 -0
  46. package/dist/shared-preact/hooks/use-signature-upload.d.ts +21 -0
  47. package/dist/shared-preact/hooks/use-signature.d.ts +16 -0
  48. package/dist/shared-preact/index.d.ts +4 -0
  49. package/dist/shared-react/components/crop-canvas.d.ts +14 -0
  50. package/dist/shared-react/components/index.d.ts +2 -0
  51. package/dist/shared-react/components/signature-draw-pad.d.ts +12 -0
  52. package/dist/shared-react/components/signature-type-pad.d.ts +14 -0
  53. package/dist/shared-react/hooks/index.d.ts +2 -0
  54. package/dist/shared-react/hooks/use-signature-upload.d.ts +21 -0
  55. package/dist/shared-react/hooks/use-signature.d.ts +16 -0
  56. package/dist/shared-react/index.d.ts +4 -0
  57. package/dist/shared-vue/components/crop-canvas.d.ts +14 -0
  58. package/dist/svelte/components/SignatureDrawPad.svelte.d.ts +12 -0
  59. package/dist/svelte/components/SignatureTypePad.svelte.d.ts +14 -0
  60. package/dist/svelte/components/index.d.ts +2 -0
  61. package/dist/svelte/hooks/index.d.ts +2 -0
  62. package/dist/svelte/hooks/use-signature-upload.svelte.d.ts +21 -0
  63. package/dist/svelte/hooks/use-signature.svelte.d.ts +17 -0
  64. package/dist/svelte/index.cjs +2 -0
  65. package/dist/svelte/index.cjs.map +1 -0
  66. package/dist/svelte/index.d.ts +4 -0
  67. package/dist/svelte/index.js +415 -0
  68. package/dist/svelte/index.js.map +1 -0
  69. package/dist/vue/components/SignatureDrawPad.vue.d.ts +15 -0
  70. package/dist/vue/components/SignatureTypePad.vue.d.ts +19 -0
  71. package/dist/vue/components/index.d.ts +2 -0
  72. package/dist/vue/hooks/index.d.ts +2 -0
  73. package/dist/vue/hooks/use-signature-upload.d.ts +20 -0
  74. package/dist/vue/hooks/use-signature.d.ts +176 -0
  75. package/dist/vue/index.cjs +2 -0
  76. package/dist/vue/index.cjs.map +1 -0
  77. package/dist/vue/index.d.ts +4 -0
  78. package/dist/vue/index.js +453 -0
  79. package/dist/vue/index.js.map +1 -0
  80. package/package.json +82 -0
@@ -0,0 +1,453 @@
1
+ import { createPluginPackage } from "@embedpdf/core";
2
+ import { SignaturePlugin, SignatureCreationType, SignaturePluginPackage as SignaturePluginPackage$1 } from "@embedpdf/plugin-signature";
3
+ export * from "@embedpdf/plugin-signature";
4
+ import { usePlugin, useCapability } from "@embedpdf/core/vue";
5
+ import { ref, watch, toValue, defineComponent, onMounted, onUnmounted, openBlock, createElementBlock, computed, createBlock, resolveDynamicComponent, toDisplayString, createElementVNode, normalizeStyle } from "vue";
6
+ const useSignaturePlugin = () => usePlugin(SignaturePlugin.id);
7
+ const useSignatureCapability = () => useCapability(SignaturePlugin.id);
8
+ const useSignatureEntries = () => {
9
+ const { provides } = useSignatureCapability();
10
+ const entries = ref([]);
11
+ watch(
12
+ provides,
13
+ (capability, _, onCleanup) => {
14
+ if (!capability) {
15
+ entries.value = [];
16
+ return;
17
+ }
18
+ entries.value = capability.getEntries();
19
+ const unsubscribe = capability.onEntriesChange((updated) => {
20
+ entries.value = updated;
21
+ });
22
+ onCleanup(unsubscribe);
23
+ },
24
+ { immediate: true }
25
+ );
26
+ return { entries };
27
+ };
28
+ const useActivePlacement = (documentId) => {
29
+ const { provides } = useSignatureCapability();
30
+ const activePlacement = ref(null);
31
+ watch(
32
+ [provides, () => toValue(documentId)],
33
+ ([capability, docId], _, onCleanup) => {
34
+ if (!capability || !docId) {
35
+ activePlacement.value = null;
36
+ return;
37
+ }
38
+ const scope = capability.forDocument(docId);
39
+ activePlacement.value = scope.getActivePlacement();
40
+ const unsubscribe = scope.onActivePlacementChange((placement) => {
41
+ activePlacement.value = placement;
42
+ });
43
+ onCleanup(unsubscribe);
44
+ },
45
+ { immediate: true }
46
+ );
47
+ return activePlacement;
48
+ };
49
+ function useSignatureUpload({
50
+ accept = "image/png,image/jpeg,image/svg+xml",
51
+ onResult
52
+ }) {
53
+ const inputRef = ref(null);
54
+ const previewUrl = ref(null);
55
+ const isDragging = ref(false);
56
+ function processFile(file) {
57
+ const reader = new FileReader();
58
+ reader.onload = () => {
59
+ const arrayBuffer = reader.result;
60
+ const blob = new Blob([arrayBuffer], { type: file.type });
61
+ const dataUrl = URL.createObjectURL(blob);
62
+ if (previewUrl.value) URL.revokeObjectURL(previewUrl.value);
63
+ previewUrl.value = dataUrl;
64
+ const img = new Image();
65
+ img.onload = () => {
66
+ const previewCanvas = document.createElement("canvas");
67
+ previewCanvas.width = img.width;
68
+ previewCanvas.height = img.height;
69
+ const ctx = previewCanvas.getContext("2d");
70
+ if (ctx) {
71
+ ctx.drawImage(img, 0, 0);
72
+ }
73
+ const result = {
74
+ creationType: SignatureCreationType.Upload,
75
+ imageMimeType: file.type,
76
+ imageSize: { width: img.width, height: img.height },
77
+ previewDataUrl: previewCanvas.toDataURL("image/png"),
78
+ imageData: arrayBuffer
79
+ };
80
+ onResult(result);
81
+ };
82
+ img.src = dataUrl;
83
+ };
84
+ reader.readAsArrayBuffer(file);
85
+ }
86
+ function handleFileInputChange(e) {
87
+ const files = e.target.files;
88
+ if (files && files[0]) {
89
+ processFile(files[0]);
90
+ }
91
+ }
92
+ function handleDrop(e) {
93
+ var _a;
94
+ e.preventDefault();
95
+ isDragging.value = false;
96
+ const files = (_a = e.dataTransfer) == null ? void 0 : _a.files;
97
+ if (files && files[0]) {
98
+ processFile(files[0]);
99
+ }
100
+ }
101
+ function handleDragOver(e) {
102
+ e.preventDefault();
103
+ isDragging.value = true;
104
+ }
105
+ function handleDragLeave() {
106
+ isDragging.value = false;
107
+ }
108
+ function openFilePicker() {
109
+ var _a;
110
+ (_a = inputRef.value) == null ? void 0 : _a.click();
111
+ }
112
+ function clear() {
113
+ if (previewUrl.value) URL.revokeObjectURL(previewUrl.value);
114
+ previewUrl.value = null;
115
+ onResult(null);
116
+ if (inputRef.value) {
117
+ inputRef.value.value = "";
118
+ }
119
+ }
120
+ return {
121
+ inputRef,
122
+ openFilePicker,
123
+ processFile,
124
+ handleFileInputChange,
125
+ handleDrop,
126
+ handleDragOver,
127
+ handleDragLeave,
128
+ previewUrl,
129
+ isDragging,
130
+ clear,
131
+ accept
132
+ };
133
+ }
134
+ function cropCanvas(source, padding = 4) {
135
+ const ctx = source.getContext("2d");
136
+ if (!ctx) return null;
137
+ const { width, height } = source;
138
+ if (width === 0 || height === 0) return null;
139
+ const imageData = ctx.getImageData(0, 0, width, height);
140
+ const { data } = imageData;
141
+ let minX = width;
142
+ let minY = height;
143
+ let maxX = 0;
144
+ let maxY = 0;
145
+ for (let y = 0; y < height; y++) {
146
+ for (let x = 0; x < width; x++) {
147
+ const alpha = data[(y * width + x) * 4 + 3];
148
+ if (alpha > 0) {
149
+ if (x < minX) minX = x;
150
+ if (x > maxX) maxX = x;
151
+ if (y < minY) minY = y;
152
+ if (y > maxY) maxY = y;
153
+ }
154
+ }
155
+ }
156
+ if (maxX < minX || maxY < minY) return null;
157
+ const cropX = Math.max(0, minX - padding);
158
+ const cropY = Math.max(0, minY - padding);
159
+ const cropW = Math.min(width, maxX + padding + 1) - cropX;
160
+ const cropH = Math.min(height, maxY + padding + 1) - cropY;
161
+ const cropped = document.createElement("canvas");
162
+ cropped.width = cropW;
163
+ cropped.height = cropH;
164
+ const croppedCtx = cropped.getContext("2d");
165
+ if (!croppedCtx) return null;
166
+ croppedCtx.drawImage(source, cropX, cropY, cropW, cropH, 0, 0, cropW, cropH);
167
+ return {
168
+ canvas: cropped,
169
+ bounds: { x: cropX, y: cropY, width: cropW, height: cropH }
170
+ };
171
+ }
172
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
173
+ __name: "SignatureDrawPad",
174
+ props: {
175
+ onResult: {},
176
+ strokeColor: { default: "#000000" },
177
+ strokeWidth: { default: 4 }
178
+ },
179
+ setup(__props, { expose: __expose }) {
180
+ const props = __props;
181
+ const canvasRef = ref(null);
182
+ const strokes = ref([]);
183
+ let isDrawing = false;
184
+ const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
185
+ let observer = null;
186
+ function getCanvasPos(e) {
187
+ const canvas = canvasRef.value;
188
+ if (!canvas) return { x: 0, y: 0 };
189
+ const rect = canvas.getBoundingClientRect();
190
+ return {
191
+ x: (e.clientX - rect.left) * (canvas.width / dpr / rect.width),
192
+ y: (e.clientY - rect.top) * (canvas.height / dpr / rect.height)
193
+ };
194
+ }
195
+ function redraw(currentStrokes) {
196
+ const canvas = canvasRef.value;
197
+ if (!canvas) return;
198
+ const ctx = canvas.getContext("2d");
199
+ if (!ctx) return;
200
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
201
+ ctx.save();
202
+ ctx.scale(dpr, dpr);
203
+ ctx.strokeStyle = props.strokeColor;
204
+ ctx.lineWidth = props.strokeWidth;
205
+ ctx.lineCap = "round";
206
+ ctx.lineJoin = "round";
207
+ for (const stroke of currentStrokes) {
208
+ if (stroke.points.length === 0) continue;
209
+ ctx.beginPath();
210
+ ctx.moveTo(stroke.points[0].x, stroke.points[0].y);
211
+ for (let i = 1; i < stroke.points.length; i++) {
212
+ ctx.lineTo(stroke.points[i].x, stroke.points[i].y);
213
+ }
214
+ ctx.stroke();
215
+ }
216
+ ctx.restore();
217
+ }
218
+ function emitResult(currentStrokes) {
219
+ if (currentStrokes.length === 0 || currentStrokes.every((s) => s.points.length < 2)) {
220
+ props.onResult(null);
221
+ return;
222
+ }
223
+ const canvas = canvasRef.value;
224
+ if (!canvas) return;
225
+ const cropped = cropCanvas(canvas, Math.ceil(props.strokeWidth * dpr));
226
+ if (!cropped) {
227
+ props.onResult(null);
228
+ return;
229
+ }
230
+ const offsetX = cropped.bounds.x / dpr;
231
+ const offsetY = cropped.bounds.y / dpr;
232
+ const croppedWidth = Math.round(cropped.bounds.width / dpr);
233
+ const croppedHeight = Math.round(cropped.bounds.height / dpr);
234
+ const result = {
235
+ creationType: SignatureCreationType.Draw,
236
+ inkData: {
237
+ inkList: currentStrokes.filter((s) => s.points.length >= 2).map((s) => ({
238
+ points: s.points.map((p) => ({
239
+ x: p.x - offsetX,
240
+ y: p.y - offsetY
241
+ }))
242
+ })),
243
+ strokeWidth: props.strokeWidth,
244
+ strokeColor: props.strokeColor,
245
+ size: { width: croppedWidth, height: croppedHeight }
246
+ },
247
+ previewDataUrl: cropped.canvas.toDataURL("image/png")
248
+ };
249
+ props.onResult(result);
250
+ }
251
+ function clear() {
252
+ strokes.value = [];
253
+ redraw([]);
254
+ props.onResult(null);
255
+ }
256
+ __expose({ clear });
257
+ function handlePointerDown(e) {
258
+ var _a, _b;
259
+ isDrawing = true;
260
+ const pos = getCanvasPos(e);
261
+ strokes.value = [...strokes.value, { points: [pos] }];
262
+ redraw(strokes.value);
263
+ (_b = (_a = e.target) == null ? void 0 : _a.setPointerCapture) == null ? void 0 : _b.call(_a, e.pointerId);
264
+ }
265
+ function handlePointerMove(e) {
266
+ if (!isDrawing) return;
267
+ const pos = getCanvasPos(e);
268
+ const last = strokes.value[strokes.value.length - 1];
269
+ if (last) {
270
+ last.points.push(pos);
271
+ strokes.value = [...strokes.value];
272
+ redraw(strokes.value);
273
+ }
274
+ }
275
+ function handlePointerUp(e) {
276
+ var _a, _b;
277
+ isDrawing = false;
278
+ (_b = (_a = e.target) == null ? void 0 : _a.releasePointerCapture) == null ? void 0 : _b.call(_a, e.pointerId);
279
+ emitResult(strokes.value);
280
+ }
281
+ watch([() => props.strokeColor, () => props.strokeWidth], () => {
282
+ redraw(strokes.value);
283
+ if (strokes.value.length > 0 && strokes.value.some((s) => s.points.length >= 2)) {
284
+ emitResult(strokes.value);
285
+ }
286
+ });
287
+ onMounted(() => {
288
+ const canvas = canvasRef.value;
289
+ if (!canvas) return;
290
+ observer = new ResizeObserver((entries) => {
291
+ const { width: w, height: h } = entries[0].contentRect;
292
+ if (w > 0 && h > 0 && canvasRef.value) {
293
+ canvasRef.value.width = Math.round(w) * dpr;
294
+ canvasRef.value.height = Math.round(h) * dpr;
295
+ redraw(strokes.value);
296
+ }
297
+ });
298
+ observer.observe(canvas);
299
+ });
300
+ onUnmounted(() => {
301
+ observer == null ? void 0 : observer.disconnect();
302
+ });
303
+ return (_ctx, _cache) => {
304
+ return openBlock(), createElementBlock("canvas", {
305
+ ref_key: "canvasRef",
306
+ ref: canvasRef,
307
+ style: { touchAction: "none", width: "100%", height: "100%", display: "block" },
308
+ onPointerdown: handlePointerDown,
309
+ onPointermove: handlePointerMove,
310
+ onPointerup: handlePointerUp
311
+ }, null, 544);
312
+ };
313
+ }
314
+ });
315
+ const _hoisted_1 = ["value", "placeholder"];
316
+ const _sfc_main = /* @__PURE__ */ defineComponent({
317
+ __name: "SignatureTypePad",
318
+ props: {
319
+ onResult: {},
320
+ fontFamily: { default: "'Dancing Script', cursive" },
321
+ fontSize: { default: 48 },
322
+ color: { default: "#000000" },
323
+ placeholder: { default: "Type your signature..." }
324
+ },
325
+ setup(__props, { expose: __expose }) {
326
+ const props = __props;
327
+ const wrapperRef = ref(null);
328
+ const canvasRef = ref(null);
329
+ const text = ref("");
330
+ const inputId = `sig-type-${Math.random().toString(36).slice(2, 8)}`;
331
+ let size = { width: 0, height: 0 };
332
+ const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
333
+ let observer = null;
334
+ const placeholderStyle = computed(
335
+ () => `#${inputId}::placeholder { color: ${props.color}; opacity: 0.5; }`
336
+ );
337
+ const inputStyle = computed(() => ({
338
+ fontFamily: props.fontFamily,
339
+ fontSize: `${Math.min(props.fontSize, 32)}px`,
340
+ color: props.color,
341
+ width: "100%",
342
+ height: "100%",
343
+ border: "none",
344
+ outline: "none",
345
+ background: "transparent",
346
+ textIndent: "8px"
347
+ }));
348
+ function renderText(currentText) {
349
+ const canvas = canvasRef.value;
350
+ if (!canvas) return;
351
+ const { width, height } = size;
352
+ if (width === 0 || height === 0) return;
353
+ canvas.width = width * dpr;
354
+ canvas.height = height * dpr;
355
+ const ctx = canvas.getContext("2d");
356
+ if (!ctx) return;
357
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
358
+ if (!currentText.trim()) {
359
+ props.onResult(null);
360
+ return;
361
+ }
362
+ ctx.scale(dpr, dpr);
363
+ ctx.fillStyle = props.color;
364
+ ctx.font = `${props.fontSize}px ${props.fontFamily}`;
365
+ ctx.textBaseline = "middle";
366
+ ctx.textAlign = "center";
367
+ ctx.fillText(currentText, width / 2, height / 2, width - 20);
368
+ const cropped = cropCanvas(canvas, Math.ceil(4 * dpr));
369
+ if (!cropped) {
370
+ props.onResult(null);
371
+ return;
372
+ }
373
+ const croppedWidth = Math.round(cropped.bounds.width / dpr);
374
+ const croppedHeight = Math.round(cropped.bounds.height / dpr);
375
+ cropped.canvas.toBlob((blob) => {
376
+ if (!blob) return;
377
+ blob.arrayBuffer().then((imageData) => {
378
+ const result = {
379
+ creationType: SignatureCreationType.Type,
380
+ label: currentText,
381
+ imageMimeType: "image/png",
382
+ imageSize: { width: croppedWidth, height: croppedHeight },
383
+ previewDataUrl: cropped.canvas.toDataURL("image/png"),
384
+ imageData
385
+ };
386
+ props.onResult(result);
387
+ });
388
+ }, "image/png");
389
+ }
390
+ function clear() {
391
+ text.value = "";
392
+ props.onResult(null);
393
+ }
394
+ __expose({ clear });
395
+ function handleInput(e) {
396
+ text.value = e.target.value;
397
+ }
398
+ watch([text, () => props.fontFamily, () => props.color], () => {
399
+ renderText(text.value);
400
+ });
401
+ onMounted(() => {
402
+ const wrapper = wrapperRef.value;
403
+ if (!wrapper) return;
404
+ observer = new ResizeObserver((entries) => {
405
+ const { width: w, height: h } = entries[0].contentRect;
406
+ if (w > 0 && h > 0) {
407
+ size = { width: Math.round(w), height: Math.round(h) };
408
+ renderText(text.value);
409
+ }
410
+ });
411
+ observer.observe(wrapper);
412
+ });
413
+ onUnmounted(() => {
414
+ observer == null ? void 0 : observer.disconnect();
415
+ });
416
+ return (_ctx, _cache) => {
417
+ return openBlock(), createElementBlock("div", {
418
+ ref_key: "wrapperRef",
419
+ ref: wrapperRef,
420
+ style: { width: "100%", height: "100%" }
421
+ }, [
422
+ (openBlock(), createBlock(resolveDynamicComponent("style"), {
423
+ textContent: toDisplayString(placeholderStyle.value)
424
+ }, null, 8, ["textContent"])),
425
+ createElementVNode("input", {
426
+ id: inputId,
427
+ type: "text",
428
+ value: text.value,
429
+ onInput: handleInput,
430
+ placeholder: __props.placeholder,
431
+ style: normalizeStyle(inputStyle.value)
432
+ }, null, 44, _hoisted_1),
433
+ createElementVNode("canvas", {
434
+ ref_key: "canvasRef",
435
+ ref: canvasRef,
436
+ style: { display: "none" }
437
+ }, null, 512)
438
+ ], 512);
439
+ };
440
+ }
441
+ });
442
+ const SignaturePluginPackage = createPluginPackage(SignaturePluginPackage$1).build();
443
+ export {
444
+ _sfc_main$1 as SignatureDrawPad,
445
+ SignaturePluginPackage,
446
+ _sfc_main as SignatureTypePad,
447
+ useActivePlacement,
448
+ useSignatureCapability,
449
+ useSignatureEntries,
450
+ useSignaturePlugin,
451
+ useSignatureUpload
452
+ };
453
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-signature.ts","../../src/vue/hooks/use-signature-upload.ts","../../src/shared/components/crop-canvas.ts","../../src/vue/components/SignatureDrawPad.vue","../../src/vue/components/SignatureTypePad.vue","../../src/vue/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { SignaturePlugin, SignatureEntry, ActivePlacementInfo } from '@embedpdf/plugin-signature';\nimport { ref, watch, toValue, type MaybeRefOrGetter } from 'vue';\n\nexport const useSignaturePlugin = () => usePlugin<SignaturePlugin>(SignaturePlugin.id);\nexport const useSignatureCapability = () => useCapability<SignaturePlugin>(SignaturePlugin.id);\n\nexport const useSignatureEntries = () => {\n const { provides } = useSignatureCapability();\n const entries = ref<SignatureEntry[]>([]);\n\n watch(\n provides,\n (capability, _, onCleanup) => {\n if (!capability) {\n entries.value = [];\n return;\n }\n\n entries.value = capability.getEntries();\n const unsubscribe = capability.onEntriesChange((updated) => {\n entries.value = updated;\n });\n onCleanup(unsubscribe);\n },\n { immediate: true },\n );\n\n return { entries };\n};\n\nexport const useActivePlacement = (documentId: MaybeRefOrGetter<string>) => {\n const { provides } = useSignatureCapability();\n const activePlacement = ref<ActivePlacementInfo | null>(null);\n\n watch(\n [provides, () => toValue(documentId)],\n ([capability, docId], _, onCleanup) => {\n if (!capability || !docId) {\n activePlacement.value = null;\n return;\n }\n\n const scope = capability.forDocument(docId);\n activePlacement.value = scope.getActivePlacement();\n const unsubscribe = scope.onActivePlacementChange((placement) => {\n activePlacement.value = placement;\n });\n onCleanup(unsubscribe);\n },\n { immediate: true },\n );\n\n return activePlacement;\n};\n","import { ref, type Ref } from 'vue';\nimport { SignatureStampFieldDefinition, SignatureCreationType } from '@embedpdf/plugin-signature';\n\nexport interface UseSignatureUploadOptions {\n accept?: string;\n onResult: (result: SignatureStampFieldDefinition | null) => void;\n}\n\nexport interface UseSignatureUploadReturn {\n inputRef: Ref<HTMLInputElement | null>;\n openFilePicker: () => void;\n processFile: (file: File) => void;\n handleFileInputChange: (e: Event) => void;\n handleDrop: (e: DragEvent) => void;\n handleDragOver: (e: DragEvent) => void;\n handleDragLeave: () => void;\n previewUrl: Ref<string | null>;\n isDragging: Ref<boolean>;\n clear: () => void;\n accept: string;\n}\n\nexport function useSignatureUpload({\n accept = 'image/png,image/jpeg,image/svg+xml',\n onResult,\n}: UseSignatureUploadOptions): UseSignatureUploadReturn {\n const inputRef = ref<HTMLInputElement | null>(null);\n const previewUrl = ref<string | null>(null);\n const isDragging = ref(false);\n\n function processFile(file: File) {\n const reader = new FileReader();\n reader.onload = () => {\n const arrayBuffer = reader.result as ArrayBuffer;\n const blob = new Blob([arrayBuffer], { type: file.type });\n const dataUrl = URL.createObjectURL(blob);\n\n if (previewUrl.value) URL.revokeObjectURL(previewUrl.value);\n previewUrl.value = dataUrl;\n\n const img = new Image();\n img.onload = () => {\n const previewCanvas = document.createElement('canvas');\n previewCanvas.width = img.width;\n previewCanvas.height = img.height;\n const ctx = previewCanvas.getContext('2d');\n if (ctx) {\n ctx.drawImage(img, 0, 0);\n }\n\n const result: SignatureStampFieldDefinition = {\n creationType: SignatureCreationType.Upload,\n imageMimeType: file.type,\n imageSize: { width: img.width, height: img.height },\n previewDataUrl: previewCanvas.toDataURL('image/png'),\n imageData: arrayBuffer,\n };\n onResult(result);\n };\n img.src = dataUrl;\n };\n reader.readAsArrayBuffer(file);\n }\n\n function handleFileInputChange(e: Event) {\n const files = (e.target as HTMLInputElement).files;\n if (files && files[0]) {\n processFile(files[0]);\n }\n }\n\n function handleDrop(e: DragEvent) {\n e.preventDefault();\n isDragging.value = false;\n const files = e.dataTransfer?.files;\n if (files && files[0]) {\n processFile(files[0]);\n }\n }\n\n function handleDragOver(e: DragEvent) {\n e.preventDefault();\n isDragging.value = true;\n }\n\n function handleDragLeave() {\n isDragging.value = false;\n }\n\n function openFilePicker() {\n inputRef.value?.click();\n }\n\n function clear() {\n if (previewUrl.value) URL.revokeObjectURL(previewUrl.value);\n previewUrl.value = null;\n onResult(null);\n if (inputRef.value) {\n inputRef.value.value = '';\n }\n }\n\n return {\n inputRef,\n openFilePicker,\n processFile,\n handleFileInputChange,\n handleDrop,\n handleDragOver,\n handleDragLeave,\n previewUrl,\n isDragging,\n clear,\n accept,\n };\n}\n","export interface CropResult {\n canvas: HTMLCanvasElement;\n bounds: { x: number; y: number; width: number; height: number };\n}\n\n/**\n * Scans a canvas for non-transparent pixels and returns a tightly cropped copy.\n * Returns null if the canvas has no visible content.\n */\nexport function cropCanvas(source: HTMLCanvasElement, padding = 4): CropResult | null {\n const ctx = source.getContext('2d');\n if (!ctx) return null;\n\n const { width, height } = source;\n if (width === 0 || height === 0) return null;\n\n const imageData = ctx.getImageData(0, 0, width, height);\n const { data } = imageData;\n\n let minX = width;\n let minY = height;\n let maxX = 0;\n let maxY = 0;\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const alpha = data[(y * width + x) * 4 + 3];\n if (alpha > 0) {\n if (x < minX) minX = x;\n if (x > maxX) maxX = x;\n if (y < minY) minY = y;\n if (y > maxY) maxY = y;\n }\n }\n }\n\n if (maxX < minX || maxY < minY) return null;\n\n const cropX = Math.max(0, minX - padding);\n const cropY = Math.max(0, minY - padding);\n const cropW = Math.min(width, maxX + padding + 1) - cropX;\n const cropH = Math.min(height, maxY + padding + 1) - cropY;\n\n const cropped = document.createElement('canvas');\n cropped.width = cropW;\n cropped.height = cropH;\n\n const croppedCtx = cropped.getContext('2d');\n if (!croppedCtx) return null;\n\n croppedCtx.drawImage(source, cropX, cropY, cropW, cropH, 0, 0, cropW, cropH);\n\n return {\n canvas: cropped,\n bounds: { x: cropX, y: cropY, width: cropW, height: cropH },\n };\n}\n","<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onUnmounted } from 'vue';\nimport { SignatureInkFieldDefinition, SignatureCreationType } from '@embedpdf/plugin-signature';\nimport { cropCanvas } from '../../shared/components/crop-canvas';\n\nconst props = withDefaults(\n defineProps<{\n onResult: (result: SignatureInkFieldDefinition | null) => void;\n strokeColor?: string;\n strokeWidth?: number;\n }>(),\n {\n strokeColor: '#000000',\n strokeWidth: 4,\n },\n);\n\nconst canvasRef = ref<HTMLCanvasElement | null>(null);\nconst strokes = ref<Array<{ points: Array<{ x: number; y: number }> }>>([]);\nlet isDrawing = false;\nlet size = { width: 0, height: 0 };\nconst dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;\nlet observer: ResizeObserver | null = null;\n\nfunction getCanvasPos(e: PointerEvent): { x: number; y: number } {\n const canvas = canvasRef.value;\n if (!canvas) return { x: 0, y: 0 };\n const rect = canvas.getBoundingClientRect();\n return {\n x: (e.clientX - rect.left) * (canvas.width / dpr / rect.width),\n y: (e.clientY - rect.top) * (canvas.height / dpr / rect.height),\n };\n}\n\nfunction redraw(currentStrokes: Array<{ points: Array<{ x: number; y: number }> }>) {\n const canvas = canvasRef.value;\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.save();\n ctx.scale(dpr, dpr);\n ctx.strokeStyle = props.strokeColor;\n ctx.lineWidth = props.strokeWidth;\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n\n for (const stroke of currentStrokes) {\n if (stroke.points.length === 0) continue;\n ctx.beginPath();\n ctx.moveTo(stroke.points[0].x, stroke.points[0].y);\n for (let i = 1; i < stroke.points.length; i++) {\n ctx.lineTo(stroke.points[i].x, stroke.points[i].y);\n }\n ctx.stroke();\n }\n ctx.restore();\n}\n\nfunction emitResult(currentStrokes: Array<{ points: Array<{ x: number; y: number }> }>) {\n if (currentStrokes.length === 0 || currentStrokes.every((s) => s.points.length < 2)) {\n props.onResult(null);\n return;\n }\n\n const canvas = canvasRef.value;\n if (!canvas) return;\n\n const cropped = cropCanvas(canvas, Math.ceil(props.strokeWidth * dpr));\n if (!cropped) {\n props.onResult(null);\n return;\n }\n\n const offsetX = cropped.bounds.x / dpr;\n const offsetY = cropped.bounds.y / dpr;\n const croppedWidth = Math.round(cropped.bounds.width / dpr);\n const croppedHeight = Math.round(cropped.bounds.height / dpr);\n\n const result: SignatureInkFieldDefinition = {\n creationType: SignatureCreationType.Draw,\n inkData: {\n inkList: currentStrokes\n .filter((s) => s.points.length >= 2)\n .map((s) => ({\n points: s.points.map((p) => ({\n x: p.x - offsetX,\n y: p.y - offsetY,\n })),\n })),\n strokeWidth: props.strokeWidth,\n strokeColor: props.strokeColor,\n size: { width: croppedWidth, height: croppedHeight },\n },\n previewDataUrl: cropped.canvas.toDataURL('image/png'),\n };\n\n props.onResult(result);\n}\n\nfunction clear() {\n strokes.value = [];\n redraw([]);\n props.onResult(null);\n}\n\ndefineExpose({ clear });\n\nfunction handlePointerDown(e: PointerEvent) {\n isDrawing = true;\n const pos = getCanvasPos(e);\n strokes.value = [...strokes.value, { points: [pos] }];\n redraw(strokes.value);\n (e.target as HTMLElement)?.setPointerCapture?.(e.pointerId);\n}\n\nfunction handlePointerMove(e: PointerEvent) {\n if (!isDrawing) return;\n const pos = getCanvasPos(e);\n const last = strokes.value[strokes.value.length - 1];\n if (last) {\n last.points.push(pos);\n strokes.value = [...strokes.value];\n redraw(strokes.value);\n }\n}\n\nfunction handlePointerUp(e: PointerEvent) {\n isDrawing = false;\n (e.target as HTMLElement)?.releasePointerCapture?.(e.pointerId);\n emitResult(strokes.value);\n}\n\nwatch([() => props.strokeColor, () => props.strokeWidth], () => {\n redraw(strokes.value);\n if (strokes.value.length > 0 && strokes.value.some((s) => s.points.length >= 2)) {\n emitResult(strokes.value);\n }\n});\n\nonMounted(() => {\n const canvas = canvasRef.value;\n if (!canvas) return;\n observer = new ResizeObserver((entries) => {\n const { width: w, height: h } = entries[0].contentRect;\n if (w > 0 && h > 0 && canvasRef.value) {\n size = { width: Math.round(w), height: Math.round(h) };\n canvasRef.value.width = Math.round(w) * dpr;\n canvasRef.value.height = Math.round(h) * dpr;\n redraw(strokes.value);\n }\n });\n observer.observe(canvas);\n});\n\nonUnmounted(() => {\n observer?.disconnect();\n});\n</script>\n\n<template>\n <canvas\n ref=\"canvasRef\"\n :style=\"{ touchAction: 'none', width: '100%', height: '100%', display: 'block' }\"\n @pointerdown=\"handlePointerDown\"\n @pointermove=\"handlePointerMove\"\n @pointerup=\"handlePointerUp\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onUnmounted, computed } from 'vue';\nimport { SignatureStampFieldDefinition, SignatureCreationType } from '@embedpdf/plugin-signature';\nimport { cropCanvas } from '../../shared/components/crop-canvas';\n\nconst props = withDefaults(\n defineProps<{\n onResult: (result: SignatureStampFieldDefinition | null) => void;\n fontFamily?: string;\n fontSize?: number;\n color?: string;\n placeholder?: string;\n }>(),\n {\n fontFamily: \"'Dancing Script', cursive\",\n fontSize: 48,\n color: '#000000',\n placeholder: 'Type your signature...',\n },\n);\n\nconst wrapperRef = ref<HTMLDivElement | null>(null);\nconst canvasRef = ref<HTMLCanvasElement | null>(null);\nconst text = ref('');\nconst inputId = `sig-type-${Math.random().toString(36).slice(2, 8)}`;\nlet size = { width: 0, height: 0 };\nconst dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;\nlet observer: ResizeObserver | null = null;\n\nconst placeholderStyle = computed(\n () => `#${inputId}::placeholder { color: ${props.color}; opacity: 0.5; }`,\n);\n\nconst inputStyle = computed(() => ({\n fontFamily: props.fontFamily,\n fontSize: `${Math.min(props.fontSize, 32)}px`,\n color: props.color,\n width: '100%',\n height: '100%',\n border: 'none',\n outline: 'none',\n background: 'transparent',\n textIndent: '8px',\n}));\n\nfunction renderText(currentText: string) {\n const canvas = canvasRef.value;\n if (!canvas) return;\n\n const { width, height } = size;\n if (width === 0 || height === 0) return;\n\n canvas.width = width * dpr;\n canvas.height = height * dpr;\n\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n if (!currentText.trim()) {\n props.onResult(null);\n return;\n }\n\n ctx.scale(dpr, dpr);\n ctx.fillStyle = props.color;\n ctx.font = `${props.fontSize}px ${props.fontFamily}`;\n ctx.textBaseline = 'middle';\n ctx.textAlign = 'center';\n ctx.fillText(currentText, width / 2, height / 2, width - 20);\n\n const cropped = cropCanvas(canvas, Math.ceil(4 * dpr));\n if (!cropped) {\n props.onResult(null);\n return;\n }\n\n const croppedWidth = Math.round(cropped.bounds.width / dpr);\n const croppedHeight = Math.round(cropped.bounds.height / dpr);\n\n cropped.canvas.toBlob((blob) => {\n if (!blob) return;\n blob.arrayBuffer().then((imageData) => {\n const result: SignatureStampFieldDefinition = {\n creationType: SignatureCreationType.Type,\n label: currentText,\n imageMimeType: 'image/png',\n imageSize: { width: croppedWidth, height: croppedHeight },\n previewDataUrl: cropped.canvas.toDataURL('image/png'),\n imageData,\n };\n props.onResult(result);\n });\n }, 'image/png');\n}\n\nfunction clear() {\n text.value = '';\n props.onResult(null);\n}\n\ndefineExpose({ clear });\n\nfunction handleInput(e: Event) {\n text.value = (e.target as HTMLInputElement).value;\n}\n\nwatch([text, () => props.fontFamily, () => props.color], () => {\n renderText(text.value);\n});\n\nonMounted(() => {\n const wrapper = wrapperRef.value;\n if (!wrapper) return;\n observer = new ResizeObserver((entries) => {\n const { width: w, height: h } = entries[0].contentRect;\n if (w > 0 && h > 0) {\n size = { width: Math.round(w), height: Math.round(h) };\n renderText(text.value);\n }\n });\n observer.observe(wrapper);\n});\n\nonUnmounted(() => {\n observer?.disconnect();\n});\n</script>\n\n<template>\n <div ref=\"wrapperRef\" :style=\"{ width: '100%', height: '100%' }\">\n <component is=\"style\" v-text=\"placeholderStyle\" />\n <input\n :id=\"inputId\"\n type=\"text\"\n :value=\"text\"\n @input=\"handleInput\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n />\n <canvas ref=\"canvasRef\" :style=\"{ display: 'none' }\" />\n </div>\n</template>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { SignaturePluginPackage as BaseSignaturePackage } from '@embedpdf/plugin-signature';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-signature';\n\nexport const SignaturePluginPackage = createPluginPackage(BaseSignaturePackage).build();\n"],"names":["_createElementBlock","_createBlock","_resolveDynamicComponent","_toDisplayString","_createElementVNode","BaseSignaturePackage"],"mappings":";;;;;AAIO,MAAM,qBAAqB,MAAM,UAA2B,gBAAgB,EAAE;AAC9E,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;AAEtF,MAAM,sBAAsB,MAAM;AACvC,QAAM,EAAE,SAAA,IAAa,uBAAA;AACrB,QAAM,UAAU,IAAsB,EAAE;AAExC;AAAA,IACE;AAAA,IACA,CAAC,YAAY,GAAG,cAAc;AAC5B,UAAI,CAAC,YAAY;AACf,gBAAQ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./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./preact": {
16
+ "types": "./dist/preact/index.d.ts",
17
+ "import": "./dist/preact/index.js",
18
+ "require": "./dist/preact/index.cjs"
19
+ },
20
+ "./react": {
21
+ "types": "./dist/react/index.d.ts",
22
+ "import": "./dist/react/index.js",
23
+ "require": "./dist/react/index.cjs"
24
+ },
25
+ "./vue": {
26
+ "types": "./dist/vue/index.d.ts",
27
+ "import": "./dist/vue/index.js",
28
+ "require": "./dist/vue/index.cjs"
29
+ },
30
+ "./svelte": {
31
+ "types": "./dist/svelte/index.d.ts",
32
+ "import": "./dist/svelte/index.js",
33
+ "require": "./dist/svelte/index.cjs"
34
+ }
35
+ },
36
+ "dependencies": {
37
+ "@embedpdf/models": "2.13.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/react": "^18.2.0",
41
+ "typescript": "^5.0.0",
42
+ "@embedpdf/build": "1.1.0",
43
+ "@embedpdf/core": "2.13.0",
44
+ "@embedpdf/plugin-annotation": "2.13.0"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=16.8.0",
48
+ "react-dom": ">=16.8.0",
49
+ "preact": "^10.26.4",
50
+ "vue": ">=3.2.0",
51
+ "svelte": ">=5 <6",
52
+ "@embedpdf/core": "2.13.0",
53
+ "@embedpdf/plugin-annotation": "2.13.0"
54
+ },
55
+ "files": [
56
+ "dist",
57
+ "README.md"
58
+ ],
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/embedpdf/embed-pdf-viewer",
62
+ "directory": "packages/plugin-signature"
63
+ },
64
+ "homepage": "https://www.embedpdf.com/docs",
65
+ "bugs": {
66
+ "url": "https://github.com/embedpdf/embed-pdf-viewer/issues"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ },
71
+ "scripts": {
72
+ "build:base": "vite build --mode base",
73
+ "build:react": "vite build --mode react",
74
+ "build:preact": "vite build --mode preact",
75
+ "build:vue": "vite build --mode vue",
76
+ "build:svelte": "vite build --mode svelte",
77
+ "build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue,svelte \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\" \"vite build --mode svelte\"",
78
+ "clean": "rimraf dist",
79
+ "lint": "eslint src --color",
80
+ "lint:fix": "eslint src --color --fix"
81
+ }
82
+ }