@pipelex/mthds-form 0.32.0 → 0.33.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/README.md +1 -1
- package/dist/{chunk-VBXFGUCG.js → chunk-4SRSGZWM.js} +333 -107
- package/dist/chunk-4SRSGZWM.js.map +1 -0
- package/dist/{chunk-PCNFELNT.js → chunk-UKTYADY3.js} +2 -2
- package/dist/{chunk-PCNFELNT.js.map → chunk-UKTYADY3.js.map} +1 -1
- package/dist/{field-renderer-Dz03dpig.d.ts → field-renderer-BYN6YrU-.d.ts} +6 -6
- package/dist/generative/headless/index.d.ts +47 -16
- package/dist/generative/headless/index.js +1 -1
- package/dist/generative/index.d.ts +56 -25
- package/dist/generative/index.js +424 -145
- package/dist/generative/index.js.map +1 -1
- package/dist/react/index.d.ts +27 -27
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-VBXFGUCG.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ReactNode, RefObject, Ref } from 'react';
|
|
3
3
|
import { FileRunField, RunField } from './core/descriptor.js';
|
|
4
4
|
import { FileFormat } from './core/file-formats.js';
|
|
@@ -51,7 +51,7 @@ interface FilePickerEntryProps {
|
|
|
51
51
|
* "Choose from your team's files": a full-width row with a folder icon, under
|
|
52
52
|
* the field's own controls.
|
|
53
53
|
*/
|
|
54
|
-
declare function FilePickerEntry({ onOpen, label, disabled, ref, id }: FilePickerEntryProps):
|
|
54
|
+
declare function FilePickerEntry({ onOpen, label, disabled, ref, id }: FilePickerEntryProps): React.JSX.Element;
|
|
55
55
|
interface FilePickerProps {
|
|
56
56
|
/** The host's list, and how its rows draw. */
|
|
57
57
|
source: FilePickerSource;
|
|
@@ -106,7 +106,7 @@ interface FilePickerProps {
|
|
|
106
106
|
* the field as it was: only Use writes. The sheet's state lives in its body,
|
|
107
107
|
* which mounts when it opens, so it always opens on a fresh choice.
|
|
108
108
|
*/
|
|
109
|
-
declare function FilePicker({ open, onOpenChange, returnFocusTo, onCloseAutoFocus, disabled, ...props }: FilePickerProps):
|
|
109
|
+
declare function FilePicker({ open, onOpenChange, returnFocusTo, onCloseAutoFocus, disabled, ...props }: FilePickerProps): React.JSX.Element;
|
|
110
110
|
|
|
111
111
|
/** The serializable value of a file field. URL is what the runner sends. */
|
|
112
112
|
interface FileValue {
|
|
@@ -167,9 +167,9 @@ interface FileFieldProps {
|
|
|
167
167
|
disabled?: boolean;
|
|
168
168
|
}
|
|
169
169
|
/** Document variant: a file shown as a PDF preview (or chip for other docs). */
|
|
170
|
-
declare function DocumentField(props: FileFieldProps):
|
|
170
|
+
declare function DocumentField(props: FileFieldProps): React.JSX.Element;
|
|
171
171
|
/** Image variant: a file shown as a real image preview. */
|
|
172
|
-
declare function ImageField(props: FileFieldProps):
|
|
172
|
+
declare function ImageField(props: FileFieldProps): React.JSX.Element;
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* The moves a host makes to a list's rows, and what a move does to an id.
|
|
@@ -317,6 +317,6 @@ interface FieldRendererProps {
|
|
|
317
317
|
* Object and list fields recurse back through here, so the whole form is one
|
|
318
318
|
* data-driven tree with no per-type branching anywhere else.
|
|
319
319
|
*/
|
|
320
|
-
declare function FieldRenderer({ field, value, onChange, id, error, env }: FieldRendererProps):
|
|
320
|
+
declare function FieldRenderer({ field, value, onChange, id, error, env }: FieldRendererProps): React.JSX.Element;
|
|
321
321
|
|
|
322
322
|
export { DocumentField as D, type FieldEnv as F, ImageField as I, type RowMove as R, type UploadedFile as U, type FilePickerSource as a, FieldRenderer as b, type FieldRendererProps as c, FilePicker as d, FilePickerEntry as e, type FilePickerEntryProps as f, type FilePickerProps as g, type FileValue as h };
|
|
@@ -17,7 +17,7 @@ import '../../core/file-formats.js';
|
|
|
17
17
|
* centred column whose host draws the band above it and the action row's
|
|
18
18
|
* mechanics, and the result after one, under the host's bar restating the
|
|
19
19
|
* request. The two moments carry their own components, found by measuring the
|
|
20
|
-
* designer against hand-drawn screens of
|
|
20
|
+
* designer against hand-drawn screens of several methods: the composer's frame
|
|
21
21
|
* (`Composer`, with the page's h1, the panel and the host's action row) and a
|
|
22
22
|
* group of inputs inside it, and a result's header, a proportion bar, colour
|
|
23
23
|
* swatches, a picture, a fact, a labelled detail, a date in words and a list
|
|
@@ -1072,11 +1072,17 @@ type GenerativeSpec = typeof catalog._specType;
|
|
|
1072
1072
|
* prose, in `methods/layout-design.mthds`.
|
|
1073
1073
|
*/
|
|
1074
1074
|
declare const COMPONENT_NAMES: readonly string[];
|
|
1075
|
-
/**
|
|
1075
|
+
/**
|
|
1076
|
+
* The component names a layout written for `frame` may use, in the order the
|
|
1077
|
+
* designer method lists them. Frozen, like the catalog `frameCatalog` builds
|
|
1078
|
+
* over them: both are shared by every check, so a caller that edited one
|
|
1079
|
+
* would change what every later check accepts.
|
|
1080
|
+
*/
|
|
1076
1081
|
declare function componentNamesFor(frame: Frame): readonly string[];
|
|
1077
1082
|
/**
|
|
1078
1083
|
* The catalog a layout written for `frame` is validated against: the same
|
|
1079
|
-
* definitions and renderings as `catalog`, held to the frame's vocabulary.
|
|
1084
|
+
* definitions and renderings as `catalog`, held to the frame's vocabulary.
|
|
1085
|
+
* Built once per frame and shared, so it is frozen with its vocabulary. A
|
|
1080
1086
|
* composer that names an `AppBar` is refused here as an unknown component,
|
|
1081
1087
|
* though the entry's registry could render one, because the host's frame
|
|
1082
1088
|
* already draws what it stands for.
|
|
@@ -1272,9 +1278,9 @@ declare function designerCatalog({ frame }?: DesignerCatalogOptions): DesignerCa
|
|
|
1272
1278
|
* the catalog as data (`designerCatalog({ frame })`). Both are what a run was
|
|
1273
1279
|
* actually given, so both are hashed - a reworded rule and a renamed prop each
|
|
1274
1280
|
* move the pin, exactly as they did when the prompt was rendered here. A run
|
|
1275
|
-
* is given the catalog of one frame, and the hash covers
|
|
1276
|
-
* order: one pin a host compares every stored layout with, whichever
|
|
1277
|
-
* was written for, and which any frame's vocabulary moving moves. The frame a
|
|
1281
|
+
* is given the catalog of one frame, and the hash covers every frame's in a
|
|
1282
|
+
* fixed order: one pin a host compares every stored layout with, whichever
|
|
1283
|
+
* frame it was written for, and which any frame's vocabulary moving moves. The frame a
|
|
1278
1284
|
* layout was written for is its own provenance, beside the hash. The brief is
|
|
1279
1285
|
* not hashed: it is the per-method half, recorded with each layout. The model
|
|
1280
1286
|
* pin in the method file moves it too, since the file is hashed whole; a
|
|
@@ -1394,23 +1400,48 @@ interface LayoutCheck {
|
|
|
1394
1400
|
frame: Frame;
|
|
1395
1401
|
descriptor: LayoutDescriptor;
|
|
1396
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* The checks' answer on a layout: every problem they found, one a line, and
|
|
1405
|
+
* whether they themselves failed on it.
|
|
1406
|
+
*/
|
|
1407
|
+
interface LayoutVerdict {
|
|
1408
|
+
/** Every problem, one a line, in the words the repair pass reads; empty means the layout may render. */
|
|
1409
|
+
problems: string[];
|
|
1410
|
+
/**
|
|
1411
|
+
* Whether a check threw on a layout of the right shape: a defect in the
|
|
1412
|
+
* checks, stated among the problems in a line of its own. The layout is
|
|
1413
|
+
* refused all the same - the host keeps the plain form - but a producer
|
|
1414
|
+
* stops here instead of handing the lines to the repair pass, which can
|
|
1415
|
+
* change the layout and not the checks.
|
|
1416
|
+
*/
|
|
1417
|
+
checksFailed: boolean;
|
|
1418
|
+
}
|
|
1397
1419
|
/**
|
|
1398
1420
|
* Everything the host's two checks find wrong with a layout written for
|
|
1399
|
-
* `frame`,
|
|
1421
|
+
* `frame`, and whether the checks themselves failed on it: first the
|
|
1400
1422
|
* catalog's verdict against the frame's own vocabulary (`frameCatalog`), then
|
|
1401
|
-
* whether it fits the descriptor (`layoutProblems`). Empty
|
|
1402
|
-
* may render. A producer feeds the lines, joined, to `repair_layout`
|
|
1403
|
-
* `problems
|
|
1404
|
-
* whether the list is
|
|
1423
|
+
* whether it fits the descriptor (`layoutProblems`). Empty problems mean the
|
|
1424
|
+
* layout may render. A producer feeds the lines, joined, to `repair_layout`
|
|
1425
|
+
* as its `problems`, unless `checksFailed` says no repair can help; a host
|
|
1426
|
+
* deciding whether a stored layout renders needs only whether the list is
|
|
1427
|
+
* empty, which `layoutCheckProblems` answers alone.
|
|
1405
1428
|
*
|
|
1406
1429
|
* It never throws. Its subject is whatever a model wrote, or a layout and a
|
|
1407
1430
|
* frame a host stored and read back, and a throw is the one answer a host
|
|
1408
1431
|
* cannot act on: it arrives instead of the problem that would have sent the
|
|
1409
|
-
* page to its fallback. So a frame this package does not draw, a missing
|
|
1410
|
-
* descriptor, and anything
|
|
1411
|
-
* and
|
|
1432
|
+
* page to its fallback. So a frame this package does not draw, a missing or
|
|
1433
|
+
* misshapen descriptor, and anything not shaped like a spec are each a
|
|
1434
|
+
* problem line, and a throw left in a walk below on a layout of the right
|
|
1435
|
+
* shape is the checks' own failure: a line saying so, and `checksFailed`.
|
|
1436
|
+
* The shape is checked once, before either check walks the layout.
|
|
1437
|
+
*/
|
|
1438
|
+
declare function layoutCheck(spec: Spec, { frame, descriptor }: LayoutCheck): LayoutVerdict;
|
|
1439
|
+
/**
|
|
1440
|
+
* Everything the host's two checks find wrong with a layout written for
|
|
1441
|
+
* `frame`, one problem a line: `layoutCheck`'s problems alone, for a host
|
|
1442
|
+
* that needs only whether a stored layout renders. Never throws.
|
|
1412
1443
|
*/
|
|
1413
|
-
declare function layoutCheckProblems(spec: Spec,
|
|
1444
|
+
declare function layoutCheckProblems(spec: Spec, check: LayoutCheck): string[];
|
|
1414
1445
|
|
|
1415
1446
|
/**
|
|
1416
1447
|
* The brief: the model's view of the descriptor, as DATA.
|
|
@@ -1699,4 +1730,4 @@ declare function fixtureLabel(fixture: Provenance & Pick<SpecFixture, 'repairs'>
|
|
|
1699
1730
|
/** The fixture a story asks for, or a loud failure: a story must never render a page it did not name. */
|
|
1700
1731
|
declare function findFixture(fixtures: readonly SpecFixture[], pipeRef: string, id: string): SpecFixture;
|
|
1701
1732
|
|
|
1702
|
-
export { type BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, type ComponentRendering, type CriticLoop, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, type DesignerAction, type DesignerBrief, type DesignerCatalog, type DesignerCatalogOptions, type DesignerComponent, type DesignerPathEntry, type DesignerStyle, FRAMES, FRAME_COMPONENTS, type Frame, type GenerativeSpec, ICON_NAMES, INPUTS_ROOT, type InputBriefOptions, type LayoutCheck, type LayoutDescriptor, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, type Producer, type ProductComponentName, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, type ResultBriefOptions, type SpecFixture, type SpecProblem, type SpecVerdict, type ValidationCatalog, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog };
|
|
1733
|
+
export { type BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, type ComponentRendering, type CriticLoop, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, type DesignerAction, type DesignerBrief, type DesignerCatalog, type DesignerCatalogOptions, type DesignerComponent, type DesignerPathEntry, type DesignerStyle, FRAMES, FRAME_COMPONENTS, type Frame, type GenerativeSpec, ICON_NAMES, INPUTS_ROOT, type InputBriefOptions, type LayoutCheck, type LayoutDescriptor, type LayoutVerdict, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, type Producer, type ProductComponentName, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, type ResultBriefOptions, type SpecFixture, type SpecProblem, type SpecVerdict, type ValidationCatalog, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheck, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, FRAMES, FRAME_COMPONENTS, ICON_NAMES, INPUTS_ROOT, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog } from '../../chunk-
|
|
1
|
+
export { COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, FRAMES, FRAME_COMPONENTS, ICON_NAMES, INPUTS_ROOT, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheck, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog } from '../../chunk-4SRSGZWM.js';
|
|
2
2
|
import '../../chunk-QQK6Y55E.js';
|
|
3
3
|
import '../../chunk-3GO65HWP.js';
|
|
4
4
|
import '../../chunk-V3OV2XQT.js';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, ComponentRendering, CriticLoop, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, DesignerAction, DesignerBrief, DesignerCatalog, DesignerCatalogOptions, DesignerComponent, DesignerPathEntry, DesignerStyle, FRAMES, FRAME_COMPONENTS, Frame, GenerativeSpec, ICON_NAMES, INPUTS_ROOT, InputBriefOptions, LayoutCheck, LayoutDescriptor, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, Producer, ProductComponentName, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, ResultBriefOptions, SpecFixture, SpecProblem, SpecVerdict, ValidationCatalog, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog } from './headless/index.js';
|
|
1
|
+
export { BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, ComponentRendering, CriticLoop, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, DesignerAction, DesignerBrief, DesignerCatalog, DesignerCatalogOptions, DesignerComponent, DesignerPathEntry, DesignerStyle, FRAMES, FRAME_COMPONENTS, Frame, GenerativeSpec, ICON_NAMES, INPUTS_ROOT, InputBriefOptions, LayoutCheck, LayoutDescriptor, LayoutVerdict, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, Producer, ProductComponentName, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, ResultBriefOptions, SpecFixture, SpecProblem, SpecVerdict, ValidationCatalog, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheck, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog } from './headless/index.js';
|
|
2
2
|
import * as _json_render_core from '@json-render/core';
|
|
3
|
-
import { Spec, StateStore, StateModel } from '@json-render/core';
|
|
3
|
+
import { Spec, StateStore, StateModel, ValidationConfig } from '@json-render/core';
|
|
4
4
|
export { Spec, StateModel, StateStore, createStateStore } from '@json-render/core';
|
|
5
|
-
import * as
|
|
5
|
+
import * as React from 'react';
|
|
6
6
|
import * as _json_render_react from '@json-render/react';
|
|
7
|
-
import { Components, Renderer } from '@json-render/react';
|
|
7
|
+
import { Components, Renderer, useFieldValidation } from '@json-render/react';
|
|
8
8
|
import { B as BrandManifest } from '../manifest-D3DLyNEv.js';
|
|
9
9
|
export { b as brandManifestSchema } from '../manifest-D3DLyNEv.js';
|
|
10
10
|
import * as zod_v4_core from 'zod/v4/core';
|
|
11
11
|
import * as zod from 'zod';
|
|
12
12
|
import { RunField } from '../core/descriptor.js';
|
|
13
|
-
import { F as FieldEnv } from '../field-renderer-
|
|
13
|
+
import { F as FieldEnv } from '../field-renderer-BYN6YrU-.js';
|
|
14
14
|
export { seedInputs } from '../core/seed.js';
|
|
15
15
|
import '../styles-Bn8byNdo.js';
|
|
16
16
|
import '../core/contracts.js';
|
|
@@ -31,11 +31,27 @@ import '../core/sources.js';
|
|
|
31
31
|
* boundary above the root. When the host passes a handler, the boundary
|
|
32
32
|
* catches the throw first, renders nothing in its place as json-render's
|
|
33
33
|
* would, and hands the error to the host after the commit, once per element
|
|
34
|
-
* that failed. When it passes none,
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
34
|
+
* that failed. When it passes none, an element's boundary logs the error as
|
|
35
|
+
* json-render's would and renders nothing, and the root's throws it on, to
|
|
36
|
+
* the host's own boundary. The wrapping does not depend on whether there is a
|
|
37
|
+
* handler, so a host that starts or stops passing one remounts nothing.
|
|
38
|
+
*
|
|
39
|
+
* Unlike json-render's, a failed boundary tries again when what it caught a
|
|
40
|
+
* throw from changes - for an element, its resolved props, the list it
|
|
41
|
+
* repeats over when it repeats, and each child's props and visibility as they
|
|
42
|
+
* resolve, since a child's props are resolved in the child's render and a
|
|
43
|
+
* throw there is the element above's to catch; for the root, the layout and
|
|
44
|
+
* the root's own resolved props - so an element that threw on a word where
|
|
45
|
+
* its list belongs draws once the store holds the list, without remounting
|
|
46
|
+
* the page. What changed is judged by content, read when the boundary fails
|
|
47
|
+
* and again only while it has failed, so a host that hands an equal value as
|
|
48
|
+
* a new object at every render - a spec parsed inline, props resolved afresh
|
|
49
|
+
* - does not retry, throw and report again at every render, and one that
|
|
50
|
+
* corrects its layout in place is judged against what failed. And while the
|
|
51
|
+
* page is `loading`, a failure is neither reported nor logged: a layout still
|
|
52
|
+
* streaming may be caught half-written, so the boundary tries again with each
|
|
53
|
+
* new value and once more when the stream ends, and reports only what still
|
|
54
|
+
* fails then.
|
|
39
55
|
*/
|
|
40
56
|
/** What a host is told of an element that failed to render. */
|
|
41
57
|
interface ElementErrorInfo {
|
|
@@ -82,8 +98,8 @@ interface DescriptorScope {
|
|
|
82
98
|
declare function useDescriptorScope(): DescriptorScope;
|
|
83
99
|
declare function DescriptorProvider({ scope, children, }: {
|
|
84
100
|
scope: DescriptorScope;
|
|
85
|
-
children:
|
|
86
|
-
}):
|
|
101
|
+
children: React.ReactNode;
|
|
102
|
+
}): React.JSX.Element;
|
|
87
103
|
/**
|
|
88
104
|
* Exported for the round-trip test only, not from the entry's index: the pair
|
|
89
105
|
* is only correct together, so a test that could see just one half of it would
|
|
@@ -720,7 +736,7 @@ declare const generativeRenderers: Components<_json_render_core.Catalog<{
|
|
|
720
736
|
}>>;
|
|
721
737
|
|
|
722
738
|
/** What a page renders through: this entry's registry unless a host brings its own. */
|
|
723
|
-
type PageRegistry =
|
|
739
|
+
type PageRegistry = React.ComponentProps<typeof Renderer>['registry'];
|
|
724
740
|
interface GenerativePageProps {
|
|
725
741
|
/** The layout to render; `null` while a stream has produced nothing yet. */
|
|
726
742
|
spec: Spec | null;
|
|
@@ -731,7 +747,8 @@ interface GenerativePageProps {
|
|
|
731
747
|
/**
|
|
732
748
|
* What `run` does. Receives the state at the moment the call to action was
|
|
733
749
|
* pressed. Return the run's promise and a press while it is pending starts
|
|
734
|
-
* nothing.
|
|
750
|
+
* nothing. Not called while a field's own checks (its `checks` prop) fail:
|
|
751
|
+
* the press shows each failing field its message instead.
|
|
735
752
|
*/
|
|
736
753
|
onRun?: (state: StateModel) => void | Promise<unknown>;
|
|
737
754
|
/** Whether a stream is still arriving. */
|
|
@@ -752,7 +769,10 @@ interface GenerativePageProps {
|
|
|
752
769
|
* the page and catches its throw in a boundary of its own, so a boundary
|
|
753
770
|
* around the page never fires; this is how a host hears of it, and falls
|
|
754
771
|
* back to its plain view if it wants the whole page to. The element renders
|
|
755
|
-
* nothing in its place either way
|
|
772
|
+
* nothing in its place either way, and draws again once what it renders
|
|
773
|
+
* from changes. Not called while `loading`: what still fails when the stream
|
|
774
|
+
* ends is reported then. Without it, the error is logged as json-render logs
|
|
775
|
+
* it, and the root's goes on to the host's own boundary around the page.
|
|
756
776
|
*/
|
|
757
777
|
onElementError?: ElementErrorHandler;
|
|
758
778
|
}
|
|
@@ -764,7 +784,7 @@ interface GenerativePageProps {
|
|
|
764
784
|
* kernel's readiness is computed from, and generation is nowhere in the
|
|
765
785
|
* request path: a layout is a data file, and this renders it.
|
|
766
786
|
*/
|
|
767
|
-
declare function GenerativePage({ spec, store, scope, onRun, loading, registry, brand, onElementError, }: GenerativePageProps):
|
|
787
|
+
declare function GenerativePage({ spec, store, scope, onRun, loading, registry, brand, onElementError, }: GenerativePageProps): React.JSX.Element;
|
|
768
788
|
/** The store's current state, re-rendering on every change. For a receipt beside a page. */
|
|
769
789
|
declare function useStoreSnapshot(store: StateStore): StateModel;
|
|
770
790
|
|
|
@@ -782,6 +802,17 @@ declare function useStoreSnapshot(store: StateStore): StateModel;
|
|
|
782
802
|
*/
|
|
783
803
|
declare const generativeRegistry: _json_render_react.ComponentRegistry;
|
|
784
804
|
|
|
805
|
+
/**
|
|
806
|
+
* json-render's `useFieldValidation`, for a control that carries checks. On a
|
|
807
|
+
* page, the field's checks enter the page's record while it is mounted, and
|
|
808
|
+
* the field validates against every check its path carries, so a control
|
|
809
|
+
* hidden or dropped no longer holds the run and two controls on one path
|
|
810
|
+
* agree. A host's own control that carries checks calls this rather than
|
|
811
|
+
* `useFieldValidation` to be held to the same rules; outside a page it is
|
|
812
|
+
* `useFieldValidation`.
|
|
813
|
+
*/
|
|
814
|
+
declare function useCheckedField(path: string, config: ValidationConfig | undefined): ReturnType<typeof useFieldValidation>;
|
|
815
|
+
|
|
785
816
|
/**
|
|
786
817
|
* What the page paints under the work column, when there is anything to paint.
|
|
787
818
|
*
|
|
@@ -797,21 +828,21 @@ declare const generativeRegistry: _json_render_react.ComponentRegistry;
|
|
|
797
828
|
*/
|
|
798
829
|
interface ResultSlot {
|
|
799
830
|
/** What to paint. Nothing is painted at all while this is absent or `null`. */
|
|
800
|
-
content:
|
|
831
|
+
content: React.ReactNode;
|
|
801
832
|
/** The heading above it. "Result" unless the host names it. */
|
|
802
833
|
title?: string;
|
|
803
834
|
}
|
|
804
835
|
declare function ResultSlotProvider({ slot, children, }: {
|
|
805
836
|
slot: ResultSlot | null;
|
|
806
|
-
children:
|
|
807
|
-
}):
|
|
837
|
+
children: React.ReactNode;
|
|
838
|
+
}): React.JSX.Element;
|
|
808
839
|
/** The slot the nearest page provides, or `null` on a page with no result yet. */
|
|
809
840
|
declare function useResultSlot(): ResultSlot | null;
|
|
810
841
|
|
|
811
842
|
declare function BrandProvider({ manifest, children, }: {
|
|
812
843
|
manifest: BrandManifest;
|
|
813
|
-
children:
|
|
814
|
-
}):
|
|
844
|
+
children: React.ReactNode;
|
|
845
|
+
}): React.JSX.Element;
|
|
815
846
|
declare function useBrand(): BrandManifest;
|
|
816
847
|
|
|
817
848
|
interface BrandBarProps {
|
|
@@ -822,7 +853,7 @@ interface BrandBarProps {
|
|
|
822
853
|
/** A short code at the end of the bar, such as the pipe's. */
|
|
823
854
|
tag?: string | null;
|
|
824
855
|
}
|
|
825
|
-
declare function BrandBar({ app, links, tag }: BrandBarProps):
|
|
856
|
+
declare function BrandBar({ app, links, tag }: BrandBarProps): React.JSX.Element;
|
|
826
857
|
|
|
827
858
|
/**
|
|
828
859
|
* What a host's compose-then-result frame tells the frame components of a
|
|
@@ -845,8 +876,8 @@ interface FrameHost {
|
|
|
845
876
|
}
|
|
846
877
|
declare function FrameHostProvider({ host, children, }: {
|
|
847
878
|
host: FrameHost;
|
|
848
|
-
children:
|
|
849
|
-
}):
|
|
879
|
+
children: React.ReactNode;
|
|
880
|
+
}): React.JSX.Element;
|
|
850
881
|
declare function useFrameHost(): FrameHost;
|
|
851
882
|
|
|
852
|
-
export { BrandBar, type BrandBarProps, BrandManifest, BrandProvider, DescriptorProvider, type DescriptorScope, type ElementErrorHandler, type ElementErrorInfo, type FrameHost, FrameHostProvider, GenerativePage, type GenerativePageProps, type PageRegistry, type ResultSlot, ResultSlotProvider, domIdFor, generativeRegistry, generativeRenderers, pathFromDomId, useBrand, useDescriptorScope, useFrameHost, useResultSlot, useStoreSnapshot };
|
|
883
|
+
export { BrandBar, type BrandBarProps, BrandManifest, BrandProvider, DescriptorProvider, type DescriptorScope, type ElementErrorHandler, type ElementErrorInfo, type FrameHost, FrameHostProvider, GenerativePage, type GenerativePageProps, type PageRegistry, type ResultSlot, ResultSlotProvider, domIdFor, generativeRegistry, generativeRenderers, pathFromDomId, useBrand, useCheckedField, useDescriptorScope, useFrameHost, useResultSlot, useStoreSnapshot };
|