diff --git a/packages/docs/docs/forms.md b/packages/docs/docs/forms.md index 944234f..47d5dad 100644 --- a/packages/docs/docs/forms.md +++ b/packages/docs/docs/forms.md @@ -7,30 +7,30 @@ title: Forms The form modules provide an Effect-first model for editable, schema-validated state. They are not a visual component library. Instead, they give you -Lenses/Subscribables for form values, validation issues, and commit state, so +Lenses/Views for form values, validation issues, and commit state, so you can build the UI with whatever components your app already uses. The base `Form` type represents a field. A field tracks both the raw encoded value used by inputs and the decoded value produced by an Effect `Schema`: - `encodedValue`: a `Lens` containing the raw input value. -- `value`: a `Subscribable` containing the decoded value as an `Option`. -- `issues`: a `Subscribable` containing schema validation issues for that field. -- `canCommit`, `isValidating`, and `isCommitting`: `Subscribable` flags for UI +- `value`: a `View` containing the decoded value as an `Option`. +- `issues`: a `View` containing schema validation issues for that field. +- `canCommit`, `isValidating`, and `isCommitting`: `View` flags for UI state. There are two root form flavors: -- `SubmittableForm`: owns local encoded form state, validates it, and submits a +- `MutationForm`: owns local encoded form state, validates it, and submits a decoded value through a mutation. -- `SynchronizedForm`: wraps an existing target `Lens` and writes valid changes +- `LensForm`: wraps an existing target `Lens` and writes valid changes back to that target. Most apps create one of those root forms, then focus it into fields with `Form.focusObjectOn`, `Form.focusArrayAt`, or the other focusing helpers. The core form model is Effect code and can technically be used outside -Effect-FC. Effect-FC adds the React-facing hooks, such as `Form.useInput`, that +Effect View. Effect View adds the React-facing hooks, such as `Form.useInput`, that make those forms convenient to bind to components. ## Field Inputs @@ -40,7 +40,7 @@ a React-style `{ value, setValue }` pair and writes changes back to the field's `encodedValue` Lens. ```tsx -import { Component, Form, Subscribable } from "effect-fc" +import { Component, Form, View } from "effect-view" const TextInputView = Component.make("TextInput")( function* (props: { @@ -50,7 +50,7 @@ const TextInputView = Component.make("TextInput")( const input = yield* Form.useInput(props.form, { debounce: "250 millis", }) - const [issues] = yield* Subscribable.useAll([props.form.issues]) + const [issues] = yield* View.useAll([props.form.issues]) return (