Socket
Socket
Sign inDemoInstall

@contentful/rich-text-react-renderer

Package Overview
Dependencies
Maintainers
56
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/rich-text-react-renderer - npm Package Compare versions

Comparing version 13.2.0 to 13.4.0

dist/lib/__test__/components/Document.js

7

dist/lib/__test__/index.test.js

@@ -21,2 +21,3 @@ "use strict";

var documents_1 = require("./documents");
var Document_1 = __importDefault(require("./components/Document"));
var Paragraph_1 = __importDefault(require("./components/Paragraph"));

@@ -35,2 +36,7 @@ var Strong_1 = __importDefault(require("./components/Strong"));

});
it('returns an array of elements when given a populated document', function () {
var document = documents_1.hrDoc;
expect(__1.documentToReactComponents(document)).toMatchSnapshot();
expect(__1.documentToReactComponents(document)).toBeInstanceOf(Array);
});
it('renders nodes with default node renderer', function () {

@@ -69,2 +75,3 @@ var docs = [

renderNode: (_a = {},
_a[rich_text_types_1.BLOCKS.DOCUMENT] = function (node, children) { return react_1.default.createElement(Document_1.default, null, children); },
_a[rich_text_types_1.BLOCKS.PARAGRAPH] = function (node, children) { return react_1.default.createElement(Paragraph_1.default, null, children); },

@@ -71,0 +78,0 @@ _a),

7

dist/lib/index.js

@@ -22,2 +22,3 @@ "use strict";

var defaultNodeRenderers = (_a = {},
_a[rich_text_types_1.BLOCKS.DOCUMENT] = function (node, children) { return children; },
_a[rich_text_types_1.BLOCKS.PARAGRAPH] = function (node, children) { return react_1.default.createElement("p", null, children); },

@@ -59,9 +60,9 @@ _a[rich_text_types_1.BLOCKS.HEADING_1] = function (node, children) { return react_1.default.createElement("h1", null, children); },

if (options === void 0) { options = {}; }
if (!richTextDocument || !richTextDocument.content) {
if (!richTextDocument) {
return null;
}
return nodeListToReactComponents_1.nodeListToReactComponents(richTextDocument.content, {
return nodeListToReactComponents_1.nodeToReactComponent(richTextDocument, {
renderNode: __assign({}, defaultNodeRenderers, options.renderNode),
renderMark: __assign({}, defaultMarkRenderers, options.renderMark),
renderText: options.renderText
renderText: options.renderText,
});

@@ -68,0 +69,0 @@ }

@@ -36,4 +36,6 @@ 'use strict';

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

@@ -49,34 +51,27 @@

function createCommonjsModule$$1(fn, module) {
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var _global = createCommonjsModule$$1(function (module) {
var O = 'object';
var check = function (it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
var global_1 =
// eslint-disable-next-line no-undef
check(typeof globalThis == O && globalThis) ||
check(typeof window == O && window) ||
check(typeof self == O && self) ||
check(typeof commonjsGlobal$1 == O && commonjsGlobal$1) ||
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
});
Function('return this')();
var _core = createCommonjsModule$$1(function (module) {
var core = module.exports = { version: '2.6.5' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
});
var _core_1 = _core.version;
var _isObject = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var _anObject = function (it) {
if (!_isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
var _fails = function (exec) {
var fails = function (exec) {
try {
return !!exec();
} catch (e) {
} catch (error) {
return true;

@@ -87,40 +82,137 @@ }

// Thank's IE8 for his funny defineProperty
var _descriptors = !_fails(function () {
var descriptors = !fails(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
var document = _global.document;
// typeof document.createElement is 'object' in old IE
var is = _isObject(document) && _isObject(document.createElement);
var _domCreate = function (it) {
return is ? document.createElement(it) : {};
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor(this, V);
return !!descriptor && descriptor.enumerable;
} : nativePropertyIsEnumerable;
var objectPropertyIsEnumerable = {
f: f
};
var _ie8DomDefine = !_descriptors && !_fails(function () {
return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
});
var createPropertyDescriptor = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
// 7.1.1 ToPrimitive(input [, PreferredType])
var toString = {}.toString;
var classofRaw = function (it) {
return toString.call(it).slice(8, -1);
};
var split = ''.split;
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var indexedObject = fails(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins
return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;
// `RequireObjectCoercible` abstract operation
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
var requireObjectCoercible = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
// toObject with fallback for non-array-like ES3 strings
var toIndexedObject = function (it) {
return indexedObject(requireObjectCoercible(it));
};
var isObject = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
// `ToPrimitive` abstract operation
// https://tc39.github.io/ecma262/#sec-toprimitive
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var _toPrimitive = function (it, S) {
if (!_isObject(it)) return it;
var toPrimitive = function (input, PREFERRED_STRING) {
if (!isObject(input)) return input;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
throw TypeError("Can't convert object to primitive value");
};
var dP = Object.defineProperty;
var hasOwnProperty = {}.hasOwnProperty;
var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
_anObject(O);
P = _toPrimitive(P, true);
_anObject(Attributes);
if (_ie8DomDefine) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
var has = function (it, key) {
return hasOwnProperty.call(it, key);
};
var document = global_1.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject(document) && isObject(document.createElement);
var documentCreateElement = function (it) {
return EXISTS ? document.createElement(it) : {};
};
// Thank's IE8 for his funny defineProperty
var ie8DomDefine = !descriptors && !fails(function () {
return Object.defineProperty(documentCreateElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (ie8DomDefine) try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
};
var objectGetOwnPropertyDescriptor = {
f: f$1
};
var anObject = function (it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
var nativeDefineProperty = Object.defineProperty;
// `Object.defineProperty` method
// https://tc39.github.io/ecma262/#sec-object.defineproperty
var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (ie8DomDefine) try {
return nativeDefineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;

@@ -130,17 +222,8 @@ return O;

var _objectDp = {
f: f
var objectDefineProperty = {
f: f$2
};
var _propertyDesc = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var _hide = _descriptors ? function (object, key, value) {
return _objectDp.f(object, key, _propertyDesc(1, value));
var hide = descriptors ? function (object, key, value) {
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {

@@ -151,16 +234,13 @@ object[key] = value;

var hasOwnProperty = {}.hasOwnProperty;
var _has = function (it, key) {
return hasOwnProperty.call(it, key);
var setGlobal = function (key, value) {
try {
hide(global_1, key, value);
} catch (error) {
global_1[key] = value;
} return value;
};
var id = 0;
var px = Math.random();
var _uid = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
var _shared = createCommonjsModule$$1(function (module) {
var shared = createCommonjsModule(function (module) {
var SHARED = '__core-js_shared__';
var store = _global[SHARED] || (_global[SHARED] = {});
var store = global_1[SHARED] || setGlobal(SHARED, {});

@@ -170,3 +250,3 @@ (module.exports = function (key, value) {

})('versions', []).push({
version: _core.version,
version: '3.1.3',
mode: 'global',

@@ -177,138 +257,137 @@ copyright: '© 2019 Denis Pushkarev (zloirock.ru)'

var _functionToString = _shared('native-function-to-string', Function.toString);
var functionToString = shared('native-function-to-string', Function.toString);
var _redefine = createCommonjsModule$$1(function (module) {
var SRC = _uid('src');
var WeakMap = global_1.WeakMap;
var TO_STRING = 'toString';
var TPL = ('' + _functionToString).split(TO_STRING);
var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
_core.inspectSource = function (it) {
return _functionToString.call(it);
var id = 0;
var postfix = Math.random();
var uid = function (key) {
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) _has(val, 'name') || _hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === _global) {
O[key] = val;
} else if (!safe) {
delete O[key];
_hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
_hide(O, key, val);
}
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || _functionToString.call(this);
});
});
var keys = shared('keys');
var _aFunction = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
var sharedKey = function (key) {
return keys[key] || (keys[key] = uid(key));
};
// optional / simple context binding
var hiddenKeys = {};
var _ctx = function (fn, that, length) {
_aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
var WeakMap$1 = global_1.WeakMap;
var set, get, has$1;
var enforce = function (it) {
return has$1(it) ? get(it) : set(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
var PROTOTYPE = 'prototype';
if (nativeWeakMap) {
var store = new WeakMap$1();
var wmget = store.get;
var wmhas = store.has;
var wmset = store.set;
set = function (it, metadata) {
wmset.call(store, it, metadata);
return metadata;
};
get = function (it) {
return wmget.call(store, it) || {};
};
has$1 = function (it) {
return wmhas.call(store, it);
};
} else {
var STATE = sharedKey('state');
hiddenKeys[STATE] = true;
set = function (it, metadata) {
hide(it, STATE, metadata);
return metadata;
};
get = function (it) {
return has(it, STATE) ? it[STATE] : {};
};
has$1 = function (it) {
return has(it, STATE);
};
}
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
var key, own, out, exp;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
// extend global
if (target) _redefine(target, key, out, type & $export.U);
// export
if (exports[key] != out) _hide(exports, key, exp);
if (IS_PROTO && expProto[key] != out) expProto[key] = out;
}
var internalState = {
set: set,
get: get,
has: has$1,
enforce: enforce,
getterFor: getterFor
};
_global.core = _core;
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
var _export = $export;
var toString = {}.toString;
var redefine = createCommonjsModule(function (module) {
var getInternalState = internalState.get;
var enforceInternalState = internalState.enforce;
var TEMPLATE = String(functionToString).split('toString');
var _cof = function (it) {
return toString.call(it).slice(8, -1);
};
shared('inspectSource', function (it) {
return functionToString.call(it);
});
// fallback for non-array-like ES3 and non-enumerable old V8 strings
(module.exports = function (O, key, value, options) {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
if (typeof value == 'function') {
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
}
if (O === global_1) {
if (simple) O[key] = value;
else setGlobal(key, value);
return;
} else if (!unsafe) {
delete O[key];
} else if (!noTargetGet && O[key]) {
simple = true;
}
if (simple) O[key] = value;
else hide(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
});
});
// eslint-disable-next-line no-prototype-builtins
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return _cof(it) == 'String' ? it.split('') : Object(it);
};
var path = global_1;
// 7.2.1 RequireObjectCoercible(argument)
var _defined = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
var aFunction = function (variable) {
return typeof variable == 'function' ? variable : undefined;
};
// to indexed object, toObject with fallback for non-array-like ES3 strings
var _toIobject = function (it) {
return _iobject(_defined(it));
var getBuiltIn = function (namespace, method) {
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
: path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
};
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
var _toInteger = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
// `ToInteger` abstract operation
// https://tc39.github.io/ecma262/#sec-tointeger
var toInteger = function (argument) {
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
};
// 7.1.15 ToLength
var min = Math.min;
var min = Math.min;
var _toLength = function (it) {
return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
// `ToLength` abstract operation
// https://tc39.github.io/ecma262/#sec-tolength
var toLength = function (argument) {
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};

@@ -318,17 +397,17 @@

var min$1 = Math.min;
var _toAbsoluteIndex = function (index, length) {
index = _toInteger(index);
return index < 0 ? max(index + length, 0) : min$1(index, length);
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
var toAbsoluteIndex = function (index, length) {
var integer = toInteger(index);
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
};
// false -> Array#indexOf
// true -> Array#includes
var _arrayIncludes = function (IS_INCLUDES) {
// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = _toIobject($this);
var length = _toLength(O.length);
var index = _toAbsoluteIndex(fromIndex, length);
var O = toIndexedObject($this);
var length = toLength(O.length);
var index = toAbsoluteIndex(fromIndex, length);
var value;

@@ -342,4 +421,4 @@ // Array#includes uses SameValueZero equality algorithm

// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
} else for (;length > index; index++) {
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;

@@ -349,20 +428,23 @@ };

var shared = _shared('keys');
var _sharedKey = function (key) {
return shared[key] || (shared[key] = _uid(key));
var arrayIncludes = {
// `Array.prototype.includes` method
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
includes: createMethod(true),
// `Array.prototype.indexOf` method
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
indexOf: createMethod(false)
};
var arrayIndexOf = _arrayIncludes(false);
var IE_PROTO = _sharedKey('IE_PROTO');
var indexOf = arrayIncludes.indexOf;
var _objectKeysInternal = function (object, names) {
var O = _toIobject(object);
var objectKeysInternal = function (object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (_has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
while (names.length > i) if (has(O, key = names[i++])) {
~indexOf(result, key) || result.push(key);
}

@@ -372,26 +454,135 @@ return result;

// IE 8- don't enum bug keys
var _enumBugKeys = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
// IE8- don't enum bug keys
var enumBugKeys = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return objectKeysInternal(O, hiddenKeys$1);
};
var objectGetOwnPropertyNames = {
f: f$3
};
var _objectKeys = Object.keys || function keys(O) {
return _objectKeysInternal(O, _enumBugKeys);
var f$4 = Object.getOwnPropertySymbols;
var objectGetOwnPropertySymbols = {
f: f$4
};
var f$1 = {}.propertyIsEnumerable;
// all object keys, includes non-enumerable and symbols
var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
var keys = objectGetOwnPropertyNames.f(anObject(it));
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};
var _objectPie = {
f: f$1
var copyConstructorProperties = function (target, source) {
var keys = ownKeys(source);
var defineProperty = objectDefineProperty.f;
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
};
var isEnum = _objectPie.f;
var _objectToArray = function (isEntries) {
var replacement = /#|\.prototype\./;
var isForced = function (feature, detection) {
var value = data[normalize(feature)];
return value == POLYFILL ? true
: value == NATIVE ? false
: typeof detection == 'function' ? fails(detection)
: !!detection;
};
var normalize = isForced.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced.data = {};
var NATIVE = isForced.NATIVE = 'N';
var POLYFILL = isForced.POLYFILL = 'P';
var isForced_1 = isForced;
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
var _export = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global_1;
} else if (STATIC) {
target = global_1[TARGET] || setGlobal(TARGET, {});
} else {
target = (global_1[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor$1(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
hide(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
// `Object.keys` method
// https://tc39.github.io/ecma262/#sec-object.keys
var objectKeys = Object.keys || function keys(O) {
return objectKeysInternal(O, enumBugKeys);
};
var propertyIsEnumerable = objectPropertyIsEnumerable.f;
// `Object.{ entries, values }` methods implementation
var createMethod$1 = function (TO_ENTRIES) {
return function (it) {
var O = _toIobject(it);
var keys = _objectKeys(O);
var O = toIndexedObject(it);
var keys = objectKeys(O);
var length = keys.length;

@@ -401,47 +592,124 @@ var i = 0;

var key;
while (length > i) if (isEnum.call(O, key = keys[i++])) {
result.push(isEntries ? [key, O[key]] : O[key]);
} return result;
while (length > i) {
key = keys[i++];
if (!descriptors || propertyIsEnumerable.call(O, key)) {
result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
}
}
return result;
};
};
// https://github.com/tc39/proposal-object-values-entries
var objectToArray = {
// `Object.entries` method
// https://tc39.github.io/ecma262/#sec-object.entries
entries: createMethod$1(true),
// `Object.values` method
// https://tc39.github.io/ecma262/#sec-object.values
values: createMethod$1(false)
};
var $values = _objectToArray(false);
var $values = objectToArray.values;
_export(_export.S, 'Object', {
values: function values(it) {
return $values(it);
// `Object.values` method
// https://tc39.github.io/ecma262/#sec-object.values
_export({ target: 'Object', stat: true }, {
values: function values(O) {
return $values(O);
}
});
var values = _core.Object.values;
var values = path.Object.values;
var _wks = createCommonjsModule$$1(function (module) {
var store = _shared('wks');
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
// Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
var Symbol = _global.Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var Symbol$1 = global_1.Symbol;
var store$1 = shared('wks');
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
var wellKnownSymbol = function (name) {
return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
|| (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
};
$exports.store = store;
});
// `Object.defineProperties` method
// https://tc39.github.io/ecma262/#sec-object.defineproperties
var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var index = 0;
var key;
while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
return O;
};
// 22.1.3.31 Array.prototype[@@unscopables]
var UNSCOPABLES = _wks('unscopables');
var ArrayProto = Array.prototype;
if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {});
var _addToUnscopables = function (key) {
ArrayProto[UNSCOPABLES][key] = true;
var html = getBuiltIn('document', 'documentElement');
var IE_PROTO = sharedKey('IE_PROTO');
var PROTOTYPE = 'prototype';
var Empty = function () { /* empty */ };
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = documentCreateElement('iframe');
var length = enumBugKeys.length;
var lt = '<';
var script = 'script';
var gt = '>';
var js = 'java' + script + ':';
var iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
iframe.src = String(js);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
return createDict();
};
// https://github.com/tc39/Array.prototype.includes
// `Object.create` method
// https://tc39.github.io/ecma262/#sec-object.create
var objectCreate = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE] = anObject(O);
result = new Empty();
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : objectDefineProperties(result, Properties);
};
var $includes = _arrayIncludes(true);
hiddenKeys[IE_PROTO] = true;
_export(_export.P, 'Array', {
var UNSCOPABLES = wellKnownSymbol('unscopables');
var ArrayPrototype = Array.prototype;
// Array.prototype[@@unscopables]
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
if (ArrayPrototype[UNSCOPABLES] == undefined) {
hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
}
// add a key to Array.prototype[@@unscopables]
var addToUnscopables = function (key) {
ArrayPrototype[UNSCOPABLES][key] = true;
};
var $includes = arrayIncludes.includes;
// `Array.prototype.includes` method
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
_export({ target: 'Array', proto: true }, {
includes: function includes(el /* , fromIndex = 0 */) {

@@ -452,6 +720,42 @@ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);

_addToUnscopables('includes');
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('includes');
var includes = _core.Array.includes;
var aFunction$1 = function (it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
} return it;
};
// optional / simple context binding
var bindContext = function (fn, that, length) {
aFunction$1(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
var call = Function.call;
var entryUnbind = function (CONSTRUCTOR, METHOD, length) {
return bindContext(call, global_1[CONSTRUCTOR].prototype[METHOD], length);
};
var includes = entryUnbind('Array', 'includes');
/**

@@ -561,4 +865,4 @@ * Map of all Contentful block types. Blocks contain inline or block nodes.

exports.helpers = helpers;
exports.BLOCKS = BLOCKS$1;
exports.CONTAINERS = CONTAINERS;
exports.INLINES = INLINES$1;

@@ -568,3 +872,3 @@ exports.MARKS = marks;

exports.VOID_BLOCKS = VOID_BLOCKS;
exports.CONTAINERS = CONTAINERS;
exports.helpers = helpers;

@@ -574,4 +878,4 @@ });

unwrapExports(richTextTypes_es5);
var richTextTypes_es5_1 = richTextTypes_es5.helpers;
var richTextTypes_es5_2 = richTextTypes_es5.BLOCKS;
var richTextTypes_es5_1 = richTextTypes_es5.BLOCKS;
var richTextTypes_es5_2 = richTextTypes_es5.CONTAINERS;
var richTextTypes_es5_3 = richTextTypes_es5.INLINES;

@@ -581,3 +885,3 @@ var richTextTypes_es5_4 = richTextTypes_es5.MARKS;

var richTextTypes_es5_6 = richTextTypes_es5.VOID_BLOCKS;
var richTextTypes_es5_7 = richTextTypes_es5.CONTAINERS;
var richTextTypes_es5_7 = richTextTypes_es5.helpers;

@@ -598,3 +902,3 @@ function appendKeyToValidElement(element, key) {

var renderNode = options.renderNode, renderMark = options.renderMark, renderText = options.renderText;
if (richTextTypes_es5_1.isText(node)) {
if (richTextTypes_es5_7.isText(node)) {
return node.marks.reduce(function (value, mark) {

@@ -618,15 +922,16 @@ if (!renderMark[mark.type]) {

var defaultNodeRenderers = (_a = {},
_a[richTextTypes_es5_2.PARAGRAPH] = function (node, children) { return React__default.createElement("p", null, children); },
_a[richTextTypes_es5_2.HEADING_1] = function (node, children) { return React__default.createElement("h1", null, children); },
_a[richTextTypes_es5_2.HEADING_2] = function (node, children) { return React__default.createElement("h2", null, children); },
_a[richTextTypes_es5_2.HEADING_3] = function (node, children) { return React__default.createElement("h3", null, children); },
_a[richTextTypes_es5_2.HEADING_4] = function (node, children) { return React__default.createElement("h4", null, children); },
_a[richTextTypes_es5_2.HEADING_5] = function (node, children) { return React__default.createElement("h5", null, children); },
_a[richTextTypes_es5_2.HEADING_6] = function (node, children) { return React__default.createElement("h6", null, children); },
_a[richTextTypes_es5_2.EMBEDDED_ENTRY] = function (node, children) { return React__default.createElement("div", null, children); },
_a[richTextTypes_es5_2.UL_LIST] = function (node, children) { return React__default.createElement("ul", null, children); },
_a[richTextTypes_es5_2.OL_LIST] = function (node, children) { return React__default.createElement("ol", null, children); },
_a[richTextTypes_es5_2.LIST_ITEM] = function (node, children) { return React__default.createElement("li", null, children); },
_a[richTextTypes_es5_2.QUOTE] = function (node, children) { return React__default.createElement("blockquote", null, children); },
_a[richTextTypes_es5_2.HR] = function () { return React__default.createElement("hr", null); },
_a[richTextTypes_es5_1.DOCUMENT] = function (node, children) { return children; },
_a[richTextTypes_es5_1.PARAGRAPH] = function (node, children) { return React__default.createElement("p", null, children); },
_a[richTextTypes_es5_1.HEADING_1] = function (node, children) { return React__default.createElement("h1", null, children); },
_a[richTextTypes_es5_1.HEADING_2] = function (node, children) { return React__default.createElement("h2", null, children); },
_a[richTextTypes_es5_1.HEADING_3] = function (node, children) { return React__default.createElement("h3", null, children); },
_a[richTextTypes_es5_1.HEADING_4] = function (node, children) { return React__default.createElement("h4", null, children); },
_a[richTextTypes_es5_1.HEADING_5] = function (node, children) { return React__default.createElement("h5", null, children); },
_a[richTextTypes_es5_1.HEADING_6] = function (node, children) { return React__default.createElement("h6", null, children); },
_a[richTextTypes_es5_1.EMBEDDED_ENTRY] = function (node, children) { return React__default.createElement("div", null, children); },
_a[richTextTypes_es5_1.UL_LIST] = function (node, children) { return React__default.createElement("ul", null, children); },
_a[richTextTypes_es5_1.OL_LIST] = function (node, children) { return React__default.createElement("ol", null, children); },
_a[richTextTypes_es5_1.LIST_ITEM] = function (node, children) { return React__default.createElement("li", null, children); },
_a[richTextTypes_es5_1.QUOTE] = function (node, children) { return React__default.createElement("blockquote", null, children); },
_a[richTextTypes_es5_1.HR] = function () { return React__default.createElement("hr", null); },
_a[richTextTypes_es5_3.ASSET_HYPERLINK] = function (node) { return defaultInline(richTextTypes_es5_3.ASSET_HYPERLINK, node); },

@@ -655,9 +960,9 @@ _a[richTextTypes_es5_3.ENTRY_HYPERLINK] = function (node) { return defaultInline(richTextTypes_es5_3.ENTRY_HYPERLINK, node); },

if (options === void 0) { options = {}; }
if (!richTextDocument || !richTextDocument.content) {
if (!richTextDocument) {
return null;
}
return nodeListToReactComponents(richTextDocument.content, {
return nodeToReactComponent(richTextDocument, {
renderNode: __assign({}, defaultNodeRenderers, options.renderNode),
renderMark: __assign({}, defaultMarkRenderers, options.renderMark),
renderText: options.renderText
renderText: options.renderText,
});

@@ -664,0 +969,0 @@ }

{
"name": "@contentful/rich-text-react-renderer",
"version": "13.2.0",
"version": "13.4.0",
"main": "dist/rich-text-react-renderer.es5.js",

@@ -26,25 +26,24 @@ "typings": "dist/types/index.d.ts",

"dependencies": {
"@contentful/rich-text-types": "^13.1.0"
"@contentful/rich-text-types": "^13.4.0"
},
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0"
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"devDependencies": {
"@types/react": "^16.8.1",
"@types/react-dom": "^16.0.11",
"jest": "^23.6.0",
"@types/react": "^16.8.15",
"@types/react-dom": "^16.8.4",
"jest": "^24.7.1",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"rimraf": "^2.6.2",
"rollup": "^0.66.6",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rimraf": "^2.6.3",
"rollup": "^1.11.0",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-typescript2": "^0.17.2",
"ts-jest": "^23.10.4",
"typescript": "^3.2.2"
},
"gitHead": "0d60e413c7a862180d04c27b4701b6cfaa78fa0b"
"rollup-plugin-typescript2": "^0.21.0",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5"
}
}

@@ -147,3 +147,3 @@ # rich-text-react-renderer

[BLOCKS.EMBEDDED_ENTRY]: (node) => {
const { title, description } = node.target.fields;
const { title, description } = node.data.target.fields;
return <CustomComponent title={title} description={description} />

@@ -150,0 +150,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc