Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mobiledoc-vdom-renderer

Package Overview
Dependencies
Maintainers
22
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobiledoc-vdom-renderer - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/commonjs/getMarkupComponentDefault/index.js

@@ -16,3 +16,3 @@ "use strict";

var utils_1 = require("../utils");
var isValidElement = utils_1.includedIn(utils_1.objectValues(__assign({}, Mobiledoc_1.MarkupSectionTagName, Mobiledoc_1.ImageSectionTagName, Mobiledoc_1.ListSectionTagName, Mobiledoc_1.ListItemTagName, Mobiledoc_1.MarkupTagName)));
var isValidElement = utils_1.includedIn(utils_1.objectValues(__assign(__assign(__assign(__assign(__assign({}, Mobiledoc_1.MarkupSectionTagName), Mobiledoc_1.ImageSectionTagName), Mobiledoc_1.ListSectionTagName), Mobiledoc_1.ListItemTagName), Mobiledoc_1.MarkupTagName)));
var getMarkupComponentDefault = function (tagName) {

@@ -19,0 +19,0 @@ return isValidElement(tagName)

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -13,8 +20,8 @@ var Mobiledoc_1 = require("../../types/Mobiledoc");

var tagName = _a[1], items = _a[2];
return createElement.apply(void 0, [getMarkupComponent(tagName) ||
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(tagName) ||
utils_1.throwError("Unhandled element: the list section tag name `'" + tagName + "'` has no corresponding handler."),
{}].concat(items.map(function (item) {
return createElement.apply(void 0, [getMarkupComponent(ITEM_TAG_NAME) ||
{}], items.map(function (item) {
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(ITEM_TAG_NAME) ||
utils_1.throwError("Unhandled element: the list item tag name `'" + tagName + "'` has no corresponding handler."),
{}].concat(MarkersRenderer_1.default({
{}], MarkersRenderer_1.default({
createElement: createElement,

@@ -21,0 +28,0 @@ getAtomComponent: getAtomComponent,

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,7 +13,7 @@ var utils_1 = require("../../utils");

var MarkerContentRenderer_1 = require("./MarkerContentRenderer");
var MarkupNodesChildAppender = function (child) { return function (nodes) { return nodes.slice(0, -1).concat(nodes
var MarkupNodesChildAppender = function (child) { return function (nodes) { return __spreadArrays(nodes.slice(0, -1), nodes
.slice(-1)
.map(function (_a) {
var markup = _a.markup, children = _a.children;
return ({ markup: markup, children: children.concat([child]) });
return ({ markup: markup, children: __spreadArrays(children, [child]) });
})); }; };

@@ -17,3 +24,3 @@ var MarkerMarkupNodesOpener = function (_a) {

var openMarkupIndexes = _a[1];
return function (nodes) { return nodes.concat(openMarkupIndexes.map(function (markupIndex) { return ({
return function (nodes) { return __spreadArrays(nodes, openMarkupIndexes.map(function (markupIndex) { return ({
markup: markups[markupIndex],

@@ -30,6 +37,6 @@ children: []

return markup
? MarkupRenderer_1.default({ createElement: createElement, getMarkupComponent: getMarkupComponent })(markup, children.concat([
? MarkupRenderer_1.default({ createElement: createElement, getMarkupComponent: getMarkupComponent })(markup, __spreadArrays(children, [
innerNode
]))
: children.concat([innerNode]);
: __spreadArrays(children, [innerNode]);
}, []);

@@ -36,0 +43,0 @@ };

@@ -10,4 +10,4 @@ "use strict";

return function (_a) {
var _b;
var typeIdentifier = _a[0], value = _a[3];
var _b;
return ((_b = {},

@@ -14,0 +14,0 @@ _b[Mobiledoc_1.MarkerTypeIdentifier.TEXT] = function (text) { return text; },

@@ -13,2 +13,9 @@ "use strict";

};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -20,3 +27,3 @@ var utils_1 = require("../../../utils");

return index % 2 !== 0
? __assign({}, accumulator, (_a = {}, _a[attributesArray[index - 1]] = value, _a)) : accumulator;
? __assign(__assign({}, accumulator), (_a = {}, _a[attributesArray[index - 1]] = value, _a)) : accumulator;
}, {});

@@ -28,6 +35,6 @@ };

var tagName = _a[0], _b = _a[1], attributesArray = _b === void 0 ? [] : _b;
return createElement.apply(void 0, [getMarkupComponent(tagName) ||
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(tagName) ||
utils_1.throwError("Unhandled element: the markup tag name `'" + tagName + "'` has no corresponding handler."),
attributesArrayToAttributes(attributesArray)].concat(children));
attributesArrayToAttributes(attributesArray)], children));
};
});
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,5 +18,5 @@ var utils_1 = require("../../utils");

var tagName = _a[1], markers = _a[2];
return createElement.apply(void 0, [getMarkupComponent(tagName) ||
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(tagName) ||
utils_1.throwError("Unhandled element: the markup section `'" + tagName + "'` has no corresponding handler."),
{}].concat(MarkersRenderer_1.default({ createElement: createElement, getAtomComponent: getAtomComponent, getMarkupComponent: getMarkupComponent })({
{}], MarkersRenderer_1.default({ createElement: createElement, getAtomComponent: getAtomComponent, getMarkupComponent: getMarkupComponent })({
markups: markups,

@@ -16,0 +23,0 @@ atoms: atoms

@@ -13,2 +13,9 @@ "use strict";

};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -22,8 +29,8 @@ var _0_3_1 = require("../../types/Mobiledoc/0.3");

? {
cards: cards.concat([[section[1], section[2]]]),
sections: sections.concat([
cards: __spreadArrays(cards, [[section[1], section[2]]]),
sections: __spreadArrays(sections, [
[_0_3_1.SectionTypeIdentifier.CARD, cards.length]
])
}
: { cards: cards, sections: sections.concat([section]) };
: { cards: cards, sections: __spreadArrays(sections, [section]) };
}, { cards: [], sections: [] }))); };

@@ -61,7 +68,7 @@ /* Upgrade markers by adding `typeIdentifier` */

};
var upgradeSections = function (mobiledoc) { return (__assign({}, mobiledoc, { sections: mobiledoc.sections.map(upgradeSection) })); };
var upgradeSections = function (mobiledoc) { return (__assign(__assign({}, mobiledoc), { sections: mobiledoc.sections.map(upgradeSection) })); };
/* Add atoms */
var addAtoms = function (mobiledoc) { return (__assign({}, mobiledoc, { atoms: [] })); };
var addAtoms = function (mobiledoc) { return (__assign(__assign({}, mobiledoc), { atoms: [] })); };
/* Update the version */
var setVersion = function (targetVersion) { return function (mobiledoc) { return (__assign({}, mobiledoc, { version: targetVersion })); }; };
var setVersion = function (targetVersion) { return function (mobiledoc) { return (__assign(__assign({}, mobiledoc), { version: targetVersion })); }; };
var updateVersion = setVersion(TARGET_VERSION);

@@ -68,0 +75,0 @@ /* Upgrade Mobiledoc 0.2.x to 0.3.x */

@@ -16,3 +16,3 @@ "use strict";

var utils_1 = require("../utils");
var isValidElement = utils_1.includedIn(utils_1.objectValues(__assign({}, Mobiledoc_1.MarkupSectionTagName, Mobiledoc_1.ImageSectionTagName, Mobiledoc_1.ListSectionTagName, Mobiledoc_1.ListItemTagName, Mobiledoc_1.MarkupTagName)));
var isValidElement = utils_1.includedIn(utils_1.objectValues(__assign(__assign(__assign(__assign(__assign({}, Mobiledoc_1.MarkupSectionTagName), Mobiledoc_1.ImageSectionTagName), Mobiledoc_1.ListSectionTagName), Mobiledoc_1.ListItemTagName), Mobiledoc_1.MarkupTagName)));
var getMarkupComponentDefault = function (tagName) {

@@ -19,0 +19,0 @@ return isValidElement(tagName)

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -13,8 +20,8 @@ var Mobiledoc_1 = require("../../types/Mobiledoc");

var tagName = _a[1], items = _a[2];
return createElement.apply(void 0, [getMarkupComponent(tagName) ||
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(tagName) ||
utils_1.throwError("Unhandled element: the list section tag name `'" + tagName + "'` has no corresponding handler."),
{}].concat(items.map(function (item) {
return createElement.apply(void 0, [getMarkupComponent(ITEM_TAG_NAME) ||
{}], items.map(function (item) {
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(ITEM_TAG_NAME) ||
utils_1.throwError("Unhandled element: the list item tag name `'" + tagName + "'` has no corresponding handler."),
{}].concat(MarkersRenderer_1.default({
{}], MarkersRenderer_1.default({
createElement: createElement,

@@ -21,0 +28,0 @@ getAtomComponent: getAtomComponent,

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,7 +13,7 @@ var utils_1 = require("../../utils");

var MarkerContentRenderer_1 = require("./MarkerContentRenderer");
var MarkupNodesChildAppender = function (child) { return function (nodes) { return nodes.slice(0, -1).concat(nodes
var MarkupNodesChildAppender = function (child) { return function (nodes) { return __spreadArrays(nodes.slice(0, -1), nodes
.slice(-1)
.map(function (_a) {
var markup = _a.markup, children = _a.children;
return ({ markup: markup, children: children.concat([child]) });
return ({ markup: markup, children: __spreadArrays(children, [child]) });
})); }; };

@@ -17,3 +24,3 @@ var MarkerMarkupNodesOpener = function (_a) {

var openMarkupIndexes = _a[1];
return function (nodes) { return nodes.concat(openMarkupIndexes.map(function (markupIndex) { return ({
return function (nodes) { return __spreadArrays(nodes, openMarkupIndexes.map(function (markupIndex) { return ({
markup: markups[markupIndex],

@@ -30,6 +37,6 @@ children: []

return markup
? MarkupRenderer_1.default({ createElement: createElement, getMarkupComponent: getMarkupComponent })(markup, children.concat([
? MarkupRenderer_1.default({ createElement: createElement, getMarkupComponent: getMarkupComponent })(markup, __spreadArrays(children, [
innerNode
]))
: children.concat([innerNode]);
: __spreadArrays(children, [innerNode]);
}, []);

@@ -36,0 +43,0 @@ };

@@ -10,4 +10,4 @@ "use strict";

return function (_a) {
var _b;
var typeIdentifier = _a[0], value = _a[3];
var _b;
return ((_b = {},

@@ -14,0 +14,0 @@ _b[Mobiledoc_1.MarkerTypeIdentifier.TEXT] = function (text) { return text; },

@@ -13,2 +13,9 @@ "use strict";

};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -20,3 +27,3 @@ var utils_1 = require("../../../utils");

return index % 2 !== 0
? __assign({}, accumulator, (_a = {}, _a[attributesArray[index - 1]] = value, _a)) : accumulator;
? __assign(__assign({}, accumulator), (_a = {}, _a[attributesArray[index - 1]] = value, _a)) : accumulator;
}, {});

@@ -28,6 +35,6 @@ };

var tagName = _a[0], _b = _a[1], attributesArray = _b === void 0 ? [] : _b;
return createElement.apply(void 0, [getMarkupComponent(tagName) ||
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(tagName) ||
utils_1.throwError("Unhandled element: the markup tag name `'" + tagName + "'` has no corresponding handler."),
attributesArrayToAttributes(attributesArray)].concat(children));
attributesArrayToAttributes(attributesArray)], children));
};
});
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,5 +18,5 @@ var utils_1 = require("../../utils");

var tagName = _a[1], markers = _a[2];
return createElement.apply(void 0, [getMarkupComponent(tagName) ||
return createElement.apply(void 0, __spreadArrays([getMarkupComponent(tagName) ||
utils_1.throwError("Unhandled element: the markup section `'" + tagName + "'` has no corresponding handler."),
{}].concat(MarkersRenderer_1.default({ createElement: createElement, getAtomComponent: getAtomComponent, getMarkupComponent: getMarkupComponent })({
{}], MarkersRenderer_1.default({ createElement: createElement, getAtomComponent: getAtomComponent, getMarkupComponent: getMarkupComponent })({
markups: markups,

@@ -16,0 +23,0 @@ atoms: atoms

export declare type Node = any;
export declare type Component = (properties: object) => Node;
export declare type ElementType = string | Component;
export declare type CreateElement = (elementType: ElementType, properties?: object, ...children: Node[]) => Node;
export declare type CreateElement = (elementType: ElementType, properties?: object | null, ...children: Node[]) => Node;
export default CreateElement;

@@ -13,2 +13,9 @@ "use strict";

};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -22,8 +29,8 @@ var _0_3_1 = require("../../types/Mobiledoc/0.3");

? {
cards: cards.concat([[section[1], section[2]]]),
sections: sections.concat([
cards: __spreadArrays(cards, [[section[1], section[2]]]),
sections: __spreadArrays(sections, [
[_0_3_1.SectionTypeIdentifier.CARD, cards.length]
])
}
: { cards: cards, sections: sections.concat([section]) };
: { cards: cards, sections: __spreadArrays(sections, [section]) };
}, { cards: [], sections: [] }))); };

@@ -61,7 +68,7 @@ /* Upgrade markers by adding `typeIdentifier` */

};
var upgradeSections = function (mobiledoc) { return (__assign({}, mobiledoc, { sections: mobiledoc.sections.map(upgradeSection) })); };
var upgradeSections = function (mobiledoc) { return (__assign(__assign({}, mobiledoc), { sections: mobiledoc.sections.map(upgradeSection) })); };
/* Add atoms */
var addAtoms = function (mobiledoc) { return (__assign({}, mobiledoc, { atoms: [] })); };
var addAtoms = function (mobiledoc) { return (__assign(__assign({}, mobiledoc), { atoms: [] })); };
/* Update the version */
var setVersion = function (targetVersion) { return function (mobiledoc) { return (__assign({}, mobiledoc, { version: targetVersion })); }; };
var setVersion = function (targetVersion) { return function (mobiledoc) { return (__assign(__assign({}, mobiledoc), { version: targetVersion })); }; };
var updateVersion = setVersion(TARGET_VERSION);

@@ -68,0 +75,0 @@ /* Upgrade Mobiledoc 0.2.x to 0.3.x */

{
"name": "mobiledoc-vdom-renderer",
"version": "1.0.0",
"version": "1.0.1",
"description": "Render Mobiledoc as VDOM, for React or React-like `createElement` calls",

@@ -54,18 +54,18 @@ "author": "Donald Tetto <donald@tetto.org>",

"eslint-plugin-fp": "^2.3.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"jsdom": "^12.0.0",
"nyc": "^12.0.2",
"preact": "^8.3.1",
"preact": "^8.5.2",
"preact-render-to-string": "^3.8.2",
"prettier": "^1.14.2",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"prettier": "^1.18.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"tslint": "^5.20.0",
"tslint-config-standard": "^8.0.1",
"typescript": "^3.0.3",
"typescript": "^3.6.3",
"typescript-eslint-parser": "^18.0.0",

@@ -72,0 +72,0 @@ "ultradom": "^2.3.4"

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