@dooboostore/simple-web-component 1.0.37 → 1.0.39

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.
Files changed (157) hide show
  1. package/README.md +280 -791
  2. package/dist/cjs/SwcAppEngine.js +3 -0
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/addEventListener.js +20 -4
  5. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  6. package/dist/cjs/decorators/applyAttribute.js.map +1 -1
  7. package/dist/cjs/decorators/applyClass.js.map +1 -1
  8. package/dist/cjs/decorators/applyNode.js +104 -35
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applySlot.js +69 -57
  11. package/dist/cjs/decorators/applySlot.js.map +3 -3
  12. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  13. package/dist/cjs/decorators/attribute.js.map +1 -1
  14. package/dist/cjs/decorators/elementDefine.js +65 -42
  15. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  16. package/dist/cjs/decorators/emitCustomEvent.js.map +1 -1
  17. package/dist/cjs/decorators/index.js +1 -0
  18. package/dist/cjs/decorators/index.js.map +2 -2
  19. package/dist/cjs/decorators/lifecycles.js +47 -31
  20. package/dist/cjs/decorators/lifecycles.js.map +3 -3
  21. package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
  22. package/dist/cjs/decorators/query.js +1 -1
  23. package/dist/cjs/decorators/query.js.map +2 -2
  24. package/dist/cjs/decorators/queryAll.js.map +1 -1
  25. package/dist/cjs/decorators/setProperty.js.map +1 -1
  26. package/dist/cjs/decorators/state.js +83 -0
  27. package/dist/cjs/decorators/state.js.map +7 -0
  28. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  29. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  30. package/dist/cjs/elements/SwcApp.js +193 -305
  31. package/dist/cjs/elements/SwcApp.js.map +3 -3
  32. package/dist/cjs/elements/SwcAppMixin.js +291 -0
  33. package/dist/cjs/elements/SwcAppMixin.js.map +7 -0
  34. package/dist/cjs/elements/index.js +3 -21
  35. package/dist/cjs/elements/index.js.map +3 -3
  36. package/dist/cjs/index.js +1 -3
  37. package/dist/cjs/index.js.map +2 -2
  38. package/dist/cjs/{types.js → types/index.js} +1 -1
  39. package/dist/cjs/types/index.js.map +7 -0
  40. package/dist/cjs/types/window.d.js.map +1 -1
  41. package/dist/cjs/utils/Utils.js +159 -20
  42. package/dist/cjs/utils/Utils.js.map +3 -3
  43. package/dist/esm/SwcAppEngine.js +3 -0
  44. package/dist/esm/SwcAppEngine.js.map +2 -2
  45. package/dist/esm/decorators/addEventListener.js +20 -4
  46. package/dist/esm/decorators/addEventListener.js.map +2 -2
  47. package/dist/esm/decorators/applyAttribute.js.map +1 -1
  48. package/dist/esm/decorators/applyClass.js.map +1 -1
  49. package/dist/esm/decorators/applyNode.js +104 -35
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applySlot.js +69 -57
  52. package/dist/esm/decorators/applySlot.js.map +3 -3
  53. package/dist/esm/decorators/applyStyle.js.map +2 -2
  54. package/dist/esm/decorators/attribute.js.map +1 -1
  55. package/dist/esm/decorators/elementDefine.js +69 -46
  56. package/dist/esm/decorators/elementDefine.js.map +2 -2
  57. package/dist/esm/decorators/emitCustomEvent.js.map +1 -1
  58. package/dist/esm/decorators/index.js +1 -0
  59. package/dist/esm/decorators/index.js.map +2 -2
  60. package/dist/esm/decorators/lifecycles.js +47 -31
  61. package/dist/esm/decorators/lifecycles.js.map +3 -3
  62. package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
  63. package/dist/esm/decorators/query.js +1 -1
  64. package/dist/esm/decorators/query.js.map +2 -2
  65. package/dist/esm/decorators/queryAll.js.map +1 -1
  66. package/dist/esm/decorators/setProperty.js.map +1 -1
  67. package/dist/esm/decorators/state.js +64 -0
  68. package/dist/esm/decorators/state.js.map +7 -0
  69. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  70. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  71. package/dist/esm/elements/SwcApp.js +195 -307
  72. package/dist/esm/elements/SwcApp.js.map +3 -3
  73. package/dist/esm/elements/SwcAppMixin.js +273 -0
  74. package/dist/esm/elements/SwcAppMixin.js.map +7 -0
  75. package/dist/esm/elements/index.js +2 -7
  76. package/dist/esm/elements/index.js.map +2 -2
  77. package/dist/esm/index.js +2 -4
  78. package/dist/esm/index.js.map +2 -2
  79. package/dist/esm/{types.js → types/index.js} +1 -1
  80. package/dist/esm/types/index.js.map +7 -0
  81. package/dist/esm/utils/Utils.js +159 -20
  82. package/dist/esm/utils/Utils.js.map +3 -3
  83. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3448 -2584
  84. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  85. package/dist/types/SwcAppEngine.d.ts +1 -1
  86. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  87. package/dist/types/decorators/addEventListener.d.ts +5 -2
  88. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  89. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  90. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  91. package/dist/types/decorators/applyNode.d.ts +23 -7
  92. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  93. package/dist/types/decorators/applySlot.d.ts +14 -12
  94. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  95. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  96. package/dist/types/decorators/attribute.d.ts.map +1 -1
  97. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  98. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  99. package/dist/types/decorators/index.d.ts +1 -0
  100. package/dist/types/decorators/index.d.ts.map +1 -1
  101. package/dist/types/decorators/lifecycles.d.ts +10 -14
  102. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  103. package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
  104. package/dist/types/decorators/query.d.ts +1 -1
  105. package/dist/types/decorators/query.d.ts.map +1 -1
  106. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  107. package/dist/types/decorators/setProperty.d.ts +1 -1
  108. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  109. package/dist/types/decorators/state.d.ts +9 -0
  110. package/dist/types/decorators/state.d.ts.map +1 -0
  111. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  112. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +5 -1
  113. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  114. package/dist/types/elements/SwcApp.d.ts +35 -6
  115. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  116. package/dist/types/elements/SwcAppMixin.d.ts +405 -0
  117. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -0
  118. package/dist/types/elements/index.d.ts +2 -2
  119. package/dist/types/elements/index.d.ts.map +1 -1
  120. package/dist/types/index.d.ts +1 -1
  121. package/dist/types/index.d.ts.map +1 -1
  122. package/dist/types/{types.d.ts → types/index.d.ts} +11 -11
  123. package/dist/types/types/index.d.ts.map +1 -0
  124. package/dist/types/utils/Utils.d.ts +14 -2
  125. package/dist/types/utils/Utils.d.ts.map +1 -1
  126. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3431 -2567
  127. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  128. package/package.json +4 -4
  129. package/src/SwcAppEngine.ts +6 -2
  130. package/src/decorators/addEventListener.ts +21 -5
  131. package/src/decorators/applyAttribute.ts +1 -1
  132. package/src/decorators/applyClass.ts +1 -1
  133. package/src/decorators/applyNode.ts +183 -73
  134. package/src/decorators/applySlot.ts +99 -128
  135. package/src/decorators/applyStyle.ts +4 -4
  136. package/src/decorators/attribute.ts +1 -1
  137. package/src/decorators/elementDefine.ts +112 -60
  138. package/src/decorators/emitCustomEvent.ts +1 -1
  139. package/src/decorators/index.ts +2 -0
  140. package/src/decorators/lifecycles.ts +50 -26
  141. package/src/decorators/publishSwcAppMessage.ts +2 -3
  142. package/src/decorators/query.ts +4 -4
  143. package/src/decorators/queryAll.ts +1 -1
  144. package/src/decorators/setProperty.ts +1 -1
  145. package/src/decorators/state.ts +83 -0
  146. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -1
  147. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +4 -3
  148. package/src/elements/SwcApp.ts +239 -441
  149. package/src/elements/SwcAppMixin.ts +328 -0
  150. package/src/elements/index.ts +2 -9
  151. package/src/index.ts +2 -4
  152. package/src/{types.ts → types/index.ts} +13 -10
  153. package/src/types/window.d.ts +3 -0
  154. package/src/utils/Utils.ts +205 -20
  155. package/dist/cjs/types.js.map +0 -7
  156. package/dist/esm/types.js.map +0 -7
  157. package/dist/types/types.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcApp.ts"],
