@venizia/ardor-react 0.1.1-0

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.
Files changed (75) hide show
  1. package/LICENSE.md +97 -0
  2. package/README.md +38 -0
  3. package/dist/common/index.d.ts +2 -0
  4. package/dist/common/index.d.ts.map +1 -0
  5. package/dist/common/index.js +2 -0
  6. package/dist/common/index.js.map +1 -0
  7. package/dist/common/types.d.ts +5 -0
  8. package/dist/common/types.d.ts.map +1 -0
  9. package/dist/common/types.js +2 -0
  10. package/dist/common/types.js.map +1 -0
  11. package/dist/contexts/application.d.ts +9 -0
  12. package/dist/contexts/application.d.ts.map +1 -0
  13. package/dist/contexts/application.js +7 -0
  14. package/dist/contexts/application.js.map +1 -0
  15. package/dist/contexts/index.d.ts +2 -0
  16. package/dist/contexts/index.d.ts.map +1 -0
  17. package/dist/contexts/index.js +2 -0
  18. package/dist/contexts/index.js.map +1 -0
  19. package/dist/hooks/index.d.ts +11 -0
  20. package/dist/hooks/index.d.ts.map +1 -0
  21. package/dist/hooks/index.js +11 -0
  22. package/dist/hooks/index.js.map +1 -0
  23. package/dist/hooks/redux/index.d.ts +3 -0
  24. package/dist/hooks/redux/index.d.ts.map +1 -0
  25. package/dist/hooks/redux/index.js +3 -0
  26. package/dist/hooks/redux/index.js.map +1 -0
  27. package/dist/hooks/redux/use-app-dispatch.d.ts +6 -0
  28. package/dist/hooks/redux/use-app-dispatch.d.ts.map +1 -0
  29. package/dist/hooks/redux/use-app-dispatch.js +21 -0
  30. package/dist/hooks/redux/use-app-dispatch.js.map +1 -0
  31. package/dist/hooks/redux/use-app-selector.d.ts +6 -0
  32. package/dist/hooks/redux/use-app-selector.d.ts.map +1 -0
  33. package/dist/hooks/redux/use-app-selector.js +17 -0
  34. package/dist/hooks/redux/use-app-selector.js.map +1 -0
  35. package/dist/hooks/use-application-context.d.ts +3 -0
  36. package/dist/hooks/use-application-context.d.ts.map +1 -0
  37. package/dist/hooks/use-application-context.js +22 -0
  38. package/dist/hooks/use-application-context.js.map +1 -0
  39. package/dist/hooks/use-autosave.d.ts +10 -0
  40. package/dist/hooks/use-autosave.d.ts.map +1 -0
  41. package/dist/hooks/use-autosave.js +42 -0
  42. package/dist/hooks/use-autosave.js.map +1 -0
  43. package/dist/hooks/use-before-unload.d.ts +6 -0
  44. package/dist/hooks/use-before-unload.d.ts.map +1 -0
  45. package/dist/hooks/use-before-unload.js +22 -0
  46. package/dist/hooks/use-before-unload.js.map +1 -0
  47. package/dist/hooks/use-confirm.d.ts +11 -0
  48. package/dist/hooks/use-confirm.d.ts.map +1 -0
  49. package/dist/hooks/use-confirm.js +29 -0
  50. package/dist/hooks/use-confirm.js.map +1 -0
  51. package/dist/hooks/use-copy-to-clipboard.d.ts +7 -0
  52. package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
  53. package/dist/hooks/use-copy-to-clipboard.js +20 -0
  54. package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
  55. package/dist/hooks/use-debounce.d.ts +10 -0
  56. package/dist/hooks/use-debounce.d.ts.map +1 -0
  57. package/dist/hooks/use-debounce.js +19 -0
  58. package/dist/hooks/use-debounce.js.map +1 -0
  59. package/dist/hooks/use-injectable.d.ts +17 -0
  60. package/dist/hooks/use-injectable.d.ts.map +1 -0
  61. package/dist/hooks/use-injectable.js +30 -0
  62. package/dist/hooks/use-injectable.js.map +1 -0
  63. package/dist/hooks/use-sizer.d.ts +7 -0
  64. package/dist/hooks/use-sizer.d.ts.map +1 -0
  65. package/dist/hooks/use-sizer.js +33 -0
  66. package/dist/hooks/use-sizer.js.map +1 -0
  67. package/dist/hooks/use-window-dimensions.d.ts +5 -0
  68. package/dist/hooks/use-window-dimensions.d.ts.map +1 -0
  69. package/dist/hooks/use-window-dimensions.js +21 -0
  70. package/dist/hooks/use-window-dimensions.js.map +1 -0
  71. package/dist/index.d.ts +4 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +4 -0
  74. package/dist/index.js.map +1 -0
  75. package/package.json +129 -0
