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

@rmwc/base

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/base - npm Package Compare versions

Comparing version 3.0.0 to 3.0.4

23

foundation-component.d.ts

@@ -8,12 +8,13 @@ import * as React from 'react';

};
declare type PropsListT = {
addEventListener: (evtName: string, callback: Function) => void;
removeEventListener: (evtName: string, callback: Function) => void;
all: () => {
[key: string]: any;
};
get: (propName: string) => any;
add: (propName: string, value: any) => void;
remove: (propName: string) => void;
};
declare class PropsList {
update: Function;
props: {};
constructor(update: any);
add(propName: any, value: any): void;
remove(propName: any): void;
all(mergeProps?: Object): {};
get(attr: string): any;
addEventListener(evtName: any, callback: any): void;
removeEventListener(evtName: any, callback: any): void;
}
declare type FoundationPropsT<P> = P & React.HTMLAttributes<any> & React.HTMLProps<any>;

@@ -26,3 +27,3 @@ export declare class FoundationComponent<P> extends React.Component<FoundationPropsT<P>> {

propsList: {
[key: string]: PropsListT;
[key: string]: PropsList;
};

@@ -29,0 +30,0 @@ constructor(props: FoundationPropsT<P>);

@@ -8,2 +8,4 @@ 'use strict';

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
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; }; }();

@@ -25,8 +27,4 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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; }

@@ -36,2 +34,6 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var reactPropFromEventName = function reactPropFromEventName(evtName) {

@@ -41,2 +43,76 @@ return _eventsMap.eventsMap[evtName];

var PropsList = function () {
function PropsList(update) {
_classCallCheck(this, PropsList);
Object.defineProperty(this, 'props', {
enumerable: true,
writable: true,
value: {}
});
this.update = update;
}
_createClass(PropsList, [{
key: 'add',
value: function add(propName, value) {
this.props = Object.assign({}, this.props, _defineProperty({}, propName, value));
this.update();
}
}, {
key: 'remove',
value: function remove(propName) {
delete this.props[propName];
this.props = Object.assign({}, this.props);
this.update();
}
}, {
key: 'all',
value: function all(mergeProps) {
var _this = this;
if (mergeProps) {
var merged = Object.entries(mergeProps).reduce(function (acc, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
val = _ref2[1];
if (typeof _this.props[key] === 'function' && typeof val === 'function') {
var oldFunc = _this.props[key];
var wrappedFunc = function wrappedFunc(evt) {
oldFunc(evt);
val(evt);
};
acc[key] = wrappedFunc;
}
return acc;
}, {});
return Object.assign({}, this.props, merged);
}
return this.props;
}
}, {
key: 'get',
value: function get(attr) {
return this.props[attr];
}
}, {
key: 'addEventListener',
value: function addEventListener(evtName, callback) {
this.add(reactPropFromEventName(evtName), callback);
}
}, {
key: 'removeEventListener',
value: function removeEventListener(evtName, callback) {
this.remove(reactPropFromEventName(evtName));
}
}]);
return PropsList;
}();
var FoundationComponent = exports.FoundationComponent = function (_React$Component) {

@@ -48,5 +124,5 @@ _inherits(FoundationComponent, _React$Component);

var _this = _possibleConstructorReturn(this, (FoundationComponent.__proto__ || Object.getPrototypeOf(FoundationComponent)).call(this, props));
var _this2 = _possibleConstructorReturn(this, (FoundationComponent.__proto__ || Object.getPrototypeOf(FoundationComponent)).call(this, props));
Object.defineProperty(_this, 'classList', {
Object.defineProperty(_this2, 'classList', {
enumerable: true,

@@ -56,3 +132,3 @@ writable: true,

});
Object.defineProperty(_this, 'propsList', {
Object.defineProperty(_this2, 'propsList', {
enumerable: true,

@@ -63,4 +139,4 @@ writable: true,

_this.foundation_ = _this.getDefaultFoundation();
return _this;
_this2.foundation_ = _this2.getDefaultFoundation();
return _this2;
}

@@ -71,3 +147,3 @@

value: function createClassList(elementName) {
var _this2 = this;
var _this3 = this;

@@ -77,3 +153,3 @@ var classes = new Set();

renderToString: function renderToString() {
return (0, _classnames2.default)(elementName === 'root_' && _this2.props.className, [].concat(_toConsumableArray(classes)));
return (0, _classnames2.default)(elementName === 'root_' && _this3.props.className, [].concat(_toConsumableArray(classes)));
},

@@ -86,3 +162,3 @@ has: function has(className) {

classes.add(className);
_this2.setState({});
_this3.setState({});
}

@@ -93,3 +169,3 @@ },

classes.delete(className);
_this2.setState({});
_this3.setState({});
}

@@ -102,33 +178,7 @@ }

value: function createPropsList(elementName) {
var _this3 = this;
var _this4 = this;
var props = {};
var add = function add(propName, value) {
props = Object.assign({}, props, _defineProperty({}, propName, value));
_this3.setState({});
};
var remove = function remove(propName) {
delete props[propName];
props = Object.assign({}, props);
_this3.setState({});
};
this.propsList[elementName] = {
addEventListener: function addEventListener(evtName, callback) {
add(reactPropFromEventName(evtName), callback);
},
removeEventListener: function removeEventListener(evtName, callback) {
remove(reactPropFromEventName(evtName));
},
all: function all() {
return props;
},
add: add,
remove: remove,
get: function get(attr) {
return props[attr];
}
};
this.propsList[elementName] = new PropsList(function () {
return _this4.setState({});
});
}

@@ -135,0 +185,0 @@ }, {

{
"name": "@rmwc/base",
"version": "3.0.0",
"version": "3.0.4",
"description": "RMWC base module",

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

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