@dooboostore/simple-web-component 1.0.39 → 1.0.41

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 (98) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +235 -47
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +194 -111
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyNode.js +58 -43
  7. package/dist/cjs/decorators/applyNode.js.map +2 -2
  8. package/dist/cjs/decorators/applyProperty.js +213 -0
  9. package/dist/cjs/decorators/applyProperty.js.map +7 -0
  10. package/dist/cjs/decorators/applySlot.js +32 -26
  11. package/dist/cjs/decorators/applySlot.js.map +2 -2
  12. package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
  13. package/dist/cjs/decorators/elementDefine.js +17 -30
  14. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  15. package/dist/cjs/decorators/index.js +2 -2
  16. package/dist/cjs/decorators/index.js.map +2 -2
  17. package/dist/cjs/decorators/lifecycles.js +4 -4
  18. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  19. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  20. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  21. package/dist/cjs/elements/SwcApp.js.map +2 -2
  22. package/dist/cjs/elements/SwcAppMixin.js +11 -4
  23. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  24. package/dist/cjs/types/index.js.map +1 -1
  25. package/dist/esm/SwcAppEngine.js.map +2 -2
  26. package/dist/esm/decorators/applyAttribute.js +196 -113
  27. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  28. package/dist/esm/decorators/applyNode.js +58 -43
  29. package/dist/esm/decorators/applyNode.js.map +2 -2
  30. package/dist/esm/decorators/applyProperty.js +194 -0
  31. package/dist/esm/decorators/applyProperty.js.map +7 -0
  32. package/dist/esm/decorators/applySlot.js +32 -26
  33. package/dist/esm/decorators/applySlot.js.map +2 -2
  34. package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
  35. package/dist/esm/decorators/elementDefine.js +17 -30
  36. package/dist/esm/decorators/elementDefine.js.map +2 -2
  37. package/dist/esm/decorators/index.js +2 -2
  38. package/dist/esm/decorators/index.js.map +1 -1
  39. package/dist/esm/decorators/lifecycles.js +4 -4
  40. package/dist/esm/decorators/lifecycles.js.map +2 -2
  41. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  42. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  43. package/dist/esm/elements/SwcApp.js.map +2 -2
  44. package/dist/esm/elements/SwcAppMixin.js +11 -4
  45. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  46. package/dist/esm/types/index.js.map +1 -1
  47. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +441 -401
  48. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  49. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  50. package/dist/types/decorators/applyAttribute.d.ts +56 -15
  51. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  52. package/dist/types/decorators/applyNode.d.ts +28 -24
  53. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  54. package/dist/types/decorators/applyProperty.d.ts +61 -0
  55. package/dist/types/decorators/applyProperty.d.ts.map +1 -0
  56. package/dist/types/decorators/applySlot.d.ts +10 -10
  57. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  58. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  59. package/dist/types/decorators/index.d.ts +2 -2
  60. package/dist/types/decorators/index.d.ts.map +1 -1
  61. package/dist/types/decorators/lifecycles.d.ts +4 -4
  62. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  63. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
  64. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  65. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  66. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  67. package/dist/types/types/index.d.ts +1 -6
  68. package/dist/types/types/index.d.ts.map +1 -1
  69. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +441 -401
  70. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  71. package/package.json +3 -3
  72. package/src/SwcAppEngine.ts +1 -0
  73. package/src/decorators/applyAttribute.ts +311 -126
  74. package/src/decorators/applyNode.ts +68 -57
  75. package/src/decorators/applyProperty.ts +302 -0
  76. package/src/decorators/applySlot.ts +25 -18
  77. package/src/decorators/changedAttributeThis.ts +1 -1
  78. package/src/decorators/elementDefine.ts +41 -30
  79. package/src/decorators/index.ts +2 -3
  80. package/src/decorators/lifecycles.ts +6 -6
  81. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +14 -4
  82. package/src/elements/SwcApp.ts +0 -1
  83. package/src/elements/SwcAppMixin.ts +16 -4
  84. package/src/types/index.ts +7 -7
  85. package/dist/cjs/decorators/attribute.js +0 -187
  86. package/dist/cjs/decorators/attribute.js.map +0 -7
  87. package/dist/cjs/decorators/setProperty.js +0 -109
  88. package/dist/cjs/decorators/setProperty.js.map +0 -7
  89. package/dist/esm/decorators/attribute.js +0 -168
  90. package/dist/esm/decorators/attribute.js.map +0 -7
  91. package/dist/esm/decorators/setProperty.js +0 -90
  92. package/dist/esm/decorators/setProperty.js.map +0 -7
  93. package/dist/types/decorators/attribute.d.ts +0 -31
  94. package/dist/types/decorators/attribute.d.ts.map +0 -1
  95. package/dist/types/decorators/setProperty.d.ts +0 -17
  96. package/dist/types/decorators/setProperty.d.ts.map +0 -1
  97. package/src/decorators/attribute.ts +0 -223
  98. package/src/decorators/setProperty.ts +0 -112
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcApp.ts"],
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,wBAA4B;AAE5B,yBAA0B;AAC1B,mBAA2D;;;;;;;AAKpD,MAAM,gBAAgB;AAEtB,MAAM,SAAS,CAAC,GAAW,SAA8B;AAC9D,aAAO,4BAA+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,uBAAmB,gCAAY,EAAE,WAAW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oBAAoB,EAAC,QAAQ,GAAG,SAAS,QAAO,CAAC;KAC1D,eAAe;AAIrB,SAAO,EAAE,eAAe,YAAY,kBAAkB;AACxD;AAKO,MAAM,kBAAkB;EAC7B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAMK,MAAM,kBAAkB,OAAO,MAAa;AACjD,QAAM,QAAQ,IAAI,gBAAgB,IAAI,aAAW,QAAQ,CAAC,CAAC,CAAC;AAC5D,SAAO,EAAE,eAAe,YAAY,aAAa;AACnD;AAGA,IAAA,iBAAe;",
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 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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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O,EAAE,eAAe,YAAY,gBAAgB;AACtD;AAKO,MAAM,qBAAqB;AAE3B,MAAM,cAAc,CAAC,GAAW,SAA8B;AACnE,aAAO,4BAA6C,GAAG,oBAAoB,IAAI;AACjF;AAEO,MAAM,oBAAoB,OAAO,MAAa;AACnD,QAAM,WAAW,EAAE,eAAe,IAAI,kBAAkB;AACxD,MAAI;AAAU,WAAO;AAGrB,MAAM,kBAAN,MAAM,4BAAwB,gCAAY,EAAE,WAAW,EAAC;;AAAlD,oBAAe,WAAA;QADpB,iCAAc,oBAAoB,EAAC,QAAQ,GAAG,SAAS,QAAO,CAAC;KAC1D,eAAe;AAIrB,SAAO,EAAE,eAAe,YAAY,kBAAkB;AACxD;AAKO,MAAM,kBAAkB;EAC7B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAMK,MAAM,kBAAkB,OAAO,MAAa;AACjD,QAAM,QAAQ,IAAI,gBAAgB,IAAI,aAAW,QAAQ,CAAC,CAAC,CAAC;AAC5D,SAAO,EAAE,eAAe,YAAY,aAAa;AACnD;AAGA,IAAA,iBAAe;",
6
6
  "names": []
