@breadstone/mosaik-elements 0.0.12-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.
- package/Events/Details/Interfaces/ICancelEventDetail.d.ts +13 -0
- package/Events/Details/Interfaces/ICancelEventDetail.d.ts.map +1 -0
- package/Events/Details/Interfaces/ICancelEventDetail.js +3 -0
- package/Events/Details/Interfaces/ICancelEventDetail.js.map +1 -0
- package/Events/Details/Interfaces/IChangedEventDetail.d.ts +17 -0
- package/Events/Details/Interfaces/IChangedEventDetail.d.ts.map +1 -0
- package/Events/Details/Interfaces/IChangedEventDetail.js +3 -0
- package/Events/Details/Interfaces/IChangedEventDetail.js.map +1 -0
- package/Events/Details/Interfaces/IErrorEventDetail.d.ts +13 -0
- package/Events/Details/Interfaces/IErrorEventDetail.d.ts.map +1 -0
- package/Events/Details/Interfaces/IErrorEventDetail.js +3 -0
- package/Events/Details/Interfaces/IErrorEventDetail.js.map +1 -0
- package/Events/Details/Interfaces/IEventDetail.d.ts +19 -0
- package/Events/Details/Interfaces/IEventDetail.d.ts.map +1 -0
- package/Events/Details/Interfaces/IEventDetail.js +18 -0
- package/Events/Details/Interfaces/IEventDetail.js.map +1 -0
- package/Events/Details/Interfaces/IValueEventDetail.d.ts +13 -0
- package/Events/Details/Interfaces/IValueEventDetail.d.ts.map +1 -0
- package/Events/Details/Interfaces/IValueEventDetail.js +3 -0
- package/Events/Details/Interfaces/IValueEventDetail.js.map +1 -0
- package/Events/Emitters/HTMLElementEventEmitter.d.ts +29 -0
- package/Events/Emitters/HTMLElementEventEmitter.d.ts.map +1 -0
- package/Events/Emitters/HTMLElementEventEmitter.js +55 -0
- package/Events/Emitters/HTMLElementEventEmitter.js.map +1 -0
- package/Events/Emitters/Interfaces/IEventEmitter.d.ts +10 -0
- package/Events/Emitters/Interfaces/IEventEmitter.d.ts.map +1 -0
- package/Events/Emitters/Interfaces/IEventEmitter.js +3 -0
- package/Events/Emitters/Interfaces/IEventEmitter.js.map +1 -0
- package/Events/Emitters/PureEventEmitter.d.ts +15 -0
- package/Events/Emitters/PureEventEmitter.d.ts.map +1 -0
- package/Events/Emitters/PureEventEmitter.js +32 -0
- package/Events/Emitters/PureEventEmitter.js.map +1 -0
- package/Events/EventListenerSubscription.d.ts +46 -0
- package/Events/EventListenerSubscription.d.ts.map +1 -0
- package/Events/EventListenerSubscription.js +73 -0
- package/Events/EventListenerSubscription.js.map +1 -0
- package/Events/Interfaces/IEventDispatcher.d.ts +7 -0
- package/Events/Interfaces/IEventDispatcher.d.ts.map +1 -0
- package/Events/Interfaces/IEventDispatcher.js +2 -0
- package/Events/Interfaces/IEventDispatcher.js.map +1 -0
- package/Events/Interfaces/IEventListenerSubscription.d.ts +19 -0
- package/Events/Interfaces/IEventListenerSubscription.d.ts.map +1 -0
- package/Events/Interfaces/IEventListenerSubscription.js +15 -0
- package/Events/Interfaces/IEventListenerSubscription.js.map +1 -0
- package/Events/Interfaces/IEventOptions.d.ts +18 -0
- package/Events/Interfaces/IEventOptions.d.ts.map +1 -0
- package/Events/Interfaces/IEventOptions.js +2 -0
- package/Events/Interfaces/IEventOptions.js.map +1 -0
- package/Events/Utils.d.ts +20 -0
- package/Events/Utils.d.ts.map +1 -0
- package/Events/Utils.js +64 -0
- package/Events/Utils.js.map +1 -0
- package/Index.d.ts +15 -0
- package/Index.d.ts.map +1 -0
- package/Index.js +5 -0
- package/Index.js.map +1 -0
- package/LICENSE +21 -0
- package/Types/Disposable.d.ts +7 -0
- package/Types/Disposable.d.ts.map +1 -0
- package/Types/Disposable.js +11 -0
- package/Types/Disposable.js.map +1 -0
- package/package.json +28 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IEventDetail } from './IEventDetail';
|
|
2
|
+
/**
|
|
3
|
+
* Represents event details with a cancelation token.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface ICancelEventDetail<TSender extends HTMLElement = HTMLElement> extends IEventDetail<TSender> {
|
|
8
|
+
/**
|
|
9
|
+
* Get or sets the `cancel` property which decides whether the event should be canceled or not.
|
|
10
|
+
*/
|
|
11
|
+
cancel: boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ICancelEventDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICancelEventDetail.d.ts","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/ICancelEventDetail.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,YAAY,CAAC,OAAO,CAAC;IAIxG;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CAInB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICancelEventDetail.js","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/ICancelEventDetail.ts"],"names":[],"mappings":"AAAA,kBAAkB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IEventDetail } from './IEventDetail';
|
|
2
|
+
/**
|
|
3
|
+
* Represents event details with a old and new value.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface IChangedEventDetail<TSender extends HTMLElement = HTMLElement, TData = unknown> extends IEventDetail<TSender> {
|
|
8
|
+
/**
|
|
9
|
+
* Gets the `oldValue` property.
|
|
10
|
+
*/
|
|
11
|
+
readonly oldValue: TData;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the `newValue` property.
|
|
14
|
+
*/
|
|
15
|
+
readonly newValue: TData;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=IChangedEventDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IChangedEventDetail.d.ts","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IChangedEventDetail.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,KAAK,GAAG,OAAO,CAAE,SAAQ,YAAY,CAAC,OAAO,CAAC;IAI1H;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;CAI5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IChangedEventDetail.js","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IChangedEventDetail.ts"],"names":[],"mappings":"AAAA,kBAAkB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IEventDetail } from './IEventDetail';
|
|
2
|
+
/**
|
|
3
|
+
* Represents event details with a cancelation token.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface IErrorEventDetail<TSender extends HTMLElement = HTMLElement> extends IEventDetail<TSender> {
|
|
8
|
+
/**
|
|
9
|
+
* Gets the `error` property.
|
|
10
|
+
*/
|
|
11
|
+
readonly error: Error;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=IErrorEventDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IErrorEventDetail.d.ts","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IErrorEventDetail.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,YAAY,CAAC,OAAO,CAAC;IAIvG;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CAIzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IErrorEventDetail.js","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IErrorEventDetail.ts"],"names":[],"mappings":"AAAA,kBAAkB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents event details with a sender.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IEventDetail<TSender extends HTMLElement = HTMLElement> {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare namespace IEventDetail {
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*
|
|
15
|
+
* Creates a IEventsDetail object.
|
|
16
|
+
*/
|
|
17
|
+
function create<TDetail extends IEventDetail<TSender>, TSender extends HTMLElement = HTMLElement>(sender: TSender, detail: TDetail): TDetail;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=IEventDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventDetail.d.ts","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IEventDetail.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,YAAY,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW;CAEtE;AAED;;GAEG;AAEH,yBAAiB,YAAY,CAAC;IAE1B;;;;OAIG;IACH,SAAgB,MAAM,CAAC,OAAO,SAAS,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAIlJ;CAEJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export var IEventDetail;
|
|
5
|
+
(function (IEventDetail) {
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*
|
|
9
|
+
* Creates a IEventsDetail object.
|
|
10
|
+
*/
|
|
11
|
+
function create(sender, detail) {
|
|
12
|
+
return {
|
|
13
|
+
...detail
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
IEventDetail.create = create;
|
|
17
|
+
})(IEventDetail || (IEventDetail = {}));
|
|
18
|
+
//# sourceMappingURL=IEventDetail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventDetail.js","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IEventDetail.ts"],"names":[],"mappings":"AAUA;;GAEG;AAEH,MAAM,KAAW,YAAY,CAa5B;AAbD,WAAiB,YAAY;IAEzB;;;;OAIG;IACH,SAAgB,MAAM,CAAmF,MAAe,EAAE,MAAe;QACrI,OAAO;YACH,GAAG,MAAM;SACZ,CAAC;IACN,CAAC;IAJe,mBAAM,SAIrB,CAAA;AAEL,CAAC,EAbgB,YAAY,KAAZ,YAAY,QAa5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IEventDetail } from './IEventDetail';
|
|
2
|
+
/**
|
|
3
|
+
* Represents event details with value.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface IValueEventDetail<TSender extends HTMLElement = HTMLElement, TValue = unknown> extends IEventDetail<TSender> {
|
|
8
|
+
/**
|
|
9
|
+
* Gets the `value` property.
|
|
10
|
+
*/
|
|
11
|
+
readonly value: TValue;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=IValueEventDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IValueEventDetail.d.ts","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IValueEventDetail.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,MAAM,GAAG,OAAO,CAAE,SAAQ,YAAY,CAAC,OAAO,CAAC;IAIzH;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAI1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IValueEventDetail.js","sourceRoot":"","sources":["../../../../src/Events/Details/Interfaces/IValueEventDetail.ts"],"names":[],"mappings":"AAAA,kBAAkB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IDisposableLike } from '../../Types/Disposable';
|
|
2
|
+
import type { IEventDispatcher } from '../Interfaces/IEventDispatcher';
|
|
3
|
+
import type { IEventOptions } from '../Interfaces/IEventOptions';
|
|
4
|
+
import type { IEventEmitter } from './Interfaces/IEventEmitter';
|
|
5
|
+
/**
|
|
6
|
+
* The `EventEmitter` class.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class HTMLElementEventEmitter<TDetail = unknown> implements IEventEmitter<TDetail> {
|
|
11
|
+
private readonly _dispatcher?;
|
|
12
|
+
private readonly _eventName?;
|
|
13
|
+
private readonly _options?;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a new instance of the `EventEmitter` class.
|
|
16
|
+
*
|
|
17
|
+
* * Important: If the EventEmitter uses with a Event decorator, the constructor parameters could be ignored.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
constructor(dispatcher?: IEventDispatcher, eventName?: string, options?: IEventOptions);
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
emit(detail?: TDetail): void;
|
|
26
|
+
subscribe(handler: (data?: TDetail) => void): IDisposableLike;
|
|
27
|
+
unsubscribe(handler: (data?: TDetail) => void): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=HTMLElementEventEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTMLElementEventEmitter.d.ts","sourceRoot":"","sources":["../../../src/Events/Emitters/HTMLElementEventEmitter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE;;;;GAIG;AACH,qBAAa,uBAAuB,CAAC,OAAO,GAAG,OAAO,CAAE,YAAW,aAAa,CAAC,OAAO,CAAC;IAIrF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAA+B;IAC5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAA4B;IAMtD;;;;;;OAMG;gBACgB,UAAU,CAAC,EAAE,gBAAgB,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAU7F;;OAEG;IACI,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAqB5B,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,eAAe;IAI7D,WAAW,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;CAM9D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
// #endregion
|
|
3
|
+
/**
|
|
4
|
+
* The `EventEmitter` class.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class HTMLElementEventEmitter {
|
|
9
|
+
// #region Fields
|
|
10
|
+
_dispatcher;
|
|
11
|
+
_eventName;
|
|
12
|
+
_options;
|
|
13
|
+
// #endregion
|
|
14
|
+
// #region Ctor
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new instance of the `EventEmitter` class.
|
|
17
|
+
*
|
|
18
|
+
* * Important: If the EventEmitter uses with a Event decorator, the constructor parameters could be ignored.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
constructor(dispatcher, eventName, options) {
|
|
23
|
+
this._dispatcher = dispatcher;
|
|
24
|
+
this._eventName = eventName;
|
|
25
|
+
this._options = options;
|
|
26
|
+
}
|
|
27
|
+
// #endregion
|
|
28
|
+
// #region Methods
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
emit(detail) {
|
|
33
|
+
if (!this._dispatcher) {
|
|
34
|
+
const exceptionMessage = 'The dispatcher could not be null.';
|
|
35
|
+
throw new Error(exceptionMessage);
|
|
36
|
+
}
|
|
37
|
+
if (!this._eventName) {
|
|
38
|
+
const exceptionMessage = 'The event name could not be null.';
|
|
39
|
+
throw new Error(exceptionMessage);
|
|
40
|
+
}
|
|
41
|
+
this._dispatcher.dispatchEvent(new CustomEvent(this._eventName.toString(), {
|
|
42
|
+
bubbles: this._options?.bubbles ?? true,
|
|
43
|
+
cancelable: this._options?.cancelable ?? false,
|
|
44
|
+
composed: this._options?.composed ?? true,
|
|
45
|
+
detail: detail
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
subscribe(handler) {
|
|
49
|
+
throw new Error('Method not implemented.');
|
|
50
|
+
}
|
|
51
|
+
unsubscribe(handler) {
|
|
52
|
+
throw new Error('Method not implemented.');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=HTMLElementEventEmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTMLElementEventEmitter.js","sourceRoot":"","sources":["../../../src/Events/Emitters/HTMLElementEventEmitter.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAOlB,aAAa;AACb;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAEhC,iBAAiB;IAEA,WAAW,CAAgC;IAC3C,UAAU,CAAsB;IAChC,QAAQ,CAA6B;IAEtD,aAAa;IAEb,eAAe;IAEf;;;;;;OAMG;IACH,YAAmB,UAA6B,EAAE,SAAkB,EAAE,OAAuB;QACzF,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;OAEG;IACI,IAAI,CAAC,MAAgB;QACxB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,aAAa,CAC1B,IAAI,WAAW,CAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE;YACjD,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,IAAI,IAAI;YACvC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,IAAI,KAAK;YAC9C,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,IAAI,IAAI;YACzC,MAAM,EAAE,MAAM;SACjB,CAAC,CACL,CAAC;IACN,CAAC;IAEM,SAAS,CAAC,OAAiC;QAC9C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAEM,WAAW,CAAC,OAAiC;QAChD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CAIJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDisposableLike } from '../../../Types/Disposable';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface IEventEmitter<TDetail = void> {
|
|
6
|
+
emit(detail?: TDetail): void;
|
|
7
|
+
subscribe(handler: (detail?: TDetail) => void): IDisposableLike;
|
|
8
|
+
unsubscribe(handler: (detail?: TDetail) => void): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=IEventEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/Events/Emitters/Interfaces/IEventEmitter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO,GAAG,IAAI;IAIzC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE7B,SAAS,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,eAAe,CAAC;IAEhE,WAAW,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;CAI1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventEmitter.js","sourceRoot":"","sources":["../../../../src/Events/Emitters/Interfaces/IEventEmitter.ts"],"names":[],"mappings":"AAAA,kBAAkB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IDisposableLike } from '../../Types/Disposable';
|
|
2
|
+
import type { IEventEmitter } from './Interfaces/IEventEmitter';
|
|
3
|
+
/**
|
|
4
|
+
* The `PureEventEmitter` class is a simple implementation of the `IEventEmitter` interface.
|
|
5
|
+
* It is used to emit events and subscribe to them when the target of the emit decorator is not an HTMLElement.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class PureEventEmitter<T> implements IEventEmitter<T> {
|
|
10
|
+
private readonly _observers;
|
|
11
|
+
emit(value?: T): void;
|
|
12
|
+
subscribe(observer: (value?: T) => void): IDisposableLike;
|
|
13
|
+
unsubscribe(observer: (value?: T) => void): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=PureEventEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PureEventEmitter.d.ts","sourceRoot":"","sources":["../../../src/Events/Emitters/PureEventEmitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE;;;;;GAKG;AACH,qBAAa,gBAAgB,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAExD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAItD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI;IAMrB,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,eAAe;IASzD,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI;CAS1D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
import { IDisposableLike } from '../../Types/Disposable';
|
|
3
|
+
// #endregion
|
|
4
|
+
/**
|
|
5
|
+
* The `PureEventEmitter` class is a simple implementation of the `IEventEmitter` interface.
|
|
6
|
+
* It is used to emit events and subscribe to them when the target of the emit decorator is not an HTMLElement.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class PureEventEmitter {
|
|
11
|
+
_observers = [];
|
|
12
|
+
// #region Methods
|
|
13
|
+
emit(value) {
|
|
14
|
+
for (const observer of this._observers) {
|
|
15
|
+
observer(value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
subscribe(observer) {
|
|
19
|
+
this._observers.push(observer);
|
|
20
|
+
// Return an object with a dispose method
|
|
21
|
+
return IDisposableLike.create(() => {
|
|
22
|
+
this.unsubscribe(observer);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
unsubscribe(observer) {
|
|
26
|
+
const index = this._observers.indexOf(observer);
|
|
27
|
+
if (index > -1) {
|
|
28
|
+
this._observers.splice(index, 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=PureEventEmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PureEventEmitter.js","sourceRoot":"","sources":["../../../src/Events/Emitters/PureEventEmitter.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,aAAa;AAEb;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAER,UAAU,GAA+B,EAAE,CAAC;IAE7D,kBAAkB;IAEX,IAAI,CAAC,KAAS;QACjB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;IAEM,SAAS,CAAC,QAA6B;QAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE/B,yCAAyC;QACzC,OAAO,eAAe,CAAC,MAAM,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,WAAW,CAAC,QAA6B;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;CAIJ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IEventListenerSubscription } from './Interfaces/IEventListenerSubscription';
|
|
2
|
+
/**
|
|
3
|
+
* The `EventListenerSubscription` class.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class EventListenerSubscription<TEvent extends Event = Event> implements IEventListenerSubscription {
|
|
8
|
+
private readonly _eventName;
|
|
9
|
+
private readonly _listener;
|
|
10
|
+
private readonly _dispose;
|
|
11
|
+
private _isDisposed;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new instance of the `EventListenerSubscription` class.
|
|
14
|
+
*
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Returns the `eventName` property.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
* @readonly
|
|
23
|
+
*/
|
|
24
|
+
get eventName(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the `listener` property.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
31
|
+
get listener(): Readonly<(event: TEvent) => void>;
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
* @static
|
|
35
|
+
*/
|
|
36
|
+
static create<TEvent extends keyof HTMLBodyElementEventMap>(eventName: string, listener: (event: HTMLBodyElementEventMap[TEvent]) => void, dispose: (arg: IEventListenerSubscription) => void): IEventListenerSubscription;
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
invoke(event: TEvent): void;
|
|
41
|
+
/**
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=EventListenerSubscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventListenerSubscription.d.ts","sourceRoot":"","sources":["../../src/Events/EventListenerSubscription.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAI1F;;;;GAIG;AACH,qBAAa,yBAAyB,CAAC,MAAM,SAAS,KAAK,GAAG,KAAK,CAAE,YAAW,0BAA0B;IAItG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4C;IACrE,OAAO,CAAC,WAAW,CAAU;IAM7B;;;;OAIG;IACH,OAAO;IAWP;;;;;OAKG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;;OAKG;IACH,IAAW,QAAQ,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAEvD;IAMD;;;OAGG;WACW,MAAM,CAAC,MAAM,SAAS,MAAM,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,IAAI,GAAG,0BAA0B;IAIjO;;OAEG;IACI,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQlC;;OAEG;IACI,OAAO,IAAI,IAAI;CAOzB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
// #endregion
|
|
3
|
+
/**
|
|
4
|
+
* The `EventListenerSubscription` class.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class EventListenerSubscription {
|
|
9
|
+
// #region Fields
|
|
10
|
+
_eventName;
|
|
11
|
+
_listener;
|
|
12
|
+
_dispose;
|
|
13
|
+
_isDisposed;
|
|
14
|
+
// #endregion
|
|
15
|
+
// #region Ctor
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new instance of the `EventListenerSubscription` class.
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
constructor(eventName, listener, dispose) {
|
|
22
|
+
this._eventName = eventName;
|
|
23
|
+
this._listener = listener;
|
|
24
|
+
this._dispose = dispose;
|
|
25
|
+
this._isDisposed = false;
|
|
26
|
+
}
|
|
27
|
+
// #endregion
|
|
28
|
+
// #region Properties
|
|
29
|
+
/**
|
|
30
|
+
* Returns the `eventName` property.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* @readonly
|
|
34
|
+
*/
|
|
35
|
+
get eventName() {
|
|
36
|
+
return this._eventName;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the `listener` property.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @readonly
|
|
43
|
+
*/
|
|
44
|
+
get listener() {
|
|
45
|
+
return this._listener;
|
|
46
|
+
}
|
|
47
|
+
// #endregion
|
|
48
|
+
// #region Methods
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
* @static
|
|
52
|
+
*/
|
|
53
|
+
static create(eventName, listener, dispose) {
|
|
54
|
+
return new EventListenerSubscription(eventName, listener, dispose);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
invoke(event) {
|
|
60
|
+
if (this._isDisposed) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this._listener(event);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
dispose() {
|
|
69
|
+
this._dispose(this);
|
|
70
|
+
this._isDisposed = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=EventListenerSubscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventListenerSubscription.js","sourceRoot":"","sources":["../../src/Events/EventListenerSubscription.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAIlB,aAAa;AAEb;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IAElC,iBAAiB;IAEA,UAAU,CAAS;IACnB,SAAS,CAA0B;IACnC,QAAQ,CAA4C;IAC7D,WAAW,CAAU;IAE7B,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH,YAAoB,SAAiB,EAAE,QAAiC,EAAE,OAAkD;QACxH,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC7B,CAAC;IAED,aAAa;IAEb,qBAAqB;IAErB;;;;;OAKG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;OAGG;IACI,MAAM,CAAC,MAAM,CAA+C,SAAiB,EAAE,QAA0D,EAAE,OAAkD;QAChM,OAAO,IAAI,yBAAyB,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAa;QACvB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC5B,CAAC;CAIJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventDispatcher.d.ts","sourceRoot":"","sources":["../../../src/Events/Interfaces/IEventDispatcher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventDispatcher.js","sourceRoot":"","sources":["../../../src/Events/Interfaces/IEventDispatcher.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the `IEventListenerSubscription` interface.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IEventListenerSubscription {
|
|
7
|
+
readonly eventName: string;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
invoke(e: Event): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The isEventListenerSubscription() method determines whether an object is an `{@link IEventListenerSubscription}`
|
|
13
|
+
* This function returns true if the object is an `{@link IEventListenerSubscription}`, and false if not.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* @param value - The value to check.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isEventListenerSubscription(value: unknown): value is IEventListenerSubscription;
|
|
19
|
+
//# sourceMappingURL=IEventListenerSubscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventListenerSubscription.d.ts","sourceRoot":"","sources":["../../../src/Events/Interfaces/IEventListenerSubscription.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IAIvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAM3B,OAAO,IAAI,IAAI,CAAC;IAEhB,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CAI1B;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,0BAA0B,CAO/F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The isEventListenerSubscription() method determines whether an object is an `{@link IEventListenerSubscription}`
|
|
3
|
+
* This function returns true if the object is an `{@link IEventListenerSubscription}`, and false if not.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
* @param value - The value to check.
|
|
7
|
+
*/
|
|
8
|
+
export function isEventListenerSubscription(value) {
|
|
9
|
+
if (value && typeof value === 'object') {
|
|
10
|
+
return !!('dispose' in value &&
|
|
11
|
+
'event' in value);
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=IEventListenerSubscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventListenerSubscription.js","sourceRoot":"","sources":["../../../src/Events/Interfaces/IEventListenerSubscription.ts"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAc;IACtD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,KAAK;YAC1B,OAAO,IAAI,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export interface IEventOptions extends EventInit {
|
|
5
|
+
/**
|
|
6
|
+
* A Boolean indicating whether the event bubbles up through the DOM or not.
|
|
7
|
+
*/
|
|
8
|
+
bubbles?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A Boolean indicating whether the event is cancelable.
|
|
11
|
+
*/
|
|
12
|
+
cancelable?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* A Boolean value indicating whether or not the event can bubble across the boundary between the shadow DOM and the regular DOM.
|
|
15
|
+
*/
|
|
16
|
+
composed?: boolean;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=IEventOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventOptions.d.ts","sourceRoot":"","sources":["../../../src/Events/Interfaces/IEventOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,SAAS;IAE5C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventOptions.js","sourceRoot":"","sources":["../../../src/Events/Interfaces/IEventOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IEventListenerSubscription } from './Interfaces/IEventListenerSubscription';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare function on<TEvent extends keyof HTMLBodyElementEventMap>(target: EventTarget, eventName: TEvent, listener: (event: HTMLBodyElementEventMap[TEvent]) => void, options?: boolean | AddEventListenerOptions): IEventListenerSubscription;
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare function off<TEvent extends Event = Event>(target: EventTarget | ShadowRoot, subscription: IEventListenerSubscription): void;
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare function emit<TDetail = void>(target: EventTarget, eventName: string, detail?: TDetail): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Waits for a specific event to be emitted from an element. Ignores events that bubble up from child elements.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare function waitForEvent<TEvent extends keyof HTMLBodyElementEventMap>(target: EventTarget, eventName: TEvent): Promise<HTMLBodyElementEventMap[TEvent]>;
|
|
20
|
+
//# sourceMappingURL=Utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/Events/Utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAqB1F;;GAEG;AACH,wBAAgB,EAAE,CAAC,MAAM,SAAS,MAAM,uBAAuB,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAAG,0BAA0B,CAS5O;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,MAAM,SAAS,KAAK,GAAG,KAAK,EAAE,MAAM,EAAE,WAAW,GAAG,UAAU,EAAE,YAAY,EAAE,0BAA0B,GAAG,IAAI,CAKlI;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAStG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS,MAAM,uBAAuB,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAW3J"}
|
package/Events/Utils.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
import { EventListenerSubscription } from './EventListenerSubscription';
|
|
3
|
+
// #endregion
|
|
4
|
+
// /**
|
|
5
|
+
// * @public
|
|
6
|
+
// */
|
|
7
|
+
// Export type AddListenerCallback = () => void;
|
|
8
|
+
// /**
|
|
9
|
+
// * @public
|
|
10
|
+
// */
|
|
11
|
+
// Export function addListener(element: HTMLElement, event: string, handler: any, capture: boolean): AddListenerCallback {
|
|
12
|
+
// Element.addEventListener(event, handler, capture);
|
|
13
|
+
// Return () => {
|
|
14
|
+
// Element.removeEventListener(event, handler, capture);
|
|
15
|
+
// };
|
|
16
|
+
// }
|
|
17
|
+
const SUBSCRIPTIONS = new Map();
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export function on(target, eventName, listener, options) {
|
|
22
|
+
target.addEventListener(eventName, listener, options);
|
|
23
|
+
const subscription = EventListenerSubscription.create(eventName, listener, (disposable) => {
|
|
24
|
+
off(target, disposable);
|
|
25
|
+
});
|
|
26
|
+
SUBSCRIPTIONS.set(eventName, subscription);
|
|
27
|
+
return subscription;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export function off(target, subscription) {
|
|
33
|
+
const sub = subscription;
|
|
34
|
+
target.removeEventListener(sub.eventName, subscription.listener);
|
|
35
|
+
SUBSCRIPTIONS.delete(sub.eventName);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export function emit(target, eventName, detail) {
|
|
41
|
+
return target.dispatchEvent(new CustomEvent(eventName, {
|
|
42
|
+
bubbles: true,
|
|
43
|
+
cancelable: false,
|
|
44
|
+
composed: true,
|
|
45
|
+
detail: detail
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Waits for a specific event to be emitted from an element. Ignores events that bubble up from child elements.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export function waitForEvent(target, eventName) {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
const done = (event) => {
|
|
56
|
+
if (event.target === target) {
|
|
57
|
+
target.removeEventListener(eventName, done);
|
|
58
|
+
resolve(event);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
target.addEventListener(eventName, done);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/Events/Utils.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,aAAa;AAEb,MAAM;AACN,aAAa;AACb,MAAM;AACN,gDAAgD;AAEhD,MAAM;AACN,aAAa;AACb,MAAM;AACN,0HAA0H;AAC1H,yDAAyD;AACzD,qBAAqB;AACrB,gEAAgE;AAChE,SAAS;AACT,IAAI;AAEJ,MAAM,aAAa,GAAG,IAAI,GAAG,EAAsC,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,EAAE,CAA+C,MAAmB,EAAE,SAAiB,EAAE,QAA0D,EAAE,OAA2C;IAC5M,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAe,EAAE,OAAO,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,yBAAyB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,EAAE;QACtF,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC3C,OAAO,YAAY,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,CAA+B,MAAgC,EAAE,YAAwC;IACxH,MAAM,GAAG,GAAG,YAAiD,CAAC;IAE9D,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAG,YAAkD,CAAC,QAAe,CAAC,CAAC;IAC/G,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI,CAAiB,MAAmB,EAAE,SAAiB,EAAE,MAAgB;IACzF,OAAO,MAAM,CAAC,aAAa,CACvB,IAAI,WAAW,CAAU,SAAS,EAAE;QAChC,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,MAAM;KACjB,CAAC,CACL,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAA+C,MAAmB,EAAE,SAAiB;IAC7G,OAAO,IAAI,OAAO,CAAkC,CAAC,OAAO,EAAE,EAAE;QAC5D,MAAM,IAAI,GAAG,CAAC,KAAsC,EAAQ,EAAE;YAC1D,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC1B,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAW,CAAC,CAAC;gBACnD,OAAO,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAW,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/Index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { emit, off, on, waitForEvent } from './Events/Utils';
|
|
2
|
+
export { EventListenerSubscription } from './Events/EventListenerSubscription';
|
|
3
|
+
export { HTMLElementEventEmitter } from './Events/Emitters/HTMLElementEventEmitter';
|
|
4
|
+
export { PureEventEmitter } from './Events/Emitters/PureEventEmitter';
|
|
5
|
+
export type { IEventEmitter } from './Events/Emitters/Interfaces/IEventEmitter';
|
|
6
|
+
export type { IEventDispatcher } from './Events/Interfaces/IEventDispatcher';
|
|
7
|
+
export type { IEventOptions } from './Events/Interfaces/IEventOptions';
|
|
8
|
+
export type { IEventListenerSubscription } from './Events/Interfaces/IEventListenerSubscription';
|
|
9
|
+
export type { IDisposableLike } from './Types/Disposable';
|
|
10
|
+
export type { IEventDetail } from './Events/Details/Interfaces/IEventDetail';
|
|
11
|
+
export type { ICancelEventDetail } from './Events/Details/Interfaces/ICancelEventDetail';
|
|
12
|
+
export type { IChangedEventDetail } from './Events/Details/Interfaces/IChangedEventDetail';
|
|
13
|
+
export type { IErrorEventDetail } from './Events/Details/Interfaces/IErrorEventDetail';
|
|
14
|
+
export type { IValueEventDetail } from './Events/Details/Interfaces/IValueEventDetail';
|
|
15
|
+
//# sourceMappingURL=Index.d.ts.map
|
package/Index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAChF,YAAY,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,YAAY,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AACjG,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzF,YAAY,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,YAAY,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,YAAY,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC"}
|
package/Index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { emit, off, on, waitForEvent } from './Events/Utils';
|
|
2
|
+
export { EventListenerSubscription } from './Events/EventListenerSubscription';
|
|
3
|
+
export { HTMLElementEventEmitter } from './Events/Emitters/HTMLElementEventEmitter';
|
|
4
|
+
export { PureEventEmitter } from './Events/Emitters/PureEventEmitter';
|
|
5
|
+
//# sourceMappingURL=Index.js.map
|
package/Index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Index.js","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC"}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Breadstone
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Disposable.d.ts","sourceRoot":"","sources":["../../src/Types/Disposable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,yBAAiB,eAAe,CAAC;IAC7B,SAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,eAAe,CAK3D;CACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var IDisposableLike;
|
|
2
|
+
(function (IDisposableLike) {
|
|
3
|
+
function create(dispose) {
|
|
4
|
+
return {
|
|
5
|
+
dispose
|
|
6
|
+
// [Symbol.dispose]: dispose
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
IDisposableLike.create = create;
|
|
10
|
+
})(IDisposableLike || (IDisposableLike = {}));
|
|
11
|
+
//# sourceMappingURL=Disposable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Disposable.js","sourceRoot":"","sources":["../../src/Types/Disposable.ts"],"names":[],"mappings":"AAIA,MAAM,KAAW,eAAe,CAO/B;AAPD,WAAiB,eAAe;IAC5B,SAAgB,MAAM,CAAC,OAAmB;QACtC,OAAO;YACH,OAAO;YACP,4BAA4B;SAC/B,CAAC;IACN,CAAC;IALe,sBAAM,SAKrB,CAAA;AACL,CAAC,EAPgB,eAAe,KAAf,eAAe,QAO/B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@breadstone/mosaik-elements",
|
|
3
|
+
"version": "0.0.12-beta.0",
|
|
4
|
+
"description": "Mosaik element core package.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
|
|
7
|
+
"main": "./Index.js",
|
|
8
|
+
"module": "./Index.js",
|
|
9
|
+
"commonjs": "./Index.js",
|
|
10
|
+
"typings": "./Index.d.ts",
|
|
11
|
+
"types": "./Index.d.ts",
|
|
12
|
+
"customElements": "./custom-elements.json",
|
|
13
|
+
"repository": {
|
|
14
|
+
"url": "git+ssh://git@github.com/RueDeRennes/mosaik.git"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@ctrl/tinycolor": "^4.1.0",
|
|
18
|
+
"@floating-ui/dom": "^1.7.0",
|
|
19
|
+
"@lit-labs/virtualizer": "^2.1.0",
|
|
20
|
+
"apexcharts": "^4.7.0",
|
|
21
|
+
"lit": "^3.3.0",
|
|
22
|
+
"qr-creator": "^1.0.0",
|
|
23
|
+
"qrcode": "^1.5.4",
|
|
24
|
+
"signature_pad": "^5.0.7",
|
|
25
|
+
"tslib": "^2.8.1",
|
|
26
|
+
"webcomponents.js": "^0.7.24"
|
|
27
|
+
}
|
|
28
|
+
}
|