@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/decorators/subscribeSwcAppRouteChangeWhileConnected.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { Router } from '@dooboostore/core-web';\n\nexport const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-route-change-while-connected');\n\nexport type RoutePathType = string | string[] | ((currentThis: any) => string | string[]);\n\nexport interface SwcAppRouteChangeSubscriberMetadata {\n propertyKey: string | symbol;\n options?: SwcAppRouteChangeOptions;\n}\n\nexport interface SwcAppRouteChangeOptions {\n path?: RoutePathType;\n filter?: (router: Router, currentThis: any) => boolean;\n}\n\nfunction createSubscribeSwcAppRouteChangeWhileConnected(options?: SwcAppRouteChangeOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const pathPattern = options?.path;\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppRouteChangeSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(options: SwcAppRouteChangeOptions): MethodDecorator;\n\n// \uC2E4\uC81C \uAD6C\uD604 (\uC774\uC911 \uBAA8\uB4DC)\nexport function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppRouteChangeWhileConnected\n // propertyKey\uAC00 string | symbol\uC774\uACE0 descriptor\uAC00 \uC788\uC73C\uBA74 \uC9C1\uC811 \uC0AC\uC6A9\n if (propertyKey && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @subscribeSwcAppRouteChangeWhileConnected() / @subscribeSwcAppRouteChangeWhileConnected('/path')\n let options: SwcAppRouteChangeOptions = {};\n\n if (Array.isArray(targetOrOptions)) {\n // \uBC30\uC5F4: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'])\n options.path = targetOrOptions;\n } else if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'function') {\n // \uBB38\uC790\uC5F4 \uB610\uB294 \uD568\uC218: @subscribeSwcAppRouteChangeWhileConnected('/path')\n options.path = targetOrOptions;\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // \uAC1D\uCCB4: @subscribeSwcAppRouteChangeWhileConnected({ path: '/path', filter: ... })\n options = targetOrOptions;\n }\n\n return createSubscribeSwcAppRouteChangeWhileConnected(options);\n}\n\n// Helper function to retrieve route change subscribers metadata\nexport const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target: any): SwcAppRouteChangeSubscriberMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": "AAAA,SAAS,oBAAoB;AAGtB,MAAM,8DAA8D,OAAO,IAAI,qEAAqE;AAc3J,SAAS,+CAA+C,SAAqD;AAC3G,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,SAAS;AAC7B,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,eAAe,6DAA6D,WAAW;AAC/G,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,6DAA6D,MAAM,WAAW;AAAA,IAC5G;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAElC,WAAO;AAAA,EACT;AACF;AAUO,SAAS,yCAAyC,iBAAuB,aAA+B,YAAsC;AAGnJ,MAAI,gBAAgB,OAAO,gBAAgB,YAAY,OAAO,gBAAgB,WAAW;AACvF,WAAO,+CAA+C,CAAC,CAAC,EAAE,iBAAiB,aAAa,UAAU;AAAA,EACpG;AAGA,MAAI,UAAoC,CAAC;AAEzC,MAAI,MAAM,QAAQ,eAAe,GAAG;AAElC,YAAQ,OAAO;AAAA,EACjB,WAAW,OAAO,oBAAoB,YAAY,OAAO,oBAAoB,YAAY;AAEvF,YAAQ,OAAO;AAAA,EACjB,WAAW,mBAAmB,OAAO,oBAAoB,UAAU;AAEjE,cAAU;AAAA,EACZ;AAEA,SAAO,+CAA+C,OAAO;AAC/D;AAGO,MAAM,sDAAsD,CAAC,WAAmE;AACrI,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,eAAe,6DAA6D,WAAW;AAC7G;",
4
+ "sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {Router} from '@dooboostore/core-web';\nimport {HelperHostSet} from '../types';\n\nexport const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-route-change-while-connected');\n\nexport type RoutePathType = string | string[] | ((currentThis: any) => string | string[]);\n\nexport interface SwcAppRouteChangeSubscriberMetadata {\n propertyKey: string | symbol;\n options?: SwcAppRouteChangeOptions;\n}\n\nexport interface SwcAppRouteChangeOptions {\n path?: RoutePathType;\n filter?: (router: Router, meta: {currentThis: any, helper: HelperHostSet}) => boolean;\n}\n\nfunction createSubscribeSwcAppRouteChangeWhileConnected(options?: SwcAppRouteChangeOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const pathPattern = options?.path;\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppRouteChangeSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(options: SwcAppRouteChangeOptions): MethodDecorator;\n\n// \uC2E4\uC81C \uAD6C\uD604 (\uC774\uC911 \uBAA8\uB4DC)\nexport function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppRouteChangeWhileConnected\n // propertyKey\uAC00 string | symbol\uC774\uACE0 descriptor\uAC00 \uC788\uC73C\uBA74 \uC9C1\uC811 \uC0AC\uC6A9\n if (propertyKey && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @subscribeSwcAppRouteChangeWhileConnected() / @subscribeSwcAppRouteChangeWhileConnected('/path')\n let options: SwcAppRouteChangeOptions = {};\n\n if (Array.isArray(targetOrOptions)) {\n // \uBC30\uC5F4: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'])\n options.path = targetOrOptions;\n } else if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'function') {\n // \uBB38\uC790\uC5F4 \uB610\uB294 \uD568\uC218: @subscribeSwcAppRouteChangeWhileConnected('/path')\n options.path = targetOrOptions;\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // \uAC1D\uCCB4: @subscribeSwcAppRouteChangeWhileConnected({ path: '/path', filter: ... })\n options = targetOrOptions;\n }\n\n return createSubscribeSwcAppRouteChangeWhileConnected(options);\n}\n\n// Helper function to retrieve route change subscribers metadata\nexport const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target: any): SwcAppRouteChangeSubscriberMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n};\n"],
5
+ "mappings": "AAAA,SAAQ,oBAAmB;AAIpB,MAAM,8DAA8D,OAAO,IAAI,qEAAqE;AAc3J,SAAS,+CAA+C,SAAqD;AAC3G,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,SAAS;AAC7B,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,eAAe,6DAA6D,WAAW;AAC/G,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,6DAA6D,MAAM,WAAW;AAAA,IAC5G;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAElC,WAAO;AAAA,EACT;AACF;AAUO,SAAS,yCAAyC,iBAAuB,aAA+B,YAAsC;AAGnJ,MAAI,gBAAgB,OAAO,gBAAgB,YAAY,OAAO,gBAAgB,WAAW;AACvF,WAAO,+CAA+C,CAAC,CAAC,EAAE,iBAAiB,aAAa,UAAU;AAAA,EACpG;AAGA,MAAI,UAAoC,CAAC;AAEzC,MAAI,MAAM,QAAQ,eAAe,GAAG;AAElC,YAAQ,OAAO;AAAA,EACjB,WAAW,OAAO,oBAAoB,YAAY,OAAO,oBAAoB,YAAY;AAEvF,YAAQ,OAAO;AAAA,EACjB,WAAW,mBAAmB,OAAO,oBAAoB,UAAU;AAEjE,cAAU;AAAA,EACZ;AAEA,SAAO,+CAA+C,OAAO;AAC/D;AAGO,MAAM,sDAAsD,CAAC,WAAmE;AACrI,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,eAAe,6DAA6D,WAAW;AAC7G;",
6
6
  "names": []
