@bagelink/vue 1.4.12 → 1.4.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SignaturePad.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/SignaturePad.vue"],"names":[],"mappings":"AAkRA,OAAO,KAAK,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAKnE,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,CAAA;AAEnF,KAAK,WAAW,GAAG;IAClB,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC;AAcF,iBAAS,KAAK,SAIb;AAED,iBAAS,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,sBAGhC;AAgCD,iBAAS,WAAW,CAAC,GAAG,EAAE,MAAM,6BAQ/B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,iBAAS,KAAK,SAIb;AAED,iBAAS,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,sBAGhC;AAgCD,iBAAS,WAAW,CAAC,GAAG,EAAE,MAAM,6BAQ/B;AAGD,iBAAS,IAAI,SAMZ;AAiBD,iBAAS,YAAY,CAAC,IAAI,EAAE,SAAS,QA0BpC;AAgFD,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,CAAC;CACb,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;eAxMH,OAAO;;;;AAmSpB,wBAWG"}
package/dist/index.cjs CHANGED
@@ -19699,22 +19699,17 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
19699
19699
  }
19700
19700
  function draw() {
19701
19701
  sig.value = new SignaturePad(vCanvas.value, signatureOptions.value);
19702
- window.addEventListener("resize", resizeCanvas);
19703
19702
  resizeCanvas();
19704
19703
  if (props2.disabled) sig.value.off();
19705
19704
  else sig.value.on();
19706
19705
  _isEmpty.value = sig.value.isEmpty();
19707
- sig.value.addEventListener("endStroke", onEndStroke);
19708
19706
  if (fileData.value) {
19709
19707
  void loadFile(fileData.value);
19710
19708
  }
19711
19709
  }
19712
19710
  vue.onMounted(draw);
