@valbuild/core 0.101.0 → 0.103.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 (42) hide show
  1. package/dist/declarations/src/extractValModules.d.ts +1 -1
  2. package/dist/declarations/src/index.d.ts +13 -11
  3. package/dist/declarations/src/initSchema.d.ts +28 -15
  4. package/dist/declarations/src/initVal.d.ts +0 -6
  5. package/dist/declarations/src/module.d.ts +1 -4
  6. package/dist/declarations/src/render.d.ts +58 -9
  7. package/dist/declarations/src/schema/array.d.ts +13 -3
  8. package/dist/declarations/src/schema/file.d.ts +17 -17
  9. package/dist/declarations/src/schema/files.d.ts +6 -2
  10. package/dist/declarations/src/schema/hasRemoteFileSchema.d.ts +34 -0
  11. package/dist/declarations/src/schema/image.d.ts +15 -6
  12. package/dist/declarations/src/schema/images.d.ts +10 -5
  13. package/dist/declarations/src/schema/index.d.ts +10 -3
  14. package/dist/declarations/src/schema/object.d.ts +2 -2
  15. package/dist/declarations/src/schema/record.d.ts +7 -7
  16. package/dist/declarations/src/schema/remote.d.ts +0 -10
  17. package/dist/declarations/src/schema/string.d.ts +4 -2
  18. package/dist/declarations/src/schema/union.d.ts +2 -2
  19. package/dist/declarations/src/selector/SelectorProxy.d.ts +9 -2
  20. package/dist/declarations/src/selector/index.d.ts +3 -7
  21. package/dist/declarations/src/source/file.d.ts +6 -24
  22. package/dist/declarations/src/source/index.d.ts +3 -7
  23. package/dist/declarations/src/source/json.d.ts +1 -1
  24. package/dist/declarations/src/source/media.d.ts +98 -0
  25. package/dist/declarations/src/source/remote.d.ts +0 -14
  26. package/dist/declarations/src/source/richtext.d.ts +5 -7
  27. package/dist/declarations/src/val/index.d.ts +2 -5
  28. package/dist/{index-a18c24c2.esm.js → index-267a8e9c.esm.js} +1086 -813
  29. package/dist/{index-3e2d700e.cjs.dev.js → index-2e40f2ae.cjs.dev.js} +1086 -813
  30. package/dist/{index-049780fa.cjs.prod.js → index-3572060f.cjs.prod.js} +1086 -813
  31. package/dist/{result-4bd63123.esm.js → result-daff1cae.esm.js} +1 -1
  32. package/dist/valbuild-core.cjs.dev.js +3 -3
  33. package/dist/valbuild-core.cjs.prod.js +3 -3
  34. package/dist/valbuild-core.esm.js +2 -2
  35. package/fp/dist/valbuild-core-fp.esm.js +1 -1
  36. package/package.json +1 -1
  37. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  38. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  39. package/patch/dist/valbuild-core-patch.esm.js +3 -3
  40. package/dist/declarations/src/selector/file.d.ts +0 -10
  41. package/dist/declarations/src/selector/image.d.ts +0 -3
  42. package/dist/declarations/src/source/image.d.ts +0 -19
@@ -1,12 +1,10 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SelectorOfSchema, SerializedSchema } from "./index.js";
2
- import { RenderSelector, ReifiedRender } from "../render.js";
2
+ import { RenderSelector, ReifiedRender, RenderScope } from "../render.js";
3
3
  import { ValRouter } from "../router.js";
4
4
  import { SelectorSource } from "../selector/index.js";
5
- import { ImageSource } from "../source/image.js";
5
+ import { ImageSource } from "../source/media.js";
6
6
  import { JsonOf, JsonSource } from "../source/json.js";
7
- import { RemoteSource } from "../source/remote.js";
8
7
  import { ModuleFilePath, SourcePath } from "../val/index.js";
