@valbuild/core 0.13.3 → 0.13.4

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.
@@ -1,12 +1,13 @@
1
1
  export { initVal } from "./initVal";
2
- export { fetchVal } from "./fetchVal";
3
2
  export type { InitVal } from "./initVal";
4
3
  export { Schema, type SerializedSchema } from "./schema";
5
4
  export type { ValModule, SerializedModule } from "./module";
6
5
  export type { SourceObject, SourcePrimitive, Source } from "./source";
7
6
  export type { FileSource } from "./source/file";
8
7
  export type { RemoteSource } from "./source/remote";
9
- export { type Val, type SerializedVal, type ModuleId, type ModulePath, type SourcePath, } from "./val";
8
+ export type { RichTextSource, RichText, TextNode, ParagraphNode, HeadingNode, ListItemNode, ListNode, } from "./source/richtext";
9
+ export { type Val, type SerializedVal, type ModuleId, type ModulePath, type SourcePath, type JsonOfSource, } from "./val";
10
+ export { type Json } from "./Json";
10
11
  export * as expr from "./expr/";
11
12
  export { FILE_REF_PROP } from "./source/file";
12
13
  export { VAL_EXTENSION } from "./source";
@@ -15,8 +16,8 @@ export { type SelectorSource, type SelectorOf, GenericSelector, } from "./select
15
16
  import { getVal } from "./fetchVal";
16
17
  import { getRawSource, resolvePath, splitModuleIdAndModulePath } from "./module";
17
18
  import { getSchema } from "./selector";
