@yume-chan/event 1.0.0 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) 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 +7 -11
  11. package/esm/event-emitter.d.ts.map +1 -1
  12. package/esm/event-emitter.js +1 -1
  13. package/esm/event-emitter.js.map +1 -1
  14. package/esm/event.d.ts +5 -5
  15. package/esm/event.d.ts.map +1 -1
  16. package/esm/index.d.ts +4 -2
  17. package/esm/index.d.ts.map +1 -1
  18. package/esm/index.js +4 -2
  19. package/esm/index.js.map +1 -1
  20. package/esm/once.d.ts +8 -0
  21. package/esm/once.d.ts.map +1 -0
  22. package/esm/once.js +14 -0
  23. package/esm/once.js.map +1 -0
  24. package/esm/pipe.d.ts +9 -0
  25. package/esm/pipe.d.ts.map +1 -0
  26. package/esm/pipe.js +14 -0
  27. package/esm/pipe.js.map +1 -0
  28. package/esm/sticky-event-emitter.d.ts +33 -0
  29. package/esm/sticky-event-emitter.d.ts.map +1 -0
  30. package/esm/sticky-event-emitter.js +53 -0
  31. package/esm/sticky-event-emitter.js.map +1 -0
  32. package/package.json +6 -6
  33. package/src/absence.ts +7 -0
  34. package/src/disposable.ts +4 -0
  35. package/src/event-emitter.ts +11 -27
  36. package/src/event.ts +10 -12
  37. package/src/index.ts +4 -2
  38. package/src/once.ts +16 -0
  39. package/src/pipe.ts +22 -0
  40. package/src/sticky-event-emitter.ts +75 -0
  41. package/CHANGELOG.md +0 -112
  42. package/esm/utils.d.ts +0 -3
  43. package/esm/utils.d.ts.map +0 -1
  44. package/esm/utils.js +0 -9
  45. package/esm/utils.js.map +0 -1
  46. package/src/utils.ts +0 -11
  47. package/tsconfig.build.tsbuildinfo +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020-2024 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,19 +1,15 @@
1
1
  import type { Disposable } from "./disposable.js";
