@shikiform/react 0.1.0 → 0.3.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.
- package/dist/{chunk-EYDJ6I7P.js → chunk-A54EUYGM.js} +318 -133
- package/dist/chunk-A54EUYGM.js.map +1 -0
- package/dist/index.d.ts +23 -25
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +92 -4
- package/dist/internal.js +1 -1
- package/dist/{use-watch-BZlpyvHw.d.ts → use-watch-BJDsp7Zo.d.ts} +220 -229
- package/package.json +2 -2
- package/dist/chunk-EYDJ6I7P.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context.tsx","../src/hooks/use-form-message.ts","../src/hooks/use-watch.ts","../src/field-group.tsx","../src/hooks/resolve-name.ts","../src/hooks/drag.ts","../src/hooks/use-array.ts","../src/id-prefix.tsx","../src/field-kit.tsx","../src/hooks/field-lifecycle.ts","../src/hooks/use-field.ts","../src/field-context.ts","../src/hooks/use-tree.ts","../src/components/virtual-rows.tsx","../src/components/fields.tsx","../src/hooks/use-submit.ts","../src/adapter/connect.tsx","../src/hooks/use-form.ts","../src/components/ui.tsx","../src/hooks/use-row.ts"],"names":["useContext","createContext","useSyncExternalStore","useRef","useCallback","ShikiUsageError","deepEqual","jsx","useEffect","current","key","NO_MESSAGES","useMemo","ArrayRow","TreeNodeFrame","Connected","normalizeUiSpec"],"mappings":";;;;;;;AA4BO,IAAM,WAAA,GAAc,cAAsC,IAAI;AAC9D,IAAM,eAAe,aAAA,CAA0B,EAAE,MAAM,EAAA,EAAI,KAAA,EAAO,IAAI;AACtE,IAAM,YAAA,GAAe,cAAsC,IAAI;AAC/D,IAAM,WAAA,GAAc,cAAqC,IAAI;AAM7D,IAAM,cAAA,GAAiB,cAA0D,IAAI;AAGrF,SAAS,cAAA,GAA2C;AACzD,EAAA,OAAO,gBAAmB,kBAAkB,CAAA;AAC9C;AA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EAAA,MAAM,IAAA,GAAO,gBAAgB,aAAa,CAAA;AAC1C,EAAA,MAAM,QAAQ,QAAA,EAAS;AACvB,EAAA,IAAI,KAAA,CAAM,KAAA,GAAQ,CAAA,IAAK,CAAC,MAAM,GAAA,EAAK;AACjC,IAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc;AACzC,MAAA,MAAM,IAAIA,gBAAgB,0HAA0H,CAAA;AAAA,IACtJ;AACA,IAAA,MAAM,IAAI,MAAM,0DAA0D,CAAA;AAAA,EAC5E;AACA,EAAA,MAAM,OAAO,KAAA,CAAM,IAAA;AACnB,EAAA,MAAM,MAAA,GAASD,WAAAA,CAAY,CAAC,EAAA,KAAmB,IAAA,CAAK,KAAA,CAAM,IAAI,CAAA,CAAE,MAAA,EAAgB,CAAC,IAAA,EAAM,IAAI,CAAC,CAAA;AAC5F,EAAA,OAAO,SAAS,MAAM,CAAA;AACxB","file":"chunk-A54EUYGM.js","sourcesContent":["import { createContext, useContext, type ReactNode } from 'react'\nimport type { FormEngine } from '@shikiform/core/internal'\nimport type { FormInstance } from '@shikiform/core/internal'\n\n/** React scope for relative field names. `path` is the index path of the parent object or row. */\nexport interface ScopeValue {\n path: string\n /** Row index inside its array, `-1` outside a row. */\n index: number\n /** Row id (structure key) when a row component provided it. */\n itemKey?: string\n /** Tree coordinate when a tree node provided it. */\n pos?: readonly number[]\n}\n\n/** The nearest enclosing array (`<ArrayField>` and its container): its absolute path and row key. */\nexport interface ArrayScopeValue {\n path: string\n rowKey?: string\n}\n\n/** The nearest enclosing tree (`<TreeField>`): its absolute path and the keys it was given (unset inherits). */\nexport interface TreeScopeValue {\n path: string\n childrenKey?: string\n rowKey?: string\n}\n\nexport const FormContext = createContext<FormEngine<any> | null>(null)\nexport const ScopeContext = createContext<ScopeValue>({ path: '', index: -1 })\nexport const ArrayContext = createContext<ArrayScopeValue | null>(null)\nexport const TreeContext = createContext<TreeScopeValue | null>(null)\n\n/**\n * Internal: a container's per-row wrapper (`ArrayCards` puts each row in a card). `<ArrayField>` rows are memoized,\n * so a container cannot rewrite them; it provides this and every row renders `wrap(rowContent)` inside its scope.\n */\nexport const RowWrapContext = createContext<((content: ReactNode) => ReactNode) | null>(null)\n\n/** The form provided by `<Form>` (the same object `useForm()` returned). */\nexport function useFormContext<T = any>(): FormInstance<T> {\n return useRequiredForm<T>('useFormContext()')\n}\n\n/**\n * Internal: the provided form's engine, or an error naming the caller (`useField('email')`, `<ArrayField name=\"items\">`) and the fix.\n * `useForm()` / `createForm()` only create the engine; it reaches fields through `<Form form={form}>`.\n */\nexport function useRequiredForm<T = any>(caller: string): FormEngine<T> {\n const form = useContext(FormContext)\n if (!form) {\n throw new Error(\n `[shikiform] ${caller} has no form. Render it inside <Form form={form}> (useForm / createForm). ` +\n `A form instance is not provided until <Form> wraps the fields.`,\n )\n }\n return form as FormEngine<T>\n}\n\n/** Parent path for `useField('price')` inside a row or object. */\nexport function useScope(): ScopeValue {\n return useContext(ScopeContext)\n}\n","import { useContext } from 'react'\nimport { formatMessage, type FormMessageKey, type MessageArgs } from '@shikiform/core/internal'\nimport { FormContext } from '../context'\n\n/**\n * Resolve built-in texts for the nearest form: its `messages` → `setDefaultMessages` → `zhCN`.\n * Outside a form only the app defaults apply. Component labels in `@shikiform/antd` read through this,\n * so a custom component can follow the same locale: `const t = useFormMessage(); t('submit')`.\n */\nexport function useFormMessage(): <K extends FormMessageKey>(key: K, ...params: MessageArgs<K>) => string {\n const form = useContext(FormContext)\n const overrides = form?.options.messages\n return (key, ...params) => formatMessage(overrides, key, ...params)\n}\n","import { useRef, useSyncExternalStore } from 'react'\nimport { deepEqual } from '@shikiform/core/internal'\nimport type { Draft } from '@shikiform/core/internal'\nimport { useRequiredForm } from '../context'\n\n/**\n * Subscribe to the `$` reads inside `select`.\n * An unannotated draft compiles and is untyped (`useWatch((d) => d.$submitting)`, `d` is `any`).\n * Prefer the form's typed handle. `useWatch<Values>()(select)` types the draft and still infers the result\n * (`useWatch<Values>(select)` does not: one explicit type argument stops inference of the result).\n *\n * ```tsx\n * const F = typed(form)\n * const name = F.useWatch((d) => d.name.$value) // string\n * const email = useWatch<Values>()((d) => d.email.$value) // string\n * const can = useWatch((d: Draft<Values>) => d.$canSubmit) // boolean\n * ```\n * `select={(d) => d.email.$errors}` re-renders when that field's errors change.\n * `select={(d) => d.$canSubmit}` re-renders when submit, validation, or errors change, not on unrelated keystrokes.\n * Return data, not a new function. The snapshot is cached with {@link deepEqual}.\n */\nexport function useWatch<T>(): <S>(select: (d: Draft<T>) => S) => S\nexport function useWatch<T = any, S = unknown>(select: (d: Draft<T>) => S): S\nexport function useWatch<T = any, S = unknown>(select?: (d: Draft<T>) => S): S | (<U>(select: (d: Draft<T>) => U) => U) {\n if (select === undefined) {\n return ((next: (d: Draft<T>) => S) => useWatch(next)) as <U>(select: (d: Draft<T>) => U) => U\n }\n const form = useRequiredForm<T>('useWatch()')\n const selectRef = useRef(select)\n selectRef.current = select\n const cache = useRef<{ value: S } | null>(null)\n const read = () => {\n const tracked = form.trackSelector(selectRef.current)\n const value = tracked.value\n if (cache.current && (Object.is(cache.current.value, value) || deepEqual(cache.current.value, value))) {\n return cache.current.value\n }\n cache.current = { value }\n return value\n }\n return useSyncExternalStore(\n (onStoreChange) => {\n let stops: Array<() => void> = []\n let last = ''\n const listen = () => {\n const tracked = form.trackSelector(selectRef.current)\n const key = tracked.deps.join('|')\n if (key === last && stops.length) return\n for (const stop of stops) stop()\n stops =\n tracked.deps.length > 0\n ? tracked.deps.map((dep) =>\n form.subscribeDep(dep, () => {\n listen()\n onStoreChange()\n }),\n )\n : [form.subscribeDebug(onStoreChange)]\n last = key\n }\n listen()\n return () => {\n for (const stop of stops) stop()\n }\n },\n read,\n read,\n )\n}\n","import { createContext, useCallback, useContext, useEffect, useMemo, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { FieldError } from '@shikiform/core/internal'\nimport type { FormEngine } from '@shikiform/core/internal'\nimport { useRequiredForm } from './context'\nimport { useWatch } from './hooks/use-watch'\n\n/**\n * A set of field paths collected from the JSX below a {@link FieldGroup}: every `<Field>` / `useField(name)` /\n * `<ArrayField>` mounted inside registers its absolute path while mounted (nested groups register into every\n * enclosing group). It owns no state of the form; it only answers \"which fields are inside this region\".\n *\n * Layout containers use it to badge a tab with the errors of its fields (`FormTab`, `FormCollapse`) and to validate\n * one step (`FormStep`: `form.validate(group.paths())`). A pure-layout `FormItem` could aggregate its children's\n * errors the same way.\n */\nexport interface FieldGroupHandle {\n /** Absolute paths mounted inside the group, in mount order. A path mounted twice is listed once. */\n paths(): string[]\n /** Called after a path is added or removed. */\n subscribe(listener: () => void): () => void\n /** Bumped on every add / remove (a `useSyncExternalStore` snapshot). */\n version(): number\n}\n\n/** Internal: the registry behind a {@link FieldGroupHandle}. */\nexport class FieldGroupStore implements FieldGroupHandle {\n private counts = new Map<string, number>()\n private listeners = new Set<() => void>()\n private ver = 0\n\n paths = (): string[] => [...this.counts.keys()]\n version = (): number => this.ver\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => {\n this.listeners.delete(listener)\n }\n }\n\n /** Register `path` until the returned function runs. */\n add(path: string): () => void {\n this.counts.set(path, (this.counts.get(path) ?? 0) + 1)\n this.changed()\n let done = false\n return () => {\n if (done) return\n done = true\n const left = (this.counts.get(path) ?? 1) - 1\n if (left > 0) this.counts.set(path, left)\n else this.counts.delete(path)\n this.changed()\n }\n }\n\n private changed(): void {\n this.ver++\n for (const listener of [...this.listeners]) listener()\n }\n}\n\n/** Internal: `add(path)` registers into the nearest group and every group around it. */\ninterface GroupRegistrar {\n add(path: string): () => void\n}\n\nexport const FieldGroupContext = createContext<GroupRegistrar | null>(null)\n\n/** Create a group handle that lives as long as the component (pass it to {@link FieldGroup}). */\nexport function useFieldGroup(): FieldGroupHandle {\n const [group] = useState(() => new FieldGroupStore())\n return group\n}\n\n/**\n * Collect the fields rendered inside `children` into `value` (from {@link useFieldGroup}). Renders no DOM.\n *\n * ```tsx\n * const group = useFieldGroup()\n * const errors = useFieldGroupErrors(group) // FieldError[] of the fields inside\n * <FieldGroup value={group}><Field name=\"a\" … /><Field name=\"b\" … /></FieldGroup>\n * await form.validate(group.paths()) // validate only those fields\n * ```\n */\nexport function FieldGroup({ value, children }: { value: FieldGroupHandle; children?: ReactNode }) {\n const parent = useContext(FieldGroupContext)\n const registrar = useMemo<GroupRegistrar>(\n () => ({\n add(path) {\n const own = (value as FieldGroupStore).add(path)\n const up = parent?.add(path)\n return () => {\n own()\n up?.()\n }\n },\n }),\n [value, parent],\n )\n return <FieldGroupContext.Provider value={registrar}>{children}</FieldGroupContext.Provider>\n}\n\n/** Internal: register `path` with the enclosing groups while mounted (`useField(name)`, `useArrayField(name)`). No path skips it. */\nexport function useFieldGroupRegistration(path: string | undefined): void {\n const registrar = useContext(FieldGroupContext)\n useEffect(() => (path && registrar ? registrar.add(path) : undefined), [registrar, path])\n}\n\nconst ids = new WeakMap<object, number>()\nlet nextId = 0\nfunction groupId(group: FieldGroupHandle): number {\n let id = ids.get(group)\n if (id === undefined) ids.set(group, (id = ++nextId))\n return id\n}\n\nfunction inPaths(path: string, paths: readonly string[]): boolean {\n for (const one of paths) if (path === one || path.startsWith(one + '.') || one === '') return true\n return false\n}\n\n/** Internal: the shown errors of each group (one entry per field with messages), re-rendering when they change. */\nexport function useGroupsErrors(form: FormEngine<any, any>, groups: readonly FieldGroupHandle[]): FieldError[][] {\n const key = groups.map(groupId).join(',')\n const subscribe = useCallback(\n (onChange: () => void) => {\n const stops = groups.map((group) => group.subscribe(onChange))\n return () => {\n for (const stop of stops) stop()\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key],\n )\n const snapshot = () => groups.map((group) => group.version()).join(',')\n const versions = useSyncExternalStore(subscribe, snapshot, snapshot)\n const select = useCallback(\n (d: any) => {\n // Root `$errors` is a dependency on every error change; the filter decides whether this group changed.\n void d.$errors\n const all = form.errors\n return groups.map((group) => {\n const paths = group.paths()\n return paths.length ? all.filter((error) => inPaths(error.path, paths)) : []\n })\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [form, versions, key],\n )\n return useWatch(select)\n}\n\n/**\n * The errors of the fields inside a {@link FieldGroup}: one `{ path, messages }` per field with shown errors\n * (hidden, disabled and read-only fields excluded), re-rendering only when that list changes. `errors.length` is a tab's badge count.\n */\nexport function useFieldGroupErrors(group: FieldGroupHandle): FieldError[] {\n const form = useRequiredForm('useFieldGroupErrors()')\n return useGroupsErrors(form, [group])[0]!\n}\n","import type { FormEngine } from '@shikiform/core/internal'\nimport { ShikiUsageError } from '@shikiform/core/internal'\nimport { getAt, joinPath } from '@shikiform/core/internal'\nimport type { ScopeValue } from '../context'\n\n/**\n * Resolve a field name against the enclosing `<ObjectField>` / `<ArrayField>` / row scope (names are always\n * relative to it). In development, a name that repeats the scope (`items.0.name` inside the `items.0` row) throws\n * {@link ShikiUsageError} instead of silently binding `items.0.items.0.name` (#30): it fires only when the joined\n * path holds no value while the name read from the root does.\n */\nexport function resolveName(form: FormEngine<any, any>, scope: ScopeValue, name: string): string {\n const path = joinPath(scope.path, name)\n if (process.env.NODE_ENV !== 'production' && scope.path && name.startsWith(scope.path + '.')) {\n const values = form.values\n if (getAt(values, path) === undefined && getAt(values, name) !== undefined) {\n const relative = name.slice(scope.path.length + 1)\n throw new ShikiUsageError(\n `Field name \"${name}\" is inside the \"${scope.path}\" scope, so it resolves to \"${path}\". ` +\n `Names are relative to the enclosing ObjectField / ArrayField / row: write name=\"${relative}\" ` +\n `(typed: the row / object handles from typed(form), e.g. row.Field).`,\n )\n }\n }\n return path\n}\n","import { useCallback, useRef, type DragEvent } from 'react'\n\n/** HTML5 drag-and-drop props for one row / node: the same object serves as drag source and drop target. */\nexport interface DragProps {\n draggable: true\n onDragStart: (event: DragEvent) => void\n onDragOver: (event: DragEvent) => void\n onDrop: (event: DragEvent) => void\n}\n\n/**\n * Shared drag plumbing behind `ArrayHandle.dragProps` / the tree handle's `dragProps`. The drag source is kept on a\n * ref (Playwright's drag does not always keep `dataTransfer`), with `dataTransfer` text as the fallback.\n * The `dataTransfer` payload carries the source structure's `key` (`<path>|<position>`), so a drop on a different\n * array / tree is ignored instead of moving that structure's own rows.\n * The returned function only changes when `key` changes, so it never re-renders anyone by itself.\n */\nexport function useDragProps<P>(key: string, move: (from: P, to: P) => unknown, encode: (at: P) => string, decode: (raw: string) => P | undefined) {\n const decodePayload = (raw: string): P | undefined => {\n const sep = raw.indexOf('|')\n if (sep < 0 || raw.slice(0, sep) !== key) return undefined\n return decode(raw.slice(sep + 1))\n }\n const fromRef = useRef<P | null>(null)\n const moveRef = useRef(move)\n moveRef.current = move\n const codec = useRef({ encode, decode })\n codec.current = { encode, decode }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback(\n (at: P): DragProps => ({\n draggable: true,\n onDragStart: (event) => {\n event.stopPropagation()\n fromRef.current = at\n event.dataTransfer?.setData('text/plain', `${key}|${codec.current.encode(at)}`)\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move'\n },\n onDragOver: (event) => {\n event.preventDefault()\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'move'\n },\n onDrop: (event) => {\n event.preventDefault()\n event.stopPropagation()\n const raw = event.dataTransfer?.getData('text/plain')\n const from = fromRef.current ?? (raw ? decodePayload(raw) : undefined)\n fromRef.current = null\n if (from === undefined || from === null) return\n if (codec.current.encode(from) === codec.current.encode(at)) return\n moveRef.current(from, at)\n },\n }),\n [key],\n )\n}\n","import { useContext, useRef, useSyncExternalStore } from 'react'\nimport type { ArrayItemOf, ArrayPath } from '@shikiform/core/internal'\nimport { deepEqual, ShikiUsageError, showDraftPath } from '@shikiform/core/internal'\nimport { ArrayContext, useRequiredForm, useScope } from '../context'\nimport { useFieldGroupRegistration } from '../field-group'\nimport { resolveName } from './resolve-name'\nimport { useDragProps, type DragProps } from './drag'\n\n/** One rendered row. `key` is the row id, or a stable identity when the row has none. */\nexport interface ArrayKey {\n key: string\n index: number\n}\n\nexport type ArrayHandle<TRow> = {\n path: string\n keys: ArrayKey[]\n push: (row: TRow) => void\n insert: (index: number, row: TRow) => void\n remove: (index: number) => void\n /** `to` is the final index. */\n move: (from: number, to: number) => void\n swap: (indexA: number, indexB: number) => void\n replace: (index: number, row: TRow) => void\n /**\n * HTML5 drag-and-drop props for row `index`: spread them on the row (drop target) and on its handle (drag source).\n * Dropping row A on row B moves A to B's index. Stable per path; dragging does not re-render.\n */\n dragProps: (index: number) => DragProps\n /** This array path's own messages. Descendant fields are not included. */\n errors: readonly string[]\n warnings: readonly string[]\n}\n\n/**\n * Array handle. Subscribes to row structure (length and ids), not to cell values.\n * `keys` use the row id when the row has one, otherwise a stable object identity.\n * `to` on `move` is the final index.\n *\n * `useArrayField()` is the nearest `<ArrayField>` (Formily `ArrayBase.useArray`): a row, or the container\n * (`ArrayItems` / `ArrayCards` / `ArrayTable`, toolbar included). Nested arrays resolve to the inner one.\n * Outside an array it throws.\n *\n * `useArrayField(name)` resolves `name` against the current scope (a repeated scope prefix throws in development),\n * registers that path into the nearest `FieldGroup`, and returns the same handle.\n * `useArrayField<Values, 'rows'>('rows')` checks the name and types `push` / `replace` as one row.\n * `useArrayField<Values>('rows')` only checks the name. A bare `useArrayField('rows')` accepts any row.\n * Options are the second argument's object: `useArrayField('rows', { rowKey: 'id' })`.\n *\n * ```tsx\n * function RemoveButton() {\n * const array = useArrayField()\n * const index = useIndex()\n * return <button onClick={() => array.remove(index)}>删除</button>\n * }\n * ```\n */\nexport function useArrayField<TRow = unknown>(): ArrayHandle<TRow>\nexport function useArrayField(name: string, opts?: { rowKey?: string }): ArrayHandle<unknown>\nexport function useArrayField<TScope>(name: ArrayPath<TScope>, opts?: { rowKey?: string }): ArrayHandle<unknown>\nexport function useArrayField<TScope, N extends ArrayPath<TScope>>(\n name: N,\n opts?: { rowKey?: string },\n): ArrayHandle<ArrayItemOf<TScope, N & string>>\nexport function useArrayField(name?: string, opts?: { rowKey?: string }): ArrayHandle<unknown> {\n const ctx = useContext(ArrayContext)\n const scope = useScope()\n if (name == null && !ctx) {\n if (process.env.NODE_ENV !== 'production') {\n throw new ShikiUsageError('useArrayField() must render inside <ArrayField> (a row or its container component: ArrayItems / ArrayCards / ArrayTable).')\n }\n throw new Error('useArrayField() must render inside <ArrayField>')\n }\n const form = useRequiredForm(name != null ? `useArrayField('${name}') / <ArrayField name=\"${name}\">` : 'useArrayField()')\n let path: string | undefined\n if (name != null) {\n path = resolveName(form, scope, name)\n if (process.env.NODE_ENV !== 'production') assertArrayValue(path, form.getValue(path))\n } else {\n path = ctx?.path\n }\n useFieldGroupRegistration(name != null ? path : undefined)\n return useArrayAt(path ?? null, name != null ? opts?.rowKey : ctx?.rowKey)\n}\n\n/** `<ArrayField name=\"title\">` on a string renders no rows and no error: say so in development. */\nfunction assertArrayValue(path: string, value: unknown): void {\n if (value == null || Array.isArray(value)) return\n const shown = typeof value === 'object' ? 'an object' : `${typeof value} ${JSON.stringify(value)?.slice(0, 40)}`\n throw new ShikiUsageError(\n `<ArrayField name=\"${path}\"> / useArrayField('${path}'): ${showDraftPath(path)}.$value is ${shown}, not an array. ` +\n `Start it as an array in initialValues (\\`${path.split('.').pop()}: []\\`), or use <Field> / <ObjectField> for a non-array value.`,\n )\n}\n\n/** {@link useArrayField} for an absolute path, without field-group registration (internal: containers, `useArrayTable`). `null` subscribes to nothing. */\nexport function useArrayAt(path: string | null, rowKey?: string): ArrayHandle<unknown> {\n const form = useRequiredForm(path ? `the array '${path}'` : 'useArrayField()')\n const version = useSyncExternalStore(\n (onStoreChange) => (path ? form.subscribeStructure(path, onStoreChange) : () => {}),\n () => (path ? form.getStructureVersion(path) : 0),\n () => (path ? form.getStructureVersion(path) : 0),\n )\n void version\n if (path) form.registerArray(path, rowKey)\n const dragProps = useDragProps<number>(path ?? '', (from, to) => { if (path) form.moveArray(path, from, to) }, String, toIndex)\n const messages = useArrayMessages(path)\n const at = path ?? ''\n return {\n path: at,\n keys: path ? form.structureKeys(path, rowKey) as ArrayKey[] : [],\n push: (row: unknown) => { if (path) form.pushArray(path, row) },\n insert: (index: number, row: unknown) => { if (path) form.insertArray(path, index, row) },\n remove: (index: number) => { if (path) form.removeArray(path, index) },\n /** `to` is the final index. */\n move: (from: number, to: number) => { if (path) form.moveArray(path, from, to) },\n swap: (indexA: number, indexB: number) => { if (path) form.swapArray(path, indexA, indexB) },\n replace: (index: number, row: unknown) => { if (path) form.replaceArray(path, index, row) },\n dragProps,\n errors: messages.errors,\n warnings: messages.warnings,\n }\n}\n\n/** This array path's own messages. Subscribes to that path only, so a cell edit does not re-render. */\nfunction useArrayMessages(path: string | null): ArrayErrors {\n const form = useRequiredForm(path ? `the array '${path}'` : 'useArrayField()')\n const cache = useRef<ArrayErrors>(NO_MESSAGES)\n const read = () => {\n if (!path) return NO_MESSAGES\n const binding = form.binding(path)\n const prev = cache.current\n if (deepEqual(prev.errors, binding.errors) && deepEqual(prev.warnings, binding.warnings)) return prev\n const next = { errors: binding.errors, warnings: binding.warnings }\n cache.current = next\n return next\n }\n return useSyncExternalStore(\n (onStoreChange) => (path ? form.subscribePath(path, onStoreChange) : () => {}),\n read,\n read,\n )\n}\n\nfunction toIndex(raw: string): number | undefined {\n const index = Number(raw)\n return Number.isInteger(index) ? index : undefined\n}\n\n/** This array path's own messages. Descendant fields are not included — those render on the row fields. */\nexport interface ArrayErrors {\n errors: readonly string[]\n warnings: readonly string[]\n}\n\nconst NO_MESSAGES: ArrayErrors = { errors: [], warnings: [] }\n","import { createContext, useContext, useId, type ReactNode } from 'react'\nimport { pathDomId } from '@shikiform/core/internal'\n\nconst IdPrefixContext = createContext('')\n\n/**\n * Internal prefix for field DOM ids. `<Form>` and shadow drafts provide it.\n * Not a public component: two forms on one page must not share `id=\"email\"`.\n */\nexport function IdPrefixProvider({ prefix, children }: { prefix: string; children: ReactNode }) {\n return <IdPrefixContext.Provider value={prefix}>{children}</IdPrefixContext.Provider>\n}\n\n/** The nearest form's DOM id prefix, or `''` outside `<Form>` / a shadow draft. */\nexport function useIdPrefix(): string {\n return useContext(IdPrefixContext)\n}\n\n/**\n * Prefix for one `<Form>` (or a shadow draft, which has no `id` prop).\n * An explicit `id` wins; otherwise React `useId()`. `useId` always runs.\n */\nexport function useAutoIdPrefix(explicit?: string): string {\n const auto = useId()\n return explicit || auto\n}\n\n/** `${prefix}-${id}` when a form prefix is set. Engine ids stay unprefixed. */\nexport function prefixDomId(prefix: string, id: string): string {\n return prefix ? `${prefix}-${id}` : id\n}\n\n/** The id `<Field>` puts on a control, and the id a failed submit focuses. */\nexport function focusFieldDomId(prefix: string, path: string): string {\n return prefixDomId(prefix, pathDomId(path))\n}\n\n/** Overlay the form prefix onto a binding's `id` (path ids and `<path>--<ui>` ids). */\nexport function withDomId<T extends { id: string }>(binding: T, prefix: string): T {\n const id = prefixDomId(prefix, binding.id)\n return id === binding.id ? binding : { ...binding, id }\n}\n","import { useContext, createContext, type ComponentType, type ReactNode } from 'react'\nimport { ShikiUsageError } from '@shikiform/core/internal'\nimport { nearestName } from '@shikiform/core/internal'\n\n/**\n * Register the controls your app passes to `<Field component=\"Input\">` (module augmentation):\n *\n * ```ts\n * declare module '@shikiform/react' { interface FieldComponents { Input: typeof Input; Select: typeof Select } }\n * ```\n *\n * Without it any string is accepted. The runtime map is {@link FieldKit} / `<Form kit>`.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface FieldComponents {}\n\n/**\n * Register the decorators your app passes to `<Field decorator=\"FormItem\">`.\n * Same rule as {@link FieldComponents}: an empty interface means any string.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface FieldDecorators {}\n\n/** A component, `[Component, props]`, or a name registered in `decorators`. */\nexport type FieldKitDecorator =\n | ComponentType<any>\n | readonly [ComponentType<any> | string, Record<string, any>?]\n | string\n\n/**\n * One registration of controls and decorators. Pass it to `<FieldKit>` (several forms) or `<Form kit>` (this form).\n * A field that omits `decorator` uses `decorator` here. `decorator={false}` on the field opts out.\n * String `component` / `decorator` names look up `components` / `decorators`; a component reference does not need\n * to be in the map — it still gets the default decorator.\n */\nexport interface FieldKitSpec {\n /** Name → control. `<Field component=\"Input\" />` and `<Field component={[\"Input\", props]} />`. */\n components?: Record<string, ComponentType<any>>\n /** Name → decorator. `<Field decorator=\"FormItem\" />`. */\n decorators?: Record<string, ComponentType<any>>\n /** Used when a `<Field>` omits `decorator`. A string looks up `decorators`. */\n decorator?: FieldKitDecorator\n}\n\ninterface ResolvedKit {\n components: Record<string, ComponentType<any>>\n decorators: Record<string, ComponentType<any>>\n decorator?: ComponentType<any>\n decoratorProps?: Record<string, any>\n}\n\nconst FieldKitContext = createContext<ResolvedKit | null>(null)\n\nfunction isComponent(value: unknown): value is ComponentType<any> {\n return typeof value === 'function' || (!!value && typeof value === 'object' && !Array.isArray(value))\n}\n\nfunction lookup(table: Record<string, ComponentType<any>>, name: string, kind: 'component' | 'decorator'): ComponentType<any> {\n const found = table[name]\n if (found) return found\n const names = Object.keys(table)\n const near = nearestName(name, names)\n const slot = kind === 'component' ? 'components' : 'decorators'\n throw new ShikiUsageError(\n `[shikiform] Unknown ${kind} \"${name}\".` +\n (near ? ` Did you mean \"${near}\"?` : '') +\n (names.length ? ` Registered: ${names.join(', ')}.` : ' None are registered.') +\n ` Add it to <Form kit={{ ${slot}: { ${near ?? name} } }} /> or <FieldKit>, or pass the component instead of a string.`,\n )\n}\n\nfunction compileDecorator(spec: FieldKitDecorator, decorators: Record<string, ComponentType<any>>): { component: ComponentType<any>; props?: Record<string, any> } {\n if (typeof spec === 'string') return { component: lookup(decorators, spec, 'decorator') }\n if (Array.isArray(spec)) {\n const head = spec[0]\n const component = typeof head === 'string' ? lookup(decorators, head, 'decorator') : head\n if (!isComponent(component)) {\n throw new ShikiUsageError('[shikiform] FieldKit `decorator` tuple has no component. Pass a component or a registered name.')\n }\n return { component, props: spec[1] }\n }\n return { component: spec as ComponentType<any> }\n}\n\nfunction mergeKit(parent: ResolvedKit | null, spec: FieldKitSpec): ResolvedKit {\n const components = { ...parent?.components, ...spec.components }\n const decorators = { ...parent?.decorators, ...spec.decorators }\n let decorator = parent?.decorator\n let decoratorProps = parent?.decoratorProps\n if (spec.decorator !== undefined) {\n const resolved = compileDecorator(spec.decorator, decorators)\n decorator = resolved.component\n decoratorProps = resolved.props\n }\n return { components, decorators, decorator, decoratorProps }\n}\n\n/**\n * Register controls and a default decorator for every `<Field>` inside.\n * `<Form kit>` does the same for one form. Names are the `component` / `decorator` strings; the components you\n * already `connect()`ed are passed by reference (`component={Input}` or `component={[Input, props]}`) and still\n * pick up the default decorator. There is no second Field component.\n *\n * ```tsx\n * <FieldKit components={{ Input, Select }} decorator={FormItem}>\n * <Form form={form}>\n * <Field name=\"email\" title=\"邮箱\" component=\"Input\" />\n * <Field name=\"city\" component={[Select, { allowClear: true }]} />\n * <Field name=\"qty\" component={[InputNumber]} decorator={false} />\n * </Form>\n * </FieldKit>\n * ```\n */\nexport function FieldKit({ children, ...spec }: FieldKitSpec & { children?: ReactNode }) {\n const parent = useContext(FieldKitContext)\n return <FieldKitContext.Provider value={mergeKit(parent, spec)}>{children}</FieldKitContext.Provider>\n}\n\n/** The kit around this component, or `null` outside `<FieldKit>` / `<Form kit>`. */\nexport function useFieldKit(): ResolvedKit | null {\n return useContext(FieldKitContext)\n}\n\nfunction resolveSlot(slot: unknown, table: Record<string, ComponentType<any>> | undefined, kind: 'component' | 'decorator'): ComponentType<any> | undefined {\n if (slot == null || slot === false) return undefined\n if (typeof slot === 'string') return lookup(table ?? {}, slot, kind)\n if (isComponent(slot)) return slot\n throw new ShikiUsageError(\n `[shikiform] ${kind} must be a component, a [component, props] tuple, or a registered name. Received ${String(slot)}.`,\n )\n}\n\n/**\n * Replace string `component` / `decorator` with the registered components.\n * `defaults` (a `<Field>`, not a named UI or `<UI>`) fills a missing decorator from the kit.\n * `decorator: false` is an explicit opt-out and stays empty.\n */\nexport function withResolvedSlots<T extends { component?: unknown; decorator?: unknown; decoratorProps?: Record<string, any> }>(\n field: T,\n kit: ResolvedKit | null,\n defaults: boolean,\n): T {\n const component = resolveSlot(field.component, kit?.components, 'component')\n let decorator: ComponentType<any> | undefined\n let decoratorProps = field.decoratorProps\n if (field.decorator === false) decorator = undefined\n else if (field.decorator != null) decorator = resolveSlot(field.decorator, kit?.decorators, 'decorator')\n else if (defaults && kit?.decorator) {\n decorator = kit.decorator\n decoratorProps = { ...kit.decoratorProps, ...field.decoratorProps }\n }\n if (component === field.component && decorator === field.decorator && decoratorProps === field.decoratorProps) return field\n return { ...field, component, decorator, decoratorProps }\n}\n","import type { FormEngine } from '@shikiform/core/internal'\nimport type { FieldSpec } from '@shikiform/core/internal'\n\n/** JSX flag props. Mount-scoped: unmount restores the declaration / inheritance. */\nconst FLAG_KEYS = ['visible', 'disabled', 'readOnly', 'omit'] as const\n\n/** React's JSX validation lease. Pure binding consumers must not release another component's rules. */\nexport function applyJsxField(\n form: FormEngine<any>,\n path: string,\n spec: Pick<FieldSpec, 'rules' | 'required' | 'visible' | 'disabled' | 'readOnly' | 'omit'>,\n): (() => void) | undefined {\n const flags: Partial<Pick<FieldSpec, 'visible' | 'disabled' | 'readOnly' | 'omit'>> = {}\n for (const key of FLAG_KEYS) if (spec[key] !== undefined) flags[key] = spec[key]\n const hasFlags = FLAG_KEYS.some((key) => spec[key] !== undefined)\n if (spec.rules === undefined && spec.required === undefined) {\n // Flags are not a validation lease: they stay when this call returns no cleanup.\n if (hasFlags) form.registerField(path, { ...flags, jsx: true })\n return undefined\n }\n const lease = form.mountJsxField(path, spec)\n return () => form.releaseJsxField(path, lease)\n}\n","import { createContext, useContext, useEffect, useRef, useSyncExternalStore, type ComponentProps, type ComponentType, type ReactNode } from 'react'\nimport type { FormEngine } from '@shikiform/core/internal'\nimport type { EnumOption } from '@shikiform/core/internal'\nimport { normalizeUiSpec } from '@shikiform/core/internal'\nimport type { FieldEnum, FieldPath, FieldUiSpec, PathValue, UiName } from '@shikiform/core/internal'\nimport { uiId } from '@shikiform/core/internal'\nimport type { RulesInput } from '@shikiform/core/internal'\nimport { ShikiUsageError } from '@shikiform/core/internal'\nimport { useRequiredForm, useScope } from '../context'\nimport { useFieldGroupRegistration } from '../field-group'\nimport { applyJsxField } from './field-lifecycle'\nimport { useIdPrefix, withDomId } from '../id-prefix'\nimport { useFieldKit, withResolvedSlots, type FieldComponents, type FieldDecorators } from '../field-kit'\nimport { resolveName } from './resolve-name'\n\n/**\n * What `useField` and `<Field>` hand to an input.\n * The component re-renders only when this path's version changes, not when a sibling changes.\n */\nexport interface FieldBinding<TValue> {\n path: string\n value: TValue\n /**\n * Method syntax is bivariant, so `FieldBinding<string>` can be passed to a helper typed as\n * `FieldBinding<string | number>` or `FieldBinding<unknown>`. `value` stays covariant: a `string` binding is not a\n * `number` binding. Calling `onChange` with a wider value is the same tradeoff React uses for event handlers.\n */\n onChange(value: TValue): void\n onBlur(): void\n errors: string[]\n warnings: string[]\n /** Effective render flag (OR-inherited). `false` does not render; the value is still submitted unless `omit`. */\n visible: boolean\n /** Effective disabled (OR-inherited). The preview wins when `readOnly` is also set. */\n disabled: boolean\n /** Effective read-only (OR-inherited). Renders the preview. Wins over `disabled`. */\n readOnly: boolean\n /** This field is left out of submit. Not inherited. */\n omit: boolean\n required: boolean\n /** True after blur. `reset` clears it. */\n touched: boolean\n /** The value differs from its initial value (deep compare). Changing it back clears it. */\n dirty: boolean\n /** Sticky: a user edit happened since the last reset. A reaction writing `$value` does not set it. */\n edited: boolean\n /** True while an async rule or schema for this field is in flight. */\n validating: boolean\n options: EnumOption[]\n loading: boolean\n id: string\n /** Decorator label. Reaction `$title` > JSX `title` > `fields.x.title`. */\n title: ReactNode\n /** Decorator help text. Reaction `$description` > JSX > `fields`. */\n description: ReactNode\n /** The control `<Field>` renders (from the `component` slot). */\n component: ComponentType<any> | undefined\n /** The wrapper `<Field>` renders (from the `decorator` slot). */\n decorator: ComponentType<any> | undefined\n /** Props for the control: `fields` ← JSX ← reaction (`$componentProps`), deep-merged. */\n componentProps: Record<string, any>\n /** Props for the decorator: `fields` ← JSX ← reaction (`$decoratorProps`), deep-merged. */\n decoratorProps: Record<string, any>\n /**\n * The UI instance name when this binding comes from `<Field name ui=\"echo\">` / `useField(name, { ui })`: value,\n * errors and `onChange` are the field's; visible, disabled, readOnly, title, props and `id` (`<prefix>-<path>--<ui>`) are the instance's.\n */\n ui?: string\n}\n\n/**\n * Internal (re-exported by `../field-context`, never from a package entry). The field a `<Field>` is rendering; `useField()` with no name reads it (Formily's field context).\n */\nexport const FieldContext = createContext<FieldBinding<any> | null>(null)\n\n/**\n * A `component` / `decorator` slot: the component, or `[Component, props]` (Formily style). On `<Field>` / `typed().Field`\n * / `row.Field` / `<UI>`, `C` is inferred from the component and the props are checked against it (all optional: the field\n * supplies value / onChange); `[InputNumber, { min: 'zero' }]` does not compile.\n */\nexport type FieldSlot<C extends ComponentType<any> = ComponentType<any>> =\n | C\n | readonly [C]\n | readonly [C, SlotProps<C> | undefined]\n\n/** The props half of a slot tuple: the component's own props, all optional, plus `data-*` attributes (as in JSX). */\nexport type SlotProps<C extends ComponentType<any>> = Partial<ComponentProps<C>> & { [key: `data-${string}`]: unknown }\n\ntype IsAny<T> = 0 extends 1 & T ? true : false\n\n/**\n * The value a control stores on the field. `connect` sets `__shikiAccepts` from `format` / `parse` when those convert\n * the value (a date string, not a Dayjs). Otherwise it is the control's `value` prop. An explicit\n * `__shikiAccepts` on the component wins over the wide prop (antd `InputNumber` accepts `string | number` but stores\n * `number | null`).\n */\nexport type ControlValue<C> = C extends { readonly __shikiAccepts: infer V }\n ? V\n : C extends ComponentType<infer P>\n ? P extends { value?: infer V }\n ? IsAny<V> extends true\n ? any\n : V\n : any\n : any\n\n/**\n * True when `V` can be passed as the control's value (`any` on either side skips the check).\n * `undefined` and `null` are ignored on the field side: `string | null` still matches Input, `boolean | null` still\n * matches Switch / Checkbox. A cleared option (`value: null`) is a separate enum check.\n */\nexport type ControlAccepts<C, V> = IsAny<V> extends true\n ? true\n : IsAny<ControlValue<C>> extends true\n ? true\n : [Exclude<V, undefined | null>] extends [ControlValue<C>]\n ? true\n : false\n\n/**\n * When the field value is not assignable to the control, the props gain a required explanation and `component`\n * becomes `never`, so the error names both types.\n */\nexport type ControlValueGuard<C, V> = ControlAccepts<C, V> extends true\n ? unknown\n : {\n component?: never\n __shikiValueMismatch: { field: V; control: ControlValue<C> }\n }\n\n/**\n * A `component` / `decorator` slot addressed by a name from {@link FieldComponents} / {@link FieldDecorators}.\n * With nothing registered, any string (and a loose props object) is accepted — the same escape hatch as an untyped\n * field name. Register the map (`declare module '@shikiform/react' { interface FieldComponents { Input: typeof Input } }`)\n * and `\"Input\"` / `[\"Input\", props]` are checked, including the props.\n */\nexport type RegisteredSlot<Registry> = [keyof Registry] extends [never]\n ? string | readonly [string] | readonly [string, Record<string, any> | undefined]\n : {\n [K in keyof Registry & string]: Registry[K] extends ComponentType<any>\n ? K | readonly [K] | readonly [K, SlotProps<Registry[K]> | undefined]\n : never\n }[keyof Registry & string]\n\n/** `<Field component=\"Input\">` when {@link FieldComponents} is augmented; any string otherwise. */\nexport type RegisteredComponentSlot = RegisteredSlot<FieldComponents>\n/** `<Field decorator=\"FormItem\">` when {@link FieldDecorators} is augmented; any string otherwise. */\nexport type RegisteredDecoratorSlot = RegisteredSlot<FieldDecorators>\n\n/**\n * Field options a hook caller can pass. Same semantics as the `<Field>` props of the same name:\n * `rules` / `required` are a mount-scoped lease (applied while the calling component is mounted, released on unmount,\n * restoring a declaration, item template, or `$rules`). `visible` / `disabled` / `readOnly` / `omit` are the same lease.\n */\nexport interface UseFieldOptions<TValue = any> {\n /**\n * A second (third …) UI of the same field: `<Field name=\"amount\" ui=\"slider\" component={[Slider]} />`.\n * Shares the value, errors and rules; has its own visible / disabled / readOnly / title / props, addressed in effects as\n * `d.amount.$ui('slider')` (unset falls back to the field). Own DOM id `<prefix>-<path>--<ui>`.\n * `rules` / `required` / `enum` / `omit` belong on the field itself (the `<Field>` without `ui`).\n */\n ui?: UiName\n /**\n * Options for this field, inline (Formily `enum`): `[{ label, value }]`, bare primitives, or `SomeEnum.with(params)`.\n * Wins over `fields.x.enum` / item templates while the component is mounted; a reaction's `$enum` wins over it.\n * A new value (deep-compared, so an inline array is fine) is applied again; unmount or `undefined` restores the declaration.\n */\n enum?: FieldEnum<TValue>\n rules?: RulesInput<TValue>\n required?: boolean\n /** `false` does not render. Inherited (OR); explicit `false` exits a shown parent. Still submitted unless `omit`. */\n visible?: boolean\n /** Gray the control out. Inherited (OR); explicit `false` exits. Skips validation. */\n disabled?: boolean\n /** Render the preview. Inherited (OR); explicit `false` exits. Wins over `disabled`. Skips validation. */\n readOnly?: boolean\n /** Leave this field out of submit. Not inherited. */\n omit?: boolean\n /**\n * UI state, the render-time JSX layer: not stored on the model, so inline objects and handlers are free.\n * A reaction (`$title`, `$componentProps.x = …`) wins over it; it wins over `fields` declarations.\n */\n title?: ReactNode\n description?: ReactNode\n /** The control, `[Control, props]`, or a name from {@link FieldComponents} (`\"Input\"`, `[\"Input\", props]`). */\n component?: FieldSlot | RegisteredComponentSlot\n /**\n * The wrapper, `[Decorator, props]`, a name from {@link FieldDecorators}, or `false` to opt out of the\n * default decorator from `<FieldKit>` / `<Form kit>`.\n */\n decorator?: FieldSlot | RegisteredDecoratorSlot | false\n}\n\n/**\n * Subscribe to one field. This is the primitive every field component (`<Field>`, the Ant Design\n * `connect` adapter, `FormItem`) is built on.\n * Inside a row whose scope is `items.0`, `useField('price')` is `items.0.price`.\n *\n * Pass `options` to own the field's JSX-level config from a hook: `useField('email', { rules: z.string().email() })`\n * behaves exactly like `<Field name=\"email\" rules={z.string().email()}>`. UI options (`title`, `component`,\n * `decorator`, …) are merged into the returned binding the same way `<Field>` merges them.\n *\n * A dynamic `string` name returns `FieldBinding<any>` so a column renderer can share one component.\n * `useField<Row>('price')` rejects a key `Row` does not have. That value is the union of `Row`'s fields.\n * `useField<Row, 'price'>('price')` types `field.value` as that property.\n *\n * With no name, `useField()` returns the field the nearest `<Field>` is rendering (Formily's\n * `useField()`): this is how a custom input, decorator, or table cell reads its field without repeating the name.\n * `useField<string>()` types `field.value`. Outside a field it throws a `ShikiUsageError` naming the fix.\n * A call site either always passes a name or never does (the two forms use different hooks).\n */\nexport function useField<TValue = any>(): FieldBinding<TValue>\nexport function useField(name: string, options?: UseFieldOptions): FieldBinding<any>\nexport function useField<TScope>(name: FieldPath<TScope>, options?: UseFieldOptions<PathValue<TScope, FieldPath<TScope> & string>>): FieldBinding<PathValue<TScope, FieldPath<TScope> & string>>\nexport function useField<TScope, N extends FieldPath<TScope>>(name: N, options?: UseFieldOptions<PathValue<TScope, N & string>>): FieldBinding<PathValue<TScope, N & string>>\nexport function useField(name?: string, options?: UseFieldOptions): FieldBinding<any> {\n const current = useContext(FieldContext)\n if (name === undefined) {\n if (!current) throw new ShikiUsageError(NO_FIELD)\n return current\n }\n const kit = useFieldKit()\n const form = useRequiredForm(`useField('${String(name)}') / <Field name=\"${String(name)}\">`)\n const prefix = useIdPrefix()\n const scope = useScope()\n const path = resolveName(form, scope, String(name))\n const ui = options?.ui\n if (ui && process.env.NODE_ENV !== 'production') warnInstanceOptions(path, ui, options!)\n const spec = options && !ui\n ? {\n rules: options.rules,\n required: options.required,\n visible: options.visible,\n disabled: options.disabled,\n readOnly: options.readOnly,\n omit: options.omit,\n }\n : undefined\n const ownsValidation = !!spec && (spec.rules !== undefined || spec.required !== undefined)\n const latestSpec = useRef(spec)\n latestSpec.current = spec\n if (spec) applyJsxField(form, path, spec)\n useEffect(() => {\n // Re-apply on effect setup as well, including React's setup/cleanup/setup probe.\n // Pure binding consumers (no options) get no cleanup and cannot release another field's lease.\n const current = latestSpec.current\n return current ? applyJsxField(form, path, current) : undefined\n }, [form, path, ownsValidation])\n useJsxEnum(form, path, ui ? undefined : options?.enum)\n useFieldGroupRegistration(path)\n const version = useSyncExternalStore(\n (onStoreChange) => form.subscribePath(path, onStoreChange),\n () => form.getPathVersion(path),\n () => form.getPathVersion(path),\n )\n void version\n useUiNode(form, path, ui, 'field')\n form.registerField(path, {})\n if (ui) {\n // A second UI of a field brings its own decorator; the kit default is for the field itself.\n return withResolvedSlots(withDomId(form.uiBinding(path, ui, uiJsx(options!, path), 'field') as unknown as FieldBinding<any>, prefix), kit, false)\n }\n return withResolvedSlots(withDomId(form.binding(path, options && uiLayer(options, path)) as FieldBinding<any>, prefix), kit, true)\n}\n\nconst NO_UI = () => () => {}\nconst ZERO = () => 0\n\n/**\n * Internal: a mounted named UI (`<Field ui>` / `<UI>`): subscribes to its own state, claims (path, name) while\n * mounted, and tells the form React has mounted (so `$ui` writes to names that never mount warn once).\n */\nexport function useUiNode(form: FormEngine<any, any>, path: string, ui: string | undefined, kind: 'field' | 'node'): void {\n const id = ui ? uiId(path, ui) : ''\n const version = useSyncExternalStore(\n ui ? (onStoreChange) => form.subscribePath(id, onStoreChange) : NO_UI,\n ui ? () => form.getPathVersion(id) : ZERO,\n ui ? () => form.getPathVersion(id) : ZERO,\n )\n void version\n useEffect(() => {\n form.markUiReady()\n return ui ? form.claimUi(path, ui, kind) : undefined\n }, [form, path, ui, kind])\n}\n\nconst warnedInstance = new Set<string>()\n\nfunction warnInstanceOptions(path: string, ui: string, options: UseFieldOptions): void {\n const owned = (['rules', 'required', 'enum', 'omit'] as const).filter((key) => options[key] !== undefined)\n const key = `${path}#${ui}`\n if (!owned.length || warnedInstance.has(key)) return\n warnedInstance.add(key)\n console.warn(\n `[shikiform] <Field name=\"${path}\" ui=\"${ui}\"> ignores ${owned.join(', ')}: a UI instance shares the field's ` +\n `value, rules and options. Put ${owned.join(' / ')} on the <Field name=\"${path}\"> without ui (or in fields / a reaction).`,\n )\n}\n\n/**\n * The `enum` option: a static list is applied during render (first paint has the options), the commit starts an\n * `EnumSource` load and applies `enumPolicy` to an update. Released on unmount, on a path change, or when the\n * option goes back to `undefined`; only the model this component leased is released (rows move with their models).\n */\nfunction useJsxEnum(form: FormEngine<any, any>, path: string, input: unknown): void {\n const has = input !== undefined\n const lease = useRef<unknown>(undefined)\n const latest = useRef(input)\n latest.current = input\n if (has) lease.current = form.applyJsxEnum(path, input, 'render')\n useEffect(() => {\n if (latest.current !== undefined) lease.current = form.applyJsxEnum(path, latest.current, 'commit')\n })\n useEffect(() => {\n if (!has) return\n return () => form.releaseJsxEnum(path, lease.current)\n }, [form, path, has])\n}\n\nconst NO_FIELD =\n '[shikiform] useField() without a name reads the surrounding <Field>, but this component is not inside one. ' +\n \"Render it inside <Field name=\\\"…\\\"> (or as its component / decorator / children), \" +\n \"or pass a name: useField('email').\"\n\nfunction uiJsx(options: UseFieldOptions, path: string) {\n return {\n ...uiLayer(options, path),\n visible: options.visible,\n disabled: options.disabled,\n readOnly: options.readOnly,\n }\n}\n\nfunction uiLayer(options: UseFieldOptions, path: string): FieldUiSpec | undefined {\n const { title, description, component, decorator } = options\n if (title === undefined && description === undefined && component === undefined && decorator === undefined) return undefined\n return normalizeUiSpec({ title, description, component, decorator }, `<Field name=\"${path}\"${options.ui ? ` ui=\"${options.ui}\"` : ''}>`) as FieldUiSpec\n}\n","import { useContext } from 'react'\nimport { FieldContext, type FieldBinding } from './hooks/use-field'\n\n/** Internal: the field context `<Field>` provides. Not exported from any package entry. */\nexport { FieldContext }\n\n/**\n * Internal, outside-field tolerant read: the surrounding field, or `null`. For components (`FormItem`, `connect`)\n * that throw their own, more specific error. Public code uses `useField()` with no name.\n */\nexport function useFieldContextOrNull<TValue = any>(): FieldBinding<TValue> | null {\n return useContext(FieldContext) as FieldBinding<TValue> | null\n}\n","import { useCallback, useContext, useRef, useSyncExternalStore } from 'react'\nimport type { Draft, MoveResult, Pos } from '@shikiform/core/internal'\nimport { deepEqual, ShikiUsageError } from '@shikiform/core/internal'\nimport { TreeContext, useRequiredForm, useScope } from '../context'\nimport { useFieldGroupRegistration } from '../field-group'\nimport { resolveName } from './resolve-name'\nimport { useDragProps, type DragProps } from './drag'\nimport { useWatch } from './use-watch'\n\n/** Options for a named {@link useTreeField}. Omitted keys keep a registration that is already there. */\nexport interface TreeOptions {\n childrenKey?: string\n rowKey?: string\n}\n\n/**\n * Edits on one tree. Field models follow the node id.\n * `path` is always the thing this handle points at: the tree root for `useTreeField(name)`, the current node for `useTreeField()`.\n * `treePath` is always the tree root (same as `path` on a root handle).\n * `errors` / `warnings` are that path's own messages, not descendant fields.\n * `value` is the current root array (`[]` when the stored value is not an array).\n * `move(from, to)` uses final `pos` coordinates and refuses a move into a descendant (the result says why).\n * `dragProps(pos)` is the HTML5 drag-and-drop props for the node at that coordinate; dropping A on B is `move(A, B)`.\n */\nexport interface TreeHandle<TNode = unknown> {\n /** What this handle points at. Root handle: the tree root. Node handle: the current node. */\n path: string\n /** The tree root. Equal to `path` on a root handle. */\n treePath: string\n /** This path's own messages. Descendant fields are not included. */\n errors: readonly string[]\n warnings: readonly string[]\n value: TNode[]\n /** Append `node` at the root, or as the last child of `parentPos`. A missing children array is created. */\n push: (node: TNode, parentPos?: Pos) => void\n /** Insert `node` so it sits at `pos`. Later siblings shift. */\n insert: (pos: Pos, node: TNode) => void\n /** Remove the node at `pos`. Its field model is dropped. */\n remove: (pos: Pos) => void\n /** Replace the node at `pos`. The previous node's field model is dropped. */\n replace: (pos: Pos, node: TNode) => void\n /** `to` is the final `pos`. Refuses a move into the node's own descendant. */\n move: (from: Pos, to: Pos) => MoveResult\n /** HTML5 drag-and-drop props for the node at `pos`. Dropping A on B is `move(A, B)`. */\n dragProps: (pos: Pos) => DragProps\n}\n\n/**\n * `useTreeField()` inside a node: the current node plus the same tree edits.\n * `path` is this node's path (`items.0.children.1`). `treePath` is the tree root.\n * `errors` / `warnings` are this node's own messages. `value` is the enclosing tree.\n * `dragProps()` with no argument targets this node.\n */\nexport interface TreeNodeHandle<TNode = unknown> extends TreeHandle<TNode> {\n /** This node's path, not the tree root. */\n path: string\n pos: Pos\n index: number\n record: TNode\n treePath: string\n dragProps: (pos?: Pos) => DragProps\n}\n\n/**\n * One tree hook.\n *\n * `useTreeField(name)` resolves `name` against the current scope and returns the tree.\n * `path` and `treePath` are both the root. It registers that path into the nearest `FieldGroup`.\n *\n * `useTreeField()` takes the nearest `<TreeField>` node: `path` is the node, `treePath` is the root,\n * plus `pos`, `index`, `record`, and the tree's `push` / `insert` / `remove` / `replace` / `move` / `dragProps`.\n * Outside a node it throws.\n */\nexport function useTreeField<TNode = unknown>(): TreeNodeHandle<TNode>\nexport function useTreeField(name: string, opts?: TreeOptions): TreeHandle<unknown>\nexport function useTreeField(name?: string, opts?: TreeOptions): TreeHandle<unknown> | TreeNodeHandle<unknown> {\n const ctx = useContext(TreeContext)\n const scope = useScope()\n if (name == null && !scope.pos) {\n if (process.env.NODE_ENV !== 'production') {\n throw new ShikiUsageError('useTreeField() must render inside a tree node (<TreeField>).')\n }\n throw new Error('useTreeField() must render inside a tree node (<TreeField>)')\n }\n const form = useRequiredForm(name != null ? `useTreeField('${name}') / <TreeField name=\"${name}\">` : 'useTreeField()')\n const treePath = name != null ? resolveName(form, scope, name) : (ctx?.path ?? form.treeRoot(scope.path) ?? scope.path)\n const options = name != null ? opts : { childrenKey: ctx?.childrenKey, rowKey: ctx?.rowKey }\n useFieldGroupRegistration(name != null ? treePath : undefined)\n // A node does not subscribe to the whole tree. `<TreeField>` repaints structure and keeps\n // unchanged sibling elements; this node re-renders when its own record or position changes.\n const tree = useTreeAt(treePath, options, name != null)\n const nodePath = name == null ? scope.path : ''\n const own = useOwnMessages(nodePath || null)\n const record = useWatch(useCallback((d: Draft<any>) => (nodePath ? form.query(nodePath).$value : undefined), [form, nodePath]))\n const pos = scope.pos as Pos | undefined\n const nodeDrag = useCallback((at?: Pos) => tree.dragProps(at ?? pos ?? []), [tree.dragProps, pos])\n if (name != null) return tree\n return {\n ...tree,\n path: scope.path,\n treePath: tree.treePath,\n errors: own.errors,\n warnings: own.warnings,\n pos: pos ?? [],\n index: pos ? (pos[pos.length - 1] ?? scope.index) : scope.index,\n record,\n dragProps: nodeDrag,\n }\n}\n\n/**\n * {@link useTreeField} for an absolute path, without field-group registration. `null` subscribes to nothing.\n * `subscribe` is false for the current node: structure paints from the named tree hook, and this call\n * only reads the value at render time.\n */\nexport function useTreeAt(path: string | null, opts?: TreeOptions, subscribe = true): TreeHandle<unknown> {\n const form = useRequiredForm(path ? `the tree '${path}'` : 'useTreeField()')\n if (path) form.registerTree(path, opts)\n const version = useSyncExternalStore(\n (onStoreChange) => (path && subscribe ? form.subscribeStructure(path, onStoreChange) : () => {}),\n () => (path && subscribe ? form.getStructureVersion(path) : 0),\n () => (path && subscribe ? form.getStructureVersion(path) : 0),\n )\n void version\n const value = path ? form.getValue(path as never) as unknown : undefined\n const dragProps = useDragProps<Pos>(path ?? '', (from, to) => { if (path) form.moveTree(path, from, to) }, (pos) => pos.join('.'), toPos)\n const messages = useOwnMessages(subscribe ? path : null)\n const at = path ?? ''\n return {\n path: at,\n treePath: at,\n errors: messages.errors,\n warnings: messages.warnings,\n value: Array.isArray(value) ? (value as unknown[]) : [],\n push: (node: unknown, parentPos?: Pos) => { if (path) form.pushTree(path, node, parentPos) },\n insert: (pos: Pos, node: unknown) => { if (path) form.insertTree(path, pos, node) },\n remove: (pos: Pos) => { if (path) form.removeTree(path, pos) },\n replace: (pos: Pos, node: unknown) => { if (path) form.replaceTree(path, pos, node) },\n move: (from: Pos, to: Pos): MoveResult => (path ? form.moveTree(path, from, to) : { ok: false }),\n dragProps,\n }\n}\n\n/** This path's own messages. Subscribes to that path only, so a descendant edit does not re-render. */\nfunction useOwnMessages(path: string | null): { errors: readonly string[]; warnings: readonly string[] } {\n const form = useRequiredForm(path ? `the tree '${path}'` : 'useTreeField()')\n const cache = useRef(NO_MESSAGES)\n const read = () => {\n if (!path) return NO_MESSAGES\n const binding = form.binding(path)\n const prev = cache.current\n if (deepEqual(prev.errors, binding.errors) && deepEqual(prev.warnings, binding.warnings)) return prev\n const next = { errors: binding.errors, warnings: binding.warnings }\n cache.current = next\n return next\n }\n return useSyncExternalStore(\n (onStoreChange) => (path ? form.subscribePath(path, onStoreChange) : () => {}),\n read,\n read,\n )\n}\n\nconst NO_MESSAGES = { errors: [] as readonly string[], warnings: [] as readonly string[] }\n\nfunction toPos(raw: string): Pos | undefined {\n const pos = raw.split('.').map(Number)\n return pos.every(Number.isInteger) ? pos : undefined\n}\n","import { useRef, type ReactNode } from 'react'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\n/**\n * Windowed list. `@tanstack/react-virtual` is the scroll engine.\n * Pass the row as `children(index)` — the row should subscribe to its own fields,\n * so a cell edit does not re-render the other mounted rows.\n */\nexport function VirtualRows({\n count,\n height,\n rowHeight = 40,\n overscan = 4,\n children,\n}: {\n count: number\n height: number\n rowHeight?: number\n overscan?: number\n children: (index: number) => ReactNode\n}) {\n const parentRef = useRef<HTMLDivElement>(null)\n const virtualizer = useVirtualizer({\n count,\n getScrollElement: () => parentRef.current,\n estimateSize: () => rowHeight,\n overscan,\n })\n const items = virtualizer.getVirtualItems()\n return (\n <div ref={parentRef} data-virtual-scroll=\"true\" style={{ height, overflow: 'auto', position: 'relative' }}>\n <div style={{ height: virtualizer.getTotalSize(), position: 'relative' }}>\n {items.map((item) => (\n <div\n key={item.index}\n data-virtual-index={item.index}\n style={{ position: 'absolute', top: 0, left: 0, width: '100%', transform: `translateY(${item.start}px)` }}\n >\n {children(item.index)}\n </div>\n ))}\n </div>\n </div>\n )\n}\n","import { memo, useContext, useEffect, useMemo, useRef, type ComponentProps, type ComponentType, type FormEvent, type FormHTMLAttributes, type ReactNode } from 'react'\nimport { isFieldErrors, SubmitSupersededError } from '@shikiform/core'\nimport { engineOf } from '@shikiform/core/internal'\nimport type { ArrayPath, Draft, FieldEnum, FieldError, FieldPath, FormInstance, PathValue, UiName } from '@shikiform/core/internal'\nimport type { RulesInput } from '@shikiform/core/internal'\nimport { pathOf, type Pos } from '@shikiform/core/internal'\nimport { ArrayContext, FormContext, RowWrapContext, ScopeContext, TreeContext, useRequiredForm, useScope } from '../context'\nimport { useArrayField } from '../hooks/use-array'\nimport { FieldContext } from '../field-context'\nimport { useField, type ControlValueGuard, type FieldBinding, type FieldSlot, type RegisteredComponentSlot, type RegisteredDecoratorSlot } from '../hooks/use-field'\nimport { useTreeField } from '../hooks/use-tree'\nimport { useWatch } from '../hooks/use-watch'\nimport { resolveName } from '../hooks/resolve-name'\nimport { ShikiUsageError } from '@shikiform/core/internal'\nimport { emptySlot } from '@shikiform/core/internal'\nimport { focusFieldDomId, IdPrefixProvider, useAutoIdPrefix } from '../id-prefix'\nimport { FieldKit, type FieldKitSpec } from '../field-kit'\nimport { VirtualRows } from './virtual-rows'\n\nconst ROOT_SCOPE = { path: '', index: -1 }\n\n/** Submit callbacks of `<Form>` (and the antd `Submit` button's own `onSubmit`). */\nexport interface FormSubmitHandlers<T> {\n /** Called with the submit values after validation passes. May be async; the submit waits for it. */\n onSubmit?: (values: T) => void | Promise<void>\n /** Called with the errors when validation fails (`submit` / `validate` reject `FieldError[]`). */\n onInvalid?: (errors: FieldError[]) => void\n /**\n * Called when `onSubmit` (or a form-level `validate`) throws or rejects.\n * Without it the error is reported with `console.error`; it never becomes an unhandled rejection.\n * Includes `SubmitUnstableError` (values never settled). A `SubmitSupersededError` is swallowed:\n * the newer submit owns that outcome.\n */\n onSubmitError?: (error: unknown) => void\n}\n\n/** Native `<form>` attributes `<Form>` passes through (`id`, `className`, `noValidate`, `aria-*` …). */\nexport type FormDomProps = Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit' | 'onInvalid' | 'children'>\n\n/** `<Form>` props. `onSubmit` receives the form's `TSubmit` (default `T`, see `SubmitValues`). */\nexport type FormProps<T, TSubmit = T> = FormSubmitHandlers<TSubmit> & FormDomProps & {\n form: FormInstance<T, TSubmit>\n children?: ReactNode\n /**\n * Controls and the default decorator for fields in this form ({@link FieldKit}).\n * A field omits `decorator` to use `kit.decorator`; `decorator={false}` opts out.\n * `component=\"Input\"` / `component={[\"Input\", props]}` look up `kit.components`.\n */\n kit?: FieldKitSpec\n}\n\n/**\n * The native submit handler of `<Form>`: Enter, a `type=\"submit\"` button, and an external\n * `<button form={id}>` all run `form.submit(onSubmit)` and route the result to `onInvalid` / `onSubmitError`.\n */\nexport function handleFormSubmit<T, TSubmit = T>(\n form: FormInstance<T, TSubmit>,\n event: FormEvent<HTMLFormElement>,\n handlers: FormSubmitHandlers<TSubmit>,\n): void {\n event.preventDefault()\n // React bubbles synthetic events through portals: keep a nested form's submit from reaching the host form.\n event.stopPropagation()\n runSubmit(form, handlers)\n}\n\n/**\n * `form.submit(onSubmit)`, with the rejection routed to `onInvalid` / `onSubmitError`\n * (shared by `<Form>` and `Submit`). Never leaves an unhandled rejection.\n */\nexport function runSubmit<T, TSubmit = T>(form: FormInstance<T, TSubmit>, handlers: FormSubmitHandlers<TSubmit>): void {\n const pending = handlers.onSubmit ? form.submit(handlers.onSubmit) : form.submit()\n void pending.then(\n () => undefined,\n (error: unknown) => {\n if (isFieldErrors(error)) {\n handlers.onInvalid?.(error)\n return\n }\n // Replaced by a later submit: that call reports the outcome. SubmitUnstableError falls through.\n if (error instanceof SubmitSupersededError) return\n if (handlers.onSubmitError) handlers.onSubmitError(error)\n else console.error('[shikiform] onSubmit failed', error)\n },\n )\n}\n\n/**\n * Provide `form` and submit on Enter / the submit button.\n * `onInvalid` gets the errors when validation fails; `onSubmitError` gets what `onSubmit` threw.\n * When a submit or `form.validate()` fails, the first errored field inside (document order) is focused.\n * Other props go to the native `<form>`.\n * Field DOM ids are prefixed with this form's `id`, or with React `useId()` when `id` is omitted, so two forms\n * do not share `id=\"email\"`. The engine's `binding().id` stays the sanitized path (`user.name` → `user-name`);\n * the control's id is `<prefix>-user-name`.\n * `<Field>` returns null when `visible` is false after subscribing, so a mounted model stays registered.\n * `omit` still renders: the value is left out of submit only.\n * A field declared on the form, or given `$rules` / `registerField`, still validates when this component is not rendered.\n */\nexport function Form<T, TSubmit = T>({ form, children, onSubmit, onInvalid, onSubmitError, id, kit, ...rest }: FormProps<T, TSubmit>) {\n const ref = useRef<HTMLFormElement>(null)\n const prefix = useAutoIdPrefix(id)\n // A failed submit / validate focuses the first errored field (after FormTab / FormCollapse / FormStep switched).\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout> | undefined\n const stop = form.subscribeValidateFailed((errors) => {\n clearTimeout(timer)\n // Retry for a few frames: switching a pane remounts its fields (antd css-in-js, a new options array),\n // which drops a focus that landed just before the remount. Stop as soon as one landed.\n let tries = 0\n const run = () => {\n focusFirstError(ref.current, errors, prefix)\n const focused = document.activeElement\n if (focused && focused !== document.body) return\n if (++tries >= 5) return\n timer = setTimeout(run, 0)\n }\n timer = setTimeout(run, 0)\n })\n return () => {\n stop()\n clearTimeout(timer)\n }\n }, [form, prefix])\n return (\n <FormContext.Provider value={engineOf(form)}>\n <IdPrefixProvider prefix={prefix}>\n {/* A nested form (a shadow form in a row's modal) starts at its own root, not at the row's scope. */}\n <ScopeContext.Provider value={ROOT_SCOPE}>\n <form {...rest} id={id} ref={ref} onSubmit={(event) => handleFormSubmit(form, event, { onSubmit, onInvalid, onSubmitError })}>\n {kit ? <FieldKit {...kit}>{children}</FieldKit> : children}\n </form>\n </ScopeContext.Provider>\n </IdPrefixProvider>\n </FormContext.Provider>\n )\n}\n\n/**\n * Focus (and scroll to) the first element, in document order inside `root`, whose id is an errored field's DOM id\n * (`<prefix>-<sanitized path>`, so `user.name` is `<prefix>-user-name`, not the raw path). Hidden elements are\n * skipped; a non-focusable one is scrolled into view.\n */\nfunction focusFirstError(root: HTMLFormElement | null, errors: readonly FieldError[], prefix: string): void {\n if (!root) return\n let first: HTMLElement | null = null\n for (const { path } of errors) {\n if (!path) continue\n const el = root.ownerDocument.getElementById(focusFieldDomId(prefix, path))\n if (!el || !root.contains(el)) continue\n if (typeof el.checkVisibility === 'function' && !el.checkVisibility()) continue\n if (!first || first.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_PRECEDING) first = el\n }\n if (!first) return\n first.focus()\n if (root.ownerDocument.activeElement !== first) first.scrollIntoView?.({ block: 'center' })\n}\n\n/** `<Field>` props. Every prop except `name` / `children` is a {@link useField} option of the same name. */\nexport interface FieldProps<\n TScope = any,\n N extends FieldPath<TScope> = FieldPath<TScope>,\n C extends ComponentType<any> = ComponentType<any>,\n D extends ComponentType<any> = ComponentType<any>,\n> {\n /** Name relative to the current `<ObjectField>` / `<ArrayField>` / `<TreeField>` scope. */\n name: N\n /**\n * Another UI of the same field (`d.name.$ui('echo')` in effects): shared value / errors / rules, its own visible /\n * disabled / readOnly, title and props (unset falls back to the field's). Own DOM id `<prefix>-<path>--<ui>`.\n * Leave rules / required / enum / omit to the `<Field>` without `ui`.\n */\n ui?: UiName\n /**\n * Inline options (Formily `enum`): `[{ label, value }]`, bare primitives (`['a', 'b']`), or `SomeEnum.with(params)`.\n * Option values are typed against the field value (its element type for an array field) when the name is typed\n * (`typed(form).Field`, `row.Field`). Wins over `fields.x.enum` while mounted; a reaction's `$enum` wins over it.\n * Changing the prop re-applies it; unmount restores the declared enum. Select / Radio / Checkbox.Group and their\n * read-only previews read it as `options`.\n */\n enum?: FieldEnum<PathValue<TScope, N & string>>\n /** Mount-scoped rules. Cleared on unmount. Does not erase a declaration, a template, or `$rules`. `validator` receives this field's value. */\n rules?: RulesInput<PathValue<TScope, N & string>>\n /** Mount-scoped required flag. Cleared on unmount. A declared or `$required` flag stays. */\n required?: boolean\n /** `false` does not render. Inherited (OR). Still submitted unless `omit`. On `<Field ui>` this is the instance's. */\n visible?: boolean\n /** Gray the control out. Inherited (OR). Skips validation. Still submitted. */\n disabled?: boolean\n /** Render the preview. Inherited (OR). Wins over `disabled`. Skips validation. Still submitted. */\n readOnly?: boolean\n /** Leave this field out of submit. Not inherited. On `<Field ui>` this is ignored (it belongs to the field). */\n omit?: boolean\n /** Decorator label (`FormItem` shows it as `label`). A reaction's `$title` wins. */\n title?: ReactNode\n /** Decorator help text (`FormItem` shows it as `extra`). A reaction's `$description` wins. */\n description?: ReactNode\n /**\n * Wrapper around the control: `decorator={[FormItem, { tooltip: '…' }]}`, or a registered name (`\"FormItem\"`,\n * `[\"FormItem\", props]`). Reads the field from context. The tuple's props are the JSX layer of `decoratorProps`\n * (under a reaction's `$decoratorProps`). `false` opts out of the `<Form kit>` / `<FieldKit>` default decorator.\n */\n decorator?: FieldSlot<D> | RegisteredDecoratorSlot | false\n /**\n * The control: `component={[Input, { placeholder: '…' }]}`, or a registered name (`\"Input\"`, `[\"Input\", props]`).\n * A `connect()`ed control reads the field from context. The tuple's props are the JSX layer of `componentProps`\n * (under a reaction's `$componentProps`). A component reference and a string name are the same slot.\n */\n component?: FieldSlot<C> | RegisteredComponentSlot\n /** A render prop (`(field) => …`), or field-aware children (`<Input />`) rendered instead of `component`. */\n children?: ReactNode | ((field: FieldBinding<PathValue<TScope, N & string>>) => ReactNode)\n}\n\n/** {@link FieldProps} plus the control/value check (`InputNumber` on a `string` field does not compile). */\nexport type CheckedFieldProps<\n TScope = any,\n N extends FieldPath<TScope> = FieldPath<TScope>,\n C extends ComponentType<any> = ComponentType<any>,\n D extends ComponentType<any> = ComponentType<any>,\n> = FieldProps<TScope, N, C, D> & ControlValueGuard<C, PathValue<TScope, N & string>>\n\n/**\n * One field: the single owner of a path's JSX config (Formily `<Field>`).\n *\n * ```tsx\n * <Field name=\"email\" title=\"邮箱\" required rules={{ format: 'email' }}\n * decorator={[FormItem]} component={[Input, { placeholder: 'name@example.com' }]} />\n * ```\n *\n * It renders `decorator` around `component` (or around `children`), and provides the binding through\n * {@link FieldContext}, so a decorator (`FormItem`) and a `connect()`ed control need no `name` of their own.\n * Both receive the effective `decoratorProps` / `componentProps` (`fields` ← JSX ← reaction). A render prop\n * `children={(field) => …}` still works and replaces `component`.\n *\n * `rules` may be a built-in rule, a Standard Schema, or a mix. JSX `rules` and `required` apply only while this\n * component is mounted; unmount restores rules from `useForm({ fields })`, `registerField`, an item template, or `$rules`.\n * `visible={false}` does not render and skips validation; the value is still submitted unless `omit`.\n * `readOnly` renders the preview and skips validation. `omit` leaves the value out of submit.\n * `<Field<Row> name=\"price\">` checks the name.\n * `<Field<Row, 'price'> name=\"price\">` types the value.\n * `<Field>` is a thin wrapper around {@link useField}: `useField(name, options)` + `visible === false` → `null`\n * + the two slots. `omit` still renders.\n */\nexport function Field<\n TScope = any,\n N extends FieldPath<TScope> = FieldPath<TScope>,\n C extends ComponentType<any> = ComponentType<any>,\n D extends ComponentType<any> = ComponentType<any>,\n>({ name, children, ...options }: CheckedFieldProps<TScope, N, C, D>) {\n // Sugar over the hook: everything <Field> does is reachable through useField(name, options).\n const field = useField<TScope, N>(name, options)\n if (!field.visible) return null\n const Component = field.component\n const Decorator = field.decorator\n const content =\n typeof children === 'function'\n ? children(field)\n : children !== undefined\n ? children\n : Component\n ? <Component {...field.componentProps} />\n : null\n return (\n <FieldContext.Provider value={field}>\n {Decorator ? <Decorator {...field.decoratorProps}>{content}</Decorator> : content}\n </FieldContext.Provider>\n )\n}\n\n/**\n * Scope child names under an object path. Does not subscribe to child values.\n * `omit` leaves this object out of submit (`getSubmitValues`; nested keys go with it). `omit` does not inherit,\n * so list the object in `useForm({ fields })` when the omission must hold before this component mounts.\n * `visible` / `disabled` / `readOnly` are inherited by the fields inside (OR; a child `false` exits).\n * `<ObjectField<Values> name=\"address\">` checks the name; `typed(form).ObjectField` also types the children.\n */\nexport function ObjectField<TScope = any>({\n name,\n visible,\n disabled,\n readOnly,\n omit,\n children,\n}: {\n name: FieldPath<TScope>\n /** `false` hides this object and, by inheritance, the fields inside. Explicit `false` on a child exits. */\n visible?: boolean\n /** Disables this object and, by inheritance, the fields inside. */\n disabled?: boolean\n /** Read-only preview for this object and, by inheritance, the fields inside. */\n readOnly?: boolean\n /** Leave this object out of submit. Not inherited; nested keys disappear with the object. */\n omit?: boolean\n children?: ReactNode\n}) {\n const form = useRequiredForm(`<ObjectField name=\"${String(name)}\">`)\n const scope = useScope()\n const path = resolveName(form, scope, String(name))\n if (visible !== undefined || disabled !== undefined || readOnly !== undefined || omit !== undefined) {\n form.registerField(path, { visible, disabled, readOnly, omit })\n }\n const next = useMemo(() => ({ path, index: -1 }), [path])\n return <ScopeContext.Provider value={next}>{children}</ScopeContext.Provider>\n}\n\n/**\n * The owner of an array path. Repeats `children` once per row; the key is the row id when present (`rowKey`, else\n * `id`), otherwise a stable object identity, so rows without an id keep their state when they move.\n * The parent subscribes to structure only. Put cell inputs in a child that calls `useField`.\n * Names inside a row are relative to the row (`name=\"price\"`, not `items.0.price`).\n * `component` is the container around the rows (Formily `ArrayItems` / `ArrayCards` / `ArrayTable` in\n * `@shikiform/antd`): `component={[ArrayItems, { addition: <ArrayItems.Addition /> }]}` renders\n * `<ArrayItems …>{rows}</ArrayItems>` inside the array's scope, so its buttons reach the array through {@link useArrayField}.\n * A container that renders its own cells (`ArrayTable` with `columns`) needs no `children`.\n * `virtualScroll` windows the plain rows (TanStack Virtual); it does not combine with a container `component`.\n * `<ArrayField<Values> name=\"items\">` checks the name; `typed(form).ArrayField` also types the row's fields.\n */\n/**\n * The `component` of an `<ArrayField>`: a container, or `[Container, props]`. The props are checked against the\n * container (`[ArrayTable, { columns }]` requires `columns` and types each column's `render`); `children` is the rows.\n */\nexport type ArrayContainerSlot<C extends ComponentType<any> = ComponentType<any>> =\n | C\n | readonly [C]\n | readonly [C, Omit<ComponentProps<C>, 'children'> | undefined]\n\nexport function ArrayField<TScope = any, C extends ComponentType<any> = ComponentType<any>>({\n name,\n rowKey,\n component,\n virtualScroll,\n children,\n}: {\n name: ArrayPath<TScope>\n rowKey?: string\n /** Container around the rows: the component, or `[Component, props]`. It receives the rows as `children`. */\n component?: ArrayContainerSlot<C>\n /** Window the rows: only those in view (plus `overscan`) mount. Plain rows only (no `component`). */\n virtualScroll?: { height: number; rowHeight?: number; overscan?: number }\n /** One row. Optional when `component` renders the rows itself (`ArrayTable` columns). */\n children?: (row: { index: number; key: string }) => ReactNode\n}) {\n const array = useArrayField(String(name), { rowKey })\n const [Container, props] = Array.isArray(component) ? component : [component as ComponentType<any> | undefined, undefined]\n if (Array.isArray(component) && Container == null && process.env.NODE_ENV !== 'production') {\n throw emptySlot(`<ArrayField name=\"${String(name)}\">`, 'component', Container)\n }\n if (virtualScroll && Container) {\n throw new ShikiUsageError(\n `<ArrayField name=\"${String(name)}\"> takes \\`virtualScroll\\` or a container \\`component\\`, not both: ` +\n 'virtualScroll windows plain rows (`<ArrayField name virtualScroll>{(row) => …}</ArrayField>`).',\n )\n }\n // Memoized rows: a push / insert renders only the new row (and rows whose index changed), not every row.\n // `children` keeps its identity while the ArrayField's parent does not re-render; when it does, every row\n // re-renders with the new closure.\n const row = (index: number, key: string) => (\n <ArrayRow key={key} path={`${array.path}.${index}`} index={index} itemKey={key} render={children!} />\n )\n let rows: ReactNode = null\n if (children && virtualScroll) {\n rows = (\n <VirtualRows count={array.keys.length} height={virtualScroll.height} rowHeight={virtualScroll.rowHeight ?? 42} overscan={virtualScroll.overscan ?? 4}>\n {(index) => {\n const at = array.keys[index]\n return at ? row(index, at.key) : null\n }}\n </VirtualRows>\n )\n } else if (children) {\n rows = array.keys.map((at) => row(at.index, at.key))\n }\n return <ArrayScope path={array.path} rowKey={rowKey}>{Container ? <Container {...props}>{rows}</Container> : rows}</ArrayScope>\n}\n\n/** One `<ArrayField>` row: re-renders only when its path / index / key or the row render function changes. */\nconst ArrayRow = memo(function ArrayRow({ path, index, itemKey, render }: {\n path: string\n index: number\n itemKey: string\n render: (row: { index: number; key: string }) => ReactNode\n}) {\n const wrap = useContext(RowWrapContext)\n const content = render({ index, key: itemKey })\n return (\n <RowScope path={path} index={index} itemKey={itemKey}>\n {wrap ? wrap(<RowWrapContext.Provider value={null}>{content}</RowWrapContext.Provider>) : content}\n </RowScope>\n )\n})\n\n/**\n * Mark the nearest array for {@link useArrayField} (`path` is absolute). `<ArrayField>` renders it; use it in a custom\n * array component built on `useArrayField(name)`.\n */\nexport function ArrayScope({ path, rowKey, children }: { path: string; rowKey?: string; children?: ReactNode }) {\n const value = useMemo(() => ({ path, rowKey }), [path, rowKey])\n return <ArrayContext.Provider value={value}>{children}</ArrayContext.Provider>\n}\n\n/**\n * Mark the nearest tree for {@link useTreeField} (`path` is absolute). `<TreeField>` renders it.\n * `childrenKey` / `rowKey` stay unset when the caller omitted them, so a prior `trees` registration is kept.\n */\nexport function TreeScope({\n path,\n childrenKey,\n rowKey,\n children,\n}: {\n path: string\n childrenKey?: string\n rowKey?: string\n children?: ReactNode\n}) {\n const value = useMemo(() => ({ path, childrenKey, rowKey }), [path, childrenKey, rowKey])\n return <TreeContext.Provider value={value}>{children}</TreeContext.Provider>\n}\n\n/**\n * Scope for one row (or tree node): relative names resolve under `path`, and {@link useIndex} / {@link useRecord}\n * (/ {@link useTreeField} with `pos`) read it. Stable value, so a row that did not move does not wake its consumers.\n * For a tree node pass `pos` (and `index` = its last segment, or omit `index`).\n */\nexport function RowScope({\n path,\n index,\n itemKey,\n pos,\n children,\n}: {\n path: string\n index?: number\n /** Row id (structure key). */\n itemKey?: string\n /** Tree coordinate of this node. */\n pos?: Pos\n children?: ReactNode\n}) {\n const at = index ?? (pos ? (pos[pos.length - 1] ?? -1) : -1)\n const posKey = pos?.join('.')\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = useMemo(() => ({ path, index: at, itemKey, pos }), [path, at, itemKey, posKey])\n return <ScopeContext.Provider value={value}>{children}</ScopeContext.Provider>\n}\n\n/** Rendered tree node passed to `<TreeField>{(node) => …}</TreeField>`. */\nexport interface TreeNodeRender {\n path: string\n pos: Pos\n index: number\n key: string\n depth: number\n children: ReactNode\n}\n\n/**\n * The owner of a tree path. Walks the tree recursively, wraps each node in a row scope keyed by the node id\n * (`rowKey`, else `id`, else a stable object identity), and hands `children` the pre-rendered subtree as `node.children`\n * (`null` on leaves) so the caller decides where to place it (`<li><NodeRow />{node.children && <ul>{node.children}</ul>}</li>`).\n * A move re-renders the moved node, nodes whose `pos` changed, and ancestors whose subtree changed.\n * A sibling whose position and subtree did not change, and every other subtree, keep the previous element and do not re-render.\n * The `children` render function is part of that identity: a new function (an inline callback while the parent re-renders) redraws every node.\n * Inside a node, relative `<Field name=\"name\">` / `useField('name')`, {@link useRecord}, and {@link useTreeField}\n * (no name: this node, plus the tree's edits) read that node, and field state / errors follow the node across moves.\n * `<TreeField<Values> name=\"menu\">` checks the name; `typed(form).TreeField` also types the node's fields.\n */\nexport function TreeField<TScope = any>({\n name,\n childrenKey,\n rowKey,\n children,\n}: {\n name: ArrayPath<TScope>\n childrenKey?: string\n rowKey?: string\n children: (node: TreeNodeRender) => ReactNode\n}) {\n const tree = useTreeField(String(name), { childrenKey, rowKey })\n const identMap = useRef(new WeakMap<object, string>())\n const identSeq = useRef(0)\n const cache = useRef(new Map<string, TreeFrameCache>())\n const resolvedChildrenKey = childrenKey ?? 'children'\n const resolvedRowKey = rowKey ?? 'id'\n const ctx: TreeFrameCtx = {\n treePath: tree.treePath,\n childrenKey: resolvedChildrenKey,\n rowKey: resolvedRowKey,\n render: children,\n identMap,\n identSeq,\n }\n return (\n <TreeScope path={tree.treePath} childrenKey={childrenKey} rowKey={rowKey}>\n {frameList(tree.value, [], ctx, cache.current)}\n </TreeScope>\n )\n}\n\n/** One node. Re-renders only when its key, position, subtree shape, or the row render function changes. */\nconst TreeNodeFrame = memo(function TreeNodeFrame(props: TreeFrameProps) {\n const cache = useRef(new Map<string, TreeFrameCache>())\n const children = frameList(props.childNodes, props.pos, props, cache.current)\n return (\n <RowScope path={props.path} index={props.index} itemKey={props.itemKey} pos={props.pos}>\n {props.render({\n path: props.path,\n pos: props.pos,\n index: props.index,\n key: props.itemKey,\n depth: props.depth,\n children,\n })}\n </RowScope>\n )\n}, (prev, next) =>\n prev.itemKey === next.itemKey &&\n prev.posKey === next.posKey &&\n prev.path === next.path &&\n prev.index === next.index &&\n prev.depth === next.depth &&\n prev.childSig === next.childSig &&\n prev.render === next.render &&\n prev.childrenKey === next.childrenKey &&\n prev.rowKey === next.rowKey &&\n prev.treePath === next.treePath,\n)\n\ninterface TreeFrameCtx {\n treePath: string\n childrenKey: string\n rowKey: string\n render: (node: TreeNodeRender) => ReactNode\n identMap: { current: WeakMap<object, string> }\n identSeq: { current: number }\n}\n\ninterface TreeFrameProps extends TreeFrameCtx {\n path: string\n pos: Pos\n posKey: string\n index: number\n depth: number\n itemKey: string\n childSig: string\n childNodes: unknown[]\n}\n\ninterface TreeFrameCache {\n sig: string\n posKey: string\n render: (node: TreeNodeRender) => ReactNode\n element: ReactNode\n}\n\n/** Child frames. An unchanged subtree is the same element, so React skips it. */\nfunction frameList(nodes: unknown[], parentPos: readonly number[], ctx: TreeFrameCtx, cache: Map<string, TreeFrameCache>): ReactNode {\n if (!nodes.length) return null\n const seen = new Set<string>()\n const frames = nodes.map((nodeObj, index) => {\n const pos: Pos = [...parentPos, index]\n const posKey = pos.join('.')\n const itemKey = treeNodeKey(nodeObj, ctx.rowKey, posKey, ctx.identMap, ctx.identSeq)\n seen.add(itemKey)\n const childNodes = treeChildList(nodeObj, ctx.childrenKey)\n const childSig = treeChildSig(childNodes, pos, ctx)\n const hit = cache.get(itemKey)\n if (hit && hit.sig === childSig && hit.posKey === posKey && hit.render === ctx.render) return hit.element\n const element = (\n <TreeNodeFrame\n key={itemKey}\n treePath={ctx.treePath}\n childrenKey={ctx.childrenKey}\n rowKey={ctx.rowKey}\n render={ctx.render}\n identMap={ctx.identMap}\n identSeq={ctx.identSeq}\n path={pathOf(ctx.treePath, pos, ctx.childrenKey)}\n pos={pos}\n posKey={posKey}\n index={index}\n depth={pos.length - 1}\n itemKey={itemKey}\n childSig={childSig}\n childNodes={childNodes}\n />\n )\n cache.set(itemKey, { sig: childSig, posKey, render: ctx.render, element })\n return element\n })\n for (const key of cache.keys()) if (!seen.has(key)) cache.delete(key)\n return frames\n}\n\nfunction treeChildList(node: unknown, childrenKey: string): unknown[] {\n if (!node || typeof node !== 'object') return []\n const sub = (node as Record<string, unknown>)[childrenKey]\n return Array.isArray(sub) ? sub : []\n}\n\nfunction treeNodeKey(\n node: unknown,\n rowKey: string,\n posKey: string,\n identMap: { current: WeakMap<object, string> },\n identSeq: { current: number },\n): string {\n if (node && typeof node === 'object' && (node as Record<string, unknown>)[rowKey] != null) {\n return String((node as Record<string, unknown>)[rowKey])\n }\n if (node && typeof node === 'object') {\n let id = identMap.current.get(node)\n if (!id) {\n identSeq.current += 1\n id = `node-${identSeq.current}`\n identMap.current.set(node, id)\n }\n return id\n }\n return posKey\n}\n\n/** Keys and positions of this subtree. A sibling move does not change it. */\nfunction treeChildSig(nodes: unknown[], parentPos: readonly number[], ctx: TreeFrameCtx): string {\n let sig = ''\n for (let index = 0; index < nodes.length; index++) {\n const posKey = `${parentPos.length ? parentPos.join('.') + '.' : ''}${index}`\n const key = treeNodeKey(nodes[index], ctx.rowKey, posKey, ctx.identMap, ctx.identSeq)\n sig += `${key}@${posKey}(${treeChildSig(treeChildList(nodes[index], ctx.childrenKey), [...parentPos, index], ctx)})`\n }\n return sig\n}\n\n/**\n * Render `children` with the current selector value. Same selectors and typing as {@link useWatch}:\n * an unannotated `select={(d) => d.$canSubmit}` compiles (`d` is untyped); `typed(form).Watch` or\n * `select={(d: Draft<Values>) => …}` types the draft and the value.\n * `select={(d) => d.$canSubmit}` subscribes a submit button without subscribing to every keystroke.\n */\nexport function Watch<T = any, S = unknown>({ select, children }: { select: (d: Draft<T>) => S; children: (value: S) => ReactNode }) {\n const value = useWatch<T, S>(select)\n return <>{children(value)}</>\n}\n","import type { Draft, FormInstance } from '@shikiform/core/internal'\nimport type { FormSubmitHandlers } from '../components/fields'\nimport { runSubmit } from '../components/fields'\nimport { useRequiredForm } from '../context'\nimport { useWatch } from './use-watch'\n\n/** The minimum a click handler needs. DOM and component events satisfy it. */\nexport interface ClickEvent {\n preventDefault(): void\n readonly defaultPrevented: boolean\n}\n\n/**\n * What {@link useSubmit} returns. Spread the DOM fields onto a button, or read `loading` for a spinner.\n * `disabled` follows `!$canSubmit` unless `options.disabled` is passed (`false` forces the button enabled).\n */\nexport interface SubmitState<E = ClickEvent> {\n /** True when the form has no shown errors and is not submitting or validating. */\n canSubmit: boolean\n submitting: boolean\n /** Alias of `submitting`, for a spinner. */\n loading: boolean\n disabled: boolean\n /** `'button'` when `onSubmit` is passed (the click submits). Otherwise `'submit'` for `<Form onSubmit>`. */\n type: 'submit' | 'button'\n 'aria-busy': true | undefined\n 'data-loading': '' | undefined\n onClick: (event: E) => void\n}\n\nexport interface UseSubmitOptions<T, E> extends FormSubmitHandlers<T> {\n /** Overrides `!$canSubmit`. `false` keeps the button enabled while the form is invalid. */\n disabled?: boolean\n /** Runs first. `preventDefault` skips the submit this button would start (`onSubmit` passed). */\n onClick?: (event: E) => void\n}\n\n/**\n * Submit state for the surrounding form. Disabled while `$canSubmit` is false, busy while `$submitting`.\n * Subscribes to form meta only, not to field values.\n *\n * - Without `onSubmit`, `type` is `'submit'`: the click is a native submit and `<Form onSubmit>` handles it.\n * - With `onSubmit`, `type` is `'button'` and the click runs `form.submit(onSubmit)` (no `<form>` element required).\n *\n * ```tsx\n * const submit = useSubmit({ onSubmit: save })\n * return <button type={submit.type} disabled={submit.disabled} aria-busy={submit['aria-busy']} onClick={submit.onClick}>保存</button>\n * ```\n */\nexport function useSubmit<T = any, E extends ClickEvent = ClickEvent>(options?: UseSubmitOptions<T, E>): SubmitState<E> {\n const form = useRequiredForm<T>('<Submit> / useSubmit()')\n const meta = useWatch((d: Draft<any>) => ({ can: d.$canSubmit === true, submitting: d.$submitting === true }))\n const own = options?.onSubmit !== undefined\n const onClick = options?.onClick\n const onSubmit = options?.onSubmit\n const onInvalid = options?.onInvalid\n const onSubmitError = options?.onSubmitError\n return {\n canSubmit: meta.can,\n submitting: meta.submitting,\n loading: meta.submitting,\n disabled: options?.disabled ?? !meta.can,\n type: own ? 'button' : 'submit',\n 'aria-busy': meta.submitting ? true : undefined,\n 'data-loading': meta.submitting ? '' : undefined,\n onClick: (event: E) => {\n onClick?.(event)\n if (!own || event.defaultPrevented) return\n runSubmit(form, { onSubmit, onInvalid, onSubmitError })\n },\n }\n}\n\nexport interface UseResetOptions<T, E> {\n /** Passed to `form.reset(values)`: the new initial values. Omit to restore the current initial values. */\n values?: T\n /**\n * Called after `form.reset`, with the values already restored. `onClick` still runs first;\n * `preventDefault` there skips the reset and this callback.\n */\n afterReset?: (values: T) => void\n /** Runs before the reset. `preventDefault` skips the reset. */\n onClick?: (event: E) => void\n /**\n * Forces the button disabled. Default `false`: reset stays available while the form is invalid\n * (unlike {@link useSubmit}, whose `disabled` follows `!$canSubmit`).\n */\n disabled?: boolean\n}\n\n/** What {@link useReset} returns. `type` is always `'button'` so a native form reset does not bypass the store. */\nexport interface ResetState<E = ClickEvent> {\n type: 'button'\n /** `options.disabled`, or `false`. Reset is not tied to `$canSubmit`. */\n disabled: boolean\n onClick: (event: E) => void\n}\n\n/**\n * Reset handler for the surrounding form. `onClick` runs first (and can cancel); `form.reset` runs next;\n * `afterReset` receives the restored values, so a query page can search with the cleared filters\n * without reading the values from before the click.\n *\n * ```tsx\n * const reset = useReset({ afterReset: (values) => search(values) })\n * return <button type={reset.type} disabled={reset.disabled} onClick={reset.onClick}>重置</button>\n * ```\n */\nexport function useReset<T = any, E extends ClickEvent = ClickEvent>(options?: UseResetOptions<T, E>): ResetState<E> {\n const form = useRequiredForm<T>('<Reset> / useReset()')\n const values = options?.values\n const afterReset = options?.afterReset\n const onClick = options?.onClick\n return {\n type: 'button',\n disabled: options?.disabled ?? false,\n onClick: (event: E) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n form.reset(values as T | undefined)\n afterReset?.((form as FormInstance<T>).values)\n },\n }\n}\n","import {\n forwardRef,\n type ComponentClass,\n type ComponentProps,\n type ComponentType,\n type ForwardRefExoticComponent,\n type FunctionComponent,\n type ReactElement,\n type Ref,\n} from 'react'\nimport type { EnumOption } from '@shikiform/core/internal'\nimport { useFieldContextOrNull } from '../field-context'\nimport { useField, type FieldBinding } from '../hooks/use-field'\n\n/**\n * Binding keys a control receives by default (each under its own name unless mapped).\n * `status` is Ant Design's (`'error'` / `'warning'`). Headless `connect` does not pass it;\n * `@shikiform/antd` opts in with `mapProps({ status: 'status' })` on the controls that paint it.\n */\nexport type FieldPropKey = 'value' | 'onChange' | 'onBlur' | 'disabled' | 'readOnly' | 'status' | 'id' | 'options' | 'loading'\n\n/**\n * Any other field state a `mapProps` object can hand to a prop (Formily: the key is a field path):\n * `{ title: 'placeholder' }`, `{ required: 'aria-required' }`, `{ 'componentProps.max': 'count' }`.\n */\nexport type FieldStateKey =\n | 'title' | 'description' | 'required' | 'validating' | 'touched' | 'dirty' | 'edited' | 'visible' | 'disabled' | 'readOnly' | 'omit' | 'path'\n | 'errors' | 'warnings'\n | `componentProps.${string}`\n | `decoratorProps.${string}`\n\n/**\n * Where blur validation goes when the control has no `onBlur` (a Lobe Select, a popover picker).\n * Without this, `validateTrigger: 'onBlur'` never runs because the `onBlur` prop is ignored.\n *\n * - `'onChange'` — `field.onBlur()` after each change (the value is already written).\n * - `'onOpenChange'` — `field.onBlur()` when the first argument is `false` (the popup closed).\n * - `{ prop, when? }` — `field.onBlur()` when `prop` fires and `when(...args)` is not false (`when` defaults to always).\n */\nexport type BlurOn =\n | 'onChange'\n | 'onOpenChange'\n | { prop: string; when?: (...args: any[]) => boolean }\n\n/**\n * Rename (`{ value: 'checked' }`), merge (`{ readOnly: 'disabled' }`), drop (`{ onBlur: false }`) binding props, or pass\n * more field state to a prop (`{ title: 'placeholder' }`; an explicit caller prop wins).\n * `format` / `parse` convert between the field value and the control value (a `'YYYY-MM-DD'` string in the field,\n * a `Date` / Dayjs in the control). `parse` replaces the default {@link valueFromEvent}. `format` runs after prop\n * transforms, so it sees the control's own props (`props.format`, …). The `readOnly` preview is not converted: the view gets\n * the field value.\n * `blurOn` is the blur fallback for a control that does not call `onBlur` ({@link BlurOn}). It replaces the default\n * `onBlur` prop so the unused handler is not passed through.\n *\n * Inside `connect(Control, mapProps({ … }))`, `parse`'s parameters are the control's `onChange` arguments and\n * `format`'s `props` are the control's props, so a date converter does not annotate Dayjs / Date. Annotate\n * `format`'s value parameter when you want that callback to name the field type.\n */\nexport type PropsMapping<P = any, F = any> = Partial<Record<FieldPropKey | FieldStateKey, string | false>> & {\n /** Field value → the value the control receives (the prop named by `value`, default `'value'`). */\n format?: (value: F, props: FormatProps<P>) => ValueOf<P>\n /** Control `onChange` arguments → the value stored on the field. Default: {@link valueFromEvent}. */\n parse?: ParseFn<P, F>\n blurOn?: BlurOn\n /** Component rendered when the field is `readOnly` (the preview). A tuple's props are its defaults. */\n preview?: ComponentType<any> | readonly [ComponentType<any>, Record<string, unknown>?]\n}\n\n/** `true` when `P` is `any` (not a concrete props type). `unknown` is not `any`. */\ntype IsAny<T> = 0 extends 1 & T ? true : false\n\n/** `P['value']` when the control has one, otherwise unchecked. */\ntype ValueOf<P> = IsAny<P> extends true ? unknown : P extends { value?: infer V } ? V : unknown\n\n/**\n * Parameter list of `P['onChange']`. `any` / `unknown` (mapProps outside `connect`, or a control with no\n * `onChange`) stay loose: a fixed-arity `parse` must still be assignable. A concrete list is what `connect`\n * uses to type `parse`'s parameters.\n */\ntype ChangeArgs<P> = IsAny<P> extends true\n ? any[]\n : [unknown] extends [P]\n ? any[]\n : P extends { onChange?: (...args: infer A) => any }\n ? A\n : any[]\n\n/**\n * `parse`. Concrete `onChange` parameters stay strict (a `string` callback is not a `Date` callback).\n * When the props type is not known, the callback is bivariant so `(a, b) => field` still assigns to a rest `any[]`.\n */\ntype ParseFn<P, F> = IsAny<P> extends true\n ? { bivarianceHack(...args: any[]): F }['bivarianceHack']\n : [unknown] extends [P]\n ? { bivarianceHack(...args: any[]): F }['bivarianceHack']\n : (...args: ChangeArgs<P>) => F\n\n/** `format`'s props parameter. `any` when the control props are not known yet, so an annotation is allowed. */\ntype FormatProps<P> = IsAny<P> extends true ? any : [unknown] extends [P] ? any : P\n\n/** A props enhancer whose `format` / `parse` are checked against the control `connect` wraps. */\nexport type CodecEnhancer<P, F> = PropsEnhancer & { __codec: { props: P; field: F } }\n\n/** Last-step transform: receives the mapped props and the field, returns the props the control gets. */\nexport type PropsTransform = (props: Record<string, any>, field: FieldBinding<any>) => Record<string, any>\n\n/** Set when a props enhancer decides blur: a {@link BlurOn} fallback, an `onBlur` rename, or an explicit drop. */\nexport type BlurFlag = BlurOn | 'drop' | 'rename'\n\nexport type PropsEnhancer = {\n kind: 'props'\n mapping: PropsMapping\n transforms: PropsTransform[]\n /** Present when this mapping names a blur fallback, renames `onBlur`, or drops it on purpose. */\n blur?: BlurFlag\n preview?: { component: ComponentType<any>; props?: Record<string, unknown> }\n}\n\nexport type ConnectEnhancer = PropsEnhancer\n\n/** Props every connected control accepts besides its own. */\nexport interface ConnectFieldProps {\n /** Field name relative to the current scope. Omit it inside a `<Field>`, which supplies the field. */\n name?: string\n /** An explicit binding, e.g. from `useField(name, options)`. Wins over `name` and context. */\n field?: FieldBinding<any>\n}\n\n/** A connected control: the target's props (all optional) plus {@link ConnectFieldProps}; the ref reaches the target. */\nexport type ConnectedComponent<P> = ComponentType<Partial<P> & ConnectFieldProps & { ref?: Ref<any> }>\n\n/** Static members of a component (`Select.Option`, `Input.Group` …), hoisted onto its connected version. */\nexport type ComponentStatics<C> = Omit<\n C,\n keyof FunctionComponent<any> | keyof ComponentClass<any> | keyof ForwardRefExoticComponent<any> | 'prototype'\n>\n\nconst DEFAULT_TARGETS: Record<FieldPropKey, string | false> = {\n value: 'value',\n onChange: 'onChange',\n onBlur: 'onBlur',\n disabled: 'disabled',\n readOnly: 'readOnly',\n // Ant Design only. A non-antd control would receive `status=\"error\"` and may forward it to the DOM.\n status: false,\n id: 'id',\n options: false,\n loading: false,\n}\n\n/** Keys of {@link PropsMapping} that are not \"copy this field state onto a prop\". */\nconst MAPPING_META = new Set(['format', 'parse', 'blurOn', 'preview'])\n\n/**\n * Default `onChange` → value: a DOM change event yields `target.checked` for checkboxes and\n * `target.value` otherwise; anything else (a number, an array, `null`) is the value itself.\n */\nexport function valueFromEvent(...args: any[]): unknown {\n const first = args[0]\n if (first && typeof first === 'object' && 'target' in first && first.target && typeof first.target === 'object') {\n const target = first.target as { type?: string; checked?: unknown; value?: unknown }\n if (target.type === 'checkbox') return target.checked\n if ('value' in target) return target.value\n if ('checked' in target) return target.checked\n }\n return first\n}\n\n/**\n * Map a field binding plus caller props onto a control's props. Pure; this is all `connect` does per render,\n * exported so a hook user (`useField`) gets the identical mapping without a wrapper component:\n *\n * ```tsx\n * const field = useField('email', { required: true })\n * return <input {...mapFieldProps(field, { placeholder: 'Email' })} />\n * ```\n *\n * - `value` → the field value (`format`, when set, turns it into the control's value after the other mapping);\n * `onChange` → `field.onChange(parse(...args))` (default {@link valueFromEvent}), then the caller's handler\n * with the original arguments; `onBlur` → `field.onBlur()`, then the caller's handler.\n * - `disabled` / `readOnly` are OR-ed with the caller's prop. Several keys may target one prop (`readOnly: 'disabled'`).\n * - `status` is not passed unless mapped (`{ status: 'status' }`): then `'error'` with errors, `'warning'` with only\n * warnings; an explicit caller `status` wins. Ant Design controls that paint `status` opt in; others should not.\n * - `options` (enum, tree nodes keep `children`) and `loading` are passed only when mapped; an explicit caller prop wins.\n * - `blurOn` calls `field.onBlur()` from another prop and does not pass `onBlur` (see {@link BlurOn}).\n * - `readOnly` with a `preview` renders that view (it wins over `disabled`). Without one, the control receives `readOnly`.\n * - `field.componentProps` (`fields` ← JSX ← `$componentProps`) are merged under `props`.\n */\nfunction mapFieldProps(\n field: FieldBinding<any>,\n props: Record<string, any>,\n ...mappers: Array<PropsMapping | PropsTransform>\n): Record<string, any> {\n const mapping: PropsMapping = {}\n const transforms: PropsTransform[] = []\n for (const mapper of mappers) {\n if (typeof mapper === 'function') transforms.push(mapper)\n else Object.assign(mapping, mapper)\n }\n return applyMapping(field, { ...field.componentProps, ...props }, mapping, transforms)\n}\n\n/** Enum options as a control takes them: `{ label, value, disabled }`, with `children` for tree / cascader nodes. */\nfunction controlOptions(options: readonly EnumOption[]): Array<Record<string, unknown>> {\n return options.map((option) => {\n const out: Record<string, unknown> = { label: option.label, value: option.value, disabled: option.disabled }\n if (option.children) out.children = controlOptions(option.children)\n return out\n })\n}\n\n/** `title`, `componentProps.max` … read from the binding. */\nfunction readState(field: FieldBinding<any>, key: string): unknown {\n let current: unknown = field\n for (const part of key.split('.')) {\n if (current == null || typeof current !== 'object') return undefined\n current = (current as Record<string, unknown>)[part]\n }\n return current\n}\n\nfunction blurSpec(blurOn: BlurOn, changeProp: string | false): { prop: string; when: (...args: any[]) => boolean } | undefined {\n if (blurOn === 'onChange') {\n if (!changeProp) return undefined\n return { prop: changeProp, when: () => true }\n }\n if (blurOn === 'onOpenChange') return { prop: 'onOpenChange', when: (open: unknown) => open === false }\n return { prop: blurOn.prop, when: blurOn.when ?? (() => true) }\n}\n\n/** After transforms: call `field.onBlur()` from the fallback prop, keeping the handler already on that prop. */\nfunction withBlur(props: Record<string, any>, field: FieldBinding<any>, blurOn: BlurOn, changeProp: string | false): Record<string, any> {\n const spec = blurSpec(blurOn, changeProp)\n if (!spec) return props\n const caller = props[spec.prop]\n return {\n ...props,\n [spec.prop]: (...args: any[]) => {\n caller?.(...args)\n if (spec.when(...args)) field.onBlur()\n },\n }\n}\n\nfunction applyMapping(\n field: FieldBinding<any>,\n props: Record<string, any>,\n mapping: PropsMapping,\n transforms: PropsTransform[],\n): Record<string, any> {\n const target = (key: FieldPropKey): string | false => (mapping[key] === undefined ? DEFAULT_TARGETS[key] : mapping[key]!)\n const parseValue = mapping.parse ?? valueFromEvent\n const out: Record<string, any> = { ...props }\n const value = target('value')\n if (value) out[value] = field.value\n const id = target('id')\n if (id) out[id] = props[id] ?? field.id\n const disabled = target('disabled')\n // `readOnly` wins: a preview (or a read-only control) is not also disabled.\n if (disabled) out[disabled] = !!out[disabled] || (field.disabled && !field.readOnly)\n const readOnly = target('readOnly')\n if (readOnly) out[readOnly] = !!out[readOnly] || field.readOnly\n const status = target('status')\n if (status) {\n const derived = field.errors.length ? 'error' : field.warnings.length ? 'warning' : undefined\n out[status] = props[status] ?? derived\n }\n const options = target('options')\n if (options) {\n out[options] = props[options] ?? controlOptions(field.options)\n }\n const loading = target('loading')\n if (loading) out[loading] = props[loading] ?? field.loading\n const changeProp = target('onChange')\n if (changeProp) {\n const caller = props[changeProp]\n out[changeProp] = (...args: any[]) => {\n field.onChange(parseValue(...args))\n caller?.(...args)\n }\n }\n // `blurOn` replaces the default `onBlur` prop. An explicit `onBlur: 'onFocusOut'` / `onBlur: false` still wins.\n const onBlur = mapping.onBlur !== undefined ? mapping.onBlur : mapping.blurOn ? false : target('onBlur')\n if (onBlur) {\n const caller = props[onBlur]\n out[onBlur] = (...args: any[]) => {\n field.onBlur()\n caller?.(...args)\n }\n }\n for (const [key, prop] of Object.entries(mapping)) {\n if (MAPPING_META.has(key) || key in DEFAULT_TARGETS || typeof prop !== 'string') continue\n if (props[prop] === undefined) out[prop] = readState(field, key)\n }\n let result = out\n for (const transform of transforms) result = transform(result, field) ?? result\n // After transforms, so `format` sees the control's own props (a date `format` string the transform just set).\n // The input is the field value, not `result[value]`: a transform cannot pre-convert it.\n if (value && mapping.format) result = { ...result, [value]: mapping.format(field.value, result) }\n if (mapping.blurOn) result = withBlur(result, field, mapping.blurOn, changeProp)\n return result\n}\n\n/** A mapping that does not convert values. `format` / `parse` take the codec overload so `connect` can check them. */\ntype MapArg = Omit<PropsMapping, 'format' | 'parse'> | PropsTransform\n\ntype BlurFrom<A extends readonly unknown[]> = A extends readonly [infer H, ...infer R]\n ? H extends { blurOn: infer B }\n ? [B] extends [BlurOn] ? B : BlurFrom<R>\n : H extends { onBlur: false }\n ? 'drop'\n : H extends { onBlur: string }\n ? 'rename'\n : BlurFrom<R>\n : undefined\n\ntype MapPropsResult<A extends readonly unknown[]> =\n [BlurFrom<A>] extends [undefined] ? PropsEnhancer : PropsEnhancer & { blur: NonNullable<BlurFrom<A>> }\n\n/**\n * Describe how a control's props come from the field (Formily `mapProps`).\n * Objects rename / merge / drop binding props; functions transform the final props.\n * `format` / `parse` on the first object convert the field value both ways ({@link PropsMapping}).\n *\n * ```ts\n * connect(Switch, mapProps({ value: 'checked', readOnly: 'disabled' }))\n * connect(LobeSelect, mapProps({ options: 'options', blurOn: 'onOpenChange' }))\n * connect(DatePicker, mapProps({\n * format: (value: string | undefined) => (value ? parseISO(value) : null),\n * parse: (next: Date | null) => (next ? format(next, 'yyyy-MM-dd') : undefined),\n * }))\n * ```\n *\n * `blurOn` keeps `validateTrigger: 'onBlur'` alive when the control never calls `onBlur`.\n * Put `format` / `parse` on the first object so `connect` can check them against the control.\n */\ntype CodecMapping<P, F> = PropsMapping<P, F> & (\n | { format: (value: F, props: FormatProps<P>) => ValueOf<P> }\n | { parse: ParseFn<P, F> }\n)\n\nexport function mapProps<P, F>(\n mapping: CodecMapping<P, F>,\n ...rest: Array<PropsMapping<P, F> | PropsTransform>\n): CodecEnhancer<P, F>\nexport function mapProps<const A extends readonly MapArg[]>(...args: A): MapPropsResult<A>\nexport function mapProps(...args: ReadonlyArray<PropsMapping | PropsTransform>): PropsEnhancer {\n const mapping: PropsMapping = {}\n const transforms: PropsTransform[] = []\n for (const arg of args) {\n if (typeof arg === 'function') transforms.push(arg)\n else Object.assign(mapping, arg)\n }\n let blur: BlurFlag | undefined\n if (mapping.blurOn) blur = mapping.blurOn\n else if (mapping.onBlur === false) blur = 'drop'\n else if (typeof mapping.onBlur === 'string') blur = 'rename'\n const rp = mapping.preview\n const preview = rp\n ? Array.isArray(rp)\n ? { component: rp[0], props: rp[1] }\n : { component: rp as ComponentType<any> }\n : undefined\n const enhancer: PropsEnhancer = {\n kind: 'props',\n mapping,\n transforms,\n ...(blur ? { blur } : {}),\n ...(preview ? { preview } : {}),\n }\n return enhancer\n}\n\nconst NOT_STATIC = new Set([\n // React component statics and function / class built-ins: never copied.\n 'displayName', 'propTypes', 'defaultProps', 'contextType', 'contextTypes', 'childContextTypes', 'getDefaultProps',\n 'getDerivedStateFromProps', 'getDerivedStateFromError', 'mixins', '$$typeof', 'render', 'compare', 'type',\n 'length', 'name', 'prototype', 'caller', 'callee', 'arguments', 'arity',\n])\nconst warned = new Set<string>()\n\n/**\n * Props of a component, from its call signature. `unknown` when the signature can't be read\n * (then blur is not required — a typed `onBlur` is what the check can see).\n */\ntype CallProps<C> = C extends (props: infer P, ...args: any[]) => any ? P : unknown\n\n/**\n * True when the control's props include `onBlur` (so the handler we pass can be called),\n * or when the props type can't be read. A closed props type with no `onBlur` is false:\n * passing `onBlur` would be ignored and blur validation would disappear.\n */\ntype HasOnBlurProp<C> = [CallProps<C>] extends [unknown]\n ? [unknown] extends [CallProps<C>]\n ? true\n : 'onBlur' extends keyof CallProps<C>\n ? true\n : false\n : true\n\ntype AnyBlur<E extends readonly unknown[]> = E extends readonly [infer H, ...infer R]\n ? H extends { blur: BlurFlag }\n ? true\n : AnyBlur<R>\n : false\n\ntype DemandBlur<C> = C & {\n readonly __shikiConnectBlurFallback:\n 'This control has no onBlur, so onBlur validation would never run. Pass mapProps({ blurOn: \"onChange\" | \"onOpenChange\" | { prop, when? } }) or mapProps({ onBlur: false }) to opt out.'\n}\n\ntype BlurTarget<C, E extends readonly unknown[]> =\n HasOnBlurProp<C> extends true ? C : AnyBlur<E> extends true ? C : DemandBlur<C>\n\ntype ValueOfProps<C> = C extends ComponentType<infer P> ? (P extends { value?: infer V } ? V : unknown) : unknown\n\n/**\n * Field value this control stores. Codec `format` / `parse` set it (a date field is a string, not a Dayjs).\n * Otherwise it is the `value` prop. A later `__shikiAccepts` intersection narrows it (`InputNumber` → `number | null`).\n */\ntype ConnectedOf<C extends ComponentType<any>, V = ValueOfProps<C>> = ConnectedComponent<ComponentProps<C>> &\n ComponentStatics<C> & { readonly __shikiAccepts: V }\n\n/** A plain enhancer: `format` / `parse` go through {@link CodecEnhancer}, so a mismatch is not swallowed by this overload. */\ntype NoCodec<E> = E extends { __codec: any } ? never : E\n\n/**\n * Turn any value/onChange control into a ShikiForm field control (Formily `connect`).\n * Lives in `@shikiform/react` (no Ant Design). `@shikiform/antd` re-exports it and opts its controls into `status`.\n *\n * The result reads its field from, in order: a `field` prop, a `name` prop (via {@link useField}),\n * or the surrounding `<Field>` (what `useField()` with no name returns). It has no state of its own: every prop comes\n * from {@link mapFieldProps} over the binding, with the field's `componentProps` merged under the caller's props\n * (so `$componentProps.placeholder = …` in a reaction reaches the control).\n *\n * A control whose props type has no `onBlur` must say where blur validation goes\n * (`mapProps({ blurOn })` / `mapProps({ onBlur: false })`). Otherwise `validateTrigger: 'onBlur'`\n * would never run and TypeScript would not complain. `blurOn: 'onOpenChange'` treats a popup close (`false`) as blur;\n * `blurOn: 'onChange'` blurs after every change.\n *\n * It forwards `ref` to the target and copies the target's static members (`Select.Option`,\n * `Input.Search` — the originals, not connected). With no field at all it renders the plain control with the\n * caller's props and warns once in development.\n *\n * ```tsx\n * const Rate = connect(Stars, mapProps({ value: 'score', onChange: 'onPick', onBlur: false }))\n * const City = connect(LobeSelect, mapProps({ options: 'options', blurOn: 'onOpenChange' }))\n * const Birthday = connect(DateInput, mapProps({\n * format: (value: string | undefined) => (value ? new Date(value) : null),\n * parse: (next: Date | null) => (next ? next.toISOString().slice(0, 10) : undefined),\n * }))\n * ```\n */\nexport function connect<C extends ComponentType<any>, F, E extends readonly ConnectEnhancer[]>(\n target: C,\n e1: CodecEnhancer<ComponentProps<C>, F>,\n ...rest: E\n): BlurTarget<C, [CodecEnhancer<ComponentProps<C>, F>, ...E]> extends C ? ConnectedOf<C, F> : DemandBlur<C>\nexport function connect<C extends ComponentType<any>, F, E1 extends ConnectEnhancer, E extends readonly ConnectEnhancer[]>(\n target: C,\n e1: E1,\n e2: CodecEnhancer<ComponentProps<C>, F>,\n ...rest: E\n): BlurTarget<C, [E1, CodecEnhancer<ComponentProps<C>, F>, ...E]> extends C ? ConnectedOf<C, F> : DemandBlur<C>\nexport function connect<C extends ComponentType<any>>(target: BlurTarget<C, []>): ConnectedOf<C>\nexport function connect<C extends ComponentType<any>, E1 extends ConnectEnhancer>(\n target: BlurTarget<C, [NoCodec<E1>]>, e1: NoCodec<E1>,\n): ConnectedOf<C>\nexport function connect<C extends ComponentType<any>, E1 extends ConnectEnhancer, E2 extends ConnectEnhancer>(\n target: BlurTarget<C, [NoCodec<E1>, NoCodec<E2>]>, e1: NoCodec<E1>, e2: NoCodec<E2>,\n): ConnectedOf<C>\nexport function connect<C extends ComponentType<any>, E1 extends ConnectEnhancer, E2 extends ConnectEnhancer, E3 extends ConnectEnhancer>(\n target: BlurTarget<C, [NoCodec<E1>, NoCodec<E2>, NoCodec<E3>]>, e1: NoCodec<E1>, e2: NoCodec<E2>, e3: NoCodec<E3>,\n): ConnectedOf<C>\nexport function connect<C extends ComponentType<any>, E1 extends ConnectEnhancer, E2 extends ConnectEnhancer, E3 extends ConnectEnhancer, E4 extends ConnectEnhancer>(\n target: BlurTarget<C, [NoCodec<E1>, NoCodec<E2>, NoCodec<E3>, NoCodec<E4>]>,\n e1: NoCodec<E1>, e2: NoCodec<E2>, e3: NoCodec<E3>, e4: NoCodec<E4>,\n): ConnectedOf<C>\nexport function connect(target: ComponentType<any>, ...enhancers: ConnectEnhancer[]): any {\n const mapping: PropsMapping = {}\n const transforms: PropsTransform[] = []\n let preview: PropsEnhancer['preview']\n for (const enhancer of enhancers) {\n Object.assign(mapping, enhancer.mapping)\n transforms.push(...enhancer.transforms)\n if (enhancer.preview) preview = enhancer.preview\n }\n const Target = target as ComponentType<any>\n const displayName = `Connected(${Target.displayName ?? Target.name ?? 'Component'})`\n const render = (field: FieldBinding<any>, callerProps: Record<string, any>, ref: Ref<any>): ReactElement => {\n // The field's componentProps (`fields` ← JSX ← `$componentProps`) sit under the caller's own props.\n const props = { ...field.componentProps, ...callerProps }\n if (preview && field.readOnly) {\n const Preview = preview.component\n return <Preview {...preview.props} {...props} value={field.value} options={props.options ?? field.options} />\n }\n const mapped = applyMapping(field, props, mapping, transforms)\n return ref == null ? <Target {...mapped} /> : <Target {...mapped} ref={ref} />\n }\n function WithField({ field, rest, forwarded }: { field: FieldBinding<any>; rest: Record<string, any>; forwarded: Ref<any> }) {\n return render(field, rest, forwarded)\n }\n function WithName({ name, rest, forwarded }: { name: string; rest: Record<string, any>; forwarded: Ref<any> }) {\n return render(useField(name), rest, forwarded)\n }\n function FromContext({ rest, forwarded }: { rest: Record<string, any>; forwarded: Ref<any> }) {\n const field = useFieldContextOrNull()\n if (field) return render(field, rest, forwarded)\n if (process.env.NODE_ENV !== 'production' && !warned.has(displayName)) {\n warned.add(displayName)\n console.warn(\n `[shikiform] ${displayName} is outside a <Field> and has no \\`name\\` / \\`field\\` prop: it renders as the plain ` +\n 'control, bound to nothing. Put it in <Field name=\"…\" component={[…]}>, or pass name=\"…\".',\n )\n }\n return forwarded == null ? <Target {...rest} /> : <Target {...rest} ref={forwarded} />\n }\n const Connected = forwardRef<any, Record<string, any>>(function Connected(props, forwarded) {\n const { name, field, ...rest } = props as ConnectFieldProps & Record<string, any>\n if (field) return <WithField field={field} rest={rest} forwarded={forwarded} />\n if (name !== undefined) return <WithName name={name} rest={rest} forwarded={forwarded} />\n return <FromContext rest={rest} forwarded={forwarded} />\n })\n Connected.displayName = displayName\n for (const key of Object.getOwnPropertyNames(target)) {\n if (NOT_STATIC.has(key) || key in Connected) continue\n const descriptor = Object.getOwnPropertyDescriptor(target, key)\n if (descriptor) Object.defineProperty(Connected, key, descriptor)\n }\n return Connected\n}\n","import { useEffect, useLayoutEffect, useRef } from 'react'\nimport { createForm, deepEqual } from '@shikiform/core/internal'\nimport type { DefaultSubmit, FieldsInput, FormInstance, FormOptions, ResolveSubmit } from '@shikiform/core/internal'\n\nconst useIsoLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n/** `useForm` options: {@link FormOptions} plus `values`. */\nexport interface UseFormOptions<T> extends FormOptions<T> {\n /**\n * Values owned outside the form (a loaded record, a query cache). The first render uses them as `initialValues`.\n * When a later render passes a different object whose content also changed, the form calls `reset(values)`:\n * they become the new baseline, edits are discarded, the form is not dirty. Same content under a new identity\n * (an inline literal) does nothing. `initialValues` is read once; use `values` when the data can change.\n */\n values?: T\n}\n\n/**\n * Create a form and keep the same instance for the lifetime of the component.\n * Options are read on the first render. Later renders ignore a new options object, except `values`,\n * which resets the form when its content changes.\n * The returned form is headless: nothing here imports a UI kit.\n *\n * `T` is inferred from `initialValues` / `values`. `getValue` / `setValue` / `batch` use that type.\n * Submit values: no type argument drops `fields` paths with `omit: true`.\n * `useForm<V>(options)` keeps the submit type as `V`. To keep `V` and still infer `fields`, call\n * `typed<V>().useForm(options)`. An explicit second argument (`SubmitValues<V, …>`) is used as written.\n * `useForm()`, `useForm(undefined)` and `useForm({})` are the same call: each returns a form and runs the same hooks.\n * `typed(form)` gives the name-checked `Field` / `ArrayField` / `useField` / `useWatch` for this form.\n * `fields` and `rows.*.name` templates validate even when the matching `<Field>` is not mounted.\n *\n * @example\n * const form = useForm({\n * initialValues: { email: '', rows: [{ name: '' }] },\n * fields: { email: { required: true }, 'rows.*.name': { required: true } },\n * })\n * const edit = typed<Detail>().useForm({ values: record, fields: { token: { omit: true } } })\n */\ntype UseFormArg<T, F> = Omit<UseFormOptions<T>, 'fields'> & { fields?: F & FieldsInput<T> }\n\nexport function useForm<T = any, TSubmit = DefaultSubmit, const F extends FieldsInput<T> = {}>(\n options?: UseFormArg<T, F>,\n): FormInstance<T, ResolveSubmit<T, TSubmit, F>>\nexport function useForm(options?: UseFormOptions<any>): any {\n const ref = useRef<FormInstance<any, any> | null>(null)\n const values = options?.values\n const last = useRef(values)\n if (!ref.current) {\n const { values: _values, ...rest } = options ?? {}\n ref.current = createForm(values !== undefined ? { ...rest, initialValues: values } : rest)\n }\n const form = ref.current\n useIsoLayoutEffect(() => {\n if (values === last.current) return\n const changed = !deepEqual(values, last.current)\n last.current = values\n if (changed && values !== undefined) form.reset(values)\n }, [values, form])\n return form\n}\n","import { createContext, useContext, type ComponentType, type ReactNode } from 'react'\nimport type { FieldUiSpec, UiName } from '@shikiform/core/internal'\nimport { useRequiredForm, useScope } from '../context'\nimport { useFieldKit, withResolvedSlots } from '../field-kit'\nimport { useUiNode, type FieldSlot, type RegisteredComponentSlot, type RegisteredDecoratorSlot } from '../hooks/use-field'\nimport { normalizeUiSpec } from '@shikiform/core/internal'\nimport { useIdPrefix, withDomId } from '../id-prefix'\n\n/** What `<UI>` renders with: the node's effective state (reaction > JSX props > the scope's flags). */\nexport interface UiBinding {\n /** The node name (`d.$ui(name)`). */\n ui: string\n /** DOM id: `<prefix>-<scope>--<name>` (`<prefix>-ui--approvalTip` at the root). */\n id: string\n visible: boolean\n disabled: boolean\n readOnly: boolean\n title: ReactNode\n description: ReactNode\n component: ComponentType<any> | undefined\n decorator: ComponentType<any> | undefined\n componentProps: Record<string, any>\n decoratorProps: Record<string, any>\n}\n\n/** `<UI>` props. A UI node has no value: nothing here is submitted or validated. */\nexport interface UIProps<C extends ComponentType<any> = ComponentType<any>, D extends ComponentType<any> = ComponentType<any>> {\n /** Addressed in effects as `d.$ui(name)` (inside a row / `<ObjectField>`: that scope's `row.$ui(name)`). */\n name: UiName\n /** The component: `component={[Alert, { type: 'warning' }]}`, or a name registered on `<FieldKit>` / `<Form kit>`. Children render inside it. */\n component?: FieldSlot<C> | RegisteredComponentSlot\n /** Wrapper (`decorator={[FormItem]}`: `title` → label, `description` → extra), or a registered decorator name. */\n decorator?: FieldSlot<D> | RegisteredDecoratorSlot | false\n title?: ReactNode\n description?: ReactNode\n /** `false` hides this UI (default: the scope's `visible`). An explicit `false` exits that fallback. */\n visible?: boolean\n /** Gray this UI out (default: the scope's `disabled`). */\n disabled?: boolean\n /** Render this UI's preview (default: the scope's `readOnly`). Wins over `disabled`. */\n readOnly?: boolean\n /** Rendered inside `component` (or alone), or a render prop `(ui) => …`. */\n children?: ReactNode | ((ui: UiBinding) => ReactNode)\n}\n\n/** Internal: the `<UI>` whose decorator is rendering (`FormItem` reads `title` / `description` from it). */\nexport const UiNodeContext = createContext<UiBinding | null>(null)\n\n/** Internal: the surrounding `<UI>`, or `null`. */\nexport function useUiNodeOrNull(): UiBinding | null {\n return useContext(UiNodeContext)\n}\n\n/**\n * A UI with no data, addressed by name in effects: `d.$ui('approvalTip').$visible = d.amount.$value >= 50000`.\n *\n * ```tsx\n * <UI name=\"approvalTip\" component={[Alert, { type: 'warning', message: '金额 ≥ 5 万需要审批' }]} />\n * ```\n *\n * `$visible` / `$disabled` / `$readOnly` / `$title` / `$description` / `$componentProps` / `$decoratorProps`, same\n * priority as a field's UI layer (reaction > these props). Hiding it unmounts its children but does **not** hide,\n * skip or drop the fields inside: a field's validation and submit depend only on its own flags.\n */\nexport function UI<C extends ComponentType<any> = ComponentType<any>, D extends ComponentType<any> = ComponentType<any>>({\n name,\n children,\n visible,\n disabled,\n readOnly,\n ...slots\n}: UIProps<C, D>) {\n const form = useRequiredForm(`<UI name=\"${String(name)}\">`)\n const path = useScope().path\n const prefix = useIdPrefix()\n useUiNode(form, path, name, 'node')\n const kit = useFieldKit()\n // No default decorator: a `<UI>` is not a field, and the kit's FormItem would wrap a tip.\n const ui = withResolvedSlots(withDomId(form.uiBinding(path, name, { ...(normalizeUiSpec(slots, `<UI name=\"${String(name)}\">`) as FieldUiSpec), visible, disabled, readOnly }, 'node') as UiBinding, prefix), kit, false)\n if (!ui.visible) return null\n const Component = ui.component\n const Decorator = ui.decorator\n const inner = typeof children === 'function' ? children(ui) : children\n const content = Component ? <Component {...ui.componentProps}>{inner}</Component> : inner\n if (!Decorator) return content\n // Only the decorator sees the node (FormItem label / extra); a pure-layout FormItem inside does not.\n return (\n <UiNodeContext.Provider value={ui}>\n <Decorator {...ui.decoratorProps}>\n <UiNodeContext.Provider value={null}>{content}</UiNodeContext.Provider>\n </Decorator>\n </UiNodeContext.Provider>\n )\n}\n","import { useCallback } from 'react'\nimport type { Draft } from '@shikiform/core/internal'\nimport { useRequiredForm, useScope } from '../context'\nimport { useWatch } from './use-watch'\nimport { ShikiUsageError } from '@shikiform/core/internal'\n\n/**\n * Index of the row this component renders in (Formily `ArrayBase.useIndex`), from the surrounding `RowScope`\n * (`<ArrayField>` rows, `ArrayTable` cells included). Throws outside a row.\n */\nexport function useIndex(): number {\n const scope = useScope()\n if (scope.index < 0) {\n if (process.env.NODE_ENV !== 'production') {\n throw new ShikiUsageError('useIndex() must render inside an array row (<ArrayField> rows, ArrayTable cells included).')\n }\n throw new Error('useIndex() must render inside an array row')\n }\n return scope.index\n}\n\n/**\n * Value of the row this component renders in (Formily `ArrayBase.useRecord`). Reactive: re-renders when any cell of\n * this row changes, and follows the row when it moves. Throws outside a row (or tree node).\n */\nexport function useRecord<TRow = any>(): TRow {\n const form = useRequiredForm('useRecord()')\n const scope = useScope()\n if (scope.index < 0 && !scope.pos) {\n if (process.env.NODE_ENV !== 'production') {\n throw new ShikiUsageError('useRecord() must render inside an array row (<ArrayField> rows, ArrayTable cells included) or a tree node (<TreeField>).')\n }\n throw new Error('useRecord() must render inside an array row or tree node')\n }\n const path = scope.path\n const select = useCallback((_d: Draft<any>) => form.query(path).$value as TRow, [form, path])\n return useWatch(select)\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentProps, MouseEvent, ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { R as ResetState, F as FormSubmitHandlers, S as SubmitState, C as CheckedFieldProps, a as FieldProps, A as ArrayContainerSlot, b as ArrayKey, U as UseFieldOptions, c as FieldBinding, d as ArrayHandle, e as UseFormOptions } from './use-watch-
|
|
4
|
-
export { f as ArrayErrors, g as ArrayField, h as
|
|
5
|
-
import { FieldPath, PathValue, ArrayPath, ArrayItemOf, Draft, DefaultSubmit, FieldsInput, FormOptions, FormInstance, ResolveSubmit
|
|
6
|
-
export { ArrayItemOf,
|
|
3
|
+
import { R as ResetState, F as FormSubmitHandlers, S as SubmitState, C as CheckedFieldProps, a as FieldProps, A as ArrayContainerSlot, b as ArrayKey, T as TreeNodeRender, U as UseFieldOptions, c as FieldBinding, d as ArrayHandle, e as UseFormOptions } from './use-watch-BJDsp7Zo.js';
|
|
4
|
+
export { f as ArrayErrors, g as ArrayField, h as ArrayScopeValue, B as BlurFlag, i as BlurOn, j as ComponentStatics, k as ConnectEnhancer, l as ConnectFieldProps, m as ConnectedComponent, n as Field, o as FieldComponents, p as FieldDecorators, q as FieldKit, r as FieldKitDecorator, s as FieldKitSpec, t as FieldPropKey, u as FieldSlot, v as FieldStateKey, w as Form, x as FormDomProps, y as FormProps, O as ObjectField, P as PropsMapping, z as PropsTransform, D as RegisteredComponentSlot, E as RegisteredDecoratorSlot, G as RegisteredSlot, H as ScopeValue, I as TreeField, J as TreeHandle, K as TreeNodeHandle, L as TreeOptions, M as TreeScopeValue, N as UI, Q as UIProps, V as UiBinding, W as Watch, X as connect, Y as mapProps, Z as useArrayField, _ as useField, $ as useForm, a0 as useFormContext, a1 as useIndex, a2 as useRecord, a3 as useTreeField, a4 as useWatch } from './use-watch-BJDsp7Zo.js';
|
|
5
|
+
import { FieldPath, PathValue, ArrayPath, ArrayItemOf, Draft, DefaultSubmit, FieldsInput, FormOptions, FormInstance, ResolveSubmit } from '@shikiform/core/internal';
|
|
6
|
+
export { ArrayItemOf, Draft, EffectDef, EnumBinding, EnumOption, EnumSource, FieldEnum, FieldError, FieldPath, FieldSpec, FieldUiSpec, FormInstance, FormMessageKey, FormMessages, FormOptions, MessageArgs, MessageBase, MessageParams, MessageTemplate, MoveResult, NoParams, NormalizePath, PathValue, Pos, RowContext, RowDraft, Rule, RulesInput, ShikiConflictError, ShikiCycleError, ShikiUsageError, SubmitResolved, SubmitSupersededError, SubmitUnstableError, SubmitValues, TemplatePath, TreeMoveParams, UiDraft, UiName, UiNames, ValidateCtx, ValidateTrigger, ValuePath, createForm, defineEffects, enUS, get, getDefaultMessages, isFieldErrors, set, setDefaultMessages, zhCN } from '@shikiform/core';
|
|
7
7
|
|
|
8
8
|
type ButtonPass = Omit<ComponentProps<'button'>, 'onClick' | 'type' | 'disabled' | 'children'>;
|
|
9
9
|
type SubmitProps<T = any> = FormSubmitHandlers<T> & ButtonPass & {
|
|
@@ -66,7 +66,10 @@ type ScopeFields<T> = {
|
|
|
66
66
|
Field: <N extends FieldPath<T>, C extends ComponentType<any> = ComponentType<any>, D extends ComponentType<any> = ComponentType<any>>(props: CheckedFieldProps<T, N, C, D>) => ReactNode;
|
|
67
67
|
ObjectField: <N extends FieldPath<T>>(props: {
|
|
68
68
|
name: N;
|
|
69
|
-
|
|
69
|
+
visible?: FieldProps['visible'];
|
|
70
|
+
disabled?: FieldProps['disabled'];
|
|
71
|
+
readOnly?: FieldProps['readOnly'];
|
|
72
|
+
omit?: FieldProps['omit'];
|
|
70
73
|
children?: ReactNode | ((scope: ScopeFields<NonNullable<PathValue<T, N & string>>>) => ReactNode);
|
|
71
74
|
}) => ReactNode;
|
|
72
75
|
ArrayField: <N extends ArrayPath<T>, C extends ComponentType<any> = ComponentType<any>>(props: {
|
|
@@ -80,6 +83,12 @@ type ScopeFields<T> = {
|
|
|
80
83
|
};
|
|
81
84
|
children?: (row: ArrayKey & ScopeFields<ArrayItemOf<T, N & string>>) => ReactNode;
|
|
82
85
|
}) => ReactNode;
|
|
86
|
+
TreeField: <N extends ArrayPath<T>>(props: {
|
|
87
|
+
name: N;
|
|
88
|
+
childrenKey?: string;
|
|
89
|
+
rowKey?: string;
|
|
90
|
+
children: (node: TreeNodeRender & ScopeFields<ArrayItemOf<T, N & string>>) => ReactNode;
|
|
91
|
+
}) => ReactNode;
|
|
83
92
|
};
|
|
84
93
|
/**
|
|
85
94
|
* {@link typed}'s return: {@link ScopeFields} for the form root plus typed hooks.
|
|
@@ -91,14 +100,16 @@ type FieldsOf<T, F> = {
|
|
|
91
100
|
};
|
|
92
101
|
type TypedForm<T, TRoot = T> = ScopeFields<T> & {
|
|
93
102
|
useField: <N extends FieldPath<T>>(name: N, options?: UseFieldOptions<PathValue<T, N & string>>) => FieldBinding<PathValue<T, N & string>>;
|
|
94
|
-
useArrayField: <N extends ArrayPath<T>>(name: N,
|
|
103
|
+
useArrayField: (<N extends ArrayPath<T>>(name: N, opts?: {
|
|
104
|
+
rowKey?: string;
|
|
105
|
+
}) => ArrayHandle<ArrayItemOf<T, N & string>>) & (() => ArrayHandle<unknown>);
|
|
95
106
|
useWatch: <S>(select: (d: Draft<TRoot>) => S) => S;
|
|
96
107
|
Watch: <S>(props: {
|
|
97
108
|
select: (d: Draft<TRoot>) => S;
|
|
98
109
|
children: (value: S) => ReactNode;
|
|
99
110
|
}) => ReactNode;
|
|
100
111
|
/**
|
|
101
|
-
* Same `createForm`, with `T` already fixed, so `fields` still decides which `
|
|
112
|
+
* Same `createForm`, with `T` already fixed, so `fields` still decides which `omit: true` paths are optional
|
|
102
113
|
* on submit. `createForm<T>(options)` does not: its submit type is `T`.
|
|
103
114
|
*/
|
|
104
115
|
createForm: <TSubmit = DefaultSubmit, const F extends FieldsInput<T> = {}>(options?: Omit<FormOptions<T>, 'fields'> & FieldsOf<T, F>) => FormInstance<T, ResolveSubmit<T, TSubmit, F>>;
|
|
@@ -144,7 +155,7 @@ interface FieldDecorator {
|
|
|
144
155
|
/** `options.description` when passed, otherwise the field description. */
|
|
145
156
|
description: ReactNode;
|
|
146
157
|
/**
|
|
147
|
-
* Whether to show the required mark. The field's `required`, hidden
|
|
158
|
+
* Whether to show the required mark. The field's `required`, hidden when `readOnly`, unless `asterisk` forces it.
|
|
148
159
|
*/
|
|
149
160
|
required: boolean;
|
|
150
161
|
errors: readonly string[];
|
|
@@ -154,12 +165,12 @@ interface FieldDecorator {
|
|
|
154
165
|
/** True when `errors` is non-empty. Warnings alone are not invalid. */
|
|
155
166
|
invalid: boolean;
|
|
156
167
|
validating: boolean;
|
|
168
|
+
visible: boolean;
|
|
157
169
|
disabled: boolean;
|
|
158
170
|
readOnly: boolean;
|
|
159
|
-
pattern: Pattern;
|
|
160
171
|
/** Space-separated ids for `aria-describedby`. Undefined when there is nothing to point at. */
|
|
161
172
|
describedBy: string | undefined;
|
|
162
|
-
/** Spread onto `<label>`. `htmlFor` is omitted
|
|
173
|
+
/** Spread onto `<label>`. `htmlFor` is omitted when `readOnly` (the view is text). */
|
|
163
174
|
labelProps: {
|
|
164
175
|
id: string;
|
|
165
176
|
htmlFor?: string;
|
|
@@ -203,7 +214,7 @@ interface FieldDecoratorOptions {
|
|
|
203
214
|
label?: ReactNode;
|
|
204
215
|
/** Wins over the field description. */
|
|
205
216
|
description?: ReactNode;
|
|
206
|
-
/** Force the required mark on (`true`) or off (`false`). Default: `field.required`, hidden
|
|
217
|
+
/** Force the required mark on (`true`) or off (`false`). Default: `field.required`, hidden when `readOnly`. */
|
|
207
218
|
asterisk?: boolean;
|
|
208
219
|
}
|
|
209
220
|
/**
|
|
@@ -227,17 +238,4 @@ interface FieldDecoratorOptions {
|
|
|
227
238
|
*/
|
|
228
239
|
declare function useFieldDecorator(options?: FieldDecoratorOptions): FieldDecorator;
|
|
229
240
|
|
|
230
|
-
|
|
231
|
-
* Windowed list. `@tanstack/react-virtual` is the scroll engine.
|
|
232
|
-
* Pass the row as `children(index)` — the row should subscribe to its own fields,
|
|
233
|
-
* so a cell edit does not re-render the other mounted rows.
|
|
234
|
-
*/
|
|
235
|
-
declare function VirtualRows({ count, height, rowHeight, overscan, children, }: {
|
|
236
|
-
count: number;
|
|
237
|
-
height: number;
|
|
238
|
-
rowHeight?: number;
|
|
239
|
-
overscan?: number;
|
|
240
|
-
children: (index: number) => ReactNode;
|
|
241
|
-
}): react.JSX.Element;
|
|
242
|
-
|
|
243
|
-
export { ArrayContainerSlot, ArrayHandle, ArrayKey, FieldBinding, type FieldDecorator, type FieldDecoratorOptions, FieldProps, FormSubmitHandlers, Reset, type ResetProps, ResetState, type ScopeFields, Submit, type SubmitProps, SubmitState, type TypedForm, UseFieldOptions, UseFormOptions, VirtualRows, typed, useFieldDecorator };
|
|
241
|
+
export { ArrayContainerSlot, ArrayHandle, ArrayKey, FieldBinding, type FieldDecorator, type FieldDecoratorOptions, FieldProps, FormSubmitHandlers, Reset, type ResetProps, type ScopeFields, Submit, type SubmitProps, TreeNodeRender, type TypedForm, UseFieldOptions, UseFormOptions, typed, useFieldDecorator };
|