@yume-chan/event 2.0.0 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +1 -1
  2. package/esm/absence.d.ts +7 -0
  3. package/esm/absence.d.ts.map +1 -0
  4. package/esm/absence.js +6 -0
  5. package/esm/absence.js.map +1 -0
  6. package/esm/disposable.d.ts +1 -0
  7. package/esm/disposable.d.ts.map +1 -1
  8. package/esm/disposable.js +3 -0
  9. package/esm/disposable.js.map +1 -1
  10. package/esm/event-emitter.d.ts +6 -6
  11. package/esm/event-emitter.d.ts.map +1 -1
  12. package/esm/event-emitter.js.map +1 -1
  13. package/esm/event.d.ts +5 -5
  14. package/esm/event.d.ts.map +1 -1
  15. package/esm/index.d.ts +2 -1
  16. package/esm/index.d.ts.map +1 -1
  17. package/esm/index.js +2 -1
  18. package/esm/index.js.map +1 -1
  19. package/esm/once.d.ts +8 -0
  20. package/esm/once.d.ts.map +1 -0
  21. package/esm/once.js +14 -0
  22. package/esm/once.js.map +1 -0
  23. package/esm/pipe.d.ts +9 -0
  24. package/esm/pipe.d.ts.map +1 -0
  25. package/esm/pipe.js +14 -0
  26. package/esm/pipe.js.map +1 -0
  27. package/esm/sticky-event-emitter.d.ts +26 -2
  28. package/esm/sticky-event-emitter.d.ts.map +1 -1
  29. package/esm/sticky-event-emitter.js +40 -3
  30. package/esm/sticky-event-emitter.js.map +1 -1
  31. package/package.json +8 -8
  32. package/src/absence.ts +7 -0
  33. package/src/disposable.ts +4 -0
  34. package/src/event-emitter.ts +9 -14
  35. package/src/event.ts +10 -12
  36. package/src/index.ts +2 -1
  37. package/src/once.ts +16 -0
  38. package/src/pipe.ts +22 -0
  39. package/src/sticky-event-emitter.ts +57 -8
  40. package/CHANGELOG.md +0 -118
  41. package/esm/utils.d.ts +0 -3
  42. package/esm/utils.d.ts.map +0 -1
  43. package/esm/utils.js +0 -9
  44. package/esm/utils.js.map +0 -1
  45. package/src/utils.ts +0 -11
  46. package/tsconfig.build.tsbuildinfo +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020-2025 Simon Chan
3
+ Copyright (c) 2020-2026 Simon Chan
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `undefined` is a valid value if `TEvent` includes `undefined`,
3
+ * so we use a unique symbol to represent the absence of value.
4
+ */
5
+ export declare const Absence: unique symbol;
6
+ export type Absence = typeof Absence;
7
+ //# sourceMappingURL=absence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"absence.d.ts","sourceRoot":"","sources":["../src/absence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO,eAAoB,CAAC;AAEzC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC"}
package/esm/absence.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `undefined` is a valid value if `TEvent` includes `undefined`,
3
+ * so we use a unique symbol to represent the absence of value.
4
+ */
5
+ export const Absence = Symbol("absence");
6
+ //# sourceMappingURL=absence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"absence.js","sourceRoot":"","sources":["../src/absence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC"}
@@ -6,6 +6,7 @@ export declare class AutoDisposable implements Disposable {
6
6
  constructor();
7
7
  protected addDisposable<T extends Disposable>(disposable: T): T;
8
8
  dispose(): void;
9
+ [Symbol.dispose](): void;
9
10
  }
10
11
  export declare class DisposableList extends AutoDisposable {
11
12
  add<T extends Disposable>(disposable: T): T;
@@ -1 +1 @@
1
- {"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,OAAO,IAAI,IAAI,CAAC;CACnB;AAED,qBAAa,cAAe,YAAW,UAAU;;;IAO7C,SAAS,CAAC,aAAa,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;IAK/D,OAAO;CAOV;AAED,qBAAa,cAAe,SAAQ,cAAc;IAC9C,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;CAG9C"}
1
+ {"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,OAAO,IAAI,IAAI,CAAC;CACnB;AAED,qBAAa,cAAe,YAAW,UAAU;;;IAO7C,SAAS,CAAC,aAAa,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;IAK/D,OAAO;IAQP,CAAC,MAAM,CAAC,OAAO,CAAC;CAGnB;AAED,qBAAa,cAAe,SAAQ,cAAc;IAC9C,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;CAG9C"}
package/esm/disposable.js CHANGED
@@ -13,6 +13,9 @@ export class AutoDisposable {
13
13
  }
14
14
  this.#disposables = [];
15
15
  }
16
+ [Symbol.dispose]() {
17
+ this.dispose();
18
+ }
16
19
  }
