@base-framework/ui 1.0.231 → 1.0.233

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.
@@ -0,0 +1,122 @@
1
+ import { DateTime as e } from "@base-framework/base";
2
+ const a = (r, n) => (typeof r == "string" && (r = [r]), Array.isArray(r) ? (r.push(n), r) : {
3
+ ...r,
4
+ callBack: n
5
+ }), s = (r, n = "") => r ?? n, B = {
6
+ /**
7
+ * Formats a number with commas.
8
+ *
9
+ * @param {string|number|object|array} watcher
10
+ * @param {string|null} defaultValue - Value if original is null or undefined.
11
+ * @returns {object|array}
12
+ */
13
+ number(r, n = null) {
14
+ return a(r, (t) => {
15
+ if (!isNaN(t)) {
16
+ const c = /\B(?=(\d{3})+(?!\d))/g;
17
+ return t.toString().replace(c, ",");
18
+ }
19
+ return n || "";
20
+ });
21
+ },
22
+ /**
23
+ * Formats a boolean value as a yes/no string.
24
+ *
25
+ * @param {string|number|object|array} watcher
26
+ * @param {string} yes - Text for true values.
27
+ * @param {string} no - Text for false values.
28
+ * @returns {object|array}
29
+ */
30
+ yesno(r, n = "Yes", l = "No") {
31
+ return a(r, (c) => c ? n : l);
32
+ },
33
+ /**
34
+ * Formats a value as money with two decimals.
35
+ *
36
+ * @param {string|number|object|array} watcher
37
+ * @param {string} currency - Currency symbol.
38
+ * @param {*} defaultValue - Value if original is invalid.
39
+ * @returns {object|array}
40
+ */
41
+ money(r, n = "$", l = null) {
42
+ return a(r, (c) => {
43
+ const o = parseFloat(c);
44
+ if (isNaN(o))
45
+ return l || "";
46
+ const i = /\B(?=(\d{3})+(?!\d))/g;
47
+ return n + o.toFixed(2).toString().replace(i, ",");
48
+ });
49
+ },
50
+ /**
51
+ * Formats a value as a US phone number (10 digits).
52
+ *
53
+ * @param {string|object|array} watcher
54
+ * @param {*} defaultValue - Value if original is invalid.
55
+ * @returns {object|array}
56
+ */
57
+ phone(r, n = null) {
58
+ return a(r, (t) => {
59
+ t = t || "";
60
+ const c = String(t.toString()).replace(/\D/g, "");
61
+ return c.length === 10 ? "(" + c.slice(0, 3) + ") " + c.slice(3, 6) + "-" + c.slice(6) : t || n;
62
+ });
63
+ },
64
+ /**
65
+ * Formats a value as an integer (rounds down).
66
+ *
67
+ * @param {string|number|object|array} watcher
68
+ * @param {*} defaultValue - Value if original is invalid.
69
+ * @returns {object|array}
70
+ */
71
+ integer(r, n = null) {
72
+ return a(r, (t) => {
73
+ t = s(t, n);
74
+ const c = parseInt(t, 10);
75
+ return isNaN(c) ? n : c.toString();
76
+ });
77
+ },
78
+ /**
79
+ * Formats a date value to a standard date format.
80
+ *
81
+ * @param {string|number|object|array} watcher
82
+ * @param {*} defaultValue - Value if original is invalid.
83
+ * @returns {object|array}
84
+ */
85
+ date(r, n = null) {
86
+ return a(r, (t) => t ? e.format("standard", t) : n || "");
87
+ },
88
+ /**
89
+ * Formats a date and time value to a standard date and time format.
90
+ *
91
+ * @param {string|number|object|array} watcher
92
+ * @param {*} defaultValue - Value if original is invalid.
93
+ * @returns {object|array}
94
+ */
95
+ dateTime(r, n = null) {
96
+ return a(r, (t) => t ? e.format("standard", t) + " " + e.formatTime(t, 12) : n || "");
97
+ },
98
+ /**
99
+ * Formats a time value to a standard time format.
100
+ *
101
+ * @param {string|number|object|array} watcher
102
+ * @param {*} defaultValue - Value if original is invalid.
103
+ * @returns {object|array}
104
+ */
105
+ time(r, n = null) {
106
+ return a(r, (t) => t ? e.formatTime(t, 12) : n || "");
107
+ },
108
+ /**
109
+ * Formats a value with a default value if null or undefined.
110
+ *
111
+ * @param {string|number|object|array} watcher
112
+ * @param {string|null} defaultValue - Value if original is null or undefined.
113
+ * @returns {object|array}
114
+ */
115
+ default(r, n = null) {
116
+ return a(r, (t) => s(t, n));
117
+ }
118
+ };
119
+ export {
120
+ B as F,
121
+ a as c
122
+ };
@@ -1,124 +1,7 @@
1
- var y = Object.defineProperty;
2
- var S = (i, t, n) => t in i ? y(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
3
- var g = (i, t, n) => S(i, typeof t != "symbol" ? t + "" : t, n);
4
- import { DateTime as f, base as l } from "@base-framework/base";
5
- const h = (i, t) => (typeof i == "string" && (i = [i]), Array.isArray(i) ? (i.push(t), i) : {
6
- ...i,
7
- callBack: t
8
- }), x = (i, t = "") => i ?? t, z = {
9
- /**
10
- * Formats a number with commas.
11
- *
12
- * @param {string|number|object|array} watcher
13
- * @param {string|null} defaultValue - Value if original is null or undefined.
14
- * @returns {object|array}
15
- */
16
- number(i, t = null) {
17
- return h(i, (e) => {
18
- if (!isNaN(e)) {
19
- const s = /\B(?=(\d{3})+(?!\d))/g;
20
- return e.toString().replace(s, ",");
21
- }
22
- return t || "";
23
- });
24
- },
25
- /**
26
- * Formats a boolean value as a yes/no string.
27
- *
28
- * @param {string|number|object|array} watcher
29
- * @param {string} yes - Text for true values.
30
- * @param {string} no - Text for false values.
31
- * @returns {object|array}
32
- */
33
- yesno(i, t = "Yes", n = "No") {
34
- return h(i, (s) => s ? t : n);
35
- },
36
- /**
37
- * Formats a value as money with two decimals.
38
- *
39
- * @param {string|number|object|array} watcher
40
- * @param {string} currency - Currency symbol.
41
- * @param {*} defaultValue - Value if original is invalid.
42
- * @returns {object|array}
43
- */
44
- money(i, t = "$", n = null) {
45
- return h(i, (s) => {
46
- const o = parseFloat(s);
47
- if (isNaN(o))
48
- return n || "";
49
- const r = /\B(?=(\d{3})+(?!\d))/g;
50
- return t + o.toFixed(2).toString().replace(r, ",");
51
- });
52
- },
53
- /**
54
- * Formats a value as a US phone number (10 digits).
55
- *
56
- * @param {string|object|array} watcher
57
- * @param {*} defaultValue - Value if original is invalid.
58
- * @returns {object|array}
59
- */
60
- phone(i, t = null) {
61
- return h(i, (e) => {
62
- e = e || "";
63
- const s = String(e.toString()).replace(/\D/g, "");
64
- return s.length === 10 ? "(" + s.slice(0, 3) + ") " + s.slice(3, 6) + "-" + s.slice(6) : e || t;
65
- });
66
- },
67
- /**
68
- * Formats a value as an integer (rounds down).
69
- *
70
- * @param {string|number|object|array} watcher
71
- * @param {*} defaultValue - Value if original is invalid.
72
- * @returns {object|array}
73
- */
74
- integer(i, t = null) {
75
- return h(i, (e) => {
76
- e = x(e, t);
77
- const s = parseInt(e, 10);
78
- return isNaN(s) ? t : s.toString();
79
- });
80
- },
81
- /**
82
- * Formats a date value to a standard date format.
83
- *
84
- * @param {string|number|object|array} watcher
85
- * @param {*} defaultValue - Value if original is invalid.
86
- * @returns {object|array}
87
- */
88
- date(i, t = null) {
89
- return h(i, (e) => e ? f.format("standard", e) : t || "");
90
- },
91
- /**
92
- * Formats a date and time value to a standard date and time format.
93
- *
94
- * @param {string|number|object|array} watcher
95
- * @param {*} defaultValue - Value if original is invalid.
96
- * @returns {object|array}
97
- */
98
- dateTime(i, t = null) {
99
- return h(i, (e) => e ? f.format("standard", e) + " " + f.formatTime(e, 12) : t || "");
100
- },
101
- /**
102
- * Formats a time value to a standard time format.
103
- *
104
- * @param {string|number|object|array} watcher
105
- * @param {*} defaultValue - Value if original is invalid.
106
- * @returns {object|array}
107
- */
108
- time(i, t = null) {
109
- return h(i, (e) => e ? f.formatTime(e, 12) : t || "");
110
- },
111
- /**
112
- * Formats a value with a default value if null or undefined.
113
- *
114
- * @param {string|number|object|array} watcher
115
- * @param {string|null} defaultValue - Value if original is null or undefined.
116
- * @returns {object|array}
117
- */
118
- default(i, t = null) {
119
- return h(i, (e) => x(e, t));
120
- }
121
- };
1
+ var m = Object.defineProperty;
2
+ var x = (l, t, e) => t in l ? m(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
+ var f = (l, t, e) => x(l, typeof t != "symbol" ? t + "" : t, e);
4
+ import { base as r } from "@base-framework/base";
122
5
  class v {
123
6
  /**
124
7
  * Creates an instance of ElementScaler.
@@ -175,11 +58,11 @@ class v {
175
58
  * @param {number} scale - Scale factor (e.g., 1.0 = 100%, 0.5 = 50%).
176
59
  * @returns {{width: number, height: number}} The new width and height after scaling.
177
60
  */
178
- transform(t, n, e) {
179
- const s = this.element, o = s.style;
180
- o.top = n + "px", o.left = t + "px";
181
- const r = s.naturalWidth * e, c = s.naturalHeight * e;
182
- return o.width = r + "px", o.height = c + "px", { width: r, height: c };
61
+ transform(t, e, s) {
62
+ const n = this.element, i = n.style;
63
+ i.top = e + "px", i.left = t + "px";
64
+ const o = n.naturalWidth * s, c = n.naturalHeight * s;
65
+ return i.width = o + "px", i.height = c + "px", { width: o, height: c };
183
66
  }
184
67
  /**
185
68
  * Updates internal bounding boxes for both the element and its container.
@@ -190,7 +73,7 @@ class v {
190
73
  this.setBoundingBox(), this.containerSize = this.container.getBoundingClientRect();
191
74
  }
192
75
  }
193
- class D {
76
+ class y {
194
77
  /**
195
78
  * Creates an EventController instance.
196
79
  *
@@ -198,11 +81,11 @@ class D {
198
81
  * @param {object} parent - The parent object (ImageScaler) that handles actions.
199
82
  * @param {HTMLElement} container - The DOM element to attach events to.
200
83
  */
201
- constructor(t, n) {
84
+ constructor(t, e) {
202
85
  /**
203
86
  * Tracks and measures distances between touches for pinch gestures.
204
87
  */
205
- g(this, "pinchTracker", {
88
+ f(this, "pinchTracker", {
206
89
  /** @type {number|null} */
207
90
  previousDistance: null,
208
91
  /** @type {number|null} */
@@ -216,9 +99,9 @@ class D {
216
99
  * @param {number} y2
217
100
  * @returns {number}
218
101
  */
219
- distance(t, n, e, s) {
102
+ distance(t, e, s, n) {
220
103
  return Math.sqrt(
221
- (t - e) * (t - e) + (n - s) * (n - s)
104
+ (t - s) * (t - s) + (e - n) * (e - n)
222
105
  );
223
106
  },
224
107
  /**
@@ -236,8 +119,8 @@ class D {
236
119
  * @param {object} touch2
237
120
  * @returns {void}
238
121
  */
239
- setCurrentDistance(t, n) {
240
- this.currentDistance = this.distance(t.x, t.y, n.x, n.y);
122
+ setCurrentDistance(t, e) {
123
+ this.currentDistance = this.distance(t.x, t.y, e.x, e.y);
241
124
  },
242
125
  /**
243
126
  * Updates currentDistance and keeps track of the previous distance.
@@ -246,8 +129,8 @@ class D {
246
129
  * @param {object} touch2
247
130
  * @returns {number} The updated current distance.
248
131
  */
249
- updateCurrentDistance(t, n) {
250
- return this.setPreviousDistance(), this.setCurrentDistance(t, n), this.currentDistance;
132
+ updateCurrentDistance(t, e) {
133
+ return this.setPreviousDistance(), this.setCurrentDistance(t, e), this.currentDistance;
251
134
  },
252
135
  /**
253
136
  * Determines the scale direction (zoom in/out) based on distance changes.
@@ -256,10 +139,10 @@ class D {
256
139
  * @param {object} touch2
257
140
  * @returns {number} 1 for zoom in, -1 for zoom out, 0 if below threshold.
258
141
  */
259
- getScale(t, n) {
260
- let e = 0;
261
- const s = this.updateCurrentDistance(t, n), o = this.previousDistance;
262
- return o === null || Math.abs(s - o) < 2 || (s > o ? e = 1 : s < o && (e = -1)), e;
142
+ getScale(t, e) {
143
+ let s = 0;
144
+ const n = this.updateCurrentDistance(t, e), i = this.previousDistance;
145
+ return i === null || Math.abs(n - i) < 2 || (n > i ? s = 1 : n < i && (s = -1)), s;
263
146
  },
264
147
  /**
265
148
  * Resets the distance measurements.
@@ -270,7 +153,7 @@ class D {
270
153
  this.previousDistance = null, this.currentDistance = null;
271
154
  }
272
155
  });
273
- this.parent = t, this.container = n, this.pointer = { x: 0, y: 0, status: "up" }, this.setup();
156
+ this.parent = t, this.container = e, this.pointer = { x: 0, y: 0, status: "up" }, this.setup();
274
157
  }
275
158
  /**
276
159
  * Initializes event setup.
@@ -294,11 +177,11 @@ class D {
294
177
  * @returns {void}
295
178
  */
296
179
  setupEvents() {
297
- const t = this.container, n = l.bind(this, this.pointerMove), e = l.bind(this, this.pointerUp), s = l.bind(this, this.pointerDown), o = l.bind(this, this.wheel), r = l.bind(this, this.resize);
180
+ const t = this.container, e = r.bind(this, this.pointerMove), s = r.bind(this, this.pointerUp), n = r.bind(this, this.pointerDown), i = r.bind(this, this.wheel), o = r.bind(this, this.resize);
298
181
  this.addEvents = function() {
299
- l.on(["mousemove", "touchmove"], t, n), l.on(["mouseup", "mouseout", "touchend", "touchcancel"], t, e), l.on(["mousedown", "touchstart"], t, s), l.onMouseWheel(o, t, !0), l.on("resize", globalThis, r);
182
+ r.on(["mousemove", "touchmove"], t, e), r.on(["mouseup", "mouseout", "touchend", "touchcancel"], t, s), r.on(["mousedown", "touchstart"], t, n), r.onMouseWheel(i, t, !0), r.on("resize", globalThis, o);
300
183
  }, this.addEvents(), this.removeEvents = function() {
301
- l.off(["mousemove", "touchmove"], t, n), l.off(["mouseup", "mouseout", "touchend", "touchcancel"], t, e), l.off(["mousedown", "touchstart"], t, s), l.offMouseWheel(o, t), l.off("resize", globalThis, r);
184
+ r.off(["mousemove", "touchmove"], t, e), r.off(["mouseup", "mouseout", "touchend", "touchcancel"], t, s), r.off(["mousedown", "touchstart"], t, n), r.offMouseWheel(i, t), r.off("resize", globalThis, o);
302
185
  };
303
186
  }
304
187
  /**
@@ -308,8 +191,8 @@ class D {
308
191
  * @param {Event} e - The associated event.
309
192
  * @returns {void}
310
193
  */
311
- wheel(t, n) {
312
- this.parent.callAction("pinch", n, t);
194
+ wheel(t, e) {
195
+ this.parent.callAction("pinch", e, t);
313
196
  }
314
197
  /**
315
198
  * Extracts the position from mouse or touch events and updates `this.pointer`.
@@ -318,14 +201,14 @@ class D {
318
201
  * @returns {void}
319
202
  */
320
203
  getEventPosition(t) {
321
- let n, e;
322
- const s = t.touches;
323
- if (s && s.length) {
324
- const o = s[0];
325
- n = o.clientX, e = o.clientY;
204
+ let e, s;
205
+ const n = t.touches;
206
+ if (n && n.length) {
207
+ const i = n[0];
208
+ e = i.clientX, s = i.clientY;
326
209
  } else
327
- n = t.clientX, e = t.clientY;
328
- this.pointer.x = n, this.pointer.y = e;
210
+ e = t.clientX, s = t.clientY;
211
+ this.pointer.x = e, this.pointer.y = s;
329
212
  }
330
213
  /**
331
214
  * Called when the pointer goes down (mouse/touch).
@@ -360,11 +243,11 @@ class D {
360
243
  * @returns {Array<object>} Array of touch points.
361
244
  */
362
245
  getTouches(t) {
363
- const n = [], e = t.touches;
364
- if (e && e.length)
365
- for (let s = 0; s < e.length; s++)
366
- n.push(e[s]);
367
- return n;
246
+ const e = [], s = t.touches;
247
+ if (s && s.length)
248
+ for (let n = 0; n < s.length; n++)
249
+ e.push(s[n]);
250
+ return e;
368
251
  }
369
252
  /**
370
253
  * Calculates the midpoint (center) between two sets of coordinates.
@@ -375,10 +258,10 @@ class D {
375
258
  * @param {number} y2
376
259
  * @returns {{x: number, y: number}} The center coordinates.
377
260
  */
378
- getCenter(t, n, e, s) {
261
+ getCenter(t, e, s, n) {
379
262
  return {
380
- x: (t + e) / 2,
381
- y: (n + s) / 2
263
+ x: (t + s) / 2,
264
+ y: (e + n) / 2
382
265
  };
383
266
  }
384
267
  /**
@@ -388,12 +271,12 @@ class D {
388
271
  * @returns {void}
389
272
  */
390
273
  pinch(t) {
391
- const n = this.getTouches(t);
392
- if (n.length === 2) {
274
+ const e = this.getTouches(t);
275
+ if (e.length === 2) {
393
276
  this.pointer.status = "down";
394
- const e = n[0], s = n[1], o = this.getPosition(e.clientX, e.clientY), r = this.getPosition(s.clientX, s.clientY);
395
- this.centerMousePinch(e, s);
396
- const c = this.pinchTracker.getScale(o, r);
277
+ const s = e[0], n = e[1], i = this.getPosition(s.clientX, s.clientY), o = this.getPosition(n.clientX, n.clientY);
278
+ this.centerMousePinch(s, n);
279
+ const c = this.pinchTracker.getScale(i, o);
397
280
  this.parent.callAction("pinch", t, c);
398
281
  }
399
282
  }
@@ -404,10 +287,10 @@ class D {
404
287
  * @param {number} eY
405
288
  * @returns {{x: number, y: number}}
406
289
  */
407
- getPosition(t, n) {
290
+ getPosition(t, e) {
408
291
  return {
409
292
  x: parseInt(String(t)),
410
- y: parseInt(String(n))
293
+ y: parseInt(String(e))
411
294
  };
412
295
  }
413
296
  /**
@@ -417,14 +300,14 @@ class D {
417
300
  * @param {Touch} touch2
418
301
  * @returns {void}
419
302
  */
420
- centerMousePinch(t, n) {
421
- const e = this.getCenter(
303
+ centerMousePinch(t, e) {
304
+ const s = this.getCenter(
422
305
  t.clientX,
423
306
  t.clientY,
424
- n.clientX,
425
- n.clientY
426
- ), s = this.pointer;
427
- s.x = e.x, s.y = e.y;
307
+ e.clientX,
308
+ e.clientY
309
+ ), n = this.pointer;
310
+ n.x = s.x, n.y = s.y;
428
311
  }
429
312
  /**
430
313
  * Called on a rotate gesture (currently not used).
@@ -442,9 +325,9 @@ class D {
442
325
  * @returns {boolean} True if it was a gesture (pinch); false otherwise.
443
326
  */
444
327
  isGesture(t) {
445
- let n = !1;
446
- const e = t.touches;
447
- return e && e.length > 1 && (t.preventDefault(), this.pinch(t), n = !0), n;
328
+ let e = !1;
329
+ const s = t.touches;
330
+ return s && s.length > 1 && (t.preventDefault(), this.pinch(t), e = !0), e;
448
331
  }
449
332
  /**
450
333
  * Called when the pointer moves (mouse/touch) but might also detect pinch.
@@ -456,7 +339,7 @@ class D {
456
339
  this.getEventPosition(t), this.isGesture(t) === !1 && this.parent.callAction("pointerMove", t);
457
340
  }
458
341
  }
459
- class E {
342
+ class B {
460
343
  /**
461
344
  * Creates an instance of ImageScaler.
462
345
  *
@@ -465,7 +348,7 @@ class E {
465
348
  */
466
349
  constructor(t) {
467
350
  /** @type {number} Minimum allowed scale factor. */
468
- g(this, "minScale", 0.2);
351
+ f(this, "minScale", 0.2);
469
352
  this.elementScaler = new v(t), this.scale = this.getImageScale(t), this.panning = !1, this.events = null, this.start = { x: 0, y: 0 }, this.delta = { x: 0, y: 0 }, this.setup();
470
353
  }
471
354
  /**
@@ -492,8 +375,8 @@ class E {
492
375
  * @param {*} [data] - Additional data passed to the method.
493
376
  * @returns {void}
494
377
  */
495
- callAction(t, n, e) {
496
- this[t](n, e);
378
+ callAction(t, e, s) {
379
+ this[t](e, s);
497
380
  }
498
381
  /**
499
382
  * Sets up the event controller for the image.
@@ -501,7 +384,7 @@ class E {
501
384
  * @returns {void}
502
385
  */
503
386
  setupEvents() {
504
- this.events = new D(this, this.elementScaler.element);
387
+ this.events = new y(this, this.elementScaler.element);
505
388
  }
506
389
  /**
507
390
  * Calculates an initial scale based on the element's offsetWidth vs. naturalWidth.
@@ -519,10 +402,10 @@ class E {
519
402
  * @returns {{x: number, y: number}} The pointer offset without scale.
520
403
  */
521
404
  getOffset(t) {
522
- const n = this.scale, e = this.delta, s = this.getPointerPosition();
405
+ const e = this.scale, s = this.delta, n = this.getPointerPosition();
523
406
  return {
524
- x: (s.x - e.x) / n,
525
- y: (s.y - e.y) / n
407
+ x: (n.x - s.x) / e,
408
+ y: (n.y - s.y) / e
526
409
  };
527
410
  }
528
411
  /**
@@ -533,9 +416,9 @@ class E {
533
416
  * @param {number} scale - The scale factor.
534
417
  * @returns {void}
535
418
  */
536
- scaleElement(t, n, e) {
537
- const s = this.elementScaler.transform(t, n, e);
538
- this.center(s.width, s.height);
419
+ scaleElement(t, e, s) {
420
+ const n = this.elementScaler.transform(t, e, s);
421
+ this.center(n.width, n.height);
539
422
  }
540
423
  /**
541
424
  * Attempts to center the scaled element within its container, respecting boundaries.
@@ -544,28 +427,28 @@ class E {
544
427
  * @param {number} [height] - Height of the scaled element.
545
428
  * @returns {void}
546
429
  */
547
- center(t, n) {
548
- const e = this.elementScaler, s = e.containerSize, o = e.elementBoundingBox, r = this.delta;
549
- t = t || o.width, n = n || o.height;
550
- let c, a;
551
- const p = s.width;
552
- if (t < p)
553
- c = p / 2 - t / 2, c = c > 0 ? c : 0;
430
+ center(t, e) {
431
+ const s = this.elementScaler, n = s.containerSize, i = s.elementBoundingBox, o = this.delta;
432
+ t = t || i.width, e = e || i.height;
433
+ let c, h;
434
+ const u = n.width;
435
+ if (t < u)
436
+ c = u / 2 - t / 2, c = c > 0 ? c : 0;
554
437
  else {
555
- c = r.x;
556
- const u = t + r.x;
557
- u < p && (c = u + (p - u) - t), r.x > 0 && (c = 0);
438
+ c = o.x;
439
+ const a = t + o.x;
440
+ a < u && (c = a + (u - a) - t), o.x > 0 && (c = 0);
558
441
  }
559
- const d = s.height;
560
- if (n < d)
561
- a = d / 2 - n / 2, a = a > 0 ? a : 0;
442
+ const p = n.height;
443
+ if (e < p)
444
+ h = p / 2 - e / 2, h = h > 0 ? h : 0;
562
445
  else {
563
- a = r.y;
564
- const u = n + r.y;
565
- u < d && (a = u + (d - u) - n), r.y > 0 && (a = 0);
446
+ h = o.y;
447
+ const a = e + o.y;
448
+ a < p && (h = a + (p - a) - e), o.y > 0 && (h = 0);
566
449
  }
567
- const m = e.element.style;
568
- m.left = c + "px", m.top = a + "px", this.delta = { x: c, y: a };
450
+ const d = s.element.style;
451
+ d.left = c + "px", d.top = h + "px", this.delta = { x: c, y: h };
569
452
  }
570
453
  /**
571
454
  * Updates the current scale (zoom) value based on scroll delta.
@@ -574,8 +457,8 @@ class E {
574
457
  * @returns {number} The updated scale factor.
575
458
  */
576
459
  updateScale(t) {
577
- let n = this.scale;
578
- return t !== 0 && (n = t > 0 ? this.scale *= 1.05 : this.scale /= 1.05), n <= this.minScale && (this.scale = this.minScale), this.scale;
460
+ let e = this.scale;
461
+ return t !== 0 && (e = t > 0 ? this.scale *= 1.05 : this.scale /= 1.05), e <= this.minScale && (this.scale = this.minScale), this.scale;
579
462
  }
580
463
  /**
581
464
  * Returns the pointer position relative to the container.
@@ -583,10 +466,10 @@ class E {
583
466
  * @returns {{x: number, y: number}} The pointer coordinates.
584
467
  */
585
468
  getPointerPosition() {
586
- const t = this.elementScaler.containerSize, n = this.events.pointer;
469
+ const t = this.elementScaler.containerSize, e = this.events.pointer;
587
470
  return {
588
- x: n.x - t.left,
589
- y: n.y - t.top
471
+ x: e.x - t.left,
472
+ y: e.y - t.top
590
473
  };
591
474
  }
592
475
  /**
@@ -596,10 +479,10 @@ class E {
596
479
  * @returns {void}
597
480
  */
598
481
  pointerDown(t) {
599
- const n = this.delta, e = this.getPointerPosition();
482
+ const e = this.delta, s = this.getPointerPosition();
600
483
  this.start = {
601
- x: e.x - n.x,
602
- y: e.y - n.y
484
+ x: s.x - e.x,
485
+ y: s.y - e.y
603
486
  }, this.panning = !0;
604
487
  }
605
488
  /**
@@ -611,8 +494,8 @@ class E {
611
494
  pointerMove(t) {
612
495
  if (t.preventDefault(), !this.panning)
613
496
  return;
614
- const n = this.getPointerPosition(), e = this.delta, s = this.start;
615
- e.x = n.x - s.x, e.y = n.y - s.y, this.scaleElement(e.x, e.y, this.scale);
497
+ const e = this.getPointerPosition(), s = this.delta, n = this.start;
498
+ s.x = e.x - n.x, s.y = e.y - n.y, this.scaleElement(s.x, s.y, this.scale);
616
499
  }
617
500
  /**
618
501
  * Called when the user releases the pointer (mouse/touch).
@@ -638,15 +521,13 @@ class E {
638
521
  * @param {number} delta - Positive = zoom in, negative = zoom out.
639
522
  * @returns {void}
640
523
  */
641
- pinch(t, n) {
642
- const e = this.getOffset(t);
524
+ pinch(t, e) {
525
+ const s = this.getOffset(t);
643
526
  t.preventDefault();
644
- const s = this.updateScale(n), o = this.getPointerPosition(), r = this.delta;
645
- r.x = o.x - e.x * s, r.y = o.y - e.y * s, this.scaleElement(r.x, r.y, s);
527
+ const n = this.updateScale(e), i = this.getPointerPosition(), o = this.delta;
528
+ o.x = i.x - s.x * n, o.y = i.y - s.y * n, this.scaleElement(o.x, o.y, n);
646
529
  }
647
530
  }
648
531
  export {
649
- z as F,
650
- E as I,
651
- h as c
532
+ B as I
652
533
  };