@effect-app/vue-components 2.9.2 → 2.10.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.
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +2 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +13 -2
- package/dist/vue-components.es.js +17 -15
- package/dist/vue-components.es10.js +120 -115
- package/dist/vue-components.es12.js +282 -204
- package/dist/vue-components.es16.js +4 -10
- package/dist/vue-components.es17.js +10 -97
- package/dist/vue-components.es2.js +29 -27
- package/dist/vue-components.es20.js +2 -2
- package/dist/vue-components.es21.js +2 -2
- package/dist/vue-components.es22.js +1 -1
- package/dist/vue-components.es23.js +1 -1
- package/dist/vue-components.es31.js +2 -4
- package/dist/vue-components.es32.js +1 -1
- package/dist/vue-components.es33.js +111 -2
- package/dist/vue-components.es35.js +9 -0
- package/dist/vue-components.es36.js +32 -7
- package/dist/vue-components.es40.js +6 -0
- package/dist/vue-components.es41.js +23 -4
- package/dist/vue-components.es42.js +5 -23
- package/dist/vue-components.es43.js +21 -5
- package/dist/vue-components.es44.js +25 -16
- package/dist/vue-components.es45.js +15 -23
- package/dist/vue-components.es46.js +7 -17
- package/dist/vue-components.es47.js +5 -12
- package/dist/vue-components.es48.js +19 -5
- package/dist/vue-components.es49.js +9 -19
- package/dist/vue-components.es50.js +31 -9
- package/dist/vue-components.es51.js +42 -25
- package/dist/vue-components.es52.js +16 -38
- package/dist/vue-components.es53.js +11 -26
- package/dist/vue-components.es54.js +65 -11
- package/dist/vue-components.es55.js +45 -54
- package/dist/vue-components.es56.js +15 -54
- package/dist/vue-components.es57.js +31 -15
- package/dist/vue-components.es58.js +26 -30
- package/dist/vue-components.es59.js +42 -29
- package/dist/vue-components.es60.js +2 -42
- package/dist/vue-components.es61.js +44 -2
- package/dist/vue-components.es62.js +2 -44
- package/dist/vue-components.es7.js +1 -1
- package/dist/vue-components.es9.js +10 -33
- package/package.json +3 -3
- package/src/components/OmegaForm/OmegaFormStuff.ts +174 -11
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +0 -48
- package/src/components/OmegaForm/useOmegaForm.ts +49 -25
- package/dist/types/components/OmegaForm/defaultAST.d.ts +0 -4
- package/dist/vue-components.es34.js +0 -113
- package/dist/vue-components.es37.js +0 -34
- package/dist/vue-components.es63.js +0 -4
- package/src/components/OmegaForm/defaultAST.ts +0 -191
- /package/dist/{vue-components.es39.js → vue-components.es38.js} +0 -0
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
error: i("error", r.ERROR),
|
|
11
|
-
warn: i("warn", r.WARN),
|
|
12
|
-
info: i("info", r.INFO),
|
|
13
|
-
debug: i("debug", r.DEBUG),
|
|
14
|
-
verbose: i("verbose", r.VERBOSE)
|
|
1
|
+
import { VERSION as t } from "./vue-components.es60.js";
|
|
2
|
+
import { isCompatible as f } from "./vue-components.es61.js";
|
|
3
|
+
import { _globalThis as m } from "./vue-components.es62.js";
|
|
4
|
+
var u = t.split(".")[0], n = Symbol.for("opentelemetry.js.api." + u), l = m;
|
|
5
|
+
function d(r, o, e, i) {
|
|
6
|
+
var v;
|
|
7
|
+
i === void 0 && (i = !1);
|
|
8
|
+
var s = l[n] = (v = l[n]) !== null && v !== void 0 ? v : {
|
|
9
|
+
version: t
|
|
15
10
|
};
|
|
11
|
+
if (!i && s[r]) {
|
|
12
|
+
var a = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + r);
|
|
13
|
+
return e.error(a.stack || a.message), !1;
|
|
14
|
+
}
|
|
15
|
+
if (s.version !== t) {
|
|
16
|
+
var a = new Error("@opentelemetry/api: Registration of version v" + s.version + " for " + r + " does not match previously registered API v" + t);
|
|
17
|
+
return e.error(a.stack || a.message), !1;
|
|
18
|
+
}
|
|
19
|
+
return s[r] = o, e.debug("@opentelemetry/api: Registered a global for " + r + " v" + t + "."), !0;
|
|
20
|
+
}
|
|
21
|
+
function E(r) {
|
|
22
|
+
var o, e, i = (o = l[n]) === null || o === void 0 ? void 0 : o.version;
|
|
23
|
+
if (!(!i || !f(i)))
|
|
24
|
+
return (e = l[n]) === null || e === void 0 ? void 0 : e[r];
|
|
25
|
+
}
|
|
26
|
+
function _(r, o) {
|
|
27
|
+
o.debug("@opentelemetry/api: Unregistering a global for " + r + " v" + t + ".");
|
|
28
|
+
var e = l[n];
|
|
29
|
+
e && delete e[r];
|
|
16
30
|
}
|
|
17
31
|
export {
|
|
18
|
-
|
|
32
|
+
E as getGlobal,
|
|
33
|
+
d as registerGlobal,
|
|
34
|
+
_ as unregisterGlobal
|
|
19
35
|
};
|
|
@@ -1,35 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
i === void 0 && (i = !1);
|
|
8
|
-
var s = l[n] = (v = l[n]) !== null && v !== void 0 ? v : {
|
|
9
|
-
version: t
|
|
10
|
-
};
|
|
11
|
-
if (!i && s[r]) {
|
|
12
|
-
var a = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + r);
|
|
13
|
-
return e.error(a.stack || a.message), !1;
|
|
14
|
-
}
|
|
15
|
-
if (s.version !== t) {
|
|
16
|
-
var a = new Error("@opentelemetry/api: Registration of version v" + s.version + " for " + r + " does not match previously registered API v" + t);
|
|
17
|
-
return e.error(a.stack || a.message), !1;
|
|
18
|
-
}
|
|
19
|
-
return s[r] = o, e.debug("@opentelemetry/api: Registered a global for " + r + " v" + t + "."), !0;
|
|
1
|
+
import { createContextKey as o } from "./vue-components.es41.js";
|
|
2
|
+
import { NonRecordingSpan as a } from "./vue-components.es50.js";
|
|
3
|
+
import { ContextAPI as u } from "./vue-components.es51.js";
|
|
4
|
+
var n = o("OpenTelemetry Context Key SPAN");
|
|
5
|
+
function r(e) {
|
|
6
|
+
return e.getValue(n) || void 0;
|
|
20
7
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
if (!(!i || !f(i)))
|
|
24
|
-
return (e = l[n]) === null || e === void 0 ? void 0 : e[r];
|
|
8
|
+
function S() {
|
|
9
|
+
return r(u.getInstance().active());
|
|
25
10
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
function i(e, t) {
|
|
12
|
+
return e.setValue(n, t);
|
|
13
|
+
}
|
|
14
|
+
function l(e) {
|
|
15
|
+
return e.deleteValue(n);
|
|
16
|
+
}
|
|
17
|
+
function d(e, t) {
|
|
18
|
+
return i(e, new a(t));
|
|
19
|
+
}
|
|
20
|
+
function m(e) {
|
|
21
|
+
var t;
|
|
22
|
+
return (t = r(e)) === null || t === void 0 ? void 0 : t.spanContext();
|
|
30
23
|
}
|
|
31
24
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
l as deleteSpan,
|
|
26
|
+
S as getActiveSpan,
|
|
27
|
+
r as getSpan,
|
|
28
|
+
m as getSpanContext,
|
|
29
|
+
i as setSpan,
|
|
30
|
+
d as setSpanContext
|
|
35
31
|
};
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { ROOT_CONTEXT as l } from "./vue-components.es41.js";
|
|
2
|
+
var c = function(t, o) {
|
|
3
|
+
var n = typeof Symbol == "function" && t[Symbol.iterator];
|
|
4
|
+
if (!n) return t;
|
|
5
|
+
var e = n.call(t), a, r = [], u;
|
|
6
|
+
try {
|
|
7
|
+
for (; (o === void 0 || o-- > 0) && !(a = e.next()).done; ) r.push(a.value);
|
|
8
|
+
} catch (i) {
|
|
9
|
+
u = { error: i };
|
|
10
|
+
} finally {
|
|
11
|
+
try {
|
|
12
|
+
a && !a.done && (n = e.return) && n.call(e);
|
|
13
|
+
} finally {
|
|
14
|
+
if (u) throw u.error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return r;
|
|
18
|
+
}, p = function(t, o, n) {
|
|
19
|
+
if (n || arguments.length === 2) for (var e = 0, a = o.length, r; e < a; e++)
|
|
20
|
+
(r || !(e in o)) && (r || (r = Array.prototype.slice.call(o, 0, e)), r[e] = o[e]);
|
|
21
|
+
return t.concat(r || Array.prototype.slice.call(o));
|
|
22
|
+
}, y = (
|
|
23
|
+
/** @class */
|
|
24
|
+
(function() {
|
|
25
|
+
function t() {
|
|
26
|
+
}
|
|
27
|
+
return t.prototype.active = function() {
|
|
28
|
+
return l;
|
|
29
|
+
}, t.prototype.with = function(o, n, e) {
|
|
30
|
+
for (var a = [], r = 3; r < arguments.length; r++)
|
|
31
|
+
a[r - 3] = arguments[r];
|
|
32
|
+
return n.call.apply(n, p([e], c(a), !1));
|
|
33
|
+
}, t.prototype.bind = function(o, n) {
|
|
34
|
+
return n;
|
|
35
|
+
}, t.prototype.enable = function() {
|
|
36
|
+
return this;
|
|
37
|
+
}, t.prototype.disable = function() {
|
|
38
|
+
return this;
|
|
39
|
+
}, t;
|
|
40
|
+
})()
|
|
41
|
+
);
|
|
24
42
|
export {
|
|
25
|
-
|
|
26
|
-
S as getActiveSpan,
|
|
27
|
-
r as getSpan,
|
|
28
|
-
m as getSpanContext,
|
|
29
|
-
i as setSpan,
|
|
30
|
-
d as setSpanContext
|
|
43
|
+
y as NoopContextManager
|
|
31
44
|
};
|
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var c = function(t, o) {
|
|
3
|
-
var n = typeof Symbol == "function" && t[Symbol.iterator];
|
|
4
|
-
if (!n) return t;
|
|
5
|
-
var e = n.call(t), a, r = [], u;
|
|
6
|
-
try {
|
|
7
|
-
for (; (o === void 0 || o-- > 0) && !(a = e.next()).done; ) r.push(a.value);
|
|
8
|
-
} catch (i) {
|
|
9
|
-
u = { error: i };
|
|
10
|
-
} finally {
|
|
11
|
-
try {
|
|
12
|
-
a && !a.done && (n = e.return) && n.call(e);
|
|
13
|
-
} finally {
|
|
14
|
-
if (u) throw u.error;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return r;
|
|
18
|
-
}, p = function(t, o, n) {
|
|
19
|
-
if (n || arguments.length === 2) for (var e = 0, a = o.length, r; e < a; e++)
|
|
20
|
-
(r || !(e in o)) && (r || (r = Array.prototype.slice.call(o, 0, e)), r[e] = o[e]);
|
|
21
|
-
return t.concat(r || Array.prototype.slice.call(o));
|
|
22
|
-
}, y = (
|
|
23
|
-
/** @class */
|
|
24
|
-
(function() {
|
|
25
|
-
function t() {
|
|
26
|
-
}
|
|
27
|
-
return t.prototype.active = function() {
|
|
28
|
-
return l;
|
|
29
|
-
}, t.prototype.with = function(o, n, e) {
|
|
30
|
-
for (var a = [], r = 3; r < arguments.length; r++)
|
|
31
|
-
a[r - 3] = arguments[r];
|
|
32
|
-
return n.call.apply(n, p([e], c(a), !1));
|
|
33
|
-
}, t.prototype.bind = function(o, n) {
|
|
34
|
-
return n;
|
|
35
|
-
}, t.prototype.enable = function() {
|
|
36
|
-
return this;
|
|
37
|
-
}, t.prototype.disable = function() {
|
|
38
|
-
return this;
|
|
39
|
-
}, t;
|
|
40
|
-
})()
|
|
41
|
-
);
|
|
1
|
+
var r = "1.9.0";
|
|
42
2
|
export {
|
|
43
|
-
|
|
3
|
+
r as VERSION
|
|
44
4
|
};
|
|
@@ -1,4 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
import { VERSION as d } from "./vue-components.es60.js";
|
|
2
|
+
var h = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
3
|
+
function s(c) {
|
|
4
|
+
var m = /* @__PURE__ */ new Set([c]), f = /* @__PURE__ */ new Set(), t = c.match(h);
|
|
5
|
+
if (!t)
|
|
6
|
+
return function() {
|
|
7
|
+
return !1;
|
|
8
|
+
};
|
|
9
|
+
var e = {
|
|
10
|
+
major: +t[1],
|
|
11
|
+
minor: +t[2],
|
|
12
|
+
patch: +t[3],
|
|
13
|
+
prerelease: t[4]
|
|
14
|
+
};
|
|
15
|
+
if (e.prerelease != null)
|
|
16
|
+
return function(r) {
|
|
17
|
+
return r === c;
|
|
18
|
+
};
|
|
19
|
+
function a(n) {
|
|
20
|
+
return f.add(n), !1;
|
|
21
|
+
}
|
|
22
|
+
function p(n) {
|
|
23
|
+
return m.add(n), !0;
|
|
24
|
+
}
|
|
25
|
+
return function(r) {
|
|
26
|
+
if (m.has(r))
|
|
27
|
+
return !0;
|
|
28
|
+
if (f.has(r))
|
|
29
|
+
return !1;
|
|
30
|
+
var i = r.match(h);
|
|
31
|
+
if (!i)
|
|
32
|
+
return a(r);
|
|
33
|
+
var u = {
|
|
34
|
+
major: +i[1],
|
|
35
|
+
minor: +i[2],
|
|
36
|
+
patch: +i[3],
|
|
37
|
+
prerelease: i[4]
|
|
38
|
+
};
|
|
39
|
+
return u.prerelease != null || e.major !== u.major ? a(r) : e.major === 0 ? e.minor === u.minor && e.patch <= u.patch ? p(r) : a(r) : e.minor <= u.minor ? p(r) : a(r);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var v = s(d);
|
|
2
43
|
export {
|
|
3
|
-
|
|
44
|
+
s as _makeCompatibilityCheck,
|
|
45
|
+
v as isCompatible
|
|
4
46
|
};
|
|
@@ -1,46 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var h = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
3
|
-
function s(c) {
|
|
4
|
-
var m = /* @__PURE__ */ new Set([c]), f = /* @__PURE__ */ new Set(), t = c.match(h);
|
|
5
|
-
if (!t)
|
|
6
|
-
return function() {
|
|
7
|
-
return !1;
|
|
8
|
-
};
|
|
9
|
-
var e = {
|
|
10
|
-
major: +t[1],
|
|
11
|
-
minor: +t[2],
|
|
12
|
-
patch: +t[3],
|
|
13
|
-
prerelease: t[4]
|
|
14
|
-
};
|
|
15
|
-
if (e.prerelease != null)
|
|
16
|
-
return function(r) {
|
|
17
|
-
return r === c;
|
|
18
|
-
};
|
|
19
|
-
function a(n) {
|
|
20
|
-
return f.add(n), !1;
|
|
21
|
-
}
|
|
22
|
-
function p(n) {
|
|
23
|
-
return m.add(n), !0;
|
|
24
|
-
}
|
|
25
|
-
return function(r) {
|
|
26
|
-
if (m.has(r))
|
|
27
|
-
return !0;
|
|
28
|
-
if (f.has(r))
|
|
29
|
-
return !1;
|
|
30
|
-
var i = r.match(h);
|
|
31
|
-
if (!i)
|
|
32
|
-
return a(r);
|
|
33
|
-
var u = {
|
|
34
|
-
major: +i[1],
|
|
35
|
-
minor: +i[2],
|
|
36
|
-
patch: +i[3],
|
|
37
|
-
prerelease: i[4]
|
|
38
|
-
};
|
|
39
|
-
return u.prerelease != null || e.major !== u.major ? a(r) : e.major === 0 ? e.minor === u.minor && e.patch <= u.patch ? p(r) : a(r) : e.minor <= u.minor ? p(r) : a(r);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
var v = s(d);
|
|
1
|
+
var o = typeof globalThis == "object" ? globalThis : typeof self == "object" ? self : typeof window == "object" ? window : typeof global == "object" ? global : {};
|
|
43
2
|
export {
|
|
44
|
-
|
|
45
|
-
v as isCompatible
|
|
3
|
+
o as _globalThis
|
|
46
4
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
import { defineComponent as $, computed as n, getCurrentInstance as N, useAttrs as S, useSlots as k, useId as q, renderSlot as u, normalizeProps as s, guardReactiveProps as d, createElementVNode as B, normalizeClass as w, createBlock as I, createCommentVNode as L, unref as A, openBlock as F, mergeProps as O, createSlots as R, withCtx as V } from "vue";
|
|
3
3
|
import { useStore as z } from "@tanstack/vue-form";
|
|
4
|
-
import T from "./vue-components.
|
|
4
|
+
import T from "./vue-components.es38.js";
|
|
5
5
|
|
|
6
6
|
const H = /* @__PURE__ */ $({
|
|
7
7
|
inheritAttrs: !1,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
3
|
-
import { getTransformationFrom as h } from "./vue-components.es3.js";
|
|
4
|
-
import { extractSchemaDefaults as S } from "./vue-components.es17.js";
|
|
5
|
-
const b = /* @__PURE__ */ l({
|
|
1
|
+
import { defineComponent as m, watch as r, renderSlot as s, createCommentVNode as o, normalizeProps as i, mergeProps as f } from "vue";
|
|
2
|
+
const d = /* @__PURE__ */ m({
|
|
6
3
|
__name: "OmegaTaggedUnionInternal",
|
|
7
4
|
props: {
|
|
8
5
|
state: {},
|
|
@@ -10,35 +7,15 @@ const b = /* @__PURE__ */ l({
|
|
|
10
7
|
name: {},
|
|
11
8
|
form: {}
|
|
12
9
|
},
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)[0];
|
|
21
|
-
if (n != null && "members" in e.form._schema && Array.isArray(e.form._schema.members)) {
|
|
22
|
-
const a = Object.assign(
|
|
23
|
-
S(
|
|
24
|
-
e.form._schema.members[n],
|
|
25
|
-
s.value
|
|
26
|
-
),
|
|
27
|
-
{ _tag: t }
|
|
28
|
-
);
|
|
29
|
-
e.form.reset(a), setTimeout(() => {
|
|
30
|
-
e.field.validate("change");
|
|
31
|
-
}, 0);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
e.form.reset(s.value), setTimeout(() => {
|
|
36
|
-
e.field.validate("change");
|
|
37
|
-
}, 0);
|
|
38
|
-
}
|
|
39
|
-
}, { immediate: !0 }), (t, o) => r.state ? d(t.$slots, `${r.name ? `${r.name}.` : ""}${r.state}`, c(p({ key: 0 }, { field: r.field, state: r.state }))) : u("", !0);
|
|
10
|
+
setup(e) {
|
|
11
|
+
const a = e, l = a.form.useStore(({ values: t }) => t);
|
|
12
|
+
return r(() => a.state, (t, n) => {
|
|
13
|
+
t === null && a.field.setValue(null), t !== n && (a.form.reset(l.value), setTimeout(() => {
|
|
14
|
+
a.field.validate("change");
|
|
15
|
+
}, 0));
|
|
16
|
+
}, { immediate: !0 }), (t, n) => e.state ? s(t.$slots, `${e.name ? `${e.name}.` : ""}${e.state}`, i(f({ key: 0 }, { field: e.field, state: e.state }))) : o("", !0);
|
|
40
17
|
}
|
|
41
18
|
});
|
|
42
19
|
export {
|
|
43
|
-
|
|
20
|
+
d as default
|
|
44
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.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.
|
|
57
|
-
"effect-app": "3.14.
|
|
56
|
+
"@effect-app/vue": "2.93.3",
|
|
57
|
+
"effect-app": "3.14.2"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "pnpm build:run",
|
|
@@ -2,6 +2,7 @@ import { type Effect, Option, type Record, S } from "effect-app"
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
import { getMetadataFromSchema } from "@effect-app/vue/form"
|
|
4
4
|
import { type DeepKeys, type DeepValue, type FieldAsyncValidateOrFn, type FieldValidateOrFn, type FormApi, type FormAsyncValidateOrFn, type FormOptions, type FormState, type FormValidateOrFn, type StandardSchemaV1, type VueFormApi } from "@tanstack/vue-form"
|
|
5
|
+
import { isObject } from "@vueuse/core"
|
|
5
6
|
import { type RuntimeFiber } from "effect/Fiber"
|
|
6
7
|
import { getTransformationFrom, useIntl } from "../../utils"
|
|
7
8
|
import { type OmegaFieldInternalApi } from "./InputProps"
|
|
@@ -685,14 +686,15 @@ export const createMeta = <T = any>(
|
|
|
685
686
|
return acc
|
|
686
687
|
}
|
|
687
688
|
|
|
688
|
-
const
|
|
689
|
+
const metadataFromAst = <From, To>(
|
|
689
690
|
schema: S.Schema<To, From, never>
|
|
690
|
-
): MetaRecord<To> => {
|
|
691
|
+
): { meta: MetaRecord<To>; defaultValues: Record<string, any> } => {
|
|
691
692
|
const ast = schema.ast
|
|
692
|
-
const
|
|
693
|
+
const newMeta: MetaRecord<To> = {}
|
|
694
|
+
const defaultValues: Record<string, any> = {}
|
|
693
695
|
|
|
694
696
|
if (ast._tag === "Transformation" || ast._tag === "Refinement") {
|
|
695
|
-
return
|
|
697
|
+
return metadataFromAst(S.make(ast.from))
|
|
696
698
|
}
|
|
697
699
|
|
|
698
700
|
// Handle root-level Union types (discriminated unions)
|
|
@@ -730,20 +732,20 @@ const flattenMeta = <From, To>(
|
|
|
730
732
|
})
|
|
731
733
|
|
|
732
734
|
// Merge into result
|
|
733
|
-
Object.assign(
|
|
735
|
+
Object.assign(newMeta, memberMeta)
|
|
734
736
|
}
|
|
735
737
|
}
|
|
736
738
|
|
|
737
739
|
// Create metadata for the discriminator field
|
|
738
740
|
if (discriminatorValues.length > 0) {
|
|
739
|
-
|
|
741
|
+
newMeta["_tag" as DeepKeys<To>] = {
|
|
740
742
|
type: "select",
|
|
741
743
|
members: discriminatorValues,
|
|
742
744
|
required: true
|
|
743
745
|
} as FieldMeta
|
|
744
746
|
}
|
|
745
747
|
|
|
746
|
-
return
|
|
748
|
+
return { meta: newMeta, defaultValues }
|
|
747
749
|
}
|
|
748
750
|
}
|
|
749
751
|
|
|
@@ -753,7 +755,7 @@ const flattenMeta = <From, To>(
|
|
|
753
755
|
})
|
|
754
756
|
|
|
755
757
|
if (Object.values(meta).every((value) => value && "type" in value)) {
|
|
756
|
-
return meta as MetaRecord<To
|
|
758
|
+
return { meta: meta as MetaRecord<To>, defaultValues }
|
|
757
759
|
}
|
|
758
760
|
|
|
759
761
|
const flattenObject = (
|
|
@@ -763,7 +765,7 @@ const flattenMeta = <From, To>(
|
|
|
763
765
|
for (const key in obj) {
|
|
764
766
|
const newKey = parentKey ? `${parentKey}.${key}` : key
|
|
765
767
|
if (obj[key] && typeof obj[key] === "object" && "type" in obj[key]) {
|
|
766
|
-
|
|
768
|
+
newMeta[newKey as DeepKeys<To>] = obj[key] as FieldMeta
|
|
767
769
|
} else if (obj[key] && typeof obj[key] === "object") {
|
|
768
770
|
flattenObject(obj[key], newKey)
|
|
769
771
|
}
|
|
@@ -773,7 +775,7 @@ const flattenMeta = <From, To>(
|
|
|
773
775
|
flattenObject(meta)
|
|
774
776
|
}
|
|
775
777
|
|
|
776
|
-
return
|
|
778
|
+
return { meta: newMeta, defaultValues }
|
|
777
779
|
}
|
|
778
780
|
|
|
779
781
|
export const duplicateSchema = <From, To>(
|
|
@@ -788,7 +790,7 @@ export const generateMetaFromSchema = <From, To>(
|
|
|
788
790
|
schema: S.Schema<To, From, never>
|
|
789
791
|
meta: MetaRecord<To>
|
|
790
792
|
} => {
|
|
791
|
-
const meta =
|
|
793
|
+
const { meta } = metadataFromAst(schema)
|
|
792
794
|
|
|
793
795
|
return { schema, meta }
|
|
794
796
|
}
|
|
@@ -976,3 +978,164 @@ const supportedInputs = [
|
|
|
976
978
|
export type SupportedInputs = typeof supportedInputs[number]
|
|
977
979
|
export const getInputType = (input: string): SupportedInputs =>
|
|
978
980
|
(supportedInputs as readonly string[]).includes(input) ? input as SupportedInputs : "text"
|
|
981
|
+
|
|
982
|
+
export function deepMerge(target: any, source: any) {
|
|
983
|
+
const result = { ...target }
|
|
984
|
+
for (const key in source) {
|
|
985
|
+
if (Array.isArray(source[key])) {
|
|
986
|
+
// Arrays should be copied directly, not deep merged
|
|
987
|
+
result[key] = source[key]
|
|
988
|
+
} else if (source[key] && isObject(source[key])) {
|
|
989
|
+
result[key] = deepMerge(result[key], source[key])
|
|
990
|
+
} else {
|
|
991
|
+
result[key] = source[key]
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return result
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// Type definitions for schemas with fields and members
|
|
998
|
+
type SchemaWithFields = {
|
|
999
|
+
fields: Record<string, S.Schema<any>>
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
type SchemaWithMembers = {
|
|
1003
|
+
members: readonly S.Schema<any>[]
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// Type guards to check schema types
|
|
1007
|
+
function hasFields(schema: any): schema is SchemaWithFields {
|
|
1008
|
+
return schema && "fields" in schema && typeof schema.fields === "object"
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
function hasMembers(schema: any): schema is SchemaWithMembers {
|
|
1012
|
+
return schema && "members" in schema && Array.isArray(schema.members)
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// Internal implementation with WeakSet tracking
|
|
1016
|
+
export const defaultsValueFromSchema = (
|
|
1017
|
+
schema: S.Schema<any>,
|
|
1018
|
+
record: Record<string, any> = {}
|
|
1019
|
+
): any => {
|
|
1020
|
+
const ast: any = schema.ast
|
|
1021
|
+
|
|
1022
|
+
if (ast?.defaultValue) {
|
|
1023
|
+
return ast.defaultValue()
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
if (isNullableOrUndefined(schema.ast) === "null") {
|
|
1027
|
+
return null
|
|
1028
|
+
}
|
|
1029
|
+
if (isNullableOrUndefined(schema.ast) === "undefined") {
|
|
1030
|
+
return undefined
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// Check if schema has fields directly
|
|
1034
|
+
if (hasFields(schema)) {
|
|
1035
|
+
// Process fields and extract default values
|
|
1036
|
+
const result: Record<string, any> = {}
|
|
1037
|
+
|
|
1038
|
+
for (const [key, fieldSchema] of Object.entries(schema.fields)) {
|
|
1039
|
+
// Check if this field has a defaultValue in its AST
|
|
1040
|
+
const fieldAst = (fieldSchema as any)?.ast
|
|
1041
|
+
if (fieldAst?.defaultValue) {
|
|
1042
|
+
try {
|
|
1043
|
+
result[key] = fieldAst.defaultValue()
|
|
1044
|
+
continue
|
|
1045
|
+
} catch {
|
|
1046
|
+
// If defaultValue() throws, fall through to recursive processing
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// Recursively process the field
|
|
1051
|
+
const fieldValue = defaultsValueFromSchema(fieldSchema as any, record[key] || {})
|
|
1052
|
+
if (fieldValue !== undefined) {
|
|
1053
|
+
result[key] = fieldValue
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
return { ...result, ...record }
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
// Check if schema has fields in from (for ExtendedClass and similar transformations)
|
|
1061
|
+
if ((schema as any)?.from && hasFields((schema as any).from)) {
|
|
1062
|
+
return defaultsValueFromSchema((schema as any).from, record)
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
if (hasMembers(schema)) {
|
|
1066
|
+
// Merge all member fields, giving precedence to fields with default values
|
|
1067
|
+
const mergedMembers = schema.members.reduce((acc, member) => {
|
|
1068
|
+
if (hasFields(member)) {
|
|
1069
|
+
// Check each field and give precedence to ones with default values
|
|
1070
|
+
Object.entries(member.fields).forEach(([key, fieldSchema]) => {
|
|
1071
|
+
const fieldAst: any = fieldSchema.ast
|
|
1072
|
+
const existingFieldAst: any = acc[key]?.ast
|
|
1073
|
+
|
|
1074
|
+
// If field doesn't exist yet, or new field has default and existing doesn't, use new field
|
|
1075
|
+
if (!acc[key] || (fieldAst?.defaultValue && !existingFieldAst?.defaultValue)) {
|
|
1076
|
+
acc[key] = fieldSchema
|
|
1077
|
+
}
|
|
1078
|
+
// If both have defaults or neither have defaults, keep the first one (existing)
|
|
1079
|
+
})
|
|
1080
|
+
return acc
|
|
1081
|
+
}
|
|
1082
|
+
return acc
|
|
1083
|
+
}, {} as Record<string, any>)
|
|
1084
|
+
|
|
1085
|
+
// Use reduce to properly accumulate the merged fields
|
|
1086
|
+
return Object.entries(mergedMembers).reduce((acc, [key, value]) => {
|
|
1087
|
+
acc[key] = defaultsValueFromSchema(value, record[key] || {})
|
|
1088
|
+
return acc
|
|
1089
|
+
}, record)
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
if (Object.keys(record).length === 0) {
|
|
1093
|
+
switch (schema.ast._tag) {
|
|
1094
|
+
case "Refinement":
|
|
1095
|
+
return defaultsValueFromSchema(S.make(schema.ast.from), record)
|
|
1096
|
+
case "Transformation": {
|
|
1097
|
+
// For all transformations, just process the 'from' side to get the base defaults
|
|
1098
|
+
const fromSchema = S.make(schema.ast.from)
|
|
1099
|
+
return defaultsValueFromSchema(fromSchema, record)
|
|
1100
|
+
}
|
|
1101
|
+
case "TypeLiteral": {
|
|
1102
|
+
// Process TypeLiteral fields directly to build the result object
|
|
1103
|
+
const result: Record<string, any> = { ...record }
|
|
1104
|
+
|
|
1105
|
+
for (const prop of ast.propertySignatures) {
|
|
1106
|
+
const key = prop.name.toString()
|
|
1107
|
+
const propType = prop.type
|
|
1108
|
+
|
|
1109
|
+
// Check if the property type itself is a Transformation with defaultValue
|
|
1110
|
+
if (propType._tag === "Transformation" && propType.defaultValue) {
|
|
1111
|
+
result[key] = propType.defaultValue()
|
|
1112
|
+
continue
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
// Check if property type has defaultValue directly on the AST
|
|
1116
|
+
if (propType.defaultValue) {
|
|
1117
|
+
result[key] = propType.defaultValue()
|
|
1118
|
+
continue
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// Create a schema from the property type and get its defaults
|
|
1122
|
+
const propSchema = S.make(propType)
|
|
1123
|
+
|
|
1124
|
+
// Recursively process the property - don't pas for prop processing
|
|
1125
|
+
// to allow proper unwrapping of nested structures
|
|
1126
|
+
const propValue = defaultsValueFromSchema(propSchema, record[key] || {})
|
|
1127
|
+
|
|
1128
|
+
if (propValue !== undefined) {
|
|
1129
|
+
result[key] = propValue
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
return result
|
|
1134
|
+
}
|
|
1135
|
+
case "StringKeyword":
|
|
1136
|
+
return ""
|
|
1137
|
+
case "BooleanKeyword":
|
|
1138
|
+
return false
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|