@contentful/rich-text-react-renderer
Advanced tools
Comparing version 15.19.6 to 15.20.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
@@ -24,3 +19,5 @@ /****************************************************************************** | ||
***************************************************************************** */ | ||
/* global Reflect, Promise, SuppressedError, Symbol */ | ||
var __assign = function() { | ||
@@ -37,3 +34,3 @@ __assign = Object.assign || function __assign(t) { | ||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
@@ -45,13 +42,8 @@ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
var dist = {}; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var blocks = {}; | ||
var blocks = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BLOCKS = void 0; | ||
Object.defineProperty(blocks, "__esModule", { value: true }); | ||
blocks.BLOCKS = void 0; | ||
/** | ||
@@ -82,12 +74,8 @@ * Map of all Contentful block types. Blocks contain inline or block nodes. | ||
BLOCKS["TABLE_HEADER_CELL"] = "table-header-cell"; | ||
})(BLOCKS || (exports.BLOCKS = BLOCKS = {})); | ||
})(BLOCKS || (blocks.BLOCKS = BLOCKS = {})); | ||
}); | ||
var inlines = {}; | ||
unwrapExports(blocks); | ||
var blocks_1 = blocks.BLOCKS; | ||
var inlines = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.INLINES = void 0; | ||
Object.defineProperty(inlines, "__esModule", { value: true }); | ||
inlines.INLINES = void 0; | ||
/** | ||
@@ -104,12 +92,8 @@ * Map of all Contentful inline types. Inline contain inline or text nodes. | ||
INLINES["EMBEDDED_RESOURCE"] = "embedded-resource-inline"; | ||
})(INLINES || (exports.INLINES = INLINES = {})); | ||
})(INLINES || (inlines.INLINES = INLINES = {})); | ||
}); | ||
var marks = {}; | ||
unwrapExports(inlines); | ||
var inlines_1 = inlines.INLINES; | ||
var marks = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MARKS = void 0; | ||
Object.defineProperty(marks, "__esModule", { value: true }); | ||
marks.MARKS = void 0; | ||
/** | ||
@@ -126,171 +110,152 @@ * Map of all Contentful marks. | ||
MARKS["SUBSCRIPT"] = "subscript"; | ||
})(MARKS || (exports.MARKS = MARKS = {})); | ||
})(MARKS || (marks.MARKS = MARKS = {})); | ||
}); | ||
var schemaConstraints = {}; | ||
unwrapExports(marks); | ||
var marks_1 = marks.MARKS; | ||
(function (exports) { | ||
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.V1_MARKS = exports.V1_NODE_TYPES = exports.TEXT_CONTAINERS = exports.HEADINGS = exports.CONTAINERS = exports.VOID_BLOCKS = exports.TABLE_BLOCKS = exports.LIST_ITEM_BLOCKS = exports.TOP_LEVEL_BLOCKS = void 0; | ||
var blocks_1 = blocks; | ||
var inlines_1 = inlines; | ||
var marks_1 = marks; | ||
/** | ||
* Array of all top level block types. | ||
* Only these block types can be the direct children of the document. | ||
*/ | ||
exports.TOP_LEVEL_BLOCKS = [ | ||
blocks_1.BLOCKS.PARAGRAPH, | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
blocks_1.BLOCKS.OL_LIST, | ||
blocks_1.BLOCKS.UL_LIST, | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.QUOTE, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
blocks_1.BLOCKS.EMBEDDED_RESOURCE, | ||
blocks_1.BLOCKS.TABLE, | ||
]; | ||
/** | ||
* Array of all allowed block types inside list items | ||
*/ | ||
exports.LIST_ITEM_BLOCKS = [ | ||
blocks_1.BLOCKS.PARAGRAPH, | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
blocks_1.BLOCKS.OL_LIST, | ||
blocks_1.BLOCKS.UL_LIST, | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.QUOTE, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
blocks_1.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
exports.TABLE_BLOCKS = [ | ||
blocks_1.BLOCKS.TABLE, | ||
blocks_1.BLOCKS.TABLE_ROW, | ||
blocks_1.BLOCKS.TABLE_CELL, | ||
blocks_1.BLOCKS.TABLE_HEADER_CELL, | ||
]; | ||
/** | ||
* Array of all void block types | ||
*/ | ||
exports.VOID_BLOCKS = [ | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
blocks_1.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
/** | ||
* Dictionary of all container block types, and the set block types they accept as children. | ||
* | ||
* Note: This does not include `[BLOCKS.DOCUMENT]: TOP_LEVEL_BLOCKS` | ||
*/ | ||
exports.CONTAINERS = (_a = {}, | ||
_a[blocks_1.BLOCKS.OL_LIST] = [blocks_1.BLOCKS.LIST_ITEM], | ||
_a[blocks_1.BLOCKS.UL_LIST] = [blocks_1.BLOCKS.LIST_ITEM], | ||
_a[blocks_1.BLOCKS.LIST_ITEM] = exports.LIST_ITEM_BLOCKS, | ||
_a[blocks_1.BLOCKS.QUOTE] = [blocks_1.BLOCKS.PARAGRAPH], | ||
_a[blocks_1.BLOCKS.TABLE] = [blocks_1.BLOCKS.TABLE_ROW], | ||
_a[blocks_1.BLOCKS.TABLE_ROW] = [blocks_1.BLOCKS.TABLE_CELL, blocks_1.BLOCKS.TABLE_HEADER_CELL], | ||
_a[blocks_1.BLOCKS.TABLE_CELL] = [blocks_1.BLOCKS.PARAGRAPH], | ||
_a[blocks_1.BLOCKS.TABLE_HEADER_CELL] = [blocks_1.BLOCKS.PARAGRAPH], | ||
_a); | ||
/** | ||
* Array of all heading levels | ||
*/ | ||
exports.HEADINGS = [ | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
]; | ||
/** | ||
* Array of all block types that may contain text and inline nodes. | ||
*/ | ||
exports.TEXT_CONTAINERS = __spreadArray([blocks_1.BLOCKS.PARAGRAPH], exports.HEADINGS, true); | ||
/** | ||
* Node types before `tables` release. | ||
*/ | ||
exports.V1_NODE_TYPES = [ | ||
blocks_1.BLOCKS.DOCUMENT, | ||
blocks_1.BLOCKS.PARAGRAPH, | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
blocks_1.BLOCKS.OL_LIST, | ||
blocks_1.BLOCKS.UL_LIST, | ||
blocks_1.BLOCKS.LIST_ITEM, | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.QUOTE, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
inlines_1.INLINES.HYPERLINK, | ||
inlines_1.INLINES.ENTRY_HYPERLINK, | ||
inlines_1.INLINES.ASSET_HYPERLINK, | ||
inlines_1.INLINES.EMBEDDED_ENTRY, | ||
'text', | ||
]; | ||
/** | ||
* Marks before `superscript` & `subscript` release. | ||
*/ | ||
exports.V1_MARKS = [marks_1.MARKS.BOLD, marks_1.MARKS.CODE, marks_1.MARKS.ITALIC, marks_1.MARKS.UNDERLINE]; | ||
} (schemaConstraints)); | ||
var schemaConstraints = createCommonjsModule(function (module, exports) { | ||
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.V1_MARKS = exports.V1_NODE_TYPES = exports.TEXT_CONTAINERS = exports.HEADINGS = exports.CONTAINERS = exports.VOID_BLOCKS = exports.TABLE_BLOCKS = exports.LIST_ITEM_BLOCKS = exports.TOP_LEVEL_BLOCKS = void 0; | ||
var types = {}; | ||
Object.defineProperty(types, "__esModule", { value: true }); | ||
var nodeTypes = {}; | ||
/** | ||
* Array of all top level block types. | ||
* Only these block types can be the direct children of the document. | ||
*/ | ||
exports.TOP_LEVEL_BLOCKS = [ | ||
blocks.BLOCKS.PARAGRAPH, | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
blocks.BLOCKS.OL_LIST, | ||
blocks.BLOCKS.UL_LIST, | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.QUOTE, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
blocks.BLOCKS.EMBEDDED_RESOURCE, | ||
blocks.BLOCKS.TABLE, | ||
]; | ||
/** | ||
* Array of all allowed block types inside list items | ||
*/ | ||
exports.LIST_ITEM_BLOCKS = [ | ||
blocks.BLOCKS.PARAGRAPH, | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
blocks.BLOCKS.OL_LIST, | ||
blocks.BLOCKS.UL_LIST, | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.QUOTE, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
blocks.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
exports.TABLE_BLOCKS = [ | ||
blocks.BLOCKS.TABLE, | ||
blocks.BLOCKS.TABLE_ROW, | ||
blocks.BLOCKS.TABLE_CELL, | ||
blocks.BLOCKS.TABLE_HEADER_CELL, | ||
]; | ||
/** | ||
* Array of all void block types | ||
*/ | ||
exports.VOID_BLOCKS = [ | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
blocks.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
/** | ||
* Dictionary of all container block types, and the set block types they accept as children. | ||
* | ||
* Note: This does not include `[BLOCKS.DOCUMENT]: TOP_LEVEL_BLOCKS` | ||
*/ | ||
exports.CONTAINERS = (_a = {}, | ||
_a[blocks.BLOCKS.OL_LIST] = [blocks.BLOCKS.LIST_ITEM], | ||
_a[blocks.BLOCKS.UL_LIST] = [blocks.BLOCKS.LIST_ITEM], | ||
_a[blocks.BLOCKS.LIST_ITEM] = exports.LIST_ITEM_BLOCKS, | ||
_a[blocks.BLOCKS.QUOTE] = [blocks.BLOCKS.PARAGRAPH], | ||
_a[blocks.BLOCKS.TABLE] = [blocks.BLOCKS.TABLE_ROW], | ||
_a[blocks.BLOCKS.TABLE_ROW] = [blocks.BLOCKS.TABLE_CELL, blocks.BLOCKS.TABLE_HEADER_CELL], | ||
_a[blocks.BLOCKS.TABLE_CELL] = [blocks.BLOCKS.PARAGRAPH], | ||
_a[blocks.BLOCKS.TABLE_HEADER_CELL] = [blocks.BLOCKS.PARAGRAPH], | ||
_a); | ||
/** | ||
* Array of all heading levels | ||
*/ | ||
exports.HEADINGS = [ | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
]; | ||
/** | ||
* Array of all block types that may contain text and inline nodes. | ||
*/ | ||
exports.TEXT_CONTAINERS = __spreadArray([blocks.BLOCKS.PARAGRAPH], exports.HEADINGS, true); | ||
/** | ||
* Node types before `tables` release. | ||
*/ | ||
exports.V1_NODE_TYPES = [ | ||
blocks.BLOCKS.DOCUMENT, | ||
blocks.BLOCKS.PARAGRAPH, | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
blocks.BLOCKS.OL_LIST, | ||
blocks.BLOCKS.UL_LIST, | ||
blocks.BLOCKS.LIST_ITEM, | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.QUOTE, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
inlines.INLINES.HYPERLINK, | ||
inlines.INLINES.ENTRY_HYPERLINK, | ||
inlines.INLINES.ASSET_HYPERLINK, | ||
inlines.INLINES.EMBEDDED_ENTRY, | ||
'text', | ||
]; | ||
/** | ||
* Marks before `superscript` & `subscript` release. | ||
*/ | ||
exports.V1_MARKS = [marks.MARKS.BOLD, marks.MARKS.CODE, marks.MARKS.ITALIC, marks.MARKS.UNDERLINE]; | ||
Object.defineProperty(nodeTypes, "__esModule", { value: true }); | ||
}); | ||
var emptyDocument = {}; | ||
unwrapExports(schemaConstraints); | ||
var schemaConstraints_1 = schemaConstraints.V1_MARKS; | ||
var schemaConstraints_2 = schemaConstraints.V1_NODE_TYPES; | ||
var schemaConstraints_3 = schemaConstraints.TEXT_CONTAINERS; | ||
var schemaConstraints_4 = schemaConstraints.HEADINGS; | ||
var schemaConstraints_5 = schemaConstraints.CONTAINERS; | ||
var schemaConstraints_6 = schemaConstraints.VOID_BLOCKS; | ||
var schemaConstraints_7 = schemaConstraints.TABLE_BLOCKS; | ||
var schemaConstraints_8 = schemaConstraints.LIST_ITEM_BLOCKS; | ||
var schemaConstraints_9 = schemaConstraints.TOP_LEVEL_BLOCKS; | ||
var types = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
}); | ||
unwrapExports(types); | ||
var nodeTypes = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
}); | ||
unwrapExports(nodeTypes); | ||
var emptyDocument = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EMPTY_DOCUMENT = void 0; | ||
Object.defineProperty(emptyDocument, "__esModule", { value: true }); | ||
emptyDocument.EMPTY_DOCUMENT = void 0; | ||
var blocks_1$1 = blocks; | ||
/** | ||
@@ -300,8 +265,8 @@ * A rich text document considered to be empty. | ||
*/ | ||
exports.EMPTY_DOCUMENT = { | ||
nodeType: blocks.BLOCKS.DOCUMENT, | ||
emptyDocument.EMPTY_DOCUMENT = { | ||
nodeType: blocks_1$1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: blocks.BLOCKS.PARAGRAPH, | ||
nodeType: blocks_1$1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
@@ -320,12 +285,8 @@ content: [ | ||
}); | ||
var helpers = {}; | ||
unwrapExports(emptyDocument); | ||
var emptyDocument_1 = emptyDocument.EMPTY_DOCUMENT; | ||
var helpers = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isText = exports.isBlock = exports.isInline = void 0; | ||
Object.defineProperty(helpers, "__esModule", { value: true }); | ||
helpers.isText = helpers.isBlock = helpers.isInline = void 0; | ||
var blocks_1 = blocks; | ||
var inlines_1 = inlines; | ||
/** | ||
@@ -348,5 +309,5 @@ * Tiny replacement for Object.values(object).includes(key) to | ||
function isInline(node) { | ||
return hasValue(inlines.INLINES, node.nodeType); | ||
return hasValue(inlines_1.INLINES, node.nodeType); | ||
} | ||
exports.isInline = isInline; | ||
helpers.isInline = isInline; | ||
/** | ||
@@ -356,5 +317,5 @@ * Checks if the node is an instance of Block. | ||
function isBlock(node) { | ||
return hasValue(blocks.BLOCKS, node.nodeType); | ||
return hasValue(blocks_1.BLOCKS, node.nodeType); | ||
} | ||
exports.isBlock = isBlock; | ||
helpers.isBlock = isBlock; | ||
/** | ||
@@ -366,63 +327,49 @@ * Checks if the node is an instance of Text. | ||
} | ||
exports.isText = isText; | ||
helpers.isText = isText; | ||
}); | ||
(function (exports) { | ||
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.helpers = exports.EMPTY_DOCUMENT = exports.MARKS = exports.INLINES = exports.BLOCKS = void 0; | ||
var blocks_1 = blocks; | ||
Object.defineProperty(exports, "BLOCKS", { enumerable: true, get: function () { return blocks_1.BLOCKS; } }); | ||
var inlines_1 = inlines; | ||
Object.defineProperty(exports, "INLINES", { enumerable: true, get: function () { return inlines_1.INLINES; } }); | ||
var marks_1 = marks; | ||
Object.defineProperty(exports, "MARKS", { enumerable: true, get: function () { return marks_1.MARKS; } }); | ||
__exportStar(schemaConstraints, exports); | ||
__exportStar(types, exports); | ||
__exportStar(nodeTypes, exports); | ||
var emptyDocument_1 = emptyDocument; | ||
Object.defineProperty(exports, "EMPTY_DOCUMENT", { enumerable: true, get: function () { return emptyDocument_1.EMPTY_DOCUMENT; } }); | ||
var helpers$1 = __importStar(helpers); | ||
exports.helpers = helpers$1; | ||
} (dist)); | ||
unwrapExports(helpers); | ||
var helpers_1 = helpers.isText; | ||
var helpers_2 = helpers.isBlock; | ||
var helpers_3 = helpers.isInline; | ||
var dist = createCommonjsModule(function (module, exports) { | ||
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.helpers = exports.EMPTY_DOCUMENT = exports.MARKS = exports.INLINES = exports.BLOCKS = void 0; | ||
Object.defineProperty(exports, "BLOCKS", { enumerable: true, get: function () { return blocks.BLOCKS; } }); | ||
Object.defineProperty(exports, "INLINES", { enumerable: true, get: function () { return inlines.INLINES; } }); | ||
Object.defineProperty(exports, "MARKS", { enumerable: true, get: function () { return marks.MARKS; } }); | ||
__exportStar(schemaConstraints, exports); | ||
__exportStar(types, exports); | ||
__exportStar(nodeTypes, exports); | ||
Object.defineProperty(exports, "EMPTY_DOCUMENT", { enumerable: true, get: function () { return emptyDocument.EMPTY_DOCUMENT; } }); | ||
var helpers$1 = __importStar(helpers); | ||
exports.helpers = helpers$1; | ||
}); | ||
unwrapExports(dist); | ||
var dist_1 = dist.helpers; | ||
var dist_2 = dist.EMPTY_DOCUMENT; | ||
var dist_3 = dist.MARKS; | ||
var dist_4 = dist.INLINES; | ||
var dist_5 = dist.BLOCKS; | ||
function appendKeyToValidElement(element, key) { | ||
@@ -442,3 +389,3 @@ if (React.isValidElement(element) && element.key === null) { | ||
var renderNode = options.renderNode, renderMark = options.renderMark, renderText = options.renderText, preserveWhitespace = options.preserveWhitespace; | ||
if (dist_1.isText(node)) { | ||
if (dist.helpers.isText(node)) { | ||
var nodeValue = renderText ? renderText(node.value) : node.value; | ||
@@ -454,3 +401,3 @@ if (preserveWhitespace) { | ||
if (index !== lines_1.length - 1) { | ||
jsxLines_1.push(React__default.createElement("br", null)); | ||
jsxLines_1.push(React.createElement("br", null)); | ||
} | ||
@@ -470,3 +417,3 @@ }); | ||
if (!node.nodeType || !renderNode[node.nodeType]) { | ||
return React__default.createElement(React__default.Fragment, null, children); | ||
return React.createElement(React.Fragment, null, children); | ||
} | ||
@@ -479,43 +426,43 @@ return renderNode[node.nodeType](node, children); | ||
var defaultNodeRenderers = (_a = {}, | ||
_a[dist_5.DOCUMENT] = function (node, children) { return children; }, | ||
_a[dist_5.PARAGRAPH] = function (node, children) { return React__default.createElement("p", null, children); }, | ||
_a[dist_5.HEADING_1] = function (node, children) { return React__default.createElement("h1", null, children); }, | ||
_a[dist_5.HEADING_2] = function (node, children) { return React__default.createElement("h2", null, children); }, | ||
_a[dist_5.HEADING_3] = function (node, children) { return React__default.createElement("h3", null, children); }, | ||
_a[dist_5.HEADING_4] = function (node, children) { return React__default.createElement("h4", null, children); }, | ||
_a[dist_5.HEADING_5] = function (node, children) { return React__default.createElement("h5", null, children); }, | ||
_a[dist_5.HEADING_6] = function (node, children) { return React__default.createElement("h6", null, children); }, | ||
_a[dist_5.EMBEDDED_ENTRY] = function (node, children) { return React__default.createElement("div", null, children); }, | ||
_a[dist_5.EMBEDDED_RESOURCE] = function (node, children) { return React__default.createElement("div", null, children); }, | ||
_a[dist_5.UL_LIST] = function (node, children) { return React__default.createElement("ul", null, children); }, | ||
_a[dist_5.OL_LIST] = function (node, children) { return React__default.createElement("ol", null, children); }, | ||
_a[dist_5.LIST_ITEM] = function (node, children) { return React__default.createElement("li", null, children); }, | ||
_a[dist_5.QUOTE] = function (node, children) { return React__default.createElement("blockquote", null, children); }, | ||
_a[dist_5.HR] = function () { return React__default.createElement("hr", null); }, | ||
_a[dist_5.TABLE] = function (node, children) { return (React__default.createElement("table", null, | ||
React__default.createElement("tbody", null, children))); }, | ||
_a[dist_5.TABLE_ROW] = function (node, children) { return React__default.createElement("tr", null, children); }, | ||
_a[dist_5.TABLE_HEADER_CELL] = function (node, children) { return React__default.createElement("th", null, children); }, | ||
_a[dist_5.TABLE_CELL] = function (node, children) { return React__default.createElement("td", null, children); }, | ||
_a[dist_4.ASSET_HYPERLINK] = function (node) { return defaultInline(dist_4.ASSET_HYPERLINK, node); }, | ||
_a[dist_4.ENTRY_HYPERLINK] = function (node) { return defaultInline(dist_4.ENTRY_HYPERLINK, node); }, | ||
_a[dist_4.RESOURCE_HYPERLINK] = function (node) { | ||
return defaultInlineResource(dist_4.RESOURCE_HYPERLINK, node); | ||
_a[dist.BLOCKS.DOCUMENT] = function (node, children) { return children; }, | ||
_a[dist.BLOCKS.PARAGRAPH] = function (node, children) { return React.createElement("p", null, children); }, | ||
_a[dist.BLOCKS.HEADING_1] = function (node, children) { return React.createElement("h1", null, children); }, | ||
_a[dist.BLOCKS.HEADING_2] = function (node, children) { return React.createElement("h2", null, children); }, | ||
_a[dist.BLOCKS.HEADING_3] = function (node, children) { return React.createElement("h3", null, children); }, | ||
_a[dist.BLOCKS.HEADING_4] = function (node, children) { return React.createElement("h4", null, children); }, | ||
_a[dist.BLOCKS.HEADING_5] = function (node, children) { return React.createElement("h5", null, children); }, | ||
_a[dist.BLOCKS.HEADING_6] = function (node, children) { return React.createElement("h6", null, children); }, | ||
_a[dist.BLOCKS.EMBEDDED_ENTRY] = function (node, children) { return React.createElement("div", null, children); }, | ||
_a[dist.BLOCKS.EMBEDDED_RESOURCE] = function (node, children) { return React.createElement("div", null, children); }, | ||
_a[dist.BLOCKS.UL_LIST] = function (node, children) { return React.createElement("ul", null, children); }, | ||
_a[dist.BLOCKS.OL_LIST] = function (node, children) { return React.createElement("ol", null, children); }, | ||
_a[dist.BLOCKS.LIST_ITEM] = function (node, children) { return React.createElement("li", null, children); }, | ||
_a[dist.BLOCKS.QUOTE] = function (node, children) { return React.createElement("blockquote", null, children); }, | ||
_a[dist.BLOCKS.HR] = function () { return React.createElement("hr", null); }, | ||
_a[dist.BLOCKS.TABLE] = function (node, children) { return (React.createElement("table", null, | ||
React.createElement("tbody", null, children))); }, | ||
_a[dist.BLOCKS.TABLE_ROW] = function (node, children) { return React.createElement("tr", null, children); }, | ||
_a[dist.BLOCKS.TABLE_HEADER_CELL] = function (node, children) { return React.createElement("th", null, children); }, | ||
_a[dist.BLOCKS.TABLE_CELL] = function (node, children) { return React.createElement("td", null, children); }, | ||
_a[dist.INLINES.ASSET_HYPERLINK] = function (node) { return defaultInline(dist.INLINES.ASSET_HYPERLINK, node); }, | ||
_a[dist.INLINES.ENTRY_HYPERLINK] = function (node) { return defaultInline(dist.INLINES.ENTRY_HYPERLINK, node); }, | ||
_a[dist.INLINES.RESOURCE_HYPERLINK] = function (node) { | ||
return defaultInlineResource(dist.INLINES.RESOURCE_HYPERLINK, node); | ||
}, | ||
_a[dist_4.EMBEDDED_ENTRY] = function (node) { return defaultInline(dist_4.EMBEDDED_ENTRY, node); }, | ||
_a[dist_4.EMBEDDED_RESOURCE] = function (node, children) { | ||
return defaultInlineResource(dist_4.EMBEDDED_RESOURCE, node); | ||
_a[dist.INLINES.EMBEDDED_ENTRY] = function (node) { return defaultInline(dist.INLINES.EMBEDDED_ENTRY, node); }, | ||
_a[dist.INLINES.EMBEDDED_RESOURCE] = function (node, children) { | ||
return defaultInlineResource(dist.INLINES.EMBEDDED_RESOURCE, node); | ||
}, | ||
_a[dist_4.HYPERLINK] = function (node, children) { return React__default.createElement("a", { href: node.data.uri }, children); }, | ||
_a[dist.INLINES.HYPERLINK] = function (node, children) { return React.createElement("a", { href: node.data.uri }, children); }, | ||
_a); | ||
var defaultMarkRenderers = (_b = {}, | ||
_b[dist_3.BOLD] = function (text) { return React__default.createElement("b", null, text); }, | ||
_b[dist_3.ITALIC] = function (text) { return React__default.createElement("i", null, text); }, | ||
_b[dist_3.UNDERLINE] = function (text) { return React__default.createElement("u", null, text); }, | ||
_b[dist_3.CODE] = function (text) { return React__default.createElement("code", null, text); }, | ||
_b[dist_3.SUPERSCRIPT] = function (text) { return React__default.createElement("sup", null, text); }, | ||
_b[dist_3.SUBSCRIPT] = function (text) { return React__default.createElement("sub", null, text); }, | ||
_b[dist.MARKS.BOLD] = function (text) { return React.createElement("b", null, text); }, | ||
_b[dist.MARKS.ITALIC] = function (text) { return React.createElement("i", null, text); }, | ||
_b[dist.MARKS.UNDERLINE] = function (text) { return React.createElement("u", null, text); }, | ||
_b[dist.MARKS.CODE] = function (text) { return React.createElement("code", null, text); }, | ||
_b[dist.MARKS.SUPERSCRIPT] = function (text) { return React.createElement("sup", null, text); }, | ||
_b[dist.MARKS.SUBSCRIPT] = function (text) { return React.createElement("sub", null, text); }, | ||
_b); | ||
function defaultInline(type, node) { | ||
return (React__default.createElement("span", { key: node.data.target.sys.id }, | ||
return (React.createElement("span", { key: node.data.target.sys.id }, | ||
"type: ", | ||
@@ -527,3 +474,3 @@ node.nodeType, | ||
function defaultInlineResource(type, node) { | ||
return (React__default.createElement("span", { key: node.data.target.sys.urn }, | ||
return (React.createElement("span", { key: node.data.target.sys.urn }, | ||
"type: ", | ||
@@ -530,0 +477,0 @@ node.nodeType, |
{ | ||
"name": "@contentful/rich-text-react-renderer", | ||
"version": "15.19.6", | ||
"version": "15.20.0", | ||
"main": "dist/rich-text-react-renderer.es5.js", | ||
@@ -23,4 +23,4 @@ "typings": "dist/types/index.d.ts", | ||
"prebuild": "rimraf dist", | ||
"build": "tsc --module commonjs && rollup -c rollup.config.js", | ||
"start": "tsc && rollup -c rollup.config.js -w", | ||
"build": "tsc --module commonjs && rollup -c --bundleConfigAsCjs rollup.config.js", | ||
"start": "tsc && rollup -c --bundleConfigAsCjs rollup.config.js -w", | ||
"lint": "tslint -t codeFrame '@(src|bin)/*.ts'", | ||
@@ -30,3 +30,3 @@ "test": "jest" | ||
"dependencies": { | ||
"@contentful/rich-text-types": "^16.3.5" | ||
"@contentful/rich-text-types": "^16.4.0" | ||
}, | ||
@@ -40,12 +40,5 @@ "peerDependencies": { | ||
"@types/react-dom": "^16.8.4", | ||
"jest": "^27.1.0", | ||
"react": "^16.4.1", | ||
"react-dom": "^16.4.1", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"ts-jest": "^29.1.2", | ||
@@ -55,3 +48,3 @@ "tslint": "^6.1.3", | ||
}, | ||
"gitHead": "63b4725a298fa5ea480f19e06cfc324996941c95" | ||
"gitHead": "f39fbb99956d719a695eb917dbddb5af969d52b6" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153680
8
1868