@dooboostore/simple-web-component 1.0.36 → 1.0.38
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 +396 -68
- package/dist/cjs/{elements/SwcAppEngine.js → SwcAppEngine.js} +9 -6
- package/dist/cjs/SwcAppEngine.js.map +7 -0
- package/dist/cjs/decorators/addEventListener.js +20 -4
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js.map +1 -1
- package/dist/cjs/decorators/applyClass.js.map +1 -1
- package/dist/cjs/decorators/applyNode.js +109 -26
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +129 -0
- package/dist/cjs/decorators/applySlot.js.map +7 -0
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/attribute.js.map +1 -1
- package/dist/cjs/decorators/elementDefine.js +90 -52
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/emitCustomEvent.js.map +1 -1
- package/dist/cjs/decorators/index.js +2 -0
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +88 -24
- package/dist/cjs/decorators/lifecycles.js.map +3 -3
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/cjs/decorators/query.js +1 -1
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js.map +1 -1
- package/dist/cjs/decorators/setProperty.js.map +1 -1
- package/dist/cjs/decorators/state.js +84 -0
- package/dist/cjs/decorators/state.js.map +7 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcApp.js +231 -0
- package/dist/cjs/elements/SwcApp.js.map +7 -0
- package/dist/cjs/elements/SwcAppMixin.js +78 -80
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/elements/index.js +2 -1
- package/dist/cjs/elements/index.js.map +2 -2
- package/dist/cjs/elements/tt/SwcAppMixin.js +1 -0
- package/dist/cjs/elements/tt/SwcAppMixin.js.map +7 -0
- package/dist/cjs/elements/tt/SwcAsync.js +1 -0
- package/dist/cjs/elements/tt/SwcAsync.js.map +7 -0
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcChoose.js +1 -0
- package/dist/cjs/elements/tt/SwcChoose.js.map +7 -0
- package/dist/cjs/elements/tt/SwcChooseTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcIf.js +1 -0
- package/dist/cjs/elements/tt/SwcIf.js.map +7 -0
- package/dist/cjs/elements/tt/SwcIfTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcIfTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcLoop.js +1 -0
- package/dist/cjs/elements/tt/SwcLoop.js.map +7 -0
- package/dist/cjs/elements/tt/SwcLoopTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcSubTemplates.js +1 -0
- package/dist/cjs/elements/tt/SwcSubTemplates.js.map +7 -0
- package/dist/cjs/elements/tt/register.js +1 -0
- package/dist/cjs/elements/tt/register.js.map +7 -0
- package/dist/cjs/index.js +10 -8
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/{types.js → types/index.js} +1 -1
- package/dist/cjs/types/index.js.map +7 -0
- package/dist/cjs/types/window.d.js +16 -0
- package/dist/cjs/types/window.d.js.map +7 -0
- package/dist/cjs/utils/Utils.js +168 -26
- package/dist/cjs/utils/Utils.js.map +3 -3
- package/dist/esm/{elements/SwcAppEngine.js → SwcAppEngine.js} +7 -4
- package/dist/esm/SwcAppEngine.js.map +7 -0
- package/dist/esm/decorators/addEventListener.js +20 -4
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js.map +1 -1
- package/dist/esm/decorators/applyClass.js.map +1 -1
- package/dist/esm/decorators/applyNode.js +109 -26
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +110 -0
- package/dist/esm/decorators/applySlot.js.map +7 -0
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/attribute.js.map +1 -1
- package/dist/esm/decorators/elementDefine.js +96 -58
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js.map +1 -1
- package/dist/esm/decorators/index.js +2 -0
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +88 -24
- package/dist/esm/decorators/lifecycles.js.map +3 -3
- package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/query.js +1 -1
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js.map +1 -1
- package/dist/esm/decorators/setProperty.js.map +1 -1
- package/dist/esm/decorators/state.js +65 -0
- package/dist/esm/decorators/state.js.map +7 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcApp.js +212 -0
- package/dist/esm/elements/SwcApp.js.map +7 -0
- package/dist/esm/elements/SwcAppMixin.js +76 -78
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/index.js +2 -1
- package/dist/esm/elements/index.js.map +2 -2
- package/dist/esm/elements/tt/SwcAppMixin.js +1 -0
- package/dist/esm/elements/tt/SwcAppMixin.js.map +7 -0
- package/dist/esm/elements/tt/SwcAsync.js +1 -0
- package/dist/esm/elements/tt/SwcAsync.js.map +7 -0
- package/dist/esm/elements/tt/SwcAsyncTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcChoose.js +1 -0
- package/dist/esm/elements/tt/SwcChoose.js.map +7 -0
- package/dist/esm/elements/tt/SwcChooseTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcChooseTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcIf.js +1 -0
- package/dist/esm/elements/tt/SwcIf.js.map +7 -0
- package/dist/esm/elements/tt/SwcIfTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcIfTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcLoop.js +1 -0
- package/dist/esm/elements/tt/SwcLoop.js.map +7 -0
- package/dist/esm/elements/tt/SwcLoopTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcLoopTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcSubTemplates.js +1 -0
- package/dist/esm/elements/tt/SwcSubTemplates.js.map +7 -0
- package/dist/esm/elements/tt/register.js +1 -0
- package/dist/esm/elements/tt/register.js.map +7 -0
- package/dist/esm/index.js +11 -9
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/{types.js → types/index.js} +1 -1
- package/dist/esm/types/index.js.map +7 -0
- package/dist/esm/types/window.d.js +1 -0
- package/dist/esm/types/window.d.js.map +7 -0
- package/dist/esm/utils/Utils.js +168 -26
- package/dist/esm/utils/Utils.js.map +3 -3
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +7477 -2828
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/{elements/SwcAppEngine.d.ts → SwcAppEngine.d.ts} +9 -4
- package/dist/types/SwcAppEngine.d.ts.map +1 -0
- package/dist/types/decorators/addEventListener.d.ts +5 -2
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +24 -8
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts +27 -0
- package/dist/types/decorators/applySlot.d.ts.map +1 -0
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/attribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +2 -0
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +26 -15
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +1 -1
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/setProperty.d.ts +1 -1
- package/dist/types/decorators/setProperty.d.ts.map +1 -1
- package/dist/types/decorators/state.d.ts +9 -0
- package/dist/types/decorators/state.d.ts.map +1 -0
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +5 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/elements/SwcApp.d.ts +36 -0
- package/dist/types/elements/SwcApp.d.ts.map +1 -0
- package/dist/types/elements/SwcAppMixin.d.ts +26 -7
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/elements/index.d.ts +2 -1
- package/dist/types/elements/index.d.ts.map +1 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts +1 -0
- package/dist/types/elements/tt/SwcAppMixin.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcAsync.d.ts +1 -0
- package/dist/types/elements/tt/SwcAsync.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcChoose.d.ts +1 -0
- package/dist/types/elements/tt/SwcChoose.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcIf.d.ts +1 -0
- package/dist/types/elements/{SwcIf.d.ts.map → tt/SwcIf.d.ts.map} +1 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcLoop.d.ts +1 -0
- package/dist/types/elements/tt/SwcLoop.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcSubTemplates.d.ts +1 -0
- package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +1 -0
- package/dist/types/elements/tt/register.d.ts +1 -0
- package/dist/types/elements/tt/register.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/{types.d.ts → types/index.d.ts} +12 -12
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/utils/Utils.d.ts +18 -5
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +7478 -2829
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +4 -4
- package/src/{elements/SwcAppEngine.ts → SwcAppEngine.ts} +17 -8
- package/src/decorators/addEventListener.ts +21 -5
- package/src/decorators/applyAttribute.ts +1 -1
- package/src/decorators/applyClass.ts +1 -1
- package/src/decorators/applyNode.ts +186 -66
- package/src/decorators/applySlot.ts +188 -0
- package/src/decorators/applyStyle.ts +4 -4
- package/src/decorators/attribute.ts +1 -1
- package/src/decorators/elementDefine.ts +142 -68
- package/src/decorators/emitCustomEvent.ts +1 -1
- package/src/decorators/index.ts +3 -0
- package/src/decorators/lifecycles.ts +119 -30
- package/src/decorators/publishSwcAppMessage.ts +2 -3
- package/src/decorators/query.ts +4 -4
- package/src/decorators/queryAll.ts +1 -1
- package/src/decorators/setProperty.ts +1 -1
- package/src/decorators/state.ts +84 -0
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -1
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +4 -3
- package/src/elements/SwcApp.ts +241 -0
- package/src/elements/SwcAppMixin.ts +98 -146
- package/src/elements/index.ts +4 -1
- package/src/elements/tt/SwcAppMixin.ts +13 -0
- package/src/elements/tt/SwcAsync.ts +139 -0
- package/src/elements/tt/SwcAsyncTemplate.ts +126 -0
- package/src/elements/tt/SwcChoose.ts +182 -0
- package/src/elements/tt/SwcChooseTemplate.ts +229 -0
- package/src/elements/tt/SwcIf.ts +145 -0
- package/src/elements/tt/SwcIfTemplate.ts +158 -0
- package/src/elements/tt/SwcLoop.ts +222 -0
- package/src/elements/tt/SwcLoopTemplate.ts +255 -0
- package/src/elements/tt/SwcSubTemplates.ts +6 -0
- package/src/elements/tt/register.ts +720 -0
- package/src/index.ts +11 -9
- package/src/{types.ts → types/index.ts} +15 -11
- package/src/types/window.d.ts +46 -0
- package/src/utils/Utils.ts +214 -24
- package/dist/cjs/elements/SwcAppEngine.js.map +0 -7
- package/dist/cjs/elements/SwcAsync.js +0 -129
- package/dist/cjs/elements/SwcAsync.js.map +0 -7
- package/dist/cjs/elements/SwcChoose.js +0 -155
- package/dist/cjs/elements/SwcChoose.js.map +0 -7
- package/dist/cjs/elements/SwcIf.js +0 -117
- package/dist/cjs/elements/SwcIf.js.map +0 -7
- package/dist/cjs/elements/SwcLoop.js +0 -176
- package/dist/cjs/elements/SwcLoop.js.map +0 -7
- package/dist/cjs/elements/SwcSubTemplates.js +0 -13
- package/dist/cjs/elements/SwcSubTemplates.js.map +0 -7
- package/dist/cjs/elements/register.js +0 -1026
- package/dist/cjs/elements/register.js.map +0 -7
- package/dist/cjs/types.js.map +0 -7
- package/dist/esm/elements/SwcAppEngine.js.map +0 -7
- package/dist/esm/elements/SwcAsync.js +0 -129
- package/dist/esm/elements/SwcAsync.js.map +0 -7
- package/dist/esm/elements/SwcChoose.js +0 -155
- package/dist/esm/elements/SwcChoose.js.map +0 -7
- package/dist/esm/elements/SwcIf.js +0 -117
- package/dist/esm/elements/SwcIf.js.map +0 -7
- package/dist/esm/elements/SwcLoop.js +0 -176
- package/dist/esm/elements/SwcLoop.js.map +0 -7
- package/dist/esm/elements/SwcSubTemplates.js +0 -13
- package/dist/esm/elements/SwcSubTemplates.js.map +0 -7
- package/dist/esm/elements/register.js +0 -1007
- package/dist/esm/elements/register.js.map +0 -7
- package/dist/esm/types.js.map +0 -7
- package/dist/types/elements/SwcAppEngine.d.ts.map +0 -1
- package/dist/types/elements/SwcAsync.d.ts +0 -2
- package/dist/types/elements/SwcAsync.d.ts.map +0 -1
- package/dist/types/elements/SwcChoose.d.ts +0 -2
- package/dist/types/elements/SwcChoose.d.ts.map +0 -1
- package/dist/types/elements/SwcIf.d.ts +0 -2
- package/dist/types/elements/SwcLoop.d.ts +0 -2
- package/dist/types/elements/SwcLoop.d.ts.map +0 -1
- package/dist/types/elements/SwcSubTemplates.d.ts +0 -13
- package/dist/types/elements/SwcSubTemplates.d.ts.map +0 -1
- package/dist/types/elements/register.d.ts +0 -4
- package/dist/types/elements/register.d.ts.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
- package/src/elements/SwcAsync.ts +0 -126
- package/src/elements/SwcChoose.ts +0 -190
- package/src/elements/SwcIf.ts +0 -124
- package/src/elements/SwcLoop.ts +0 -205
- package/src/elements/SwcSubTemplates.ts +0 -6
- package/src/elements/register.ts +0 -1022
|
@@ -1,31 +1,38 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
4
|
+
import { findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY } from "../decorators/index.js";
|
|
5
|
+
import { SwcAppEngine } from "../SwcAppEngine.js";
|
|
6
6
|
import { debounceTimeIntervalLock, FunctionUtils } from "@dooboostore/core";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { SwcUtils } from "../utils/Utils.js";
|
|
8
|
+
const isSSR = (i) => {
|
|
9
|
+
return i.hasAttribute("swc-use-ssr");
|
|
10
|
+
};
|
|
11
|
+
const setSSRAttribute = (i) => {
|
|
12
|
+
i.setAttribute("swc-use-ssr", i._swcId ?? "");
|
|
13
|
+
};
|
|
14
|
+
const removeSSRAttribute = (i) => {
|
|
15
|
+
i.removeAttribute("swc-use-ssr");
|
|
16
|
+
};
|
|
9
17
|
function SwcAppMixin(Base) {
|
|
10
|
-
return class extends Base {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...
|
|
18
|
+
return class SwcAppMixinClass extends Base {
|
|
19
|
+
constructor(...args) {
|
|
20
|
+
super(...args);
|
|
13
21
|
__publicField(this, "__swc_engine", new SwcAppEngine(this));
|
|
14
22
|
__publicField(this, "_swc_connected_instance", /* @__PURE__ */ new Set());
|
|
15
|
-
// _swc_notified_routes = new WeakMap<any, RouterEventType>();
|
|
16
23
|
__publicField(this, "_routerSubscription");
|
|
17
24
|
__publicField(this, "_lastRouterEvent");
|
|
18
25
|
__publicField(this, "_routeChangeInvocations", 0);
|
|
19
26
|
__publicField(this, "_connectedInvocations", 0);
|
|
20
27
|
__publicField(this, "_childrenRouteChangedInterval");
|
|
21
28
|
__publicField(this, "_childrenConnectedDoneInterval");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
저 polyfill에서는 자식부터 만들어지고 부모가 만들어진다 is일때 아 .. 이문제때문에 자식이 _connected_safari 에 강제로 자기자식넣어준다
|
|
29
|
+
/**
|
|
30
|
+
* Safari is 속성 처리
|
|
31
|
+
* Safari polyfill에서는 자식부터 만들어지고 부모가 만들어지므로
|
|
32
|
+
* 부모가 자식들을 강제로 등록해주는 형태로 처리
|
|
27
33
|
*/
|
|
28
|
-
__publicField(this, "
|
|
34
|
+
__publicField(this, "_connected_safari_and_standby", []);
|
|
35
|
+
console.log("[SWC-APP-MIXIN] constructor");
|
|
29
36
|
}
|
|
30
37
|
get simpleApplication() {
|
|
31
38
|
return this.__swc_engine.simpleApplication;
|
|
@@ -40,21 +47,22 @@ function SwcAppMixin(Base) {
|
|
|
40
47
|
if (instance.isConnected === false) return;
|
|
41
48
|
this._routeChangeInvocations++;
|
|
42
49
|
if (this._childrenRouteChangedInterval) {
|
|
43
|
-
clearInterval(this._childrenRouteChangedInterval);
|
|
50
|
+
this.config.window.clearInterval(this._childrenRouteChangedInterval);
|
|
44
51
|
}
|
|
52
|
+
const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
|
|
45
53
|
this._childrenRouteChangedInterval = debounceTimeIntervalLock(
|
|
46
54
|
() => this._routeChangeInvocations === 0,
|
|
47
55
|
() => {
|
|
48
56
|
this._childrenRouteChangedInterval = null;
|
|
49
|
-
this.config.onChildrenRouteChanged(re, this);
|
|
57
|
+
this.config.onChildrenRouteChanged?.(re, this);
|
|
50
58
|
},
|
|
51
59
|
this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
|
|
52
|
-
|
|
53
|
-
// {setInterval: window.setInterval, clearInterval: window.clearInterval}
|
|
60
|
+
intervalConfig
|
|
54
61
|
);
|
|
55
62
|
try {
|
|
56
63
|
const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
|
|
57
64
|
if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
|
|
65
|
+
console.log("[SWC-MIXIN] Route change subscribers found");
|
|
58
66
|
const ps = routeChangeSubscribers.map(async (metadata) => {
|
|
59
67
|
const methodName = metadata.propertyKey;
|
|
60
68
|
let pathPattern = metadata.options?.path;
|
|
@@ -80,7 +88,8 @@ function SwcAppMixin(Base) {
|
|
|
80
88
|
pathData = SwcUtils.parsePathPattern(pathPattern, re.path || "/");
|
|
81
89
|
pathMatched = pathData !== null;
|
|
82
90
|
}
|
|
83
|
-
const
|
|
91
|
+
const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
|
|
92
|
+
const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
|
|
84
93
|
if (pathMatched && filterPassed && instance[methodName]) {
|
|
85
94
|
await instance[methodName]({ ...re, pathData });
|
|
86
95
|
}
|
|
@@ -88,24 +97,41 @@ function SwcAppMixin(Base) {
|
|
|
88
97
|
await Promise.allSettled(ps);
|
|
89
98
|
}
|
|
90
99
|
} finally {
|
|
91
|
-
this.
|
|
100
|
+
if (this.config?.ssr) {
|
|
101
|
+
setSSRAttribute(instance);
|
|
102
|
+
} else {
|
|
103
|
+
removeSSRAttribute(instance);
|
|
104
|
+
}
|
|
105
|
+
this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);
|
|
92
106
|
}
|
|
93
107
|
}
|
|
94
|
-
async _connected(instance) {
|
|
108
|
+
async _connected(instance, option) {
|
|
95
109
|
if (instance) {
|
|
96
|
-
this.
|
|
110
|
+
if (!this.simpleApplication && !this.config) {
|
|
111
|
+
this._connected_safari_and_standby.push(instance);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.config.onConnectedChildBefore?.(instance);
|
|
115
|
+
if (!option?.noIncrements) {
|
|
116
|
+
this._connectedInvocations++;
|
|
117
|
+
}
|
|
97
118
|
this._swc_connected_instance.add(instance);
|
|
119
|
+
const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY) ?? [];
|
|
120
|
+
for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {
|
|
121
|
+
await instance?._invokeLifecycleMethod?.(connectedSwcAppCallBack);
|
|
122
|
+
}
|
|
98
123
|
if (this._childrenConnectedDoneInterval) {
|
|
99
|
-
clearInterval(this._childrenConnectedDoneInterval);
|
|
124
|
+
this.config.window.clearInterval(this._childrenConnectedDoneInterval);
|
|
100
125
|
}
|
|
126
|
+
const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
|
|
101
127
|
this._childrenConnectedDoneInterval = debounceTimeIntervalLock(
|
|
102
128
|
() => this._connectedInvocations === 0,
|
|
103
129
|
() => {
|
|
104
130
|
this._childrenConnectedDoneInterval = null;
|
|
105
|
-
this.config.onChildrenConnectedDone(this);
|
|
131
|
+
this.config.onChildrenConnectedDone?.(this);
|
|
106
132
|
},
|
|
107
133
|
this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
|
|
108
|
-
|
|
134
|
+
intervalConfig
|
|
109
135
|
);
|
|
110
136
|
if (this.simpleApplication) {
|
|
111
137
|
try {
|
|
@@ -116,17 +142,25 @@ function SwcAppMixin(Base) {
|
|
|
116
142
|
throw e;
|
|
117
143
|
}
|
|
118
144
|
}
|
|
145
|
+
if (this.config?.ssr) {
|
|
146
|
+
setSSRAttribute(instance);
|
|
147
|
+
} else {
|
|
148
|
+
removeSSRAttribute(instance);
|
|
149
|
+
}
|
|
119
150
|
}
|
|
151
|
+
this.config.onConnectedChildAfter?.(instance);
|
|
152
|
+
return this;
|
|
120
153
|
}
|
|
121
154
|
async _connectedDone(instance) {
|
|
122
155
|
try {
|
|
123
156
|
} finally {
|
|
124
|
-
this._connectedInvocations
|
|
157
|
+
this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
160
|
_disconnected(instance) {
|
|
128
161
|
if (instance) {
|
|
129
162
|
this._swc_connected_instance.delete(instance);
|
|
163
|
+
this.config?.onDisconnectedChildAfter?.(instance);
|
|
130
164
|
}
|
|
131
165
|
}
|
|
132
166
|
async _handleRouteChange(route) {
|
|
@@ -136,73 +170,31 @@ function SwcAppMixin(Base) {
|
|
|
136
170
|
await Promise.allSettled(ps);
|
|
137
171
|
}
|
|
138
172
|
async connect(config) {
|
|
173
|
+
console.log("[SWC-MIXIN] connect");
|
|
139
174
|
const swcConfig = {
|
|
140
175
|
routeType: "element",
|
|
141
176
|
window: config?.window,
|
|
142
177
|
...config
|
|
143
178
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.setAttribute("swc-connect-mode", "direct");
|
|
148
|
-
} else if (mode === "swap" || mode === "clear-swap") {
|
|
149
|
-
if (!this.parentNode) {
|
|
150
|
-
await this.__swc_engine.connect(swcConfig);
|
|
151
|
-
this.setAttribute("swc-connect-mode", "direct");
|
|
152
|
-
} else {
|
|
153
|
-
const clonedApp = this.cloneNode(mode === "swap");
|
|
154
|
-
clonedApp.style.display = "none";
|
|
155
|
-
this.parentNode.insertBefore(clonedApp, this.nextSibling);
|
|
156
|
-
try {
|
|
157
|
-
await clonedApp.connect({ ...config || {}, connectMode: "direct" });
|
|
158
|
-
if (this.parentNode) {
|
|
159
|
-
this.parentNode.removeChild(this);
|
|
160
|
-
}
|
|
161
|
-
clonedApp.style.display = "";
|
|
162
|
-
clonedApp.setAttribute("swc-connect-mode", mode);
|
|
163
|
-
return;
|
|
164
|
-
} catch (e) {
|
|
165
|
-
if (clonedApp.parentNode) {
|
|
166
|
-
clonedApp.parentNode.removeChild(clonedApp);
|
|
167
|
-
}
|
|
168
|
-
await this.__swc_engine.connect(swcConfig);
|
|
169
|
-
this.setAttribute("swc-connect-mode", "direct");
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
this._connected_safari.forEach((instance) => {
|
|
174
|
-
this._connected(instance);
|
|
179
|
+
await this.__swc_engine.connect(swcConfig);
|
|
180
|
+
this._connected_safari_and_standby.forEach((instance) => {
|
|
181
|
+
this._connected(instance, { noIncrements: true });
|
|
175
182
|
});
|
|
176
183
|
if (!this._routerSubscription && this.router) {
|
|
177
184
|
const config2 = this.__swc_engine.config;
|
|
178
185
|
this._routerSubscription = this.router.observable.subscribe(async (route) => {
|
|
186
|
+
console.log("[SWC-MIXIN] Router event received:", route.triggerPoint);
|
|
179
187
|
if (route.triggerPoint === "end") {
|
|
180
188
|
await this._handleRouteChange(route);
|
|
181
189
|
}
|
|
182
190
|
});
|
|
183
191
|
if (config2?.path) {
|
|
184
|
-
|
|
192
|
+
console.log("[DEBUG] Navigating to initial path:", config2.path);
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
195
|
}
|
|
188
|
-
// async _invokeOnConnectedSwcAppStarted(instance: any) {
|
|
189
|
-
// this._swcAppStartedInvocations++;
|
|
190
|
-
// try {
|
|
191
|
-
// // 이미 시작된 인스턴스라면 스킵 (비동기 병렬 중복 호출 방지)
|
|
192
|
-
// if (this._swc_started_instances.has(instance)) return;
|
|
193
|
-
// this._swc_started_instances.add(instance);
|
|
194
|
-
//
|
|
195
|
-
// const startedMethods = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);
|
|
196
|
-
// if (startedMethods) {
|
|
197
|
-
// const ps = startedMethods.map(m => instance._invokeLifecycleMethod(m));
|
|
198
|
-
// await Promise.allSettled(ps);
|
|
199
|
-
// }
|
|
200
|
-
// } finally {
|
|
201
|
-
// this._swcAppStartedInvocations--;
|
|
202
|
-
// }
|
|
203
|
-
// }
|
|
204
196
|
connectedCallback() {
|
|
205
|
-
|
|
197
|
+
super.connectedCallback?.();
|
|
206
198
|
const configStr = this.getAttribute("swc-get-application-config");
|
|
207
199
|
const win = this.ownerDocument?.defaultView || window;
|
|
208
200
|
if (configStr && win) {
|
|
@@ -214,18 +206,21 @@ function SwcAppMixin(Base) {
|
|
|
214
206
|
});
|
|
215
207
|
this.connect(userConfig);
|
|
216
208
|
} catch (e) {
|
|
217
|
-
console.error("[SWC-
|
|
209
|
+
console.error("[SWC-MIXIN] Script execution failed:", e);
|
|
218
210
|
}
|
|
219
211
|
}
|
|
212
|
+
this._connected(this);
|
|
220
213
|
this.__swc_engine?.config?.onConnected?.(this);
|
|
214
|
+
this._connectedDone(this);
|
|
221
215
|
}
|
|
222
216
|
disconnectedCallback() {
|
|
223
|
-
|
|
217
|
+
super.disconnectedCallback?.();
|
|
224
218
|
this._routerSubscription?.unsubscribe();
|
|
225
219
|
this._routerSubscription = void 0;
|
|
226
220
|
this._lastRouterEvent = void 0;
|
|
227
221
|
this.__swc_engine.disconnect();
|
|
228
222
|
this.__swc_engine?.config?.onDisconnected?.(this);
|
|
223
|
+
this._disconnected(this);
|
|
229
224
|
}
|
|
230
225
|
async routing(path) {
|
|
231
226
|
await this.router?.go(path);
|
|
@@ -270,6 +265,9 @@ function SwcAppMixin(Base) {
|
|
|
270
265
|
};
|
|
271
266
|
}
|
|
272
267
|
export {
|
|
273
|
-
SwcAppMixin
|
|
268
|
+
SwcAppMixin,
|
|
269
|
+
isSSR,
|
|
270
|
+
removeSSRAttribute,
|
|
271
|
+
setSSRAttribute
|
|
274
272
|
};
|
|
275
273
|
//# sourceMappingURL=SwcAppMixin.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/elements/SwcAppMixin.ts"],
|
|
4
|
-
"sourcesContent": ["import {SwcAppEngine, SwcAttributeConfigType, SwcConfigType} from './SwcAppEngine';\nimport {SwcAppInterface, SwcAppMessage} from '../types';\nimport {SwcUtils} from '../utils/Utils';\nimport {debounceTimeIntervalLock, FunctionUtils, Subscription} from '@dooboostore/core';\nimport {RouterEventType} from '@dooboostore/core-web';\nimport {getSubscribeSwcAppRouteChangeWhileConnectedMetadata} from '../decorators/subscribeSwcAppRouteChangeWhileConnected';\nimport {getSubscribeSwcAppMessageWhileConnectedMetadata} from '../decorators/subscribeSwcAppMessageWhileConnected';\n\nexport function SwcAppMixin<T extends { new(...args: any[]): HTMLElement }>(Base: T) {\n //@ts-ignore\n return class extends Base implements SwcAppInterface {\n __swc_engine = new SwcAppEngine(this as any);\n _swc_connected_instance = new Set<any>();\n // _swc_notified_routes = new WeakMap<any, RouterEventType>();\n _routerSubscription?: Subscription;\n _lastRouterEvent?: RouterEventType;\n _routeChangeInvocations = 0;\n _connectedInvocations = 0;\n\n _childrenRouteChangedInterval: any;\n _childrenConnectedDoneInterval: any;\n\n /*\n \uC0AC\uD30C\uB9AC is \uC77C\uACBD\uC6B0\n <script src=\"https://unpkg.com/@ungap/custom-elements\"></script>\n \uC774\uAC78\uC0AC\uC6A9\uD558\uB294\uB370 is \uB300\uC751\uD558\uB294\uAC70\uB2E4 \uADF8\uB7F0\uB370 \uC774\uB54C \uCC98\uB9AC\uB418\uB294 \uC21C\uC11C\uAC00 \uD06C\uB86C\uC774\uB098 \uD45C\uC900\uC5D0\uC11C\uB294 \uBD80\uBAA8\uBD80\uD130 \uB9CC\uB4E4\uC5B4\uC9C0\uACE0 \uC790\uC2DD\uB4E4\uC774 \uB9CC\uB4E4\uC5B4\uC9C0\uB294\uB370\n \uC800 polyfill\uC5D0\uC11C\uB294 \uC790\uC2DD\uBD80\uD130 \uB9CC\uB4E4\uC5B4\uC9C0\uACE0 \uBD80\uBAA8\uAC00 \uB9CC\uB4E4\uC5B4\uC9C4\uB2E4 is\uC77C\uB54C \uC544 .. \uC774\uBB38\uC81C\uB54C\uBB38\uC5D0 \uC790\uC2DD\uC774 _connected_safari \uC5D0 \uAC15\uC81C\uB85C \uC790\uAE30\uC790\uC2DD\uB123\uC5B4\uC900\uB2E4\n */\n _connected_safari = [];\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: any, re: RouterEventType) {\n if (instance.isConnected === false) return;\n\n this._routeChangeInvocations++;\n\n if (this._childrenRouteChangedInterval) {\n clearInterval(this._childrenRouteChangedInterval);\n }\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 {setInterval: window.setInterval, clearInterval: window.clearInterval}\n // {setInterval: window.setInterval, clearInterval: window.clearInterval}\n );\n\n\n // debounceTimeIntervalLock({\n // unlockChecker: () => this._routeChangeInvocations === 0,\n // unlocked: () => this.config.onChildrenRouteChanged(re, this)\n // }, {\n // intervalId: this._childrenRouteChangedInterval,\n // setIntervalId: (id) => this._childrenRouteChangedInterval = id,\n // intervalTime: this.config?.childrenRouteChangedCheckIntervalTime ?? 30\n // }, {\n // setInterval: window.setInterval,\n // clearInterval: window.clearInterval\n // });\n\n try {\n // if (this._swc_notified_routes.get(instance) === re) {\n // return;\n // }\n // this._swc_notified_routes.set(instance, re);\n\n const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);\n if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {\n const ps = routeChangeSubscribers.map(async metadata => {\n const methodName = metadata.propertyKey;\n let pathPattern = metadata.options?.path as any;\n const filter = metadata.options?.filter;\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 filterPassed = !filter || filter(this.router!, instance);\n\n if (pathMatched && filterPassed && instance[methodName]) {\n await instance[methodName]({...re, pathData: pathData});\n }\n });\n await Promise.allSettled(ps);\n }\n } finally {\n this._routeChangeInvocations--;\n }\n }\n\n async _connected(instance: any) {\n if (instance) {\n this._connectedInvocations++;\n this._swc_connected_instance.add(instance);\n\n if (this._childrenConnectedDoneInterval) {\n clearInterval(this._childrenConnectedDoneInterval);\n }\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 {setInterval: window.setInterval, clearInterval: window.clearInterval}\n );\n\n\n if (this.simpleApplication) {\n try {\n // await this._invokeOnConnectedSwcAppStarted(instance);\n\n if (this.router && this._lastRouterEvent) {\n await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent!);\n }\n } catch (e) {\n throw e;\n }\n }\n }\n }\n\n async _connectedDone(instance: any) {\n try {\n // \uB0B4\uBD80 \uC5F0\uACB0 \uCC98\uB9AC \uB85C\uC9C1\uC774 \uC788\uB2E4\uBA74 \uC5EC\uAE30\uC5D0 \uCD94\uAC00\n } finally {\n this._connectedInvocations--;\n }\n }\n\n _disconnected(instance: any) {\n // console.log('_disconnected', instance);\n if (instance) {\n this._swc_connected_instance.delete(instance);\n // this._swc_notified_routes.delete(instance);\n }\n }\n\n async _handleRouteChange(route: RouterEventType) {\n // Save last router event\n this._lastRouterEvent = route;\n // if (route.triggerPoint === 'end') {\n // Iterate through all connected component instances\n const swcConnectedInstance = Array.from(this._swc_connected_instance);\n // console.log('routing handle-->', swcConnectedInstance)\n const ps = swcConnectedInstance.map((instance: any) => this._invokeRouteChangeSubscribers(instance, route));\n await Promise.allSettled(ps);\n // }\n }\n\n async connect(config?: SwcAttributeConfigType) {\n const swcConfig = {\n routeType: 'element',\n window: config?.window,\n ...config\n } as SwcConfigType;\n\n const mode = config?.connectMode || 'direct';\n\n if (mode === 'direct') {\n await this.__swc_engine.connect(swcConfig);\n this.setAttribute('swc-connect-mode', 'direct');\n } else if (mode === 'swap' || mode === 'clear-swap') {\n if (!this.parentNode) {\n // \uBD80\uBAA8\uAC00 \uC5C6\uC73C\uBA74 swap\uC744 \uD560 \uC218 \uC5C6\uC73C\uBBC0\uB85C direct\uB85C \uD3F4\uBC31\uD569\uB2C8\uB2E4.\n await this.__swc_engine.connect(swcConfig);\n this.setAttribute('swc-connect-mode', 'direct');\n } else {\n // 1. \uD604\uC7AC SSR \uC0C1\uD0DC(\uD654\uBA74)\uB97C \uADF8\uB300\uB85C \uC720\uC9C0\uD55C \uCC44\uB85C, \uBC31\uADF8\uB77C\uC6B4\uB4DC\uC6A9 \uD074\uB860\uC744 \uB9CC\uB4ED\uB2C8\uB2E4.\n const clonedApp = this.cloneNode(mode === 'swap') as any; // clear-swap \uBAA8\uB4DC\uBA74 \uC790\uC2DD \uB178\uB4DC\uB97C \uD074\uB860\uD558\uC9C0 \uC54A\uC74C(false)\n clonedApp.style.display = 'none';\n\n // 2. DOM\uC5D0 \uD074\uB860\uC744 \uBAB0\uB798 \uBD99\uC785\uB2C8\uB2E4.\n this.parentNode.insertBefore(clonedApp, this.nextSibling);\n\n try {\n // 3. \uD074\uB860\uC744 direct \uBAA8\uB4DC\uB85C \uC5F0\uACB0(\uCD08\uAE30\uD654/\uB80C\uB354\uB9C1) \uC2DC\uD0B5\uB2C8\uB2E4.\n await clonedApp.connect({...(config || {}), connectMode: 'direct'});\n\n // 4. \uD074\uB860\uC758 \uB80C\uB354\uB9C1\uC774 \uC644\uC804\uD788 \uB05D\uB098\uBA74, \uAE30\uC874 SSR \uD654\uBA74(this)\uC744 \uC9C0\uC6B0\uACE0 \uD074\uB860\uC744 \uBCF4\uC5EC\uC90D\uB2C8\uB2E4.\n if (this.parentNode) {\n this.parentNode.removeChild(this);\n }\n clonedApp.style.display = '';\n clonedApp.setAttribute('swc-connect-mode', mode);\n\n // \u2605 \uB9E4\uC6B0 \uC911\uC694: \uAD50\uCCB4\uAC00 \uC644\uB8CC\uB418\uC5C8\uC73C\uBBC0\uB85C \uAE30\uC874 \uC571(this)\uC740 \uC5EC\uAE30\uC11C \uC989\uC2DC \uC885\uB8CC\uD558\uC5EC \uBD88\uD544\uC694\uD55C \uB77C\uC6B0\uD130/\uC774\uBCA4\uD2B8 \uAD6C\uB3C5\uC744 \uB9C9\uC544\uC57C \uD569\uB2C8\uB2E4!\n return;\n } catch (e) {\n // \uC2E4\uD328 \uC2DC \uD074\uB860\uC744 \uC9C0\uC6B0\uACE0 \uC6D0\uBCF8\uC744 direct\uB85C \uAC15\uC81C \uC5F0\uACB0\uD569\uB2C8\uB2E4.\n if (clonedApp.parentNode) {\n clonedApp.parentNode.removeChild(clonedApp);\n }\n await this.__swc_engine.connect(swcConfig);\n this.setAttribute('swc-connect-mode', 'direct');\n }\n }\n }\n\n // \uC0AC\uD30C\uB9AC\uC77C\uB584 \uC608\uC678\uC774\uB2E4 is \uC77C\uB54C polyfill\uB418\uB294\uB370 \uC774\uB584 \uBD80\uBAA8\uBD80\uD130 \uB9CC\uB4E4\uC5B4\uC9C0\uB294\uAC8C \uC544\uB2C8\uB77C \uC790\uC2DD\uBD80\uD130 \uB9CC\uB4E4\uC5B4\uC9C4\uB2E4 \uADF8\uB798\uC11C \uBD80\uBAA8\uAC00 \uB9CC\uB4E4\uC5B4\uC9C8\uB54C \uC790\uC2DD\uB4E4\uC774 \uC774\uBBF8 \uB9CC\uB4E4\uC5B4\uC838\uC788\uC5B4\uC11C \uBD80\uBAA8\uAC00 \uC790\uC2DD\uB4E4\uC744 \uB4F1\uB85D\uD574\uC8FC\uB294 \uD615\uD0DC\uB85C \uAC15\uC81C\uB85C \uB4F1\uB85D\uD574\uC900\uB2E4\n this._connected_safari.forEach((instance: any) => {\n // console.log('safari!!!!!!!!!!', instance)\n this._connected(instance);\n // this._swc_connected_instance.add(instance);\n });\n // Invoke @onConnectedSwcApp lifecycle methods on all connected component instances\n // const hostSet = SwcUtils.getHostSet(this as any);\n\n // const scis = Array.from(this._swc_connected_instance);\n // await Promise.allSettled(scis.map(instance => this._invokeOnConnectedSwcAppStarted(instance)));\n\n // this._swc_connected_instance.forEach((instance: any) => {\n // this._invokeOnConnectedSwcAppStarted(instance);\n // });\n\n // Subscribe to router changes after connect\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] Router event received:', route.triggerPoint);\n if (route.triggerPoint === 'end') {\n // 1. \uBAA8\uB4E0 \uAE30\uC874 \uC5F0\uACB0\uB41C \uC790\uC2DD\uB4E4\uC5D0\uAC8C \uB77C\uC6B0\uD2B8 \uC774\uBCA4\uD2B8 \uC54C\uB9BC\n await this._handleRouteChange(route);\n }\n });\n\n // Navigate to initial path if specified\n if (config?.path) {\n // console.log('[DEBUG] Navigating to initial path:', config.path);\n this.router.go(config.path);\n }\n }\n }\n\n // async _invokeOnConnectedSwcAppStarted(instance: any) {\n // this._swcAppStartedInvocations++;\n // try {\n // // \uC774\uBBF8 \uC2DC\uC791\uB41C \uC778\uC2A4\uD134\uC2A4\uB77C\uBA74 \uC2A4\uD0B5 (\uBE44\uB3D9\uAE30 \uBCD1\uB82C \uC911\uBCF5 \uD638\uCD9C \uBC29\uC9C0)\n // if (this._swc_started_instances.has(instance)) return;\n // this._swc_started_instances.add(instance);\n //\n // const startedMethods = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);\n // if (startedMethods) {\n // const ps = startedMethods.map(m => instance._invokeLifecycleMethod(m));\n // await Promise.allSettled(ps);\n // }\n // } finally {\n // this._swcAppStartedInvocations--;\n // }\n // }\n\n connectedCallback() {\n // this.innerHTML='';\n // @ts-ignore\n if (super.connectedCallback) 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 // console.log('vvvvvvvvvvvvvvvv->>>>', SwcUtils.findNearestSwcHost(this.host), SwcUtils.getHostSet(this.host))\n const userConfig = FunctionUtils.executeReturn({\n script: configStr,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n this.connect(userConfig);\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Script execution failed:', e);\n }\n }\n\n this.__swc_engine?.config?.onConnected?.(this);\n }\n\n disconnectedCallback() {\n // @ts-ignore\n if (super.disconnectedCallback) super.disconnectedCallback();\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 }\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 // \uBA54\uC2DC\uC9C0\uB97C \uBAA8\uB4E0 connected component instances\uB85C \uBD84\uBC30\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 // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uD655\uC778\n let typeMatched = false;\n if (!messageType) {\n // messageType\uC774 \uC5C6\uC73C\uBA74 \uBAA8\uB4E0 \uBA54\uC2DC\uC9C0 \uB9E4\uCE6D (\uC640\uC77C\uB4DC\uCE74\uB4DC)\n typeMatched = true;\n } else if (message.type === messageType) {\n typeMatched = true;\n }\n\n // \uD544\uD130 \uC801\uC6A9\n let filterMatched = true;\n if (filter && typeMatched) {\n filterMatched = filter(message, instance);\n }\n\n // \uC870\uAC74\uC744 \uB9CC\uC871\uD558\uBA74 \uBA54\uC11C\uB4DC \uD638\uCD9C\n if (typeMatched && filterMatched && typeof instance[methodName] === 'function') {\n instance[methodName](message);\n }\n });\n }\n }\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;
|
|
4
|
+
"sourcesContent": ["import {SwcAppInterface, SwcAppMessage} from \"../types\";\nimport {findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY} from \"../decorators\";\nimport {SwcAppEngine, SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\nimport {debounceTimeIntervalLock, FunctionUtils, Subscription} from \"@dooboostore/core\";\nimport {RouterEventType} 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 if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {\n console.log('[SWC-MIXIN] Route change subscribers found')\n const ps = routeChangeSubscribers.map(async metadata => {\n const methodName = metadata.propertyKey;\n let pathPattern = metadata.options?.path as any;\n const filter = metadata.options?.filter;\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 await instance[methodName]({...re, pathData: pathData});\n }\n });\n await Promise.allSettled(ps);\n }\n } finally {\n if (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);\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 if (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 this.connect(userConfig);\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,SAAQ,0BAA0B,iDAAiD,qDAAqD,yCAAwC;AAChL,SAAQ,oBAA0D;AAClE,SAAQ,0BAA0B,qBAAk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aAAa,SAAS;AAC5B,gBAAM,cAAc,SAAS;AAC7B,gBAAM,SAAS,SAAS;AAExB,cAAI,cAAc;AAClB,cAAI,CAAC,aAAa;AAChB,0BAAc;AAAA,UAChB,WAAW,QAAQ,SAAS,aAAa;AACvC,0BAAc;AAAA,UAChB;AAEA,cAAI,gBAAgB;AACpB,cAAI,UAAU,aAAa;AACzB,4BAAgB,OAAO,SAAS,QAAQ;AAAA,UAC1C;AAEA,cAAI,eAAe,iBAAiB,OAAO,SAAS,UAAU,MAAM,YAAY;AAC9E,qBAAS,UAAU,EAAE,OAAO;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/elements/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './register';\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// export * from './tt/register';\nexport * from './SwcAppMixin'\nexport * from './SwcApp'\n\n"],
|
|
5
|
+
"mappings": "AACA,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcAppMixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcAsyncTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcChoose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcChooseTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcIf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcIfTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcLoop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcLoopTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SwcSubTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=register.js.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
|
|
2
|
+
export * from "./elements/index.js";
|
|
3
|
+
import { defineSwcAppAll } from "./elements/index.js";
|
|
3
4
|
export * from "./decorators/index.js";
|
|
4
|
-
export * from "./types.js";
|
|
5
|
+
export * from "./types/index.js";
|
|
5
6
|
export * from "./utils/Utils.js";
|
|
6
7
|
export * from "./config/config.js";
|
|
7
|
-
var src_default = (w, other) => {
|
|
8
|
-
const cr =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
var src_default = async (w, other) => {
|
|
9
|
+
const cr = await defineSwcAppAll(w);
|
|
10
|
+
if (other) {
|
|
11
|
+
for (const fn of other) {
|
|
12
|
+
if (typeof fn === "function") {
|
|
13
|
+
await fn(w);
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
|
-
}
|
|
16
|
+
}
|
|
15
17
|
return cr;
|
|
16
18
|
};
|
|
17
19
|
export {
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import 'reflect-metadata';\nimport {
|
|
5
|
-
"mappings": "AAAA,OAAO;AACP,SAAS,
|
|
4
|
+
"sourcesContent": ["import 'reflect-metadata';\nexport * from './elements'\nimport { defineSwcAppAll } from './elements';\nimport {ConstructorType} from \"@dooboostore/core\";\n\n// Decorators\nexport * from './decorators';\n\n// Types\nexport * from './types';\n\n// Utilities\nexport * from './utils/Utils';\n\n// Config\nexport * from './config/config';\n\n// Registration Factory\nexport default async (w: Window, other?: (((w: Window) => Promise<CustomElementConstructor> | CustomElementConstructor) | any) []) => {\n const cr = await defineSwcAppAll(w);\n // const cr = await elementFactories(w);\n if (other) {\n for (const fn of other) {\n if (typeof fn === 'function') {\n await fn(w);\n }\n }\n }\n\n return cr;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO;AACP,cAAc;AACd,SAAS,uBAAuB;AAIhC,cAAc;AAGd,cAAc;AAGd,cAAc;AAGd,cAAc;AAGd,IAAO,cAAQ,OAAO,GAAW,UAAqG;AACpI,QAAM,KAAK,MAAM,gBAAgB,CAAC;AAElC,MAAI,OAAO;AACT,eAAW,MAAM,OAAO;AACtB,UAAI,OAAO,OAAO,YAAY;AAC5B,cAAM,GAAG,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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}"],
|
|
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
|
+
"names": ["InjectSituationType"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=window.d.js.map
|