4
- "sourcesContent": ["import {SwcAppInterface, SwcAppMessage} from \"../types\";\nimport {elementDefine, 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\nexport const tagName = 'swc-app';\nexport default async (w: Window) => {\n const existing = w.customElements.get(tagName);\n if (existing) return existing;\n\n @elementDefine(tagName, {window: w})\n class SwcApp extends w.HTMLElement 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 사파리 is 일경우\n <script src=\"https://unpkg.com/@ungap/custom-elements\"></script>\n 이걸사용하는데 is 대응하는거다 그런데 이때 처리되는 순서가 크롬이나 표준에서는 부모부터 만들어지고 자식들이 만들어지는데\n 저 polyfill에서는 자식부터 만들어지고 부모가 만들어진다 is일때 아 .. 이문제때문에 자식이 _connected_safari 에 강제로 자기자식넣어준다\n */\n _connected_safari_and_standby = [];\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 // {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 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 // console.log('_connected-->', instance.tagName, this._connectedInvocations)\n\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 // console.log('onChildConnectedDone-->')\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 if (this.config?.ssr) {\n setSSRAttribute(instance);\n } else {\n removeSSRAttribute(instance);\n }\n }\n\n\n this.config.onConnectedChildAfter?.(instance);\n return this;\n }\n\n async _connectedDone(instance: any) {\n try {\n // 내부 연결 처리 로직이 있다면 여기에 추가\n // console.log('_connectedDone-->', instance, this._connectedInvocations)\n } finally {\n this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);\n }\n }\n\n _disconnected(instance: any) {\n // console.log('_disconnected', instance);\n if (instance) {\n this._swc_connected_instance.delete(instance);\n this.config?.onDisconnectedChildAfter?.(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 console.log('[SWC] connect')\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' || mode === 'hydrate') {\n this.setAttribute('swc-connect-mode', mode);\n await this.__swc_engine.connect(swcConfig);\n } else if (mode === 'swap' || mode === 'clear-swap') {\n if (!this.parentNode) {\n // 부모가 없으면 swap을 할 수 없으므로 direct로 폴백합니다.\n await this.__swc_engine.connect(swcConfig);\n this.setAttribute('swc-connect-mode', 'direct');\n } else {\n // 1. 현재 SSR 상태(화면)를 그대로 유지한 채로, 백그라운드용 클론을 만듭니다.\n const clonedApp = this.cloneNode(mode === 'swap') as any; // clear-swap 모드면 자식 노드를 클론하지 않음(false)\n clonedApp.style.display = 'none';\n\n // 2. DOM에 클론을 몰래 붙입니다.\n this.parentNode.insertBefore(clonedApp, this.nextSibling);\n\n try {\n // 3. 클론을 direct 모드로 연결(초기화/렌더링) 시킵니다.\n await clonedApp.connect({...(config || {}), connectMode: 'direct'});\n\n // 4. 클론의 렌더링이 완전히 끝나면, 기존 SSR 화면(this)을 지우고 클론을 보여줍니다.\n if (this.parentNode) {\n this.parentNode.removeChild(this);\n }\n clonedApp.style.display = '';\n clonedApp.setAttribute('swc-connect-mode', mode);\n\n // ★ 매우 중요: 교체가 완료되었으므로 기존 앱(this)은 여기서 즉시 종료하여 불필요한 라우터/이벤트 구독을 막아야 합니다!\n return;\n } catch (e) {\n // 실패 시 클론을 지우고 원본을 direct로 강제 연결합니다.\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 // 사파리일떄 예외이다 is 일때 polyfill되는데 이떄 부모부터 만들어지는게 아니라 자식부터 만들어진다 그래서 부모가 만들어질때 자식들이 이미 만들어져있어서 부모가 자식들을 등록해주는 형태로 강제로 등록해준다\n this._connected_safari_and_standby.forEach((instance: any) => {\n // console.log('safari!!!!!!!!!!', instance)\n this._connected(instance, {noIncrements: true});\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. 모든 기존 연결된 자식들에게 라우트 이벤트 알림\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 // // 이미 시작된 인스턴스라면 스킵 (비동기 병렬 중복 호출 방지)\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 // 자기자신은 apphost로 포함이 도지않으니(부모) 내자신은 self로 넣는다\n this._connected(this);\n this.__swc_engine?.config?.onConnected?.(this);\n this._connectedDone(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 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 // async completedSwcApp() {\n // const ss = Array.from(this._swc_connected_instance).flatMap((it) => {\n // const ms = findAllLifecycleMetadata(it, ON_CONNECTED_COMPLETED_SWC_APP_METADATA_KEY) ?? [];\n // return ms.map((sit) => it[sit](this));\n // });\n // await Promise.allSettled(ss);\n // }\n\n publishMessage(message: SwcAppMessage): void {\n // 메시지를 모든 connected component instances로 분배\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 // 메시지 타입 확인\n let typeMatched = false;\n if (!messageType) {\n // messageType이 없으면 모든 메시지 매칭 (와일드카드)\n typeMatched = true;\n } else if (message.type === messageType) {\n typeMatched = true;\n }\n\n // 필터 적용\n let filterMatched = true;\n if (filter && typeMatched) {\n filterMatched = filter(message, instance);\n }\n\n // 조건을 만족하면 메서드 호출\n if (typeMatched && filterMatched && typeof instance[methodName] === 'function') {\n instance[methodName](message);\n }\n });\n }\n }\n };\n\n\n return w.customElements.whenDefined(tagName);\n\n\n}"],
5
- "mappings": ";;;;;;AACA,SAAQ,eAAe,0BAA0B,iDAAiD,qDAAsD,yCAAwC;AAChM,SAAQ,oBAA0D;AAClE,SAAQ,0BAA0B,qBAAkC;AAEpE,SAAQ,gBAAe;AAEhB,MAAM,QAAQ,CAAC,MAAkB;AACtC,SAAO,EAAE,aAAa,aAAa;AACrC;AACO,MAAM,kBAAkB,CAAC,MAAkB;AAChD,IAAE,aAAa,eAAgB,EAAU,UAAU,EAAE;AACvD;AACO,MAAM,qBAAqB,CAAC,MAAkB;AACnD,IAAE,gBAAgB,aAAa;AACjC;AAGO,MAAM,UAAU;AACvB,IAAA,iBAAe,OAAO,MAAa;AACjC,QAAM,WAAW,EAAE,eAAe,IAAI,OAAO;AAC7C,MAAI;AAAU,WAAO;AAGrB,MAAM,SAAN,MAAM,eAAe,EAAE,YAAW;IAAlC,cAAA;;AACE,WAAA,eAAe,IAAI,aAAa,IAAW;AAC3C,WAAA,0BAA0B,oBAAI,IAAG;AAIjC,WAAA,0BAA0B;AAC1B,WAAA,wBAAwB;AAWxB,WAAA,gCAAgC,CAAA;IA0YlC;IAxYE,IAAI,oBAAiB;AACnB,aAAO,KAAK,aAAa;IAC3B;IAEA,IAAI,SAAM;AACR,aAAO,KAAK,cAAc;IAC5B;IAEA,IAAI,SAAM;AACR,aAAO,KAAK,cAAc;IAC5B;IAEA,MAAM,8BAA8B,UAAuB,IAAmB;AAC5E,UAAI,SAAS,gBAAgB;AAAO;AAEpC,WAAK;AAEL,UAAI,KAAK,+BAA+B;AACtC,aAAK,OAAO,OAAO,cAAc,KAAK,6BAA6B;MACrE;AACA,YAAM,iB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AChD,WAAK,cAAc,IAAI;IACzB;IAEA,MAAM,QAAQ,MAAY;AACxB,YAAM,KAAK,QAAQ,GAAG,IAAI;IAC5B;IAEA,OAAI;AACF,WAAK,QAAQ,KAAI;IACnB;IAEA,UAAO;AACL,WAAK,QAAQ,QAAO;IACtB;IAEA,SAAM;AACJ,WAAK,QAAQ,OAAM;IACrB;;;;;;;;IAUA,eAAe,SAAsB;AAEnC,WAAK,wBAAwB,QAAQ,CAAC,aAAiB;AACrD,aAAK,0BAA0B,UAAU,OAAO;MAClD,CAAC;IACH;IAEA,0BAA0B,UAAe,SAAsB;AAC7D,YAAM,qBAAqB,gDAAgD,QAAQ;AACnF,UAAI,sBAAsB,MAAM,QAAQ,kBAAkB,GAAG;AAC3D,2BAAmB,QAAQ,cAAW;AACpC,gBAAM,aAAa,SAAS;AAC5B,gBAAM,cAAc,SAAS;AAC7B,gBAAM,SAAS,SAAS;AAGxB,cAAI,cAAc;AAClB,cAAI,CAAC,aAAa;AAEhB,0BAAc;UAChB,WAAW,QAAQ,SAAS,aAAa;AACvC,0BAAc;UAChB;AAGA,cAAI,gBAAgB;AACpB,cAAI,UAAU,aAAa;AACzB,4BAAgB,OAAO,SAAS,QAAQ;UAC1C;AAGA,cAAI,eAAe,iBAAiB,OAAO,SAAS,UAAU,MAAM,YAAY;AAC9E,qBAAS,UAAU,EAAE,OAAO;UAC9B;QACF,CAAC;MACH;IACF;;AA3ZI,WAAM,WAAA;IADX,cAAc,SAAS,EAAC,QAAQ,EAAC,CAAC;KAC7B,MAAM;AA4ZX;AAGD,SAAO,EAAE,eAAe,YAAY,OAAO;AAG7C;",
6
- "names": ["config"]
4
+ "sourcesContent": ["import {elementDefine} from \"../decorators\";\nimport {SwcAppInterface} from \"../types\";\nimport {SwcAppMixin} from \"./SwcAppMixin\";\nimport {SwcUtils, createElement, CreateElementConfig} from \"../utils/Utils\";\n\n// ============================================\n// SwcApp (HTMLElement)\n// ============================================\nexport const swcAppTagName = 'swc-app';\n\nexport const SwcApp = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface>(w, swcAppTagName, data);\n};\n\nexport const defineSwcApp = async (w: Window) => {\n const existing = w.customElements.get(swcAppTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppTagName, {window: w})\n class SwcAppImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppTagName);\n};\n\n// ============================================\n// SwcAppBody (HTMLBodyElement)\n// ============================================\nexport const swcAppBodyTagName = 'swc-app-body';\n\nexport const SwcAppBody = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLBodyElement>(w, swcAppBodyTagName, data);\n};\n\nexport const defineSwcAppBody = async (w: Window) => {\n const existing = w.customElements.get(swcAppBodyTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppBodyTagName, {window: w, extends: 'body'})\n class SwcAppBodyImpl extends SwcAppMixin(w.HTMLBodyElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppBodyTagName);\n};\n\n// ============================================\n// SwcAppDiv (HTMLDivElement)\n// ============================================\nexport const swcAppDivTagName = 'swc-app-div';\n\nexport const SwcAppDiv = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLDivElement>(w, swcAppDivTagName, data);\n};\n\nexport const defineSwcAppDiv = async (w: Window) => {\n const existing = w.customElements.get(swcAppDivTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppDivTagName, {window: w, extends: 'div'})\n class SwcAppDivImpl extends SwcAppMixin(w.HTMLDivElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppDivTagName);\n};\n\n// ============================================\n// SwcAppSection (HTMLElement)\n// ============================================\nexport const swcAppSectionTagName = 'swc-app-section';\n\nexport const SwcAppSection = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLElement>(w, swcAppSectionTagName, data);\n};\n\nexport const defineSwcAppSection = async (w: Window) => {\n const existing = w.customElements.get(swcAppSectionTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppSectionTagName, {window: w, extends: 'section'})\n class SwcAppSectionImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppSectionTagName);\n};\n\n// ============================================\n// SwcAppMain (HTMLElement)\n// ============================================\nexport const swcAppMainTagName = 'swc-app-main';\n\nexport const SwcAppMain = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLElement>(w, swcAppMainTagName, data);\n};\n\nexport const defineSwcAppMain = async (w: Window) => {\n const existing = w.customElements.get(swcAppMainTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppMainTagName, {window: w, extends: 'main'})\n class SwcAppMainImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppMainTagName);\n};\n\n// ============================================\n// SwcAppArticle (HTMLElement)\n// ============================================\nexport const swcAppArticleTagName = 'swc-app-article';\n\nexport const SwcAppArticle = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLElement>(w, swcAppArticleTagName, data);\n};\n\nexport const defineSwcAppArticle = async (w: Window) => {\n const existing = w.customElements.get(swcAppArticleTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppArticleTagName, {window: w, extends: 'article'})\n class SwcAppArticleImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppArticleTagName);\n};\n\n// ============================================\n// SwcAppHeader (HTMLElement)\n// ============================================\nexport const swcAppHeaderTagName = 'swc-app-header';\n\nexport const SwcAppHeader = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLElement>(w, swcAppHeaderTagName, data);\n};\n\nexport const defineSwcAppHeader = async (w: Window) => {\n const existing = w.customElements.get(swcAppHeaderTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppHeaderTagName, {window: w, extends: 'header'})\n class SwcAppHeaderImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppHeaderTagName);\n};\n\n// ============================================\n// SwcAppFooter (HTMLElement)\n// ============================================\nexport const swcAppFooterTagName = 'swc-app-footer';\n\nexport const SwcAppFooter = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLElement>(w, swcAppFooterTagName, data);\n};\n\nexport const defineSwcAppFooter = async (w: Window) => {\n const existing = w.customElements.get(swcAppFooterTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppFooterTagName, {window: w, extends: 'footer'})\n class SwcAppFooterImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppFooterTagName);\n};\n\n// ============================================\n// SwcAppNav (HTMLElement)\n// ============================================\nexport const swcAppNavTagName = 'swc-app-nav';\n\nexport const SwcAppNav = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLElement>(w, swcAppNavTagName, data);\n};\n\nexport const defineSwcAppNav = async (w: Window) => {\n const existing = w.customElements.get(swcAppNavTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppNavTagName, {window: w, extends: 'nav'})\n class SwcAppNavImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppNavTagName);\n};\n\n// ============================================\n// SwcAppAside (HTMLElement)\n// ============================================\nexport const swcAppAsideTagName = 'swc-app-aside';\n\nexport const SwcAppAside = (w: Window, data?: CreateElementConfig) => {\n return createElement<SwcAppInterface & HTMLElement>(w, swcAppAsideTagName, data);\n};\n\nexport const defineSwcAppAside = async (w: Window) => {\n const existing = w.customElements.get(swcAppAsideTagName);\n if (existing) return existing;\n\n @elementDefine(swcAppAsideTagName, {window: w, extends: 'aside'})\n class SwcAppAsideImpl extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n // SwcAppMixin에서 모든 기능을 상속받음\n }\n\n return w.customElements.whenDefined(swcAppAsideTagName);\n};\n\n// ============================================\n// Factory Array\n// ============================================\nexport const swcAppFactories = [\n defineSwcApp,\n defineSwcAppBody,\n defineSwcAppDiv,\n defineSwcAppSection,\n defineSwcAppMain,\n defineSwcAppArticle,\n defineSwcAppHeader,\n defineSwcAppFooter,\n defineSwcAppNav,\n defineSwcAppAside\n];\n\n// ============================================\n// Define All SwcApp Elements\n// ============================================\nexport const defineSwcAppAll = async (w: Window) => {\n await Promise.all(swcAppFactories.map(factory => factory(w)));\n return w.customElements.whenDefined(swcAppTagName);\n};\n\n// Default export for backward compatibility\nexport default defineSwcAppAll;"],
5
+ "mappings": ";;;;;;AAAA,SAAQ,qBAAoB;AAE5B,SAAQ,mBAAkB;AAC1B,SAAkB,qBAAyC;AAKpD,MAAM,gBAAgB;AAEtB,MAAM,SAAS,CAAC,GAAW,SAA8B;AAC9D,SAAO,cAA+B,GAAG,eAAe,IAAI;AAC9D;AAEO,MAAM,eAAe,OAAO,MAAa;AAC9C,QAAM,WAAW,EAAE,eAAe,IAAI,aAAa;AACnD,MAAI;AAAU,WAAO;AAGrB,MAAM,aAAN,MAAM,mBAAmB,YAAY,EAAE,WAAW,EAAC;;AAA7C,eAAU,WAAA;IADf,cAAc,eAAe,EAAC,QAAQ,EAAC,CAAC;KACnC,UAAU;AAIhB,SAAO,EAAE,eAAe,YAAY,aAAa;AACnD;AAKO,MAAM,oBAAoB;AAE1B,MAAM,aAAa,CAAC,GAAW,SAA8B;AAClE,SAAO,cAAiD,GAAG,mBAAmB,IAAI;AACpF;AAEO,MAAM,mBAAmB,OAAO,MAAa;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AE,eAAe,YAAY,aAAa;AACnD;AAGA,IAAA,iBAAe;",
6
+ "names": []
7
7
  }
