@effect-app/vue-components 2.11.0 → 2.11.2

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.
@@ -215,7 +215,9 @@ const M = (i) => function(s) {
215
215
  // /** @experimental */
216
216
  handleSubmitEffect: B,
217
217
  registerField: (e) => {
218
- N(e, (r) => j.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), R(() => {
218
+ N(e, (r) => {
219
+ j.value.set(r.name, { label: r.label, id: r.id });
220
+ }, { immediate: !0 }), R(() => {
219
221
  j.value.get(e.value.name)?.id === e.value.id && j.value.delete(e.value.name);
220
222
  });
221
223
  }
@@ -1,4 +1,4 @@
1
- import { defineComponent as M, ref as C, computed as s, watch as b, provide as k, createBlock as F, openBlock as O, unref as f, withCtx as c, renderSlot as o, createVNode as i, createCommentVNode as S, normalizeProps as g, guardReactiveProps as d, createSlots as V, renderList as w } from "vue";
1
+ import { defineComponent as M, ref as C, computed as s, watch as b, provide as k, createBlock as F, openBlock as O, unref as f, withCtx as i, renderSlot as o, createVNode as c, createCommentVNode as S, normalizeProps as g, guardReactiveProps as d, createSlots as V, renderList as w } from "vue";
2
2
  import A from "./vue-components.es9.js";
3
3
  const N = /* @__PURE__ */ M({
4
4
  __name: "OmegaTaggedUnion",
@@ -10,28 +10,28 @@ const N = /* @__PURE__ */ M({
10
10
  label: {}
11
11
  },
12
12
  setup(t) {
13
- const n = t, r = C(null), v = s(() => n.name ? `${n.name}._tag` : "_tag"), $ = n.form.useStore((e) => e.values);
13
+ const n = t, m = C(null), v = s(() => n.name ? `${n.name}._tag` : "_tag"), $ = n.form.useStore((e) => e.values);
14
14
  b(
15
- () => v.value.split(".").reduce((l, a) => l?.[a], $.value),
15
+ () => v.value.split(".").reduce((r, a) => r?.[a], $.value),
16
16
  (e) => {
17
- r.value = e ?? null;
17
+ m.value = e ?? null;
18
18
  },
19
19
  { immediate: !0 }
20
20
  );
21
21
  const y = s(() => {
22
- const e = r.value;
22
+ const e = m.value;
23
23
  return (a) => {
24
24
  if (!e) return null;
25
- const m = n.form.unionMeta[e];
26
- return m ? m[a] ?? null : null;
25
+ const l = n.form.unionMeta[e];
26
+ return l ? l[a] ?? null : null;
27
27
  };
28
28
  });
29
- return k("getMetaFromArray", y), (e, l) => (O(), F(f(t.form).Field, {
29
+ return k("getMetaFromArray", y), (e, r) => (O(), F(f(t.form).Field, {
30
30
  name: t.name ? `${t.name}._tag` : "_tag"
31
31
  }, {
32
- default: c((a) => [
32
+ default: i((a) => [
33
33
  o(e.$slots, "OmegaCustomInput", g(d(a)), () => [
34
- i(f(t.form).Input, {
34
+ c(f(t.form).Input, {
35
35
  name: t.name ? `${t.name}._tag` : "_tag",
36
36
  label: t.label,
37
37
  type: t.type ?? "select",
@@ -39,15 +39,15 @@ const N = /* @__PURE__ */ M({
39
39
  }, null, 8, ["name", "label", "type", "options"])
40
40
  ]),
41
41
  o(e.$slots, "default"),
42
- i(A, {
42
+ c(A, {
43
43
  field: a.field,
44
44
  state: a.state.value,
45
45
  name: t.name,
46
46
  form: t.form
47
47
  }, V({ _: 2 }, [
48
- w(e.$slots, (m, u) => ({
48
+ w(e.$slots, (l, u) => ({
49
49
  name: u,
50
- fn: c((h) => [
50
+ fn: i((h) => [
51
51
  o(e.$slots, u, g(d(h)))
52
52
  ])
53
53
  }))
@@ -1,5 +1,5 @@
1
- import { defineComponent as n, watch as m, renderSlot as o, createCommentVNode as r, normalizeProps as f, mergeProps as u } from "vue";
2
- const c = /* @__PURE__ */ n({
1
+ import { defineComponent as l, watch as r, renderSlot as o, createCommentVNode as m, normalizeProps as u, mergeProps as f } from "vue";
2
+ const c = /* @__PURE__ */ l({
3
3
  __name: "OmegaTaggedUnionInternal",
4
4
  props: {
5
5
  state: {},
@@ -9,17 +9,17 @@ const c = /* @__PURE__ */ n({
9
9
  },
10
10
  setup(t) {
11
11
  const a = t;
12
- return a.form.useStore(({ values: e }) => e), m(() => a.state, (e, s) => {
13
- if (e === null && a.field.setValue(null), e !== s && e) {
14
- const l = {
12
+ return a.form.useStore(({ values: e }) => e), r(() => a.state, (e, n) => {
13
+ if (e === null && a.field.setValue(null), e !== n && e) {
14
+ const s = {
15
15
  ...a.form.unionDefaultValues?.[e] ?? {},
16
16
  _tag: e
17
17
  };
18
- a.form.reset(l), setTimeout(() => {
18
+ a.form.reset(s), setTimeout(() => {
19
19
  a.field.validate("change");
20
20
  }, 0);
21
21
  }
22
- }, { immediate: !0 }), (e, s) => t.state ? o(e.$slots, `${t.name ? `${t.name}.` : ""}${t.state}`, f(u({ key: 0 }, { field: t.field, state: t.state }))) : r("", !0);
22
+ }, { immediate: !0 }), (e, n) => t.state ? o(e.$slots, `${t.name ? `${t.name}.` : ""}${t.state}`, u(f({ key: 0 }, { field: t.field, state: t.state }))) : m("", !0);
23
23
  }
24
24
  });
25
25
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "2.11.0",
3
+ "version": "2.11.2",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "effect": "^3.19.3",
@@ -53,8 +53,8 @@
53
53
  "highlight.js": "^11.11.1",
54
54
  "mitt": "^3.0.1",
55
55
  "vue3-highlightjs": "^1.0.5",
56
- "@effect-app/vue": "2.93.6",
57
- "effect-app": "3.15.1"
56
+ "effect-app": "3.15.1",
57
+ "@effect-app/vue": "2.93.6"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "pnpm build:run",
@@ -34,6 +34,7 @@ watch(
34
34
  },
35
35
  (newTag) => {
36
36
  currentTag.value = newTag ?? null
37
+ return undefined
37
38
  },
38
39
  { immediate: true }
39
40
  )
@@ -44,5 +44,6 @@ watch(() => props.state, (newTag, oldTag) => {
44
44
  props.field.validate("change")
45
45
  }, 0)
46
46
  }
47
+ return undefined
47
48
  }, { immediate: true })
48
49
  </script>
@@ -919,6 +919,7 @@ export const useOmegaForm = <
919
919
  // Reset with current values to mark them as the new baseline
920
920
  form.reset(values.value)
921
921
  }
922
+ return undefined
922
923
  })
923
924
  }
924
925
 
@@ -964,7 +965,9 @@ export const useOmegaForm = <
964
965
  // /** @experimental */
965
966
  handleSubmitEffect,
966
967
  registerField: (field: ComputedRef<{ name: string; label: string; id: string }>) => {
967
- watch(field, (f) => fieldMap.value.set(f.name, { label: f.label, id: f.id }), { immediate: true })
968
+ watch(field, (f) => {
969
+ fieldMap.value.set(f.name, { label: f.label, id: f.id })
970
+ }, { immediate: true })
968
971
  onUnmounted(() => {
969
972
  // Only delete if this component instance still owns the registration (id matches)
970
973
  // This prevents the old component from removing the new component's registration
@@ -5,7 +5,9 @@ const Key = Symbol("injected") as InjectionKey<Map<string, { label: string; id:
5
5
 
6
6
  export const useRegisterField = (field: ComputedRef<{ name: string; label: string; id: string }>) => {
7
7
  const map = injectCertain(Key)
8
- watch(field, (f) => map.set(f.name, { label: f.label, id: f.id }), { immediate: true })
8
+ watch(field, (f) => {
9
+ map.set(f.name, { label: f.label, id: f.id })
10
+ }, { immediate: true })
9
11
  onUnmounted(() => map.delete(field.value.name)) // todo; perhap only when owned
10
12
  }
11
13