@xyo-network/react-event 2.80.0 → 2.81.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/dist/browser/hooks/index.d.cts +2 -2
  2. package/dist/browser/hooks/index.d.cts.map +1 -1
  3. package/dist/browser/hooks/index.d.mts +2 -2
  4. package/dist/browser/hooks/index.d.mts.map +1 -1
  5. package/dist/browser/hooks/index.d.ts +2 -2
  6. package/dist/browser/hooks/index.d.ts.map +1 -1
  7. package/dist/browser/hooks/useCustomEvent.d.cts +1 -1
  8. package/dist/browser/hooks/useCustomEvent.d.cts.map +1 -1
  9. package/dist/browser/hooks/useCustomEvent.d.mts +1 -1
  10. package/dist/browser/hooks/useCustomEvent.d.mts.map +1 -1
  11. package/dist/browser/hooks/useCustomEvent.d.ts +1 -1
  12. package/dist/browser/hooks/useCustomEvent.d.ts.map +1 -1
  13. package/dist/browser/hooks/useEvent.d.cts +1 -1
  14. package/dist/browser/hooks/useEvent.d.cts.map +1 -1
  15. package/dist/browser/hooks/useEvent.d.mts +1 -1
  16. package/dist/browser/hooks/useEvent.d.mts.map +1 -1
  17. package/dist/browser/hooks/useEvent.d.ts +1 -1
  18. package/dist/browser/hooks/useEvent.d.ts.map +1 -1
  19. package/dist/browser/index.cjs.map +1 -1
  20. package/dist/browser/index.d.cts +1 -1
  21. package/dist/browser/index.d.cts.map +1 -1
  22. package/dist/browser/index.d.mts +1 -1
  23. package/dist/browser/index.d.mts.map +1 -1
  24. package/dist/browser/index.d.ts +1 -1
  25. package/dist/browser/index.d.ts.map +1 -1
  26. package/dist/browser/index.js.map +1 -1
  27. package/dist/neutral/hooks/index.d.cts +2 -2
  28. package/dist/neutral/hooks/index.d.cts.map +1 -1
  29. package/dist/neutral/hooks/index.d.mts +2 -2
  30. package/dist/neutral/hooks/index.d.mts.map +1 -1
  31. package/dist/neutral/hooks/index.d.ts +2 -2
  32. package/dist/neutral/hooks/index.d.ts.map +1 -1
  33. package/dist/neutral/hooks/useCustomEvent.d.cts +1 -1
  34. package/dist/neutral/hooks/useCustomEvent.d.cts.map +1 -1
  35. package/dist/neutral/hooks/useCustomEvent.d.mts +1 -1
  36. package/dist/neutral/hooks/useCustomEvent.d.mts.map +1 -1
  37. package/dist/neutral/hooks/useCustomEvent.d.ts +1 -1
  38. package/dist/neutral/hooks/useCustomEvent.d.ts.map +1 -1
  39. package/dist/neutral/hooks/useEvent.d.cts +1 -1
  40. package/dist/neutral/hooks/useEvent.d.cts.map +1 -1
  41. package/dist/neutral/hooks/useEvent.d.mts +1 -1
  42. package/dist/neutral/hooks/useEvent.d.mts.map +1 -1
  43. package/dist/neutral/hooks/useEvent.d.ts +1 -1
  44. package/dist/neutral/hooks/useEvent.d.ts.map +1 -1
  45. package/dist/neutral/index.cjs.map +1 -1
  46. package/dist/neutral/index.d.cts +1 -1
  47. package/dist/neutral/index.d.cts.map +1 -1
  48. package/dist/neutral/index.d.mts +1 -1
  49. package/dist/neutral/index.d.mts.map +1 -1
  50. package/dist/neutral/index.d.ts +1 -1
  51. package/dist/neutral/index.d.ts.map +1 -1
  52. package/dist/neutral/index.js.map +1 -1
  53. package/dist/node/hooks/index.d.cts +2 -2
  54. package/dist/node/hooks/index.d.cts.map +1 -1
  55. package/dist/node/hooks/index.d.mts +2 -2
  56. package/dist/node/hooks/index.d.mts.map +1 -1
  57. package/dist/node/hooks/index.d.ts +2 -2
  58. package/dist/node/hooks/index.d.ts.map +1 -1
  59. package/dist/node/hooks/useCustomEvent.d.cts +1 -1
  60. package/dist/node/hooks/useCustomEvent.d.cts.map +1 -1
  61. package/dist/node/hooks/useCustomEvent.d.mts +1 -1
  62. package/dist/node/hooks/useCustomEvent.d.mts.map +1 -1
  63. package/dist/node/hooks/useCustomEvent.d.ts +1 -1
  64. package/dist/node/hooks/useCustomEvent.d.ts.map +1 -1
  65. package/dist/node/hooks/useEvent.d.cts +1 -1
  66. package/dist/node/hooks/useEvent.d.cts.map +1 -1
  67. package/dist/node/hooks/useEvent.d.mts +1 -1
  68. package/dist/node/hooks/useEvent.d.mts.map +1 -1
  69. package/dist/node/hooks/useEvent.d.ts +1 -1
  70. package/dist/node/hooks/useEvent.d.ts.map +1 -1
  71. package/dist/node/index.cjs.map +1 -1
  72. package/dist/node/index.d.cts +1 -1
  73. package/dist/node/index.d.cts.map +1 -1
  74. package/dist/node/index.d.mts +1 -1
  75. package/dist/node/index.d.mts.map +1 -1
  76. package/dist/node/index.d.ts +1 -1
  77. package/dist/node/index.d.ts.map +1 -1
  78. package/dist/node/index.js.map +1 -1
  79. package/package.json +2 -2
  80. package/src/hooks/index.ts +2 -2
  81. package/src/hooks/useEvent.ts +1 -1
  82. package/src/index.ts +1 -1
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS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erb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,wOAkBpB,CAAA"}
1
+ {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,KAAK,cAAc,KAAK,cAAc,KAAK,sBAC9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,gBAC/B,SAAS,CAAC,CAAC,CAAC,KACzB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAenD,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,wOAkBpB,CAAA"}
1
+ {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,KAAK,cAAc,KAAK,cAAc,KAAK,sBAC9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,gBAC/B,SAAS,CAAC,CAAC,CAAC,KACzB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAenD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks'\n","import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,mBAAgD;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,iBAAa,wBAAoB;AAC7C,8BAAU,MAAM;AACd,UAAM,UAAU,KAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,aAAS,wBAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,eAAS,iBAAiB,MAAM,OAAO;AAAA,IACzC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,iBAAS,oBAAoB,MAAM,OAAO;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AACnE,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,QAAI,SAAS,cAAc,KAAK;AAAA,EAClC;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks/index.js'\n","import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent.js'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}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* from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAsB,iBAAiB;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,aAAa,UAAoB;AAC7C,YAAU,MAAM;AACd,UAAM,UAAU,KAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,SAAS,SAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,eAAS,iBAAiB,MAAM,OAAO;AAAA,IACzC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,iBAAS,oBAAoB,MAAM,OAAO;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AACnE,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,QAAI,SAAS,cAAc,KAAK;AAAA,EAClC;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent.js'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAsB,iBAAiB;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,aAAa,UAAoB;AAC7C,YAAU,MAAM;AACd,UAAM,UAAU,KAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,SAAS,SAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,eAAS,iBAAiB,MAAM,OAAO;AAAA,IACzC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,iBAAS,oBAAoB,MAAM,OAAO;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AACnE,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,QAAI,SAAS,cAAc,KAAK;AAAA,EAClC;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,wOAkBpB,CAAA"}
1
+ {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,KAAK,cAAc,KAAK,cAAc,KAAK,sBAC9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,gBAC/B,SAAS,CAAC,CAAC,CAAC,KACzB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAenD,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,wOAkBpB,CAAA"}
1
+ {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,KAAK,cAAc,KAAK,cAAc,KAAK,sBAC9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,gBAC/B,SAAS,CAAC,CAAC,CAAC,KACzB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAenD,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,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,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,KAAK,cAAc,KAAK,cAAc,KAAK,sBAC9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,gBAC/B,SAAS,CAAC,CAAC,CAAC,KACzB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAenD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks'\n","import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,mBAAgD;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,iBAAa,wBAAoB;AAC7C,8BAAU,MAAM;AACd,UAAM,UAAU,KAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,aAAS,wBAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,eAAS,iBAAiB,MAAM,OAAO;AAAA,IACzC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,iBAAS,oBAAoB,MAAM,OAAO;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AACnE,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,QAAI,SAAS,cAAc,KAAK;AAAA,EAClC;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks/index.js'\n","import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent.js'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,mBAAgD;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,iBAAa,wBAAoB;AAC7C,8BAAU,MAAM;AACd,UAAM,UAAU,KAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,aAAS,wBAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,eAAS,iBAAiB,MAAM,OAAO;AAAA,IACzC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,iBAAS,oBAAoB,MAAM,OAAO;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AACnE,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,QAAI,SAAS,cAAc,KAAK;AAAA,EAClC;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAsB,iBAAiB;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,aAAa,UAAoB;AAC7C,YAAU,MAAM;AACd,UAAM,UAAU,KAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,SAAS,SAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,eAAS,iBAAiB,MAAM,OAAO;AAAA,IACzC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,iBAAS,oBAAoB,MAAM,OAAO;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AACnE,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,QAAI,SAAS,cAAc,KAAK;AAAA,EAClC;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent.js'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAsB,iBAAiB;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,aAAa,UAAoB;AAC7C,YAAU,MAAM;AACd,UAAM,UAAU,KAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,SAAS,SAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,eAAS,iBAAiB,MAAM,OAAO;AAAA,IACzC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,iBAAS,oBAAoB,MAAM,OAAO;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AACnE,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,QAAI,SAAS,cAAc,KAAK;AAAA,EAClC;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './useCustomEvent';
2
- export * from './useEvent';
1
+ export * from './useCustomEvent.js';
2
+ export * from './useEvent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void;
3
- export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail> | undefined, customRef?: RefObject<TElement> | undefined) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
3
+ export declare const useCustomEvent: <TElement extends HTMLElement, TDetail = unknown>(type: string, listener?: CustomEventDispatch<TDetail>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
4
  //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,0DACnB,MAAM,0JAsCb,CAAA"}
1
+ {"version":3,"file":"useCustomEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCustomEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAa,MAAM,OAAO,CAAA;AAEvD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5E,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,OAAO,kBAC5D,MAAM,aACD,mBAAmB,CAAC,OAAO,CAAC,cAC3B,SAAS,CAAC,QAAQ,CAAC,KAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAmCpD,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM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W,EAAE,KAAK,cAAc,KAAK,cAAc,KAAK,sBAC9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,gBAC/B,SAAS,CAAC,CAAC,CAAC,KACzB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAenD,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK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,CAAA"}
@@ -7,5 +7,5 @@ export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
7
7
  verb: TVerb;
8
8
  }
9
9
  export type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
10
- export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData> | undefined, sharableRef?: RefObject<T> | undefined) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
10
+ export declare const useEvent: <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(listener?: EventDispatch<TNoun, TVerb, TData>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
11
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,wOAkBpB,CAAA"}
1
+ {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAChG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM;IACzE,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAAA;AAE5I,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,KAAK,cAAc,KAAK,cAAc,KAAK,sBAC9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,gBAC/B,SAAS,CAAC,CAAC,CAAC,KACzB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAenD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks'\n","import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: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KAAK,QAAQ;AACvB;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks/index.js'\n","import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent.js'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,mBAAgD;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,iBAAa,wBAAoB;AAC7C,8BAAU,MAAM;AACd,UAAM,UAAU,2BAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,aAAS,wBAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,yCAAS,iBAAiB,MAAM;AAAA,IAClC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,2CAAS,oBAAoB,MAAM;AAAA,MACrC;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AAlCvE;AAmCI,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,cAAI,YAAJ,mBAAa,cAAc;AAAA,EAC7B;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './hooks';
1
+ export * from './hooks/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAsB,iBAAiB;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,aAAa,UAAoB;AAC7C,YAAU,MAAM;AACd,UAAM,UAAU,2BAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,SAAS,SAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,yCAAS,iBAAiB,MAAM;AAAA,IAClC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,2CAAS,oBAAoB,MAAM;AAAA,MACrC;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AAlCvE;AAmCI,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,cAAI,YAAJ,mBAAa,cAAc;AAAA,EAC7B;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { createRef, RefObject, useEffect } from 'react'\n\nexport type CustomEventDispatch<T = unknown> = (detail: T) => boolean | void\n\nexport const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(\n type: string,\n listener?: CustomEventDispatch<TDetail>,\n customRef?: RefObject<TElement>,\n): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {\n const ref = customRef ?? createRef<TElement>()\n useEffect(() => {\n const element = ref?.current\n const currentListener = listener\n const handler =\n currentListener ?\n (event: CustomEventInit<TDetail> & Event) => {\n const detail = assertEx(event.detail, () => 'Event missing detail')\n const stop = currentListener(detail)\n if (stop) {\n event.stopPropagation()\n }\n }\n : undefined\n\n if (handler && element) {\n element?.addEventListener(type, handler)\n }\n return () => {\n if (handler && element) {\n element?.removeEventListener(type, handler)\n }\n }\n })\n const dispatch: CustomEventDispatch<TDetail> = (detail?: TDetail) => {\n const event = new CustomEvent<TDetail>(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n })\n ref.current?.dispatchEvent(event)\n }\n return [ref, dispatch]\n}\n","import { RefObject } from 'react'\n\nimport { useCustomEvent } from './useCustomEvent.js'\n\nexport type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'\nexport type EventVerb = 'click' | 'favorite'\n\nexport interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {\n data?: TData\n noun: TNoun\n verb: TVerb\n}\n\nexport type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void\n\nexport const useEvent = <T extends HTMLElement, TNoun = EventNoun, TVerb = EventVerb, TData = string>(\n listener?: EventDispatch<TNoun, TVerb, TData>,\n sharableRef?: RefObject<T>,\n): [RefObject<T>, EventDispatch<TNoun, TVerb, TData>] => {\n const [ref, customDispatch] = useCustomEvent<T, Event<TNoun, TVerb, TData>>(\n 'xyo',\n listener ?\n (detail: Event<TNoun, TVerb, TData>) => {\n return listener(detail.noun, detail.verb, detail.data)\n }\n : undefined,\n sharableRef,\n )\n\n const dispatch: EventDispatch<TNoun, TVerb, TData> = (noun: TNoun, verb: TVerb, data?: TData) => {\n return customDispatch({ data, noun, verb })\n }\n return [ref, dispatch]\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAsB,iBAAiB;AAIzC,IAAM,iBAAiB,CAC5B,MACA,UACA,cACwD;AACxD,QAAM,MAAM,aAAa,UAAoB;AAC7C,YAAU,MAAM;AACd,UAAM,UAAU,2BAAK;AACrB,UAAM,kBAAkB;AACxB,UAAM,UACJ,kBACE,CAAC,UAA4C;AAC3C,YAAM,SAAS,SAAS,MAAM,QAAQ,MAAM,sBAAsB;AAClE,YAAM,OAAO,gBAAgB,MAAM;AACnC,UAAI,MAAM;AACR,cAAM,gBAAgB;AAAA,MACxB;AAAA,IACF,IACA;AAEJ,QAAI,WAAW,SAAS;AACtB,yCAAS,iBAAiB,MAAM;AAAA,IAClC;AACA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,2CAAS,oBAAoB,MAAM;AAAA,MACrC;AAAA,IACF;AAAA,EACF,CAAC;AACD,QAAM,WAAyC,CAAC,WAAqB;AAlCvE;AAmCI,UAAM,QAAQ,IAAI,YAAqB,MAAM;AAAA,MAC3C,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,cAAI,YAAJ,mBAAa,cAAc;AAAA,EAC7B;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;;;AC7BO,IAAM,WAAW,CACtB,UACA,gBACuD;AACvD,QAAM,CAAC,KAAK,cAAc,IAAI;AAAA,IAC5B;AAAA,IACA,WACE,CAAC,WAAuC;AACtC,aAAO,SAAS,OAAO,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,IACvD,IACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAA+C,CAAC,MAAa,MAAa,SAAiB;AAC/F,WAAO,eAAe,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,CAAC,KAAK,QAAQ;AACvB;","names":[]}
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^3.5.2"
13
+ "@xylabs/assert": "^3.5.9"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@xylabs/ts-scripts-yarn3": "^3.11.12",
@@ -71,6 +71,6 @@
71
71
  },
72
72
  "sideEffects": false,
73
73
  "types": "dist/browser/index.d.ts",
74
- "version": "2.80.0",
74
+ "version": "2.81.0",
75
75
  "type": "module"
76
76
  }
@@ -1,2 +1,2 @@
1
- export * from './useCustomEvent'
2
- export * from './useEvent'
1
+ export * from './useCustomEvent.js'
2
+ export * from './useEvent.js'
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react'
2
2
 
3
- import { useCustomEvent } from './useCustomEvent'
3
+ import { useCustomEvent } from './useCustomEvent.js'
4
4
 
5
5
  export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema'
6
6
  export type EventVerb = 'click' | 'favorite'
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './hooks'
1
+ export * from './hooks/index.js'