@@ -0,0 +1,273 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY } from "../decorators/index.js";
5
+ import { SwcAppEngine } from "../SwcAppEngine.js";
6
+ import { debounceTimeIntervalLock, FunctionUtils } from "@dooboostore/core";
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
+ };
17
+ function SwcAppMixin(Base) {
18
+ return class SwcAppMixinClass extends Base {
19
+ constructor(...args) {
20
+ super(...args);
21
+ __publicField(this, "__swc_engine", new SwcAppEngine(this));
22
+ __publicField(this, "_swc_connected_instance", /* @__PURE__ */ new Set());
23
+ __publicField(this, "_routerSubscription");
24
+ __publicField(this, "_lastRouterEvent");
25
+ __publicField(this, "_routeChangeInvocations", 0);
26
+ __publicField(this, "_connectedInvocations", 0);
27
+ __publicField(this, "_childrenRouteChangedInterval");
28
+ __publicField(this, "_childrenConnectedDoneInterval");
29
+ /**
30
+ * Safari is 속성 처리
31
+ * Safari polyfill에서는 자식부터 만들어지고 부모가 만들어지므로
32
+ * 부모가 자식들을 강제로 등록해주는 형태로 처리
33
+ */
34
+ __publicField(this, "_connected_safari_and_standby", []);
35
+ console.log("[SWC-APP-MIXIN] constructor");
36
+ }
37
+ get simpleApplication() {
38
+ return this.__swc_engine.simpleApplication;
39
+ }
40
+ get config() {
41
+ return this.__swc_engine?.config;
42
+ }
43
+ get router() {
44
+ return this.__swc_engine?.router;
45
+ }
46
+ async _invokeRouteChangeSubscribers(instance, re) {
47
+ if (instance.isConnected === false) return;
48
+ this._routeChangeInvocations++;
49
+ if (this._childrenRouteChangedInterval) {
50
+ this.config.window.clearInterval(this._childrenRouteChangedInterval);
51
+ }
52
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
53
+ this._childrenRouteChangedInterval = debounceTimeIntervalLock(
54
+ () => this._routeChangeInvocations === 0,
55
+ () => {
56
+ this._childrenRouteChangedInterval = null;
57
+ this.config.onChildrenRouteChanged?.(re, this);
58
+ },
59
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
60
+ intervalConfig
61
+ );
62
+ try {
63
+ const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
64
+ if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
65
+ console.log("[SWC-MIXIN] Route change subscribers found");
66
+ const ps = routeChangeSubscribers.map(async (metadata) => {
67
+ const methodName = metadata.propertyKey;
68
+ let pathPattern = metadata.options?.path;
69
+ const filter = metadata.options?.filter;
70
+ if (typeof pathPattern === "function") {
71
+ pathPattern = pathPattern(instance);
72
+ }
73
+ let pathMatched = false;
74
+ let pathData = null;
75
+ if (!pathPattern) {
76
+ pathMatched = true;
77
+ pathData = {};
78
+ } else if (Array.isArray(pathPattern)) {
79
+ for (const pattern of pathPattern) {
80
+ const data = SwcUtils.parsePathPattern(pattern, re.path || "/");
81
+ if (data !== null) {
82
+ pathMatched = true;
83
+ pathData = data;
84
+ break;
85
+ }
86
+ }
87
+ } else {
88
+ pathData = SwcUtils.parsePathPattern(pathPattern, re.path || "/");
89
+ pathMatched = pathData !== null;
90
+ }
91
+ const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
92
+ const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
93
+ if (pathMatched && filterPassed && instance[methodName]) {
94
+ await instance[methodName]({ ...re, pathData });
95
+ }
96
+ });
97
+ await Promise.allSettled(ps);
98
+ }
99
+ } finally {
100
+ if (this.config?.ssr) {
101
+ setSSRAttribute(instance);
102
+ } else {
103
+ removeSSRAttribute(instance);
104
+ }
105
+ this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);
106
+ }
107
+ }
108
+ async _connected(instance, option) {
109
+ if (instance) {
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
+ }
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
+ }
123
+ if (this._childrenConnectedDoneInterval) {
124
+ this.config.window.clearInterval(this._childrenConnectedDoneInterval);
125
+ }
126
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
127
+ this._childrenConnectedDoneInterval = debounceTimeIntervalLock(
128
+ () => this._connectedInvocations === 0,
129
+ () => {
130
+ this._childrenConnectedDoneInterval = null;
131
+ this.config.onChildrenConnectedDone?.(this);
132
+ },
133
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
134
+ intervalConfig
135
+ );
136
+ if (this.simpleApplication) {
137
+ try {
138
+ if (this.router && this._lastRouterEvent) {
139
+ await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent);
140
+ }
141
+ } catch (e) {
142
+ throw e;
143
+ }
144
+ }
145
+ if (this.config?.ssr) {
146
+ setSSRAttribute(instance);
147
+ } else {
148
+ removeSSRAttribute(instance);
149
+ }
150
+ }
151
+ this.config.onConnectedChildAfter?.(instance);
152
+ return this;
153
+ }
154
+ async _connectedDone(instance) {
155
+ try {
156
+ } finally {
157
+ this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);
158
+ }
159
+ }
160
+ _disconnected(instance) {
161
+ if (instance) {
162
+ this._swc_connected_instance.delete(instance);
163
+ this.config?.onDisconnectedChildAfter?.(instance);
164
+ }
165
+ }
166
+ async _handleRouteChange(route) {
167
+ this._lastRouterEvent = route;
168
+ const swcConnectedInstance = Array.from(this._swc_connected_instance);
169
+ const ps = swcConnectedInstance.map((instance) => this._invokeRouteChangeSubscribers(instance, route));
170
+ await Promise.allSettled(ps);
171
+ }
172
+ async connect(config) {
173
+ console.log("[SWC-MIXIN] connect");
174
+ const swcConfig = {
175
+ routeType: "element",
176
+ window: config?.window,
177
+ ...config
178
+ };
179
+ await this.__swc_engine.connect(swcConfig);
180
+ this._connected_safari_and_standby.forEach((instance) => {
181
+ this._connected(instance, { noIncrements: true });
182
+ });
183
+ if (!this._routerSubscription && this.router) {
184
+ const config2 = this.__swc_engine.config;
185
+ this._routerSubscription = this.router.observable.subscribe(async (route) => {
186
+ console.log("[SWC-MIXIN] Router event received:", route.triggerPoint);
187
+ if (route.triggerPoint === "end") {
188
+ await this._handleRouteChange(route);
189
+ }
190
+ });
191
+ if (config2?.path) {
192
+ console.log("[DEBUG] Navigating to initial path:", config2.path);
193
+ }
194
+ }
195
+ }
196
+ connectedCallback() {
197
+ super.connectedCallback?.();
198
+ const configStr = this.getAttribute("swc-get-application-config");
199
+ const win = this.ownerDocument?.defaultView || window;
200
+ if (configStr && win) {
201
+ try {
202
+ const userConfig = FunctionUtils.executeReturn({
203
+ script: configStr,
204
+ context: this,
205
+ args: SwcUtils.getHelperAndHostSet(win, this)
206
+ });
207
+ this.connect(userConfig);
208
+ } catch (e) {
209
+ console.error("[SWC-MIXIN] Script execution failed:", e);
210
+ }
211
+ }
212
+ this._connected(this);
213
+ this.__swc_engine?.config?.onConnected?.(this);
214
+ this._connectedDone(this);
215
+ }
216
+ disconnectedCallback() {
217
+ super.disconnectedCallback?.();
218
+ this._routerSubscription?.unsubscribe();
219
+ this._routerSubscription = void 0;
220
+ this._lastRouterEvent = void 0;
221
+ this.__swc_engine.disconnect();
222
+ this.__swc_engine?.config?.onDisconnected?.(this);
223
+ this._disconnected(this);
224
+ }
225
+ async routing(path) {
226
+ await this.router?.go(path);
227
+ }
228
+ back() {
229
+ this.router?.back();
230
+ }
231
+ forward() {
232
+ this.router?.forward();
233
+ }
234
+ reload() {
235
+ this.router?.reload();
236
+ }
237
+ publishMessage(message) {
238
+ this._swc_connected_instance.forEach((instance) => {
239
+ this._invokeMessageSubscribers(instance, message);
240
+ });
241
+ }
242
+ _invokeMessageSubscribers(instance, message) {
243
+ const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);
244
+ if (messageSubscribers && Array.isArray(messageSubscribers)) {
245
+ messageSubscribers.forEach((metadata) => {
246
+ const methodName = metadata.propertyKey;
247
+ const messageType = metadata.messageType;
248
+ const filter = metadata.filter;
249
+ let typeMatched = false;
250
+ if (!messageType) {
251
+ typeMatched = true;
252
+ } else if (message.type === messageType) {
253
+ typeMatched = true;
254
+ }
255
+ let filterMatched = true;
256
+ if (filter && typeMatched) {
257
+ filterMatched = filter(message, instance);
258
+ }
259
+ if (typeMatched && filterMatched && typeof instance[methodName] === "function") {
260
+ instance[methodName](message);
261
+ }
262
+ });
263
+ }
264
+ }
265
+ };
266
+ }
267
+ export {
268
+ SwcAppMixin,
269
+ isSSR,
270
+ removeSSRAttribute,
271
+ setSSRAttribute
272
+ };
273
+ //# sourceMappingURL=SwcAppMixin.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/elements/SwcAppMixin.ts"],
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,qBAAkC;AAEpE,SAAQ,gBAAe;AAEhB,MAAM,QAAQ,CAAC,MAAmB;AACvC,SAAO,EAAE,aAAa,aAAa;AACrC;AACO,MAAM,kBAAkB,CAAC,MAAmB;AACjD,IAAE,aAAa,eAAgB,EAAU,UAAU,EAAE;AACvD;AACO,MAAM,qBAAqB,CAAC,MAAmB;AACpD,IAAE,gBAAgB,aAAa;AAC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AgB,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
+ "names": ["config"]
7
+ }
@@ -1,8 +1,3 @@
1
- import swcAppFactory from "./SwcApp.js";
2
- const registerSwcApp = swcAppFactory;
3
- const register = [swcAppFactory];
4
- export {
5
- register,
6
- registerSwcApp
7
- };
1
+ export * from "./SwcAppMixin.js";
2
+ export * from "./SwcApp.js";
8
3
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/index.ts"],
4
- "sourcesContent": ["// export * from './tt/register';\nimport swcAppFactory from './SwcApp'\n// import swcAsyncFactory from './SwcAsync'\n// import swcLoopFactory from './SwcLoop'\n// import swcIfFactory from './SwcIf'\nexport const registerSwcApp = swcAppFactory;\n// export const registerSwcAsync = swcAsyncFactory;\n// export const registerSwcLoop = swcLoopFactory;\n// export const registerSwcIf = swcIfFactory;\n\nexport const register = [swcAppFactory];"],
5
- "mappings": "AACA,OAAO,mBAAmB;AAInB,MAAM,iBAAiB;AAKvB,MAAM,WAAW,CAAC,aAAa;",
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
  }