2
- import type { EventListener, RemoveEventListener } from "./event.js";
3
- export interface EventListenerInfo<TEvent, TResult = unknown> {
4
- listener: EventListener<TEvent, unknown, unknown[], TResult>;
2
+ import type { Event, EventListener, RemoveEventListener } from "./event.js";
3
+ export interface EventListenerInfo<TEvent> {
4
+ listener: EventListener<TEvent, unknown, unknown[]>;
5
5
  thisArg: unknown;
6
6
  args: unknown[];
7
7
  }
8
- export interface AddEventListener<TEvent, TResult = unknown> {
9
- (listener: EventListener<TEvent, unknown, [], TResult>): RemoveEventListener;
10
- <TThis, TArgs extends unknown[]>(listener: EventListener<TEvent, TThis, TArgs, TResult>, thisArg: TThis, ...args: TArgs): RemoveEventListener;
11
- }
12
- export declare class EventEmitter<TEvent, TResult = unknown> implements Disposable {
13
- protected readonly listeners: EventListenerInfo<TEvent, TResult>[];
8
+ export declare class EventEmitter<TEvent> implements Disposable {
9
+ protected readonly listeners: EventListenerInfo<TEvent>[];
14
10
  constructor();
15
- protected addEventListener(info: EventListenerInfo<TEvent, TResult>): RemoveEventListener;
16
- event: AddEventListener<TEvent, TResult>;
11
+ protected addEventListener(info: EventListenerInfo<TEvent>): RemoveEventListener;
12
+ event: Event<TEvent>;
17
13
  fire(e: TEvent): void;
18
14
  dispose(): void;
19
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,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE,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,MAAM,WAAW,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IACvD,CACI,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,GACtD,mBAAmB,CAAC;IACvB,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;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,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBtC;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"}
@@ -24,7 +24,7 @@ export class EventEmitter {
24
24
  };
25
25
  fire(e) {
26
26
  for (const info of this.listeners.slice()) {
27
- info.listener.apply(info.thisArg, [e, ...info.args]);
27
+ info.listener.call(info.thisArg, e, ...info.args);
28
28
  }
29
29
  }
30
30
  dispose() {
@@ -1 +1 @@
1
- {"version":3,"file":"event-emitter.js","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAsBA,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,GAAsC,CACvC,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,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACzD,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,5 +1,7 @@
1
1
  export * from "./disposable.js";
2
- export * from "./event.js";
3
2
  export * from "./event-emitter.js";
4
- export * from "./utils.js";
3
+ export * from "./event.js";
4
+ export * from "./once.js";
5
+ export * from "./pipe.js";
6
+ export * from "./sticky-event-emitter.js";
5
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,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,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,5 +1,7 @@
1
1
  export * from "./disposable.js";
2
- export * from "./event.js";
3
2
  export * from "./event-emitter.js";
4
- export * from "./utils.js";
3
+ export * from "./event.js";
4
+ export * from "./once.js";
5
+ export * from "./pipe.js";
6
+ export * from "./sticky-event-emitter.js";
5
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,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,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"}
@@ -0,0 +1,33 @@
1
+ import type { EventListenerInfo } from "./event-emitter.js";
2
+ import { EventEmitter } from "./event-emitter.js";
3
+ import type { RemoveEventListener } from "./event.js";
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> {
8
+ #private;
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;
19
+ fire(e: TEvent): void;
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
+ }
33
+ //# sourceMappingURL=sticky-event-emitter.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,53 @@
1
+ import { Absence } from "./absence.js";
2
+ import { EventEmitter } from "./event-emitter.js";
3
+ /**
4
+ * An event emitter that remembers the last emitted value and immediately emits it to new listeners.
5
+ */
6
+ export class StickyEventEmitter extends EventEmitter {
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
+ }
39
+ addEventListener(info) {
40
+ if (this.#value !== Absence) {
41
+ info.listener.call(info.thisArg, this.#value, ...info.args);
42
+ }
43
+ return super.addEventListener(info);
44
+ }
45
+ fire(e) {
46
+ if (this.#value !== Absence && this.#equal(this.#value, e)) {
47
+ return;
48
+ }
49
+ this.#value = e;
50
+ super.fire(e);
51
+ }
52
+ }
53
+ //# sourceMappingURL=sticky-event-emitter.js.map
@@ -0,0 +1 @@
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": "1.0.0",
3
+ "version": "3.0.0-beta.0",
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.10.0",
34
- "prettier": "^3.4.1",
35
- "typescript": "^5.7.2",
33
+ "@types/node": "^26.0.0",
34
+ "prettier": "^3.8.4",
35
+ "typescript": "^6.0.3",
36
36
  "@yume-chan/eslint-config": "^1.0.0",
37
37
  "@yume-chan/test-runner": "^1.0.0",
38
38
  "@yume-chan/tsconfig": "^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,34 +1,23 @@
1
1
  import type { Disposable } from "./disposable.js";
2
- import type { EventListener, RemoveEventListener } from "./event.js";
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 interface AddEventListener<TEvent, TResult = unknown> {
13
- (
14
- listener: EventListener<TEvent, unknown, [], TResult>,
15
- ): RemoveEventListener;
16
- <TThis, TArgs extends unknown[]>(
17
- listener: EventListener<TEvent, TThis, TArgs, TResult>,
18
- thisArg: TThis,
19
- ...args: TArgs
20
- ): RemoveEventListener;
21
- }
22
-
23
- export class EventEmitter<TEvent, TResult = unknown> implements Disposable {
24
- protected readonly listeners: EventListenerInfo<TEvent, TResult>[] = [];
12
+ export class EventEmitter<TEvent> implements Disposable {
13
+ protected readonly listeners: EventListenerInfo<TEvent>[] = [];
25
14
 
26
15
  constructor() {
27
16
  this.event = this.event.bind(this);
28
17
  }
29
18
 
30
19
  protected addEventListener(
31
- info: EventListenerInfo<TEvent, TResult>,
20
+ info: EventListenerInfo<TEvent>,
32
21
  ): RemoveEventListener {
33
22
  this.listeners.push(info);
34
23
 
@@ -42,18 +31,13 @@ export class EventEmitter<TEvent, TResult = unknown> implements Disposable {
42
31
  return remove;
43
32
  }
44
33
 
45
- event: AddEventListener<TEvent, TResult> = <TThis, TArgs extends unknown[]>(
46
- listener: EventListener<TEvent, TThis, TArgs, TResult>,
34
+ event: Event<TEvent> = <TThis, TArgs extends unknown[]>(
35
+ listener: EventListener<TEvent, TThis, TArgs>,
47
36
  thisArg?: TThis,
48
37
  ...args: TArgs
49
38
  ) => {
50
- const info: EventListenerInfo<TEvent, TResult> = {
51
- listener: listener as EventListener<
52
- TEvent,
53
- unknown,
54
- unknown[],
55
- TResult
56
- >,
39
+ const info: EventListenerInfo<TEvent> = {
40
+ listener: listener as EventListener<TEvent, unknown, unknown[]>,
57
41
  thisArg,
58
42
  args,
59
43
  };
@@ -62,7 +46,7 @@ export class EventEmitter<TEvent, TResult = unknown> implements Disposable {
62
46
 
63
47
  fire(e: TEvent) {
64
48
  for (const info of this.listeners.slice()) {
65
- info.listener.apply(info.thisArg, [e, ...info.args]);
49
+ info.listener.call(info.thisArg, e, ...info.args);
66
50
  }
67
51
  }
68
52
 
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,4 +1,6 @@
1
1
  export * from "./disposable.js";
2
- export * from "./event.js";
3
2
  export * from "./event-emitter.js";
4
- export * from "./utils.js";
3
+ export * from "./event.js";
4
+ export * from "./once.js";
5
+ export * from "./pipe.js";
6
+ export * from "./sticky-event-emitter.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
+ }
@@ -0,0 +1,75 @@
1
+ import { Absence } from "./absence.js";
2
+ import type { EventListenerInfo } from "./event-emitter.js";
3
+ import { EventEmitter } from "./event-emitter.js";
4
+ import type { RemoveEventListener } from "./event.js";
5
+
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
+ }
37
+
38
+ if (options.equals) {
39
+ this.#equal = options.equals;
40
+ } else {
41
+ this.#equal = () => false;
42
+ }
43
+ }
44
+
45
+ protected override addEventListener(
46
+ info: EventListenerInfo<TEvent>,
47
+ ): RemoveEventListener {
48
+ if (this.#value !== Absence) {
49
+ info.listener.call(info.thisArg, this.#value, ...info.args);
50
+ }
51
+ return super.addEventListener(info);
52
+ }
53
+
54
+ override fire(e: TEvent): void {
55
+ if (this.#value !== Absence && this.#equal(this.#value, e)) {
56
+ return;
57
+ }
58
+ this.#value = e;
59
+ super.fire(e);
60
+ }
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,112 +0,0 @@
1
- # Change Log - @yume-chan/event
2
-
3
- ## 1.0.1
4
-
5
- ### Patch Changes
6
-
7
- - 53688d3: Use PNPM workspace and Changesets to manage the monorepo.
8
-
9
- 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.
10
-
11
- This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
12
-
13
- ## 0.0.24
14
-
15
- Tue, 18 Jun 2024 02:49:43 GMT
16
-
17
- _Version update only_
18
-
19
- ## 0.0.23
20
-
21
- Thu, 21 Mar 2024 03:15:10 GMT
22
-
23
- _Version update only_
24
-
25
- ## 0.0.22
26
-
27
- Wed, 13 Dec 2023 05:57:27 GMT
28
-
29
- _Version update only_
30
-
31
- ## 0.0.21
32
-
33
- Fri, 25 Aug 2023 14:05:18 GMT
34
-
35
- _Version update only_
36
-
37
- ## 0.0.20
38
-
39
- Mon, 05 Jun 2023 02:51:41 GMT
40
-
41
- _Version update only_
42
-
43
- ## 0.0.19
44
-
45
- Sun, 09 Apr 2023 05:55:33 GMT
46
-
47
- _Version update only_
48
-
49
- ## 0.0.18
50
-
51
- Wed, 25 Jan 2023 21:33:49 GMT
52
-
53
- _Version update only_
54
-
55
- ## 0.0.17
56
-
57
- Tue, 18 Oct 2022 09:32:30 GMT
58
-
59
- _Version update only_
60
-
61
- ## 0.0.16
62
-
63
- Sat, 28 May 2022 03:56:37 GMT
64
-
65
- ### Updates
66
-
67
- - Upgrade TypeScript to 4.7.2 to enable Node.js ESM
68
-
69
- ## 0.0.15
70
-
71
- Mon, 02 May 2022 04:18:01 GMT
72
-
73
- _Version update only_
74
-
75
- ## 0.0.14
76
-
77
- Sat, 30 Apr 2022 14:05:48 GMT
78
-
79
- _Version update only_
80
-
81
- ## 0.0.13
82
-
83
- Thu, 28 Apr 2022 01:23:53 GMT
84
-
85
- _Version update only_
86
-
87
- ## 0.0.12
88
-
89
- Sun, 03 Apr 2022 11:18:47 GMT
90
-
91
- _Version update only_
92
-
93
- ## 0.0.11
94
-
95
- Sun, 03 Apr 2022 11:18:11 GMT
96
-
97
- ### Updates
98
-
99
- - Improve compatibility with Node.js 12 ESM format
100
- - Update license year
101
-
102
- ## 0.0.10
103
-
104
- Sun, 09 Jan 2022 15:52:20 GMT
105
-
106
- _Version update only_
107
-
108
- ## 0.0.9
109
-
110
- Sun, 09 Jan 2022 15:50:20 GMT
111
-
112
- _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.7.2/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.collection.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.object.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.promise.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2024.string.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/disposable.ts","./src/event.ts","./src/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":[[77,78],[77],[77,78,79,85],[78,84],[80,81,82,83]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","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":"e12a46ce14b817d4c9e6b2b478956452330bf00c9801b79de46f7a1815b5bd40","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","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":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","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":"bab26767638ab3557de12c900f0b91f710c7dc40ee9793d5a27d32c04f0bf646","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":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"61d6a2092f48af66dbfb220e31eea8b10bc02b6932d6e529005fd2d7b3281290","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":"b756b6fd0e4bfc7eb34c8695e7855666e980a09a1861d6b2e0f0ec86afb64adc","signature":"a21c587d34edbe9808b8f4fac207d190f802687b477ef55ee0f494d79a427f31","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":"11fd6a023d60896a902933f64a2c8363102e5276838dbe29aa02a24c2e69fbd1","impliedFormat":99}],"root":[[77,79],85,86],"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":[[79,1],[78,2],[86,3],[85,4],[84,5]],"latestChangedDtsFile":"./esm/index.d.ts","version":"5.7.2"}