18
- import { getValPath } from "./val";
19
- export type { RichText, TextNode, ParagraphNode, HeadingNode, ImageNode, ListItemNode, ListNode, RootNode, } from "./schema/richtext";
19
+ import { getValPath, isVal } from "./val";
20
+ import { fetchVal } from "./fetchVal";
20
21
  declare const Internal: {
21
22
  convertImageSource: (src: import("./source/file").FileSource<import("./schema/image").ImageMetadata>) => {
22
23
  url: string;
@@ -28,5 +29,7 @@ declare const Internal: {
28
29
  getRawSource: typeof getRawSource;
29
30
  resolvePath: typeof resolvePath;
30
31
  splitModuleIdAndModulePath: typeof splitModuleIdAndModulePath;
32
+ fetchVal: typeof fetchVal;
33
+ isVal: typeof isVal;
31
34
  };
32
35
  export { Internal };
@@ -50,7 +50,7 @@ export declare function initSchema<Locales extends readonly string[]>(locales: F
50
50
  valPath?: undefined;
51
51
  } & { [k in Key]: string; }>[]>(key: Key, ...objects: T_1) => import("./schema").Schema<T_1 extends import("./schema").Schema<infer S_1 extends import("./selector").SelectorSource>[] ? S_1 extends import("./selector").SelectorSource ? S_1 : never : never>;
52
52
  oneOf: <Src extends import("./selector").GenericSelector<import("./source").SourceArray, undefined> & import("./module").ValModuleBrand>(valModule: Src) => import("./schema").Schema<Src extends import("./selector").GenericSelector<infer S_2 extends import("./source").Source, undefined> ? S_2 extends (infer IS)[] ? IS extends import("./source").Source ? import("./selector").GenericSelector<IS, undefined> : never : never : never>;
53
- richtext: () => import("./schema").Schema<import("./schema/richtext").RichText<"h1" | "h2" | "h3" | "h4" | "h5" | "h6", import("./schema/richtext").TextNode>>;
53
+ richtext: () => import("./schema").Schema<import(".").RichTextSource>;
54
54
  image: (options?: import("./schema/image").ImageOptions | undefined) => import("./schema").Schema<import(".").FileSource<import("./schema/image").ImageMetadata>>;
55
55
  literal: <T_2 extends string>(value: T_2) => import("./schema").Schema<T_2>;
56
56
  i18n: <S_3 extends import("./schema").Schema<import("./source/i18n").I18nCompatibleSource>>(schema: S_3) => import("./schema").Schema<import("./source/i18n").I18nSource<import("ts-toolbelt/out/Any/Try").Try<Locales, [], (Locales extends [] ? [] : never) | (Locales extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? Locales : never) | { [K in keyof Locales]: Locales[K] extends Function ? Locales[K] : (Locales[K] extends infer T_3 ? T_3 extends Locales[K] ? T_3 extends [] ? [] : never : never : never) | (Locales[K] extends infer T_4 ? T_4 extends Locales[K] ? T_4 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_4 : never : never : never) | (Locales[K] extends infer T_5 ? { [K_1 in keyof T_5]: Locales[K][K_1] extends Function ? Locales[K][K_1] : (Locales[K][K_1] extends infer T_6 ? T_6 extends Locales[K][K_1] ? T_6 extends [] ? [] : never : never : never) | (Locales[K][K_1] extends infer T_7 ? T_7 extends Locales[K][K_1] ? T_7 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_7 : never : never : never) | (Locales[K][K_1] extends infer T_8 ? { [K_2 in keyof T_8]: Locales[K][K_1][K_2] extends Function ? Locales[K][K_1][K_2] : (Locales[K][K_1][K_2] extends infer T_9 ? T_9 extends Locales[K][K_1][K_2] ? T_9 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2] extends infer T_10 ? T_10 extends Locales[K][K_1][K_2] ? T_10 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_10 : never : never : never) | (Locales[K][K_1][K_2] extends infer T_11 ? { [K_3 in keyof T_11]: Locales[K][K_1][K_2][K_3] extends Function ? Locales[K][K_1][K_2][K_3] : (Locales[K][K_1][K_2][K_3] extends infer T_12 ? T_12 extends Locales[K][K_1][K_2][K_3] ? T_12 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3] extends infer T_13 ? T_13 extends Locales[K][K_1][K_2][K_3] ? T_13 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_13 : never : never : never) | (Locales[K][K_1][K_2][K_3] extends infer T_14 ? { [K_4 in keyof T_14]: Locales[K][K_1][K_2][K_3][K_4] extends Function ? Locales[K][K_1][K_2][K_3][K_4] : (Locales[K][K_1][K_2][K_3][K_4] extends infer T_15 ? T_15 extends Locales[K][K_1][K_2][K_3][K_4] ? T_15 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4] extends infer T_16 ? T_16 extends Locales[K][K_1][K_2][K_3][K_4] ? T_16 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_16 : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4] extends infer T_17 ? { [K_5 in keyof T_17]: Locales[K][K_1][K_2][K_3][K_4][K_5] extends Function ? Locales[K][K_1][K_2][K_3][K_4][K_5] : (Locales[K][K_1][K_2][K_3][K_4][K_5] extends infer T_18 ? T_18 extends Locales[K][K_1][K_2][K_3][K_4][K_5] ? T_18 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5] extends infer T_19 ? T_19 extends Locales[K][K_1][K_2][K_3][K_4][K_5] ? T_19 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_19 : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5] extends infer T_20 ? { [K_6 in keyof T_20]: Locales[K][K_1][K_2][K_3][K_4][K_5][K_6] extends Function ? Locales[K][K_1][K_2][K_3][K_4][K_5][K_6] : (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6] extends infer T_21 ? T_21 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6] ? T_21 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6] extends infer T_22 ? T_22 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6] ? T_22 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_22 : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6] extends infer T_23 ? { [K_7 in keyof T_23]: Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7] extends Function ? Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7] : (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7] extends infer T_24 ? T_24 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7] ? T_24 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7] extends infer T_25 ? T_25 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7] ? T_25 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_25 : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7] extends infer T_26 ? { [K_8 in keyof T_26]: Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8] extends Function ? Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8] : (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8] extends infer T_27 ? T_27 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8] ? T_27 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8] extends infer T_28 ? T_28 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8] ? T_28 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_28 : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8] extends infer T_29 ? { [K_9 in keyof T_29]: Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9] extends Function ? Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9] : (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9] extends infer T_30 ? T_30 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9] ? T_30 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9] extends infer T_31 ? T_31 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9] ? T_31 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_31 : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9] extends infer T_32 ? { [K_10 in keyof T_32]: Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10] extends Function ? Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10] : (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10] extends infer T_33 ? T_33 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10] ? T_33 extends [] ? [] : never : never : never) | (Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10] extends infer T_34 ? T_34 extends Locales[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10] ? T_34 extends import("ts-toolbelt/out/Function/_Internal").Narrowable ? T_34 : never : never : never) | any; } : never); } : never); } : never); } : never); } : never); } : never); } : never); } : never); } : never); } : never); }>, import("./schema").SchemaTypeOf<S_3>>>;