package/dist/esm/index.js CHANGED
@@ -1,14 +1,12 @@
1
1
  import "reflect-metadata";
2
2
  export * from "./elements/index.js";
3
- import { register } from "./elements/index.js";
3
+ import { defineSwcAppAll } from "./elements/index.js";
4
4
  export * from "./decorators/index.js";
5
5
  export * from "./types/index.js";
6
6
  export * from "./utils/Utils.js";
7
7
  export * from "./config/config.js";
8
8
  var src_default = async (w, other) => {
9
- console.log("rr");
10
- const cr = await Promise.all(register.map((it) => it(w)));
11
- console.log("rr11");
9
+ const cr = await defineSwcAppAll(w);
12
10
  if (other) {
13
11
  for (const fn of other) {
14
12
  if (typeof fn === "function") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import 'reflect-metadata';\nexport * from './elements'\nimport { register } 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 console.log('rr')\n const cr = await Promise.all(register.map(it => it(w)));\n console.log('rr11')\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,gBAAgB;AAIzB,cAAc;AAGd,cAAc;AAGd,cAAc;AAGd,cAAc;AAGd,IAAO,cAAQ,OAAO,GAAW,UAAqG;AACpI,UAAQ,IAAI,IAAI;AAChB,QAAM,KAAK,MAAM,QAAQ,IAAI,SAAS,IAAI,QAAM,GAAG,CAAC,CAAC,CAAC;AACtD,UAAQ,IAAI,MAAM;AAElB,MAAI,OAAO;AACT,eAAW,MAAM,OAAO;AACtB,UAAI,OAAO,OAAO,YAAY;AAC5B,cAAM,GAAG,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
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
  }
@@ -14,4 +14,4 @@ var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
14
14
  export {
15
15
  InjectSituationType
16
16
  };
17
- //# sourceMappingURL=types.js.map
17
+ //# sourceMappingURL=index.js.map
@@ -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
+ }