9
- import { ImageMetadata } from "./image.js";
10
8
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
11
9
  type MediaOptions = {
12
10
  type: "files" | "images";
@@ -20,6 +18,8 @@ export type SerializedRecordSchema = {
20
18
  item: SerializedSchema;
21
19
  key?: SerializedSchema;
22
20
  opt: boolean;
21
+ /** Set when this schema declares a `render`. See `SerializedArraySchema`. */
22
+ render?: true;
23
23
  router?: string;
24
24
  customValidate?: boolean;
25
25
  mediaType?: "files" | "images";
@@ -54,7 +54,7 @@ type RecordRenderInput<T extends Schema<SelectorSource>> = {
54
54
  }) => {
55
55
  title: string;
56
56
  subtitle?: string | null;
57
- image?: ImageSource | RemoteSource<ImageMetadata> | null;
57
+ image?: ImageSource | null;
58
58
  };
59
59
  };
60
60
  export declare class RecordSchema<T extends Schema<SelectorSource>, K extends Schema<string>, Src extends Record<SelectorOfSchema<K>, SelectorOfSchema<T>> | JsonValuesRecordSrc<T, K> | null> extends Schema<Src> {
@@ -113,7 +113,7 @@ export declare class RecordSchema<T extends Schema<SelectorSource>, K extends Sc
113
113
  * defers).
114
114
  */
115
115
  validateJsonEntryContent(path: SourcePath, content: SelectorSource): ValidationErrors;
116
- protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
116
+ protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: RenderScope): ReifiedRender;
117
117
  render(input: {
118
118
  as: "list";
119
119
  select: (input: {
@@ -122,7 +122,7 @@ export declare class RecordSchema<T extends Schema<SelectorSource>, K extends Sc
122
122
  }) => {
123
123
  title: string;
124
124
  subtitle?: string | null;
125
- image?: ImageSource | RemoteSource<ImageMetadata> | null;
125
+ image?: ImageSource | null;
126
126
  };
127
127
  }): RecordSchema<T, K, Src>;
128
128
  }
@@ -1,11 +1 @@
1
- import { Json } from "../index.js";
2
- import { RemoteSource } from "../source/remote.js";
3
1
  export declare const DEFAULT_VAL_REMOTE_HOST = "https://remote.val.build";
4
- export declare function convertRemoteSource<Metadata extends {
5
- readonly [key: string]: Json;
6
- } | undefined = {
7
- readonly [key: string]: Json;
8
- } | undefined>(src: RemoteSource<Metadata>): {
9
- url: string;
10
- metadata?: Metadata;
11
- };
@@ -1,5 +1,5 @@
1
1
  import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { CodeLanguage, ReifiedRender } from "../render.js";
2
+ import { CodeLanguage, ReifiedRender, RenderScope } from "../render.js";
3
3
  import { ModuleFilePath, SourcePath } from "../val/index.js";
4
4
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
5
5
  type StringOptions = {
@@ -10,6 +10,8 @@ type StringOptions = {
10
10
  };
11
11
  export type SerializedStringSchema = {
12
12
  type: "string";
13
+ /** Set when this schema declares a `render`. See `SerializedArraySchema`. */
14
+ render?: true;
13
15
  options?: {
14
16
  maxLength?: number;
15
17
  minLength?: number;
@@ -73,7 +75,7 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
73
75
  as: "code";
74
76
  language: CodeLanguage;
75
77
  }): StringSchema<Src>;
76
- protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
78
+ protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, _scope?: RenderScope): ReifiedRender;
77
79
  }
78
80
  export declare const string: <T extends string>(options?: Record<string, never>) => StringSchema<T>;
79
81
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { ReifiedRender, RenderScope } from "../render.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): ReifiedRender;
60
+ protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src, scope?: RenderScope): ReifiedRender;
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 {};
@@ -1,8 +1,15 @@
1
1
  import { GenericSelector } from "./index.js";
2
2
  import { Source } from "../source/index.js";
3
- import { ModulePath, SourcePath } from "../val/index.js";
3
+ import { ModuleFilePath, ModulePath, SourcePath } from "../val/index.js";
4
4
  export declare function isSelector(source: any): source is GenericSelector<Source>;
5
5
  export declare function newSelectorProxy(source: any, path?: SourcePath, moduleSchema?: any): any;