package/LICENSE.md ADDED
@@ -0,0 +1,97 @@
1
+ # ARDOR Framework License
2
+
3
+ ARDOR is a TypeScript frontend application framework built on [IGNIS](https://ignis.venizia.ai) and
4
+ [React](https://react.dev/).
5
+
6
+ ## MIT License
7
+
8
+ Copyright (c) 2025 VENIZIA Ltd. Co.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ ---
29
+
30
+ ## Packages
31
+
32
+ This monorepo contains the following packages, all licensed under MIT:
33
+
34
+ | Package | Description |
35
+ |---------|-------------|
36
+ | `@venizia/ardor` | Umbrella entry point over the framework packages |
37
+ | `@venizia/ardor-kernel` | Isomorphic core - application base, services, network layer, utilities |
38
+ | `@venizia/ardor-react` | React bindings - application context, injectable and UI hooks |
39
+ | `@venizia/ardor-admin` | react-admin adapter - data, auth and i18n providers |
40
+ | `@venizia/ardor-ui-kit` | Design system - Tailwind and Radix components, design tokens |
41
+
42
+ ---
43
+
44
+ ## Third-Party Dependencies
45
+
46
+ ARDOR uses the following open-source libraries. We are grateful to the authors and contributors of
47
+ these projects.
48
+
49
+ ### Core Dependencies
50
+
51
+ | Library | License | Description |
52
+ |---------|---------|-------------|
53
+ | [IGNIS](https://github.com/VENIZIA-AI/ignis) | MIT | Inversion of control container and query filter vocabulary |
54
+ | [React](https://github.com/facebook/react) | MIT | User interface library |
55
+ | [react-admin](https://github.com/marmelab/react-admin) (`ra-core`) | MIT | Admin application framework |
56
+ | [reflect-metadata](https://github.com/rbuckton/reflect-metadata) | Apache-2.0 | Metadata reflection API |
57
+
58
+ ### Data and State Dependencies
59
+
60
+ | Library | License | Description |
61
+ |---------|---------|-------------|
62
+ | [Redux Toolkit](https://github.com/reduxjs/redux-toolkit) | MIT | State container |
63
+ | [React Redux](https://github.com/reduxjs/react-redux) | MIT | React bindings for Redux |
64
+ | [TanStack Query](https://github.com/TanStack/query) | MIT | Asynchronous state management |
65
+ | [React Router](https://github.com/remix-run/react-router) | MIT | Routing |
66
+ | [Axios](https://github.com/axios/axios) | MIT | HTTP client |
67
+ | [Socket.IO Client](https://github.com/socketio/socket.io) | MIT | Real-time bidirectional communication |
68
+ | [Lodash](https://github.com/lodash/lodash) | MIT | Utility library |
69
+ | [node-polyglot](https://github.com/airbnb/polyglot.js) (`ra-i18n-polyglot`) | BSD-2-Clause | Internationalisation |
70
+
71
+ ### UI Kit Dependencies
72
+
73
+ | Library | License | Description |
74
+ |---------|---------|-------------|
75
+ | [Tailwind CSS](https://github.com/tailwindlabs/tailwindcss) | MIT | Utility-first CSS framework |
76
+ | [Radix UI](https://github.com/radix-ui/primitives) | MIT | Unstyled, accessible component primitives |
77
+ | [Lucide](https://github.com/lucide-icons/lucide) | ISC | Icon set |
78
+ | [Day.js](https://github.com/iamkun/dayjs) | MIT | Date manipulation library |
79
+
80
+ ---
81
+
82
+ ## Acknowledgments
83
+
84
+ ARDOR is inspired by and built upon the work of many open-source projects:
85
+
86
+ - **[IGNIS](https://ignis.venizia.ai)** - The backend framework ARDOR is the frontend sibling of
87
+ - **[react-admin](https://marmelab.com/react-admin/)** by Marmelab - The admin framework ARDOR adapts
88
+ - **[LoopBack 4](https://loopback.io/)** by IBM/StrongLoop - Inspiration for the binding-key and provider patterns
89
+ - **[shadcn/ui](https://ui.shadcn.com/)** - Inspiration and source for the UI kit component layer
90
+
91
+ We thank all the maintainers and contributors of these projects for their excellent work.
92
+
93
+ ---
94
+
95
+ ## Contributing
96
+
97
+ By contributing to ARDOR, you agree that your contributions will be licensed under the MIT License.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @venizia/ardor-react
2
+
3
+ The React bindings of [ARDOR](https://github.com/VENIZIA-AI/ardor): the application context, the
4
+ hooks that resolve out of it, and the UI hooks. No react-admin.
5
+
6
+ ```bash
7
+ bun add @venizia/ardor-react @venizia/ardor-kernel @venizia/ignis-inversion
8
+ ```
9
+
10
+ Most applications install [`@venizia/ardor`](https://www.npmjs.com/package/@venizia/ardor) instead,
11
+ which re-exports this package.
12
+
13
+ ## What is in it
14
+
15
+ | Area | Exports |
16
+ |---|---|
17
+ | Context | `ApplicationContext`, `useApplicationContext`, `useApplicationLogger` |
18
+ | Injection | `useInjectable` - resolve a binding by key or by class |
19
+ | Redux | `createAppDispatch`, `createAppSelectors` - factories that bind your `RootState` and `AppDispatch` |
20
+ | UI hooks | `useDebounce`, `useAutosave`, `useConfirm`, `useBeforeUnload`, `useCopyToClipboard`, `useSizer`, `useWindowDimensions` |
21
+ | Types | `SyncFC`, `TUseInjectableKeys` |
22
+
23
+ ## Typing your own binding keys
24
+
25
+ `IUseInjectableKeysOverrides` is declared here, so augment this package - an interface merges only
26
+ into the module that declares it, never through a re-export:
27
+
28
+ ```typescript
29
+ declare module '@venizia/ardor-react' {
30
+ interface IUseInjectableKeysOverrides {
31
+ 'services.ProductApi': unknown;
32
+ }
33
+ }
34
+ ```
35
+
36
+ ## License
37
+
38
+ MIT - see [LICENSE.md](./LICENSE.md).
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface SyncFC<P = {}> {
3
+ (props: P): ReactNode;
4
+ }
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,EAAE;IAC5B,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { type Container } from '@venizia/ignis-inversion';
3
+ import { type Logger } from '@venizia/ardor-kernel';
4
+ export declare const ApplicationContext: React.Context<{
5
+ container: Container | null;
6
+ registry: Container | null;
7
+ logger: Logger | null;
8
+ }>;
9
+ //# sourceMappingURL=application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/contexts/application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,eAAO,MAAM,kBAAkB;eAClB,SAAS,GAAG,IAAI;cACjB,SAAS,GAAG,IAAI;YAClB,MAAM,GAAG,IAAI;EAKrB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export const ApplicationContext = React.createContext({
3
+ container: null,
4
+ registry: null,
5
+ logger: null,
6
+ });
7
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/contexts/application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAIlD;IACD,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;CACb,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './application';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './application';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from './redux';
2
+ export * from './use-application-context';
3
+ export * from './use-autosave';
4
+ export * from './use-before-unload';
5
+ export * from './use-confirm';
6
+ export * from './use-copy-to-clipboard';
7
+ export * from './use-debounce';
8
+ export * from './use-injectable';
9
+ export * from './use-sizer';
10
+ export * from './use-window-dimensions';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from './redux';
2
+ export * from './use-application-context';
3
+ export * from './use-autosave';
4
+ export * from './use-before-unload';
5
+ export * from './use-confirm';
6
+ export * from './use-copy-to-clipboard';
7
+ export * from './use-debounce';
8
+ export * from './use-injectable';
9
+ export * from './use-sizer';
10
+ export * from './use-window-dimensions';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './use-app-dispatch';
2
+ export * from './use-app-selector';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/redux/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './use-app-dispatch';
2
+ export * from './use-app-selector';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/redux/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type Dispatch, type UnknownAction } from '@reduxjs/toolkit';
2
+ export declare const createAppDispatch: <D extends Dispatch<UnknownAction> = Dispatch<UnknownAction>>() => {
3
+ useAppDispatch: import("react-redux").UseDispatch<D>;
4
+ useMultipleAppDispatch: () => (...actions: Parameters<D>[0][]) => void;
5
+ };
6
+ //# sourceMappingURL=use-app-dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-dispatch.d.ts","sourceRoot":"","sources":["../../../src/hooks/redux/use-app-dispatch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGrE,eAAO,MAAM,iBAAiB,GAC5B,CAAC,SAAS,QAAQ,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC;;+CAU1C,kBAAoB;CAiBtC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { useDispatch } from 'react-redux';
3
+ export const createAppDispatch = () => {
4
+ const useAppDispatch = useDispatch.withTypes();
5
+ const useMultipleAppDispatch = () => {
6
+ const dispatch = useAppDispatch();
7
+ const multipleDispatch = React.useCallback((...actions) => {
8
+ actions.forEach((action) => {
9
+ if (action) {
10
+ dispatch(action);
11
+ }
12
+ });
13
+ }, [dispatch]);
14
+ return multipleDispatch;
15
+ };
16
+ return {
17
+ useAppDispatch,
18
+ useMultipleAppDispatch,
19
+ };
20
+ };
21
+ //# sourceMappingURL=use-app-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-dispatch.js","sourceRoot":"","sources":["../../../src/hooks/redux/use-app-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAE7B,EAAE;IACJ,MAAM,cAAc,GAAG,WAAW,CAAC,SAAS,EAAK,CAAC;IAElD,MAAM,sBAAsB,GAAG,GAAG,EAAE;QAClC,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;QAIlC,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACxC,CAAC,GAAG,OAA6B,EAAE,EAAE;YACnC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,IAAI,MAAM,EAAE,CAAC;oBACX,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO;QACL,cAAc;QACd,sBAAsB;KACvB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const createAppSelectors: <S>() => {
2
+ useAppSelector: import("react-redux").UseSelector<S>;
3
+ useShallowEqualSelector: <T>(selector: (state: S) => T) => T;
4
+ useDeepEqualSelector: <T>(selector: (state: S) => T) => T;
5
+ };
6
+ //# sourceMappingURL=use-app-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-selector.d.ts","sourceRoot":"","sources":["../../../src/hooks/redux/use-app-selector.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,GAAI,CAAC;;8BAGD,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC;2BAI/B,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC;CAS3D,CAAC"}
@@ -0,0 +1,17 @@
1
+ import isEqual from 'lodash/isEqual';
2
+ import { shallowEqual, useSelector } from 'react-redux';
3
+ export const createAppSelectors = () => {
4
+ const useAppSelector = useSelector.withTypes();
5
+ const useShallowEqualSelector = (selector) => {
6
+ return useAppSelector(selector, shallowEqual);
7
+ };
8
+ const useDeepEqualSelector = (selector) => {
9
+ return useAppSelector(selector, isEqual);
10
+ };
11
+ return {
12
+ useAppSelector,
13
+ useShallowEqualSelector,
14
+ useDeepEqualSelector,
15
+ };
16
+ };
17
+ //# sourceMappingURL=use-app-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-selector.js","sourceRoot":"","sources":["../../../src/hooks/redux/use-app-selector.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAM,EAAE;IACxC,MAAM,cAAc,GAAG,WAAW,CAAC,SAAS,EAAK,CAAC;IAElD,MAAM,uBAAuB,GAAG,CAAI,QAAyB,EAAE,EAAE;QAC/D,OAAO,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,CAAI,QAAyB,EAAE,EAAE;QAC5D,OAAO,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,OAAO;QACL,cAAc;QACd,uBAAuB;QACvB,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const useApplicationContext: () => import("@venizia/ignis-inversion").Container;
2
+ export declare const useApplicationLogger: () => import("@venizia/ardor-kernel").Logger;
3
+ //# sourceMappingURL=use-application-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-application-context.d.ts","sourceRoot":"","sources":["../../src/hooks/use-application-context.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,oDAUjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,8CAUhC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { getError } from '@venizia/ignis-inversion';
3
+ import { ApplicationContext } from '../contexts/application';
4
+ export const useApplicationContext = () => {
5
+ const rs = React.useContext(ApplicationContext);
6
+ if (!rs?.container) {
7
+ throw getError({
8
+ message: '[useApplicationContext] must be used within a ApplicationContextProvider',
9
+ });
10
+ }
11
+ return rs.container;
12
+ };
13
+ export const useApplicationLogger = () => {
14
+ const rs = React.useContext(ApplicationContext);
15
+ if (!rs?.logger) {
16
+ throw getError({
17
+ message: '[useApplicationLogger] must be used within a ApplicationContextProvider',
18
+ });
19
+ }
20
+ return rs.logger;
21
+ };
22
+ //# sourceMappingURL=use-application-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-application-context.js","sourceRoot":"","sources":["../../src/hooks/use-application-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEhD,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC;QACnB,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,0EAA0E;SACpF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,CAAC,SAAS,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEhD,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC;QAChB,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,yEAAyE;SACnF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,CAAC,MAAM,CAAC;AACnB,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface IUseAutosaveParams<TData, TReturn> {
2
+ data: TData;
3
+ onSave: (data: TData) => Promise<TReturn> | TReturn | void;
4
+ /** @default 2000 */
5
+ interval?: number;
6
+ enableSaveOnUnmount?: boolean;
7
+ disabled?: boolean;
8
+ }
9
+ export declare const useAutosave: <TData, TReturn>(params: IUseAutosaveParams<TData, TReturn>) => void;
10
+ //# sourceMappingURL=use-autosave.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-autosave.d.ts","sourceRoot":"","sources":["../../src/hooks/use-autosave.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB,CAAC,KAAK,EAAE,OAAO;IAChD,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAC3D,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,GAAI,KAAK,EAAE,OAAO,EAAE,QAAQ,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,SA4CrF,CAAC"}
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { useDebounce } from './use-debounce';
3
+ export const useAutosave = (params) => {
4
+ const { data, onSave, interval = 2000, enableSaveOnUnmount, disabled } = params;
5
+ const valueOnCleanup = React.useRef(data);
6
+ const initialRender = React.useRef(true);
7
+ const handleSave = React.useRef(onSave);
8
+ const { debouncedValue: debouncedValueToSave } = useDebounce({
9
+ value: data,
10
+ delay: interval,
11
+ disabled,
12
+ });
13
+ React.useEffect(() => {
14
+ if (initialRender.current) {
15
+ initialRender.current = false;
16
+ return;
17
+ }
18
+ Promise.resolve(handleSave.current(debouncedValueToSave)).catch((error) => {
19
+ console.error('[useAutosave] Failed to save debounced value | error: %s', error);
20
+ });
21
+ return () => { };
22
+ }, [debouncedValueToSave]);
23
+ React.useEffect(() => {
24
+ valueOnCleanup.current = data;
25
+ return () => { };
26
+ }, [data]);
27
+ React.useEffect(() => {
28
+ handleSave.current = onSave;
29
+ return () => { };
30
+ }, [onSave]);
31
+ React.useEffect(() => {
32
+ return () => {
33
+ if (!enableSaveOnUnmount) {
34
+ return;
35
+ }
36
+ Promise.resolve(handleSave.current(valueOnCleanup.current)).catch((error) => {
37
+ console.error('[useAutosave] Failed to save value on unmount | error: %s', error);
38
+ });
39
+ };
40
+ }, [enableSaveOnUnmount]);
41
+ };
42
+ //# sourceMappingURL=use-autosave.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-autosave.js","sourceRoot":"","sources":["../../src/hooks/use-autosave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAW7C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAiB,MAA0C,EAAE,EAAE;IACxF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAEhF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,EAAE,cAAc,EAAE,oBAAoB,EAAE,GAAG,WAAW,CAAC;QAC3D,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,QAAQ;QACf,QAAQ;KACT,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;YAC1B,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;YAC9B,OAAO;QACT,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACjF,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,KAAK,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAE3B,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;QAC9B,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC;QAC5B,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACzB,OAAO;YACT,CAAC;YACD,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBACnF,OAAO,CAAC,KAAK,CAAC,2DAA2D,EAAE,KAAK,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC5B,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface IUseBeforeUnloadParams {
2
+ enabled: boolean | (() => boolean);
3
+ message?: string;
4
+ }
5
+ export declare const useBeforeUnload: (params: IUseBeforeUnloadParams) => void;
6
+ //# sourceMappingURL=use-before-unload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-before-unload.d.ts","sourceRoot":"","sources":["../../src/hooks/use-before-unload.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,sBAAsB,SA2B7D,CAAC"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export const useBeforeUnload = (params) => {
3
+ const { enabled, message } = params;
4
+ const handleBeforeUnload = React.useCallback((event) => {
5
+ const isEnabled = enabled instanceof Function ? enabled() : enabled;
6
+ if (!isEnabled) {
7
+ return;
8
+ }
9
+ event.preventDefault();
10
+ if (message) {
11
+ event.returnValue = message;
12
+ }
13
+ return message;
14
+ }, [enabled, message]);
15
+ React.useEffect(() => {
16
+ window.addEventListener('beforeunload', handleBeforeUnload);
17
+ return () => {
18
+ window.removeEventListener('beforeunload', handleBeforeUnload);
19
+ };
20
+ }, [handleBeforeUnload]);
21
+ };
22
+ //# sourceMappingURL=use-before-unload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-before-unload.js","sourceRoot":"","sources":["../../src/hooks/use-before-unload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAA8B,EAAE,EAAE;IAChE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAC1C,CAAC,KAAwB,EAAE,EAAE;QAC3B,MAAM,SAAS,GAAG,OAAO,YAAY,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACpE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,KAAK,CAAC,cAAc,EAAE,CAAC;QAEvB,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;QAC9B,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,CAAC,OAAO,EAAE,OAAO,CAAC,CACnB,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAC5D,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QACjE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface IUseConfirmReturn {
2
+ message?: string;
3
+ confirm: (opts: {
4
+ message: string;
5
+ }) => Promise<boolean>;
6
+ handleClose: () => void;
7
+ handleConfirm: () => void;
8
+ handleAbort: () => void;
9
+ }
10
+ export declare const useConfirm: () => IUseConfirmReturn;
11
+ //# sourceMappingURL=use-confirm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-confirm.d.ts","sourceRoot":"","sources":["../../src/hooks/use-confirm.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,UAAU,QAAO,iBAgC7B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ export const useConfirm = () => {
3
+ const [resolve, setResolve] = React.useState();
4
+ const [message, setMessage] = React.useState();
5
+ const confirm = React.useCallback((opts) => {
6
+ return new Promise((_resolve) => {
7
+ setResolve(() => {
8
+ return (value) => {
9
+ return _resolve(value);
10
+ };
11
+ });
12
+ setMessage(opts.message);
13
+ });
14
+ }, []);
15
+ const handleClose = React.useCallback(() => {
16
+ setResolve(undefined);
17
+ setMessage(undefined);
18
+ }, []);
19
+ const handleConfirm = React.useCallback(() => {
20
+ resolve?.(true);
21
+ handleClose();
22
+ }, [handleClose, resolve]);
23
+ const handleAbort = React.useCallback(() => {
24
+ resolve?.(false);
25
+ handleClose();
26
+ }, [handleClose, resolve]);
27
+ return { message, confirm, handleClose, handleConfirm, handleAbort };
28
+ };
29
+ //# sourceMappingURL=use-confirm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-confirm.js","sourceRoot":"","sources":["../../src/hooks/use-confirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAsB,EAAE;IAChD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,EAA4B,CAAC;IAEzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAEvD,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,IAAyB,EAAE,EAAE;QAC9D,OAAO,IAAI,OAAO,CAAU,CAAC,QAAQ,EAAE,EAAE;YACvC,UAAU,CAAC,GAAG,EAAE;gBACd,OAAO,CAAC,KAAc,EAAE,EAAE;oBACxB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACzB,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,UAAU,CAAC,SAAS,CAAC,CAAC;QACtB,UAAU,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC3C,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QAChB,WAAW,EAAE,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3B,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACjB,WAAW,EAAE,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AACvE,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface IUseCopyToClipboardReturn {
2
+ copy: (opts: {
3
+ value: string;
4
+ }) => Promise<boolean>;
5
+ }
6
+ export declare const useCopyToClipboard: () => IUseCopyToClipboardReturn;
7
+ //# sourceMappingURL=use-copy-to-clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-copy-to-clipboard.d.ts","sourceRoot":"","sources":["../../src/hooks/use-copy-to-clipboard.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,kBAAkB,QAAO,yBAmBrC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export const useCopyToClipboard = () => {
3
+ const copy = React.useCallback(async (opts) => {
4
+ if (!navigator?.clipboard) {
5
+ console.warn('Clipboard not supported');
6
+ return false;
7
+ }
8
+ const { value } = opts;
9
+ try {
10
+ await navigator.clipboard.writeText(value);
11
+ return true;
12
+ }
13
+ catch (error) {
14
+ console.warn('Copy failed', error);
15
+ return false;
16
+ }
17
+ }, []);
18
+ return { copy };
19
+ };
20
+ //# sourceMappingURL=use-copy-to-clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-copy-to-clipboard.js","sourceRoot":"","sources":["../../src/hooks/use-copy-to-clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAA8B,EAAE;IAChE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,IAAuB,EAAE,EAAE;QAC/D,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAEvB,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface IUseDebounceParams<TValue> {
2
+ value: TValue;
3
+ delay?: number;
4
+ disabled?: boolean;
5
+ }
6
+ export interface IUseDebounceReturn<TValue> {
7
+ debouncedValue: TValue;
8
+ }
9
+ export declare const useDebounce: <TValue>(params: IUseDebounceParams<TValue>) => IUseDebounceReturn<TValue>;
10
+ //# sourceMappingURL=use-debounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounce.d.ts","sourceRoot":"","sources":["../../src/hooks/use-debounce.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB,CAAC,MAAM;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB,CAAC,MAAM;IACxC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,EAChC,QAAQ,kBAAkB,CAAC,MAAM,CAAC,KACjC,kBAAkB,CAAC,MAAM,CAoB3B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { App, isBrowser } from '@venizia/ardor-kernel';
3
+ export const useDebounce = (params) => {
4
+ const { value, delay, disabled } = params;
5
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
6
+ React.useEffect(() => {
7
+ if (!isBrowser() || disabled) {
8
+ return;
9
+ }
10
+ const timer = setTimeout(() => {
11
+ setDebouncedValue(value);
12
+ }, delay ?? App.DEFAULT_DEBOUNCE_TIME);
13
+ return () => {
14
+ clearTimeout(timer);
15
+ };
16
+ }, [value, delay, disabled]);
17
+ return { debouncedValue };
18
+ };
19
+ //# sourceMappingURL=use-debounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounce.js","sourceRoot":"","sources":["../../src/hooks/use-debounce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAYvD,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,MAAkC,EACN,EAAE;IAC9B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE1C,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,KAAK,CAAC,CAAC;IAE1E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,SAAS,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC,EAAE,KAAK,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAEvC,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE7B,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Container, type TClass } from '@venizia/ignis-inversion';
2
+ import { type AnyType, CoreBindings, type ValueOf } from '@venizia/ardor-kernel';
3
+ export interface IUseInjectableKeysOverrides {
4
+ }
5
+ export type TUseInjectableKeysDefault = Extract<ValueOf<typeof CoreBindings>, string>;
6
+ export type TUseInjectableKeys = TUseInjectableKeysDefault | keyof IUseInjectableKeysOverrides;
7
+ export type TUseInjectableOptions = {
8
+ container?: Container;
9
+ key: TUseInjectableKeys;
10
+ target?: never;
11
+ } | {
12
+ container?: Container;
13
+ key?: never;
14
+ target: TClass<AnyType>;
15
+ };
16
+ export declare const useInjectable: <T>(opts: TUseInjectableOptions) => T;
17
+ //# sourceMappingURL=use-injectable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-injectable.d.ts","sourceRoot":"","sources":["../../src/hooks/use-injectable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAY,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,KAAK,OAAO,EAAE,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGjF,MAAM,WAAW,2BAA2B;CAAG;AAE/C,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;AAEtF,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,GAAG,MAAM,2BAA2B,CAAC;AAE/F,MAAM,MAAM,qBAAqB,GAC7B;IAAE,SAAS,CAAC,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,kBAAkB,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GAClE;IAAE,SAAS,CAAC,EAAE,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,MAAM,qBAAqB,MA+B3D,CAAC"}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { getError } from '@venizia/ignis-inversion';
3
+ import { ApplicationContext } from '../contexts/application';
4
+ export const useInjectable = (opts) => {
5
+ const requestContainer = opts?.container;
6
+ const applicationContext = React.useContext(ApplicationContext);
7
+ const container = requestContainer ?? applicationContext.container;
8
+ if (!container) {
9
+ throw getError({
10
+ message: '[useInjectable] Failed to determine injectable container!',
11
+ });
12
+ }
13
+ const { key, target } = opts;
14
+ if (key) {
15
+ return container.get({ key });
16
+ }
17
+ if (!target) {
18
+ throw getError({
19
+ message: '[useInjectable] Failed to determine injectable! | Missing both key and target',
20
+ });
21
+ }
22
+ const resolved = container.getMetadataRegistry().getBindingKey({ target });
23
+ if (!resolved) {
24
+ throw getError({
25
+ message: `[useInjectable] Failed to resolve binding key for target: ${target.name}! | Decorate it (@service, @component, ...) or register it on the application before injecting`,
26
+ });
27
+ }
28
+ return container.get({ key: resolved });
29
+ };
30
+ //# sourceMappingURL=use-injectable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-injectable.js","sourceRoot":"","sources":["../../src/hooks/use-injectable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAa,QAAQ,EAAe,MAAM,0BAA0B,CAAC;AAG5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAY7D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAI,IAA2B,EAAE,EAAE;IAC9D,MAAM,gBAAgB,GAAG,IAAI,EAAE,SAAS,CAAC;IACzC,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEhE,MAAM,SAAS,GAAG,gBAAgB,IAAI,kBAAkB,CAAC,SAAS,CAAC;IACnE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAE7B,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,SAAS,CAAC,GAAG,CAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,+EAA+E;SACzF,CAAC,CAAC;IACL,CAAC;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,mBAAmB,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,6DAA6D,MAAM,CAAC,IAAI,gGAAgG;SAClL,CAAC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC,GAAG,CAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const useSizer: (props: {
2
+ containerId: string;
3
+ }) => {
4
+ width: number;
5
+ height: number;
6
+ };
7
+ //# sourceMappingURL=use-sizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-sizer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-sizer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,GAAI,OAAO;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,KAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAsCxF,CAAC"}
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ export const useSizer = (props) => {
3
+ const [width, setWidth] = React.useState(0);
4
+ const [height, setHeight] = React.useState(0);
5
+ const cached = React.useRef({ width, height });
6
+ React.useEffect(() => {
7
+ const { containerId } = props;
8
+ const container = document.getElementById(containerId);
9
+ if (!container) {
10
+ return;
11
+ }
12
+ const sizeObserver = new ResizeObserver(() => {
13
+ if (container.offsetWidth !== cached.current.width) {
14
+ setWidth(container.clientWidth + 1);
15
+ }
16
+ if (container.offsetHeight !== cached.current.height) {
17
+ setHeight(container.offsetHeight + 1);
18
+ }
19
+ });
20
+ sizeObserver.observe(container);
21
+ return () => {
22
+ sizeObserver.disconnect();
23
+ };
24
+ }, [props]);
25
+ React.useEffect(() => {
26
+ cached.current.width = width;
27
+ }, [width]);
28
+ React.useEffect(() => {
29
+ cached.current.height = height;
30
+ }, [height]);
31
+ return { width, height };
32
+ };
33
+ //# sourceMappingURL=use-sizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-sizer.js","sourceRoot":"","sources":["../../src/hooks/use-sizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAA8B,EAAqC,EAAE;IAC5F,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,CAAC,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAoC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAElF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;QAC9B,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE;YAC3C,IAAI,SAAS,CAAC,WAAW,KAAK,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACnD,QAAQ,CAAC,SAAS,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;YACtC,CAAC;YAED,IAAI,SAAS,CAAC,YAAY,KAAK,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACrD,SAAS,CAAC,SAAS,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;YACxC,CAAC;QACH,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEhC,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAC/B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACjC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const useWindowDimensions: () => {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ //# sourceMappingURL=use-window-dimensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-window-dimensions.d.ts","sourceRoot":"","sources":["../../src/hooks/use-window-dimensions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;CAsB/B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export const useWindowDimensions = () => {
3
+ const [windowDimensions, setWindowDimensions] = React.useState({
4
+ width: window.innerWidth,
5
+ height: window.innerHeight,
6
+ });
7
+ React.useEffect(() => {
8
+ const resizeHandler = () => {
9
+ setWindowDimensions({
10
+ width: window.innerWidth,
11
+ height: window.innerHeight,
12
+ });
13
+ };
14
+ window.addEventListener('resize', resizeHandler);
15
+ return () => {
16
+ window.removeEventListener('resize', resizeHandler);
17
+ };
18
+ }, []);
19
+ return windowDimensions;
20
+ };
21
+ //# sourceMappingURL=use-window-dimensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-window-dimensions.js","sourceRoot":"","sources":["../../src/hooks/use-window-dimensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC7D,KAAK,EAAE,MAAM,CAAC,UAAU;QACxB,MAAM,EAAE,MAAM,CAAC,WAAW;KAC3B,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,aAAa,GAAG,GAAG,EAAE;YACzB,mBAAmB,CAAC;gBAClB,KAAK,EAAE,MAAM,CAAC,UAAU;gBACxB,MAAM,EAAE,MAAM,CAAC,WAAW;aAC3B,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAEjD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACtD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './common';
2
+ export * from './contexts';
3
+ export * from './hooks';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './common';
2
+ export * from './contexts';
3
+ export * from './hooks';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
package/package.json ADDED
@@ -0,0 +1,129 @@
1
+ {
2
+ "name": "@venizia/ardor-react",
3
+ "version": "0.1.1-0",
4
+ "description": "ARDOR React bindings - the application context, the injectable and logger hooks that read it, typed Redux hook factories, and the framework-agnostic UI hooks (debounce, autosave, confirm, clipboard, sizer, window dimensions). No react-admin.",
5
+ "keywords": [
6
+ "ardor",
7
+ "ardor-react",
8
+ "context",
9
+ "dependency-injection",
10
+ "hooks",
11
+ "ignis",
12
+ "react",
13
+ "react-hooks",
14
+ "react-redux",
15
+ "typescript",
16
+ "venizia"
17
+ ],
18
+ "homepage": "https://ardor.venizia.ai",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/VENIZIA-AI/ardor.git",
22
+ "directory": "packages/react"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/VENIZIA-AI/ardor/issues"
26
+ },
27
+ "author": {
28
+ "name": "VENIZIA AI Developer",
29
+ "email": "developer@venizia.ai",
30
+ "url": "https://venizia.ai"
31
+ },
32
+ "license": "MIT",
33
+ "engines": {
34
+ "bun": ">=1.3"
35
+ },
36
+ "type": "module",
37
+ "main": "./dist/index.js",
38
+ "module": "./dist/index.js",
39
+ "types": "./dist/index.d.ts",
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/index.d.ts",
43
+ "import": "./dist/index.js",
44
+ "default": "./dist/index.js"
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
48
+ "sideEffects": false,
49
+ "files": [
50
+ "README.md",
51
+ "LICENSE.md",
52
+ "dist",
53
+ "!/**/__tests__",
54
+ "!**/*.tsbuildinfo"
55
+ ],
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "scripts": {
60
+ "force-update": "sh ./scripts/force-update.sh",
61
+ "build": "sh ./scripts/build.sh",
62
+ "typecheck": "tsc --noEmit -p tsconfig.test.json",
63
+ "clean": "sh ./scripts/clean.sh",
64
+ "eslint": "eslint --report-unused-disable-directives .",
65
+ "lint": "bun run eslint && bun run prettier:cli",
66
+ "lint:fix": "bun run eslint --fix && bun run prettier:fix",
67
+ "prettier:cli": "prettier \"**/*.{js,ts,tsx}\" -l",
68
+ "prettier:fix": "bun run prettier:cli --write",
69
+ "rebuild": "sh ./scripts/rebuild.sh no-version",
70
+ "prepublishOnly": "bun run rebuild",
71
+ "test": "NODE_ENV=test bun test --env-file=.env.test",
72
+ "test:watch": "NODE_ENV=test bun test --watch --env-file=.env.test",
73
+ "size": "size-limit"
74
+ },
75
+ "dependencies": {
76
+ "@venizia/ardor-kernel": "^0.1.1-0",
77
+ "lodash": "catalog:"
78
+ },
79
+ "peerDependencies": {
80
+ "@reduxjs/toolkit": ">=2.12.0",
81
+ "@venizia/ignis-inversion": "^0.2.0-7",
82
+ "react": ">=18.0",
83
+ "react-redux": ">=9.3.0"
84
+ },
85
+ "devDependencies": {
86
+ "@happy-dom/global-registrator": "catalog:",
87
+ "@reduxjs/toolkit": "catalog:",
88
+ "@size-limit/preset-small-lib": "catalog:",
89
+ "@testing-library/dom": "catalog:",
90
+ "@testing-library/react": "catalog:",
91
+ "@types/bun": "catalog:",
92
+ "@types/lodash": "catalog:",
93
+ "@types/react": "catalog:",
94
+ "@types/react-dom": "catalog:",
95
+ "@venizia/dev-configs": "catalog:",
96
+ "@venizia/ignis-inversion": "^0.2.0-7",
97
+ "eslint": "catalog:",
98
+ "prettier": "catalog:",
99
+ "react": "catalog:",
100
+ "react-redux": "catalog:",
101
+ "reflect-metadata": "catalog:",
102
+ "size-limit": "catalog:",
103
+ "tsc-alias": "catalog:",
104
+ "typescript": "catalog:"
105
+ },
106
+ "peerDependenciesMeta": {
107
+ "@reduxjs/toolkit": {
108
+ "optional": true
109
+ },
110
+ "react-redux": {
111
+ "optional": true
112
+ }
113
+ },
114
+ "size-limit": [
115
+ {
116
+ "path": "dist/index.js",
117
+ "import": "*",
118
+ "ignore": [
119
+ "@reduxjs/toolkit",
120
+ "@venizia/ardor-kernel",
121
+ "@venizia/ignis-inversion",
122
+ "lodash",
123
+ "react",
124
+ "react-redux"
125
+ ],
126
+ "limit": "2.0 KB"
127
+ }
128
+ ]
129
+ }