@valbuild/core 0.103.0 → 0.105.1

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.
Files changed (31) hide show
  1. package/dist/declarations/src/extractValModules.d.ts +54 -0
  2. package/dist/declarations/src/index.d.ts +3 -2
  3. package/dist/declarations/src/preview.d.ts +98 -0
  4. package/dist/declarations/src/render.d.ts +29 -91
  5. package/dist/declarations/src/schema/array.d.ts +22 -23
  6. package/dist/declarations/src/schema/boolean.d.ts +2 -2
  7. package/dist/declarations/src/schema/color.d.ts +2 -2
  8. package/dist/declarations/src/schema/date.d.ts +2 -2
  9. package/dist/declarations/src/schema/datetime.d.ts +2 -2
  10. package/dist/declarations/src/schema/file.d.ts +2 -2
  11. package/dist/declarations/src/schema/image.d.ts +2 -2
  12. package/dist/declarations/src/schema/index.d.ts +6 -6
  13. package/dist/declarations/src/schema/keyOf.d.ts +2 -2
  14. package/dist/declarations/src/schema/literal.d.ts +2 -2
  15. package/dist/declarations/src/schema/number.d.ts +2 -2
  16. package/dist/declarations/src/schema/object.d.ts +2 -2
  17. package/dist/declarations/src/schema/record.d.ts +19 -29
  18. package/dist/declarations/src/schema/richtext.d.ts +2 -2
  19. package/dist/declarations/src/schema/route.d.ts +2 -2
  20. package/dist/declarations/src/schema/string.d.ts +28 -17
  21. package/dist/declarations/src/schema/union.d.ts +2 -2
  22. package/dist/{index-267a8e9c.esm.js → index-005f51a5.esm.js} +277 -177
  23. package/dist/{index-3572060f.cjs.prod.js → index-4013c9f8.cjs.prod.js} +279 -177
  24. package/dist/{index-2e40f2ae.cjs.dev.js → index-baa3109b.cjs.dev.js} +279 -177
  25. package/dist/valbuild-core.cjs.dev.js +4 -2
  26. package/dist/valbuild-core.cjs.prod.js +4 -2
  27. package/dist/valbuild-core.esm.js +1 -1
  28. package/package.json +1 -1
  29. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  30. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  31. package/patch/dist/valbuild-core-patch.esm.js +2 -2
@@ -16,7 +16,61 @@ export type ExtractedValModules = {
16
16
  sourcesSha: string;
17
17
  configSha: string;
18
18
  moduleErrors: ExtractedModuleError[];
19
+ /**
20
+ * What the SHAs above are a fold over, in order.
21
+ *
22
+ * Kept so they can be recomputed from a source that did NOT come from
23
+ * evaluating the modules — see {@link computeValModuleShas}. A record keyed by
24
+ * path could not do this: the fold is order-dependent, and the order is
25
+ * `val.modules`, which a record does not promise to preserve.
26
+ */
27
+ shaEntries: ValModuleShaEntry[];
19
28
  };
