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

gutenblock-controls

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gutenblock-controls - npm Package Compare versions

Comparing version 0.4.6 to 0.5.0

83

dist/repeat/index.js

@@ -33,9 +33,13 @@ 'use strict';

var getItems = function getItems(_ref) {
var attributes = _ref.attributes,
attribute = _ref.attribute;
return attributes && attributes[attribute] ? attributes[attribute] : [];
};
var Repeat = function (_React$Component) {
_inherits(Repeat, _React$Component);
function Repeat(_ref) {
var attribute = _ref.attribute,
attributes = _ref.attributes;
function Repeat() {
_classCallCheck(this, Repeat);

@@ -45,7 +49,5 @@

_this.add = _this.add.bind(_this);
_this.update = _this.update.bind(_this);
_this.delete = _this.delete.bind(_this);
var items = attributes && attributes[attribute] ? attributes[attribute] : [];
_this.state = { items: items.length };
return _this;

@@ -55,14 +57,18 @@ }

_createClass(Repeat, [{
key: 'add',
value: function add() {
var setAttributes = this.props.setAttributes;
setAttributes(_defineProperty({}, attribute, [].concat(_toConsumableArray(getItems(this.props)), [{}])));
}
}, {
key: 'update',
value: function update(name, value, tabId, onChange) {
var _props = this.props,
attribute = _props.attribute,
attributes = _props.attributes;
var currentAttributes = getItems(this.props);
var currentAttributes = attributes[attribute] || [];
var foundAttribute = currentAttributes.find(function (attr, index) {
return index === tabId;
});
var newAttributes = void 0;

@@ -78,5 +84,5 @@ if (!foundAttribute) newAttributes = [].concat(_toConsumableArray(currentAttributes), [_defineProperty({}, name, value)]);else newAttributes = currentAttributes.map(function (attr, index) {

value: function _delete(tabId, onChange) {
var _props2 = this.props,
attribute = _props2.attribute,
attributes = _props2.attributes;
var _props = this.props,
attribute = _props.attribute,
attributes = _props.attributes;

@@ -95,8 +101,8 @@

var _props3 = this.props,
attribute = _props3.attribute,
children = _props3.children,
setAttributes = _props3.setAttributes,
attributes = _props3.attributes,
_onChange = _props3.onChange;
var _props2 = this.props,
attribute = _props2.attribute,
children = _props2.children,
setAttributes = _props2.setAttributes,
attributes = _props2.attributes,
_onChange = _props2.onChange;

@@ -137,11 +143,12 @@

var items = this.state.items;
var _props4 = this.props,
style = _props4.style,
title = _props4.title,
indent = _props4.indent,
addNew = _props4.addNew,
max = _props4.max;
var _props3 = this.props,
style = _props3.style,
title = _props3.title,
indent = _props3.indent,
addNew = _props3.addNew,
max = _props3.max;
var items = getItems(this.props);
var repeats = [];

@@ -172,3 +179,7 @@ for (var item = 0; item < items; item++) {

onClick: function onClick() {
return _this3.setState({ items: items + 1 });
_this3.setState(function (prevState, props) {
return { items: prevState.items + 1 };
}, function () {
_this3.props.setAttributes && _this3.add();
});
}

@@ -187,13 +198,2 @@ },

}
}], [{
key: 'getDerivedStateFromProps',
value: function getDerivedStateFromProps(_ref3, state) {
var attributes = _ref3.attributes,
attribute = _ref3.attribute;
var items = attributes && attributes[attribute] ? attributes[attribute] : [];
if (items.length !== state.items) return { items: items.length };
return null;
}
}]);

@@ -218,2 +218,3 @@

reactHotLoader.register(Button, 'Button', 'src/repeat/index.js');
reactHotLoader.register(getItems, 'getItems', 'src/repeat/index.js');
reactHotLoader.register(Repeat, 'Repeat', 'src/repeat/index.js');

@@ -220,0 +221,0 @@ reactHotLoader.register(_default, 'default', 'src/repeat/index.js');

{
"name": "gutenblock-controls",
"version": "0.4.6",
"version": "0.5.0",
"description": "Useful inspector controls for gutenberg",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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