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

@enact/core

Package Overview
Dependencies
Maintainers
1
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enact/core - npm Package Compare versions

Comparing version 2.0.0-rc.3 to 2.0.0

8

CHANGELOG.md

@@ -5,2 +5,6 @@ # Change Log

## [2.0.0] - 2018-07-30
No significant changes.
## [2.0.0-rc.3] - 2018-07-23

@@ -123,2 +127,6 @@

## [1.13.4] - 2018-07-30
No significant changes.
## [1.13.3] - 2018-01-16

@@ -125,0 +133,0 @@

50

kind/kind.js

@@ -18,2 +18,6 @@ "use strict";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
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"); } }

@@ -91,7 +95,14 @@

propTypes = config.propTypes,
_render = config.render,
render = config.render,
cfgStyles = config.styles;
var renderStyles = cfgStyles ? (0, _styles.default)(cfgStyles) : false;
var renderComputed = cfgComputed ? (0, _computed.default)(cfgComputed) : false; // addition prop decorations would be chained here (after config.render)
var renderComputed = cfgComputed ? (0, _computed.default)(cfgComputed) : false;
var renderKind = function renderKind(props, context) {
if (renderStyles) props = renderStyles(props, context);
if (renderComputed) props = renderComputed(props, context);
return render(props, context);
}; // addition prop decorations would be chained here (after config.render)
var Component = (_temp = _class =

@@ -140,6 +151,3 @@ /*#__PURE__*/

value: function render() {
var p = Object.assign({}, this.props, this.handlers);
if (renderStyles) p = renderStyles(p, this.context);
if (renderComputed) p = renderComputed(p, this.context);
return _render(p, this.context);
return renderKind(_objectSpread({}, this.props, this.handlers), this.context);
}

@@ -172,2 +180,32 @@ }]);

if (process.env.NODE_ENV !== "production" && cfgComputed) Component.computed = cfgComputed;
var defaultPropKeys = defaultProps ? Object.keys(defaultProps) : null;
var handlerKeys = handlers ? Object.keys(handlers) : null;
Component.inline = function (props, context) {
var updated = _objectSpread({}, props);
if (defaultPropKeys && defaultPropKeys.length > 0) {
defaultPropKeys.forEach(function (key) {
// eslint-disable-next-line no-undefined
if (props == null || props[key] === undefined) {
updated[key] = defaultProps[key];
}
});
}
if (handlerKeys && handlerKeys.length > 0) {
// generate a handler with a clone of updated to ensure each handler receives the same
// props without the kind.handlers injected.
updated = handlerKeys.reduce(function (_props, key) {
_props[key] = function (ev) {
return handlers[key](ev, updated, context);
};
return _props;
}, _objectSpread({}, updated));
}
return renderKind(updated, context);
};
return Component;

@@ -174,0 +212,0 @@ };

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

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _extends() { _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; }; return _extends.apply(this, arguments); }

@@ -101,2 +103,43 @@

});
describe('inline', function () {
it('should support a minimal kind', function () {
var Minimal = (0, _kind.default)({
name: 'Minimal',
render: function render() {
return _react.default.createElement("div", null);
}
});
var component = Minimal.inline();
var expected = 'div';
var actual = component.type;
expect(actual).to.equal(expected);
});
it('should set default props when prop is not passed', function () {
var component = Kind.inline(); // since we're inlining the output, we have to reference where the label prop lands --
// the title prop of the <div> -- rather than the label prop on the component (which
// doesn't exist due to inlining).
var expected = 'Label';
var actual = component.props.title;
expect(actual).to.equal(expected);
});
it('should set default props when passed prop is undefined', function () {
var component = Kind.inline({
// explicitly testing settings undefined in this test case
// eslint-disable-next-line no-undefined
label: undefined
});
var expected = 'Label';
var actual = component.props.title;
expect(actual).to.equal(expected);
});
it('should include handlers', function () {
var component = Kind.inline();
var expected = 'function';
var actual = _typeof(component.props.onClick);
expect(actual).to.equal(expected);
});
});
});

2

package.json
{
"name": "@enact/core",
"version": "2.0.0-rc.3",
"version": "2.0.0",
"description": "Enact is an open source JavaScript framework containing everything you need to create a fast, scalable mobile or web application.",

@@ -5,0 +5,0 @@ "main": "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