@signal24/vue-foundation 4.13.5 → 4.13.7

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,6 +1,6 @@
1
- declare function mask(): void;
1
+ declare function mask(): () => void;
2
2
  declare function unmask(): void;
3
- declare function hide(): void;
3
+ declare function hide(): () => void;
4
4
  declare function unhide(): void;
5
5
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
6
6
  id?: string | undefined;
@@ -39,7 +39,7 @@ interface PropsWithCallback<T> {
39
39
  }
40
40
  type ComponentReturn<M extends OverlayComponent> = OverlayComponentProps<M> extends PropsWithCallback<infer R> ? R : never;
41
41
  export type AnyComponentPublicInstance = {
42
- $: ComponentInternalInstance;
42
+ $?: ComponentInternalInstance;
43
43
  };
44
44
  export declare function createOverlayInjection<C extends OverlayComponent>(component: C, props: OverlayComponentProps<C>, options?: OverlayOptions): OverlayInjection<C>;
45
45
  export declare function dismissOverlayInjectionByInstance(instance: AnyComponentPublicInstance): void;
@@ -10,6 +10,6 @@ export declare function maskComponent(cmp: AnyComponentPublicInstance, message?:
10
10
  export declare function unmaskComponent(cmp: AnyComponentPublicInstance): void;
11
11
  export declare function maskEl(el: MaskElement, message?: string): () => void;
12
12
  export declare function unmaskEl(el: MaskElement): void;
13
- export declare function maskForm(formOrCmp: Element | AnyComponentPublicInstance, buttonSelector?: string | Element, buttonText?: string): () => void;
13
+ export declare function maskForm(formOrCmp: Element | AnyComponentPublicInstance, buttonSelector?: string | Element, buttonText?: string): (() => void) | undefined;
14
14
  export declare function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance): void;
15
15
  export {};
@@ -1,7 +1,7 @@
1
1
  var Ve = Object.defineProperty;