29
+ /**
30
+ * One module's contribution to the SHAs, in fold order.
31
+ *
32
+ * The SHAs are a FOLD, not a hash of a set: each module is mixed into the
33
+ * running value in `val.modules` order, so reproducing one means replaying the
34
+ * same modules with the same inputs in the same order. That is what this type
35
+ * is for — see {@link computeValModuleShas}.
36
+ */
37
+ export type ValModuleShaEntry = {
38
+ path: ModuleFilePath;
39
+ source: Source;
40
+ serializedSchema: SerializedSchema;
41
+ /**
42
+ * How many module errors had been collected when this module was folded in.
43
+ *
44
+ * The base SHA mixes in the error array as it stood at each step, so a module
45
+ * that failed to load changes the hash of every module folded in AFTER it and
46
+ * of none before. Errors are only ever appended, so the state at step _i_ is
47
+ * the final array's first `moduleErrorsAt` entries — one number is enough to
48
+ * reproduce it exactly, and a per-step copy is not needed.
49
+ */
50
+ moduleErrorsAt: number;
51
+ };
52
+ export type ValModuleShas = {
53
+ baseSha: string;
54
+ schemaSha: string;
55
+ sourcesSha: string;
56
+ configSha: string;
57
+ };
58
+ /**
59
+ * The SHAs, from the entries they are a fold over.
60
+ *
61
+ * Split out from {@link extractValModules} because there are two ways to arrive
62
+ * at a set of sources. Extraction evaluates the modules; the server also
63
+ * PROMOTES the sources it has just written to disk, because re-evaluating gets
64
+ * it nothing — a module `def` is the app's own `import()`, which resolves from
65
+ * the module registry rather than from the file that was just rewritten. Both
66
+ * have to produce SHAs the other side can compare, so the fold has one
67
+ * implementation and both call it.
68
+ *
69
+ * Feeding back the entries a previous fold used, unchanged, reproduces its SHAs
70
+ * exactly. That is the property the promotion relies on: only the modules whose
71
+ * source actually moved change anything.
72
+ */
73
+ export declare function computeValModuleShas(config: ValModules["config"], entries: readonly ValModuleShaEntry[], moduleErrors: readonly ExtractedModuleError[]): ValModuleShas;
20
74
  /**
21
75
  * Extracts schemas and sources from a ValModules registry and computes the
22
76
  * deterministic SHAs that the server and client both use to detect changes.
@@ -1,6 +1,6 @@
1
1
  export { initVal, type ConfigDirectory } from "./initVal.js";
2
2
  export { modules, type ValModules } from "./modules.js";
3
- export { extractValModules, type ExtractedValModules, type ExtractedModuleError, } from "./extractValModules.js";
3
+ export { extractValModules, computeValModuleShas, type ExtractedValModules, type ValModuleShaEntry, type ValModuleShas, type ExtractedModuleError, } from "./extractValModules.js";
4
4
  export type { InitVal, ValConfig, ValConstructor, ContentConstructor, } from "./initVal.js";
5
5
  export { Schema, type SerializedSchema, type SelectorOfSchema } from "./schema/index.js";
6
6
  export { hasRemoteFileSchema } from "./schema/hasRemoteFileSchema.js";
@@ -59,7 +59,8 @@ export { type SerializedRichTextSchema, RichTextSchema, } from "./schema/richtex
59
59
  export { type SerializedUnionSchema, UnionSchema, type SerializedStringUnionSchema, type SerializedObjectUnionSchema, } from "./schema/union.js";
60
60
  export { type SerializedLiteralSchema, LiteralSchema } from "./schema/literal.js";
61
61
  export { deserializeSchema } from "./schema/deserialize.js";
62
- export { type ListRecordRender, type ListArrayRender, type ReifiedRender, type RenderScope, type CodeLanguage, type CodeRender, renderScope, } from "./render.js";
62
+ export { type PreviewItem, type RecordPreview, type ArrayPreview, type ReifiedPreview, type PreviewScope, previewScope, } from "./preview.js";
63
+ export { type CodeLanguage, type StringRender, CODE_LANGUAGES } from "./render.js";
63
64
  export type { ValRouter, RouteValidationError } from "./router.js";
64
65
  export { getSourcePathFromRoute } from "./getSourcePathFromRoute.js";
65
66
  export declare const FATAL_ERROR_TYPES: readonly ["no-schema", "no-source", "invalid-id", "no-module", "invalid-patch"];
@@ -0,0 +1,98 @@
1
+ import { Schema } from "./schema/index.js";
2
+ import { SelectorSource } from "./selector/index.js";
3
+ import { ImageSource } from "./source/media.js";
4
+ import { ModuleFilePath, SourcePath } from "./val/index.js";
5
+ /**
6
+ * What a container shows for ONE of its items: the user's `preview` callback
7
+ * returns this, and the Studio draws a row from it.
8
+ *
9
+ * NB: {@link ArrayPreview} / {@link RecordPreview} name the DATA a container
10
+ * previews with. The Studio also has React components called `ArrayPreview` /
11
+ * `RecordPreview` (the fallback rendering of an array / record field, part of
12
+ * the `<Type>Preview` convention in `components/Preview.tsx`). They do not
13
+ * collide today because no file needs both - if one ever does, alias this type
14
+ * at the import rather than renaming that convention.
15
+ */
16
+ export type PreviewItem = {
17
+ title: string;
18
+ subtitle?: string | null;
19
+ image?: ImageSource | null;
20
+ };
21
+ export type RecordPreview = {
22
+ parent: "record";
23
+ items: [key: string, value: PreviewItem][];
24
+ };
25
+ export type ArrayPreview = {
26
+ parent: "array";
27
+ /**
28
+ * The previewed items, each PAIRED WITH ITS INDEX - the same
29
+ * `[key, value][]` shape {@link RecordPreview} uses.
30
+ *
31
+ * Not a positionally-indexed array, and the reason is
32
+ * {@link PreviewScope}: a preview computed for a subset of paths carries only
33
+ * those items, so `items[i]` would silently read the wrong row. Carrying the
34
+ * index makes a windowed preview impossible to misread - a consumer looks its
35
+ * index up rather than trusting a position - and makes the array and record
36
+ * shapes symmetric.
37
+ */
38
+ items: [index: number, value: PreviewItem][];
39
+ };
40
+ /**
41
+ * Main preview type.
42
+ *
43
+ * Deliberately not exported: `parent` is the discriminant, and every consumer
44
+ * narrows on it rather than on the union as a whole. There is no `layout` here
45
+ * on purpose - how a preview is laid out is the editor's business, not the
46
+ * schema's.
47
+ */
48
+ type PreviewTypes = RecordPreview | ArrayPreview;
49
+ type WithStatus<T> = {
50
+ status: "error";
51
+ message: string;
52
+ } | {
53
+ status: "loading";
54
+ data?: T;
55
+ } | {
56
+ status: "success";
57
+ data: T;
58
+ };
59
+ export type ReifiedPreview = Record<SourcePath | ModuleFilePath, WithStatus<PreviewTypes>>;
60
+ /**
61
+ * Which paths a preview is being computed FOR.
62
+ *
63
+ * `executePreview` takes a whole module, so one request has always walked every
64
+ * node in it and run every `preview` closure - for `handboka`, with `preview` at
65
+ * two nested array levels, that is every chapter and every section to serve one
66
+ * visible row. A scope is what makes the walk proportional to what is being
67
+ * looked at instead of to the project.
68
+ *
69
+ * Two questions, because a container and its items need different answers:
70
+ *
71
+ * - {@link PreviewScope.wants} - is a preview AT this exact path wanted? A
72
+ * container answers `true` here when the whole of it is being shown, and its
73
+ * preview is then computed in full.
74
+ * - {@link PreviewScope.wantsUnder} - could anything at or below this path be
75
+ * wanted? Recursion is pruned where this is `false`, and a container whose own
76
+ * path is not wanted but which has wanted descendants previews a WINDOW: only
77
+ * the items that were asked for. That is the case a single visible row is, and
78
+ * it is why {@link ArrayPreview} carries indices.
79
+ *
80
+ * Absent scope means the whole module, which is what every existing caller
81
+ * passes and what every existing caller got.
82
+ */
83
+ export type PreviewScope = {
84
+ wants(path: SourcePath | ModuleFilePath): boolean;
85
+ wantsUnder(path: SourcePath | ModuleFilePath): boolean;
86
+ };
87
+ /**
88
+ * A scope covering exactly `paths` and their subtrees.
89
+ *
90
+ * Compares SEGMENTS rather than string prefixes. A source path's module path is
91
+ * a quoted, dot-joined encoding (`?p="a".1."b"`), so `startsWith` gets the
92
+ * ancestor test wrong wherever a key is a prefix of a sibling key or contains a
93
+ * dot or a quote - `"title"` against `"titles"` being the cheapest example.
94
+ * Segments are parsed once here, not per comparison.
95
+ */
96
+ export declare function previewScope(paths: readonly SourcePath[]): PreviewScope;
97
+ export type PreviewSelector<T extends Schema<SelectorSource>> = T extends Schema<infer S> ? S : never;
98
+ export {};
@@ -1,98 +1,36 @@
1
- import { Schema } from "./schema/index.js";
2
- import { SelectorSource } from "./selector/index.js";
3
- import { ImageSource } from "./source/media.js";
4
- import { ModuleFilePath, SourcePath } from "./val/index.js";
5
- export type ListRecordRender = {
6
- layout: "list";
7
- parent: "record";
8
- items: [
9
- key: string,
10
- value: {
11
- title: string;
12
- subtitle?: string | null;
13
- image?: ImageSource | null;
14
- }
15
- ][];
16
- };
17
- export type ListArrayRender = {
18
- layout: "list";
19
- parent: "array";
20
- /**
21
- * The rendered items, each PAIRED WITH ITS INDEX — the same
22
- * `[key, value][]` shape {@link ListRecordRender} uses.
23
- *
24
- * Not a positionally-indexed array, and the reason is
25
- * {@link RenderScope}: a render computed for a subset of paths carries only
26
- * those items, so `items[i]` would silently read the wrong row. Carrying the
27
- * index makes a windowed render impossible to misread — a consumer looks its
28
- * index up rather than trusting a position — and makes the array and record
29
- * shapes symmetric.
30
- */
31
- items: [
32
- index: number,
33
- value: {
34
- title: string;
35
- subtitle?: string | null;
36
- image?: ImageSource | null;
37
- }
38
- ][];
39
- };
40
- export type TextareaRender = {
41
- layout: "textarea";
42
- };
43
- export type CodeLanguage = "typescript" | "javascript" | "javascriptreact" | "typescriptreact" | "json" | "java" | "html" | "css" | "xml" | "markdown" | "sql" | "python" | "rust" | "php" | "go" | "cpp" | "sass" | "vue" | "angular";
44
- export type CodeRender = {
45
- layout: "code";
46
- language: CodeLanguage;
47
- };
48
- type RenderTypes = ListRecordRender | ListArrayRender | TextareaRender | CodeRender;
49
- type WithStatus<T> = {
50
- status: "error";
51
- message: string;
52
- } | {
53
- status: "loading";
54
- data?: T;
55
- } | {
56
- status: "success";
57
- data: T;
58
- };
59
- export type ReifiedRender = Record<SourcePath | ModuleFilePath, WithStatus<RenderTypes>>;
60
1
  /**
61
- * Which paths a render is being computed FOR.
2
+ * A RENDER is how one field is laid out in the editor: `s.string().render({ as:
3
+ * "textarea" })`, `.render({ as: "code", language })`.
62
4
  *
63
- * `executeRender` takes a whole module, so one request has always walked every
64
- * node in it and run every `select` closure — for `handboka`, with `select` at
65
- * two nested array levels, that is every chapter and every section to serve one
66
- * visible row. A scope is what makes the walk proportional to what is being
67
- * looked at instead of to the project.
5
+ * It is static configuration - plain data, with no closure behind it and no
6
+ * dependency on source - which is why it lives in the SERIALIZED schema
7
+ * (`SerializedStringSchema.render`) and is read straight off it where the field
8
+ * is drawn. There is no render pipeline, no store and no host round-trip.
68
9
  *
69
- * Two questions, because a container and its items need different answers:
10
+ * That "static" is an ASSUMPTION we are taking deliberately, for simplicity,
11
+ * not a law. A future render could plausibly want to depend on source - a
12
+ * layout that varies with the value, a callback of its own. If that day comes,
13
+ * the shape it needs back is `executePreview`'s, and the honest move is to give
14
+ * `render` its own execute/store pair again. It is NOT to re-merge the two:
15
+ * conflating them is what this file was split up to undo.
70
16
  *
71
- * - {@link RenderScope.wants} — is a render AT this exact path wanted? A
72
- * container answers `true` here when the whole of it is being shown, and its
73
- * list render is then computed in full.
74
- * - {@link RenderScope.wantsUnder} — could anything at or below this path be
75
- * wanted? Recursion is pruned where this is `false`, and a container whose own
76
- * path is not wanted but which has wanted descendants renders a WINDOW: only
77
- * the items that were asked for. That is the case a single visible row is, and
78
- * it is why {@link ListArrayRender} carries indices.
79
- *
80
- * Absent scope means the whole module, which is what every existing caller
81
- * passes and what every existing caller got.
17
+ * The dynamic, source-dependent, demand-scoped thing - what a container shows
18
+ * for its items - is a PREVIEW. See `preview.ts`.
82
19
  */