7
7
  }
@@ -4,321 +4,209 @@ var __decorate = function(decorators, target, key, desc) {
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { elementDefine, findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY } from "../decorators/index.js";
8
- import { SwcAppEngine } from "../SwcAppEngine.js";
9
- import { debounceTimeIntervalLock, FunctionUtils } from "@dooboostore/core";
10
- import { SwcUtils } from "../utils/Utils.js";
11
- const isSSR = (i) => {
12
- return i.hasAttribute("swc-use-ssr");
7
+ import { elementDefine } from "../decorators/index.js";
8
+ import { SwcAppMixin } from "./SwcAppMixin.js";
9
+ import { createElement } from "../utils/Utils.js";
10
+ const swcAppTagName = "swc-app";
11
+ const SwcApp = (w, data) => {
12
+ return createElement(w, swcAppTagName, data);
13
13
  };
14
- const setSSRAttribute = (i) => {
15
- i.setAttribute("swc-use-ssr", i._swcId ?? "");
14
+ const defineSwcApp = async (w) => {
15
+ const existing = w.customElements.get(swcAppTagName);
16
+ if (existing)
17
+ return existing;
18
+ let SwcAppImpl = class SwcAppImpl extends SwcAppMixin(w.HTMLElement) {
19
+ };
20
+ SwcAppImpl = __decorate([
21
+ elementDefine(swcAppTagName, { window: w })
22
+ ], SwcAppImpl);
23
+ return w.customElements.whenDefined(swcAppTagName);
24
+ };
25
+ const swcAppBodyTagName = "swc-app-body";
26
+ const SwcAppBody = (w, data) => {
27
+ return createElement(w, swcAppBodyTagName, data);
28
+ };
29
+ const defineSwcAppBody = async (w) => {
30
+ const existing = w.customElements.get(swcAppBodyTagName);
31
+ if (existing)
32
+ return existing;
33
+ let SwcAppBodyImpl = class SwcAppBodyImpl extends SwcAppMixin(w.HTMLBodyElement) {
34
+ };
35
+ SwcAppBodyImpl = __decorate([
36
+ elementDefine(swcAppBodyTagName, { window: w, extends: "body" })
37
+ ], SwcAppBodyImpl);
38
+ return w.customElements.whenDefined(swcAppBodyTagName);
39
+ };
40
+ const swcAppDivTagName = "swc-app-div";
41
+ const SwcAppDiv = (w, data) => {
42
+ return createElement(w, swcAppDivTagName, data);
43
+ };
44
+ const defineSwcAppDiv = async (w) => {
45
+ const existing = w.customElements.get(swcAppDivTagName);
46
+ if (existing)
47
+ return existing;
48
+ let SwcAppDivImpl = class SwcAppDivImpl extends SwcAppMixin(w.HTMLDivElement) {
49
+ };
50
+ SwcAppDivImpl = __decorate([
51
+ elementDefine(swcAppDivTagName, { window: w, extends: "div" })
52
+ ], SwcAppDivImpl);
53
+ return w.customElements.whenDefined(swcAppDivTagName);
54
+ };
55
+ const swcAppSectionTagName = "swc-app-section";
56
+ const SwcAppSection = (w, data) => {
57
+ return createElement(w, swcAppSectionTagName, data);
58
+ };
59
+ const defineSwcAppSection = async (w) => {
60
+ const existing = w.customElements.get(swcAppSectionTagName);
61
+ if (existing)
62
+ return existing;
63
+ let SwcAppSectionImpl = class SwcAppSectionImpl extends SwcAppMixin(w.HTMLElement) {
64
+ };
65
+ SwcAppSectionImpl = __decorate([
66
+ elementDefine(swcAppSectionTagName, { window: w, extends: "section" })
67
+ ], SwcAppSectionImpl);
68
+ return w.customElements.whenDefined(swcAppSectionTagName);
69
+ };
70
+ const swcAppMainTagName = "swc-app-main";
71
+ const SwcAppMain = (w, data) => {
72
+ return createElement(w, swcAppMainTagName, data);
73
+ };
74
+ const defineSwcAppMain = async (w) => {
75
+ const existing = w.customElements.get(swcAppMainTagName);
76
+ if (existing)
77
+ return existing;
78
+ let SwcAppMainImpl = class SwcAppMainImpl extends SwcAppMixin(w.HTMLElement) {
79
+ };
80
+ SwcAppMainImpl = __decorate([
81
+ elementDefine(swcAppMainTagName, { window: w, extends: "main" })
82
+ ], SwcAppMainImpl);
83
+ return w.customElements.whenDefined(swcAppMainTagName);
84
+ };
85
+ const swcAppArticleTagName = "swc-app-article";
86
+ const SwcAppArticle = (w, data) => {
87
+ return createElement(w, swcAppArticleTagName, data);
88
+ };
89
+ const defineSwcAppArticle = async (w) => {
90
+ const existing = w.customElements.get(swcAppArticleTagName);
91
+ if (existing)
92
+ return existing;
93
+ let SwcAppArticleImpl = class SwcAppArticleImpl extends SwcAppMixin(w.HTMLElement) {
94
+ };
95
+ SwcAppArticleImpl = __decorate([
96
+ elementDefine(swcAppArticleTagName, { window: w, extends: "article" })
97
+ ], SwcAppArticleImpl);
98
+ return w.customElements.whenDefined(swcAppArticleTagName);
99
+ };
100
+ const swcAppHeaderTagName = "swc-app-header";
101
+ const SwcAppHeader = (w, data) => {
102
+ return createElement(w, swcAppHeaderTagName, data);
103
+ };
104
+ const defineSwcAppHeader = async (w) => {
105
+ const existing = w.customElements.get(swcAppHeaderTagName);
106
+ if (existing)
107
+ return existing;
108
+ let SwcAppHeaderImpl = class SwcAppHeaderImpl extends SwcAppMixin(w.HTMLElement) {
109
+ };
110
+ SwcAppHeaderImpl = __decorate([
111
+ elementDefine(swcAppHeaderTagName, { window: w, extends: "header" })
112
+ ], SwcAppHeaderImpl);
113
+ return w.customElements.whenDefined(swcAppHeaderTagName);
16
114
  };
17
- const removeSSRAttribute = (i) => {
18
- i.removeAttribute("swc-use-ssr");
115
+ const swcAppFooterTagName = "swc-app-footer";
116
+ const SwcAppFooter = (w, data) => {
117
+ return createElement(w, swcAppFooterTagName, data);
19
118
  };
20
- const tagName = "swc-app";
21
- var SwcApp_default = async (w) => {
22
- const existing = w.customElements.get(tagName);
119
+ const defineSwcAppFooter = async (w) => {
120
+ const existing = w.customElements.get(swcAppFooterTagName);
23
121
  if (existing)
24
122
  return existing;
25
- let SwcApp = class SwcApp extends w.HTMLElement {
26
- constructor() {
27
- super(...arguments);
28
- this.__swc_engine = new SwcAppEngine(this);
29
- this._swc_connected_instance = /* @__PURE__ */ new Set();
30
- this._routeChangeInvocations = 0;
31
- this._connectedInvocations = 0;
32
- this._connected_safari_and_standby = [];
33
- }
34
- get simpleApplication() {
35
- return this.__swc_engine.simpleApplication;
36
- }
37
- get config() {
38
- return this.__swc_engine?.config;
39
- }
40
- get router() {
41
- return this.__swc_engine?.router;
42
- }
43
- async _invokeRouteChangeSubscribers(instance, re) {
44
- if (instance.isConnected === false)
45
- return;
46
- this._routeChangeInvocations++;
47
- if (this._childrenRouteChangedInterval) {
48
- this.config.window.clearInterval(this._childrenRouteChangedInterval);
49
- }
50
- const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
51
- this._childrenRouteChangedInterval = debounceTimeIntervalLock(
52
- () => this._routeChangeInvocations === 0,
53
- () => {
54
- this._childrenRouteChangedInterval = null;
55
- this.config.onChildrenRouteChanged?.(re, this);
56
- },
57
- this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
58
- intervalConfig
59
- // {setInterval: window.setInterval, clearInterval: window.clearInterval}
60
- );
61
- try {
62
- const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
63
- if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
64
- const ps = routeChangeSubscribers.map(async (metadata) => {
65
- const methodName = metadata.propertyKey;
66
- let pathPattern = metadata.options?.path;
67
- const filter = metadata.options?.filter;
68
- if (typeof pathPattern === "function") {
69
- pathPattern = pathPattern(instance);
70
- }
71
- let pathMatched = false;
72
- let pathData = null;
73
- if (!pathPattern) {
74
- pathMatched = true;
75
- pathData = {};
76
- } else if (Array.isArray(pathPattern)) {
77
- for (const pattern of pathPattern) {
78
- const data = SwcUtils.parsePathPattern(pattern, re.path || "/");
79
- if (data !== null) {
80
- pathMatched = true;
81
- pathData = data;
82
- break;
83
- }
84
- }
85
- } else {
86
- pathData = SwcUtils.parsePathPattern(pathPattern, re.path || "/");
87
- pathMatched = pathData !== null;
88
- }
89
- const filterPassed = !filter || filter(this.router, instance);
90
- if (pathMatched && filterPassed && instance[methodName]) {
91
- await instance[methodName]({ ...re, pathData });
92
- }
93
- });
94
- await Promise.allSettled(ps);
95
- }
96
- } finally {
97
- if (this.config?.ssr) {
98
- setSSRAttribute(instance);
99
- } else {
100
- removeSSRAttribute(instance);
101
- }
102
- this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);
103
- }
104
- }
105
- async _connected(instance, option) {
106
- if (instance) {
107
- if (!this.simpleApplication && !this.config) {
108
- this._connected_safari_and_standby.push(instance);
109
- return;
110
- }
111
- this.config.onConnectedChildBefore?.(instance);
112
- if (!option?.noIncrements) {
113
- this._connectedInvocations++;
114
- }
115
- this._swc_connected_instance.add(instance);
116
- const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY) ?? [];
117
- for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {
118
- await instance?._invokeLifecycleMethod?.(connectedSwcAppCallBack);
119
- }
120
- if (this._childrenConnectedDoneInterval) {
121
- this.config.window.clearInterval(this._childrenConnectedDoneInterval);
122
- }
123
- const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
124
- this._childrenConnectedDoneInterval = debounceTimeIntervalLock(() => this._connectedInvocations === 0, () => {
125
- this._childrenConnectedDoneInterval = null;
126
- this.config.onChildrenConnectedDone?.(this);
127
- }, this.config?.childrenConnectedDoneCheckIntervalTime ?? 30, intervalConfig);
128
- if (this.simpleApplication) {
129
- try {
130
- if (this.router && this._lastRouterEvent) {
131
- await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent);
132
- }
133
- } catch (e) {
134
- throw e;
135
- }
136
- }
137
- if (this.config?.ssr) {
138
- setSSRAttribute(instance);
139
- } else {
140
- removeSSRAttribute(instance);
141
- }
142
- }
143
- this.config.onConnectedChildAfter?.(instance);
144
- return this;
145
- }
146
- async _connectedDone(instance) {
147
- try {
148
- } finally {
149
- this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);
150
- }
151
- }
152
- _disconnected(instance) {
153
- if (instance) {
154
- this._swc_connected_instance.delete(instance);
155
- this.config?.onDisconnectedChildAfter?.(instance);
156
- }
157
- }
158
- async _handleRouteChange(route) {
159
- this._lastRouterEvent = route;
160
- const swcConnectedInstance = Array.from(this._swc_connected_instance);
161
- const ps = swcConnectedInstance.map((instance) => this._invokeRouteChangeSubscribers(instance, route));
162
- await Promise.allSettled(ps);
163
- }
164
- async connect(config) {
165
- console.log("[SWC] connect");
166
- const swcConfig = {
167
- routeType: "element",
168
- window: config?.window,
169
- ...config
170
- };
171
- const mode = config?.connectMode || "direct";
172
- if (mode === "direct" || mode === "hydrate") {
173
- this.setAttribute("swc-connect-mode", mode);
174
- await this.__swc_engine.connect(swcConfig);
175
- } else if (mode === "swap" || mode === "clear-swap") {
176
- if (!this.parentNode) {
177
- await this.__swc_engine.connect(swcConfig);
178
- this.setAttribute("swc-connect-mode", "direct");
179
- } else {
180
- const clonedApp = this.cloneNode(mode === "swap");
181
- clonedApp.style.display = "none";
182
- this.parentNode.insertBefore(clonedApp, this.nextSibling);
183
- try {
184
- await clonedApp.connect({ ...config || {}, connectMode: "direct" });
185
- if (this.parentNode) {
186
- this.parentNode.removeChild(this);
187
- }
188
- clonedApp.style.display = "";
189
- clonedApp.setAttribute("swc-connect-mode", mode);
190
- return;
191
- } catch (e) {
192
- if (clonedApp.parentNode) {
193
- clonedApp.parentNode.removeChild(clonedApp);
194
- }
195
- await this.__swc_engine.connect(swcConfig);
196
- this.setAttribute("swc-connect-mode", "direct");
197
- }
198
- }
199
- }
200
- this._connected_safari_and_standby.forEach((instance) => {
201
- this._connected(instance, { noIncrements: true });
202
- });
203
- if (!this._routerSubscription && this.router) {
204
- const config2 = this.__swc_engine.config;
205
- this._routerSubscription = this.router.observable.subscribe(async (route) => {
206
- console.log("[SWC] Router event received:", route.triggerPoint);
207
- if (route.triggerPoint === "end") {
208
- await this._handleRouteChange(route);
209
- }
210
- });
211
- if (config2?.path) {
212
- console.log("[DEBUG] Navigating to initial path:", config2.path);
213
- }
214
- }
215
- }
216
- // async _invokeOnConnectedSwcAppStarted(instance: any) {
217
- // this._swcAppStartedInvocations++;
218
- // try {
219
- // // 이미 시작된 인스턴스라면 스킵 (비동기 병렬 중복 호출 방지)
220
- // if (this._swc_started_instances.has(instance)) return;
221
- // this._swc_started_instances.add(instance);
222
- //
223
- // const startedMethods = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);
224
- // if (startedMethods) {
225
- // const ps = startedMethods.map(m => instance._invokeLifecycleMethod(m));
226
- // await Promise.allSettled(ps);
227
- // }
228
- // } finally {
229
- // this._swcAppStartedInvocations--;
230
- // }
231
- // }
232
- connectedCallback() {
233
- if (super.connectedCallback)
234
- super.connectedCallback();
235
- const configStr = this.getAttribute("swc-get-application-config");
236
- const win = this.ownerDocument?.defaultView || window;
237
- if (configStr && win) {
238
- try {
239
- const userConfig = FunctionUtils.executeReturn({
240
- script: configStr,
241
- context: this,
242
- args: SwcUtils.getHelperAndHostSet(win, this)
243
- });
244
- this.connect(userConfig);
245
- } catch (e) {
246
- console.error("[SWC-APP-ENGINE] Script execution failed:", e);
247
- }
248
- }
249
- this._connected(this);
250
- this.__swc_engine?.config?.onConnected?.(this);
251
- this._connectedDone(this);
252
- }
253
- disconnectedCallback() {
254
- if (super.disconnectedCallback)
255
- super.disconnectedCallback();
256
- this._routerSubscription?.unsubscribe();
257
- this._routerSubscription = void 0;
258
- this._lastRouterEvent = void 0;
259
- this.__swc_engine.disconnect();
260
- this.__swc_engine?.config?.onDisconnected?.(this);
261
- this._disconnected(this);
262
- }
263
- async routing(path) {
264
- await this.router?.go(path);
265
- }
266
- back() {
267
- this.router?.back();
268
- }
269
- forward() {
270
- this.router?.forward();
271
- }
272
- reload() {
273
- this.router?.reload();
274
- }
275
- // async completedSwcApp() {
276
- // const ss = Array.from(this._swc_connected_instance).flatMap((it) => {
277
- // const ms = findAllLifecycleMetadata(it, ON_CONNECTED_COMPLETED_SWC_APP_METADATA_KEY) ?? [];
278
- // return ms.map((sit) => it[sit](this));
279
- // });
280
- // await Promise.allSettled(ss);
281
- // }
282
- publishMessage(message) {
283
- this._swc_connected_instance.forEach((instance) => {
284
- this._invokeMessageSubscribers(instance, message);
285
- });
286
- }
287
- _invokeMessageSubscribers(instance, message) {
288
- const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);
289
- if (messageSubscribers && Array.isArray(messageSubscribers)) {
290
- messageSubscribers.forEach((metadata) => {
291
- const methodName = metadata.propertyKey;
292
- const messageType = metadata.messageType;
293
- const filter = metadata.filter;
294
- let typeMatched = false;
295
- if (!messageType) {
296
- typeMatched = true;
297
- } else if (message.type === messageType) {
298
- typeMatched = true;
299
- }
300
- let filterMatched = true;
301
- if (filter && typeMatched) {
302
- filterMatched = filter(message, instance);
303
- }
304
- if (typeMatched && filterMatched && typeof instance[methodName] === "function") {
305
- instance[methodName](message);
306
- }
307
- });
308
- }
309
- }
123
+ let SwcAppFooterImpl = class SwcAppFooterImpl extends SwcAppMixin(w.HTMLElement) {
310
124
  };
311
- SwcApp = __decorate([
312
- elementDefine(tagName, { window: w })
313
- ], SwcApp);
314
- ;
315
- return w.customElements.whenDefined(tagName);
125
+ SwcAppFooterImpl = __decorate([
126
+ elementDefine(swcAppFooterTagName, { window: w, extends: "footer" })
127
+ ], SwcAppFooterImpl);
128
+ return w.customElements.whenDefined(swcAppFooterTagName);
129
+ };
130
+ const swcAppNavTagName = "swc-app-nav";
131
+ const SwcAppNav = (w, data) => {
132
+ return createElement(w, swcAppNavTagName, data);
133
+ };
134
+ const defineSwcAppNav = async (w) => {
135
+ const existing = w.customElements.get(swcAppNavTagName);
136
+ if (existing)
137
+ return existing;
138
+ let SwcAppNavImpl = class SwcAppNavImpl extends SwcAppMixin(w.HTMLElement) {
139
+ };
140
+ SwcAppNavImpl = __decorate([
141
+ elementDefine(swcAppNavTagName, { window: w, extends: "nav" })
142
+ ], SwcAppNavImpl);
143
+ return w.customElements.whenDefined(swcAppNavTagName);
144
+ };
145
+ const swcAppAsideTagName = "swc-app-aside";
146
+ const SwcAppAside = (w, data) => {
147
+ return createElement(w, swcAppAsideTagName, data);
148
+ };
149
+ const defineSwcAppAside = async (w) => {
150
+ const existing = w.customElements.get(swcAppAsideTagName);
151
+ if (existing)
152
+ return existing;
153
+ let SwcAppAsideImpl = class SwcAppAsideImpl extends SwcAppMixin(w.HTMLElement) {
154
+ };
155
+ SwcAppAsideImpl = __decorate([
156
+ elementDefine(swcAppAsideTagName, { window: w, extends: "aside" })
157
+ ], SwcAppAsideImpl);
158
+ return w.customElements.whenDefined(swcAppAsideTagName);
159
+ };
160
+ const swcAppFactories = [
161
+ defineSwcApp,
162
+ defineSwcAppBody,
163
+ defineSwcAppDiv,
164
+ defineSwcAppSection,
165
+ defineSwcAppMain,
166
+ defineSwcAppArticle,
167
+ defineSwcAppHeader,
168
+ defineSwcAppFooter,
169
+ defineSwcAppNav,
170
+ defineSwcAppAside
171
+ ];
172
+ const defineSwcAppAll = async (w) => {
173
+ await Promise.all(swcAppFactories.map((factory) => factory(w)));
174
+ return w.customElements.whenDefined(swcAppTagName);
316
175
  };
