@xyo-network/react-event 2.82.0 → 2.83.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. package/dist/browser/index.d.ts +16 -2
  2. package/package.json +6 -22
  3. package/xy.config.ts +12 -0
  4. package/dist/browser/hooks/index.d.cts +0 -3
  5. package/dist/browser/hooks/index.d.cts.map +0 -1
  6. package/dist/browser/hooks/index.d.mts +0 -3
  7. package/dist/browser/hooks/index.d.mts.map +0 -1
  8. package/dist/browser/hooks/index.d.ts +0 -3
  9. package/dist/browser/hooks/index.d.ts.map +0 -1
  10. package/dist/browser/hooks/useCustomEvent.d.cts +0 -4
  11. package/dist/browser/hooks/useCustomEvent.d.cts.map +0 -1
  12. package/dist/browser/hooks/useCustomEvent.d.mts +0 -4
  13. package/dist/browser/hooks/useCustomEvent.d.mts.map +0 -1
  14. package/dist/browser/hooks/useCustomEvent.d.ts +0 -4
  15. package/dist/browser/hooks/useCustomEvent.d.ts.map +0 -1
  16. package/dist/browser/hooks/useEvent.d.cts +0 -11
  17. package/dist/browser/hooks/useEvent.d.cts.map +0 -1
  18. package/dist/browser/hooks/useEvent.d.mts +0 -11
  19. package/dist/browser/hooks/useEvent.d.mts.map +0 -1
  20. package/dist/browser/hooks/useEvent.d.ts +0 -11
  21. package/dist/browser/hooks/useEvent.d.ts.map +0 -1
  22. package/dist/browser/index.cjs +0 -85
  23. package/dist/browser/index.cjs.map +0 -1
  24. package/dist/browser/index.d.cts +0 -2
  25. package/dist/browser/index.d.cts.map +0 -1
  26. package/dist/browser/index.d.mts +0 -2
  27. package/dist/browser/index.d.mts.map +0 -1
  28. package/dist/browser/index.d.ts.map +0 -1
  29. package/dist/neutral/hooks/index.d.cts +0 -3
  30. package/dist/neutral/hooks/index.d.cts.map +0 -1
  31. package/dist/neutral/hooks/index.d.mts +0 -3
  32. package/dist/neutral/hooks/index.d.mts.map +0 -1
  33. package/dist/neutral/hooks/index.d.ts +0 -3
  34. package/dist/neutral/hooks/index.d.ts.map +0 -1
  35. package/dist/neutral/hooks/useCustomEvent.d.cts +0 -4
  36. package/dist/neutral/hooks/useCustomEvent.d.cts.map +0 -1
  37. package/dist/neutral/hooks/useCustomEvent.d.mts +0 -4
  38. package/dist/neutral/hooks/useCustomEvent.d.mts.map +0 -1
  39. package/dist/neutral/hooks/useCustomEvent.d.ts +0 -4
  40. package/dist/neutral/hooks/useCustomEvent.d.ts.map +0 -1
  41. package/dist/neutral/hooks/useEvent.d.cts +0 -11
  42. package/dist/neutral/hooks/useEvent.d.cts.map +0 -1
  43. package/dist/neutral/hooks/useEvent.d.mts +0 -11
  44. package/dist/neutral/hooks/useEvent.d.mts.map +0 -1
  45. package/dist/neutral/hooks/useEvent.d.ts +0 -11
  46. package/dist/neutral/hooks/useEvent.d.ts.map +0 -1
  47. package/dist/neutral/index.cjs +0 -85
  48. package/dist/neutral/index.cjs.map +0 -1
  49. package/dist/neutral/index.d.cts +0 -2
  50. package/dist/neutral/index.d.cts.map +0 -1
  51. package/dist/neutral/index.d.mts +0 -2
  52. package/dist/neutral/index.d.mts.map +0 -1
  53. package/dist/neutral/index.d.ts +0 -2
  54. package/dist/neutral/index.d.ts.map +0 -1
  55. package/dist/neutral/index.mjs +0 -64
  56. package/dist/neutral/index.mjs.map +0 -1
  57. package/dist/node/hooks/index.d.cts +0 -3
  58. package/dist/node/hooks/index.d.cts.map +0 -1
  59. package/dist/node/hooks/index.d.mts +0 -3
  60. package/dist/node/hooks/index.d.mts.map +0 -1
  61. package/dist/node/hooks/index.d.ts +0 -3
  62. package/dist/node/hooks/index.d.ts.map +0 -1
  63. package/dist/node/hooks/useCustomEvent.d.cts +0 -4
  64. package/dist/node/hooks/useCustomEvent.d.cts.map +0 -1
  65. package/dist/node/hooks/useCustomEvent.d.mts +0 -4
  66. package/dist/node/hooks/useCustomEvent.d.mts.map +0 -1
  67. package/dist/node/hooks/useCustomEvent.d.ts +0 -4
  68. package/dist/node/hooks/useCustomEvent.d.ts.map +0 -1
  69. package/dist/node/hooks/useEvent.d.cts +0 -11
  70. package/dist/node/hooks/useEvent.d.cts.map +0 -1
  71. package/dist/node/hooks/useEvent.d.mts +0 -11
  72. package/dist/node/hooks/useEvent.d.mts.map +0 -1
  73. package/dist/node/hooks/useEvent.d.ts +0 -11
  74. package/dist/node/hooks/useEvent.d.ts.map +0 -1
  75. package/dist/node/index.cjs +0 -91
  76. package/dist/node/index.cjs.map +0 -1
  77. package/dist/node/index.d.cts +0 -2
  78. package/dist/node/index.d.cts.map +0 -1
  79. package/dist/node/index.d.mts +0 -2
  80. package/dist/node/index.d.mts.map +0 -1
  81. package/dist/node/index.d.ts +0 -2
  82. package/dist/node/index.d.ts.map +0 -1
  83. package/dist/node/index.mjs +0 -65
  84. package/dist/node/index.mjs.map +0 -1
