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

@bem-react/di

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bem-react/di - npm Package Compare versions

Comparing version 2.0.4 to 2.1.0

9

build/di.development.js

@@ -83,2 +83,11 @@ 'use strict';

/**
* Set react components in registry via object literal.
*
* @param componentsSet set of valid react components
*/
Registry.prototype.fill = function (componentsSet) {
this.components = __assign({}, this.components, componentsSet);
return this;
};
/**
* Get react component from registry by id.

@@ -85,0 +94,0 @@ *

2

build/di.production.min.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),__assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},registryContext=React.createContext({}),RegistryProvider=registryContext.Provider,RegistryConsumer=registryContext.Consumer;function withRegistry(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var r=function(r){return React.createElement(RegistryConsumer,null,function(n){var s=__assign({},n);return e.forEach(function(e){var t=n[e.id];s[e.id]=e.overridable?t?e.merge(t):e:e&&t?t.merge(e):e}),React.createElement(RegistryProvider,{value:s},React.createElement(t,__assign({},r)))})};return r.displayName="RegistryResolver("+e.map(function(e){return e.id}).join(", ")+")",r}}var ComponentRegistryConsumer=function(e){return React.createElement(RegistryConsumer,null,function(t){return e.children(t[e.id].snapshot())})},useRegistries=function(){return React.useContext(registryContext)},useComponentRegistry=function(e){return useRegistries()[e].snapshot()},Registry=function(){function e(e){var t=e.id,r=e.overridable,n=void 0===r||r;this.components={},this.id=t,this.overridable=n}return e.prototype.set=function(e,t){return this.components[e]=t,this},e.prototype.get=function(e){return this.components[e]},e.prototype.snapshot=function(){return this.components},e.prototype.merge=function(t){var r=new e({id:this.id,overridable:this.overridable});return r.components=__assign({},this.components,t?t.snapshot():{}),r},e}();exports.ComponentRegistryConsumer=ComponentRegistryConsumer,exports.Registry=Registry,exports.RegistryConsumer=RegistryConsumer,exports.registryContext=registryContext,exports.useComponentRegistry=useComponentRegistry,exports.useRegistries=useRegistries,exports.withRegistry=withRegistry;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),__assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},registryContext=React.createContext({}),RegistryProvider=registryContext.Provider,RegistryConsumer=registryContext.Consumer;function withRegistry(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var r=function(r){return React.createElement(RegistryConsumer,null,function(n){var s=__assign({},n);return e.forEach(function(e){var t=n[e.id];s[e.id]=e.overridable?t?e.merge(t):e:e&&t?t.merge(e):e}),React.createElement(RegistryProvider,{value:s},React.createElement(t,__assign({},r)))})};return r.displayName="RegistryResolver("+e.map(function(e){return e.id}).join(", ")+")",r}}var ComponentRegistryConsumer=function(e){return React.createElement(RegistryConsumer,null,function(t){return e.children(t[e.id].snapshot())})},useRegistries=function(){return React.useContext(registryContext)},useComponentRegistry=function(e){return useRegistries()[e].snapshot()},Registry=function(){function e(e){var t=e.id,r=e.overridable,n=void 0===r||r;this.components={},this.id=t,this.overridable=n}return e.prototype.set=function(e,t){return this.components[e]=t,this},e.prototype.fill=function(e){return this.components=__assign({},this.components,e),this},e.prototype.get=function(e){return this.components[e]},e.prototype.snapshot=function(){return this.components},e.prototype.merge=function(t){var r=new e({id:this.id,overridable:this.overridable});return r.components=__assign({},this.components,t?t.snapshot():{}),r},e}();exports.ComponentRegistryConsumer=ComponentRegistryConsumer,exports.Registry=Registry,exports.RegistryConsumer=RegistryConsumer,exports.registryContext=registryContext,exports.useComponentRegistry=useComponentRegistry,exports.useRegistries=useRegistries,exports.withRegistry=withRegistry;

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

# [2.1.0](https://github.com/bem/bem-react/compare/@bem-react/di@2.0.4...@bem-react/di@2.1.0) (2019-12-02)
### Features
- **di:** fill registry with components via object literal ([a4f69c5](https://github.com/bem/bem-react/commit/a4f69c5c12e4bdf31c66994174d75fd82bc76674))
## [2.0.4](https://github.com/bem/bem-react/compare/@bem-react/di@2.0.3...@bem-react/di@2.0.4) (2019-10-02)

@@ -8,0 +14,0 @@

@@ -17,2 +17,5 @@ import React, { ReactNode, FC, ComponentType } from 'react';

}
interface IRegistryComponents {
[key: string]: any;
}
export declare class Registry {

@@ -31,2 +34,8 @@ id: string;

/**
* Set react components in registry via object literal.
*
* @param componentsSet set of valid react components
*/
fill(componentsSet: IRegistryComponents): this;
/**
* Get react component from registry by id.

@@ -48,1 +57,2 @@ *

}
export {};
{
"name": "@bem-react/di",
"version": "2.0.4",
"version": "2.1.0",
"description": "BEM React Dependency Injection",

@@ -51,3 +51,3 @@ "homepage": "https://github.com/bem/bem-react/tree/master/packages/di",

},
"gitHead": "20fd7b03b006a70a0e998021e405dfd534a4bb00"
"gitHead": "e9d8011ed9f975b3b94dd710045d4027e1ad8cc2"
}

@@ -51,2 +51,20 @@ # @bem-react/di &middot; [![npm (scoped)](https://img.shields.io/npm/v/@bem-react/di.svg)](https://www.npmjs.com/package/@bem-react/di) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@bem-react/di.svg)](https://bundlephobia.com/result?p=@bem-react/di)

or
```ts
registry.fill({
Header,
Footer,
})
```
or
```ts
registry.fill({
'id-1': Header,
'id-2': Footer,
})
```
3. Export the App version with its registry of components:

@@ -53,0 +71,0 @@

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