@@ -7,12 +7,14 @@ import { SelectorSource, GenericSelector } from "./selector";
7
7
  import { JsonOfSource } from "./val";
8
8
  import { remote } from "./source/remote";
9
9
  import { file } from "./source/file";
10
+ import { richtext } from "./source/richtext";
10
11
  type ValConstructor = {
11
12
  content: typeof content;
12
13
  getPath: typeof getPath;
13
14
  key: typeof getPath;
14
15
  remote: typeof remote;
15
16
  file: typeof file;
17
+ richtext: typeof richtext;
16
18
  };
17
19
  export type InitVal<Locales extends readonly string[] | undefined> = [
18
20
  Locales
@@ -3,9 +3,10 @@ import { GenericSelector, SelectorOf, SelectorSource } from "./selector";
3
3
  import { Source } from "./source";
4
4
  import { ModuleId, ModulePath, SourcePath } from "./val";
5
5
  import { Json } from "./Json";
6
- import { RichText, SerializedRichTextSchema } from "./schema/richtext";
6
+ import { SerializedRichTextSchema } from "./schema/richtext";
7
7
  import { ImageMetadata, ImageSchema, SerializedImageSchema } from "./schema/image";
8
8
  import { FileSource } from "./source/file";
9
+ import { RichText } from "./source/richtext";
9
10
  declare const brand: unique symbol;
10
11
  export type ValModule<T extends SelectorSource> = SelectorOf<T> & ValModuleBrand;
11
12
  export type ValModuleBrand = {
@@ -22,7 +23,7 @@ export declare function resolvePath(path: ModulePath, valModule: ValModule<Selec
22
23
  source: any;
23
24
  } | {
24
25
  path: string;
25
- schema: SerializedRichTextSchema | Schema<RichText<"h1" | "h2" | "h3" | "h4" | "h5" | "h6", import("./schema/richtext").TextNode>>;
26
+ schema: SerializedRichTextSchema | Schema<RichText<"h1" | "h2" | "h3" | "h4" | "h5" | "h6", import("./source/richtext").TextNode>>;
26
27
  source: any;
27
28
  } | {
28
29
  path: ModulePath;
@@ -1,76 +1,16 @@
1
1
  import { Schema, SerializedSchema } from ".";
2
+ import { RichTextSource } from "../source/richtext";
2
3
  import { SourcePath } from "../val";
3
4
  export type SerializedRichTextSchema = {
4
5
  type: "richtext";
5
6
  opt: boolean;
6
7
  };
7
- type Node = {
8
- version: 1;
9
- };
10
- type NodeType = Node & {
11
- format: FormatType;
12
- direction: DirectionType;
13
- indent: number;
14
- };
15
- type FormatType = "left" | "start" | "center" | "right" | "end" | "justify" | "";
16
- type DirectionType = "ltr" | "rtl" | null;
17
- export type TextNode = Node & {
18
- format: FormatType | number;
19
- detail: number;
20
- mode: "normal" | "code" | "quote";
21
- style: string;
22
- text: string;
23
- type: "text";
24
- direction?: DirectionType;
25
- indent?: number;
26
- };
27
- export type ImageNode = Node & {
28
- altText: string;
29
- height: number;
30
- width: number;
31
- maxWidth: number;
32
- src: string;
33
- type: "image";
34
- };
35
- export type ParagraphNode<VN = TextNode> = NodeType & {
36
- children: (TextNode | VN)[];
37
- type: "paragraph";
38
- };
39
- export type HeadingNode<HT extends HeadingTags = HeadingTags> = NodeType & {
40
- children: TextNode[];
41
- type: "heading";
42
- tag: HT;
43
- };
44
- export type ListItemNode<VN = TextNode> = NodeType & {
45
- children: (TextNode | VN)[];
46
- type: "listitem";
47
- value: number;
48
- checked?: boolean;
49
- };
50
- export type ListNode<VN = TextNode> = NodeType & {
51
- children: ListItemNode<VN>[];
52
- type: "list";
53
- tag: "ol" | "ul";
54
- listType: "number" | "bullet" | "check";
55
- start?: number;
56
- };
57
- type HeadingTags = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
58
- export type RootNode<HT extends HeadingTags, VN> = Node & {
59
- children: (HeadingNode<HT> | ParagraphNode<VN> | ListNode<VN>)[];
60
- type: "root";
61
- format: FormatType;
62
- direction: DirectionType;
63
- indent: number;
64
- };
65
- type ValNode = ImageNode;
66
- export type RichText<HT extends HeadingTags = HeadingTags, VN extends TextNode | ValNode = TextNode> = RootNode<HT, VN>;
67
- export declare class RichTextSchema<Src extends RichText | null> extends Schema<Src> {
8
+ export declare class RichTextSchema<Src extends RichTextSource | null> extends Schema<Src> {
68
9
  readonly opt: boolean;
69
10
  validate(src: Src): false | Record<SourcePath, string[]>;
70
11
  match(src: Src): boolean;
71
- optional(): Schema<RichText<HeadingTags, TextNode> | null>;
12
+ optional(): Schema<RichTextSource | null>;
72
13
  serialize(): SerializedSchema;
73
14
  constructor(opt?: boolean);
74
15
  }
75
- export declare const richtext: () => Schema<RichText>;
76
- export {};
16
+ export declare const richtext: () => Schema<RichTextSource>;
@@ -15,6 +15,7 @@ import { A } from "ts-toolbelt";
15
15
  import { I18nSource, I18nCompatibleSource } from "../source/i18n";
16
16
  import { RemoteCompatibleSource, RemoteSource } from "../source/remote";
17
17
  import { FileSource } from "../source/file";
18
+ import { RichText, RichTextSource } from "../source/richtext";
18
19
  /**
19
20
  * Selectors can be used to select parts of a Val module.
20
21
  * Unlike queries, joins, aggregates etc is and will not be supported.
@@ -36,10 +37,10 @@ import { FileSource } from "../source/file";
36
37
  * }));
37
38
  *
38
39
  */
39
- export type Selector<T extends Source> = Source extends T ? GenericSelector<T> : T extends I18nSource<infer L, infer S> ? I18nSelector<L, S> : T extends RemoteSource<infer S> ? S extends RemoteCompatibleSource ? RemoteSelector<S> : GenericSelector<Source, "Could not determine remote source"> : T extends FileSource ? FileSelector : 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;
40
+ export type Selector<T extends Source> = Source extends T ? GenericSelector<T> : T extends I18nSource<infer L, infer S> ? I18nSelector<L, S> : T extends RemoteSource<infer S> ? S extends RemoteCompatibleSource ? RemoteSelector<S> : GenericSelector<Source, "Could not determine remote source"> : T extends FileSource ? FileSelector : T extends RichTextSource ? RichText : 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;
40
41
  export type SelectorSource = SourcePrimitive | undefined | readonly SelectorSource[] | {
41
42
  [key: string]: SelectorSource;
42
- } | I18nSource<readonly string[], I18nCompatibleSource> | RemoteSource<RemoteCompatibleSource> | FileSource | GenericSelector<Source>;
43
+ } | I18nSource<readonly string[], I18nCompatibleSource> | RemoteSource<RemoteCompatibleSource> | FileSource | RichTextSource | GenericSelector<Source>;
43
44
  /**
44
45
  * @internal
45
46
  */
@@ -1,7 +1,8 @@
1
1
  import { FileSource } from "./file";
2
2
  import { I18nSource, I18nCompatibleSource } from "./i18n";
3
3
  import { RemoteSource, RemoteCompatibleSource } from "./remote";
4
- export type Source = SourcePrimitive | SourceObject | SourceArray | I18nSource<string[], I18nCompatibleSource> | RemoteSource<RemoteCompatibleSource> | FileSource;
4
+ import { RichTextSource } from "./richtext";
5
+ export type Source = SourcePrimitive | SourceObject | SourceArray | I18nSource<string[], I18nCompatibleSource> | RemoteSource<RemoteCompatibleSource> | FileSource | RichTextSource;
5
6
  export type SourceObject = {
6
7
  [key in string]: Source;
7
8
  } & {
@@ -15,7 +16,7 @@ export type SourceObject = {
15
16
  export type SourceArray = readonly Source[];
16
17
  export type SourcePrimitive = string | number | boolean | null;
17
18
  export declare const VAL_EXTENSION: "_type";
18
- export declare function getValExtension(source: Source): false | "" | 0 | "file" | "i18n" | "remote" | null | undefined;
19
+ export declare function getValExtension(source: Source): false | "" | 0 | "richtext" | "file" | "i18n" | "remote" | null | undefined;
19
20
  /**
20
21
  * A phantom type parameter is one that doesn't show up at runtime, but is checked statically (and only) at compile time.
21
22
  *
@@ -1,11 +1,11 @@
1
1
  import { SourcePrimitive, VAL_EXTENSION, PhantomType } from ".";
2
- import { RichText } from "../schema/richtext";
3
2
  import { FileSource } from "./file";
4
3
  import { I18nCompatibleSource, I18nSource } from "./i18n";
4
+ import { RichTextSource } from "./richtext";
5
5
  /**
6
6
  * Remote sources cannot include other remote sources.
7
7
  */
8
- export type RemoteCompatibleSource = SourcePrimitive | RemoteObject | RemoteArray | RichText | FileSource | I18nSource<string[], I18nCompatibleSource>;
8
+ export type RemoteCompatibleSource = SourcePrimitive | RemoteObject | RemoteArray | RichTextSource | FileSource | I18nSource<string[], I18nCompatibleSource>;
9
9
  export type RemoteObject = {
10
10
  [key in string]: RemoteCompatibleSource;
11
11
  };
@@ -0,0 +1,63 @@
1
+ import { VAL_EXTENSION } from ".";
2
+ import { SourcePath } from "../val";
3
+ type Node = {
4
+ version?: 1;
5
+ };
6
+ type NodeType = Node & {
7
+ format?: FormatType;
8
+ direction?: DirectionType;
9
+ indent?: number;
10
+ };
11
+ type FormatType = "left" | "start" | "center" | "right" | "end" | "justify" | "";
12
+ type DirectionType = "ltr" | "rtl" | null;
13
+ export type TextNode = Node & {
14
+ type: "text";
15
+ format?: FormatType | number;
16
+ detail?: number;
17
+ mode?: "normal" | "code" | "quote";
18
+ style?: string;
19
+ text: string;
20
+ direction?: DirectionType;
21
+ indent?: number;
22
+ };
23
+ export type ParagraphNode<VN = TextNode> = NodeType & {
24
+ children: (TextNode | VN)[];
25
+ type: "paragraph";
26
+ };
27
+ export type HeadingNode<HT extends HeadingTags = HeadingTags> = NodeType & {
28
+ children: TextNode[];
29
+ type: "heading";
30
+ tag: HT;
31
+ };
32
+ export type ListItemNode<VN = TextNode> = NodeType & {
33
+ children: (TextNode | VN)[];
34
+ type: "listitem";
35
+ value: number;
36
+ checked?: boolean;
37
+ };
38
+ export type ListNode<VN = TextNode> = NodeType & {
39
+ children: ListItemNode<VN>[];
40
+ type: "list";
41
+ tag: "ol" | "ul";
42
+ listType: "number" | "bullet" | "check";
43
+ start?: number;
44
+ };
45
+ type HeadingTags = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
46
+ export type RootNode<HT extends HeadingTags, VN> = Node & {
47
+ children: (HeadingNode<HT> | ParagraphNode<VN> | ListNode<VN>)[];
48
+ type?: "root";
49
+ format?: FormatType;
50
+ direction?: DirectionType;
51
+ indent?: number;
52
+ };
53
+ declare const brand: unique symbol;
54
+ export type RichText<HT extends HeadingTags = HeadingTags, VN extends TextNode = TextNode> = RootNode<HT, VN> & {
55
+ [brand]: "richtext";
56
+ valPath: SourcePath;
57
+ };
58
+ export type RichTextSource = RichText & {
59
+ readonly [VAL_EXTENSION]: "richtext";
60
+ };
61
+ export declare function richtext(data: RootNode<HeadingTags, TextNode> | string): RichTextSource;
62
+ export declare function isRichText(obj: unknown): obj is RichTextSource;
63
+ export {};
@@ -21,6 +21,7 @@ export type Val<T extends Json> = Json extends T ? {
21
21
  readonly [Path]: SourcePath | undefined;
22
22
  readonly val: Source;
23
23
  } : T extends JsonObject ? ObjectVal<T> : T extends JsonArray ? ArrayVal<T> : T extends JsonPrimitive ? PrimitiveVal<T> : never;
24
+ export declare function isVal<T extends Json>(val: unknown): val is Val<T>;
24
25
  declare const brand: unique symbol;
25
26
  /**
26
27
  * The path of the source value.
@@ -383,6 +383,9 @@ var convertImageSource = function convertImageSource(src) {
383
383
  function isSerializedVal(val) {
384
384
  return createClass._typeof(val) === "object" && val !== null && val !== undefined && ("val" in val || "valPath" in val);
385
385
  }
386
+ function isVal(val) {
387
+ return createClass._typeof(val) === "object" && val !== null && val !== undefined && Path in val && "val" in val;
388
+ }
386
389
 
387
390
  /**
388
391
  * The path of the source value.
@@ -1027,5 +1030,6 @@ exports.index = index;
1027
1030
  exports.isFile = isFile;
1028
1031
  exports.isSelector = isSelector;
1029
1032
  exports.isSerializedVal = isSerializedVal;
1033
+ exports.isVal = isVal;
1030
1034
  exports.newSelectorProxy = newSelectorProxy;
1031
1035
  exports.parse = parse;
@@ -381,6 +381,9 @@ var convertImageSource = function convertImageSource(src) {
381
381
  function isSerializedVal(val) {
382
382
  return _typeof(val) === "object" && val !== null && val !== undefined && ("val" in val || "valPath" in val);
383
383
  }
384
+ function isVal(val) {
385
+ return _typeof(val) === "object" && val !== null && val !== undefined && Path in val && "val" in val;
386
+ }
384
387
 
385
388
  /**
386
389
  * The path of the source value.
@@ -997,4 +1000,4 @@ var index = /*#__PURE__*/Object.freeze({
997
1000
  evaluate: evaluate
998
1001
  });
999
1002
 
1000
- export { Call as C, Expr as E, FILE_REF_PROP as F, GenericSelector as G, ImageSchema as I, NilSym as N, Path as P, Schema as S, VAL_EXTENSION as V, _inherits as _, _createSuper as a, SourceOrExpr as b, _objectSpread2 as c, _defineProperty as d, createValPathOfItem as e, isSelector as f, getValPath as g, isSerializedVal as h, image as i, file as j, isFile as k, convertImageSource as l, getSchema as m, newSelectorProxy as n, index as o, parse as p, StringLiteral as q, StringTemplate as r, Sym as s, evaluate as t };
1003
+ export { Call as C, Expr as E, FILE_REF_PROP as F, GenericSelector as G, ImageSchema as I, NilSym as N, Path as P, Schema as S, VAL_EXTENSION as V, _inherits as _, _createSuper as a, SourceOrExpr as b, _objectSpread2 as c, _defineProperty as d, createValPathOfItem as e, isSelector as f, getValPath as g, isSerializedVal as h, image as i, file as j, isFile as k, convertImageSource as l, getSchema as m, newSelectorProxy as n, isVal as o, index as p, parse as q, StringLiteral as r, StringTemplate as s, Sym as t, evaluate as u };
@@ -383,6 +383,9 @@ var convertImageSource = function convertImageSource(src) {
383
383
  function isSerializedVal(val) {
384
384
  return createClass._typeof(val) === "object" && val !== null && val !== undefined && ("val" in val || "valPath" in val);
385
385
  }
386
+ function isVal(val) {
387
+ return createClass._typeof(val) === "object" && val !== null && val !== undefined && Path in val && "val" in val;
388
+ }
386
389
 
387
390
  /**
388
391
  * The path of the source value.
@@ -1027,5 +1030,6 @@ exports.index = index;
1027
1030
  exports.isFile = isFile;
1028
1031
  exports.isSelector = isSelector;
1029
1032
  exports.isSerializedVal = isSerializedVal;
1033
+ exports.isVal = isVal;
1030
1034
  exports.newSelectorProxy = newSelectorProxy;
1031
1035
  exports.parse = parse;