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

ditox-react

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ditox-react - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

4

dist/browser/index.d.ts

@@ -7,3 +7,3 @@ import { Container, Token, ModuleDeclaration, Module } from 'ditox';

*/
declare type DependencyContainerBinder = (container: Container) => unknown;
type DependencyContainerBinder = (container: Container) => unknown;
/**

@@ -14,3 +14,3 @@ * Specifies an existed container or options for a new container:

*/
declare type DependencyContainerParams = {
type DependencyContainerParams = {
children: ReactNode;

@@ -17,0 +17,0 @@ root?: boolean;

@@ -7,3 +7,3 @@ import type { Container } from 'ditox';

*/
export declare type DependencyContainerBinder = (container: Container) => unknown;
export type DependencyContainerBinder = (container: Container) => unknown;
/**

@@ -14,3 +14,3 @@ * Specifies an existed container or options for a new container:

*/
export declare type DependencyContainerParams = {
export type DependencyContainerParams = {
children: ReactNode;

@@ -17,0 +17,0 @@ root?: boolean;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -7,3 +7,3 @@ import type { Container } from 'ditox';

*/
export declare type DependencyContainerBinder = (container: Container) => unknown;
export type DependencyContainerBinder = (container: Container) => unknown;
/**

@@ -14,3 +14,3 @@ * Specifies an existed container or options for a new container:

*/
export declare type DependencyContainerParams = {
export type DependencyContainerParams = {
children: ReactNode;

@@ -17,0 +17,0 @@ root?: boolean;

@@ -7,3 +7,3 @@ import { Container, Token, ModuleDeclaration, Module } from 'ditox';

*/
declare type DependencyContainerBinder = (container: Container) => unknown;
type DependencyContainerBinder = (container: Container) => unknown;
/**

@@ -14,3 +14,3 @@ * Specifies an existed container or options for a new container:

*/
declare type DependencyContainerParams = {
type DependencyContainerParams = {
children: ReactNode;

@@ -17,0 +17,0 @@ root?: boolean;

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("ditox"),require("react")):"function"==typeof define&&define.amd?define(["exports","ditox","react"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).DitoxReact={},e.Ditox,e.React)}(this,(function(e,n,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(t),u=t.createContext(void 0);function i(e){var r=e.children,i=e.root,c=e.binder,d=t.useContext(u),f=t.useMemo((function(){var e=n.createContainer(i?void 0:d);return null==c||c(e),e}),[c,d,i]);return t.useEffect((function(){return function(){return f.removeAll()}}),[f]),o.default.createElement(u.Provider,{value:f},r)}function c(e){var n=t.useContext(u);if(!n&&"strict"===e)throw new Error("Container is not provided by DependencyContainer component");return n}e.DependencyContainer=i,e.DependencyModule=function(e){var r=e.children,u=e.module,c=e.scope,d=t.useCallback((function(e){return n.bindModule(e,u,{scope:c})}),[u,c]);return o.default.createElement(i,{binder:d},r)},e.useDependency=function(e){var n=c("strict");return t.useMemo((function(){return n.resolve(e)}),[n,e])},e.useDependencyContainer=c,e.useOptionalDependency=function(e){var n=c();return t.useMemo((function(){return null==n?void 0:n.get(e)}),[n,e])},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("ditox"),require("react")):"function"==typeof define&&define.amd?define(["exports","ditox","react"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).DitoxReact={},e.Ditox,e.React)}(this,(function(e,n,t){"use strict";var r=t.createContext(void 0);function o(e){var o=e.children,i=e.root,u=e.binder,c=t.useContext(r),d=t.useMemo((function(){var e=n.createContainer(i?void 0:c);return null==u||u(e),e}),[u,c,i]);return t.useEffect((function(){return function(){return d.removeAll()}}),[d]),t.createElement(r.Provider,{value:d},o)}function i(e){var n=t.useContext(r);if(!n&&"strict"===e)throw new Error("Container is not provided by DependencyContainer component");return n}e.DependencyContainer=o,e.DependencyModule=function(e){var r=e.children,i=e.module,u=e.scope,c=t.useCallback((function(e){return n.bindModule(e,i,{scope:u})}),[i,u]);return t.createElement(o,{binder:c},r)},e.useDependency=function(e){var n=i("strict");return t.useMemo((function(){return n.resolve(e)}),[n,e])},e.useDependencyContainer=i,e.useOptionalDependency=function(e){var n=i();return t.useMemo((function(){return null==n?void 0:n.get(e)}),[n,e])}}));
//# sourceMappingURL=index.js.map

@@ -7,3 +7,3 @@ ditox-react

### Type aliases
### Type Aliases

@@ -48,8 +48,16 @@ - [DependencyContainerBinder](README.md#dependencycontainerbinder)

### Other Functions
### Hook
Returns a dependency container, or `undefined` in case the container is not provided. Functions
- [useDependencyContainer](README.md#usedependencycontainer)
## Type aliases
### Hook
Returns a dependency container. Throws an error in case the container is not provided. Functions
- [useDependencyContainer](README.md#usedependencycontainer)
## Type Aliases
### DependencyContainerBinder

@@ -67,4 +75,4 @@

| Name | Type |
| :------ | :------ |
| Name | Type |
| :---------- | :---------- |
| `container` | `Container` |

@@ -78,5 +86,5 @@

[DependencyContainer.tsx:19](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/DependencyContainer.tsx#L19)
[DependencyContainer.tsx:19](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/DependencyContainer.tsx#L19)
___
---

@@ -89,17 +97,21 @@ ### DependencyContainerParams

**`property`** binder - A callback which setup bindings to the container.
**`Property`**
**`property`** root - If `true` then a new container does not depend on any parent containers
A callback which setup bindings to the container.
**`Property`**
If `true` then a new container does not depend on any parent containers
#### Type declaration
| Name | Type |
| :------ | :------ |
| `binder?` | [`DependencyContainerBinder`](README.md#dependencycontainerbinder) |
| `children` | `ReactNode` |
| `root?` | `boolean` |
| Name | Type |
| :--------- | :----------------------------------------------------------------- |
| `binder?` | [`DependencyContainerBinder`](README.md#dependencycontainerbinder) |
| `children` | `ReactNode` |
| `root?` | `boolean` |
#### Defined in
[DependencyContainer.tsx:26](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/DependencyContainer.tsx#L26)
[DependencyContainer.tsx:26](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/DependencyContainer.tsx#L26)

@@ -116,3 +128,3 @@ ## Component

**`example`**
**`Example`**

@@ -133,8 +145,8 @@ ```tsx

| Name | Type | Description |
| :------ | :------ | :------ |
| `params` | `Object` | - |
| `params.children` | `ReactNode` | - |
| `params.module` | `ModuleDeclaration`<`Module`<`Record`<`string`, `unknown`\>\>\> | Module declaration for binding |
| `params.scope?` | ``"scoped"`` \| ``"singleton"`` | Optional scope for binding: `singleton` (default) or `scoped`. |
| Name | Type | Description |
| :---------------- | :-------------------------------------------------------------- | :------------------------------------------------------------- |
| `params` | `Object` | - |
| `params.children` | `ReactNode` | - |
| `params.module` | `ModuleDeclaration`<`Module`<`Record`<`string`, `unknown`\>\>\> | Module declaration for binding |
| `params.scope?` | `"scoped"` \| `"singleton"` | Optional scope for binding: `singleton` (default) or `scoped`. |

@@ -147,5 +159,5 @@ #### Returns

[DependencyModule.tsx:33](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/DependencyModule.tsx#L33)
[DependencyModule.tsx:33](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/DependencyModule.tsx#L33)
___
---

@@ -169,3 +181,3 @@ ## Component

**`example`**
**`Example`**

@@ -190,4 +202,4 @@ ```tsx

| Name | Type |
| :------ | :------ |
| Name | Type |
| :------- | :----------------------------------------------------------------- |
| `params` | [`DependencyContainerParams`](README.md#dependencycontainerparams) |

@@ -201,5 +213,5 @@

[DependencyContainer.tsx:68](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/DependencyContainer.tsx#L68)
[DependencyContainer.tsx:68](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/DependencyContainer.tsx#L68)
___
---

@@ -217,9 +229,9 @@ ## Hook

| Name |
| :------ |
| `T` |
| :--- |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| Name | Type |
| :------ | :------------ |
| `token` | `Token`<`T`\> |

@@ -233,5 +245,5 @@

[hooks.ts:52](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/hooks.ts#L52)
[hooks.ts:52](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/hooks.ts#L52)
___
---

@@ -249,9 +261,9 @@ ## Hook

| Name |
| :------ |
| `T` |
| :--- |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| Name | Type |
| :------ | :------------ |
| `token` | `Token`<`T`\> |

@@ -265,8 +277,10 @@

[hooks.ts:41](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/hooks.ts#L41)
[hooks.ts:41](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/hooks.ts#L41)
___
---
## Other Functions
## Hook
Returns a dependency container, or &#x60;undefined&#x60; in case the container is not provided. Functions
### useDependencyContainer

@@ -276,11 +290,7 @@

**`category`** Hook
Returns a dependency container. Throws an error in case the container is not provided.
#### Parameters
| Name | Type |
| :------ | :------ |
| `mode` | ``"strict"`` |
| Name | Type |
| :----- | :--------- |
| `mode` | `"strict"` |

@@ -293,18 +303,54 @@ #### Returns

[hooks.ts:10](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/hooks.ts#L10)
[hooks.ts:10](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/hooks.ts#L10)
▸ **useDependencyContainer**(`mode?`): `Container` \| `undefined`
**`category`** Hook
#### Parameters
Returns a dependency container, or `undefined` in case the container is not provided.
| Name | Type |
| :------ | :----------- |
| `mode?` | `"optional"` |
#### Returns
`Container` \| `undefined`
#### Defined in
[hooks.ts:16](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/hooks.ts#L16)
---
## Hook
Returns a dependency container. Throws an error in case the container is not provided. Functions
### useDependencyContainer
▸ **useDependencyContainer**(`mode`): `Container`
#### Parameters
| Name | Type |
| :------ | :------ |
| `mode?` | ``"optional"`` |
| Name | Type |
| :----- | :--------- |
| `mode` | `"strict"` |
#### Returns
`Container`
#### Defined in
[hooks.ts:10](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/hooks.ts#L10)
▸ **useDependencyContainer**(`mode?`): `Container` \| `undefined`
#### Parameters
| Name | Type |
| :------ | :----------- |
| `mode?` | `"optional"` |
#### Returns
`Container` \| `undefined`

@@ -314,2 +360,2 @@

[hooks.ts:16](https://github.com/mnasyrov/ditox/blob/a821171/packages/ditox-react/src/hooks.ts#L16)
[hooks.ts:16](https://github.com/mnasyrov/ditox/blob/37f658c/packages/ditox-react/src/hooks.ts#L16)
{
"name": "ditox-react",
"version": "2.2.0",
"version": "2.3.0",
"description": "Ditox.js tooling for React.js",

@@ -54,16 +54,15 @@ "publishConfig": {

"dependencies": {
"ditox": "2.2.0"
"ditox": "2.3.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@testing-library/react": "12.1.2",
"@testing-library/react-hooks": "7.0.2",
"@types/react": "17.0.38",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-test-renderer": "17.0.2"
"@testing-library/react": "13.4.0",
"@types/react": "18.0.26",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-test-renderer": "18.2.0"
},
"gitHead": "f9d1e2d369a00fb12ad62cbb9aa6039104c4cbe3"
"gitHead": "3d34ea7a89e0bb599fa2d9dbfa67e75ec68bfba2"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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