@agntcms/next 0.3.2 → 0.3.4
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/{assets-Cyt9upqW.d.cts → assets-B3oNeLdj.d.cts} +1 -1
- package/dist/{assets-P8OCigDG.d.ts → assets-DHumg-X7.d.ts} +1 -1
- package/dist/client.cjs +2831 -4747
- package/dist/client.d.cts +11 -153
- package/dist/client.d.ts +11 -153
- package/dist/client.mjs +4750 -6675
- package/dist/config.cjs +2 -123
- package/dist/config.d.cts +4 -59
- package/dist/config.d.ts +4 -59
- package/dist/config.mjs +2 -116
- package/dist/{defineSection-Kr0pWqMY.d.ts → defineSection-ByG5uwiR.d.cts} +5 -24
- package/dist/{defineSection-9qQ5ulAH.d.cts → defineSection-ChkZCQyQ.d.ts} +5 -24
- package/dist/{rateLimit-CXptRM_K.d.ts → getContent-DAgAn095.d.ts} +3 -132
- package/dist/{rateLimit-CiROGTLE.d.cts → getContent-yK-sARoc.d.cts} +3 -132
- package/dist/handlers.cjs +19 -382
- package/dist/handlers.d.cts +4 -73
- package/dist/handlers.d.ts +4 -73
- package/dist/handlers.mjs +19 -377
- package/dist/index.cjs +1 -109
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.mjs +1 -103
- package/dist/{form-BqY0H1V5.d.cts → page-DXF0_SrY.d.cts} +3 -293
- package/dist/{form-BqY0H1V5.d.ts → page-DXF0_SrY.d.ts} +3 -293
- package/dist/server.cjs +15 -635
- package/dist/server.d.cts +8 -75
- package/dist/server.d.ts +8 -75
- package/dist/server.mjs +11 -618
- package/package.json +1 -1
- package/dist/defineForm-Bp9vzW56.d.ts +0 -71
- package/dist/defineForm-CJ8KZC93.d.cts +0 -71
- package/dist/registry-CraTTwT7.d.cts +0 -29
- package/dist/registry-DMujGqt0.d.ts +0 -29
package/dist/client.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { P as Page,
|
|
2
|
-
|
|
3
|
-
import { A as AnySectionDefinition, E as EditableSlot, c as SlotItem } from './defineSection-9qQ5ulAH.cjs';
|
|
1
|
+
import { P as Page, o as Section, S as SectionSchema, a as ImageValue, b as VideoValue, e as LinkValue, f as ButtonValue, p as SelectOption, m as ListItem } from './page-DXF0_SrY.cjs';
|
|
2
|
+
import { A as AnySectionDefinition, E as EditableSlot, c as SlotItem } from './defineSection-ByG5uwiR.cjs';
|
|
4
3
|
import { ReactNode, ReactElement } from 'react';
|
|
5
4
|
|
|
6
5
|
interface PageRendererProps {
|
|
@@ -57,12 +56,11 @@ declare function usePreviewMode(): PreviewMode;
|
|
|
57
56
|
* domain `SectionDefinition` type at runtime — only at the call site.
|
|
58
57
|
*
|
|
59
58
|
* `schema` and `label` are optional because the picker itself does
|
|
60
|
-
* not need them. They are surfaced here so
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* a runtime contract change.
|
|
59
|
+
* not need them. They are surfaced here so consumers can find a
|
|
60
|
+
* section's field-descriptor map and human label without a parallel
|
|
61
|
+
* definitions channel. At runtime every real `AnySectionDefinition`
|
|
62
|
+
* carries both, so the optional declaration is a type-system
|
|
63
|
+
* relaxation rather than a runtime contract change.
|
|
66
64
|
*/
|
|
67
65
|
interface DefinitionLike {
|
|
68
66
|
readonly name: string;
|
|
@@ -85,13 +83,6 @@ interface DefinitionLike {
|
|
|
85
83
|
readonly schema?: SectionSchema;
|
|
86
84
|
/** Optional human-friendly label. Falls back to `name`. */
|
|
87
85
|
readonly label?: string;
|
|
88
|
-
/**
|
|
89
|
-
* Optional layout names declared on the section definition. When a
|
|
90
|
-
* section with layouts is being edited (caller passes `currentSection`
|
|
91
|
-
* + `onSelectLayout`), the modal renders a "Layout" tab with a
|
|
92
|
-
* preview card per layout. Undefined means no Layout tab.
|
|
93
|
-
*/
|
|
94
|
-
readonly layouts?: readonly string[];
|
|
95
86
|
}
|
|
96
87
|
/**
|
|
97
88
|
* A global content block entry as returned by /api/agntcms/global/list.
|
|
@@ -116,27 +107,17 @@ interface SectionPickerModalProps {
|
|
|
116
107
|
* When omitted, the globals group is not shown (backwards compatible). */
|
|
117
108
|
readonly onSelectGlobal?: (globalName: string) => void;
|
|
118
109
|
/**
|
|
119
|
-
* The section currently being edited. When provided
|
|
120
|
-
*
|
|
121
|
-
* length >= 2, the modal exposes a "Layout" tab next to "Replace".
|
|
110
|
+
* The section currently being edited. When provided, the Replace
|
|
111
|
+
* grid hides the current type to keep the list of alternatives clean.
|
|
122
112
|
*
|
|
123
113
|
* `data` is a plain record (not a PreviewField-wrapped one). Callers in
|
|
124
|
-
* preview mode must strip wrappers before passing
|
|
125
|
-
* renders `<Component {...data} layout={v} />` and React would reject
|
|
126
|
-
* PreviewField objects as children. See SectionEditControls'
|
|
127
|
-
* `stripSectionData` for the stripper.
|
|
114
|
+
* preview mode must strip wrappers before passing.
|
|
128
115
|
*/
|
|
129
116
|
readonly currentSection?: {
|
|
130
117
|
readonly id: string;
|
|
131
118
|
readonly type: string;
|
|
132
119
|
readonly data: Record<string, unknown>;
|
|
133
120
|
};
|
|
134
|
-
/**
|
|
135
|
-
* Called when the user picks a layout from the Layout tab. Omitting
|
|
136
|
-
* this prop hides the Layout tab even if `currentSection` is present —
|
|
137
|
-
* the callback is the only way a click can actually change anything.
|
|
138
|
-
*/
|
|
139
|
-
readonly onSelectLayout?: (layoutName: string) => void;
|
|
140
121
|
}
|
|
141
122
|
declare function SectionPickerModal(props: SectionPickerModalProps): ReactElement | null;
|
|
142
123
|
|
|
@@ -173,94 +154,6 @@ interface SectionEditControlsProps {
|
|
|
173
154
|
*/
|
|
174
155
|
declare function SectionEditControls(props: SectionEditControlsProps): React.ReactElement;
|
|
175
156
|
|
|
176
|
-
/**
|
|
177
|
-
* Derived payload shape for a `FormDefinition<S>`. Maps every field to its
|
|
178
|
-
* runtime value type. We re-derive locally rather than re-using
|
|
179
|
-
* `domain/schema.ts:DataOf<S>` because forms don't use the section data
|
|
180
|
-
* record shape (`hasUniqueSectionIds`, etc.) — they use a flat record.
|
|
181
|
-
*/
|
|
182
|
-
type PayloadOf<S extends FormSchema> = {
|
|
183
|
-
readonly [K in keyof S]: FieldValueFor<S[K]>;
|
|
184
|
-
};
|
|
185
|
-
interface FormProps<S extends FormSchema> {
|
|
186
|
-
/** The form definition produced by `defineForm`. Drives schema-based rendering. */
|
|
187
|
-
readonly definition: FormDefinition<S>;
|
|
188
|
-
/**
|
|
189
|
-
* Content rendered in place of the form on a successful submit. Default:
|
|
190
|
-
* a plain "Thanks — we'll be in touch." message. Set to `null` to render
|
|
191
|
-
* nothing on success.
|
|
192
|
-
*/
|
|
193
|
-
readonly successMessage?: ReactNode;
|
|
194
|
-
/** Submit endpoint. Defaults to `/api/agntcms/forms/submit`. */
|
|
195
|
-
readonly endpoint?: string;
|
|
196
|
-
/** Called with the submitted payload after a successful (stored) submit. */
|
|
197
|
-
readonly onSubmitSuccess?: (payload: PayloadOf<S>) => void;
|
|
198
|
-
/** Called instead of POSTing when the surrounding `<PreviewProvider mode="preview">` is active. */
|
|
199
|
-
readonly onPreviewSubmit?: (payload: PayloadOf<S>) => void;
|
|
200
|
-
/** Class applied to the root `<form>` element. */
|
|
201
|
-
readonly className?: string;
|
|
202
|
-
/** Submit button label. Defaults to "Submit". */
|
|
203
|
-
readonly submitLabel?: string;
|
|
204
|
-
/**
|
|
205
|
-
* Per-section-instance display chrome and instance defaults for the form's
|
|
206
|
-
* fields. See `FormFieldOverrides` (domain/formOverrides.ts) and
|
|
207
|
-
* ARCHITECTURE.md §6.5. Field NAMES, KINDS, and VALIDATION are NOT
|
|
208
|
-
* overridable — only `label`, `placeholder`, `helpText`, `hidden`,
|
|
209
|
-
* `order`, and `default`.
|
|
210
|
-
*
|
|
211
|
-
* A hidden field with a `default` is included in the submitted payload as
|
|
212
|
-
* if the user had typed it. A hidden field WITHOUT a default is omitted
|
|
213
|
-
* entirely — the server-side schema validation will reject if that field
|
|
214
|
-
* is required, by design (callers must provide a default whenever they
|
|
215
|
-
* hide a required field).
|
|
216
|
-
*/
|
|
217
|
-
readonly overrides?: FormFieldOverrides;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* End-user form. Renders one input per declared field, validates server-side
|
|
221
|
-
* via the submit handler, and surfaces error/success states.
|
|
222
|
-
*
|
|
223
|
-
* In preview mode (inside a `<PreviewProvider mode="preview">`) the submit
|
|
224
|
-
* is intercepted: no network call is made, an inline notice is shown, and
|
|
225
|
-
* the optional `onPreviewSubmit` callback receives the typed payload.
|
|
226
|
-
*/
|
|
227
|
-
declare function Form<S extends FormSchema>(props: FormProps<S>): ReactElement;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* The registry value plumbed through context. An empty map is the
|
|
231
|
-
* default — components that look up a form by name and miss render a
|
|
232
|
-
* graceful "form not found" message instead of crashing.
|
|
233
|
-
*/
|
|
234
|
-
type FormsByName = ReadonlyMap<string, AnyFormDefinition>;
|
|
235
|
-
interface FormsRegistryProviderProps {
|
|
236
|
-
/**
|
|
237
|
-
* Either a `ReadonlyMap<string, AnyFormDefinition>` (used directly)
|
|
238
|
-
* or a list of definitions (the provider builds the map). The list
|
|
239
|
-
* shape is convenient for callers who already hold the array from
|
|
240
|
-
* `defineConfig({ forms })`.
|
|
241
|
-
*/
|
|
242
|
-
readonly forms?: FormsByName | ReadonlyArray<AnyFormDefinition>;
|
|
243
|
-
readonly children: ReactNode;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Provider that exposes the registered forms to descendant preview
|
|
247
|
-
* widgets via context. When `forms` is omitted, descendants see the
|
|
248
|
-
* default (empty map) — same outcome as no provider at all.
|
|
249
|
-
*
|
|
250
|
-
* Usage:
|
|
251
|
-
* <FormsRegistryProvider forms={[Contact, Newsletter]}>
|
|
252
|
-
* <SectionEditControls ... />
|
|
253
|
-
* </FormsRegistryProvider>
|
|
254
|
-
*/
|
|
255
|
-
declare function FormsRegistryProvider(props: FormsRegistryProviderProps): React.ReactElement;
|
|
256
|
-
/**
|
|
257
|
-
* Returns the current forms registry. Defaults to an empty map outside
|
|
258
|
-
* a `FormsRegistryProvider`. Consumers MUST handle the empty case
|
|
259
|
-
* gracefully — a missing form name renders a helpful inline message,
|
|
260
|
-
* not a crash.
|
|
261
|
-
*/
|
|
262
|
-
declare function useFormsRegistry(): FormsByName;
|
|
263
|
-
|
|
264
157
|
interface SectionReplaceOverlayProps {
|
|
265
158
|
/** The section being replaced (id + current type). */
|
|
266
159
|
readonly sectionId: string;
|
|
@@ -275,20 +168,6 @@ interface SectionReplaceOverlayProps {
|
|
|
275
168
|
/** Called when a global is selected as the replacement.
|
|
276
169
|
* When provided, the picker shows globals alongside section types. */
|
|
277
170
|
readonly onSelectGlobal?: (globalName: string) => void;
|
|
278
|
-
/**
|
|
279
|
-
* The section currently being edited. Forwarded to `SectionPickerModal`
|
|
280
|
-
* to enable the "Layout" tab for sections with declared layouts. Data
|
|
281
|
-
* must be PreviewField-stripped by the caller (SectionEditControls does
|
|
282
|
-
* this via its `stripSectionData` helper). When omitted, the Layout tab
|
|
283
|
-
* is hidden regardless of `onSelectLayout`.
|
|
284
|
-
*/
|
|
285
|
-
readonly currentSection?: {
|
|
286
|
-
readonly id: string;
|
|
287
|
-
readonly type: string;
|
|
288
|
-
readonly data: Record<string, unknown>;
|
|
289
|
-
};
|
|
290
|
-
/** Called when a layout is picked from the Layout tab. */
|
|
291
|
-
readonly onSelectLayout?: (layoutName: string) => void;
|
|
292
171
|
}
|
|
293
172
|
declare function SectionReplaceOverlay(props: SectionReplaceOverlayProps): React.ReactElement | null;
|
|
294
173
|
|
|
@@ -301,19 +180,6 @@ interface SectionWrapperProps {
|
|
|
301
180
|
readonly onReplaced?: () => void;
|
|
302
181
|
/** Forwarded to the picker to allow replacing a section with a global. */
|
|
303
182
|
readonly onSelectGlobal?: (globalName: string) => void;
|
|
304
|
-
/**
|
|
305
|
-
* The section currently being edited. Forwarded to the picker modal so
|
|
306
|
-
* sections declaring `layouts` can expose a "Layout" tab. `data` must
|
|
307
|
-
* be PreviewField-stripped by the caller — the picker renders the section
|
|
308
|
-
* component with this data and React rejects wrapper objects as props.
|
|
309
|
-
*/
|
|
310
|
-
readonly currentSection?: {
|
|
311
|
-
readonly id: string;
|
|
312
|
-
readonly type: string;
|
|
313
|
-
readonly data: Record<string, unknown>;
|
|
314
|
-
};
|
|
315
|
-
/** Forwarded to the picker; invoked when a layout is chosen. */
|
|
316
|
-
readonly onSelectLayout?: (layoutName: string) => void;
|
|
317
183
|
/**
|
|
318
184
|
* Optional slot rendered inside the hover-controls area next to the ⇄
|
|
319
185
|
* replace button. The caller composes any React node (typically an
|
|
@@ -330,14 +196,6 @@ interface SectionWrapperProps {
|
|
|
330
196
|
* just places it in the hover scope.
|
|
331
197
|
*/
|
|
332
198
|
readonly deleteAction?: React.ReactNode;
|
|
333
|
-
/**
|
|
334
|
-
* Optional slot for the edit (✎) button. Same composition pattern
|
|
335
|
-
* as `agentAction` and `deleteAction`: rendered inside the hover scope
|
|
336
|
-
* so the same group-hover rule fades it in. The caller positions and
|
|
337
|
-
* styles the button; SectionWrapper stays agnostic of the modal it
|
|
338
|
-
* opens (which would otherwise pull preview-only deps into this leaf).
|
|
339
|
-
*/
|
|
340
|
-
readonly settingsAction?: React.ReactNode;
|
|
341
199
|
readonly children: React.ReactNode;
|
|
342
200
|
}
|
|
343
201
|
/**
|
|
@@ -803,4 +661,4 @@ interface GlobalSaveProviderProps {
|
|
|
803
661
|
*/
|
|
804
662
|
declare function GlobalSaveProvider(props: GlobalSaveProviderProps): React.ReactElement;
|
|
805
663
|
|
|
806
|
-
export { AdminModal, type AdminModalProps, ButtonPickerModal, type ButtonPickerModalProps, type DefinitionLike, EditableBoolean, type EditableBooleanProps, EditableButton, type EditableButtonProps, EditableImage, type EditableImageProps, EditableLink, type EditableLinkProps, EditableList, type EditableListProps, EditableNumber, type EditableNumberProps, EditableRichText, type EditableRichTextProps, EditableSelect, type EditableSelectProps, EditableSlot, EditableText, type EditableTextProps, EditableVideo, type EditableVideoProps,
|
|
664
|
+
export { AdminModal, type AdminModalProps, ButtonPickerModal, type ButtonPickerModalProps, type DefinitionLike, EditableBoolean, type EditableBooleanProps, EditableButton, type EditableButtonProps, EditableImage, type EditableImageProps, EditableLink, type EditableLinkProps, EditableList, type EditableListProps, EditableNumber, type EditableNumberProps, EditableRichText, type EditableRichTextProps, EditableSelect, type EditableSelectProps, EditableSlot, EditableText, type EditableTextProps, EditableVideo, type EditableVideoProps, type GlobalEntry, GlobalSaveProvider, type GlobalSaveProviderProps, PageRenderer, type PageRendererProps, type PreviewContextValue, type PreviewFieldLike, type PreviewFieldOriginLike, type PreviewMode, PreviewProvider, type PreviewProviderProps, PreviewToolbar, type PreviewToolbarProps, type SaveFieldFn, SaveProvider, type SaveProviderProps, SectionEditControls, type SectionEditControlsProps, SectionPickerModal, type SectionPickerModalProps, SectionRenderer, type SectionRendererProps, SectionReplaceOverlay, type SectionReplaceOverlayProps, SectionWrapper, type SectionWrapperProps, SlotItem, type TaskState, type TaskStatus, VideoPickerModal, type VideoPickerModalProps, isPreviewField, isSlotInPreview, read, usePreviewMode, useSaveField, useTaskEvents };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { P as Page,
|
|
2
|
-
|
|
3
|
-
import { A as AnySectionDefinition, E as EditableSlot, c as SlotItem } from './defineSection-Kr0pWqMY.js';
|
|
1
|
+
import { P as Page, o as Section, S as SectionSchema, a as ImageValue, b as VideoValue, e as LinkValue, f as ButtonValue, p as SelectOption, m as ListItem } from './page-DXF0_SrY.js';
|
|
2
|
+
import { A as AnySectionDefinition, E as EditableSlot, c as SlotItem } from './defineSection-ChkZCQyQ.js';
|
|
4
3
|
import { ReactNode, ReactElement } from 'react';
|
|
5
4
|
|
|
6
5
|
interface PageRendererProps {
|
|
@@ -57,12 +56,11 @@ declare function usePreviewMode(): PreviewMode;
|
|
|
57
56
|
* domain `SectionDefinition` type at runtime — only at the call site.
|
|
58
57
|
*
|
|
59
58
|
* `schema` and `label` are optional because the picker itself does
|
|
60
|
-
* not need them. They are surfaced here so
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* a runtime contract change.
|
|
59
|
+
* not need them. They are surfaced here so consumers can find a
|
|
60
|
+
* section's field-descriptor map and human label without a parallel
|
|
61
|
+
* definitions channel. At runtime every real `AnySectionDefinition`
|
|
62
|
+
* carries both, so the optional declaration is a type-system
|
|
63
|
+
* relaxation rather than a runtime contract change.
|
|
66
64
|
*/
|
|
67
65
|
interface DefinitionLike {
|
|
68
66
|
readonly name: string;
|
|
@@ -85,13 +83,6 @@ interface DefinitionLike {
|
|
|
85
83
|
readonly schema?: SectionSchema;
|
|
86
84
|
/** Optional human-friendly label. Falls back to `name`. */
|
|
87
85
|
readonly label?: string;
|
|
88
|
-
/**
|
|
89
|
-
* Optional layout names declared on the section definition. When a
|
|
90
|
-
* section with layouts is being edited (caller passes `currentSection`
|
|
91
|
-
* + `onSelectLayout`), the modal renders a "Layout" tab with a
|
|
92
|
-
* preview card per layout. Undefined means no Layout tab.
|
|
93
|
-
*/
|
|
94
|
-
readonly layouts?: readonly string[];
|
|
95
86
|
}
|
|
96
87
|
/**
|
|
97
88
|
* A global content block entry as returned by /api/agntcms/global/list.
|
|
@@ -116,27 +107,17 @@ interface SectionPickerModalProps {
|
|
|
116
107
|
* When omitted, the globals group is not shown (backwards compatible). */
|
|
117
108
|
readonly onSelectGlobal?: (globalName: string) => void;
|
|
118
109
|
/**
|
|
119
|
-
* The section currently being edited. When provided
|
|
120
|
-
*
|
|
121
|
-
* length >= 2, the modal exposes a "Layout" tab next to "Replace".
|
|
110
|
+
* The section currently being edited. When provided, the Replace
|
|
111
|
+
* grid hides the current type to keep the list of alternatives clean.
|
|
122
112
|
*
|
|
123
113
|
* `data` is a plain record (not a PreviewField-wrapped one). Callers in
|
|
124
|
-
* preview mode must strip wrappers before passing
|
|
125
|
-
* renders `<Component {...data} layout={v} />` and React would reject
|
|
126
|
-
* PreviewField objects as children. See SectionEditControls'
|
|
127
|
-
* `stripSectionData` for the stripper.
|
|
114
|
+
* preview mode must strip wrappers before passing.
|
|
128
115
|
*/
|
|
129
116
|
readonly currentSection?: {
|
|
130
117
|
readonly id: string;
|
|
131
118
|
readonly type: string;
|
|
132
119
|
readonly data: Record<string, unknown>;
|
|
133
120
|
};
|
|
134
|
-
/**
|
|
135
|
-
* Called when the user picks a layout from the Layout tab. Omitting
|
|
136
|
-
* this prop hides the Layout tab even if `currentSection` is present —
|
|
137
|
-
* the callback is the only way a click can actually change anything.
|
|
138
|
-
*/
|
|
139
|
-
readonly onSelectLayout?: (layoutName: string) => void;
|
|
140
121
|
}
|
|
141
122
|
declare function SectionPickerModal(props: SectionPickerModalProps): ReactElement | null;
|
|
142
123
|
|
|
@@ -173,94 +154,6 @@ interface SectionEditControlsProps {
|
|
|
173
154
|
*/
|
|
174
155
|
declare function SectionEditControls(props: SectionEditControlsProps): React.ReactElement;
|
|
175
156
|
|
|
176
|
-
/**
|
|
177
|
-
* Derived payload shape for a `FormDefinition<S>`. Maps every field to its
|
|
178
|
-
* runtime value type. We re-derive locally rather than re-using
|
|
179
|
-
* `domain/schema.ts:DataOf<S>` because forms don't use the section data
|
|
180
|
-
* record shape (`hasUniqueSectionIds`, etc.) — they use a flat record.
|
|
181
|
-
*/
|
|
182
|
-
type PayloadOf<S extends FormSchema> = {
|
|
183
|
-
readonly [K in keyof S]: FieldValueFor<S[K]>;
|
|
184
|
-
};
|
|
185
|
-
interface FormProps<S extends FormSchema> {
|
|
186
|
-
/** The form definition produced by `defineForm`. Drives schema-based rendering. */
|
|
187
|
-
readonly definition: FormDefinition<S>;
|
|
188
|
-
/**
|
|
189
|
-
* Content rendered in place of the form on a successful submit. Default:
|
|
190
|
-
* a plain "Thanks — we'll be in touch." message. Set to `null` to render
|
|
191
|
-
* nothing on success.
|
|
192
|
-
*/
|
|
193
|
-
readonly successMessage?: ReactNode;
|
|
194
|
-
/** Submit endpoint. Defaults to `/api/agntcms/forms/submit`. */
|
|
195
|
-
readonly endpoint?: string;
|
|
196
|
-
/** Called with the submitted payload after a successful (stored) submit. */
|
|
197
|
-
readonly onSubmitSuccess?: (payload: PayloadOf<S>) => void;
|
|
198
|
-
/** Called instead of POSTing when the surrounding `<PreviewProvider mode="preview">` is active. */
|
|
199
|
-
readonly onPreviewSubmit?: (payload: PayloadOf<S>) => void;
|
|
200
|
-
/** Class applied to the root `<form>` element. */
|
|
201
|
-
readonly className?: string;
|
|
202
|
-
/** Submit button label. Defaults to "Submit". */
|
|
203
|
-
readonly submitLabel?: string;
|
|
204
|
-
/**
|
|
205
|
-
* Per-section-instance display chrome and instance defaults for the form's
|
|
206
|
-
* fields. See `FormFieldOverrides` (domain/formOverrides.ts) and
|
|
207
|
-
* ARCHITECTURE.md §6.5. Field NAMES, KINDS, and VALIDATION are NOT
|
|
208
|
-
* overridable — only `label`, `placeholder`, `helpText`, `hidden`,
|
|
209
|
-
* `order`, and `default`.
|
|
210
|
-
*
|
|
211
|
-
* A hidden field with a `default` is included in the submitted payload as
|
|
212
|
-
* if the user had typed it. A hidden field WITHOUT a default is omitted
|
|
213
|
-
* entirely — the server-side schema validation will reject if that field
|
|
214
|
-
* is required, by design (callers must provide a default whenever they
|
|
215
|
-
* hide a required field).
|
|
216
|
-
*/
|
|
217
|
-
readonly overrides?: FormFieldOverrides;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* End-user form. Renders one input per declared field, validates server-side
|
|
221
|
-
* via the submit handler, and surfaces error/success states.
|
|
222
|
-
*
|
|
223
|
-
* In preview mode (inside a `<PreviewProvider mode="preview">`) the submit
|
|
224
|
-
* is intercepted: no network call is made, an inline notice is shown, and
|
|
225
|
-
* the optional `onPreviewSubmit` callback receives the typed payload.
|
|
226
|
-
*/
|
|
227
|
-
declare function Form<S extends FormSchema>(props: FormProps<S>): ReactElement;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* The registry value plumbed through context. An empty map is the
|
|
231
|
-
* default — components that look up a form by name and miss render a
|
|
232
|
-
* graceful "form not found" message instead of crashing.
|
|
233
|
-
*/
|
|
234
|
-
type FormsByName = ReadonlyMap<string, AnyFormDefinition>;
|
|
235
|
-
interface FormsRegistryProviderProps {
|
|
236
|
-
/**
|
|
237
|
-
* Either a `ReadonlyMap<string, AnyFormDefinition>` (used directly)
|
|
238
|
-
* or a list of definitions (the provider builds the map). The list
|
|
239
|
-
* shape is convenient for callers who already hold the array from
|
|
240
|
-
* `defineConfig({ forms })`.
|
|
241
|
-
*/
|
|
242
|
-
readonly forms?: FormsByName | ReadonlyArray<AnyFormDefinition>;
|
|
243
|
-
readonly children: ReactNode;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Provider that exposes the registered forms to descendant preview
|
|
247
|
-
* widgets via context. When `forms` is omitted, descendants see the
|
|
248
|
-
* default (empty map) — same outcome as no provider at all.
|
|
249
|
-
*
|
|
250
|
-
* Usage:
|
|
251
|
-
* <FormsRegistryProvider forms={[Contact, Newsletter]}>
|
|
252
|
-
* <SectionEditControls ... />
|
|
253
|
-
* </FormsRegistryProvider>
|
|
254
|
-
*/
|
|
255
|
-
declare function FormsRegistryProvider(props: FormsRegistryProviderProps): React.ReactElement;
|
|
256
|
-
/**
|
|
257
|
-
* Returns the current forms registry. Defaults to an empty map outside
|
|
258
|
-
* a `FormsRegistryProvider`. Consumers MUST handle the empty case
|
|
259
|
-
* gracefully — a missing form name renders a helpful inline message,
|
|
260
|
-
* not a crash.
|
|
261
|
-
*/
|
|
262
|
-
declare function useFormsRegistry(): FormsByName;
|
|
263
|
-
|
|
264
157
|
interface SectionReplaceOverlayProps {
|
|
265
158
|
/** The section being replaced (id + current type). */
|
|
266
159
|
readonly sectionId: string;
|
|
@@ -275,20 +168,6 @@ interface SectionReplaceOverlayProps {
|
|
|
275
168
|
/** Called when a global is selected as the replacement.
|
|
276
169
|
* When provided, the picker shows globals alongside section types. */
|
|
277
170
|
readonly onSelectGlobal?: (globalName: string) => void;
|
|
278
|
-
/**
|
|
279
|
-
* The section currently being edited. Forwarded to `SectionPickerModal`
|
|
280
|
-
* to enable the "Layout" tab for sections with declared layouts. Data
|
|
281
|
-
* must be PreviewField-stripped by the caller (SectionEditControls does
|
|
282
|
-
* this via its `stripSectionData` helper). When omitted, the Layout tab
|
|
283
|
-
* is hidden regardless of `onSelectLayout`.
|
|
284
|
-
*/
|
|
285
|
-
readonly currentSection?: {
|
|
286
|
-
readonly id: string;
|
|
287
|
-
readonly type: string;
|
|
288
|
-
readonly data: Record<string, unknown>;
|
|
289
|
-
};
|
|
290
|
-
/** Called when a layout is picked from the Layout tab. */
|
|
291
|
-
readonly onSelectLayout?: (layoutName: string) => void;
|
|
292
171
|
}
|
|
293
172
|
declare function SectionReplaceOverlay(props: SectionReplaceOverlayProps): React.ReactElement | null;
|
|
294
173
|
|
|
@@ -301,19 +180,6 @@ interface SectionWrapperProps {
|
|
|
301
180
|
readonly onReplaced?: () => void;
|
|
302
181
|
/** Forwarded to the picker to allow replacing a section with a global. */
|
|
303
182
|
readonly onSelectGlobal?: (globalName: string) => void;
|
|
304
|
-
/**
|
|
305
|
-
* The section currently being edited. Forwarded to the picker modal so
|
|
306
|
-
* sections declaring `layouts` can expose a "Layout" tab. `data` must
|
|
307
|
-
* be PreviewField-stripped by the caller — the picker renders the section
|
|
308
|
-
* component with this data and React rejects wrapper objects as props.
|
|
309
|
-
*/
|
|
310
|
-
readonly currentSection?: {
|
|
311
|
-
readonly id: string;
|
|
312
|
-
readonly type: string;
|
|
313
|
-
readonly data: Record<string, unknown>;
|
|
314
|
-
};
|
|
315
|
-
/** Forwarded to the picker; invoked when a layout is chosen. */
|
|
316
|
-
readonly onSelectLayout?: (layoutName: string) => void;
|
|
317
183
|
/**
|
|
318
184
|
* Optional slot rendered inside the hover-controls area next to the ⇄
|
|
319
185
|
* replace button. The caller composes any React node (typically an
|
|
@@ -330,14 +196,6 @@ interface SectionWrapperProps {
|
|
|
330
196
|
* just places it in the hover scope.
|
|
331
197
|
*/
|
|
332
198
|
readonly deleteAction?: React.ReactNode;
|
|
333
|
-
/**
|
|
334
|
-
* Optional slot for the edit (✎) button. Same composition pattern
|
|
335
|
-
* as `agentAction` and `deleteAction`: rendered inside the hover scope
|
|
336
|
-
* so the same group-hover rule fades it in. The caller positions and
|
|
337
|
-
* styles the button; SectionWrapper stays agnostic of the modal it
|
|
338
|
-
* opens (which would otherwise pull preview-only deps into this leaf).
|
|
339
|
-
*/
|
|
340
|
-
readonly settingsAction?: React.ReactNode;
|
|
341
199
|
readonly children: React.ReactNode;
|
|
342
200
|
}
|
|
343
201
|
/**
|
|
@@ -803,4 +661,4 @@ interface GlobalSaveProviderProps {
|
|
|
803
661
|
*/
|
|
804
662
|
declare function GlobalSaveProvider(props: GlobalSaveProviderProps): React.ReactElement;
|
|
805
663
|
|
|
806
|
-
export { AdminModal, type AdminModalProps, ButtonPickerModal, type ButtonPickerModalProps, type DefinitionLike, EditableBoolean, type EditableBooleanProps, EditableButton, type EditableButtonProps, EditableImage, type EditableImageProps, EditableLink, type EditableLinkProps, EditableList, type EditableListProps, EditableNumber, type EditableNumberProps, EditableRichText, type EditableRichTextProps, EditableSelect, type EditableSelectProps, EditableSlot, EditableText, type EditableTextProps, EditableVideo, type EditableVideoProps,
|
|
664
|
+
export { AdminModal, type AdminModalProps, ButtonPickerModal, type ButtonPickerModalProps, type DefinitionLike, EditableBoolean, type EditableBooleanProps, EditableButton, type EditableButtonProps, EditableImage, type EditableImageProps, EditableLink, type EditableLinkProps, EditableList, type EditableListProps, EditableNumber, type EditableNumberProps, EditableRichText, type EditableRichTextProps, EditableSelect, type EditableSelectProps, EditableSlot, EditableText, type EditableTextProps, EditableVideo, type EditableVideoProps, type GlobalEntry, GlobalSaveProvider, type GlobalSaveProviderProps, PageRenderer, type PageRendererProps, type PreviewContextValue, type PreviewFieldLike, type PreviewFieldOriginLike, type PreviewMode, PreviewProvider, type PreviewProviderProps, PreviewToolbar, type PreviewToolbarProps, type SaveFieldFn, SaveProvider, type SaveProviderProps, SectionEditControls, type SectionEditControlsProps, SectionPickerModal, type SectionPickerModalProps, SectionRenderer, type SectionRendererProps, SectionReplaceOverlay, type SectionReplaceOverlayProps, SectionWrapper, type SectionWrapperProps, SlotItem, type TaskState, type TaskStatus, VideoPickerModal, type VideoPickerModalProps, isPreviewField, isSlotInPreview, read, usePreviewMode, useSaveField, useTaskEvents };
|