@@ -1,2 +1,16 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
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>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
5
+
6
+ type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
7
+ type EventVerb = 'click' | 'favorite';
8
+ interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
9
+ data?: TData;
10
+ noun: TNoun;
11
+ verb: TVerb;
12
+ }
13
+ type EventDispatch<TNoun = EventNoun, TVerb = EventVerb, TData = string> = (noun: TNoun, verb: TVerb, data?: TData) => boolean | void;
14
+ 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>];
15
+
16
+ export { type CustomEventDispatch, type Event, type EventDispatch, type EventNoun, type EventVerb, useCustomEvent, useEvent };
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@xylabs/assert": "^3.6.12"
14
14
  },
15
15
  "devDependencies": {
16
- "@xylabs/ts-scripts-yarn3": "^3.15.16",
16
+ "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.7",
17
17
  "typescript": "^5.5.4"
18
18
  },
19
19
  "peerDependencies": {
@@ -24,31 +24,15 @@
24
24
  "docs": "dist/docs.json",
25
25
  "exports": {
26
26
  ".": {
27
- "node": {
28
- "import": {
29
- "types": "./dist/node/index.d.mts",
30
- "default": "./dist/node/index.mjs"
31
- },
32
- "require": {
33
- "types": "./dist/node/index.d.cts",
34
- "default": "./dist/node/index.cjs"
35
- }
36
- },
37
- "browser": {
38
- "import": {
39
- "types": "./dist/browser/index.d.mts",
40
- "default": "./dist/browser/index.mjs"
41
- },
42
- "require": {
43
- "types": "./dist/browser/index.d.cts",
44
- "default": "./dist/browser/index.cjs"
45
- }
27
+ "import": {
28
+ "types": "./dist/browser/index.d.ts",
29
+ "default": "./dist/browser/index.mjs"
46
30
  },
31
+ "types": "./dist/browser/index.d.ts",
47
32
  "default": "./dist/browser/index.mjs"
48
33
  },
49
34
  "./package.json": "./package.json"
50
35
  },
51
- "main": "dist/browser/index.cjs",
52
36
  "module": "dist/browser/index.mjs",
53
37
  "homepage": "https://xyo.network",
54
38
  "keywords": [
@@ -71,6 +55,6 @@
71
55
  },
72
56
  "sideEffects": false,
73
57
  "types": "dist/browser/index.d.ts",
74
- "version": "2.82.0",
58
+ "version": "2.83.1",
75
59
  "type": "module"
76
60
  }
package/xy.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
+ const config: XyTsupConfig = {
3
+ compile: {
4
+ browser: {
5
+ src: true,
6
+ },
7
+ node: {},
8
+ neutral: {},
9
+ },
10
+ }
11
+
12
+ export default config
@@ -1,3 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,4 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,4 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,85 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
24
- useCustomEvent: () => useCustomEvent,
25
- useEvent: () => useEvent
26
- });
27
- module.exports = __toCommonJS(src_exports);
28
-
29
- // src/hooks/useCustomEvent.ts
30
- var import_assert = require("@xylabs/assert");
31
- var import_react = require("react");
32
- var useCustomEvent = /* @__PURE__ */ __name((type, listener, customRef) => {
33
- const ref = customRef ?? (0, import_react.createRef)();
34
- (0, import_react.useEffect)(() => {
35
- const element = ref?.current;
36
- const currentListener = listener;
37
- const handler = currentListener ? (event) => {
38
- const detail = (0, import_assert.assertEx)(event.detail, () => "Event missing detail");
39
- const stop = currentListener(detail);
40
- if (stop) {
41
- event.stopPropagation();
42
- }
43
- } : void 0;
44
- if (handler && element) {
45
- element?.addEventListener(type, handler);
46
- }
47
- return () => {
48
- if (handler && element) {
49
- element?.removeEventListener(type, handler);
50
- }
51
- };
52
- });
53
- const dispatch = /* @__PURE__ */ __name((detail) => {
54
- const event = new CustomEvent(type, {
55
- bubbles: true,
56
- cancelable: true,
57
- composed: true,
58
- detail
59
- });
60
- ref.current?.dispatchEvent(event);
61
- }, "dispatch");
62
- return [
63
- ref,
64
- dispatch
65
- ];
66
- }, "useCustomEvent");
67
-
68
- // src/hooks/useEvent.ts
69
- var useEvent = /* @__PURE__ */ __name((listener, sharableRef) => {
70
- const [ref, customDispatch] = useCustomEvent("xyo", listener ? (detail) => {
71
- return listener(detail.noun, detail.verb, detail.data);
72
- } : void 0, sharableRef);
73
- const dispatch = /* @__PURE__ */ __name((noun, verb, data) => {
74
- return customDispatch({
75
- data,
76
- noun,
77
- verb
78
- });
79
- }, "dispatch");
80
- return [
81
- ref,
82
- dispatch
83
- ];
84
- }, "useEvent");
85
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks/index.ts'\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 // eslint-disable-next-line @eslint-react/no-create-ref\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.ts'\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;;;;;;;;ACAA,oBAAyB;AACzB,mBAAgD;AAIzC,IAAMA,iBAAiB,wBAC5BC,MACAC,UACAC,cAAAA;AAGA,QAAMC,MAAMD,iBAAaE,wBAAAA;AACzBC,8BAAU,MAAA;AACR,UAAMC,UAAUH,KAAKI;AACrB,UAAMC,kBAAkBP;AACxB,UAAMQ,UACFD,kBACE,CAACE,UAAAA;AACC,YAAMC,aAASC,wBAASF,MAAMC,QAAQ,MAAM,sBAAA;AAC5C,YAAME,OAAOL,gBAAgBG,MAAAA;AAC7B,UAAIE,MAAM;AACRH,cAAMI,gBAAe;MACvB;IACF,IACAC;AAEN,QAAIN,WAAWH,SAAS;AACtBA,eAASU,iBAAiBhB,MAAMS,OAAAA;IAClC;AACA,WAAO,MAAA;AACL,UAAIA,WAAWH,SAAS;AACtBA,iBAASW,oBAAoBjB,MAAMS,OAAAA;MACrC;IACF;EACF,CAAA;AACA,QAAMS,WAAyC,wBAACP,WAAAA;AAC9C,UAAMD,QAAQ,IAAIS,YAAqBnB,MAAM;MAC3CoB,SAAS;MACTC,YAAY;MACZC,UAAU;MACVX;IACF,CAAA;AACAR,QAAII,SAASgB,cAAcb,KAAAA;EAC7B,GAR+C;AAS/C,SAAO;IAACP;IAAKe;;AACf,GAxC8B;;;ACUvB,IAAMM,WAAW,wBACtBC,UACAC,gBAAAA;AAEA,QAAM,CAACC,KAAKC,cAAAA,IAAkBC,eAC5B,OACAJ,WACI,CAACK,WAAAA;AACC,WAAOL,SAASK,OAAOC,MAAMD,OAAOE,MAAMF,OAAOG,IAAI;EACvD,IACAC,QACJR,WAAAA;AAGF,QAAMS,WAA+C,wBAACJ,MAAaC,MAAaC,SAAAA;AAC9E,WAAOL,eAAe;MAAEK;MAAMF;MAAMC;IAAK,CAAA;EAC3C,GAFqD;AAGrD,SAAO;IAACL;IAAKQ;;AACf,GAlBwB;","names":["useCustomEvent","type","listener","customRef","ref","createRef","useEffect","element","current","currentListener","handler","event","detail","assertEx","stop","stopPropagation","undefined","addEventListener","removeEventListener","dispatch","CustomEvent","bubbles","cancelable","composed","dispatchEvent","useEvent","listener","sharableRef","ref","customDispatch","useCustomEvent","detail","noun","verb","data","undefined","dispatch"]}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,3 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,4 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,4 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,85 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
24
- useCustomEvent: () => useCustomEvent,
25
- useEvent: () => useEvent
26
- });
27
- module.exports = __toCommonJS(src_exports);
28
-
29
- // src/hooks/useCustomEvent.ts
30
- var import_assert = require("@xylabs/assert");
31
- var import_react = require("react");
32
- var useCustomEvent = /* @__PURE__ */ __name((type, listener, customRef) => {
33
- const ref = customRef ?? (0, import_react.createRef)();
34
- (0, import_react.useEffect)(() => {
35
- const element = ref?.current;
36
- const currentListener = listener;
37
- const handler = currentListener ? (event) => {
38
- const detail = (0, import_assert.assertEx)(event.detail, () => "Event missing detail");
39
- const stop = currentListener(detail);
40
- if (stop) {
41
- event.stopPropagation();
42
- }
43
- } : void 0;
44
- if (handler && element) {
45
- element?.addEventListener(type, handler);
46
- }
47
- return () => {
48
- if (handler && element) {
49
- element?.removeEventListener(type, handler);
50
- }
51
- };
52
- });
53
- const dispatch = /* @__PURE__ */ __name((detail) => {
54
- const event = new CustomEvent(type, {
55
- bubbles: true,
56
- cancelable: true,
57
- composed: true,
58
- detail
59
- });
60
- ref.current?.dispatchEvent(event);
61
- }, "dispatch");
62
- return [
63
- ref,
64
- dispatch
65
- ];
66
- }, "useCustomEvent");
67
-
68
- // src/hooks/useEvent.ts
69
- var useEvent = /* @__PURE__ */ __name((listener, sharableRef) => {
70
- const [ref, customDispatch] = useCustomEvent("xyo", listener ? (detail) => {
71
- return listener(detail.noun, detail.verb, detail.data);
72
- } : void 0, sharableRef);
73
- const dispatch = /* @__PURE__ */ __name((noun, verb, data) => {
74
- return customDispatch({
75
- data,
76
- noun,
77
- verb
78
- });
79
- }, "dispatch");
80
- return [
81
- ref,
82
- dispatch
83
- ];
84
- }, "useEvent");
85
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks/index.ts'\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 // eslint-disable-next-line @eslint-react/no-create-ref\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.ts'\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;;;;;;;;ACAA,oBAAyB;AACzB,mBAAgD;AAIzC,IAAMA,iBAAiB,wBAC5BC,MACAC,UACAC,cAAAA;AAGA,QAAMC,MAAMD,iBAAaE,wBAAAA;AACzBC,8BAAU,MAAA;AACR,UAAMC,UAAUH,KAAKI;AACrB,UAAMC,kBAAkBP;AACxB,UAAMQ,UACFD,kBACE,CAACE,UAAAA;AACC,YAAMC,aAASC,wBAASF,MAAMC,QAAQ,MAAM,sBAAA;AAC5C,YAAME,OAAOL,gBAAgBG,MAAAA;AAC7B,UAAIE,MAAM;AACRH,cAAMI,gBAAe;MACvB;IACF,IACAC;AAEN,QAAIN,WAAWH,SAAS;AACtBA,eAASU,iBAAiBhB,MAAMS,OAAAA;IAClC;AACA,WAAO,MAAA;AACL,UAAIA,WAAWH,SAAS;AACtBA,iBAASW,oBAAoBjB,MAAMS,OAAAA;MACrC;IACF;EACF,CAAA;AACA,QAAMS,WAAyC,wBAACP,WAAAA;AAC9C,UAAMD,QAAQ,IAAIS,YAAqBnB,MAAM;MAC3CoB,SAAS;MACTC,YAAY;MACZC,UAAU;MACVX;IACF,CAAA;AACAR,QAAII,SAASgB,cAAcb,KAAAA;EAC7B,GAR+C;AAS/C,SAAO;IAACP;IAAKe;;AACf,GAxC8B;;;ACUvB,IAAMM,WAAW,wBACtBC,UACAC,gBAAAA;AAEA,QAAM,CAACC,KAAKC,cAAAA,IAAkBC,eAC5B,OACAJ,WACI,CAACK,WAAAA;AACC,WAAOL,SAASK,OAAOC,MAAMD,OAAOE,MAAMF,OAAOG,IAAI;EACvD,IACAC,QACJR,WAAAA;AAGF,QAAMS,WAA+C,wBAACJ,MAAaC,MAAaC,SAAAA;AAC9E,WAAOL,eAAe;MAAEK;MAAMF;MAAMC;IAAK,CAAA;EAC3C,GAFqD;AAGrD,SAAO;IAACL;IAAKQ;;AACf,GAlBwB;","names":["useCustomEvent","type","listener","customRef","ref","createRef","useEffect","element","current","currentListener","handler","event","detail","assertEx","stop","stopPropagation","undefined","addEventListener","removeEventListener","dispatch","CustomEvent","bubbles","cancelable","composed","dispatchEvent","useEvent","listener","sharableRef","ref","customDispatch","useCustomEvent","detail","noun","verb","data","undefined","dispatch"]}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,64 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/hooks/useCustomEvent.ts
5
- import { assertEx } from "@xylabs/assert";
6
- import { createRef, useEffect } from "react";
7
- var useCustomEvent = /* @__PURE__ */ __name((type, listener, customRef) => {
8
- const ref = customRef ?? createRef();
9
- useEffect(() => {
10
- const element = ref?.current;
11
- const currentListener = listener;
12
- const handler = currentListener ? (event) => {
13
- const detail = assertEx(event.detail, () => "Event missing detail");
14
- const stop = currentListener(detail);
15
- if (stop) {
16
- event.stopPropagation();
17
- }
18
- } : void 0;
19
- if (handler && element) {
20
- element?.addEventListener(type, handler);
21
- }
22
- return () => {
23
- if (handler && element) {
24
- element?.removeEventListener(type, handler);
25
- }
26
- };
27
- });
28
- const dispatch = /* @__PURE__ */ __name((detail) => {
29
- const event = new CustomEvent(type, {
30
- bubbles: true,
31
- cancelable: true,
32
- composed: true,
33
- detail
34
- });
35
- ref.current?.dispatchEvent(event);
36
- }, "dispatch");
37
- return [
38
- ref,
39
- dispatch
40
- ];
41
- }, "useCustomEvent");
42
-
43
- // src/hooks/useEvent.ts
44
- var useEvent = /* @__PURE__ */ __name((listener, sharableRef) => {
45
- const [ref, customDispatch] = useCustomEvent("xyo", listener ? (detail) => {
46
- return listener(detail.noun, detail.verb, detail.data);
47
- } : void 0, sharableRef);
48
- const dispatch = /* @__PURE__ */ __name((noun, verb, data) => {
49
- return customDispatch({
50
- data,
51
- noun,
52
- verb
53
- });
54
- }, "dispatch");
55
- return [
56
- ref,
57
- dispatch
58
- ];
59
- }, "useEvent");
60
- export {
61
- useCustomEvent,
62
- useEvent
63
- };
64
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
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 // eslint-disable-next-line @eslint-react/no-create-ref\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.ts'\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,SAASA,gBAAgB;AACzB,SAASC,WAAsBC,iBAAiB;AAIzC,IAAMC,iBAAiB,wBAC5BC,MACAC,UACAC,cAAAA;AAGA,QAAMC,MAAMD,aAAaE,UAAAA;AACzBC,YAAU,MAAA;AACR,UAAMC,UAAUH,KAAKI;AACrB,UAAMC,kBAAkBP;AACxB,UAAMQ,UACFD,kBACE,CAACE,UAAAA;AACC,YAAMC,SAASC,SAASF,MAAMC,QAAQ,MAAM,sBAAA;AAC5C,YAAME,OAAOL,gBAAgBG,MAAAA;AAC7B,UAAIE,MAAM;AACRH,cAAMI,gBAAe;MACvB;IACF,IACAC;AAEN,QAAIN,WAAWH,SAAS;AACtBA,eAASU,iBAAiBhB,MAAMS,OAAAA;IAClC;AACA,WAAO,MAAA;AACL,UAAIA,WAAWH,SAAS;AACtBA,iBAASW,oBAAoBjB,MAAMS,OAAAA;MACrC;IACF;EACF,CAAA;AACA,QAAMS,WAAyC,wBAACP,WAAAA;AAC9C,UAAMD,QAAQ,IAAIS,YAAqBnB,MAAM;MAC3CoB,SAAS;MACTC,YAAY;MACZC,UAAU;MACVX;IACF,CAAA;AACAR,QAAII,SAASgB,cAAcb,KAAAA;EAC7B,GAR+C;AAS/C,SAAO;IAACP;IAAKe;;AACf,GAxC8B;;;ACUvB,IAAMM,WAAW,wBACtBC,UACAC,gBAAAA;AAEA,QAAM,CAACC,KAAKC,cAAAA,IAAkBC,eAC5B,OACAJ,WACI,CAACK,WAAAA;AACC,WAAOL,SAASK,OAAOC,MAAMD,OAAOE,MAAMF,OAAOG,IAAI;EACvD,IACAC,QACJR,WAAAA;AAGF,QAAMS,WAA+C,wBAACJ,MAAaC,MAAaC,SAAAA;AAC9E,WAAOL,eAAe;MAAEK;MAAMF;MAAMC;IAAK,CAAA;EAC3C,GAFqD;AAGrD,SAAO;IAACL;IAAKQ;;AACf,GAlBwB;","names":["assertEx","createRef","useEffect","useCustomEvent","type","listener","customRef","ref","createRef","useEffect","element","current","currentListener","handler","event","detail","assertEx","stop","stopPropagation","undefined","addEventListener","removeEventListener","dispatch","CustomEvent","bubbles","cancelable","composed","dispatchEvent","useEvent","listener","sharableRef","ref","customDispatch","useCustomEvent","detail","noun","verb","data","undefined","dispatch"]}
@@ -1,3 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './useCustomEvent.ts';
2
- export * from './useEvent.ts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,4 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,4 +0,0 @@
1
- import { RefObject } from 'react';
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>, customRef?: RefObject<TElement>) => [RefObject<TElement>, CustomEventDispatch<TDetail>];
4
- //# sourceMappingURL=useCustomEvent.d.ts.map
@@ -1 +0,0 @@
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,CAoCpD,CAAA"}
@@ -1,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type EventNoun = 'payload' | 'boundwitness' | 'address' | 'hash' | 'signature' | 'schema';
3
- export type EventVerb = 'click' | 'favorite';
4
- export interface Event<TNoun = EventNoun, TVerb = EventVerb, TData = string> {
5
- data?: TData;
6
- noun: TNoun;
7
- verb: TVerb;
8
- }
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>, sharableRef?: RefObject<T>) => [RefObject<T>, EventDispatch<TNoun, TVerb, TData>];
11
- //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +0,0 @@
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,91 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
24
- useCustomEvent: () => useCustomEvent,
25
- useEvent: () => useEvent
26
- });
27
- module.exports = __toCommonJS(src_exports);
28
-
29
- // src/hooks/useCustomEvent.ts
30
- var import_assert = require("@xylabs/assert");
31
- var import_react = require("react");
32
- var useCustomEvent = /* @__PURE__ */ __name((type, listener, customRef) => {
33
- const ref = customRef ?? (0, import_react.createRef)();
34
- (0, import_react.useEffect)(() => {
35
- const element = ref == null ? void 0 : ref.current;
36
- const currentListener = listener;
37
- const handler = currentListener ? (event) => {
38
- const detail = (0, import_assert.assertEx)(event.detail, () => "Event missing detail");
39
- const stop = currentListener(detail);
40
- if (stop) {
41
- event.stopPropagation();
42
- }
43
- } : void 0;
44
- if (handler && element) {
45
- element == null ? void 0 : element.addEventListener(type, handler);
46
- }
47
- return () => {
48
- if (handler && element) {
49
- element == null ? void 0 : element.removeEventListener(type, handler);
50
- }
51
- };
52
- });
53
- const dispatch = /* @__PURE__ */ __name((detail) => {
54
- var _a;
55
- const event = new CustomEvent(type, {
56
- bubbles: true,
57
- cancelable: true,
58
- composed: true,
59
- detail
60
- });
61
- (_a = ref.current) == null ? void 0 : _a.dispatchEvent(event);
62
- }, "dispatch");
63
- return [
64
- ref,
65
- dispatch
66
- ];
67
- }, "useCustomEvent");
68
-
69
- // src/hooks/useEvent.ts
70
- var useEvent = /* @__PURE__ */ __name((listener, sharableRef) => {
71
- const [ref, customDispatch] = useCustomEvent("xyo", listener ? (detail) => {
72
- return listener(detail.noun, detail.verb, detail.data);
73
- } : void 0, sharableRef);
74
- const dispatch = /* @__PURE__ */ __name((noun, verb, data) => {
75
- return customDispatch({
76
- data,
77
- noun,
78
- verb
79
- });
80
- }, "dispatch");
81
- return [
82
- ref,
83
- dispatch
84
- ];
85
- }, "useEvent");
86
- // Annotate the CommonJS export names for ESM import in node:
87
- 0 && (module.exports = {
88
- useCustomEvent,
89
- useEvent
90
- });
91
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/hooks/useCustomEvent.ts","../../src/hooks/useEvent.ts"],"sourcesContent":["export * from './hooks/index.ts'\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 // eslint-disable-next-line @eslint-react/no-create-ref\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.ts'\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;;;;;;;;ACAA,oBAAyB;AACzB,mBAAgD;AAIzC,IAAMA,iBAAiB,wBAC5BC,MACAC,UACAC,cAAAA;AAGA,QAAMC,MAAMD,iBAAaE,wBAAAA;AACzBC,8BAAU,MAAA;AACR,UAAMC,UAAUH,2BAAKI;AACrB,UAAMC,kBAAkBP;AACxB,UAAMQ,UACFD,kBACE,CAACE,UAAAA;AACC,YAAMC,aAASC,wBAASF,MAAMC,QAAQ,MAAM,sBAAA;AAC5C,YAAME,OAAOL,gBAAgBG,MAAAA;AAC7B,UAAIE,MAAM;AACRH,cAAMI,gBAAe;MACvB;IACF,IACAC;AAEN,QAAIN,WAAWH,SAAS;AACtBA,yCAASU,iBAAiBhB,MAAMS;IAClC;AACA,WAAO,MAAA;AACL,UAAIA,WAAWH,SAAS;AACtBA,2CAASW,oBAAoBjB,MAAMS;MACrC;IACF;EACF,CAAA;AACA,QAAMS,WAAyC,wBAACP,WAAAA;AAnClD;AAoCI,UAAMD,QAAQ,IAAIS,YAAqBnB,MAAM;MAC3CoB,SAAS;MACTC,YAAY;MACZC,UAAU;MACVX;IACF,CAAA;AACAR,cAAII,YAAJJ,mBAAaoB,cAAcb;EAC7B,GAR+C;AAS/C,SAAO;IAACP;IAAKe;;AACf,GAxC8B;;;ACUvB,IAAMM,WAAW,wBACtBC,UACAC,gBAAAA;AAEA,QAAM,CAACC,KAAKC,cAAAA,IAAkBC,eAC5B,OACAJ,WACI,CAACK,WAAAA;AACC,WAAOL,SAASK,OAAOC,MAAMD,OAAOE,MAAMF,OAAOG,IAAI;EACvD,IACAC,QACJR,WAAAA;AAGF,QAAMS,WAA+C,wBAACJ,MAAaC,MAAaC,SAAAA;AAC9E,WAAOL,eAAe;MAAEK;MAAMF;MAAMC;IAAK,CAAA;EAC3C,GAFqD;AAGrD,SAAO;IAACL;IAAKQ;;AACf,GAlBwB;","names":["useCustomEvent","type","listener","customRef","ref","createRef","useEffect","element","current","currentListener","handler","event","detail","assertEx","stop","stopPropagation","undefined","addEventListener","removeEventListener","dispatch","CustomEvent","bubbles","cancelable","composed","dispatchEvent","useEvent","listener","sharableRef","ref","customDispatch","useCustomEvent","detail","noun","verb","data","undefined","dispatch"]}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './hooks/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,65 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/hooks/useCustomEvent.ts
5
- import { assertEx } from "@xylabs/assert";
6
- import { createRef, useEffect } from "react";
7
- var useCustomEvent = /* @__PURE__ */ __name((type, listener, customRef) => {
8
- const ref = customRef ?? createRef();
9
- useEffect(() => {
10
- const element = ref == null ? void 0 : ref.current;
11
- const currentListener = listener;
12
- const handler = currentListener ? (event) => {
13
- const detail = assertEx(event.detail, () => "Event missing detail");
14
- const stop = currentListener(detail);
15
- if (stop) {
16
- event.stopPropagation();
17
- }
18
- } : void 0;
19
- if (handler && element) {
20
- element == null ? void 0 : element.addEventListener(type, handler);
21
- }
22
- return () => {
23
- if (handler && element) {
24
- element == null ? void 0 : element.removeEventListener(type, handler);
25
- }
26
- };
27
- });
28
- const dispatch = /* @__PURE__ */ __name((detail) => {
29
- var _a;
30
- const event = new CustomEvent(type, {
31
- bubbles: true,
32
- cancelable: true,
33
- composed: true,
34
- detail
35
- });
36
- (_a = ref.current) == null ? void 0 : _a.dispatchEvent(event);
37
- }, "dispatch");
38
- return [
39
- ref,
40
- dispatch
41
- ];
42
- }, "useCustomEvent");
43
-
44
- // src/hooks/useEvent.ts
45
- var useEvent = /* @__PURE__ */ __name((listener, sharableRef) => {
46
- const [ref, customDispatch] = useCustomEvent("xyo", listener ? (detail) => {
47
- return listener(detail.noun, detail.verb, detail.data);
48
- } : void 0, sharableRef);
49
- const dispatch = /* @__PURE__ */ __name((noun, verb, data) => {
50
- return customDispatch({
51
- data,
52
- noun,
53
- verb
54
- });
55
- }, "dispatch");
56
- return [
57
- ref,
58
- dispatch
59
- ];
60
- }, "useEvent");
61
- export {
62
- useCustomEvent,
63
- useEvent
64
- };
65
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
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 // eslint-disable-next-line @eslint-react/no-create-ref\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.ts'\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,SAASA,gBAAgB;AACzB,SAASC,WAAsBC,iBAAiB;AAIzC,IAAMC,iBAAiB,wBAC5BC,MACAC,UACAC,cAAAA;AAGA,QAAMC,MAAMD,aAAaE,UAAAA;AACzBC,YAAU,MAAA;AACR,UAAMC,UAAUH,2BAAKI;AACrB,UAAMC,kBAAkBP;AACxB,UAAMQ,UACFD,kBACE,CAACE,UAAAA;AACC,YAAMC,SAASC,SAASF,MAAMC,QAAQ,MAAM,sBAAA;AAC5C,YAAME,OAAOL,gBAAgBG,MAAAA;AAC7B,UAAIE,MAAM;AACRH,cAAMI,gBAAe;MACvB;IACF,IACAC;AAEN,QAAIN,WAAWH,SAAS;AACtBA,yCAASU,iBAAiBhB,MAAMS;IAClC;AACA,WAAO,MAAA;AACL,UAAIA,WAAWH,SAAS;AACtBA,2CAASW,oBAAoBjB,MAAMS;MACrC;IACF;EACF,CAAA;AACA,QAAMS,WAAyC,wBAACP,WAAAA;AAnClD;AAoCI,UAAMD,QAAQ,IAAIS,YAAqBnB,MAAM;MAC3CoB,SAAS;MACTC,YAAY;MACZC,UAAU;MACVX;IACF,CAAA;AACAR,cAAII,YAAJJ,mBAAaoB,cAAcb;EAC7B,GAR+C;AAS/C,SAAO;IAACP;IAAKe;;AACf,GAxC8B;;;ACUvB,IAAMM,WAAW,wBACtBC,UACAC,gBAAAA;AAEA,QAAM,CAACC,KAAKC,cAAAA,IAAkBC,eAC5B,OACAJ,WACI,CAACK,WAAAA;AACC,WAAOL,SAASK,OAAOC,MAAMD,OAAOE,MAAMF,OAAOG,IAAI;EACvD,IACAC,QACJR,WAAAA;AAGF,QAAMS,WAA+C,wBAACJ,MAAaC,MAAaC,SAAAA;AAC9E,WAAOL,eAAe;MAAEK;MAAMF;MAAMC;IAAK,CAAA;EAC3C,GAFqD;AAGrD,SAAO;IAACL;IAAKQ;;AACf,GAlBwB;","names":["assertEx","createRef","useEffect","useCustomEvent","type","listener","customRef","ref","createRef","useEffect","element","current","currentListener","handler","event","detail","assertEx","stop","stopPropagation","undefined","addEventListener","removeEventListener","dispatch","CustomEvent","bubbles","cancelable","composed","dispatchEvent","useEvent","listener","sharableRef","ref","customDispatch","useCustomEvent","detail","noun","verb","data","undefined","dispatch"]}