2
2
  var Fe = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var E = (e, t, n) => (Fe(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { defineComponent as x, defineProps as _e, defineEmits as Ne, ref as O, computed as _, openBlock as d, createElementBlock as u, createElementVNode as w, toDisplayString as C, withDirectives as j, createCommentVNode as b, Fragment as U, renderList as J, vModelSelect as Re, getCurrentInstance as ee, onMounted as L, normalizeClass as k, normalizeStyle as Ke, withModifiers as te, renderSlot as K, reactive as je, h as W, Teleport as Ue, markRaw as We, onBeforeUnmount as ne, resolveDirective as Oe, createBlock as be, createSlots as Pe, withCtx as Y, createTextVNode as ae, vModelText as qe, watch as ce, onActivated as ke, onDeactivated as Se } from "vue";
4
+ import { defineComponent as x, defineProps as _e, defineEmits as Ne, ref as O, computed as _, openBlock as d, createElementBlock as h, createElementVNode as w, toDisplayString as C, withDirectives as j, createCommentVNode as b, Fragment as U, renderList as J, vModelSelect as Re, getCurrentInstance as ee, onMounted as L, normalizeClass as k, normalizeStyle as Ke, withModifiers as te, renderSlot as K, reactive as je, h as W, Teleport as Ue, markRaw as We, onBeforeUnmount as ne, resolveDirective as Oe, createBlock as be, createSlots as Pe, withCtx as Y, createTextVNode as ae, vModelText as qe, watch as ce, onActivated as ke, onDeactivated as Se } from "vue";
5
5
  import { compact as ze, debounce as Xe, isEqual as xe, upperFirst as Ye, startCase as Ze, cloneDeep as Ge, remove as Qe } from "lodash";
6
6
  import { escapeHtml as Je } from "@vue/shared";
7
7
  import { escapeHtml as ni } from "@vue/shared";
@@ -45,26 +45,26 @@ const nt = x({
45
45
  key: 0,
46
46
  value: null
47
47
  }, ot = ["value"];
48
- function lt(e, t, n, i, s, o) {
49
- return e.renderOptions ? j((d(), u("select", {
48
+ function rt(e, t, n, i, s, o) {
49
+ return e.renderOptions ? j((d(), h("select", {
50
50
  key: 1,
51
- "onUpdate:modelValue": t[0] || (t[0] = (r) => e.selectedItem = r)
51
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => e.selectedItem = l)
52
52
  }, [
53
- e.props.nullText ? (d(), u("option", st, C(e.props.nullText), 1)) : b("", !0),
54
- (d(!0), u(U, null, J(e.renderOptions, (r, l) => {
53
+ e.props.nullText ? (d(), h("option", st, C(e.props.nullText), 1)) : b("", !0),
54
+ (d(!0), h(U, null, J(e.renderOptions, (l, r) => {
55
55
  var a;
56
- return d(), u("option", {
57
- key: l,
58
- value: (a = e.options) == null ? void 0 : a[l]
59
- }, C(r), 9, ot);
56
+ return d(), h("option", {
57
+ key: r,
58
+ value: (a = e.options) == null ? void 0 : a[r]
59
+ }, C(l), 9, ot);
60
60
  }), 128))
61
61
  ], 512)), [
62
62
  [Re, e.selectedItem]
63
- ]) : (d(), u("select", it, [
63
+ ]) : (d(), h("select", it, [
64
64
  w("option", null, C(e.props.loadingText || "Loading..."), 1)
65
65
  ]));
66
66
  }
67
- const Mn = /* @__PURE__ */ Ce(nt, [["render", lt]]), rt = /* @__PURE__ */ x({
67
+ const Mn = /* @__PURE__ */ Ce(nt, [["render", rt]]), lt = /* @__PURE__ */ x({
68
68
  __name: "overlay-anchor",
69
69
  props: {
70
70
  overlayId: {},
@@ -72,27 +72,29 @@ const Mn = /* @__PURE__ */ Ce(nt, [["render", lt]]), rt = /* @__PURE__ */ x({
72
72
  },
73
73
  setup(e) {
74
74
  const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, i = O({ visibility: "hidden", top: "0", left: "0" }), s = O([]), o = ee();
75
- L(r);
76
- function r() {
77
- const p = o.vnode.el, { styles: g, classes: m } = l(p, n);
75
+ L(l);
76
+ function l() {
77
+ if (!o)
78
+ return;
79
+ const p = o.vnode.el, { styles: g, classes: m } = r(p, n);
78
80
  i.value = g, s.value = m;
79
81
  }
80
- function l(p, g) {
81
- const m = t.anchor instanceof HTMLElement ? {} : t.anchor, y = g.getBoundingClientRect(), f = p.getBoundingClientRect();
82
- m.matchWidth && (f.width = y.width), m.matchHeight && (f.height = y.height);
83
- const h = m.class ? Array.isArray(m.class) ? m.class : [m.class] : [];
82
+ function r(p, g) {
83
+ const m = t.anchor instanceof HTMLElement ? {} : t.anchor, v = g.getBoundingClientRect(), f = p.getBoundingClientRect();
84
+ m.matchWidth && (f.width = v.width), m.matchHeight && (f.height = v.height);
85
+ const u = m.class ? Array.isArray(m.class) ? m.class : [m.class] : [];
84
86
  let c, T;
85
87
  if (m.y === "center")
86
- c = y.top + y.height / 2 - f.height / 2, h.push("anchored-center-y");
88
+ c = v.top + v.height / 2 - f.height / 2, u.push("anchored-center-y");
87
89
  else {
88
- const H = (y.bottom + f.height < window.innerHeight || m.y === "below") && m.y !== "above";
89
- c = H ? y.bottom : y.top - f.height, h.push(H ? "anchored-top" : "anchored-bottom");
90
+ const H = (v.bottom + f.height < window.innerHeight || m.y === "below") && m.y !== "above";
91
+ c = H ? v.bottom : v.top - f.height, u.push(H ? "anchored-top" : "anchored-bottom");
90
92
  }
91
93
  if (m.x === "center")
92
- T = y.left + y.width / 2 - f.width / 2, h.push("anchored-center-x");
94
+ T = v.left + v.width / 2 - f.width / 2, u.push("anchored-center-x");
93
95
  else {
94
- const H = (y.left + f.width < window.innerWidth || m.x === "left") && m.x !== "right";
95
- T = H ? y.left : y.right - f.width, h.push(H ? "anchored-left" : "anchored-right");
96
+ const H = (v.left + f.width < window.innerWidth || m.x === "left") && m.x !== "right";
97
+ T = H ? v.left : v.right - f.width, u.push(H ? "anchored-left" : "anchored-right");
96
98
  }
97
99
  return {
98
100
  styles: {
@@ -101,7 +103,7 @@ const Mn = /* @__PURE__ */ Ce(nt, [["render", lt]]), rt = /* @__PURE__ */ x({
101
103
  ...m.matchWidth ? { width: `${f.width}px` } : {},
102
104
  ...m.matchHeight ? { height: `${f.height}px` } : {}
103
105
  },
104
- classes: h
106
+ classes: u
105
107
  };
106
108
  }
107
109
  function a() {
@@ -111,7 +113,7 @@ const Mn = /* @__PURE__ */ Ce(nt, [["render", lt]]), rt = /* @__PURE__ */ x({
111
113
  setTimeout(() => {
112
114
  window.addEventListener("click", a);
113
115
  }, 10);
114
- }), (p, g) => (d(), u("div", {
116
+ }), (p, g) => (d(), h("div", {
115
117
  class: k(["vf-overlay-anchor", s.value]),
116
118
  style: Ke(i.value),
117
119
  onClick: te(a, ["stop"])
@@ -131,18 +133,18 @@ const S = je([]), In = x({
131
133
  function ie(e, t, n) {
132
134
  const i = document.getElementById("vf-overlay-target") ?? document.createElement("div");
133
135
  i.id = "vf-overlay-target", i.removeAttribute("inert"), document.body.appendChild(i);
134
- const s = String(++at), o = We(e), r = W(o, t), l = n != null && n.anchor ? W(rt, { overlayId: s, anchor: n.anchor }, () => [r]) : void 0, a = {
136
+ const s = String(++at), o = We(e), l = W(o, t), r = n != null && n.anchor ? W(lt, { overlayId: s, anchor: n.anchor }, () => [l]) : void 0, a = {
135
137
  id: s,
136
138
  component: o,
137
139
  props: t,
138
140
  options: n ?? {},
139
- vnode: r,
140
- wrapperVnode: l
141
+ vnode: l,
142
+ wrapperVnode: r
141
143
  };
142
144
  return S.push(a), a;
143
145
  }
144
146
  function Hn(e) {
145
- Le(e.$);
147
+ e.$ && Le(e.$);
146
148
  }
147
149
  function Le(e) {
148
150
  let t = e;
@@ -164,10 +166,10 @@ function P(e) {
164
166
  async function se(e, t, n) {
165
167
  return new Promise((i) => {
166
168
  let s = null;
167
- const r = { ...t, callback: (l) => {
168
- P(s), i(l);
169
+ const l = { ...t, callback: (r) => {
170
+ P(s), i(r);
169
171
  } };
170
- s = ie(e, r, n);
172
+ s = ie(e, l, n);
171
173
  });
172
174
  }
173
175
  function q(e, t) {
@@ -233,11 +235,13 @@ async function Fn(e) {
233
235
  }
234
236
  const B = Symbol("MaskState");
235
237
  function _n(e, t) {
236
- const n = e.$.vnode.el, i = n.closest(".vf-modal");
238
+ var s;
239
+ const n = (s = e.$) == null ? void 0 : s.vnode.el, i = n.closest(".vf-modal");
237
240
  return ht(i ?? n, t);
238
241
  }
239
242
  function Nn(e) {
240
- const t = e.$.vnode.el, n = t.closest(".vf-modal");
243
+ var i;
244
+ const t = (i = e.$) == null ? void 0 : i.vnode.el, n = t.closest(".vf-modal");
241
245
  return Me(n ?? t);
242
246
  }
243
247
  function ht(e, t) {
@@ -253,24 +257,30 @@ function Me(e) {
253
257
  const Q = Symbol("FormMaskState");
254
258
  function ft(e, t, n) {
255
259
  const i = e instanceof Element ? e : He(e);
260
+ if (!i)
261
+ return;
256
262
  i.classList.add("vf-masked");
257
263
  const s = t instanceof Element ? t : i.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0];
258
264
  let o;
259
265
  s && (o = s.tagName === "INPUT" ? s.value : s.innerHTML, s.setAttribute("disabled", "disabled"), s.innerText = n ?? "Please wait...");
260
- const l = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
261
- return l.forEach((a) => a.setAttribute("disabled", "disabled")), i[Q] = {
262
- disabledElements: l,
266
+ const r = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
267
+ return r.forEach((a) => a.setAttribute("disabled", "disabled")), i[Q] = {
268
+ disabledElements: r,
263
269
  waitButton: s,
264
270
  buttonHtml: o
265
271
  }, () => Ie(i);
266
272
  }
267
273
  function Ie(e) {
268
- const t = e instanceof Element ? e : He(e), n = t[Q];
274
+ const t = e instanceof Element ? e : He(e);
275
+ if (!t)
276
+ return;
277
+ const n = t[Q];
269
278
  n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((i) => i.removeAttribute("disabled")), n.waitButton && (n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled")), delete t[Q]);
270
279
  }
271
280
  function He(e) {
272
- const t = e.$.vnode.el;
273
- return t.tagName === "FORM" ? t : t.querySelector("form");
281
+ var n;
282
+ const t = (n = e == null ? void 0 : e.$) == null ? void 0 : n.vnode.el;
283
+ return t ? t.tagName === "FORM" ? t : t.querySelector("form") : null;
274
284
  }
275
285
  const pt = ["id"], mt = {
276
286
  key: 0,
@@ -290,8 +300,8 @@ const pt = ["id"], mt = {
290
300
  emits: ["formSubmit"],
291
301
  setup(e, { expose: t }) {
292
302
  const n = ee(), i = e;
293
- t({ mask: m, unmask: y, hide: f, unhide: h });
294
- const s = O(), o = O(), r = O(!1), l = _(() => ze([i.class, r.value && "hidden"]));
303
+ t({ mask: m, unmask: v, hide: f, unhide: u });
304
+ const s = O(), o = O(), l = O(!1), r = _(() => ze([i.class, l.value && "hidden"]));
295
305
  L(() => {
296
306
  var c;
297
307
  document.body.classList.add("vf-modal-open"), i.closeOnMaskClick && (window.addEventListener("keydown", p), (c = s.value) == null || c.addEventListener("click", a));
@@ -311,20 +321,20 @@ const pt = ["id"], mt = {
311
321
  Le(n);
312
322
  }
313
323
  function m() {
314
- ft(o.value);
324
+ return ft(o.value), () => v();
315
325
  }
316
- function y() {
326
+ function v() {
317
327
  Ie(o.value);
318
328
  }
319
329
  function f() {
320
- r.value = !0;
330
+ return l.value = !0, () => u();
321
331
  }
322
- function h() {
323
- r.value = !1;
332
+ function u() {
333
+ l.value = !1;
324
334
  }
325
- return (c, T) => (d(), u("div", {
335
+ return (c, T) => (d(), h("div", {
326
336
  id: c.id,
327
- class: k(["vf-overlay vf-modal-wrap", l.value]),
337
+ class: k(["vf-overlay vf-modal-wrap", r.value]),
328
338
  ref_key: "overlay",
329
339
  ref: s
330
340
  }, [
@@ -335,9 +345,9 @@ const pt = ["id"], mt = {
335
345
  ref_key: "form",
336
346
  ref: o
337
347
  }, [
338
- c.$slots.header ? (d(), u("div", mt, [
348
+ c.$slots.header ? (d(), h("div", mt, [
339
349
  K(c.$slots, "header"),
340
- i.closeX ? (d(), u("i", {
350
+ i.closeX ? (d(), h("i", {
341
351
  key: 0,
342
352
  class: "close",
343
353
  onClick: g
@@ -346,7 +356,7 @@ const pt = ["id"], mt = {
346
356
  w("div", vt, [
347
357
  K(c.$slots, "default")
348
358
  ]),
349
- c.$slots.footer ? (d(), u("div", yt, [
359
+ c.$slots.footer ? (d(), h("div", yt, [
350
360
  K(c.$slots, "footer")
351
361
  ])) : b("", !0)
352
362
  ], 34)
@@ -371,11 +381,11 @@ const pt = ["id"], mt = {
371
381
  class: k(["vf-alert", i.classes])
372
382
  }, Pe({
373
383
  default: Y(() => [
374
- i.isHtml ? (d(), u("div", {
384
+ i.isHtml ? (d(), h("div", {
375
385
  key: 0,
376
386
  innerHtml: i.message,
377
387
  class: "user-message"
378
- }, null, 8, Et)) : (d(), u("div", {
388
+ }, null, 8, Et)) : (d(), h("div", {
379
389
  key: 1,
380
390
  innerText: n.value
381
391
  }, null, 8, Tt))
@@ -392,8 +402,8 @@ const pt = ["id"], mt = {
392
402
  i.isBare ? void 0 : {
393
403
  name: "footer",
394
404
  fn: Y(() => [
395
- i.shouldConfirm ? (d(), u(U, { key: 0 }, [
396
- j((d(), u("button", {
405
+ i.shouldConfirm ? (d(), h(U, { key: 0 }, [
406
+ j((d(), h("button", {
397
407
  class: "primary",
398
408
  onClick: s[0] || (s[0] = () => i.callback(!0))
399
409
  }, [
@@ -405,7 +415,7 @@ const pt = ["id"], mt = {
405
415
  class: "default",
406
416
  onClick: s[1] || (s[1] = () => i.callback(!1))
407
417
  }, "Cancel")
408
- ], 64)) : j((d(), u("button", {
418
+ ], 64)) : j((d(), h("button", {
409
419
  key: 1,
410
420
  class: "default",
411
421
  onClick: s[2] || (s[2] = () => i.callback(!0))
@@ -428,11 +438,11 @@ function Ot() {
428
438
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
429
439
  return R(wt);
430
440
  }
431
- const v = [];
441
+ const y = [];
432
442
  for (let e = 0; e < 256; ++e)
433
- v.push((e + 256).toString(16).slice(1));
443
+ y.push((e + 256).toString(16).slice(1));
434
444
  function bt(e, t = 0) {
435
- return v[e[t + 0]] + v[e[t + 1]] + v[e[t + 2]] + v[e[t + 3]] + "-" + v[e[t + 4]] + v[e[t + 5]] + "-" + v[e[t + 6]] + v[e[t + 7]] + "-" + v[e[t + 8]] + v[e[t + 9]] + "-" + v[e[t + 10]] + v[e[t + 11]] + v[e[t + 12]] + v[e[t + 13]] + v[e[t + 14]] + v[e[t + 15]];
445
+ return y[e[t + 0]] + y[e[t + 1]] + y[e[t + 2]] + y[e[t + 3]] + "-" + y[e[t + 4]] + y[e[t + 5]] + "-" + y[e[t + 6]] + y[e[t + 7]] + "-" + y[e[t + 8]] + y[e[t + 9]] + "-" + y[e[t + 10]] + y[e[t + 11]] + y[e[t + 12]] + y[e[t + 13]] + y[e[t + 14]] + y[e[t + 15]];
436
446
  }
437
447
  const kt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ue = {
438
448
  randomUUID: kt
@@ -543,16 +553,16 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
543
553
  },
544
554
  optionsDescriptors() {
545
555
  return this.allOptions.map((e, t) => {
546
- var l, a;
547
- const n = this.formatter(e), i = (l = this.subtitleFormatter) == null ? void 0 : l.call(this, e), s = n ? n.trim().toLowerCase() : "", o = i ? i.trim().toLowerCase() : "", r = [];
556
+ var r, a;
557
+ const n = this.formatter(e), i = (r = this.subtitleFormatter) == null ? void 0 : r.call(this, e), s = n ? n.trim().toLowerCase() : "", o = i ? i.trim().toLowerCase() : "", l = [];
548
558
  return this.searchFields ? this.searchFields.forEach((p) => {
549
- e[p] && r.push(String(e[p]).toLowerCase());
550
- }) : (r.push(s), o && r.push(o)), {
559
+ e[p] && l.push(String(e[p]).toLowerCase());
560
+ }) : (l.push(s), o && l.push(o)), {
551
561
  // eslint-disable-next-line vue/no-use-computed-property-like-method
552
562
  key: ((a = this.effectiveKeyExtractor) == null ? void 0 : a.call(this, e)) ?? String(t),
553
563
  title: n,
554
564
  subtitle: i,
555
- searchContent: r.join(""),
565
+ searchContent: l.join(""),
556
566
  ref: e
557
567
  };
558
568
  });
@@ -740,46 +750,46 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
740
750
  class: "no-results"
741
751
  };
742
752
  function _t(e, t, n, i, s, o) {
743
- const r = Oe("disabled");
744
- return d(), u("div", {
753
+ const l = Oe("disabled");
754
+ return d(), h("div", {
745
755
  class: k(["vf-smart-select", { disabled: o.effectiveDisabled, open: e.shouldDisplayOptions }])
746
756
  }, [
747
757
  j(w("input", {
748
- "onUpdate:modelValue": t[0] || (t[0] = (l) => e.searchText = l),
758
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => e.searchText = r),
749
759
  ref: "searchField",
750
760
  type: "text",
751
761
  class: k({ nullable: !!n.nullTitle }),
752
- onKeydown: t[1] || (t[1] = (...l) => o.handleKeyDown && o.handleKeyDown(...l)),
762
+ onKeydown: t[1] || (t[1] = (...r) => o.handleKeyDown && o.handleKeyDown(...r)),
753
763
  placeholder: o.effectivePlaceholder,
754
- onFocus: t[2] || (t[2] = (...l) => o.handleInputFocused && o.handleInputFocused(...l)),
755
- onBlur: t[3] || (t[3] = (...l) => o.handleInputBlurred && o.handleInputBlurred(...l)),
764
+ onFocus: t[2] || (t[2] = (...r) => o.handleInputFocused && o.handleInputFocused(...r)),
765
+ onBlur: t[3] || (t[3] = (...r) => o.handleInputBlurred && o.handleInputBlurred(...r)),
756
766
  required: n.required
757
767
  }, null, 42, Ht), [
758
768
  [qe, e.searchText],
759
- [r, o.effectiveDisabled]
769
+ [l, o.effectiveDisabled]
760
770
  ]),
761
- e.shouldDisplayOptions ? (d(), u("div", Dt, [
762
- e.isLoaded ? (d(), u(U, { key: 1 }, [
763
- (d(!0), u(U, null, J(o.effectiveOptions, (l) => (d(), u("div", {
764
- key: String(l.key),
771
+ e.shouldDisplayOptions ? (d(), h("div", Dt, [
772
+ e.isLoaded ? (d(), h(U, { key: 1 }, [
773
+ (d(!0), h(U, null, J(o.effectiveOptions, (r) => (d(), h("div", {
774
+ key: String(r.key),
765
775
  class: k(["option", {
766
- highlighted: e.highlightedOptionKey === l.key
776
+ highlighted: e.highlightedOptionKey === r.key
767
777
  }]),
768
- onMousemove: (a) => o.handleOptionHover(l),
769
- onMousedown: (a) => o.selectOption(l)
778
+ onMousemove: (a) => o.handleOptionHover(r),
779
+ onMousedown: (a) => o.selectOption(r)
770
780
  }, [
771
781
  w("div", {
772
782
  class: "title",
773
- innerHTML: l.title
783
+ innerHTML: r.title
774
784
  }, null, 8, Bt),
775
- l.subtitle ? (d(), u("div", {
785
+ r.subtitle ? (d(), h("div", {
776
786
  key: 0,
777
787
  class: "subtitle",
778
- innerHTML: l.subtitle
788
+ innerHTML: r.subtitle
779
789
  }, null, 8, Vt)) : b("", !0)
780
790
  ], 42, $t))), 128)),
781
- !o.effectiveOptions.length && e.searchText ? (d(), u("div", Ft, C(o.effectiveNoResultsText), 1)) : b("", !0)
782
- ], 64)) : (d(), u("div", At, "Loading..."))
791
+ !o.effectiveOptions.length && e.searchText ? (d(), h("div", Ft, C(o.effectiveNoResultsText), 1)) : b("", !0)
792
+ ], 64)) : (d(), h("div", At, "Loading..."))
783
793
  ], 512)) : b("", !0)
784
794
  ], 2);
785
795
  }
@@ -794,27 +804,27 @@ const Nt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ x({
794
804
  },
795
805
  emits: ["update:modelValue"],
796
806
  setup(e, { emit: t }) {
797
- const n = e, i = _(() => Array.isArray(n.options) ? n.options.map((l) => ({ value: l, label: l })) : Object.entries(n.options).map(([l, a]) => ({
798
- value: l,
807
+ const n = e, i = _(() => Array.isArray(n.options) ? n.options.map((r) => ({ value: r, label: r })) : Object.entries(n.options).map(([r, a]) => ({
808
+ value: r,
799
809
  label: a
800
- }))), s = _(() => n.formatter ? (l) => {
810
+ }))), s = _(() => n.formatter ? (r) => {
801
811
  var a;
802
- return (a = n.formatter) == null ? void 0 : a.call(n, l.label);
803
- } : (l) => l.label), o = t, r = O(i.value.find((l) => l.value === n.modelValue) ?? null);
812
+ return (a = n.formatter) == null ? void 0 : a.call(n, r.label);
813
+ } : (r) => r.label), o = t, l = O(i.value.find((r) => r.value === n.modelValue) ?? null);
804
814
  return ce(
805
815
  () => n.modelValue,
806
- (l) => {
807
- r.value = i.value.find((a) => a.value === l) ?? null;
816
+ (r) => {
817
+ l.value = i.value.find((a) => a.value === r) ?? null;
808
818
  }
809
- ), ce(r, (l) => {
819
+ ), ce(l, (r) => {
810
820
  var a;
811
- o("update:modelValue", l ? ((a = i.value.find((p) => xe(p, l))) == null ? void 0 : a.value) ?? null : null);
812
- }), (l, a) => (d(), be(Nt, {
813
- modelValue: r.value,
814
- "onUpdate:modelValue": a[0] || (a[0] = (p) => r.value = p),
821
+ o("update:modelValue", r ? ((a = i.value.find((p) => xe(p, r))) == null ? void 0 : a.value) ?? null : null);
822
+ }), (r, a) => (d(), be(Nt, {
823
+ modelValue: l.value,
824
+ "onUpdate:modelValue": a[0] || (a[0] = (p) => l.value = p),
815
825
  options: i.value,
816
826
  formatter: s.value,
817
- "null-title": l.nullTitle
827
+ "null-title": r.nullTitle
818
828
  }, null, 8, ["modelValue", "options", "formatter", "null-title"]));
819
829
  }
820
830
  }), Rt = { class: "content" }, Kt = { class: "message" }, jt = {
@@ -846,15 +856,15 @@ const Nt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ x({
846
856
  duration: s * 1e3,
847
857
  easing: "linear"
848
858
  }), setTimeout(() => t.callback(), s * 1e3);
849
- }), (s, o) => (d(), u("div", {
859
+ }), (s, o) => (d(), h("div", {
850
860
  class: k(["vf-toast", s.className]),
851
861
  onClick: te(n, ["stop"])
852
862
  }, [
853
863
  w("div", Rt, [
854
864
  w("div", Kt, C(s.message), 1),
855
- s.disableClose ? b("", !0) : (d(), u("div", jt, "x"))
865
+ s.disableClose ? b("", !0) : (d(), h("div", jt, "x"))
856
866
  ]),
857
- s.durationSecs !== null ? (d(), u("div", Ut, [
867
+ s.durationSecs !== null ? (d(), h("div", Ut, [
858
868
  w("div", {
859
869
  ref_key: "progressInnerEl",
860
870
  ref: i,
@@ -933,25 +943,25 @@ function qn(e, t) {
933
943
  c.classList.add("separator"), i.appendChild(c);
934
944
  return;
935
945
  }
936
- const h = document.createElement("div");
937
- h.classList.add("item"), h.style.userSelect = "none", h.innerText = f.title, i.appendChild(h), f.class && h.classList.add(f.class), f.shouldConfirm ? h.addEventListener("click", (c) => y(c, h, f.handler)) : h.addEventListener("click", () => f.handler());
946
+ const u = document.createElement("div");
947
+ u.classList.add("item"), u.style.userSelect = "none", u.innerText = f.title, i.appendChild(u), f.class && u.classList.add(f.class), f.shouldConfirm ? u.addEventListener("click", (c) => v(c, u, f.handler)) : u.addEventListener("click", () => f.handler());
938
948
  });
939
- const o = window.innerWidth - e.clientX, r = window.innerHeight - e.clientY, l = i.offsetHeight, a = i.offsetWidth, p = o < a ? e.clientX - a - 1 : e.clientX + 1, g = r < l ? e.clientY - l - 1 : e.clientY + 1;
949
+ const o = window.innerWidth - e.clientX, l = window.innerHeight - e.clientY, r = i.offsetHeight, a = i.offsetWidth, p = o < a ? e.clientX - a - 1 : e.clientX + 1, g = l < r ? e.clientY - r - 1 : e.clientY + 1;
940
950
  i.style.left = p + "px", i.style.top = g + "px", setTimeout(() => {
941
951
  i.style.width = i.offsetWidth + "px";
942
952
  }, 50);
943
953
  function m() {
944
954
  t.targetClass && s.classList.remove(t.targetClass), s.classList.remove("context-menu-active"), s.style.userSelect = "", n.remove();
945
955
  }
946
- function y(f, h, c) {
947
- if (h.classList.contains("pending-confirm"))
956
+ function v(f, u, c) {
957
+ if (u.classList.contains("pending-confirm"))
948
958
  return c();
949
- const T = h.innerHTML;
950
- h.classList.add("pending-confirm"), h.innerText = "Confirm";
959
+ const T = u.innerHTML;
960
+ u.classList.add("pending-confirm"), u.innerText = "Confirm";
951
961
  const I = () => {
952
- h.classList.remove("pending-confirm"), h.innerHTML = T, h.removeEventListener("mouseleave", I);
962
+ u.classList.remove("pending-confirm"), u.innerHTML = T, u.removeEventListener("mouseleave", I);
953
963
  };
954
- h.addEventListener("mouseleave", I), f.stopPropagation();
964
+ u.addEventListener("mouseleave", I), f.stopPropagation();
955
965
  }
956
966
  }
957
967
  const tn = (e) => new Promise((t) => setTimeout(t, e)), zn = (e) => tn(e * 1e3);
@@ -978,7 +988,7 @@ function Zn(e) {
978
988
  }
979
989
  });
980
990
  }
981
- const le = Symbol("HookState");
991
+ const re = Symbol("HookState");
982
992
  function Gn(e, t) {
983
993
  const n = t ?? ee();
984
994
  L(() => sn(n, e), n), ke(() => on(n), n), Se(() => pe(n), n), ne(() => pe(n), n);
@@ -989,16 +999,16 @@ function sn(e, t) {
989
999
  const i = De(e.vnode.el);
990
1000
  i ? n.ancestor = new V(i, t.ancestorScrolledToBottom) : console.warn("[VueFoundation] No scollable ancestor found for component:", e);
991
1001
  }
992
- t.windowScrolledToBottom && (n.window = new V(window, t.windowScrolledToBottom)), e[le] = n;
1002
+ t.windowScrolledToBottom && (n.window = new V(window, t.windowScrolledToBottom)), e[re] = n;
993
1003
  }
994
1004
  function on(e) {
995
1005
  var n, i, s;
996
- const t = e[le];
1006
+ const t = e[re];
997
1007
  (n = t == null ? void 0 : t.el) == null || n.install(), (i = t == null ? void 0 : t.ancestor) == null || i.install(), (s = t == null ? void 0 : t.window) == null || s.install();
998
1008
  }
999
1009
  function pe(e) {
1000
1010
  var n, i, s;
1001
- const t = e[le];
1011
+ const t = e[re];
1002
1012
  (n = t == null ? void 0 : t.el) == null || n.uninstall(), (i = t == null ? void 0 : t.ancestor) == null || i.uninstall(), (s = t == null ? void 0 : t.window) == null || s.uninstall();
1003
1013
  }
1004
1014
  const Z = ["auto", "scroll"];
@@ -1028,7 +1038,7 @@ class V {
1028
1038
  function Qn(e) {
1029
1039
  L(() => window.addEventListener("resize", e)), ke(() => window.addEventListener("resize", e)), Se(() => window.removeEventListener("resize", e)), ne(() => window.removeEventListener("resize", e));
1030
1040
  }
1031
- const ln = {
1041
+ const rn = {
1032
1042
  mounted: ve,
1033
1043
  updated: ve
1034
1044
  }, me = Symbol("HasAutoFocused");
@@ -1039,13 +1049,13 @@ function ve(e, t) {
1039
1049
  const n = ["BUTTON", "INPUT", "TEXTAREA", "SELECT"].indexOf(e.tagName) > -1 ? e : e.querySelectorAll("input")[0];
1040
1050
  setTimeout(() => n.focus(), 10);
1041
1051
  }
1042
- const rn = {
1052
+ const ln = {
1043
1053
  mounted: an
1044
1054
  }, A = Symbol("ConfirmState");
1045
1055
  function an(e, t) {
1046
1056
  e.addEventListener("click", (n) => {
1047
- var r, l;
1048
- const i = Date.now(), s = ((r = t.value) == null ? void 0 : r.text) !== void 0 ? t.value.text : "Confirm";
1057
+ var l, r;
1058
+ const i = Date.now(), s = ((l = t.value) == null ? void 0 : l.text) !== void 0 ? t.value.text : "Confirm";
1049
1059
  if (e[A]) {
1050
1060
  if (i - e[A].initTime < 300)
1051
1061
  return;
@@ -1061,7 +1071,7 @@ function an(e, t) {
1061
1071
  s && (e.innerHTML = o.preconfirmHtml), (a = t.value) != null && a.class && e.classList.remove(t.value.class), e.blur(), e.removeEventListener("mouseout", o.resetHandler), delete e[A];
1062
1072
  }
1063
1073
  };
1064
- e[A] = o, s && (e.innerHTML = s), (l = t.value) != null && l.class && e.classList.add(t.value.class), e.addEventListener("mouseout", o.resetHandler);
1074
+ e[A] = o, s && (e.innerHTML = s), (r = t.value) != null && r.class && e.classList.add(t.value.class), e.addEventListener("mouseout", o.resetHandler);
1065
1075
  });
1066
1076
  }
1067
1077
  const cn = {
@@ -1089,14 +1099,14 @@ function hn(e, t) {
1089
1099
  let n = "";
1090
1100
  const i = t.value.replace(/ /g, "T").replace(/\.\d+Z$/, "Z"), s = e.attributes.getNamedItem("local") !== null ? i.replace(/Z$/, "") : i.replace(/(Z|\+00:00)?$/, "Z"), o = new Date(s);
1091
1101
  e.attributes.getNamedItem("display-utc") !== null && o.setMinutes(o.getMinutes() - o.getTimezoneOffset());
1092
- let r = (p = e.attributes.getNamedItem("format")) == null ? void 0 : p.value;
1093
- if (!r && e.attributes.getNamedItem("relative-date") !== null) {
1102
+ let l = (p = e.attributes.getNamedItem("format")) == null ? void 0 : p.value;
1103
+ if (!l && e.attributes.getNamedItem("relative-date") !== null) {
1094
1104
  const g = /* @__PURE__ */ new Date();
1095
- g.getFullYear() == o.getFullYear() && g.getMonth() == o.getMonth() && g.getDate() == o.getDate() && (n = "at", r = "HH:mm");
1105
+ g.getFullYear() == o.getFullYear() && g.getMonth() == o.getMonth() && g.getDate() == o.getDate() && (n = "at", l = "HH:mm");
1096
1106
  }
1097
- r || (e.attributes.getNamedItem("date-only") !== null ? r = M.defaultDateFormat : r = M.defaultDateTimeFormat);
1098
- let l = G(o, r);
1099
- return n && (l = n + " " + l), l;
1107
+ l || (e.attributes.getNamedItem("date-only") !== null ? l = M.defaultDateFormat : l = M.defaultDateTimeFormat);
1108
+ let r = G(o, l);
1109
+ return n && (r = n + " " + r), r;
1100
1110
  }
1101
1111
  const fn = {
1102
1112
  beforeMount: ge,
@@ -1113,19 +1123,19 @@ const mn = {
1113
1123
  beforeMount: Ee,
1114
1124
  updated: Ee,
1115
1125
  unmounted: $e
1116
- }, N = Symbol("HasAutoFocused"), re = [];
1126
+ }, N = Symbol("HasAutoFocused"), le = [];
1117
1127
  function vn() {
1118
- re.forEach(Ae);
1128
+ le.forEach(Ae);
1119
1129
  }
1120
1130
  setInterval(vn, 1e3);
1121
1131
  function Ee(e, t) {
1122
- var r;
1132
+ var l;
1123
1133
  if (t.value == t.oldValue)
1124
1134
  return;
1125
1135
  if (!t.value)
1126
1136
  return $e(e);
1127
- const n = new Date(t.value), i = (r = e.attributes.getNamedItem("base-time")) == null ? void 0 : r.value, s = n.getTime() - (i ? new Date(i).getTime() - t.value * 1e3 : 0), o = e.getAttribute("no-seconds") === null;
1128
- e[N] || re.push(e), e[N] = {
1137
+ const n = new Date(t.value), i = (l = e.attributes.getNamedItem("base-time")) == null ? void 0 : l.value, s = n.getTime() - (i ? new Date(i).getTime() - t.value * 1e3 : 0), o = e.getAttribute("no-seconds") === null;
1138
+ e[N] || le.push(e), e[N] = {
1129
1139
  startTs: s,
1130
1140
  includeSeconds: o
1131
1141
  }, Ae(e);
@@ -1135,7 +1145,7 @@ function Ae(e) {
1135
1145
  e.innerText = yn(n, t.includeSeconds);
1136
1146
  }
1137
1147
  function $e(e) {
1138
- e[N] && (Qe(re, e), delete e[N]), e.innerText = "-";
1148
+ e[N] && (Qe(le, e), delete e[N]), e.innerText = "-";
1139
1149
  }
1140
1150
  function yn(e, t) {
1141
1151
  const n = [], i = Math.floor(e / 86400);
@@ -1222,8 +1232,8 @@ class wn {
1222
1232
  }
1223
1233
  handleMouseMove(t) {
1224
1234
  const n = this.tipEl.offsetWidth, i = this.tipEl.offsetHeight, s = window.innerWidth, o = window.innerHeight;
1225
- let r = t.pageX + 10, l = t.pageY + 20;
1226
- r + n > s && (r = t.pageX - 5 - n), l + i > o && (l = t.pageY - 5 - i), this.tipEl.style.left = r + "px", this.tipEl.style.top = l + "px", this.lastMoveEvt = t;
1235
+ let l = t.pageX + 10, r = t.pageY + 20;
1236
+ l + n > s && (l = t.pageX - 5 - n), r + i > o && (r = t.pageY - 5 - i), this.tipEl.style.left = l + "px", this.tipEl.style.top = r + "px", this.lastMoveEvt = t;
1227
1237
  }
1228
1238
  checkMoveEvent() {
1229
1239
  var t;
@@ -1234,7 +1244,7 @@ class wn {
1234
1244
  }
1235
1245
  }
1236
1246
  function On(e) {
1237
- e.directive("autofocus", ln), e.directive("confirm-button", rn), e.directive("date-input", cn), e.directive("datetime", un), e.directive("disabled", fn), e.directive("duration", mn), e.directive("infinite-scroll", gn), e.directive("readonly", En), e.directive("tooltip", Tn);
1247
+ e.directive("autofocus", rn), e.directive("confirm-button", ln), e.directive("date-input", cn), e.directive("datetime", un), e.directive("disabled", fn), e.directive("duration", mn), e.directive("infinite-scroll", gn), e.directive("readonly", En), e.directive("tooltip", Tn);
1238
1248
  }
1239
1249
  function Jn(e) {
1240
1250
  On(e);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.13.5",
4
+ "version": "4.13.7",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "exports": {
@@ -82,6 +82,7 @@ function closeParent() {
82
82
 
83
83
  function mask() {
84
84
  maskForm(form.value!);
85
+ return () => unmask();
85
86
  }
86
87
 
87
88
  function unmask() {
@@ -90,6 +91,7 @@ function unmask() {
90
91
 
91
92
  function hide() {
92
93
  isHidden.value = true;
94
+ return () => unhide();
93
95
  }
94
96
 
95
97
  function unhide() {
@@ -25,7 +25,8 @@ const instance = getCurrentInstance();
25
25
  onMounted(updateAttributes);
26
26
 
27
27
  function updateAttributes() {
28
- const overlayEl = instance!.vnode.el as HTMLElement;
28
+ if (!instance) return;
29
+ const overlayEl = instance.vnode.el as HTMLElement;
29
30
  const { styles, classes } = computeAnchoredStyle(overlayEl, anchorEl);
30
31
  anchorStyles.value = styles;
31
32
  anchorClasses.value = classes;
@@ -90,7 +90,7 @@ interface PropsWithCallback<T> {
90
90
  }
91
91
  type ComponentReturn<M extends OverlayComponent> = OverlayComponentProps<M> extends PropsWithCallback<infer R> ? R : never;
92
92
 
93
- export type AnyComponentPublicInstance = { $: ComponentInternalInstance };
93
+ export type AnyComponentPublicInstance = { $?: ComponentInternalInstance };
94
94
 
95
95
  export function createOverlayInjection<C extends OverlayComponent>(
96
96
  component: C,
@@ -124,7 +124,7 @@ export function createOverlayInjection<C extends OverlayComponent>(
124
124
  }
125
125
 
126
126
  export function dismissOverlayInjectionByInstance(instance: AnyComponentPublicInstance) {
127
- dismissOverlayInjectionByInternalInstance(instance.$);
127
+ instance.$ && dismissOverlayInjectionByInternalInstance(instance.$);
128
128
  }
129
129
 
130
130
  export function dismissOverlayInjectionByInternalInstance(instance: ComponentInternalInstance) {
@@ -12,13 +12,13 @@ interface IMaskState {
12
12
  type MaskElement = Element & IMaskState;
13
13
 
14
14
  export function maskComponent(cmp: AnyComponentPublicInstance, message?: string) {
15
- const el = cmp.$.vnode.el;
15
+ const el = cmp.$?.vnode.el;
16
16
  const modalParentlEl = el!.closest('.vf-modal');
17
17
  return maskEl(modalParentlEl ?? el, message);
18
18
  }
19
19
 
20
20
  export function unmaskComponent(cmp: AnyComponentPublicInstance) {
21
- const el = cmp.$.vnode.el;
21
+ const el = cmp.$?.vnode.el;
22
22
  const modalParentlEl = el!.closest('.vf-modal');
23
23
  return unmaskEl(modalParentlEl ?? el);
24
24
  }
@@ -58,6 +58,8 @@ type FormMaskElement = Element & IFormMaskState;
58
58
 
59
59
  export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, buttonSelector?: string | Element, buttonText?: string) {
60
60
  const form = formOrCmp instanceof Element ? formOrCmp : getFormFromCmp(formOrCmp);
61
+ if (!form) return;
62
+
61
63
  form.classList.add('vf-masked');
62
64
 
63
65
  const buttonEl = (
@@ -85,6 +87,7 @@ export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, button
85
87
 
86
88
  export function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance) {
87
89
  const form = formOrCmp instanceof Element ? formOrCmp : getFormFromCmp(formOrCmp);
90
+ if (!form) return;
88
91
 
89
92
  const state = (form as FormMaskElement)[FormMaskState];
90
93
  if (!state) return;
@@ -101,8 +104,9 @@ export function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance) {
101
104
  delete (form as FormMaskElement)[FormMaskState];
102
105
  }
103
106
 
104
- function getFormFromCmp(cmp: AnyComponentPublicInstance) {
105
- const cmpEl = cmp.$.vnode.el!;
107
+ function getFormFromCmp(cmp: AnyComponentPublicInstance | null) {
108
+ const cmpEl = cmp?.$?.vnode.el;
109
+ if (!cmpEl) return null;
106
110
  if (cmpEl.tagName === 'FORM') {
107
111
  return cmpEl as HTMLElement;
108
112
  } else {