microcosm
Advanced tools
Comparing version 12.3.0 to 12.3.1
@@ -184,3 +184,2 @@ 'use strict'; | ||
exports.extract = extract; | ||
exports['default'] = indexing; |
@@ -1,1 +0,1 @@ | ||
"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r.default:r}function t(r){return""===r||null===r||void 0===r}function e(r){return Array.isArray(r)?r:t(r)?[]:"string"==typeof r?r.split(l):[r]}function n(r){var t=r;return Array.isArray(r)===!1&&(t=(""+t).split(a)),t.map(e)}function o(r,t,e){return t.reduce(function(t,e){return u.set(t,e,u.get(r,e))},e||{})}Object.defineProperty(exports,"__esModule",{value:!0});var u=require("../microcosm.js"),i=r(u),l=".",a=",",s=function(){i.prototype.index=function(r,t){for(var e=arguments.length,i=Array(e>2?e-2:0),l=2;l<e;l++)i[l-2]=arguments[l];var a=this,s=n(t),f=null,p=null,c=null,y=function(){for(var r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];if(a.state!==f){f=a.state;var n=o(f,s,p);n!==p&&(p=n,c=i.reduce(function(r,t){return t.call(a,r,f)},p))}return t.reduce(function(r,t){return t.call(a,r,f)},c)};return this.indexes=u.set(this.indexes||{},r,y),y},i.prototype.lookup=function(r){var t=u.get(this.indexes,r);if(null==t){if(this.parent)return this.parent.lookup(r);throw new TypeError("Unable to find missing index "+r)}return t},i.prototype.compute=function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return this.lookup(r).apply(void 0,e)},i.prototype.memo=function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];var o=this.lookup(r),u=null,i=null;return function(){var r=o();return r!==u&&(u=r,i=o.apply(void 0,e)),i}}};exports.extract=o,exports.default=s; | ||
"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r.default:r}function t(r){return""===r||null===r||void 0===r}function n(r){return Array.isArray(r)?r:t(r)?[]:"string"==typeof r?r.split(l):[r]}function e(r){var t=r;return Array.isArray(r)===!1&&(t=(""+t).split(a)),t.map(n)}function o(r,t,n){return t.reduce(function(t,n){return u.set(t,n,u.get(r,n))},n||{})}Object.defineProperty(exports,"__esModule",{value:!0});var u=require("../microcosm.js"),i=r(u),l=".",a=",",f=function(){i.prototype.index=function(r,t){for(var n=arguments.length,i=Array(n>2?n-2:0),l=2;l<n;l++)i[l-2]=arguments[l];var a=this,f=e(t),s=null,p=null,c=null,y=function(){for(var r=arguments.length,t=Array(r),n=0;n<r;n++)t[n]=arguments[n];if(a.state!==s){s=a.state;var e=o(s,f,p);e!==p&&(p=e,c=i.reduce(function(r,t){return t.call(a,r,s)},p))}return t.reduce(function(r,t){return t.call(a,r,s)},c)};return this.indexes=u.set(this.indexes||{},r,y),y},i.prototype.lookup=function(r){var t=u.get(this.indexes,r);if(null==t){if(this.parent)return this.parent.lookup(r);throw new TypeError("Unable to find missing index "+r)}return t},i.prototype.compute=function(r){for(var t=arguments.length,n=Array(t>1?t-1:0),e=1;e<t;e++)n[e-1]=arguments[e];return this.lookup(r).apply(void 0,n)},i.prototype.memo=function(r){for(var t=arguments.length,n=Array(t>1?t-1:0),e=1;e<t;e++)n[e-1]=arguments[e];var o=this.lookup(r),u=null,i=null;return function(){var r=o();return r!==u&&(u=r,i=o.apply(void 0,n)),i}}};exports.default=f; |
@@ -199,6 +199,9 @@ 'use strict'; | ||
// tag intent first so the interceptor keys off the right key | ||
var taggedIntent = Microcosm.tag(intent); | ||
var interceptors = this.presenter.intercept(); | ||
// A presenter's register goes through the same registration steps | ||
var handler = Microcosm.getRegistration(interceptors, Microcosm.tag(intent), 'resolve'); | ||
var handler = Microcosm.getRegistration(interceptors, taggedIntent, 'resolve'); | ||
@@ -205,0 +208,0 @@ // Does the presenter register to this intent? |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function t(){return this.props.children?o.Children.only(this.props.children):null}function r(e,s){o.PureComponent.apply(this,arguments),this.render!==r.prototype.render?(this.defaultRender=this.render,this.render=r.prototype.render):this.defaultRender=t,this.send=this.send.bind(this)}function s(e,t){o.PureComponent.apply(this,arguments),this.presenter=e.presenter,this.repo=this.presenter._requestRepo(t.repo),this.send=this.send.bind(this),this.state={repo:this.repo,send:this.send}}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("../microcosm.js"),i=e(n),o=require("react"),p={};n.inherit(r,o.PureComponent,{_beginSetup:function(e){this.repo=e.repo,this.mediator=e,this.setup(this.repo,this.props,this.state),this.model=this._prepareModel(),this.ready(this.repo,this.props,this.state)},_beginTeardown:function(){this.teardown(this.repo,this.props,this.state)},_requestRepo:function(e){var t=this.props.repo||e,r=this.getRepo(t,this.props,this.state);return this.didFork=r!==t,r},_prepareModel:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return this.mediator.updateModel(e,t)},setup:function(e,t,r){},ready:function(e,t,r){},update:function(e,t,r){},teardown:function(e,t,r){},intercept:function(){return p},componentWillUpdate:function(e,t){this.model=this._prepareModel(e,t),this.update(this.repo,e,t)},getRepo:function(e,t){return e?e.fork():new i},send:function(){var e;return(e=this.mediator).send.apply(e,arguments)},getModel:function(e,t,r){return p},render:function(){return o.createElement(s,{presenter:this,parentState:this.state,parentProps:this.props})}}),n.inherit(s,o.PureComponent,{getChildContext:function(){return{repo:this.repo,send:this.send}},componentWillMount:function(){this.presenter.getModel!==r.prototype.getModel&&this.repo.on("change",this.setModel,this),this.presenter._beginSetup(this)},componentDidMount:function(){this.presenter.refs=this.refs},componentWillUnmount:function(){this.presenter.refs=this.refs,this.repo.off("change",this.setModel,this),this.presenter.didFork&&this.repo.teardown(),this.presenter._beginTeardown()},render:function(){this.presenter.model=this.state;var e=this.presenter.view;return null!=e?o.createElement(e,n.merge(this.presenter.props,this.state)):this.presenter.defaultRender()},updateModel:function(e,t){var r=this.presenter.getModel(e,t),s=this.repo.state,i={};this.propMap={};for(var o in r){var p=r[o];"function"==typeof p?(this.propMap[o]=p,i[o]=p(s)):i[o]=p}return this.setState(i),n.merge(this.state,i)},setModel:function(e){var t=this.state,r=null;for(var s in this.propMap){var n=this.propMap[s](e);t[s]!==n&&(r=r||{},r[s]=n)}null!==r&&this.setState(r)},hasParent:function(){return n.get(this.repo,"history")===n.get(this.context,["repo","history"])},send:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];var i=this.presenter.intercept(),o=n.getRegistration(i,n.tag(e),"resolve");return o?o.call.apply(o,[this.presenter,this.repo].concat(r)):this.hasParent()?this.context.send.apply(null,arguments):this.repo.push.apply(this.repo,arguments)}}),s.propTypes={repo:o.PropTypes.object},s.contextTypes={repo:o.PropTypes.object,send:o.PropTypes.func},s.childContextTypes={repo:o.PropTypes.object,send:o.PropTypes.func},exports.default=r; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function t(){return this.props.children?o.Children.only(this.props.children):null}function r(e,s){o.PureComponent.apply(this,arguments),this.render!==r.prototype.render?(this.defaultRender=this.render,this.render=r.prototype.render):this.defaultRender=t,this.send=this.send.bind(this)}function s(e,t){o.PureComponent.apply(this,arguments),this.presenter=e.presenter,this.repo=this.presenter._requestRepo(t.repo),this.send=this.send.bind(this),this.state={repo:this.repo,send:this.send}}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("../microcosm.js"),i=e(n),o=require("react"),p={};n.inherit(r,o.PureComponent,{_beginSetup:function(e){this.repo=e.repo,this.mediator=e,this.setup(this.repo,this.props,this.state),this.model=this._prepareModel(),this.ready(this.repo,this.props,this.state)},_beginTeardown:function(){this.teardown(this.repo,this.props,this.state)},_requestRepo:function(e){var t=this.props.repo||e,r=this.getRepo(t,this.props,this.state);return this.didFork=r!==t,r},_prepareModel:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return this.mediator.updateModel(e,t)},setup:function(e,t,r){},ready:function(e,t,r){},update:function(e,t,r){},teardown:function(e,t,r){},intercept:function(){return p},componentWillUpdate:function(e,t){this.model=this._prepareModel(e,t),this.update(this.repo,e,t)},getRepo:function(e,t){return e?e.fork():new i},send:function(){var e;return(e=this.mediator).send.apply(e,arguments)},getModel:function(e,t,r){return p},render:function(){return o.createElement(s,{presenter:this,parentState:this.state,parentProps:this.props})}}),n.inherit(s,o.PureComponent,{getChildContext:function(){return{repo:this.repo,send:this.send}},componentWillMount:function(){this.presenter.getModel!==r.prototype.getModel&&this.repo.on("change",this.setModel,this),this.presenter._beginSetup(this)},componentDidMount:function(){this.presenter.refs=this.refs},componentWillUnmount:function(){this.presenter.refs=this.refs,this.repo.off("change",this.setModel,this),this.presenter.didFork&&this.repo.teardown(),this.presenter._beginTeardown()},render:function(){this.presenter.model=this.state;var e=this.presenter.view;return null!=e?o.createElement(e,n.merge(this.presenter.props,this.state)):this.presenter.defaultRender()},updateModel:function(e,t){var r=this.presenter.getModel(e,t),s=this.repo.state,i={};this.propMap={};for(var o in r){var p=r[o];"function"==typeof p?(this.propMap[o]=p,i[o]=p(s)):i[o]=p}return this.setState(i),n.merge(this.state,i)},setModel:function(e){var t=this.state,r=null;for(var s in this.propMap){var n=this.propMap[s](e);t[s]!==n&&(r=r||{},r[s]=n)}null!==r&&this.setState(r)},hasParent:function(){return n.get(this.repo,"history")===n.get(this.context,["repo","history"])},send:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];var i=n.tag(e),o=this.presenter.intercept(),p=n.getRegistration(o,i,"resolve");return p?p.call.apply(p,[this.presenter,this.repo].concat(r)):this.hasParent()?this.context.send.apply(null,arguments):this.repo.push.apply(this.repo,arguments)}}),s.propTypes={repo:o.PropTypes.object},s.contextTypes={repo:o.PropTypes.object,send:o.PropTypes.func},s.childContextTypes={repo:o.PropTypes.object,send:o.PropTypes.func},exports.default=r; |
# Changelog | ||
## 12.3.1 | ||
- Fix bug where Presenters weren't intercepting actions sent from | ||
child views. | ||
## 12.3.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "microcosm", | ||
"version": "12.3.0", | ||
"version": "12.3.1", | ||
"description": "Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.", | ||
@@ -5,0 +5,0 @@ "main": "microcosm.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
225805
2018
1