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

@bem-react/di

Package Overview
Dependencies
Maintainers
7
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 3.1.1 to 5.0.0

12

build/di.development.js

@@ -52,3 +52,3 @@ 'use strict';

// TODO: Use setDisplayName util.
RegistryResolver.displayName = "RegistryResolver(" + resolverValue + ")";
RegistryResolver.displayName = "RegistryResolver(".concat(resolverValue, ")");
}

@@ -61,3 +61,3 @@ return RegistryResolver;

if (!registries[props.id]) {
throw new Error("Registry with id '" + props.id + "' not found.");
throw new Error("Registry with id '".concat(props.id, "' not found."));
}

@@ -74,6 +74,6 @@ }

};
var useRegistry = function (id) {
function useRegistry(id) {
var registries = useRegistries();
return registries[id].snapshot();
};
}
/**

@@ -83,3 +83,3 @@ * @deprecated consider using 'useRegistry' instead

var useComponentRegistry = useRegistry;
var registryOverloadMark = 'RegistryOverloadHMark';
var registryOverloadMark = 'RegistryOverloadMark';
function withOverload(overload) {

@@ -140,3 +140,3 @@ return {

if (!this.entities[id]) {
throw new Error("Entry with id '" + id + "' not found.");
throw new Error("Entry with id '".concat(id, "' not found."));
}

@@ -143,0 +143,0 @@ }

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

'use strict';function e(e){return{$symbol:f,overload:e}}function t(e){return e.$symbol===f}Object.defineProperty(exports,'__esModule',{value:!0});var r=require('react'),n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=r.createContext({}),o=i.Consumer,s=i.Provider,u=function(e){return r.createElement(o,null,function(t){return e.children(t[e.id].snapshot())})},a=u,l=function(){return r.useContext(i)},c=function(e){return l()[e].snapshot()},p=c,f='RegistryOverloadHMark',h=function(){function r(e){var t=e.id,r=e.overridable,n=void 0===r||r;this.entities={},this.id=t,this.overridable=n}return r.prototype.set=function(e,t){return this.entities[e]=t,this},r.prototype.extends=function(t,r){return this.entities[t]=e(r),this},r.prototype.fill=function(e){for(var t in e)this.entities[t]=e[t];return this},r.prototype.get=function(e){return this.entities[e]},r.prototype.snapshot=function(){return this.entities},r.prototype.merge=function(e){var t=new r({id:this.id,overridable:this.overridable});if(t.fill(this.entities),!e)return t;var n=e.snapshot();for(var i in n)n.hasOwnProperty(i)&&(t.entities[i]=this.mergeEntities(t.entities[i],n[i]));return t},r.prototype.mergeEntities=function(r,n){return t(n)&&r?t(r)?e(function(e){return n.overload(r.overload(e))}):n.overload(r):n},r}();exports.ComponentRegistryConsumer=a,exports.Registry=h,exports.RegistryConsumer=u,exports.registryContext=i,exports.useComponentRegistry=p,exports.useRegistries=l,exports.useRegistry=c,exports.withRegistry=function(){var e=[].slice.call(arguments);return function(t){return function(i){var u=r.useRef(null);return r.createElement(o,null,function(o){if(null===u.current){for(var a=n({},o),l=0;l<e.length;l++){var c=e[l],p=a[c.id];a[c.id]=c.overridable?p?c.merge(p):c:c&&p?p.merge(c):c}u.current=a}return r.createElement(s,{value:u.current},r.createElement(t,i))})}}};
'use strict';function e(e){return c()[e].snapshot()}function t(e){return{$symbol:f,overload:e}}function r(e){return e.$symbol===f}Object.defineProperty(exports,'__esModule',{value:!0});var n=require('react'),i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=n.createContext({}),s=o.Consumer,u=o.Provider,a=function(e){return n.createElement(s,null,function(t){return e.children(t[e.id].snapshot())})},l=a,c=function(){return n.useContext(o)},p=e,f='RegistryOverloadMark',h=function(){function e(e){var t=e.id,r=e.overridable,n=void 0===r||r;this.entities={},this.id=t,this.overridable=n}return e.prototype.set=function(e,t){return this.entities[e]=t,this},e.prototype.extends=function(e,r){return this.entities[e]=t(r),this},e.prototype.fill=function(e){for(var t in e)this.entities[t]=e[t];return this},e.prototype.get=function(e){return this.entities[e]},e.prototype.snapshot=function(){return this.entities},e.prototype.merge=function(t){var r=new e({id:this.id,overridable:this.overridable});if(r.fill(this.entities),!t)return r;var n=t.snapshot();for(var i in n)n.hasOwnProperty(i)&&(r.entities[i]=this.mergeEntities(r.entities[i],n[i]));return r},e.prototype.mergeEntities=function(e,n){return r(n)&&e?r(e)?t(function(t){return n.overload(e.overload(t))}):n.overload(e):n},e}();exports.ComponentRegistryConsumer=l,exports.Registry=h,exports.RegistryConsumer=a,exports.registryContext=o,exports.useComponentRegistry=p,exports.useRegistries=c,exports.useRegistry=e,exports.withRegistry=function(){var e=[].slice.call(arguments);return function(t){return function(r){var o=n.useRef(null);return n.createElement(s,null,function(s){if(null===o.current){for(var a=i({},s),l=0;l<e.length;l++){var c=e[l],p=a[c.id];a[c.id]=c.overridable?p?c.merge(p):c:c&&p?p.merge(c):c}o.current=a}return n.createElement(u,{value:o.current},n.createElement(t,r))})}}};

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

# [5.0.0](https://github.com/bem/bem-react/compare/@bem-react/di@3.1.1...@bem-react/di@5.0.0) (2022-12-15)
### Bug Fixes
- types ([17ab34b](https://github.com/bem/bem-react/commit/17ab34b168c5f5904b6a9b87c0fbb7f9a071cf0a))
### Features
- update to react@18 ([f08e4d6](https://github.com/bem/bem-react/commit/f08e4d686d7891e4356859932ee18812700a4e27))
# [4.0.0](https://github.com/bem/bem-react/compare/@bem-react/di@3.1.1...@bem-react/di@4.0.0) (2022-12-15)
### Bug Fixes
- types ([17ab34b](https://github.com/bem/bem-react/commit/17ab34b168c5f5904b6a9b87c0fbb7f9a071cf0a))
### Features
- update to react@18 ([f08e4d6](https://github.com/bem/bem-react/commit/f08e4d686d7891e4356859932ee18812700a4e27))
## [3.1.1](https://github.com/bem/bem-react/compare/@bem-react/di@3.1.0...@bem-react/di@3.1.1) (2021-06-29)

@@ -8,0 +28,0 @@

import React, { ReactNode, FC, ComponentType } from 'react';
export declare type RegistryContext = Record<string, Registry>;
export declare const registryContext: React.Context<Record<string, Registry>>;
export declare function withRegistry(...registries: Registry[]): <P>(Component: ComponentType<P>) => FC<P>;
export type RegistryContext = Record<string, Registry>;
export declare const registryContext: React.Context<RegistryContext>;
export declare function withRegistry(...registries: Registry[]): <P extends {}>(Component: ComponentType<P>) => FC<P>;
export interface IRegistryConsumerProps {

@@ -13,9 +13,9 @@ id: string;

*/
export declare const ComponentRegistryConsumer: React.FunctionComponent<IRegistryConsumerProps>;
export declare const useRegistries: () => Record<string, Registry>;
export declare const useRegistry: <T extends {}>(id: string) => T;
export declare const ComponentRegistryConsumer: React.FC<IRegistryConsumerProps>;
export declare const useRegistries: () => RegistryContext;
export declare function useRegistry(id: string): IRegistryEntities;
/**
* @deprecated consider using 'useRegistry' instead
*/
export declare const useComponentRegistry: <T extends {}>(id: string) => T;
export declare const useComponentRegistry: typeof useRegistry;
export interface IRegistryOptions {

@@ -25,4 +25,4 @@ id: string;

}
declare const registryOverloadMark = "RegistryOverloadHMark";
declare type SimpleOverload<T> = (Base: T) => T;
declare const registryOverloadMark = "RegistryOverloadMark";
type SimpleOverload<T> = (Base: T) => T;
interface IRegistryEntityOverload<T> {

@@ -32,4 +32,4 @@ $symbol: typeof registryOverloadMark;

}
declare type IRegistryEntity<T = any> = T | IRegistryEntityOverload<T>;
export declare type IRegistryEntities = Record<string, IRegistryEntity>;
type IRegistryEntity<T = any> = T | IRegistryEntityOverload<T>;
export type IRegistryEntities = Record<string, IRegistryEntity>;
export declare class Registry {

@@ -69,3 +69,3 @@ id: string;

*/
snapshot<RT>(): RT;
snapshot(): IRegistryEntities;
/**

@@ -72,0 +72,0 @@ * Override entities by external registry.

{
"name": "@bem-react/di",
"version": "3.1.1",
"version": "5.0.0",
"description": "BEM React Dependency Injection",

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

"peerDependencies": {
"react": "^16.8.0 || ^17.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"gitHead": "442128551bfd755e87aa9ea63dca4677c7e64709"
"gitHead": "21fc8d684380fd84c2dd7e6540a047251eb32a07"
}
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