@effect-app/vue-components 1.8.7 → 1.8.9

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
1
  import { DiagComponentLogger as m } from "./vue-components.es49.js";
2
2
  import { createLogLevelDiagLogger as y } from "./vue-components.es50.js";
3
- import { DiagLogLevel as d } from "./vue-components.es37.js";
3
+ import { DiagLogLevel as d } from "./vue-components.es35.js";
4
4
  import { unregisterGlobal as p, getGlobal as v, registerGlobal as w } from "./vue-components.es51.js";
5
5
  var b = function(i, n) {
6
6
  var r = typeof Symbol == "function" && i[Symbol.iterator];
@@ -1,4 +1,4 @@
1
- import { DiagLogLevel as r } from "./vue-components.es37.js";
1
+ import { DiagLogLevel as r } from "./vue-components.es35.js";
2
2
  function c(n, o) {
3
3
  n < r.NONE ? n = r.NONE : n > r.ALL && (n = r.ALL), o = o || {};
4
4
  function i(t, f) {
@@ -1,6 +1,6 @@
1
- import { createContextKey as o } from "./vue-components.es36.js";
2
- import { NonRecordingSpan as a } from "./vue-components.es45.js";
3
- import { ContextAPI as u } from "./vue-components.es46.js";
1
+ import { createContextKey as o } from "./vue-components.es34.js";
2
+ import { NonRecordingSpan as a } from "./vue-components.es43.js";
3
+ import { ContextAPI as u } from "./vue-components.es44.js";
4
4
  var n = o("OpenTelemetry Context Key SPAN");
5
5
  function r(e) {
6
6
  return e.getValue(n) || void 0;
@@ -1,4 +1,4 @@
1
- import { ROOT_CONTEXT as l } from "./vue-components.es36.js";
1
+ import { ROOT_CONTEXT as l } from "./vue-components.es34.js";
2
2
  var c = function(t, o) {
3
3
  var n = typeof Symbol == "function" && t[Symbol.iterator];
4
4
  if (!n) return t;
@@ -1,29 +1,29 @@
1
- import { useForm as k } from "@tanstack/vue-form";
2
- import { Data as B, S as L, Effect as l, Fiber as b, Option as G, Array as O } from "effect-app";
3
- import { runtimeFiberAsPromise as T } from "./vue-components.es12.js";
4
- import { isObject as W } from "./vue-components.es13.js";
5
- import { computed as I, onUnmounted as U, onMounted as z, onBeforeUnmount as Q, ref as X, watch as $, h as N } from "vue";
6
- import { usePreventClose as Y } from "./vue-components.es8.js";
7
- import Z from "./vue-components.es14.js";
8
- import C from "./vue-components.es15.js";
9
- import ee from "./vue-components.es16.js";
10
- import { generateMetaFromSchema as re } from "./vue-components.es9.js";
11
- import te from "./vue-components.es5.js";
12
- import se from "./vue-components.es17.js";
13
- import { trace as A } from "./vue-components.es18.js";
14
- import { context as y } from "./vue-components.es19.js";
15
- class ne extends B.TaggedError("FormErrors") {
1
+ import { useForm as J } from "@tanstack/vue-form";
2
+ import { Data as q, S as U, Effect as a, Fiber as y, Option as K, Array as L } from "effect-app";
3
+ import { runtimeFiberAsPromise as k } from "./vue-components.es12.js";
4
+ import { isObject as B } from "./vue-components.es13.js";
5
+ import { computed as O, onUnmounted as M, onMounted as G, onBeforeUnmount as T, ref as W, watch as z, h as A } from "vue";
6
+ import { usePreventClose as Q } from "./vue-components.es8.js";
7
+ import X from "./vue-components.es14.js";
8
+ import Y from "./vue-components.es15.js";
9
+ import Z from "./vue-components.es16.js";
10
+ import { generateMetaFromSchema as C } from "./vue-components.es9.js";
11
+ import ee from "./vue-components.es5.js";
12
+ import re from "./vue-components.es17.js";
13
+ import { trace as $ } from "./vue-components.es18.js";
14
+ import { context as b } from "./vue-components.es19.js";
15
+ class te extends q.TaggedError("FormErrors") {
16
16
  }
17
- const p = (c) => function(i) {
17
+ const p = (c) => function(n) {
18
18
  return {
19
19
  render() {
20
- return N(i, {
20
+ return A(n, {
21
21
  form: c,
22
22
  ...this.$attrs
23
23
  }, this.$slots);
24
24
  }
25
25
  };
26
- }, ie = (c) => function(i) {
26
+ }, se = (c) => function(n) {
27
27
  return {
28
28
  setup() {
29
29
  return {
@@ -31,41 +31,41 @@ const p = (c) => function(i) {
31
31
  };
32
32
  },
33
33
  render({ fieldMap: h, form: S }) {
34
- return N(i, {
34
+ return A(n, {
35
35
  form: S,
36
36
  fieldMap: h,
37
37
  ...this.$attrs
38
38
  }, this.$slots);
39
39
  }
40
40
  };
41
- }, ye = (c, a, i) => {
41
+ }, ve = (c, o, n) => {
42
42
  if (!c) throw new Error("Schema is required");
43
- const h = L.standardSchemaV1(c), S = L.decode(c), { filterItems: _, meta: d } = re(c), m = I(() => {
44
- if (i?.persistency?.id)
45
- return i.persistency.id;
46
- const e = window.location.pathname, r = Object.keys(d);
43
+ const h = U.standardSchemaV1(c), S = U.decode(c), { meta: f } = C(c), d = O(() => {
44
+ if (n?.persistency?.id)
45
+ return n.persistency.id;
46
+ const e = window.location.pathname, r = Object.keys(f);
47
47
  return `${e}-${r.join("-")}`;
48
- }), D = () => {
48
+ }), N = () => {
49
49
  const e = new URLSearchParams(window.location.search);
50
- e.delete(m.value);
50
+ e.delete(d.value);
51
51
  const r = new URL(window.location.href);
52
52
  r.search = e.toString(), window.history.replaceState({}, "", r.toString());
53
53
  };
54
- function g(e, r) {
54
+ function E(e, r) {
55
55
  for (const t in r)
56
- r[t] && W(r[t]) ? (e[t] || (e[t] = {}), g(e[t], r[t])) : e[t] = r[t];
56
+ r[t] && B(r[t]) ? (e[t] || (e[t] = {}), E(e[t], r[t])) : e[t] = r[t];
57
57
  return e;
58
58
  }
59
- const R = I(() => {
60
- if (a?.defaultValues && !i?.persistency?.overrideDefaultValues)
61
- return a?.defaultValues;
59
+ const _ = O(() => {
60
+ if (o?.defaultValues && !n?.persistency?.overrideDefaultValues)
61
+ return o?.defaultValues;
62
62
  let e;
63
- const r = i?.persistency;
63
+ const r = n?.persistency;
64
64
  if (!r?.policies || r.policies.length === 0) return {};
65
65
  if (r.policies.includes("querystring"))
66
66
  try {
67
- const s = new URLSearchParams(window.location.search).get(m.value);
68
- D(), s && (e = JSON.parse(s));
67
+ const s = new URLSearchParams(window.location.search).get(d.value);
68
+ N(), s && (e = JSON.parse(s));
69
69
  } catch (t) {
70
70
  console.error(t);
71
71
  }
@@ -77,137 +77,114 @@ const p = (c) => function(i) {
77
77
  if (t)
78
78
  try {
79
79
  const s = JSON.parse(
80
- t.getItem(m.value) || "{}"
80
+ t.getItem(d.value) || "{}"
81
81
  );
82
- t.removeItem(m.value), e = s;
82
+ t.removeItem(d.value), e = s;
83
83
  } catch (s) {
84
84
  console.error(s);
85
85
  }
86
86
  }
87
- if (e ??= {}, a?.defaultValues == null)
87
+ if (e ??= {}, o?.defaultValues == null)
88
88
  return e;
89
89
  {
90
- const t = a?.defaultValues;
91
- return g(t, e);
90
+ const t = o?.defaultValues;
91
+ return E(t, e);
92
92
  }
93
- }), x = (e, r) => e ? y.with(A.setSpan(y.active(), e), r) : r(), u = k({
94
- ...a,
93
+ }), D = (e, r) => e ? b.with($.setSpan(b.active(), e), r) : r(), l = J({
94
+ ...o,
95
95
  validators: {
96
96
  onSubmit: h,
97
- ...a?.validators || {}
97
+ ...o?.validators || {}
98
98
  },
99
- onSubmit: a?.onSubmit ? ({ formApi: e, meta: r, value: t }) => x(r?.currentSpan, async () => {
100
- const s = await l.runPromise(S(t)), n = a.onSubmit({
99
+ onSubmit: o?.onSubmit ? ({ formApi: e, meta: r, value: t }) => D(r?.currentSpan, async () => {
100
+ const s = await a.runPromise(S(t)), i = o.onSubmit({
101
101
  formApi: e,
102
102
  meta: r,
103
103
  value: s
104
104
  });
105
- return b.isFiber(n) && b.isRuntimeFiber(n) ? await T(n) : l.isEffect(n) ? await l.runPromise(
106
- n.pipe(
105
+ return y.isFiber(i) && y.isRuntimeFiber(i) ? await k(i) : a.isEffect(i) ? await a.runPromise(
106
+ i.pipe(
107
107
  // meta?.currentSpan
108
108
  // ? Effect.withParentSpan(meta.currentSpan)
109
109
  // : (_) => _,
110
- l.flatMap((f) => b.join(f))
110
+ a.flatMap((m) => y.join(m))
111
111
  )
112
- ) : n;
112
+ ) : i;
113
113
  }) : void 0,
114
- defaultValues: R.value
115
- }), H = () => {
116
- Object.keys(d).forEach((e) => {
117
- u.setFieldValue(e, void 0);
114
+ defaultValues: _.value
115
+ }), I = () => {
116
+ Object.keys(f).forEach((e) => {
117
+ l.setFieldValue(e, void 0);
118
118
  });
119
- }, E = (e) => e.reduce((r, t) => {
119
+ }, g = (e) => e.reduce((r, t) => {
120
120
  const s = t.split(".");
121
- return s.reduce((n, f, K) => (K === s.length - 1 ? n[f] = u.getFieldValue(t) : n[f] = n[f] ?? {}, n[f]), r), r;
121
+ return s.reduce((i, m, H) => (H === s.length - 1 ? i[m] = l.getFieldValue(t) : i[m] = i[m] ?? {}, i[m]), r), r;
122
122
  }, {}), F = (e) => {
123
123
  if (e) {
124
- if (O.isArray(e.keys))
125
- return E(e.keys);
126
- if (O.isArray(e.banKeys)) {
127
- const r = Object.keys(d).filter((t) => e.banKeys?.includes(t));
128
- return E(r);
124
+ if (L.isArray(e.keys))
125
+ return g(e.keys);
126
+ if (L.isArray(e.banKeys)) {
127
+ const r = Object.keys(f).filter((t) => e.banKeys?.includes(t));
128
+ return g(r);
129
129
  }
130
- return u.store.state.values;
130
+ return l.store.state.values;
131
131
  }
132
- }, v = () => {
133
- const e = i?.persistency;
132
+ }, w = () => {
133
+ const e = n?.persistency;
134
134
  if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
135
135
  const r = e.policies.includes("local") ? localStorage : sessionStorage;
136
136
  if (!r) return;
137
137
  const t = F(e);
138
- return r.setItem(m.value, JSON.stringify(t));
138
+ return r.setItem(d.value, JSON.stringify(t));
139
139
  }
140
140
  }, V = () => {
141
- const e = i?.persistency;
141
+ const e = n?.persistency;
142
142
  if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
143
143
  const r = F(e), t = new URLSearchParams(window.location.search);
144
- t.set(m.value, JSON.stringify(r));
144
+ t.set(d.value, JSON.stringify(r));
145
145
  const s = new URL(window.location.href);
146
146
  s.search = t.toString(), window.history.replaceState({}, "", s.toString());
147
147
  }
148
148
  };
149
- U(v), z(() => {
150
- window.addEventListener("beforeunload", v), window.addEventListener("blur", V);
151
- }), Q(() => {
152
- window.removeEventListener("beforeunload", v), window.removeEventListener("blur", V);
149
+ M(w), G(() => {
150
+ window.addEventListener("beforeunload", w), window.addEventListener("blur", V);
151
+ }), T(() => {
152
+ window.removeEventListener("beforeunload", w), window.removeEventListener("blur", V);
153
153
  });
154
- const j = (e) => l.currentSpan.pipe(
155
- l.option,
156
- l.flatMap(
157
- (r) => l.promise(() => u.handleSubmit(G.isSome(r) ? { currentSpan: r.value, ...e } : e))
154
+ const P = (e) => a.currentSpan.pipe(
155
+ a.option,
156
+ a.flatMap(
157
+ (r) => a.promise(() => l.handleSubmit(K.isSome(r) ? { currentSpan: r.value, ...e } : e))
158
158
  )
159
- ), J = (e) => e?.checkErrors ? j(e?.meta).pipe(l.flatMap(l.fnUntraced(function* () {
160
- const r = u.getAllErrors();
159
+ ), R = (e) => e?.checkErrors ? P(e?.meta).pipe(a.flatMap(a.fnUntraced(function* () {
160
+ const r = l.getAllErrors();
161
161
  if (Object.keys(r.fields).length || r.form.errors.length)
162
- return yield* new ne({ form: r.form, fields: r.fields });
163
- }))) : j(e?.meta), q = u.handleSubmit, w = X(/* @__PURE__ */ new Map()), o = Object.assign(u, {
164
- i18nNamespace: i?.i18nNamespace,
165
- meta: d,
166
- filterItems: _,
167
- clear: H,
162
+ return yield* new te({ form: r.form, fields: r.fields });
163
+ }))) : P(e?.meta), x = l.handleSubmit, v = W(/* @__PURE__ */ new Map()), u = Object.assign(l, {
164
+ i18nNamespace: n?.i18nNamespace,
165
+ meta: f,
166
+ clear: I,
168
167
  handleSubmit: (e) => {
169
- const r = A.getSpan(y.active());
170
- return q({ currentSpan: r, ...e });
168
+ const r = $.getSpan(b.active());
169
+ return x({ currentSpan: r, ...e });
171
170
  },
172
171
  // /** @experimental */
173
- handleSubmitEffect: J,
172
+ handleSubmitEffect: R,
174
173
  registerField: (e) => {
175
- $(e, (r) => w.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), U(() => w.value.delete(e.value.name));
174
+ z(e, (r) => v.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), M(() => v.value.delete(e.value.name));
176
175
  }
177
- }), M = o.useStore((e) => e.errors);
178
- $(
179
- () => [o.filterItems, M.value],
180
- () => {
181
- const e = o.filterItems, r = M.value;
182
- return e ? r ? (Object.values(r).filter(
183
- (s) => !!s
184
- ).flatMap(
185
- (s) => Object.values(s).flat().map((n) => n.message)
186
- ).some((s) => s === e.message) && e.items.forEach((s) => {
187
- const n = o.getFieldMeta(s);
188
- n && o.setFieldMeta(s, {
189
- ...n,
190
- errorMap: {
191
- onSubmit: [
192
- { path: [s], message: e.message }
193
- ]
194
- }
195
- });
196
- }), {}) : {} : {};
197
- }
198
- );
199
- const P = { form: o, fieldMap: w };
200
- return i?.ignorePreventCloseEvents || Y(() => o.useStore((e) => e.isDirty)), Object.assign(o, {
201
- errorContext: P,
202
- Form: p(o)(se),
203
- Input: p(o)(i?.input ?? te),
204
- Field: u.Field,
205
- Errors: ie(P)(ee),
206
- Array: p(o)(Z),
207
- AutoGen: p(o)(C)
176
+ }), j = { form: u, fieldMap: v };
177
+ return n?.ignorePreventCloseEvents || Q(() => u.useStore((e) => e.isDirty)), Object.assign(u, {
178
+ errorContext: j,
179
+ Form: p(u)(re),
180
+ Input: p(u)(n?.input ?? ee),
181
+ Field: l.Field,
182
+ Errors: se(j)(Z),
183
+ Array: p(u)(X),
184
+ AutoGen: p(u)(Y)
208
185
  });
209
186
  };
210
187
  export {
211
- ne as FormErrors,
212
- ye as useOmegaForm
188
+ te as FormErrors,
189
+ ve as useOmegaForm
213
190
  };