@effect-app/vue-components 0.27.11 → 0.27.12

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,8 +1,8 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var d=document.createElement("style");if(d.appendChild(document.createTextNode("fieldset[data-v-42cdd73c]{display:contents}fieldset[disabled][data-v-42cdd73c]>*{pointer-events:none}")),document.head.appendChild(d),window.customElements){const e=window.customElements.define;window.customElements.define=function(c,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-42cdd73c]{display:contents}fieldset[disabled][data-v-42cdd73c]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,c,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-5ae97f5e]{display:contents}fieldset[disabled][data-v-5ae97f5e]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-5ae97f5e]{display:contents}fieldset[disabled][data-v-5ae97f5e]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
2
  import o from "./vue-components.es20.js";
3
3
 
4
4
  import r from "./vue-components.es17.js";
5
- const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-42cdd73c"]]);
5
+ const t = /* @__PURE__ */ r(o, [["__scopeId", "data-v-5ae97f5e"]]);
6
6
  export {
7
- m as default
7
+ t as default
8
8
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as B, getCurrentInstance as F, computed as u, onBeforeMount as L, watch as S, createElementBlock as O, openBlock as h, withModifiers as C, createElementVNode as V, unref as m, renderSlot as p, createCommentVNode as k, Fragment as _ } from "vue";
1
+ import { defineComponent as M, getCurrentInstance as B, computed as u, onBeforeMount as L, watch as S, provide as C, createElementBlock as O, openBlock as h, withModifiers as V, createElementVNode as k, unref as m, renderSlot as p, createCommentVNode as K, Fragment as _ } from "vue";
2
2
  import { useStore as y } from "@tanstack/vue-form";
3
- import { getOmegaStore as $ } from "./vue-components.es26.js";
3
+ import { getOmegaStore as $ } from "./vue-components.es27.js";
4
4
  import { provideOmegaErrors as A } from "./vue-components.es8.js";
5
- import { useOmegaForm as K } from "./vue-components.es9.js";
6
- const W = ["disabled"], H = /* @__PURE__ */ B({
5
+ import { useOmegaForm as W, OmegaFormKey as P } from "./vue-components.es9.js";
6
+ const x = ["disabled"], q = /* @__PURE__ */ M({
7
7
  __name: "OmegaWrapper",
8
8
  props: {
9
9
  omegaConfig: {},
@@ -27,12 +27,12 @@ const W = ["disabled"], H = /* @__PURE__ */ B({
27
27
  onSubmit: {}
28
28
  },
29
29
  setup(w) {
30
- const o = w, E = F(), j = (e, r) => new Promise((n) => {
30
+ const o = w, E = B(), j = (e, r) => new Promise((n) => {
31
31
  E.emit("submit", e, r);
32
32
  const t = S(() => o.isLoading, (i) => {
33
33
  i || (n(), t.stop());
34
34
  });
35
- }), b = typeof o.isLoading < "u" ? u(() => j) : typeof o.onSubmit < "u" ? u(() => o.onSubmit) : void 0, l = b?.value ? ({ formApi: e, meta: r, value: n }) => b.value(n, { meta: r, formApi: e }) : void 0, f = o.form || !o.schema ? void 0 : K(
35
+ }), v = typeof o.isLoading < "u" ? u(() => j) : typeof o.onSubmit < "u" ? u(() => o.onSubmit) : void 0, l = v?.value ? ({ formApi: e, meta: r, value: n }) => v.value(n, { meta: r, formApi: e }) : void 0, f = o.form || !o.schema ? void 0 : W(
36
36
  o.schema,
37
37
  {
38
38
  ...o,
@@ -79,10 +79,10 @@ Props will overwrite existing form options. This might indicate a configuration
79
79
  const I = y(
80
80
  s.value.store,
81
81
  (e) => e.isSubmitting
82
- ), v = $(
82
+ ), b = $(
83
83
  s.value,
84
84
  o.subscribe
85
- ), M = y(
85
+ ), F = y(
86
86
  s.value.store,
87
87
  (e) => e.submissionAttempts
88
88
  ), c = u(() => s.value.useStore((e) => e.errors));
@@ -106,23 +106,23 @@ Props will overwrite existing form options. This might indicate a configuration
106
106
  });
107
107
  }), {}) : {} : {};
108
108
  }
109
- ), A(M, c.value, o.showErrorsOn), (e, r) => (h(), O("form", {
109
+ ), A(F, c.value, o.showErrorsOn), C(P, s.value), (e, r) => (h(), O("form", {
110
110
  novalidate: "",
111
- onSubmit: r[0] || (r[0] = C((n) => s.value.handleSubmit(), ["prevent", "stop"]))
111
+ onSubmit: r[0] || (r[0] = V((n) => s.value.handleSubmit(), ["prevent", "stop"]))
112
112
  }, [
113
- V("fieldset", { disabled: m(I) }, [
113
+ k("fieldset", { disabled: m(I) }, [
114
114
  o.form ? (h(), O(_, { key: 0 }, [
115
- p(e.$slots, "externalForm", { subscribedValues: m(v) }, void 0, !0),
115
+ p(e.$slots, "externalForm", { subscribedValues: m(b) }, void 0, !0),
116
116
  p(e.$slots, "default", {}, void 0, !0)
117
117
  ], 64)) : m(f) ? p(e.$slots, "internalForm", {
118
118
  key: 1,
119
119
  form: m(f),
120
- subscribedValues: m(v)
121
- }, void 0, !0) : k("", !0)
122
- ], 8, W)
120
+ subscribedValues: m(b)
121
+ }, void 0, !0) : K("", !0)
122
+ ], 8, x)
123
123
  ], 32));
124
124
  }
125
125
  });