83
- export type RenderScope = {
84
- wants(path: SourcePath | ModuleFilePath): boolean;
85
- wantsUnder(path: SourcePath | ModuleFilePath): boolean;
86
- };
87
20
  /**
88
- * A scope covering exactly `paths` and their subtrees.
89
- *
90
- * Compares SEGMENTS rather than string prefixes. A source path's module path is
91
- * a quoted, dot-joined encoding (`?p="a".1."b"`), so `startsWith` gets the
92
- * ancestor test wrong wherever a key is a prefix of a sibling key or contains a
93
- * dot or a quote — `"title"` against `"titles"` being the cheapest example.
94
- * Segments are parsed once here, not per comparison.
21
+ * The list is the declaration and {@link CodeLanguage} is derived from it, so
22
+ * that a validator elsewhere (`shared`'s zod schema) can enumerate the same
23
+ * languages without a second copy that drifts. Same shape as `COLOR_FORMATS`.
24
+ */
25
+ export declare const CODE_LANGUAGES: readonly ["typescript", "javascript", "javascriptreact", "typescriptreact", "json", "java", "html", "css", "xml", "markdown", "sql", "python", "rust", "php", "go", "cpp", "sass", "vue", "angular"];
26
+ export type CodeLanguage = (typeof CODE_LANGUAGES)[number];
27
+ /**
28
+ * What `s.string().render(...)` takes, and what the serialized schema carries
29
+ * verbatim.
95
30
  */
