@valbuild/core 0.103.0 → 0.105.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.
Files changed (30) hide show
  1. package/dist/declarations/src/index.d.ts +2 -1
  2. package/dist/declarations/src/preview.d.ts +98 -0
  3. package/dist/declarations/src/render.d.ts +29 -91
  4. package/dist/declarations/src/schema/array.d.ts +22 -23
  5. package/dist/declarations/src/schema/boolean.d.ts +2 -2
  6. package/dist/declarations/src/schema/color.d.ts +2 -2
  7. package/dist/declarations/src/schema/date.d.ts +2 -2
  8. package/dist/declarations/src/schema/datetime.d.ts +2 -2
  9. package/dist/declarations/src/schema/file.d.ts +2 -2
  10. package/dist/declarations/src/schema/image.d.ts +2 -2
  11. package/dist/declarations/src/schema/index.d.ts +6 -6
  12. package/dist/declarations/src/schema/keyOf.d.ts +2 -2
  13. package/dist/declarations/src/schema/literal.d.ts +2 -2
  14. package/dist/declarations/src/schema/number.d.ts +2 -2
  15. package/dist/declarations/src/schema/object.d.ts +2 -2
  16. package/dist/declarations/src/schema/record.d.ts +19 -29
  17. package/dist/declarations/src/schema/richtext.d.ts +2 -2
  18. package/dist/declarations/src/schema/route.d.ts +2 -2
  19. package/dist/declarations/src/schema/string.d.ts +28 -17
  20. package/dist/declarations/src/schema/union.d.ts +2 -2
  21. package/dist/{index-2e40f2ae.cjs.dev.js → index-730a5254.cjs.dev.js} +177 -139
  22. package/dist/{index-267a8e9c.esm.js → index-d7cc2231.esm.js} +176 -139
  23. package/dist/{index-3572060f.cjs.prod.js → index-e990b6ad.cjs.prod.js} +177 -139
  24. package/dist/valbuild-core.cjs.dev.js +3 -2
  25. package/dist/valbuild-core.cjs.prod.js +3 -2
  26. package/dist/valbuild-core.esm.js +1 -1
  27. package/package.json +1 -1
  28. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  29. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  30. package/patch/dist/valbuild-core-patch.esm.js +2 -2
@@ -1,6 +1,6 @@
1
1
  import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
2
  import { SourcePath } from "../val/index.js";
3
- import { ReifiedRender } from "../render.js";
3
+ import { ReifiedPreview } from "../preview.js";
4
4
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
5
5
  type RouteOptions = {
6
6
  include?: RegExp;
@@ -68,7 +68,7 @@ export declare class RouteSchema<Src extends string | null> extends Schema<Src>
68
68
  hidden(): RouteSchema<Src>;
69
69
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
70
70
  protected executeSerialize(): SerializedSchema;
71
- protected executeRender(): ReifiedRender;
71
+ protected executePreview(): ReifiedPreview;
72
72
  }
73
73
  export declare const route: <T extends string>(options?: Record<string, never>) => RouteSchema<T>;
74
74
  export {};
@@ -1,6 +1,7 @@
1
1
  import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { CodeLanguage, ReifiedRender, RenderScope } from "../render.js";
3
- import { ModuleFilePath, SourcePath } from "../val/index.js";
2
+ import { ReifiedPreview } from "../preview.js";
3
+ import { StringRender } from "../render.js";
4
+ import { SourcePath } from "../val/index.js";
4
5
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
5
6
  type StringOptions = {
6
7
  maxLength?: number;
@@ -10,8 +11,16 @@ type StringOptions = {
10
11
  };
11
12
  export type SerializedStringSchema = {
12
13
  type: "string";
13
- /** Set when this schema declares a `render`. See `SerializedArraySchema`. */
14
- render?: true;
14
+ /**
15
+ * How this field is laid out in the editor, carried WHOLE rather than as a
16
+ * marker.
17
+ *
18
+ * A render is static configuration — no closure, no dependency on source — so
19
+ * unlike a `preview` it serializes in full, and the editor reads it straight
20
+ * off the schema it already has. See `render.ts` for what that assumption
21
+ * buys, and what to do if a render ever needs to stop being static.
22
+ */
23
+ render?: StringRender;
15
24
  options?: {
16
25
  maxLength?: number;
17
26
  minLength?: number;
@@ -42,12 +51,7 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
42
51
  private readonly isReadonly;
43
52
  private readonly isHidden;
44
53
  private readonly description?;
45
- constructor(options?: StringOptions | undefined, opt?: boolean, isRaw?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], renderInput?: {
46
- as: "textarea";
47
- } | {
48
- as: "code";
49
- language: CodeLanguage;
50
- } | null, isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
54
+ constructor(options?: StringOptions | undefined, opt?: boolean, isRaw?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], renderInput?: StringRender | null, isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
51
55
  describe(description: string | null): StringSchema<Src>;
52
56
  /**
53
57
  * @deprecated Use `minLength` instead
@@ -69,13 +73,20 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
69
73
  raw(): StringSchema<Src extends null ? RawString | null : RawString>;
70
74
  protected executeCustomValidateAt(path: SourcePath, src: Src): ValidationError[];
71
75
  protected executeSerialize(): SerializedSchema;
72
- render(input: {
73
- as: "textarea";
74
- } | {
75
- as: "code";
76
- language: CodeLanguage;
77
- }): StringSchema<Src>;
78
- protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, _scope?: RenderScope): ReifiedRender;
76
+ /**
77
+ * How this field is laid out in the editor: a textarea, or a code editor for
78
+ * the given language.
79
+ *
80
+ * Static configuration, not a callback — see `render.ts`. What a CONTAINER
81
+ * shows for its items is a `preview`, which is a different thing entirely.
82
+ */
83
+ render(input: StringRender): StringSchema<Src>;
84
+ /**
85
+ * Nothing: a string has no items, so there is nothing to preview. Its layout
86
+ * is a `render`, which travels in the serialized schema instead of through
87
+ * this pipeline.
88
+ */
89
+ protected executePreview(): ReifiedPreview;
79
90
  }
80
91
  export declare const string: <T extends string>(options?: Record<string, never>) => StringSchema<T>;
81
92
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, 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 { SourceObject } from "../source/index.js";
5
5
  import { ModuleFilePath, SourcePath } from "../val/index.js";
@@ -57,7 +57,7 @@ export declare class UnionSchema<Key extends string | Schema<string>, T extends
57
57
  private matchedVariant;
58
58
  protected executeSerialize(): SerializedSchema;
59
59
  constructor(key: Key, items: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
60
- protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: RenderScope): ReifiedRender;
60
+ protected executePreview(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: PreviewScope): ReifiedPreview;
61
61
  }
62
62
  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>>;
63
63
  export {};