diff --git a/content/docs/form/advanced/normalized-store.ko.mdx b/content/docs/form/advanced/normalized-store.ko.mdx index de92f70..07b101a 100644 --- a/content/docs/form/advanced/normalized-store.ko.mdx +++ b/content/docs/form/advanced/normalized-store.ko.mdx @@ -5,7 +5,7 @@ description: "정규화된 필드 기록이 getState, getValues, 어댑터 구 # 정규화 저장소 -관찰 가능한 내부 상태는 `FormState` 모양입니다. 여기에는 `initialValues`, `fields`, `submitCount`, `arrayKeys`가 있습니다. `fields` 기록은 정규화된 경로 키로 저장되며 말단 값마다 하나의 `FieldState`를 가집니다. 그래서 `getFieldState(path)`가 가볍게 동작하고, 어댑터가 하나의 스냅샷에서 errors, dirty fields, touched fields를 요약할 수 있습니다. +관찰 가능한 내부 상태는 `FormState` 모양입니다. 여기에는 `defaultValues`, `fields`, `submitCount`, `arrayKeys`가 있습니다. `fields` 기록은 정규화된 경로 키로 저장되며 말단 값마다 하나의 `FieldState`를 가집니다. 그래서 `getFieldState(path)`가 가볍게 동작하고, 어댑터가 하나의 스냅샷에서 errors, dirty fields, touched fields를 요약할 수 있습니다. ```ts lineNumbers const snapshot = form.getState(); diff --git a/content/docs/form/advanced/normalized-store.mdx b/content/docs/form/advanced/normalized-store.mdx index 0000974..7dd9d6c 100644 --- a/content/docs/form/advanced/normalized-store.mdx +++ b/content/docs/form/advanced/normalized-store.mdx @@ -5,7 +5,7 @@ description: "How normalized field records explain getState, getValues, and adap # Normalized store -Internally visible state is shaped as `FormState`: `initialValues`, `fields`, `submitCount`, and `arrayKeys`. The `fields` record is keyed by normalized path keys and stores one `FieldState` per leaf. This is why `getFieldState(path)` can be cheap and why adapters can summarize errors, dirty fields, and touched fields from one snapshot. +Internally visible state is shaped as `FormState`: `defaultValues`, `fields`, `submitCount`, and `arrayKeys`. The `fields` record is keyed by normalized path keys and stores one `FieldState` per leaf. This is why `getFieldState(path)` can be cheap and why adapters can summarize errors, dirty fields, and touched fields from one snapshot. ```ts lineNumbers const snapshot = form.getState(); diff --git a/content/docs/form/guides/build-a-login-form.ko.mdx b/content/docs/form/guides/build-a-login-form.ko.mdx index 5ad4e06..17d58c4 100644 --- a/content/docs/form/guides/build-a-login-form.ko.mdx +++ b/content/docs/form/guides/build-a-login-form.ko.mdx @@ -9,7 +9,7 @@ description: "필드 바인딩, 검증, 제출, 초기화를 갖춘 실무형 ```tsx lineNumbers const form = new CreateForm({ - initialValues: { email: '', password: '', remember: false }, + defaultValues: { email: '', password: '', remember: false }, schema: loginSchema, validateOn: ['blur', 'submit'], }); diff --git a/content/docs/form/guides/build-a-login-form.mdx b/content/docs/form/guides/build-a-login-form.mdx index 68d1e13..3d38f43 100644 --- a/content/docs/form/guides/build-a-login-form.mdx +++ b/content/docs/form/guides/build-a-login-form.mdx @@ -9,7 +9,7 @@ Start by keeping the form instance outside the component so it is not recreated ```tsx lineNumbers const form = new CreateForm({ - initialValues: { email: '', password: '', remember: false }, + defaultValues: { email: '', password: '', remember: false }, schema: loginSchema, validateOn: ['blur', 'submit'], }); diff --git a/content/docs/form/guides/validation-flow.ko.mdx b/content/docs/form/guides/validation-flow.ko.mdx index 74e3b74..f8a52b7 100644 --- a/content/docs/form/guides/validation-flow.ko.mdx +++ b/content/docs/form/guides/validation-flow.ko.mdx @@ -9,7 +9,7 @@ description: "validateOn, field-local 스키마, 수동 trigger, 제출 검증 ```ts lineNumbers const form = new CreateForm({ - initialValues, + defaultValues, schema: profileSchema, validateOn: ['blur', 'submit'], }); diff --git a/content/docs/form/guides/validation-flow.mdx b/content/docs/form/guides/validation-flow.mdx index c6a5737..04b33b8 100644 --- a/content/docs/form/guides/validation-flow.mdx +++ b/content/docs/form/guides/validation-flow.mdx @@ -9,7 +9,7 @@ A practical validation flow usually combines three layers. First, a form-level S ```ts lineNumbers const form = new CreateForm({ - initialValues, + defaultValues, schema: profileSchema, validateOn: ['blur', 'submit'], }); diff --git a/content/docs/form/index.ko.mdx b/content/docs/form/index.ko.mdx index 9b98c01..b5a7d1b 100644 --- a/content/docs/form/index.ko.mdx +++ b/content/docs/form/index.ko.mdx @@ -21,7 +21,7 @@ description: "프레임워크와 분리된 폼 상태, 검증, 배열 메타데 import { CreateForm } from '@ilokesto/form'; const form = new CreateForm({ - initialValues: { + defaultValues: { email: '', profile: { name: 'Ada' }, tags: ['docs'], diff --git a/content/docs/form/index.mdx b/content/docs/form/index.mdx index 8d2eef8..14f12ac 100644 --- a/content/docs/form/index.mdx +++ b/content/docs/form/index.mdx @@ -21,7 +21,7 @@ Install the framework peer you use as well: `react`, `vue`, `solid-js`, or `svel import { CreateForm } from '@ilokesto/form'; const form = new CreateForm({ - initialValues: { + defaultValues: { email: '', profile: { name: 'Ada' }, tags: ['docs'], @@ -48,3 +48,5 @@ The most important rule is path semantics. A string is a literal field name, so ## Where to go next Read [Quick start](/en/form/quick-start) for a working React example, [Core concepts](/en/form/core-concepts) for the mental model, [CreateForm](/en/form/reference/create-form) for the core API, and the integration page for your framework when you are ready to bind DOM inputs. + +> This documentation lives in the `@ilokesto/form` repository and is synced to the ilokesto docs site. diff --git a/content/docs/form/integrations/react.ko.mdx b/content/docs/form/integrations/react.ko.mdx index 6ba416a..5bf7282 100644 --- a/content/docs/form/integrations/react.ko.mdx +++ b/content/docs/form/integrations/react.ko.mdx @@ -30,6 +30,20 @@ function ProfileForm({ form }) { text input은 `onChange`로 갱신됩니다. checkbox와 radio는 checked 상태를 사용합니다. select와 textarea 바인딩은 제네릭으로 좁힐 수 있습니다. 오류를 렌더링하거나 `setValue`를 호출해야 하면 `useField`를 쓰고, 평범한 입력에 속성만 필요하면 `useRegister`를 사용하세요. +## 외부 값 동기화 + +`ReactFormOptions`는 현재 render의 `values`와 plain `resetOptions`를 받습니다. 처음 정의된 값과 이후 `Object.is` identity가 달라진 값마다 `form.reset(values, resetOptions)`를 호출합니다. `undefined`는 reset 없이 동기화를 중단하고, 그 뒤 마지막으로 정의되었던 같은 object를 다시 전달해도 no-op입니다. `resetOptions`만 바꾸는 것도 no-op이며 새 `values` reference가 reset을 일으킬 때만 읽힙니다. + +```tsx +const { form } = useForm({ + defaultValues: emptyProfile, + values: query.data, + resetOptions: { keepDirtyValues: true }, +}); +``` + +`defaultValues`는 component-owned form을 한 번만 생성합니다. values effect는 component unmount 시 종료됩니다. `useForm(existingForm)` overload는 기존 동작을 유지하며 external-value synchronization을 설치하지 않습니다. + ## 주의할 점 코어 폼은 안정적인 위치에서 만들고, 해당 프레임워크 피어 의존성을 설치하며, 프레임워크 컴포넌트에서는 이 어댑터 하위 경로에서만 가져오세요. 서버 액션이나 도메인 도우미처럼 렌더링이 필요 없는 코드는 루트 `@ilokesto/form` API에 남겨두는 편이 좋습니다. diff --git a/content/docs/form/integrations/react.mdx b/content/docs/form/integrations/react.mdx index b572929..cc85482 100644 --- a/content/docs/form/integrations/react.mdx +++ b/content/docs/form/integrations/react.mdx @@ -30,6 +30,20 @@ function ProfileForm({ form }) { Text inputs update through `onChange`; checkbox and radio fields use checked state; select and textarea bindings can be narrowed with a generic. Use `useField` when rendering errors or calling `setValue`, and `useRegister` when a plain input only needs props. +## Syncing external values + +`ReactFormOptions` accepts the current render `values` and plain `resetOptions`. The first defined value and each later value with a different `Object.is` identity call `form.reset(values, resetOptions)`. `undefined` pauses synchronization without resetting, and passing the last defined object again remains a no-op. Changing only `resetOptions` is also a no-op; it is read only when a new `values` reference drives a reset. + +```tsx +const { form } = useForm({ + defaultValues: emptyProfile, + values: query.data, + resetOptions: { keepDirtyValues: true }, +}); +``` + +`defaultValues` creates the component-owned form once. The values effect ends when the component unmounts. `useForm(existingForm)` keeps its existing overload behavior and does not install external-value synchronization. + ## Cautions Create the core form in a stable place, install the matching peer dependency, and import only from this adapter subpath in framework components. Keep server actions and domain helpers on the root `@ilokesto/form` API when they do not need rendering. diff --git a/content/docs/form/integrations/solid.ko.mdx b/content/docs/form/integrations/solid.ko.mdx index c8689cf..1c6f674 100644 --- a/content/docs/form/integrations/solid.ko.mdx +++ b/content/docs/form/integrations/solid.ko.mdx @@ -30,6 +30,21 @@ function Phones({ form }) { 오류 렌더링과 직접 setter가 필요하면 `useField`를 사용하세요. text, checkbox, radio, select, textarea, DOM 호환 커스텀 컨트롤에는 `useRegister`를 사용합니다. React에서처럼 배열 키와 튜플 인덱스 경로는 분리해서 관리하세요. +## 외부 값 동기화 + +`SolidFormOptions`는 `values`를 `Accessor`로 받고 plain `resetOptions`를 받습니다. 처음 정의된 값과 이후 `Object.is` identity가 달라진 값마다 `form.reset(values, resetOptions)`를 호출합니다. `undefined`는 reset 없이 동기화를 중단하고, 마지막으로 정의되었던 같은 object를 다시 emit해도 no-op입니다. `resetOptions`는 value-driven reset에만 적용됩니다. + +```tsx +const [serverValues, setServerValues] = createSignal(); +const { form } = useForm({ + defaultValues: emptyProfile, + values: serverValues, + resetOptions: { keepDirtyValues: true }, +}); +``` + +이 overload에는 active Solid owner가 필요하며 owner가 없으면 form 생성 전에 실패합니다. Tracking computation은 해당 owner와 함께 dispose됩니다. `useForm(existingForm)`은 values tracking을 설치하지 않습니다. + ## 주의할 점 코어 폼은 안정적인 위치에서 만들고, 해당 프레임워크 피어 의존성을 설치하며, 프레임워크 컴포넌트에서는 이 어댑터 하위 경로에서만 가져오세요. 서버 액션이나 도메인 도우미처럼 렌더링이 필요 없는 코드는 루트 `@ilokesto/form` API에 남겨두는 편이 좋습니다. diff --git a/content/docs/form/integrations/solid.mdx b/content/docs/form/integrations/solid.mdx index 2cfbc26..651fde9 100644 --- a/content/docs/form/integrations/solid.mdx +++ b/content/docs/form/integrations/solid.mdx @@ -30,6 +30,21 @@ function Phones({ form }) { Use `useField` for error rendering and direct setters. Use `useRegister` for text, checkbox, radio, select, textarea, and DOM-compatible custom controls. Keep array keys separate from tuple index paths, just as you would in React. +## Syncing external values + +`SolidFormOptions` accepts `values` as `Accessor` and accepts plain `resetOptions`. The first defined value and each later value with a different `Object.is` identity call `form.reset(values, resetOptions)`. `undefined` pauses synchronization without resetting, and re-emitting the last defined object remains a no-op. `resetOptions` applies only to value-driven resets. + +```tsx +const [serverValues, setServerValues] = createSignal(); +const { form } = useForm({ + defaultValues: emptyProfile, + values: serverValues, + resetOptions: { keepDirtyValues: true }, +}); +``` + +This overload requires an active Solid owner and fails before form creation when none exists. The tracking computation is disposed with that owner. `useForm(existingForm)` does not install values tracking. + ## Cautions Create the core form in a stable place, install the matching peer dependency, and import only from this adapter subpath in framework components. Keep server actions and domain helpers on the root `@ilokesto/form` API when they do not need rendering. diff --git a/content/docs/form/integrations/svelte.ko.mdx b/content/docs/form/integrations/svelte.ko.mdx index b085742..42a8a94 100644 --- a/content/docs/form/integrations/svelte.ko.mdx +++ b/content/docs/form/integrations/svelte.ko.mdx @@ -26,6 +26,26 @@ description: "@ilokesto/form/svelte의 register 액션과 읽기 가능한 폼 액션은 DOM 리스너를 붙이고 요소가 사라질 때 정리합니다. `useFormState()`는 errors, dirty fields, touched fields, validity, submitting state, submitCount 같은 전체 상태 요약을 담은 Svelte readable store를 반환합니다. +## 외부 값 동기화 + +`SvelteFormOptions`는 `values`를 `Readable`로 받고 plain `resetOptions`를 받습니다. 처음 정의된 emission과 이후 `Object.is` identity가 달라진 emission마다 `form.reset(values, resetOptions)`를 호출합니다. `undefined`는 reset 없이 동기화를 중단하고, 마지막으로 정의되었던 같은 object를 다시 emit해도 no-op입니다. `resetOptions`는 value-driven reset에만 적용됩니다. + +```svelte + +``` + +이 options overload는 component initialization 중 호출해야 합니다. Readable subscription은 component unmount 시 해제됩니다. `useForm(existingForm)`은 external values를 구독하지 않습니다. + ## 주의할 점 코어 폼은 안정적인 위치에서 만들고, 해당 프레임워크 피어 의존성을 설치하며, 프레임워크 컴포넌트에서는 이 어댑터 하위 경로에서만 가져오세요. 서버 액션이나 도메인 도우미처럼 렌더링이 필요 없는 코드는 루트 `@ilokesto/form` API에 남겨두는 편이 좋습니다. diff --git a/content/docs/form/integrations/svelte.mdx b/content/docs/form/integrations/svelte.mdx index 0fbb9a3..4de554d 100644 --- a/content/docs/form/integrations/svelte.mdx +++ b/content/docs/form/integrations/svelte.mdx @@ -26,6 +26,26 @@ Install `svelte` as the peer and import from `@ilokesto/form/svelte`. Svelte is The action attaches DOM listeners and cleans them up when the element is destroyed. `useFormState()` returns a Svelte readable store containing aggregate state such as errors, dirty fields, touched fields, validity, submitting state, and submitCount. +## Syncing external values + +`SvelteFormOptions` accepts `values` as `Readable` and accepts plain `resetOptions`. The first defined emission and each later emission with a different `Object.is` identity call `form.reset(values, resetOptions)`. `undefined` pauses synchronization without resetting, and re-emitting the last defined object remains a no-op. `resetOptions` applies only to value-driven resets. + +```svelte + +``` + +Call this options overload during component initialization. Its readable subscription is released on component unmount. `useForm(existingForm)` does not subscribe to external values. + ## Cautions Create the core form in a stable place, install the matching peer dependency, and import only from this adapter subpath in framework components. Keep server actions and domain helpers on the root `@ilokesto/form` API when they do not need rendering. diff --git a/content/docs/form/integrations/vue.ko.mdx b/content/docs/form/integrations/vue.ko.mdx index 5fc2f73..faeb7e0 100644 --- a/content/docs/form/integrations/vue.ko.mdx +++ b/content/docs/form/integrations/vue.ko.mdx @@ -29,6 +29,26 @@ const state = useFormState(); 반환된 상태는 getter 기반으로 읽히므로 템플릿에서 최신 값을 볼 수 있습니다. field-local 스키마는 현재 Vue effect scope와 함께 정리됩니다. 커스텀 컴포넌트에서는 DOM과 호환되는 value, checked, 이벤트 동작을 통과시키세요. +## 외부 값 동기화 + +`VueFormOptions`는 `values`를 `MaybeRefOrGetter`로 받고 plain `resetOptions`를 받습니다. 처음 정의된 값과 이후 `Object.is` identity가 달라진 값마다 `form.reset(values, resetOptions)`를 호출합니다. `undefined`는 reset 없이 동기화를 중단하고, 마지막으로 정의되었던 같은 object를 다시 emit해도 no-op입니다. `resetOptions`는 value-driven reset에만 사용됩니다. + +```vue + +``` + +변화 추적을 보장하려면 반응형 소스(`ref`/`computed`/getter)를 직접 전달하세요. 평면 값은 생성 시 한 번만 평가됩니다. 이 overload에는 active Vue effect scope가 필요하며 scope가 없으면 form 생성 전에 실패합니다. Watcher는 해당 scope와 함께 중지되며 `useForm(existingForm)`은 values watcher를 설치하지 않습니다. + ## 주의할 점 코어 폼은 안정적인 위치에서 만들고, 해당 프레임워크 피어 의존성을 설치하며, 프레임워크 컴포넌트에서는 이 어댑터 하위 경로에서만 가져오세요. 서버 액션이나 도메인 도우미처럼 렌더링이 필요 없는 코드는 루트 `@ilokesto/form` API에 남겨두는 편이 좋습니다. diff --git a/content/docs/form/integrations/vue.mdx b/content/docs/form/integrations/vue.mdx index 1169d33..e07abca 100644 --- a/content/docs/form/integrations/vue.mdx +++ b/content/docs/form/integrations/vue.mdx @@ -29,6 +29,26 @@ const state = useFormState(); The returned state uses getter-backed reads so templates see fresh values. Field-local schemas are cleaned up with the current Vue effect scope. For custom components, pass through DOM-compatible value, checked, and event behavior. +## Syncing external values + +`VueFormOptions` accepts `values` as `MaybeRefOrGetter` and accepts plain `resetOptions`. The first defined value and each later value with a different `Object.is` identity call `form.reset(values, resetOptions)`. `undefined` pauses synchronization without resetting, and re-emitting the last defined object remains a no-op. `resetOptions` is used only by a value-driven reset. + +```vue + +``` + +Pass reactive sources (`ref`/`computed`/getter) directly so Vue can track changes. A plain value is evaluated once. This overload requires an active Vue effect scope and fails before form creation when none exists. The watcher stops with that scope, and `useForm(existingForm)` does not install a values watcher. + ## Cautions Create the core form in a stable place, install the matching peer dependency, and import only from this adapter subpath in framework components. Keep server actions and domain helpers on the root `@ilokesto/form` API when they do not need rendering. diff --git a/content/docs/form/quick-start.ko.mdx b/content/docs/form/quick-start.ko.mdx index 6c22b34..23a91fa 100644 --- a/content/docs/form/quick-start.ko.mdx +++ b/content/docs/form/quick-start.ko.mdx @@ -27,7 +27,7 @@ type LoginValues = { }; export const loginForm = new CreateForm({ - initialValues: { + defaultValues: { email: '', password: '', remember: false, @@ -36,7 +36,7 @@ export const loginForm = new CreateForm({ }); ``` -`initialValues`는 reset 기준값이자 처음 필드 값입니다. `validateOn`은 자동 검증이 실행될 시점을 정합니다. 그래도 필요한 순간에는 언제든 `trigger()`를 직접 호출할 수 있습니다. +`defaultValues`는 reset 기준값이자 처음 필드 값입니다. `validateOn`은 자동 검증이 실행될 시점을 정합니다. 그래도 필요한 순간에는 언제든 `trigger()`를 직접 호출할 수 있습니다. ## 3. React에서 필드 연결하기 diff --git a/content/docs/form/quick-start.mdx b/content/docs/form/quick-start.mdx index 503ac66..8538295 100644 --- a/content/docs/form/quick-start.mdx +++ b/content/docs/form/quick-start.mdx @@ -27,7 +27,7 @@ type LoginValues = { }; export const loginForm = new CreateForm({ - initialValues: { + defaultValues: { email: '', password: '', remember: false, @@ -36,7 +36,7 @@ export const loginForm = new CreateForm({ }); ``` -`initialValues` establishes the reset baseline and the first `FieldState` values. `validateOn` tells the core when automatic validation should run. You can still call `trigger()` manually at any time. +`defaultValues` establishes the reset baseline and the first `FieldState` values. `validateOn` tells the core when automatic validation should run. You can still call `trigger()` manually at any time. ## 3. Bind fields in React diff --git a/content/docs/form/reference/create-form.ko.mdx b/content/docs/form/reference/create-form.ko.mdx index ef45afc..658a87b 100644 --- a/content/docs/form/reference/create-form.ko.mdx +++ b/content/docs/form/reference/create-form.ko.mdx @@ -5,11 +5,11 @@ description: "렌더러 없이 폼 컨트롤러를 만들고 상태를 구독하 # CreateForm -`CreateForm`는 모든 어댑터 뒤에 있는 코어 클래스입니다. 생성자에는 `CreateFormOptions`를 전달합니다. 옵션에는 `initialValues`, 선택적인 폼 전체 `schema`, 선택적인 `schemaOptions`, 선택적인 `validateOn`이 있습니다. 인스턴스는 `Form`를 구현하므로 어댑터와 테스트가 하나의 안정된 계약에 의존할 수 있습니다. +`CreateForm`는 모든 어댑터 뒤에 있는 코어 클래스입니다. 생성자에는 `CreateFormOptions`를 전달합니다. 옵션에는 `defaultValues`, 선택적인 폼 전체 `schema`, 선택적인 `schemaOptions`, 선택적인 `validateOn`이 있습니다. 인스턴스는 `Form`를 구현하므로 어댑터와 테스트가 하나의 안정된 계약에 의존할 수 있습니다. ```ts lineNumbers const form = new CreateForm({ - initialValues: { email: '', profile: { name: '' } }, + defaultValues: { email: '', profile: { name: '' } }, schema: profileSchema, schemaOptions: { libraryOptions: { abortEarly: false } }, validateOn: ['change', 'blur', 'submit'], diff --git a/content/docs/form/reference/create-form.mdx b/content/docs/form/reference/create-form.mdx index 14e64fa..33e306f 100644 --- a/content/docs/form/reference/create-form.mdx +++ b/content/docs/form/reference/create-form.mdx @@ -5,11 +5,11 @@ description: "Create a form controller, subscribe to state, and operate values w # CreateForm -`CreateForm` is the core class behind every adapter. Construct it with `CreateFormOptions`: `initialValues`, optional form-level `schema`, optional `schemaOptions`, and optional `validateOn`. The instance implements `Form`, so adapters and tests can rely on one stable contract. +`CreateForm` is the core class behind every adapter. Construct it with `CreateFormOptions`: `defaultValues`, optional form-level `schema`, optional `schemaOptions`, and optional `validateOn`. The instance implements `Form`, so adapters and tests can rely on one stable contract. ```ts lineNumbers const form = new CreateForm({ - initialValues: { email: '', profile: { name: '' } }, + defaultValues: { email: '', profile: { name: '' } }, schema: profileSchema, schemaOptions: { libraryOptions: { abortEarly: false } }, validateOn: ['change', 'blur', 'submit'], diff --git a/content/docs/form/reference/entrypoints.ko.mdx b/content/docs/form/reference/entrypoints.ko.mdx index 2695ec9..dcf5408 100644 --- a/content/docs/form/reference/entrypoints.ko.mdx +++ b/content/docs/form/reference/entrypoints.ko.mdx @@ -5,7 +5,7 @@ description: "코어와 프레임워크 어댑터를 올바른 패키지 하위 # 진입점 -`@ilokesto/form`에는 프레임워크와 분리된 루트 진입점 하나와 네 개의 어댑터 진입점이 있습니다. `CreateForm`, `CreateFormOptions`, `FieldPathInput`, `FieldState`, `FormState`, `FormError`, `StandardSchemaV1`은 루트에서 가져옵니다. 프레임워크 도우미는 `@ilokesto/form/react`, `@ilokesto/form/vue`, `@ilokesto/form/solid`, `@ilokesto/form/svelte`에서 가져옵니다. +`@ilokesto/form`에는 프레임워크와 분리된 루트 진입점 하나와 네 개의 어댑터 진입점이 있습니다. `CreateForm`, `CreateFormOptions`, `FieldPathInput`, `Form`, `FormError`, `ResetOptions`, `StandardSchemaV1`은 루트에서 가져옵니다. `FieldState`와 `FormState`는 `getFieldState()`와 `getState()`가 반환하는 런타임 모양이며 루트에서 가져올 수 없습니다. 프레임워크 도우미는 `@ilokesto/form/react`, `@ilokesto/form/vue`, `@ilokesto/form/solid`, `@ilokesto/form/svelte`에서 가져옵니다. ```ts lineNumbers import { CreateForm, type FormError } from '@ilokesto/form'; diff --git a/content/docs/form/reference/entrypoints.mdx b/content/docs/form/reference/entrypoints.mdx index 852b2cb..732652c 100644 --- a/content/docs/form/reference/entrypoints.mdx +++ b/content/docs/form/reference/entrypoints.mdx @@ -5,7 +5,7 @@ description: "Import the core and framework adapters from the correct package su # Entrypoints -`@ilokesto/form` has one framework-neutral root entrypoint and four adapter entrypoints. Import `CreateForm`, `CreateFormOptions`, `FieldPathInput`, `FieldState`, `FormState`, `FormError`, and `StandardSchemaV1` from the root. Import framework helpers from `@ilokesto/form/react`, `@ilokesto/form/vue`, `@ilokesto/form/solid`, or `@ilokesto/form/svelte`. +`@ilokesto/form` has one framework-neutral root entrypoint and four adapter entrypoints. Import `CreateForm`, `CreateFormOptions`, `FieldPathInput`, `Form`, `FormError`, `ResetOptions`, and `StandardSchemaV1` from the root. `FieldState` and `FormState` are runtime shapes returned by `getFieldState()` and `getState()`; they are not importable from the root. Import framework helpers from `@ilokesto/form/react`, `@ilokesto/form/vue`, `@ilokesto/form/solid`, or `@ilokesto/form/svelte`. ```ts lineNumbers import { CreateForm, type FormError } from '@ilokesto/form'; diff --git a/content/docs/form/reference/submit-and-reset.ko.mdx b/content/docs/form/reference/submit-and-reset.ko.mdx index 356ade7..fffef3c 100644 --- a/content/docs/form/reference/submit-and-reset.ko.mdx +++ b/content/docs/form/reference/submit-and-reset.ko.mdx @@ -19,7 +19,7 @@ await form.submit( ); ``` -`reset()`은 원래 `initialValues`로 되돌립니다. `reset(nextValues)`는 기준값을 교체하고 새 값 주변의 필드 메타데이터를 정리합니다. 서버 흐름에서는 `submit`, `setErrors`, `clearErrors`를 함께 사용하세요. 클라이언트 검증을 통과한 값을 제출하고, 서버 오류를 필드에 매핑한 뒤, 사용자가 수정하거나 다시 시도할 때 그 오류를 지웁니다. +`reset()`은 원래 `defaultValues`로 되돌립니다. `reset(nextValues)`는 기준값을 교체하고 새 값 주변의 필드 메타데이터를 정리합니다. 서버 흐름에서는 `submit`, `setErrors`, `clearErrors`를 함께 사용하세요. 클라이언트 검증을 통과한 값을 제출하고, 서버 오류를 필드에 매핑한 뒤, 사용자가 수정하거나 다시 시도할 때 그 오류를 지웁니다. ## 실무 사용 팁 diff --git a/content/docs/form/reference/submit-and-reset.mdx b/content/docs/form/reference/submit-and-reset.mdx index f189a7e..1c1533f 100644 --- a/content/docs/form/reference/submit-and-reset.mdx +++ b/content/docs/form/reference/submit-and-reset.mdx @@ -19,7 +19,7 @@ await form.submit( ); ``` -`reset()` restores the original `initialValues`. `reset(nextValues)` replaces the baseline and clears field metadata around the new values. Combine `submit`, `setErrors`, and `clearErrors` for server flows: submit valid client values, map server errors to fields, clear those errors when the user changes or retries. +`reset()` restores the original `defaultValues`. `reset(nextValues)` replaces the baseline and clears field metadata around the new values. Combine `submit`, `setErrors`, and `clearErrors` for server flows: submit valid client values, map server errors to fields, clear those errors when the user changes or retries. ## Practical guidance diff --git a/content/docs/form/reference/types.ko.mdx b/content/docs/form/reference/types.ko.mdx index 3b9108c..2e19568 100644 --- a/content/docs/form/reference/types.ko.mdx +++ b/content/docs/form/reference/types.ko.mdx @@ -5,14 +5,12 @@ description: "코어와 어댑터가 내보내는 공개 타입입니다." # 타입 -중요한 코어 타입은 `CreateFormOptions`, `FieldPathInput`, `FieldState`, `FormState`, `FormError`, `StandardSchemaV1`, `ValidationTrigger`, `FieldSchemaOptions`, `SetValueOptions`, `Form`, `FormArray`입니다. 어댑터 패키지도 `RegisterOptions` 별칭과 프레임워크별 반환 타입을 내보냅니다. +루트 진입점은 `CreateFormOptions`, `FieldPathInput`, `Form`, `FormError`, `ResetOptions`, `StandardSchemaV1`(`CreateForm` 클래스 포함)을 내보냅니다. `getFieldState(path)`는 `FieldState`를 반환하고 `getState()`는 `FormState`를 반환합니다. 이 런타임 모양은 루트에서 가져오는 것이 아니라 field-state와 normalized-store 문서에서 설명합니다. 어댑터 패키지도 `RegisterOptions` 별칭과 프레임워크별 반환 타입을 내보냅니다. ```ts lineNumbers import type { CreateFormOptions, FieldPathInput, - FieldState, - FormState, FormError, StandardSchemaV1, } from '@ilokesto/form'; diff --git a/content/docs/form/reference/types.mdx b/content/docs/form/reference/types.mdx index 5433231..78b5058 100644 --- a/content/docs/form/reference/types.mdx +++ b/content/docs/form/reference/types.mdx @@ -5,14 +5,12 @@ description: "Public types exported by the core and adapters." # Types -The most important core types are `CreateFormOptions`, `FieldPathInput`, `FieldState`, `FormState`, `FormError`, `StandardSchemaV1`, `ValidationTrigger`, `FieldSchemaOptions`, `SetValueOptions`, `Form`, and `FormArray`. Adapter packages also export their `RegisterOptions` alias and framework-specific return types. +The root entrypoint exports `CreateFormOptions`, `FieldPathInput`, `Form`, `FormError`, `ResetOptions`, and `StandardSchemaV1` (plus the `CreateForm` class). `getFieldState(path)` returns a `FieldState` and `getState()` returns a `FormState`; those runtime shapes are documented on the field-state and normalized-store pages rather than imported from the root. Adapter packages also export their `RegisterOptions` alias and framework-specific return types. ```ts lineNumbers import type { CreateFormOptions, FieldPathInput, - FieldState, - FormState, FormError, StandardSchemaV1, } from '@ilokesto/form';