@homebound/form-state 2.33.0 → 3.1.0

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.
Files changed (59) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +450 -9
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +1118 -14
  5. package/dist/index.js.map +1 -0
  6. package/package.json +42 -50
  7. package/skills/form-state/SKILL.md +9 -9
  8. package/dist/FormStateApp.d.ts +0 -5
  9. package/dist/FormStateApp.js +0 -54
  10. package/dist/FormStateApp.test.d.ts +0 -1
  11. package/dist/FormStateApp.test.js +0 -26
  12. package/dist/config.d.ts +0 -78
  13. package/dist/config.js +0 -2
  14. package/dist/configBuilders.d.ts +0 -67
  15. package/dist/configBuilders.js +0 -115
  16. package/dist/configBuilders.test.d.ts +0 -1
  17. package/dist/configBuilders.test.js +0 -65
  18. package/dist/fields/deepEquals.d.ts +0 -7
  19. package/dist/fields/deepEquals.js +0 -53
  20. package/dist/fields/fragmentField.d.ts +0 -4
  21. package/dist/fields/fragmentField.js +0 -58
  22. package/dist/fields/listField.d.ts +0 -11
  23. package/dist/fields/listField.js +0 -355
  24. package/dist/fields/objectField.d.ts +0 -63
  25. package/dist/fields/objectField.js +0 -277
  26. package/dist/fields/valueField.d.ts +0 -81
  27. package/dist/fields/valueField.js +0 -244
  28. package/dist/formState.stories.d.ts +0 -4
  29. package/dist/formState.stories.js +0 -12
  30. package/dist/formState.test.d.ts +0 -11
  31. package/dist/formState.test.js +0 -2109
  32. package/dist/formStateDomain.d.ts +0 -47
  33. package/dist/formStateDomain.js +0 -28
  34. package/dist/mobx-behavior.test.d.ts +0 -1
  35. package/dist/mobx-behavior.test.js +0 -51
  36. package/dist/proxies.d.ts +0 -5
  37. package/dist/proxies.js +0 -20
  38. package/dist/rules.d.ts +0 -10
  39. package/dist/rules.js +0 -11
  40. package/dist/setupTests.d.ts +0 -1
  41. package/dist/setupTests.js +0 -15
  42. package/dist/stackoverlfow.d.ts +0 -17
  43. package/dist/stackoverlfow.js +0 -17
  44. package/dist/temporal.d.ts +0 -6
  45. package/dist/temporal.js +0 -34
  46. package/dist/temporal.test.d.ts +0 -1
  47. package/dist/temporal.test.js +0 -97
  48. package/dist/useFormState.d.ts +0 -82
  49. package/dist/useFormState.js +0 -158
  50. package/dist/useFormState.test.d.ts +0 -1
  51. package/dist/useFormState.test.js +0 -787
  52. package/dist/useFormStates.d.ts +0 -68
  53. package/dist/useFormStates.js +0 -101
  54. package/dist/useFormStates.test.d.ts +0 -1
  55. package/dist/useFormStates.test.js +0 -223
  56. package/dist/utils.d.ts +0 -52
  57. package/dist/utils.js +0 -198
  58. package/dist/utils.test.d.ts +0 -1
  59. package/dist/utils.test.js +0 -102
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const mobx_1 = require("mobx");
4
- const rules_1 = require("./rules");
5
- const utils_1 = require("./utils");
6
- describe("utils", () => {
7
- describe("pickFields", () => {
8
- it("can pick a value field", () => {
9
- const a = (0, utils_1.pickFields)(
10
- //
11
- { firstName: { type: "value" } }, { firstName: "a", b: "ignored" });
12
- expect(a).toMatchInlineSnapshot(`
13
- {
14
- "firstName": "a",
15
- }
16
- `);
17
- });
18
- it("can pick an unset object fields", () => {
19
- const a = (0, utils_1.pickFields)(authorWithAddressConfig, { firstName: "a", b: "ignored" });
20
- expect(a).toMatchInlineSnapshot(`
21
- {
22
- "address": undefined,
23
- "firstName": "a",
24
- "id": undefined,
25
- "lastName": undefined,
26
- }
27
- `);
28
- });
29
- it("can pick a set object field", () => {
30
- const a = (0, utils_1.pickFields)(authorWithAddressConfig, { firstName: "a", b: "ignored", address: {} });
31
- expect(a).toMatchInlineSnapshot(`
32
- {
33
- "address": {
34
- "city": undefined,
35
- "street": undefined,
36
- },
37
- "firstName": "a",
38
- "id": undefined,
39
- "lastName": undefined,
40
- }
41
- `);
42
- });
43
- it("can pick an unset list field", () => {
44
- const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored" });
45
- expect(a).toMatchInlineSnapshot(`
46
- {
47
- "books": undefined,
48
- "firstName": "a",
49
- "id": undefined,
50
- "lastName": undefined,
51
- }
52
- `);
53
- });
54
- it("can pick a set list field", () => {
55
- const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored", books: [{}] });
56
- expect(a).toMatchInlineSnapshot(`
57
- {
58
- "books": [
59
- {
60
- "classification": undefined,
61
- "id": undefined,
62
- "title": undefined,
63
- },
64
- ],
65
- "firstName": "a",
66
- "id": undefined,
67
- "lastName": undefined,
68
- }
69
- `);
70
- });
71
- it("can pick a set observable list field", () => {
72
- const books = (0, mobx_1.observable)([]);
73
- const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored", books });
74
- expect((0, mobx_1.isObservable)(a.books)).toEqual(true);
75
- });
76
- });
77
- });
78
- const authorWithAddressConfig = {
79
- id: { type: "value" },
80
- firstName: { type: "value" },
81
- lastName: { type: "value" },
82
- address: {
83
- type: "object",
84
- config: {
85
- street: { type: "value", rules: [rules_1.required] },
86
- city: { type: "value" },
87
- },
88
- },
89
- };
90
- const authorWithBooksConfig = {
91
- id: { type: "value" },
92
- firstName: { type: "value" },
93
- lastName: { type: "value" },
94
- books: {
95
- type: "list",
96
- config: {
97
- id: { type: "value" },
98
- title: { type: "value", rules: [rules_1.required] },
99
- classification: { type: "value" },
100
- },
101
- },
102
- };