@incodetech/web 0.0.0-dev-20260402-682edb5 → 0.0.0-dev-20260402-43cf9b8
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/signature/signature.es.js +634 -164
- package/package.json +4 -3
|
@@ -1,238 +1,708 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var L = (o, n, t) => n in o ? O(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
|
|
3
|
+
var g = (o, n, t) => L(o, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { u as w, I, b as B, a as A, S as k, B as T } from "../button-DXIWeie9.js";
|
|
5
|
+
import { D as R, A as P, q as W, F, y as E, d as N, T as z } from "../vendor-preact-BoMmvSgn.js";
|
|
3
6
|
import "@incodetech/core";
|
|
4
7
|
import "../uiConfig-DmIn-g8M.js";
|
|
5
|
-
import { P } from "../page-D4OThpFS.js";
|
|
6
|
-
import { r as
|
|
7
|
-
import {
|
|
8
|
-
import { S as
|
|
9
|
-
import { f as
|
|
10
|
-
|
|
8
|
+
import { P as M } from "../page-D4OThpFS.js";
|
|
9
|
+
import { r as $ } from "../incodeModule-C4XIllao.js";
|
|
10
|
+
import { createSignatureManager as G } from "@incodetech/core/signature";
|
|
11
|
+
import { S as V } from "../successIcon-BZphSsQr.js";
|
|
12
|
+
import { f as q } from "../typography-CBPoLoAP.js";
|
|
13
|
+
var b = class {
|
|
14
|
+
constructor(o, n, t, e) {
|
|
15
|
+
g(this, "x");
|
|
16
|
+
g(this, "y");
|
|
17
|
+
g(this, "pressure");
|
|
18
|
+
g(this, "time");
|
|
19
|
+
if (isNaN(o) || isNaN(n))
|
|
20
|
+
throw new Error(`Point is invalid: (${o}, ${n})`);
|
|
21
|
+
this.x = +o, this.y = +n, this.pressure = t || 0, this.time = e || Date.now();
|
|
22
|
+
}
|
|
23
|
+
distanceTo(o) {
|
|
24
|
+
return Math.sqrt(
|
|
25
|
+
Math.pow(this.x - o.x, 2) + Math.pow(this.y - o.y, 2)
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
equals(o) {
|
|
29
|
+
return this.x === o.x && this.y === o.y && this.pressure === o.pressure && this.time === o.time;
|
|
30
|
+
}
|
|
31
|
+
velocityFrom(o) {
|
|
32
|
+
return this.time !== o.time ? this.distanceTo(o) / (this.time - o.time) : 0;
|
|
33
|
+
}
|
|
34
|
+
}, H = class D {
|
|
35
|
+
constructor(n, t, e, i, s, a) {
|
|
36
|
+
this.startPoint = n, this.control2 = t, this.control1 = e, this.endPoint = i, this.startWidth = s, this.endWidth = a;
|
|
37
|
+
}
|
|
38
|
+
static fromPoints(n, t) {
|
|
39
|
+
const e = this.calculateControlPoints(n[0], n[1], n[2]).c2, i = this.calculateControlPoints(n[1], n[2], n[3]).c1;
|
|
40
|
+
return new D(n[1], e, i, n[2], t.start, t.end);
|
|
41
|
+
}
|
|
42
|
+
static calculateControlPoints(n, t, e) {
|
|
43
|
+
const i = n.x - t.x, s = n.y - t.y, a = t.x - e.x, l = t.y - e.y, h = { x: (n.x + t.x) / 2, y: (n.y + t.y) / 2 }, c = { x: (t.x + e.x) / 2, y: (t.y + e.y) / 2 }, d = Math.sqrt(i * i + s * s), r = Math.sqrt(a * a + l * l), u = h.x - c.x, f = h.y - c.y, _ = d + r == 0 ? 0 : r / (d + r), v = { x: c.x + u * _, y: c.y + f * _ }, m = t.x - v.x, y = t.y - v.y;
|
|
44
|
+
return {
|
|
45
|
+
c1: new b(h.x + m, h.y + y),
|
|
46
|
+
c2: new b(c.x + m, c.y + y)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// Returns approximated length. Code taken from https://www.lemoda.net/maths/bezier-length/index.html.
|
|
50
|
+
length() {
|
|
51
|
+
let t = 0, e, i;
|
|
52
|
+
for (let s = 0; s <= 10; s += 1) {
|
|
53
|
+
const a = s / 10, l = this.point(
|
|
54
|
+
a,
|
|
55
|
+
this.startPoint.x,
|
|
56
|
+
this.control1.x,
|
|
57
|
+
this.control2.x,
|
|
58
|
+
this.endPoint.x
|
|
59
|
+
), h = this.point(
|
|
60
|
+
a,
|
|
61
|
+
this.startPoint.y,
|
|
62
|
+
this.control1.y,
|
|
63
|
+
this.control2.y,
|
|
64
|
+
this.endPoint.y
|
|
65
|
+
);
|
|
66
|
+
if (s > 0) {
|
|
67
|
+
const c = l - e, d = h - i;
|
|
68
|
+
t += Math.sqrt(c * c + d * d);
|
|
69
|
+
}
|
|
70
|
+
e = l, i = h;
|
|
71
|
+
}
|
|
72
|
+
return t;
|
|
73
|
+
}
|
|
74
|
+
// Calculate parametric value of x or y given t and the four point coordinates of a cubic bezier curve.
|
|
75
|
+
point(n, t, e, i, s) {
|
|
76
|
+
return t * (1 - n) * (1 - n) * (1 - n) + 3 * e * (1 - n) * (1 - n) * n + 3 * i * (1 - n) * n * n + s * n * n * n;
|
|
77
|
+
}
|
|
78
|
+
}, j = class {
|
|
79
|
+
/* tslint:enable: variable-name */
|
|
80
|
+
constructor() {
|
|
81
|
+
/* tslint:disable: variable-name */
|
|
82
|
+
g(this, "_et");
|
|
83
|
+
try {
|
|
84
|
+
this._et = new EventTarget();
|
|
85
|
+
} catch {
|
|
86
|
+
this._et = document;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
addEventListener(o, n, t) {
|
|
90
|
+
this._et.addEventListener(o, n, t);
|
|
91
|
+
}
|
|
92
|
+
dispatchEvent(o) {
|
|
93
|
+
return this._et.dispatchEvent(o);
|
|
94
|
+
}
|
|
95
|
+
removeEventListener(o, n, t) {
|
|
96
|
+
this._et.removeEventListener(o, n, t);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function X(o, n = 250) {
|
|
100
|
+
let t = 0, e = null, i, s, a;
|
|
101
|
+
const l = () => {
|
|
102
|
+
t = Date.now(), e = null, i = o.apply(s, a), e || (s = null, a = []);
|
|
103
|
+
};
|
|
104
|
+
return function(...c) {
|
|
105
|
+
const d = Date.now(), r = n - (d - t);
|
|
106
|
+
return s = this, a = c, r <= 0 || r > n ? (e && (clearTimeout(e), e = null), t = d, i = o.apply(s, a), e || (s = null, a = [])) : e || (e = window.setTimeout(l, r)), i;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
var Y = class C extends j {
|
|
110
|
+
/* tslint:enable: variable-name */
|
|
111
|
+
constructor(t, e = {}) {
|
|
112
|
+
super();
|
|
113
|
+
// Public stuff
|
|
114
|
+
g(this, "dotSize");
|
|
115
|
+
g(this, "minWidth");
|
|
116
|
+
g(this, "maxWidth");
|
|
117
|
+
g(this, "penColor");
|
|
118
|
+
g(this, "minDistance");
|
|
119
|
+
g(this, "velocityFilterWeight");
|
|
120
|
+
g(this, "compositeOperation");
|
|
121
|
+
g(this, "backgroundColor");
|
|
122
|
+
g(this, "throttle");
|
|
123
|
+
g(this, "canvasContextOptions");
|
|
124
|
+
// Private stuff
|
|
125
|
+
/* tslint:disable: variable-name */
|
|
126
|
+
g(this, "_ctx");
|
|
127
|
+
g(this, "_drawingStroke", !1);
|
|
128
|
+
g(this, "_isEmpty", !0);
|
|
129
|
+
g(this, "_dataUrl");
|
|
130
|
+
g(this, "_dataUrlOptions");
|
|
131
|
+
g(this, "_lastPoints", []);
|
|
132
|
+
// Stores up to 4 most recent points; used to generate a new curve
|
|
133
|
+
g(this, "_data", []);
|
|
134
|
+
// Stores all points in groups (one group per line or dot)
|
|
135
|
+
g(this, "_lastVelocity", 0);
|
|
136
|
+
g(this, "_lastWidth", 0);
|
|
137
|
+
g(this, "_strokeMoveUpdate");
|
|
138
|
+
g(this, "_strokePointerId");
|
|
139
|
+
this.canvas = t, this.velocityFilterWeight = e.velocityFilterWeight || 0.7, this.minWidth = e.minWidth || 0.5, this.maxWidth = e.maxWidth || 2.5, this.throttle = e.throttle ?? 16, this.minDistance = e.minDistance ?? 5, this.dotSize = e.dotSize || 0, this.penColor = e.penColor || "black", this.backgroundColor = e.backgroundColor || "rgba(0,0,0,0)", this.compositeOperation = e.compositeOperation || "source-over", this.canvasContextOptions = e.canvasContextOptions ?? {}, this._strokeMoveUpdate = this.throttle ? X(C.prototype._strokeUpdate, this.throttle) : C.prototype._strokeUpdate, this._handleMouseDown = this._handleMouseDown.bind(this), this._handleMouseMove = this._handleMouseMove.bind(this), this._handleMouseUp = this._handleMouseUp.bind(this), this._handleTouchStart = this._handleTouchStart.bind(this), this._handleTouchMove = this._handleTouchMove.bind(this), this._handleTouchEnd = this._handleTouchEnd.bind(this), this._handlePointerDown = this._handlePointerDown.bind(this), this._handlePointerMove = this._handlePointerMove.bind(this), this._handlePointerUp = this._handlePointerUp.bind(this), this._handlePointerCancel = this._handlePointerCancel.bind(this), this._handleTouchCancel = this._handleTouchCancel.bind(this), this._ctx = t.getContext(
|
|
140
|
+
"2d",
|
|
141
|
+
this.canvasContextOptions
|
|
142
|
+
), this.clear(), this.on();
|
|
143
|
+
}
|
|
144
|
+
clear() {
|
|
145
|
+
const { _ctx: t, canvas: e } = this;
|
|
146
|
+
t.fillStyle = this.backgroundColor, t.clearRect(0, 0, e.width, e.height), t.fillRect(0, 0, e.width, e.height), this._data = [], this._reset(this._getPointGroupOptions()), this._isEmpty = !0, this._dataUrl = void 0, this._dataUrlOptions = void 0, this._strokePointerId = void 0;
|
|
147
|
+
}
|
|
148
|
+
redraw() {
|
|
149
|
+
const t = this._data, e = this._dataUrl, i = this._dataUrlOptions;
|
|
150
|
+
this.clear(), e && this.fromDataURL(e, i), this.fromData(t, { clear: !1 });
|
|
151
|
+
}
|
|
152
|
+
fromDataURL(t, e = {}) {
|
|
153
|
+
return new Promise((i, s) => {
|
|
154
|
+
const a = new Image(), l = e.ratio || window.devicePixelRatio || 1, h = e.width || this.canvas.width / l, c = e.height || this.canvas.height / l, d = e.xOffset || 0, r = e.yOffset || 0;
|
|
155
|
+
this._reset(this._getPointGroupOptions()), a.onload = () => {
|
|
156
|
+
this._ctx.drawImage(a, d, r, h, c), i();
|
|
157
|
+
}, a.onerror = (u) => {
|
|
158
|
+
s(u);
|
|
159
|
+
}, a.crossOrigin = "anonymous", a.src = t, this._isEmpty = !1, this._dataUrl = t, this._dataUrlOptions = { ...e };
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
toDataURL(t = "image/png", e) {
|
|
163
|
+
switch (t) {
|
|
164
|
+
case "image/svg+xml":
|
|
165
|
+
return typeof e != "object" && (e = void 0), `data:image/svg+xml;base64,${btoa(
|
|
166
|
+
this.toSVG(e)
|
|
167
|
+
)}`;
|
|
168
|
+
default:
|
|
169
|
+
return typeof e != "number" && (e = void 0), this.canvas.toDataURL(t, e);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
on() {
|
|
173
|
+
this.canvas.style.touchAction = "none", this.canvas.style.msTouchAction = "none", this.canvas.style.userSelect = "none", this.canvas.style.webkitUserSelect = "none";
|
|
174
|
+
const t = /Macintosh/.test(navigator.userAgent) && "ontouchstart" in document;
|
|
175
|
+
window.PointerEvent && !t ? this._handlePointerEvents() : (this._handleMouseEvents(), "ontouchstart" in window && this._handleTouchEvents());
|
|
176
|
+
}
|
|
177
|
+
off() {
|
|
178
|
+
this.canvas.style.touchAction = "auto", this.canvas.style.msTouchAction = "auto", this.canvas.style.userSelect = "auto", this.canvas.style.webkitUserSelect = "auto", this.canvas.removeEventListener("pointerdown", this._handlePointerDown), this.canvas.removeEventListener("mousedown", this._handleMouseDown), this.canvas.removeEventListener("touchstart", this._handleTouchStart), this._removeMoveUpEventListeners();
|
|
179
|
+
}
|
|
180
|
+
_getListenerFunctions() {
|
|
181
|
+
const t = window.document === this.canvas.ownerDocument ? window : this.canvas.ownerDocument.defaultView ?? this.canvas.ownerDocument;
|
|
182
|
+
return {
|
|
183
|
+
addEventListener: t.addEventListener.bind(
|
|
184
|
+
t
|
|
185
|
+
),
|
|
186
|
+
removeEventListener: t.removeEventListener.bind(
|
|
187
|
+
t
|
|
188
|
+
)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
_removeMoveUpEventListeners() {
|
|
192
|
+
const { removeEventListener: t } = this._getListenerFunctions();
|
|
193
|
+
t("pointermove", this._handlePointerMove), t("pointerup", this._handlePointerUp), t("pointercancel", this._handlePointerCancel), t("mousemove", this._handleMouseMove), t("mouseup", this._handleMouseUp), t("touchmove", this._handleTouchMove), t("touchend", this._handleTouchEnd), t("touchcancel", this._handleTouchCancel);
|
|
194
|
+
}
|
|
195
|
+
isEmpty() {
|
|
196
|
+
return this._isEmpty;
|
|
197
|
+
}
|
|
198
|
+
fromData(t, { clear: e = !0 } = {}) {
|
|
199
|
+
e && this.clear(), this._fromData(
|
|
200
|
+
t,
|
|
201
|
+
this._drawCurve.bind(this),
|
|
202
|
+
this._drawDot.bind(this)
|
|
203
|
+
), this._data = this._data.concat(t);
|
|
204
|
+
}
|
|
205
|
+
toData() {
|
|
206
|
+
return this._data;
|
|
207
|
+
}
|
|
208
|
+
_isLeftButtonPressed(t, e) {
|
|
209
|
+
return e ? t.buttons === 1 : (t.buttons & 1) === 1;
|
|
210
|
+
}
|
|
211
|
+
_pointerEventToSignatureEvent(t) {
|
|
212
|
+
return {
|
|
213
|
+
event: t,
|
|
214
|
+
type: t.type,
|
|
215
|
+
x: t.clientX,
|
|
216
|
+
y: t.clientY,
|
|
217
|
+
pressure: "pressure" in t ? t.pressure : 0
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
_touchEventToSignatureEvent(t) {
|
|
221
|
+
const e = t.changedTouches[0];
|
|
222
|
+
return {
|
|
223
|
+
event: t,
|
|
224
|
+
type: t.type,
|
|
225
|
+
x: e.clientX,
|
|
226
|
+
y: e.clientY,
|
|
227
|
+
pressure: e.force
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
// Event handlers
|
|
231
|
+
_handleMouseDown(t) {
|
|
232
|
+
!this._isLeftButtonPressed(t, !0) || this._drawingStroke || this._strokeBegin(this._pointerEventToSignatureEvent(t));
|
|
233
|
+
}
|
|
234
|
+
_handleMouseMove(t) {
|
|
235
|
+
if (!this._isLeftButtonPressed(t, !0) || !this._drawingStroke) {
|
|
236
|
+
this._strokeEnd(this._pointerEventToSignatureEvent(t), !1);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t));
|
|
240
|
+
}
|
|
241
|
+
_handleMouseUp(t) {
|
|
242
|
+
this._isLeftButtonPressed(t) || this._strokeEnd(this._pointerEventToSignatureEvent(t));
|
|
243
|
+
}
|
|
244
|
+
_handleTouchStart(t) {
|
|
245
|
+
t.targetTouches.length !== 1 || this._drawingStroke || (t.cancelable && t.preventDefault(), this._strokeBegin(this._touchEventToSignatureEvent(t)));
|
|
246
|
+
}
|
|
247
|
+
_handleTouchMove(t) {
|
|
248
|
+
if (t.targetTouches.length === 1) {
|
|
249
|
+
if (t.cancelable && t.preventDefault(), !this._drawingStroke) {
|
|
250
|
+
this._strokeEnd(this._touchEventToSignatureEvent(t), !1);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this._strokeMoveUpdate(this._touchEventToSignatureEvent(t));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
_handleTouchEnd(t) {
|
|
257
|
+
t.targetTouches.length === 0 && (t.cancelable && t.preventDefault(), this._strokeEnd(this._touchEventToSignatureEvent(t)));
|
|
258
|
+
}
|
|
259
|
+
_handlePointerCancel(t) {
|
|
260
|
+
this._allowPointerId(t) && (t.preventDefault(), this._strokeEnd(this._pointerEventToSignatureEvent(t), !1));
|
|
261
|
+
}
|
|
262
|
+
_handleTouchCancel(t) {
|
|
263
|
+
t.cancelable && t.preventDefault(), this._strokeEnd(this._touchEventToSignatureEvent(t), !1);
|
|
264
|
+
}
|
|
265
|
+
_getPointerId(t) {
|
|
266
|
+
return t.persistentDeviceId || t.pointerId;
|
|
267
|
+
}
|
|
268
|
+
_allowPointerId(t, e = !1) {
|
|
269
|
+
return typeof this._strokePointerId > "u" ? e : this._getPointerId(t) === this._strokePointerId;
|
|
270
|
+
}
|
|
271
|
+
_handlePointerDown(t) {
|
|
272
|
+
this._drawingStroke || !this._isLeftButtonPressed(t) || !this._allowPointerId(t, !0) || (this._strokePointerId = this._getPointerId(t), t.preventDefault(), this._strokeBegin(this._pointerEventToSignatureEvent(t)));
|
|
273
|
+
}
|
|
274
|
+
_handlePointerMove(t) {
|
|
275
|
+
if (this._allowPointerId(t)) {
|
|
276
|
+
if (!this._isLeftButtonPressed(t, !0) || !this._drawingStroke) {
|
|
277
|
+
this._strokeEnd(this._pointerEventToSignatureEvent(t), !1);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
t.preventDefault(), this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
_handlePointerUp(t) {
|
|
284
|
+
this._isLeftButtonPressed(t) || !this._allowPointerId(t) || (t.preventDefault(), this._strokeEnd(this._pointerEventToSignatureEvent(t)));
|
|
285
|
+
}
|
|
286
|
+
_getPointGroupOptions(t) {
|
|
287
|
+
return {
|
|
288
|
+
penColor: t && "penColor" in t ? t.penColor : this.penColor,
|
|
289
|
+
dotSize: t && "dotSize" in t ? t.dotSize : this.dotSize,
|
|
290
|
+
minWidth: t && "minWidth" in t ? t.minWidth : this.minWidth,
|
|
291
|
+
maxWidth: t && "maxWidth" in t ? t.maxWidth : this.maxWidth,
|
|
292
|
+
velocityFilterWeight: t && "velocityFilterWeight" in t ? t.velocityFilterWeight : this.velocityFilterWeight,
|
|
293
|
+
compositeOperation: t && "compositeOperation" in t ? t.compositeOperation : this.compositeOperation
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
// Private methods
|
|
297
|
+
_strokeBegin(t) {
|
|
298
|
+
if (!this.dispatchEvent(
|
|
299
|
+
new CustomEvent("beginStroke", { detail: t, cancelable: !0 })
|
|
300
|
+
))
|
|
301
|
+
return;
|
|
302
|
+
const { addEventListener: i } = this._getListenerFunctions();
|
|
303
|
+
switch (t.event.type) {
|
|
304
|
+
case "mousedown":
|
|
305
|
+
i("mousemove", this._handleMouseMove, {
|
|
306
|
+
passive: !1
|
|
307
|
+
}), i("mouseup", this._handleMouseUp, { passive: !1 });
|
|
308
|
+
break;
|
|
309
|
+
case "touchstart":
|
|
310
|
+
i("touchmove", this._handleTouchMove, {
|
|
311
|
+
passive: !1
|
|
312
|
+
}), i("touchend", this._handleTouchEnd, { passive: !1 }), i("touchcancel", this._handleTouchCancel, { passive: !1 });
|
|
313
|
+
break;
|
|
314
|
+
case "pointerdown":
|
|
315
|
+
i("pointermove", this._handlePointerMove, {
|
|
316
|
+
passive: !1
|
|
317
|
+
}), i("pointerup", this._handlePointerUp, {
|
|
318
|
+
passive: !1
|
|
319
|
+
}), i("pointercancel", this._handlePointerCancel, {
|
|
320
|
+
passive: !1
|
|
321
|
+
});
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
this._drawingStroke = !0;
|
|
325
|
+
const s = this._getPointGroupOptions(), a = {
|
|
326
|
+
...s,
|
|
327
|
+
points: []
|
|
328
|
+
};
|
|
329
|
+
this._data.push(a), this._reset(s), this._strokeUpdate(t);
|
|
330
|
+
}
|
|
331
|
+
_strokeUpdate(t) {
|
|
332
|
+
if (!this._drawingStroke)
|
|
333
|
+
return;
|
|
334
|
+
if (this._data.length === 0) {
|
|
335
|
+
this._strokeBegin(t);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
this.dispatchEvent(
|
|
339
|
+
new CustomEvent("beforeUpdateStroke", { detail: t })
|
|
340
|
+
);
|
|
341
|
+
const e = this._createPoint(t.x, t.y, t.pressure), i = this._data[this._data.length - 1], s = i.points, a = s.length > 0 && s[s.length - 1], l = a ? e.distanceTo(a) <= this.minDistance : !1, h = this._getPointGroupOptions(i);
|
|
342
|
+
if (!a || !(a && l)) {
|
|
343
|
+
const c = this._addPoint(e, h);
|
|
344
|
+
a ? c && this._drawCurve(c, h) : this._drawDot(e, h), s.push({
|
|
345
|
+
time: e.time,
|
|
346
|
+
x: e.x,
|
|
347
|
+
y: e.y,
|
|
348
|
+
pressure: e.pressure
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
this.dispatchEvent(new CustomEvent("afterUpdateStroke", { detail: t }));
|
|
352
|
+
}
|
|
353
|
+
_strokeEnd(t, e = !0) {
|
|
354
|
+
this._removeMoveUpEventListeners(), this._drawingStroke && (e && this._strokeUpdate(t), this._drawingStroke = !1, this._strokePointerId = void 0, this.dispatchEvent(new CustomEvent("endStroke", { detail: t })));
|
|
355
|
+
}
|
|
356
|
+
_handlePointerEvents() {
|
|
357
|
+
this._drawingStroke = !1, this.canvas.addEventListener("pointerdown", this._handlePointerDown, {
|
|
358
|
+
passive: !1
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
_handleMouseEvents() {
|
|
362
|
+
this._drawingStroke = !1, this.canvas.addEventListener("mousedown", this._handleMouseDown, {
|
|
363
|
+
passive: !1
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
_handleTouchEvents() {
|
|
367
|
+
this.canvas.addEventListener("touchstart", this._handleTouchStart, {
|
|
368
|
+
passive: !1
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
// Called when a new line is started
|
|
372
|
+
_reset(t) {
|
|
373
|
+
this._lastPoints = [], this._lastVelocity = 0, this._lastWidth = (t.minWidth + t.maxWidth) / 2, this._ctx.fillStyle = t.penColor, this._ctx.globalCompositeOperation = t.compositeOperation;
|
|
374
|
+
}
|
|
375
|
+
_createPoint(t, e, i) {
|
|
376
|
+
const s = this.canvas.getBoundingClientRect();
|
|
377
|
+
return new b(
|
|
378
|
+
t - s.left,
|
|
379
|
+
e - s.top,
|
|
380
|
+
i,
|
|
381
|
+
(/* @__PURE__ */ new Date()).getTime()
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
// Add point to _lastPoints array and generate a new curve if there are enough points (i.e. 3)
|
|
385
|
+
_addPoint(t, e) {
|
|
386
|
+
const { _lastPoints: i } = this;
|
|
387
|
+
if (i.push(t), i.length > 2) {
|
|
388
|
+
i.length === 3 && i.unshift(i[0]);
|
|
389
|
+
const s = this._calculateCurveWidths(
|
|
390
|
+
i[1],
|
|
391
|
+
i[2],
|
|
392
|
+
e
|
|
393
|
+
), a = H.fromPoints(i, s);
|
|
394
|
+
return i.shift(), a;
|
|
395
|
+
}
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
_calculateCurveWidths(t, e, i) {
|
|
399
|
+
const s = i.velocityFilterWeight * e.velocityFrom(t) + (1 - i.velocityFilterWeight) * this._lastVelocity, a = this._strokeWidth(s, i), l = {
|
|
400
|
+
end: a,
|
|
401
|
+
start: this._lastWidth
|
|
402
|
+
};
|
|
403
|
+
return this._lastVelocity = s, this._lastWidth = a, l;
|
|
404
|
+
}
|
|
405
|
+
_strokeWidth(t, e) {
|
|
406
|
+
return Math.max(e.maxWidth / (t + 1), e.minWidth);
|
|
407
|
+
}
|
|
408
|
+
_drawCurveSegment(t, e, i) {
|
|
409
|
+
const s = this._ctx;
|
|
410
|
+
s.moveTo(t, e), s.arc(t, e, i, 0, 2 * Math.PI, !1), this._isEmpty = !1;
|
|
411
|
+
}
|
|
412
|
+
_drawCurve(t, e) {
|
|
413
|
+
const i = this._ctx, s = t.endWidth - t.startWidth, a = Math.ceil(t.length()) * 2;
|
|
414
|
+
i.beginPath(), i.fillStyle = e.penColor;
|
|
415
|
+
for (let l = 0; l < a; l += 1) {
|
|
416
|
+
const h = l / a, c = h * h, d = c * h, r = 1 - h, u = r * r, f = u * r;
|
|
417
|
+
let _ = f * t.startPoint.x;
|
|
418
|
+
_ += 3 * u * h * t.control1.x, _ += 3 * r * c * t.control2.x, _ += d * t.endPoint.x;
|
|
419
|
+
let v = f * t.startPoint.y;
|
|
420
|
+
v += 3 * u * h * t.control1.y, v += 3 * r * c * t.control2.y, v += d * t.endPoint.y;
|
|
421
|
+
const m = Math.min(
|
|
422
|
+
t.startWidth + d * s,
|
|
423
|
+
e.maxWidth
|
|
424
|
+
);
|
|
425
|
+
this._drawCurveSegment(_, v, m);
|
|
426
|
+
}
|
|
427
|
+
i.closePath(), i.fill();
|
|
428
|
+
}
|
|
429
|
+
_drawDot(t, e) {
|
|
430
|
+
const i = this._ctx, s = e.dotSize > 0 ? e.dotSize : (e.minWidth + e.maxWidth) / 2;
|
|
431
|
+
i.beginPath(), this._drawCurveSegment(t.x, t.y, s), i.closePath(), i.fillStyle = e.penColor, i.fill();
|
|
432
|
+
}
|
|
433
|
+
_fromData(t, e, i) {
|
|
434
|
+
for (const s of t) {
|
|
435
|
+
const { points: a } = s, l = this._getPointGroupOptions(s);
|
|
436
|
+
if (a.length > 1)
|
|
437
|
+
for (let h = 0; h < a.length; h += 1) {
|
|
438
|
+
const c = a[h], d = new b(
|
|
439
|
+
c.x,
|
|
440
|
+
c.y,
|
|
441
|
+
c.pressure,
|
|
442
|
+
c.time
|
|
443
|
+
);
|
|
444
|
+
h === 0 && this._reset(l);
|
|
445
|
+
const r = this._addPoint(d, l);
|
|
446
|
+
r && e(r, l);
|
|
447
|
+
}
|
|
448
|
+
else
|
|
449
|
+
this._reset(l), i(a[0], l);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
toSVG({ includeBackgroundColor: t = !1, includeDataUrl: e = !1 } = {}) {
|
|
453
|
+
const i = this._data, s = Math.max(window.devicePixelRatio || 1, 1), a = 0, l = 0, h = this.canvas.width / s, c = this.canvas.height / s, d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
454
|
+
if (d.setAttribute("xmlns", "http://www.w3.org/2000/svg"), d.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), d.setAttribute("viewBox", `${a} ${l} ${h} ${c}`), d.setAttribute("width", h.toString()), d.setAttribute("height", c.toString()), t && this.backgroundColor) {
|
|
455
|
+
const r = document.createElement("rect");
|
|
456
|
+
r.setAttribute("width", "100%"), r.setAttribute("height", "100%"), r.setAttribute("fill", this.backgroundColor), d.appendChild(r);
|
|
457
|
+
}
|
|
458
|
+
if (e && this._dataUrl) {
|
|
459
|
+
const r = this._dataUrlOptions?.ratio || window.devicePixelRatio || 1, u = this._dataUrlOptions?.width || this.canvas.width / r, f = this._dataUrlOptions?.height || this.canvas.height / r, _ = this._dataUrlOptions?.xOffset || 0, v = this._dataUrlOptions?.yOffset || 0, m = document.createElement("image");
|
|
460
|
+
m.setAttribute("x", _.toString()), m.setAttribute("y", v.toString()), m.setAttribute("width", u.toString()), m.setAttribute("height", f.toString()), m.setAttribute("preserveAspectRatio", "none"), m.setAttribute("href", this._dataUrl), d.appendChild(m);
|
|
461
|
+
}
|
|
462
|
+
return this._fromData(
|
|
463
|
+
i,
|
|
464
|
+
(r, { penColor: u }) => {
|
|
465
|
+
const f = document.createElement("path");
|
|
466
|
+
if (!isNaN(r.control1.x) && !isNaN(r.control1.y) && !isNaN(r.control2.x) && !isNaN(r.control2.y)) {
|
|
467
|
+
const _ = `M ${r.startPoint.x.toFixed(3)},${r.startPoint.y.toFixed(
|
|
468
|
+
3
|
|
469
|
+
)} C ${r.control1.x.toFixed(3)},${r.control1.y.toFixed(3)} ${r.control2.x.toFixed(3)},${r.control2.y.toFixed(3)} ${r.endPoint.x.toFixed(3)},${r.endPoint.y.toFixed(3)}`;
|
|
470
|
+
f.setAttribute("d", _), f.setAttribute("stroke-width", (r.endWidth * 2.25).toFixed(3)), f.setAttribute("stroke", u), f.setAttribute("fill", "none"), f.setAttribute("stroke-linecap", "round"), d.appendChild(f);
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
(r, { penColor: u, dotSize: f, minWidth: _, maxWidth: v }) => {
|
|
474
|
+
const m = document.createElement("circle"), y = f > 0 ? f : (_ + v) / 2;
|
|
475
|
+
m.setAttribute("r", y.toString()), m.setAttribute("cx", r.x.toString()), m.setAttribute("cy", r.y.toString()), m.setAttribute("fill", u), d.appendChild(m);
|
|
476
|
+
}
|
|
477
|
+
), d.outerHTML;
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
const K = (o) => {
|
|
11
481
|
if (typeof document > "u") return null;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
if (document.body.removeChild(
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
return
|
|
482
|
+
const n = document.createElement("div");
|
|
483
|
+
n.style.color = o, n.style.position = "absolute", n.style.visibility = "hidden", document.body.appendChild(n);
|
|
484
|
+
const t = getComputedStyle(n).color;
|
|
485
|
+
if (document.body.removeChild(n), !t || t === "transparent") return null;
|
|
486
|
+
const e = t.match(/\d+/g);
|
|
487
|
+
if (e && e.length >= 3) {
|
|
488
|
+
const i = Number.parseInt(e[0], 10), s = Number.parseInt(e[1], 10), a = Number.parseInt(e[2], 10), l = (h) => {
|
|
489
|
+
const c = h.toString(16);
|
|
490
|
+
return c.length === 1 ? `0${c}` : c;
|
|
21
491
|
};
|
|
22
|
-
return `#${
|
|
492
|
+
return `#${l(i)}${l(s)}${l(a)}`;
|
|
23
493
|
}
|
|
24
494
|
return null;
|
|
25
|
-
},
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
495
|
+
}, J = "var(--icon-neutral-800)", Q = "#ffffff", Z = (o) => {
|
|
496
|
+
const n = document.createElement("canvas");
|
|
497
|
+
n.width = o.width, n.height = o.height;
|
|
498
|
+
const t = n.getContext("2d");
|
|
499
|
+
if (!t)
|
|
30
500
|
throw new Error("Canvas 2D context is not available");
|
|
31
|
-
return
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
(
|
|
35
|
-
|
|
501
|
+
return t.fillStyle = Q, t.fillRect(0, 0, n.width, n.height), t.drawImage(o, 0, 0), n;
|
|
502
|
+
}, tt = (o, n, t) => new Promise((e, i) => {
|
|
503
|
+
o.toBlob(
|
|
504
|
+
(s) => {
|
|
505
|
+
s ? e(s) : i(new Error("Canvas toBlob() returned null"));
|
|
36
506
|
},
|
|
37
|
-
|
|
38
|
-
|
|
507
|
+
n,
|
|
508
|
+
n === "image/jpeg" || n === "image/webp" ? t : void 0
|
|
39
509
|
);
|
|
40
|
-
}),
|
|
510
|
+
}), U = R(
|
|
41
511
|
({
|
|
42
|
-
onBeginStroke:
|
|
43
|
-
hasDrawing:
|
|
44
|
-
placeholder:
|
|
45
|
-
customPenColor:
|
|
46
|
-
customPenStrokeWidth:
|
|
47
|
-
customBackgroundColor:
|
|
48
|
-
},
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
|
|
512
|
+
onBeginStroke: o,
|
|
513
|
+
hasDrawing: n,
|
|
514
|
+
placeholder: t,
|
|
515
|
+
customPenColor: e,
|
|
516
|
+
customPenStrokeWidth: i,
|
|
517
|
+
customBackgroundColor: s
|
|
518
|
+
}, a) => {
|
|
519
|
+
const l = P(null), h = P(null), c = P(null), d = P(o);
|
|
520
|
+
d.current = o;
|
|
521
|
+
const r = W(() => {
|
|
522
|
+
const u = l.current, f = h.current, _ = c.current;
|
|
523
|
+
if (!u || !f || !_) return;
|
|
524
|
+
const v = Math.max(window.devicePixelRatio || 1, 1), m = f.getContext("2d"), { width: y, height: S } = u.getBoundingClientRect();
|
|
525
|
+
if (y === 0 || S === 0 || !m) return;
|
|
526
|
+
const p = _.isEmpty() ? null : _.toData();
|
|
527
|
+
f.width = Math.floor(y * v), f.height = Math.floor(S * v), m.setTransform(v, 0, 0, v, 0, 0), p ? _.fromData(p, { clear: !0 }) : _.clear();
|
|
58
528
|
}, []);
|
|
59
|
-
return
|
|
60
|
-
|
|
529
|
+
return F(
|
|
530
|
+
a,
|
|
61
531
|
() => ({
|
|
62
532
|
clear: () => {
|
|
63
|
-
|
|
533
|
+
c.current?.clear();
|
|
64
534
|
},
|
|
65
|
-
isEmpty: () =>
|
|
66
|
-
toDataURL: (
|
|
67
|
-
getCanvas: () =>
|
|
68
|
-
getSignaturePad: () =>
|
|
69
|
-
on: () =>
|
|
70
|
-
off: () =>
|
|
535
|
+
isEmpty: () => c.current?.isEmpty() ?? !0,
|
|
536
|
+
toDataURL: (u = "image/png", f) => c.current?.toDataURL(u, f) ?? "",
|
|
537
|
+
getCanvas: () => h.current,
|
|
538
|
+
getSignaturePad: () => c.current,
|
|
539
|
+
on: () => c.current?.on(),
|
|
540
|
+
off: () => c.current?.off(),
|
|
71
541
|
getSignatureWithWhiteBackground: () => {
|
|
72
|
-
const
|
|
73
|
-
return
|
|
542
|
+
const u = h.current;
|
|
543
|
+
return u ? Z(u) : null;
|
|
74
544
|
},
|
|
75
|
-
getBlob: (
|
|
545
|
+
getBlob: (u = h.current ?? void 0, f = "image/jpeg", _ = 0.92) => u ? tt(u, f, _) : Promise.reject(new Error("No canvas available for getBlob"))
|
|
76
546
|
}),
|
|
77
547
|
[]
|
|
78
|
-
),
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
81
|
-
let
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
548
|
+
), E(() => {
|
|
549
|
+
const u = l.current, f = h.current;
|
|
550
|
+
if (!u || !f) return;
|
|
551
|
+
let _ = null;
|
|
552
|
+
const v = () => {
|
|
553
|
+
_ === null && (_ = requestAnimationFrame(() => {
|
|
554
|
+
_ = null, r();
|
|
85
555
|
}));
|
|
86
|
-
},
|
|
87
|
-
...
|
|
88
|
-
...
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
556
|
+
}, m = e ?? K(J), y = {
|
|
557
|
+
...m ? { penColor: m } : {},
|
|
558
|
+
...i ? { maxWidth: i } : {}
|
|
559
|
+
}, S = new Y(f, y);
|
|
560
|
+
c.current = S;
|
|
561
|
+
const p = () => d.current?.();
|
|
562
|
+
S.addEventListener("beginStroke", p), r();
|
|
563
|
+
const x = new ResizeObserver(() => {
|
|
564
|
+
v();
|
|
95
565
|
});
|
|
96
|
-
return
|
|
97
|
-
|
|
566
|
+
return x.observe(u), () => {
|
|
567
|
+
_ !== null && cancelAnimationFrame(_), x.disconnect(), S.removeEventListener("beginStroke", p), S.off(), c.current = null;
|
|
98
568
|
};
|
|
99
|
-
}, [
|
|
569
|
+
}, [r, e, i]), /* @__PURE__ */ w(
|
|
100
570
|
"div",
|
|
101
571
|
{
|
|
102
572
|
class: "SignatureCanvasContainer",
|
|
103
|
-
style:
|
|
104
|
-
ref:
|
|
573
|
+
style: s ? { backgroundColor: s } : void 0,
|
|
574
|
+
ref: l,
|
|
105
575
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ w(
|
|
107
577
|
"canvas",
|
|
108
578
|
{
|
|
109
579
|
class: "SignatureCanvas",
|
|
110
|
-
ref:
|
|
111
|
-
"aria-label":
|
|
580
|
+
ref: h,
|
|
581
|
+
"aria-label": t
|
|
112
582
|
}
|
|
113
583
|
),
|
|
114
|
-
!
|
|
584
|
+
!n && /* @__PURE__ */ w("p", { class: "SignatureCanvasPlaceholder", children: t })
|
|
115
585
|
]
|
|
116
586
|
}
|
|
117
587
|
);
|
|
118
588
|
}
|
|
119
589
|
);
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
config:
|
|
123
|
-
onFinish:
|
|
124
|
-
onError:
|
|
590
|
+
U.displayName = "SignatureCanvas";
|
|
591
|
+
const et = ({
|
|
592
|
+
config: o,
|
|
593
|
+
onFinish: n,
|
|
594
|
+
onError: t
|
|
125
595
|
}) => {
|
|
126
|
-
const { t:
|
|
127
|
-
() =>
|
|
596
|
+
const { t: e } = B(), [i, s] = A(
|
|
597
|
+
() => G({ config: o }),
|
|
128
598
|
{ autoLoad: !0 }
|
|
129
|
-
), [
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
132
|
-
}, [
|
|
133
|
-
|
|
134
|
-
}, [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}, [
|
|
138
|
-
|
|
139
|
-
}, [
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
}, [
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
return
|
|
146
|
-
},
|
|
147
|
-
const
|
|
148
|
-
return
|
|
149
|
-
},
|
|
150
|
-
const
|
|
151
|
-
if (!
|
|
152
|
-
const
|
|
153
|
-
return
|
|
154
|
-
},
|
|
155
|
-
const
|
|
156
|
-
if (!(!
|
|
157
|
-
|
|
599
|
+
), [a, l] = N(!1), h = P(null), c = P(void 0), d = z(() => {
|
|
600
|
+
if (i.status === "capture" || i.status === "submitting")
|
|
601
|
+
return i.phase;
|
|
602
|
+
}, [i]), r = i.status === "error" ? i.error : void 0, u = i.status === "submitting", f = i.status === "capture" && i.canContinue && !u, _ = W(() => {
|
|
603
|
+
h.current && (h.current.on(), h.current.clear(), l(!1), s.setSignatureValid(!1));
|
|
604
|
+
}, [s]);
|
|
605
|
+
E(() => {
|
|
606
|
+
i.status === "finished" && n?.();
|
|
607
|
+
}, [i.status, n]), E(() => {
|
|
608
|
+
r && (t?.(r), h.current?.on());
|
|
609
|
+
}, [r, t]), E(() => {
|
|
610
|
+
const p = c.current;
|
|
611
|
+
d && p && p !== d && (l(!1), s.setSignatureValid(!1), _()), c.current = d;
|
|
612
|
+
}, [d, s, _]);
|
|
613
|
+
const v = (p) => {
|
|
614
|
+
const x = o.title?.trim();
|
|
615
|
+
return x || e(p === "initials" ? "signature.initialsTitle" : "signature.fullSignatureTitle");
|
|
616
|
+
}, m = () => {
|
|
617
|
+
const p = o.subtitle?.trim();
|
|
618
|
+
return p || e("signature.subtitle");
|
|
619
|
+
}, y = async () => {
|
|
620
|
+
const p = h.current;
|
|
621
|
+
if (!p) return;
|
|
622
|
+
const x = p.getSignatureWithWhiteBackground();
|
|
623
|
+
return x ? o.sendBase64 ?? !1 ? x.toDataURL("image/png").replace(/^data:image\/png;base64,/, "") : p.getBlob(x) : void 0;
|
|
624
|
+
}, S = async () => {
|
|
625
|
+
const p = h.current;
|
|
626
|
+
if (!(!p || i.status !== "capture" || p.isEmpty())) {
|
|
627
|
+
p.off();
|
|
158
628
|
try {
|
|
159
|
-
const
|
|
160
|
-
if (!
|
|
161
|
-
|
|
629
|
+
const x = await y();
|
|
630
|
+
if (!x) {
|
|
631
|
+
p.on();
|
|
162
632
|
return;
|
|
163
633
|
}
|
|
164
|
-
|
|
634
|
+
s.submit(x);
|
|
165
635
|
} catch {
|
|
166
|
-
|
|
636
|
+
p.on();
|
|
167
637
|
}
|
|
168
638
|
}
|
|
169
639
|
};
|
|
170
|
-
return
|
|
640
|
+
return i.status === "idle" || i.status === "finished" || i.status === "error" ? null : i.status === "success" ? /* @__PURE__ */ w(M, { className: "IncodeSignature IncodeSignatureFadeIn", children: /* @__PURE__ */ w(
|
|
171
641
|
"div",
|
|
172
642
|
{
|
|
173
643
|
class: "IncodeSignatureContent IncodeSignatureSuccess",
|
|
174
644
|
role: "status",
|
|
175
645
|
children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ w(V, { size: 48 }),
|
|
647
|
+
/* @__PURE__ */ w(k, { size: 16 }),
|
|
648
|
+
/* @__PURE__ */ w(q, { children: e("signature.successTitle") })
|
|
179
649
|
]
|
|
180
650
|
}
|
|
181
|
-
) }) : /* @__PURE__ */
|
|
182
|
-
|
|
651
|
+
) }) : /* @__PURE__ */ w(
|
|
652
|
+
M,
|
|
183
653
|
{
|
|
184
654
|
className: "IncodeSignature IncodeSignatureFadeIn",
|
|
185
|
-
title:
|
|
186
|
-
subtitle:
|
|
655
|
+
title: v(d),
|
|
656
|
+
subtitle: m(),
|
|
187
657
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
658
|
+
/* @__PURE__ */ w("div", { class: "IncodeSignatureContent", children: [
|
|
659
|
+
/* @__PURE__ */ w(
|
|
660
|
+
U,
|
|
191
661
|
{
|
|
192
|
-
ref:
|
|
193
|
-
hasDrawing:
|
|
662
|
+
ref: h,
|
|
663
|
+
hasDrawing: a,
|
|
194
664
|
onBeginStroke: () => {
|
|
195
|
-
|
|
665
|
+
l(!0), s.setSignatureValid(!0);
|
|
196
666
|
},
|
|
197
|
-
placeholder:
|
|
198
|
-
|
|
667
|
+
placeholder: e(
|
|
668
|
+
d === "initials" ? "signature.initialsPlaceholder" : "signature.fullSignaturePlaceholder"
|
|
199
669
|
),
|
|
200
|
-
customBackgroundColor:
|
|
201
|
-
customPenColor:
|
|
202
|
-
customPenStrokeWidth:
|
|
670
|
+
customBackgroundColor: o.canvasBackgroundColor,
|
|
671
|
+
customPenColor: o.penColor,
|
|
672
|
+
customPenStrokeWidth: o.penStrokeWidth
|
|
203
673
|
}
|
|
204
674
|
),
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
|
|
675
|
+
/* @__PURE__ */ w(k, { size: 8 }),
|
|
676
|
+
/* @__PURE__ */ w(
|
|
677
|
+
T,
|
|
208
678
|
{
|
|
209
679
|
variant: "link",
|
|
210
|
-
disabled: !
|
|
211
|
-
onClick:
|
|
212
|
-
children:
|
|
680
|
+
disabled: !a || u,
|
|
681
|
+
onClick: _,
|
|
682
|
+
children: e("signature.clear")
|
|
213
683
|
}
|
|
214
684
|
)
|
|
215
685
|
] }),
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
|
|
686
|
+
/* @__PURE__ */ w("div", { class: "IncodeSignatureButtonContainer", children: /* @__PURE__ */ w(
|
|
687
|
+
T,
|
|
218
688
|
{
|
|
219
|
-
disabled: !
|
|
220
|
-
isLoading:
|
|
221
|
-
onClick:
|
|
222
|
-
children:
|
|
223
|
-
|
|
689
|
+
disabled: !f,
|
|
690
|
+
isLoading: u,
|
|
691
|
+
onClick: S,
|
|
692
|
+
children: e(
|
|
693
|
+
d === "initials" ? "common.continue" : "signature.done"
|
|
224
694
|
)
|
|
225
695
|
}
|
|
226
696
|
) })
|
|
227
697
|
]
|
|
228
698
|
}
|
|
229
699
|
);
|
|
230
|
-
},
|
|
231
|
-
config:
|
|
232
|
-
onFinish:
|
|
233
|
-
onError:
|
|
234
|
-
}) => /* @__PURE__ */
|
|
235
|
-
|
|
700
|
+
}, it = ({
|
|
701
|
+
config: o,
|
|
702
|
+
onFinish: n,
|
|
703
|
+
onError: t
|
|
704
|
+
}) => /* @__PURE__ */ w(I, { children: o ? /* @__PURE__ */ w(et, { config: o, onFinish: n, onError: t }) : null });
|
|
705
|
+
$(it, "incode-signature");
|
|
236
706
|
export {
|
|
237
|
-
|
|
707
|
+
it as Signature
|
|
238
708
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@incodetech/web",
|
|
3
|
-
"version": "0.0.0-dev-20260402-
|
|
3
|
+
"version": "0.0.0-dev-20260402-43cf9b8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.es.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -135,8 +135,9 @@
|
|
|
135
135
|
"preact-custom-element": "^4.6.0",
|
|
136
136
|
"preact-markup": "^2.1.1",
|
|
137
137
|
"qrcode": "^1.5.4",
|
|
138
|
+
"signature_pad": "^5.1.3",
|
|
138
139
|
"tailwindcss": "^4.1.17",
|
|
139
|
-
"@incodetech/core": "0.0.0-dev-20260402-
|
|
140
|
+
"@incodetech/core": "0.0.0-dev-20260402-43cf9b8"
|
|
140
141
|
},
|
|
141
142
|
"devDependencies": {
|
|
142
143
|
"@microsoft/api-extractor": "^7.53.3",
|
|
@@ -167,7 +168,7 @@
|
|
|
167
168
|
"@incodetech/config": "1.0.0"
|
|
168
169
|
},
|
|
169
170
|
"scripts": {
|
|
170
|
-
"dev": "vite
|
|
171
|
+
"dev": "vite",
|
|
171
172
|
"dev:http": "VITE_DEV_HTTPS=false vite --host",
|
|
172
173
|
"dev:debug": "vite --host --no-open",
|
|
173
174
|
"build:dev": "vite build --watch",
|