New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

mjml-section

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mjml-section - npm Package Compare versions

Comparing version

to
4.0.0-alpha.4

@@ -8,10 +8,36 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _extends2 = require('babel-runtime/helpers/extends');
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _extends3 = _interopRequireDefault(_extends2);
var _class, _temp;
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _class, _temp2;
var _mjmlCore = require('mjml-core');
var _fp = require('lodash/fp');
var _widthParser2 = require('mjml-core/lib/helpers/widthParser');

@@ -23,18 +49,23 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var makeBackgroundString = (0, _fp.flow)((0, _fp.filter)(_fp.identity), (0, _fp.join)(' '));
var MjSection = (_temp2 = _class = function (_BodyComponent) {
(0, _inherits3.default)(MjSection, _BodyComponent);
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function MjSection() {
var _ref;
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _temp, _this, _ret;
var MjSection = (_temp = _class = function (_BodyComponent) {
_inherits(MjSection, _BodyComponent);
(0, _classCallCheck3.default)(this, MjSection);
function MjSection() {
_classCallCheck(this, MjSection);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _possibleConstructorReturn(this, (MjSection.__proto__ || Object.getPrototypeOf(MjSection)).apply(this, arguments));
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = MjSection.__proto__ || (0, _getPrototypeOf2.default)(MjSection)).call.apply(_ref, [this].concat(args))), _this), _this.getBackground = function () {
return makeBackgroundString([_this.getAttribute('background-color')].concat((0, _toConsumableArray3.default)(_this.hasBackground() ? ['url(' + _this.getAttribute('background-url') + ')', 'top center / ' + _this.getAttribute('background-size'), _this.getAttribute('background-repeat')] : [])));
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
_createClass(MjSection, [{
(0, _createClass3.default)(MjSection, [{
key: 'getChildContext',

@@ -50,6 +81,5 @@ value: function getChildContext() {

}),
unit = _widthParser.unit,
parsedWidth = _widthParser.parsedWidth;
return _extends({}, this.context, {
return (0, _extends3.default)({}, this.context, {
containerWidth: parsedWidth - paddingSize + 'px'

@@ -66,6 +96,3 @@ });

var background = this.getAttribute('background-url') ? {
background: ((this.getAttribute('background-color') || '') + ' url(' + this.getAttribute('background-url') + ') top center / ' + (this.getAttribute('background-size') || '') + ' ' + (this.getAttribute('background-repeat') || '')).trim(),
'background-color': this.getAttribute('background-color')
} : {
var background = this.getAttribute('background-url') ? this.getBackground() : {
background: this.getAttribute('background-color'),

@@ -76,7 +103,7 @@ 'background-color': this.getAttribute('background-color')

return {
tableFullwidth: _extends({}, fullWidth ? background : {}, {
tableFullwidth: (0, _extends3.default)({}, fullWidth ? background : {}, {
width: '100%',
'border-radius': this.getAttribute('border-radius')
}),
table: _extends({}, fullWidth ? {} : background, {
table: (0, _extends3.default)({}, fullWidth ? {} : background, {
width: '100%',

@@ -101,3 +128,3 @@ 'border-radius': this.getAttribute('border-radius')

},
div: _extends({}, fullWidth ? {} : background, {
div: (0, _extends3.default)({}, fullWidth ? {} : background, {
Margin: '0px auto',

@@ -144,2 +171,3 @@ 'border-radius': this.getAttribute('border-radius'),

value: function renderAfter() {
// eslint-disable-line class-methods-use-this
return '\n <!--[if mso | IE]>\n </td>\n </tr>\n </table>\n <![endif]-->\n ';

@@ -184,3 +212,3 @@ }

type: 'tile'
}) + ' />\n <v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0">\n <![endif]-->\n ' + content + '\n <!--[if mso | IE]>\n </v:textbox>\n </v:rect>\n <![endif]-->\n ';
}) + ' />\n <v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0">\n <![endif]-->\n ' + content + '\n <!--[if mso | IE]>\n </v:textbox>\n </v:rect>\n <![endif]-->\n ';
}

@@ -210,2 +238,4 @@ }, {

value: function renderFullWidth() {
var content = this.hasBackground() ? this.renderWithBackground('\n ' + this.renderBefore() + '\n ' + this.renderSection() + '\n ' + this.renderAfter() + '\n ') : '\n ' + this.renderBefore() + '\n ' + this.renderSection() + '\n ' + this.renderAfter() + '\n ';
return '\n <table\n ' + this.htmlAttributes({

@@ -220,3 +250,3 @@ align: 'center',

style: 'tableFullwidth'
}) + '\n >\n <tbody>\n <tr>\n <td>\n ' + (this.hasBackground() ? this.renderWithBackground('\n ' + this.renderBefore() + '\n ' + this.renderSection() + '\n ' + this.renderAfter() + '\n ') : '\n ' + this.renderBefore() + '\n ' + this.renderSection() + '\n ' + this.renderAfter() + '\n ') + '\n </td>\n </tr>\n </tbody>\n </table>\n ';
}) + '\n >\n <tbody>\n <tr>\n <td>\n ' + content + '\n </td>\n </tr>\n </tbody>\n </table>\n ';
}

@@ -236,3 +266,2 @@ }, {

}]);
return MjSection;

@@ -268,4 +297,4 @@ }(_mjmlCore.BodyComponent), _class.allowedAttributes = {

'vertical-align': 'top'
}, _temp);
}, _temp2);
exports.default = MjSection;
module.exports = exports['default'];
{
"name": "mjml-section",
"description": "mjml-section",
"version": "4.0.0-alpha.3",
"version": "4.0.0-alpha.4",
"main": "lib/index.js",

@@ -21,4 +21,4 @@ "repository": {

"lodash": "^4.17.2",
"mjml-core": "^4.0.0-alpha.3"
"mjml-core": "^4.0.0-alpha.4"
}
}

Sorry, the diff of this file is not supported yet