@dooboostore/simple-web-component 1.0.48 → 1.0.50
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 +189 -19
- package/dist/cjs/config/config.js +1 -1
- package/dist/cjs/config/config.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +2373 -30
- package/dist/cjs/decorators/addEventListener.js.map +3 -3
- package/dist/cjs/decorators/applyAttribute.js +31 -0
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +55 -18
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +73 -1
- package/dist/cjs/decorators/applyNode.js.map +3 -3
- package/dist/cjs/decorators/applyProperty.js +107 -3
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +6 -5
- package/dist/cjs/decorators/applySlot.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +42 -5
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/changedAttribute.js +61 -13
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +254 -439
- 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/eventMedia.js +84 -0
- package/dist/cjs/decorators/eventMedia.js.map +7 -0
- package/dist/cjs/decorators/index.js +6 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/intersectionObserver.js +200 -0
- package/dist/cjs/decorators/intersectionObserver.js.map +7 -0
- package/dist/cjs/decorators/mutationObserver.js +186 -55
- package/dist/cjs/decorators/mutationObserver.js.map +3 -3
- package/dist/cjs/decorators/parameter.js +73 -0
- package/dist/cjs/decorators/parameter.js.map +7 -0
- package/dist/cjs/decorators/query.js +117 -102
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/requestAnimationFrame.js +124 -0
- package/dist/cjs/decorators/requestAnimationFrame.js.map +7 -0
- package/dist/cjs/decorators/resizeObserver.js +133 -55
- package/dist/cjs/decorators/resizeObserver.js.map +2 -2
- package/dist/cjs/decorators/setInterval.js +114 -0
- package/dist/cjs/decorators/setInterval.js.map +7 -0
- package/dist/cjs/decorators/setTimeout.js +117 -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/elements/SwcAppMixin.js +19 -3
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/window.d.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 +2374 -30
- package/dist/esm/decorators/addEventListener.js.map +3 -3
- package/dist/esm/decorators/applyAttribute.js +31 -0
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +55 -18
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +73 -1
- package/dist/esm/decorators/applyNode.js.map +3 -3
- package/dist/esm/decorators/applyProperty.js +107 -3
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +6 -5
- package/dist/esm/decorators/applySlot.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +42 -5
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/changedAttribute.js +62 -13
- package/dist/esm/decorators/changedAttribute.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +261 -446
- 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/eventMedia.js +66 -0
- package/dist/esm/decorators/eventMedia.js.map +7 -0
- package/dist/esm/decorators/index.js +6 -1
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/intersectionObserver.js +182 -0
- package/dist/esm/decorators/intersectionObserver.js.map +7 -0
- package/dist/esm/decorators/mutationObserver.js +187 -55
- package/dist/esm/decorators/mutationObserver.js.map +3 -3
- package/dist/esm/decorators/parameter.js +54 -0
- package/dist/esm/decorators/parameter.js.map +7 -0
- package/dist/esm/decorators/query.js +117 -102
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/requestAnimationFrame.js +105 -0
- package/dist/esm/decorators/requestAnimationFrame.js.map +7 -0
- package/dist/esm/decorators/resizeObserver.js +134 -55
- package/dist/esm/decorators/resizeObserver.js.map +2 -2
- package/dist/esm/decorators/setInterval.js +95 -0
- package/dist/esm/decorators/setInterval.js.map +7 -0
- package/dist/esm/decorators/setTimeout.js +98 -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/elements/SwcAppMixin.js +20 -4
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +4961 -1628
- 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 +1046 -33
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +24 -34
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +36 -34
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +32 -20
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +61 -34
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +27 -12
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/changedAttribute.d.ts +12 -3
- 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/eventMedia.d.ts +25 -0
- package/dist/types/decorators/eventMedia.d.ts.map +1 -0
- package/dist/types/decorators/index.d.ts +6 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/intersectionObserver.d.ts +58 -0
- package/dist/types/decorators/intersectionObserver.d.ts.map +1 -0
- package/dist/types/decorators/mutationObserver.d.ts +44 -25
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -1
- package/dist/types/decorators/parameter.d.ts +35 -0
- package/dist/types/decorators/parameter.d.ts.map +1 -0
- package/dist/types/decorators/query.d.ts +57 -14
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/requestAnimationFrame.d.ts +47 -0
- package/dist/types/decorators/requestAnimationFrame.d.ts.map +1 -0
- package/dist/types/decorators/resizeObserver.d.ts +43 -23
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -1
- package/dist/types/decorators/setInterval.d.ts +41 -0
- package/dist/types/decorators/setInterval.d.ts.map +1 -0
- package/dist/types/decorators/setTimeout.d.ts +41 -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/elements/SwcAppMixin.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 +4961 -1628
- 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 +1446 -34
- package/src/decorators/applyAttribute.ts +60 -36
- package/src/decorators/applyClass.ts +86 -26
- package/src/decorators/applyNode.ts +124 -36
- package/src/decorators/applyProperty.ts +172 -40
- package/src/decorators/applySlot.ts +6 -5
- package/src/decorators/applyStyle.ts +74 -17
- package/src/decorators/changedAttribute.ts +76 -15
- package/src/decorators/elementDefine.ts +310 -582
- package/src/decorators/emitCustomEvent.ts +73 -5
- package/src/decorators/eventMedia.ts +78 -0
- package/src/decorators/index.ts +6 -1
- package/src/decorators/intersectionObserver.ts +275 -0
- package/src/decorators/mutationObserver.ts +282 -89
- package/src/decorators/parameter.ts +81 -0
- package/src/decorators/query.ts +168 -126
- package/src/decorators/requestAnimationFrame.ts +158 -0
- package/src/decorators/resizeObserver.ts +211 -89
- package/src/decorators/setInterval.ts +136 -0
- package/src/decorators/setTimeout.ts +139 -0
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +17 -0
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +19 -0
- package/src/elements/SwcAppMixin.ts +20 -5
- package/src/types/index.ts +141 -0
- package/src/types/window.d.ts +2 -18
- package/dist/cjs/decorators/queryAll.js +0 -181
- package/dist/cjs/decorators/queryAll.js.map +0 -7
- package/dist/cjs/examples/RxJSOperatorsExample.js +0 -285
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +0 -7
- package/dist/esm/decorators/queryAll.js +0 -162
- package/dist/esm/decorators/queryAll.js.map +0 -7
- package/dist/esm/examples/RxJSOperatorsExample.js +0 -266
- package/dist/esm/examples/RxJSOperatorsExample.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/examples/RxJSOperatorsExample.d.ts +0 -94
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +0 -1
- package/src/decorators/queryAll.ts +0 -186
- package/src/examples/RxJSOperatorsExample.ts +0 -279
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ReflectUtils } from "@dooboostore/core";
|
|
2
|
+
import { ensureInit, getElementConfig } from "./elementDefine.js";
|
|
3
|
+
import { SwcUtils } from "../utils/Utils.js";
|
|
4
|
+
const SET_TIMEOUT_METADATA_KEY = Symbol.for("simple-web-component:set-timeout");
|
|
5
|
+
const activeMap = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
const getActiveEntries = (inst) => {
|
|
7
|
+
let entries = activeMap.get(inst);
|
|
8
|
+
if (!entries) {
|
|
9
|
+
entries = [];
|
|
10
|
+
activeMap.set(inst, entries);
|
|
11
|
+
}
|
|
12
|
+
return entries;
|
|
13
|
+
};
|
|
14
|
+
function setTimeout(delay, options = {}) {
|
|
15
|
+
return (target, propertyKey, descriptor) => {
|
|
16
|
+
const constructor = target.constructor;
|
|
17
|
+
const normalizedOptions = { ...options, type: options.type ?? "returnValue" };
|
|
18
|
+
let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor);
|
|
19
|
+
if (!metaList) {
|
|
20
|
+
metaList = [];
|
|
21
|
+
ReflectUtils.defineMetadata(SET_TIMEOUT_METADATA_KEY, metaList, constructor);
|
|
22
|
+
}
|
|
23
|
+
metaList.push({ propertyKey, delay, options: normalizedOptions });
|
|
24
|
+
if (normalizedOptions.type === "onConnected" || !descriptor) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const original = descriptor.value;
|
|
28
|
+
descriptor.value = function(...args) {
|
|
29
|
+
const res = original.apply(this, args);
|
|
30
|
+
const vk = normalizedOptions.valueKey ?? SET_TIMEOUT_METADATA_KEY;
|
|
31
|
+
const tickFn = typeof res === "function" ? res : res && typeof res === "object" && typeof res[vk] === "function" ? res[vk] : void 0;
|
|
32
|
+
if (tickFn) {
|
|
33
|
+
ensureInit(this);
|
|
34
|
+
const conf = getElementConfig(this);
|
|
35
|
+
const win = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
36
|
+
const id = win.setTimeout(() => {
|
|
37
|
+
const entries = getActiveEntries(this);
|
|
38
|
+
const idx = entries.indexOf(id);
|
|
39
|
+
if (idx >= 0) entries.splice(idx, 1);
|
|
40
|
+
try {
|
|
41
|
+
tickFn(id);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
console.error("[SWC] setTimeout fire error:", e);
|
|
44
|
+
}
|
|
45
|
+
}, delay);
|
|
46
|
+
normalizedOptions.created?.(SwcUtils.getHelperAndHostSet(win, this), id);
|
|
47
|
+
getActiveEntries(this).push(id);
|
|
48
|
+
}
|
|
49
|
+
return res;
|
|
50
|
+
};
|
|
51
|
+
return descriptor;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const findAllSetTimeoutMetadata = (target) => {
|
|
55
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
56
|
+
return (ReflectUtils.findAllMetadata(SET_TIMEOUT_METADATA_KEY, constructor) || []).flat();
|
|
57
|
+
};
|
|
58
|
+
class SetTimeoutLifeCycler {
|
|
59
|
+
onConnected(helperHostSet) {
|
|
60
|
+
const inst = helperHostSet.$this;
|
|
61
|
+
activeMap.delete(inst);
|
|
62
|
+
for (const meta of findAllSetTimeoutMetadata(inst)) {
|
|
63
|
+
if (meta.options.type !== "onConnected") continue;
|
|
64
|
+
const id = helperHostSet.$w.setTimeout(() => {
|
|
65
|
+
const args = meta.options.parameter?.(helperHostSet) ?? [];
|
|
66
|
+
try {
|
|
67
|
+
const res = inst[meta.propertyKey](...args);
|
|
68
|
+
const vk = meta.options.valueKey ?? SET_TIMEOUT_METADATA_KEY;
|
|
69
|
+
if (res && typeof res === "object" && typeof res[vk] === "function") {
|
|
70
|
+
res[vk](id);
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.error("[SWC] setTimeout fire error:", e);
|
|
74
|
+
}
|
|
75
|
+
}, meta.delay);
|
|
76
|
+
meta.options.created?.(helperHostSet, id);
|
|
77
|
+
getActiveEntries(inst).push(id);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
onDisconnected(helperHostSet) {
|
|
81
|
+
const inst = helperHostSet.$this;
|
|
82
|
+
for (const id of activeMap.get(inst) ?? []) {
|
|
83
|
+
try {
|
|
84
|
+
helperHostSet.$w.clearTimeout(id);
|
|
85
|
+
} catch (e) {
|
|
86
|
+
console.error("[SWC] clearTimeout error:", e);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
activeMap.delete(inst);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
SET_TIMEOUT_METADATA_KEY,
|
|
94
|
+
SetTimeoutLifeCycler,
|
|
95
|
+
findAllSetTimeoutMetadata,
|
|
96
|
+
setTimeout
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=setTimeout.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/setTimeout.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit, getElementConfig } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { ElementDefineLifeCycler, HelperHostSet } from '../types';\n\nexport const SET_TIMEOUT_METADATA_KEY = Symbol.for('simple-web-component:set-timeout');\n\nexport type SetTimeoutType = 'onConnected' | 'returnValue';\n\nexport interface SetTimeoutOptions {\n /**\n * 'onConnected' (connect \uC2DC \uC790\uB3D9\uC73C\uB85C \uC608\uC57D, disconnect \uC2DC \uC790\uB3D9 \uC815\uB9AC) |\n * 'returnValue' (\uAE30\uBCF8\uAC12 - \uC790\uB3D9 \uC608\uC57D \uC5C6\uC74C. \uAC1C\uBC1C\uC790\uAC00 \uC774 \uBA54\uC11C\uB4DC\uB97C \uC9C1\uC811 \uD638\uCD9C\uD574\uC57C \uC608\uC57D\uB418\uACE0,\n * \uADF8 \uD638\uCD9C\uC758 \uB9AC\uD134\uAC12\uC774 \uC2E4\uC81C\uB85C \uC2E4\uD589\uB420 \uD568\uC218\uAC00 \uB41C\uB2E4 - \uC544\uB798 \uC124\uBA85 \uCC38\uACE0).\n */\n type?: SetTimeoutType;\n /** \uC2E4\uD589 \uC2DC \uB370\uCF54\uB808\uC774\uD2B8\uB41C \uBA54\uC11C\uB4DC\uC5D0 \uB118\uAE38 \uC778\uC790\uB97C \uACC4\uC0B0. type:'onConnected'\uC5D0\uC11C\uB9CC \uC758\uBBF8\uAC00 \uC788\uC74C (\uC5C6\uC73C\uBA74 \uC778\uC790 \uC5C6\uC774 \uD638\uCD9C). */\n parameter?: (set: HelperHostSet) => any[];\n /** \uD0C0\uC774\uBA38 \uB4F1\uB85D \uC9C1\uD6C4 1\uD68C \uD638\uCD9C (\uB514\uBC84\uAE45/\uB85C\uAE45\uC6A9). id\uB294 \uC2E4\uC81C setTimeout \uBC18\uD658\uAC12 - cleanup\uC740 \uC790\uB3D9\uC73C\uB85C \uCC98\uB9AC\uB418\uBBC0\uB85C \uC9C1\uC811 clear\uD560 \uD544\uC694 \uC5C6\uC74C. */\n created?: (set: HelperHostSet, id: number) => void;\n /**\n * type:'onConnected' - fire \uC2DC \uB370\uCF54\uB808\uC774\uD2B8\uB41C \uBA54\uC11C\uB4DC\uC758 \uB9AC\uD134\uAC12\uC774 \uAC1D\uCCB4\uC774\uACE0 \uC774 \uD0A4\uC758 \uAC12\uC774 \uD568\uC218\uC774\uBA74 (id: number)\uB85C \uD638\uCD9C\uD55C\uB2E4.\n * type:'returnValue' - \uB9AC\uD134\uAC12\uC774 \uD568\uC218\uBA74 \uADF8 \uC790\uCCB4\uB97C, \uAC1D\uCCB4\uBA74 \uC774 \uD0A4\uC758 \uAC12\uC774 \uD568\uC218\uC77C \uB54C \uADF8 \uAC12\uC744 \"\uC2E4\uC81C\uB85C \uC2E4\uD589\uB420 \uD568\uC218\"\uB85C \uC0AC\uC6A9\uD55C\uB2E4.\n * \uC548 \uC8FC\uBA74 SET_TIMEOUT_METADATA_KEY\uB85C \uD3F4\uBC31\uD55C\uB2E4 - applyAttribute.ts/applyNode.ts\uC758 valueKey\uC640 \uB3D9\uC77C\uD55C \uCEE8\uBCA4\uC158\n * (\uB9AC\uD134 \uAC1D\uCCB4\uC5D0\uC11C \uC774 \uB370\uCF54\uB808\uC774\uD130 \uBAAB\uB9CC \uBF51\uC544 \uC4F0\uACE0, \uB2E4\uB978 \uB370\uCF54\uB808\uC774\uD130\uC640 \uC2A4\uD0DD\uD560 \uB54C\uB9CC \uCEE4\uC2A4\uD140 \uD0A4\uB85C \uAD6C\uBD84\uD558\uBA74 \uB41C\uB2E4).\n */\n valueKey?: symbol | string;\n}\n\nexport interface SetTimeoutMetadata {\n propertyKey: string | symbol;\n delay: number;\n options: SetTimeoutOptions;\n}\n\nconst activeMap = new WeakMap<any, number[]>();\nconst getActiveEntries = (inst: any): number[] => {\n let entries = activeMap.get(inst);\n if (!entries) {\n entries = [];\n activeMap.set(inst, entries);\n }\n return entries;\n};\n\n/**\n * type:'onConnected' - connect \uC2DC \uC790\uB3D9\uC73C\uB85C setTimeout\uC744 \uAC78\uACE0, disconnect \uC2DC (\uC544\uC9C1 \uC2E4\uD589 \uC804\uC774\uB77C\uBA74) \uC790\uB3D9\uC73C\uB85C clearTimeout \uD55C\uB2E4.\n * type:'returnValue'(\uAE30\uBCF8\uAC12) - \uBA54\uC11C\uB4DC\uB97C \uAC10\uC2F8\uC9C0 \uC54A\uB294 \uB300\uC2E0, \uD638\uCD9C\uB420 \uB54C\uB9C8\uB2E4(\uAC1C\uBC1C\uC790\uAC00 \uC9C1\uC811 \uD638\uCD9C) \uC6D0\uBCF8 \uB85C\uC9C1\uC744\n * \uADF8\uB300\uB85C \uC2E4\uD589\uD558\uACE0 \uB9AC\uD134\uAC12(\uB610\uB294 valueKey\uB85C \uBF51\uC740 \uAC12)\uC774 \uD568\uC218\uBA74 \uADF8 \uD568\uC218\uB97C \uC0C8 setTimeout\uC73C\uB85C \uC608\uC57D\uD55C\uB2E4.\n * \uD638\uCD9C\uD560 \uB54C\uB9C8\uB2E4 \uBCC4\uB3C4\uC758 \uC0C8 \uD0C0\uC774\uBA38\uAC00 \uC0DD\uAE30\uBA70, disconnect \uC2DC (\uC544\uC9C1 \uC2E4\uD589 \uC804\uC778 \uAC83\uB4E4\uC740) \uC804\uBD80 \uC815\uB9AC\uB41C\uB2E4.\n * \uC6D0\uBCF8 \uB9AC\uD134\uAC12\uC740 \uADF8\uB300\uB85C \uD1B5\uACFC\uC2DC\uD0A4\uBBC0\uB85C \uB2E4\uB978 \uB370\uCF54\uB808\uC774\uD130\uC640 \uAC19\uC740 \uBA54\uC11C\uB4DC\uC5D0 \uC2A4\uD0DD\uD574\uB3C4 \uC21C\uC11C\uC5D0 \uC0C1\uAD00\uC5C6\uC774 \uC548\uC804\uD558\uB2E4.\n */\nexport function setTimeout(delay: number, options: SetTimeoutOptions = {}): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n const normalizedOptions: SetTimeoutOptions = { ...options, type: options.type ?? 'returnValue' };\n\n let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor) as SetTimeoutMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(SET_TIMEOUT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({ propertyKey, delay, options: normalizedOptions });\n\n if (normalizedOptions.type === 'onConnected' || !descriptor) {\n return; // LifeCycler\uAC00 connect/disconnect\uB97C \uC804\uB2F4 - wrapping \uBD88\uD544\uC694\n }\n\n const original = descriptor.value;\n descriptor.value = function (this: any, ...args: any[]) {\n const res = original.apply(this, args);\n // valueKey\uB97C \uC548 \uC8FC\uBA74 \uC774 \uB370\uCF54\uB808\uC774\uD130 \uC804\uC6A9 METADATA_KEY\uB85C \uD3F4\uBC31 (applyAttribute.ts/applyNode.ts\uC640 \uB3D9\uC77C\uD55C \uCEE8\uBCA4\uC158)\n const vk = normalizedOptions.valueKey ?? SET_TIMEOUT_METADATA_KEY;\n const tickFn: ((id: number) => void) | undefined =\n typeof res === 'function' ? res : res && typeof res === 'object' && typeof res[vk] === 'function' ? res[vk] : undefined;\n\n if (tickFn) {\n ensureInit(this);\n const conf = getElementConfig(this);\n const win = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);\n const id = win.setTimeout(() => {\n const entries = getActiveEntries(this);\n const idx = entries.indexOf(id);\n if (idx >= 0) entries.splice(idx, 1);\n try {\n tickFn(id);\n } catch (e) {\n console.error('[SWC] setTimeout fire error:', e);\n }\n }, delay);\n normalizedOptions.created?.(SwcUtils.getHelperAndHostSet(win, this), id);\n getActiveEntries(this).push(id);\n }\n return res;\n };\n return descriptor;\n };\n}\n\nexport const findAllSetTimeoutMetadata = (target: any): SetTimeoutMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return (ReflectUtils.findAllMetadata<SetTimeoutMetadata[]>(SET_TIMEOUT_METADATA_KEY, constructor) || []).flat();\n};\n\nexport class SetTimeoutLifeCycler implements ElementDefineLifeCycler {\n onConnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n activeMap.delete(inst); // \uC7AC\uC5F0\uACB0 \uB300\uBE44 \uB9AC\uC14B\n for (const meta of findAllSetTimeoutMetadata(inst)) {\n if (meta.options.type !== 'onConnected') continue; // returnValue \uD0C0\uC785\uC740 \uC218\uB3D9 \uD638\uCD9C\uC744 \uAE30\uB2E4\uB9BC\n const id = helperHostSet.$w.setTimeout(() => {\n const args = meta.options.parameter?.(helperHostSet) ?? [];\n try {\n const res = inst[meta.propertyKey](...args);\n const vk = meta.options.valueKey ?? SET_TIMEOUT_METADATA_KEY;\n if (res && typeof res === 'object' && typeof res[vk] === 'function') {\n res[vk](id);\n }\n } catch (e) {\n console.error('[SWC] setTimeout fire error:', e);\n }\n }, meta.delay);\n meta.options.created?.(helperHostSet, id);\n getActiveEntries(inst).push(id);\n }\n }\n\n onDisconnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n for (const id of activeMap.get(inst) ?? []) {\n try {\n helperHostSet.$w.clearTimeout(id);\n } catch (e) {\n console.error('[SWC] clearTimeout error:', e);\n }\n }\n activeMap.delete(inst);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,wBAAwB;AAC7C,SAAS,gBAAgB;AAGlB,MAAM,2BAA2B,OAAO,IAAI,kCAAkC;AA8BrF,MAAM,YAAY,oBAAI,QAAuB;AAC7C,MAAM,mBAAmB,CAAC,SAAwB;AAChD,MAAI,UAAU,UAAU,IAAI,IAAI;AAChC,MAAI,CAAC,SAAS;AACZ,cAAU,CAAC;AACX,cAAU,IAAI,MAAM,OAAO;AAAA,EAC7B;AACA,SAAO;AACT;AASO,SAAS,WAAW,OAAe,UAA6B,CAAC,GAAoB;AAC1F,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,OAAO;AAC3B,UAAM,oBAAuC,EAAE,GAAG,SAAS,MAAM,QAAQ,QAAQ,cAAc;AAE/F,QAAI,WAAW,aAAa,eAAe,0BAA0B,WAAW;AAChF,QAAI,CAAC,UAAU;AACb,i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AAc;AAC3B,cAAU,OAAO,IAAI;AACrB,eAAW,QAAQ,0BAA0B,IAAI,GAAG;AAClD,UAAI,KAAK,QAAQ,SAAS,cAAe;AACzC,YAAM,KAAK,cAAc,GAAG,WAAW,MAAM;AAC3C,cAAM,OAAO,KAAK,QAAQ,YAAY,aAAa,KAAK,CAAC;AACzD,YAAI;AACF,gBAAM,MAAM,KAAK,KAAK,WAAW,EAAE,GAAG,IAAI;AAC1C,gBAAM,KAAK,KAAK,QAAQ,YAAY;AACpC,cAAI,OAAO,OAAO,QAAQ,YAAY,OAAO,IAAI,EAAE,MAAM,YAAY;AACnE,gBAAI,EAAE,EAAE,EAAE;AAAA,UACZ;AAAA,QACF,SAAS,GAAG;AACV,kBAAQ,MAAM,gCAAgC,CAAC;AAAA,QACjD;AAAA,MACF,GAAG,KAAK,KAAK;AACb,WAAK,QAAQ,UAAU,eAAe,EAAE;AACxC,uBAAiB,IAAI,EAAE,KAAK,EAAE;AAAA,IAChC;AAAA,EACF;AAAA,EAEA,eAAe,eAAoC;AACjD,UAAM,OAAO,cAAc;AAC3B,eAAW,MAAM,UAAU,IAAI,IAAI,KAAK,CAAC,GAAG;AAC1C,UAAI;AACF,sBAAc,GAAG,aAAa,EAAE;AAAA,MAClC,SAAS,GAAG;AACV,gBAAQ,MAAM,6BAA6B,CAAC;AAAA,MAC9C;AAAA,IACF;AACA,cAAU,OAAO,IAAI;AAAA,EACvB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -36,7 +36,16 @@ const getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
|
|
|
36
36
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
37
37
|
return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
38
38
|
};
|
|
39
|
+
class MessageSubscribeLifeCycler {
|
|
40
|
+
onConnected(_helperHostSet) {
|
|
41
|
+
}
|
|
42
|
+
/** SwcAppMixin 이 구독 대상 메타를 꺼낼 때 사용 */
|
|
43
|
+
getMetadata(helperHostSet) {
|
|
44
|
+
return getSubscribeSwcAppMessageWhileConnectedMetadata(helperHostSet.$this);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
export {
|
|
48
|
+
MessageSubscribeLifeCycler,
|
|
40
49
|
SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY,
|
|
41
50
|
getSubscribeSwcAppMessageWhileConnectedMetadata,
|
|
42
51
|
receiveMessage,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/subscribeSwcAppMessageWhileConnected.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message-while-connected');\n\nexport interface SwcAppMessageSubscriberMetadata {\n propertyKey: string | symbol;\n messageType?: string;\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nexport interface SwcAppMessageOptions {\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nfunction createSubscribeSwcAppMessageWhileConnected(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessageWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(options: SwcAppMessageOptions): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessageWhileConnected(messageType: string, options: SwcAppMessageOptions): MethodDecorator;\n\nexport function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessageWhileConnected\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected('messageType') \uB610\uB294 @subscribeSwcAppMessageWhileConnected('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessageWhileConnected(options, messageType);\n}\n\nexport const receiveMessage = subscribeSwcAppMessageWhileConnected;\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageWhileConnectedMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n};\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAGtB,MAAM,yDAAyD,OAAO,IAAI,gEAAgE;AAYjJ,SAAS,2CAA2C,SAAgC,aAAuC;AACzH,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,eAAe,wDAAwD,WAAW;AAC1G,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,wDAAwD,MAAM,WAAW;AAAA,IACvG;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,OAAO,CAAC;AAE9C,WAAO;AAAA,EACT;AACF;AAWO,SAAS,qCAAqC,8BAAoC,sBAA4B,YAAsC;AAEzJ,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,2CAA2C,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACvF;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,2CAA2C,SAAS,WAAW;AACxE;AAEO,MAAM,iBAAiB;AAEvB,MAAM,kDAAkD,CAAC,WAA+D;AAC7H,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,eAAe,wDAAwD,WAAW;AACxG;",
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message-while-connected');\n\nexport interface SwcAppMessageSubscriberMetadata {\n propertyKey: string | symbol;\n messageType?: string;\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nexport interface SwcAppMessageOptions {\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nfunction createSubscribeSwcAppMessageWhileConnected(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessageWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(options: SwcAppMessageOptions): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessageWhileConnected(messageType: string, options: SwcAppMessageOptions): MethodDecorator;\n\nexport function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessageWhileConnected\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected('messageType') \uB610\uB294 @subscribeSwcAppMessageWhileConnected('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessageWhileConnected(options, messageType);\n}\n\nexport const receiveMessage = subscribeSwcAppMessageWhileConnected;\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageWhileConnectedMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_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// MessageSubscribeLifeCycler\n// NOTE: \uC2E4\uC81C \uAD6C\uB3C5 \uB85C\uC9C1\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\uB41C\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 } from '../types';\n\nexport class MessageSubscribeLifeCycler implements ElementDefineLifeCycler {\n onConnected(_helperHostSet: HelperHostSet): void {\n // \uC2E4\uC81C \uAD6C\uB3C5\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\n }\n\n /** SwcAppMixin \uC774 \uAD6C\uB3C5 \uB300\uC0C1 \uBA54\uD0C0\uB97C \uAEBC\uB0BC \uB54C \uC0AC\uC6A9 */\n getMetadata(helperHostSet: HelperHostSet): SwcAppMessageSubscriberMetadata[] | undefined {\n return getSubscribeSwcAppMessageWhileConnectedMetadata(helperHostSet.$this);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAGtB,MAAM,yDAAyD,OAAO,IAAI,gEAAgE;AAYjJ,SAAS,2CAA2C,SAAgC,aAAuC;AACzH,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,eAAe,wDAAwD,WAAW;AAC1G,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,wDAAwD,MAAM,WAAW;AAAA,IACvG;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,OAAO,CAAC;AAE9C,WAAO;AAAA,EACT;AACF;AAWO,SAAS,qCAAqC,8BAAoC,sBAA4B,YAAsC;AAEzJ,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,2CAA2C,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACvF;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,2CAA2C,SAAS,WAAW;AACxE;AAEO,MAAM,iBAAiB;AAEvB,MAAM,kDAAkD,CAAC,WAA+D;AAC7H,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,eAAe,wDAAwD,WAAW;AACxG;AAQO,MAAM,2BAA8D;AAAA,EACzE,YAAY,gBAAqC;AAAA,EAEjD;AAAA;AAAA,EAGA,YAAY,eAA6E;AACvF,WAAO,gDAAgD,cAAc,KAAK;AAAA,EAC5E;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,7 +41,16 @@ const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
|
|
|
41
41
|
if (!results) return [];
|
|
42
42
|
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
43
43
|
};
|
|
44
|
+
class RouteSubscribeLifeCycler {
|
|
45
|
+
onConnected(_helperHostSet) {
|
|
46
|
+
}
|
|
47
|
+
/** SwcAppMixin 이 구독 대상 메타를 꺼낼 때 사용 */
|
|
48
|
+
getMetadata(helperHostSet) {
|
|
49
|
+
return getSubscribeSwcAppRouteChangeWhileConnectedMetadata(helperHostSet.$this);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
44
52
|
export {
|
|
53
|
+
RouteSubscribeLifeCycler,
|
|
45
54
|
SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY,
|
|
46
55
|
changedRoute,
|
|
47
56
|
getSubscribeSwcAppRouteChangeWhileConnectedMetadata,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts"],
|
|
4
|
-
"sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {Router} from '@dooboostore/core-web';\nimport {HelperHostSet} from '../types';\n\nexport const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-route-change-while-connected');\n\nexport type RoutePathType = string | string[] | ((currentThis: any) => string | string[]);\n\nexport interface SwcAppRouteChangeSubscriberMetadata {\n propertyKey: string | symbol;\n options?: SwcAppRouteChangeOptions;\n}\n\nexport interface SwcAppRouteChangeOptions {\n path?: RoutePathType;\n filter?: (router: Router, meta: { currentThis: any; helper: HelperHostSet }) => boolean;\n order?: number;\n valueKey?: symbol | string;\n}\n\nfunction createSubscribeSwcAppRouteChangeWhileConnected(options?: SwcAppRouteChangeOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const pathPattern = options?.path;\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppRouteChangeSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType, config: Omit<SwcAppRouteChangeOptions, 'path'>): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(options: SwcAppRouteChangeOptions): MethodDecorator;\n\n// \uC2E4\uC81C \uAD6C\uD604 (\uC774\uC911 \uBAA8\uB4DC)\nexport function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions?: any, propertyKeyOrConfig?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppRouteChangeWhileConnected\n // propertyKey\uAC00 string | symbol\uC774\uACE0 descriptor\uAC00 \uC788\uC73C\uBA74 \uC9C1\uC811 \uC0AC\uC6A9\n if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === 'string' || typeof propertyKeyOrConfig === 'symbol')) {\n return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @subscribeSwcAppRouteChangeWhileConnected() / @subscribeSwcAppRouteChangeWhileConnected('/path')\n let options: SwcAppRouteChangeOptions = {};\n\n if (Array.isArray(targetOrOptions)) {\n // \uBC30\uC5F4: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'])\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'], { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'function') {\n // \uBB38\uC790\uC5F4 \uB610\uB294 \uD568\uC218: @subscribeSwcAppRouteChangeWhileConnected('/path')\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected('/path', { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // \uAC1D\uCCB4: @subscribeSwcAppRouteChangeWhileConnected({ path: '/path', filter: ..., order: 1 })\n options = targetOrOptions;\n }\n\n return createSubscribeSwcAppRouteChangeWhileConnected(options);\n}\nexport const changedRoute = subscribeSwcAppRouteChangeWhileConnected;\n\n// Helper function to retrieve route change subscribers metadata\nexport const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target: any): SwcAppRouteChangeSubscriberMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n if (!results) return [];\n \n // Sort by order (default 0 if not specified)\n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AO;AACjE,QAAM,UAAU,aAAa,eAAe,6DAA6D,WAAW;AACpH,MAAI,CAAC,QAAS,QAAO,CAAC;AAGtB,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,EAAE;AACtF;",
|
|
4
|
+
"sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {Router} from '@dooboostore/core-web';\nimport {HelperHostSet} from '../types';\n\nexport const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-route-change-while-connected');\n\nexport type RoutePathType = string | string[] | ((currentThis: any) => string | string[]);\n\nexport interface SwcAppRouteChangeSubscriberMetadata {\n propertyKey: string | symbol;\n options?: SwcAppRouteChangeOptions;\n}\n\nexport interface SwcAppRouteChangeOptions {\n path?: RoutePathType;\n filter?: (router: Router, meta: { currentThis: any; helper: HelperHostSet }) => boolean;\n order?: number;\n valueKey?: symbol | string;\n}\n\nfunction createSubscribeSwcAppRouteChangeWhileConnected(options?: SwcAppRouteChangeOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const pathPattern = options?.path;\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppRouteChangeSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType, config: Omit<SwcAppRouteChangeOptions, 'path'>): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(options: SwcAppRouteChangeOptions): MethodDecorator;\n\n// \uC2E4\uC81C \uAD6C\uD604 (\uC774\uC911 \uBAA8\uB4DC)\nexport function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions?: any, propertyKeyOrConfig?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppRouteChangeWhileConnected\n // propertyKey\uAC00 string | symbol\uC774\uACE0 descriptor\uAC00 \uC788\uC73C\uBA74 \uC9C1\uC811 \uC0AC\uC6A9\n if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === 'string' || typeof propertyKeyOrConfig === 'symbol')) {\n return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @subscribeSwcAppRouteChangeWhileConnected() / @subscribeSwcAppRouteChangeWhileConnected('/path')\n let options: SwcAppRouteChangeOptions = {};\n\n if (Array.isArray(targetOrOptions)) {\n // \uBC30\uC5F4: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'])\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'], { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'function') {\n // \uBB38\uC790\uC5F4 \uB610\uB294 \uD568\uC218: @subscribeSwcAppRouteChangeWhileConnected('/path')\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected('/path', { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // \uAC1D\uCCB4: @subscribeSwcAppRouteChangeWhileConnected({ path: '/path', filter: ..., order: 1 })\n options = targetOrOptions;\n }\n\n return createSubscribeSwcAppRouteChangeWhileConnected(options);\n}\nexport const changedRoute = subscribeSwcAppRouteChangeWhileConnected;\n\n// Helper function to retrieve route change subscribers metadata\nexport const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target: any): SwcAppRouteChangeSubscriberMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n if (!results) return [];\n \n // Sort by order (default 0 if not specified)\n return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));\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// RouteSubscribeLifeCycler\n// NOTE: \uC2E4\uC81C \uAD6C\uB3C5 \uB85C\uC9C1\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\uB41C\uB2E4.\n// \uC774 cycler \uB294 \uBA54\uD0C0\uB370\uC774\uD130 \uC811\uADFC \uC9C4\uC785\uC810 \uC5ED\uD560\uB9CC \uD558\uBA70,\n// \uD5A5\uD6C4 SwcAppMixin \uC5D0\uC11C \uB85C\uC9C1\uC744 \uBD84\uB9AC\uD560 \uB54C \uC774 \uD074\uB798\uC2A4\uB85C \uC774\uC804\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 } from '../types';\n\nexport class RouteSubscribeLifeCycler implements ElementDefineLifeCycler {\n onConnected(_helperHostSet: HelperHostSet): void {\n // \uC2E4\uC81C \uAD6C\uB3C5\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\n }\n\n /** SwcAppMixin \uC774 \uAD6C\uB3C5 \uB300\uC0C1 \uBA54\uD0C0\uB97C \uAEBC\uB0BC \uB54C \uC0AC\uC6A9 */\n getMetadata(helperHostSet: HelperHostSet): SwcAppRouteChangeSubscriberMetadata[] {\n return getSubscribeSwcAppRouteChangeWhileConnectedMetadata(helperHostSet.$this);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAQ,oBAAmB;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AAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,EAAE;AACtF;AAUO,MAAM,yBAA4D;AAAA,EACvE,YAAY,gBAAqC;AAAA,EAEjD;AAAA;AAAA,EAGA,YAAY,eAAqE;AAC/E,WAAO,oDAAoD,cAAc,KAAK;AAAA,EAChF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY, SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY } from "../decorators/index.js";
|
|
4
|
+
import { findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY, SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, buildSwcParameterArgs } from "../decorators/index.js";
|
|
5
5
|
import { SwcAppEngine } from "../SwcAppEngine.js";
|
|
6
6
|
import { debounceTimeIntervalLock, FunctionUtils } from "@dooboostore/core";
|
|
7
7
|
import { ValidUtils } from "@dooboostore/core-web";
|
|
@@ -63,7 +63,6 @@ function SwcAppMixin(Base) {
|
|
|
63
63
|
try {
|
|
64
64
|
const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
|
|
65
65
|
if (routeChangeSubscribers.length > 0) {
|
|
66
|
-
console.log("[SWC-MIXIN] Route change subscribers found");
|
|
67
66
|
for (const metadata of routeChangeSubscribers) {
|
|
68
67
|
const methodName = metadata.propertyKey;
|
|
69
68
|
let pathPattern = metadata.options?.path;
|
|
@@ -99,7 +98,16 @@ function SwcAppMixin(Base) {
|
|
|
99
98
|
const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
|
|
100
99
|
const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
|
|
101
100
|
if (pathMatched && filterPassed && instance[methodName]) {
|
|
102
|
-
const
|
|
101
|
+
const routeEventValue = { ...re, pathData };
|
|
102
|
+
const instanceHelperHostSet = SwcUtils.getHelperAndHostSet(this.config.window, instance);
|
|
103
|
+
const instanceHelperSet = SwcUtils.getHelperSet(this.config.window);
|
|
104
|
+
const args = buildSwcParameterArgs(instance, methodName, {
|
|
105
|
+
routerEvent: routeEventValue,
|
|
106
|
+
hostSet: instanceHelperHostSet,
|
|
107
|
+
helperHostSet: instanceHelperHostSet,
|
|
108
|
+
helperSet: instanceHelperSet
|
|
109
|
+
}, [routeEventValue]);
|
|
110
|
+
const result = extractValue(await instance[methodName](...args));
|
|
103
111
|
if (result !== void 0 && result !== null) {
|
|
104
112
|
break;
|
|
105
113
|
}
|
|
@@ -278,7 +286,15 @@ function SwcAppMixin(Base) {
|
|
|
278
286
|
filterMatched = filter(message, instance);
|
|
279
287
|
}
|
|
280
288
|
if (typeMatched && filterMatched && typeof instance[methodName] === "function") {
|
|
281
|
-
instance
|
|
289
|
+
const instanceHelperHostSet = SwcUtils.getHelperAndHostSet(this.config.window, instance);
|
|
290
|
+
const instanceHelperSet = SwcUtils.getHelperSet(this.config.window);
|
|
291
|
+
const args = buildSwcParameterArgs(instance, methodName, {
|
|
292
|
+
appMessage: message,
|
|
293
|
+
hostSet: instanceHelperHostSet,
|
|
294
|
+
helperHostSet: instanceHelperHostSet,
|
|
295
|
+
helperSet: instanceHelperSet
|
|
296
|
+
}, [message]);
|
|
297
|
+
instance[methodName](...args);
|
|
282
298
|
}
|
|
283
299
|
});
|
|
284
300
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/elements/SwcAppMixin.ts"],
|
|
4
|
-
"sourcesContent": ["import { SwcAppInterface, SwcAppMessage } from '../types';\nimport { APPLY_NODE_METADATA_KEY, findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY, SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY } from '../decorators';\nimport { SwcAppEngine, SwcAttributeConfigType, SwcConfigType } from '../SwcAppEngine';\nimport { debounceTimeIntervalLock, FunctionUtils, Subscription } from '@dooboostore/core';\nimport {RouterEventType, ValidUtils} from '@dooboostore/core-web';\nimport { SwcUtils } from '../utils/Utils';\n\nexport const isSSR = (i: HTMLElement) => {\n return i.hasAttribute('swc-use-ssr');\n};\nexport const setSSRAttribute = (i: HTMLElement) => {\n i.setAttribute('swc-use-ssr', (i as any)._swcId ?? '');\n};\nexport const removeSSRAttribute = (i: HTMLElement) => {\n i.removeAttribute('swc-use-ssr');\n};\n\n/**\n * SwcAppMixin: SwcApp \uAE30\uB2A5\uC744 \uBAA8\uB4E0 HTMLElement\uC5D0 \uCD94\uAC00\uD560 \uC218 \uC788\uB294 Mixin\n *\n * \uC0AC\uC6A9 \uC608:\n * @elementDefine('custom-app', { window: w })\n * class CustomApp extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n * // \uCD94\uAC00 \uAE30\uB2A5 \uAD6C\uD604\n * }\n */\nexport function SwcAppMixin<T extends { new (...args: any[]): HTMLElement }>(Base: T) {\n return class SwcAppMixinClass extends Base implements SwcAppInterface {\n __swc_engine = new SwcAppEngine(this as any);\n _swc_connected_instance = new Set<any>();\n _routerSubscription?: Subscription;\n _lastRouterEvent?: RouterEventType;\n _routeChangeInvocations = 0;\n _connectedInvocations = 0;\n\n _childrenRouteChangedInterval: any;\n _childrenConnectedDoneInterval: any;\n\n /**\n * Safari is \uC18D\uC131 \uCC98\uB9AC\n * Safari polyfill\uC5D0\uC11C\uB294 \uC790\uC2DD\uBD80\uD130 \uB9CC\uB4E4\uC5B4\uC9C0\uACE0 \uBD80\uBAA8\uAC00 \uB9CC\uB4E4\uC5B4\uC9C0\uBBC0\uB85C\n * \uBD80\uBAA8\uAC00 \uC790\uC2DD\uB4E4\uC744 \uAC15\uC81C\uB85C \uB4F1\uB85D\uD574\uC8FC\uB294 \uD615\uD0DC\uB85C \uCC98\uB9AC\n */\n _connected_safari_and_standby = [];\n\n constructor(...args: any[]) {\n super(...args);\n console.log('[SWC-APP-MIXIN] constructor');\n }\n\n get simpleApplication() {\n return this.__swc_engine.simpleApplication;\n }\n\n get config() {\n return this.__swc_engine?.config;\n }\n\n get router() {\n return this.__swc_engine?.router;\n }\n\n async _invokeRouteChangeSubscribers(instance: HTMLElement, re: RouterEventType) {\n if (instance.isConnected === false) return;\n\n this._routeChangeInvocations++;\n\n if (this._childrenRouteChangedInterval) {\n this.config.window.clearInterval(this._childrenRouteChangedInterval);\n }\n const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };\n this._childrenRouteChangedInterval = debounceTimeIntervalLock(\n () => this._routeChangeInvocations === 0,\n () => {\n this._childrenRouteChangedInterval = null;\n this.config.onChildrenRouteChanged?.(re, this);\n },\n this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,\n intervalConfig\n );\n\n try {\n const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);\n\n if (routeChangeSubscribers.length > 0) {\n console.log('[SWC-MIXIN] Route change subscribers found');\n\n // Subscribers are already sorted by order from getSubscribeSwcAppRouteChangeWhileConnectedMetadata\n // Execute subscribers in order, stop if one returns a value\n for (const metadata of routeChangeSubscribers) {\n const methodName = metadata.propertyKey;\n let pathPattern = metadata.options?.path as any;\n const filter = metadata.options?.filter;\n const extractValue = (v: any) => {\n const keyToUse = metadata.options?.valueKey ?? SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY;\n if (v && typeof v === 'object' && keyToUse in v) {\n return v[keyToUse];\n }\n return v;\n };\n\n if (typeof pathPattern === 'function') {\n pathPattern = (pathPattern as Function)(instance);\n }\n\n let pathMatched = false;\n let pathData: any = null;\n\n if (!pathPattern) {\n pathMatched = true;\n pathData = {};\n } else if (Array.isArray(pathPattern)) {\n for (const pattern of pathPattern) {\n const data = SwcUtils.parsePathPattern(pattern, re.path || '/');\n if (data !== null) {\n pathMatched = true;\n pathData = data;\n break;\n }\n }\n } else {\n pathData = SwcUtils.parsePathPattern(pathPattern, re.path || '/');\n pathMatched = pathData !== null;\n }\n\n const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);\n const filterPassed = !filter || filter(this.router!, { helper: hostSet, currentThis: instance });\n\n if (pathMatched && filterPassed && instance[methodName]) {\n const result = extractValue(await instance[methodName]({ ...re, pathData: pathData }));\n // if (typeof result === 'object'\n // If handler returns a value, stop propagation to next handlers\n if (result !== undefined && result !== null) {\n break;\n }\n }\n }\n }\n } finally {\n // this.config?.window\n const isBrowser = ValidUtils.isBrowser();\n if (!isBrowser && this.config?.ssr) {\n setSSRAttribute(instance);\n } else {\n removeSSRAttribute(instance);\n }\n this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);\n }\n }\n\n async _connected(instance: HTMLElement, option?: { noIncrements: boolean }) {\n if (instance) {\n if (!this.simpleApplication && !this.config) {\n this._connected_safari_and_standby.push(instance);\n return;\n }\n\n this.config.onConnectedChildBefore?.(instance);\n if (!option?.noIncrements) {\n this._connectedInvocations++;\n }\n this._swc_connected_instance.add(instance);\n\n const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);\n for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {\n await (instance as any)?._invokeLifecycleMethod?.(connectedSwcAppCallBack.propertyKey);\n }\n\n if (this._childrenConnectedDoneInterval) {\n this.config.window.clearInterval(this._childrenConnectedDoneInterval);\n }\n const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };\n this._childrenConnectedDoneInterval = debounceTimeIntervalLock(\n () => this._connectedInvocations === 0,\n () => {\n this._childrenConnectedDoneInterval = null;\n this.config.onChildrenConnectedDone?.(this);\n },\n this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,\n intervalConfig\n );\n\n if (this.simpleApplication) {\n try {\n if (this.router && this._lastRouterEvent) {\n await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent!);\n }\n } catch (e) {\n throw e;\n }\n }\n\n const isBrowser = ValidUtils.isBrowser();\n console.log('------>', isBrowser, this.config?.ssr)\n if (!isBrowser && this.config?.ssr) {\n setSSRAttribute(instance);\n } else {\n removeSSRAttribute(instance);\n }\n }\n\n this.config.onConnectedChildAfter?.(instance);\n return this;\n }\n\n async _connectedDone(instance: any) {\n try {\n // \uB0B4\uBD80 \uC5F0\uACB0 \uCC98\uB9AC \uB85C\uC9C1\n } finally {\n this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);\n }\n }\n\n _disconnected(instance: any) {\n if (instance) {\n this._swc_connected_instance.delete(instance);\n this.config?.onDisconnectedChildAfter?.(instance);\n }\n }\n\n async _handleRouteChange(route: RouterEventType) {\n this._lastRouterEvent = route;\n const swcConnectedInstance = Array.from(this._swc_connected_instance);\n const ps = swcConnectedInstance.map((instance: any) => this._invokeRouteChangeSubscribers(instance, route));\n await Promise.allSettled(ps);\n }\n\n async connect(config?: SwcAttributeConfigType) {\n console.log('[SWC-MIXIN] connect');\n const swcConfig = {\n routeType: 'element',\n window: config?.window,\n ...config\n } as SwcConfigType;\n\n await this.__swc_engine.connect(swcConfig);\n\n // Safari is \uC18D\uC131 \uCC98\uB9AC\n this._connected_safari_and_standby.forEach((instance: any) => {\n this._connected(instance, { noIncrements: true });\n });\n\n // \uB77C\uC6B0\uD130 \uBCC0\uACBD \uAD6C\uB3C5\n if (!this._routerSubscription && this.router) {\n const config = this.__swc_engine.config;\n\n this._routerSubscription = this.router.observable.subscribe(async (route: RouterEventType) => {\n console.log('[SWC-MIXIN] Router event received:', route.triggerPoint);\n if (route.triggerPoint === 'end') {\n await this._handleRouteChange(route);\n }\n });\n\n if (config?.path) {\n console.log('[DEBUG] Navigating to initial path:', config.path);\n }\n }\n }\n\n connectedCallback() {\n // \uBD80\uBAA8 \uD074\uB798\uC2A4\uC758 connectedCallback \uD638\uCD9C\n // @ts-ignore\n super.connectedCallback?.();\n\n const configStr = this.getAttribute('swc-get-application-config');\n const win = this.ownerDocument?.defaultView || window;\n if (configStr && win) {\n try {\n const userConfig = FunctionUtils.executeReturn({\n script: configStr,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n if (userConfig instanceof Promise) {\n userConfig\n .then(resolvedConfig => {\n this.connect(resolvedConfig);\n })\n .catch(e => {\n console.error('[SWC-MIXIN] Script execution failed:', e);\n });\n } else {\n this.connect(userConfig);\n }\n } catch (e) {\n console.error('[SWC-MIXIN] Script execution failed:', e);\n }\n }\n\n this._connected(this);\n this.__swc_engine?.config?.onConnected?.(this);\n this._connectedDone(this);\n }\n\n disconnectedCallback() {\n // \uBD80\uBAA8 \uD074\uB798\uC2A4\uC758 disconnectedCallback \uD638\uCD9C\n // @ts-ignore\n super.disconnectedCallback?.();\n\n this._routerSubscription?.unsubscribe();\n this._routerSubscription = undefined;\n this._lastRouterEvent = undefined;\n this.__swc_engine.disconnect();\n this.__swc_engine?.config?.onDisconnected?.(this);\n this._disconnected(this);\n }\n\n async routing(path: string) {\n await this.router?.go(path);\n }\n\n back(): void {\n this.router?.back();\n }\n\n forward(): void {\n this.router?.forward();\n }\n\n reload(): void {\n this.router?.reload();\n }\n\n publishMessage(message: SwcAppMessage): void {\n this._swc_connected_instance.forEach((instance: any) => {\n this._invokeMessageSubscribers(instance, message);\n });\n }\n\n _invokeMessageSubscribers(instance: any, message: SwcAppMessage) {\n const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);\n if (messageSubscribers && Array.isArray(messageSubscribers)) {\n messageSubscribers.forEach(metadata => {\n const methodName = metadata.propertyKey;\n const messageType = metadata.messageType;\n const filter = metadata.filter;\n\n let typeMatched = false;\n if (!messageType) {\n typeMatched = true;\n } else if (message.type === messageType) {\n typeMatched = true;\n }\n\n let filterMatched = true;\n if (filter && typeMatched) {\n filterMatched = filter(message, instance);\n }\n\n if (typeMatched && filterMatched && typeof instance[methodName] === 'function') {\n instance[methodName](message);\n }\n });\n }\n }\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;AACA,SAAkC,0BAA0B,iDAAiD,qDAAqD,mCAAmC,
|
|
4
|
+
"sourcesContent": ["import { SwcAppInterface, SwcAppMessage } from '../types';\nimport { APPLY_NODE_METADATA_KEY, findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY, SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, buildSwcParameterArgs } from '../decorators';\nimport { SwcAppEngine, SwcAttributeConfigType, SwcConfigType } from '../SwcAppEngine';\nimport { debounceTimeIntervalLock, FunctionUtils, Subscription } from '@dooboostore/core';\nimport {RouterEventType, ValidUtils} from '@dooboostore/core-web';\nimport { SwcUtils } from '../utils/Utils';\n\nexport const isSSR = (i: HTMLElement) => {\n return i.hasAttribute('swc-use-ssr');\n};\nexport const setSSRAttribute = (i: HTMLElement) => {\n i.setAttribute('swc-use-ssr', (i as any)._swcId ?? '');\n};\nexport const removeSSRAttribute = (i: HTMLElement) => {\n i.removeAttribute('swc-use-ssr');\n};\n\n/**\n * SwcAppMixin: SwcApp \uAE30\uB2A5\uC744 \uBAA8\uB4E0 HTMLElement\uC5D0 \uCD94\uAC00\uD560 \uC218 \uC788\uB294 Mixin\n *\n * \uC0AC\uC6A9 \uC608:\n * @elementDefine('custom-app', { window: w })\n * class CustomApp extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n * // \uCD94\uAC00 \uAE30\uB2A5 \uAD6C\uD604\n * }\n */\nexport function SwcAppMixin<T extends { new (...args: any[]): HTMLElement }>(Base: T) {\n return class SwcAppMixinClass extends Base implements SwcAppInterface {\n __swc_engine = new SwcAppEngine(this as any);\n _swc_connected_instance = new Set<any>();\n _routerSubscription?: Subscription;\n _lastRouterEvent?: RouterEventType;\n _routeChangeInvocations = 0;\n _connectedInvocations = 0;\n\n _childrenRouteChangedInterval: any;\n _childrenConnectedDoneInterval: any;\n\n /**\n * Safari is \uC18D\uC131 \uCC98\uB9AC\n * Safari polyfill\uC5D0\uC11C\uB294 \uC790\uC2DD\uBD80\uD130 \uB9CC\uB4E4\uC5B4\uC9C0\uACE0 \uBD80\uBAA8\uAC00 \uB9CC\uB4E4\uC5B4\uC9C0\uBBC0\uB85C\n * \uBD80\uBAA8\uAC00 \uC790\uC2DD\uB4E4\uC744 \uAC15\uC81C\uB85C \uB4F1\uB85D\uD574\uC8FC\uB294 \uD615\uD0DC\uB85C \uCC98\uB9AC\n */\n _connected_safari_and_standby = [];\n\n constructor(...args: any[]) {\n super(...args);\n console.log('[SWC-APP-MIXIN] constructor');\n }\n\n get simpleApplication() {\n return this.__swc_engine.simpleApplication;\n }\n\n get config() {\n return this.__swc_engine?.config;\n }\n\n get router() {\n return this.__swc_engine?.router;\n }\n\n async _invokeRouteChangeSubscribers(instance: HTMLElement, re: RouterEventType) {\n if (instance.isConnected === false) return;\n\n this._routeChangeInvocations++;\n\n if (this._childrenRouteChangedInterval) {\n this.config.window.clearInterval(this._childrenRouteChangedInterval);\n }\n const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };\n this._childrenRouteChangedInterval = debounceTimeIntervalLock(\n () => this._routeChangeInvocations === 0,\n () => {\n this._childrenRouteChangedInterval = null;\n this.config.onChildrenRouteChanged?.(re, this);\n },\n this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,\n intervalConfig\n );\n\n try {\n const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);\n\n if (routeChangeSubscribers.length > 0) {\n // Subscribers are already sorted by order from getSubscribeSwcAppRouteChangeWhileConnectedMetadata\n // Execute subscribers in order, stop if one returns a value\n for (const metadata of routeChangeSubscribers) {\n const methodName = metadata.propertyKey;\n let pathPattern = metadata.options?.path as any;\n const filter = metadata.options?.filter;\n const extractValue = (v: any) => {\n const keyToUse = metadata.options?.valueKey ?? SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY;\n if (v && typeof v === 'object' && keyToUse in v) {\n return v[keyToUse];\n }\n return v;\n };\n\n if (typeof pathPattern === 'function') {\n pathPattern = (pathPattern as Function)(instance);\n }\n\n let pathMatched = false;\n let pathData: any = null;\n\n if (!pathPattern) {\n pathMatched = true;\n pathData = {};\n } else if (Array.isArray(pathPattern)) {\n for (const pattern of pathPattern) {\n const data = SwcUtils.parsePathPattern(pattern, re.path || '/');\n if (data !== null) {\n pathMatched = true;\n pathData = data;\n break;\n }\n }\n } else {\n pathData = SwcUtils.parsePathPattern(pathPattern, re.path || '/');\n pathMatched = pathData !== null;\n }\n\n const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);\n const filterPassed = !filter || filter(this.router!, { helper: hostSet, currentThis: instance });\n\n if (pathMatched && filterPassed && instance[methodName]) {\n const routeEventValue = { ...re, pathData: pathData };\n const instanceHelperHostSet = SwcUtils.getHelperAndHostSet(this.config.window, instance);\n const instanceHelperSet = SwcUtils.getHelperSet(this.config.window);\n const args = buildSwcParameterArgs(instance, methodName, {\n routerEvent: routeEventValue,\n hostSet: instanceHelperHostSet,\n helperHostSet: instanceHelperHostSet,\n helperSet: instanceHelperSet\n }, [routeEventValue]);\n const result = extractValue(await instance[methodName](...args));\n // if (typeof result === 'object'\n // If handler returns a value, stop propagation to next handlers\n if (result !== undefined && result !== null) {\n break;\n }\n }\n }\n }\n } finally {\n // this.config?.window\n const isBrowser = ValidUtils.isBrowser();\n if (!isBrowser && this.config?.ssr) {\n setSSRAttribute(instance);\n } else {\n removeSSRAttribute(instance);\n }\n this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);\n }\n }\n\n async _connected(instance: HTMLElement, option?: { noIncrements: boolean }) {\n if (instance) {\n if (!this.simpleApplication && !this.config) {\n this._connected_safari_and_standby.push(instance);\n return;\n }\n\n this.config.onConnectedChildBefore?.(instance);\n if (!option?.noIncrements) {\n this._connectedInvocations++;\n }\n this._swc_connected_instance.add(instance);\n\n const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);\n for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {\n await (instance as any)?._invokeLifecycleMethod?.(connectedSwcAppCallBack.propertyKey);\n }\n\n if (this._childrenConnectedDoneInterval) {\n this.config.window.clearInterval(this._childrenConnectedDoneInterval);\n }\n const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };\n this._childrenConnectedDoneInterval = debounceTimeIntervalLock(\n () => this._connectedInvocations === 0,\n () => {\n this._childrenConnectedDoneInterval = null;\n this.config.onChildrenConnectedDone?.(this);\n },\n this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,\n intervalConfig\n );\n\n if (this.simpleApplication) {\n try {\n if (this.router && this._lastRouterEvent) {\n await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent!);\n }\n } catch (e) {\n throw e;\n }\n }\n\n const isBrowser = ValidUtils.isBrowser();\n console.log('------>', isBrowser, this.config?.ssr)\n if (!isBrowser && this.config?.ssr) {\n setSSRAttribute(instance);\n } else {\n removeSSRAttribute(instance);\n }\n }\n\n this.config.onConnectedChildAfter?.(instance);\n return this;\n }\n\n async _connectedDone(instance: any) {\n try {\n // \uB0B4\uBD80 \uC5F0\uACB0 \uCC98\uB9AC \uB85C\uC9C1\n } finally {\n this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);\n }\n }\n\n _disconnected(instance: any) {\n if (instance) {\n this._swc_connected_instance.delete(instance);\n this.config?.onDisconnectedChildAfter?.(instance);\n }\n }\n\n async _handleRouteChange(route: RouterEventType) {\n this._lastRouterEvent = route;\n const swcConnectedInstance = Array.from(this._swc_connected_instance);\n const ps = swcConnectedInstance.map((instance: any) => this._invokeRouteChangeSubscribers(instance, route));\n await Promise.allSettled(ps);\n }\n\n async connect(config?: SwcAttributeConfigType) {\n console.log('[SWC-MIXIN] connect');\n const swcConfig = {\n routeType: 'element',\n window: config?.window,\n ...config\n } as SwcConfigType;\n\n await this.__swc_engine.connect(swcConfig);\n\n // Safari is \uC18D\uC131 \uCC98\uB9AC\n this._connected_safari_and_standby.forEach((instance: any) => {\n this._connected(instance, { noIncrements: true });\n });\n\n // \uB77C\uC6B0\uD130 \uBCC0\uACBD \uAD6C\uB3C5\n if (!this._routerSubscription && this.router) {\n const config = this.__swc_engine.config;\n\n this._routerSubscription = this.router.observable.subscribe(async (route: RouterEventType) => {\n console.log('[SWC-MIXIN] Router event received:', route.triggerPoint);\n if (route.triggerPoint === 'end') {\n await this._handleRouteChange(route);\n }\n });\n\n if (config?.path) {\n console.log('[DEBUG] Navigating to initial path:', config.path);\n }\n }\n }\n\n connectedCallback() {\n // \uBD80\uBAA8 \uD074\uB798\uC2A4\uC758 connectedCallback \uD638\uCD9C\n // @ts-ignore\n super.connectedCallback?.();\n\n const configStr = this.getAttribute('swc-get-application-config');\n const win = this.ownerDocument?.defaultView || window;\n if (configStr && win) {\n try {\n const userConfig = FunctionUtils.executeReturn({\n script: configStr,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n if (userConfig instanceof Promise) {\n userConfig\n .then(resolvedConfig => {\n this.connect(resolvedConfig);\n })\n .catch(e => {\n console.error('[SWC-MIXIN] Script execution failed:', e);\n });\n } else {\n this.connect(userConfig);\n }\n } catch (e) {\n console.error('[SWC-MIXIN] Script execution failed:', e);\n }\n }\n\n this._connected(this);\n this.__swc_engine?.config?.onConnected?.(this);\n this._connectedDone(this);\n }\n\n disconnectedCallback() {\n // \uBD80\uBAA8 \uD074\uB798\uC2A4\uC758 disconnectedCallback \uD638\uCD9C\n // @ts-ignore\n super.disconnectedCallback?.();\n\n this._routerSubscription?.unsubscribe();\n this._routerSubscription = undefined;\n this._lastRouterEvent = undefined;\n this.__swc_engine.disconnect();\n this.__swc_engine?.config?.onDisconnected?.(this);\n this._disconnected(this);\n }\n\n async routing(path: string) {\n await this.router?.go(path);\n }\n\n back(): void {\n this.router?.back();\n }\n\n forward(): void {\n this.router?.forward();\n }\n\n reload(): void {\n this.router?.reload();\n }\n\n publishMessage(message: SwcAppMessage): void {\n this._swc_connected_instance.forEach((instance: any) => {\n this._invokeMessageSubscribers(instance, message);\n });\n }\n\n _invokeMessageSubscribers(instance: any, message: SwcAppMessage) {\n const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);\n if (messageSubscribers && Array.isArray(messageSubscribers)) {\n messageSubscribers.forEach(metadata => {\n const methodName = metadata.propertyKey;\n const messageType = metadata.messageType;\n const filter = metadata.filter;\n\n let typeMatched = false;\n if (!messageType) {\n typeMatched = true;\n } else if (message.type === messageType) {\n typeMatched = true;\n }\n\n let filterMatched = true;\n if (filter && typeMatched) {\n filterMatched = filter(message, instance);\n }\n\n if (typeMatched && filterMatched && typeof instance[methodName] === 'function') {\n const instanceHelperHostSet = SwcUtils.getHelperAndHostSet(this.config.window, instance);\n const instanceHelperSet = SwcUtils.getHelperSet(this.config.window);\n const args = buildSwcParameterArgs(instance, methodName, {\n appMessage: message,\n hostSet: instanceHelperHostSet,\n helperHostSet: instanceHelperHostSet,\n helperSet: instanceHelperSet\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,QAAQ;AAAA,UAC1C;AAEA,cAAI,eAAe,iBAAiB,OAAO,SAAS,UAAU,MAAM,YAAY;AAC9E,kBAAM,wBAAwB,SAAS,oBAAoB,KAAK,OAAO,QAAQ,QAAQ;AACvF,kBAAM,oBAAoB,SAAS,aAAa,KAAK,OAAO,MAAM;AAClE,kBAAM,OAAO,sBAAsB,UAAU,YAAY;AAAA,cACvD,YAAY;AAAA,cACZ,SAAS;AAAA,cACT,eAAe;AAAA,cACf,WAAW;AAAA,YACb,GAAG,CAAC,OAAO,CAAC;AACZ,qBAAS,UAAU,EAAE,GAAG,IAAI;AAAA,UAC9B;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["config"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n\nexport interface SwcElement {\n _swcId: string;\n // createSlotString(id: string): string\n // createEaHtml(id: string, script: string): string\n // createEaText(id: string, script: string): string\n // createEaAttribute(id: string, attributeName: string): string\n // createEaEvent(id: string, eventName: string): string\n // createEaProperty(id: string, propertyName: string): string\n}"],
|
|
4
|
+
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\n// \uACF5\uD1B5 \uC140\uB809\uD130 \uD568\uC218 \u2014 \uC694\uC18C/\uB178\uB4DC\uB97C \uC9C1\uC811 \uBC18\uD658\uD558\uB294 \uD568\uC218 \uC140\uB809\uD130 (query\uB294 Node\uAE4C\uC9C0 \uBC18\uD658 \uAC00\uB2A5)\nexport type SwcFnSelector = (currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null;\n// \uACF5\uD1B5 \uC140\uB809\uD130 \u2014 \uBB38\uC790\uC5F4(CSS/\uD2B9\uC218) \uB610\uB294 \uD568\uC218\nexport type SwcSelector = string | SwcFnSelector;\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n\nexport interface SwcElement {\n _swcId: string;\n // createSlotString(id: string): string\n // createEaHtml(id: string, script: string): string\n // createEaText(id: string, script: string): string\n // createEaAttribute(id: string, attributeName: string): string\n // createEaEvent(id: string, eventName: string): string\n // createEaProperty(id: string, propertyName: string): string\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// ElementDefineLifeCycler\n//\n// \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C(addEventListener, mutationObserver, \u2026)\uC774 \uC774 interface\uB97C\n// \uAD6C\uD604\uD574 export \uD558\uACE0, elementDefine.ts\uB294 cyclers \uBC30\uC5F4\uB85C \uAD00\uB9AC\uD558\uBA70 \uC704\uC784\uB9CC \uD55C\uB2E4.\n//\n// \uC2DC\uD074\uB7EC\uB294 \uC0DD\uC131\uC790\uC5D0\uC11C \uC544\uBB34 \uC778\uC790\uB3C4 \uBC1B\uC9C0 \uC54A\uB294\uB2E4. \uC0C1\uD0DC\uB294 \uC778\uC2A4\uD134\uC2A4\uBCC4\uB85C \uAD00\uB9AC\uD574\uC57C \uD558\uBBC0\uB85C,\n// \uAC01 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uD6C5(onConnected \uB4F1)\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uC544\n// \uADF8 \uC548\uC758 $this(\uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4) / $w(window) \uB85C \uCC98\uB9AC\uD55C\uB2E4.\n// elementDefine \uC740 elementDefine \uC2DC\uC810\uC5D0 \uC2DC\uD074\uB7EC\uB97C 1\uD68C \uC0DD\uC131\uD558\uACE0 \uACC4\uC18D \uC7AC\uC0AC\uC6A9\uD55C\uB2E4.\n// \uBAA8\uB4E0 \uBA54\uC11C\uB4DC\uB294 optional \u2014 \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \uB41C\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\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// onConnected \uBC18\uD658 \uD0C0\uC785\n//\n// \uAC01 cycler \uAC00 \"\uD544\uC694\uD55C observer \uC815\uBCF4\"\uB97C \uC120\uC5B8\uD558\uBA74,\n// elementDefine \uC774 \uC218\uC9D1\uD574\uC11C \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC observer \uC778\uC2A4\uD134\uC2A4\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\n\n/** observer observe \uB300\uC0C1 \uC5D4\uD2B8\uB9AC. delegate:true \uC774\uBA74 target \uC740 \uC140\uB809\uD130 \uBB38\uC790\uC5F4\uC774\uBA70, \uC2E4\uC81C \uC694\uC18C\uB294 \uB3D9\uC801 \uCD94\uC801\uC73C\uB85C observe/unobserve \uB41C\uB2E4. */\nexport interface ObserverObserveTarget<TOptions> {\n target: Element | ShadowRoot | string;\n options?: TOptions;\n delegate?: boolean;\n /** delegate \uB3D9\uC801 \uCD94\uC801 \uC2DC observe/unobserve \uB97C \uC2E4\uD589\uD560 \uB8E8\uD2B8(\uC2A4\uCF54\uD504). delegate:true \uC77C \uB54C\uB9CC \uC758\uBBF8 \uC788\uB2E4. */\n delegateRoot?: SwcRootType;\n}\n\n/** MutationObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uB8E8\uD2B8\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface MutationObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: MutationObserverInit;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (mutations: MutationRecord[], observer: MutationObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 MutationObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type MutationObserverSet = MutationObserverSetEntry[];\n\n/** ResizeObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uC140\uB809\uD130\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface ResizeObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: ResizeObserverOptions;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 ResizeObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type ResizeObserverSet = ResizeObserverSetEntry[];\n\n/** IntersectionObserver observe \uB300\uC0C1 \uD558\uB098. \uAC19\uC740 \uC635\uC158 \uADF8\uB8F9\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface IntersectionObserverSetEntry {\n target: Element | ShadowRoot | string;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void;\n}\n\n/** IntersectionObserver \uADF8\uB8F9. observer \uB294 \uC0DD\uC131 \uC2DC\uC810\uC5D0 \uC635\uC158\uC774 \uACE0\uC815\uB418\uBBC0\uB85C \uC635\uC158\uBCC4\uB85C 1\uAC1C\uC529 \uC0DD\uC131\uB41C\uB2E4. */\nexport interface IntersectionObserverGroup {\n /** observer \uC0DD\uC131 \uC635\uC158 (threshold/rootMargin/root). \uC774 \uAC12\uC774 \uAC19\uC73C\uBA74 \uAC19\uC740 observer \uB97C \uACF5\uC720\uD55C\uB2E4. */\n options: IntersectionObserverInit;\n observeTargets: IntersectionObserverSetEntry[];\n}\n\n/** observe \uD560 \uC635\uC158 \uADF8\uB8F9 \uBAA9\uB85D. elementDefine \uC774 \uADF8\uB8F9\uB9C8\uB2E4 IntersectionObserver \uB97C \uC0DD\uC131\uD55C\uB2E4. */\nexport type IntersectionObserverSet = IntersectionObserverGroup[];\n\n/**\n * onConnected \uC758 \uBC18\uD658 \uD0C0\uC785.\n * observer \uAC00 \uD544\uC694 \uC5C6\uB294 cycler \uB294 undefined \uB97C \uBC18\uD658\uD574\uB3C4 \uB41C\uB2E4.\n */\nexport interface OnConnectedResult {\n mutationObserverSet?: MutationObserverSet;\n resizeObserverSet?: ResizeObserverSet;\n intersectionObserverSet?: IntersectionObserverSet;\n}\n\n/**\n * \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C\uC774 \uAD6C\uD604\uD558\uB294 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uC704\uC784 interface.\n *\n * \uAD6C\uD604\uCCB4\uB294 \uC0C1\uD0DC\uB97C \uAC16\uC9C0 \uC54A\uACE0, \uAC01 \uD6C5\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uB294\uB2E4.\n * \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \uB41C\uB2E4 (\uC804\uBD80 optional).\n *\n * ```ts\n * const eventCycler = new EventListenerLifeCycler();\n * const cyclers: ElementDefineLifeCycler[] = [eventCycler, ...]; // elementDefine \uC2DC 1\uD68C \uC0DD\uC131\n *\n * proto.connectedCallback = async function () {\n * const helperHostSet = SwcUtils.getHelperAndHostSet(win, this);\n * const results = await Promise.all(cyclers.map(c => c.onConnected?.(helperHostSet)));\n * // results \uC5D0\uC11C mutationObserverSet / resizeObserverSet \uC218\uC9D1\n * // \u2192 \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC MutationObserver / ResizeObserver \uC0DD\uC131\n * };\n * proto.disconnectedCallback = function () {\n * for (const c of cyclers) c.onDisconnected?.(helperHostSet);\n * };\n * ```\n */\nexport interface ElementDefineLifeCycler {\n /**\n * connectedCallback \uC2DC \uD638\uCD9C.\n * observer \uAC00 \uD544\uC694\uD558\uBA74 OnConnectedResult \uB97C \uBC18\uD658\uD558\uACE0,\n * \uD544\uC694 \uC5C6\uC73C\uBA74 void / undefined \uB97C \uBC18\uD658\uD55C\uB2E4.\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param resizeObserverSet \uC774\uC804 \uC2DC\uD074\uB7EC\uAC00 \uBC18\uD658\uD55C resize observer set (mutation \uC2DC\uD074\uB7EC\uAC00 \uC8FC\uC785\uBC1B\uC544 \uC0AC\uC6A9)\n */\n onConnected?(helperHostSet: HelperHostSet, resizeObserverSet?: ResizeObserverSet): OnConnectedResult | void | Promise<OnConnectedResult | void>;\n\n /** disconnectedCallback \uC2DC \uD638\uCD9C. \uB4F1\uB85D\uD55C \uB9AC\uC18C\uC2A4\uB97C \uD574\uC81C\uD55C\uB2E4. */\n onDisconnected?(helperHostSet: HelperHostSet): void;\n\n /** adoptedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801). */\n onAdopted?(helperHostSet: HelperHostSet): void;\n\n /**\n * attributeChangedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801).\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param name \uBCC0\uACBD\uB41C attribute \uC774\uB984\n * @param oldVal \uC774\uC804 \uAC12\n * @param newVal \uC0C8 \uAC12 (ActionExpression \uCC98\uB9AC \uD6C4)\n */\n onAttributeChanged?(helperHostSet: HelperHostSet, name: string, oldVal: string | null, newVal: any): void;\n\n /**\n * observedAttributes \uC5D0 \uD3EC\uD568\uD574\uC57C \uD558\uB294 attribute \uC774\uB984 \uBAA9\uB85D\uC744 \uBC18\uD658\uD55C\uB2E4.\n * elementDefine \uC774 define-time(constructor)\uC5D0 \uD638\uCD9C\uD574 \uC218\uC9D1\uD55C\uB2E4.\n * \uAD00\uC2EC \uC5C6\uC73C\uBA74 \uAD6C\uD604\uD558\uC9C0 \uC54A\uAC70\uB098 \uBE48 \uBC30\uC5F4\uC744 \uBC18\uD658\uD55C\uB2E4.\n * @param target constructor \uB610\uB294 element \uC778\uC2A4\uD134\uC2A4 (\uBA54\uD0C0\uB370\uC774\uD130 \uC870\uD68C\uC6A9)\n */\n getObservedAttributeNames?(target: any): string[];\n}"],
|
|
5
5
|
"mappings": "AAIO,IAAK,sBAAL,kBAAKA,yBAAL;AACL,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,iBAAc;AACd,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,gBAAa;AACb,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,oBAAiB;AACjB,EAAAA,qBAAA,mBAAgB;AAVN,SAAAA;AAAA,GAAA;",
|
|
6
6
|
"names": ["InjectSituationType"]
|
|
7
7
|
}
|