6
- export declare function createValPathOfItem(arrayPath: SourcePath | ModulePath | undefined, prop: string | number | symbol): SourcePath | undefined;
6
+ export declare function createValPathOfItem(
7
+ /**
8
+ * `ModuleFilePath` is accepted because the no-separator branch below is
9
+ * exactly that case: a path with no `?p=` yet gets one, and the key becomes
10
+ * the first module-path segment. Callers walking a module from its root had
11
+ * to widen the type themselves, and hand-rolled the concatenation instead.
12
+ */
13
+ arrayPath: SourcePath | ModulePath | ModuleFilePath | undefined, prop: string | number | symbol): SourcePath | undefined;
7
14
  export declare function unsafeCreateSourcePath(path: string, itemKey: string | number | symbol): SourcePath;
8
15
  export declare function selectorToVal(s: any): any;
@@ -4,22 +4,18 @@ import { Selector as NumberSelector } from "./number.js";
4
4
  import { Selector as StringSelector } from "./string.js";
5
5
  import { Selector as BooleanSelector } from "./boolean.js";
6
6
  import { Selector as PrimitiveSelector } from "./primitive.js";
7
- import { FileSelector } from "./file.js";
8
7
  import { SourcePath } from "../val/index.js";
9
8
  import { Source, SourceArray, SourceObject, SourcePrimitive } from "../source/index.js";
10
9
  import { Schema } from "../schema/index.js";
11
10
  import type { A } from "ts-toolbelt";
12
- import { FileSource } from "../source/file.js";
11
+ import { MediaSource } from "../source/media.js";
13
12
  import { AllRichTextOptions, RichTextSource } from "../source/richtext.js";
14
- import { ImageSelector } from "./image.js";
15
13
  import { RichTextSelector } from "./richtext.js";
16
- import { ImageSource } from "../source/image.js";
17
- import { RemoteSource } from "../source/remote.js";
18
14
  import { JsonSource } from "../source/json.js";
19
- export type Selector<T extends Source> = Source extends T ? GenericSelector<T> : T extends ImageSource ? ImageSelector : T extends FileSource<infer M> ? FileSelector<M> : T extends JsonSource ? GenericSelector<JsonSource> : T extends RichTextSource<infer O> ? RichTextSelector<O> : T extends SourceObject ? ObjectSelector<T> : T extends SourceArray ? ArraySelector<T> : T extends string ? StringSelector<T> : T extends number ? NumberSelector<T> : T extends boolean ? BooleanSelector<T> : T extends null ? PrimitiveSelector<null> : never;
15
+ export type Selector<T extends Source> = Source extends T ? GenericSelector<T> : T extends MediaSource ? GenericSelector<T> : T extends JsonSource ? GenericSelector<JsonSource> : T extends RichTextSource<infer O> ? RichTextSelector<O> : T extends SourceObject ? ObjectSelector<T> : T extends SourceArray ? ArraySelector<T> : T extends string ? StringSelector<T> : T extends number ? NumberSelector<T> : T extends boolean ? BooleanSelector<T> : T extends null ? PrimitiveSelector<null> : never;
20
16
  export type SelectorSource = SourcePrimitive | undefined | readonly SelectorSource[] | {
21
17
  [key: string]: SelectorSource;
22
- } | ImageSource | FileSource | RemoteSource | JsonSource | RichTextSource<AllRichTextOptions> | GenericSelector<Source>;
18
+ } | MediaSource | JsonSource | RichTextSource<AllRichTextOptions> | GenericSelector<Source>;
23
19
  /**
24
20
  * @internal
25
21
  */
@@ -1,28 +1,10 @@
1
- import { VAL_EXTENSION } from "./index.js";
2
- import { ValConfig } from "../initVal.js";
3
- import { Json } from "../Json.js";
4
- export declare const FILE_REF_PROP: "_ref";
5
- export declare const FILE_REF_SUBTYPE_TAG: "_tag";
6
- export type FileMetadata = {
7
- mimeType?: string;
8
- };
9
1
  /**
10
- * A file source represents the path to a (local) file.
11
- *
12
- * It will be resolved into a Asset object.
2
+ * What Val computes from a file's bytes.
13
3
  *
4
+ * Not part of the source any more — a media source carries these fields
5
+ * directly — but still the unit the upload and `--fix` pipelines work in:
6
+ * "here is what reading this file told us".
14
7
  */
