@reformer/core 11.0.0-beta.4 → 11.0.0-beta.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.
Files changed (50) hide show
  1. package/dist/form/create-form.d.ts +11 -9
  2. package/dist/form/factories/node-factory.d.ts +17 -16
  3. package/dist/form/nodes/array-node.d.ts +3 -3
  4. package/dist/form/nodes/field-node.d.ts +6 -3
  5. package/dist/form/nodes/group-node.d.ts +7 -7
  6. package/dist/form/nodes/model-array-node.d.ts +2 -2
  7. package/dist/form/types/deep-schema.d.ts +5 -5
  8. package/dist/form/validators/email.d.ts +5 -6
  9. package/dist/form/validators/file-type.d.ts +5 -6
  10. package/dist/form/validators/future-date.d.ts +5 -6
  11. package/dist/form/validators/index.d.ts +3 -2
  12. package/dist/form/validators/integer.d.ts +5 -6
  13. package/dist/form/validators/is-date.d.ts +5 -6
  14. package/dist/form/validators/is-number.d.ts +5 -6
  15. package/dist/form/validators/max-age.d.ts +5 -6
  16. package/dist/form/validators/max-date.d.ts +5 -6
  17. package/dist/form/validators/max-file-size.d.ts +5 -6
  18. package/dist/form/validators/max-files.d.ts +5 -6
  19. package/dist/form/validators/max-length.d.ts +6 -7
  20. package/dist/form/validators/max-total-file-size.d.ts +5 -6
  21. package/dist/form/validators/max.d.ts +6 -7
  22. package/dist/form/validators/min-age.d.ts +5 -6
  23. package/dist/form/validators/min-date.d.ts +5 -6
  24. package/dist/form/validators/min-file-size.d.ts +5 -6
  25. package/dist/form/validators/min-files.d.ts +5 -6
  26. package/dist/form/validators/min-length.d.ts +6 -7
  27. package/dist/form/validators/min.d.ts +6 -7
  28. package/dist/form/validators/multiple-of.d.ts +5 -6
  29. package/dist/form/validators/non-negative.d.ts +5 -6
  30. package/dist/form/validators/non-zero.d.ts +5 -6
  31. package/dist/form/validators/past-date.d.ts +5 -6
  32. package/dist/form/validators/pattern.d.ts +6 -14
  33. package/dist/form/validators/phone.d.ts +5 -6
  34. package/dist/form/validators/required.d.ts +7 -12
  35. package/dist/form/validators/url.d.ts +7 -12
  36. package/dist/index.js +26 -23
  37. package/docs/llms/02-quick-start.md +6 -6
  38. package/docs/llms/03-api-signatures.md +3 -3
  39. package/docs/llms/05-common-mistakes.md +1 -1
  40. package/docs/llms/09-formschema.md +11 -11
  41. package/docs/llms/10-arrays.md +4 -4
  42. package/docs/llms/14-extended-mistakes.md +1 -1
  43. package/docs/llms/15-project-structure.md +8 -7
  44. package/docs/llms/16-ui-components.md +6 -6
  45. package/docs/llms/17-nonexistent-api.md +2 -2
  46. package/docs/llms/29-async-preload.md +4 -4
  47. package/docs/llms/30-type-safety-recipes.md +1 -1
  48. package/llms-index.json +1 -0
  49. package/llms.txt +2043 -224
  50. package/package.json +2 -1
@@ -47,7 +47,7 @@ export const createCreditApplicationModel = (): FormModel<CreditApplicationForm>
47
47
  // forms/credit-application/form.schema.ts
48
48
  import type { FormModel } from '@reformer/core';
49
49
  export const creditApplicationSchema = (model: FormModel<CreditApplicationForm>) => ({
50
- loanType: { value: model.$.loanType, component: Select, componentProps: { /* ... */ } },
50
+ loanType: { value: model.$.loanType, component: SelectField, componentProps: { /* ... */ } },
51
51
  personalData: personalDataNodes(model.$.personalData),
52
52
  properties: { array: model.properties, item: propertyItem },
53
53
  });
@@ -94,9 +94,9 @@ forms/
94
94
  │
95
95
  ├── schema/ # The form definition
96
96
  │ ├── model.ts # createModel factory + initial values + array-element factories
97
- │ ├── schema.ts # schema builder (model) => tree ({ value: model.$.x, component })
97
+ │ ├── form.schema.ts # schema builder (model) => tree ({ value: model.$.x, component })
98
98
  │ ├── validation.ts # defineValidationSchema + validateModel config ({ validateStep, validateAll })
99
- │ ├── behavior.ts # defineFormBehavior(...)
99
+ │ ├── form.behavior.ts # defineFormBehavior(...)
100
100
  │ └── create-form.ts # Assembly: createCoreForm({ model, schema, behavior, validation })
101
101
  │
102
102
  └── components/
@@ -107,7 +107,7 @@ forms/
107
107
 
108
108
  Rule of thumb for this layout: **domain raw material → `lib/`; anything describing the form →
109
109
  `schema/`; React layout → `components/`; root = entry + `index.ts`.** In very large forms you
110
- may co-locate each step's `schema.ts` / `validation.ts` / `behavior.ts` inside its
110
+ may co-locate each step's `form.schema.ts` / `validation.ts` / `form.behavior.ts` inside its
111
111
  `steps/[Step]/` folder, keeping only the shared `model` and cross-step rules in `schema/` — see
112
112
  the guide below.
113
113
 
@@ -124,6 +124,7 @@ the guide below.
124
124
  > is `minimalist`.
125
125
 
