@xyo-network/react-event 6.0.0 → 6.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.
@@ -0,0 +1,18 @@
1
+ import { RefObject } from 'react';
2
+
3
+ type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
4
+ declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement | null>) => [RefObject<TElement | null>, CustomEventDispatch<TDetail>];
5
+
6
+ type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
7
+ type ExtendEventNoun<Extension extends string = string> = Extension | EventNoun;
8
+ type EventVerb = 'click' | 'favorite';
9
+ interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
10
+ data?: TData;
11
+ noun: TNoun;
12
+ verb: TVerb;
13
+ }
14
+ type EventDispatch<TNoun = ExtendEventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
15
+ declare const useEvent: <T extends HTMLElement, TNoun = ExtendEventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T | null>) => [RefObject<T | null>, EventDispatch<TNoun, TVerb, TData>];
16
+
17
+ export { useCustomEvent, useEvent };
18
+ export type { CustomEventDispatch, Event, EventDispatch, EventNoun, EventVerb, ExtendEventNoun };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/react-event",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Common React library for all XYO projects that use React",
5
5
  "keywords": [
6
6
  "xyo",
@@ -28,21 +28,21 @@
28
28
  "exports": {
29
29
  ".": {
30
30
  "browser": {
31
- "types": "./dist/types/index.d.ts",
31
+ "types": "./dist/browser/index.d.ts",
32
32
  "default": "./dist/browser/index.mjs"
33
33
  },
34
- "types": "./dist/types/index.d.ts",
34
+ "types": "./dist/browser/index.d.ts",
35
35
  "default": "./dist/browser/index.mjs"
36
36
  },
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "module": "dist/browser/index.mjs",
40
- "types": "dist/types/index.d.ts",
40
+ "types": "dist/browser/index.d.ts",
41
41
  "dependencies": {
42
- "@xylabs/assert": "^4.12.31"
42
+ "@xylabs/assert": "^4.13.15"
43
43
  },
44
44
  "devDependencies": {
45
- "@xylabs/ts-scripts-yarn3": "^6.5.12",
45
+ "@xylabs/ts-scripts-yarn3": "next",
46
46
  "typescript": "^5.8.3"
47
47
  },
48
48
  "peerDependencies": {
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes