@w3ux/hooks 2.1.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # Hooks
2
+
3
+ A collection of general purpose React hooks
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @w3ux/hooks
9
+ ```
10
+
11
+ or
12
+
13
+ ```bash
14
+ yarn add @w3ux/hooks
15
+ ```
16
+
17
+ or
18
+
19
+ ```bash
20
+ pnpm add @w3ux/hooks
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```typescript
26
+ import { /* your imports */ } from '@w3ux/hooks'
27
+ ```
28
+
29
+ ### React Usage
30
+
31
+ This package provides React hooks and components. Here's a basic example:
32
+
33
+ ```tsx
34
+ import React from 'react'
35
+ import { /* specific hook or component */ } from '@w3ux/hooks'
36
+
37
+ function MyComponent() {
38
+ // Use the imported hooks or components here
39
+ return <div>Your component content</div>
40
+ }
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ For comprehensive documentation and examples, visit the [w3ux documentation](https://w3ux.org/library/hooks/overview).
46
+
47
+ ## Keywords
48
+
49
+ `w3ux`, `polkadot`, `web3`, `react`, `hooks`, `typescript`
50
+
51
+ ## Repository
52
+
53
+ - **Source**: [GitHub](https://github.com/w3ux/w3ux-library)
54
+ - **Package**: [npm](https://www.npmjs.com/package/@w3ux/hooks)
55
+ - **Issues**: [GitHub Issues](https://github.com/w3ux/w3ux-library/issues)
56
+
57
+ ## License
58
+
59
+ This package is licensed under the GPL-3.0-only.
60
+
61
+ ---
62
+
63
+ Part of the [w3ux library](https://github.com/w3ux/w3ux-library) - A collection of packages for building Web3 applications.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useSafeContext.tsx"],"names":[],"mappings":";;;AAIA,iCAAiD;AAE1C,MAAM,cAAc,GAAG,CAAK,GAAyB,EAAK,EAAE;IACjE,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAPY,QAAA,cAAc,kBAO1B;AAEM,MAAM,iBAAiB,GAAG,GAAqC,EAAE;IACtE,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAW,IAAI,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,IAAA,sBAAc,EAAI,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC,CAAA;AAJY,QAAA,iBAAiB,qBAI7B","file":"useSafeContext.js","sourcesContent":["// Copyright 2025 @polkadot-cloud/polkadot-staking-dashboard authors & contributors\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport type { Context } from 'react'\nimport { createContext, useContext } from 'react'\n\nexport const useSafeContext = <T,>(ctx: T | null | undefined): T => {\n if (ctx === null || ctx === undefined) {\n throw new Error(\n 'Context value is null or undefined. Please ensure the context Provider is used correctly.'\n )\n }\n return ctx\n}\n\nexport const createSafeContext = <T,>(): [Context<T | null>, () => T] => {\n const Context = createContext<T | null>(null)\n const useHook = () => useSafeContext<T>(useContext(Context))\n return [Context, useHook]\n}\n"]}
1
+ {"version":3,"sources":["../src/useSafeContext.tsx"],"names":[],"mappings":";;;AAIA,iCAAiD;AAE1C,MAAM,cAAc,GAAG,CAAK,GAAyB,EAAK,EAAE;IACjE,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAPY,QAAA,cAAc,kBAO1B;AAEM,MAAM,iBAAiB,GAAG,GAAqC,EAAE;IACtE,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAW,IAAI,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,IAAA,sBAAc,EAAI,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC,CAAA;AAJY,QAAA,iBAAiB,qBAI7B","file":"useSafeContext.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport type { Context } from 'react'\nimport { createContext, useContext } from 'react'\n\nexport const useSafeContext = <T,>(ctx: T | null | undefined): T => {\n if (ctx === null || ctx === undefined) {\n throw new Error(\n 'Context value is null or undefined. Please ensure the context Provider is used correctly.'\n )\n }\n return ctx\n}\n\nexport const createSafeContext = <T,>(): [Context<T | null>, () => T] => {\n const Context = createContext<T | null>(null)\n const useHook = () => useSafeContext<T>(useContext(Context))\n return [Context, useHook]\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useSafeContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAK,GAAyB,EAAK,EAAE;IACjE,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAqC,EAAE;IACtE,MAAM,OAAO,GAAG,aAAa,CAAW,IAAI,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,cAAc,CAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC,CAAA","file":"useSafeContext.js","sourcesContent":["// Copyright 2025 @polkadot-cloud/polkadot-staking-dashboard authors & contributors\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport type { Context } from 'react'\nimport { createContext, useContext } from 'react'\n\nexport const useSafeContext = <T,>(ctx: T | null | undefined): T => {\n if (ctx === null || ctx === undefined) {\n throw new Error(\n 'Context value is null or undefined. Please ensure the context Provider is used correctly.'\n )\n }\n return ctx\n}\n\nexport const createSafeContext = <T,>(): [Context<T | null>, () => T] => {\n const Context = createContext<T | null>(null)\n const useHook = () => useSafeContext<T>(useContext(Context))\n return [Context, useHook]\n}\n"]}
1
+ {"version":3,"sources":["../src/useSafeContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAK,GAAyB,EAAK,EAAE;IACjE,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAqC,EAAE;IACtE,MAAM,OAAO,GAAG,aAAa,CAAW,IAAI,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,cAAc,CAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC,CAAA","file":"useSafeContext.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport type { Context } from 'react'\nimport { createContext, useContext } from 'react'\n\nexport const useSafeContext = <T,>(ctx: T | null | undefined): T => {\n if (ctx === null || ctx === undefined) {\n throw new Error(\n 'Context value is null or undefined. Please ensure the context Provider is used correctly.'\n )\n }\n return ctx\n}\n\nexport const createSafeContext = <T,>(): [Context<T | null>, () => T] => {\n const Context = createContext<T | null>(null)\n const useHook = () => useSafeContext<T>(useContext(Context))\n return [Context, useHook]\n}\n"]}
package/package.json CHANGED
@@ -1,13 +1,26 @@
1
1
  {
2
2
  "name": "@w3ux/hooks",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "license": "GPL-3.0-only",
5
- "dependencies": {
6
- "@w3ux/utils": "^2.0.8",
7
- "date-fns": "^4.1.0"
5
+ "type": "module",
6
+ "description": "A collection of general purpose React hooks",
7
+ "keywords": [
8
+ "w3ux",
9
+ "polkadot",
10
+ "web3",
11
+ "react",
12
+ "hooks",
13
+ "typescript"
14
+ ],
15
+ "homepage": "https://w3ux.org/library/hooks/overview",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/w3ux/w3ux-library.git",
19
+ "directory": "library/hooks"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/w3ux/w3ux-library/issues"
8
23
  },
9
- "main": "cjs/index.js",
10
- "module": "mjs/index.js",
11
24
  "exports": {
12
25
  ".": {
13
26
  "import": "./mjs/index.js",
@@ -18,6 +31,10 @@
18
31
  "require": "./cjs/util.js"
19
32
  }
20
33
  },
34
+ "dependencies": {
35
+ "@w3ux/utils": "^2.1.0",
36
+ "date-fns": "^4.1.0"
37
+ },
21
38
  "peerDependencies": {
22
39
  "react": "^19"
23
40
  }