19713
- vue.onUnmounted(() => {
19714
- var _a;
19715
- (_a = sig.value) == null ? void 0 : _a.removeEventListener("endStroke", onEndStroke);
19716
- window.removeEventListener("resize", resizeCanvas);
19717
- });
19711
+ useResizeObserver(() => vCanvas.value, resizeCanvas);
19712
+ useEventListener(() => sig.value, "endStroke", onEndStroke);
19718
19713
  __expose({
19719
19714
  save: save2,
19720
19715
  clear,
@@ -19726,7 +19721,7 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
19726
19721
  return (_ctx, _cache) => {
19727
19722
  return vue.openBlock(), vue.createElementBlock("div", {
19728
19723
  class: vue.normalizeClass(["bgl_input signature-pad relative", { "bg-transparent": _ctx.disabled }]),
19729
- onTouchmove: _cache[1] || (_cache[1] = vue.withModifiers(() => {
19724
+ onTouchmove: _cache[0] || (_cache[0] = vue.withModifiers(() => {
19730
19725
  }, ["prevent"]))
19731
19726
  }, [
19732
19727
  _ctx.clearable && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(Btn), {
@@ -19748,13 +19743,8 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
19748
19743
  type: "text",
19749
19744
  required: _ctx.required && vue.unref(_isEmpty),
19750
19745
  class: "pixel opacity-0",
19751
- tabindex: "-1",
19752
- "aria-hidden": "true",
19753
- onFocus: _cache[0] || (_cache[0] = (event) => {
19754
- var _a, _b;
19755
- return (_b = (_a = event.target) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
19756
- })
19757
- }, null, 40, _hoisted_2$l)
19746
+ inputMode: "none"
19747
+ }, null, 8, _hoisted_2$l)
19758
19748
  ], 34);
19759
19749
  };
19760
19750
  }
package/dist/index.mjs CHANGED
@@ -19697,22 +19697,17 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
19697
19697
  }
19698
19698
  function draw() {
19699
19699
  sig.value = new SignaturePad(vCanvas.value, signatureOptions.value);
19700
- window.addEventListener("resize", resizeCanvas);
19701
19700
  resizeCanvas();
19702
19701
  if (props2.disabled) sig.value.off();
19703
19702
  else sig.value.on();
19704
19703
  _isEmpty.value = sig.value.isEmpty();
19705
- sig.value.addEventListener("endStroke", onEndStroke);
19706
19704
  if (fileData.value) {
19707
19705
  void loadFile(fileData.value);
19708
19706
  }
19709
19707
  }
19710
19708
  onMounted(draw);
19711
- onUnmounted(() => {
19712
- var _a;
19713
- (_a = sig.value) == null ? void 0 : _a.removeEventListener("endStroke", onEndStroke);
19714
- window.removeEventListener("resize", resizeCanvas);
19715
- });
19709
+ useResizeObserver(() => vCanvas.value, resizeCanvas);
19710
+ useEventListener(() => sig.value, "endStroke", onEndStroke);
19716
19711
  __expose({
19717
19712
  save: save2,
19718
19713
  clear,
@@ -19724,7 +19719,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
19724
19719
  return (_ctx, _cache) => {
19725
19720
  return openBlock(), createElementBlock("div", {
19726
19721
  class: normalizeClass(["bgl_input signature-pad relative", { "bg-transparent": _ctx.disabled }]),
19727
- onTouchmove: _cache[1] || (_cache[1] = withModifiers(() => {
19722
+ onTouchmove: _cache[0] || (_cache[0] = withModifiers(() => {
19728
19723
  }, ["prevent"]))
19729
19724
  }, [
19730
19725
  _ctx.clearable && !_ctx.disabled ? (openBlock(), createBlock(unref(Btn), {
@@ -19746,13 +19741,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
19746
19741
  type: "text",
19747
19742
  required: _ctx.required && unref(_isEmpty),
19748
19743
  class: "pixel opacity-0",
19749
- tabindex: "-1",
19750
- "aria-hidden": "true",
19751
- onFocus: _cache[0] || (_cache[0] = (event) => {
19752
- var _a, _b;
19753
- return (_b = (_a = event.target) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
19754
- })
19755
- }, null, 40, _hoisted_2$l)
19744
+ inputMode: "none"
19745
+ }, null, 8, _hoisted_2$l)
19756
19746
  ], 34);
19757
19747
  };
19758
19748
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.4.12",
4
+ "version": "1.4.14",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -1,8 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import type { Options as SignaturePadOptions } from 'signature_pad'
3
3
  import { Btn } from '@bagelink/vue'
4
+ import { useEventListener, useResizeObserver } from '@vueuse/core'
4
5
  import SignaturePad from 'signature_pad'
5
- import { onMounted, onUnmounted, watch } from 'vue'
6
+ import { onMounted, watch } from 'vue'
6
7
 
7
8
  export interface WaterMark {
8
9
  text: string
@@ -186,12 +187,10 @@ function resizeCanvas() {
186
187
 
187
188
  function draw() {
188
189
  sig = new SignaturePad(vCanvas!, signatureOptions)
189
- window.addEventListener('resize', resizeCanvas)
190
190
  resizeCanvas()
191
191
  if (props.disabled) sig.off()
192
192
  else sig.on()
193
193
  _isEmpty = sig.isEmpty()
194
- sig.addEventListener('endStroke', onEndStroke)
195
194
 
196
195
  // Load initial file if provided
197
196
  if (fileData.value) {
@@ -200,10 +199,8 @@ function draw() {
200
199
  }
201
200
 
202
201
  onMounted(draw)
203
- onUnmounted(() => {
204
- sig?.removeEventListener('endStroke', onEndStroke)
205
- window.removeEventListener('resize', resizeCanvas)
206
- })
202
+ useResizeObserver(() => vCanvas, resizeCanvas)
203
+ useEventListener(() => sig, 'endStroke', onEndStroke)
207
204
 
208
205
  defineExpose({
209
206
  save,
@@ -239,16 +236,13 @@ defineExpose({
239
236
  type="text"
240
237
  :required="required && _isEmpty"
241
238
  class="pixel opacity-0"
242
- tabindex="-1"
243
- aria-hidden="true"
244
- @focus="event => (event.target as any)?.blur?.()"
239
+ inputMode="none"
245
240
  >
246
241
  <!--
247
242
  we add a hidden input to make the signature pad required
248
- we need to set the tabindex to -1 and aria-hidden to true
249
- to make it not focusable and not visible to screen readers
250
- ! most importantally this prevents the keyboard from opening on mobile
251
- -->
243
+ we need to set inputMode="none"
244
+ ! this prevents the keyboard from opening on mobile
245
+ -->
252
246
  </div>
253
247
  </template>
254
248