126
126
  export {
127
- H as default
127
+ q as default
128
128
  };
@@ -1,13 +1,92 @@
1
- import { useStore as u } from "@tanstack/vue-form";
2
- import { computed as f } from "vue";
3
- function c(o, t) {
4
- return f(() => t ? u(o.store, (n) => {
5
- const r = {};
6
- for (const e of t)
7
- r[e] = n[e];
8
- return r;
9
- }).value : {});
10
- }
1
+ (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
+ import { useStore as z } from "@tanstack/vue-form";
4
+ import { useOmegaErrors as A } from "./vue-components.es8.js";
5
+ import D from "./vue-components.es48.js";
6
+
7
+ const J = /* @__PURE__ */ w({
8
+ inheritAttrs: !1,
9
+ __name: "OmegaInternalInput",
10
+ props: {
11
+ field: {},
12
+ meta: {},
13
+ label: {},
14
+ options: {},
15
+ type: {},
16
+ validators: {}
17
+ },
18
+ setup(c) {
19
+ const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
+ () => (
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
+ )
24
+ ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
+ f(
26
+ () => !!n.value,
27
+ () => {
28
+ y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
+ o.setValue(
30
+ e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
+ );
32
+ });
33
+ }
34
+ ), d(() => {
35
+ !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
+ });
37
+ const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
+ k(() => {
39
+ (E.value || V === "onChange") && (s.value = !0);
40
+ });
41
+ const u = () => {
42
+ s.value = !0;
43
+ };
44
+ d(() => {
45
+ n.value && u();
46
+ });
47
+ const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
+ f(
49
+ () => r.value.meta.errors,
50
+ () => {
51
+ r.value.meta.errors.length ? h({
52
+ inputId: l,
53
+ errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
+ label: e.label
55
+ }) : b(l);
56
+ }
57
+ );
58
+ const i = a(() => ({
59
+ id: l,
60
+ required: e.meta?.required,
61
+ minLength: e.meta?.type === "string" && e.meta?.minLength,
62
+ maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
+ max: e.meta?.type === "number" && e.meta?.maximum,
64
+ min: e.meta?.type === "number" && e.meta?.minimum,
65
+ name: e.field.name,
66
+ modelValue: e.field.state.value,
67
+ errorMessages: p.value,
68
+ error: !!p.value.length,
69
+ field: e.field,
70
+ setRealDirty: u,
71
+ type: m.value,
72
+ label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
+ options: e.options
74
+ }));
75
+ return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
+ _("div", {
77
+ class: q(t.$attrs.class),
78
+ onFocusout: u
79
+ }, [
80
+ F(v) ? (S(), L(D, T({
81
+ key: 0,
82
+ "input-props": i.value
83
+ }, t.$attrs, {
84
+ "vuetify-value": i.value.field.state.value
85
+ }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
+ ], 34)
87
+ ]);
88
+ }
89
+ });
11
90
  export {
12
- c as getOmegaStore
91
+ J as default
13
92
  };
