@datocms/astro 0.6.0 → 0.6.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.
package/package.json
CHANGED
|
@@ -4,7 +4,12 @@ import {
|
|
|
4
4
|
type Document,
|
|
5
5
|
type StructuredText,
|
|
6
6
|
} from 'datocms-structured-text-utils';
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
BlockComponents,
|
|
9
|
+
InlineBlockComponents,
|
|
10
|
+
InlineRecordComponents,
|
|
11
|
+
LinkToRecordComponents,
|
|
12
|
+
} from './types';
|
|
8
13
|
|
|
9
14
|
type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRecord> =
|
|
10
15
|
| {
|
|
@@ -20,8 +25,8 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
20
25
|
data:
|
|
21
26
|
| (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
|
|
22
27
|
blocks: B[];
|
|
23
|
-
links
|
|
24
|
-
inlineBlocks
|
|
28
|
+
links?: never;
|
|
29
|
+
inlineBlocks?: never;
|
|
25
30
|
})
|
|
26
31
|
| null
|
|
27
32
|
| undefined;
|
|
@@ -35,9 +40,9 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
35
40
|
/** The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from a DatoCMS Structured Text field */
|
|
36
41
|
data:
|
|
37
42
|
| (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
|
|
38
|
-
blocks
|
|
43
|
+
blocks?: never;
|
|
39
44
|
links: L[];
|
|
40
|
-
inlineBlocks
|
|
45
|
+
inlineBlocks?: never;
|
|
41
46
|
})
|
|
42
47
|
| null
|
|
43
48
|
| undefined;
|
|
@@ -52,15 +57,15 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
52
57
|
/** The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from a DatoCMS Structured Text field */
|
|
53
58
|
data:
|
|
54
59
|
| (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
|
|
55
|
-
blocks
|
|
56
|
-
links
|
|
60
|
+
blocks?: never;
|
|
61
|
+
links?: never;
|
|
57
62
|
inlineBlocks: I[];
|
|
58
63
|
})
|
|
59
64
|
| null
|
|
60
65
|
| undefined;
|
|
61
66
|
blockComponents?: never;
|
|
62
67
|
/** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
|
|
63
|
-
inlineBlockComponents:
|
|
68
|
+
inlineBlockComponents: InlineBlockComponents<B, L, I>;
|
|
64
69
|
linkToRecordComponents?: never;
|
|
65
70
|
inlineRecordComponents?: never;
|
|
66
71
|
}
|
|
@@ -68,7 +73,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
68
73
|
/** The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from a DatoCMS Structured Text field */
|
|
69
74
|
data:
|
|
70
75
|
| (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
|
|
71
|
-
blocks
|
|
76
|
+
blocks?: never;
|
|
72
77
|
links: L[];
|
|
73
78
|
inlineBlocks: I[];
|
|
74
79
|
})
|
|
@@ -76,7 +81,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
76
81
|
| undefined;
|
|
77
82
|
blockComponents?: never;
|
|
78
83
|
/** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
|
|
79
|
-
inlineBlockComponents:
|
|
84
|
+
inlineBlockComponents: InlineBlockComponents<B, L, I>;
|
|
80
85
|
/** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
|
|
81
86
|
linkToRecordComponents: LinkToRecordComponents<B, L, I>;
|
|
82
87
|
/** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
|
|
@@ -87,7 +92,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
87
92
|
data:
|
|
88
93
|
| (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
|
|
89
94
|
blocks: B[];
|
|
90
|
-
links
|
|
95
|
+
links?: never;
|
|
91
96
|
inlineBlocks: I[];
|
|
92
97
|
})
|
|
93
98
|
| null
|
|
@@ -95,7 +100,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
95
100
|
/** An object in which the keys are the `__typename` of the blocks to be rendered, and the values are the Astro components */
|
|
96
101
|
blockComponents: BlockComponents<B, L, I>;
|
|
97
102
|
/** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
|
|
98
|
-
inlineBlockComponents:
|
|
103
|
+
inlineBlockComponents: InlineBlockComponents<B, L, I>;
|
|
99
104
|
linkToRecordComponents?: never;
|
|
100
105
|
inlineRecordComponents?: never;
|
|
101
106
|
}
|
|
@@ -105,7 +110,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
105
110
|
| (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
|
|
106
111
|
blocks: B[];
|
|
107
112
|
links: L[];
|
|
108
|
-
inlineBlocks
|
|
113
|
+
inlineBlocks?: never;
|
|
109
114
|
})
|
|
110
115
|
| null
|
|
111
116
|
| undefined;
|
|
@@ -130,7 +135,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
130
135
|
/** An object in which the keys are the `__typename` of the blocks to be rendered, and the values are the Astro components */
|
|
131
136
|
blockComponents: BlockComponents<B, L, I>;
|
|
132
137
|
/** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
|
|
133
|
-
inlineBlockComponents:
|
|
138
|
+
inlineBlockComponents: InlineBlockComponents<B, L, I>;
|
|
134
139
|
/** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
|
|
135
140
|
linkToRecordComponents: LinkToRecordComponents<B, L, I>;
|
|
136
141
|
/** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
|
|
@@ -138,9 +143,9 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
|
|
|
138
143
|
};
|
|
139
144
|
|
|
140
145
|
export function ensureValidStructuredTextProps<
|
|
141
|
-
B extends DatocmsRecord,
|
|
142
|
-
L extends DatocmsRecord,
|
|
143
|
-
I extends DatocmsRecord,
|
|
146
|
+
B extends DatocmsRecord = DatocmsRecord,
|
|
147
|
+
L extends DatocmsRecord = DatocmsRecord,
|
|
148
|
+
I extends DatocmsRecord = DatocmsRecord,
|
|
144
149
|
>(props: Props<B, L, I>): Props<B, L, I> {
|
|
145
150
|
return props;
|
|
146
151
|
}
|