mlform 0.1.16 → 0.1.18
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 +2 -2
- package/dist/{builtins-DQTX_dwn.js → builtins-STiTwaH9.js} +98 -104
- package/dist/mlform/builtins.mjs +2 -2
- package/dist/mlform/kit.mjs +3 -3
- package/dist/mlform/runtime.mjs +2 -2
- package/dist/mlform/schema.mjs +2 -2
- package/dist/mlform/transport.mjs +1 -1
- package/dist/{runtime-BxMSso-p.js → runtime-Eo_q4pgg.js} +355 -362
- package/dist/{schema-D9V7-AkU.js → schema-CNKKJZRx.js} +22 -18
- package/dist/{transport-BG3HPc3-.js → transport-Cloa_erk.js} +8 -8
- package/dist/types/src/builtins/constants.d.ts +0 -4
- package/dist/types/src/builtins/definitions/shared.d.ts +0 -1
- package/dist/types/src/primitives/controller-types.d.ts +3 -3
- package/dist/types/src/schema/mapped-to.d.ts +3 -10
- package/dist/types/src/schema/types/report.d.ts +1 -1
- package/dist/types/src/schema/types/submit.d.ts +2 -2
- package/dist/types/src/transport/types/core.d.ts +2 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Schema-driven forms for machine learning applications.
|
|
|
9
9
|
|
|
10
10
|
MLForm gives you a predictable UI layer between users and model backends. You describe inputs and reports with a schema, MLForm renders accessible Web Components, validates values, submits structured payloads, and displays model results in the same host container.
|
|
11
11
|
|
|
12
|
-
Version `0.1.
|
|
12
|
+
Version `0.1.18` is the current release in this repository.
|
|
13
13
|
|
|
14
14
|
## Why MLForm
|
|
15
15
|
|
|
@@ -306,7 +306,7 @@ The main package targets Node.js `>=24.9.0`.
|
|
|
306
306
|
|
|
307
307
|
## Release Notes
|
|
308
308
|
|
|
309
|
-
For `0.1.
|
|
309
|
+
For `0.1.18`, use the repository release entry and the published docs as the source of truth:
|
|
310
310
|
|
|
311
311
|
- GitHub releases: https://github.com/UlloaSP/mlform/releases
|
|
312
312
|
- npm package: https://www.npmjs.com/package/mlform
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as e, m as t, s as n } from "./schema-CNKKJZRx.js";
|
|
2
2
|
import { s as r } from "./primitives-BcXt2QWI.js";
|
|
3
3
|
import * as i from "zod";
|
|
4
4
|
//#region src/builtins/constants.ts
|
|
@@ -6,9 +6,6 @@ var a = {
|
|
|
6
6
|
classifier: "classifier",
|
|
7
7
|
regressor: "regressor"
|
|
8
8
|
}, o = {
|
|
9
|
-
classifier: a.classifier,
|
|
10
|
-
regressor: a.regressor
|
|
11
|
-
}, ee = {
|
|
12
9
|
text: "text",
|
|
13
10
|
number: "number",
|
|
14
11
|
boolean: "boolean",
|
|
@@ -23,10 +20,10 @@ var a = {
|
|
|
23
20
|
}, s = {
|
|
24
21
|
classifier: "Classifier report",
|
|
25
22
|
regressor: "Regressor report"
|
|
26
|
-
},
|
|
23
|
+
}, c = {
|
|
27
24
|
unknownPrediction: "Unknown",
|
|
28
25
|
classifierClassLabel: (e) => `Class ${e + 1}`
|
|
29
|
-
},
|
|
26
|
+
}, l = {
|
|
30
27
|
invalidNumber: "Value must be a valid number.",
|
|
31
28
|
textPatternMismatch: "Value does not match the expected pattern.",
|
|
32
29
|
categoryOptionMismatch: "Value must match one of the available options.",
|
|
@@ -47,7 +44,7 @@ var a = {
|
|
|
47
44
|
timestampsUnique: "Timestamps must be unique.",
|
|
48
45
|
timestampsAscending: "Timestamps must be sorted in ascending order.",
|
|
49
46
|
timestampsDescending: "Timestamps must be sorted in descending order."
|
|
50
|
-
},
|
|
47
|
+
}, u = i.record(i.string(), i.unknown()).optional(), d = i.union([i.string().min(1), i.number().int().nonnegative()]), f = i.union([d, i.record(i.string().min(1), d.nullish())]).optional(), ee = i.custom((e) => typeof e == "function"), p = i.enum([
|
|
51
48
|
"idle",
|
|
52
49
|
"editing",
|
|
53
50
|
"validating",
|
|
@@ -106,7 +103,7 @@ var a = {
|
|
|
106
103
|
kind: i.literal("not"),
|
|
107
104
|
condition: m
|
|
108
105
|
})
|
|
109
|
-
])), h = i.union([
|
|
106
|
+
])), h = i.union([ee, m]), g = {
|
|
110
107
|
id: i.string().optional(),
|
|
111
108
|
label: i.string().min(1),
|
|
112
109
|
description: i.string().optional(),
|
|
@@ -126,23 +123,20 @@ var a = {
|
|
|
126
123
|
]).optional(),
|
|
127
124
|
includeInSubmission: i.boolean().optional(),
|
|
128
125
|
displayKey: i.string().min(1).optional(),
|
|
129
|
-
mappedTo:
|
|
126
|
+
mappedTo: f,
|
|
130
127
|
valuePath: i.union([i.string().min(1), i.array(i.string().min(1)).min(1)]).optional(),
|
|
131
128
|
defaultValue: i.unknown().optional(),
|
|
132
|
-
ui:
|
|
129
|
+
ui: u
|
|
133
130
|
}, _ = {
|
|
134
131
|
id: i.string().optional(),
|
|
135
132
|
label: i.string().optional(),
|
|
136
133
|
description: i.string().optional(),
|
|
137
|
-
mappedTo:
|
|
138
|
-
ui:
|
|
134
|
+
mappedTo: f,
|
|
135
|
+
ui: u
|
|
139
136
|
}, v = i.union([i.string(), i.object({
|
|
140
137
|
label: i.string(),
|
|
141
138
|
value: i.string()
|
|
142
|
-
})]), y = (e, t) => {
|
|
143
|
-
let n = e.raw;
|
|
144
|
-
if (!(typeof n != "object" || !n || !("outputs" in n) || !Array.isArray(n.outputs))) return n.outputs.find((e) => e.type === t);
|
|
145
|
-
}, b = (e, t, n) => ({
|
|
139
|
+
})]), y = (e, t, n) => ({
|
|
146
140
|
component: e,
|
|
147
141
|
props: {
|
|
148
142
|
id: t.id,
|
|
@@ -155,7 +149,7 @@ var a = {
|
|
|
155
149
|
...n,
|
|
156
150
|
...t.ui
|
|
157
151
|
}
|
|
158
|
-
}),
|
|
152
|
+
}), b = {
|
|
159
153
|
kind: "boolean",
|
|
160
154
|
schema: i.object({
|
|
161
155
|
kind: i.literal("boolean"),
|
|
@@ -170,7 +164,7 @@ var a = {
|
|
|
170
164
|
return e == null || e === "" ? null : e === !0 || e === "true" ? !0 : e === !1 || e === "false" ? !1 : !!e;
|
|
171
165
|
},
|
|
172
166
|
describe(e, t) {
|
|
173
|
-
return
|
|
167
|
+
return y("boolean-field", e, {
|
|
174
168
|
checked: t.state.value,
|
|
175
169
|
trueLabel: e.trueLabel,
|
|
176
170
|
falseLabel: e.falseLabel,
|
|
@@ -178,7 +172,7 @@ var a = {
|
|
|
178
172
|
errors: t.state.errors
|
|
179
173
|
});
|
|
180
174
|
}
|
|
181
|
-
},
|
|
175
|
+
}, x = {
|
|
182
176
|
kind: "category",
|
|
183
177
|
schema: i.object({
|
|
184
178
|
kind: i.literal("category"),
|
|
@@ -192,27 +186,27 @@ var a = {
|
|
|
192
186
|
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
193
187
|
},
|
|
194
188
|
validate(e, t) {
|
|
195
|
-
return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [
|
|
189
|
+
return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [l.categoryOptionMismatch];
|
|
196
190
|
},
|
|
197
191
|
describe(e, t) {
|
|
198
|
-
return
|
|
192
|
+
return y("category-field", e, {
|
|
199
193
|
value: t.state.value,
|
|
200
194
|
options: e.options,
|
|
201
195
|
state: t.state.status,
|
|
202
196
|
errors: t.state.errors
|
|
203
197
|
});
|
|
204
198
|
}
|
|
205
|
-
},
|
|
199
|
+
}, te = i.object({
|
|
206
200
|
label: i.string(),
|
|
207
201
|
value: i.string(),
|
|
208
202
|
mapping: i.record(i.string(), i.unknown())
|
|
209
|
-
}),
|
|
203
|
+
}), S = {
|
|
210
204
|
kind: "mapped-category",
|
|
211
205
|
schema: i.object({
|
|
212
206
|
kind: i.literal("mapped-category"),
|
|
213
207
|
...g,
|
|
214
208
|
includeInSubmission: i.boolean().optional().default(!1),
|
|
215
|
-
options: i.array(
|
|
209
|
+
options: i.array(te).min(1)
|
|
216
210
|
}),
|
|
217
211
|
getDefaultValue(e) {
|
|
218
212
|
return typeof e.defaultValue == "string" ? e.defaultValue : null;
|
|
@@ -221,10 +215,10 @@ var a = {
|
|
|
221
215
|
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
222
216
|
},
|
|
223
217
|
validate(e, t) {
|
|
224
|
-
return e === null || t.options.map((e) => e.value).includes(e) ? [] : [
|
|
218
|
+
return e === null || t.options.map((e) => e.value).includes(e) ? [] : [l.categoryOptionMismatch];
|
|
225
219
|
},
|
|
226
220
|
describe(e, t) {
|
|
227
|
-
return
|
|
221
|
+
return y("category-field", e, {
|
|
228
222
|
value: t.state.value,
|
|
229
223
|
options: e.options.map((e) => ({
|
|
230
224
|
label: e.label,
|
|
@@ -234,17 +228,17 @@ var a = {
|
|
|
234
228
|
errors: t.state.errors
|
|
235
229
|
});
|
|
236
230
|
}
|
|
237
|
-
},
|
|
231
|
+
}, C = i.object({
|
|
238
232
|
label: i.string(),
|
|
239
233
|
value: i.string(),
|
|
240
|
-
mappedTo:
|
|
241
|
-
}),
|
|
234
|
+
mappedTo: f.unwrap()
|
|
235
|
+
}), w = {
|
|
242
236
|
kind: "onehot-category",
|
|
243
237
|
schema: i.object({
|
|
244
238
|
kind: i.literal("onehot-category"),
|
|
245
239
|
...g,
|
|
246
240
|
includeInSubmission: i.boolean().optional().default(!0),
|
|
247
|
-
options: i.array(
|
|
241
|
+
options: i.array(C).min(1)
|
|
248
242
|
}),
|
|
249
243
|
getDefaultValue(e) {
|
|
250
244
|
return typeof e.defaultValue == "string" ? e.defaultValue : null;
|
|
@@ -253,10 +247,10 @@ var a = {
|
|
|
253
247
|
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
254
248
|
},
|
|
255
249
|
validate(e, t) {
|
|
256
|
-
return e === null || t.options.some((t) => t.value === e) ? [] : [
|
|
250
|
+
return e === null || t.options.some((t) => t.value === e) ? [] : [l.categoryOptionMismatch];
|
|
257
251
|
},
|
|
258
252
|
describe(e, t) {
|
|
259
|
-
return
|
|
253
|
+
return y("category-field", e, {
|
|
260
254
|
value: t.state.value,
|
|
261
255
|
options: e.options.map((e) => ({
|
|
262
256
|
label: e.label,
|
|
@@ -266,14 +260,14 @@ var a = {
|
|
|
266
260
|
errors: t.state.errors
|
|
267
261
|
});
|
|
268
262
|
}
|
|
269
|
-
},
|
|
263
|
+
}, T = (e) => typeof e == "object" && !!e && !Array.isArray(e), E = (e) => {
|
|
270
264
|
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
|
|
271
265
|
if (typeof e == "string" || typeof e == "number") {
|
|
272
266
|
let t = new Date(e);
|
|
273
267
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
274
268
|
}
|
|
275
269
|
return null;
|
|
276
|
-
},
|
|
270
|
+
}, D = {
|
|
277
271
|
kind: "date",
|
|
278
272
|
schema: i.object({
|
|
279
273
|
kind: i.literal("date"),
|
|
@@ -283,25 +277,25 @@ var a = {
|
|
|
283
277
|
step: i.number().positive().optional()
|
|
284
278
|
}),
|
|
285
279
|
getDefaultValue(e) {
|
|
286
|
-
return
|
|
280
|
+
return E(e.defaultValue) ?? null;
|
|
287
281
|
},
|
|
288
282
|
normalizeValue(e) {
|
|
289
|
-
return
|
|
283
|
+
return E(e);
|
|
290
284
|
},
|
|
291
285
|
serializeValue(e) {
|
|
292
286
|
return e instanceof Date ? e.toISOString() : e;
|
|
293
287
|
},
|
|
294
288
|
validate(e, t) {
|
|
295
|
-
let n = [], r =
|
|
296
|
-
if (r && i && r.getTime() > i.getTime() && n.push(
|
|
297
|
-
if (r && e.getTime() < r.getTime() && n.push(
|
|
289
|
+
let n = [], r = E(t.min), i = E(t.max);
|
|
290
|
+
if (r && i && r.getTime() > i.getTime() && n.push(l.invalidDateRange), e === null) return n;
|
|
291
|
+
if (r && e.getTime() < r.getTime() && n.push(l.dateOnOrAfter(String(t.min))), i && e.getTime() > i.getTime() && n.push(l.dateOnOrBefore(String(t.max))), t.step !== void 0) {
|
|
298
292
|
let i = r ?? /* @__PURE__ */ new Date("1970-01-01T00:00:00Z");
|
|
299
|
-
Math.round(Math.abs(e.getTime() - i.getTime()) / 864e5) % t.step !== 0 && n.push(
|
|
293
|
+
Math.round(Math.abs(e.getTime() - i.getTime()) / 864e5) % t.step !== 0 && n.push(l.stepDate(t.step));
|
|
300
294
|
}
|
|
301
295
|
return n;
|
|
302
296
|
},
|
|
303
297
|
describe(e, t) {
|
|
304
|
-
return
|
|
298
|
+
return y("date-field", e, {
|
|
305
299
|
value: t.state.value instanceof Date ? t.state.value.toISOString().slice(0, 10) : t.state.value,
|
|
306
300
|
min: e.min,
|
|
307
301
|
max: e.max,
|
|
@@ -310,7 +304,7 @@ var a = {
|
|
|
310
304
|
errors: t.state.errors
|
|
311
305
|
});
|
|
312
306
|
}
|
|
313
|
-
},
|
|
307
|
+
}, O = {
|
|
314
308
|
kind: "long-text",
|
|
315
309
|
schema: i.object({
|
|
316
310
|
kind: i.literal("long-text"),
|
|
@@ -328,10 +322,10 @@ var a = {
|
|
|
328
322
|
},
|
|
329
323
|
validate(e, t) {
|
|
330
324
|
let n = [];
|
|
331
|
-
return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(
|
|
325
|
+
return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(l.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(l.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(l.maxLength(t.maxLength)), n);
|
|
332
326
|
},
|
|
333
327
|
describe(e, t) {
|
|
334
|
-
return
|
|
328
|
+
return y("long-text-field", e, {
|
|
335
329
|
value: t.state.value,
|
|
336
330
|
placeholder: e.placeholder ?? "",
|
|
337
331
|
minLength: e.minLength,
|
|
@@ -341,7 +335,7 @@ var a = {
|
|
|
341
335
|
errors: t.state.errors
|
|
342
336
|
});
|
|
343
337
|
}
|
|
344
|
-
},
|
|
338
|
+
}, k = {
|
|
345
339
|
kind: "multi-choice",
|
|
346
340
|
schema: i.object({
|
|
347
341
|
kind: i.literal("multi-choice"),
|
|
@@ -364,10 +358,10 @@ var a = {
|
|
|
364
358
|
validate(e, t) {
|
|
365
359
|
if (e.length === 0) return [];
|
|
366
360
|
let n = t.options.map((e) => typeof e == "string" ? e : e.value);
|
|
367
|
-
return e.filter((e) => !n.includes(e)).length > 0 ? [
|
|
361
|
+
return e.filter((e) => !n.includes(e)).length > 0 ? [l.categoryOptionMismatch] : [];
|
|
368
362
|
},
|
|
369
363
|
describe(e, t) {
|
|
370
|
-
return
|
|
364
|
+
return y("multi-choice-field", e, {
|
|
371
365
|
value: t.state.value,
|
|
372
366
|
options: e.options,
|
|
373
367
|
layout: e.layout ?? "vertical",
|
|
@@ -375,7 +369,7 @@ var a = {
|
|
|
375
369
|
errors: t.state.errors
|
|
376
370
|
});
|
|
377
371
|
}
|
|
378
|
-
},
|
|
372
|
+
}, A = {
|
|
379
373
|
kind: "number",
|
|
380
374
|
schema: i.object({
|
|
381
375
|
kind: i.literal("number"),
|
|
@@ -403,17 +397,17 @@ var a = {
|
|
|
403
397
|
},
|
|
404
398
|
validate(e, t) {
|
|
405
399
|
let n = [];
|
|
406
|
-
if (t.min !== void 0 && t.max !== void 0 && t.min > t.max && n.push(
|
|
407
|
-
if (typeof e != "number") return n.push(
|
|
408
|
-
if (t.min !== void 0 && e < t.min && n.push(
|
|
400
|
+
if (t.min !== void 0 && t.max !== void 0 && t.min > t.max && n.push(l.invalidNumericRange), e === null) return n;
|
|
401
|
+
if (typeof e != "number") return n.push(l.invalidNumber), n;
|
|
402
|
+
if (t.min !== void 0 && e < t.min && n.push(l.minValue(t.min)), t.max !== void 0 && e > t.max && n.push(l.maxValue(t.max)), t.step !== void 0) {
|
|
409
403
|
let r = t.min ?? 0, i = Math.abs(e - r) % t.step, a = t.step * 1e-9;
|
|
410
|
-
i > a && Math.abs(i - t.step) > a && n.push(
|
|
404
|
+
i > a && Math.abs(i - t.step) > a && n.push(l.stepValue(t.step));
|
|
411
405
|
}
|
|
412
406
|
return n;
|
|
413
407
|
},
|
|
414
408
|
describe(e, t) {
|
|
415
409
|
let n = e.min !== void 0 && e.max !== void 0 && !e.required && t.state.value !== null;
|
|
416
|
-
return
|
|
410
|
+
return y("number-field", e, {
|
|
417
411
|
value: t.state.value,
|
|
418
412
|
min: e.min,
|
|
419
413
|
max: e.max,
|
|
@@ -425,7 +419,7 @@ var a = {
|
|
|
425
419
|
errors: t.state.errors
|
|
426
420
|
});
|
|
427
421
|
}
|
|
428
|
-
},
|
|
422
|
+
}, j = {
|
|
429
423
|
kind: "rating",
|
|
430
424
|
schema: i.object({
|
|
431
425
|
kind: i.literal("rating"),
|
|
@@ -445,10 +439,10 @@ var a = {
|
|
|
445
439
|
validate(e, t) {
|
|
446
440
|
if (e === null) return [];
|
|
447
441
|
let n = [], r = t.min ?? 1, i = t.max;
|
|
448
|
-
return r > i ? (n.push(
|
|
442
|
+
return r > i ? (n.push(l.invalidNumericRange), n) : (e < r && n.push(l.minValue(r)), e > i && n.push(l.maxValue(i)), n);
|
|
449
443
|
},
|
|
450
444
|
describe(e, t) {
|
|
451
|
-
return
|
|
445
|
+
return y("rating-field", e, {
|
|
452
446
|
value: t.state.value,
|
|
453
447
|
min: e.min ?? 1,
|
|
454
448
|
max: e.max,
|
|
@@ -457,7 +451,7 @@ var a = {
|
|
|
457
451
|
errors: t.state.errors
|
|
458
452
|
});
|
|
459
453
|
}
|
|
460
|
-
},
|
|
454
|
+
}, M = {
|
|
461
455
|
kind: "text",
|
|
462
456
|
schema: i.object({
|
|
463
457
|
kind: i.literal("text"),
|
|
@@ -475,10 +469,10 @@ var a = {
|
|
|
475
469
|
},
|
|
476
470
|
validate(e, t) {
|
|
477
471
|
let n = [];
|
|
478
|
-
return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(
|
|
472
|
+
return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(l.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(l.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(l.maxLength(t.maxLength)), t.pattern && !new RegExp(t.pattern).test(e) && n.push(l.textPatternMismatch), n);
|
|
479
473
|
},
|
|
480
474
|
describe(e, t) {
|
|
481
|
-
return
|
|
475
|
+
return y("text-field", e, {
|
|
482
476
|
value: t.state.value,
|
|
483
477
|
placeholder: e.placeholder ?? "",
|
|
484
478
|
minLength: e.minLength,
|
|
@@ -488,23 +482,23 @@ var a = {
|
|
|
488
482
|
errors: t.state.errors
|
|
489
483
|
});
|
|
490
484
|
}
|
|
491
|
-
},
|
|
485
|
+
}, N = i.object({
|
|
492
486
|
kind: i.string().min(1),
|
|
493
487
|
label: i.string().min(1),
|
|
494
488
|
required: i.boolean().optional()
|
|
495
|
-
}).passthrough(),
|
|
489
|
+
}).passthrough(), P = i.object({
|
|
496
490
|
kind: i.literal("series"),
|
|
497
491
|
...g,
|
|
498
|
-
field1:
|
|
499
|
-
field2:
|
|
492
|
+
field1: N,
|
|
493
|
+
field2: N,
|
|
500
494
|
minPoints: i.number().int().nonnegative().optional(),
|
|
501
495
|
maxPoints: i.number().int().nonnegative().optional()
|
|
502
|
-
}),
|
|
503
|
-
text:
|
|
504
|
-
number:
|
|
505
|
-
date:
|
|
506
|
-
category:
|
|
507
|
-
},
|
|
496
|
+
}), F = "This field is required.", I = (e) => e.toISOString().slice(0, 10), L = {
|
|
497
|
+
text: M,
|
|
498
|
+
number: A,
|
|
499
|
+
date: D,
|
|
500
|
+
category: x
|
|
501
|
+
}, R = (e) => L[e], ne = (e) => {
|
|
508
502
|
if (e == null || e === "") return null;
|
|
509
503
|
if (typeof e == "boolean") return e;
|
|
510
504
|
if (typeof e == "string") {
|
|
@@ -513,19 +507,19 @@ var a = {
|
|
|
513
507
|
}
|
|
514
508
|
return !!e;
|
|
515
509
|
}, z = (e, t) => {
|
|
516
|
-
if (e.kind ===
|
|
517
|
-
let n =
|
|
510
|
+
if (e.kind === b.kind) return ne(t);
|
|
511
|
+
let n = R(e.kind);
|
|
518
512
|
return n?.normalizeValue ? n.normalizeValue(t, e) : t;
|
|
519
513
|
}, B = (e, t) => {
|
|
520
514
|
if (t == null) return null;
|
|
521
|
-
if (e.kind === "date" && t instanceof Date) return
|
|
522
|
-
let n =
|
|
515
|
+
if (e.kind === "date" && t instanceof Date) return I(t);
|
|
516
|
+
let n = R(e.kind);
|
|
523
517
|
return n?.serializeValue ? n.serializeValue(t, e) : t;
|
|
524
|
-
},
|
|
525
|
-
if (e.required &&
|
|
526
|
-
if (e.kind ===
|
|
518
|
+
}, re = (e, t) => t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : e.kind === b.kind ? t == null : !1, V = (e, t) => {
|
|
519
|
+
if (e.required && re(e, t)) return [F];
|
|
520
|
+
if (e.kind === b.kind) {
|
|
527
521
|
if (t === null) return [];
|
|
528
|
-
let n =
|
|
522
|
+
let n = b.validate?.(t, e, {
|
|
529
523
|
field: {
|
|
530
524
|
...e,
|
|
531
525
|
id: e.label
|
|
@@ -537,7 +531,7 @@ var a = {
|
|
|
537
531
|
});
|
|
538
532
|
return Array.isArray(n) ? n : [];
|
|
539
533
|
}
|
|
540
|
-
let n =
|
|
534
|
+
let n = R(e.kind);
|
|
541
535
|
if (!n?.validate) return [];
|
|
542
536
|
let r = n.validate(t, e, {
|
|
543
537
|
field: {
|
|
@@ -555,7 +549,7 @@ var a = {
|
|
|
555
549
|
field1: e[0],
|
|
556
550
|
field2: e[1]
|
|
557
551
|
} : null;
|
|
558
|
-
if (!
|
|
552
|
+
if (!T(e)) return null;
|
|
559
553
|
if ("field1" in e || "field2" in e) return {
|
|
560
554
|
field1: e.field1,
|
|
561
555
|
field2: e.field2
|
|
@@ -573,10 +567,10 @@ var a = {
|
|
|
573
567
|
} : null;
|
|
574
568
|
}, G = (e, t) => {
|
|
575
569
|
let n = /* @__PURE__ */ new Set();
|
|
576
|
-
return t.minPoints !== void 0 && t.maxPoints !== void 0 && t.minPoints > t.maxPoints && n.add(
|
|
570
|
+
return t.minPoints !== void 0 && t.maxPoints !== void 0 && t.minPoints > t.maxPoints && n.add(l.invalidPointCountRange), t.minPoints !== void 0 && e.length < t.minPoints && n.add(l.minPoints(t.minPoints)), t.maxPoints !== void 0 && e.length > t.maxPoints && n.add(l.maxPoints(t.maxPoints)), n;
|
|
577
571
|
}, K = {
|
|
578
572
|
kind: "series",
|
|
579
|
-
schema:
|
|
573
|
+
schema: P,
|
|
580
574
|
getDefaultValue(e) {
|
|
581
575
|
return Array.isArray(e.defaultValue) ? e.defaultValue.map((t) => W(t, e)).filter((e) => e !== null) : [];
|
|
582
576
|
},
|
|
@@ -597,8 +591,8 @@ var a = {
|
|
|
597
591
|
}), [...n];
|
|
598
592
|
},
|
|
599
593
|
describe(e, t) {
|
|
600
|
-
return
|
|
601
|
-
value: Array.isArray(t.state.value) ? t.state.value.map((t) =>
|
|
594
|
+
return y("series-field", e, {
|
|
595
|
+
value: Array.isArray(t.state.value) ? t.state.value.map((t) => T(t) ? {
|
|
602
596
|
field1: B(e.field1, t.field1),
|
|
603
597
|
field2: B(e.field2, t.field2)
|
|
604
598
|
} : t) : [],
|
|
@@ -625,10 +619,10 @@ var a = {
|
|
|
625
619
|
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
626
620
|
},
|
|
627
621
|
validate(e, t) {
|
|
628
|
-
return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [
|
|
622
|
+
return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [l.categoryOptionMismatch];
|
|
629
623
|
},
|
|
630
624
|
describe(e, t) {
|
|
631
|
-
return
|
|
625
|
+
return y("single-choice-field", e, {
|
|
632
626
|
value: t.state.value,
|
|
633
627
|
options: e.options,
|
|
634
628
|
layout: e.layout ?? "vertical",
|
|
@@ -646,7 +640,7 @@ var a = {
|
|
|
646
640
|
showClassProbabilities: i.boolean().optional().default(!0)
|
|
647
641
|
}),
|
|
648
642
|
resolvePayload(t, n) {
|
|
649
|
-
return e(n.report, n.result)
|
|
643
|
+
return e(n.report, n.result);
|
|
650
644
|
},
|
|
651
645
|
describe(e, t) {
|
|
652
646
|
return t.state.status === "idle" && t.payload === void 0 ? null : {
|
|
@@ -675,7 +669,7 @@ var a = {
|
|
|
675
669
|
precision: i.number().int().nonnegative().optional().default(2)
|
|
676
670
|
}),
|
|
677
671
|
resolvePayload(t, n) {
|
|
678
|
-
return e(n.report, n.result)
|
|
672
|
+
return e(n.report, n.result);
|
|
679
673
|
},
|
|
680
674
|
describe(e, t) {
|
|
681
675
|
return t.state.status === "idle" && t.payload === void 0 ? null : {
|
|
@@ -694,7 +688,7 @@ var a = {
|
|
|
694
688
|
}
|
|
695
689
|
};
|
|
696
690
|
}
|
|
697
|
-
}, X = (e) => e.kind === "mapped-category" ? e.config : null, Z = (e, n) => e.getField(n) ?? e.getField(t(n)),
|
|
691
|
+
}, X = (e) => e.kind === "mapped-category" ? e.config : null, Z = (e, n) => e.getField(n) ?? e.getField(t(n)), ie = async (e, t) => {
|
|
698
692
|
let n = t.getField(e.fieldId);
|
|
699
693
|
if (!n) return;
|
|
700
694
|
let r = X(n);
|
|
@@ -718,35 +712,35 @@ var a = {
|
|
|
718
712
|
}
|
|
719
713
|
},
|
|
720
714
|
async onValuesChanged(e, t) {
|
|
721
|
-
await
|
|
715
|
+
await ie(e, t);
|
|
722
716
|
}
|
|
723
|
-
}),
|
|
724
|
-
|
|
725
|
-
|
|
717
|
+
}), ae = [
|
|
718
|
+
M,
|
|
719
|
+
A,
|
|
720
|
+
b,
|
|
726
721
|
x,
|
|
727
722
|
S,
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
O,
|
|
723
|
+
w,
|
|
724
|
+
D,
|
|
731
725
|
K,
|
|
732
|
-
|
|
726
|
+
O,
|
|
733
727
|
q,
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
],
|
|
728
|
+
k,
|
|
729
|
+
j
|
|
730
|
+
], oe = [J, Y], $ = (e, t) => {
|
|
737
731
|
!t.describe || e.getField(t.kind) || e.registerField({
|
|
738
732
|
kind: t.kind,
|
|
739
733
|
describe: t.describe
|
|
740
734
|
});
|
|
741
|
-
},
|
|
735
|
+
}, se = (e, t) => {
|
|
742
736
|
!t.describe || e.getReport(t.kind) || e.registerReport({
|
|
743
737
|
kind: t.kind,
|
|
744
738
|
describe: t.describe
|
|
745
739
|
});
|
|
746
|
-
},
|
|
740
|
+
}, ce = () => n().registerReport(J).registerReport(Y), le = () => {
|
|
747
741
|
let e = n(), t = r();
|
|
748
|
-
for (let n of
|
|
749
|
-
for (let n of
|
|
742
|
+
for (let n of ae) e.registerField(n), $(t, n);
|
|
743
|
+
for (let n of oe) e.registerReport(n), se(t, n);
|
|
750
744
|
return {
|
|
751
745
|
registry: e,
|
|
752
746
|
descriptorRegistry: t,
|
|
@@ -754,4 +748,4 @@ var a = {
|
|
|
754
748
|
};
|
|
755
749
|
};
|
|
756
750
|
//#endregion
|
|
757
|
-
export {
|
|
751
|
+
export { l as S, b as _, J as a, a as b, M as c, k as d, O as f, x as g, S as h, Y as i, j as l, w as m, le as n, q as o, D as p, Q as r, K as s, ce as t, A as u, o as v, s as x, c as y };
|
package/dist/mlform/builtins.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "../builtins-STiTwaH9.js";
|
|
2
|
+
export { t as booleanFieldDefinition, y as builtinFieldKinds, x as builtinReportFallbacks, r as builtinReportKinds, b as builtinReportLabels, e as builtinValidationMessages, s as categoryFieldDefinition, n as classifierReportDefinition, _ as createBuiltinMlRegistry, h as createMappedCategoryBehavior, f as createMlRegistryPack, m as dateFieldDefinition, o as longTextFieldDefinition, c as mappedCategoryFieldDefinition, a as multiChoiceFieldDefinition, v as numberFieldDefinition, d as oneHotCategoryFieldDefinition, u as ratingFieldDefinition, l as regressorReportDefinition, g as seriesFieldDefinition, p as singleChoiceFieldDefinition, i as textFieldDefinition };
|
package/dist/mlform/kit.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as e, t } from "../runtime-
|
|
2
|
-
import { m as n, s as r } from "../schema-
|
|
3
|
-
import { n as i } from "../builtins-
|
|
1
|
+
import { _ as e, t } from "../runtime-Eo_q4pgg.js";
|
|
2
|
+
import { m as n, s as r } from "../schema-CNKKJZRx.js";
|
|
3
|
+
import { n as i } from "../builtins-STiTwaH9.js";
|
|
4
4
|
import { _ as a, a as o, h as s, l as c, m as l, p as u, r as d, t as f } from "../primitives-BcXt2QWI.js";
|
|
5
5
|
import { d as p, h as m, r as h } from "../design-Dr7o4rR9.js";
|
|
6
6
|
import { LitElement as g, css as _, html as v, nothing as y } from "lit";
|
package/dist/mlform/runtime.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _ } from "../runtime-
|
|
2
|
-
import { J as v, Y as y } from "../transport-
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _ } from "../runtime-Eo_q4pgg.js";
|
|
2
|
+
import { J as v, Y as y } from "../transport-Cloa_erk.js";
|
|
3
3
|
export { r as EngineError, i as RegistryError, f as ReportPayloadError, l as SubmissionAbortedError, o as SubmitError, v as TransportError, a as ValidationError, h as createForm, h as createFormRuntime, m as createMultiBackendSubmissionSnapshot, n as createSubmissionSnapshot, u as defaultEquality, e as executeFormPipeline, d as executeMultiBackendPipeline, _ as executeReportFetches, c as identity, g as isPromiseLike, p as shallowArrayEquality, s as shallowEquality, t as shallowObjectEquality, y as transportErrorCodes };
|
package/dist/mlform/schema.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "../schema-
|
|
2
|
-
export {
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "../schema-CNKKJZRx.js";
|
|
2
|
+
export { c as RegistryError, d as createRegistry, s as createReportContexts, f as createReportFetchRequest, t as defineFieldDefinition, a as defineReportDefinition, u as getReportContext, p as mappedToKey, e as normalizeSchema, o as normalizeSchemaId, n as resolveMappedReportPayload, r as resolveMappedTargets, l as resolveMappedTo, i as resolveOneHotDisplayValue };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, R as g, S as _, T as v, U as y, V as b, W as x, Y as S, _ as C, a as w, b as T, c as E, d as D, f as O, g as k, h as A, i as j, j as M, k as N, l as P, m as F, n as I, o as L, p as R, q as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q, z as J } from "../transport-
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, R as g, S as _, T as v, U as y, V as b, W as x, Y as S, _ as C, a as w, b as T, c as E, d as D, f as O, g as k, h as A, i as j, j as M, k as N, l as P, m as F, n as I, o as L, p as R, q as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q, z as J } from "../transport-Cloa_erk.js";
|
|
2
2
|
export { l as TransportError, t as assertPayloadWithinLimits, b as assertTransportCapabilities, s as cloneCapabilities, w as createFallbackTransport, V as createFanoutTransport, h as createGraphqlTransport, r as createGrpcSessionTransport, m as createGrpcStreamTransport, N as createGrpcTransport, e as createGrpcUnaryTransport, I as createHedgedTransport, a as createJsonTransport, E as createLoadBalancedTransport, C as createMemoryCircuitBreakerState, A as createMemorySharedRateLimiter, O as createMemoryTransportCacheStore, H as createMemoryTransportHealthState, j as createPipelineTransport, L as createQuorumFanoutTransport, B as createRacingTransport, P as createRoutingTransport, f as createSessionTransport, p as createSseTransport, c as createTransportRequestRunner, M as createWebSocketSessionTransport, U as createWeightedRoutingTransport, d as extractErrorMessage, g as getTransportPolicyContext, y as inferTransportCapabilities, x as mergeTransportCapabilities, o as normalizeTransportCapabilities, i as pipe, u as transportDefaults, S as transportErrorCodes, z as transportErrorMessages, W as withAuth, D as withCache, k as withCircuitBreaker, R as withDedup, K as withLogging, q as withMetrics, F as withRateLimit, _ as withRequestTransform, n as withResponseTransform, v as withRetry, G as withTimeout, T as withTracing, J as withTransportPolicyContext };
|