mlform 0.1.23 → 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-BQsOz8iz.js → runtime-B_vnmwya.js} +9 -9
- package/dist/{schema-BI-Ia-h9.js → schema-C34LJ8aV.js} +5 -5
- 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 +2 -1
- package/dist/types/{src/transport → transport}/types.d.ts +1 -1
- package/package.json +27 -20
- package/dist/builtins-rkxD-h7K.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
package/README.md
CHANGED
|
@@ -1,89 +1,75 @@
|
|
|
1
1
|
# MLForm
|
|
2
2
|
|
|
3
|
-
[](LICENSE)
|
|
3
|
+
[](https://github.com/UlloaSP/mlform/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/mlform)
|
|
5
|
+
[](LICENSE)
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
MLForm is a schema-driven form runtime and Web Component kit for machine-learning products. Define inputs and reports once; MLForm handles normalization, validation, backend-facing values, submission state, and result rendering.
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
Use the complete UI from `mlform`, build your own UI on the headless runtime, or adopt the layers between those two points.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
## Why another form library?
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
Most form libraries stop at collecting values. ML interfaces also need to keep model mappings, validation, asynchronous reports, loading states, and result rendering consistent with the backend contract.
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
MLForm exists so every screen does not invent that integration again. The schema stays the source of truth, transports remain replaceable, and rendering is optional. The project is MIT licensed; if its direction stops fitting your product, you can fork it or use only the lower-level packages.
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
- validation rules end up duplicated across components
|
|
20
|
-
- model outputs are rendered ad hoc in each screen
|
|
21
|
-
- design and accessibility regress when teams move fast
|
|
17
|
+
## Installation
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Use it for:
|
|
26
|
-
|
|
27
|
-
- prediction forms
|
|
28
|
-
- scoring and approval tools
|
|
29
|
-
- forecasting dashboards
|
|
30
|
-
- internal review consoles
|
|
31
|
-
- embedded model workflows inside larger apps
|
|
32
|
-
|
|
33
|
-
## Install
|
|
34
|
-
|
|
35
|
-
For application usage:
|
|
19
|
+
> [!NOTE]
|
|
20
|
+
> MLForm is pre-1.0. Public APIs may change between minor releases. Node-based consumers require Node.js 20.19 or newer; contributors need Node.js 24.15 or newer.
|
|
36
21
|
|
|
37
22
|
```bash
|
|
38
23
|
npm install mlform
|
|
39
24
|
```
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import { mountForm } from "mlform/kit";
|
|
45
|
-
import { createJsonTransport } from "mlform/transport";
|
|
46
|
-
```
|
|
26
|
+
## Quick start
|
|
47
27
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Create a host element:
|
|
28
|
+
Add a host element:
|
|
51
29
|
|
|
52
30
|
```html
|
|
53
31
|
<div id="prediction-form"></div>
|
|
54
32
|
```
|
|
55
33
|
|
|
56
|
-
Mount a
|
|
34
|
+
Mount MLForm with a schema and any object implementing the transport contract:
|
|
57
35
|
|
|
58
36
|
```ts
|
|
59
|
-
import { mountForm } from "mlform
|
|
60
|
-
import {
|
|
37
|
+
import { mountForm } from "mlform";
|
|
38
|
+
import type { Transport } from "mlform/transport";
|
|
39
|
+
|
|
40
|
+
const transport: Transport = {
|
|
41
|
+
async submit(request) {
|
|
42
|
+
const response = await fetch("/api/predict", {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: { "content-type": "application/json" },
|
|
45
|
+
body: JSON.stringify({
|
|
46
|
+
inputs: request.modelValues,
|
|
47
|
+
reports: request.reports,
|
|
48
|
+
}),
|
|
49
|
+
signal: request.signal,
|
|
50
|
+
});
|
|
61
51
|
|
|
62
|
-
|
|
52
|
+
if (!response.ok) throw new Error(`Prediction failed: ${response.status}`);
|
|
53
|
+
return response.json();
|
|
54
|
+
},
|
|
55
|
+
};
|
|
63
56
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
57
|
+
const container = document.querySelector<HTMLElement>("#prediction-form");
|
|
58
|
+
if (!container) throw new Error("Missing #prediction-form container.");
|
|
67
59
|
|
|
68
|
-
const mounted = mountForm(container
|
|
69
|
-
transport
|
|
60
|
+
const mounted = mountForm(container, {
|
|
61
|
+
transport,
|
|
70
62
|
schema: {
|
|
71
63
|
fields: [
|
|
72
|
-
{
|
|
73
|
-
id: "prompt",
|
|
74
|
-
kind: "text",
|
|
75
|
-
label: "Prompt",
|
|
76
|
-
required: true,
|
|
77
|
-
minLength: 3,
|
|
78
|
-
},
|
|
64
|
+
{ id: "prompt", kind: "text", label: "Prompt", required: true },
|
|
79
65
|
{
|
|
80
66
|
id: "threshold",
|
|
81
67
|
kind: "number",
|
|
82
68
|
label: "Confidence threshold",
|
|
83
69
|
min: 0,
|
|
84
70
|
max: 1,
|
|
85
|
-
step: 0.05,
|
|
86
71
|
defaultValue: 0.75,
|
|
72
|
+
mappedTo: "threshold",
|
|
87
73
|
},
|
|
88
74
|
],
|
|
89
75
|
reports: [
|
|
@@ -91,225 +77,108 @@ const mounted = mountForm(container as HTMLElement, {
|
|
|
91
77
|
id: "prediction",
|
|
92
78
|
kind: "classifier",
|
|
93
79
|
label: "Prediction",
|
|
80
|
+
mappedTo: "prediction",
|
|
94
81
|
},
|
|
95
82
|
],
|
|
96
83
|
},
|
|
97
|
-
labels: {
|
|
98
|
-
|
|
99
|
-
submitting: "Running...",
|
|
100
|
-
},
|
|
101
|
-
layout: "split",
|
|
102
|
-
designSystem: {
|
|
103
|
-
mode: "auto",
|
|
104
|
-
theme: "cobalt",
|
|
105
|
-
recipe: "soft",
|
|
106
|
-
},
|
|
84
|
+
labels: { submit: "Run prediction" },
|
|
85
|
+
designSystem: { mode: "auto", theme: "cobalt", recipe: "soft" },
|
|
107
86
|
});
|
|
108
87
|
|
|
109
88
|
window.addEventListener("beforeunload", () => mounted.unmount());
|
|
110
89
|
```
|
|
111
90
|
|
|
112
|
-
The
|
|
91
|
+
The backend returns explicit report results:
|
|
113
92
|
|
|
114
93
|
```json
|
|
115
94
|
{
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```json
|
|
126
|
-
{
|
|
127
|
-
"reports": {
|
|
128
|
-
"prediction": {
|
|
129
|
-
"label": "Approved",
|
|
130
|
-
"confidence": 0.91,
|
|
131
|
-
"probabilities": {
|
|
132
|
-
"Approved": 0.91,
|
|
133
|
-
"Rejected": 0.09
|
|
95
|
+
"reports": [
|
|
96
|
+
{
|
|
97
|
+
"backend": "default",
|
|
98
|
+
"mappedTo": "prediction",
|
|
99
|
+
"status": "ready",
|
|
100
|
+
"payload": {
|
|
101
|
+
"prediction": "Approved",
|
|
102
|
+
"labels": ["Approved", "Rejected"],
|
|
103
|
+
"probabilities": [0.91, 0.09]
|
|
134
104
|
}
|
|
135
105
|
}
|
|
136
|
-
|
|
137
|
-
"meta": {
|
|
138
|
-
"model": "credit-risk-v2"
|
|
139
|
-
}
|
|
106
|
+
],
|
|
107
|
+
"meta": { "model": "credit-risk-v2" }
|
|
140
108
|
}
|
|
141
109
|
```
|
|
142
110
|
|
|
143
|
-
##
|
|
144
|
-
|
|
145
|
-
- Schema-driven fields, reports, conditions, defaults, and serialization
|
|
146
|
-
- Accessible Web Components for form inputs, submit actions, and result rendering
|
|
147
|
-
- Headless `createFormView()` API for custom layouts and app-owned rendering
|
|
148
|
-
- Official `mountForm()` helper for step-based flows
|
|
149
|
-
- Built-in JSON transport plus composable transport middleware
|
|
150
|
-
- Headless engine APIs for custom orchestration and registries
|
|
151
|
-
- Runtime design system with themes, recipes, density, motion, and token overrides
|
|
152
|
-
- Extension points for custom field and report kinds
|
|
153
|
-
|
|
154
|
-
Built-in fields:
|
|
155
|
-
|
|
156
|
-
- `text`
|
|
157
|
-
- `number`
|
|
158
|
-
- `boolean`
|
|
159
|
-
- `category`
|
|
160
|
-
- `date`
|
|
161
|
-
- `time-series`
|
|
162
|
-
|
|
163
|
-
Built-in reports:
|
|
111
|
+
## Choose your level
|
|
164
112
|
|
|
165
|
-
|
|
166
|
-
|
|
113
|
+
| Package | Purpose |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `mlform` | Application-facing alias of `mlform/kit`. |
|
|
116
|
+
| `mlform/kit` | Mounting, layouts, navigation, lifecycle, and declarative extensions. |
|
|
117
|
+
| `mlform/runtime` | Headless state, validation, conditions, hooks, and submission orchestration. |
|
|
118
|
+
| `mlform/schema` | Schema contracts, normalization, mappings, and registries. |
|
|
119
|
+
| `mlform/builtins` | Headless definitions for included field and report kinds. |
|
|
120
|
+
| `mlform/transport` | Transport contracts, request execution, errors, and fanout. |
|
|
121
|
+
| `mlform/primitives` | Web Component renderers and renderer registries. |
|
|
122
|
+
| `mlform/design` | Themes, recipes, tokens, density, motion, and host integration. |
|
|
167
123
|
|
|
168
|
-
|
|
124
|
+
## What is included?
|
|
169
125
|
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
126
|
+
- Accessible built-in fields and report renderers
|
|
127
|
+
- Headless runtime and form-view APIs
|
|
128
|
+
- Single-page, split, tabs, accordion, and wizard layouts
|
|
129
|
+
- Explicit display-value and model-value boundaries
|
|
130
|
+
- Custom field and report kinds through the normal registration path
|
|
131
|
+
- Themes, recipes, design tokens, forced-colors support, and host integration
|
|
132
|
+
- Replaceable transports for HTTP, local models, workers, or application-owned clients
|
|
175
133
|
|
|
176
|
-
|
|
134
|
+
## Some notes
|
|
177
135
|
|
|
178
|
-
|
|
179
|
-
- `minimal`
|
|
180
|
-
- `soft`
|
|
181
|
-
- `contrast`
|
|
136
|
+
MLForm is young. Expect the API to become smaller and more explicit before 1.0.
|
|
182
137
|
|
|
183
|
-
|
|
138
|
+
MLForm does not host models, prescribe a backend framework, or require its built-in UI. It owns the form contract and lifecycle; your application owns transport, authentication, deployment, and model execution.
|
|
184
139
|
|
|
185
|
-
|
|
186
|
-
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
-
| `mlform/kit` | Explicit kit entrypoint with `mountForm`, `createFormView`, labels, layout, and lifecycle utilities. |
|
|
188
|
-
| `mlform/runtime` | Headless state, validation, registries, hooks, conditions, and submission orchestration. |
|
|
189
|
-
| `mlform/primitives` | Web Component renderers and custom renderer registries. |
|
|
190
|
-
| `mlform/design` | Themes, recipes, tokens, mode resolution, and host integration. |
|
|
191
|
-
| `mlform/transport` | Transport composition, middleware, resilience policies, and orchestration helpers. |
|
|
140
|
+
## Documentation
|
|
192
141
|
|
|
193
|
-
|
|
142
|
+
Full documentation lives at [ulloasp.github.io/mlform](https://ulloasp.github.io/mlform/).
|
|
194
143
|
|
|
195
|
-
|
|
144
|
+
- [Installation](https://ulloasp.github.io/mlform/getting-started/installation/)
|
|
145
|
+
- [Quick start](https://ulloasp.github.io/mlform/getting-started/quick-start/)
|
|
146
|
+
- [Backend contract](https://ulloasp.github.io/mlform/guides/backend-contract/)
|
|
147
|
+
- [Headless kit](https://ulloasp.github.io/mlform/kit/headless-kit/)
|
|
148
|
+
- [Design system](https://ulloasp.github.io/mlform/design/overview/)
|
|
149
|
+
- [Package exports](https://ulloasp.github.io/mlform/reference/package-exports/)
|
|
196
150
|
|
|
197
|
-
|
|
198
|
-
import { createMlRegistryPack } from "mlform/builtins";
|
|
199
|
-
import { defineFieldKind, registerDefinedFieldKind } from "mlform/kit";
|
|
200
|
-
import { z } from "zod";
|
|
201
|
-
|
|
202
|
-
const pack = createMlRegistryPack();
|
|
203
|
-
|
|
204
|
-
registerDefinedFieldKind(
|
|
205
|
-
pack.registry,
|
|
206
|
-
pack.descriptorRegistry,
|
|
207
|
-
defineFieldKind({
|
|
208
|
-
kind: "score",
|
|
209
|
-
schema: z.object({
|
|
210
|
-
kind: z.literal("score"),
|
|
211
|
-
id: z.string().optional(),
|
|
212
|
-
label: z.string(),
|
|
213
|
-
min: z.number().default(0),
|
|
214
|
-
max: z.number().default(100),
|
|
215
|
-
}),
|
|
216
|
-
value: {
|
|
217
|
-
default: () => 0,
|
|
218
|
-
normalize: (value) => Number(value ?? 0),
|
|
219
|
-
serialize: (value) => value,
|
|
220
|
-
},
|
|
221
|
-
validate: ({ value, config }) =>
|
|
222
|
-
value < config.min || value > config.max ? ["Score out of range."] : [],
|
|
223
|
-
render: {
|
|
224
|
-
widget: "number",
|
|
225
|
-
hints: ({ config }) => ({
|
|
226
|
-
min: config.min,
|
|
227
|
-
max: config.max,
|
|
228
|
-
unit: "%",
|
|
229
|
-
}),
|
|
230
|
-
},
|
|
231
|
-
}),
|
|
232
|
-
);
|
|
233
|
-
```
|
|
151
|
+
The current architecture is available as an [interactive diagram](./architecture/mlform-system.architecture.html).
|
|
234
152
|
|
|
235
|
-
|
|
153
|
+
## Contributing
|
|
236
154
|
|
|
237
|
-
|
|
155
|
+
MLForm uses [Vite+](https://viteplus.dev/guide/) for dependency management, checks, tests, and builds.
|
|
238
156
|
|
|
239
|
-
|
|
240
|
-
2. Mount the form with `mountForm`.
|
|
241
|
-
3. Point the transport at your model endpoint or custom backend adapter.
|
|
242
|
-
4. Return normalized reports from the backend.
|
|
243
|
-
5. Customize theme, recipe, labels, or registries only where your product needs it.
|
|
157
|
+
Install `vp`:
|
|
244
158
|
|
|
245
|
-
|
|
159
|
+
### macOS / Linux
|
|
246
160
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
```ts
|
|
250
|
-
import { createFormView } from "mlform/kit";
|
|
251
|
-
import { createJsonTransport } from "mlform/transport";
|
|
252
|
-
|
|
253
|
-
const view = createFormView({
|
|
254
|
-
transport: createJsonTransport({ endpoint: "/api/predict" }),
|
|
255
|
-
schema,
|
|
256
|
-
layout: {
|
|
257
|
-
kind: "wizard",
|
|
258
|
-
steps: [
|
|
259
|
-
{ title: "Profile", children: [{ kind: "field", field: "name" }] },
|
|
260
|
-
{ title: "Review", children: [{ kind: "field", field: "email" }] },
|
|
261
|
-
],
|
|
262
|
-
},
|
|
263
|
-
});
|
|
161
|
+
```bash
|
|
162
|
+
curl -fsSL https://vite.plus | bash
|
|
264
163
|
```
|
|
265
164
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
## Documentation
|
|
269
|
-
|
|
270
|
-
- Docs home: https://ulloasp.github.io/mlform/
|
|
271
|
-
- Quick start: https://ulloasp.github.io/mlform/getting-started/quick-start/
|
|
272
|
-
- Installation: https://ulloasp.github.io/mlform/getting-started/installation/
|
|
273
|
-
- Backend contract: https://ulloasp.github.io/mlform/guides/backend-contract/
|
|
274
|
-
- Transport guide: https://ulloasp.github.io/mlform/kit/transport/
|
|
275
|
-
- Headless kit: https://ulloasp.github.io/mlform/kit/headless-kit/
|
|
276
|
-
- Wizard layout: https://ulloasp.github.io/mlform/kit/wizard-layout/
|
|
277
|
-
- Design system: https://ulloasp.github.io/mlform/design/overview/
|
|
278
|
-
- API reference: https://ulloasp.github.io/mlform/reference/kit/
|
|
279
|
-
- Migration guide: https://ulloasp.github.io/mlform/migration/from-legacy-mlform/
|
|
280
|
-
- Versioning notes: https://ulloasp.github.io/mlform/support/versioning/
|
|
165
|
+
### Windows
|
|
281
166
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
This repository uses Vite+. Do not use `npm`, `pnpm`, or `yarn` directly for workspace tasks in this repo.
|
|
285
|
-
|
|
286
|
-
Run the main package checks:
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
vp install
|
|
290
|
-
vp check
|
|
291
|
-
vp test
|
|
292
|
-
vp build
|
|
167
|
+
```powershell
|
|
168
|
+
irm https://vite.plus/ps1 | iex
|
|
293
169
|
```
|
|
294
170
|
|
|
295
|
-
|
|
171
|
+
Then install and verify the repository:
|
|
296
172
|
|
|
297
173
|
```bash
|
|
298
|
-
cd docs
|
|
299
174
|
vp install
|
|
175
|
+
vp check
|
|
300
176
|
vp run typecheck
|
|
301
|
-
vp run
|
|
302
|
-
vp
|
|
177
|
+
vp test run
|
|
178
|
+
vp build
|
|
303
179
|
```
|
|
304
180
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
## Release Notes
|
|
308
|
-
|
|
309
|
-
For `0.1.23`, use the repository release entry and the published docs as the source of truth:
|
|
310
|
-
|
|
311
|
-
- GitHub releases: https://github.com/UlloaSP/mlform/releases
|
|
312
|
-
- npm package: https://www.npmjs.com/package/mlform
|
|
181
|
+
Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening an issue or pull request.
|
|
313
182
|
|
|
314
183
|
## License
|
|
315
184
|
|