@@ -1,92 +1,13 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
- import { useStore as z } from "@tanstack/vue-form";
4
- import { useOmegaErrors as A } from "./vue-components.es8.js";
5
- import D from "./vue-components.es48.js";
6
-
7
- const J = /* @__PURE__ */ w({
8
- inheritAttrs: !1,
9
- __name: "OmegaInternalInput",
10
- props: {
11
- field: {},
12
- meta: {},
13
- label: {},
14
- options: {},
15
- type: {},
16
- validators: {}
17
- },
18
- setup(c) {
19
- const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
- () => (
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
- )
24
- ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
- f(
26
- () => !!n.value,
27
- () => {
28
- y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
- o.setValue(
30
- e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
- );
32
- });
33
- }
34
- ), d(() => {
35
- !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
- });
37
- const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
- k(() => {
39
- (E.value || V === "onChange") && (s.value = !0);
40
- });
41
- const u = () => {
42
- s.value = !0;
43
- };
44
- d(() => {
45
- n.value && u();
46
- });
47
- const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
- f(
49
- () => r.value.meta.errors,
50
- () => {
51
- r.value.meta.errors.length ? h({
52
- inputId: l,
53
- errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
- label: e.label
55
- }) : b(l);
56
- }
57
- );
58
- const i = a(() => ({
59
- id: l,
60
- required: e.meta?.required,
61
- minLength: e.meta?.type === "string" && e.meta?.minLength,
62
- maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
- max: e.meta?.type === "number" && e.meta?.maximum,
64
- min: e.meta?.type === "number" && e.meta?.minimum,
65
- name: e.field.name,
66
- modelValue: e.field.state.value,
67
- errorMessages: p.value,
68
- error: !!p.value.length,
69
- field: e.field,
70
- setRealDirty: u,
71
- type: m.value,
72
- label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
- options: e.options
74
- }));
75
- return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
- _("div", {
77
- class: q(t.$attrs.class),
78
- onFocusout: u
79
- }, [
80
- F(v) ? (S(), L(D, T({
81
- key: 0,
82
- "input-props": i.value
83
- }, t.$attrs, {
84
- "vuetify-value": i.value.field.state.value
85
- }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
- ], 34)
87
- ]);
88
- }
89
- });
1
+ import { useStore as u } from "@tanstack/vue-form";
2
+ import { computed as f } from "vue";
3
+ function c(o, t) {
4
+ return f(() => t ? u(o.store, (n) => {
5
+ const r = {};
6
+ for (const e of t)
7
+ r[e] = n[e];
8
+ return r;
9
+ }).value : {});
10
+ }
90
11
  export {
91
- J as default
12
+ c as getOmegaStore
92
13
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es27.js";
1
+ import f from "./vue-components.es26.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as y, inject as h, computed as l, createBlock as s, openBlock as i, resolveDynamicComponent as M, withCtx as p, createCommentVNode as $, mergeProps as b, renderSlot as C, normalizeProps as k, guardReactiveProps as F } from "vue";
2
2
  import { useIntl as A } from "./vue-components.es3.js";
3
3
  import { generateInputStandardSchemaFromFieldMeta as w } from "./vue-components.es10.js";
4
- import I from "./vue-components.es27.js";
4
+ import I from "./vue-components.es26.js";
5
5
  const z = /* @__PURE__ */ y({
6
6
  inheritAttrs: !1,
7
7
  __name: "OmegaInput",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "0.27.11",
3
+ "version": "0.27.12",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "effect": "^3.17.13",
@@ -66,11 +66,11 @@
66
66
  /* eslint-disable @typescript-eslint/no-explicit-any */
67
67
  import { type StandardSchemaV1Issue, useStore } from "@tanstack/vue-form"
68
68
  import { type Record, type S } from "effect-app"
69
- import { computed, getCurrentInstance, onBeforeMount, watch } from "vue"
69
+ import { computed, getCurrentInstance, onBeforeMount, provide, watch } from "vue"
70
70
  import { getOmegaStore } from "./getOmegaStore"
71
71
  import { provideOmegaErrors } from "./OmegaErrorsContext"
72
72
  import { type FilterItems, type FormProps, type OmegaFormApi, type OmegaFormState, type ShowErrorsOn } from "./OmegaFormStuff"
73
- import { type OmegaConfig, type OmegaFormReturn, useOmegaForm } from "./useOmegaForm"
73
+ import { type OmegaConfig, OmegaFormKey, type OmegaFormReturn, useOmegaForm } from "./useOmegaForm"
74
74
 
75
75
  type OnSubmit = NonNullable<FormProps<From, To>["onSubmit"]>
76
76
  type OnSubmitArg = Parameters<OnSubmit>[0]
@@ -278,6 +278,8 @@ defineSlots<{
278
278
  // Named slot when form is passed via props (provides subscribedValues)
279
279
  externalForm(props: { subscribedValues: typeof subscribedValues.value }): void
280
280
  }>()
281
+
282
+ provide(OmegaFormKey, formToUse.value)
281
283
  </script>
282
284
 
283
285
  <style scoped>