@homebound/form-state 2.26.4 → 2.26.5

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 CHANGED
@@ -23,6 +23,10 @@ It also keeps track of low-level form UX details like:
23
23
  - Supports collections of children, i.e. a `author: { books: [...} }` will include only changed books if necessary
24
24
  - Child collections can be either exhaustive (if any child changes, submit them all) or incremental (only include changed children), to match the backend endpoint's semantics
25
25
 
26
+ # Basic Usage
27
+
28
+ See our in-repo [sample app](https://github.com/homebound-team/form-state/blob/main/src/FormStateApp.tsx).
29
+
26
30
  # Main Features
27
31
 
28
32
  There are two main reasons why form-state exists:
@@ -90,19 +94,7 @@ Admittedly (and hopefully, b/c it makes the code simpler), the differences betwe
90
94
 
91
95
  These are usually simple/mechanistic changes, but nonetheless just some boilerplate that form-state provides conventions for.
92
96
 
93
- # Basic Usage
94
-
95
- See the [sample](https://github.com/homebound-team/form-state/blob/main/src/FormStateApp.tsx).
96
-
97
- # Todo
98
-
99
- - Add conditional readonly logic, like `{ type: "field", readOnlyIf: i => i.isInternal.value }`
100
-
101
- - Add `omitFromValue` so we can have two fields, `book.author.id` / `book.author.name`, where `book.author.name` is used for showing the author name, but `book.author.id` is the only field that is submitted to the server on mutation (maybe pair this with `Ref` based mutations)
102
-
103
- - Undo/redo would in theory be neat and easy to do on top of the existing infra
104
-
105
- # Features
97
+ # Other Features
106
98
 
107
99
  ## Incremental changedValue/dirty Management
108
100
 
@@ -211,6 +203,14 @@ const form = useFormState({
211
203
  });
212
204
  ```
213
205
 
206
+ # Todo
207
+
208
+ - Add conditional readonly logic, like `{ type: "field", readOnlyIf: i => i.isInternal.value }`
209
+
210
+ - Add `omitFromValue` so we can have two fields, `book.author.id` / `book.author.name`, where `book.author.name` is used for showing the author name, but `book.author.id` is the only field that is submitted to the server on mutation (maybe pair this with `Ref` based mutations)
211
+
212
+ - Undo/redo would in theory be neat and easy to do on top of the existing infra
213
+
214
214
  # Internal Implementation Notes
215
215
 
216
216
  form-state keeps the "actual data" (basically a POJO of your form data) separate from the "mobx proxies that track reactivity" (the `ObjectState` interface with `.get` / `.set` / `.errors` other methods).
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { f } from "./configBuilders";
2
2
  export { type FragmentField } from "./fields/fragmentField";
3
3
  export { type ListFieldState } from "./fields/listField";
4
- export { createObjectState, type Fragment, type ObjectState, type fragment } from "./fields/objectField";
4
+ export { createObjectState, type Fragment, type ObjectState, fragment } from "./fields/objectField";
5
5
  export { type FieldState, type ValueAdapter } from "./fields/valueField";
6
6
  export { required, type Rule } from "./rules";
7
7
  export { useFormState } from "./useFormState";
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFormStates = exports.useFormState = exports.required = exports.createObjectState = exports.f = void 0;
3
+ exports.useFormStates = exports.useFormState = exports.required = exports.fragment = exports.createObjectState = exports.f = void 0;
4
4
  var configBuilders_1 = require("./configBuilders");
5
5
  Object.defineProperty(exports, "f", { enumerable: true, get: function () { return configBuilders_1.f; } });
6
6
  var objectField_1 = require("./fields/objectField");
7
7
  Object.defineProperty(exports, "createObjectState", { enumerable: true, get: function () { return objectField_1.createObjectState; } });
8
+ Object.defineProperty(exports, "fragment", { enumerable: true, get: function () { return objectField_1.fragment; } });
8
9
  var rules_1 = require("./rules");
9
10
  Object.defineProperty(exports, "required", { enumerable: true, get: function () { return rules_1.required; } });
10
11
  var useFormState_1 = require("./useFormState");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/form-state",
3
- "version": "2.26.4",
3
+ "version": "2.26.5",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",