mlform 0.1.22 → 0.1.24
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 +98 -229
- package/dist/builtins-jvAitKUC.js +560 -0
- package/dist/{design-Dr7o4rR9.js → design-D8zce4Mh.js} +13 -12
- package/dist/mlform/builtins.mjs +2 -2
- package/dist/mlform/design.mjs +1 -1
- package/dist/mlform/kit.mjs +435 -275
- package/dist/mlform/primitives.mjs +2 -2
- package/dist/mlform/runtime.mjs +1 -1
- package/dist/mlform/schema.mjs +1 -1
- package/dist/{primitives-ljp3c5R8.js → primitives-ChLgMFl9.js} +452 -450
- package/dist/{runtime-C9ZioNpI.js → runtime-B_vnmwya.js} +9 -9
- package/dist/{schema-CiCjXECD.js → schema-C34LJ8aV.js} +99 -110
- package/dist/types/{src/builtins → builtins}/definitions/collections.d.ts +12 -12
- package/dist/types/{src/builtins → builtins}/definitions/fields/boolean.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/category.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/date.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/long-text.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/mapped-category.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/multi-choice.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/number.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/onehot-category.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/rating.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/series-helpers.d.ts +4 -4
- package/dist/types/{src/builtins → builtins}/definitions/fields/single-choice.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/fields/text.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/reports/classifier.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/reports/regressor.d.ts +1 -1
- package/dist/types/{src/builtins → builtins}/definitions/shared.d.ts +3 -28
- package/dist/types/{src/builtins → builtins}/index.d.ts +2 -3
- package/dist/types/{src/builtins → builtins}/mapped-category-behavior.d.ts +1 -1
- package/dist/types/builtins/registry.d.ts +2 -0
- package/dist/types/kit/builtin-presenters.d.ts +2 -0
- package/dist/types/{src/kit → kit}/defaults.d.ts +3 -3
- package/dist/types/{src/kit → kit}/index.d.ts +3 -0
- package/dist/types/{src/kit → kit}/kinds/define-field-kind.d.ts +4 -3
- package/dist/types/{src/kit → kit}/kinds/define-report-kind.d.ts +4 -3
- package/dist/types/kit/kinds/register-kind.d.ts +6 -0
- package/dist/types/{src/kit → kit}/layout-helpers.d.ts +1 -1
- package/dist/types/{src/kit → kit}/layout-node-render.d.ts +1 -1
- package/dist/types/{src/kit → kit}/layout-root.d.ts +1 -1
- package/dist/types/{src/kit → kit}/layout-utils.d.ts +1 -1
- package/dist/types/{src/kit → kit}/layout.d.ts +1 -1
- package/dist/types/{src/kit → kit}/mount-types.d.ts +5 -3
- package/dist/types/kit/plugin.d.ts +19 -0
- package/dist/types/kit/registry-pack.d.ts +16 -0
- package/dist/types/{src/kit → kit}/tabs-root.d.ts +1 -1
- package/dist/types/{src/kit → kit}/view-core-types.d.ts +4 -2
- package/dist/types/{src/kit → kit}/view-navigation.d.ts +1 -1
- package/dist/types/{src/kit → kit}/view-snapshot-cache.d.ts +2 -2
- package/dist/types/{src/kit → kit}/view-snapshot.d.ts +2 -2
- package/dist/types/{src/kit → kit}/wizard-root.d.ts +1 -1
- package/dist/types/{src/primitives → primitives}/descriptors/registry.d.ts +2 -1
- package/dist/types/{src/primitives → primitives}/index.d.ts +1 -1
- package/dist/types/primitives/mount-form.d.ts +4 -0
- package/dist/types/{src/runtime → runtime}/errors.d.ts +1 -1
- package/dist/types/{src/runtime → runtime}/runtime-behaviors.d.ts +1 -1
- package/dist/types/{src/runtime → runtime}/submission/request.d.ts +1 -1
- package/dist/types/{src/runtime → runtime}/submission/types.d.ts +1 -1
- package/dist/types/{src/runtime → runtime}/types/behavior.d.ts +2 -2
- package/dist/types/{src/runtime → runtime}/types/field.d.ts +3 -3
- package/dist/types/{src/runtime → runtime}/types/form.d.ts +3 -2
- package/dist/types/{src/runtime → runtime}/types/index.d.ts +1 -0
- package/dist/types/{src/runtime → runtime}/types/registry.d.ts +1 -1
- package/dist/types/{src/runtime → runtime}/types/report.d.ts +5 -5
- package/dist/types/runtime/types/status.d.ts +1 -0
- package/dist/types/{src/runtime → runtime}/types/transport.d.ts +5 -5
- package/dist/types/{src/runtime → runtime}/validation/form.d.ts +1 -1
- package/dist/types/{src/schema → schema}/index.d.ts +1 -0
- package/dist/types/{src/schema → schema}/mapped-to.d.ts +2 -6
- package/dist/types/{src/schema → schema}/normalize.d.ts +2 -1
- package/dist/types/{src/schema → schema}/registry.d.ts +3 -1
- package/dist/types/{src/schema → schema}/types/field.d.ts +1 -1
- package/dist/types/schema/types/mapping.d.ts +6 -0
- package/dist/types/{src/schema → schema}/types/report.d.ts +1 -1
- package/dist/types/{src/schema → schema}/types/submit.d.ts +1 -1
- package/dist/types/{src/schema → schema}/validation.d.ts +3 -1
- package/dist/types/{src/transport → transport}/types.d.ts +1 -1
- package/package.json +27 -20
- package/dist/builtins-B2U_ViF6.js +0 -749
- package/dist/types/src/builtins/registry-pack.d.ts +0 -10
- package/dist/types/src/kit/kinds/register-kind.d.ts +0 -5
- package/dist/types/src/primitives/mount-form.d.ts +0 -4
- /package/dist/types/{src/builtins → builtins}/constants.d.ts +0 -0
- /package/dist/types/{src/builtins → builtins}/definitions/fields/series.d.ts +0 -0
- /package/dist/types/{src/builtins → builtins}/definitions/fields/value-helpers.d.ts +0 -0
- /package/dist/types/{src/builtins → builtins}/definitions/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/constants.d.ts +0 -0
- /package/dist/types/{src/design → design}/contract/component-keys.d.ts +0 -0
- /package/dist/types/{src/design → design}/contract/component-tokens.d.ts +0 -0
- /package/dist/types/{src/design → design}/contract/global-tokens.d.ts +0 -0
- /package/dist/types/{src/design → design}/contract/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/contract/token-keys.d.ts +0 -0
- /package/dist/types/{src/design → design}/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/recipes/collections.d.ts +0 -0
- /package/dist/types/{src/design → design}/recipes/contrast.d.ts +0 -0
- /package/dist/types/{src/design → design}/recipes/default.d.ts +0 -0
- /package/dist/types/{src/design → design}/recipes/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/recipes/minimal.d.ts +0 -0
- /package/dist/types/{src/design → design}/recipes/soft.d.ts +0 -0
- /package/dist/types/{src/design → design}/registry/builtins.d.ts +0 -0
- /package/dist/types/{src/design → design}/registry/create-registry.d.ts +0 -0
- /package/dist/types/{src/design → design}/registry/deep-freeze.d.ts +0 -0
- /package/dist/types/{src/design → design}/registry/define-recipe.d.ts +0 -0
- /package/dist/types/{src/design → design}/registry/define-theme.d.ts +0 -0
- /package/dist/types/{src/design → design}/registry/define-token-maps.d.ts +0 -0
- /package/dist/types/{src/design → design}/registry/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/diagnostics.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/merge-config.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/migrate-tokens.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/resolve-design.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/resolve-mode.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/resolve-recipe.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/resolve-theme.d.ts +0 -0
- /package/dist/types/{src/design → design}/resolve/resolve-tokens.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/apply-tokens.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/attach-design.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/controller-helpers.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/create-stylesheet.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/declarations.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/design-controller.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/fingerprint.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/host-observer.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/host-state.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/hydrate-design.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/hydration-state.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/inherited-scheme.d.ts +0 -0
- /package/dist/types/{src/design → design}/runtime/media.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/airbnb.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/clickhouse.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/cobalt.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/collections.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/graphite.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/neutral.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/sage.d.ts +0 -0
- /package/dist/types/{src/design → design}/themes/sunset.d.ts +0 -0
- /package/dist/types/{src/design → design}/tokens/base.d.ts +0 -0
- /package/dist/types/{src/design → design}/tokens/contrast.d.ts +0 -0
- /package/dist/types/{src/design → design}/tokens/density.d.ts +0 -0
- /package/dist/types/{src/design → design}/tokens/forced-colors.d.ts +0 -0
- /package/dist/types/{src/design → design}/tokens/index.d.ts +0 -0
- /package/dist/types/{src/design → design}/tokens/motion.d.ts +0 -0
- /package/dist/types/{src/design → design}/types.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/constants.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/disclosure-root-styles.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/error-navigation.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/kinds/index.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/layout-node-resolver.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/layout-types.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/mount-form.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/panel-nav.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/step-indicator.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/tabs-root-styles.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/types.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/view-layout-state.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/view-types.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/view.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/wizard-constants.d.ts +0 -0
- /package/dist/types/{src/kit → kit}/wizard-root-styles.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/base-async-report-element.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/base-field-element.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/base-report-element.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/declarative-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/declarative-report.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/descriptor-content.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/error-focus.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/field-frame-feedback.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/field-frame-styles.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/field-frame.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/form-errors.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/form-root-presenters.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/form-root-split-styles.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/form-root-state.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/form-root-styles.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/form-root-templates.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/form-root.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/mounted-report.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/report-frame.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/submit-button.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/components/unsupported-component.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/constants.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/controller-binding.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/controller-types.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/descriptor-resolution.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/descriptors/content.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/descriptors/field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/descriptors/index.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/descriptors/report.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/boolean-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/category-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/date-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/long-text-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/multi-choice-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/number-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/rating-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/series-field-helpers.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/series-field-renderers.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/series-field-styles.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/series-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/single-choice-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/fields/text-field.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/register.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/registry.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/reports/classifier-report.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/reports/regressor-report.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/request-runner.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/types.d.ts +0 -0
- /package/dist/types/{src/primitives → primitives}/utils.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/comparison.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/create-runtime-helpers.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/create-runtime.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/equality.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/fields/controller.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/fields/index.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/fields/state-calculations.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/fields/state.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/form.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/index.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/paths.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/reports/controller.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/reports/index.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/runtime-controller.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/runtime-refresh.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/runtime-values.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/state/engine.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/state/index.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/state/snapshots.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/state/store.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/abort.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/create-submitter.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/error-flow.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/index.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/lifecycle.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/multi-backend.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/pipeline.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/report-fetches.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/reports.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/result.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/snapshot.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/submitter.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/submission/transport-response.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/types/pipeline.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/utils.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/validation/conditions.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/validation/field-state.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/validation/field-validator.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/validation/field.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/validation/index.d.ts +0 -0
- /package/dist/types/{src/runtime → runtime}/values.d.ts +0 -0
- /package/dist/types/{src/schema → schema}/ids.d.ts +0 -0
- /package/dist/types/{src/schema → schema}/onehot-display.d.ts +0 -0
- /package/dist/types/{src/schema → schema}/report-context.d.ts +0 -0
- /package/dist/types/{src/schema → schema}/report-fetch-request.d.ts +0 -0
- /package/dist/types/{src/schema → schema}/types/form.d.ts +0 -0
- /package/dist/types/{src/schema → schema}/types/registry.d.ts +0 -0
- /package/dist/types/{src/transport → transport}/errors.d.ts +0 -0
- /package/dist/types/{src/transport → transport}/fanout.d.ts +0 -0
- /package/dist/types/{src/transport → transport}/index.d.ts +0 -0
- /package/dist/types/{src/transport → transport}/request-runner.d.ts +0 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { b as e, d as t, h as n } from "./schema-C34LJ8aV.js";
|
|
2
|
+
import * as r from "zod";
|
|
3
|
+
//#region src/builtins/constants.ts
|
|
4
|
+
var i = {
|
|
5
|
+
classifier: "classifier",
|
|
6
|
+
regressor: "regressor"
|
|
7
|
+
}, a = {
|
|
8
|
+
text: "text",
|
|
9
|
+
number: "number",
|
|
10
|
+
boolean: "boolean",
|
|
11
|
+
category: "category",
|
|
12
|
+
oneHotCategory: "onehot-category",
|
|
13
|
+
date: "date",
|
|
14
|
+
series: "series",
|
|
15
|
+
longText: "long-text",
|
|
16
|
+
singleChoice: "single-choice",
|
|
17
|
+
multiChoice: "multi-choice",
|
|
18
|
+
rating: "rating"
|
|
19
|
+
}, ee = {
|
|
20
|
+
classifier: "Classifier report",
|
|
21
|
+
regressor: "Regressor report"
|
|
22
|
+
}, o = {
|
|
23
|
+
unknownPrediction: "Unknown",
|
|
24
|
+
classifierClassLabel: (e) => `Class ${e + 1}`
|
|
25
|
+
}, s = {
|
|
26
|
+
invalidNumber: "Value must be a valid number.",
|
|
27
|
+
textPatternMismatch: "Value does not match the expected pattern.",
|
|
28
|
+
categoryOptionMismatch: "Value must match one of the available options.",
|
|
29
|
+
invalidTextLengthRange: "Minimum length cannot exceed maximum length.",
|
|
30
|
+
invalidNumericRange: "Minimum value cannot exceed maximum value.",
|
|
31
|
+
invalidDateRange: "Minimum date cannot be after maximum date.",
|
|
32
|
+
invalidPointCountRange: "Minimum number of points cannot exceed maximum number of points.",
|
|
33
|
+
minLength: (e) => `Minimum length is ${e} characters.`,
|
|
34
|
+
maxLength: (e) => `Maximum length is ${e} characters.`,
|
|
35
|
+
minValue: (e) => `Minimum value is ${e}.`,
|
|
36
|
+
maxValue: (e) => `Maximum value is ${e}.`,
|
|
37
|
+
stepValue: (e) => `Value must be a multiple of ${e}.`,
|
|
38
|
+
dateOnOrAfter: (e) => `Date must be on or after ${e}.`,
|
|
39
|
+
dateOnOrBefore: (e) => `Date must be on or before ${e}.`,
|
|
40
|
+
stepDate: (e) => `Date must fall on a step of ${e} day(s) from the minimum date.`,
|
|
41
|
+
minPoints: (e) => `Minimum number of points is ${e}.`,
|
|
42
|
+
maxPoints: (e) => `Maximum number of points is ${e}.`,
|
|
43
|
+
timestampsUnique: "Timestamps must be unique.",
|
|
44
|
+
timestampsAscending: "Timestamps must be sorted in ascending order.",
|
|
45
|
+
timestampsDescending: "Timestamps must be sorted in descending order."
|
|
46
|
+
}, c = r.record(r.string(), r.unknown()).optional(), l = r.union([r.string().min(1), r.number().int().nonnegative()]), u = r.union([l, r.record(r.string().min(1), l.nullish())]).optional(), d = r.custom((e) => typeof e == "function"), f = r.enum([
|
|
47
|
+
"idle",
|
|
48
|
+
"editing",
|
|
49
|
+
"validating",
|
|
50
|
+
"submitting",
|
|
51
|
+
"success",
|
|
52
|
+
"error"
|
|
53
|
+
]), p = r.lazy(() => r.union([
|
|
54
|
+
r.object({
|
|
55
|
+
kind: r.literal("field-value"),
|
|
56
|
+
field: r.string().min(1),
|
|
57
|
+
equals: r.unknown().optional(),
|
|
58
|
+
notEquals: r.unknown().optional(),
|
|
59
|
+
greaterThan: r.unknown().optional(),
|
|
60
|
+
greaterThanOrEqual: r.unknown().optional(),
|
|
61
|
+
lessThan: r.unknown().optional(),
|
|
62
|
+
lessThanOrEqual: r.unknown().optional(),
|
|
63
|
+
in: r.array(r.unknown()).optional(),
|
|
64
|
+
notIn: r.array(r.unknown()).optional(),
|
|
65
|
+
empty: r.boolean().optional(),
|
|
66
|
+
notEmpty: r.boolean().optional(),
|
|
67
|
+
truthy: r.boolean().optional(),
|
|
68
|
+
falsy: r.boolean().optional()
|
|
69
|
+
}),
|
|
70
|
+
r.object({
|
|
71
|
+
kind: r.literal("field-comparison"),
|
|
72
|
+
field: r.string().min(1),
|
|
73
|
+
otherField: r.string().min(1),
|
|
74
|
+
operator: r.enum([
|
|
75
|
+
"eq",
|
|
76
|
+
"neq",
|
|
77
|
+
"gt",
|
|
78
|
+
"gte",
|
|
79
|
+
"lt",
|
|
80
|
+
"lte"
|
|
81
|
+
])
|
|
82
|
+
}),
|
|
83
|
+
r.object({
|
|
84
|
+
kind: r.literal("form-status"),
|
|
85
|
+
equals: r.union([f, r.array(f).min(1)])
|
|
86
|
+
}),
|
|
87
|
+
r.object({
|
|
88
|
+
kind: r.literal("submit-count"),
|
|
89
|
+
eq: r.number().int().nonnegative().optional(),
|
|
90
|
+
gte: r.number().int().nonnegative().optional(),
|
|
91
|
+
lte: r.number().int().nonnegative().optional()
|
|
92
|
+
}),
|
|
93
|
+
r.object({
|
|
94
|
+
kind: r.literal("all"),
|
|
95
|
+
conditions: r.array(p).min(1)
|
|
96
|
+
}),
|
|
97
|
+
r.object({
|
|
98
|
+
kind: r.literal("any"),
|
|
99
|
+
conditions: r.array(p).min(1)
|
|
100
|
+
}),
|
|
101
|
+
r.object({
|
|
102
|
+
kind: r.literal("not"),
|
|
103
|
+
condition: p
|
|
104
|
+
})
|
|
105
|
+
])), m = r.union([d, p]), h = {
|
|
106
|
+
id: r.string().optional(),
|
|
107
|
+
label: r.string().min(1),
|
|
108
|
+
description: r.string().optional(),
|
|
109
|
+
showDescriptionInline: r.boolean().optional().default(!1),
|
|
110
|
+
required: r.boolean().optional().default(!1),
|
|
111
|
+
disabled: r.boolean().optional().default(!1),
|
|
112
|
+
hidden: r.boolean().optional().default(!1),
|
|
113
|
+
readOnly: r.boolean().optional().default(!1),
|
|
114
|
+
disabledWhen: m.optional(),
|
|
115
|
+
hiddenWhen: m.optional(),
|
|
116
|
+
readOnlyWhen: m.optional(),
|
|
117
|
+
asyncValidationDebounceMs: r.number().int().nonnegative().optional(),
|
|
118
|
+
inactiveFieldPolicy: r.enum([
|
|
119
|
+
"include",
|
|
120
|
+
"omit",
|
|
121
|
+
"reset-on-hide"
|
|
122
|
+
]).optional(),
|
|
123
|
+
includeInSubmission: r.boolean().optional(),
|
|
124
|
+
displayKey: r.string().min(1).optional(),
|
|
125
|
+
mappedTo: u,
|
|
126
|
+
valuePath: r.union([r.string().min(1), r.array(r.string().min(1)).min(1)]).optional(),
|
|
127
|
+
defaultValue: r.unknown().optional(),
|
|
128
|
+
ui: c
|
|
129
|
+
}, g = {
|
|
130
|
+
id: r.string().optional(),
|
|
131
|
+
label: r.string().optional(),
|
|
132
|
+
description: r.string().optional(),
|
|
133
|
+
mappedTo: u,
|
|
134
|
+
ui: c
|
|
135
|
+
}, _ = r.union([r.string(), r.object({
|
|
136
|
+
label: r.string(),
|
|
137
|
+
value: r.string()
|
|
138
|
+
})]), v = {
|
|
139
|
+
kind: "boolean",
|
|
140
|
+
schema: r.object({
|
|
141
|
+
kind: r.literal("boolean"),
|
|
142
|
+
...h,
|
|
143
|
+
trueLabel: r.string().optional(),
|
|
144
|
+
falseLabel: r.string().optional()
|
|
145
|
+
}),
|
|
146
|
+
getDefaultValue(e) {
|
|
147
|
+
return typeof e.defaultValue == "boolean" ? e.defaultValue : null;
|
|
148
|
+
},
|
|
149
|
+
normalizeValue(e) {
|
|
150
|
+
return e == null || e === "" ? null : e === !0 || e === "true" ? !0 : e === !1 || e === "false" ? !1 : !!e;
|
|
151
|
+
}
|
|
152
|
+
}, y = {
|
|
153
|
+
kind: "category",
|
|
154
|
+
schema: r.object({
|
|
155
|
+
kind: r.literal("category"),
|
|
156
|
+
...h,
|
|
157
|
+
options: r.array(_).min(1)
|
|
158
|
+
}),
|
|
159
|
+
getDefaultValue(e) {
|
|
160
|
+
return typeof e.defaultValue == "string" ? e.defaultValue : null;
|
|
161
|
+
},
|
|
162
|
+
normalizeValue(e) {
|
|
163
|
+
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
164
|
+
},
|
|
165
|
+
validate(e, t) {
|
|
166
|
+
return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [s.categoryOptionMismatch];
|
|
167
|
+
}
|
|
168
|
+
}, b = r.object({
|
|
169
|
+
label: r.string(),
|
|
170
|
+
value: r.string(),
|
|
171
|
+
mapping: r.record(r.string(), r.unknown())
|
|
172
|
+
}), x = {
|
|
173
|
+
kind: "mapped-category",
|
|
174
|
+
schema: r.object({
|
|
175
|
+
kind: r.literal("mapped-category"),
|
|
176
|
+
...h,
|
|
177
|
+
includeInSubmission: r.boolean().optional().default(!1),
|
|
178
|
+
options: r.array(b).min(1)
|
|
179
|
+
}),
|
|
180
|
+
getDefaultValue(e) {
|
|
181
|
+
return typeof e.defaultValue == "string" ? e.defaultValue : null;
|
|
182
|
+
},
|
|
183
|
+
normalizeValue(e) {
|
|
184
|
+
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
185
|
+
},
|
|
186
|
+
validate(e, t) {
|
|
187
|
+
return e === null || t.options.map((e) => e.value).includes(e) ? [] : [s.categoryOptionMismatch];
|
|
188
|
+
}
|
|
189
|
+
}, S = r.object({
|
|
190
|
+
label: r.string(),
|
|
191
|
+
value: r.string(),
|
|
192
|
+
mappedTo: u.unwrap()
|
|
193
|
+
}), C = {
|
|
194
|
+
kind: "onehot-category",
|
|
195
|
+
schema: r.object({
|
|
196
|
+
kind: r.literal("onehot-category"),
|
|
197
|
+
...h,
|
|
198
|
+
includeInSubmission: r.boolean().optional().default(!0),
|
|
199
|
+
options: r.array(S).min(1)
|
|
200
|
+
}),
|
|
201
|
+
getDefaultValue(e) {
|
|
202
|
+
return typeof e.defaultValue == "string" ? e.defaultValue : null;
|
|
203
|
+
},
|
|
204
|
+
normalizeValue(e) {
|
|
205
|
+
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
206
|
+
},
|
|
207
|
+
validate(e, t) {
|
|
208
|
+
return e === null || t.options.some((t) => t.value === e) ? [] : [s.categoryOptionMismatch];
|
|
209
|
+
}
|
|
210
|
+
}, w = (e) => typeof e == "object" && !!e && !Array.isArray(e), T = (e) => {
|
|
211
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
|
|
212
|
+
if (typeof e == "string" || typeof e == "number") {
|
|
213
|
+
let t = new Date(e);
|
|
214
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
}, E = {
|
|
218
|
+
kind: "date",
|
|
219
|
+
schema: r.object({
|
|
220
|
+
kind: r.literal("date"),
|
|
221
|
+
...h,
|
|
222
|
+
min: r.string().optional(),
|
|
223
|
+
max: r.string().optional(),
|
|
224
|
+
step: r.number().positive().optional()
|
|
225
|
+
}),
|
|
226
|
+
getDefaultValue(e) {
|
|
227
|
+
return T(e.defaultValue) ?? null;
|
|
228
|
+
},
|
|
229
|
+
normalizeValue(e) {
|
|
230
|
+
return T(e);
|
|
231
|
+
},
|
|
232
|
+
serializeValue(e) {
|
|
233
|
+
return e instanceof Date ? e.toISOString() : e;
|
|
234
|
+
},
|
|
235
|
+
validate(e, t) {
|
|
236
|
+
let n = [], r = T(t.min), i = T(t.max);
|
|
237
|
+
if (r && i && r.getTime() > i.getTime() && n.push(s.invalidDateRange), e === null) return n;
|
|
238
|
+
if (r && e.getTime() < r.getTime() && n.push(s.dateOnOrAfter(String(t.min))), i && e.getTime() > i.getTime() && n.push(s.dateOnOrBefore(String(t.max))), t.step !== void 0) {
|
|
239
|
+
let i = r ?? /* @__PURE__ */ new Date("1970-01-01T00:00:00Z");
|
|
240
|
+
Math.round(Math.abs(e.getTime() - i.getTime()) / 864e5) % t.step !== 0 && n.push(s.stepDate(t.step));
|
|
241
|
+
}
|
|
242
|
+
return n;
|
|
243
|
+
}
|
|
244
|
+
}, D = {
|
|
245
|
+
kind: "long-text",
|
|
246
|
+
schema: r.object({
|
|
247
|
+
kind: r.literal("long-text"),
|
|
248
|
+
...h,
|
|
249
|
+
placeholder: r.string().optional(),
|
|
250
|
+
minLength: r.number().int().nonnegative().optional(),
|
|
251
|
+
maxLength: r.number().int().nonnegative().optional(),
|
|
252
|
+
rows: r.number().int().positive().optional()
|
|
253
|
+
}),
|
|
254
|
+
getDefaultValue(e) {
|
|
255
|
+
return typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
256
|
+
},
|
|
257
|
+
normalizeValue(e) {
|
|
258
|
+
return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : "";
|
|
259
|
+
},
|
|
260
|
+
validate(e, t) {
|
|
261
|
+
let n = [];
|
|
262
|
+
return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(s.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(s.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(s.maxLength(t.maxLength)), n);
|
|
263
|
+
}
|
|
264
|
+
}, O = {
|
|
265
|
+
kind: "multi-choice",
|
|
266
|
+
schema: r.object({
|
|
267
|
+
kind: r.literal("multi-choice"),
|
|
268
|
+
...h,
|
|
269
|
+
options: r.array(_).min(1),
|
|
270
|
+
layout: r.enum(["horizontal", "vertical"]).optional()
|
|
271
|
+
}),
|
|
272
|
+
getDefaultValue(e) {
|
|
273
|
+
return Array.isArray(e.defaultValue) ? e.defaultValue.filter((e) => typeof e == "string").map(String) : [];
|
|
274
|
+
},
|
|
275
|
+
normalizeValue(e) {
|
|
276
|
+
return Array.isArray(e) ? e.filter((e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint").map(String) : [];
|
|
277
|
+
},
|
|
278
|
+
cloneValue(e) {
|
|
279
|
+
return [...e];
|
|
280
|
+
},
|
|
281
|
+
isEqual(e, t) {
|
|
282
|
+
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
283
|
+
},
|
|
284
|
+
validate(e, t) {
|
|
285
|
+
if (e.length === 0) return [];
|
|
286
|
+
let n = t.options.map((e) => typeof e == "string" ? e : e.value);
|
|
287
|
+
return e.filter((e) => !n.includes(e)).length > 0 ? [s.categoryOptionMismatch] : [];
|
|
288
|
+
}
|
|
289
|
+
}, k = {
|
|
290
|
+
kind: "number",
|
|
291
|
+
schema: r.object({
|
|
292
|
+
kind: r.literal("number"),
|
|
293
|
+
...h,
|
|
294
|
+
min: r.number().optional(),
|
|
295
|
+
max: r.number().optional(),
|
|
296
|
+
step: r.number().positive().optional(),
|
|
297
|
+
unit: r.string().optional(),
|
|
298
|
+
placeholder: r.string().optional()
|
|
299
|
+
}),
|
|
300
|
+
getDefaultValue(e) {
|
|
301
|
+
return typeof e.defaultValue == "number" ? e.defaultValue : null;
|
|
302
|
+
},
|
|
303
|
+
normalizeValue(e) {
|
|
304
|
+
if (e == null || e === "") return null;
|
|
305
|
+
if (typeof e == "number") return Number.isNaN(e) ? null : e;
|
|
306
|
+
if (typeof e == "string") {
|
|
307
|
+
let t = e.trim();
|
|
308
|
+
if (t.length === 0) return null;
|
|
309
|
+
let n = Number(t);
|
|
310
|
+
return Number.isNaN(n) ? e : n;
|
|
311
|
+
}
|
|
312
|
+
let t = Number(e);
|
|
313
|
+
return Number.isNaN(t) ? null : t;
|
|
314
|
+
},
|
|
315
|
+
validate(e, t) {
|
|
316
|
+
let n = [];
|
|
317
|
+
if (t.min !== void 0 && t.max !== void 0 && t.min > t.max && n.push(s.invalidNumericRange), e === null) return n;
|
|
318
|
+
if (typeof e != "number") return n.push(s.invalidNumber), n;
|
|
319
|
+
if (t.min !== void 0 && e < t.min && n.push(s.minValue(t.min)), t.max !== void 0 && e > t.max && n.push(s.maxValue(t.max)), t.step !== void 0) {
|
|
320
|
+
let r = t.min ?? 0, i = Math.abs(e - r) % t.step, a = t.step * 1e-9;
|
|
321
|
+
i > a && Math.abs(i - t.step) > a && n.push(s.stepValue(t.step));
|
|
322
|
+
}
|
|
323
|
+
return n;
|
|
324
|
+
}
|
|
325
|
+
}, A = {
|
|
326
|
+
kind: "rating",
|
|
327
|
+
schema: r.object({
|
|
328
|
+
kind: r.literal("rating"),
|
|
329
|
+
...h,
|
|
330
|
+
min: r.number().int().optional(),
|
|
331
|
+
max: r.number().int().min(1),
|
|
332
|
+
step: r.number().int().positive().optional()
|
|
333
|
+
}),
|
|
334
|
+
getDefaultValue(e) {
|
|
335
|
+
return typeof e.defaultValue == "number" ? e.defaultValue : null;
|
|
336
|
+
},
|
|
337
|
+
normalizeValue(e) {
|
|
338
|
+
if (e == null) return null;
|
|
339
|
+
let t = typeof e == "number" ? e : Number(e);
|
|
340
|
+
return Number.isNaN(t) ? null : t;
|
|
341
|
+
},
|
|
342
|
+
validate(e, t) {
|
|
343
|
+
if (e === null) return [];
|
|
344
|
+
let n = [], r = t.min ?? 1, i = t.max;
|
|
345
|
+
return r > i ? (n.push(s.invalidNumericRange), n) : (e < r && n.push(s.minValue(r)), e > i && n.push(s.maxValue(i)), n);
|
|
346
|
+
}
|
|
347
|
+
}, j = {
|
|
348
|
+
kind: "text",
|
|
349
|
+
schema: r.object({
|
|
350
|
+
kind: r.literal("text"),
|
|
351
|
+
...h,
|
|
352
|
+
placeholder: r.string().optional(),
|
|
353
|
+
minLength: r.number().int().nonnegative().optional(),
|
|
354
|
+
maxLength: r.number().int().nonnegative().optional(),
|
|
355
|
+
pattern: r.string().optional()
|
|
356
|
+
}),
|
|
357
|
+
getDefaultValue(e) {
|
|
358
|
+
return typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
359
|
+
},
|
|
360
|
+
normalizeValue(e) {
|
|
361
|
+
return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : "";
|
|
362
|
+
},
|
|
363
|
+
validate(e, t) {
|
|
364
|
+
let n = [];
|
|
365
|
+
return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(s.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(s.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(s.maxLength(t.maxLength)), t.pattern && !new RegExp(t.pattern).test(e) && n.push(s.textPatternMismatch), n);
|
|
366
|
+
}
|
|
367
|
+
}, M = r.object({
|
|
368
|
+
kind: r.string().min(1),
|
|
369
|
+
label: r.string().min(1),
|
|
370
|
+
required: r.boolean().optional()
|
|
371
|
+
}).passthrough(), N = r.object({
|
|
372
|
+
kind: r.literal("series"),
|
|
373
|
+
...h,
|
|
374
|
+
field1: M,
|
|
375
|
+
field2: M,
|
|
376
|
+
minPoints: r.number().int().nonnegative().optional(),
|
|
377
|
+
maxPoints: r.number().int().nonnegative().optional()
|
|
378
|
+
}), P = "This field is required.", F = (e) => e.toISOString().slice(0, 10), I = {
|
|
379
|
+
text: j,
|
|
380
|
+
number: k,
|
|
381
|
+
date: E,
|
|
382
|
+
category: y
|
|
383
|
+
}, L = (e) => I[e], R = (e) => {
|
|
384
|
+
if (e == null || e === "") return null;
|
|
385
|
+
if (typeof e == "boolean") return e;
|
|
386
|
+
if (typeof e == "string") {
|
|
387
|
+
if (e === "true") return !0;
|
|
388
|
+
if (e === "false") return !1;
|
|
389
|
+
}
|
|
390
|
+
return !!e;
|
|
391
|
+
}, z = (e, t) => {
|
|
392
|
+
if (e.kind === v.kind) return R(t);
|
|
393
|
+
let n = L(e.kind);
|
|
394
|
+
return n?.normalizeValue ? n.normalizeValue(t, e) : t;
|
|
395
|
+
}, B = (e, t) => {
|
|
396
|
+
if (t == null) return null;
|
|
397
|
+
if (e.kind === "date" && t instanceof Date) return F(t);
|
|
398
|
+
let n = L(e.kind);
|
|
399
|
+
return n?.serializeValue ? n.serializeValue(t, e) : t;
|
|
400
|
+
}, te = (e, t) => t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : e.kind === v.kind && t == null, V = (e, t) => {
|
|
401
|
+
if (e.required && te(e, t)) return [P];
|
|
402
|
+
if (e.kind === v.kind) {
|
|
403
|
+
if (t === null) return [];
|
|
404
|
+
let n = v.validate?.(t, e, {
|
|
405
|
+
field: {
|
|
406
|
+
...e,
|
|
407
|
+
id: e.label
|
|
408
|
+
},
|
|
409
|
+
values: {},
|
|
410
|
+
submitCount: 0,
|
|
411
|
+
validationVersion: 0,
|
|
412
|
+
signal: void 0
|
|
413
|
+
});
|
|
414
|
+
return Array.isArray(n) ? n : [];
|
|
415
|
+
}
|
|
416
|
+
let n = L(e.kind);
|
|
417
|
+
if (!n?.validate) return [];
|
|
418
|
+
let r = n.validate(t, e, {
|
|
419
|
+
field: {
|
|
420
|
+
...e,
|
|
421
|
+
id: e.label
|
|
422
|
+
},
|
|
423
|
+
values: {},
|
|
424
|
+
submitCount: 0,
|
|
425
|
+
validationVersion: 0,
|
|
426
|
+
signal: void 0
|
|
427
|
+
});
|
|
428
|
+
return Array.isArray(r) ? r : [];
|
|
429
|
+
}, H = (e, t, n) => n.map((n) => `Row ${e + 1} (${t}): ${n}`), U = (e) => {
|
|
430
|
+
if (Array.isArray(e)) return e.length >= 2 ? {
|
|
431
|
+
field1: e[0],
|
|
432
|
+
field2: e[1]
|
|
433
|
+
} : null;
|
|
434
|
+
if (!w(e)) return null;
|
|
435
|
+
if ("field1" in e || "field2" in e) return {
|
|
436
|
+
field1: e.field1,
|
|
437
|
+
field2: e.field2
|
|
438
|
+
};
|
|
439
|
+
let t = Object.entries(e);
|
|
440
|
+
return t.length < 2 ? null : {
|
|
441
|
+
field1: t[0]?.[1],
|
|
442
|
+
field2: t[1]?.[1]
|
|
443
|
+
};
|
|
444
|
+
}, W = (e, t) => {
|
|
445
|
+
let n = U(e);
|
|
446
|
+
return n ? {
|
|
447
|
+
field1: z(t.field1, n.field1),
|
|
448
|
+
field2: z(t.field2, n.field2)
|
|
449
|
+
} : null;
|
|
450
|
+
}, G = (e, t) => {
|
|
451
|
+
let n = /* @__PURE__ */ new Set();
|
|
452
|
+
return t.minPoints !== void 0 && t.maxPoints !== void 0 && t.minPoints > t.maxPoints && n.add(s.invalidPointCountRange), t.minPoints !== void 0 && e.length < t.minPoints && n.add(s.minPoints(t.minPoints)), t.maxPoints !== void 0 && e.length > t.maxPoints && n.add(s.maxPoints(t.maxPoints)), n;
|
|
453
|
+
}, K = {
|
|
454
|
+
kind: "series",
|
|
455
|
+
schema: N,
|
|
456
|
+
getDefaultValue(e) {
|
|
457
|
+
return Array.isArray(e.defaultValue) ? e.defaultValue.map((t) => W(t, e)).filter((e) => e !== null) : [];
|
|
458
|
+
},
|
|
459
|
+
normalizeValue(e, t) {
|
|
460
|
+
return Array.isArray(e) ? e.map((e) => W(e, t)).filter((e) => e !== null) : [];
|
|
461
|
+
},
|
|
462
|
+
serializeValue(e, t) {
|
|
463
|
+
return e.map((e) => ({
|
|
464
|
+
field1: B(t.field1, e.field1),
|
|
465
|
+
field2: B(t.field2, e.field2)
|
|
466
|
+
}));
|
|
467
|
+
},
|
|
468
|
+
validate(e, t) {
|
|
469
|
+
let n = G(e, t);
|
|
470
|
+
return e.forEach((e, r) => {
|
|
471
|
+
for (let i of H(r, t.field1.label, V(t.field1, e.field1))) n.add(i);
|
|
472
|
+
for (let i of H(r, t.field2.label, V(t.field2, e.field2))) n.add(i);
|
|
473
|
+
}), [...n];
|
|
474
|
+
}
|
|
475
|
+
}, q = {
|
|
476
|
+
kind: "single-choice",
|
|
477
|
+
schema: r.object({
|
|
478
|
+
kind: r.literal("single-choice"),
|
|
479
|
+
...h,
|
|
480
|
+
options: r.array(_).min(1),
|
|
481
|
+
layout: r.enum(["horizontal", "vertical"]).optional()
|
|
482
|
+
}),
|
|
483
|
+
getDefaultValue(e) {
|
|
484
|
+
return typeof e.defaultValue == "string" ? e.defaultValue : null;
|
|
485
|
+
},
|
|
486
|
+
normalizeValue(e) {
|
|
487
|
+
return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
|
|
488
|
+
},
|
|
489
|
+
validate(e, t) {
|
|
490
|
+
return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [s.categoryOptionMismatch];
|
|
491
|
+
}
|
|
492
|
+
}, J = {
|
|
493
|
+
kind: "classifier",
|
|
494
|
+
schema: r.object({
|
|
495
|
+
kind: r.literal("classifier"),
|
|
496
|
+
...g,
|
|
497
|
+
labels: r.array(r.string()).optional(),
|
|
498
|
+
showClassProbabilities: r.boolean().optional().default(!0)
|
|
499
|
+
}),
|
|
500
|
+
resolvePayload(e, t) {
|
|
501
|
+
return n(t.report, t.result);
|
|
502
|
+
}
|
|
503
|
+
}, Y = {
|
|
504
|
+
kind: "regressor",
|
|
505
|
+
schema: r.object({
|
|
506
|
+
kind: r.literal("regressor"),
|
|
507
|
+
...g,
|
|
508
|
+
unit: r.string().optional(),
|
|
509
|
+
precision: r.number().int().nonnegative().optional().default(2)
|
|
510
|
+
}),
|
|
511
|
+
resolvePayload(e, t) {
|
|
512
|
+
return n(t.report, t.result);
|
|
513
|
+
}
|
|
514
|
+
}, X = [
|
|
515
|
+
j,
|
|
516
|
+
k,
|
|
517
|
+
v,
|
|
518
|
+
y,
|
|
519
|
+
x,
|
|
520
|
+
C,
|
|
521
|
+
E,
|
|
522
|
+
K,
|
|
523
|
+
D,
|
|
524
|
+
q,
|
|
525
|
+
O,
|
|
526
|
+
A
|
|
527
|
+
], Z = [J, Y], Q = (e) => e.kind === "mapped-category" ? e.config : null, $ = (t, n) => t.getField(n) ?? t.getField(e(n)), ne = async (e, t) => {
|
|
528
|
+
let n = t.getField(e.fieldId);
|
|
529
|
+
if (!n) return;
|
|
530
|
+
let r = Q(n);
|
|
531
|
+
if (!r) return;
|
|
532
|
+
let i = e.values[e.fieldId], a = r.options.find((e) => e.value === i);
|
|
533
|
+
if (a?.mapping) {
|
|
534
|
+
for (let [n, r] of Object.entries(a.mapping)) {
|
|
535
|
+
let i = $(t, n);
|
|
536
|
+
if (!i) throw Error(`mapped-category "${e.fieldId}": target field "${n}" not found in schema.`);
|
|
537
|
+
t.commitDerivedValue(i.id, r);
|
|
538
|
+
}
|
|
539
|
+
t.syncDerivedState();
|
|
540
|
+
}
|
|
541
|
+
}, re = () => ({
|
|
542
|
+
validate(e) {
|
|
543
|
+
for (let t of e.fields) {
|
|
544
|
+
let n = Q(t);
|
|
545
|
+
if (n) {
|
|
546
|
+
for (let r of n.options) for (let n of Object.keys(r.mapping ?? {})) if (!$(e, n)) throw Error(`mapped-category "${t.id}": mapping references unknown field "${n}".`);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
async onValuesChanged(e, t) {
|
|
551
|
+
await ne(e, t);
|
|
552
|
+
}
|
|
553
|
+
}), ie = () => {
|
|
554
|
+
let e = t();
|
|
555
|
+
for (let t of X) e.registerField(t);
|
|
556
|
+
for (let t of Z) e.registerReport(t);
|
|
557
|
+
return e;
|
|
558
|
+
};
|
|
559
|
+
//#endregion
|
|
560
|
+
export { s as C, ee as S, y as _, Y as a, o as b, K as c, k as d, O as f, x as g, C as h, Z as i, j as l, E as m, re as n, J as o, D as p, X as r, q as s, ie as t, A as u, v, i as x, a as y };
|
|
@@ -799,19 +799,19 @@ var e = [
|
|
|
799
799
|
}
|
|
800
800
|
return { tokens: { ...t } };
|
|
801
801
|
}, x = new Set(i), S = /var\(\s*(--mlf-[a-z0-9-]+)\s*[,)]/g, C = (e, t, n) => {
|
|
802
|
-
if (n) for (let r of Object.keys(n))
|
|
802
|
+
if (n) for (let r of Object.keys(n)) r.startsWith("--mlf-") && !x.has(r) && e.push({
|
|
803
803
|
code: "unknown-token-key",
|
|
804
804
|
path: t,
|
|
805
805
|
value: r,
|
|
806
806
|
message: `[mlform] Unknown design-system token "${r}" at ${t}`
|
|
807
807
|
});
|
|
808
808
|
}, w = (e, t, n, r) => {
|
|
809
|
-
if (r) for (let i of Object.keys(r))
|
|
809
|
+
if (r) for (let i of Object.keys(r)) i.startsWith("--mlf-") && x.has(i) && (i.startsWith(`--mlf-${t}-`) || e.push({
|
|
810
810
|
code: "misplaced-component-token",
|
|
811
811
|
path: n,
|
|
812
812
|
value: i,
|
|
813
813
|
message: `[mlform] Token "${i}" does not belong to component "${t}" at ${n}`
|
|
814
|
-
});
|
|
814
|
+
}));
|
|
815
815
|
}, ie = (e, t, n) => {
|
|
816
816
|
if (n) for (let [r, i] of Object.entries(n)) {
|
|
817
817
|
S.lastIndex = 0;
|
|
@@ -835,7 +835,7 @@ var e = [
|
|
|
835
835
|
e.value ?? "",
|
|
836
836
|
e.message
|
|
837
837
|
].join("|");
|
|
838
|
-
return t.has(n)
|
|
838
|
+
return !t.has(n) && (t.add(n), !0);
|
|
839
839
|
});
|
|
840
840
|
}, E = (t, n, r, i) => {
|
|
841
841
|
let a = [];
|
|
@@ -1108,13 +1108,14 @@ var e = [
|
|
|
1108
1108
|
let r = new Map(t.map((e) => [e.from, e.to])), i = { ...e }, a = {};
|
|
1109
1109
|
for (let [o, s] of Object.entries(e)) {
|
|
1110
1110
|
let e = r.get(o) ?? o;
|
|
1111
|
-
if (e in a)
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1111
|
+
if (e in a) {
|
|
1112
|
+
if (n === "source-wins") o !== e && (a[e] = s);
|
|
1113
|
+
else if (n === "target-wins") o === e && (a[e] = s);
|
|
1114
|
+
else {
|
|
1115
|
+
let r = t.find((t) => t.to === e), o = r ? i[r.from] : void 0, c = i[e];
|
|
1116
|
+
a[e] = o !== void 0 && c !== void 0 ? n(o, c, e) : n(a[e], s, e);
|
|
1117
|
+
}
|
|
1118
|
+
} else a[e] = s;
|
|
1118
1119
|
}
|
|
1119
1120
|
return a;
|
|
1120
1121
|
}, F = (e, t) => {
|
|
@@ -1371,7 +1372,7 @@ var e = [
|
|
|
1371
1372
|
signature: B(n.resolved),
|
|
1372
1373
|
envSnapshot: n.envSnapshot
|
|
1373
1374
|
}) : null, Be = (e, t, n, r) => {
|
|
1374
|
-
|
|
1375
|
+
e && !t.has(n) && (t.add(n), e.observe(n, {
|
|
1375
1376
|
attributes: !0,
|
|
1376
1377
|
childList: r,
|
|
1377
1378
|
subtree: !1,
|
package/dist/mlform/builtins.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i 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, x, y as S } from "../builtins-jvAitKUC.js";
|
|
2
|
+
export { b as booleanFieldDefinition, g as builtinFieldDefinitions, S as builtinFieldKinds, u as builtinReportDefinitions, i as builtinReportFallbacks, x as builtinReportKinds, t as builtinReportLabels, e as builtinValidationMessages, n as categoryFieldDefinition, m as classifierReportDefinition, v as createBuiltinMlRegistry, p as createMappedCategoryBehavior, f as dateFieldDefinition, h as longTextFieldDefinition, c as mappedCategoryFieldDefinition, s as multiChoiceFieldDefinition, o as numberFieldDefinition, l as oneHotCategoryFieldDefinition, y as ratingFieldDefinition, r as regressorReportDefinition, a as seriesFieldDefinition, _ as singleChoiceFieldDefinition, d as textFieldDefinition };
|
package/dist/mlform/design.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as v, t as y, u as b, v as x, w as S, x as C, y as w } from "../design-
|
|
1
|
+
import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as v, t as y, u as b, v as x, w as S, x as C, y as w } from "../design-D8zce4Mh.js";
|
|
2
2
|
export { d as DesignSystemController, i as applyResolvedDesignSystem, _ as attachDesignSystem, u as builtinDesignSystemRegistry, C as builtinRecipes, a as builtinThemes, n as componentKeys, S as componentTokenDefaults, l as createBuiltinDesignSystemRegistry, r as createDesignSystemRegistry, m as createDesignSystemStylesheet, v as createResolvedDesignSystemSignature, g as defineComponentTokens, p as defineGlobalTokens, w as defineRecipe, x as defineTheme, o as getResolvedDesignSystemHostAttributes, e as globalTokenDefaults, y as hydrateDesignSystem, s as mergeDesignSystemConfig, f as migrateThemeTokens, b as migrateTokens, t as mlfTokenKeys, c as resolveDesignSystem, h as writeDesignSystemTokenDeclarations };
|