@contentful/rich-text-types
Advanced tools
Comparing version 15.13.2 to 15.14.0
@@ -1,122 +0,120 @@ | ||
'use strict'; | ||
var __importDefault = | ||
(this && this.__importDefault) || | ||
function (mod) { | ||
return mod && mod.__esModule ? mod : { default: mod }; | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var faker_1 = __importDefault(require('faker')); | ||
var __1 = require('..'); | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var faker_1 = __importDefault(require("faker")); | ||
var __1 = require(".."); | ||
describe('Document', function () { | ||
it('empty Document', function () { | ||
var document = { | ||
nodeType: __1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [], | ||
}; | ||
}); | ||
it('Document with blocks', function () { | ||
var document = { | ||
nodeType: __1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
it('empty Document', function () { | ||
var document = { | ||
nodeType: __1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [], | ||
}; | ||
}); | ||
it('Document with blocks', function () { | ||
var document = { | ||
nodeType: __1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
}); | ||
describe('Block', function () { | ||
it('empty Block', function () { | ||
var block = { | ||
nodeType: __1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [], | ||
}; | ||
}); | ||
it('Block with block', function () { | ||
var block = { | ||
nodeType: __1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
it('Block with text', function () { | ||
var block = { | ||
nodeType: __1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: 'text', | ||
value: 'hi', | ||
data: {}, | ||
marks: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
it('empty Block', function () { | ||
var block = { | ||
nodeType: __1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [], | ||
}; | ||
}); | ||
it('Block with block', function () { | ||
var block = { | ||
nodeType: __1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
it('Block with text', function () { | ||
var block = { | ||
nodeType: __1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: 'text', | ||
value: 'hi', | ||
data: {}, | ||
marks: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
}); | ||
describe('Inline', function () { | ||
it('empty Inline', function () { | ||
var inline = { | ||
nodeType: __1.INLINES.HYPERLINK, | ||
data: {}, | ||
content: [], | ||
}; | ||
}); | ||
it('Inline with inline', function () { | ||
var inline = { | ||
nodeType: __1.INLINES.HYPERLINK, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
it('Inline with text', function () { | ||
var inline = { | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: 'text', | ||
value: 'hi', | ||
data: {}, | ||
marks: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
it('empty Inline', function () { | ||
var inline = { | ||
nodeType: __1.INLINES.HYPERLINK, | ||
data: {}, | ||
content: [], | ||
}; | ||
}); | ||
it('Inline with inline', function () { | ||
var inline = { | ||
nodeType: __1.INLINES.HYPERLINK, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
it('Inline with text', function () { | ||
var inline = { | ||
nodeType: faker_1.default.name.title(), | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: 'text', | ||
value: 'hi', | ||
data: {}, | ||
marks: [], | ||
}, | ||
], | ||
}; | ||
}); | ||
}); | ||
describe('text', function () { | ||
it('instantiates text', function () { | ||
var text = { | ||
nodeType: 'text', | ||
value: '', | ||
data: {}, | ||
marks: [], | ||
}; | ||
}); | ||
it('instantiates text with marks', function () { | ||
var textWithMarks = { | ||
nodeType: 'text', | ||
data: {}, | ||
value: '', | ||
marks: [{ type: 'bold' }], | ||
}; | ||
}); | ||
it('instantiates text', function () { | ||
var text = { | ||
nodeType: 'text', | ||
value: '', | ||
data: {}, | ||
marks: [], | ||
}; | ||
}); | ||
it('instantiates text with marks', function () { | ||
var textWithMarks = { | ||
nodeType: 'text', | ||
data: {}, | ||
value: '', | ||
marks: [{ type: 'bold' }], | ||
}; | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map | ||
//# sourceMappingURL=index.test.js.map |
@@ -1,33 +0,24 @@ | ||
'use strict'; | ||
var __spreadArray = | ||
(this && this.__spreadArray) || | ||
function (to, from, pack) { | ||
if (pack || arguments.length === 2) | ||
for (var i = 0, l = from.length, ar; i < l; i++) { | ||
"use strict"; | ||
var __spreadArray = (this && this.__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]; | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var blocks_1 = require('../blocks'); | ||
var schemaConstraints_1 = require('../schemaConstraints'); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var blocks_1 = require("../blocks"); | ||
var schemaConstraints_1 = require("../schemaConstraints"); | ||
var allKnownBlocks = Object.values(blocks_1.BLOCKS); | ||
describe('schema constraints', function () { | ||
it('all block node types are either considered a container or void', function () { | ||
var blocks = __spreadArray( | ||
__spreadArray( | ||
__spreadArray([blocks_1.BLOCKS.DOCUMENT], schemaConstraints_1.VOID_BLOCKS, true), | ||
schemaConstraints_1.TEXT_CONTAINERS, | ||
true, | ||
), | ||
Object.keys(schemaConstraints_1.CONTAINERS), | ||
true, | ||
); | ||
expect(blocks).toEqual(expect.arrayContaining(allKnownBlocks)); | ||
expect(blocks.length).toEqual(allKnownBlocks.length); | ||
}); | ||
it('all block node types are either considered a container or void', function () { | ||
var blocks = __spreadArray(__spreadArray(__spreadArray([ | ||
blocks_1.BLOCKS.DOCUMENT | ||
], schemaConstraints_1.VOID_BLOCKS, true), schemaConstraints_1.TEXT_CONTAINERS, true), Object.keys(schemaConstraints_1.CONTAINERS), true); | ||
expect(blocks).toEqual(expect.arrayContaining(allKnownBlocks)); | ||
expect(blocks.length).toEqual(allKnownBlocks.length); | ||
}); | ||
}); | ||
//# sourceMappingURL=schemaConstraints.test.js.map | ||
//# sourceMappingURL=schemaConstraints.test.js.map |
@@ -1,3 +0,3 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BLOCKS = void 0; | ||
@@ -9,22 +9,22 @@ /** | ||
(function (BLOCKS) { | ||
BLOCKS['DOCUMENT'] = 'document'; | ||
BLOCKS['PARAGRAPH'] = 'paragraph'; | ||
BLOCKS['HEADING_1'] = 'heading-1'; | ||
BLOCKS['HEADING_2'] = 'heading-2'; | ||
BLOCKS['HEADING_3'] = 'heading-3'; | ||
BLOCKS['HEADING_4'] = 'heading-4'; | ||
BLOCKS['HEADING_5'] = 'heading-5'; | ||
BLOCKS['HEADING_6'] = 'heading-6'; | ||
BLOCKS['OL_LIST'] = 'ordered-list'; | ||
BLOCKS['UL_LIST'] = 'unordered-list'; | ||
BLOCKS['LIST_ITEM'] = 'list-item'; | ||
BLOCKS['HR'] = 'hr'; | ||
BLOCKS['QUOTE'] = 'blockquote'; | ||
BLOCKS['EMBEDDED_ENTRY'] = 'embedded-entry-block'; | ||
BLOCKS['EMBEDDED_ASSET'] = 'embedded-asset-block'; | ||
BLOCKS['TABLE'] = 'table'; | ||
BLOCKS['TABLE_ROW'] = 'table-row'; | ||
BLOCKS['TABLE_CELL'] = 'table-cell'; | ||
BLOCKS['TABLE_HEADER_CELL'] = 'table-header-cell'; | ||
})((BLOCKS = exports.BLOCKS || (exports.BLOCKS = {}))); | ||
//# sourceMappingURL=blocks.js.map | ||
BLOCKS["DOCUMENT"] = "document"; | ||
BLOCKS["PARAGRAPH"] = "paragraph"; | ||
BLOCKS["HEADING_1"] = "heading-1"; | ||
BLOCKS["HEADING_2"] = "heading-2"; | ||
BLOCKS["HEADING_3"] = "heading-3"; | ||
BLOCKS["HEADING_4"] = "heading-4"; | ||
BLOCKS["HEADING_5"] = "heading-5"; | ||
BLOCKS["HEADING_6"] = "heading-6"; | ||
BLOCKS["OL_LIST"] = "ordered-list"; | ||
BLOCKS["UL_LIST"] = "unordered-list"; | ||
BLOCKS["LIST_ITEM"] = "list-item"; | ||
BLOCKS["HR"] = "hr"; | ||
BLOCKS["QUOTE"] = "blockquote"; | ||
BLOCKS["EMBEDDED_ENTRY"] = "embedded-entry-block"; | ||
BLOCKS["EMBEDDED_ASSET"] = "embedded-asset-block"; | ||
BLOCKS["TABLE"] = "table"; | ||
BLOCKS["TABLE_ROW"] = "table-row"; | ||
BLOCKS["TABLE_CELL"] = "table-cell"; | ||
BLOCKS["TABLE_HEADER_CELL"] = "table-header-cell"; | ||
})(BLOCKS = exports.BLOCKS || (exports.BLOCKS = {})); | ||
//# sourceMappingURL=blocks.js.map |
@@ -1,4 +0,4 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var blocks_1 = require('./blocks'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var blocks_1 = require("./blocks"); | ||
/** | ||
@@ -9,20 +9,20 @@ * A rich text document considered to be empty. | ||
var EMPTY_DOCUMENT = { | ||
nodeType: blocks_1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: blocks_1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [ | ||
nodeType: blocks_1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: 'text', | ||
value: '', | ||
marks: [], | ||
data: {}, | ||
nodeType: blocks_1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: 'text', | ||
value: '', | ||
marks: [], | ||
data: {}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
], | ||
}; | ||
exports.default = EMPTY_DOCUMENT; | ||
//# sourceMappingURL=emptyDocument.js.map | ||
//# sourceMappingURL=emptyDocument.js.map |
@@ -1,6 +0,6 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isText = exports.isBlock = exports.isInline = void 0; | ||
var blocks_1 = require('./blocks'); | ||
var inlines_1 = require('./inlines'); | ||
var blocks_1 = require("./blocks"); | ||
var inlines_1 = require("./inlines"); | ||
/** | ||
@@ -11,9 +11,9 @@ * Tiny replacement for Object.values(object).includes(key) to | ||
function hasValue(obj, value) { | ||
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (value === obj[key]) { | ||
return true; | ||
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (value === obj[key]) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
return false; | ||
} | ||
@@ -24,3 +24,3 @@ /** | ||
function isInline(node) { | ||
return hasValue(inlines_1.INLINES, node.nodeType); | ||
return hasValue(inlines_1.INLINES, node.nodeType); | ||
} | ||
@@ -32,3 +32,3 @@ exports.isInline = isInline; | ||
function isBlock(node) { | ||
return hasValue(blocks_1.BLOCKS, node.nodeType); | ||
return hasValue(blocks_1.BLOCKS, node.nodeType); | ||
} | ||
@@ -40,5 +40,5 @@ exports.isBlock = isBlock; | ||
function isText(node) { | ||
return node.nodeType === 'text'; | ||
return node.nodeType === 'text'; | ||
} | ||
exports.isText = isText; | ||
//# sourceMappingURL=helpers.js.map | ||
//# sourceMappingURL=helpers.js.map |
@@ -1,91 +0,42 @@ | ||
'use strict'; | ||
var __createBinding = | ||
(this && this.__createBinding) || | ||
(Object.create | ||
? function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { | ||
enumerable: true, | ||
get: function () { | ||
return m[k]; | ||
}, | ||
}); | ||
} | ||
: function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
var __setModuleDefault = | ||
(this && this.__setModuleDefault) || | ||
(Object.create | ||
? function (o, v) { | ||
Object.defineProperty(o, 'default', { enumerable: true, value: v }); | ||
} | ||
: function (o, v) { | ||
o['default'] = v; | ||
}); | ||
var __exportStar = | ||
(this && this.__exportStar) || | ||
function (m, exports) { | ||
for (var p in m) | ||
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) | ||
__createBinding(exports, m, p); | ||
}; | ||
var __importStar = | ||
(this && this.__importStar) || | ||
function (mod) { | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importStar = (this && this.__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); | ||
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; | ||
}; | ||
var __importDefault = | ||
(this && this.__importDefault) || | ||
function (mod) { | ||
return mod && mod.__esModule ? mod : { default: mod }; | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.helpers = | ||
exports.EMPTY_DOCUMENT = | ||
exports.MARKS = | ||
exports.INLINES = | ||
exports.BLOCKS = | ||
void 0; | ||
var blocks_1 = require('./blocks'); | ||
Object.defineProperty(exports, 'BLOCKS', { | ||
enumerable: true, | ||
get: function () { | ||
return blocks_1.BLOCKS; | ||
}, | ||
}); | ||
var inlines_1 = require('./inlines'); | ||
Object.defineProperty(exports, 'INLINES', { | ||
enumerable: true, | ||
get: function () { | ||
return inlines_1.INLINES; | ||
}, | ||
}); | ||
var marks_1 = require('./marks'); | ||
Object.defineProperty(exports, 'MARKS', { | ||
enumerable: true, | ||
get: function () { | ||
return __importDefault(marks_1).default; | ||
}, | ||
}); | ||
__exportStar(require('./schemaConstraints'), exports); | ||
__exportStar(require('./types'), exports); | ||
__exportStar(require('./nodeTypes'), exports); | ||
var emptyDocument_1 = require('./emptyDocument'); | ||
Object.defineProperty(exports, 'EMPTY_DOCUMENT', { | ||
enumerable: true, | ||
get: function () { | ||
return __importDefault(emptyDocument_1).default; | ||
}, | ||
}); | ||
var helpers = __importStar(require('./helpers')); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.helpers = exports.EMPTY_DOCUMENT = exports.MARKS = exports.INLINES = exports.BLOCKS = void 0; | ||
var blocks_1 = require("./blocks"); | ||
Object.defineProperty(exports, "BLOCKS", { enumerable: true, get: function () { return blocks_1.BLOCKS; } }); | ||
var inlines_1 = require("./inlines"); | ||
Object.defineProperty(exports, "INLINES", { enumerable: true, get: function () { return inlines_1.INLINES; } }); | ||
var marks_1 = require("./marks"); | ||
Object.defineProperty(exports, "MARKS", { enumerable: true, get: function () { return __importDefault(marks_1).default; } }); | ||
__exportStar(require("./schemaConstraints"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./nodeTypes"), exports); | ||
var emptyDocument_1 = require("./emptyDocument"); | ||
Object.defineProperty(exports, "EMPTY_DOCUMENT", { enumerable: true, get: function () { return __importDefault(emptyDocument_1).default; } }); | ||
var helpers = __importStar(require("./helpers")); | ||
exports.helpers = helpers; | ||
//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.INLINES = void 0; | ||
@@ -9,7 +9,7 @@ /** | ||
(function (INLINES) { | ||
INLINES['HYPERLINK'] = 'hyperlink'; | ||
INLINES['ENTRY_HYPERLINK'] = 'entry-hyperlink'; | ||
INLINES['ASSET_HYPERLINK'] = 'asset-hyperlink'; | ||
INLINES['EMBEDDED_ENTRY'] = 'embedded-entry-inline'; | ||
})((INLINES = exports.INLINES || (exports.INLINES = {}))); | ||
//# sourceMappingURL=inlines.js.map | ||
INLINES["HYPERLINK"] = "hyperlink"; | ||
INLINES["ENTRY_HYPERLINK"] = "entry-hyperlink"; | ||
INLINES["ASSET_HYPERLINK"] = "asset-hyperlink"; | ||
INLINES["EMBEDDED_ENTRY"] = "embedded-entry-inline"; | ||
})(INLINES = exports.INLINES || (exports.INLINES = {})); | ||
//# sourceMappingURL=inlines.js.map |
@@ -1,3 +0,3 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -8,8 +8,10 @@ * Map of all Contentful marks. | ||
(function (MARKS) { | ||
MARKS['BOLD'] = 'bold'; | ||
MARKS['ITALIC'] = 'italic'; | ||
MARKS['UNDERLINE'] = 'underline'; | ||
MARKS['CODE'] = 'code'; | ||
MARKS["BOLD"] = "bold"; | ||
MARKS["ITALIC"] = "italic"; | ||
MARKS["UNDERLINE"] = "underline"; | ||
MARKS["CODE"] = "code"; | ||
MARKS["SUPERSCRIPT"] = "superscript"; | ||
MARKS["SUBSCRIPT"] = "subscript"; | ||
})(MARKS || (MARKS = {})); | ||
exports.default = MARKS; | ||
//# sourceMappingURL=marks.js.map | ||
//# sourceMappingURL=marks.js.map |
@@ -1,3 +0,3 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=nodeTypes.js.map | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=nodeTypes.js.map |
@@ -1,27 +0,16 @@ | ||
'use strict'; | ||
var __spreadArray = | ||
(this && this.__spreadArray) || | ||
function (to, from, pack) { | ||
if (pack || arguments.length === 2) | ||
for (var i = 0, l = from.length, ar; i < l; i++) { | ||
"use strict"; | ||
var __spreadArray = (this && this.__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]; | ||
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_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 = require('./blocks'); | ||
var inlines_1 = require('./inlines'); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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 = require("./blocks"); | ||
var inlines_1 = require("./inlines"); | ||
/** | ||
@@ -32,16 +21,16 @@ * Array of all top level block types. | ||
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.TABLE, | ||
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.TABLE, | ||
]; | ||
@@ -52,21 +41,21 @@ /** | ||
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.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, | ||
]; | ||
exports.TABLE_BLOCKS = [ | ||
blocks_1.BLOCKS.TABLE, | ||
blocks_1.BLOCKS.TABLE_ROW, | ||
blocks_1.BLOCKS.TABLE_CELL, | ||
blocks_1.BLOCKS.TABLE_HEADER_CELL, | ||
blocks_1.BLOCKS.TABLE, | ||
blocks_1.BLOCKS.TABLE_ROW, | ||
blocks_1.BLOCKS.TABLE_CELL, | ||
blocks_1.BLOCKS.TABLE_HEADER_CELL, | ||
]; | ||
@@ -76,7 +65,3 @@ /** | ||
*/ | ||
exports.VOID_BLOCKS = [ | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
]; | ||
exports.VOID_BLOCKS = [blocks_1.BLOCKS.HR, blocks_1.BLOCKS.EMBEDDED_ENTRY, blocks_1.BLOCKS.EMBEDDED_ASSET]; | ||
/** | ||
@@ -87,13 +72,12 @@ * Dictionary of all container block types, and the set block types they accept as children. | ||
*/ | ||
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); | ||
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); | ||
/** | ||
@@ -103,8 +87,8 @@ * 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, | ||
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, | ||
]; | ||
@@ -119,23 +103,23 @@ /** | ||
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', | ||
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', | ||
]; | ||
//# sourceMappingURL=schemaConstraints.js.map | ||
//# sourceMappingURL=schemaConstraints.js.map |
@@ -1,22 +0,22 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var blocks_1 = require('../../blocks'); | ||
var inlines_1 = require('../../inlines'); | ||
var helpers_1 = require('../../helpers'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var blocks_1 = require("../../blocks"); | ||
var inlines_1 = require("../../inlines"); | ||
var helpers_1 = require("../../helpers"); | ||
test('isBlock', function () { | ||
var block = { nodeType: blocks_1.BLOCKS.PARAGRAPH }; | ||
var nonBlock = { nodeType: 'Paragraph' }; | ||
var nonBlock2 = { nodeType: undefined }; | ||
expect((0, helpers_1.isBlock)(block)).toBe(true); | ||
expect((0, helpers_1.isBlock)(nonBlock)).toBe(false); | ||
expect((0, helpers_1.isBlock)(nonBlock2)).toBe(false); | ||
var block = { nodeType: blocks_1.BLOCKS.PARAGRAPH }; | ||
var nonBlock = { nodeType: 'Paragraph' }; | ||
var nonBlock2 = { nodeType: undefined }; | ||
expect((0, helpers_1.isBlock)(block)).toBe(true); | ||
expect((0, helpers_1.isBlock)(nonBlock)).toBe(false); | ||
expect((0, helpers_1.isBlock)(nonBlock2)).toBe(false); | ||
}); | ||
test('isInline', function () { | ||
var inline = { nodeType: inlines_1.INLINES.HYPERLINK }; | ||
var noninline = { nodeType: 'Hyperlink' }; | ||
var noninline2 = { nodeType: undefined }; | ||
expect((0, helpers_1.isInline)(inline)).toBe(true); | ||
expect((0, helpers_1.isInline)(noninline)).toBe(false); | ||
expect((0, helpers_1.isInline)(noninline2)).toBe(false); | ||
var inline = { nodeType: inlines_1.INLINES.HYPERLINK }; | ||
var noninline = { nodeType: 'Hyperlink' }; | ||
var noninline2 = { nodeType: undefined }; | ||
expect((0, helpers_1.isInline)(inline)).toBe(true); | ||
expect((0, helpers_1.isInline)(noninline)).toBe(false); | ||
expect((0, helpers_1.isInline)(noninline2)).toBe(false); | ||
}); | ||
//# sourceMappingURL=helpers.test.js.map | ||
//# sourceMappingURL=helpers.test.js.map |
@@ -1,26 +0,24 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var blocks_1 = require('../../blocks'); | ||
var inlines_1 = require('../../inlines'); | ||
var index_1 = require('../index'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var blocks_1 = require("../../blocks"); | ||
var inlines_1 = require("../../inlines"); | ||
var index_1 = require("../index"); | ||
var matchesSnapshot = function (nodeType) { | ||
var jsonSchema = (0, index_1.getSchemaWithNodeType)(nodeType); | ||
expect(jsonSchema).toMatchSnapshot(nodeType); | ||
var jsonSchema = (0, index_1.getSchemaWithNodeType)(nodeType); | ||
expect(jsonSchema).toMatchSnapshot(nodeType); | ||
}; | ||
describe('getSchemaWithNodeType', function () { | ||
it('returns json schema for each nodeType', function () { | ||
Object.values(inlines_1.INLINES).forEach(function (nodeType) { | ||
matchesSnapshot(nodeType); | ||
it('returns json schema for each nodeType', function () { | ||
Object.values(inlines_1.INLINES).forEach(function (nodeType) { | ||
matchesSnapshot(nodeType); | ||
}); | ||
Object.values(blocks_1.BLOCKS).forEach(function (nodeType) { | ||
matchesSnapshot(nodeType); | ||
}); | ||
matchesSnapshot('text'); | ||
}); | ||
Object.values(blocks_1.BLOCKS).forEach(function (nodeType) { | ||
matchesSnapshot(nodeType); | ||
it('throws error if no schema found', function () { | ||
expect(function () { return (0, index_1.getSchemaWithNodeType)('unknown-node-type'); }).toThrowErrorMatchingSnapshot(); | ||
}); | ||
matchesSnapshot('text'); | ||
}); | ||
it('throws error if no schema found', function () { | ||
expect(function () { | ||
return (0, index_1.getSchemaWithNodeType)('unknown-node-type'); | ||
}).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
//# sourceMappingURL=schemas.test.js.map | ||
//# sourceMappingURL=schemas.test.js.map |
@@ -1,12 +0,13 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSchemaWithNodeType = void 0; | ||
function getSchemaWithNodeType(nodeType) { | ||
try { | ||
return require('./generated/' + nodeType + '.json'); | ||
} catch (error) { | ||
throw new Error('Schema for nodeType "' + nodeType + '" was not found.'); | ||
} | ||
try { | ||
return require("./generated/" + nodeType + ".json"); | ||
} | ||
catch (error) { | ||
throw new Error("Schema for nodeType \"" + nodeType + "\" was not found."); | ||
} | ||
} | ||
exports.getSchemaWithNodeType = getSchemaWithNodeType; | ||
//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=types.js.map | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
export {}; |
@@ -5,21 +5,21 @@ /** | ||
export declare enum BLOCKS { | ||
DOCUMENT = 'document', | ||
PARAGRAPH = 'paragraph', | ||
HEADING_1 = 'heading-1', | ||
HEADING_2 = 'heading-2', | ||
HEADING_3 = 'heading-3', | ||
HEADING_4 = 'heading-4', | ||
HEADING_5 = 'heading-5', | ||
HEADING_6 = 'heading-6', | ||
OL_LIST = 'ordered-list', | ||
UL_LIST = 'unordered-list', | ||
LIST_ITEM = 'list-item', | ||
HR = 'hr', | ||
QUOTE = 'blockquote', | ||
EMBEDDED_ENTRY = 'embedded-entry-block', | ||
EMBEDDED_ASSET = 'embedded-asset-block', | ||
TABLE = 'table', | ||
TABLE_ROW = 'table-row', | ||
TABLE_CELL = 'table-cell', | ||
TABLE_HEADER_CELL = 'table-header-cell', | ||
DOCUMENT = "document", | ||
PARAGRAPH = "paragraph", | ||
HEADING_1 = "heading-1", | ||
HEADING_2 = "heading-2", | ||
HEADING_3 = "heading-3", | ||
HEADING_4 = "heading-4", | ||
HEADING_5 = "heading-5", | ||
HEADING_6 = "heading-6", | ||
OL_LIST = "ordered-list", | ||
UL_LIST = "unordered-list", | ||
LIST_ITEM = "list-item", | ||
HR = "hr", | ||
QUOTE = "blockquote", | ||
EMBEDDED_ENTRY = "embedded-entry-block", | ||
EMBEDDED_ASSET = "embedded-asset-block", | ||
TABLE = "table", | ||
TABLE_ROW = "table-row", | ||
TABLE_CELL = "table-cell", | ||
TABLE_HEADER_CELL = "table-header-cell" | ||
} |
@@ -0,0 +0,0 @@ import { Document } from './types'; |
@@ -0,0 +0,0 @@ import { Node, Block, Inline, Text } from './types'; |
@@ -0,0 +0,0 @@ export { BLOCKS } from './blocks'; |
@@ -5,6 +5,6 @@ /** | ||
export declare enum INLINES { | ||
HYPERLINK = 'hyperlink', | ||
ENTRY_HYPERLINK = 'entry-hyperlink', | ||
ASSET_HYPERLINK = 'asset-hyperlink', | ||
EMBEDDED_ENTRY = 'embedded-entry-inline', | ||
HYPERLINK = "hyperlink", | ||
ENTRY_HYPERLINK = "entry-hyperlink", | ||
ASSET_HYPERLINK = "asset-hyperlink", | ||
EMBEDDED_ENTRY = "embedded-entry-inline" | ||
} |
@@ -5,7 +5,9 @@ /** | ||
declare enum MARKS { | ||
BOLD = 'bold', | ||
ITALIC = 'italic', | ||
UNDERLINE = 'underline', | ||
CODE = 'code', | ||
BOLD = "bold", | ||
ITALIC = "italic", | ||
UNDERLINE = "underline", | ||
CODE = "code", | ||
SUPERSCRIPT = "superscript", | ||
SUBSCRIPT = "subscript" | ||
} | ||
export default MARKS; |
@@ -6,156 +6,156 @@ import { BLOCKS } from './blocks'; | ||
export interface Heading1 extends Block { | ||
nodeType: BLOCKS.HEADING_1; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.HEADING_1; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface Heading2 extends Block { | ||
nodeType: BLOCKS.HEADING_2; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.HEADING_2; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface Heading3 extends Block { | ||
nodeType: BLOCKS.HEADING_3; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.HEADING_3; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface Heading4 extends Block { | ||
nodeType: BLOCKS.HEADING_4; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.HEADING_4; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface Heading5 extends Block { | ||
nodeType: BLOCKS.HEADING_5; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.HEADING_5; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface Heading6 extends Block { | ||
nodeType: BLOCKS.HEADING_6; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.HEADING_6; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface Paragraph extends Block { | ||
nodeType: BLOCKS.PARAGRAPH; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.PARAGRAPH; | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface Quote extends Block { | ||
nodeType: BLOCKS.QUOTE; | ||
data: EmptyNodeData; | ||
content: Paragraph[]; | ||
nodeType: BLOCKS.QUOTE; | ||
data: EmptyNodeData; | ||
content: Paragraph[]; | ||
} | ||
export interface Hr extends Block { | ||
nodeType: BLOCKS.HR; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.HR; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
data: EmptyNodeData; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface OrderedList extends Block { | ||
nodeType: BLOCKS.OL_LIST; | ||
data: EmptyNodeData; | ||
content: ListItem[]; | ||
nodeType: BLOCKS.OL_LIST; | ||
data: EmptyNodeData; | ||
content: ListItem[]; | ||
} | ||
export interface UnorderedList extends Block { | ||
nodeType: BLOCKS.UL_LIST; | ||
data: EmptyNodeData; | ||
content: ListItem[]; | ||
nodeType: BLOCKS.UL_LIST; | ||
data: EmptyNodeData; | ||
content: ListItem[]; | ||
} | ||
export interface ListItem extends Block { | ||
nodeType: BLOCKS.LIST_ITEM; | ||
data: EmptyNodeData; | ||
content: ListItemBlock[]; | ||
nodeType: BLOCKS.LIST_ITEM; | ||
data: EmptyNodeData; | ||
content: ListItemBlock[]; | ||
} | ||
export interface Link<T extends string = string> { | ||
sys: { | ||
type: 'Link'; | ||
linkType: T; | ||
id: string; | ||
}; | ||
sys: { | ||
type: 'Link'; | ||
linkType: T; | ||
id: string; | ||
}; | ||
} | ||
export interface EntryLinkBlock extends Block { | ||
nodeType: BLOCKS.EMBEDDED_ENTRY; | ||
data: { | ||
target: Link<'Entry'>; | ||
}; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.EMBEDDED_ENTRY; | ||
data: { | ||
target: Link<'Entry'>; | ||
}; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
content: Array<Inline | Text>; | ||
} | ||
export interface AssetLinkBlock extends Block { | ||
nodeType: BLOCKS.EMBEDDED_ASSET; | ||
data: { | ||
target: Link<'Asset'>; | ||
}; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
content: Array<Inline | Text>; | ||
nodeType: BLOCKS.EMBEDDED_ASSET; | ||
data: { | ||
target: Link<'Asset'>; | ||
}; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
content: Array<Inline | Text>; | ||
} | ||
export interface EntryLinkInline extends Inline { | ||
nodeType: INLINES.EMBEDDED_ENTRY; | ||
data: { | ||
target: Link<'Entry'>; | ||
}; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
content: Text[]; | ||
nodeType: INLINES.EMBEDDED_ENTRY; | ||
data: { | ||
target: Link<'Entry'>; | ||
}; | ||
/** | ||
* | ||
* @maxItems 0 | ||
*/ | ||
content: Text[]; | ||
} | ||
export interface Hyperlink extends Inline { | ||
nodeType: INLINES.HYPERLINK; | ||
data: { | ||
uri: string; | ||
}; | ||
content: Text[]; | ||
nodeType: INLINES.HYPERLINK; | ||
data: { | ||
uri: string; | ||
}; | ||
content: Text[]; | ||
} | ||
export interface AssetHyperlink extends Inline { | ||
nodeType: INLINES.ASSET_HYPERLINK; | ||
data: { | ||
target: Link<'Asset'>; | ||
}; | ||
content: Text[]; | ||
nodeType: INLINES.ASSET_HYPERLINK; | ||
data: { | ||
target: Link<'Asset'>; | ||
}; | ||
content: Text[]; | ||
} | ||
export interface EntryHyperlink extends Inline { | ||
nodeType: INLINES.ENTRY_HYPERLINK; | ||
data: { | ||
target: Link<'Entry'>; | ||
}; | ||
content: Text[]; | ||
nodeType: INLINES.ENTRY_HYPERLINK; | ||
data: { | ||
target: Link<'Entry'>; | ||
}; | ||
content: Text[]; | ||
} | ||
export interface TableCell extends Block { | ||
nodeType: BLOCKS.TABLE_HEADER_CELL | BLOCKS.TABLE_CELL; | ||
data: { | ||
colspan?: number; | ||
rowspan?: number; | ||
}; | ||
/** | ||
* @minItems 1 | ||
*/ | ||
content: Paragraph[]; | ||
nodeType: BLOCKS.TABLE_HEADER_CELL | BLOCKS.TABLE_CELL; | ||
data: { | ||
colspan?: number; | ||
rowspan?: number; | ||
}; | ||
/** | ||
* @minItems 1 | ||
*/ | ||
content: Paragraph[]; | ||
} | ||
export interface TableHeaderCell extends TableCell { | ||
nodeType: BLOCKS.TABLE_HEADER_CELL; | ||
nodeType: BLOCKS.TABLE_HEADER_CELL; | ||
} | ||
export interface TableRow extends Block { | ||
nodeType: BLOCKS.TABLE_ROW; | ||
data: EmptyNodeData; | ||
/** | ||
* @minItems 1 | ||
*/ | ||
content: TableCell[]; | ||
nodeType: BLOCKS.TABLE_ROW; | ||
data: EmptyNodeData; | ||
/** | ||
* @minItems 1 | ||
*/ | ||
content: TableCell[]; | ||
} | ||
export interface Table extends Block { | ||
nodeType: BLOCKS.TABLE; | ||
data: EmptyNodeData; | ||
/** | ||
* @minItems 1 | ||
*/ | ||
content: TableRow[]; | ||
nodeType: BLOCKS.TABLE; | ||
data: EmptyNodeData; | ||
/** | ||
* @minItems 1 | ||
*/ | ||
content: TableRow[]; | ||
} | ||
export {}; |
import { BLOCKS } from './blocks'; | ||
export declare type TopLevelBlockEnum = | ||
| BLOCKS.PARAGRAPH | ||
| BLOCKS.HEADING_1 | ||
| BLOCKS.HEADING_2 | ||
| BLOCKS.HEADING_3 | ||
| BLOCKS.HEADING_4 | ||
| BLOCKS.HEADING_5 | ||
| BLOCKS.HEADING_6 | ||
| BLOCKS.OL_LIST | ||
| BLOCKS.UL_LIST | ||
| BLOCKS.HR | ||
| BLOCKS.QUOTE | ||
| BLOCKS.EMBEDDED_ENTRY | ||
| BLOCKS.EMBEDDED_ASSET | ||
| BLOCKS.TABLE; | ||
export declare type TopLevelBlockEnum = BLOCKS.PARAGRAPH | BLOCKS.HEADING_1 | BLOCKS.HEADING_2 | BLOCKS.HEADING_3 | BLOCKS.HEADING_4 | BLOCKS.HEADING_5 | BLOCKS.HEADING_6 | BLOCKS.OL_LIST | BLOCKS.UL_LIST | BLOCKS.HR | BLOCKS.QUOTE | BLOCKS.EMBEDDED_ENTRY | BLOCKS.EMBEDDED_ASSET | BLOCKS.TABLE; | ||
/** | ||
@@ -22,16 +8,3 @@ * Array of all top level block types. | ||
export declare const TOP_LEVEL_BLOCKS: TopLevelBlockEnum[]; | ||
export declare type ListItemBlockEnum = | ||
| BLOCKS.PARAGRAPH | ||
| BLOCKS.HEADING_1 | ||
| BLOCKS.HEADING_2 | ||
| BLOCKS.HEADING_3 | ||
| BLOCKS.HEADING_4 | ||
| BLOCKS.HEADING_5 | ||
| BLOCKS.HEADING_6 | ||
| BLOCKS.OL_LIST | ||
| BLOCKS.UL_LIST | ||
| BLOCKS.HR | ||
| BLOCKS.QUOTE | ||
| BLOCKS.EMBEDDED_ENTRY | ||
| BLOCKS.EMBEDDED_ASSET; | ||
export declare type ListItemBlockEnum = BLOCKS.PARAGRAPH | BLOCKS.HEADING_1 | BLOCKS.HEADING_2 | BLOCKS.HEADING_3 | BLOCKS.HEADING_4 | BLOCKS.HEADING_5 | BLOCKS.HEADING_6 | BLOCKS.OL_LIST | BLOCKS.UL_LIST | BLOCKS.HR | BLOCKS.QUOTE | BLOCKS.EMBEDDED_ENTRY | BLOCKS.EMBEDDED_ASSET; | ||
/** | ||
@@ -52,10 +25,10 @@ * Array of all allowed block types inside list items | ||
export declare const CONTAINERS: { | ||
'ordered-list': BLOCKS[]; | ||
'unordered-list': BLOCKS[]; | ||
'list-item': TopLevelBlockEnum[]; | ||
blockquote: BLOCKS[]; | ||
table: BLOCKS[]; | ||
'table-row': BLOCKS[]; | ||
'table-cell': BLOCKS[]; | ||
'table-header-cell': BLOCKS[]; | ||
"ordered-list": BLOCKS[]; | ||
"unordered-list": BLOCKS[]; | ||
"list-item": TopLevelBlockEnum[]; | ||
blockquote: BLOCKS[]; | ||
table: BLOCKS[]; | ||
"table-row": BLOCKS[]; | ||
"table-cell": BLOCKS[]; | ||
"table-header-cell": BLOCKS[]; | ||
}; | ||
@@ -62,0 +35,0 @@ /** |
export declare type PrimitiveType = number | boolean | string | null; | ||
export declare type Definition = { | ||
$ref?: string; | ||
$schema?: string; | ||
$id?: string; | ||
description?: string; | ||
allOf?: Definition[]; | ||
oneOf?: Definition[]; | ||
anyOf?: Definition[]; | ||
title?: string; | ||
type?: string | string[]; | ||
definitions?: { | ||
[key: string]: any; | ||
}; | ||
format?: string; | ||
items?: Definition | Definition[]; | ||
minItems?: number; | ||
additionalItems?: | ||
| { | ||
$ref?: string; | ||
$schema?: string; | ||
$id?: string; | ||
description?: string; | ||
allOf?: Definition[]; | ||
oneOf?: Definition[]; | ||
anyOf?: Definition[]; | ||
title?: string; | ||
type?: string | string[]; | ||
definitions?: { | ||
[key: string]: any; | ||
}; | ||
format?: string; | ||
items?: Definition | Definition[]; | ||
minItems?: number; | ||
additionalItems?: { | ||
anyOf: Definition[]; | ||
} | ||
| Definition; | ||
enum?: PrimitiveType[] | Definition[]; | ||
default?: PrimitiveType | Object; | ||
additionalProperties?: Definition | boolean; | ||
required?: string[]; | ||
propertyOrder?: string[]; | ||
properties?: { | ||
[key: string]: any; | ||
}; | ||
defaultProperties?: string[]; | ||
patternProperties?: { | ||
[pattern: string]: Definition; | ||
}; | ||
typeof?: 'function'; | ||
} | Definition; | ||
enum?: PrimitiveType[] | Definition[]; | ||
default?: PrimitiveType | Object; | ||
additionalProperties?: Definition | boolean; | ||
required?: string[]; | ||
propertyOrder?: string[]; | ||
properties?: { | ||
[key: string]: any; | ||
}; | ||
defaultProperties?: string[]; | ||
patternProperties?: { | ||
[pattern: string]: Definition; | ||
}; | ||
typeof?: 'function'; | ||
}; | ||
export declare function getSchemaWithNodeType(nodeType: string): Definition; |
@@ -9,30 +9,30 @@ import { BLOCKS } from './blocks'; | ||
export interface Node { | ||
readonly nodeType: string; | ||
data: NodeData; | ||
readonly nodeType: string; | ||
data: NodeData; | ||
} | ||
export interface Block extends Node { | ||
nodeType: BLOCKS; | ||
content: Array<Block | Inline | Text>; | ||
nodeType: BLOCKS; | ||
content: Array<Block | Inline | Text>; | ||
} | ||
export interface Inline extends Node { | ||
nodeType: INLINES; | ||
content: Array<Inline | Text>; | ||
nodeType: INLINES; | ||
content: Array<Inline | Text>; | ||
} | ||
export interface TopLevelBlock extends Block { | ||
nodeType: TopLevelBlockEnum; | ||
nodeType: TopLevelBlockEnum; | ||
} | ||
export interface Document extends Node { | ||
nodeType: BLOCKS.DOCUMENT; | ||
content: TopLevelBlock[]; | ||
nodeType: BLOCKS.DOCUMENT; | ||
content: TopLevelBlock[]; | ||
} | ||
export interface Text extends Node { | ||
nodeType: 'text'; | ||
value: string; | ||
marks: Mark[]; | ||
nodeType: 'text'; | ||
value: string; | ||
marks: Mark[]; | ||
} | ||
export interface Mark { | ||
type: string; | ||
type: string; | ||
} | ||
export interface ListItemBlock extends Block { | ||
nodeType: ListItemBlockEnum; | ||
nodeType: ListItemBlockEnum; | ||
} |
{ | ||
"name": "@contentful/rich-text-types", | ||
"version": "15.13.2", | ||
"version": "15.14.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/types/index.d.ts", |
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
132674
0
4522