@signal24/vue-foundation 4.13.6 → 4.13.8

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.
@@ -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;
@@ -74,6 +74,8 @@ const Mn = /* @__PURE__ */ Ce(nt, [["render", rt]]), lt = /* @__PURE__ */ x({
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
75
  L(l);
76
76
  function l() {
77
+ if (!o)
78
+ return;
77
79
  const p = o.vnode.el, { styles: g, classes: m } = r(p, n);
78
80
  i.value = g, s.value = m;
79
81
  }
@@ -142,7 +144,7 @@ function ie(e, t, n) {
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;
@@ -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,6 +257,9 @@ 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 () => {
262
+ };
256
263
  i.classList.add("vf-masked");
257
264
  const s = t instanceof Element ? t : i.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0];
258
265
  let o;
@@ -265,12 +272,16 @@ function ft(e, t, n) {
265
272
  }, () => Ie(i);
266
273
  }
267
274
  function Ie(e) {
268
- const t = e instanceof Element ? e : He(e), n = t[Q];
275
+ const t = e instanceof Element ? e : He(e);
276
+ if (!t)
277
+ return;
278
+ const n = t[Q];
269
279
  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
280
  }
271
281
  function He(e) {
272
- const t = e.$.vnode.el;
273
- return t.tagName === "FORM" ? t : t.querySelector("form");
282
+ var n;
283
+ const t = (n = e == null ? void 0 : e.$) == null ? void 0 : n.vnode.el;
284
+ return t ? t.tagName === "FORM" ? t : t.querySelector("form") : null;
274
285
  }
275
286
  const pt = ["id"], mt = {
276
287
  key: 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.13.6",
4
+ "version": "4.13.8",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "exports": {
@@ -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 {