17
20
  export class DisposableList extends AutoDisposable {
18
21
  add(disposable) {
@@ -1 +1 @@
1
- {"version":3,"file":"disposable.js","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,cAAc;IACvB,YAAY,GAAiB,EAAE,CAAC;IAEhC;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAES,aAAa,CAAuB,UAAa;QACvD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnC,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,OAAO;QACH,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACzC,UAAU,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IAC3B,CAAC;CACJ;AAED,MAAM,OAAO,cAAe,SAAQ,cAAc;IAC9C,GAAG,CAAuB,UAAa;QACnC,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;CACJ"}
1
+ {"version":3,"file":"disposable.js","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,cAAc;IACvB,YAAY,GAAiB,EAAE,CAAC;IAEhC;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAES,aAAa,CAAuB,UAAa;QACvD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnC,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,OAAO;QACH,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACzC,UAAU,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED,CAAC,MAAM,CAAC,OAAO,CAAC;QACZ,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;CACJ;AAED,MAAM,OAAO,cAAe,SAAQ,cAAc;IAC9C,GAAG,CAAuB,UAAa;QACnC,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;CACJ"}
@@ -1,15 +1,15 @@
1
1
  import type { Disposable } from "./disposable.js";
2
2
  import type { Event, EventListener, RemoveEventListener } from "./event.js";
3
- export interface EventListenerInfo<TEvent, TResult = unknown> {
4
- listener: EventListener<TEvent, unknown, unknown[], TResult>;
3
+ export interface EventListenerInfo<TEvent> {
4
+ listener: EventListener<TEvent, unknown, unknown[]>;
5
5
  thisArg: unknown;
6
6
  args: unknown[];
7
7
  }
8
- export declare class EventEmitter<TEvent, TResult = unknown> implements Disposable {
9
- protected readonly listeners: EventListenerInfo<TEvent, TResult>[];
8
+ export declare class EventEmitter<TEvent> implements Disposable {
9
+ protected readonly listeners: EventListenerInfo<TEvent>[];
10
10
  constructor();
11
- protected addEventListener(info: EventListenerInfo<TEvent, TResult>): RemoveEventListener;
12
- event: Event<TEvent, TResult>;
11
+ protected addEventListener(info: EventListenerInfo<TEvent>): RemoveEventListener;
12
+ event: Event<TEvent>;
13
13
  fire(e: TEvent): void;
14
14
  dispose(): void;
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,WAAW,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IACxD,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAE7D,OAAO,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,OAAO,EAAE,CAAC;CACnB;AAED,qBAAa,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAE,YAAW,UAAU;IACtE,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAM;;IAMxE,SAAS,CAAC,gBAAgB,CACtB,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,mBAAmB;IAatB,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAgB3B;IAEF,IAAI,CAAC,CAAC,EAAE,MAAM;IAMd,OAAO;CAGV"}
1
+ {"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,WAAW,iBAAiB,CAAC,MAAM;IACrC,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpD,OAAO,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,OAAO,EAAE,CAAC;CACnB;AAED,qBAAa,YAAY,CAAC,MAAM,CAAE,YAAW,UAAU;IACnD,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAM;;IAM/D,SAAS,CAAC,gBAAgB,CACtB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAChC,mBAAmB;IAatB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAWlB;IAEF,IAAI,CAAC,CAAC,EAAE,MAAM;IAMd,OAAO;CAGV"}
@@ -1 +1 @@
1
- {"version":3,"file":"event-emitter.js","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,YAAY;IACF,SAAS,GAAyC,EAAE,CAAC;IAExE;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAES,gBAAgB,CACtB,IAAwC;QAExC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1B,MAAM,MAAM,GAAwB,GAAG,EAAE;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACpC,CAAC;QACL,CAAC,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,GAA2B,CAC5B,QAAsD,EACtD,OAAe,EACf,GAAG,IAAW,EAChB,EAAE;QACA,MAAM,IAAI,GAAuC;YAC7C,QAAQ,EAAE,QAKT;YACD,OAAO;YACP,IAAI;SACP,CAAC;QACF,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,IAAI,CAAC,CAAS;QACV,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;YACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED,OAAO;QACH,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;CACJ"}
1
+ {"version":3,"file":"event-emitter.js","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,YAAY;IACF,SAAS,GAAgC,EAAE,CAAC;IAE/D;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAES,gBAAgB,CACtB,IAA+B;QAE/B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1B,MAAM,MAAM,GAAwB,GAAG,EAAE;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACpC,CAAC;QACL,CAAC,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,GAAkB,CACnB,QAA6C,EAC7C,OAAe,EACf,GAAG,IAAW,EAChB,EAAE;QACA,MAAM,IAAI,GAA8B;YACpC,QAAQ,EAAE,QAAqD;YAC/D,OAAO;YACP,IAAI;SACP,CAAC;QACF,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,IAAI,CAAC,CAAS;QACV,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;YACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED,OAAO;QACH,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;CACJ"}
package/esm/event.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import type { Disposable } from "./disposable.js";
2
- export interface EventListener<TEvent, TThis, TArgs extends unknown[], TResult> {
3
- (this: TThis, e: TEvent, ...args: TArgs): TResult;
2
+ export interface EventListener<TEvent, TThis, TArgs extends unknown[]> {
3
+ (this: TThis, e: TEvent, ...args: TArgs): unknown;
4
4
  }
5
5
  export interface RemoveEventListener extends Disposable {
6
6
  (): void;
7
7
  }
8
- export interface Event<TEvent, TResult = unknown> {
8
+ export interface Event<TEvent> {
9
9
  /**
10
10
  * Attaches an event listener.
11
11
  */
12
- (listener: EventListener<TEvent, unknown, [], TResult>): RemoveEventListener;
12
+ (listener: EventListener<TEvent, unknown, []>): RemoveEventListener;
13
13
  /**
14
14
  * Attaches an event listener that bind to `this` and `args`.
15
15
  */
16
- <TThis, TArgs extends unknown[]>(listener: EventListener<TEvent, TThis, TArgs, TResult>, thisArg: TThis, ...args: TArgs): RemoveEventListener;
16
+ <TThis, TArgs extends unknown[]>(listener: EventListener<TEvent, TThis, TArgs>, thisArg: TThis, ...args: TArgs): RemoveEventListener;
17
17
  }
18
18
  //# sourceMappingURL=event.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,aAAa,CAC1B,MAAM,EACN,KAAK,EACL,KAAK,SAAS,OAAO,EAAE,EACvB,OAAO;IAEP,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;CACrD;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACnD,IAAI,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IAC5C;;OAEG;IACH,CACI,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,GACtD,mBAAmB,CAAC;IAEvB;;OAEG;IACH,CAAC,KAAK,EAAE,KAAK,SAAS,OAAO,EAAE,EAC3B,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EACtD,OAAO,EAAE,KAAK,EACd,GAAG,IAAI,EAAE,KAAK,GACf,mBAAmB,CAAC;CAC1B"}
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,SAAS,OAAO,EAAE;IAMjE,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;CACrD;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACnD,IAAI,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,KAAK,CAAC,MAAM;IACzB;;OAEG;IACH,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,mBAAmB,CAAC;IAEpE;;OAEG;IACH,CAAC,KAAK,EAAE,KAAK,SAAS,OAAO,EAAE,EAC3B,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAC7C,OAAO,EAAE,KAAK,EACd,GAAG,IAAI,EAAE,KAAK,GACf,mBAAmB,CAAC;CAC1B"}
package/esm/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./disposable.js";
2
2
  export * from "./event-emitter.js";
3
3
  export * from "./event.js";
4
+ export * from "./once.js";
5
+ export * from "./pipe.js";
4
6
  export * from "./sticky-event-emitter.js";
5
- export * from "./utils.js";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC"}
package/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./disposable.js";
2
2
  export * from "./event-emitter.js";
3
3
  export * from "./event.js";
4
+ export * from "./once.js";
5
+ export * from "./pipe.js";
4
6
  export * from "./sticky-event-emitter.js";
5
- export * from "./utils.js";
6
7
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC"}
package/esm/once.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { Event } from "./event.js";
2
+ /**
3
+ * Asynchronously waits for the next occurrence of the event and returns its value.
4
+ * @param event The event to wait for.
5
+ * @returns A promise that resolves with the value of the next occurrence of the event.
6
+ */
7
+ export declare function once<T>(event: Event<T>): Promise<T>;
8
+ //# sourceMappingURL=once.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"once.d.ts","sourceRoot":"","sources":["../src/once.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMzD"}
package/esm/once.js ADDED
@@ -0,0 +1,14 @@
1
+ import { PromiseResolver } from "@yume-chan/async";
2
+ /**
3
+ * Asynchronously waits for the next occurrence of the event and returns its value.
4
+ * @param event The event to wait for.
5
+ * @returns A promise that resolves with the value of the next occurrence of the event.
6
+ */
7
+ export async function once(event) {
8
+ const resolver = new PromiseResolver();
9
+ const dispose = event((value) => void resolver.resolve(value));
10
+ const result = await resolver.promise;
11
+ dispose();
12
+ return result;
13
+ }
14
+ //# sourceMappingURL=once.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"once.js","sourceRoot":"","sources":["../src/once.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAI,KAAe;IACzC,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAK,CAAC;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;IACtC,OAAO,EAAE,CAAC;IACV,OAAO,MAAM,CAAC;AAClB,CAAC"}
package/esm/pipe.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import type { Event } from "./event.js";
2
+ /**
3
+ * Creates a new event that emits the transformed value whenever the source event emits a value.
4
+ * @param source The source event
5
+ * @param transform A function that transforms the value of the source event to the value of the new event
6
+ * @returns A new event that emits the transformed value whenever the source event emits a value
7
+ */
8
+ export declare function pipe<TSource, TNew>(source: Event<TSource>, transform: (value: TSource) => TNew): Event<TNew>;
9
+ //# sourceMappingURL=pipe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,IAAI,EAC9B,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EACtB,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACpC,KAAK,CAAC,IAAI,CAAC,CAUb"}
package/esm/pipe.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Creates a new event that emits the transformed value whenever the source event emits a value.
3
+ * @param source The source event
4
+ * @param transform A function that transforms the value of the source event to the value of the new event
5
+ * @returns A new event that emits the transformed value whenever the source event emits a value
6
+ */
7
+ export function pipe(source, transform) {
8
+ return (listener, thisArg, ...args) => {
9
+ return source((value) => {
10
+ return listener.call(thisArg, transform(value), ...args);
11
+ });
12
+ };
13
+ }
14
+ //# sourceMappingURL=pipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAChB,MAAsB,EACtB,SAAmC;IAEnC,OAAO,CACH,QAAmD,EACnD,OAAiB,EACjB,GAAG,IAAe,EACpB,EAAE;QACA,OAAO,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
@@ -1,9 +1,33 @@
1
1
  import type { EventListenerInfo } from "./event-emitter.js";
2
2
  import { EventEmitter } from "./event-emitter.js";
3
3
  import type { RemoveEventListener } from "./event.js";
4
- export declare class StickyEventEmitter<TEvent, TResult = unknown> extends EventEmitter<TEvent, TResult> {
4
+ /**
5
+ * An event emitter that remembers the last emitted value and immediately emits it to new listeners.
6
+ */
7
+ export declare class StickyEventEmitter<TEvent> extends EventEmitter<TEvent> {
5
8
  #private;
6
- protected addEventListener(info: EventListenerInfo<TEvent, TResult>): RemoveEventListener;
9
+ /**
10
+ * Gets whether there is a value. If `true`, `value` can be accessed without error.
11
+ */
12
+ get hasValue(): boolean;
13
+ /**
14
+ * Gets the current value. If there is no value, throws an error.
15
+ */
16
+ get value(): TEvent;
17
+ constructor(options?: StickyEventEmitter.Options<TEvent>);
18
+ protected addEventListener(info: EventListenerInfo<TEvent>): RemoveEventListener;
7
19
  fire(e: TEvent): void;
8
20
  }
21
+ export declare namespace StickyEventEmitter {
22
+ interface Options<TEvent> {
23
+ initialValue?: TEvent;
24
+ /**
25
+ * An optional comparator function to determine whether the new value is equal to the current value.
26
+ * If the new value is equal to the current value, the event will not be emitted.
27
+ *
28
+ * If not provided, all values are considered different.
29
+ */
30
+ equals?: (a: TEvent, b: TEvent) => boolean;
31
+ }
32
+ }
9
33
  //# sourceMappingURL=sticky-event-emitter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sticky-event-emitter.d.ts","sourceRoot":"","sources":["../src/sticky-event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAItD,qBAAa,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAE,SAAQ,YAAY,CAC3E,MAAM,EACN,OAAO,CACV;;cAGsB,gBAAgB,CAC/B,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,mBAAmB;IAOb,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;CAIjC"}
1
+ {"version":3,"file":"sticky-event-emitter.d.ts","sourceRoot":"","sources":["../src/sticky-event-emitter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;GAEG;AACH,qBAAa,kBAAkB,CAAC,MAAM,CAAE,SAAQ,YAAY,CAAC,MAAM,CAAC;;IAEhE;;OAEG;IACH,IAAI,QAAQ,YAEX;IACD;;OAEG;IACH,IAAI,KAAK,WAKR;gBAIW,OAAO,GAAE,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAM;cAgBzC,gBAAgB,CAC/B,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAChC,mBAAmB;IAOb,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;CAOjC;AAED,yBAAiB,kBAAkB,CAAC;IAChC,UAAiB,OAAO,CAAC,MAAM;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;;;;WAKG;QACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;KAC9C;CACJ"}
@@ -1,14 +1,51 @@
1
+ import { Absence } from "./absence.js";
1
2
  import { EventEmitter } from "./event-emitter.js";
2
- const Undefined = Symbol("undefined");
3
+ /**
4
+ * An event emitter that remembers the last emitted value and immediately emits it to new listeners.
5
+ */
3
6
  export class StickyEventEmitter extends EventEmitter {
4
- #value = Undefined;
7
+ #value;
8
+ /**
9
+ * Gets whether there is a value. If `true`, `value` can be accessed without error.
10
+ */
11
+ get hasValue() {
12
+ return this.#value !== Absence;
13
+ }
14
+ /**
15
+ * Gets the current value. If there is no value, throws an error.
16
+ */
17
+ get value() {
18
+ if (this.#value === Absence) {
19
+ throw new Error("No value");
20
+ }
21
+ return this.#value;
22
+ }
23
+ #equal;
24
+ constructor(options = {}) {
25
+ super();
26
+ if ("initialValue" in options) {
27
+ this.#value = options.initialValue;
28
+ }
29
+ else {
30
+ this.#value = Absence;
31
+ }
32
+ if (options.equals) {
33
+ this.#equal = options.equals;
34
+ }
35
+ else {
36
+ this.#equal = () => false;
37
+ }
38
+ }
5
39
  addEventListener(info) {
6
- if (this.#value !== Undefined) {
40
+ if (this.#value !== Absence) {
7
41
  info.listener.call(info.thisArg, this.#value, ...info.args);
8
42
  }
9
43
  return super.addEventListener(info);
10
44
  }
11
45
  fire(e) {
46
+ if (this.#value !== Absence && this.#equal(this.#value, e)) {
47
+ return;
48
+ }
12
49
  this.#value = e;
13
50
  super.fire(e);
14
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sticky-event-emitter.js","sourceRoot":"","sources":["../src/sticky-event-emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEtC,MAAM,OAAO,kBAA8C,SAAQ,YAGlE;IACG,MAAM,GAA8B,SAAS,CAAC;IAE3B,gBAAgB,CAC/B,IAAwC;QAExC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEQ,IAAI,CAAC,CAAS;QACnB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACJ"}
1
+ {"version":3,"file":"sticky-event-emitter.js","sourceRoot":"","sources":["../src/sticky-event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;GAEG;AACH,MAAM,OAAO,kBAA2B,SAAQ,YAAoB;IAChE,MAAM,CAAmB;IACzB;;OAEG;IACH,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;IACnC,CAAC;IACD;;OAEG;IACH,IAAI,KAAK;QACL,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,MAAM,CAAoC;IAE1C,YAAY,UAA8C,EAAE;QACxD,KAAK,EAAE,CAAC;QAER,IAAI,cAAc,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;QACvC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QAC1B,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACjC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;QAC9B,CAAC;IACL,CAAC;IAEkB,gBAAgB,CAC/B,IAA+B;QAE/B,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEQ,IAAI,CAAC,CAAS;QACnB,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;YACzD,OAAO;QACX,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yume-chan/event",
3
- "version": "2.0.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "Event/EventEmitter",
5
5
  "keywords": [
6
6
  "event",
@@ -27,18 +27,18 @@
27
27
  "types": "esm/index.d.ts",
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
- "@yume-chan/async": "^4.0.2"
30
+ "@yume-chan/async": "^4.1.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^22.13.10",
34
- "prettier": "^3.5.3",
35
- "typescript": "^5.8.2",
36
- "@yume-chan/test-runner": "^1.0.0",
33
+ "@types/node": "^26.1.1",
34
+ "prettier": "^3.9.6",
35
+ "typescript": "^6.0.3",
37
36
  "@yume-chan/eslint-config": "^1.0.0",
38
- "@yume-chan/tsconfig": "^1.0.0"
37
+ "@yume-chan/tsconfig": "^1.0.0",
38
+ "@yume-chan/test-runner": "^1.0.0"
39
39
  },
40
40
  "scripts": {
41
- "build": "tsc -b tsconfig.build.json",
41
+ "build": "tsc -p tsconfig.build.json",
42
42
  "lint": "run-eslint && prettier src/**/*.ts --write --tab-width 4",
43
43
  "test": "run-test"
44
44
  }
package/src/absence.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `undefined` is a valid value if `TEvent` includes `undefined`,
3
+ * so we use a unique symbol to represent the absence of value.
4
+ */
5
+ export const Absence = Symbol("absence");
6
+
7
+ export type Absence = typeof Absence;
package/src/disposable.ts CHANGED
@@ -21,6 +21,10 @@ export class AutoDisposable implements Disposable {
21
21
 
22
22
  this.#disposables = [];
23
23
  }
24
+
25
+ [Symbol.dispose]() {
26
+ this.dispose();
27
+ }
24
28
  }
25
29
 
26
30
  export class DisposableList extends AutoDisposable {
@@ -1,23 +1,23 @@
1
1
  import type { Disposable } from "./disposable.js";
2
2
  import type { Event, EventListener, RemoveEventListener } from "./event.js";
3
3
 
4
- export interface EventListenerInfo<TEvent, TResult = unknown> {
5
- listener: EventListener<TEvent, unknown, unknown[], TResult>;
4
+ export interface EventListenerInfo<TEvent> {
5
+ listener: EventListener<TEvent, unknown, unknown[]>;
6
6
 
7
7
  thisArg: unknown;
8
8
 
9
9
  args: unknown[];
10
10
  }
11
11
 
12
- export class EventEmitter<TEvent, TResult = unknown> implements Disposable {
13
- protected readonly listeners: EventListenerInfo<TEvent, TResult>[] = [];
12
+ export class EventEmitter<TEvent> implements Disposable {
13
+ protected readonly listeners: EventListenerInfo<TEvent>[] = [];
14
14
 
15
15
  constructor() {
16
16
  this.event = this.event.bind(this);
17
17
  }
18
18
 
19
19
  protected addEventListener(
20
- info: EventListenerInfo<TEvent, TResult>,
20
+ info: EventListenerInfo<TEvent>,
21
21
  ): RemoveEventListener {
22
22
  this.listeners.push(info);
23
23
 
@@ -31,18 +31,13 @@ export class EventEmitter<TEvent, TResult = unknown> implements Disposable {
31
31
  return remove;
32
32
  }
33
33
 
34
- event: Event<TEvent, TResult> = <TThis, TArgs extends unknown[]>(
35
- listener: EventListener<TEvent, TThis, TArgs, TResult>,
34
+ event: Event<TEvent> = <TThis, TArgs extends unknown[]>(
35
+ listener: EventListener<TEvent, TThis, TArgs>,
36
36
  thisArg?: TThis,
37
37
  ...args: TArgs
38
38
  ) => {
39
- const info: EventListenerInfo<TEvent, TResult> = {
40
- listener: listener as EventListener<
41
- TEvent,
42
- unknown,
43
- unknown[],
44
- TResult
45
- >,
39
+ const info: EventListenerInfo<TEvent> = {
40
+ listener: listener as EventListener<TEvent, unknown, unknown[]>,
46
41
  thisArg,
47
42
  args,
48
43
  };
package/src/event.ts CHANGED
@@ -1,31 +1,29 @@
1
1
  import type { Disposable } from "./disposable.js";
2
2
 
3
- export interface EventListener<
4
- TEvent,
5
- TThis,
6
- TArgs extends unknown[],
7
- TResult,
8
- > {
9
- (this: TThis, e: TEvent, ...args: TArgs): TResult;
3
+ export interface EventListener<TEvent, TThis, TArgs extends unknown[]> {
4
+ // https://typescript-eslint.io/rules/no-misused-promises/
5
+ // ESLint `@typescript-eslint/no-misused-promises` rule does not allow
6
+ // converting async functions to `void`-returning function types.
7
+ // So use `unknown` as return type to allow that,
8
+ // because we don't care whether the listener is async or not.
9
+ (this: TThis, e: TEvent, ...args: TArgs): unknown;
10
10
  }
11
11
 
12
12
  export interface RemoveEventListener extends Disposable {
13
13
  (): void;
14
14
  }
15
15
 
16
- export interface Event<TEvent, TResult = unknown> {
16
+ export interface Event<TEvent> {
17
17
  /**
18
18
  * Attaches an event listener.
19
19
  */
20
- (
21
- listener: EventListener<TEvent, unknown, [], TResult>,
22
- ): RemoveEventListener;
20
+ (listener: EventListener<TEvent, unknown, []>): RemoveEventListener;
23
21
 
24
22
  /**
25
23
  * Attaches an event listener that bind to `this` and `args`.
26
24
  */
27
25
  <TThis, TArgs extends unknown[]>(
28
- listener: EventListener<TEvent, TThis, TArgs, TResult>,
26
+ listener: EventListener<TEvent, TThis, TArgs>,
29
27
  thisArg: TThis,
30
28
  ...args: TArgs
31
29
  ): RemoveEventListener;
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./disposable.js";
2
2
  export * from "./event-emitter.js";
3
3
  export * from "./event.js";
4
+ export * from "./once.js";
5
+ export * from "./pipe.js";
4
6
  export * from "./sticky-event-emitter.js";
5
- export * from "./utils.js";
package/src/once.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { PromiseResolver } from "@yume-chan/async";
2
+
3
+ import type { Event } from "./event.js";
4
+
5
+ /**
6
+ * Asynchronously waits for the next occurrence of the event and returns its value.
7
+ * @param event The event to wait for.
8
+ * @returns A promise that resolves with the value of the next occurrence of the event.
9
+ */
10
+ export async function once<T>(event: Event<T>): Promise<T> {
11
+ const resolver = new PromiseResolver<T>();
12
+ const dispose = event((value) => void resolver.resolve(value));
13
+ const result = await resolver.promise;
14
+ dispose();
15
+ return result;
16
+ }
package/src/pipe.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { Event } from "./event.js";
2
+
3
+ /**
4
+ * Creates a new event that emits the transformed value whenever the source event emits a value.
5
+ * @param source The source event
6
+ * @param transform A function that transforms the value of the source event to the value of the new event
7
+ * @returns A new event that emits the transformed value whenever the source event emits a value
8
+ */
9
+ export function pipe<TSource, TNew>(
10
+ source: Event<TSource>,
11
+ transform: (value: TSource) => TNew,
12
+ ): Event<TNew> {
13
+ return (
14
+ listener: (value: TNew, ...args: unknown[]) => void,
15
+ thisArg?: unknown,
16
+ ...args: unknown[]
17
+ ) => {
18
+ return source((value) => {
19
+ return listener.call(thisArg, transform(value), ...args);
20
+ });
21
+ };
22
+ }
@@ -1,26 +1,75 @@
1
+ import { Absence } from "./absence.js";
1
2
  import type { EventListenerInfo } from "./event-emitter.js";
2
3
  import { EventEmitter } from "./event-emitter.js";
3
4
  import type { RemoveEventListener } from "./event.js";
4
5
 
5
- const Undefined = Symbol("undefined");
6
+ /**
7
+ * An event emitter that remembers the last emitted value and immediately emits it to new listeners.
8
+ */
9
+ export class StickyEventEmitter<TEvent> extends EventEmitter<TEvent> {
10
+ #value: TEvent | Absence;
11
+ /**
12
+ * Gets whether there is a value. If `true`, `value` can be accessed without error.
13
+ */
14
+ get hasValue() {
15
+ return this.#value !== Absence;
16
+ }
17
+ /**
18
+ * Gets the current value. If there is no value, throws an error.
19
+ */
20
+ get value() {
21
+ if (this.#value === Absence) {
22
+ throw new Error("No value");
23
+ }
24
+ return this.#value;
25
+ }
26
+
27
+ #equal: (a: TEvent, b: TEvent) => boolean;
28
+
29
+ constructor(options: StickyEventEmitter.Options<TEvent> = {}) {
30
+ super();
31
+
32
+ if ("initialValue" in options) {
33
+ this.#value = options.initialValue;
34
+ } else {
35
+ this.#value = Absence;
36
+ }
6
37
 
7
- export class StickyEventEmitter<TEvent, TResult = unknown> extends EventEmitter<
8
- TEvent,
9
- TResult
10
- > {
11
- #value: TEvent | typeof Undefined = Undefined;
38
+ if (options.equals) {
39
+ this.#equal = options.equals;
40
+ } else {
41
+ this.#equal = () => false;
42
+ }
43
+ }
12
44
 
13
45
  protected override addEventListener(
14
- info: EventListenerInfo<TEvent, TResult>,
46
+ info: EventListenerInfo<TEvent>,
15
47
  ): RemoveEventListener {
16
- if (this.#value !== Undefined) {
48
+ if (this.#value !== Absence) {
17
49
  info.listener.call(info.thisArg, this.#value, ...info.args);
18
50
  }
19
51
  return super.addEventListener(info);
20
52
  }
21
53
 
22
54
  override fire(e: TEvent): void {
55
+ if (this.#value !== Absence && this.#equal(this.#value, e)) {
56
+ return;
57
+ }
23
58
  this.#value = e;
24
59
  super.fire(e);
25
60
  }
26
61
  }
62
+
63
+ export namespace StickyEventEmitter {
64
+ export interface Options<TEvent> {
65
+ initialValue?: TEvent;
66
+
67
+ /**
68
+ * An optional comparator function to determine whether the new value is equal to the current value.
69
+ * If the new value is equal to the current value, the event will not be emitted.
70
+ *
71
+ * If not provided, all values are considered different.
72
+ */
73
+ equals?: (a: TEvent, b: TEvent) => boolean;
74
+ }
75
+ }
package/CHANGELOG.md DELETED
@@ -1,118 +0,0 @@
1
- # Change Log - @yume-chan/event
2
-
3
- ## 2.0.0
4
-
5
- ### Minor Changes
6
-
7
- - 05c01ad: Make `DeviceObserver#onListChange` sticky
8
-
9
- ## 1.0.1
10
-
11
- ### Patch Changes
12
-
13
- - 53688d3: Use PNPM workspace and Changesets to manage the monorepo.
14
-
15
- Because Changesets doesn't support alpha versions (`0.x.x`), this version is `1.0.0`. Future versions will follow SemVer rules, for example, breaking API changes will introduce a new major version.
16
-
17
- This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
18
-
19
- ## 0.0.24
20
-
21
- Tue, 18 Jun 2024 02:49:43 GMT
22
-
23
- _Version update only_
24
-
25
- ## 0.0.23
26
-
27
- Thu, 21 Mar 2024 03:15:10 GMT
28
-
29
- _Version update only_
30
-
31
- ## 0.0.22
32
-
33
- Wed, 13 Dec 2023 05:57:27 GMT
34
-
35
- _Version update only_
36
-
37
- ## 0.0.21
38
-
39
- Fri, 25 Aug 2023 14:05:18 GMT
40
-
41
- _Version update only_
42
-
43
- ## 0.0.20
44
-
45
- Mon, 05 Jun 2023 02:51:41 GMT
46
-
47
- _Version update only_
48
-
49
- ## 0.0.19
50
-
51
- Sun, 09 Apr 2023 05:55:33 GMT
52
-
53
- _Version update only_
54
-
55
- ## 0.0.18
56
-
57
- Wed, 25 Jan 2023 21:33:49 GMT
58
-
59
- _Version update only_
60
-
61
- ## 0.0.17
62
-
63
- Tue, 18 Oct 2022 09:32:30 GMT
64
-
65
- _Version update only_
66
-
67
- ## 0.0.16
68
-
69
- Sat, 28 May 2022 03:56:37 GMT
70
-
71
- ### Updates
72
-
73
- - Upgrade TypeScript to 4.7.2 to enable Node.js ESM
74
-
75
- ## 0.0.15
76
-
77
- Mon, 02 May 2022 04:18:01 GMT
78
-
79
- _Version update only_
80
-
81
- ## 0.0.14
82
-
83
- Sat, 30 Apr 2022 14:05:48 GMT
84
-
85
- _Version update only_
86
-
87
- ## 0.0.13
88
-
89
- Thu, 28 Apr 2022 01:23:53 GMT
90
-
91
- _Version update only_
92
-
93
- ## 0.0.12
94
-
95
- Sun, 03 Apr 2022 11:18:47 GMT
96
-
97
- _Version update only_
98
-
99
- ## 0.0.11
100
-
101
- Sun, 03 Apr 2022 11:18:11 GMT
102
-
103
- ### Updates
104
-
105
- - Improve compatibility with Node.js 12 ESM format
106
- - Update license year
107
-
108
- ## 0.0.10
109
-
110
- Sun, 09 Jan 2022 15:52:20 GMT
111
-
112
- _Version update only_
113
-
114
- ## 0.0.9
115
-
116
- Sun, 09 Jan 2022 15:50:20 GMT
117
-
118
- _Initial release_
package/esm/utils.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Event } from "./event.js";
2
- export declare function once<T>(event: Event<T, unknown>): Promise<T>;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,wBAAsB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMlE"}
package/esm/utils.js DELETED
@@ -1,9 +0,0 @@
1
- import { PromiseResolver } from "@yume-chan/async";
2
- export async function once(event) {
3
- const resolver = new PromiseResolver();
4
- const dispose = event(resolver.resolve);
5
- const result = await resolver.promise;
6
- dispose();
7
- return result;
8
- }
9
- //# sourceMappingURL=utils.js.map
package/esm/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAI,KAAwB;IAClD,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAK,CAAC;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;IACtC,OAAO,EAAE,CAAC;IACV,OAAO,MAAM,CAAC;AAClB,CAAC"}
package/src/utils.ts DELETED
@@ -1,11 +0,0 @@
1
- import { PromiseResolver } from "@yume-chan/async";
2
-
3
- import type { Event } from "./event.js";
4
-
5
- export async function once<T>(event: Event<T, unknown>): Promise<T> {
6
- const resolver = new PromiseResolver<T>();
7
- const dispose = event(resolver.resolve);
8
- const result = await resolver.promise;
9
- dispose();
10
- return result;
11
- }
@@ -1 +0,0 @@
1
- {"fileNames":["../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.collection.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.object.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2024.string.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.esnext.float16.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/disposable.ts","./src/event.ts","./src/event-emitter.ts","./src/sticky-event-emitter.ts","../../node_modules/.pnpm/@yume-chan+async@4.0.2/node_modules/@yume-chan/async/dts/async-operation-manager.d.ts","../../node_modules/.pnpm/@yume-chan+async@4.0.2/node_modules/@yume-chan/async/dts/delay.d.ts","../../node_modules/.pnpm/@yume-chan+async@4.0.2/node_modules/@yume-chan/async/dts/promise-resolver.d.ts","../../node_modules/.pnpm/@yume-chan+async@4.0.2/node_modules/@yume-chan/async/dts/maybe-promise.d.ts","../../node_modules/.pnpm/@yume-chan+async@4.0.2/node_modules/@yume-chan/async/dts/index.d.ts","./src/utils.ts","./src/index.ts"],"fileIdsList":[[79,80],[79],[79,80,81,82,88],[80,81],[80,87],[83,84,85,86]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a7ce48505b8cdf9daaf00a8363756645d6b2fcb871a9139d4da42ecd1c9f8bca","signature":"207ecf493b69ddca525bbbd8f1d120d99d00be1448ae8c0e690526f24dc182ca","impliedFormat":99},{"version":"f17eeebcfa6f0e07f7bb800e01edcc7110ffd9c13d38aff427d62454a4397782","signature":"af6ac8a19dbd05c34feff97d0eae81194fd0be1358bd2366478e9a574492d332","impliedFormat":99},{"version":"bc65588635e3807d6e0a499abb8b258a9c8a2e239743bd7c0ac32b0327fb4581","signature":"346557f6ca397f60089615ebe31c22e9aaa64ed104db53e72858a5b3c97aab66","impliedFormat":99},{"version":"81fc016940a4030dc3a53974f83e0485d9bbbe41eb7365ac17c95ced61b9d447","signature":"e3427f1af48d46a0ebf78760ab9417773d00be504683ec0dd1c70e6eef3391ba","impliedFormat":99},{"version":"4942ce52738852aac9e3eb7b2743abd920ea3f62dfc930e8ab49db6672c5d292","impliedFormat":1},{"version":"f232c6de4d9dacf27320453a89e04c29b3bcc7a084ee6184de18a15e4a1a3a1d","impliedFormat":1},{"version":"557a9670c1bb00cdd5eb309ed1e28665fdefe501a4b12eb124dc1bcaa1498328","impliedFormat":1},{"version":"0bbbbb1b5a4f7a77a28dbcd2fc59311affab8cfed9dba97b5d5cf20ae7fbc3f3","impliedFormat":1},{"version":"f9e4b9df247b6b2ec942f9a043801a67c70d94014546d6d2c27d32cb729e470c","impliedFormat":1},{"version":"c0b7a9aa8c7633f16ccc4575cae220731b7518517d292b9efb86e6bd8819584f","signature":"f00b8fc0c970cfd54d4df6047aae216bce4d7a2ceb6610655541a678ac54c57a","impliedFormat":99},{"version":"6006c2501c5f4bd65c31bad2a9ef2895a3c71d9d65a5ded4a85b1c9514c18041","impliedFormat":99}],"root":[[79,82],88,89],"options":{"composite":true,"declaration":true,"declarationDir":"./esm","declarationMap":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":199,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitOverride":true,"noImplicitReturns":true,"noImplicitThis":true,"noUncheckedIndexedAccess":true,"noUncheckedSideEffectImports":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./esm","rootDir":"./src","skipLibCheck":true,"sourceMap":true,"strict":true,"stripInternal":true,"target":99,"verbatimModuleSyntax":true},"referencedMap":[[81,1],[80,2],[89,3],[82,4],[88,5],[87,6]],"latestChangedDtsFile":"./esm/index.d.ts","version":"5.8.2"}