@bem-react/di
Advanced tools
Comparing version 2.2.4 to 2.2.5
@@ -34,3 +34,3 @@ 'use strict'; | ||
var registry = registries[i]; | ||
var overrides = contextRegistries[registry.id]; | ||
var overrides = providedRegistries[registry.id]; | ||
// eslint-disable-next-line no-nested-ternary | ||
@@ -37,0 +37,0 @@ providedRegistries[registry.id] = registry.overridable |
@@ -1,1 +0,1 @@ | ||
'use strict';function t(t){var e=function(){throw new Error("Not found base component for enhance HOC: "+t.toString())};return e.$symbol=c,e.hoc=t,e}function e(t){return t.$symbol===c}Object.defineProperty(exports,'__esModule',{value:1});var n=require('react'),r=function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])({}).hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=n.createContext({}),i=o.Provider,s=o.Consumer,u=function(){return n.useContext(o)},c='RegistryHoc',p=function(){function n(t){var e=t.id,n=t.overridable,r=void 0===n?1:n;this.components={},this.id=e,this.overridable=r}return n.prototype.set=function(t,e){return this.components[t]=e,this},n.prototype.extends=function(e,n){return this.components[e]=t(n),this},n.prototype.fill=function(t){for(var e in t)this.components[e]=t[e];return this},n.prototype.get=function(t){return this.components[t]},n.prototype.snapshot=function(){return this.components},n.prototype.merge=function(t){var e=new n({id:this.id,overridable:this.overridable});if(e.fill(this.components),!t)return e;var r=t.snapshot();for(var o in r)r.hasOwnProperty(o)&&(e.components[o]=this.mergeComponents(e.components[o],r[o]));return e},n.prototype.mergeComponents=function(n,r){return e(r)&&n?e(n)?t(function(t){return r.hoc(n.hoc(t))}):r.hoc(n):r},n}();exports.ComponentRegistryConsumer=function(t){return n.createElement(s,null,function(e){return t.children(e[t.id].snapshot())})},exports.Registry=p,exports.RegistryConsumer=s,exports.registryContext=o,exports.useComponentRegistry=function(t){return u()[t].snapshot()},exports.useRegistries=u,exports.withRegistry=function(){var t=[].slice.call(arguments);return function(e){return function(o){var u=n.useRef(null);return n.createElement(s,null,function(s){if(null===u.current){for(var c=r({},s),p=0;p<t.length;p++){var a=t[p],f=s[a.id];c[a.id]=a.overridable?f?a.merge(f):a:a&&f?f.merge(a):a}u.current=c}return n.createElement(i,{value:u.current},n.createElement(e,o))})}}}; | ||
'use strict';function t(t){var e=function(){throw new Error("Not found base component for enhance HOC: "+t.toString())};return e.$symbol=c,e.hoc=t,e}function e(t){return t.$symbol===c}Object.defineProperty(exports,'__esModule',{value:1});var n=require('react'),r=function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])({}).hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=n.createContext({}),i=o.Provider,s=o.Consumer,u=function(){return n.useContext(o)},c='RegistryHoc',p=function(){function n(t){var e=t.id,n=t.overridable,r=void 0===n?1:n;this.components={},this.id=e,this.overridable=r}return n.prototype.set=function(t,e){return this.components[t]=e,this},n.prototype.extends=function(e,n){return this.components[e]=t(n),this},n.prototype.fill=function(t){for(var e in t)this.components[e]=t[e];return this},n.prototype.get=function(t){return this.components[t]},n.prototype.snapshot=function(){return this.components},n.prototype.merge=function(t){var e=new n({id:this.id,overridable:this.overridable});if(e.fill(this.components),!t)return e;var r=t.snapshot();for(var o in r)r.hasOwnProperty(o)&&(e.components[o]=this.mergeComponents(e.components[o],r[o]));return e},n.prototype.mergeComponents=function(n,r){return e(r)&&n?e(n)?t(function(t){return r.hoc(n.hoc(t))}):r.hoc(n):r},n}();exports.ComponentRegistryConsumer=function(t){return n.createElement(s,null,function(e){return t.children(e[t.id].snapshot())})},exports.Registry=p,exports.RegistryConsumer=s,exports.registryContext=o,exports.useComponentRegistry=function(t){return u()[t].snapshot()},exports.useRegistries=u,exports.withRegistry=function(){var t=[].slice.call(arguments);return function(e){return function(o){var u=n.useRef(null);return n.createElement(s,null,function(s){if(null===u.current){for(var c=r({},s),p=0;p<t.length;p++){var a=t[p],f=c[a.id];c[a.id]=a.overridable?f?a.merge(f):a:a&&f?f.merge(a):a}u.current=c}return n.createElement(i,{value:u.current},n.createElement(e,o))})}}}; |
@@ -6,2 +6,8 @@ # Change Log | ||
## [2.2.5](https://github.com/bem/bem-react/compare/@bem-react/di@2.2.4...@bem-react/di@2.2.5) (2020-11-13) | ||
### Bug Fixes | ||
- **di:** fixed merge of registries with same id ([0706c4a](https://github.com/bem/bem-react/commit/0706c4ad5117c3107df24d42abe8b67eebbec30c)) | ||
## [2.2.4](https://github.com/bem/bem-react/compare/@bem-react/di@2.2.3...@bem-react/di@2.2.4) (2020-04-02) | ||
@@ -8,0 +14,0 @@ |
{ | ||
"name": "@bem-react/di", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"description": "BEM React Dependency Injection", | ||
@@ -49,3 +49,3 @@ "homepage": "https://github.com/bem/bem-react/tree/master/packages/di", | ||
}, | ||
"gitHead": "05800170cddaa0f6bef4808c6de3adbf0982c16c" | ||
"gitHead": "08764e692bd10c1931b02ccad63a521f535c1ba8" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43906