@dooboostore/simple-web-component 1.0.48 → 1.0.49
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 +117 -19
- package/dist/cjs/config/config.js +1 -1
- package/dist/cjs/config/config.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +387 -29
- package/dist/cjs/decorators/addEventListener.js.map +3 -3
- package/dist/cjs/decorators/applyAttribute.js +25 -0
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +49 -18
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +67 -1
- package/dist/cjs/decorators/applyNode.js.map +3 -3
- package/dist/cjs/decorators/applyProperty.js +101 -3
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +36 -5
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/changedAttribute.js +39 -0
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +237 -437
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +55 -0
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +3 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/intersectionObserver.js +209 -0
- package/dist/cjs/decorators/intersectionObserver.js.map +7 -0
- package/dist/cjs/decorators/mutationObserver.js +140 -0
- package/dist/cjs/decorators/mutationObserver.js.map +3 -3
- package/dist/cjs/decorators/query.js +117 -102
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/resizeObserver.js +87 -0
- package/dist/cjs/decorators/resizeObserver.js.map +2 -2
- package/dist/cjs/decorators/setInterval.js +82 -0
- package/dist/cjs/decorators/setInterval.js.map +7 -0
- package/dist/cjs/decorators/setTimeout.js +82 -0
- package/dist/cjs/decorators/setTimeout.js.map +7 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +9 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -0
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/config/config.js +1 -1
- package/dist/esm/config/config.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +388 -29
- package/dist/esm/decorators/addEventListener.js.map +3 -3
- package/dist/esm/decorators/applyAttribute.js +25 -0
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +49 -18
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +67 -1
- package/dist/esm/decorators/applyNode.js.map +3 -3
- package/dist/esm/decorators/applyProperty.js +101 -3
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +36 -5
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/changedAttribute.js +40 -0
- package/dist/esm/decorators/changedAttribute.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +244 -444
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/emitCustomEvent.js +55 -0
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +3 -1
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/intersectionObserver.js +191 -0
- package/dist/esm/decorators/intersectionObserver.js.map +7 -0
- package/dist/esm/decorators/mutationObserver.js +141 -0
- package/dist/esm/decorators/mutationObserver.js.map +3 -3
- package/dist/esm/decorators/query.js +117 -102
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/resizeObserver.js +88 -0
- package/dist/esm/decorators/resizeObserver.js.map +2 -2
- package/dist/esm/decorators/setInterval.js +64 -0
- package/dist/esm/decorators/setInterval.js.map +7 -0
- package/dist/esm/decorators/setTimeout.js +64 -0
- package/dist/esm/decorators/setTimeout.js.map +7 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +9 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -0
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2565 -1474
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/config/config.d.ts.map +1 -1
- package/dist/types/decorators/addEventListener.d.ts +84 -33
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +22 -34
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +34 -34
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +30 -20
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +57 -34
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +25 -12
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/changedAttribute.d.ts +11 -0
- package/dist/types/decorators/changedAttribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts +0 -14
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +28 -4
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +3 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/intersectionObserver.d.ts +49 -0
- package/dist/types/decorators/intersectionObserver.d.ts.map +1 -0
- package/dist/types/decorators/mutationObserver.d.ts +35 -25
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +57 -14
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/resizeObserver.d.ts +34 -23
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -1
- package/dist/types/decorators/setInterval.d.ts +29 -0
- package/dist/types/decorators/setInterval.d.ts.map +1 -0
- package/dist/types/decorators/setTimeout.d.ts +29 -0
- package/dist/types/decorators/setTimeout.d.ts.map +1 -0
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +7 -1
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +6 -0
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +104 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +2565 -1474
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +7 -5
- package/src/config/config.ts +1 -1
- package/src/decorators/addEventListener.ts +394 -34
- package/src/decorators/applyAttribute.ts +50 -36
- package/src/decorators/applyClass.ts +76 -26
- package/src/decorators/applyNode.ts +114 -36
- package/src/decorators/applyProperty.ts +152 -40
- package/src/decorators/applyStyle.ts +64 -17
- package/src/decorators/changedAttribute.ts +46 -0
- package/src/decorators/elementDefine.ts +281 -580
- package/src/decorators/emitCustomEvent.ts +73 -5
- package/src/decorators/index.ts +3 -1
- package/src/decorators/intersectionObserver.ts +259 -0
- package/src/decorators/mutationObserver.ts +215 -39
- package/src/decorators/query.ts +168 -126
- package/src/decorators/resizeObserver.ts +152 -46
- package/src/decorators/setInterval.ts +80 -0
- package/src/decorators/setTimeout.ts +80 -0
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +17 -0
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +19 -0
- package/src/types/index.ts +141 -0
- package/dist/cjs/decorators/queryAll.js +0 -181
- package/dist/cjs/decorators/queryAll.js.map +0 -7
- package/dist/esm/decorators/queryAll.js +0 -162
- package/dist/esm/decorators/queryAll.js.map +0 -7
- package/dist/types/decorators/queryAll.d.ts +0 -22
- package/dist/types/decorators/queryAll.d.ts.map +0 -1
- package/src/decorators/queryAll.ts +0 -186
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,50 +16,64 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
16
|
return to;
|
|
16
17
|
};
|
|
17
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18
20
|
var addEventListener_exports = {};
|
|
19
21
|
__export(addEventListener_exports, {
|
|
20
22
|
ADD_EVENT_LISTENER_METADATA_KEY: () => ADD_EVENT_LISTENER_METADATA_KEY,
|
|
23
|
+
EventListenerLifeCycler: () => EventListenerLifeCycler,
|
|
21
24
|
addEventListener: () => addEventListener,
|
|
22
|
-
|
|
25
|
+
addEventListenerAll: () => addEventListenerAll,
|
|
23
26
|
addEventListenerAppHost: () => addEventListenerAppHost,
|
|
24
27
|
addEventListenerDelegate: () => addEventListenerDelegate,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
addEventListenerDelegateAll: () => addEventListenerDelegateAll,
|
|
29
|
+
addEventListenerDelegateLight: () => addEventListenerDelegateLight,
|
|
30
|
+
addEventListenerDelegateShadow: () => addEventListenerDelegateShadow,
|
|
28
31
|
addEventListenerDocument: () => addEventListenerDocument,
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
addEventListenerLight: () => addEventListenerLight,
|
|
33
|
+
addEventListenerMutation: () => addEventListenerMutation,
|
|
34
|
+
addEventListenerMutationAll: () => addEventListenerMutationAll,
|
|
35
|
+
addEventListenerMutationLight: () => addEventListenerMutationLight,
|
|
36
|
+
addEventListenerMutationShadow: () => addEventListenerMutationShadow,
|
|
37
|
+
addEventListenerShadow: () => addEventListenerShadow,
|
|
31
38
|
addEventListenerThis: () => addEventListenerThis,
|
|
32
39
|
addEventListenerWindow: () => addEventListenerWindow,
|
|
33
40
|
event: () => event,
|
|
34
|
-
|
|
41
|
+
eventAll: () => eventAll,
|
|
35
42
|
eventAppHost: () => eventAppHost,
|
|
36
43
|
eventDelegate: () => eventDelegate,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
eventDelegateAll: () => eventDelegateAll,
|
|
45
|
+
eventDelegateLight: () => eventDelegateLight,
|
|
46
|
+
eventDelegateShadow: () => eventDelegateShadow,
|
|
40
47
|
eventDocument: () => eventDocument,
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
eventLight: () => eventLight,
|
|
49
|
+
eventMutation: () => eventMutation,
|
|
50
|
+
eventMutationAll: () => eventMutationAll,
|
|
51
|
+
eventMutationLight: () => eventMutationLight,
|
|
52
|
+
eventMutationShadow: () => eventMutationShadow,
|
|
53
|
+
eventShadow: () => eventShadow,
|
|
43
54
|
eventThis: () => eventThis,
|
|
44
55
|
eventWindow: () => eventWindow,
|
|
45
56
|
getAddEventListenerMetadata: () => getAddEventListenerMetadata
|
|
46
57
|
});
|
|
47
58
|
module.exports = __toCommonJS(addEventListener_exports);
|
|
48
59
|
var import_core = require("@dooboostore/core");
|
|
60
|
+
var import_core2 = require("@dooboostore/core");
|
|
61
|
+
var import_operators = require("@dooboostore/core/message/operators");
|
|
62
|
+
var import_Utils = require("../utils/Utils");
|
|
49
63
|
const ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
50
64
|
function addEventListener(selectorOrType, typeOrOptions, maybeOptions) {
|
|
51
65
|
return (targetObj, propertyKey, descriptor) => {
|
|
52
66
|
let selector;
|
|
53
|
-
let
|
|
67
|
+
let types;
|
|
54
68
|
let opts = {};
|
|
55
|
-
if (typeof typeOrOptions === "string") {
|
|
69
|
+
if (typeof typeOrOptions === "string" || Array.isArray(typeOrOptions)) {
|
|
56
70
|
selector = selectorOrType;
|
|
57
|
-
|
|
71
|
+
types = Array.isArray(typeOrOptions) ? typeOrOptions : [typeOrOptions];
|
|
58
72
|
opts = maybeOptions ?? {};
|
|
59
73
|
} else {
|
|
60
74
|
selector = "$this";
|
|
61
|
-
|
|
75
|
+
if (Array.isArray(selectorOrType)) types = selectorOrType;
|
|
76
|
+
else types = [selectorOrType];
|
|
62
77
|
opts = typeOrOptions ?? {};
|
|
63
78
|
}
|
|
64
79
|
const constructor = targetObj.constructor;
|
|
@@ -67,28 +82,40 @@ function addEventListener(selectorOrType, typeOrOptions, maybeOptions) {
|
|
|
67
82
|
listeners = [];
|
|
68
83
|
import_core.ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
69
84
|
}
|
|
70
|
-
listeners.push({ propertyKey, selector, type, options: opts });
|
|
85
|
+
for (const type of types) listeners.push({ propertyKey, selector, type, options: opts });
|
|
71
86
|
};
|
|
72
87
|
}
|
|
73
|
-
function
|
|
88
|
+
function addEventListenerDelegateLight(selector, type, options) {
|
|
74
89
|
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: true });
|
|
75
90
|
}
|
|
76
|
-
function
|
|
91
|
+
function addEventListenerDelegateShadow(selector, type, options) {
|
|
77
92
|
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: true });
|
|
78
93
|
}
|
|
79
|
-
function
|
|
94
|
+
function addEventListenerDelegateAll(selector, type, options) {
|
|
80
95
|
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: true });
|
|
81
96
|
}
|
|
82
97
|
function addEventListenerDelegate(selector, type, options) {
|
|
83
98
|
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
84
99
|
}
|
|
85
|
-
function
|
|
100
|
+
function addEventListenerMutationLight(selector, type, options) {
|
|
101
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: "mutation" });
|
|
102
|
+
}
|
|
103
|
+
function addEventListenerMutationShadow(selector, type, options) {
|
|
104
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: "mutation" });
|
|
105
|
+
}
|
|
106
|
+
function addEventListenerMutationAll(selector, type, options) {
|
|
107
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: "mutation" });
|
|
108
|
+
}
|
|
109
|
+
function addEventListenerMutation(selector, type, options) {
|
|
110
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: "mutation" });
|
|
111
|
+
}
|
|
112
|
+
function addEventListenerLight(selector, type, options) {
|
|
86
113
|
return addEventListener(selector, type, { ...options ?? {}, root: "light" });
|
|
87
114
|
}
|
|
88
|
-
function
|
|
115
|
+
function addEventListenerShadow(selector, type, options) {
|
|
89
116
|
return addEventListener(selector, type, { ...options ?? {}, root: "shadow" });
|
|
90
117
|
}
|
|
91
|
-
function
|
|
118
|
+
function addEventListenerAll(selector, type, options) {
|
|
92
119
|
return addEventListener(selector, type, { ...options ?? {}, root: "all" });
|
|
93
120
|
}
|
|
94
121
|
function addEventListenerThis(type, options) {
|
|
@@ -104,13 +131,17 @@ function addEventListenerDocument(type, options) {
|
|
|
104
131
|
return addEventListener("$document", type, options);
|
|
105
132
|
}
|
|
106
133
|
const event = addEventListener;
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
134
|
+
const eventDelegateLight = addEventListenerDelegateLight;
|
|
135
|
+
const eventDelegateShadow = addEventListenerDelegateShadow;
|
|
136
|
+
const eventDelegateAll = addEventListenerDelegateAll;
|
|
110
137
|
const eventDelegate = addEventListenerDelegate;
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
const
|
|
138
|
+
const eventMutationLight = addEventListenerMutationLight;
|
|
139
|
+
const eventMutationShadow = addEventListenerMutationShadow;
|
|
140
|
+
const eventMutationAll = addEventListenerMutationAll;
|
|
141
|
+
const eventMutation = addEventListenerMutation;
|
|
142
|
+
const eventLight = addEventListenerLight;
|
|
143
|
+
const eventShadow = addEventListenerShadow;
|
|
144
|
+
const eventAll = addEventListenerAll;
|
|
114
145
|
const eventAppHost = addEventListenerAppHost;
|
|
115
146
|
const eventWindow = addEventListenerWindow;
|
|
116
147
|
const eventDocument = addEventListenerDocument;
|
|
@@ -119,4 +150,331 @@ const getAddEventListenerMetadata = (target) => {
|
|
|
119
150
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
120
151
|
return import_core.ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
121
152
|
};
|
|
153
|
+
class EventListenerLifeCycler {
|
|
154
|
+
constructor() {
|
|
155
|
+
/** 인스턴스별 boundListeners 상태 (시클러는 elementDefine 시 1회 생성되어 공유되므로) */
|
|
156
|
+
__publicField(this, "boundListenersMap", /* @__PURE__ */ new WeakMap());
|
|
157
|
+
/** 인스턴스별 delegate:'mutation' 바인딩 추적 WeakSet — MutationObserverLifeCycler 에서 참조 */
|
|
158
|
+
__publicField(this, "eventBoundSetsMap", /* @__PURE__ */ new WeakMap());
|
|
159
|
+
}
|
|
160
|
+
// ── 외부(MutationObserverLifeCycler)에서 직접 사용하는 공개 헬퍼 ──
|
|
161
|
+
/** 인스턴스별 boundListeners 를 반환한다 (없으면 생성). */
|
|
162
|
+
getBoundListeners(inst) {
|
|
163
|
+
let list = this.boundListenersMap.get(inst);
|
|
164
|
+
if (!list) {
|
|
165
|
+
list = [];
|
|
166
|
+
this.boundListenersMap.set(inst, list);
|
|
167
|
+
}
|
|
168
|
+
return list;
|
|
169
|
+
}
|
|
170
|
+
/** 인스턴스별 eventBoundSets 를 반환한다 (없으면 생성). */
|
|
171
|
+
getEventBoundSets(inst) {
|
|
172
|
+
let map = this.eventBoundSetsMap.get(inst);
|
|
173
|
+
if (!map) {
|
|
174
|
+
map = /* @__PURE__ */ new Map();
|
|
175
|
+
this.eventBoundSetsMap.set(inst, map);
|
|
176
|
+
}
|
|
177
|
+
return map;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* target 에 meta 이벤트를 직접 바인딩한다.
|
|
181
|
+
* delegate:'mutation' 초기/동적 바인딩에서 호출된다.
|
|
182
|
+
*/
|
|
183
|
+
bindDirect(helperHostSet, target, meta) {
|
|
184
|
+
const inst = helperHostSet.$this;
|
|
185
|
+
const currentWin = helperHostSet.$w;
|
|
186
|
+
const { type, options } = meta;
|
|
187
|
+
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
188
|
+
const handler = async (event2) => {
|
|
189
|
+
if (options.filter) {
|
|
190
|
+
const helper = import_Utils.SwcUtils.getHelperAndHostSet(currentWin, target);
|
|
191
|
+
if (!options.filter(event2, { currentThis: inst, helper })) return;
|
|
192
|
+
}
|
|
193
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
194
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
195
|
+
if (options.preventDefault) event2.preventDefault();
|
|
196
|
+
const currentHostSet = import_Utils.SwcUtils.getHostSet(inst);
|
|
197
|
+
await inst[meta.propertyKey](event2, { currentHostSet, $matchedElement: event2.currentTarget }, { event: event2, ...currentHostSet, $el: target, $root: target });
|
|
198
|
+
};
|
|
199
|
+
const eventSubject = new import_core2.Subject();
|
|
200
|
+
let eventStream = eventSubject;
|
|
201
|
+
if (options.debounceTime && options.debounceTime > 0)
|
|
202
|
+
eventStream = eventStream.pipe((0, import_operators.debounceTime)(options.debounceTime));
|
|
203
|
+
if (options.throttleTime && options.throttleTime > 0)
|
|
204
|
+
eventStream = eventStream.pipe((0, import_operators.throttleTime)(options.throttleTime));
|
|
205
|
+
if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
|
|
206
|
+
eventStream = typeof options.distinctUntilChanged === "function" ? eventStream.pipe((0, import_operators.distinctUntilChanged)(options.distinctUntilChanged)) : eventStream.pipe((0, import_operators.distinctUntilChanged)());
|
|
207
|
+
}
|
|
208
|
+
const subscription = eventStream.subscribe({
|
|
209
|
+
next: (e) => handler(e).catch((err) => console.error("Event handler error:", err)),
|
|
210
|
+
error: (err) => console.error("Event stream error:", err)
|
|
211
|
+
});
|
|
212
|
+
const wrappedHandler = (event2) => eventSubject.next(event2);
|
|
213
|
+
target.addEventListener(type, wrappedHandler, opts);
|
|
214
|
+
const onRemoves = options.removeListener ? [{ fn: options.removeListener, opts: options }] : [];
|
|
215
|
+
this.getBoundListeners(inst).push({ target, type, handler: wrappedHandler, options: opts, subscription, onRemoves, meta });
|
|
216
|
+
}
|
|
217
|
+
/** target + meta 조합 리스너를 제거한다. MutationObserver 추적 요소 제거 시 호출. */
|
|
218
|
+
unbindDirect(helperHostSet, target, meta) {
|
|
219
|
+
const inst = helperHostSet.$this;
|
|
220
|
+
const list = this.getBoundListeners(inst);
|
|
221
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
222
|
+
const l = list[i];
|
|
223
|
+
if (l.target === target && l.type === meta.type && l.meta === meta) {
|
|
224
|
+
try {
|
|
225
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
226
|
+
l.subscription?.unsubscribe?.();
|
|
227
|
+
} catch (e) {
|
|
228
|
+
console.error("[SWC] unbindDirect error:", e);
|
|
229
|
+
}
|
|
230
|
+
for (const r of l.onRemoves ?? []) {
|
|
231
|
+
try {
|
|
232
|
+
r.fn(l.target, r.opts);
|
|
233
|
+
} catch (e) {
|
|
234
|
+
console.error("[SWC] unbindDirect removeListener error:", e);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
list.splice(i, 1);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* 메타데이터 목록을 delegate / mutationDelegate / nonDelegate 로 분류한다.
|
|
243
|
+
* MutationObserverLifeCycler 에서 mutationDelegate 목록을 꺼낼 때 사용한다.
|
|
244
|
+
*/
|
|
245
|
+
classifyListeners(metaList) {
|
|
246
|
+
const isSpecial = (sel) => [
|
|
247
|
+
"$window",
|
|
248
|
+
"$document",
|
|
249
|
+
"$host",
|
|
250
|
+
"$appHost",
|
|
251
|
+
"$firstHost",
|
|
252
|
+
"$lastHost",
|
|
253
|
+
"$firstAppHost",
|
|
254
|
+
"$lastAppHost",
|
|
255
|
+
"$hosts",
|
|
256
|
+
"$appHosts",
|
|
257
|
+
"$this",
|
|
258
|
+
""
|
|
259
|
+
].includes(sel);
|
|
260
|
+
const delegateListeners = [];
|
|
261
|
+
const mutationDelegateListeners = [];
|
|
262
|
+
const nonDelegateListeners = [];
|
|
263
|
+
for (const meta of metaList) {
|
|
264
|
+
const isStr = typeof meta.selector === "string";
|
|
265
|
+
const mode = meta.options.delegate;
|
|
266
|
+
if (mode && isStr && !isSpecial(meta.selector)) {
|
|
267
|
+
mode === "mutation" ? mutationDelegateListeners.push(meta) : delegateListeners.push(meta);
|
|
268
|
+
} else {
|
|
269
|
+
nonDelegateListeners.push(meta);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return { delegateListeners, mutationDelegateListeners, nonDelegateListeners };
|
|
273
|
+
}
|
|
274
|
+
// ── ElementDefineLifeCycler 구현 ──
|
|
275
|
+
onConnected(helperHostSet) {
|
|
276
|
+
const inst = helperHostSet.$this;
|
|
277
|
+
const currentWin = helperHostSet.$w;
|
|
278
|
+
this.boundListenersMap.delete(inst);
|
|
279
|
+
this.eventBoundSetsMap.delete(inst);
|
|
280
|
+
const allMeta = getAddEventListenerMetadata(inst) ?? [];
|
|
281
|
+
const { delegateListeners, nonDelegateListeners, mutationDelegateListeners } = this.classifyListeners(allMeta);
|
|
282
|
+
const groups = /* @__PURE__ */ new Map();
|
|
283
|
+
for (const meta of delegateListeners) {
|
|
284
|
+
const key = `${meta.type}:${meta.options.root || "auto"}`;
|
|
285
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
286
|
+
groups.get(key).push(meta);
|
|
287
|
+
}
|
|
288
|
+
groups.forEach((metaList, key) => {
|
|
289
|
+
const ci = key.indexOf(":");
|
|
290
|
+
const type = key.slice(0, ci);
|
|
291
|
+
const r = key.slice(ci + 1);
|
|
292
|
+
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
293
|
+
const roots = [];
|
|
294
|
+
if (r === "auto") roots.push(inst.shadowRoot || inst);
|
|
295
|
+
else if (r === "light") roots.push(inst);
|
|
296
|
+
else if (r === "shadow" && inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
297
|
+
else if (r === "all") {
|
|
298
|
+
roots.push(inst);
|
|
299
|
+
if (inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
300
|
+
}
|
|
301
|
+
for (const br of roots) {
|
|
302
|
+
const sorted = [...metaList].sort((a, b) => (b.options.stopPropagation ? 1 : 0) - (a.options.stopPropagation ? 1 : 0));
|
|
303
|
+
const handler = async (event2) => {
|
|
304
|
+
for (const m of sorted) {
|
|
305
|
+
const matchedEl = event2.target?.closest(m.selector);
|
|
306
|
+
console.log("[DBG][delegate] type=", event2.type, "| evtTarget=", event2.target?.tagName, "| sel=", m.selector, "| matchedEl=", matchedEl?.className || matchedEl?.tagName, "| brContains=", br.contains?.(matchedEl), "| brTag=", br.tagName || br.constructor?.name);
|
|
307
|
+
if (matchedEl && br.contains(matchedEl)) {
|
|
308
|
+
if (m.options.filter) {
|
|
309
|
+
const helper = import_Utils.SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
310
|
+
if (!m.options.filter(event2, { currentThis: inst, helper })) continue;
|
|
311
|
+
}
|
|
312
|
+
if (m.options.stopPropagation) event2.stopPropagation();
|
|
313
|
+
if (m.options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
314
|
+
if (m.options.preventDefault) event2.preventDefault();
|
|
315
|
+
const hs = import_Utils.SwcUtils.getHostSet(inst);
|
|
316
|
+
await inst[m.propertyKey](event2, { ...hs, $matchedElement: matchedEl }, { event: event2, ...hs, $el: matchedEl, $root: br });
|
|
317
|
+
if (event2.cancelBubble) break;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
br.addEventListener(type, handler, opts);
|
|
322
|
+
if (type === "click") {
|
|
323
|
+
console.log("[DBG][eventCycler] bound click on br=", br.tagName || br.constructor?.name, "| inst=", inst.tagName || inst.constructor?.name, "| isSame=", br === inst);
|
|
324
|
+
}
|
|
325
|
+
const onRemoves = sorted.filter((m) => m.options.removeListener).map((m) => ({ fn: m.options.removeListener, opts: m.options }));
|
|
326
|
+
this.getBoundListeners(inst).push({ target: br, type, handler, options: opts, onRemoves });
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
for (const meta of nonDelegateListeners) {
|
|
330
|
+
const { selector, options } = meta;
|
|
331
|
+
const r = options.root || "auto";
|
|
332
|
+
const bindTargets = [];
|
|
333
|
+
let resolvedSel = null;
|
|
334
|
+
if (typeof selector === "function") {
|
|
335
|
+
const result = selector(inst, helperHostSet);
|
|
336
|
+
if (typeof result === "string") resolvedSel = result;
|
|
337
|
+
else if (result instanceof currentWin.Element) bindTargets.push(result);
|
|
338
|
+
else if (result instanceof currentWin.NodeList) bindTargets.push(...Array.from(result));
|
|
339
|
+
else if (Array.isArray(result)) bindTargets.push(...result);
|
|
340
|
+
} else {
|
|
341
|
+
resolvedSel = selector;
|
|
342
|
+
}
|
|
343
|
+
const applyRoot = (t) => {
|
|
344
|
+
if (!t) return;
|
|
345
|
+
if (r === "auto") bindTargets.push(t.shadowRoot || t);
|
|
346
|
+
else {
|
|
347
|
+
if (r === "light" || r === "all") bindTargets.push(t);
|
|
348
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) bindTargets.push(t.shadowRoot);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
if (resolvedSel) {
|
|
352
|
+
if (resolvedSel === "$window") bindTargets.push(currentWin);
|
|
353
|
+
else if (resolvedSel === "$document") bindTargets.push(currentWin.document);
|
|
354
|
+
else if (resolvedSel === "$host") applyRoot(helperHostSet.$host);
|
|
355
|
+
else if (resolvedSel === "$parentHost") applyRoot(helperHostSet.$parentHost);
|
|
356
|
+
else if (resolvedSel === "$appHost") applyRoot(helperHostSet.$appHost);
|
|
357
|
+
else if (resolvedSel === "$firstHost") applyRoot(helperHostSet.$firstHost);
|
|
358
|
+
else if (resolvedSel === "$lastHost") applyRoot(helperHostSet.$lastHost);
|
|
359
|
+
else if (resolvedSel === "$firstAppHost") applyRoot(helperHostSet.$firstAppHost);
|
|
360
|
+
else if (resolvedSel === "$lastAppHost") applyRoot(helperHostSet.$lastAppHost);
|
|
361
|
+
else if (resolvedSel === "$hosts") helperHostSet.$hosts.forEach(applyRoot);
|
|
362
|
+
else if (resolvedSel === "$appHosts") helperHostSet.$appHosts.forEach(applyRoot);
|
|
363
|
+
else if (resolvedSel === "$this" || !resolvedSel) applyRoot(inst);
|
|
364
|
+
else {
|
|
365
|
+
const searchRoots = [];
|
|
366
|
+
if (r === "auto") searchRoots.push(inst.shadowRoot || inst);
|
|
367
|
+
else if (r === "light") searchRoots.push(inst);
|
|
368
|
+
else if (r === "shadow" && inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
369
|
+
else if (r === "all") {
|
|
370
|
+
searchRoots.push(inst);
|
|
371
|
+
if (inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
372
|
+
}
|
|
373
|
+
for (const sr of searchRoots) sr.querySelectorAll(resolvedSel).forEach((el) => bindTargets.push(el));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
for (const t of bindTargets) this.bindDirect(helperHostSet, t, meta);
|
|
377
|
+
}
|
|
378
|
+
if (mutationDelegateListeners.length > 0) {
|
|
379
|
+
const shadowEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
380
|
+
const r = m.options.root || "auto";
|
|
381
|
+
return inst.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
382
|
+
});
|
|
383
|
+
const lightEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
384
|
+
const r = m.options.root || "auto";
|
|
385
|
+
return r === "light" || r === "all" || !inst.shadowRoot && r === "auto";
|
|
386
|
+
});
|
|
387
|
+
const buildMutationEntry = (root, eventDelegates) => {
|
|
388
|
+
if (eventDelegates.length === 0) return null;
|
|
389
|
+
const boundSets = this.getEventBoundSets(inst);
|
|
390
|
+
const callback = (mutations, obs) => {
|
|
391
|
+
for (const m of eventDelegates) {
|
|
392
|
+
let boundSet = boundSets.get(m);
|
|
393
|
+
if (!boundSet) {
|
|
394
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
395
|
+
boundSets.set(m, boundSet);
|
|
396
|
+
}
|
|
397
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
398
|
+
const matchesSel = (n) => {
|
|
399
|
+
if (!n || n.nodeType !== 1) return false;
|
|
400
|
+
if (isThis) return true;
|
|
401
|
+
return typeof m.selector === "string" && n.matches?.(m.selector);
|
|
402
|
+
};
|
|
403
|
+
const bindEl = (el) => {
|
|
404
|
+
if (!boundSet.has(el)) {
|
|
405
|
+
this.bindDirect(helperHostSet, el, m);
|
|
406
|
+
boundSet.add(el);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
const unbindEl = (el) => {
|
|
410
|
+
if (boundSet.has(el)) {
|
|
411
|
+
this.unbindDirect(helperHostSet, el, m);
|
|
412
|
+
boundSet.delete(el);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
for (const mut of mutations) {
|
|
416
|
+
Array.from(mut.addedNodes || []).forEach((n) => {
|
|
417
|
+
if (n.nodeType !== 1) return;
|
|
418
|
+
if (matchesSel(n)) bindEl(n);
|
|
419
|
+
else if (!isThis && typeof m.selector === "string") n.querySelectorAll?.(m.selector).forEach(bindEl);
|
|
420
|
+
});
|
|
421
|
+
Array.from(mut.removedNodes || []).forEach((n) => {
|
|
422
|
+
if (n.nodeType !== 1) return;
|
|
423
|
+
const el = n;
|
|
424
|
+
if (matchesSel(el)) unbindEl(el);
|
|
425
|
+
else if (!isThis && typeof m.selector === "string") el.querySelectorAll?.(m.selector).forEach(unbindEl);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
for (const m of eventDelegates) {
|
|
431
|
+
let boundSet = boundSets.get(m);
|
|
432
|
+
if (!boundSet) {
|
|
433
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
434
|
+
boundSets.set(m, boundSet);
|
|
435
|
+
}
|
|
436
|
+
if (typeof m.selector !== "string") continue;
|
|
437
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
438
|
+
this.bindDirect(helperHostSet, root, m);
|
|
439
|
+
boundSet.add(root);
|
|
440
|
+
} else {
|
|
441
|
+
root.querySelectorAll(m.selector).forEach((el) => {
|
|
442
|
+
if (!boundSet.has(el)) {
|
|
443
|
+
this.bindDirect(helperHostSet, el, m);
|
|
444
|
+
boundSet.add(el);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return { target: root, options: { childList: true, subtree: true }, callback };
|
|
450
|
+
};
|
|
451
|
+
const shadowEntry = inst.shadowRoot ? buildMutationEntry(inst.shadowRoot, shadowEventDelegates) : null;
|
|
452
|
+
const lightEntry = buildMutationEntry(inst, lightEventDelegates);
|
|
453
|
+
const mutationObserverSet = [shadowEntry, lightEntry].filter(Boolean);
|
|
454
|
+
if (mutationObserverSet.length > 0) return { mutationObserverSet };
|
|
455
|
+
}
|
|
456
|
+
return void 0;
|
|
457
|
+
}
|
|
458
|
+
onDisconnected(helperHostSet) {
|
|
459
|
+
const inst = helperHostSet.$this;
|
|
460
|
+
const list = this.boundListenersMap.get(inst) ?? [];
|
|
461
|
+
for (const l of list) {
|
|
462
|
+
try {
|
|
463
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
464
|
+
l.subscription?.unsubscribe?.();
|
|
465
|
+
} catch (e) {
|
|
466
|
+
console.error("[SWC] EventListenerLifeCycler cleanup error:", e);
|
|
467
|
+
}
|
|
468
|
+
for (const r of l.onRemoves ?? []) {
|
|
469
|
+
try {
|
|
470
|
+
r.fn(l.target, r.opts);
|
|
471
|
+
} catch (e) {
|
|
472
|
+
console.error("[SWC] removeListener error:", e);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
this.boundListenersMap.delete(inst);
|
|
477
|
+
this.eventBoundSetsMap.delete(inst);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
122
480
|
//# sourceMappingURL=addEventListener.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/addEventListener.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface AddEventListenerBaseOptions<TEvent extends Event = Event> extends EventListenerOptions {\n capture?: boolean;\n once?: boolean;\n passive?: boolean;\n stopPropagation?: boolean;\n stopImmediatePropagation?: boolean;\n preventDefault?: boolean;\n // removeOnDisconnected?: boolean;\n delegate?: boolean;\n filter?: (target: Event | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}) => boolean;\n // \uB9AC\uC2A4\uB108 \uC81C\uAC70(disconnected \uB610\uB294 unmount) \uC2DC \uD638\uCD9C\uB418\uB294 \uCF5C\uBC31. \uCCAB \uBC88\uC9F8 \uC778\uC790\uB294 \uBC14\uC778\uB529\uB41C \uD0C0\uAC9F element, \uB450 \uBC88\uC9F8\uB294 \uC774 \uC635\uC158\uC774 \uC18D\uD55C \uC804\uCCB4 \uC635\uC158 \uAC1D\uCCB4(Base + SwcQuery + delegate).\n removeListener?: (target: Element, optionValue: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean }) => void;\n // RxJS operator options\n debounceTime?: number;\n throttleTime?: number;\n distinctUntilChanged?: boolean | ((prev: TEvent, curr: TEvent) => boolean);\n}\n\nexport type EventListenerSelector = string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null);\n\nexport interface AddEventListenerMetadata<TEvent extends Event = Event> {\n propertyKey: string | symbol;\n selector: EventListenerSelector;\n type: string;\n options: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean };\n}\n\nexport const ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:add-event-listener');\n\nexport function addEventListener<TEvent extends Event = Event>(target: SpecialSelector, type: string, options?: AddEventListenerBaseOptions<TEvent>): MethodDecorator;\nexport function addEventListener<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean }): MethodDecorator;\n/**\n * @addEventListener(type, options?) \u2014 \uC140\uB809\uD130 \uC0DD\uB7B5 \uC2DC $this(\uCEF4\uD3EC\uB10C\uD2B8 \uC790\uC2E0)\uB85C \uBC14\uC778\uB529\n */\nexport function addEventListener<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean }): MethodDecorator;\n/**\n * @addEventListener decorator to bind events to elements.\n */\nexport function addEventListener<TEvent extends Event = Event>(selectorOrType: EventListenerSelector | string, typeOrOptions?: string | (AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean }), maybeOptions?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean }): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n let selector: EventListenerSelector;\n let type: string;\n let opts: any = {};\n\n if (typeof typeOrOptions === 'string') {\n // (selector, type[, options]) form \u2014 \uAE30\uC874 \uD638\uD658\n selector = selectorOrType as EventListenerSelector;\n type = typeOrOptions;\n opts = maybeOptions ?? {};\n } else {\n // (type[, options]) form \u2014 selector \uAE30\uBCF8\uAC12 $this\n selector = '$this';\n type = selectorOrType as string;\n opts = typeOrOptions ?? {};\n }\n\n const constructor = targetObj.constructor;\n\n let listeners = ReflectUtils.getMetadata<AddEventListenerMetadata<TEvent>[]>(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n if (!listeners) {\n listeners = [];\n ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);\n }\n\n listeners.push({ propertyKey, selector, type, options: opts });\n };\n}\n\n\nexport function addEventListenerDelegateLightDom<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'light', delegate: true});\n}\n\nexport function addEventListenerDelegateShadowDom<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'shadow', delegate: true});\n}\nexport function addEventListenerDelegateAllDom<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'all', delegate: true});\n}\nexport function addEventListenerDelegate<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'auto', delegate: true});\n}\n\n// \u2500\u2500\u2500 root\uBCC4 \uC77C\uBC18 \uD5EC\uD37C (delegate \uC5C6\uC74C) \u2500\u2500\u2500\n\nexport function addEventListenerLightDom<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: AddEventListenerBaseOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'light'});\n}\n\nexport function addEventListenerShadowDom<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: AddEventListenerBaseOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'shadow'});\n}\n\nexport function addEventListenerAllDom<TEvent extends Event = Event>(selector: EventListenerSelector, type: string, options?: AddEventListenerBaseOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'all'});\n}\n\n/**\n * @addEventListenerThis decorator - simplified version of @addEventListener for $this selector\n */\nexport function addEventListenerThis<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$this', type, options);\n}\n\n/**\n * @addEventListenerAppHost decorator - simplified version of @addEventListener for $appHost selector\n */\nexport function addEventListenerAppHost<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$appHost', type, options);\n}\n\nexport function addEventListenerWindow<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$window', type, options);\n}\nexport function addEventListenerDocument<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$document', type, options);\n}\n\n// --- Aliases: event... ---\nexport const event = addEventListener;\nexport const eventDelegateLightDom = addEventListenerDelegateLightDom;\nexport const eventDelegateShadowDom = addEventListenerDelegateShadowDom;\nexport const eventDelegateAllDom = addEventListenerDelegateAllDom;\nexport const eventDelegate = addEventListenerDelegate;\nexport const eventLightDom = addEventListenerLightDom;\nexport const eventShadowDom = addEventListenerShadowDom;\nexport const eventAllDom = addEventListenerAllDom;\nexport const eventAppHost = addEventListenerAppHost;\nexport const eventWindow = addEventListenerWindow;\nexport const eventDocument = addEventListenerDocument;\nexport const eventThis = addEventListenerThis;\n\nexport const getAddEventListenerMetadata = (target: any): AddEventListenerMetadata<Event>[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AA8BtB,MAAM,kCAAkC,OAAO,IAAI,yCAAyC;AAW5F,SAAS,iBAA+C,gBAAgD,eAA2G,cAAgH;AACxU,SAAO,CAAC,WAAmB,aAA8B,eAAmC;AAC1F,QAAI;AACJ,QAAI;AACJ,QAAI,OAAY,CAAC;AAEjB,QAAI,OAAO,kBAAkB,UAAU;AAErC,iBAAW;AACX,aAAO;AACP,aAAO,gBAAgB,CAAC;AAAA,IAC1B,OAAO;AAEL,iBAAW;AACX,aAAO;AACP,aAAO,iBAAiB,CAAC;AAAA,IAC3B;AAEA,UAAM,cAAc,UAAU;AAE9B,QAAI,YAAY,yBAAa,YAAgD,iCAAiC,WAAW;AACzH,QAAI,CAAC,WAAW;AACd,kBAAY,CAAC;AACb,+BAAa,eAAe,iCAAiC,WAAW,WAAW;AAAA,IACrF;AAEA,cAAU,KAAK,EAAE,aAAa,UAAU,MAAM,SAAS,KAAK,CAAC;AAAA,EAC/D;AACF;AAGO,SAAS,iCAA+D,UAAiC,MAAc,SAAkF;AAC9M,SAAO,iBAAyB,UAAU,MAAM,EAAC,GAA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BAAyB;AAC/B,MAAM,sBAAsB;AAC5B,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AACvB,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAElB,MAAM,8BAA8B,CAAC,WAA+D;AACzG,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,YAAY,iCAAiC,WAAW;AAC9E;",
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet, SwcFnSelector, SwcSelector } from '../types';\n\nexport interface AddEventListenerBaseOptions<TEvent extends Event = Event> extends EventListenerOptions {\n capture?: boolean;\n once?: boolean;\n passive?: boolean;\n stopPropagation?: boolean;\n stopImmediatePropagation?: boolean;\n preventDefault?: boolean;\n // removeOnDisconnected?: boolean;\n // delegate\uB294 \uBB38\uC790\uC5F4 \uC140\uB809\uD130 \uC804\uC6A9 \u2192 AddEventListenerQueryOptions\uC5D0\uB9CC \uC874\uC7AC\n filter?: (target: Event | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}) => boolean;\n // \uB9AC\uC2A4\uB108 \uC81C\uAC70(disconnected \uB610\uB294 unmount) \uC2DC \uD638\uCD9C\uB418\uB294 \uCF5C\uBC31. \uCCAB \uBC88\uC9F8 \uC778\uC790\uB294 \uBC14\uC778\uB529\uB41C \uD0C0\uAC9F element, \uB450 \uBC88\uC9F8\uB294 \uC774 \uC635\uC158\uC774 \uC18D\uD55C \uC804\uCCB4 \uC635\uC158 \uAC1D\uCCB4(Base + SwcQuery + delegate).\n removeListener?: (target: Element, optionValue: AddEventListenerQueryOptions<TEvent>) => void;\n // RxJS operator options\n debounceTime?: number;\n throttleTime?: number;\n distinctUntilChanged?: boolean | ((prev: TEvent, curr: TEvent) => boolean);\n}\n\nexport type EventListenerFnSelector = SwcFnSelector;\nexport type EventListenerSelector = SwcSelector;\n\nexport interface AddEventListenerMetadata<TEvent extends Event = Event> {\n propertyKey: string | symbol;\n selector: EventListenerSelector;\n type: string;\n options: AddEventListenerQueryOptions<TEvent>;\n}\n\nexport const ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:add-event-listener');\n\n// root + delegate \uD5C8\uC6A9 \u2014 \uBB38\uC790\uC5F4 \uC140\uB809\uD130\uB294 \uCEF4\uD3EC\uB10C\uD2B8 DOM \uD2B8\uB9AC \uC548\uC5D0\uC11C \uD0D0\uC0C9/\uB378\uB9AC\uAC8C\uC774\uC158\uD558\uBBC0\uB85C \uC758\uBBF8 \uC788\uC74C\nexport type AddEventListenerQueryOptions<TEvent extends Event = Event> = AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean | 'this' | 'mutation' };\n// root\u00B7delegate \uBE44\uD5C8\uC6A9 \u2014 \uD568\uC218 \uC140\uB809\uD130\uB294 \uC774\uBBF8 \uC694\uC18C\uB97C \uC9C1\uC811 \uBC18\uD658\uD558\uBBC0\uB85C root\u00B7delegate\uAC00 \uBB34\uC758\uBBF8\uD568\nexport type AddEventListenerNonQueryOptions<TEvent extends Event = Event> = AddEventListenerBaseOptions<TEvent>;\n\n// \uC140\uB809\uD130 \uC885\uB958\uC5D0 \uB530\uB77C \uC635\uC158 \uD0C0\uC785\uC744 \uBD84\uAE30\nexport type AddEventListenerOptionsOf<S extends EventListenerSelector, TEvent extends Event = Event> =\n S extends string ? AddEventListenerQueryOptions<TEvent> : AddEventListenerNonQueryOptions<TEvent>;\n\nexport function addEventListener<TEvent extends Event = Event>(target: SpecialSelector, type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;\nexport function addEventListener<TEvent extends Event = Event>(selector: string, type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;\nexport function addEventListener<TEvent extends Event = Event>(selector: string, type: string[], options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;\nexport function addEventListener<TEvent extends Event = Event>(selector: EventListenerFnSelector, type: string, options?: AddEventListenerNonQueryOptions<TEvent>): MethodDecorator;\n/**\n * @addEventListener(type, options?) \u2014 \uC140\uB809\uD130 \uC0DD\uB7B5 \uC2DC $this(\uCEF4\uD3EC\uB10C\uD2B8 \uC790\uC2E0)\uB85C \uBC14\uC778\uB529\n */\nexport function addEventListener<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;\nexport function addEventListener<TEvent extends Event = Event>(type: string[], options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator;\n/**\n * @addEventListener decorator to bind events to elements.\n */\nexport function addEventListener<TEvent extends Event = Event>(selectorOrType: EventListenerSelector | string | string[], typeOrOptions?: string | string[] | AddEventListenerQueryOptions<TEvent>, maybeOptions?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n let selector: EventListenerSelector;\n let types: string[];\n let opts: any = {};\n\n if (typeof typeOrOptions === 'string' || Array.isArray(typeOrOptions)) {\n // (selector, type|[types][, options]) form \u2014 \uAE30\uC874 \uD638\uD658\n selector = selectorOrType as EventListenerSelector;\n types = Array.isArray(typeOrOptions) ? typeOrOptions : [typeOrOptions];\n opts = maybeOptions ?? {};\n } else {\n // (type|[types][, options]) form \u2014 selector \uAE30\uBCF8\uAC12 $this\n selector = '$this';\n if (Array.isArray(selectorOrType)) types = selectorOrType;\n else types = [selectorOrType as string];\n opts = typeOrOptions ?? {};\n }\n\n const constructor = targetObj.constructor;\n\n let listeners = ReflectUtils.getMetadata<AddEventListenerMetadata<TEvent>[]>(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n if (!listeners) {\n listeners = [];\n ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);\n }\n\n for (const type of types) listeners.push({ propertyKey, selector, type, options: opts });\n };\n}\n\n\nexport function addEventListenerDelegateLight<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'light', delegate: true});\n}\n\nexport function addEventListenerDelegateShadow<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'shadow', delegate: true});\n}\nexport function addEventListenerDelegateAll<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'all', delegate: true});\n}\nexport function addEventListenerDelegate<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'auto', delegate: true});\n}\n\nexport function addEventListenerMutationLight<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'light', delegate: 'mutation'});\n}\n\nexport function addEventListenerMutationShadow<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'shadow', delegate: 'mutation'});\n}\n\nexport function addEventListenerMutationAll<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'all', delegate: 'mutation'});\n}\n\nexport function addEventListenerMutation<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerQueryOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'auto', delegate: 'mutation'});\n}\n\n// \u2500\u2500\u2500 root\uBCC4 \uC77C\uBC18 \uD5EC\uD37C (delegate \uC5C6\uC74C, \uBB38\uC790\uC5F4 \uC140\uB809\uD130 \uC804\uC6A9) \u2500\u2500\u2500\n\nexport function addEventListenerLight<TEvent extends Event = Event>(selector: string, type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'light'});\n}\n\nexport function addEventListenerShadow<TEvent extends Event = Event>(selector: string, type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'shadow'});\n}\n\nexport function addEventListenerAll<TEvent extends Event = Event>(selector: string, type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'all'});\n}\n\n/**\n * @addEventListenerThis decorator - simplified version of @addEventListener for $this selector\n */\nexport function addEventListenerThis<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>('$this', type, options);\n}\n\n/**\n * @addEventListenerAppHost decorator - simplified version of @addEventListener for $appHost selector\n */\nexport function addEventListenerAppHost<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>('$appHost', type, options);\n}\n\nexport function addEventListenerWindow<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>('$window', type, options);\n}\nexport function addEventListenerDocument<TEvent extends Event = Event>(type: string, options?: AddEventListenerQueryOptions<TEvent>): MethodDecorator {\n return addEventListener<TEvent>('$document', type, options);\n}\n\n// --- Aliases: event... ---\nexport const event = addEventListener;\nexport const eventDelegateLight = addEventListenerDelegateLight;\nexport const eventDelegateShadow = addEventListenerDelegateShadow;\nexport const eventDelegateAll = addEventListenerDelegateAll;\nexport const eventDelegate = addEventListenerDelegate;\nexport const eventMutationLight = addEventListenerMutationLight;\nexport const eventMutationShadow = addEventListenerMutationShadow;\nexport const eventMutationAll = addEventListenerMutationAll;\nexport const eventMutation = addEventListenerMutation;\nexport const eventLight = addEventListenerLight;\nexport const eventShadow = addEventListenerShadow;\nexport const eventAll = addEventListenerAll;\nexport const eventAppHost = addEventListenerAppHost;\nexport const eventWindow = addEventListenerWindow;\nexport const eventDocument = addEventListenerDocument;\nexport const eventThis = addEventListenerThis;\n\nexport const getAddEventListenerMetadata = (target: any): AddEventListenerMetadata<Event>[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n};\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// EventListenerLifeCycler\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nimport { ElementDefineLifeCycler, MutationObserverSetEntry, OnConnectedResult } from '../types';\nimport { Subject } from '@dooboostore/core';\nimport { debounceTime, distinctUntilChanged, throttleTime } from '@dooboostore/core/message/operators';\nimport { SwcUtils } from '../utils/Utils';\n\nexport interface BoundListenerEntry {\n target: EventTarget;\n type: string;\n handler: EventListener;\n options: AddEventListenerOptions;\n onRemoves?: Array<{ fn: (target: EventTarget, optionValue: unknown) => void; opts: unknown }>;\n subscription?: { unsubscribe: () => void };\n meta?: AddEventListenerMetadata<Event>;\n}\n\nexport class EventListenerLifeCycler implements ElementDefineLifeCycler {\n /** \uC778\uC2A4\uD134\uC2A4\uBCC4 boundListeners \uC0C1\uD0DC (\uC2DC\uD074\uB7EC\uB294 elementDefine \uC2DC 1\uD68C \uC0DD\uC131\uB418\uC5B4 \uACF5\uC720\uB418\uBBC0\uB85C) */\n private readonly boundListenersMap = new WeakMap<Element, BoundListenerEntry[]>();\n /** \uC778\uC2A4\uD134\uC2A4\uBCC4 delegate:'mutation' \uBC14\uC778\uB529 \uCD94\uC801 WeakSet \u2014 MutationObserverLifeCycler \uC5D0\uC11C \uCC38\uC870 */\n private readonly eventBoundSetsMap = new WeakMap<Element, Map<AddEventListenerMetadata, WeakSet<Element>>>();\n\n // \u2500\u2500 \uC678\uBD80(MutationObserverLifeCycler)\uC5D0\uC11C \uC9C1\uC811 \uC0AC\uC6A9\uD558\uB294 \uACF5\uAC1C \uD5EC\uD37C \u2500\u2500\n\n /** \uC778\uC2A4\uD134\uC2A4\uBCC4 boundListeners \uB97C \uBC18\uD658\uD55C\uB2E4 (\uC5C6\uC73C\uBA74 \uC0DD\uC131). */\n getBoundListeners(inst: Element): BoundListenerEntry[] {\n let list = this.boundListenersMap.get(inst);\n if (!list) { list = []; this.boundListenersMap.set(inst, list); }\n return list;\n }\n\n /** \uC778\uC2A4\uD134\uC2A4\uBCC4 eventBoundSets \uB97C \uBC18\uD658\uD55C\uB2E4 (\uC5C6\uC73C\uBA74 \uC0DD\uC131). */\n getEventBoundSets(inst: Element): Map<AddEventListenerMetadata, WeakSet<Element>> {\n let map = this.eventBoundSetsMap.get(inst);\n if (!map) { map = new Map(); this.eventBoundSetsMap.set(inst, map); }\n return map;\n }\n\n /**\n * target \uC5D0 meta \uC774\uBCA4\uD2B8\uB97C \uC9C1\uC811 \uBC14\uC778\uB529\uD55C\uB2E4.\n * delegate:'mutation' \uCD08\uAE30/\uB3D9\uC801 \uBC14\uC778\uB529\uC5D0\uC11C \uD638\uCD9C\uB41C\uB2E4.\n */\n bindDirect(helperHostSet: HelperHostSet, target: EventTarget, meta: AddEventListenerMetadata): void {\n const inst = helperHostSet.$this;\n const currentWin = helperHostSet.$w;\n const { type, options } = meta;\n const opts = { capture: options.capture, once: options.once, passive: options.passive };\n\n const handler = async (event: Event) => {\n if (options.filter) {\n const helper = SwcUtils.getHelperAndHostSet(currentWin, target as HTMLElement);\n if (!options.filter(event, { currentThis: inst, helper })) return;\n }\n if (options.stopPropagation) event.stopPropagation();\n if (options.stopImmediatePropagation) event.stopImmediatePropagation();\n if (options.preventDefault) event.preventDefault();\n const currentHostSet = SwcUtils.getHostSet(inst);\n await inst[meta.propertyKey](event, { currentHostSet, $matchedElement: event.currentTarget }, { event, ...currentHostSet, $el: target, $root: target });\n };\n\n const eventSubject = new Subject<Event>();\n let eventStream: any = eventSubject;\n if (options.debounceTime && options.debounceTime > 0)\n eventStream = eventStream.pipe(debounceTime(options.debounceTime));\n if (options.throttleTime && options.throttleTime > 0)\n eventStream = eventStream.pipe(throttleTime(options.throttleTime));\n if (options.distinctUntilChanged !== undefined && options.distinctUntilChanged !== false) {\n eventStream = typeof options.distinctUntilChanged === 'function'\n ? eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged))\n : eventStream.pipe(distinctUntilChanged());\n }\n\n const subscription = eventStream.subscribe({\n next: (e: Event) => handler(e).catch((err: any) => console.error('Event handler error:', err)),\n error: (err: any) => console.error('Event stream error:', err),\n });\n\n const wrappedHandler = (event: Event) => eventSubject.next(event);\n target.addEventListener(type, wrappedHandler, opts);\n\n const onRemoves: Array<{ fn: any; opts: any }> =\n options.removeListener ? [{ fn: options.removeListener, opts: options }] : [];\n this.getBoundListeners(inst).push({ target, type, handler: wrappedHandler, options: opts, subscription, onRemoves, meta });\n }\n\n /** target + meta \uC870\uD569 \uB9AC\uC2A4\uB108\uB97C \uC81C\uAC70\uD55C\uB2E4. MutationObserver \uCD94\uC801 \uC694\uC18C \uC81C\uAC70 \uC2DC \uD638\uCD9C. */\n unbindDirect(helperHostSet: HelperHostSet, target: EventTarget, meta: AddEventListenerMetadata): void {\n const inst = helperHostSet.$this;\n const list = this.getBoundListeners(inst);\n for (let i = list.length - 1; i >= 0; i--) {\n const l = list[i];\n if (l.target === target && l.type === meta.type && l.meta === meta) {\n try { l.target.removeEventListener(l.type, l.handler, l.options); l.subscription?.unsubscribe?.(); }\n catch (e) { console.error('[SWC] unbindDirect error:', e); }\n for (const r of l.onRemoves ?? []) {\n try { r.fn(l.target, r.opts); } catch (e) { console.error('[SWC] unbindDirect removeListener error:', e); }\n }\n list.splice(i, 1);\n }\n }\n }\n\n /**\n * \uBA54\uD0C0\uB370\uC774\uD130 \uBAA9\uB85D\uC744 delegate / mutationDelegate / nonDelegate \uB85C \uBD84\uB958\uD55C\uB2E4.\n * MutationObserverLifeCycler \uC5D0\uC11C mutationDelegate \uBAA9\uB85D\uC744 \uAEBC\uB0BC \uB54C \uC0AC\uC6A9\uD55C\uB2E4.\n */\n classifyListeners(metaList: AddEventListenerMetadata[]): {\n delegateListeners: AddEventListenerMetadata[];\n mutationDelegateListeners: AddEventListenerMetadata[];\n nonDelegateListeners: AddEventListenerMetadata[];\n } {\n const isSpecial = (sel: any) =>\n ['$window', '$document', '$host', '$appHost', '$firstHost', '$lastHost',\n '$firstAppHost', '$lastAppHost', '$hosts', '$appHosts', '$this', ''].includes(sel);\n\n const delegateListeners: AddEventListenerMetadata[] = [];\n const mutationDelegateListeners: AddEventListenerMetadata[] = [];\n const nonDelegateListeners: AddEventListenerMetadata[] = [];\n\n for (const meta of metaList) {\n const isStr = typeof meta.selector === 'string';\n const mode = meta.options.delegate;\n if (mode && isStr && !isSpecial(meta.selector)) {\n mode === 'mutation' ? mutationDelegateListeners.push(meta) : delegateListeners.push(meta);\n } else {\n nonDelegateListeners.push(meta);\n }\n }\n return { delegateListeners, mutationDelegateListeners, nonDelegateListeners };\n }\n\n // \u2500\u2500 ElementDefineLifeCycler \uAD6C\uD604 \u2500\u2500\n\n onConnected(helperHostSet: HelperHostSet): OnConnectedResult | void {\n const inst = helperHostSet.$this;\n const currentWin = helperHostSet.$w;\n\n this.boundListenersMap.delete(inst);\n this.eventBoundSetsMap.delete(inst);\n\n const allMeta = getAddEventListenerMetadata(inst) ?? [];\n const { delegateListeners, nonDelegateListeners, mutationDelegateListeners } = this.classifyListeners(allMeta);\n\n // \u2500\u2500 delegate \uB9AC\uC2A4\uB108: type+root \uD0A4\uB85C \uADF8\uB8F9\uD551 \u2192 unified handler \u2500\u2500\n const groups = new Map<string, AddEventListenerMetadata[]>();\n for (const meta of delegateListeners) {\n const key = `${meta.type}:${meta.options.root || 'auto'}`;\n if (!groups.has(key)) groups.set(key, []);\n groups.get(key)!.push(meta);\n }\n\n groups.forEach((metaList, key) => {\n const ci = key.indexOf(':');\n const type = key.slice(0, ci);\n const r = key.slice(ci + 1);\n const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };\n\n const roots: (HTMLElement | ShadowRoot)[] = [];\n if (r === 'auto') roots.push(inst.shadowRoot || inst);\n else if (r === 'light') roots.push(inst);\n else if (r === 'shadow' && inst.shadowRoot) roots.push(inst.shadowRoot);\n else if (r === 'all') { roots.push(inst); if (inst.shadowRoot) roots.push(inst.shadowRoot); }\n\n for (const br of roots) {\n const sorted = [...metaList].sort((a, b) => (b.options.stopPropagation ? 1 : 0) - (a.options.stopPropagation ? 1 : 0));\n const handler = async (event: Event) => {\n for (const m of sorted) {\n const matchedEl = (event.target as HTMLElement)?.closest(m.selector as string);\n console.log('[DBG][delegate] type=', event.type, '| evtTarget=', (event.target as any)?.tagName, '| sel=', m.selector, '| matchedEl=', matchedEl?.className || matchedEl?.tagName, '| brContains=', (br as any).contains?.(matchedEl), '| brTag=', (br as any).tagName || (br as any).constructor?.name);\n if (matchedEl && (br as any).contains(matchedEl)) {\n if (m.options.filter) {\n const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl as HTMLElement);\n if (!m.options.filter(event, { currentThis: inst, helper })) continue;\n }\n if (m.options.stopPropagation) event.stopPropagation();\n if (m.options.stopImmediatePropagation) event.stopImmediatePropagation();\n if (m.options.preventDefault) event.preventDefault();\n const hs = SwcUtils.getHostSet(inst);\n await inst[m.propertyKey](event, { ...hs, $matchedElement: matchedEl }, { event, ...hs, $el: matchedEl, $root: br });\n if ((event as any).cancelBubble) break;\n }\n }\n };\n br.addEventListener(type, handler, opts);\n if (type === 'click') {\n console.log('[DBG][eventCycler] bound click on br=', (br as any).tagName || (br as any).constructor?.name, '| inst=', (inst as any).tagName || (inst as any).constructor?.name, '| isSame=', br === inst);\n }\n const onRemoves: Array<{ fn: any; opts: any }> = sorted.filter(m => m.options.removeListener).map(m => ({ fn: m.options.removeListener, opts: m.options }));\n this.getBoundListeners(inst).push({ target: br, type, handler, options: opts, onRemoves });\n }\n });\n\n // \u2500\u2500 non-delegate \uB9AC\uC2A4\uB108: \uB300\uC0C1 \uC694\uC18C \uC9C1\uC811 \uD0D0\uC0C9 \u2192 bindDirect \u2500\u2500\n for (const meta of nonDelegateListeners) {\n const { selector, options } = meta;\n const r = options.root || 'auto';\n const bindTargets: EventTarget[] = [];\n\n let resolvedSel: string | null = null;\n if (typeof selector === 'function') {\n const result = selector(inst, helperHostSet);\n if (typeof result === 'string') resolvedSel = result;\n else if (result instanceof currentWin.Element) bindTargets.push(result as EventTarget);\n else if (result instanceof currentWin.NodeList) bindTargets.push(...(Array.from(result) as EventTarget[]));\n else if (Array.isArray(result)) bindTargets.push(...(result as EventTarget[]));\n } else {\n resolvedSel = selector;\n }\n\n const applyRoot = (t: any) => {\n if (!t) return;\n if (r === 'auto') bindTargets.push(t.shadowRoot || t);\n else { if (r === 'light' || r === 'all') bindTargets.push(t); if ((r === 'shadow' || r === 'all') && t.shadowRoot) bindTargets.push(t.shadowRoot); }\n };\n\n if (resolvedSel) {\n if (resolvedSel === '$window') bindTargets.push(currentWin);\n else if (resolvedSel === '$document') bindTargets.push(currentWin.document);\n else if (resolvedSel === '$host') applyRoot(helperHostSet.$host);\n else if (resolvedSel === '$parentHost') applyRoot(helperHostSet.$parentHost);\n else if (resolvedSel === '$appHost') applyRoot(helperHostSet.$appHost);\n else if (resolvedSel === '$firstHost') applyRoot(helperHostSet.$firstHost);\n else if (resolvedSel === '$lastHost') applyRoot(helperHostSet.$lastHost);\n else if (resolvedSel === '$firstAppHost') applyRoot(helperHostSet.$firstAppHost);\n else if (resolvedSel === '$lastAppHost') applyRoot(helperHostSet.$lastAppHost);\n else if (resolvedSel === '$hosts') helperHostSet.$hosts.forEach(applyRoot);\n else if (resolvedSel === '$appHosts') helperHostSet.$appHosts.forEach(applyRoot);\n else if (resolvedSel === '$this' || !resolvedSel) applyRoot(inst);\n else {\n const searchRoots: (HTMLElement | ShadowRoot)[] = [];\n if (r === 'auto') searchRoots.push(inst.shadowRoot || inst);\n else if (r === 'light') searchRoots.push(inst);\n else if (r === 'shadow' && inst.shadowRoot) searchRoots.push(inst.shadowRoot);\n else if (r === 'all') { searchRoots.push(inst); if (inst.shadowRoot) searchRoots.push(inst.shadowRoot); }\n for (const sr of searchRoots) sr.querySelectorAll(resolvedSel).forEach(el => bindTargets.push(el));\n }\n }\n\n for (const t of bindTargets) this.bindDirect(helperHostSet, t, meta);\n }\n\n // \u2500\u2500 delegate:'mutation' \uB9AC\uC2A4\uB108: MutationObserver \uB85C \uCD94\uAC00/\uC81C\uAC70\uB41C \uC694\uC18C\uB97C \uCD94\uC801\uD574 \uC9C1\uC811 \uBC14\uC778\uB529/\uD574\uC81C \u2500\u2500\n // \uC774\uBCA4\uD2B8 \uB9AC\uC2A4\uB108\uC758 \uCC45\uC784\uC774\uBBC0\uB85C EventListenerLifeCycler \uAC00 \uC9C1\uC811 \uCC98\uB9AC\uD558\uACE0,\n // mutationObserverSet \uC744 \uBC18\uD658\uD574 elementDefine \uC774 \uD558\uB098\uC758 MutationObserver \uB85C \uC0DD\uC131\uD558\uAC8C \uD55C\uB2E4.\n if (mutationDelegateListeners.length > 0) {\n const shadowEventDelegates = mutationDelegateListeners.filter(m => {\n const r = m.options.root || 'auto';\n return inst.shadowRoot && (r === 'shadow' || r === 'all' || r === 'auto');\n });\n const lightEventDelegates = mutationDelegateListeners.filter(m => {\n const r = m.options.root || 'auto';\n return r === 'light' || r === 'all' || (!inst.shadowRoot && r === 'auto');\n });\n\n const buildMutationEntry = (\n root: HTMLElement | ShadowRoot,\n eventDelegates: AddEventListenerMetadata[],\n ): MutationObserverSetEntry | null => {\n if (eventDelegates.length === 0) return null;\n const boundSets = this.getEventBoundSets(inst);\n\n const callback = (mutations: MutationRecord[], obs: MutationObserver) => {\n for (const m of eventDelegates) {\n let boundSet = boundSets.get(m);\n if (!boundSet) { boundSet = new WeakSet<Element>(); boundSets.set(m, boundSet); }\n\n const isThis = m.selector === '$this' || m.selector === '';\n const matchesSel = (n: any) => {\n if (!n || n.nodeType !== 1) return false;\n if (isThis) return true;\n return typeof m.selector === 'string' && (n as HTMLElement).matches?.(m.selector);\n };\n const bindEl = (el: Element) => { if (!boundSet!.has(el)) { this.bindDirect(helperHostSet, el, m); boundSet!.add(el); } };\n const unbindEl = (el: Element) => { if (boundSet!.has(el)) { this.unbindDirect(helperHostSet, el, m); boundSet!.delete(el); } };\n\n for (const mut of mutations) {\n Array.from(mut.addedNodes || []).forEach(n => { if (n.nodeType !== 1) return; if (matchesSel(n)) bindEl(n as Element); else if (!isThis && typeof m.selector === 'string') (n as Element).querySelectorAll?.(m.selector).forEach(bindEl); });\n Array.from(mut.removedNodes || []).forEach(n => { if (n.nodeType !== 1) return; const el = n as Element; if (matchesSel(el)) unbindEl(el); else if (!isThis && typeof m.selector === 'string') el.querySelectorAll?.(m.selector).forEach(unbindEl); });\n }\n }\n };\n\n // delegate:'mutation' \uCD08\uAE30 \uBC14\uC778\uB529 (connected \uC2DC \uC774\uBBF8 \uC874\uC7AC\uD558\uB294 \uC694\uC18C)\n for (const m of eventDelegates) {\n let boundSet = boundSets.get(m);\n if (!boundSet) { boundSet = new WeakSet<Element>(); boundSets.set(m, boundSet); }\n if (typeof m.selector !== 'string') continue;\n if (m.selector === '$this' || m.selector === '') {\n this.bindDirect(helperHostSet, root as EventTarget, m);\n boundSet.add(root as Element);\n } else {\n root.querySelectorAll(m.selector).forEach(el => {\n if (!boundSet!.has(el)) { this.bindDirect(helperHostSet, el, m); boundSet!.add(el); }\n });\n }\n }\n\n return { target: root, options: { childList: true, subtree: true }, callback };\n };\n\n const shadowEntry = inst.shadowRoot ? buildMutationEntry(inst.shadowRoot, shadowEventDelegates) : null;\n const lightEntry = buildMutationEntry(inst as any, lightEventDelegates);\n const mutationObserverSet: MutationObserverSetEntry[] = [shadowEntry, lightEntry].filter(Boolean) as MutationObserverSetEntry[];\n if (mutationObserverSet.length > 0) return { mutationObserverSet };\n }\n\n return undefined;\n }\n\n onDisconnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n const list = this.boundListenersMap.get(inst) ?? [];\n for (const l of list) {\n try { l.target.removeEventListener(l.type, l.handler, l.options); l.subscription?.unsubscribe?.(); }\n catch (e) { console.error('[SWC] EventListenerLifeCycler cleanup error:', e); }\n for (const r of l.onRemoves ?? []) {\n try { r.fn(l.target, r.opts); } catch (e) { console.error('[SWC] removeListener error:', e); }\n }\n }\n this.boundListenersMap.delete(inst);\n this.eventBoundSetsMap.delete(inst);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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