@contensis/canvas-react 1.0.4 → 1.0.6
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/dist/canvas-react.d.mts +2 -1
- package/dist/canvas-react.d.ts +2 -1
- package/dist/canvas-react.js +123 -78
- package/dist/canvas-react.js.map +1 -1
- package/dist/esm/canvas-react.js +485 -0
- package/dist/esm/canvas-react.js.map +1 -0
- package/package.json +3 -3
- package/dist/canvas-react.mjs +0 -438
- package/dist/canvas-react.mjs.map +0 -1
package/dist/canvas-react.d.mts
CHANGED
|
@@ -352,6 +352,7 @@ declare const RendererContext: React.Context<RendererContextValue>;
|
|
|
352
352
|
*
|
|
353
353
|
*/
|
|
354
354
|
declare function RenderContextProvider(props: RendererContextProviderProps): React.JSX.Element;
|
|
355
|
+
declare function RenderChildren(props: RenderBlockProps<Block>): React.JSX.Element;
|
|
355
356
|
type Renderer<TProps> = FunctionComponent<TProps> | ClassType<TProps, Component$1<TProps>, ComponentClass<TProps>>;
|
|
356
357
|
/**
|
|
357
358
|
* The default render method for processing Canvas data
|
|
@@ -504,4 +505,4 @@ declare namespace Variable {
|
|
|
504
505
|
var Children: typeof DecoratorChildren;
|
|
505
506
|
}
|
|
506
507
|
|
|
507
|
-
export { Anchor, type AnchorBlock, type Block, type BlockRenderer, Code, type CodeBlock, Component, type ComponentBlock, type DecoratorType, Delete, Divider, type DividerBlock, Emphasis, Fragment, type FragmentBlock, Heading, type HeadingBlock, Image, type ImageBlock, InlineCode, InlineEntry, type InlineEntryBlock, Insert, Keyboard, LineBreak, Link, type LinkBlock, List, type ListBlock, ListItem, type ListItemBlock, Mark, Panel, type PanelBlock, Paragraph, type ParagraphBlock, Quote, type QuoteBlock, type RenderBlockProps, type RenderBlockPropsWithChildren, RenderContextProvider, type RenderDecoratorProps, type RenderDecoratorPropsWithChildren, Renderer, RendererContext, Strikethrough, Strong, Subscript, Superscript, Table, type TableBlock, TableBody, type TableBodyBlock, TableCaption, type TableCaptionBlock, TableCell, type TableCellBlock, TableFooter, type TableFooterBlock, TableHeader, type TableHeaderBlock, TableHeaderCell, type TableHeaderCellBlock, TableRow, type TableRowBlock, Underline, Variable };
|
|
508
|
+
export { Anchor, type AnchorBlock, type Block, type BlockRenderer, Code, type CodeBlock, Component, type ComponentBlock, type DecoratorType, Delete, Divider, type DividerBlock, Emphasis, Fragment, type FragmentBlock, Heading, type HeadingBlock, Image, type ImageBlock, InlineCode, InlineEntry, type InlineEntryBlock, Insert, Keyboard, LineBreak, Link, type LinkBlock, List, type ListBlock, ListItem, type ListItemBlock, Mark, Panel, type PanelBlock, Paragraph, type ParagraphBlock, Quote, type QuoteBlock, type RenderBlockProps, type RenderBlockPropsWithChildren, RenderChildren, RenderContextProvider, type RenderDecoratorProps, type RenderDecoratorPropsWithChildren, Renderer, RendererContext, Strikethrough, Strong, Subscript, Superscript, Table, type TableBlock, TableBody, type TableBodyBlock, TableCaption, type TableCaptionBlock, TableCell, type TableCellBlock, TableFooter, type TableFooterBlock, TableHeader, type TableHeaderBlock, TableHeaderCell, type TableHeaderCellBlock, TableRow, type TableRowBlock, Underline, Variable };
|
package/dist/canvas-react.d.ts
CHANGED
|
@@ -352,6 +352,7 @@ declare const RendererContext: React.Context<RendererContextValue>;
|
|
|
352
352
|
*
|
|
353
353
|
*/
|
|
354
354
|
declare function RenderContextProvider(props: RendererContextProviderProps): React.JSX.Element;
|
|
355
|
+
declare function RenderChildren(props: RenderBlockProps<Block>): React.JSX.Element;
|
|
355
356
|
type Renderer<TProps> = FunctionComponent<TProps> | ClassType<TProps, Component$1<TProps>, ComponentClass<TProps>>;
|
|
356
357
|
/**
|
|
357
358
|
* The default render method for processing Canvas data
|
|
@@ -504,4 +505,4 @@ declare namespace Variable {
|
|
|
504
505
|
var Children: typeof DecoratorChildren;
|
|
505
506
|
}
|
|
506
507
|
|
|
507
|
-
export { Anchor, type AnchorBlock, type Block, type BlockRenderer, Code, type CodeBlock, Component, type ComponentBlock, type DecoratorType, Delete, Divider, type DividerBlock, Emphasis, Fragment, type FragmentBlock, Heading, type HeadingBlock, Image, type ImageBlock, InlineCode, InlineEntry, type InlineEntryBlock, Insert, Keyboard, LineBreak, Link, type LinkBlock, List, type ListBlock, ListItem, type ListItemBlock, Mark, Panel, type PanelBlock, Paragraph, type ParagraphBlock, Quote, type QuoteBlock, type RenderBlockProps, type RenderBlockPropsWithChildren, RenderContextProvider, type RenderDecoratorProps, type RenderDecoratorPropsWithChildren, Renderer, RendererContext, Strikethrough, Strong, Subscript, Superscript, Table, type TableBlock, TableBody, type TableBodyBlock, TableCaption, type TableCaptionBlock, TableCell, type TableCellBlock, TableFooter, type TableFooterBlock, TableHeader, type TableHeaderBlock, TableHeaderCell, type TableHeaderCellBlock, TableRow, type TableRowBlock, Underline, Variable };
|
|
508
|
+
export { Anchor, type AnchorBlock, type Block, type BlockRenderer, Code, type CodeBlock, Component, type ComponentBlock, type DecoratorType, Delete, Divider, type DividerBlock, Emphasis, Fragment, type FragmentBlock, Heading, type HeadingBlock, Image, type ImageBlock, InlineCode, InlineEntry, type InlineEntryBlock, Insert, Keyboard, LineBreak, Link, type LinkBlock, List, type ListBlock, ListItem, type ListItemBlock, Mark, Panel, type PanelBlock, Paragraph, type ParagraphBlock, Quote, type QuoteBlock, type RenderBlockProps, type RenderBlockPropsWithChildren, RenderChildren, RenderContextProvider, type RenderDecoratorProps, type RenderDecoratorPropsWithChildren, Renderer, RendererContext, Strikethrough, Strong, Subscript, Superscript, Table, type TableBlock, TableBody, type TableBodyBlock, TableCaption, type TableCaptionBlock, TableCell, type TableCellBlock, TableFooter, type TableFooterBlock, TableHeader, type TableHeaderBlock, TableHeaderCell, type TableHeaderCellBlock, TableRow, type TableRowBlock, Underline, Variable };
|
package/dist/canvas-react.js
CHANGED
|
@@ -3,8 +3,34 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __objRest = (source, exclude) => {
|
|
23
|
+
var target = {};
|
|
24
|
+
for (var prop in source)
|
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
+
target[prop] = source[prop];
|
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
8
34
|
var __export = (target, all) => {
|
|
9
35
|
for (var name in all)
|
|
10
36
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -51,6 +77,7 @@ __export(src_exports, {
|
|
|
51
77
|
Panel: () => Panel,
|
|
52
78
|
Paragraph: () => Paragraph,
|
|
53
79
|
Quote: () => Quote,
|
|
80
|
+
RenderChildren: () => RenderChildren,
|
|
54
81
|
RenderContextProvider: () => RenderContextProvider,
|
|
55
82
|
Renderer: () => Renderer,
|
|
56
83
|
RendererContext: () => RendererContext,
|
|
@@ -78,14 +105,14 @@ function RenderContextProvider(props) {
|
|
|
78
105
|
const overrideBlocks = props.blocks;
|
|
79
106
|
const blocks = Object.keys(BLOCK_RENDERERS).reduce((prev, type) => {
|
|
80
107
|
const blockType = type;
|
|
81
|
-
const renderer = overrideBlocks
|
|
108
|
+
const renderer = (overrideBlocks == null ? void 0 : overrideBlocks[blockType]) || BLOCK_RENDERERS[blockType];
|
|
82
109
|
prev[blockType] = renderer;
|
|
83
110
|
return prev;
|
|
84
111
|
}, {});
|
|
85
112
|
const overrideDecorators = props.decorators;
|
|
86
113
|
const decorators = Object.keys(DECORATOR_RENDERERS).reduce((prev, type) => {
|
|
87
114
|
const decoratorType = type;
|
|
88
|
-
prev[decoratorType] = overrideDecorators
|
|
115
|
+
prev[decoratorType] = (overrideDecorators == null ? void 0 : overrideDecorators[decoratorType]) || DECORATOR_RENDERERS[decoratorType];
|
|
89
116
|
return prev;
|
|
90
117
|
}, {});
|
|
91
118
|
const value = { blocks, decorators, components: props.components };
|
|
@@ -115,8 +142,9 @@ function RenderContents(props) {
|
|
|
115
142
|
return props.contents ? props.contents : props.fallback;
|
|
116
143
|
}
|
|
117
144
|
function RenderChildren(props) {
|
|
118
|
-
|
|
119
|
-
const
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const isArray = Array.isArray((_a = props.block) == null ? void 0 : _a.value);
|
|
147
|
+
const isString = typeof ((_b = props.block) == null ? void 0 : _b.value) === "string";
|
|
120
148
|
const render = () => {
|
|
121
149
|
if (isArray) {
|
|
122
150
|
return /* @__PURE__ */ import_react.default.createElement(RenderBlocks, { blocks: props.block.value });
|
|
@@ -135,13 +163,12 @@ function Renderer(props) {
|
|
|
135
163
|
return /* @__PURE__ */ import_react.default.createElement(RenderBlocks, { blocks: props.data });
|
|
136
164
|
}
|
|
137
165
|
function getAttributes(props, extra = {}) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
attributes =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
166
|
+
var _c;
|
|
167
|
+
const _a = props, { block } = _a, rest = __objRest(_a, ["block"]);
|
|
168
|
+
let _b = rest, { children, decorator, otherDecorators } = _b, attributes = __objRest(_b, ["children", "decorator", "otherDecorators"]);
|
|
169
|
+
attributes = __spreadValues(__spreadValues({
|
|
170
|
+
id: (_c = block == null ? void 0 : block.properties) == null ? void 0 : _c.id
|
|
171
|
+
}, extra), attributes);
|
|
145
172
|
return attributes;
|
|
146
173
|
}
|
|
147
174
|
function WithCaption(props) {
|
|
@@ -159,71 +186,78 @@ function EmptyChildrenFactory() {
|
|
|
159
186
|
}
|
|
160
187
|
function Anchor(props) {
|
|
161
188
|
const attributes = getAttributes(props);
|
|
162
|
-
return /* @__PURE__ */ import_react.default.createElement("a", {
|
|
189
|
+
return /* @__PURE__ */ import_react.default.createElement("a", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Anchor.Children, { block: props.block }) }));
|
|
163
190
|
}
|
|
164
191
|
Anchor.Children = RenderBlockChildrenFactory();
|
|
165
192
|
function Code(props) {
|
|
193
|
+
var _a, _b, _c, _d;
|
|
166
194
|
const attributes = getAttributes(props, {
|
|
167
|
-
"data-language": props.block
|
|
195
|
+
"data-language": (_b = (_a = props.block) == null ? void 0 : _a.value) == null ? void 0 : _b.language
|
|
168
196
|
});
|
|
169
197
|
const codeAttributes = getAttributes(props, {
|
|
170
|
-
className: `language-${props.block
|
|
198
|
+
className: `language-${(_d = (_c = props.block) == null ? void 0 : _c.value) == null ? void 0 : _d.language}`
|
|
171
199
|
});
|
|
172
|
-
return /* @__PURE__ */ import_react.default.createElement("pre", {
|
|
200
|
+
return /* @__PURE__ */ import_react.default.createElement("pre", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement("code", __spreadValues({}, codeAttributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Code.Children, { block: props.block }) })));
|
|
173
201
|
}
|
|
174
202
|
Code.Children = function(props) {
|
|
175
|
-
|
|
203
|
+
var _a, _b;
|
|
204
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, (_b = (_a = props.block) == null ? void 0 : _a.value) == null ? void 0 : _b.code);
|
|
176
205
|
};
|
|
177
206
|
function CodeWithCaption(props) {
|
|
178
|
-
|
|
207
|
+
var _a, _b;
|
|
208
|
+
return /* @__PURE__ */ import_react.default.createElement(WithCaption, { caption: (_b = (_a = props.block) == null ? void 0 : _a.value) == null ? void 0 : _b.caption }, /* @__PURE__ */ import_react.default.createElement(Code, __spreadValues({}, props)));
|
|
179
209
|
}
|
|
180
210
|
function Component(props) {
|
|
181
|
-
|
|
211
|
+
var _a, _b;
|
|
212
|
+
const component = (_a = props == null ? void 0 : props.block.properties) == null ? void 0 : _a.component;
|
|
182
213
|
const components = useComponents();
|
|
183
|
-
const ComponentElement = !!component ? components
|
|
214
|
+
const ComponentElement = !!component ? components == null ? void 0 : components[component] : void 0;
|
|
184
215
|
const value = props.block.value ? JSON.stringify(props.block.value) : "";
|
|
185
216
|
const attributes = getAttributes(props, {
|
|
186
217
|
className: "component",
|
|
187
|
-
"data-component": props.block.properties
|
|
218
|
+
"data-component": (_b = props.block.properties) == null ? void 0 : _b.component,
|
|
188
219
|
"data-component-value": value
|
|
189
220
|
});
|
|
190
|
-
return !!ComponentElement ? /* @__PURE__ */ import_react.default.createElement(ComponentElement, {
|
|
221
|
+
return !!ComponentElement ? /* @__PURE__ */ import_react.default.createElement(ComponentElement, __spreadValues({}, props)) : /* @__PURE__ */ import_react.default.createElement("div", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Component.Children, { block: props.block }) }));
|
|
191
222
|
}
|
|
192
223
|
Component.Children = function(props) {
|
|
193
|
-
|
|
224
|
+
var _a, _b;
|
|
225
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "Component: ", (_b = (_a = props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.component);
|
|
194
226
|
};
|
|
195
227
|
function Divider(props) {
|
|
196
228
|
const attributes = getAttributes(props);
|
|
197
|
-
return /* @__PURE__ */ import_react.default.createElement("hr", {
|
|
229
|
+
return /* @__PURE__ */ import_react.default.createElement("hr", __spreadValues({}, attributes));
|
|
198
230
|
}
|
|
199
231
|
Divider.Children = EmptyChildrenFactory();
|
|
200
232
|
function Fragment(props) {
|
|
201
|
-
|
|
202
|
-
const
|
|
233
|
+
var _a, _b, _c, _d, _e;
|
|
234
|
+
const hasDecorators = !!((_c = (_b = (_a = props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.decorators) == null ? void 0 : _c.length);
|
|
235
|
+
const decorators = (_e = (_d = props.block) == null ? void 0 : _d.properties) == null ? void 0 : _e.decorators;
|
|
203
236
|
return hasDecorators ? /* @__PURE__ */ import_react.default.createElement(Decorators, { block: props.block, decorators }) : /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Fragment.Children, { block: props.block }) });
|
|
204
237
|
}
|
|
205
238
|
Fragment.Children = RenderBlockChildrenFactory();
|
|
206
239
|
function Heading(props) {
|
|
207
240
|
const attributes = getAttributes(props);
|
|
208
241
|
const render = () => {
|
|
209
|
-
|
|
242
|
+
var _a, _b;
|
|
243
|
+
switch ((_b = (_a = props == null ? void 0 : props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.level) {
|
|
210
244
|
case 2: {
|
|
211
|
-
return /* @__PURE__ */ import_react.default.createElement("h2", {
|
|
245
|
+
return /* @__PURE__ */ import_react.default.createElement("h2", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Heading.Children, { block: props.block }) }));
|
|
212
246
|
}
|
|
213
247
|
case 3: {
|
|
214
|
-
return /* @__PURE__ */ import_react.default.createElement("h3", {
|
|
248
|
+
return /* @__PURE__ */ import_react.default.createElement("h3", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Heading.Children, { block: props.block }) }));
|
|
215
249
|
}
|
|
216
250
|
case 4: {
|
|
217
|
-
return /* @__PURE__ */ import_react.default.createElement("h4", {
|
|
251
|
+
return /* @__PURE__ */ import_react.default.createElement("h4", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Heading.Children, { block: props.block }) }));
|
|
218
252
|
}
|
|
219
253
|
case 5: {
|
|
220
|
-
return /* @__PURE__ */ import_react.default.createElement("h5", {
|
|
254
|
+
return /* @__PURE__ */ import_react.default.createElement("h5", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Heading.Children, { block: props.block }) }));
|
|
221
255
|
}
|
|
222
256
|
case 6: {
|
|
223
|
-
return /* @__PURE__ */ import_react.default.createElement("h6", {
|
|
257
|
+
return /* @__PURE__ */ import_react.default.createElement("h6", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Heading.Children, { block: props.block }) }));
|
|
224
258
|
}
|
|
225
259
|
default: {
|
|
226
|
-
return /* @__PURE__ */ import_react.default.createElement("h1", {
|
|
260
|
+
return /* @__PURE__ */ import_react.default.createElement("h1", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Heading.Children, { block: props.block }) }));
|
|
227
261
|
}
|
|
228
262
|
}
|
|
229
263
|
};
|
|
@@ -231,116 +265,126 @@ function Heading(props) {
|
|
|
231
265
|
}
|
|
232
266
|
Heading.Children = RenderBlockChildrenFactory();
|
|
233
267
|
function Image(props) {
|
|
234
|
-
|
|
268
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
269
|
+
const src = (_d = (_c = (_b = (_a = props.block) == null ? void 0 : _a.value) == null ? void 0 : _b.asset) == null ? void 0 : _c.sys) == null ? void 0 : _d.uri;
|
|
235
270
|
const attributes = getAttributes(props, {
|
|
236
271
|
src,
|
|
237
|
-
alt: props.block
|
|
238
|
-
title: props
|
|
272
|
+
alt: (_f = (_e = props.block) == null ? void 0 : _e.value) == null ? void 0 : _f.altText,
|
|
273
|
+
title: (_h = (_g = props == null ? void 0 : props.block) == null ? void 0 : _g.value) == null ? void 0 : _h.caption
|
|
239
274
|
});
|
|
240
|
-
return /* @__PURE__ */ import_react.default.createElement("img", {
|
|
275
|
+
return /* @__PURE__ */ import_react.default.createElement("img", __spreadValues({}, attributes));
|
|
241
276
|
}
|
|
242
277
|
Image.Children = EmptyChildrenFactory();
|
|
243
278
|
function ImageWithCaption(props) {
|
|
244
|
-
|
|
279
|
+
var _a, _b;
|
|
280
|
+
return /* @__PURE__ */ import_react.default.createElement(WithCaption, { caption: (_b = (_a = props.block) == null ? void 0 : _a.value) == null ? void 0 : _b.caption }, /* @__PURE__ */ import_react.default.createElement(Image, __spreadValues({}, props)));
|
|
245
281
|
}
|
|
246
282
|
function InlineEntry(props) {
|
|
247
|
-
|
|
283
|
+
var _a, _b, _c;
|
|
284
|
+
const href = (_c = (_b = (_a = props == null ? void 0 : props.block) == null ? void 0 : _a.value) == null ? void 0 : _b.sys) == null ? void 0 : _c.uri;
|
|
248
285
|
const attributes = getAttributes(props, {
|
|
249
286
|
href
|
|
250
287
|
});
|
|
251
|
-
return !!attributes.href ? /* @__PURE__ */ import_react.default.createElement("a", {
|
|
288
|
+
return !!attributes.href ? /* @__PURE__ */ import_react.default.createElement("a", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(InlineEntry.Children, { block: props.block }) })) : /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(InlineEntry.Children, { block: props.block }) });
|
|
252
289
|
}
|
|
253
290
|
InlineEntry.Children = function(props) {
|
|
254
|
-
|
|
291
|
+
var _a, _b;
|
|
292
|
+
const entryTitle = ((_b = (_a = props == null ? void 0 : props.block) == null ? void 0 : _a.value) == null ? void 0 : _b.entryTitle) || "";
|
|
255
293
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, entryTitle);
|
|
256
294
|
};
|
|
257
295
|
function Link(props) {
|
|
258
|
-
|
|
296
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
297
|
+
const linkValue = (_b = (_a = props == null ? void 0 : props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.link;
|
|
259
298
|
const attributes = getAttributes(props, {
|
|
260
|
-
href: linkValue
|
|
261
|
-
target: props
|
|
262
|
-
rel: props
|
|
299
|
+
href: (_c = linkValue == null ? void 0 : linkValue.sys) == null ? void 0 : _c.uri,
|
|
300
|
+
target: ((_e = (_d = props == null ? void 0 : props.block) == null ? void 0 : _d.properties) == null ? void 0 : _e.newTab) ? "_blank" : null,
|
|
301
|
+
rel: ((_g = (_f = props == null ? void 0 : props.block) == null ? void 0 : _f.properties) == null ? void 0 : _g.newTab) ? "noopener noreferrer" : null
|
|
263
302
|
});
|
|
264
|
-
return !!attributes.href ? /* @__PURE__ */ import_react.default.createElement("a", {
|
|
303
|
+
return !!attributes.href ? /* @__PURE__ */ import_react.default.createElement("a", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Link.Children, { block: props.block }) })) : /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Link.Children, { block: props.block }) });
|
|
265
304
|
}
|
|
266
305
|
Link.Children = RenderBlockChildrenFactory();
|
|
267
306
|
function List(props) {
|
|
268
|
-
|
|
307
|
+
var _a, _b, _c, _d;
|
|
308
|
+
const isOrdered = ((_b = (_a = props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.listType) === "ordered";
|
|
269
309
|
const attributes = getAttributes(props, {
|
|
270
|
-
start: isOrdered ? props.block
|
|
310
|
+
start: isOrdered ? (_d = (_c = props.block) == null ? void 0 : _c.properties) == null ? void 0 : _d.start : null
|
|
271
311
|
});
|
|
272
|
-
return isOrdered ? /* @__PURE__ */ import_react.default.createElement("ol", {
|
|
312
|
+
return isOrdered ? /* @__PURE__ */ import_react.default.createElement("ol", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(List.Children, { block: props.block }) })) : /* @__PURE__ */ import_react.default.createElement("ul", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(List.Children, { block: props.block }) }));
|
|
273
313
|
}
|
|
274
314
|
List.Children = RenderBlockChildrenFactory();
|
|
275
315
|
function ListItem(props) {
|
|
276
316
|
const attributes = getAttributes(props);
|
|
277
|
-
return /* @__PURE__ */ import_react.default.createElement("li", {
|
|
317
|
+
return /* @__PURE__ */ import_react.default.createElement("li", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(ListItem.Children, { block: props.block }) }));
|
|
278
318
|
}
|
|
279
319
|
ListItem.Children = RenderBlockChildrenFactory();
|
|
280
320
|
function Panel(props) {
|
|
321
|
+
var _a, _b;
|
|
281
322
|
const attributes = getAttributes(props, {
|
|
282
|
-
className: ["panel", props.block
|
|
323
|
+
className: ["panel", ((_b = (_a = props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.panelType) || "info"].join(" ")
|
|
283
324
|
});
|
|
284
|
-
return /* @__PURE__ */ import_react.default.createElement("aside", {
|
|
325
|
+
return /* @__PURE__ */ import_react.default.createElement("aside", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Panel.Children, { block: props.block }) }));
|
|
285
326
|
}
|
|
286
327
|
Panel.Children = RenderBlockChildrenFactory();
|
|
287
328
|
function Paragraph(props) {
|
|
329
|
+
var _a, _b;
|
|
288
330
|
const attributes = getAttributes(props, {
|
|
289
|
-
className: props.block
|
|
331
|
+
className: (_b = (_a = props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.paragraphType
|
|
290
332
|
});
|
|
291
|
-
return /* @__PURE__ */ import_react.default.createElement("p", {
|
|
333
|
+
return /* @__PURE__ */ import_react.default.createElement("p", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Paragraph.Children, { block: props.block }) }));
|
|
292
334
|
}
|
|
293
335
|
Paragraph.Children = RenderBlockChildrenFactory();
|
|
294
336
|
function Quote(props) {
|
|
337
|
+
var _a, _b;
|
|
295
338
|
const attributes = getAttributes(props, {
|
|
296
|
-
"cite": props.block
|
|
339
|
+
"cite": (_b = (_a = props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.url
|
|
297
340
|
});
|
|
298
|
-
return /* @__PURE__ */ import_react.default.createElement("blockquote", {
|
|
341
|
+
return /* @__PURE__ */ import_react.default.createElement("blockquote", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Quote.Children, { block: props.block }) }));
|
|
299
342
|
}
|
|
300
343
|
Quote.Children = function(props) {
|
|
301
|
-
|
|
302
|
-
const
|
|
344
|
+
var _a, _b, _c, _d;
|
|
345
|
+
const source = (_b = (_a = props.block) == null ? void 0 : _a.properties) == null ? void 0 : _b.source;
|
|
346
|
+
const citation = (_d = (_c = props.block) == null ? void 0 : _c.properties) == null ? void 0 : _d.citation;
|
|
303
347
|
const hasChildren = !!source || !!citation;
|
|
304
348
|
return hasChildren ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("p", null, /* @__PURE__ */ import_react.default.createElement(RenderChildren, { block: props.block })), /* @__PURE__ */ import_react.default.createElement("footer", null, source, " ", !!citation ? /* @__PURE__ */ import_react.default.createElement("cite", null, citation) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null))) : /* @__PURE__ */ import_react.default.createElement(RenderChildren, { block: props.block });
|
|
305
349
|
};
|
|
306
350
|
function Table(props) {
|
|
307
351
|
const attributes = getAttributes(props);
|
|
308
|
-
return /* @__PURE__ */ import_react.default.createElement("table", {
|
|
352
|
+
return /* @__PURE__ */ import_react.default.createElement("table", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Table.Children, { block: props.block }) }));
|
|
309
353
|
}
|
|
310
354
|
Table.Children = RenderBlockChildrenFactory();
|
|
311
355
|
function TableBody(props) {
|
|
312
356
|
const attributes = getAttributes(props);
|
|
313
|
-
return /* @__PURE__ */ import_react.default.createElement("tbody", {
|
|
357
|
+
return /* @__PURE__ */ import_react.default.createElement("tbody", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(TableBody.Children, { block: props.block }) }));
|
|
314
358
|
}
|
|
315
359
|
TableBody.Children = RenderBlockChildrenFactory();
|
|
316
360
|
function TableCaption(props) {
|
|
317
361
|
const attributes = getAttributes(props);
|
|
318
|
-
return /* @__PURE__ */ import_react.default.createElement("caption", {
|
|
362
|
+
return /* @__PURE__ */ import_react.default.createElement("caption", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(TableCaption.Children, { block: props.block }) }));
|
|
319
363
|
}
|
|
320
364
|
TableCaption.Children = RenderBlockChildrenFactory();
|
|
321
365
|
function TableCell(props) {
|
|
322
366
|
const attributes = getAttributes(props);
|
|
323
|
-
return /* @__PURE__ */ import_react.default.createElement("td", {
|
|
367
|
+
return /* @__PURE__ */ import_react.default.createElement("td", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(TableCell.Children, { block: props.block }) }));
|
|
324
368
|
}
|
|
325
369
|
TableCell.Children = RenderBlockChildrenFactory();
|
|
326
370
|
function TableFooter(props) {
|
|
327
371
|
const attributes = getAttributes(props);
|
|
328
|
-
return /* @__PURE__ */ import_react.default.createElement("tfoot", {
|
|
372
|
+
return /* @__PURE__ */ import_react.default.createElement("tfoot", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(TableFooter.Children, { block: props.block }) }));
|
|
329
373
|
}
|
|
330
374
|
TableFooter.Children = RenderBlockChildrenFactory();
|
|
331
375
|
function TableHeader(props) {
|
|
332
376
|
const attributes = getAttributes(props);
|
|
333
|
-
return /* @__PURE__ */ import_react.default.createElement("thead", {
|
|
377
|
+
return /* @__PURE__ */ import_react.default.createElement("thead", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(TableHeader.Children, { block: props.block }) }));
|
|
334
378
|
}
|
|
335
379
|
TableHeader.Children = RenderBlockChildrenFactory();
|
|
336
380
|
function TableHeaderCell(props) {
|
|
337
381
|
const attributes = getAttributes(props);
|
|
338
|
-
return /* @__PURE__ */ import_react.default.createElement("th", {
|
|
382
|
+
return /* @__PURE__ */ import_react.default.createElement("th", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(TableHeaderCell.Children, { block: props.block }) }));
|
|
339
383
|
}
|
|
340
384
|
TableHeaderCell.Children = RenderBlockChildrenFactory();
|
|
341
385
|
function TableRow(props) {
|
|
342
386
|
const attributes = getAttributes(props);
|
|
343
|
-
return /* @__PURE__ */ import_react.default.createElement("tr", {
|
|
387
|
+
return /* @__PURE__ */ import_react.default.createElement("tr", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(TableRow.Children, { block: props.block }) }));
|
|
344
388
|
}
|
|
345
389
|
TableRow.Children = RenderBlockChildrenFactory();
|
|
346
390
|
function Decorators(props) {
|
|
@@ -364,69 +408,69 @@ function DecoratorChildren(props) {
|
|
|
364
408
|
}
|
|
365
409
|
function InlineCode(props) {
|
|
366
410
|
const attributes = getAttributes(props);
|
|
367
|
-
return /* @__PURE__ */ import_react.default.createElement("code", {
|
|
411
|
+
return /* @__PURE__ */ import_react.default.createElement("code", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(InlineCode.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
368
412
|
}
|
|
369
413
|
InlineCode.Children = DecoratorChildren;
|
|
370
414
|
function Delete(props) {
|
|
371
415
|
const attributes = getAttributes(props);
|
|
372
|
-
return /* @__PURE__ */ import_react.default.createElement("del", {
|
|
416
|
+
return /* @__PURE__ */ import_react.default.createElement("del", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Delete.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
373
417
|
}
|
|
374
418
|
Delete.Children = DecoratorChildren;
|
|
375
419
|
function Emphasis(props) {
|
|
376
420
|
const attributes = getAttributes(props);
|
|
377
|
-
return /* @__PURE__ */ import_react.default.createElement("em", {
|
|
421
|
+
return /* @__PURE__ */ import_react.default.createElement("em", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Emphasis.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
378
422
|
}
|
|
379
423
|
Emphasis.Children = DecoratorChildren;
|
|
380
424
|
function Insert(props) {
|
|
381
425
|
const attributes = getAttributes(props);
|
|
382
|
-
return /* @__PURE__ */ import_react.default.createElement("ins", {
|
|
426
|
+
return /* @__PURE__ */ import_react.default.createElement("ins", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Insert.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
383
427
|
}
|
|
384
428
|
Insert.Children = DecoratorChildren;
|
|
385
429
|
function Keyboard(props) {
|
|
386
430
|
const attributes = getAttributes(props);
|
|
387
|
-
return /* @__PURE__ */ import_react.default.createElement("kbd", {
|
|
431
|
+
return /* @__PURE__ */ import_react.default.createElement("kbd", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Keyboard.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
388
432
|
}
|
|
389
433
|
Keyboard.Children = DecoratorChildren;
|
|
390
434
|
function LineBreak(props) {
|
|
391
435
|
const attributes = getAttributes(props);
|
|
392
|
-
return /* @__PURE__ */ import_react.default.createElement("br", {
|
|
436
|
+
return /* @__PURE__ */ import_react.default.createElement("br", __spreadValues({}, attributes));
|
|
393
437
|
}
|
|
394
438
|
LineBreak.Children = function(props) {
|
|
395
439
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null);
|
|
396
440
|
};
|
|
397
441
|
function Mark(props) {
|
|
398
442
|
const attributes = getAttributes(props);
|
|
399
|
-
return /* @__PURE__ */ import_react.default.createElement("mark", {
|
|
443
|
+
return /* @__PURE__ */ import_react.default.createElement("mark", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Mark.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
400
444
|
}
|
|
401
445
|
Mark.Children = DecoratorChildren;
|
|
402
446
|
function Strong(props) {
|
|
403
447
|
const attributes = getAttributes(props);
|
|
404
|
-
return /* @__PURE__ */ import_react.default.createElement("strong", {
|
|
448
|
+
return /* @__PURE__ */ import_react.default.createElement("strong", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Strong.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
405
449
|
}
|
|
406
450
|
Strong.Children = DecoratorChildren;
|
|
407
451
|
function Strikethrough(props) {
|
|
408
452
|
const attributes = getAttributes(props);
|
|
409
|
-
return /* @__PURE__ */ import_react.default.createElement("s", {
|
|
453
|
+
return /* @__PURE__ */ import_react.default.createElement("s", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Strikethrough.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
410
454
|
}
|
|
411
455
|
Strikethrough.Children = DecoratorChildren;
|
|
412
456
|
function Subscript(props) {
|
|
413
457
|
const attributes = getAttributes(props);
|
|
414
|
-
return /* @__PURE__ */ import_react.default.createElement("sub", {
|
|
458
|
+
return /* @__PURE__ */ import_react.default.createElement("sub", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Subscript.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
415
459
|
}
|
|
416
460
|
Subscript.Children = DecoratorChildren;
|
|
417
461
|
function Superscript(props) {
|
|
418
462
|
const attributes = getAttributes(props);
|
|
419
|
-
return /* @__PURE__ */ import_react.default.createElement("sup", {
|
|
463
|
+
return /* @__PURE__ */ import_react.default.createElement("sup", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Superscript.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
420
464
|
}
|
|
421
465
|
Superscript.Children = DecoratorChildren;
|
|
422
466
|
function Underline(props) {
|
|
423
467
|
const attributes = getAttributes(props);
|
|
424
|
-
return /* @__PURE__ */ import_react.default.createElement("u", {
|
|
468
|
+
return /* @__PURE__ */ import_react.default.createElement("u", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Underline.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
425
469
|
}
|
|
426
470
|
Underline.Children = DecoratorChildren;
|
|
427
471
|
function Variable(props) {
|
|
428
472
|
const attributes = getAttributes(props);
|
|
429
|
-
return /* @__PURE__ */ import_react.default.createElement("var", {
|
|
473
|
+
return /* @__PURE__ */ import_react.default.createElement("var", __spreadValues({}, attributes), /* @__PURE__ */ import_react.default.createElement(RenderContents, { contents: props.children, fallback: /* @__PURE__ */ import_react.default.createElement(Variable.Children, { block: props.block, decorator: props.decorator, otherDecorators: props.otherDecorators }) }));
|
|
430
474
|
}
|
|
431
475
|
Variable.Children = DecoratorChildren;
|
|
432
476
|
var BLOCK_RENDERERS = {
|
|
@@ -491,6 +535,7 @@ var DECORATOR_RENDERERS = {
|
|
|
491
535
|
Panel,
|
|
492
536
|
Paragraph,
|
|
493
537
|
Quote,
|
|
538
|
+
RenderChildren,
|
|
494
539
|
RenderContextProvider,
|
|
495
540
|
Renderer,
|
|
496
541
|
RendererContext,
|