15
- export type FileSource<Metadata extends FileMetadata | undefined = FileMetadata | undefined> = {
16
- readonly [FILE_REF_PROP]: string;
17
- readonly [VAL_EXTENSION]: "file";
18
- readonly [FILE_REF_SUBTYPE_TAG]?: string;
19
- readonly metadata?: Metadata;
20
- readonly patch_id?: string;
21
- };
22
- export declare const initFile: (config?: ValConfig) => {
23
- <Metadata extends {
24
- readonly [key: string]: Json;
25
- }>(ref: `${import("../initVal.js").ConfigDirectory}/${string}`, metadata: Metadata): FileSource<Metadata>;
26
- (ref: `${import("../initVal.js").ConfigDirectory}/${string}`, metadata?: undefined): FileSource<undefined>;
8
+ export type FileMetadata = {
9
+ mimeType?: string;
27
10
  };
28
- export declare function isFile(obj: unknown): obj is FileSource;
@@ -1,9 +1,7 @@
1
- import { FileSource } from "./file.js";
2
- import { ImageSource } from "./image.js";
3
1
  import { JsonSource } from "./json.js";
4
- import { RemoteSource } from "./remote.js";
2
+ import { MediaSource } from "./media.js";
5
3
  import { RichTextOptions, RichTextSource } from "./richtext.js";
6
- export type Source = SourcePrimitive | SourceObject | SourceArray | RemoteSource | FileSource | ImageSource | JsonSource | RichTextSource<RichTextOptions>;
4
+ export type Source = SourcePrimitive | SourceObject | SourceArray | MediaSource | JsonSource | RichTextSource<RichTextOptions>;
7
5
  export type SourceObject = {
8
6
  [key in string]: Source;
9
7
  } & {
@@ -14,8 +12,6 @@ export type SourceObject = {
14
12
  /** Reserved name */
15
13
  andThen?: never;
16
14
  /** Reserved name */
17
- _ref?: never;
18
- /** Reserved name */
19
15
  _type?: never;
20
16
  /** Reserved name */
21
17
  val?: never;
@@ -25,7 +21,7 @@ export type SourceObject = {
25
21
  export type SourceArray = readonly Source[];
26
22
  export type SourcePrimitive = string | number | boolean | null;
27
23
  export declare const VAL_EXTENSION: "_type";
28
- export declare function getValExtension(source: Source): false | "" | 0 | "remote" | "file" | "json" | null | undefined;
24
+ export declare function getValExtension(source: Source): false | "" | 0 | "json" | null | undefined;
29
25
  /**
30
26
  * A phantom type parameter is one that doesn't show up at runtime, but is checked statically (and only) at compile time.
31
27
  *
@@ -30,7 +30,7 @@ export type JsonImportThunk<T = unknown> = () => Promise<{
30
30
  */
31
31
  export type JsonSource<T = unknown> = {
32
32
  readonly [VAL_EXTENSION]: typeof JSON_VAL_EXTENSION_TAG;
33
- /** Set on uncommitted/draft entries (mirrors FileSource/RemoteSource). */
33
+ /** Set on uncommitted/draft entries (mirrors a media source's). */
34
34
  readonly patch_id?: string;
35
35
  } & PhantomType<T>;
36
36
  export declare function json<T = Json>(importThunk: JsonImportThunk<T>): JsonSource<T>;
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Media — images and files — is a plain object carrying a `path`.
3
+ *
4
+ * There is no marker on the value: nothing may decide "this is an image" by
5
+ * looking at it. The **schema** says so (`type === "image" | "file"`), which is
6
+ * what lets the same object be written in a `.val.ts` and in a `*.val.json`
7
+ * entry, where a function call cannot be written at all.
8
+ *
9
+ * `path` is a plain `string` rather than a `` `/public/${string}` `` template so
10
+ * a field can move between local and remote without a type error. Remote-ness
11
+ * is read off the path: anything not under `/public` is remote.
12
+ */
13
+ /** What must stay in frame when a page crops an image. */
14
+ export type MediaHotspot = {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ /**
19
+ * The authored fields of a gallery-backed image (`s.image(galleryModule)`):
20
+ * `width`/`height`/`mimeType` live in the gallery, so they are not repeated
21
+ * here. One place per fact.
22
+ */
23
+ export type GalleryImageSource = {
24
+ readonly path: string;
25
+ readonly alt?: string;
26
+ readonly hotspot?: MediaHotspot;
27
+ /**
28
+ * Set on a source whose bytes are not committed yet. Injected server-side and
29
+ * consumed only by {@link mediaUrl} — never written to a `.val.ts`.
30
+ */
31
+ readonly patch_id?: string;
32
+ };
33
+ export type ImageSource = GalleryImageSource & {
34
+ readonly width?: number;
35
+ readonly height?: number;
36
+ readonly mimeType?: string;
37
+ };
38
+ export type GalleryFileSource = {
39
+ readonly path: string;
40
+ readonly patch_id?: string;
41
+ };
42
+ export type FileSource = GalleryFileSource & {
43
+ readonly mimeType?: string;
44
+ };
45
+ /**
46
+ * The structural supertype of every media source.
47
+ *
48
+ * It is a named member of the `Source` / `SelectorSource` unions rather than
49
+ * "just an object" because `SourceObject` is `{[key: string]: Source}` and
50
+ * `Source` excludes `undefined` — an object with optional properties does not
51
+ * satisfy it.
52
+ */
53
+ export type MediaSource = ImageSource;
54
+ /** A path is remote unless it is under `/public`. */
55
+ export declare function isRemoteMediaPath(path: string): boolean;
56
+ /**
57
+ * Where the bytes of a media source are actually served from.
58
+ *
59
+ * Two states, and conflating them is the recurring bug: uncommitted bytes live
60
+ * in the patch directory and are served by the API with the `patch_id` that put
61
+ * them there; committed bytes live at the path itself, with `/public` stripped.
62
+ */
63
+ export declare function mediaUrl(src: {
64
+ readonly path: string;
65
+ readonly patch_id?: string;
66
+ }): string;
67
+ /**
68
+ * A media source plus the URL its bytes are served from.
69
+ *
70
+ * `url` is the only generated field: everything else the consumer sees was
71
+ * either authored or filled in from the gallery.
72
+ */
73
+ export declare function resolveMedia<S extends {
74
+ readonly path: string;
75
+ }>(src: S): S & {
76
+ url: string;
77
+ };
78
+ /**
79
+ * Fill in what a gallery-backed field does not carry itself.
80
+ *
81
+ * `s.image(galleryModule)` stores only `{path, alt?, hotspot?}` — the
82
+ * dimensions and mime type live in the gallery module, keyed by path. This is
83
+ * the single implementation of that lookup; core, stega/RSC and the Studio all
84
+ * call it rather than each rolling their own.
85
+ *
86
+ * `alt` is filled in too, because a gallery holds the alt text an editor typed
87
+ * once for a file used in several places — but only when the field does not
88
+ * have its own, so a per-image override wins. A gallery whose `alt` schema is a
89
+ * locale record holds an object rather than a string; that is left alone rather
90
+ * than copied into a field typed `string`, and making the override
91
+ * locale-shaped is a separate change.
92
+ *
93
+ * The double lookup is load-bearing: a remote gallery keys its entries by the
94
+ * remote URL while the file itself stays on disk under its local path.
95
+ */
96
+ export declare function fillFromGallery<S extends {
97
+ readonly path: string;
98
+ }>(src: S, schema: unknown, getModuleSource: (modulePath: string) => unknown): S;
@@ -1,17 +1,3 @@
1
- import { VAL_EXTENSION } from "./index.js";
2
- import { ValConfig } from "../initVal.js";
3
- import { ImageMetadata } from "../schema/image.js";
4
- import { FILE_REF_PROP, FileMetadata } from "./file.js";
5
- /**
6
- * A remote source represents data that is not stored locally.
7
- */
8
- export type RemoteSource<Metadata extends FileMetadata | undefined = FileMetadata | undefined> = {
9
- readonly [FILE_REF_PROP]: string;
10
- readonly [VAL_EXTENSION]: "remote";
11
- readonly metadata?: Metadata;
12
- readonly patch_id?: string;
13
- };
14
- export declare const initRemote: (config?: ValConfig) => <Metadata extends FileMetadata | ImageMetadata>(ref: RemoteRef, metadata?: Metadata) => RemoteSource<Metadata>;
15
1
  export type RemoteRef = `${string}/file/p/${string}/b/${string}/v/${string}/h/${string}/f/${string}/p/public/${string}`;
16
2
  export declare function createRemoteRef(remoteHost: string, { publicProjectId, coreVersion, validationHash, fileHash, filePath, bucket, }: {
17
3
  publicProjectId: string;
@@ -1,9 +1,7 @@
1
- import { ImageMetadata, ImageSchema, SerializedImageSchema } from "../schema/image.js";
1
+ import { ImageSchema, SerializedImageSchema } from "../schema/image.js";
2
2
  import { RouteSchema, SerializedRouteSchema } from "../schema/route.js";
3
3
  import { StringSchema, SerializedStringSchema } from "../schema/string.js";
4
- import { FileSource } from "./file.js";
5
- import { ImageSource } from "./image.js";
6
- import { RemoteSource } from "./remote.js";
4
+ import { ImageSource } from "./media.js";
7
5
  export type RichTextOptions = Partial<{
8
6
  style: Partial<{
9
7
  bold: boolean;
@@ -22,7 +20,7 @@ export type RichTextOptions = Partial<{
22
20
  }>;
23
21
  inline: Partial<{
24
22
  a: boolean | RouteSchema<string> | StringSchema<string>;
25
- img: boolean | ImageSchema<ImageSource> | ImageSchema<RemoteSource<ImageMetadata | undefined>> | ImageSchema<ImageSource | RemoteSource<ImageMetadata | undefined>>;
23
+ img: boolean | ImageSchema<ImageSource>;
26
24
  }>;
27
25
  }>;
28
26
  export type SerializedRichTextOptions = Partial<{
@@ -92,8 +90,8 @@ export type SpanNode<O extends RichTextOptions> = {
92
90
  };
93
91
  export type ImageNode<O extends RichTextOptions> = NonNullable<O["inline"]>["img"] extends true ? {
94
92
  tag: "img";
95
- src: ImageSource | RemoteSource<ImageMetadata>;
96
- } : NonNullable<O["inline"]>["img"] extends ImageSchema<infer Src> ? Src extends RemoteSource | FileSource | ImageSource ? {
93
+ src: ImageSource;
94
+ } : NonNullable<O["inline"]>["img"] extends ImageSchema<infer Src> ? Src extends ImageSource ? {
97
95
  tag: "img";
98
96
  src: Src;
99
97
  } : never : never;
@@ -4,16 +4,13 @@ import { Val as ArrayVal } from "./array.js";
4
4
  import { Val as PrimitiveVal } from "./primitive.js";
5
5
  import { Json, JsonArray, JsonObject, JsonPrimitive } from "../Json.js";
6
6
  import { Path, Selector } from "../selector/index.js";
7
- import { RemoteSource } from "../source/remote.js";
8
- import { FileSource } from "../source/file.js";
7
+ import { MediaSource } from "../source/media.js";
9
8
  export type SerializedVal = {
10
9
  val: SerializedVal | Json;
11
10
  valPath: SourcePath | undefined;
12
11
  };
13
12
  export declare function isSerializedVal(val: unknown): val is SerializedVal;
14
- export type JsonOfSource<T extends Source> = Json extends T ? Json : T extends RemoteSource ? {
15
- url: string;
16
- } : T extends FileSource ? {
13
+ export type JsonOfSource<T extends Source> = Json extends T ? Json : T extends MediaSource ? T & {
17
14
  url: string;
18
15
  } : T extends SourceObject ? {
19
16
  [key in keyof T]: JsonOfSource<T[key]>;