@valbuild/core 0.106.0 → 0.110.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/declarations/src/index.d.ts +4 -4
- package/dist/declarations/src/initSchema.d.ts +20 -20
- package/dist/declarations/src/preview.d.ts +40 -2
- package/dist/declarations/src/render.d.ts +64 -9
- package/dist/declarations/src/schema/array.d.ts +24 -12
- package/dist/declarations/src/schema/boolean.d.ts +25 -2
- package/dist/declarations/src/schema/color.d.ts +25 -2
- package/dist/declarations/src/schema/date.d.ts +25 -2
- package/dist/declarations/src/schema/datetime.d.ts +25 -2
- package/dist/declarations/src/schema/file.d.ts +25 -2
- package/dist/declarations/src/schema/image.d.ts +61 -5
- package/dist/declarations/src/schema/images.d.ts +8 -0
- package/dist/declarations/src/schema/index.d.ts +19 -1
- package/dist/declarations/src/schema/keyOf.d.ts +25 -2
- package/dist/declarations/src/schema/literal.d.ts +25 -2
- package/dist/declarations/src/schema/number.d.ts +25 -2
- package/dist/declarations/src/schema/object.d.ts +25 -2
- package/dist/declarations/src/schema/record.d.ts +29 -13
- package/dist/declarations/src/schema/richtext.d.ts +25 -2
- package/dist/declarations/src/schema/route.d.ts +25 -2
- package/dist/declarations/src/schema/string.d.ts +13 -2
- package/dist/declarations/src/schema/union.d.ts +32 -2
- package/dist/{index-2cef45cc.cjs.dev.js → index-409a38c3.cjs.dev.js} +1072 -192
- package/dist/{index-eaee0a0b.cjs.prod.js → index-62ef4533.cjs.prod.js} +1072 -192
- package/dist/{index-193f19b4.esm.js → index-6652ab3c.esm.js} +1072 -193
- package/dist/valbuild-core.cjs.dev.js +2 -1
- package/dist/valbuild-core.cjs.prod.js +2 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/package.json +2 -2
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
|
|
2
|
-
import { ReifiedPreview, PreviewScope } from "../preview.js";
|
|
2
|
+
import { ItemPreviewInput, PreviewItem, ReifiedPreview, PreviewScope } from "../preview.js";
|
|
3
|
+
import { FieldRender } from "../render.js";
|
|
3
4
|
import { SelectorSource } from "../selector/index.js";
|
|
4
5
|
import { SourceObject } from "../source/index.js";
|
|
5
6
|
import { ModuleFilePath, SourcePath } from "../val/index.js";
|
|
@@ -9,6 +10,10 @@ import { ValidationError, ValidationErrors } from "./validation/ValidationError.
|
|
|
9
10
|
export type SerializedUnionSchema = SerializedStringUnionSchema | SerializedObjectUnionSchema;
|
|
10
11
|
export type SerializedStringUnionSchema = {
|
|
11
12
|
type: "union";
|
|
13
|
+
/** Static layout config, carried whole in the serialized schema — see `render.ts`. */
|
|
14
|
+
render?: FieldRender;
|
|
15
|
+
/** Set when this schema declares a `preview`. The closure itself cannot serialize. */
|
|
16
|
+
preview?: true;
|
|
12
17
|
key: SerializedLiteralSchema;
|
|
13
18
|
items: SerializedLiteralSchema[];
|
|
14
19
|
opt: boolean;
|
|
@@ -19,6 +24,10 @@ export type SerializedStringUnionSchema = {
|
|
|
19
24
|
};
|
|
20
25
|
export type SerializedObjectUnionSchema = {
|
|
21
26
|
type: "union";
|
|
27
|
+
/** Static layout config, carried whole in the serialized schema — see `render.ts`. */
|
|
28
|
+
render?: FieldRender;
|
|
29
|
+
/** Set when this schema declares a `preview`. The closure itself cannot serialize. */
|
|
30
|
+
preview?: true;
|
|
22
31
|
key: string;
|
|
23
32
|
items: SerializedObjectSchema[];
|
|
24
33
|
opt: boolean;
|
|
@@ -40,6 +49,8 @@ export declare class UnionSchema<Key extends string | Schema<string>, T extends
|
|
|
40
49
|
private readonly isReadonly;
|
|
41
50
|
private readonly isHidden;
|
|
42
51
|
private readonly description?;
|
|
52
|
+
private readonly renderInput;
|
|
53
|
+
private readonly previewInput;
|
|
43
54
|
describe(description: string | null): UnionSchema<Key, T, Src>;
|
|
44
55
|
validate(validationFunction: (src: Src) => false | string): UnionSchema<Key, T, Src>;
|
|
45
56
|
protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
|
|
@@ -55,8 +66,27 @@ export declare class UnionSchema<Key extends string | Schema<string>, T extends
|
|
|
55
66
|
* already reports.
|
|
56
67
|
*/
|
|
57
68
|
private matchedVariant;
|
|
69
|
+
/**
|
|
70
|
+
* How this field is laid out in the editor when it is the item of an array
|
|
71
|
+
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
72
|
+
* instead of a preview row that navigates to it.
|
|
73
|
+
*
|
|
74
|
+
* Static configuration, not a callback — see `render.ts`.
|
|
75
|
+
*/
|
|
76
|
+
render(input: FieldRender): UnionSchema<Key, T, Src>;
|
|
77
|
+
/**
|
|
78
|
+
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
79
|
+
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
80
|
+
* itself is edited (that is `render`). See `preview.ts`.
|
|
81
|
+
*
|
|
82
|
+
* Without one of its own, a tagged union previews as the VARIANT the value
|
|
83
|
+
* takes — declare `preview` on the member objects and the union dispatches.
|
|
84
|
+
*/
|
|
85
|
+
preview(select: ItemPreviewInput<Src>): UnionSchema<Key, T, Src>;
|
|
86
|
+
protected executePreviewItem(src: NonNullable<Src>): PreviewItem | null;
|
|
87
|
+
protected declaresItemPreview(): boolean;
|
|
58
88
|
protected executeSerialize(): SerializedSchema;
|
|
59
|
-
constructor(key: Key, items: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
|
|
89
|
+
constructor(key: Key, items: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined, renderInput?: FieldRender | null, previewInput?: ItemPreviewInput<Src> | null);
|
|
60
90
|
protected executePreview(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: PreviewScope): ReifiedPreview;
|
|
61
91
|
}
|
|
62
92
|
export declare const union: <Key extends string | Schema<string>, T extends Schema<Key extends string ? SourceObject & { [k in Key]: string; } : Key extends Schema<string> ? string : unknown>[]>(key: Key, ...objects: T) => UnionSchema<Key, T, SourceOf<Key, T>>;
|