96
- export declare function renderScope(paths: readonly SourcePath[]): RenderScope;
97
- export type RenderSelector<T extends Schema<SelectorSource>> = T extends Schema<infer S> ? S : never;
98
- export {};
31
+ export type StringRender = {
32
+ as: "textarea";
33
+ } | {
34
+ as: "code";
35
+ language: CodeLanguage;
36
+ };
@@ -1,7 +1,6 @@
1
1
  import { Schema, SchemaAssertResult, SelectorOfSchema, SerializedSchema } from "./index.js";
2
- import { RenderSelector, ReifiedRender, RenderScope } from "../render.js";
2
+ import { PreviewItem, PreviewSelector, ReifiedPreview, PreviewScope } from "../preview.js";
3
3
  import { SelectorSource } from "../selector/index.js";
4
- import { ImageSource } from "../source/media.js";
5
4
  import { ModuleFilePath, SourcePath } from "../val/index.js";
6
5
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
7
6
  export type SerializedArraySchema = {
@@ -9,30 +8,23 @@ export type SerializedArraySchema = {
9
8
  item: SerializedSchema;
10
9
  opt: boolean;
11
10
  /**
12
- * Set when this schema declares a `render`.
11
+ * Set when this schema declares a `preview`.
13
12
  *
14
- * The render itself cannot be serialized — `select` is a user closure — but
15
- * whether one EXISTS can be, and that is worth carrying: it lets the non-host
16
- * side skip asking the host to render a module that cannot produce one.
17
- * Measured in a browser: mounting 260 fields across 141 modules spent ~2.3ms
18
- * of 3.1ms calling `executeRender` on modules that returned nothing.
13
+ * The preview itself cannot be serialized — it is a user closure — but whether
14
+ * one EXISTS can be, and that is worth carrying: it lets the non-host side
15
+ * skip asking the host to preview a module that cannot produce one. Measured
16
+ * in a browser: mounting 260 fields across 141 modules spent ~2.3ms of 3.1ms
17
+ * calling `executePreview` on modules that returned nothing.
19
18
  */
20
- render?: true;
19
+ preview?: true;
21
20
  customValidate?: boolean;
22
21
  readonly?: boolean;
23
22
  hidden?: boolean;
24
23
  description?: string;
25
24
  };
26
- type ArrayRenderInput<T extends Schema<SelectorSource>> = {
27
- as: "list";
28
- select: (input: {
29
- val: RenderSelector<T>;
30
- }) => {
31
- title: string;
32
- subtitle?: string | null;
33
- image?: ImageSource | null;
34
- };
35
- };
25
+ type ArrayPreviewInput<T extends Schema<SelectorSource>> = (input: {
26
+ val: PreviewSelector<T>;
27
+ }) => PreviewItem;
36
28
  export declare class ArraySchema<T extends Schema<SelectorSource>, Src extends SelectorOfSchema<T>[] | null> extends Schema<Src> {
37
29
  private readonly item;
38
30
  private readonly opt;
@@ -40,8 +32,8 @@ export declare class ArraySchema<T extends Schema<SelectorSource>, Src extends S
40
32
  private readonly isReadonly;
41
33
  private readonly isHidden;
42
34
  private readonly description?;
43
- private readonly renderInput;
44
- constructor(item: T, opt?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined, renderInput?: ArrayRenderInput<T> | null);
35
+ private readonly previewInput;
36
+ constructor(item: T, opt?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined, previewInput?: ArrayPreviewInput<T> | null);
45
37
  describe(description: string | null): ArraySchema<T, Src>;
46
38
  validate(validationFunction: (src: Src) => false | string): ArraySchema<T, Src>;
47
39
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
@@ -51,8 +43,15 @@ export declare class ArraySchema<T extends Schema<SelectorSource>, Src extends S
51
43
  hidden(): ArraySchema<T, Src>;
52
44
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
53
45
  protected executeSerialize(): SerializedArraySchema;
54
- protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: RenderScope): ReifiedRender;
55
- render(input: ArrayRenderInput<T>): ArraySchema<T, Src>;
46
+ protected executePreview(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: PreviewScope): ReifiedPreview;
47
+ /**
48
+ * What the editor shows for each ITEM of this array: a title, and optionally a
49
+ * subtitle and an image.
50
+ *
51
+ * `select` is your own code over the item's source, so it is run on demand for
52
+ * the rows that are actually being looked at — see `PreviewScope`.
53
+ */
54
+ preview(select: ArrayPreviewInput<T>): ArraySchema<T, Src>;
56
55
  }
