@valbuild/core 0.20.0 → 0.20.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.
@@ -11,7 +11,7 @@ export type RichTextOptions = {
11
11
  };
12
12
  export type ParagraphNode<O extends RichTextOptions> = {
13
13
  tag: "p";
14
- children: (string | SpanNode<O> | ImageNode<O>)[];
14
+ children: (string | SpanNode<O>)[];
15
15
  };
16
16
  export type LineThrough<O extends RichTextOptions> = O["lineThrough"] extends true ? "line-through" : never;
17
17
  export type Italic<O extends RichTextOptions> = O["italic"] extends true ? "italic" : never;
@@ -30,7 +30,7 @@ export type ImageNode<O extends RichTextOptions> = O["img"] extends true ? {
30
30
  } : never;
31
31
  export type ListItemNode<O extends RichTextOptions> = {
32
32
  tag: "li";
33
- children: (string | SpanNode<O> | ImageNode<O> | UnorderedListNode<O> | OrderedListNode<O>)[];
33
+ children: (string | SpanNode<O> | UnorderedListNode<O> | OrderedListNode<O>)[];
34
34
  };
35
35
  export type UnorderedListNode<O extends RichTextOptions> = O["ul"] extends true ? {
36
36
  tag: "ul";
@@ -63,7 +63,7 @@ export type AnyRichTextOptions = {
63
63
  };
64
64
  export type RichTextSourceNode<O extends RichTextOptions> = Exclude<RichTextNode<O>, {
65
65
  tag: "img";
66
- }> | ParagraphNode<O> | ListItemNode<O> | ImageNode<O> | SourceNode<O>;
66
+ }> | SourceNode<O>;
67
67
  export type RichTextSource<O extends RichTextOptions> = {
68
68
  [VAL_EXTENSION]: "richtext";
69
69
  children: (HeadingNode<O> | ParagraphNode<O> | UnorderedListNode<O> | OrderedListNode<O> | SourceNode<O>)[];
@@ -456,6 +456,9 @@ function parseTokens(tokens) {
456
456
  }];
457
457
  }
458
458
  if (token.type === "text") {
459
+ if ("tokens" in token && Array.isArray(token.tokens)) {
460
+ return parseTokens(token.tokens);
461
+ }
459
462
  return [token.text];
460
463
  }
461
464
  if (token.type === "list") {
@@ -456,6 +456,9 @@ function parseTokens(tokens) {
456
456
  }];
457
457
  }
458
458
  if (token.type === "text") {
459
+ if ("tokens" in token && Array.isArray(token.tokens)) {
460
+ return parseTokens(token.tokens);
461
+ }
459
462
  return [token.text];
460
463
  }
461
464
  if (token.type === "list") {
@@ -433,6 +433,9 @@ function parseTokens(tokens) {
433
433
  }];
434
434
  }
435
435
  if (token.type === "text") {
436
+ if ("tokens" in token && Array.isArray(token.tokens)) {
437
+ return parseTokens(token.tokens);
438
+ }
436
439
  return [token.text];
437
440
  }
438
441
  if (token.type === "list") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {
@@ -19,7 +19,7 @@ export type RichTextOptions = {
19
19
 
20
20
  export type ParagraphNode<O extends RichTextOptions> = {
21
21
  tag: "p";
22
- children: (string | SpanNode<O> | ImageNode<O>)[];
22
+ children: (string | SpanNode<O>)[];
23
23
  // AnchorNode<O>
24
24
  };
25
25
 
@@ -79,7 +79,6 @@ export type ListItemNode<O extends RichTextOptions> = {
79
79
  | string
80
80
  | SpanNode<O>
81
81
  // | AnchorNode<O>
82
- | ImageNode<O>
83
82
  | UnorderedListNode<O>
84
83
  | OrderedListNode<O>
85
84
  )[];
@@ -140,9 +139,6 @@ export type AnyRichTextOptions = {
140
139
 
141
140
  export type RichTextSourceNode<O extends RichTextOptions> =
142
141
  | Exclude<RichTextNode<O>, { tag: "img" }>
143
- | ParagraphNode<O>
144
- | ListItemNode<O>
145
- | ImageNode<O>
146
142
  | SourceNode<O>;
147
143
 
148
144
  export type RichTextSource<O extends RichTextOptions> = {
@@ -230,6 +226,9 @@ function parseTokens<O extends RichTextOptions>(
230
226
  ];
231
227
  }
232
228
  if (token.type === "text") {
229
+ if ("tokens" in token && Array.isArray(token.tokens)) {
230
+ return parseTokens(token.tokens);
231
+ }
233
232
  return [token.text];
234
233
  }
235
234
  if (token.type === "list") {