@dooboostore/simple-web-component 1.0.50 → 1.0.52
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/README.md +735 -354
- package/dist/cjs/SwcAppEngine.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +64 -146
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +36 -48
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +9 -12
- package/dist/cjs/decorators/applyClass.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +14 -22
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +12 -42
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +3 -3
- package/dist/cjs/decorators/applySlot.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +9 -12
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/around.js +124 -0
- package/dist/cjs/decorators/around.js.map +7 -0
- package/dist/cjs/decorators/changedAttribute.js +40 -12
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +224 -195
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +14 -12
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/eventMedia.js +36 -8
- package/dist/cjs/decorators/eventMedia.js.map +2 -2
- package/dist/cjs/decorators/fetch.js +278 -0
- package/dist/cjs/decorators/fetch.js.map +7 -0
- package/dist/cjs/decorators/index.js +5 -2
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/intersectionObserver.js +33 -13
- package/dist/cjs/decorators/intersectionObserver.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +11 -11
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/mutationObserver.js +55 -39
- package/dist/cjs/decorators/mutationObserver.js.map +3 -3
- package/dist/cjs/decorators/parameter.js +92 -9
- package/dist/cjs/decorators/parameter.js.map +2 -2
- package/dist/cjs/decorators/publishSwcAppMessage.js +2 -2
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/cjs/decorators/query.js +11 -5
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/requestAnimationFrame.js +7 -16
- package/dist/cjs/decorators/requestAnimationFrame.js.map +2 -2
- package/dist/cjs/decorators/resizeObserver.js +41 -17
- package/dist/cjs/decorators/resizeObserver.js.map +3 -3
- package/dist/cjs/decorators/setInterval.js +36 -25
- package/dist/cjs/decorators/setInterval.js.map +2 -2
- package/dist/cjs/decorators/setTimeout.js +36 -25
- package/dist/cjs/decorators/setTimeout.js.map +2 -2
- package/dist/cjs/decorators/state.js +13 -10
- package/dist/cjs/decorators/state.js.map +2 -2
- package/dist/cjs/decorators/{subscribeSwcAppMessageWhileConnected.js → subscribeSwcAppMessage.js} +20 -21
- package/dist/cjs/decorators/subscribeSwcAppMessage.js.map +7 -0
- package/dist/cjs/decorators/{subscribeSwcAppRouteChangeWhileConnected.js → subscribeSwcAppRouteChange.js} +23 -19
- package/dist/cjs/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/cjs/decorators/swcAppRoute.js +149 -0
- package/dist/cjs/decorators/swcAppRoute.js.map +7 -0
- package/dist/cjs/elements/SwcApp.js +70 -0
- package/dist/cjs/elements/SwcApp.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +262 -83
- package/dist/cjs/elements/SwcAppMixin.js.map +3 -3
- package/dist/cjs/types/index.js +5 -1
- package/dist/cjs/types/index.js.map +2 -2
- package/dist/cjs/utils/Utils.js +36 -15
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/SwcAppEngine.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +64 -146
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +36 -48
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +9 -12
- package/dist/esm/decorators/applyClass.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +15 -23
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +12 -42
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +3 -3
- package/dist/esm/decorators/applySlot.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +9 -12
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/around.js +105 -0
- package/dist/esm/decorators/around.js.map +7 -0
- package/dist/esm/decorators/changedAttribute.js +40 -12
- package/dist/esm/decorators/changedAttribute.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +222 -193
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/emitCustomEvent.js +15 -13
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/eventMedia.js +36 -8
- package/dist/esm/decorators/eventMedia.js.map +2 -2
- package/dist/esm/decorators/fetch.js +259 -0
- package/dist/esm/decorators/fetch.js.map +7 -0
- package/dist/esm/decorators/index.js +5 -2
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/intersectionObserver.js +33 -13
- package/dist/esm/decorators/intersectionObserver.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +11 -11
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/mutationObserver.js +55 -39
- package/dist/esm/decorators/mutationObserver.js.map +3 -3
- package/dist/esm/decorators/parameter.js +92 -9
- package/dist/esm/decorators/parameter.js.map +2 -2
- package/dist/esm/decorators/publishSwcAppMessage.js +2 -2
- package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/query.js +11 -5
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/requestAnimationFrame.js +8 -17
- package/dist/esm/decorators/requestAnimationFrame.js.map +2 -2
- package/dist/esm/decorators/resizeObserver.js +41 -17
- package/dist/esm/decorators/resizeObserver.js.map +2 -2
- package/dist/esm/decorators/setInterval.js +37 -26
- package/dist/esm/decorators/setInterval.js.map +2 -2
- package/dist/esm/decorators/setTimeout.js +37 -26
- package/dist/esm/decorators/setTimeout.js.map +2 -2
- package/dist/esm/decorators/state.js +13 -10
- package/dist/esm/decorators/state.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppMessage.js +53 -0
- package/dist/esm/decorators/subscribeSwcAppMessage.js.map +7 -0
- package/dist/esm/decorators/{subscribeSwcAppRouteChangeWhileConnected.js → subscribeSwcAppRouteChange.js} +20 -16
- package/dist/esm/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/esm/decorators/swcAppRoute.js +130 -0
- package/dist/esm/decorators/swcAppRoute.js.map +7 -0
- package/dist/esm/elements/SwcApp.js +70 -0
- package/dist/esm/elements/SwcApp.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +264 -85
- package/dist/esm/elements/SwcAppMixin.js.map +3 -3
- package/dist/esm/types/index.js +5 -1
- package/dist/esm/types/index.js.map +2 -2
- package/dist/esm/utils/Utils.js +36 -15
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +1893 -1000
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/SwcAppEngine.d.ts +1 -0
- package/dist/types/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/decorators/addEventListener.d.ts +923 -960
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +26 -38
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +1 -3
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +15 -17
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +25 -45
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +1 -3
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/around.d.ts +87 -0
- package/dist/types/decorators/around.d.ts.map +1 -0
- package/dist/types/decorators/changedAttribute.d.ts +21 -1
- package/dist/types/decorators/changedAttribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +0 -1
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/eventMedia.d.ts +24 -1
- package/dist/types/decorators/eventMedia.d.ts.map +1 -1
- package/dist/types/decorators/fetch.d.ts +139 -0
- package/dist/types/decorators/fetch.d.ts.map +1 -0
- package/dist/types/decorators/index.d.ts +5 -2
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/intersectionObserver.d.ts +24 -11
- package/dist/types/decorators/intersectionObserver.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +8 -7
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/mutationObserver.d.ts +26 -13
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -1
- package/dist/types/decorators/parameter.d.ts +84 -6
- package/dist/types/decorators/parameter.d.ts.map +1 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts +0 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +7 -7
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/requestAnimationFrame.d.ts +1 -1
- package/dist/types/decorators/requestAnimationFrame.d.ts.map +1 -1
- package/dist/types/decorators/resizeObserver.d.ts +26 -13
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -1
- package/dist/types/decorators/setInterval.d.ts +10 -0
- package/dist/types/decorators/setInterval.d.ts.map +1 -1
- package/dist/types/decorators/setTimeout.d.ts +10 -0
- package/dist/types/decorators/setTimeout.d.ts.map +1 -1
- package/dist/types/decorators/state.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts +44 -0
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts.map +1 -0
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts +60 -0
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts.map +1 -0
- package/dist/types/decorators/swcAppRoute.d.ts +94 -0
- package/dist/types/decorators/swcAppRoute.d.ts.map +1 -0
- package/dist/types/elements/SwcApp.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +423 -388
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +43 -4
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +15 -5
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +1893 -1000
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +8 -6
- package/src/SwcAppEngine.ts +1 -0
- package/src/decorators/addEventListener.ts +102 -96
- package/src/decorators/applyAttribute.ts +76 -138
- package/src/decorators/applyClass.ts +8 -14
- package/src/decorators/applyNode.ts +33 -41
- package/src/decorators/applyProperty.ts +51 -99
- package/src/decorators/applySlot.ts +3 -3
- package/src/decorators/applyStyle.ts +8 -14
- package/src/decorators/around.ts +196 -0
- package/src/decorators/changedAttribute.ts +39 -15
- package/src/decorators/elementDefine.ts +270 -219
- package/src/decorators/emitCustomEvent.ts +17 -13
- package/src/decorators/eventMedia.ts +50 -9
- package/src/decorators/fetch.ts +454 -0
- package/src/decorators/index.ts +5 -2
- package/src/decorators/intersectionObserver.ts +38 -24
- package/src/decorators/lifecycles.ts +24 -22
- package/src/decorators/mutationObserver.ts +71 -52
- package/src/decorators/parameter.ts +145 -14
- package/src/decorators/publishSwcAppMessage.ts +3 -4
- package/src/decorators/query.ts +22 -14
- package/src/decorators/requestAnimationFrame.ts +10 -19
- package/src/decorators/resizeObserver.ts +50 -29
- package/src/decorators/setInterval.ts +37 -26
- package/src/decorators/setTimeout.ts +37 -26
- package/src/decorators/state.ts +19 -13
- package/src/decorators/subscribeSwcAppMessage.ts +106 -0
- package/src/decorators/subscribeSwcAppRouteChange.ts +131 -0
- package/src/decorators/swcAppRoute.ts +231 -0
- package/src/elements/SwcApp.ts +40 -10
- package/src/elements/SwcAppMixin.ts +340 -101
- package/src/types/index.ts +38 -5
- package/src/utils/Utils.ts +50 -18
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +0 -7
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +0 -7
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +0 -54
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +0 -7
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +0 -7
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +0 -23
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +0 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +0 -31
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +0 -1
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +0 -91
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +0 -107
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReflectUtils } from '@dooboostore/core';
|
|
2
2
|
import { SpecialSelector, SwcQueryOptions, HelperHostSet, SwcFnSelector, SwcSelector } from '../types';
|
|
3
3
|
|
|
4
|
-
export interface AddEventListenerBaseOptions<TEvent extends Event = Event> extends EventListenerOptions {
|
|
4
|
+
export interface AddEventListenerBaseOptions<TEvent extends Event = Event, Return = any> extends EventListenerOptions {
|
|
5
5
|
capture?: boolean;
|
|
6
6
|
once?: boolean;
|
|
7
7
|
passive?: boolean;
|
|
@@ -10,7 +10,16 @@ export interface AddEventListenerBaseOptions<TEvent extends Event = Event> exten
|
|
|
10
10
|
preventDefault?: boolean;
|
|
11
11
|
// removeOnDisconnected?: boolean;
|
|
12
12
|
// delegate는 문자열 셀렉터 전용 → AddEventListenerQueryOptions에만 존재
|
|
13
|
-
filter?: (target:
|
|
13
|
+
filter?: (target: TEvent | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}) => boolean | Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* filter 통과 후, 핸들러 호출 직전에 실행되는 훅. 이벤트/meta에 더해 핸들러에 넘어갈 args 배열을 받으며 await된다(비동기 가능).
|
|
16
|
+
* 리턴값은 게이팅에 쓰이지 않는다(취소는 filter 담당).
|
|
17
|
+
*/
|
|
18
|
+
before?: (target: TEvent | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}, args: any[]) => any | Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* 핸들러가 성공/실패해도 항상 실행되는 정리 훅. ctx로 핸들러 인자/결과/에러를 받는다. 에러는 삼키지 않고 전파.
|
|
21
|
+
*/
|
|
22
|
+
finally?: (target: TEvent | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}, ctx: { args: any[]; result?: Return; error?: any }) => any | Promise<any>;
|
|
14
23
|
// 리스너 제거(disconnected 또는 unmount) 시 호출되는 콜백. 첫 번째 인자는 바인딩된 타겟 element, 두 번째는 이 옵션이 속한 전체 옵션 객체(Base + SwcQuery + delegate).
|
|
15
24
|
removeListener?: (target: Element, optionValue: AddEventListenerQueryOptions<TEvent>) => void;
|
|
16
25
|
// RxJS operator options
|
|
@@ -32,7 +41,7 @@ export interface AddEventListenerMetadata<TEvent extends Event = Event> {
|
|
|
32
41
|
export const ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:add-event-listener');
|
|
33
42
|
|
|
34
43
|
// root + delegate 허용 — 문자열 셀렉터는 컴포넌트 DOM 트리 안에서 탐색/델리게이션하므로 의미 있음
|
|
35
|
-
export type AddEventListenerQueryOptions<TEvent extends Event = Event> = AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean | 'this' | 'mutation' };
|
|
44
|
+
export type AddEventListenerQueryOptions<TEvent extends Event = Event, Return = any> = AddEventListenerBaseOptions<TEvent, Return> & SwcQueryOptions & { delegate?: boolean | 'this' | 'mutation' };
|
|
36
45
|
// root·delegate 비허용 — 함수 셀렉터는 이미 요소를 직접 반환하므로 root·delegate가 무의미함
|
|
37
46
|
export type AddEventListenerNonQueryOptions<TEvent extends Event = Event> = AddEventListenerBaseOptions<TEvent>;
|
|
38
47
|
|
|
@@ -45,12 +54,12 @@ export function addEventListener<TEvent extends Event = Event>(selector: string,
|
|
|
45
54
|
export function addEventListener<TEvent extends Event = Event>(selector: string, type: string[], options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;
|
|
46
55
|
export function addEventListener<TEvent extends Event = Event>(selector: EventListenerFnSelector, type: string, options?: AddEventListenerNonQueryOptions<TEvent>): MethodDecorator;
|
|
47
56
|
/**
|
|
48
|
-
* @
|
|
57
|
+
* @event(type, options?) — 셀렉터 생략 시 $this(컴포넌트 자신)로 바인딩
|
|
49
58
|
*/
|
|
50
59
|
export function addEventListener<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;
|
|
51
60
|
export function addEventListener<TEvent extends Event = Event>(type: string[], options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;
|
|
52
61
|
/**
|
|
53
|
-
* @
|
|
62
|
+
* @event decorator to bind events to elements.
|
|
54
63
|
*/
|
|
55
64
|
export function addEventListener<TEvent extends Event = Event>(selectorOrType: EventListenerSelector | string | string[], typeOrOptions?: string | string[] | AddEventListenerQueryOptions<TEvent>, maybeOptions?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {
|
|
56
65
|
return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
@@ -73,7 +82,7 @@ export function addEventListener<TEvent extends Event = Event>(selectorOrType: E
|
|
|
73
82
|
|
|
74
83
|
const constructor = targetObj.constructor;
|
|
75
84
|
|
|
76
|
-
let listeners = ReflectUtils.
|
|
85
|
+
let listeners = ReflectUtils.getOwnMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor) as AddEventListenerMetadata<TEvent>[] | undefined;
|
|
77
86
|
if (!listeners) {
|
|
78
87
|
listeners = [];
|
|
79
88
|
ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
@@ -128,15 +137,9 @@ export function addEventListenerAll<TEvent extends Event = Event>(selector: stri
|
|
|
128
137
|
return addEventListener<TEvent>(selector, type, {...options??{}, root:'all'});
|
|
129
138
|
}
|
|
130
139
|
|
|
131
|
-
/**
|
|
132
|
-
* @addEventListenerThis decorator - simplified version of @addEventListener for $this selector
|
|
133
|
-
*/
|
|
134
|
-
export function addEventListenerThis<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {
|
|
135
|
-
return addEventListener<TEvent>('$this', type, options);
|
|
136
|
-
}
|
|
137
140
|
|
|
138
141
|
/**
|
|
139
|
-
* @
|
|
142
|
+
* @eventAppHost decorator - simplified version of @event for $appHost selector
|
|
140
143
|
*/
|
|
141
144
|
export function addEventListenerAppHost<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {
|
|
142
145
|
return addEventListener<TEvent>('$appHost', type, options);
|
|
@@ -165,14 +168,46 @@ export const eventAll = addEventListenerAll;
|
|
|
165
168
|
export const eventAppHost = addEventListenerAppHost;
|
|
166
169
|
export const eventWindow = addEventListenerWindow;
|
|
167
170
|
export const eventDocument = addEventListenerDocument;
|
|
168
|
-
export const eventThis = addEventListenerThis;
|
|
169
171
|
|
|
170
172
|
// ─── 이벤트 타입별 별칭 (eventClick, eventClickDelegateLight, ...) ───
|
|
171
173
|
// 위 scope/delegate 축 별칭들을 특정 이벤트 타입에 고정해서 재바인딩한다.
|
|
172
|
-
// 실제 타입별 export 목록(
|
|
174
|
+
// 실제 타입별 export 목록(885개, 아래)은 이 팩토리로 생성 스크립트를 돌려서 만들었다.
|
|
175
|
+
// 기본 별칭(eventClick)은 셀렉터를 빼면 자기 자신($this) — @event('click') 과 같다:
|
|
176
|
+
// @eventClick / @eventClick({...}) → $this, @eventClick('.btn', {...}) → 셀렉터
|
|
177
|
+
// selector 가 필요 없는 AppHost/Window/Document 는 options 만 받는다 (@eventClickWindow / @eventClickWindow({...})).
|
|
178
|
+
// 인자가 없으면 괄호도 없다 — 빈 괄호 @eventClick() 는 시그니처가 없어 타입 에러.
|
|
179
|
+
// 두 번째 인자가 string|symbol이면 (target, propertyKey, descriptor)로 직접 호출된 것으로 판단한다.
|
|
180
|
+
export interface TypedEventDecorator<TEvent extends Event = Event> {
|
|
181
|
+
(selector: string | EventListenerFnSelector, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;
|
|
182
|
+
(options: AddEventListenerQueryOptions<TEvent>): MethodDecorator;
|
|
183
|
+
(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): any;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function makeTypedEventDecorator<TEvent extends Event = Event>(type: string): TypedEventDecorator<TEvent> {
|
|
187
|
+
return ((a?: any, b?: any, c?: PropertyDescriptor): any => {
|
|
188
|
+
if (typeof b === 'string' || typeof b === 'symbol') return addEventListener<TEvent>('$this', type)(a, b, c!);
|
|
189
|
+
if (typeof a === 'string' || typeof a === 'function') return addEventListener<TEvent>(a, type, b);
|
|
190
|
+
return addEventListener<TEvent>('$this', type, a);
|
|
191
|
+
}) as TypedEventDecorator<TEvent>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface BareableMethodDecorator<TOptions> {
|
|
195
|
+
(options: TOptions): MethodDecorator;
|
|
196
|
+
(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): any;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function makeBareableEventDecorator<TOptions>(bind: (options?: TOptions) => MethodDecorator): BareableMethodDecorator<TOptions> {
|
|
200
|
+
return ((a?: any, b?: any, c?: PropertyDescriptor): any => {
|
|
201
|
+
if (typeof b === 'string' || typeof b === 'symbol') {
|
|
202
|
+
return bind()(a, b, c);
|
|
203
|
+
}
|
|
204
|
+
return bind(a);
|
|
205
|
+
}) as BareableMethodDecorator<TOptions>;
|
|
206
|
+
}
|
|
207
|
+
|
|
173
208
|
export function makeTypedEventAliases<TEvent extends Event = Event>(type: string) {
|
|
174
209
|
return {
|
|
175
|
-
base:
|
|
210
|
+
base: makeTypedEventDecorator<TEvent>(type),
|
|
176
211
|
delegateLight: (selector: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>) => addEventListenerDelegateLight<TEvent>(selector, type, options),
|
|
177
212
|
delegateShadow: (selector: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>) => addEventListenerDelegateShadow<TEvent>(selector, type, options),
|
|
178
213
|
delegateAll: (selector: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>) => addEventListenerDelegateAll<TEvent>(selector, type, options),
|
|
@@ -184,16 +219,15 @@ export function makeTypedEventAliases<TEvent extends Event = Event>(type: string
|
|
|
184
219
|
light: (selector: string, options?: AddEventListenerQueryOptions<TEvent>) => addEventListenerLight<TEvent>(selector, type, options),
|
|
185
220
|
shadow: (selector: string, options?: AddEventListenerQueryOptions<TEvent>) => addEventListenerShadow<TEvent>(selector, type, options),
|
|
186
221
|
all: (selector: string, options?: AddEventListenerQueryOptions<TEvent>) => addEventListenerAll<TEvent>(selector, type, options),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
document: (options?: AddEventListenerQueryOptions<TEvent>) => addEventListenerDocument<TEvent>(type, options),
|
|
222
|
+
appHost: makeBareableEventDecorator<AddEventListenerQueryOptions<TEvent>>((options) => addEventListenerAppHost<TEvent>(type, options)),
|
|
223
|
+
window: makeBareableEventDecorator<AddEventListenerQueryOptions<TEvent>>((options) => addEventListenerWindow<TEvent>(type, options)),
|
|
224
|
+
document: makeBareableEventDecorator<AddEventListenerQueryOptions<TEvent>>((options) => addEventListenerDocument<TEvent>(type, options)),
|
|
191
225
|
};
|
|
192
226
|
}
|
|
193
227
|
|
|
194
228
|
// ─── 이벤트 타입별 별칭 (eventClick, eventClickDelegateLight, eventInputThis, ...) ───
|
|
195
229
|
// 위 makeTypedEventAliases 팩토리를 자주 쓰는 DOM 이벤트 타입 각각에 대해 미리 바인딩해둔 것.
|
|
196
|
-
// 생성 스크립트로 만들어짐 — 새 타입을 추가하려면 같은 패턴(
|
|
230
|
+
// 생성 스크립트로 만들어짐 — 새 타입을 추가하려면 같은 패턴(15개 export)을 추가하면 된다.
|
|
197
231
|
const clickAliases = makeTypedEventAliases<MouseEvent>('click');
|
|
198
232
|
export const eventClick = clickAliases.base;
|
|
199
233
|
export const eventClickDelegateLight = clickAliases.delegateLight;
|
|
@@ -207,7 +241,6 @@ export const eventClickMutation = clickAliases.mutation;
|
|
|
207
241
|
export const eventClickLight = clickAliases.light;
|
|
208
242
|
export const eventClickShadow = clickAliases.shadow;
|
|
209
243
|
export const eventClickAll = clickAliases.all;
|
|
210
|
-
export const eventClickThis = clickAliases.this;
|
|
211
244
|
export const eventClickAppHost = clickAliases.appHost;
|
|
212
245
|
export const eventClickWindow = clickAliases.window;
|
|
213
246
|
export const eventClickDocument = clickAliases.document;
|
|
@@ -224,7 +257,6 @@ export const eventDblclickMutation = dblclickAliases.mutation;
|
|
|
224
257
|
export const eventDblclickLight = dblclickAliases.light;
|
|
225
258
|
export const eventDblclickShadow = dblclickAliases.shadow;
|
|
226
259
|
export const eventDblclickAll = dblclickAliases.all;
|
|
227
|
-
export const eventDblclickThis = dblclickAliases.this;
|
|
228
260
|
export const eventDblclickAppHost = dblclickAliases.appHost;
|
|
229
261
|
export const eventDblclickWindow = dblclickAliases.window;
|
|
230
262
|
export const eventDblclickDocument = dblclickAliases.document;
|
|
@@ -241,7 +273,6 @@ export const eventMousedownMutation = mousedownAliases.mutation;
|
|
|
241
273
|
export const eventMousedownLight = mousedownAliases.light;
|
|
242
274
|
export const eventMousedownShadow = mousedownAliases.shadow;
|
|
243
275
|
export const eventMousedownAll = mousedownAliases.all;
|
|
244
|
-
export const eventMousedownThis = mousedownAliases.this;
|
|
245
276
|
export const eventMousedownAppHost = mousedownAliases.appHost;
|
|
246
277
|
export const eventMousedownWindow = mousedownAliases.window;
|
|
247
278
|
export const eventMousedownDocument = mousedownAliases.document;
|
|
@@ -258,7 +289,6 @@ export const eventMouseupMutation = mouseupAliases.mutation;
|
|
|
258
289
|
export const eventMouseupLight = mouseupAliases.light;
|
|
259
290
|
export const eventMouseupShadow = mouseupAliases.shadow;
|
|
260
291
|
export const eventMouseupAll = mouseupAliases.all;
|
|
261
|
-
export const eventMouseupThis = mouseupAliases.this;
|
|
262
292
|
export const eventMouseupAppHost = mouseupAliases.appHost;
|
|
263
293
|
export const eventMouseupWindow = mouseupAliases.window;
|
|
264
294
|
export const eventMouseupDocument = mouseupAliases.document;
|
|
@@ -275,7 +305,6 @@ export const eventMousemoveMutation = mousemoveAliases.mutation;
|
|
|
275
305
|
export const eventMousemoveLight = mousemoveAliases.light;
|
|
276
306
|
export const eventMousemoveShadow = mousemoveAliases.shadow;
|
|
277
307
|
export const eventMousemoveAll = mousemoveAliases.all;
|
|
278
|
-
export const eventMousemoveThis = mousemoveAliases.this;
|
|
279
308
|
export const eventMousemoveAppHost = mousemoveAliases.appHost;
|
|
280
309
|
export const eventMousemoveWindow = mousemoveAliases.window;
|
|
281
310
|
export const eventMousemoveDocument = mousemoveAliases.document;
|
|
@@ -292,7 +321,6 @@ export const eventMouseoverMutation = mouseoverAliases.mutation;
|
|
|
292
321
|
export const eventMouseoverLight = mouseoverAliases.light;
|
|
293
322
|
export const eventMouseoverShadow = mouseoverAliases.shadow;
|
|
294
323
|
export const eventMouseoverAll = mouseoverAliases.all;
|
|
295
|
-
export const eventMouseoverThis = mouseoverAliases.this;
|
|
296
324
|
export const eventMouseoverAppHost = mouseoverAliases.appHost;
|
|
297
325
|
export const eventMouseoverWindow = mouseoverAliases.window;
|
|
298
326
|
export const eventMouseoverDocument = mouseoverAliases.document;
|
|
@@ -309,7 +337,6 @@ export const eventMouseoutMutation = mouseoutAliases.mutation;
|
|
|
309
337
|
export const eventMouseoutLight = mouseoutAliases.light;
|
|
310
338
|
export const eventMouseoutShadow = mouseoutAliases.shadow;
|
|
311
339
|
export const eventMouseoutAll = mouseoutAliases.all;
|
|
312
|
-
export const eventMouseoutThis = mouseoutAliases.this;
|
|
313
340
|
export const eventMouseoutAppHost = mouseoutAliases.appHost;
|
|
314
341
|
export const eventMouseoutWindow = mouseoutAliases.window;
|
|
315
342
|
export const eventMouseoutDocument = mouseoutAliases.document;
|
|
@@ -326,7 +353,6 @@ export const eventMouseenterMutation = mouseenterAliases.mutation;
|
|
|
326
353
|
export const eventMouseenterLight = mouseenterAliases.light;
|
|
327
354
|
export const eventMouseenterShadow = mouseenterAliases.shadow;
|
|
328
355
|
export const eventMouseenterAll = mouseenterAliases.all;
|
|
329
|
-
export const eventMouseenterThis = mouseenterAliases.this;
|
|
330
356
|
export const eventMouseenterAppHost = mouseenterAliases.appHost;
|
|
331
357
|
export const eventMouseenterWindow = mouseenterAliases.window;
|
|
332
358
|
export const eventMouseenterDocument = mouseenterAliases.document;
|
|
@@ -343,7 +369,6 @@ export const eventMouseleaveMutation = mouseleaveAliases.mutation;
|
|
|
343
369
|
export const eventMouseleaveLight = mouseleaveAliases.light;
|
|
344
370
|
export const eventMouseleaveShadow = mouseleaveAliases.shadow;
|
|
345
371
|
export const eventMouseleaveAll = mouseleaveAliases.all;
|
|
346
|
-
export const eventMouseleaveThis = mouseleaveAliases.this;
|
|
347
372
|
export const eventMouseleaveAppHost = mouseleaveAliases.appHost;
|
|
348
373
|
export const eventMouseleaveWindow = mouseleaveAliases.window;
|
|
349
374
|
export const eventMouseleaveDocument = mouseleaveAliases.document;
|
|
@@ -360,7 +385,6 @@ export const eventContextmenuMutation = contextmenuAliases.mutation;
|
|
|
360
385
|
export const eventContextmenuLight = contextmenuAliases.light;
|
|
361
386
|
export const eventContextmenuShadow = contextmenuAliases.shadow;
|
|
362
387
|
export const eventContextmenuAll = contextmenuAliases.all;
|
|
363
|
-
export const eventContextmenuThis = contextmenuAliases.this;
|
|
364
388
|
export const eventContextmenuAppHost = contextmenuAliases.appHost;
|
|
365
389
|
export const eventContextmenuWindow = contextmenuAliases.window;
|
|
366
390
|
export const eventContextmenuDocument = contextmenuAliases.document;
|
|
@@ -377,7 +401,6 @@ export const eventWheelMutation = wheelAliases.mutation;
|
|
|
377
401
|
export const eventWheelLight = wheelAliases.light;
|
|
378
402
|
export const eventWheelShadow = wheelAliases.shadow;
|
|
379
403
|
export const eventWheelAll = wheelAliases.all;
|
|
380
|
-
export const eventWheelThis = wheelAliases.this;
|
|
381
404
|
export const eventWheelAppHost = wheelAliases.appHost;
|
|
382
405
|
export const eventWheelWindow = wheelAliases.window;
|
|
383
406
|
export const eventWheelDocument = wheelAliases.document;
|
|
@@ -394,7 +417,6 @@ export const eventKeydownMutation = keydownAliases.mutation;
|
|
|
394
417
|
export const eventKeydownLight = keydownAliases.light;
|
|
395
418
|
export const eventKeydownShadow = keydownAliases.shadow;
|
|
396
419
|
export const eventKeydownAll = keydownAliases.all;
|
|
397
|
-
export const eventKeydownThis = keydownAliases.this;
|
|
398
420
|
export const eventKeydownAppHost = keydownAliases.appHost;
|
|
399
421
|
export const eventKeydownWindow = keydownAliases.window;
|
|
400
422
|
export const eventKeydownDocument = keydownAliases.document;
|
|
@@ -411,7 +433,6 @@ export const eventKeyupMutation = keyupAliases.mutation;
|
|
|
411
433
|
export const eventKeyupLight = keyupAliases.light;
|
|
412
434
|
export const eventKeyupShadow = keyupAliases.shadow;
|
|
413
435
|
export const eventKeyupAll = keyupAliases.all;
|
|
414
|
-
export const eventKeyupThis = keyupAliases.this;
|
|
415
436
|
export const eventKeyupAppHost = keyupAliases.appHost;
|
|
416
437
|
export const eventKeyupWindow = keyupAliases.window;
|
|
417
438
|
export const eventKeyupDocument = keyupAliases.document;
|
|
@@ -428,7 +449,6 @@ export const eventKeypressMutation = keypressAliases.mutation;
|
|
|
428
449
|
export const eventKeypressLight = keypressAliases.light;
|
|
429
450
|
export const eventKeypressShadow = keypressAliases.shadow;
|
|
430
451
|
export const eventKeypressAll = keypressAliases.all;
|
|
431
|
-
export const eventKeypressThis = keypressAliases.this;
|
|
432
452
|
export const eventKeypressAppHost = keypressAliases.appHost;
|
|
433
453
|
export const eventKeypressWindow = keypressAliases.window;
|
|
434
454
|
export const eventKeypressDocument = keypressAliases.document;
|
|
@@ -445,7 +465,6 @@ export const eventInputMutation = inputAliases.mutation;
|
|
|
445
465
|
export const eventInputLight = inputAliases.light;
|
|
446
466
|
export const eventInputShadow = inputAliases.shadow;
|
|
447
467
|
export const eventInputAll = inputAliases.all;
|
|
448
|
-
export const eventInputThis = inputAliases.this;
|
|
449
468
|
export const eventInputAppHost = inputAliases.appHost;
|
|
450
469
|
export const eventInputWindow = inputAliases.window;
|
|
451
470
|
export const eventInputDocument = inputAliases.document;
|
|
@@ -462,7 +481,6 @@ export const eventChangeMutation = changeAliases.mutation;
|
|
|
462
481
|
export const eventChangeLight = changeAliases.light;
|
|
463
482
|
export const eventChangeShadow = changeAliases.shadow;
|
|
464
483
|
export const eventChangeAll = changeAliases.all;
|
|
465
|
-
export const eventChangeThis = changeAliases.this;
|
|
466
484
|
export const eventChangeAppHost = changeAliases.appHost;
|
|
467
485
|
export const eventChangeWindow = changeAliases.window;
|
|
468
486
|
export const eventChangeDocument = changeAliases.document;
|
|
@@ -479,7 +497,6 @@ export const eventSubmitMutation = submitAliases.mutation;
|
|
|
479
497
|
export const eventSubmitLight = submitAliases.light;
|
|
480
498
|
export const eventSubmitShadow = submitAliases.shadow;
|
|
481
499
|
export const eventSubmitAll = submitAliases.all;
|
|
482
|
-
export const eventSubmitThis = submitAliases.this;
|
|
483
500
|
export const eventSubmitAppHost = submitAliases.appHost;
|
|
484
501
|
export const eventSubmitWindow = submitAliases.window;
|
|
485
502
|
export const eventSubmitDocument = submitAliases.document;
|
|
@@ -496,7 +513,6 @@ export const eventResetMutation = resetAliases.mutation;
|
|
|
496
513
|
export const eventResetLight = resetAliases.light;
|
|
497
514
|
export const eventResetShadow = resetAliases.shadow;
|
|
498
515
|
export const eventResetAll = resetAliases.all;
|
|
499
|
-
export const eventResetThis = resetAliases.this;
|
|
500
516
|
export const eventResetAppHost = resetAliases.appHost;
|
|
501
517
|
export const eventResetWindow = resetAliases.window;
|
|
502
518
|
export const eventResetDocument = resetAliases.document;
|
|
@@ -513,7 +529,6 @@ export const eventInvalidMutation = invalidAliases.mutation;
|
|
|
513
529
|
export const eventInvalidLight = invalidAliases.light;
|
|
514
530
|
export const eventInvalidShadow = invalidAliases.shadow;
|
|
515
531
|
export const eventInvalidAll = invalidAliases.all;
|
|
516
|
-
export const eventInvalidThis = invalidAliases.this;
|
|
517
532
|
export const eventInvalidAppHost = invalidAliases.appHost;
|
|
518
533
|
export const eventInvalidWindow = invalidAliases.window;
|
|
519
534
|
export const eventInvalidDocument = invalidAliases.document;
|
|
@@ -530,7 +545,6 @@ export const eventSelectMutation = selectAliases.mutation;
|
|
|
530
545
|
export const eventSelectLight = selectAliases.light;
|
|
531
546
|
export const eventSelectShadow = selectAliases.shadow;
|
|
532
547
|
export const eventSelectAll = selectAliases.all;
|
|
533
|
-
export const eventSelectThis = selectAliases.this;
|
|
534
548
|
export const eventSelectAppHost = selectAliases.appHost;
|
|
535
549
|
export const eventSelectWindow = selectAliases.window;
|
|
536
550
|
export const eventSelectDocument = selectAliases.document;
|
|
@@ -547,7 +561,6 @@ export const eventFocusMutation = focusAliases.mutation;
|
|
|
547
561
|
export const eventFocusLight = focusAliases.light;
|
|
548
562
|
export const eventFocusShadow = focusAliases.shadow;
|
|
549
563
|
export const eventFocusAll = focusAliases.all;
|
|
550
|
-
export const eventFocusThis = focusAliases.this;
|
|
551
564
|
export const eventFocusAppHost = focusAliases.appHost;
|
|
552
565
|
export const eventFocusWindow = focusAliases.window;
|
|
553
566
|
export const eventFocusDocument = focusAliases.document;
|
|
@@ -564,7 +577,6 @@ export const eventBlurMutation = blurAliases.mutation;
|
|
|
564
577
|
export const eventBlurLight = blurAliases.light;
|
|
565
578
|
export const eventBlurShadow = blurAliases.shadow;
|
|
566
579
|
export const eventBlurAll = blurAliases.all;
|
|
567
|
-
export const eventBlurThis = blurAliases.this;
|
|
568
580
|
export const eventBlurAppHost = blurAliases.appHost;
|
|
569
581
|
export const eventBlurWindow = blurAliases.window;
|
|
570
582
|
export const eventBlurDocument = blurAliases.document;
|
|
@@ -581,7 +593,6 @@ export const eventFocusinMutation = focusinAliases.mutation;
|
|
|
581
593
|
export const eventFocusinLight = focusinAliases.light;
|
|
582
594
|
export const eventFocusinShadow = focusinAliases.shadow;
|
|
583
595
|
export const eventFocusinAll = focusinAliases.all;
|
|
584
|
-
export const eventFocusinThis = focusinAliases.this;
|
|
585
596
|
export const eventFocusinAppHost = focusinAliases.appHost;
|
|
586
597
|
export const eventFocusinWindow = focusinAliases.window;
|
|
587
598
|
export const eventFocusinDocument = focusinAliases.document;
|
|
@@ -598,7 +609,6 @@ export const eventFocusoutMutation = focusoutAliases.mutation;
|
|
|
598
609
|
export const eventFocusoutLight = focusoutAliases.light;
|
|
599
610
|
export const eventFocusoutShadow = focusoutAliases.shadow;
|
|
600
611
|
export const eventFocusoutAll = focusoutAliases.all;
|
|
601
|
-
export const eventFocusoutThis = focusoutAliases.this;
|
|
602
612
|
export const eventFocusoutAppHost = focusoutAliases.appHost;
|
|
603
613
|
export const eventFocusoutWindow = focusoutAliases.window;
|
|
604
614
|
export const eventFocusoutDocument = focusoutAliases.document;
|
|
@@ -615,7 +625,6 @@ export const eventDragstartMutation = dragstartAliases.mutation;
|
|
|
615
625
|
export const eventDragstartLight = dragstartAliases.light;
|
|
616
626
|
export const eventDragstartShadow = dragstartAliases.shadow;
|
|
617
627
|
export const eventDragstartAll = dragstartAliases.all;
|
|
618
|
-
export const eventDragstartThis = dragstartAliases.this;
|
|
619
628
|
export const eventDragstartAppHost = dragstartAliases.appHost;
|
|
620
629
|
export const eventDragstartWindow = dragstartAliases.window;
|
|
621
630
|
export const eventDragstartDocument = dragstartAliases.document;
|
|
@@ -632,7 +641,6 @@ export const eventDragMutation = dragAliases.mutation;
|
|
|
632
641
|
export const eventDragLight = dragAliases.light;
|
|
633
642
|
export const eventDragShadow = dragAliases.shadow;
|
|
634
643
|
export const eventDragAll = dragAliases.all;
|
|
635
|
-
export const eventDragThis = dragAliases.this;
|
|
636
644
|
export const eventDragAppHost = dragAliases.appHost;
|
|
637
645
|
export const eventDragWindow = dragAliases.window;
|
|
638
646
|
export const eventDragDocument = dragAliases.document;
|
|
@@ -649,7 +657,6 @@ export const eventDragendMutation = dragendAliases.mutation;
|
|
|
649
657
|
export const eventDragendLight = dragendAliases.light;
|
|
650
658
|
export const eventDragendShadow = dragendAliases.shadow;
|
|
651
659
|
export const eventDragendAll = dragendAliases.all;
|
|
652
|
-
export const eventDragendThis = dragendAliases.this;
|
|
653
660
|
export const eventDragendAppHost = dragendAliases.appHost;
|
|
654
661
|
export const eventDragendWindow = dragendAliases.window;
|
|
655
662
|
export const eventDragendDocument = dragendAliases.document;
|
|
@@ -666,7 +673,6 @@ export const eventDragenterMutation = dragenterAliases.mutation;
|
|
|
666
673
|
export const eventDragenterLight = dragenterAliases.light;
|
|
667
674
|
export const eventDragenterShadow = dragenterAliases.shadow;
|
|
668
675
|
export const eventDragenterAll = dragenterAliases.all;
|
|
669
|
-
export const eventDragenterThis = dragenterAliases.this;
|
|
670
676
|
export const eventDragenterAppHost = dragenterAliases.appHost;
|
|
671
677
|
export const eventDragenterWindow = dragenterAliases.window;
|
|
672
678
|
export const eventDragenterDocument = dragenterAliases.document;
|
|
@@ -683,7 +689,6 @@ export const eventDragleaveMutation = dragleaveAliases.mutation;
|
|
|
683
689
|
export const eventDragleaveLight = dragleaveAliases.light;
|
|
684
690
|
export const eventDragleaveShadow = dragleaveAliases.shadow;
|
|
685
691
|
export const eventDragleaveAll = dragleaveAliases.all;
|
|
686
|
-
export const eventDragleaveThis = dragleaveAliases.this;
|
|
687
692
|
export const eventDragleaveAppHost = dragleaveAliases.appHost;
|
|
688
693
|
export const eventDragleaveWindow = dragleaveAliases.window;
|
|
689
694
|
export const eventDragleaveDocument = dragleaveAliases.document;
|
|
@@ -700,7 +705,6 @@ export const eventDragoverMutation = dragoverAliases.mutation;
|
|
|
700
705
|
export const eventDragoverLight = dragoverAliases.light;
|
|
701
706
|
export const eventDragoverShadow = dragoverAliases.shadow;
|
|
702
707
|
export const eventDragoverAll = dragoverAliases.all;
|
|
703
|
-
export const eventDragoverThis = dragoverAliases.this;
|
|
704
708
|
export const eventDragoverAppHost = dragoverAliases.appHost;
|
|
705
709
|
export const eventDragoverWindow = dragoverAliases.window;
|
|
706
710
|
export const eventDragoverDocument = dragoverAliases.document;
|
|
@@ -717,7 +721,6 @@ export const eventDropMutation = dropAliases.mutation;
|
|
|
717
721
|
export const eventDropLight = dropAliases.light;
|
|
718
722
|
export const eventDropShadow = dropAliases.shadow;
|
|
719
723
|
export const eventDropAll = dropAliases.all;
|
|
720
|
-
export const eventDropThis = dropAliases.this;
|
|
721
724
|
export const eventDropAppHost = dropAliases.appHost;
|
|
722
725
|
export const eventDropWindow = dropAliases.window;
|
|
723
726
|
export const eventDropDocument = dropAliases.document;
|
|
@@ -734,7 +737,6 @@ export const eventTouchstartMutation = touchstartAliases.mutation;
|
|
|
734
737
|
export const eventTouchstartLight = touchstartAliases.light;
|
|
735
738
|
export const eventTouchstartShadow = touchstartAliases.shadow;
|
|
736
739
|
export const eventTouchstartAll = touchstartAliases.all;
|
|
737
|
-
export const eventTouchstartThis = touchstartAliases.this;
|
|
738
740
|
export const eventTouchstartAppHost = touchstartAliases.appHost;
|
|
739
741
|
export const eventTouchstartWindow = touchstartAliases.window;
|
|
740
742
|
export const eventTouchstartDocument = touchstartAliases.document;
|
|
@@ -751,7 +753,6 @@ export const eventTouchmoveMutation = touchmoveAliases.mutation;
|
|
|
751
753
|
export const eventTouchmoveLight = touchmoveAliases.light;
|
|
752
754
|
export const eventTouchmoveShadow = touchmoveAliases.shadow;
|
|
753
755
|
export const eventTouchmoveAll = touchmoveAliases.all;
|
|
754
|
-
export const eventTouchmoveThis = touchmoveAliases.this;
|
|
755
756
|
export const eventTouchmoveAppHost = touchmoveAliases.appHost;
|
|
756
757
|
export const eventTouchmoveWindow = touchmoveAliases.window;
|
|
757
758
|
export const eventTouchmoveDocument = touchmoveAliases.document;
|
|
@@ -768,7 +769,6 @@ export const eventTouchendMutation = touchendAliases.mutation;
|
|
|
768
769
|
export const eventTouchendLight = touchendAliases.light;
|
|
769
770
|
export const eventTouchendShadow = touchendAliases.shadow;
|
|
770
771
|
export const eventTouchendAll = touchendAliases.all;
|
|
771
|
-
export const eventTouchendThis = touchendAliases.this;
|
|
772
772
|
export const eventTouchendAppHost = touchendAliases.appHost;
|
|
773
773
|
export const eventTouchendWindow = touchendAliases.window;
|
|
774
774
|
export const eventTouchendDocument = touchendAliases.document;
|
|
@@ -785,7 +785,6 @@ export const eventTouchcancelMutation = touchcancelAliases.mutation;
|
|
|
785
785
|
export const eventTouchcancelLight = touchcancelAliases.light;
|
|
786
786
|
export const eventTouchcancelShadow = touchcancelAliases.shadow;
|
|
787
787
|
export const eventTouchcancelAll = touchcancelAliases.all;
|
|
788
|
-
export const eventTouchcancelThis = touchcancelAliases.this;
|
|
789
788
|
export const eventTouchcancelAppHost = touchcancelAliases.appHost;
|
|
790
789
|
export const eventTouchcancelWindow = touchcancelAliases.window;
|
|
791
790
|
export const eventTouchcancelDocument = touchcancelAliases.document;
|
|
@@ -802,7 +801,6 @@ export const eventPointerdownMutation = pointerdownAliases.mutation;
|
|
|
802
801
|
export const eventPointerdownLight = pointerdownAliases.light;
|
|
803
802
|
export const eventPointerdownShadow = pointerdownAliases.shadow;
|
|
804
803
|
export const eventPointerdownAll = pointerdownAliases.all;
|
|
805
|
-
export const eventPointerdownThis = pointerdownAliases.this;
|
|
806
804
|
export const eventPointerdownAppHost = pointerdownAliases.appHost;
|
|
807
805
|
export const eventPointerdownWindow = pointerdownAliases.window;
|
|
808
806
|
export const eventPointerdownDocument = pointerdownAliases.document;
|
|
@@ -819,7 +817,6 @@ export const eventPointerupMutation = pointerupAliases.mutation;
|
|
|
819
817
|
export const eventPointerupLight = pointerupAliases.light;
|
|
820
818
|
export const eventPointerupShadow = pointerupAliases.shadow;
|
|
821
819
|
export const eventPointerupAll = pointerupAliases.all;
|
|
822
|
-
export const eventPointerupThis = pointerupAliases.this;
|
|
823
820
|
export const eventPointerupAppHost = pointerupAliases.appHost;
|
|
824
821
|
export const eventPointerupWindow = pointerupAliases.window;
|
|
825
822
|
export const eventPointerupDocument = pointerupAliases.document;
|
|
@@ -836,7 +833,6 @@ export const eventPointermoveMutation = pointermoveAliases.mutation;
|
|
|
836
833
|
export const eventPointermoveLight = pointermoveAliases.light;
|
|
837
834
|
export const eventPointermoveShadow = pointermoveAliases.shadow;
|
|
838
835
|
export const eventPointermoveAll = pointermoveAliases.all;
|
|
839
|
-
export const eventPointermoveThis = pointermoveAliases.this;
|
|
840
836
|
export const eventPointermoveAppHost = pointermoveAliases.appHost;
|
|
841
837
|
export const eventPointermoveWindow = pointermoveAliases.window;
|
|
842
838
|
export const eventPointermoveDocument = pointermoveAliases.document;
|
|
@@ -853,7 +849,6 @@ export const eventPointeroverMutation = pointeroverAliases.mutation;
|
|
|
853
849
|
export const eventPointeroverLight = pointeroverAliases.light;
|
|
854
850
|
export const eventPointeroverShadow = pointeroverAliases.shadow;
|
|
855
851
|
export const eventPointeroverAll = pointeroverAliases.all;
|
|
856
|
-
export const eventPointeroverThis = pointeroverAliases.this;
|
|
857
852
|
export const eventPointeroverAppHost = pointeroverAliases.appHost;
|
|
858
853
|
export const eventPointeroverWindow = pointeroverAliases.window;
|
|
859
854
|
export const eventPointeroverDocument = pointeroverAliases.document;
|
|
@@ -870,7 +865,6 @@ export const eventPointeroutMutation = pointeroutAliases.mutation;
|
|
|
870
865
|
export const eventPointeroutLight = pointeroutAliases.light;
|
|
871
866
|
export const eventPointeroutShadow = pointeroutAliases.shadow;
|
|
872
867
|
export const eventPointeroutAll = pointeroutAliases.all;
|
|
873
|
-
export const eventPointeroutThis = pointeroutAliases.this;
|
|
874
868
|
export const eventPointeroutAppHost = pointeroutAliases.appHost;
|
|
875
869
|
export const eventPointeroutWindow = pointeroutAliases.window;
|
|
876
870
|
export const eventPointeroutDocument = pointeroutAliases.document;
|
|
@@ -887,7 +881,6 @@ export const eventPointerenterMutation = pointerenterAliases.mutation;
|
|
|
887
881
|
export const eventPointerenterLight = pointerenterAliases.light;
|
|
888
882
|
export const eventPointerenterShadow = pointerenterAliases.shadow;
|
|
889
883
|
export const eventPointerenterAll = pointerenterAliases.all;
|
|
890
|
-
export const eventPointerenterThis = pointerenterAliases.this;
|
|
891
884
|
export const eventPointerenterAppHost = pointerenterAliases.appHost;
|
|
892
885
|
export const eventPointerenterWindow = pointerenterAliases.window;
|
|
893
886
|
export const eventPointerenterDocument = pointerenterAliases.document;
|
|
@@ -904,7 +897,6 @@ export const eventPointerleaveMutation = pointerleaveAliases.mutation;
|
|
|
904
897
|
export const eventPointerleaveLight = pointerleaveAliases.light;
|
|
905
898
|
export const eventPointerleaveShadow = pointerleaveAliases.shadow;
|
|
906
899
|
export const eventPointerleaveAll = pointerleaveAliases.all;
|
|
907
|
-
export const eventPointerleaveThis = pointerleaveAliases.this;
|
|
908
900
|
export const eventPointerleaveAppHost = pointerleaveAliases.appHost;
|
|
909
901
|
export const eventPointerleaveWindow = pointerleaveAliases.window;
|
|
910
902
|
export const eventPointerleaveDocument = pointerleaveAliases.document;
|
|
@@ -921,7 +913,6 @@ export const eventPointercancelMutation = pointercancelAliases.mutation;
|
|
|
921
913
|
export const eventPointercancelLight = pointercancelAliases.light;
|
|
922
914
|
export const eventPointercancelShadow = pointercancelAliases.shadow;
|
|
923
915
|
export const eventPointercancelAll = pointercancelAliases.all;
|
|
924
|
-
export const eventPointercancelThis = pointercancelAliases.this;
|
|
925
916
|
export const eventPointercancelAppHost = pointercancelAliases.appHost;
|
|
926
917
|
export const eventPointercancelWindow = pointercancelAliases.window;
|
|
927
918
|
export const eventPointercancelDocument = pointercancelAliases.document;
|
|
@@ -938,7 +929,6 @@ export const eventCopyMutation = copyAliases.mutation;
|
|
|
938
929
|
export const eventCopyLight = copyAliases.light;
|
|
939
930
|
export const eventCopyShadow = copyAliases.shadow;
|
|
940
931
|
export const eventCopyAll = copyAliases.all;
|
|
941
|
-
export const eventCopyThis = copyAliases.this;
|
|
942
932
|
export const eventCopyAppHost = copyAliases.appHost;
|
|
943
933
|
export const eventCopyWindow = copyAliases.window;
|
|
944
934
|
export const eventCopyDocument = copyAliases.document;
|
|
@@ -955,7 +945,6 @@ export const eventCutMutation = cutAliases.mutation;
|
|
|
955
945
|
export const eventCutLight = cutAliases.light;
|
|
956
946
|
export const eventCutShadow = cutAliases.shadow;
|
|
957
947
|
export const eventCutAll = cutAliases.all;
|
|
958
|
-
export const eventCutThis = cutAliases.this;
|
|
959
948
|
export const eventCutAppHost = cutAliases.appHost;
|
|
960
949
|
export const eventCutWindow = cutAliases.window;
|
|
961
950
|
export const eventCutDocument = cutAliases.document;
|
|
@@ -972,7 +961,6 @@ export const eventPasteMutation = pasteAliases.mutation;
|
|
|
972
961
|
export const eventPasteLight = pasteAliases.light;
|
|
973
962
|
export const eventPasteShadow = pasteAliases.shadow;
|
|
974
963
|
export const eventPasteAll = pasteAliases.all;
|
|
975
|
-
export const eventPasteThis = pasteAliases.this;
|
|
976
964
|
export const eventPasteAppHost = pasteAliases.appHost;
|
|
977
965
|
export const eventPasteWindow = pasteAliases.window;
|
|
978
966
|
export const eventPasteDocument = pasteAliases.document;
|
|
@@ -989,7 +977,6 @@ export const eventAnimationstartMutation = animationstartAliases.mutation;
|
|
|
989
977
|
export const eventAnimationstartLight = animationstartAliases.light;
|
|
990
978
|
export const eventAnimationstartShadow = animationstartAliases.shadow;
|
|
991
979
|
export const eventAnimationstartAll = animationstartAliases.all;
|
|
992
|
-
export const eventAnimationstartThis = animationstartAliases.this;
|
|
993
980
|
export const eventAnimationstartAppHost = animationstartAliases.appHost;
|
|
994
981
|
export const eventAnimationstartWindow = animationstartAliases.window;
|
|
995
982
|
export const eventAnimationstartDocument = animationstartAliases.document;
|
|
@@ -1006,7 +993,6 @@ export const eventAnimationendMutation = animationendAliases.mutation;
|
|
|
1006
993
|
export const eventAnimationendLight = animationendAliases.light;
|
|
1007
994
|
export const eventAnimationendShadow = animationendAliases.shadow;
|
|
1008
995
|
export const eventAnimationendAll = animationendAliases.all;
|
|
1009
|
-
export const eventAnimationendThis = animationendAliases.this;
|
|
1010
996
|
export const eventAnimationendAppHost = animationendAliases.appHost;
|
|
1011
997
|
export const eventAnimationendWindow = animationendAliases.window;
|
|
1012
998
|
export const eventAnimationendDocument = animationendAliases.document;
|
|
@@ -1023,7 +1009,6 @@ export const eventAnimationiterationMutation = animationiterationAliases.mutatio
|
|
|
1023
1009
|
export const eventAnimationiterationLight = animationiterationAliases.light;
|
|
1024
1010
|
export const eventAnimationiterationShadow = animationiterationAliases.shadow;
|
|
1025
1011
|
export const eventAnimationiterationAll = animationiterationAliases.all;
|
|
1026
|
-
export const eventAnimationiterationThis = animationiterationAliases.this;
|
|
1027
1012
|
export const eventAnimationiterationAppHost = animationiterationAliases.appHost;
|
|
1028
1013
|
export const eventAnimationiterationWindow = animationiterationAliases.window;
|
|
1029
1014
|
export const eventAnimationiterationDocument = animationiterationAliases.document;
|
|
@@ -1040,7 +1025,6 @@ export const eventAnimationcancelMutation = animationcancelAliases.mutation;
|
|
|
1040
1025
|
export const eventAnimationcancelLight = animationcancelAliases.light;
|
|
1041
1026
|
export const eventAnimationcancelShadow = animationcancelAliases.shadow;
|
|
1042
1027
|
export const eventAnimationcancelAll = animationcancelAliases.all;
|
|
1043
|
-
export const eventAnimationcancelThis = animationcancelAliases.this;
|
|
1044
1028
|
export const eventAnimationcancelAppHost = animationcancelAliases.appHost;
|
|
1045
1029
|
export const eventAnimationcancelWindow = animationcancelAliases.window;
|
|
1046
1030
|
export const eventAnimationcancelDocument = animationcancelAliases.document;
|
|
@@ -1057,7 +1041,6 @@ export const eventTransitionstartMutation = transitionstartAliases.mutation;
|
|
|
1057
1041
|
export const eventTransitionstartLight = transitionstartAliases.light;
|
|
1058
1042
|
export const eventTransitionstartShadow = transitionstartAliases.shadow;
|
|
1059
1043
|
export const eventTransitionstartAll = transitionstartAliases.all;
|
|
1060
|
-
export const eventTransitionstartThis = transitionstartAliases.this;
|
|
1061
1044
|
export const eventTransitionstartAppHost = transitionstartAliases.appHost;
|
|
1062
1045
|
export const eventTransitionstartWindow = transitionstartAliases.window;
|
|
1063
1046
|
export const eventTransitionstartDocument = transitionstartAliases.document;
|
|
@@ -1074,7 +1057,6 @@ export const eventTransitionendMutation = transitionendAliases.mutation;
|
|
|
1074
1057
|
export const eventTransitionendLight = transitionendAliases.light;
|
|
1075
1058
|
export const eventTransitionendShadow = transitionendAliases.shadow;
|
|
1076
1059
|
export const eventTransitionendAll = transitionendAliases.all;
|
|
1077
|
-
export const eventTransitionendThis = transitionendAliases.this;
|
|
1078
1060
|
export const eventTransitionendAppHost = transitionendAliases.appHost;
|
|
1079
1061
|
export const eventTransitionendWindow = transitionendAliases.window;
|
|
1080
1062
|
export const eventTransitionendDocument = transitionendAliases.document;
|
|
@@ -1091,7 +1073,6 @@ export const eventTransitioncancelMutation = transitioncancelAliases.mutation;
|
|
|
1091
1073
|
export const eventTransitioncancelLight = transitioncancelAliases.light;
|
|
1092
1074
|
export const eventTransitioncancelShadow = transitioncancelAliases.shadow;
|
|
1093
1075
|
export const eventTransitioncancelAll = transitioncancelAliases.all;
|
|
1094
|
-
export const eventTransitioncancelThis = transitioncancelAliases.this;
|
|
1095
1076
|
export const eventTransitioncancelAppHost = transitioncancelAliases.appHost;
|
|
1096
1077
|
export const eventTransitioncancelWindow = transitioncancelAliases.window;
|
|
1097
1078
|
export const eventTransitioncancelDocument = transitioncancelAliases.document;
|
|
@@ -1108,7 +1089,6 @@ export const eventTransitionrunMutation = transitionrunAliases.mutation;
|
|
|
1108
1089
|
export const eventTransitionrunLight = transitionrunAliases.light;
|
|
1109
1090
|
export const eventTransitionrunShadow = transitionrunAliases.shadow;
|
|
1110
1091
|
export const eventTransitionrunAll = transitionrunAliases.all;
|
|
1111
|
-
export const eventTransitionrunThis = transitionrunAliases.this;
|
|
1112
1092
|
export const eventTransitionrunAppHost = transitionrunAliases.appHost;
|
|
1113
1093
|
export const eventTransitionrunWindow = transitionrunAliases.window;
|
|
1114
1094
|
export const eventTransitionrunDocument = transitionrunAliases.document;
|
|
@@ -1125,7 +1105,6 @@ export const eventScrollMutation = scrollAliases.mutation;
|
|
|
1125
1105
|
export const eventScrollLight = scrollAliases.light;
|
|
1126
1106
|
export const eventScrollShadow = scrollAliases.shadow;
|
|
1127
1107
|
export const eventScrollAll = scrollAliases.all;
|
|
1128
|
-
export const eventScrollThis = scrollAliases.this;
|
|
1129
1108
|
export const eventScrollAppHost = scrollAliases.appHost;
|
|
1130
1109
|
export const eventScrollWindow = scrollAliases.window;
|
|
1131
1110
|
export const eventScrollDocument = scrollAliases.document;
|
|
@@ -1142,7 +1121,6 @@ export const eventResizeMutation = resizeAliases.mutation;
|
|
|
1142
1121
|
export const eventResizeLight = resizeAliases.light;
|
|
1143
1122
|
export const eventResizeShadow = resizeAliases.shadow;
|
|
1144
1123
|
export const eventResizeAll = resizeAliases.all;
|
|
1145
|
-
export const eventResizeThis = resizeAliases.this;
|
|
1146
1124
|
export const eventResizeAppHost = resizeAliases.appHost;
|
|
1147
1125
|
export const eventResizeWindow = resizeAliases.window;
|
|
1148
1126
|
export const eventResizeDocument = resizeAliases.document;
|
|
@@ -1159,7 +1137,6 @@ export const eventLoadMutation = loadAliases.mutation;
|
|
|
1159
1137
|
export const eventLoadLight = loadAliases.light;
|
|
1160
1138
|
export const eventLoadShadow = loadAliases.shadow;
|
|
1161
1139
|
export const eventLoadAll = loadAliases.all;
|
|
1162
|
-
export const eventLoadThis = loadAliases.this;
|
|
1163
1140
|
export const eventLoadAppHost = loadAliases.appHost;
|
|
1164
1141
|
export const eventLoadWindow = loadAliases.window;
|
|
1165
1142
|
export const eventLoadDocument = loadAliases.document;
|
|
@@ -1176,7 +1153,6 @@ export const eventErrorMutation = errorAliases.mutation;
|
|
|
1176
1153
|
export const eventErrorLight = errorAliases.light;
|
|
1177
1154
|
export const eventErrorShadow = errorAliases.shadow;
|
|
1178
1155
|
export const eventErrorAll = errorAliases.all;
|
|
1179
|
-
export const eventErrorThis = errorAliases.this;
|
|
1180
1156
|
export const eventErrorAppHost = errorAliases.appHost;
|
|
1181
1157
|
export const eventErrorWindow = errorAliases.window;
|
|
1182
1158
|
export const eventErrorDocument = errorAliases.document;
|
|
@@ -1193,13 +1169,12 @@ export const eventToggleMutation = toggleAliases.mutation;
|
|
|
1193
1169
|
export const eventToggleLight = toggleAliases.light;
|
|
1194
1170
|
export const eventToggleShadow = toggleAliases.shadow;
|
|
1195
1171
|
export const eventToggleAll = toggleAliases.all;
|
|
1196
|
-
export const eventToggleThis = toggleAliases.this;
|
|
1197
1172
|
export const eventToggleAppHost = toggleAliases.appHost;
|
|
1198
1173
|
export const eventToggleWindow = toggleAliases.window;
|
|
1199
1174
|
export const eventToggleDocument = toggleAliases.document;
|
|
1200
1175
|
export const getAddEventListenerMetadata = (target: any): AddEventListenerMetadata<Event>[] | undefined => {
|
|
1201
|
-
const constructor = target
|
|
1202
|
-
return ReflectUtils.
|
|
1176
|
+
const constructor = typeof target === 'function' ? target : target.constructor;
|
|
1177
|
+
return ReflectUtils.findAllMetadata<any[]>(ADD_EVENT_LISTENER_METADATA_KEY, constructor).flat();
|
|
1203
1178
|
};
|
|
1204
1179
|
|
|
1205
1180
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -1254,9 +1229,9 @@ export class EventListenerLifeCycler implements ElementDefineLifeCycler {
|
|
|
1254
1229
|
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
1255
1230
|
|
|
1256
1231
|
const handler = async (event: Event) => {
|
|
1232
|
+
const helper = (options.filter || options.before || options.finally) ? SwcUtils.getHelperAndHostSet(target as HTMLElement, currentWin) : undefined;
|
|
1257
1233
|
if (options.filter) {
|
|
1258
|
-
|
|
1259
|
-
if (!options.filter(event, { currentThis: inst, helper })) return;
|
|
1234
|
+
if (!(await options.filter(event, { currentThis: inst, helper }))) return;
|
|
1260
1235
|
}
|
|
1261
1236
|
if (options.stopPropagation) event.stopPropagation();
|
|
1262
1237
|
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
@@ -1265,14 +1240,30 @@ export class EventListenerLifeCycler implements ElementDefineLifeCycler {
|
|
|
1265
1240
|
const legacyArgs = [event, { currentHostSet, $matchedElement: event.currentTarget }, { event, ...currentHostSet, $el: target, $root: target }];
|
|
1266
1241
|
const currentHelperSet = SwcUtils.getHelperSet(currentWin);
|
|
1267
1242
|
const currentHelperHostSet = { ...currentHelperSet, ...currentHostSet, $this: inst };
|
|
1268
|
-
const
|
|
1269
|
-
event,
|
|
1270
|
-
|
|
1243
|
+
const buildArgs = (beforeReturn: any) => buildSwcParameterArgs(inst, meta.propertyKey, {
|
|
1244
|
+
eventObject: event,
|
|
1245
|
+
matchedElement: event.currentTarget,
|
|
1271
1246
|
hostSet: currentHostSet,
|
|
1272
1247
|
helperHostSet: currentHelperHostSet,
|
|
1273
|
-
helperSet: currentHelperSet
|
|
1248
|
+
helperSet: currentHelperSet,
|
|
1249
|
+
eventBeforeReturn: beforeReturn
|
|
1274
1250
|
}, legacyArgs);
|
|
1275
|
-
|
|
1251
|
+
// before를 먼저 돌려 그 리턴값을 @eventBeforeReturn 으로 주입. before엔 (아직 자기 리턴 전이라
|
|
1252
|
+
// eventBeforeReturn=undefined인) args를 넘기고, 리턴을 받은 뒤 args를 다시 빌드해 핸들러에 넘긴다.
|
|
1253
|
+
let args = buildArgs(undefined);
|
|
1254
|
+
if (options.before) {
|
|
1255
|
+
const beforeReturn = await options.before(event, { currentThis: inst, helper }, args);
|
|
1256
|
+
args = buildArgs(beforeReturn);
|
|
1257
|
+
}
|
|
1258
|
+
let result: any, error: any;
|
|
1259
|
+
try {
|
|
1260
|
+
result = await inst[meta.propertyKey](...args);
|
|
1261
|
+
} catch (e) {
|
|
1262
|
+
error = e;
|
|
1263
|
+
} finally {
|
|
1264
|
+
if (options.finally) await options.finally(event, { currentThis: inst, helper }, { args, result, error });
|
|
1265
|
+
}
|
|
1266
|
+
if (error) throw error;
|
|
1276
1267
|
};
|
|
1277
1268
|
|
|
1278
1269
|
const eventSubject = new Subject<Event>();
|
|
@@ -1389,9 +1380,9 @@ export class EventListenerLifeCycler implements ElementDefineLifeCycler {
|
|
|
1389
1380
|
const matches = sorted.map(m => ({ m, matchedEl: (event.target as HTMLElement)?.closest(m.selector as string) }));
|
|
1390
1381
|
for (const { m, matchedEl } of matches) {
|
|
1391
1382
|
if (matchedEl && (br as any).contains(matchedEl)) {
|
|
1383
|
+
const helper = (m.options.filter || m.options.before || m.options.finally) ? SwcUtils.getHelperAndHostSet(matchedEl as HTMLElement, currentWin) : undefined;
|
|
1392
1384
|
if (m.options.filter) {
|
|
1393
|
-
|
|
1394
|
-
if (!m.options.filter(event, { currentThis: inst, helper })) continue;
|
|
1385
|
+
if (!(await m.options.filter(event, { currentThis: inst, helper }))) continue;
|
|
1395
1386
|
}
|
|
1396
1387
|
if (m.options.stopPropagation) event.stopPropagation();
|
|
1397
1388
|
if (m.options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
@@ -1400,14 +1391,29 @@ export class EventListenerLifeCycler implements ElementDefineLifeCycler {
|
|
|
1400
1391
|
const legacyArgs = [event, { ...hs, $matchedElement: matchedEl }, { event, ...hs, $el: matchedEl, $root: br }];
|
|
1401
1392
|
const helperSetForMatch = SwcUtils.getHelperSet(currentWin);
|
|
1402
1393
|
const helperHostSetForMatch = { ...helperSetForMatch, ...hs, $this: inst };
|
|
1403
|
-
const
|
|
1404
|
-
event,
|
|
1405
|
-
|
|
1394
|
+
const buildArgs = (beforeReturn: any) => buildSwcParameterArgs(inst, m.propertyKey, {
|
|
1395
|
+
eventObject: event,
|
|
1396
|
+
matchedElement: matchedEl,
|
|
1406
1397
|
hostSet: hs,
|
|
1407
1398
|
helperHostSet: helperHostSetForMatch,
|
|
1408
|
-
helperSet: helperSetForMatch
|
|
1399
|
+
helperSet: helperSetForMatch,
|
|
1400
|
+
eventBeforeReturn: beforeReturn
|
|
1409
1401
|
}, legacyArgs);
|
|
1410
|
-
|
|
1402
|
+
// before를 먼저 돌려 그 리턴값을 @eventBeforeReturn 으로 주입.
|
|
1403
|
+
let args = buildArgs(undefined);
|
|
1404
|
+
if (m.options.before) {
|
|
1405
|
+
const beforeReturn = await m.options.before(event, { currentThis: inst, helper }, args);
|
|
1406
|
+
args = buildArgs(beforeReturn);
|
|
1407
|
+
}
|
|
1408
|
+
let result: any, error: any;
|
|
1409
|
+
try {
|
|
1410
|
+
result = await inst[m.propertyKey](...args);
|
|
1411
|
+
} catch (e) {
|
|
1412
|
+
error = e;
|
|
1413
|
+
} finally {
|
|
1414
|
+
if (m.options.finally) await m.options.finally(event, { currentThis: inst, helper }, { args, result, error });
|
|
1415
|
+
}
|
|
1416
|
+
if (error) throw error;
|
|
1411
1417
|
if ((event as any).cancelBubble) break;
|
|
1412
1418
|
}
|
|
1413
1419
|
}
|