57
56
  export declare const array: <S extends Schema<SelectorSource>>(schema: S) => ArraySchema<S, SelectorOfSchema<S>[]>;
58
57
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { ReifiedPreview } from "../preview.js";
3
3
  import { SourcePath } from "../val/index.js";
4
4
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
5
5
  export type SerializedBooleanSchema = {
@@ -26,6 +26,6 @@ export declare class BooleanSchema<Src extends boolean | null> extends Schema<Sr
26
26
  hidden(): BooleanSchema<Src>;
27
27
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
28
28
  protected executeSerialize(): SerializedSchema;
29
- protected executeRender(): ReifiedRender;
29
+ protected executePreview(): ReifiedPreview;
30
30
  }
31
31
  export declare const boolean: () => BooleanSchema<boolean>;
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { ReifiedPreview } from "../preview.js";
3
3
  import { SourcePath } from "../val/index.js";
4
4
  import { ColorFormat } from "./colorFormat.js";
5
5
  import { RawString } from "./string.js";
@@ -52,6 +52,6 @@ export declare class ColorSchema<Src extends string | null> extends Schema<Src>
52
52
  readonly(): ColorSchema<Src>;
53
53
  hidden(): ColorSchema<Src>;
54
54
  protected executeSerialize(): SerializedSchema;
