@contensis/canvas-react 1.0.1 → 1.0.3
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/README.md +1 -1
- package/dist/canvas-react.d.mts +36 -10
- package/dist/canvas-react.d.ts +36 -10
- package/dist/canvas-react.js +81 -82
- package/dist/canvas-react.js.map +1 -1
- package/dist/canvas-react.mjs +70 -82
- package/dist/canvas-react.mjs.map +1 -1
- package/package.json +2 -1
package/dist/canvas-react.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// src/renderer.tsx
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { createContext, useContext } from "react";
|
|
4
3
|
var RendererContext = createContext({});
|
|
5
4
|
function RenderContextProvider(props) {
|
|
6
5
|
const overrideBlocks = props.blocks;
|
|
7
6
|
const blocks = Object.keys(BLOCK_RENDERERS).reduce((prev, type) => {
|
|
8
7
|
const blockType = type;
|
|
9
|
-
|
|
8
|
+
const renderer = overrideBlocks?.[blockType] || BLOCK_RENDERERS[blockType];
|
|
9
|
+
prev[blockType] = renderer;
|
|
10
10
|
return prev;
|
|
11
11
|
}, {});
|
|
12
12
|
const overrideDecorators = props.decorators;
|
|
@@ -16,7 +16,7 @@ function RenderContextProvider(props) {
|
|
|
16
16
|
return prev;
|
|
17
17
|
}, {});
|
|
18
18
|
const value = { blocks, decorators, components: props.components };
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ React.createElement(RendererContext.Provider, { value }, props.children);
|
|
20
20
|
}
|
|
21
21
|
function useBlocks() {
|
|
22
22
|
const value = useContext(RendererContext);
|
|
@@ -33,10 +33,10 @@ function useComponents() {
|
|
|
33
33
|
function RenderBlock(props) {
|
|
34
34
|
const blocks = useBlocks();
|
|
35
35
|
const Component2 = blocks[props.block.type];
|
|
36
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ React.createElement(Component2, { block: props.block });
|
|
37
37
|
}
|
|
38
38
|
function RenderBlocks(props) {
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.blocks.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, { block, key: block.id })));
|
|
40
40
|
}
|
|
41
41
|
function RenderContents(props) {
|
|
42
42
|
return props.contents ? props.contents : props.fallback;
|
|
@@ -46,20 +46,20 @@ function RenderChildren(props) {
|
|
|
46
46
|
const isString = typeof props.block?.value === "string";
|
|
47
47
|
const render = () => {
|
|
48
48
|
if (isArray) {
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ React.createElement(RenderBlocks, { blocks: props.block.value });
|
|
50
50
|
} else if (isString) {
|
|
51
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ React.createElement(RenderText, { text: props.block.value });
|
|
52
52
|
} else {
|
|
53
|
-
return /* @__PURE__ */
|
|
53
|
+
return /* @__PURE__ */ React.createElement(RenderText, { text: "" });
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
return render();
|
|
57
57
|
}
|
|
58
58
|
function RenderText(props) {
|
|
59
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
|
|
60
60
|
}
|
|
61
61
|
function Renderer(props) {
|
|
62
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ React.createElement(RenderBlocks, { blocks: props.data });
|
|
63
63
|
}
|
|
64
64
|
function getAttributes(props, extra = {}) {
|
|
65
65
|
const { block, ...rest } = props;
|
|
@@ -72,24 +72,21 @@ function getAttributes(props, extra = {}) {
|
|
|
72
72
|
return attributes;
|
|
73
73
|
}
|
|
74
74
|
function WithCaption(props) {
|
|
75
|
-
return !!props.caption ? /* @__PURE__ */
|
|
76
|
-
props.children,
|
|
77
|
-
/* @__PURE__ */ jsx("figcaption", { children: props.caption })
|
|
78
|
-
] }) : props.children;
|
|
75
|
+
return !!props.caption ? /* @__PURE__ */ React.createElement("figure", null, props.children, /* @__PURE__ */ React.createElement("figcaption", null, props.caption)) : props.children || null;
|
|
79
76
|
}
|
|
80
77
|
function RenderBlockChildrenFactory() {
|
|
81
78
|
return function(props) {
|
|
82
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ React.createElement(RenderChildren, { block: props.block });
|
|
83
80
|
};
|
|
84
81
|
}
|
|
85
82
|
function EmptyChildrenFactory() {
|
|
86
83
|
return function(props) {
|
|
87
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
88
85
|
};
|
|
89
86
|
}
|
|
90
87
|
function Anchor(props) {
|
|
91
88
|
const attributes = getAttributes(props);
|
|
92
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ React.createElement("a", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Anchor.Children, { block: props.block }) }));
|
|
93
90
|
}
|
|
94
91
|
Anchor.Children = RenderBlockChildrenFactory();
|
|
95
92
|
function Code(props) {
|
|
@@ -99,13 +96,13 @@ function Code(props) {
|
|
|
99
96
|
const codeAttributes = getAttributes(props, {
|
|
100
97
|
className: `language-${props.block?.value?.language}`
|
|
101
98
|
});
|
|
102
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ React.createElement("pre", { ...attributes }, /* @__PURE__ */ React.createElement("code", { ...codeAttributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Code.Children, { block: props.block }) })));
|
|
103
100
|
}
|
|
104
101
|
Code.Children = function(props) {
|
|
105
|
-
return /* @__PURE__ */
|
|
102
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.block?.value?.code);
|
|
106
103
|
};
|
|
107
104
|
function CodeWithCaption(props) {
|
|
108
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ React.createElement(WithCaption, { caption: props.block?.value?.caption }, /* @__PURE__ */ React.createElement(Code, { ...props }));
|
|
109
106
|
}
|
|
110
107
|
function Component(props) {
|
|
111
108
|
const component = props?.block.properties?.component;
|
|
@@ -117,46 +114,43 @@ function Component(props) {
|
|
|
117
114
|
"data-component": props.block.properties?.component,
|
|
118
115
|
"data-component-value": value
|
|
119
116
|
});
|
|
120
|
-
return !!ComponentElement ? /* @__PURE__ */
|
|
117
|
+
return !!ComponentElement ? /* @__PURE__ */ React.createElement(ComponentElement, { ...props }) : /* @__PURE__ */ React.createElement("div", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Component.Children, { block: props.block }) }));
|
|
121
118
|
}
|
|
122
119
|
Component.Children = function(props) {
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
"Component: ",
|
|
125
|
-
props.block?.properties?.component
|
|
126
|
-
] });
|
|
120
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, "Component: ", props.block?.properties?.component);
|
|
127
121
|
};
|
|
128
122
|
function Divider(props) {
|
|
129
123
|
const attributes = getAttributes(props);
|
|
130
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ React.createElement("hr", { ...attributes });
|
|
131
125
|
}
|
|
132
126
|
Divider.Children = EmptyChildrenFactory();
|
|
133
|
-
function
|
|
127
|
+
function Fragment(props) {
|
|
134
128
|
const hasDecorators = !!props.block?.properties?.decorators?.length;
|
|
135
129
|
const decorators = props.block?.properties?.decorators;
|
|
136
|
-
return hasDecorators ? /* @__PURE__ */
|
|
130
|
+
return hasDecorators ? /* @__PURE__ */ React.createElement(Decorators, { block: props.block, decorators }) : /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Fragment.Children, { block: props.block }) });
|
|
137
131
|
}
|
|
138
|
-
|
|
132
|
+
Fragment.Children = RenderBlockChildrenFactory();
|
|
139
133
|
function Heading(props) {
|
|
140
134
|
const attributes = getAttributes(props);
|
|
141
135
|
const render = () => {
|
|
142
136
|
switch (props?.block?.properties?.level) {
|
|
143
137
|
case 2: {
|
|
144
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ React.createElement("h2", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Heading.Children, { block: props.block }) }));
|
|
145
139
|
}
|
|
146
140
|
case 3: {
|
|
147
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ React.createElement("h3", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Heading.Children, { block: props.block }) }));
|
|
148
142
|
}
|
|
149
143
|
case 4: {
|
|
150
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ React.createElement("h4", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Heading.Children, { block: props.block }) }));
|
|
151
145
|
}
|
|
152
146
|
case 5: {
|
|
153
|
-
return /* @__PURE__ */
|
|
147
|
+
return /* @__PURE__ */ React.createElement("h5", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Heading.Children, { block: props.block }) }));
|
|
154
148
|
}
|
|
155
149
|
case 6: {
|
|
156
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ React.createElement("h6", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Heading.Children, { block: props.block }) }));
|
|
157
151
|
}
|
|
158
152
|
default: {
|
|
159
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ React.createElement("h1", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Heading.Children, { block: props.block }) }));
|
|
160
154
|
}
|
|
161
155
|
}
|
|
162
156
|
};
|
|
@@ -170,22 +164,22 @@ function Image(props) {
|
|
|
170
164
|
alt: props.block?.value?.altText,
|
|
171
165
|
title: props?.block?.value?.caption
|
|
172
166
|
});
|
|
173
|
-
return /* @__PURE__ */
|
|
167
|
+
return /* @__PURE__ */ React.createElement("img", { ...attributes });
|
|
174
168
|
}
|
|
175
169
|
Image.Children = EmptyChildrenFactory();
|
|
176
170
|
function ImageWithCaption(props) {
|
|
177
|
-
return /* @__PURE__ */
|
|
171
|
+
return /* @__PURE__ */ React.createElement(WithCaption, { caption: props.block?.value?.caption }, /* @__PURE__ */ React.createElement(Image, { ...props }));
|
|
178
172
|
}
|
|
179
173
|
function InlineEntry(props) {
|
|
180
174
|
const href = props?.block?.value?.sys?.uri;
|
|
181
175
|
const attributes = getAttributes(props, {
|
|
182
176
|
href
|
|
183
177
|
});
|
|
184
|
-
return !!attributes.href ? /* @__PURE__ */
|
|
178
|
+
return !!attributes.href ? /* @__PURE__ */ React.createElement("a", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(InlineEntry.Children, { block: props.block }) })) : /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(InlineEntry.Children, { block: props.block }) });
|
|
185
179
|
}
|
|
186
180
|
InlineEntry.Children = function(props) {
|
|
187
181
|
const entryTitle = props?.block?.value?.entryTitle || "";
|
|
188
|
-
return /* @__PURE__ */
|
|
182
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, entryTitle);
|
|
189
183
|
};
|
|
190
184
|
function Link(props) {
|
|
191
185
|
const linkValue = props?.block?.properties?.link;
|
|
@@ -194,7 +188,7 @@ function Link(props) {
|
|
|
194
188
|
target: props?.block?.properties?.newTab ? "_blank" : null,
|
|
195
189
|
rel: props?.block?.properties?.newTab ? "noopener noreferrer" : null
|
|
196
190
|
});
|
|
197
|
-
return !!attributes.href ? /* @__PURE__ */
|
|
191
|
+
return !!attributes.href ? /* @__PURE__ */ React.createElement("a", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Link.Children, { block: props.block }) })) : /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Link.Children, { block: props.block }) });
|
|
198
192
|
}
|
|
199
193
|
Link.Children = RenderBlockChildrenFactory();
|
|
200
194
|
function List(props) {
|
|
@@ -202,85 +196,78 @@ function List(props) {
|
|
|
202
196
|
const attributes = getAttributes(props, {
|
|
203
197
|
start: isOrdered ? props.block?.properties?.start : null
|
|
204
198
|
});
|
|
205
|
-
return isOrdered ? /* @__PURE__ */
|
|
199
|
+
return isOrdered ? /* @__PURE__ */ React.createElement("ol", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(List.Children, { block: props.block }) })) : /* @__PURE__ */ React.createElement("ul", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(List.Children, { block: props.block }) }));
|
|
206
200
|
}
|
|
207
201
|
List.Children = RenderBlockChildrenFactory();
|
|
208
202
|
function ListItem(props) {
|
|
209
203
|
const attributes = getAttributes(props);
|
|
210
|
-
return /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ React.createElement("li", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(ListItem.Children, { block: props.block }) }));
|
|
211
205
|
}
|
|
212
206
|
ListItem.Children = RenderBlockChildrenFactory();
|
|
213
207
|
function Panel(props) {
|
|
214
208
|
const attributes = getAttributes(props, {
|
|
215
209
|
className: ["panel", props.block?.properties?.panelType || "info"].join(" ")
|
|
216
210
|
});
|
|
217
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ React.createElement("aside", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Panel.Children, { block: props.block }) }));
|
|
218
212
|
}
|
|
219
213
|
Panel.Children = RenderBlockChildrenFactory();
|
|
220
214
|
function Paragraph(props) {
|
|
221
215
|
const attributes = getAttributes(props, {
|
|
222
216
|
className: props.block?.properties?.paragraphType
|
|
223
217
|
});
|
|
224
|
-
return /* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ React.createElement("p", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Paragraph.Children, { block: props.block }) }));
|
|
225
219
|
}
|
|
226
220
|
Paragraph.Children = RenderBlockChildrenFactory();
|
|
227
221
|
function Quote(props) {
|
|
228
222
|
const attributes = getAttributes(props, {
|
|
229
223
|
"cite": props.block?.properties?.url
|
|
230
224
|
});
|
|
231
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ React.createElement("blockquote", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Quote.Children, { block: props.block }) }));
|
|
232
226
|
}
|
|
233
227
|
Quote.Children = function(props) {
|
|
234
228
|
const source = props.block?.properties?.source;
|
|
235
229
|
const citation = props.block?.properties?.citation;
|
|
236
230
|
const hasChildren = !!source || !!citation;
|
|
237
|
-
return hasChildren ? /* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(RenderChildren, { block: props.block }) }),
|
|
239
|
-
/* @__PURE__ */ jsxs("footer", { children: [
|
|
240
|
-
source,
|
|
241
|
-
" ",
|
|
242
|
-
!!citation ? /* @__PURE__ */ jsx("cite", { children: citation }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
243
|
-
] })
|
|
244
|
-
] }) : /* @__PURE__ */ jsx(RenderChildren, { block: props.block });
|
|
231
|
+
return hasChildren ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement(RenderChildren, { block: props.block })), /* @__PURE__ */ React.createElement("footer", null, source, " ", !!citation ? /* @__PURE__ */ React.createElement("cite", null, citation) : /* @__PURE__ */ React.createElement(React.Fragment, null))) : /* @__PURE__ */ React.createElement(RenderChildren, { block: props.block });
|
|
245
232
|
};
|
|
246
233
|
function Table(props) {
|
|
247
234
|
const attributes = getAttributes(props);
|
|
248
|
-
return /* @__PURE__ */
|
|
235
|
+
return /* @__PURE__ */ React.createElement("table", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Table.Children, { block: props.block }) }));
|
|
249
236
|
}
|
|
250
237
|
Table.Children = RenderBlockChildrenFactory();
|
|
251
238
|
function TableBody(props) {
|
|
252
239
|
const attributes = getAttributes(props);
|
|
253
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ React.createElement("tbody", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(TableBody.Children, { block: props.block }) }));
|
|
254
241
|
}
|
|
255
242
|
TableBody.Children = RenderBlockChildrenFactory();
|
|
256
243
|
function TableCaption(props) {
|
|
257
244
|
const attributes = getAttributes(props);
|
|
258
|
-
return /* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ React.createElement("caption", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(TableCaption.Children, { block: props.block }) }));
|
|
259
246
|
}
|
|
260
247
|
TableCaption.Children = RenderBlockChildrenFactory();
|
|
261
248
|
function TableCell(props) {
|
|
262
249
|
const attributes = getAttributes(props);
|
|
263
|
-
return /* @__PURE__ */
|
|
250
|
+
return /* @__PURE__ */ React.createElement("td", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(TableCell.Children, { block: props.block }) }));
|
|
264
251
|
}
|
|
265
252
|
TableCell.Children = RenderBlockChildrenFactory();
|
|
266
253
|
function TableFooter(props) {
|
|
267
254
|
const attributes = getAttributes(props);
|
|
268
|
-
return /* @__PURE__ */
|
|
255
|
+
return /* @__PURE__ */ React.createElement("tfoot", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(TableFooter.Children, { block: props.block }) }));
|
|
269
256
|
}
|
|
270
257
|
TableFooter.Children = RenderBlockChildrenFactory();
|
|
271
258
|
function TableHeader(props) {
|
|
272
259
|
const attributes = getAttributes(props);
|
|
273
|
-
return /* @__PURE__ */
|
|
260
|
+
return /* @__PURE__ */ React.createElement("thead", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(TableHeader.Children, { block: props.block }) }));
|
|
274
261
|
}
|
|
275
262
|
TableHeader.Children = RenderBlockChildrenFactory();
|
|
276
263
|
function TableHeaderCell(props) {
|
|
277
264
|
const attributes = getAttributes(props);
|
|
278
|
-
return /* @__PURE__ */
|
|
265
|
+
return /* @__PURE__ */ React.createElement("th", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(TableHeaderCell.Children, { block: props.block }) }));
|
|
279
266
|
}
|
|
280
267
|
TableHeaderCell.Children = RenderBlockChildrenFactory();
|
|
281
268
|
function TableRow(props) {
|
|
282
269
|
const attributes = getAttributes(props);
|
|
283
|
-
return /* @__PURE__ */
|
|
270
|
+
return /* @__PURE__ */ React.createElement("tr", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(TableRow.Children, { block: props.block }) }));
|
|
284
271
|
}
|
|
285
272
|
TableRow.Children = RenderBlockChildrenFactory();
|
|
286
273
|
function Decorators(props) {
|
|
@@ -290,83 +277,83 @@ function Decorators(props) {
|
|
|
290
277
|
const DecoratorComponent = !!firstDecorator ? decorators[firstDecorator] : void 0;
|
|
291
278
|
const render = () => {
|
|
292
279
|
if (!!DecoratorComponent) {
|
|
293
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ React.createElement(DecoratorComponent, { block: props.block, decorator: firstDecorator, otherDecorators: remainingDecorators });
|
|
294
281
|
} else if (firstDecorator) {
|
|
295
|
-
return /* @__PURE__ */
|
|
282
|
+
return /* @__PURE__ */ React.createElement(Decorators, { block: props.block, decorators: remainingDecorators });
|
|
296
283
|
} else {
|
|
297
|
-
return /* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ React.createElement(Fragment.Children, { block: props.block });
|
|
298
285
|
}
|
|
299
286
|
};
|
|
300
287
|
return render();
|
|
301
288
|
}
|
|
302
289
|
function DecoratorChildren(props) {
|
|
303
|
-
return /* @__PURE__ */
|
|
290
|
+
return /* @__PURE__ */ React.createElement(Decorators, { block: props.block, decorators: props.otherDecorators });
|
|
304
291
|
}
|
|
305
292
|
function InlineCode(props) {
|
|
306
293
|
const attributes = getAttributes(props);
|
|
307
|
-
return /* @__PURE__ */
|
|
294
|
+
return /* @__PURE__ */ React.createElement("code", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(InlineCode.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
308
295
|
}
|
|
309
296
|
InlineCode.Children = DecoratorChildren;
|
|
310
297
|
function Delete(props) {
|
|
311
298
|
const attributes = getAttributes(props);
|
|
312
|
-
return /* @__PURE__ */
|
|
299
|
+
return /* @__PURE__ */ React.createElement("del", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Delete.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
313
300
|
}
|
|
314
301
|
Delete.Children = DecoratorChildren;
|
|
315
302
|
function Emphasis(props) {
|
|
316
303
|
const attributes = getAttributes(props);
|
|
317
|
-
return /* @__PURE__ */
|
|
304
|
+
return /* @__PURE__ */ React.createElement("em", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Emphasis.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
318
305
|
}
|
|
319
306
|
Emphasis.Children = DecoratorChildren;
|
|
320
307
|
function Insert(props) {
|
|
321
308
|
const attributes = getAttributes(props);
|
|
322
|
-
return /* @__PURE__ */
|
|
309
|
+
return /* @__PURE__ */ React.createElement("ins", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Insert.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
323
310
|
}
|
|
324
311
|
Insert.Children = DecoratorChildren;
|
|
325
312
|
function Keyboard(props) {
|
|
326
313
|
const attributes = getAttributes(props);
|
|
327
|
-
return /* @__PURE__ */
|
|
314
|
+
return /* @__PURE__ */ React.createElement("kbd", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Keyboard.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
328
315
|
}
|
|
329
316
|
Keyboard.Children = DecoratorChildren;
|
|
330
317
|
function LineBreak(props) {
|
|
331
318
|
const attributes = getAttributes(props);
|
|
332
|
-
return /* @__PURE__ */
|
|
319
|
+
return /* @__PURE__ */ React.createElement("br", { ...attributes });
|
|
333
320
|
}
|
|
334
321
|
LineBreak.Children = function(props) {
|
|
335
|
-
return /* @__PURE__ */
|
|
322
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
336
323
|
};
|
|
337
324
|
function Mark(props) {
|
|
338
325
|
const attributes = getAttributes(props);
|
|
339
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ React.createElement("mark", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Mark.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
340
327
|
}
|
|
341
328
|
Mark.Children = DecoratorChildren;
|
|
342
329
|
function Strong(props) {
|
|
343
330
|
const attributes = getAttributes(props);
|
|
344
|
-
return /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ React.createElement("strong", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Strong.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
345
332
|
}
|
|
346
333
|
Strong.Children = DecoratorChildren;
|
|
347
334
|
function Strikethrough(props) {
|
|
348
335
|
const attributes = getAttributes(props);
|
|
349
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ React.createElement("s", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Strikethrough.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
350
337
|
}
|
|
351
338
|
Strikethrough.Children = DecoratorChildren;
|
|
352
339
|
function Subscript(props) {
|
|
353
340
|
const attributes = getAttributes(props);
|
|
354
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ React.createElement("sub", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Subscript.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
355
342
|
}
|
|
356
343
|
Subscript.Children = DecoratorChildren;
|
|
357
344
|
function Superscript(props) {
|
|
358
345
|
const attributes = getAttributes(props);
|
|
359
|
-
return /* @__PURE__ */
|
|
346
|
+
return /* @__PURE__ */ React.createElement("sup", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Superscript.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
360
347
|
}
|
|
361
348
|
Superscript.Children = DecoratorChildren;
|
|
362
349
|
function Underline(props) {
|
|
363
350
|
const attributes = getAttributes(props);
|
|
364
|
-
return /* @__PURE__ */
|
|
351
|
+
return /* @__PURE__ */ React.createElement("u", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Underline.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
365
352
|
}
|
|
366
353
|
Underline.Children = DecoratorChildren;
|
|
367
354
|
function Variable(props) {
|
|
368
355
|
const attributes = getAttributes(props);
|
|
369
|
-
return /* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ React.createElement("var", { ...attributes }, /* @__PURE__ */ React.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ React.createElement(Variable.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
370
357
|
}
|
|
371
358
|
Variable.Children = DecoratorChildren;
|
|
372
359
|
var BLOCK_RENDERERS = {
|
|
@@ -374,7 +361,7 @@ var BLOCK_RENDERERS = {
|
|
|
374
361
|
"_code": CodeWithCaption,
|
|
375
362
|
"_component": Component,
|
|
376
363
|
"_divider": Divider,
|
|
377
|
-
"_fragment":
|
|
364
|
+
"_fragment": Fragment,
|
|
378
365
|
"_heading": Heading,
|
|
379
366
|
"_image": ImageWithCaption,
|
|
380
367
|
"_inlineEntry": InlineEntry,
|
|
@@ -415,7 +402,7 @@ export {
|
|
|
415
402
|
Delete,
|
|
416
403
|
Divider,
|
|
417
404
|
Emphasis,
|
|
418
|
-
|
|
405
|
+
Fragment,
|
|
419
406
|
Heading,
|
|
420
407
|
Image,
|
|
421
408
|
InlineCode,
|
|
@@ -429,6 +416,7 @@ export {
|
|
|
429
416
|
Mark,
|
|
430
417
|
Panel,
|
|
431
418
|
Paragraph,
|
|
419
|
+
Quote,
|
|
432
420
|
RenderContextProvider,
|
|
433
421
|
Renderer,
|
|
434
422
|
RendererContext,
|