126
126
  > Cross-target variants (renderer-react `renderer.schema.ts` + `renderer.behavior.ts` /
127
- > renderer-json `renderer.schema.json` + `renderer.behavior.ts` + `registry.ts`), the
128
- > centralized-vs-co-located choice, and the full reuse map live in the
129
- > **form-directory-layout** guide (`@reformer/mcp`).
127
+ > renderer-json `renderer.schema.ts` + `renderer.behavior.ts` + `registry.ts`, plus an optional
128
+ > `renderer.wizard.tsx` shim), the `.tsx` / `.json` schema variants, the centralized-vs-co-located
129
+ > choice, and the full reuse map live in the **form-directory-layout** guide (`@reformer/mcp`) —
130
+ > `find_recipe directory-layout`.
@@ -7,7 +7,7 @@
7
7
  >
8
8
  > Канонический schema-driven подход:
9
9
  >
10
- > - **компонент** объявляется в схеме как `component: Input` (или `Select`, `Checkbox`, etc.)
10
+ > - **компонент** объявляется в схеме как `component: InputField` (или `Select`, `Checkbox`, etc.)
11
11
  > - **пропсы** компонента — в `componentProps: { label, placeholder, options, type, ... }`
12
12
  > - **JSX рендерит**: `<FormField control={form.x} />` БЕЗ дополнительных props
13
13
  >
@@ -19,7 +19,7 @@
19
19
  ```tsx
20
20
  import { useMemo } from 'react';
21
21
  import { createModel, createForm } from '@reformer/core';
22
- import { FormField, Input, Select, Checkbox, Button } from '@reformer/ui-kit';
22
+ import { FormField, InputField, SelectField, CheckboxField, Button } from '@reformer/ui-kit';
23
23
 
24
24
  type RegistrationForm = {
25
25
  email: string;
@@ -33,12 +33,12 @@ function RegistrationPage() {
33
33
  const schema = {
34
34
  email: {
35
35
  value: model.$.email,
36
- component: Input,
36
+ component: InputField,
37
37
  componentProps: { label: 'Email', type: 'email', placeholder: 'you@example.com' },
38
38
  },
39
39
  country: {
40
40
  value: model.$.country,
41
- component: Select,
41
+ component: SelectField,
42
42
  componentProps: {
43
43
  label: 'Country',
44
44
  options: [
@@ -49,7 +49,7 @@ function RegistrationPage() {
49
49
  },
50
50
  agree: {
51
51
  value: model.$.agree,
52
- component: Checkbox,
52
+ component: CheckboxField,
53
53
  componentProps: { label: 'I agree to terms' },
54
54
  },
55
55
  };
@@ -92,7 +92,7 @@ function RegistrationPage() {
92
92
  ✅ Всё это в схеме:
93
93
 
94
94
  ```ts
95
- { email: { component: Input, componentProps: { label: 'Email' } } }
95
+ { email: { component: InputField, componentProps: { label: 'Email' } } }
96
96
  ```
97
97
 
98
98
  ```tsx
@@ -64,8 +64,8 @@ const schema = {
64
64
 
65
65
  // CORRECT - layout только связывает поле с сигналом модели...
66
66
  const layout = {
67
- name: { value: model.$.name, component: Input, componentProps: { label: 'Name' } },
68
- email: { value: model.$.email, component: Input, componentProps: { label: 'Email' } },
67
+ name: { value: model.$.name, component: InputField, componentProps: { label: 'Name' } },
68
+ email: { value: model.$.email, component: InputField, componentProps: { label: 'Email' } },
69
69
  };
70
70
 
71
71
  // ...а правила — отдельная ambient-схема (прогоняется раннером validateModel):
@@ -31,16 +31,16 @@ Initial values задаются в `createModel(initial)`; `reset()` возвр
31
31
 
32
32
  ```typescript
33
33
  import { createModel, createForm } from '@reformer/core';
34
- import { Input, Select } from '@reformer/ui-kit';
34
+ import { InputField, SelectField } from '@reformer/ui-kit';
35
35
 
36
36
  type ProfileForm = { username: string; language: 'ru' | 'en'; marketing: boolean };
37
37
 
38
38
  const model = createModel<ProfileForm>({ username: '', language: 'ru', marketing: true });
39
39
  const schema = {
40
- username: { value: model.$.username, component: Input, componentProps: { label: 'Username' } },
40
+ username: { value: model.$.username, component: InputField, componentProps: { label: 'Username' } },
41
41
  language: {
42
42
  value: model.$.language,
43
- component: Select,
43
+ component: SelectField,
44
44
  componentProps: {
45
45
  label: 'Язык',
46
46
  options: [
@@ -49,7 +49,7 @@ const schema = {
49
49
  ],
50
50
  },
51
51
  },
52
- marketing: { value: model.$.marketing, component: Input, componentProps: { type: 'checkbox' } },
52
+ marketing: { value: model.$.marketing, component: InputField, componentProps: { type: 'checkbox' } },
53
53
  };
54
54
  const form = createForm({ model, schema });
55
55
  // model.get() === { username: '', language: 'ru', marketing: true }
@@ -59,7 +59,7 @@ Layout-схема БЕЗ валидаторов — правила живут в
59
59
  const model = createModel<CreditApplicationForm>(initial);
60
60
 
61
61
  const schema = {
62
- loanAmount: { value: model.$.loanAmount, component: Input },
62
+ loanAmount: { value: model.$.loanAmount, component: InputField },
63
63
  // вложенная группа — builder, принимающий ModelSignals<Sub>
64
64
  personalData: personalDataNodes(model.$.personalData),
65
65
  // массив — { array, item }