55
- protected executeRender(): ReifiedRender;
55
+ protected executePreview(): ReifiedPreview;
56
56
  }
57
57
  export declare const color: (options?: ColorOptions) => ColorSchema<RawString>;
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { ReifiedPreview } from "../preview.js";
3
3
  import { SourcePath } from "../val/index.js";
4
4
  import { RawString } from "./string.js";
5
5
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
@@ -47,7 +47,7 @@ export declare class DateSchema<Src extends string | null> extends Schema<Src> {
47
47
  hidden(): DateSchema<Src>;
48
48
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
49
49
  protected executeSerialize(): SerializedSchema;
50
- protected executeRender(): ReifiedRender;
50
+ protected executePreview(): ReifiedPreview;
51
51
  }
52
52
  export declare const date: (options?: Record<string, never>) => DateSchema<RawString>;
53
53
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { ReifiedPreview } from "../preview.js";
3
3
  import { SourcePath } from "../val/index.js";
4
4
  import { RawString } from "./string.js";
5
5
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
@@ -51,7 +51,7 @@ export declare class DateTimeSchema<Src extends string | null> extends Schema<Sr
51
51
  hidden(): DateTimeSchema<Src>;
52
52
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
53
53
  protected executeSerialize(): SerializedSchema;
54
- protected executeRender(): ReifiedRender;
54
+ protected executePreview(): ReifiedPreview;
55
55
  }