7
7
  }
@@ -87,7 +87,12 @@ function SwcAppMixin(Base) {
87
87
  const routeChangeSubscribers = (0, import_decorators.getSubscribeSwcAppRouteChangeWhileConnectedMetadata)(instance);
88
88
  if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
89
89
  console.log("[SWC-MIXIN] Route change subscribers found");
90
- const ps = routeChangeSubscribers.map(async (metadata) => {
90
+ const sortedSubscribers = [...routeChangeSubscribers].sort((a, b) => {
91
+ const orderA = a.options?.order ?? 0;
92
+ const orderB = b.options?.order ?? 0;
93
+ return orderA - orderB;
94
+ });
95
+ for (const metadata of sortedSubscribers) {
91
96
  const methodName = metadata.propertyKey;
92
97
  let pathPattern = metadata.options?.path;
93
98
  const filter = metadata.options?.filter;
@@ -115,10 +120,12 @@ function SwcAppMixin(Base) {
115
120
  const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(this.config.window, this);
116
121
  const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
117
122
  if (pathMatched && filterPassed && instance[methodName]) {
118
- await instance[methodName]({ ...re, pathData });
123
+ const result = await instance[methodName]({ ...re, pathData });
124
+ if (result !== void 0 && result !== null) {
125
+ break;
126
+ }
119
127
  }
120
- });
121
- await Promise.allSettled(ps);
128
+ }
122
129
  }
123
130
  } finally {
124
131
  if (this.config?.ssr) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcAppMixin.ts"],
4
- "sourcesContent": ["import {SwcAppInterface, SwcAppMessage} from \"../types\";\nimport {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": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAgL;AAChL,0BAAkE;AAClE,kBAAoE;AAEpE,mBAAuB;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;AACjC;AAWO,SAAS,YAA4D,MAAS;AACnF,SAAO,MAAM,yBAAyB,KAAgC;AAAA,IAkBpE,eAAe,MAAa;AAC1B,YAAM,GAAG,IAAI;AAlBf,0CAAe,IAAI,iCAAa,IAAW;AAC3C,qDAA0B,oBAAI,IAAS;AACvC;AACA;AACA,qDAA0B;AAC1B,mDAAwB;AAExB;AACA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA,2DAAgC,CAAC;AAI/B,cAAQ,IAAI,6BAA6B;AAAA,IAC3C;AAAA,IAEA,IAAI,oBAAoB;AACtB,aAAO,KAAK,aAAa;AAAA,IAC3B;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,KAAK,cAAc;AAAA,IAC5B;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,KAAK,cAAc;AAAA,IAC5B;AAAA,IAEA,MAAM,8BAA8B,UAAuB,IAAqB;AAC9E,UAAI,SAAS,gBAAgB,MAAO;AAEpC,WAAK;AAEL,UAAI,KAAK,+BAA+B;AACtC,aAAK,OAAO,OAAO,cAAc,KAAK,6BAA6B;AAAA,MACrE;AACA,YAAM,iBAAiB,EAAC,aAAa,KAAK,OAAO,OAAO,YAAY,KAAK,KAAK,OAAO,MAAM,GAAG,eAAe,KAAK,OAAO,OAAO,cAAc,KAAK,KAAK,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AU,OAAO;AAAA,MAClD,CAAC;AAAA,IACH;AAAA,IAEA,0BAA0B,UAAe,SAAwB;AAC/D,YAAM,yBAAqB,mEAAgD,QAAQ;AACnF,UAAI,sBAAsB,MAAM,QAAQ,kBAAkB,GAAG;AAC3D,2BAAmB,QAAQ,cAAY;AACrC,gBAAM,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;",
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 \n // Sort by order (default 0 if not specified)\n const sortedSubscribers = [...routeChangeSubscribers].sort((a, b) => {\n const orderA = a.options?.order ?? 0;\n const orderB = b.options?.order ?? 0;\n return orderA - orderB;\n });\n \n // Execute subscribers in order, stop if one returns a value\n for (const metadata of sortedSubscribers) {\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 const result = await instance[methodName]({...re, pathData: pathData});\n // If handler returns a value, stop propagation to next handlers\n if (result !== undefined && result !== null) {\n break;\n }\n }\n }\n }\n } finally {\n 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": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAgL;AAChL,0BAAkE;AAClE,kBAAoE;AAEpE,mBAAuB;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;AACjC;AAWO,SAAS,YAA4D,MAAS;AACnF,SAAO,MAAM,yBAAyB,KAAgC;AAAA,IAkBpE,eAAe,MAAa;AAC1B,YAAM,GAAG,IAAI;AAlBf,0CAAe,IAAI,iCAAa,IAAW;AAC3C,qDAA0B,oBAAI,IAAS;AACvC;AACA;AACA,qDAA0B;AAC1B,mDAAwB;AAExB;AACA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA,2DAAgC,CAAC;AAI/B,cAAQ,IAAI,6BAA6B;AAAA,IAC3C;AAAA,IAEA,IAAI,oB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AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["config"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/types/index.ts"],
4
- "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n\nexport interface SwcElement {\n // _swcId: string;\n createSlotString(id: string): string\n createEaHtml(id: string, script: string): string\n createEaText(id: string, script: string): string\n createEaAttribute(id: string, attributeName: string): string\n createEaEvent(id: string, eventName: string): string\n createEaProperty(id: string, propertyName: string): string\n}"],
4
+ "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\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
5
  "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAK,sBAAL,kBAAKA,yBAAL;AACL,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,iBAAc;AACd,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,gBAAa;AACb,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,oBAAiB;AACjB,EAAAA,qBAAA,mBAAgB;AAVN,SAAAA;AAAA,GAAA;",
6
6
  "names": ["InjectSituationType"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SwcAppEngine.ts"],
4
- "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\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AAK,QAAQ,8BAA8B;AAC7C,cAAM,QAAQ,IAAI,KAAK,QAAQ,6BAA6B,IAAI,QAAM,GAAG,KAAK,QAAQ,MAAM,CAAC,CAAC;AAAA,MAChG;AACA,UAAI,KAAK,QAAQ,iBAAiB;AAChC,cAAM,KAAK,QAAQ,gBAAgB,KAAK,mBAAmB,KAAK,IAAkC;AAAA,MACpG;AAAA,IACF,SAAS,GAAG;AACV,cAAQ,MAAM,iCAAiC,GAAG,KAAK,OAAO;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,aAAa;AACX,SAAK,oBAAoB,YAAY;AAAA,EACvC;AACF;",
4
+ "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n // console.log('-------->', this._config.onStartedLazyDefineComponent)\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e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G3C,UAAI,KAAK,QAAQ,8BAA8B;AAE7C,cAAM,QAAQ,IAAI,KAAK,QAAQ,6BAA6B,IAAI,QAAM,GAAG,KAAK,QAAQ,MAAM,CAAC,CAAC;AAAA,MAChG;AACA,UAAI,KAAK,QAAQ,iBAAiB;AAChC,cAAM,KAAK,QAAQ,gBAAgB,KAAK,mBAAmB,KAAK,IAAkC;AAAA,MACpG;AAAA,IACF,SAAS,GAAG;AACV,cAAQ,MAAM,iCAAiC,GAAG,KAAK,OAAO;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,aAAa;AACX,SAAK,oBAAoB,YAAY;AAAA,EACvC;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,140 +1,223 @@
1
- import { ReflectUtils } from "@dooboostore/core";
2
- import { ensureInit } from "./elementDefine.js";
1
+ import { ReflectUtils, FunctionUtils, ActionExpression } from "@dooboostore/core";
2
+ import { ensureInit, getElementConfig } from "./elementDefine.js";
3
3
  import { SwcUtils } from "../utils/Utils.js";
4
- const ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
5
- function createAttributeDecorator(action) {
6
- return (selector, nameOrOptions, options = {}) => {
7
- return (target, propertyKey, descriptor) => {
8
- const constructor = target.constructor;
9
- let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
10
- if (!metaList) {
11
- metaList = /* @__PURE__ */ new Map();
12
- ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
4
+ import { ConvertUtils } from "@dooboostore/core-web";
5
+ const ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
6
+ const convertValue = (val, type) => {
7
+ if (val === null || val === void 0) return val;
8
+ if (type === Number) return Number(val);
9
+ if (type === Boolean) return val === "false" || val === "0" ? false : true;
10
+ return val;
11
+ };
12
+ const getAttributeValue = (inst, attrName, options) => {
13
+ const conf = getElementConfig(inst);
14
+ const currentWin = inst._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
15
+ const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];
16
+ const primaryTarget = targets[0];
17
+ if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
18
+ let domVal = primaryTarget.getAttribute(attrName);
19
+ const ae = new ActionExpression(domVal);
20
+ const expr = ae.getFirstExpression("callReturn");
21
+ if (expr) {
22
+ try {
23
+ const result = FunctionUtils.executeReturn({
24
+ script: ConvertUtils.decodeHtmlEntity(expr.script, currentWin.document),
25
+ context: inst,
26
+ args: SwcUtils.getHelperAndHostSet(currentWin, inst)
27
+ });
28
+ return convertValue(result, options?.type);
29
+ } catch (err) {
30
+ console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);
31
+ return convertValue(domVal, options?.type);
13
32
  }
14
- let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
15
- let finalOptions = options;
16
- if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
17
- finalOptions = nameOrOptions;
33
+ }
34
+ return convertValue(domVal, options?.type);
35
+ }
36
+ return null;
37
+ };
38
+ const resolveAttributeTargets = (inst, selector, options) => {
39
+ const conf = getElementConfig(inst);
40
+ const currentWin = conf.window;
41
+ const r = options.root || "auto";
42
+ const results = [];
43
+ const applyRoot = (target) => {
44
+ if (!target) return;
45
+ if (r === "auto") {
46
+ results.push(target);
47
+ } else {
48
+ if (r === "light" || r === "all") results.push(target);
49
+ if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
50
+ }
51
+ };
52
+ if (selector === "$this" || !selector) {
53
+ applyRoot(inst);
54
+ } else {
55
+ const hostSet = SwcUtils.getHostSet(inst);
56
+ if (selector === "$host") applyRoot(hostSet.$host);
57
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
58
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
59
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
60
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
61
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
62
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
63
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
64
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
65
+ else {
66
+ if (r === "shadow") {
67
+ const found = inst.shadowRoot?.querySelectorAll(selector);
68
+ if (found) results.push(...found);
69
+ } else if (r === "light") {
70
+ const found = inst.querySelectorAll(selector);
71
+ if (found) results.push(...found);
72
+ } else if (r === "all") {
73
+ const sMatch = inst.shadowRoot?.querySelectorAll(selector);
74
+ const lMatch = inst.querySelectorAll(selector);
75
+ if (sMatch) results.push(...sMatch);
76
+ if (lMatch) results.push(...lMatch);
77
+ } else {
78
+ const found = (inst.shadowRoot || inst).querySelectorAll(selector);
79
+ if (found) results.push(...found);
18
80
  }
19
- metaList.set(propertyKey, {
20
- propertyKey,
21
- selector,
22
- action,
23
- options: { ...finalOptions, name: attributeName }
81
+ }
82
+ }
83
+ return results;
84
+ };
85
+ function applyAttribute(selector, targetAttributeNameOrOptions, options) {
86
+ return (target, propertyKey, descriptor) => {
87
+ const constructor = target.constructor;
88
+ const designType = Reflect.getMetadata("design:type", target, propertyKey);
89
+ const metaType = descriptor && typeof descriptor.value === "function" ? "method" : "property";
90
+ let finalOptions = {};
91
+ let targetAttributeName;
92
+ if (typeof targetAttributeNameOrOptions === "string") {
93
+ targetAttributeName = targetAttributeNameOrOptions;
94
+ finalOptions = options || {};
95
+ } else if (targetAttributeNameOrOptions) {
96
+ finalOptions = targetAttributeNameOrOptions;
97
+ targetAttributeName = finalOptions.name || String(propertyKey);
98
+ } else {
99
+ targetAttributeName = String(propertyKey);
100
+ }
101
+ let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor);
102
+ if (!metaList) {
103
+ metaList = [];
104
+ ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);
105
+ }
106
+ metaList.push({
107
+ propertyKey,
108
+ selector,
109
+ targetAttributeName,
110
+ options: finalOptions,
111
+ type: metaType
112
+ });
113
+ const applyValueToTargets = (inst, resolvedValue) => {
114
+ const conf = getElementConfig(inst);
115
+ const currentWin = conf.window;
116
+ const targetEls = resolveAttributeTargets(inst, selector, finalOptions);
117
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);
118
+ targetEls.forEach((targetEl) => {
119
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {
120
+ return;
121
+ }
122
+ if (resolvedValue === null) {
123
+ targetEl.removeAttribute(targetAttributeName);
124
+ } else if (resolvedValue !== void 0) {
125
+ targetEl.setAttribute(targetAttributeName, resolvedValue === true ? "" : String(resolvedValue));
126
+ }
24
127
  });
128
+ return resolvedValue;
129
+ };
130
+ if (descriptor && typeof descriptor.value === "function") {
25
131
  const original = descriptor.value;
26
132
  descriptor.value = function(...args) {
27
133
  ensureInit(this);
28
134
  const res = original.apply(this, args);
29
- const handleResult = (resolvedValue) => {
30
- if (resolvedValue !== void 0) {
31
- const win = this.ownerDocument?.defaultView || window;
32
- const host = this;
33
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
34
- const r = finalOptions.root || "auto";
35
- const targetEls = [];
36
- const applyRoot = (t) => {
37
- if (!t || !(t instanceof win.HTMLElement)) return;
38
- targetEls.push(t);
39
- };
40
- if (selector === "$this" || !selector) applyRoot(host);
41
- else if (selector === "$host") applyRoot(hostSet.$host);
42
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
43
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
44
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
45
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
46
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
47
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
48
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
49
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
50
- else {
51
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
52
- if (targetRoot) {
53
- const found = targetRoot.querySelectorAll(selector);
54
- if (found) targetEls.push(...Array.from(found));
55
- }
56
- }
57
- targetEls.forEach((targetEl) => {
58
- if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
59
- return;
60
- }
61
- const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
62
- if (action === "set" || action === "update") {
63
- if (attributeName) {
64
- if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
65
- targetEl.removeAttribute(attributeName);
66
- } else {
67
- targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
68
- }
69
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
70
- Object.entries(resolvedRes).forEach(([attr, val]) => {
71
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
72
- if (finalVal === null || finalVal === void 0 || finalVal === false) {
73
- targetEl.removeAttribute(attr);
74
- } else {
75
- targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
76
- }
77
- });
78
- }
79
- } else if (action === "remove") {
80
- if (attributeName) {
81
- targetEl.removeAttribute(attributeName);
82
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
83
- Object.entries(resolvedRes).forEach(([attr, val]) => {
84
- const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
85
- if (shouldRemove) targetEl.removeAttribute(attr);
86
- });
87
- } else {
88
- const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
89
- attrs.forEach((a) => targetEl.removeAttribute(String(a)));
90
- }
91
- }
92
- });
93
- }
94
- return resolvedValue;
95
- };
96
135
  if (res instanceof Promise) {
97
- return res.then(handleResult);
136
+ return res.then((v) => {
137
+ applyValueToTargets(this, v);
138
+ return v;
139
+ });
98
140
  } else {
99
- return handleResult(res);
141
+ applyValueToTargets(this, res);
142
+ return res;
100
143
  }
101
144
  };
102
- return descriptor;
103
- };
145
+ return;
146
+ }
147
+ Object.defineProperty(target, propertyKey, {
148
+ configurable: true,
149
+ enumerable: true,
150
+ get() {
151
+ ensureInit(this);
152
+ const mergedOptions = { ...finalOptions, selector, type: finalOptions.type || designType };
153
+ return getAttributeValue(this, targetAttributeName, mergedOptions);
154
+ },
155
+ set(value) {
156
+ ensureInit(this);
157
+ if (value instanceof Promise) {
158
+ value.then((v) => applyValueToTargets(this, v)).catch(() => {
159
+ });
160
+ } else {
161
+ applyValueToTargets(this, value);
162
+ }
163
+ }
164
+ });
104
165
  };