176
+ var SwcApp_default = defineSwcAppAll;
317
177
  export {
178
+ SwcApp,
179
+ SwcAppArticle,
180
+ SwcAppAside,
181
+ SwcAppBody,
182
+ SwcAppDiv,
183
+ SwcAppFooter,
184
+ SwcAppHeader,
185
+ SwcAppMain,
186
+ SwcAppNav,
187
+ SwcAppSection,
318
188
  SwcApp_default as default,
319
- isSSR,
320
- removeSSRAttribute,
321
- setSSRAttribute,
322
- tagName
189
+ defineSwcApp,
190
+ defineSwcAppAll,
191
+ defineSwcAppArticle,
192
+ defineSwcAppAside,
193
+ defineSwcAppBody,
194
+ defineSwcAppDiv,
195
+ defineSwcAppFooter,
196
+ defineSwcAppHeader,
197
+ defineSwcAppMain,
198
+ defineSwcAppNav,
199
+ defineSwcAppSection,
200
+ swcAppArticleTagName,
201
+ swcAppAsideTagName,
202
+ swcAppBodyTagName,
203
+ swcAppDivTagName,
204
+ swcAppFactories,
205
+ swcAppFooterTagName,
206
+ swcAppHeaderTagName,
207
+ swcAppMainTagName,
208
+ swcAppNavTagName,
209
+ swcAppSectionTagName,
210
+ swcAppTagName
323
211
  };
324
212
  //# sourceMappingURL=SwcApp.js.map