56
56
  export declare const datetime: (options?: Record<string, never>) => DateTimeSchema<RawString>;
57
57
  export {};
@@ -4,7 +4,7 @@ import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema }
4
4
  import { ModulePath, SourcePath } from "../val/index.js";
5
5
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
6
6
  import { ValModule } from "../index.js";
7
- import { ReifiedRender } from "../render.js";
7
+ import { ReifiedPreview } from "../preview.js";
8
8
  import { FilesEntryMetadata } from "./files.js";
9
9
  export type FileOptions = {
10
10
  accept?: string;
@@ -45,7 +45,7 @@ export declare class FileSchema<Src extends FileSource | null> extends Schema<Sr
45
45
  hidden(): FileSchema<Src>;
46
46
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
47
47
  protected executeSerialize(): SerializedSchema;
48
- protected executeRender(): ReifiedRender;
48
+ protected executePreview(): ReifiedPreview;
49
49
  }
50
50
  /**
51
51
  * A file picked from a gallery. Its mime type lives in the gallery, so the
@@ -3,7 +3,7 @@ import { GalleryImageSource, ImageSource } from "../source/media.js";
3
3
  import { ModulePath, SourcePath } from "../val/index.js";
4
4
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
5
5
  import { ValModule } from "../index.js";
6
- import { ReifiedRender } from "../render.js";
6
+ import { ReifiedPreview } from "../preview.js";
7
7
  import { ImagesEntryMetadata } from "./images.js";
8
8
  export type ImageOptions = {
9
9
  ext?: ["jpg"] | ["webp"];
@@ -57,7 +57,7 @@ export declare class ImageSchema<Src extends ImageSource | null> extends Schema<
57
57
  hidden(): ImageSchema<Src>;
58
58
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
59
59
  protected executeSerialize(): SerializedSchema;
60
- protected executeRender(): ReifiedRender;
60
+ protected executePreview(): ReifiedPreview;
61
61
  }
62
62
  /**
63
63
  * An image picked from a gallery. Its dimensions and mime type live in the
@@ -19,7 +19,7 @@ import { SerializedRouteSchema } from "./route.js";
19
19
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
20
20
  import { FileSource } from "../source/media.js";
21
21
  import { GenericRichTextSourceNode, RichTextSource } from "../source/richtext.js";
22
- import { ReifiedRender, RenderScope } from "../render.js";
22
+ import { ReifiedPreview, PreviewScope } from "../preview.js";
23
23
  export type SerializedSchema = SerializedStringSchema | SerializedLiteralSchema | SerializedBooleanSchema | SerializedNumberSchema | SerializedObjectSchema | SerializedArraySchema | SerializedUnionSchema | SerializedRichTextSchema | SerializedRecordSchema | SerializedKeyOfSchema | SerializedFileSchema | SerializedDateSchema | SerializedDateTimeSchema | SerializedColorSchema | SerializedRouteSchema | SerializedImageSchema;
24
24
  type Primitives = number | string | boolean | null | FileSource;
25
25
  export type AssertError = {
@@ -107,13 +107,13 @@ export declare abstract class Schema<Src extends SelectorSource> {
107
107
  abstract hidden(): Schema<Src>;
108
108
  protected abstract executeSerialize(): SerializedSchema;
109
109
  /**
110
- * @param scope Which paths the caller needs a render for. Absent means the
110
+ * @param scope Which paths the caller needs a preview for. Absent means the
111
111
  * whole module, which is what every caller passed before scoping existed.
112
- * See {@link RenderScope}: a container prunes recursion where nothing is
113
- * wanted, and renders a WINDOW when its own path is not wanted but some of its
114
- * items are — which is the single-visible-row case.
112
+ * See {@link PreviewScope}: a container prunes recursion where nothing is
113
+ * wanted, and previews a WINDOW when its own path is not wanted but some of
114
+ * its items are — which is the single-visible-row case.
115
115
  */
