@dooboostore/simple-web-component 1.0.47 → 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 +223 -27
- package/dist/cjs/config/config.js +1 -1
- package/dist/cjs/config/config.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +412 -16
- 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 +244 -225
- 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 +5 -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 +244 -0
- package/dist/cjs/decorators/mutationObserver.js.map +7 -0
- package/dist/cjs/decorators/query.js +129 -102
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/resizeObserver.js +191 -0
- package/dist/cjs/decorators/resizeObserver.js.map +7 -0
- 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/examples/RxJSOperatorsExample.js +285 -0
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
- 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 +413 -16
- 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 +249 -230
- 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 +5 -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 +226 -0
- package/dist/esm/decorators/mutationObserver.js.map +7 -0
- package/dist/esm/decorators/query.js +129 -102
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/resizeObserver.js +173 -0
- package/dist/esm/decorators/resizeObserver.js.map +7 -0
- 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/examples/RxJSOperatorsExample.js +266 -0
- package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2413 -889
- 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 +93 -23
- 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.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 +5 -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 +46 -0
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -0
- package/dist/types/decorators/query.d.ts +63 -8
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/resizeObserver.d.ts +48 -0
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -0
- 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/examples/RxJSOperatorsExample.d.ts +94 -0
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
- 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 +2413 -889
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +8 -6
- package/src/config/config.ts +1 -1
- package/src/decorators/addEventListener.ts +426 -23
- 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 +301 -317
- package/src/decorators/emitCustomEvent.ts +73 -5
- package/src/decorators/index.ts +5 -1
- package/src/decorators/intersectionObserver.ts +259 -0
- package/src/decorators/mutationObserver.ts +304 -0
- package/src/decorators/query.ts +182 -117
- package/src/decorators/resizeObserver.ts +235 -0
- 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/examples/RxJSOperatorsExample.ts +279 -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/cjs/elements/tt/SwcAppMixin.js +0 -1
- package/dist/cjs/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsync.js +0 -1
- package/dist/cjs/elements/tt/SwcAsync.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChoose.js +0 -1
- package/dist/cjs/elements/tt/SwcChoose.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIf.js +0 -1
- package/dist/cjs/elements/tt/SwcIf.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoop.js +0 -1
- package/dist/cjs/elements/tt/SwcLoop.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/cjs/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/cjs/elements/tt/register.js +0 -1
- package/dist/cjs/elements/tt/register.js.map +0 -7
- package/dist/esm/decorators/queryAll.js +0 -162
- package/dist/esm/decorators/queryAll.js.map +0 -7
- package/dist/esm/elements/tt/SwcAppMixin.js +0 -1
- package/dist/esm/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsync.js +0 -1
- package/dist/esm/elements/tt/SwcAsync.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcChoose.js +0 -1
- package/dist/esm/elements/tt/SwcChoose.js.map +0 -7
- package/dist/esm/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcIf.js +0 -1
- package/dist/esm/elements/tt/SwcIf.js.map +0 -7
- package/dist/esm/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoop.js +0 -1
- package/dist/esm/elements/tt/SwcLoop.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/esm/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/esm/elements/tt/register.js +0 -1
- package/dist/esm/elements/tt/register.js.map +0 -7
- package/dist/types/decorators/queryAll.d.ts +0 -22
- package/dist/types/decorators/queryAll.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts +0 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +0 -1
- package/dist/types/elements/tt/register.d.ts +0 -1
- package/dist/types/elements/tt/register.d.ts.map +0 -1
- package/src/decorators/queryAll.ts +0 -186
- package/src/elements/tt/SwcAppMixin.ts +0 -13
- package/src/elements/tt/SwcAsync.ts +0 -139
- package/src/elements/tt/SwcAsyncTemplate.ts +0 -126
- package/src/elements/tt/SwcChoose.ts +0 -182
- package/src/elements/tt/SwcChooseTemplate.ts +0 -229
- package/src/elements/tt/SwcIf.ts +0 -145
- package/src/elements/tt/SwcIfTemplate.ts +0 -158
- package/src/elements/tt/SwcLoop.ts +0 -222
- package/src/elements/tt/SwcLoopTemplate.ts +0 -255
- package/src/elements/tt/SwcSubTemplates.ts +0 -6
- package/src/elements/tt/register.ts +0 -720
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { ReflectUtils } from "@dooboostore/core";
|
|
5
|
+
const INTERSECTION_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:intersection-observer");
|
|
6
|
+
function intersectionObserver(selectorOrOptions, maybeOptions) {
|
|
7
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
8
|
+
let selector = "$this";
|
|
9
|
+
let options = {};
|
|
10
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11
|
+
selector = selectorOrOptions;
|
|
12
|
+
options = maybeOptions ?? {};
|
|
13
|
+
} else {
|
|
14
|
+
selector = "$this";
|
|
15
|
+
options = selectorOrOptions ?? {};
|
|
16
|
+
}
|
|
17
|
+
const constructor = targetObj.constructor;
|
|
18
|
+
let observers = ReflectUtils.getMetadata(INTERSECTION_OBSERVER_METADATA_KEY, constructor);
|
|
19
|
+
if (!observers) {
|
|
20
|
+
observers = [];
|
|
21
|
+
ReflectUtils.defineMetadata(INTERSECTION_OBSERVER_METADATA_KEY, observers, constructor);
|
|
22
|
+
}
|
|
23
|
+
observers.push({ propertyKey, selector, options });
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function intersectionObserverThis(options) {
|
|
27
|
+
return intersectionObserver("$this", options);
|
|
28
|
+
}
|
|
29
|
+
function intersectionObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
30
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
31
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
32
|
+
}
|
|
33
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
34
|
+
}
|
|
35
|
+
function intersectionObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
36
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
37
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
38
|
+
}
|
|
39
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
40
|
+
}
|
|
41
|
+
function intersectionObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
42
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
43
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
44
|
+
}
|
|
45
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
46
|
+
}
|
|
47
|
+
function intersectionObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
48
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
49
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
50
|
+
}
|
|
51
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
52
|
+
}
|
|
53
|
+
function intersectionObserverLight(selectorOrOptions, maybeOptions) {
|
|
54
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
55
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
56
|
+
}
|
|
57
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
58
|
+
}
|
|
59
|
+
function intersectionObserverShadow(selectorOrOptions, maybeOptions) {
|
|
60
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
61
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
62
|
+
}
|
|
63
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
64
|
+
}
|
|
65
|
+
function intersectionObserverAll(selectorOrOptions, maybeOptions) {
|
|
66
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
67
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
68
|
+
}
|
|
69
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
70
|
+
}
|
|
71
|
+
function getIntersectionObserverMetadata(target) {
|
|
72
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
73
|
+
return ReflectUtils.getMetadata(INTERSECTION_OBSERVER_METADATA_KEY, constructor);
|
|
74
|
+
}
|
|
75
|
+
import { SwcUtils } from "../utils/Utils.js";
|
|
76
|
+
class IntersectionObserverLifeCycler {
|
|
77
|
+
constructor() {
|
|
78
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
79
|
+
}
|
|
80
|
+
onConnected(helperHostSet) {
|
|
81
|
+
const inst = helperHostSet.$this;
|
|
82
|
+
const currentWin = helperHostSet.$w;
|
|
83
|
+
const removeObserverCallbacks = [];
|
|
84
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
85
|
+
const allMeta = getIntersectionObserverMetadata(inst) ?? [];
|
|
86
|
+
if (allMeta.length === 0) return;
|
|
87
|
+
const root = inst.shadowRoot || inst;
|
|
88
|
+
for (const m of allMeta) {
|
|
89
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
90
|
+
}
|
|
91
|
+
const buildCallback = (metas) => {
|
|
92
|
+
return (entries, obs) => {
|
|
93
|
+
for (const m of metas) {
|
|
94
|
+
let matchedEls;
|
|
95
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
96
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
97
|
+
matchedEls = entries.map((e) => e.target).filter((el) => {
|
|
98
|
+
if (!el || el.nodeType !== 1) return false;
|
|
99
|
+
if (isThis) return true;
|
|
100
|
+
return el.matches?.(m.selector) || !!el.closest?.(m.selector);
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
matchedEls = entries.map((e) => e.target).filter((t) => t && t.nodeType === 1);
|
|
104
|
+
}
|
|
105
|
+
if (matchedEls.length === 0) continue;
|
|
106
|
+
if (m.options.filter) {
|
|
107
|
+
if (!m.options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
108
|
+
}
|
|
109
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
110
|
+
inst[m.propertyKey](matchedEls, entries, obs, { ...hostSet, $root: root });
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const groups = /* @__PURE__ */ new Map();
|
|
115
|
+
for (const m of allMeta) {
|
|
116
|
+
const obsOptions = {
|
|
117
|
+
root: m.options.intersectionRoot ?? null,
|
|
118
|
+
rootMargin: m.options.rootMargin,
|
|
119
|
+
threshold: m.options.threshold
|
|
120
|
+
};
|
|
121
|
+
const key = JSON.stringify([obsOptions.root, obsOptions.rootMargin, obsOptions.threshold]);
|
|
122
|
+
if (!groups.has(key)) groups.set(key, { options: obsOptions, metas: [] });
|
|
123
|
+
groups.get(key).metas.push(m);
|
|
124
|
+
}
|
|
125
|
+
const intersectionObserverSet = [];
|
|
126
|
+
for (const [, group] of groups) {
|
|
127
|
+
const callback = buildCallback(group.metas);
|
|
128
|
+
const observeTargets = [];
|
|
129
|
+
for (const m of group.metas) {
|
|
130
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
131
|
+
observeTargets.push({ target: m.selector, delegate: true, delegateRoot: m.options.root, callback });
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
let targets = [];
|
|
135
|
+
if (typeof m.selector === "function") {
|
|
136
|
+
const res = m.selector(inst, helperHostSet);
|
|
137
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
138
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
139
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
140
|
+
} else if (typeof m.selector === "string") {
|
|
141
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
142
|
+
targets = [inst];
|
|
143
|
+
} else {
|
|
144
|
+
const r = m.options.root || "auto";
|
|
145
|
+
const scopes = [];
|
|
146
|
+
if (r === "auto") scopes.push(inst.shadowRoot || inst);
|
|
147
|
+
else if (r === "light") scopes.push(inst);
|
|
148
|
+
else if (r === "shadow" && inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
149
|
+
else if (r === "all") {
|
|
150
|
+
scopes.push(inst);
|
|
151
|
+
if (inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
152
|
+
}
|
|
153
|
+
for (const s of scopes) {
|
|
154
|
+
const found = s?.querySelectorAll?.(m.selector);
|
|
155
|
+
if (found?.length) targets.push(...Array.from(found));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
for (const el of targets) observeTargets.push({ target: el, callback });
|
|
160
|
+
}
|
|
161
|
+
intersectionObserverSet.push({ options: group.options, observeTargets });
|
|
162
|
+
}
|
|
163
|
+
return { intersectionObserverSet };
|
|
164
|
+
}
|
|
165
|
+
onDisconnected(helperHostSet) {
|
|
166
|
+
const inst = helperHostSet.$this;
|
|
167
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
168
|
+
try {
|
|
169
|
+
cb.fn(cb.target, cb.opts);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.error("[SWC] removeObserver error:", e);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
INTERSECTION_OBSERVER_METADATA_KEY,
|
|
179
|
+
IntersectionObserverLifeCycler,
|
|
180
|
+
getIntersectionObserverMetadata,
|
|
181
|
+
intersectionObserver,
|
|
182
|
+
intersectionObserverAll,
|
|
183
|
+
intersectionObserverDelegate,
|
|
184
|
+
intersectionObserverDelegateAll,
|
|
185
|
+
intersectionObserverDelegateLight,
|
|
186
|
+
intersectionObserverDelegateShadow,
|
|
187
|
+
intersectionObserverLight,
|
|
188
|
+
intersectionObserverShadow,
|
|
189
|
+
intersectionObserverThis
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=intersectionObserver.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/intersectionObserver.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, SwcFnSelector, SwcSelector, HelperHostSet } from '../types';\n\n// \uACF5\uD1B5 \uC635\uC158 \u2014 IntersectionObserverInit + filter/removeObserver. root\u00B7delegate \uC81C\uC678.\n// \uC8FC\uC758: \uB370\uCF54\uB808\uC774\uD130\uC758 root(light/shadow/all/auto) \uB294 \uC140\uB809\uD130 \uC2A4\uCF54\uD504 \uC120\uD0DD\uC6A9\uC774\uB2E4.\n// IntersectionObserver \uC758 \uC2A4\uD06C\uB864 \uCEE8\uD14C\uC774\uB108 root \uB294 intersectionRoot \uB85C \uC9C0\uC815\uD55C\uB2E4.\nexport interface IntersectionObserverBaseOptions extends Omit<IntersectionObserverInit, 'root'> {\n /** IntersectionObserver \uC758 \uC2A4\uD06C\uB864 \uCEE8\uD14C\uC774\uB108 (viewport \uB300\uC2E0). \uB370\uCF54\uB808\uC774\uD130 root \uC640 \uD63C\uB3D9 \uC8FC\uC758. */\n intersectionRoot?: Element | Document;\n filter?: (matchedEls: HTMLElement[], meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n removeObserver?: (target: Element, optionValue: IntersectionObserverQueryOptions) => void;\n}\n\n// \uBB38\uC790\uC5F4 \uC140\uB809\uD130 \uC804\uC6A9 \u2014 root\u00B7delegate \uD5C8\uC6A9\nexport type IntersectionObserverQueryOptions = IntersectionObserverBaseOptions & SwcQueryOptions & { delegate?: boolean };\n// \uD568\uC218 \uC140\uB809\uD130 \uC804\uC6A9 \u2014 root\u00B7delegate \uAE08\uC9C0\nexport type IntersectionObserverNonQueryOptions = IntersectionObserverBaseOptions;\n// \uB0B4\uBD80 \uC800\uC7A5/\uD574\uC11D\uC6A9\nexport type IntersectionObserverOptions = IntersectionObserverQueryOptions;\n\n// \uC140\uB809\uD130 \uC885\uB958\uC5D0 \uB530\uB77C \uC635\uC158 \uD0C0\uC785 \uBD84\uAE30\nexport type IntersectionObserverOptionsOf<S extends SwcSelector> = S extends string ? IntersectionObserverQueryOptions : IntersectionObserverNonQueryOptions;\n\nexport interface IntersectionObserverMetadata {\n propertyKey: string | symbol;\n selector: SwcSelector;\n options: IntersectionObserverOptions;\n}\n\nexport const INTERSECTION_OBSERVER_METADATA_KEY = Symbol.for('simple-web-component:intersection-observer');\n\nexport function intersectionObserver(target: SpecialSelector, options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserver(selector: string, options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserver(selector: SwcFnSelector, options?: IntersectionObserverNonQueryOptions): MethodDecorator;\nexport function intersectionObserver(options?: IntersectionObserverQueryOptions): MethodDecorator;\n/**\n * @intersectionObserver decorator to observe element intersection changes.\n *\n * IntersectionObserver \uB294 \uC0DD\uC131 \uC2DC\uC810\uC5D0 \uC635\uC158(threshold/rootMargin/root)\uC774 \uACE0\uC815\uB418\uBBC0\uB85C,\n * \uC635\uC158\uBCC4\uB85C \uADF8\uB8F9\uC744 \uB9CC\uB4E4\uC5B4 observer \uB97C \uC0DD\uC131\uD55C\uB2E4. \uAC19\uC740 \uC635\uC158 \uADF8\uB8F9 \uC548\uC5D0\uC11C delegate \uB3D9\uC801 \uCD94\uC801\uC774 \uAC00\uB2A5\uD558\uB2E4.\n */\nexport function intersectionObserver(selectorOrOptions?: SwcSelector | IntersectionObserverOptions, maybeOptions?: IntersectionObserverOptions): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n let selector: SwcSelector = '$this';\n let options: IntersectionObserverOptions = {};\n\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n selector = selectorOrOptions;\n options = maybeOptions ?? {};\n } else {\n selector = '$this';\n options = selectorOrOptions ?? {};\n }\n\n const constructor = targetObj.constructor;\n\n let observers = ReflectUtils.getMetadata<IntersectionObserverMetadata[]>(INTERSECTION_OBSERVER_METADATA_KEY, constructor);\n if (!observers) {\n observers = [];\n ReflectUtils.defineMetadata(INTERSECTION_OBSERVER_METADATA_KEY, observers, constructor);\n }\n\n observers.push({ propertyKey, selector, options });\n };\n}\n\nexport function intersectionObserverThis(options?: IntersectionObserverQueryOptions): MethodDecorator {\n return intersectionObserver('$this', options);\n}\n\n// \u2500\u2500\u2500 root\uBCC4 delegate \uD5EC\uD37C (root \uC8FC\uC785 \u2192 \uBB38\uC790\uC5F4 \uC140\uB809\uD130 \uC804\uC6A9) \u2500\u2500\u2500\n\nexport function intersectionObserverDelegateLight(selector: string, options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegateLight(options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegateLight(selectorOrOptions?: string | Omit<IntersectionObserverQueryOptions, 'delegate'>, maybeOptions?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return intersectionObserver(selectorOrOptions as any, {...maybeOptions ?? {}, root: 'light', delegate: true});\n }\n return intersectionObserver({...selectorOrOptions ?? {}, root: 'light', delegate: true});\n}\n\nexport function intersectionObserverDelegateShadow(selector: string, options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegateShadow(options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegateShadow(selectorOrOptions?: string | Omit<IntersectionObserverQueryOptions, 'delegate'>, maybeOptions?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return intersectionObserver(selectorOrOptions as any, {...maybeOptions ?? {}, root: 'shadow', delegate: true});\n }\n return intersectionObserver({...selectorOrOptions ?? {}, root: 'shadow', delegate: true});\n}\n\nexport function intersectionObserverDelegateAll(selector: string, options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegateAll(options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegateAll(selectorOrOptions?: string | Omit<IntersectionObserverQueryOptions, 'delegate'>, maybeOptions?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return intersectionObserver(selectorOrOptions as any, {...maybeOptions ?? {}, root: 'all', delegate: true});\n }\n return intersectionObserver({...selectorOrOptions ?? {}, root: 'all', delegate: true});\n}\n\nexport function intersectionObserverDelegate(selector: string, options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegate(options?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator;\nexport function intersectionObserverDelegate(selectorOrOptions?: string | Omit<IntersectionObserverQueryOptions, 'delegate'>, maybeOptions?: Omit<IntersectionObserverQueryOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return intersectionObserver(selectorOrOptions as any, {...maybeOptions ?? {}, root: 'auto', delegate: true});\n }\n return intersectionObserver({...selectorOrOptions ?? {}, root: 'auto', delegate: true});\n}\n\n// \u2500\u2500\u2500 root\uBCC4 \uC77C\uBC18 \uD5EC\uD37C (delegate \uC5C6\uC774, \uC140\uB809\uD130 \uC0DD\uB7B5 \uC2DC $this) \u2500\u2500\u2500\n\nexport function intersectionObserverLight(selector: string, options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserverLight(options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserverLight(selectorOrOptions?: string | IntersectionObserverQueryOptions, maybeOptions?: IntersectionObserverQueryOptions): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return intersectionObserver(selectorOrOptions as any, {...maybeOptions ?? {}, root: 'light'});\n }\n return intersectionObserver({...selectorOrOptions ?? {}, root: 'light'});\n}\n\nexport function intersectionObserverShadow(selector: string, options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserverShadow(options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserverShadow(selectorOrOptions?: string | IntersectionObserverQueryOptions, maybeOptions?: IntersectionObserverQueryOptions): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return intersectionObserver(selectorOrOptions as any, {...maybeOptions ?? {}, root: 'shadow'});\n }\n return intersectionObserver({...selectorOrOptions ?? {}, root: 'shadow'});\n}\n\nexport function intersectionObserverAll(selector: string, options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserverAll(options?: IntersectionObserverQueryOptions): MethodDecorator;\nexport function intersectionObserverAll(selectorOrOptions?: string | IntersectionObserverQueryOptions, maybeOptions?: IntersectionObserverQueryOptions): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return intersectionObserver(selectorOrOptions as any, {...maybeOptions ?? {}, root: 'all'});\n }\n return intersectionObserver({...selectorOrOptions ?? {}, root: 'all'});\n}\n\nexport function getIntersectionObserverMetadata(target: any): IntersectionObserverMetadata[] | undefined {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(INTERSECTION_OBSERVER_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// IntersectionObserverLifeCycler\n// observer \uB97C \uC9C1\uC811 \uC0DD\uC131\uD558\uC9C0 \uC54A\uACE0 \uC635\uC158 \uADF8\uB8F9 \uBC30\uC5F4(IntersectionObserverSet)\uC744 \uBC18\uD658\uD55C\uB2E4.\n// elementDefine \uC774 \uADF8\uB8F9\uBCC4\uB85C observer \uB97C \uC0DD\uC131\uD55C\uB2E4.\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, OnConnectedResult, IntersectionObserverSet, IntersectionObserverGroup, IntersectionObserverSetEntry } from '../types';\nimport { SwcUtils } from '../utils/Utils';\n\nexport class IntersectionObserverLifeCycler implements ElementDefineLifeCycler {\n private readonly removeObserverCallbacksMap = new WeakMap<Element, Array<{ fn: (target: Element, opts: unknown) => void; target: any; opts: unknown }>>();\n\n onConnected(helperHostSet: HelperHostSet): OnConnectedResult | void {\n const inst = helperHostSet.$this;\n const currentWin = helperHostSet.$w;\n\n const removeObserverCallbacks: Array<{ fn: (target: Element, opts: unknown) => void; target: any; opts: unknown }> = [];\n this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);\n\n const allMeta = getIntersectionObserverMetadata(inst) ?? [];\n if (allMeta.length === 0) return;\n\n const root: HTMLElement | ShadowRoot = inst.shadowRoot || inst;\n\n // removeObserver \uCF5C\uBC31 \uC218\uC9D1\n for (const m of allMeta) {\n if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });\n }\n\n // \u2500\u2500 IntersectionObserver \uCF5C\uBC31 \u2500\u2500\n const buildCallback = (metas: IntersectionObserverMetadata[]): IntersectionObserverSetEntry['callback'] => {\n return (entries, obs) => {\n for (const m of metas) {\n let matchedEls: HTMLElement[];\n if (m.options.delegate && typeof m.selector === 'string') {\n const isThis = m.selector === '$this' || m.selector === '';\n matchedEls = entries.map(e => e.target as HTMLElement).filter(el => {\n if (!el || el.nodeType !== 1) return false;\n if (isThis) return true;\n return el.matches?.(m.selector as string) || !!el.closest?.(m.selector as string);\n });\n } else {\n matchedEls = entries.map(e => e.target as HTMLElement).filter(t => t && t.nodeType === 1);\n }\n if (matchedEls.length === 0) continue;\n if (m.options.filter) {\n if (!m.options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;\n }\n const hostSet = SwcUtils.getHostSet(inst);\n inst[m.propertyKey](matchedEls, entries, obs, { ...hostSet, $root: root });\n }\n };\n };\n\n // \u2500\u2500 \uC635\uC158\uBCC4 \uADF8\uB8F9\uD551: \uAC19\uC740 observer \uC635\uC158(threshold/rootMargin/intersectionRoot)\uB07C\uB9AC \uBB36\uB294\uB2E4 \u2500\u2500\n // delegate:true \uD56D\uBAA9\uC740 \uB3D9\uC801 \uCD94\uC801\uC6A9 \uC140\uB809\uD130 \uBB38\uC790\uC5F4\uB85C \uC120\uC5B8\uB41C\uB2E4.\n const groups = new Map<string, { options: IntersectionObserverInit; metas: IntersectionObserverMetadata[] }>();\n for (const m of allMeta) {\n const obsOptions: IntersectionObserverInit = {\n root: m.options.intersectionRoot ?? null,\n rootMargin: m.options.rootMargin,\n threshold: m.options.threshold,\n };\n const key = JSON.stringify([obsOptions.root, obsOptions.rootMargin, obsOptions.threshold]);\n if (!groups.has(key)) groups.set(key, { options: obsOptions, metas: [] });\n groups.get(key)!.metas.push(m);\n }\n\n const intersectionObserverSet: IntersectionObserverSet = [];\n for (const [, group] of groups) {\n const callback = buildCallback(group.metas);\n const observeTargets: IntersectionObserverGroup['observeTargets'] = [];\n\n for (const m of group.metas) {\n if (m.options.delegate && typeof m.selector === 'string') {\n observeTargets.push({ target: m.selector, delegate: true, delegateRoot: m.options.root, callback });\n continue;\n }\n let targets: HTMLElement[] = [];\n\n if (typeof m.selector === 'function') {\n const res = (m.selector as any)(inst, helperHostSet);\n if (res instanceof currentWin.HTMLElement) targets = [res as HTMLElement];\n else if (res instanceof currentWin.NodeList) targets = Array.from(res as NodeList).filter((e: any) => e instanceof currentWin.HTMLElement) as HTMLElement[];\n else if (Array.isArray(res)) targets = res.filter((e: any) => e instanceof currentWin.HTMLElement) as HTMLElement[];\n } else if (typeof m.selector === 'string') {\n if (m.selector === '$this' || m.selector === '') {\n targets = [inst as HTMLElement];\n } else {\n const r: any = m.options.root || 'auto';\n const scopes: any[] = [];\n if (r === 'auto') scopes.push(inst.shadowRoot || inst);\n else if (r === 'light') scopes.push(inst);\n else if (r === 'shadow' && inst.shadowRoot) scopes.push(inst.shadowRoot);\n else if (r === 'all') { scopes.push(inst); if (inst.shadowRoot) scopes.push(inst.shadowRoot); }\n for (const s of scopes) {\n const found = s?.querySelectorAll?.(m.selector as string) as NodeListOf<HTMLElement> | undefined;\n if (found?.length) targets.push(...Array.from(found));\n }\n }\n }\n for (const el of targets) observeTargets.push({ target: el, callback });\n }\n\n intersectionObserverSet.push({ options: group.options, observeTargets });\n }\n\n return { intersectionObserverSet };\n }\n\n onDisconnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {\n try { cb.fn(cb.target, cb.opts); } catch (e) { console.error('[SWC] removeObserver error:', e); }\n }\n this.removeObserverCallb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AK,CAAC,GAAG;AAChE,UAAI;AAAE,WAAG,GAAG,GAAG,QAAQ,GAAG,IAAI;AAAA,MAAG,SAAS,GAAG;AAAE,gBAAQ,MAAM,+BAA+B,CAAC;AAAA,MAAG;AAAA,IAClG;AACA,SAAK,2BAA2B,OAAO,IAAI;AAAA,EAC7C;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { ReflectUtils } from "@dooboostore/core";
|
|
5
|
+
const MUTATION_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:mutation-observer");
|
|
6
|
+
function mutationObserver(selectorOrOptions, maybeOptions) {
|
|
7
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
8
|
+
let selector = "$this";
|
|
9
|
+
let options = {};
|
|
10
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11
|
+
selector = selectorOrOptions;
|
|
12
|
+
options = maybeOptions ?? {};
|
|
13
|
+
} else {
|
|
14
|
+
selector = "$this";
|
|
15
|
+
options = selectorOrOptions ?? {};
|
|
16
|
+
}
|
|
17
|
+
const constructor = targetObj.constructor;
|
|
18
|
+
let observers = ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
19
|
+
if (!observers) {
|
|
20
|
+
observers = [];
|
|
21
|
+
ReflectUtils.defineMetadata(MUTATION_OBSERVER_METADATA_KEY, observers, constructor);
|
|
22
|
+
}
|
|
23
|
+
observers.push({ propertyKey, selector, options });
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function mutationObserverThis(options) {
|
|
27
|
+
return mutationObserver("$this", options);
|
|
28
|
+
}
|
|
29
|
+
function mutationObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
30
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
31
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
32
|
+
}
|
|
33
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
34
|
+
}
|
|
35
|
+
function mutationObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
36
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
37
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
38
|
+
}
|
|
39
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
40
|
+
}
|
|
41
|
+
function mutationObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
42
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
43
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
44
|
+
}
|
|
45
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
46
|
+
}
|
|
47
|
+
function mutationObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
48
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
49
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
50
|
+
}
|
|
51
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
52
|
+
}
|
|
53
|
+
function mutationObserverLight(selectorOrOptions, maybeOptions) {
|
|
54
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
55
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
56
|
+
}
|
|
57
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
58
|
+
}
|
|
59
|
+
function mutationObserverShadow(selectorOrOptions, maybeOptions) {
|
|
60
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
61
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
62
|
+
}
|
|
63
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
64
|
+
}
|
|
65
|
+
function mutationObserverAll(selectorOrOptions, maybeOptions) {
|
|
66
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
67
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
68
|
+
}
|
|
69
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
70
|
+
}
|
|
71
|
+
function getMutationObserverMetadata(target) {
|
|
72
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
73
|
+
return ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
74
|
+
}
|
|
75
|
+
import { SwcUtils } from "../utils/Utils.js";
|
|
76
|
+
class MutationObserverLifeCycler {
|
|
77
|
+
constructor() {
|
|
78
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
79
|
+
}
|
|
80
|
+
onConnected(helperHostSet) {
|
|
81
|
+
const inst = helperHostSet.$this;
|
|
82
|
+
const currentWin = helperHostSet.$w;
|
|
83
|
+
const removeObserverCallbacks = [];
|
|
84
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
85
|
+
const allMeta = getMutationObserverMetadata(inst) ?? [];
|
|
86
|
+
if (allMeta.length === 0) return;
|
|
87
|
+
const shadowMetas = allMeta.filter((m) => {
|
|
88
|
+
const r = m.options.root || "auto";
|
|
89
|
+
return inst.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
90
|
+
});
|
|
91
|
+
const lightMetas = allMeta.filter((m) => {
|
|
92
|
+
const r = m.options.root || "auto";
|
|
93
|
+
return r === "light" || r === "all" || !inst.shadowRoot && r === "auto";
|
|
94
|
+
});
|
|
95
|
+
const buildSet = (root, metas) => {
|
|
96
|
+
if (metas.length === 0) return null;
|
|
97
|
+
const initFrom = (o) => {
|
|
98
|
+
const init = {
|
|
99
|
+
childList: o.childList,
|
|
100
|
+
attributes: o.attributes,
|
|
101
|
+
characterData: o.characterData,
|
|
102
|
+
subtree: o.subtree,
|
|
103
|
+
attributeFilter: o.attributeFilter,
|
|
104
|
+
attributeOldValue: o.attributeOldValue,
|
|
105
|
+
characterDataOldValue: o.characterDataOldValue
|
|
106
|
+
};
|
|
107
|
+
if (!init.childList && !init.attributes && !init.characterData) init.childList = true;
|
|
108
|
+
return init;
|
|
109
|
+
};
|
|
110
|
+
const fnObservedSets = /* @__PURE__ */ new Map();
|
|
111
|
+
const callback = (mutations, obs) => {
|
|
112
|
+
for (const meta of metas) {
|
|
113
|
+
const { selector, options } = meta;
|
|
114
|
+
let matchedEls = [];
|
|
115
|
+
const typeMatches = (m) => {
|
|
116
|
+
const has = !!(options.childList || options.attributes || options.characterData);
|
|
117
|
+
if (m.type === "childList") return has ? !!options.childList : true;
|
|
118
|
+
if (m.type === "attributes") return !!options.attributes;
|
|
119
|
+
if (m.type === "characterData") return !!options.characterData;
|
|
120
|
+
return true;
|
|
121
|
+
};
|
|
122
|
+
const collect = (matchesSel) => mutations.flatMap((m) => {
|
|
123
|
+
if (!typeMatches(m)) return [];
|
|
124
|
+
const els = [];
|
|
125
|
+
if (matchesSel(m.target)) els.push(m.target);
|
|
126
|
+
Array.from(m.addedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
127
|
+
Array.from(m.removedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
128
|
+
return els;
|
|
129
|
+
});
|
|
130
|
+
if (options.delegate && typeof selector === "string") {
|
|
131
|
+
const isThis = selector === "$this" || selector === "";
|
|
132
|
+
matchedEls = collect((n) => {
|
|
133
|
+
if (!n || n.nodeType !== 1) return false;
|
|
134
|
+
if (isThis) return true;
|
|
135
|
+
const el = n;
|
|
136
|
+
return el.matches?.(selector) || !!el.closest?.(selector);
|
|
137
|
+
});
|
|
138
|
+
} else if (typeof selector === "string") {
|
|
139
|
+
const isThis = selector === "$this" || selector === "";
|
|
140
|
+
matchedEls = collect((n) => {
|
|
141
|
+
if (!n || n.nodeType !== 1) return false;
|
|
142
|
+
if (isThis) return true;
|
|
143
|
+
return n.matches?.(selector);
|
|
144
|
+
});
|
|
145
|
+
} else if (typeof selector === "function") {
|
|
146
|
+
const set = fnObservedSets.get(meta);
|
|
147
|
+
matchedEls = mutations.filter((m) => typeMatches(m)).map((m) => m.target).filter((t) => t && t.nodeType === 1 && (set ? set.has(t) : false));
|
|
148
|
+
} else {
|
|
149
|
+
matchedEls = mutations.filter((m) => typeMatches(m)).map((m) => m.target).filter((t) => t && t.nodeType === 1);
|
|
150
|
+
}
|
|
151
|
+
if (matchedEls.length === 0) continue;
|
|
152
|
+
if (options.filter) {
|
|
153
|
+
if (!options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
154
|
+
}
|
|
155
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
156
|
+
inst[meta.propertyKey](matchedEls, mutations, obs, { ...hostSet, $root: root });
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const observeTargets = [];
|
|
160
|
+
if (metas.some((m) => m.options.delegate)) {
|
|
161
|
+
observeTargets.push({ target: root, options: { childList: true, subtree: true } });
|
|
162
|
+
}
|
|
163
|
+
for (const m of metas.filter((m2) => !m2.options.delegate)) {
|
|
164
|
+
const { selector, options } = m;
|
|
165
|
+
const mInit = initFrom(options);
|
|
166
|
+
if (typeof selector === "string") {
|
|
167
|
+
if (selector === "$this" || selector === "") {
|
|
168
|
+
observeTargets.push({ target: root, options: mInit });
|
|
169
|
+
} else {
|
|
170
|
+
root.querySelectorAll(selector).forEach((el) => observeTargets.push({ target: el, options: mInit }));
|
|
171
|
+
}
|
|
172
|
+
} else if (typeof selector === "function") {
|
|
173
|
+
const res = selector(inst, helperHostSet);
|
|
174
|
+
let targets = [];
|
|
175
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
176
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
177
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
178
|
+
const set = /* @__PURE__ */ new WeakSet();
|
|
179
|
+
for (const el of targets) {
|
|
180
|
+
set.add(el);
|
|
181
|
+
observeTargets.push({ target: el, options: mInit });
|
|
182
|
+
}
|
|
183
|
+
fnObservedSets.set(m, set);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
for (const m of metas) {
|
|
187
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
188
|
+
}
|
|
189
|
+
return { callback, observeTargets };
|
|
190
|
+
};
|
|
191
|
+
const shadowSet = inst.shadowRoot ? buildSet(inst.shadowRoot, shadowMetas) : null;
|
|
192
|
+
const lightSet = buildSet(inst, lightMetas);
|
|
193
|
+
const mutationObserverSet = [
|
|
194
|
+
...(shadowSet?.observeTargets ?? []).map((t) => ({ ...t, callback: shadowSet.callback })),
|
|
195
|
+
...(lightSet?.observeTargets ?? []).map((t) => ({ ...t, callback: lightSet.callback }))
|
|
196
|
+
];
|
|
197
|
+
if (mutationObserverSet.length === 0) return;
|
|
198
|
+
return { mutationObserverSet };
|
|
199
|
+
}
|
|
200
|
+
onDisconnected(helperHostSet) {
|
|
201
|
+
const inst = helperHostSet.$this;
|
|
202
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
203
|
+
try {
|
|
204
|
+
cb.fn(cb.target, cb.opts);
|
|
205
|
+
} catch (e) {
|
|
206
|
+
console.error("[SWC] removeObserver error:", e);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
MUTATION_OBSERVER_METADATA_KEY,
|
|
214
|
+
MutationObserverLifeCycler,
|
|
215
|
+
getMutationObserverMetadata,
|
|
216
|
+
mutationObserver,
|
|
217
|
+
mutationObserverAll,
|
|
218
|
+
mutationObserverDelegate,
|
|
219
|
+
mutationObserverDelegateAll,
|
|
220
|
+
mutationObserverDelegateLight,
|
|
221
|
+
mutationObserverDelegateShadow,
|
|
222
|
+
mutationObserverLight,
|
|
223
|
+
mutationObserverShadow,
|
|
224
|
+
mutationObserverThis
|
|
225
|
+
};
|
|
226
|
+
//# sourceMappingURL=mutationObserver.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/mutationObserver.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, SwcSelector, SwcFnSelector, HelperHostSet } from '../types';\n\n// \uACF5\uD1B5 \uC635\uC158 \u2014 root\u00B7delegate \uC5C6\uC74C (MutationObserverInit + filter/removeObserver)\nexport interface MutationObserverBaseOptions extends MutationObserverInit {\n filter?: (matchedEls: HTMLElement[], meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n // observer \uD574\uC81C(disconnected) \uC2DC \uD638\uCD9C\uB418\uB294 \uCF5C\uBC31. \uCCAB \uBC88\uC9F8 \uC778\uC790\uB294 observe\uB41C target element, \uB450 \uBC88\uC9F8\uB294 \uC0AC\uC6A9\uC790 \uC635\uC158 \uAC1D\uCCB4.\n removeObserver?: (target: Element, optionValue: MutationObserverQueryOptions) => void;\n}\n\n// \uBB38\uC790\uC5F4 \uC140\uB809\uD130 \uC804\uC6A9 \u2014 root\u00B7delegate \uD5C8\uC6A9 (\uC140\uB809\uD130\uB85C \uD0D0\uC0C9/\uB378\uB9AC\uAC8C\uC774\uC158)\nexport type MutationObserverQueryOptions = MutationObserverBaseOptions & SwcQueryOptions & { delegate?: boolean };\n// \uD568\uC218 \uC140\uB809\uD130 \uC804\uC6A9 \u2014 root\u00B7delegate \uAE08\uC9C0 (\uC774\uBBF8 \uC694\uC18C\uB97C \uC9C1\uC811 \uBC18\uD658)\nexport type MutationObserverNonQueryOptions = MutationObserverBaseOptions;\n\n// \uC140\uB809\uD130 \uC885\uB958\uC5D0 \uB530\uB77C \uC635\uC158 \uD0C0\uC785 \uBD84\uAE30\nexport type MutationObserverOptionsOf<S extends SwcSelector> = S extends string ? MutationObserverQueryOptions : MutationObserverNonQueryOptions;\n\nexport interface MutationObserverMetadata {\n propertyKey: string | symbol;\n selector: SwcSelector;\n options: MutationObserverQueryOptions;\n}\n\nexport const MUTATION_OBSERVER_METADATA_KEY = Symbol.for('simple-web-component:mutation-observer');\n\nexport function mutationObserver(target: SpecialSelector, options?: MutationObserverQueryOptions): MethodDecorator;\nexport function mutationObserver(selector: string, options?: MutationObserverQueryOptions): MethodDecorator;\nexport function mutationObserver(selector: SwcFnSelector, options?: MutationObserverNonQueryOptions): MethodDecorator;\nexport function mutationObserver(options?: MutationObserverQueryOptions): MethodDecorator;\n/**\n * @mutationObserver decorator to observe DOM mutations.\n */\nexport function mutationObserver(selectorOrOptions?: SwcSelector | MutationObserverQueryOptions, maybeOptions?: MutationObserverQueryOptions): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n let selector: SwcSelector = '$this';\n let options: MutationObserverQueryOptions = {};\n\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n selector = selectorOrOptions;\n options = maybeOptions ?? {};\n } else {\n selector = '$this';\n options = selectorOrOptions ?? {};\n }\n\n const constructor = targetObj.constructor;\n\n let observers = ReflectUtils.getMetadata<MutationObserverMetadata[]>(MUTATION_OBSERVER_METADATA_KEY, constructor);\n if (!observers) {\n observers = [];\n ReflectUtils.defineMetadata(MUTATION_OBSERVER_METADATA_KEY, observers, constructor);\n }\n\n observers.push({ propertyKey, selector, options });\n };\n}\n\nexport function mutationObserverThis<TEvent extends Event = Event>(options?: MutationObserverQueryOptions): MethodDecorator {\n return mutationObserver('$this', options);\n}\n\n// \u2500\u2500\u2500 root\uBCC4 delegate \uD5EC\uD37C (addEventListener\uC640 \uB3D9\uC77C \uD328\uD134) \u2500\u2500\u2500\n\nexport function mutationObserverDelegateLight(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateLight(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateLight(selectorOrOptions?: string | Omit<MutationObserverQueryOptions, 'root'>, maybeOptions?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'light', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'light', delegate: true});\n}\n\nexport function mutationObserverDelegateShadow(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateShadow(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateShadow(selectorOrOptions?: string | Omit<MutationObserverQueryOptions, 'root'>, maybeOptions?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'shadow', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'shadow', delegate: true});\n}\n\nexport function mutationObserverDelegateAll(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateAll(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateAll(selectorOrOptions?: string | Omit<MutationObserverQueryOptions, 'root'>, maybeOptions?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'all', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'all', delegate: true});\n}\n\nexport function mutationObserverDelegate(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegate(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegate(selectorOrOptions?: string | Omit<MutationObserverQueryOptions, 'root'>, maybeOptions?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'auto', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'auto', delegate: true});\n}\n\n// \u2500\u2500\u2500 root\uBCC4 \uC77C\uBC18 \uD5EC\uD37C (delegate \uC5C6\uC774, \uC140\uB809\uD130 \uC0DD\uB7B5 \uC2DC $this) \u2500\u2500\u2500\n\nexport function mutationObserverLight(selector: string, options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverLight(options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverLight(selectorOrOptions?: string | Omit<MutationObserverQueryOptions, 'root'>, maybeOptions?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'light'});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'light'});\n}\n\nexport function mutationObserverShadow(selector: string, options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverShadow(options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverShadow(selectorOrOptions?: string | Omit<MutationObserverQueryOptions, 'root'>, maybeOptions?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'shadow'});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'shadow'});\n}\n\nexport function mutationObserverAll(selector: string, options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverAll(options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverAll(selectorOrOptions?: string | Omit<MutationObserverQueryOptions, 'root'>, maybeOptions?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'all'});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'all'});\n}\n\nexport function getMutationObserverMetadata(target: any): MutationObserverMetadata[] | undefined {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(MUTATION_OBSERVER_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// MutationObserverLifeCycler\n// observer \uB97C \uC9C1\uC811 \uC0DD\uC131\uD558\uC9C0 \uC54A\uACE0 OnConnectedResult \uB97C \uBC18\uD658\uD55C\uB2E4.\n// elementDefine \uC774 \uC218\uC9D1\uB41C MutationObserverSet \uC73C\uB85C observer \uB97C \uC0DD\uC131\uD55C\uB2E4.\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, MutationObserverSet, MutationObserverSetEntry, ObserverObserveTarget, OnConnectedResult } from '../types';\nimport { SwcUtils } from '../utils/Utils';\n\nexport class MutationObserverLifeCycler implements ElementDefineLifeCycler {\n private readonly removeObserverCallbacksMap = new WeakMap<Element, Array<{ fn: (target: Element, opts: unknown) => void; target: any; opts: unknown }>>();\n\n onConnected(helperHostSet: HelperHostSet): OnConnectedResult | void {\n const inst = helperHostSet.$this;\n const currentWin = helperHostSet.$w;\n\n const removeObserverCallbacks: Array<{ fn: (target: Element, opts: unknown) => void; target: any; opts: unknown }> = [];\n this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);\n\n const allMeta = getMutationObserverMetadata(inst) ?? [];\n // \uCC98\uB9AC\uD560 \uBA54\uD0C0\uAC00 \uC5C6\uC73C\uBA74 observer \uBD88\uD544\uC694\n if (allMeta.length === 0) return;\n\n // \u2500\u2500 shadow / light \uB8E8\uD2B8\uBCC4 \uBD84\uB958 \u2500\u2500\n const shadowMetas = allMeta.filter(m => {\n const r = m.options.root || 'auto';\n return inst.shadowRoot && (r === 'shadow' || r === 'all' || r === 'auto');\n });\n const lightMetas = allMeta.filter(m => {\n const r = m.options.root || 'auto';\n return r === 'light' || r === 'all' || (!inst.shadowRoot && r === 'auto');\n });\n // \u2500\u2500 MutationObserverSet \uC0DD\uC131 \uD5EC\uD37C (\uB8E8\uD2B8\uBCC4) \u2500\u2500\n const buildSet = (\n root: HTMLElement | ShadowRoot,\n metas: MutationObserverMetadata[],\n ): { callback: MutationObserverSetEntry['callback']; observeTargets: ObserverObserveTarget<MutationObserverInit>[] } | null => {\n if (metas.length === 0) return null;\n\n const initFrom = (o: MutationObserverBaseOptions): MutationObserverInit => {\n const init: MutationObserverInit = {\n childList: o.childList, attributes: o.attributes, characterData: o.characterData,\n subtree: o.subtree, attributeFilter: o.attributeFilter,\n attributeOldValue: o.attributeOldValue, characterDataOldValue: o.characterDataOldValue,\n };\n if (!init.childList && !init.attributes && !init.characterData) init.childList = true;\n return init;\n };\n\n const fnObservedSets = new Map<MutationObserverMetadata, WeakSet<Element>>();\n\n const callback = (mutations: MutationRecord[], obs: MutationObserver) => {\n // \u2500\u2500 MutationObserver \uBA54\uD0C0 \uCF5C\uBC31 \u2500\u2500\n for (const meta of metas) {\n const { selector, options } = meta;\n let matchedEls: HTMLElement[] = [];\n\n const typeMatches = (m: MutationRecord): boolean => {\n const has = !!(options.childList || options.attributes || options.characterData);\n if (m.type === 'childList') return has ? !!options.childList : true;\n if (m.type === 'attributes') return !!options.attributes;\n if (m.type === 'characterData') return !!options.characterData;\n return true;\n };\n\n const collect = (matchesSel: (n: any) => boolean) =>\n mutations.flatMap(m => {\n if (!typeMatches(m)) return [];\n const els: HTMLElement[] = [];\n if (matchesSel(m.target)) els.push(m.target as HTMLElement);\n Array.from(m.addedNodes || []).filter(matchesSel).forEach(n => els.push(n as HTMLElement));\n Array.from(m.removedNodes || []).filter(matchesSel).forEach(n => els.push(n as HTMLElement));\n return els;\n });\n\n if (options.delegate && typeof selector === 'string') {\n const isThis = selector === '$this' || selector === '';\n matchedEls = collect(n => {\n if (!n || n.nodeType !== 1) return false;\n if (isThis) return true;\n const el = n as HTMLElement;\n return el.matches?.(selector) || !!el.closest?.(selector);\n });\n } else if (typeof selector === 'string') {\n const isThis = selector === '$this' || selector === '';\n matchedEls = collect(n => {\n if (!n || n.nodeType !== 1) return false;\n if (isThis) return true;\n return (n as HTMLElement).matches?.(selector);\n });\n } else if (typeof selector === 'function') {\n const set = fnObservedSets.get(meta);\n matchedEls = mutations.filter(m => typeMatches(m))\n .map(m => m.target as HTMLElement)\n .filter(t => t && t.nodeType === 1 && (set ? set.has(t) : false));\n } else {\n matchedEls = mutations.filter(m => typeMatches(m))\n .map(m => m.target as HTMLElement)\n .filter(t => t && t.nodeType === 1);\n }\n\n if (matchedEls.length === 0) continue;\n if (options.filter) {\n if (!options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;\n }\n const hostSet = SwcUtils.getHostSet(inst);\n inst[meta.propertyKey](matchedEls, mutations, obs, { ...hostSet, $root: root });\n }\n\n };\n\n // \u2500\u2500 observe \uB300\uC0C1 \uBAA9\uB85D \uAD6C\uC131 \u2500\u2500\n const observeTargets: ObserverObserveTarget<MutationObserverInit>[] = [];\n\n // delegate \uC788\uC73C\uBA74 \uB8E8\uD2B8 \uC804\uCCB4 subtree observe\n if (metas.some(m => m.options.delegate)) {\n observeTargets.push({ target: root, options: { childList: true, subtree: true } });\n }\n\n // non-delegate: \uC140\uB809\uD130 \uB9E4\uCE6D \uC694\uC18C \uC9C1\uC811 observe\n for (const m of metas.filter(m => !m.options.delegate)) {\n const { selector, options } = m;\n const mInit = initFrom(options);\n if (typeof selector === 'string') {\n if (selector === '$this' || selector === '') {\n observeTargets.push({ target: root, options: mInit });\n } else {\n root.querySelectorAll(selector).forEach(el => observeTargets.push({ target: el as Element, options: mInit }));\n }\n } else if (typeof selector === 'function') {\n const res = (selector as any)(inst, helperHostSet);\n let targets: HTMLElement[] = [];\n if (res instanceof currentWin.HTMLElement) targets = [res as HTMLElement];\n else if (res instanceof currentWin.NodeList) targets = Array.from(res as NodeList).filter((e: any) => e instanceof currentWin.HTMLElement) as HTMLElement[];\n else if (Array.isArray(res)) targets = res.filter((e: any) => e instanceof currentWin.HTMLElement) as HTMLElement[];\n const set = new WeakSet<Element>();\n for (const el of targets) { set.add(el); observeTargets.push({ target: el, options: mInit }); }\n fnObservedSets.set(m, set);\n }\n }\n\n // removeObserver \uCF5C\uBC31 \uC218\uC9D1\n for (const m of metas) {\n if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });\n }\n\n return { callback, observeTargets };\n };\n\n const shadowSet = inst.shadowRoot ? buildSet(inst.shadowRoot, shadowMetas) : null;\n const lightSet = buildSet(inst as any, lightMetas);\n\n // \uB450 \uB8E8\uD2B8\uC758 observe \uB300\uC0C1 + \uCF5C\uBC31\uC744 \uC5D4\uD2B8\uB9AC \uBC30\uC5F4(MutationObserverSet)\uB85C \uBCD1\uD569\n // \uAC19\uC740 \uB8E8\uD2B8\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4.\n const mutationObserverSet: MutationObserverSet = [\n ...(shadowSet?.observeTargets ?? []).map(t => ({ ...t, callback: shadowSet!.callback })),\n ...(lightSet?.observeTargets ?? []).map(t => ({ ...t, callback: lightSet!.callback })),\n ];\n if (mutationObserverSet.length === 0) return;\n\n return { mutationObserverSet };\n }\n\n onDisconnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {\n try { cb.fn(cb.target, cb.opts); } catch (e) { console.error('[SWC] removeObserver error:', e); }\n }\n this.removeObserverCallbacksMap.delete(inst);\n }\n}"],
|
|
5
|
+
"mappings": ";;;AAAA,SAAS,oBAAoB;AAwBtB,MAAM,iCAAiC,OAAO,IAAI,wCAAwC;AAS1F,SAAS,iBAAiB,mBAAgE,cAA8D;AAC7J,SAAO,CAAC,WAAmB,aAA8B,eAAmC;AAC1F,QAAI,WAAwB;AAC5B,QAAI,UAAwC,CAAC;AAE7C,QAAI,OAAO,sBAAsB,YAAY,OAAO,sBAAsB,YAAY;AACpF,iBA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