mlform 0.1.2 → 0.1.3
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/README.md +166 -85
- package/dist/FieldStrategy-CW2h8YyB.js +2427 -0
- package/dist/{ReportStrategy-DY3GC_mJ.js → ReportStrategy-CxPzs4b2.js} +1 -1
- package/dist/{boolean-field-Cd3uhIPj.js → boolean-field-Dwz0ejWl.js} +2 -2
- package/dist/{category-field-D_Ms1x9u.js → category-field-DIgX--Px.js} +2 -2
- package/dist/{classifier-prediction-C5QzorTo.js → classifier-prediction-DgiEREf_.js} +2 -2
- package/dist/{custom-element-ttkHUa8w.js → custom-element-DFxkZ1wU.js} +0 -5
- package/dist/{date-field-Cg_ja679.js → date-field-91U2Xe46.js} +2 -2
- package/dist/{error-card-BwjPChwf.js → error-card-DHdkE18B.js} +2 -2
- package/dist/{field-wrapper-DqIQl76d.js → field-wrapper-CBmpN5T_.js} +3 -3
- package/dist/{ml-layout-Dx63KKf7.js → ml-layout-BJax9HVW.js} +3 -3
- package/dist/mlform/extensions.mjs +4 -4
- package/dist/mlform/strategies.mjs +9 -9
- package/dist/mlform.mjs +210 -202
- package/dist/{number-field-CC2DrVEb.js → number-field-Bcp45dJb.js} +31 -32
- package/dist/{property-jKFNMQpR.js → property-B2UZ3Oii.js} +0 -25
- package/dist/{range-field-Cr7LEtsJ.js → range-field-CD0kkCt0.js} +2 -2
- package/dist/{regressor-prediction-C18dHlfK.js → regressor-prediction-CPzZXlmA.js} +2 -2
- package/dist/src/core/domain/index.d.ts +2 -1
- package/dist/state-Ba1Gr1cr.js +7 -0
- package/dist/test/integration/lifecycle.integration.test.d.ts +1 -0
- package/dist/test/integration/registration.integration.test.d.ts +1 -0
- package/dist/test/integration/state.integration.test.d.ts +1 -0
- package/dist/test/integration/validation.integration.test.d.ts +1 -0
- package/dist/test/unit/Strategies.extensions.test.d.ts +1 -0
- package/dist/test/unit/Strategies.test.d.ts +1 -0
- package/dist/{text-field-DwP-Fa1w.js → text-field-CSBBr4gN.js} +2 -2
- package/package.json +59 -15
- package/dist/FieldStrategy-pPekBtH-.js +0 -2318
- package/dist/state-CLlTRyl1.js +0 -12
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FieldElement as p } from "./mlform/extensions.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
import { t as d } from "./custom-element-
|
|
4
|
-
var
|
|
5
|
-
for (var
|
|
6
|
-
(o = r[
|
|
7
|
-
return
|
|
2
|
+
import { a as h, n as u, x as c } from "./property-B2UZ3Oii.js";
|
|
3
|
+
import { t as d } from "./custom-element-DFxkZ1wU.js";
|
|
4
|
+
var m = Object.defineProperty, f = Object.getOwnPropertyDescriptor, b = (r, t, i) => t in r ? m(r, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[t] = i, l = (r, t, i, s) => {
|
|
5
|
+
for (var a = s > 1 ? void 0 : s ? f(t, i) : t, e = r.length - 1, o; e >= 0; e--)
|
|
6
|
+
(o = r[e]) && (a = (s ? o(t, i, a) : o(a)) || a);
|
|
7
|
+
return s && a && m(t, i, a), a;
|
|
8
8
|
}, v = (r, t, i) => b(r, t + "", i);
|
|
9
|
-
let
|
|
9
|
+
let n = class extends p {
|
|
10
10
|
unit = "";
|
|
11
11
|
step = "1";
|
|
12
12
|
firstUpdated() {
|
|
@@ -42,39 +42,38 @@ let a = class extends p {
|
|
|
42
42
|
`;
|
|
43
43
|
}
|
|
44
44
|
onInput(r) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const t = r.target.value.trim();
|
|
46
|
+
if (!t) {
|
|
47
|
+
this.value = NaN, this.dispatchState("empty");
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
|
-
if (!/^[0-9.,\s-]+$/.test(
|
|
50
|
+
if (!/^[0-9.,\s-]+$/.test(t)) {
|
|
50
51
|
this.dispatchState(
|
|
51
52
|
"error",
|
|
52
53
|
"Only digits, comma, dot, space, and a leading minus are allowed."
|
|
53
54
|
);
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
57
|
+
const s = (t.match(/-/g) || []).length;
|
|
58
|
+
if (s > 1 || s === 1 && !t.startsWith("-")) {
|
|
58
59
|
this.dispatchState(
|
|
59
60
|
"error",
|
|
60
61
|
"Minus sign must appear once and only at the beginning."
|
|
61
62
|
);
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
|
-
if (!/^-?(?:\d{1,3}(?:([,\s])\d{3}(?:\1\d{3})*)|\d+)(?:[.]\d+)?$/.test(
|
|
65
|
+
if (!/^-?(?:\d{1,3}(?:([,\s])\d{3}(?:\1\d{3})*)|\d+)(?:[.]\d+)?$/.test(t)) {
|
|
65
66
|
this.dispatchState(
|
|
66
67
|
"error",
|
|
67
68
|
"Invalid number format (check grouping or decimal separator)."
|
|
68
69
|
);
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
|
-
const e = this.parseLocaleNumber(
|
|
72
|
+
const e = this.parseLocaleNumber(t);
|
|
72
73
|
if (this.min && this.max && (e < parseFloat(this.min) || e > parseFloat(this.max))) {
|
|
73
74
|
this.dispatchState(
|
|
74
75
|
"error",
|
|
75
|
-
`Number must be between
|
|
76
|
-
${this.min} ${this.unit} and
|
|
77
|
-
${this.max ?? ""} ${this.unit}`
|
|
76
|
+
`Number must be between ${this.min} ${this.unit} and ${this.max ?? ""} ${this.unit}`
|
|
78
77
|
);
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
@@ -92,7 +91,7 @@ let a = class extends p {
|
|
|
92
91
|
);
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
|
-
this.dispatchState(
|
|
94
|
+
this.value = e, this.dispatchState(
|
|
96
95
|
"success",
|
|
97
96
|
`Valid Number: ${e.toLocaleString("en-US", {})} ${this.unit}`
|
|
98
97
|
);
|
|
@@ -100,14 +99,14 @@ let a = class extends p {
|
|
|
100
99
|
parseLocaleNumber(r) {
|
|
101
100
|
let t = r.replace(/\s+/g, ""), i = "";
|
|
102
101
|
t.startsWith("-") && (i = "-", t = t.slice(1));
|
|
103
|
-
const
|
|
104
|
-
let
|
|
105
|
-
return
|
|
102
|
+
const s = t.lastIndexOf("."), a = Math.max(s);
|
|
103
|
+
let e, o = "";
|
|
104
|
+
return a !== -1 ? (e = t.slice(0, a), o = t.slice(a + 1)) : e = t, e = e.replace(/[.,]/g, ""), parseFloat(i + (o ? `${e}.${o}` : e));
|
|
106
105
|
}
|
|
107
106
|
};
|
|
108
|
-
v(
|
|
107
|
+
v(n, "styles", [
|
|
109
108
|
p.baseStyles,
|
|
110
|
-
|
|
109
|
+
h`
|
|
111
110
|
.input-wrapper {
|
|
112
111
|
position: relative;
|
|
113
112
|
}
|
|
@@ -141,25 +140,25 @@ v(a, "styles", [
|
|
|
141
140
|
]);
|
|
142
141
|
l([
|
|
143
142
|
u({ type: String })
|
|
144
|
-
],
|
|
143
|
+
], n.prototype, "unit", 2);
|
|
145
144
|
l([
|
|
146
145
|
u({ type: String })
|
|
147
|
-
],
|
|
146
|
+
], n.prototype, "step", 2);
|
|
148
147
|
l([
|
|
149
148
|
u({ type: String })
|
|
150
|
-
],
|
|
149
|
+
], n.prototype, "min", 2);
|
|
151
150
|
l([
|
|
152
151
|
u({ type: String })
|
|
153
|
-
],
|
|
152
|
+
], n.prototype, "max", 2);
|
|
154
153
|
l([
|
|
155
154
|
u({ type: String })
|
|
156
|
-
],
|
|
155
|
+
], n.prototype, "defaultValue", 2);
|
|
157
156
|
l([
|
|
158
157
|
u({ type: String })
|
|
159
|
-
],
|
|
160
|
-
|
|
158
|
+
], n.prototype, "placeholder", 2);
|
|
159
|
+
n = l([
|
|
161
160
|
d("number-field")
|
|
162
|
-
],
|
|
161
|
+
], n);
|
|
163
162
|
export {
|
|
164
|
-
|
|
163
|
+
n as NumberField
|
|
165
164
|
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
1
|
const x = globalThis, k = x.ShadowRoot && (x.ShadyCSS === void 0 || x.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, j = Symbol(), I = /* @__PURE__ */ new WeakMap();
|
|
7
2
|
let X = class {
|
|
8
3
|
constructor(t, e, s) {
|
|
@@ -40,11 +35,6 @@ const it = (r) => new X(typeof r == "string" ? r : r + "", void 0, j), Ut = (r,
|
|
|
40
35
|
for (const s of t.cssRules) e += s.cssText;
|
|
41
36
|
return it(e);
|
|
42
37
|
})(r) : r;
|
|
43
|
-
/**
|
|
44
|
-
* @license
|
|
45
|
-
* Copyright 2017 Google LLC
|
|
46
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
-
*/
|
|
48
38
|
const { is: nt, defineProperty: ot, getOwnPropertyDescriptor: ht, getOwnPropertyNames: at, getOwnPropertySymbols: lt, getPrototypeOf: ct } = Object, T = globalThis, V = T.trustedTypes, dt = V ? V.emptyScript : "", pt = T.reactiveElementPolyfillSupport, S = (r, t) => r, M = { toAttribute(r, t) {
|
|
49
39
|
switch (t) {
|
|
50
40
|
case Boolean:
|
|
@@ -257,11 +247,6 @@ let g = class extends HTMLElement {
|
|
|
257
247
|
}
|
|
258
248
|
};
|
|
259
249
|
g.elementStyles = [], g.shadowRootOptions = { mode: "open" }, g[S("elementProperties")] = /* @__PURE__ */ new Map(), g[S("finalized")] = /* @__PURE__ */ new Map(), pt?.({ ReactiveElement: g }), (T.reactiveElementVersions ??= []).push("2.1.1");
|
|
260
|
-
/**
|
|
261
|
-
* @license
|
|
262
|
-
* Copyright 2017 Google LLC
|
|
263
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
264
|
-
*/
|
|
265
250
|
const L = globalThis, H = L.trustedTypes, J = H ? H.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Y = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, tt = "?" + _, ut = `<${tt}>`, y = document, b = () => y.createComment(""), w = (r) => r === null || typeof r != "object" && typeof r != "function", z = Array.isArray, $t = (r) => z(r) || typeof r?.[Symbol.iterator] == "function", R = `[
|
|
266
251
|
\f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, K = /-->/g, Z = />/g, f = RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^
|
|
267
252
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), F = /'/g, G = /"/g, et = /^(?:script|style|textarea|title)$/i, _t = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), Ot = _t(1), m = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Q = /* @__PURE__ */ new WeakMap(), A = y.createTreeWalker(y, 129);
|
|
@@ -487,11 +472,6 @@ const St = (r, t, e) => {
|
|
|
487
472
|
}
|
|
488
473
|
return i._$AI(r), i;
|
|
489
474
|
};
|
|
490
|
-
/**
|
|
491
|
-
* @license
|
|
492
|
-
* Copyright 2017 Google LLC
|
|
493
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
494
|
-
*/
|
|
495
475
|
const B = globalThis;
|
|
496
476
|
class O extends g {
|
|
497
477
|
constructor() {
|
|
@@ -519,11 +499,6 @@ O._$litElement$ = !0, O.finalized = !0, B.litElementHydrateSupport?.({ LitElemen
|
|
|
519
499
|
const bt = B.litElementPolyfillSupport;
|
|
520
500
|
bt?.({ LitElement: O });
|
|
521
501
|
(B.litElementVersions ??= []).push("4.2.1");
|
|
522
|
-
/**
|
|
523
|
-
* @license
|
|
524
|
-
* Copyright 2017 Google LLC
|
|
525
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
526
|
-
*/
|
|
527
502
|
const wt = { attribute: !0, type: String, converter: M, reflect: !1, hasChanged: D }, Ct = (r = wt, t, e) => {
|
|
528
503
|
const { kind: s, metadata: i } = e;
|
|
529
504
|
let n = globalThis.litPropertyMetadata.get(i);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FieldElement as l } from "./mlform/extensions.mjs";
|
|
2
|
-
import { a as c, n as p, x as b } from "./property-
|
|
3
|
-
import { t as h } from "./custom-element-
|
|
2
|
+
import { a as c, n as p, x as b } from "./property-B2UZ3Oii.js";
|
|
3
|
+
import { t as h } from "./custom-element-DFxkZ1wU.js";
|
|
4
4
|
var d = Object.defineProperty, g = Object.getOwnPropertyDescriptor, m = (e, t, r) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, i = (e, t, r, o) => {
|
|
5
5
|
for (var n = o > 1 ? void 0 : o ? g(t, r) : t, u = e.length - 1, s; u >= 0; u--)
|
|
6
6
|
(s = e[u]) && (n = (o ? s(t, r, n) : s(n)) || n);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as m, x as l, a as v, n as c } from "./property-
|
|
2
|
-
import { t as h } from "./custom-element-
|
|
1
|
+
import { i as m, x as l, a as v, n as c } from "./property-B2UZ3Oii.js";
|
|
2
|
+
import { t as h } from "./custom-element-DFxkZ1wU.js";
|
|
3
3
|
var p = Object.defineProperty, u = Object.getOwnPropertyDescriptor, x = (t, i, e) => i in t ? p(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e, o = (t, i, e, r) => {
|
|
4
4
|
for (var a = r > 1 ? void 0 : r ? u(i, e) : i, n = t.length - 1, d; n >= 0; n--)
|
|
5
5
|
(d = t[n]) && (a = (r ? d(i, e, a) : d(a)) || a);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ZodType, array as zArray, infer as zInfer, union as zUnion } from 'zod';
|
|
1
|
+
import { never as Znever, ZodType, array as zArray, infer as zInfer, union as zUnion } from 'zod';
|
|
2
2
|
import { FieldTypes, ModelTypes } from '../../strategies/domain';
|
|
3
3
|
export declare const array: typeof zArray;
|
|
4
4
|
export declare const union: typeof zUnion;
|
|
5
|
+
export declare const never: typeof Znever;
|
|
5
6
|
export type Schema = ZodType;
|
|
6
7
|
export type Infer<T extends ZodType> = zInfer<T>;
|
|
7
8
|
declare const BaseSchema: import('zod').ZodArray<import('zod').ZodObject<{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FieldElement as u } from "./mlform/extensions.mjs";
|
|
2
|
-
import { x as m, a as d, n as l } from "./property-
|
|
3
|
-
import { t as c } from "./custom-element-
|
|
2
|
+
import { x as m, a as d, n as l } from "./property-B2UZ3Oii.js";
|
|
3
|
+
import { t as c } from "./custom-element-DFxkZ1wU.js";
|
|
4
4
|
var p = Object.defineProperty, g = Object.getOwnPropertyDescriptor, v = (t, e, r) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, a = (t, e, r, h) => {
|
|
5
5
|
for (var n = h > 1 ? void 0 : h ? g(e, r) : e, s = t.length - 1, o; s >= 0; s--)
|
|
6
6
|
(o = t[s]) && (n = (h ? o(e, r, n) : o(n)) || n);
|
package/package.json
CHANGED
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mlform",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Composable form generation utilities for machine learning backend integration",
|
|
4
5
|
"license": "MIT",
|
|
5
|
-
"author":
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Pablo Ulloa Santín",
|
|
8
|
+
"email": "pablo.ulloa.santin@udc.es",
|
|
9
|
+
"url": "https://github.com/UlloaSP"
|
|
10
|
+
},
|
|
11
|
+
"contributors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Pablo Ulloa Santín",
|
|
14
|
+
"email": "pablo.ulloa.santin@udc.es",
|
|
15
|
+
"url": "https://github.com/UlloaSP"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"lit",
|
|
20
|
+
"web-components",
|
|
21
|
+
"forms",
|
|
22
|
+
"form-generator",
|
|
23
|
+
"strategies",
|
|
24
|
+
"typescript",
|
|
25
|
+
"zod",
|
|
26
|
+
"ml",
|
|
27
|
+
"machine-learning",
|
|
28
|
+
"frontend",
|
|
29
|
+
"models",
|
|
30
|
+
"ui",
|
|
31
|
+
"user-interface",
|
|
32
|
+
"library"
|
|
33
|
+
],
|
|
34
|
+
"homepage": "https://ulloasp.github.io/mlform/",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/UlloaSP/mlform/issues"
|
|
37
|
+
},
|
|
6
38
|
"repository": {
|
|
7
39
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/UlloaSP/mlform"
|
|
40
|
+
"url": "https://github.com/UlloaSP/mlform.git"
|
|
9
41
|
},
|
|
10
42
|
"private": false,
|
|
11
43
|
"type": "module",
|
|
12
44
|
"files": ["dist/**"],
|
|
45
|
+
"funding": [
|
|
46
|
+
{
|
|
47
|
+
"type": "github",
|
|
48
|
+
"url": "https://github.com/sponsors/UlloaSP"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
13
51
|
"exports": {
|
|
14
52
|
".": {
|
|
15
53
|
"types": "./dist/types/index.d.ts",
|
|
@@ -25,9 +63,15 @@
|
|
|
25
63
|
}
|
|
26
64
|
},
|
|
27
65
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
66
|
+
"node": ">=24.9.0"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public",
|
|
70
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
71
|
},
|
|
30
|
-
"
|
|
72
|
+
"sideEffects": false,
|
|
73
|
+
"types": "dist/types/index.d.ts",
|
|
74
|
+
"packageManager": "npm@11.6.2",
|
|
31
75
|
"scripts": {
|
|
32
76
|
"lint": "npx @biomejs/biome check --write",
|
|
33
77
|
"type": "tsc -p tsconfig.json --noEmit",
|
|
@@ -40,18 +84,18 @@
|
|
|
40
84
|
},
|
|
41
85
|
"dependencies": {
|
|
42
86
|
"lit": "3.3.1",
|
|
43
|
-
"zod": "4.
|
|
87
|
+
"zod": "4.1.12"
|
|
44
88
|
},
|
|
45
89
|
"devDependencies": {
|
|
46
|
-
"@biomejs/biome": "2.
|
|
47
|
-
"@types/node": "^24.
|
|
48
|
-
"globals": "^16.
|
|
49
|
-
"jsdom": "^
|
|
50
|
-
"rollup-plugin-visualizer": "^6.0.
|
|
51
|
-
"typescript": "~5.
|
|
52
|
-
"vite": "^7.
|
|
53
|
-
"vitest": "^
|
|
90
|
+
"@biomejs/biome": "2.3.4",
|
|
91
|
+
"@types/node": "^24.10.0",
|
|
92
|
+
"globals": "^16.5.0",
|
|
93
|
+
"jsdom": "^27.1.0",
|
|
94
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
95
|
+
"typescript": "~5.9.3",
|
|
96
|
+
"vite": "^7.2.2",
|
|
97
|
+
"vitest": "^4.0.8",
|
|
54
98
|
"vite-plugin-dts": "^4.5.4",
|
|
55
|
-
"@vitest/coverage-v8": "^
|
|
99
|
+
"@vitest/coverage-v8": "^4.0.8"
|
|
56
100
|
}
|
|
57
101
|
}
|