116
- protected abstract executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: RenderScope): ReifiedRender;
116
+ protected abstract executePreview(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: PreviewScope): ReifiedPreview;
117
117
  /** MUTATES! since internal and perf sensitive */
118
118
  protected appendValidationError(current: ValidationErrors, path: SourcePath, message: string, value: unknown, schemaError?: boolean): ValidationErrors;
119
119
  /**
@@ -5,7 +5,7 @@ import { Source, SourceObject } from "../source/index.js";
5
5
  import { SourcePath } from "../val/index.js";
6
6
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
7
7
  import { RawString } from "./string.js";
8
- import { ReifiedRender } from "../render.js";
8
+ import { ReifiedPreview } from "../preview.js";
9
9
  export type SerializedKeyOfSchema = {
10
10
  type: "keyOf";
11
11
  path: SourcePath;
@@ -44,7 +44,7 @@ export declare class KeyOfSchema<Sel extends GenericSelector<SourceObject>, Src
44
44
  hidden(): KeyOfSchema<Sel, Src>;
45
45
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
46
46
  protected executeSerialize(): SerializedSchema;
47
- protected executeRender(): ReifiedRender;
47
+ protected executePreview(): ReifiedPreview;
48
48
  }
49
49
  export declare const keyOf: <Src extends GenericSelector<SourceObject> & ValModuleBrand>(valModule: Src) => KeyOfSchema<Src, KeyOfSelector<Src>>;
50
50
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { ReifiedPreview } from "../preview.js";
3
3
  import { SourcePath } from "../val/index.js";
4
4
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
5
5
  export type SerializedLiteralSchema = {
@@ -28,6 +28,6 @@ export declare class LiteralSchema<Src extends string | null> extends Schema<Src
28
28
  hidden(): LiteralSchema<Src>;
29
29
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
30
30
  protected executeSerialize(): SerializedSchema;
31
- protected executeRender(): ReifiedRender;
31
+ protected executePreview(): ReifiedPreview;
32
32
  }
33
33
  export declare const literal: <T extends string>(value: T) => LiteralSchema<T>;
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { ReifiedPreview } from "../preview.js";
3
3
  import { SourcePath } from "../val/index.js";
4
4
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
5
5
  type NumberOptions = {
@@ -34,7 +34,7 @@ export declare class NumberSchema<Src extends number | null> extends Schema<Src>
34
34
  min(min: number): NumberSchema<Src>;
35
35
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
36
36
  protected executeSerialize(): SerializedSchema;
37
- protected executeRender(): ReifiedRender;
37
+ protected executePreview(): ReifiedPreview;
38
38
  }
39
39
  export declare const number: (options?: NumberOptions) => NumberSchema<number>;
40
40
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SelectorOfSchema, SerializedSchema } from "./index.js";
2
- import { ReifiedRender, RenderScope } from "../render.js";
2
+ import { ReifiedPreview, PreviewScope } from "../preview.js";
3
3
  import { SelectorSource } from "../selector/index.js";
4
4
  import { ModuleFilePath, SourcePath } from "../val/index.js";
5
5
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
@@ -52,7 +52,7 @@ export declare class ObjectSchema<Props extends ObjectSchemaProps, Src extends O
52
52
  hidden(): ObjectSchema<Props, Src>;
53
53
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
54
54
  protected executeSerialize(): SerializedSchema;
55
- protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: RenderScope): ReifiedRender;
55
+ protected executePreview(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: PreviewScope): ReifiedPreview;
56
56
  }
57
57
  export declare const object: <Props extends ObjectSchemaProps>(schema: Props) => ObjectSchema<Props, ObjectSchemaSrcOf<Props>>;
58
58
  export {};