105
166
  }
106
- function applyAttribute(selector, action = "update", options = {}) {
107
- return createAttributeDecorator(action)(selector, options);
167
+ function attribute(selector, targetAttributeNameOrOptions, options) {
168
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
169
+ }
170
+ function attributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
171
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") {
172
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
173
+ }
174
+ if (typeof targetOrOptions === "string") {
175
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
176
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
177
+ return applyAttribute("$this", void 0, targetOrOptions);
178
+ } else {
179
+ return applyAttribute("$this", void 0, {});
180
+ }
181
+ }
182
+ function setAttribute(selector, targetAttributeNameOrOptions, options) {
183
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
108
184
  }
109
- const setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
110
- const updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
111
- const removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
112
- function applyAttributeThis(action = "update", options = {}) {
113
- return createAttributeDecorator(action)("$this", options);
185
+ function setAttributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
186
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
187
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
188
+ }
189
+ if (typeof targetOrOptions === "string") {
190
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
191
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
192
+ return applyAttribute("$this", void 0, targetOrOptions);
193
+ } else {
194
+ return applyAttribute("$this", void 0, {});
195
+ }
114
196
  }
115
- const setAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("set")("$this", nameOrOptions, options);
116
- const updateAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("update")("$this", nameOrOptions, options);
117
- const removeAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("remove")("$this", nameOrOptions, options);
197
+ const findAllAttributeMetadata = (target) => {
198
+ const actualTarget = target instanceof Function ? target : target.constructor;
199
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, actualTarget).flat();
200
+ };
118
201
  const findAllAttributeApplyMetadata = (target) => {
119
202
  const result = /* @__PURE__ */ new Map();
120
- const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
121
- maps.forEach((map) => {
122
- if (map instanceof Map) {
123
- map.forEach((v, k) => result.set(k, v));
124
- }
203
+ findAllAttributeMetadata(target).forEach((meta) => {
204
+ result.set(meta.propertyKey, meta);
125
205
  });
126
206
  return result;
127
207
  };
208
+ var applyAttribute_default = applyAttribute;
128
209
  export {
129
- ATTRIBUTE_APPLY_METADATA_KEY,
210
+ ATTRIBUTE_METADATA_KEY,
130
211
  applyAttribute,
131
- applyAttributeThis,
212
+ attribute,
213
+ attributeThis,
214
+ convertValue,
215
+ applyAttribute_default as default,
132
216
  findAllAttributeApplyMetadata,
133
- removeAttribute,
134
- removeAttributeThis,
217
+ findAllAttributeMetadata,
218
+ getAttributeValue,
219
+ resolveAttributeTargets,
135
220
  setAttribute,
136
- setAttributeThis,
137
- updateAttribute,
138
- updateAttributeThis
221
+ setAttributeThis
139
222
  };
140
223
  //# sourceMappingURL=applyAttribute.js.map