@dooboostore/simple-web-component 1.0.36 → 1.0.37

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 (210) hide show
  1. package/README.md +41 -4
  2. package/dist/cjs/{elements/SwcAppEngine.js → SwcAppEngine.js} +6 -6
  3. package/dist/cjs/SwcAppEngine.js.map +7 -0
  4. package/dist/cjs/decorators/applyNode.js +14 -13
  5. package/dist/cjs/decorators/applyNode.js.map +2 -2
  6. package/dist/cjs/decorators/applySlot.js +122 -0
  7. package/dist/cjs/decorators/applySlot.js.map +7 -0
  8. package/dist/cjs/decorators/elementDefine.js +38 -30
  9. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  10. package/dist/cjs/decorators/index.js +1 -0
  11. package/dist/cjs/decorators/index.js.map +2 -2
  12. package/dist/cjs/decorators/lifecycles.js +56 -8
  13. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  14. package/dist/cjs/elements/{SwcAppMixin.js → SwcApp.js} +107 -57
  15. package/dist/cjs/elements/SwcApp.js.map +7 -0
  16. package/dist/cjs/elements/index.js +21 -2
  17. package/dist/cjs/elements/index.js.map +3 -3
  18. package/dist/cjs/elements/tt/SwcAppMixin.js +1 -0
  19. package/dist/cjs/elements/tt/SwcAppMixin.js.map +7 -0
  20. package/dist/cjs/elements/tt/SwcAsync.js +1 -0
  21. package/dist/cjs/elements/tt/SwcAsync.js.map +7 -0
  22. package/dist/cjs/elements/tt/SwcAsyncTemplate.js +1 -0
  23. package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +7 -0
  24. package/dist/cjs/elements/tt/SwcChoose.js +1 -0
  25. package/dist/cjs/elements/tt/SwcChoose.js.map +7 -0
  26. package/dist/cjs/elements/tt/SwcChooseTemplate.js +1 -0
  27. package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +7 -0
  28. package/dist/cjs/elements/tt/SwcIf.js +1 -0
  29. package/dist/cjs/elements/tt/SwcIf.js.map +7 -0
  30. package/dist/cjs/elements/tt/SwcIfTemplate.js +1 -0
  31. package/dist/cjs/elements/tt/SwcIfTemplate.js.map +7 -0
  32. package/dist/cjs/elements/tt/SwcLoop.js +1 -0
  33. package/dist/cjs/elements/tt/SwcLoop.js.map +7 -0
  34. package/dist/cjs/elements/tt/SwcLoopTemplate.js +1 -0
  35. package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +7 -0
  36. package/dist/cjs/elements/tt/SwcSubTemplates.js +1 -0
  37. package/dist/cjs/elements/tt/SwcSubTemplates.js.map +7 -0
  38. package/dist/cjs/elements/tt/register.js +1 -0
  39. package/dist/cjs/elements/tt/register.js.map +7 -0
  40. package/dist/cjs/index.js +12 -8
  41. package/dist/cjs/index.js.map +2 -2
  42. package/dist/cjs/types/window.d.js +16 -0
  43. package/dist/cjs/types/window.d.js.map +7 -0
  44. package/dist/cjs/types.js.map +1 -1
  45. package/dist/cjs/utils/Utils.js +9 -6
  46. package/dist/cjs/utils/Utils.js.map +2 -2
  47. package/dist/esm/{elements/SwcAppEngine.js → SwcAppEngine.js} +4 -4
  48. package/dist/esm/SwcAppEngine.js.map +7 -0
  49. package/dist/esm/decorators/applyNode.js +14 -13
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applySlot.js +103 -0
  52. package/dist/esm/decorators/applySlot.js.map +7 -0
  53. package/dist/esm/decorators/elementDefine.js +41 -33
  54. package/dist/esm/decorators/elementDefine.js.map +2 -2
  55. package/dist/esm/decorators/index.js +1 -0
  56. package/dist/esm/decorators/index.js.map +2 -2
  57. package/dist/esm/decorators/lifecycles.js +56 -8
  58. package/dist/esm/decorators/lifecycles.js.map +2 -2
  59. package/dist/esm/elements/{SwcAppMixin.js → SwcApp.js} +102 -53
  60. package/dist/esm/elements/SwcApp.js.map +7 -0
  61. package/dist/esm/elements/index.js +7 -1
  62. package/dist/esm/elements/index.js.map +2 -2
  63. package/dist/esm/elements/tt/SwcAppMixin.js +1 -0
  64. package/dist/esm/elements/tt/SwcAppMixin.js.map +7 -0
  65. package/dist/esm/elements/tt/SwcAsync.js +1 -0
  66. package/dist/esm/elements/tt/SwcAsync.js.map +7 -0
  67. package/dist/esm/elements/tt/SwcAsyncTemplate.js +1 -0
  68. package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +7 -0
  69. package/dist/esm/elements/tt/SwcChoose.js +1 -0
  70. package/dist/esm/elements/tt/SwcChoose.js.map +7 -0
  71. package/dist/esm/elements/tt/SwcChooseTemplate.js +1 -0
  72. package/dist/esm/elements/tt/SwcChooseTemplate.js.map +7 -0
  73. package/dist/esm/elements/tt/SwcIf.js +1 -0
  74. package/dist/esm/elements/tt/SwcIf.js.map +7 -0
  75. package/dist/esm/elements/tt/SwcIfTemplate.js +1 -0
  76. package/dist/esm/elements/tt/SwcIfTemplate.js.map +7 -0
  77. package/dist/esm/elements/tt/SwcLoop.js +1 -0
  78. package/dist/esm/elements/tt/SwcLoop.js.map +7 -0
  79. package/dist/esm/elements/tt/SwcLoopTemplate.js +1 -0
  80. package/dist/esm/elements/tt/SwcLoopTemplate.js.map +7 -0
  81. package/dist/esm/elements/tt/SwcSubTemplates.js +1 -0
  82. package/dist/esm/elements/tt/SwcSubTemplates.js.map +7 -0
  83. package/dist/esm/elements/tt/register.js +1 -0
  84. package/dist/esm/elements/tt/register.js.map +7 -0
  85. package/dist/esm/index.js +13 -9
  86. package/dist/esm/index.js.map +2 -2
  87. package/dist/esm/types/window.d.js +1 -0
  88. package/dist/esm/types/window.d.js.map +7 -0
  89. package/dist/esm/types.js.map +1 -1
  90. package/dist/esm/utils/Utils.js +9 -6
  91. package/dist/esm/utils/Utils.js.map +2 -2
  92. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3867 -97
  93. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  94. package/dist/types/{elements/SwcAppEngine.d.ts → SwcAppEngine.d.ts} +9 -4
  95. package/dist/types/SwcAppEngine.d.ts.map +1 -0
  96. package/dist/types/decorators/applyNode.d.ts +7 -7
  97. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  98. package/dist/types/decorators/applySlot.d.ts +27 -0
  99. package/dist/types/decorators/applySlot.d.ts.map +1 -0
  100. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  101. package/dist/types/decorators/index.d.ts +1 -0
  102. package/dist/types/decorators/index.d.ts.map +1 -1
  103. package/dist/types/decorators/lifecycles.d.ts +21 -6
  104. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  105. package/dist/types/elements/SwcApp.d.ts +7 -0
  106. package/dist/types/elements/SwcApp.d.ts.map +1 -0
  107. package/dist/types/elements/index.d.ts +2 -1
  108. package/dist/types/elements/index.d.ts.map +1 -1
  109. package/dist/types/elements/tt/SwcAppMixin.d.ts +1 -0
  110. package/dist/types/elements/tt/SwcAppMixin.d.ts.map +1 -0
  111. package/dist/types/elements/tt/SwcAsync.d.ts +1 -0
  112. package/dist/types/elements/tt/SwcAsync.d.ts.map +1 -0
  113. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +1 -0
  114. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +1 -0
  115. package/dist/types/elements/tt/SwcChoose.d.ts +1 -0
  116. package/dist/types/elements/tt/SwcChoose.d.ts.map +1 -0
  117. package/dist/types/elements/tt/SwcChooseTemplate.d.ts +1 -0
  118. package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +1 -0
  119. package/dist/types/elements/tt/SwcIf.d.ts +1 -0
  120. package/dist/types/elements/{SwcIf.d.ts.map → tt/SwcIf.d.ts.map} +1 -1
  121. package/dist/types/elements/tt/SwcIfTemplate.d.ts +1 -0
  122. package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +1 -0
  123. package/dist/types/elements/tt/SwcLoop.d.ts +1 -0
  124. package/dist/types/elements/tt/SwcLoop.d.ts.map +1 -0
  125. package/dist/types/elements/tt/SwcLoopTemplate.d.ts +1 -0
  126. package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +1 -0
  127. package/dist/types/elements/tt/SwcSubTemplates.d.ts +1 -0
  128. package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +1 -0
  129. package/dist/types/elements/tt/register.d.ts +1 -0
  130. package/dist/types/elements/tt/register.d.ts.map +1 -0
  131. package/dist/types/index.d.ts +2 -2
  132. package/dist/types/index.d.ts.map +1 -1
  133. package/dist/types/types.d.ts +3 -3
  134. package/dist/types/types.d.ts.map +1 -1
  135. package/dist/types/utils/Utils.d.ts +6 -5
  136. package/dist/types/utils/Utils.d.ts.map +1 -1
  137. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3867 -97
  138. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  139. package/package.json +2 -2
  140. package/src/{elements/SwcAppEngine.ts → SwcAppEngine.ts} +12 -7
  141. package/src/decorators/applyNode.ts +15 -13
  142. package/src/decorators/applySlot.ts +228 -0
  143. package/src/decorators/elementDefine.ts +59 -37
  144. package/src/decorators/index.ts +1 -0
  145. package/src/decorators/lifecycles.ts +76 -11
  146. package/src/elements/{SwcAppMixin.ts → SwcApp.ts} +98 -31
  147. package/src/elements/index.ts +11 -1
  148. package/src/elements/tt/SwcAppMixin.ts +13 -0
  149. package/src/elements/tt/SwcAsync.ts +139 -0
  150. package/src/elements/tt/SwcAsyncTemplate.ts +126 -0
  151. package/src/elements/tt/SwcChoose.ts +182 -0
  152. package/src/elements/tt/SwcChooseTemplate.ts +229 -0
  153. package/src/elements/tt/SwcIf.ts +145 -0
  154. package/src/elements/tt/SwcIfTemplate.ts +158 -0
  155. package/src/elements/tt/SwcLoop.ts +222 -0
  156. package/src/elements/tt/SwcLoopTemplate.ts +255 -0
  157. package/src/elements/tt/SwcSubTemplates.ts +6 -0
  158. package/src/elements/tt/register.ts +720 -0
  159. package/src/index.ts +13 -9
  160. package/src/types/window.d.ts +43 -0
  161. package/src/types.ts +4 -3
  162. package/src/utils/Utils.ts +11 -6
  163. package/dist/cjs/elements/SwcAppEngine.js.map +0 -7
  164. package/dist/cjs/elements/SwcAppMixin.js.map +0 -7
  165. package/dist/cjs/elements/SwcAsync.js +0 -129
  166. package/dist/cjs/elements/SwcAsync.js.map +0 -7
  167. package/dist/cjs/elements/SwcChoose.js +0 -155
  168. package/dist/cjs/elements/SwcChoose.js.map +0 -7
  169. package/dist/cjs/elements/SwcIf.js +0 -117
  170. package/dist/cjs/elements/SwcIf.js.map +0 -7
  171. package/dist/cjs/elements/SwcLoop.js +0 -176
  172. package/dist/cjs/elements/SwcLoop.js.map +0 -7
  173. package/dist/cjs/elements/SwcSubTemplates.js +0 -13
  174. package/dist/cjs/elements/SwcSubTemplates.js.map +0 -7
  175. package/dist/cjs/elements/register.js +0 -1026
  176. package/dist/cjs/elements/register.js.map +0 -7
  177. package/dist/esm/elements/SwcAppEngine.js.map +0 -7
  178. package/dist/esm/elements/SwcAppMixin.js.map +0 -7
  179. package/dist/esm/elements/SwcAsync.js +0 -129
  180. package/dist/esm/elements/SwcAsync.js.map +0 -7
  181. package/dist/esm/elements/SwcChoose.js +0 -155
  182. package/dist/esm/elements/SwcChoose.js.map +0 -7
  183. package/dist/esm/elements/SwcIf.js +0 -117
  184. package/dist/esm/elements/SwcIf.js.map +0 -7
  185. package/dist/esm/elements/SwcLoop.js +0 -176
  186. package/dist/esm/elements/SwcLoop.js.map +0 -7
  187. package/dist/esm/elements/SwcSubTemplates.js +0 -13
  188. package/dist/esm/elements/SwcSubTemplates.js.map +0 -7
  189. package/dist/esm/elements/register.js +0 -1007
  190. package/dist/esm/elements/register.js.map +0 -7
  191. package/dist/types/elements/SwcAppEngine.d.ts.map +0 -1
  192. package/dist/types/elements/SwcAppMixin.d.ts +0 -386
  193. package/dist/types/elements/SwcAppMixin.d.ts.map +0 -1
  194. package/dist/types/elements/SwcAsync.d.ts +0 -2
  195. package/dist/types/elements/SwcAsync.d.ts.map +0 -1
  196. package/dist/types/elements/SwcChoose.d.ts +0 -2
  197. package/dist/types/elements/SwcChoose.d.ts.map +0 -1
  198. package/dist/types/elements/SwcIf.d.ts +0 -2
  199. package/dist/types/elements/SwcLoop.d.ts +0 -2
  200. package/dist/types/elements/SwcLoop.d.ts.map +0 -1
  201. package/dist/types/elements/SwcSubTemplates.d.ts +0 -13
  202. package/dist/types/elements/SwcSubTemplates.d.ts.map +0 -1
  203. package/dist/types/elements/register.d.ts +0 -4
  204. package/dist/types/elements/register.d.ts.map +0 -1
  205. package/src/elements/SwcAsync.ts +0 -126
  206. package/src/elements/SwcChoose.ts +0 -190
  207. package/src/elements/SwcIf.ts +0 -124
  208. package/src/elements/SwcLoop.ts +0 -205
  209. package/src/elements/SwcSubTemplates.ts +0 -6
  210. package/src/elements/register.ts +0 -1022
package/README.md CHANGED
@@ -49,26 +49,63 @@ render() {
49
49
  }
50
50
  ```
51
51
 
52
- #### @applyInnerHtmlNodeThis
52
+ #### @applyNodeThisInnerHtml
53
53
  Apply HTML to specific host element.
54
54
 
55
55
  ```typescript
56
- @applyInnerHtmlNodeThis({ root: 'light' })
56
+ @applyNodeThisInnerHtml({ root: 'light' })
57
57
  updateContent() {
58
58
  return `<p>Updated content</p>`;
59
59
  }
60
60
  ```
61
61
 
62
- #### @applyReplaceChildrenNodeThis
62
+ #### @applyNodeThisReplaceChildren
63
63
  Replace child nodes with new content.
64
64
 
65
65
  ```typescript
66
- @applyReplaceChildrenNodeThis({ root: 'light' })
66
+ @applyNodeThisReplaceChildren({ root: 'light' })
67
67
  replaceChildren(node: Node) {
68
68
  return node;
69
69
  }
70
70
  ```
71
71
 
72
+ ### slot
73
+ ```typescript
74
+ @applySlot('zzz')
75
+ nodeSlot!: NodeSlot;
76
+
77
+ @addEventListener('.test-btn', 'click' )
78
+ @applySlotReplaceChildren('zzz')
79
+ ttt() {
80
+ return '<div>zzzzzzzzzz</div>'
81
+ }
82
+
83
+ @addEventListener('.test-clear-btn', 'click' )
84
+ // @applySlot('zzz', {position: 'clear'})
85
+ @applySlotClear('zzz')
86
+ ttct() {
87
+ return true;
88
+ }
89
+
90
+ @onConnectedAfter
91
+ ttttt() {
92
+ console.log('vvvvvvvvvvvvvvv??', this.nodeSlot)
93
+ this.nodeSlot.appendText('zzz22zzz'+new Date().toISOString())
94
+ }
95
+ @onConnectedInnerHtml
96
+ render()
97
+ {
98
+
99
+ return `
100
+ [[ zzz ]]
101
+ <button class="test-btn">test222222222222222</button>
102
+ <button class="test-clear-btn">clear</button>
103
+ [[ zzz ]]
104
+ `
105
+ }
106
+ ```
107
+
108
+
72
109
  ### 4. **Event Handling**
73
110
 
74
111
  #### @addEventListener
@@ -22,10 +22,10 @@ __export(SwcAppEngine_exports, {
22
22
  SwcAppEngine: () => SwcAppEngine
23
23
  });
24
24
  module.exports = __toCommonJS(SwcAppEngine_exports);
25
- var import_SimpleApplication = require("@dooboostore/simple-boot/SimpleApplication");
25
+ var import_simple_boot = require("@dooboostore/simple-boot");
26
26
  var import_core_web = require("@dooboostore/core-web");
27
- var import_ElementRouter = require("../router/ElementRouter");
28
- var import_SimOption = require("@dooboostore/simple-boot/SimOption");
27
+ var import_ElementRouter = require("./router/ElementRouter");
28
+ var import_simple_boot2 = require("@dooboostore/simple-boot");
29
29
  class SwcAppEngine {
30
30
  constructor(host) {
31
31
  this.host = host;
@@ -47,8 +47,8 @@ class SwcAppEngine {
47
47
  } else if (this._config.routeType === "element") {
48
48
  this.router = new import_ElementRouter.ElementRouter({ window: this._config.window, firstUrl: this._config.path });
49
49
  }
50
- this.simpleApplication = new import_SimpleApplication.SimpleApplication(
51
- new import_SimOption.SimOption({
50
+ this.simpleApplication = new import_simple_boot.SimpleApplication(
51
+ new import_simple_boot2.SimOption({
52
52
  excludeProxys: [this._config.window.Node],
53
53
  container: this._config.container
54
54
  })
@@ -60,7 +60,7 @@ class SwcAppEngine {
60
60
  if (this.router) otherInstanceSim.set(import_core_web.Router, this.router);
61
61
  this.simpleApplication.run(otherInstanceSim);
62
62
  if (this._config.onEngineStarted) {
63
- this._config.onEngineStarted(this.simpleApplication, this.host);
63
+ await this._config.onEngineStarted(this.simpleApplication, this.host);
64
64
  }
65
65
  } catch (e) {
66
66
  console.error("[SWC-APP-ENGINE] Init failed:", e, this._config);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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';\n\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'; // 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\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 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 }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAClC,sBAAgE;AAChE,2BAA8B;AAC9B,IAAAA,sBAA0B;AAgCnB,MAAM,aAAa;AAAA,EAMxB,YAAoB,MAAmB;AAAnB;AALpB,wBAAO;AACP,wBAAO;AACP,wBAAQ;AACR,wBAAQ;AAAA,EAEgC;AAAA,EAExC,IAAI,SAAS;AACX,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,QAAuB;AACn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};
19
19
  __export(applyNode_exports, {
20
20
  APPLY_NODE_METADATA_KEY: () => APPLY_NODE_METADATA_KEY,
21
- applyInnerHtmlNode: () => applyInnerHtmlNode,
22
- applyInnerHtmlNodeThis: () => applyInnerHtmlNodeThis,
23
- applyInnerTextNode: () => applyInnerTextNode,
24
21
  applyNode: () => applyNode,
22
+ applyNodeInnerHtml: () => applyNodeInnerHtml,
23
+ applyNodeInnerText: () => applyNodeInnerText,
24
+ applyNodeReplaceChildren: () => applyNodeReplaceChildren,
25
25
  applyNodeThis: () => applyNodeThis,
26
- applyReplaceChildrenNode: () => applyReplaceChildrenNode,
27
- applyReplaceChildrenNodeThis: () => applyReplaceChildrenNodeThis,
26
+ applyNodeThisReplaceChildren: () => applyNodeThisReplaceChildren,
27
+ applyThisInnerHtmlNode: () => applyThisInnerHtmlNode,
28
28
  findAllApplyNodeMetadata: () => findAllApplyNodeMetadata
29
29
  });
30
30
  module.exports = __toCommonJS(applyNode_exports);
@@ -39,8 +39,9 @@ const normalizeNodes = (res, doc) => {
39
39
  return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
40
40
  });
41
41
  };
42
- const applyToDom = (targetEl, res, pos, doc) => {
42
+ const applyToDom = (targetEl, res, pos, win) => {
43
43
  if (!targetEl) return;
44
+ const doc = win.document;
44
45
  if (pos === "innerHtml") {
45
46
  targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
46
47
  return;
@@ -51,7 +52,7 @@ const applyToDom = (targetEl, res, pos, doc) => {
51
52
  }
52
53
  return;
53
54
  }
54
- const isShadowRoot = targetEl instanceof ShadowRoot;
55
+ const isShadowRoot = targetEl instanceof win.ShadowRoot;
55
56
  const nodes = normalizeNodes(res, doc);
56
57
  if (pos === "replace") {
57
58
  if (!isShadowRoot) targetEl.replaceWith(...nodes);
@@ -104,7 +105,7 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
104
105
  const runApply = (target, val) => {
105
106
  const pos = options.position || "beforeEnd";
106
107
  if (!options.filter || options.filter(target, val, { currentThis: this, helper: hostSet })) {
107
- applyToDom(target, val, pos, currentDoc);
108
+ applyToDom(target, val, pos, currentWin);
108
109
  }
109
110
  };
110
111
  if (res instanceof Promise) {
@@ -138,23 +139,23 @@ function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
138
139
  const opt = targetOrOptions || {};
139
140
  return applyNode("$this", { position: "beforeEnd", ...opt });
140
141
  }
141
- function applyReplaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
142
+ function applyNodeThisReplaceChildren(targetOrOptions, propertyKey, descriptor) {
142
143
  if (propertyKey !== void 0) return applyNode("$this", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
143
144
  const opt = targetOrOptions || {};
144
145
  return applyNode("$this", { position: "replaceChildren", ...opt });
145
146
  }
146
- function applyInnerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
147
+ function applyThisInnerHtmlNode(targetOrOptions, propertyKey, descriptor) {
147
148
  if (propertyKey !== void 0) return applyNode("$this", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
148
149
  const opt = targetOrOptions || {};
149
150
  return applyNode("$this", { position: "innerHtml", ...opt });
150
151
  }
151
- function applyReplaceChildrenNode(selector, options = {}) {
152
+ function applyNodeReplaceChildren(selector, options = {}) {
152
153
  return applyNode(selector, { ...options, position: "replaceChildren" });
153
154
  }
154
- function applyInnerHtmlNode(selector, options = {}) {
155
+ function applyNodeInnerHtml(selector, options = {}) {
155
156
  return applyNode(selector, { ...options, position: "innerHtml" });
156
157
  }
157
- function applyInnerTextNode(selector, options = {}) {
158
+ function applyNodeInnerText(selector, options = {}) {
158
159
  return applyNode(selector, { ...options, position: "innerText" });
159
160
  }
160
161
  //# sourceMappingURL=applyNode.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/applyNode.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit, getElementConfig } from './elementDefine';\nimport { HelperHostSet, SwcRootType } from '../types';\nimport { SwcUtils } from \"../utils/Utils\";\n/*\n<!-- beforebegin -->\n<p>\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplyNodePosition = 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd' | 'replace' | 'replaceChildren' | 'innerHtml' | 'innerText' | 'remove';\n\nexport interface ApplyNodeOptions {\n position?: ApplyNodePosition;\n root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n loading?: (helper: HelperHostSet) => any;\n}\n\nexport interface ApplyNodeMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: ApplyNodeOptions;\n}\n\nexport const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-node');\n\nconst normalizeNodes = (res: any, doc: Document): Node[] => {\n const items = Array.isArray(res) ? res : [res];\n return items.map(it => {\n if (it instanceof Node) return it;\n return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n });\n};\n\nconst applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, doc: Document) => {\n if (!targetEl) return;\n \n if (pos === 'innerHtml') {\n targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';\n return;\n }\n \n if (pos === 'innerText') {\n if (targetEl.innerText !== undefined) {\n targetEl.innerText = res !== undefined && res !== null ? String(res) : '';\n }\n return;\n }\n\n const isShadowRoot = targetEl instanceof ShadowRoot;\n const nodes = normalizeNodes(res, doc);\n if (pos === 'replace') {\n if (!isShadowRoot) targetEl.replaceWith(...nodes);\n } else if (pos === 'replaceChildren') {\n targetEl.replaceChildren(...nodes);\n } else {\n if (pos === 'beforeEnd') targetEl.append(...nodes);\n else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n }\n};\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n */\nexport function applyNode(selector: string, options: ApplyNodeOptions = { position: 'beforeEnd' }): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor) as Map<string | symbol, ApplyNodeMetadata>;\n if (!metaList) {\n metaList = new Map<string | symbol, ApplyNodeMetadata>();\n ReflectUtils.defineMetadata(APPLY_NODE_METADATA_KEY, metaList, constructor);\n }\n metaList.set(propertyKey, { propertyKey, selector, options });\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n \n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n \n const getTarget = () => {\n const r = options.root || 'auto';\n const applyRoot = (t: any) => {\n if (!t) return t;\n if (r === 'auto') return t.shadowRoot || t;\n if (r === 'shadow') return t.shadowRoot;\n if (r === 'light') return t;\n if (r === 'all') return t.shadowRoot || t;\n return t;\n };\n\n if (selector === '$this') return applyRoot(this);\n if (selector === '$host') return applyRoot(hostSet.$host);\n if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === '$appHost') return applyRoot(hostSet.$appHost);\n if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);\n \n const targetRoot = applyRoot(this);\n return targetRoot ? targetRoot.querySelector(selector) : null;\n };\n\n const targetEl = getTarget();\n const res = original.apply(this, args);\n\n const runApply = (target: any, val: any) => {\n const pos = options.position || 'beforeEnd';\n \n // \uC0AC\uC6A9\uC790\uAC00 filter\uB97C \uBA85\uC2DC\uD558\uBA74 \uADF8 \uC870\uAC74\uC73C\uB85C, \uC544\uB2C8\uBA74 \uD56D\uC0C1 \uC801\uC6A9\n if (!options.filter || options.filter(target, val, {currentThis: this, helper: hostSet})) {\n applyToDom(target, val, pos, currentDoc);\n }\n };\n\n if (res instanceof Promise) {\n // \uBE44\uB3D9\uAE30\uC77C \uB54C\uB9CC \uB85C\uB529 \uD45C\uC2DC\n if (targetEl && options.loading) {\n const loadingRes = options.loading.call(this, hostSet);\n applyToDom(targetEl, loadingRes, options.position || 'beforeEnd', currentDoc);\n }\n\n return res.then(finalRes => {\n if (finalRes !== undefined && targetEl) runApply(targetEl, finalRes);\n return finalRes;\n });\n } else {\n if (res !== undefined && targetEl) runApply(targetEl, res);\n return res;\n }\n };\n };\n}\n\nexport const findAllApplyNodeMetadata = (target: any): Map<string | symbol, ApplyNodeMetadata> => {\n const result = new Map<string | symbol, ApplyNodeMetadata>();\n const maps = ReflectUtils.findAllMetadata<Map<string | symbol, ApplyNodeMetadata>>(APPLY_NODE_METADATA_KEY, target);\n maps.forEach(map => {\n if (map instanceof Map) {\n map.forEach((v, k) => result.set(k, v));\n }\n });\n return result;\n};\n\nexport function applyNodeThis(options: ApplyNodeOptions): MethodDecorator;\nexport function applyNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function applyNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n if (propertyKey !== undefined) return applyNode('$this', { position: 'beforeEnd' })(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', { position: 'beforeEnd', ...opt });\n}\n\nexport function applyReplaceChildrenNodeThis(options: ApplyNodeOptions): MethodDecorator;\nexport function applyReplaceChildrenNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function applyReplaceChildrenNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n if (propertyKey !== undefined) return applyNode('$this', { position: 'replaceChildren' })(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', { position: 'replaceChildren', ...opt });\n}\n\nexport function applyInnerHtmlNodeThis(options: ApplyNodeOptions): MethodDecorator;\nexport function applyInnerHtmlNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function applyInnerHtmlNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n if (propertyKey !== undefined) return applyNode('$this', { position: 'innerHtml' })(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', { position: 'innerHtml', ...opt });\n}\n\nexport function applyReplaceChildrenNode(selector: string, options: ApplyNodeOptions = {}): MethodDecorator {\n return applyNode(selector, { ...options, position: 'replaceChildren' });\n}\n\nexport function applyInnerHtmlNode(selector: string, options: ApplyNodeOptions = {}): MethodDecorator {\n return applyNode(selector, { ...options, position: 'innerHtml' });\n}\n\nexport function applyInnerTextNode(selector: string, options: ApplyNodeOptions = {}): MethodDecorator {\n return applyNode(selector, { ...options, position: 'innerText' });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAC7B,2BAA6C;AAE7C,mBAAyB;AAgClB,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;AAEnF,MAAM,iBAAiB,CAAC,KAAU,QAA0B;AAC1D,QAAM,QAAQ,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;AAC7C,SAAO,MAAM,IAAI,QAAM;AACrB,QAAI,cAAc,KAAM,QAAO;AAC/B,WAAO,IAAI,eAAe,OAAO,UAAa,OAAO,OAAO,OAAO,EAAE,IAAI,EAAE;AAAA,EAC7E,CAAC;AACH;AAEA,MAAM,aAAa,CAAC,UAAe,KAAU,KAAwB,QAAkB;AACnF,MAAI,CAA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AkB,UAA4B,CAAC,GAAoB;AACxG,SAAO,UAAU,UAAU,EAAE,GAAG,SAAS,UAAU,kBAAkB,CAAC;AAC1E;AAEO,SAAS,mBAAmB,UAAkB,UAA4B,CAAC,GAAoB;AAClG,SAAO,UAAU,UAAU,EAAE,GAAG,SAAS,UAAU,YAAY,CAAC;AACpE;AAEO,SAAS,mBAAmB,UAAkB,UAA4B,CAAC,GAAoB;AAClG,SAAO,UAAU,UAAU,EAAE,GAAG,SAAS,UAAU,YAAY,CAAC;AACpE;",
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit, getElementConfig } from './elementDefine';\nimport { HelperHostSet, SwcRootType } from '../types';\nimport { SwcUtils } from \"../utils/Utils\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplyNodePosition = 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd' | 'replace' | 'replaceChildren' | 'innerHtml' | 'innerText' | 'remove';\n\nexport interface ApplyNodeOptions {\n position?: ApplyNodePosition;\n root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n loading?: (helper: HelperHostSet) => any;\n}\n\nexport interface ApplyNodeMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: ApplyNodeOptions;\n}\n\nexport const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-node');\n\nconst normalizeNodes = (res: any, doc: Document): Node[] => {\n const items = Array.isArray(res) ? res : [res];\n return items.map(it => {\n if (it instanceof Node) return it;\n return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n });\n};\n\nconst applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, win: Window) => {\n if (!targetEl) return;\n\n const doc = win.document;\n \n if (pos === 'innerHtml') {\n targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';\n return;\n }\n \n if (pos === 'innerText') {\n if (targetEl.innerText !== undefined) {\n targetEl.innerText = res !== undefined && res !== null ? String(res) : '';\n }\n return;\n }\n\n const isShadowRoot = targetEl instanceof win.ShadowRoot;\n const nodes = normalizeNodes(res, doc);\n if (pos === 'replace') {\n if (!isShadowRoot) targetEl.replaceWith(...nodes);\n } else if (pos === 'replaceChildren') {\n targetEl.replaceChildren(...nodes);\n } else {\n if (pos === 'beforeEnd') targetEl.append(...nodes);\n else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n }\n};\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n */\nexport function applyNode(selector: string, options: ApplyNodeOptions = { position: 'beforeEnd' }): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor) as Map<string | symbol, ApplyNodeMetadata>;\n if (!metaList) {\n metaList = new Map<string | symbol, ApplyNodeMetadata>();\n ReflectUtils.defineMetadata(APPLY_NODE_METADATA_KEY, metaList, constructor);\n }\n metaList.set(propertyKey, { propertyKey, selector, options });\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n \n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n \n const getTarget = () => {\n const r = options.root || 'auto';\n const applyRoot = (t: any) => {\n if (!t) return t;\n if (r === 'auto') return t.shadowRoot || t;\n if (r === 'shadow') return t.shadowRoot;\n if (r === 'light') return t;\n if (r === 'all') return t.shadowRoot || t;\n return t;\n };\n\n if (selector === '$this') return applyRoot(this);\n if (selector === '$host') return applyRoot(hostSet.$host);\n if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === '$appHost') return applyRoot(hostSet.$appHost);\n if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);\n \n const targetRoot = applyRoot(this);\n return targetRoot ? targetRoot.querySelector(selector) : null;\n };\n\n const targetEl = getTarget();\n const res = original.apply(this, args);\n\n const runApply = (target: any, val: any) => {\n const pos = options.position || 'beforeEnd';\n \n // \uC0AC\uC6A9\uC790\uAC00 filter\uB97C \uBA85\uC2DC\uD558\uBA74 \uADF8 \uC870\uAC74\uC73C\uB85C, \uC544\uB2C8\uBA74 \uD56D\uC0C1 \uC801\uC6A9\n if (!options.filter || options.filter(target, val, {currentThis: this, helper: hostSet})) {\n applyToDom(target, val, pos, currentWin);\n }\n };\n\n if (res instanceof Promise) {\n // \uBE44\uB3D9\uAE30\uC77C \uB54C\uB9CC \uB85C\uB529 \uD45C\uC2DC\n if (targetEl && options.loading) {\n const loadingRes = options.loading.call(this, hostSet);\n applyToDom(targetEl, loadingRes, options.position || 'beforeEnd', currentDoc);\n }\n\n return res.then(finalRes => {\n if (finalRes !== undefined && targetEl) runApply(targetEl, finalRes);\n return finalRes;\n });\n } else {\n if (res !== undefined && targetEl) runApply(targetEl, res);\n return res;\n }\n };\n };\n}\n\nexport const findAllApplyNodeMetadata = (target: any): Map<string | symbol, ApplyNodeMetadata> => {\n const result = new Map<string | symbol, ApplyNodeMetadata>();\n const maps = ReflectUtils.findAllMetadata<Map<string | symbol, ApplyNodeMetadata>>(APPLY_NODE_METADATA_KEY, target);\n maps.forEach(map => {\n if (map instanceof Map) {\n map.forEach((v, k) => result.set(k, v));\n }\n });\n return result;\n};\n\nexport function applyNodeThis(options: ApplyNodeOptions): MethodDecorator;\nexport function applyNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function applyNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n if (propertyKey !== undefined) return applyNode('$this', { position: 'beforeEnd' })(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', { position: 'beforeEnd', ...opt });\n}\n\nexport function applyNodeThisReplaceChildren(options: ApplyNodeOptions): MethodDecorator;\nexport function applyNodeThisReplaceChildren(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function applyNodeThisReplaceChildren(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n if (propertyKey !== undefined) return applyNode('$this', { position: 'replaceChildren' })(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', { position: 'replaceChildren', ...opt });\n}\n\nexport function applyThisInnerHtmlNode(options: ApplyNodeOptions): MethodDecorator;\nexport function applyThisInnerHtmlNode(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function applyThisInnerHtmlNode(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n if (propertyKey !== undefined) return applyNode('$this', { position: 'innerHtml' })(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', { position: 'innerHtml', ...opt });\n}\n\nexport function applyNodeReplaceChildren(selector: string, options: ApplyNodeOptions = {}): MethodDecorator {\n return applyNode(selector, { ...options, position: 'replaceChildren' });\n}\n\nexport function applyNodeInnerHtml(selector: string, options: ApplyNodeOptions = {}): MethodDecorator {\n return applyNode(selector, { ...options, position: 'innerHtml' });\n}\n\nexport function applyNodeInnerText(selector: string, options: ApplyNodeOptions = {}): MethodDecorator {\n return applyNode(selector, { ...options, position: 'innerText' });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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gBAAgB,OAAW,QAAO,UAAU,SAAS,EAAE,UAAU,kBAAkB,CAAC,EAAE,iBAAiB,aAAa,UAAU;AAClI,QAAM,MAAM,mBAAmB,CAAC;AAChC,SAAO,UAAU,SAAS,EAAE,UAAU,mBAAmB,GAAG,IAAI,CAAC;AACnE;AAIO,SAAS,uBAAuB,iBAAuB,aAA+B,YAAsC;AACjI,MAAI,gBAAgB,OAAW,QAAO,UAAU,SAAS,EAAE,UAAU,YAAY,CAAC,EAAE,iBAAiB,aAAa,UAAU;AAC5H,QAAM,MAAM,mBAAmB,CAAC;AAChC,SAAO,UAAU,SAAS,EAAE,UAAU,aAAa,GAAG,IAAI,CAAC;AAC7D;AAEO,SAAS,yBAAyB,UAAkB,UAA4B,CAAC,GAAoB;AACxG,SAAO,UAAU,UAAU,EAAE,GAAG,SAAS,UAAU,kBAAkB,CAAC;AAC1E;AAEO,SAAS,mBAAmB,UAAkB,UAA4B,CAAC,GAAoB;AAClG,SAAO,UAAU,UAAU,EAAE,GAAG,SAAS,UAAU,YAAY,CAAC;AACpE;AAEO,SAAS,mBAAmB,UAAkB,UAA4B,CAAC,GAAoB;AAClG,SAAO,UAAU,UAAU,EAAE,GAAG,SAAS,UAAU,YAAY,CAAC;AACpE;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,122 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var applySlot_exports = {};
19
+ __export(applySlot_exports, {
20
+ APPLY_SLOT_METADATA_KEY: () => APPLY_SLOT_METADATA_KEY,
21
+ applySlot: () => applySlot,
22
+ applySlotAppend: () => applySlotAppend,
23
+ applySlotAppendHtml: () => applySlotAppendHtml,
24
+ applySlotAppendText: () => applySlotAppendText,
25
+ applySlotClear: () => applySlotClear,
26
+ applySlotPrepend: () => applySlotPrepend,
27
+ applySlotPrependHtml: () => applySlotPrependHtml,
28
+ applySlotPrependText: () => applySlotPrependText,
29
+ applySlotReplaceChildren: () => applySlotReplaceChildren,
30
+ applySlotReplaceChildrenHtml: () => applySlotReplaceChildrenHtml,
31
+ applySlotReplaceChildrenText: () => applySlotReplaceChildrenText,
32
+ findAllApplySlotMetadata: () => findAllApplySlotMetadata
33
+ });
34
+ module.exports = __toCommonJS(applySlot_exports);
35
+ var import_core = require("@dooboostore/core");
36
+ var import_elementDefine = require("./elementDefine");
37
+ var import_Utils = require("../utils/Utils");
38
+ var import_core_web = require("@dooboostore/core-web");
39
+ const APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
40
+ function applySlot(id, options = { position: "replaceChildrenHtml" }) {
41
+ return (targetObj, propertyKey, descriptor) => {
42
+ const type = descriptor === void 0 ? "property" : "method";
43
+ if (type === "property") {
44
+ Object.defineProperty(targetObj, propertyKey, {
45
+ get() {
46
+ const nodeSlot = new import_core_web.NodeSlot(this, `${this._swcId}-${id}`);
47
+ return nodeSlot;
48
+ },
49
+ configurable: true,
50
+ enumerable: true
51
+ });
52
+ }
53
+ const constructor = targetObj.constructor;
54
+ let metaList = import_core.ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
55
+ if (!metaList) {
56
+ metaList = [];
57
+ import_core.ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
58
+ }
59
+ metaList.push({ propertyKey, id, type, options });
60
+ if (type === "method") {
61
+ const original = descriptor.value;
62
+ descriptor.value = function(...args) {
63
+ (0, import_elementDefine.ensureInit)(this);
64
+ const conf = (0, import_elementDefine.getElementConfig)(this);
65
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
66
+ const currentDoc = currentWin.document;
67
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(currentWin, this);
68
+ const res = original.apply(this, args);
69
+ if (res) {
70
+ const nodeSlot = new import_core_web.NodeSlot(this, `${this._swcId}-${id}`);
71
+ const pos = options.position || "replaceChildrenHtml";
72
+ const doc = currentWin.document;
73
+ if (pos === "replaceChildrenHtml") {
74
+ nodeSlot.replaceChildrenHtml(res);
75
+ } else if (pos === "replaceChildrenText") {
76
+ nodeSlot.replaceChildrenText(res);
77
+ } else if (pos === "appendHtml") {
78
+ nodeSlot.appendHtml(res);
79
+ } else if (pos === "appendText") {
80
+ nodeSlot.appendText(res);
81
+ } else if (pos === "prependHtml") {
82
+ nodeSlot.prependHtml(res);
83
+ } else if (pos === "prependText") {
84
+ nodeSlot.prependText(res);
85
+ } else if (pos === "clear") {
86
+ nodeSlot.clear();
87
+ }
88
+ }
89
+ return res;
90
+ };
91
+ }
92
+ };
93
+ }
94
+ const findAllApplySlotMetadata = (target) => {
95
+ const constructor = target instanceof Function ? target : target.constructor;
96
+ return import_core.ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
97
+ };
98
+ function applySlotClear(id) {
99
+ return applySlot(id, { position: "clear" });
100
+ }
101
+ function applySlotPrependHtml(id) {
102
+ return applySlot(id, { position: "prependHtml" });
103
+ }
104
+ const applySlotPrepend = applySlotPrependHtml;
105
+ function applySlotPrependText(id) {
106
+ return applySlot(id, { position: "prependText" });
107
+ }
108
+ function applySlotAppendHtml(id) {
109
+ return applySlot(id, { position: "appendHtml" });
110
+ }
111
+ function applySlotAppendText(id) {
112
+ return applySlot(id, { position: "appendText" });
113
+ }
114
+ const applySlotAppend = applySlotAppendHtml;
115
+ function applySlotReplaceChildrenHtml(id) {
116
+ return applySlot(id, { position: "replaceChildrenHtml" });
117
+ }
118
+ const applySlotReplaceChildren = applySlotReplaceChildrenHtml;
119
+ function applySlotReplaceChildrenText(id) {
120
+ return applySlot(id, { position: "replaceChildrenText" });
121
+ }
122
+ //# sourceMappingURL=applySlot.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/decorators/applySlot.ts"],
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit, getElementConfig } from './elementDefine';\nimport { HelperHostSet, SwcRootType } from '../types';\nimport { SwcUtils } from \"../utils/Utils\";\nimport {NodeSlot} from \"@dooboostore/core-web\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplySlotPosition = 'prependHtml' | 'prependText' | 'appendHtml' | 'appendText' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';\n\nexport interface ApplySlotOptions {\n position?: ApplySlotPosition;\n // root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n // filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n // loading?: (helper: HelperHostSet) => any;\n}\n\nexport interface ApplySlotMetadata {\n propertyKey: string | symbol;\n id: string;\n type: 'method' | 'property';\n options: ApplySlotOptions;\n}\n\nexport const APPLY_SLOT_METADATA_KEY = Symbol.for('simple-web-component:apply-slot');\n\n// const normalizeNodes = (res: any, doc: Document): Node[] => {\n// const items = Array.isArray(res) ? res : [res];\n// return items.map(it => {\n// if (it instanceof Node) return it;\n// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n// });\n// };\n\n// const applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, win: Window) => {\n// if (!targetEl) return;\n//\n// const doc = win.document;\n//\n// if (pos === 'innerHtml') {\n// targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';\n// return;\n// }\n//\n// if (pos === 'innerText') {\n// if (targetEl.innerText !== undefined) {\n// targetEl.innerText = res !== undefined && res !== null ? String(res) : '';\n// }\n// return;\n// }\n//\n// const isShadowRoot = targetEl instanceof win.ShadowRoot;\n// const nodes = normalizeNodes(res, doc);\n// if (pos === 'replace') {\n// if (!isShadowRoot) targetEl.replaceWith(...nodes);\n// } else if (pos === 'replaceChildren') {\n// targetEl.replaceChildren(...nodes);\n// } else {\n// if (pos === 'beforeEnd') targetEl.append(...nodes);\n// else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n// else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n// else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n// }\n// };\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n */\nexport function applySlot(id: string, options: ApplySlotOptions = { position: 'replaceChildrenHtml' }): MethodDecorator & PropertyDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const type = descriptor === undefined ? 'property' : 'method';\n\n if (type === 'property') {\n Object.defineProperty(targetObj, propertyKey, {\n get(this: any) {\n const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);\n return nodeSlot;\n },\n configurable: true,\n enumerable: true,\n })\n // return nodeSlot;\n // return;\n }\n\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor) as ApplySlotMetadata[];\n if (!metaList) {\n metaList = []\n ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({ propertyKey, id, type, options });\n\n\n\n if (type === 'method') {\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n\n\n // const getTarget = () => {\n // const r = options.root || 'auto';\n // const applyRoot = (t: any) => {\n // if (!t) return t;\n // if (r === 'auto') return t.shadowRoot || t;\n // if (r === 'shadow') return t.shadowRoot;\n // if (r === 'light') return t;\n // if (r === 'all') return t.shadowRoot || t;\n // return t;\n // };\n //\n // if (selector === '$this') return applyRoot(this);\n // if (selector === '$host') return applyRoot(hostSet.$host);\n // if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);\n // if (selector === '$appHost') return applyRoot(hostSet.$appHost);\n // if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);\n // if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);\n //\n // const targetRoot = applyRoot(this);\n // return targetRoot ? targetRoot.querySelector(selector) : null;\n // };\n\n // const targetEl = getTarget();\n const res = original.apply(this, args);\n\n // const runApply = (target: any, val: any) => {\n // const pos = options.position || 'beforeEnd';\n //\n // // \uC0AC\uC6A9\uC790\uAC00 filter\uB97C \uBA85\uC2DC\uD558\uBA74 \uADF8 \uC870\uAC74\uC73C\uB85C, \uC544\uB2C8\uBA74 \uD56D\uC0C1 \uC801\uC6A9\n // if (!options.filter || options.filter(target, val, {currentThis: this, helper: hostSet})) {\n // applyToDom(target, val, pos, currentWin);\n // }\n // };\n\n // if (res instanceof Promise) {\n // // \uBE44\uB3D9\uAE30\uC77C \uB54C\uB9CC \uB85C\uB529 \uD45C\uC2DC\n // if (targetEl && options.loading) {\n // const loadingRes = options.loading.call(this, hostSet);\n // applyToDom(targetEl, loadingRes, options.position || 'beforeEnd', currentDoc);\n // }\n //\n // return res.then(finalRes => {\n // if (finalRes !== undefined && targetEl) runApply(targetEl, finalRes);\n // return finalRes;\n // });\n // } else {\n // if (res !== undefined && targetEl) runApply(targetEl, res);\n // return res;\n // }\n if (res) {\n const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);\n const pos = options.position || 'replaceChildrenHtml';\n const doc = currentWin.document;\n\n\n // const isShadowRoot = targetEl instanceof win.ShadowRoot;\n // const nodes = normalizeNodes(res, doc);\n if (pos === 'replaceChildrenHtml') {\n nodeSlot.replaceChildrenHtml(res);\n } else if (pos === 'replaceChildrenText') {\n nodeSlot.replaceChildrenText(res);\n } else if (pos === 'appendHtml') {\n nodeSlot.appendHtml(res);\n } else if (pos === 'appendText') {\n nodeSlot.appendText(res);\n } else if (pos === 'prependHtml') {\n nodeSlot.prependHtml(res);\n } else if (pos === 'prependText') {\n nodeSlot.prependText(res);\n } else if (pos === 'clear') {\n nodeSlot.clear();\n }\n }\n return res;\n };\n }\n };\n}\n\n// export const findAllApplySlotMetadata = (target: any): Map<string | symbol, ApplySlotMetadata> => {\nexport const findAllApplySlotMetadata = (target: any): ApplySlotMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);\n};\n\nexport function applySlotClear(id: string): MethodDecorator {\n return applySlot(id, { position: 'clear' });\n}\nexport function applySlotPrependHtml(id: string): MethodDecorator {\n return applySlot(id, { position: 'prependHtml' });\n}\nexport const applySlotPrepend = applySlotPrependHtml;\nexport function applySlotPrependText(id: string): MethodDecorator {\n return applySlot(id, { position: 'prependText' });\n}\nexport function applySlotAppendHtml(id: string): MethodDecorator {\n return applySlot(id, { position: 'appendHtml' });\n}\nexport function applySlotAppendText(id: string): MethodDecorator {\n return applySlot(id, { position: 'appendText' });\n}\nexport const applySlotAppend = applySlotAppendHtml;\nexport function applySlotReplaceChildrenHtml(id: string): MethodDecorator {\n return applySlot(id, { position: 'replaceChildrenHtml' });\n}\nexport const applySlotReplaceChildren = applySlotReplaceChildrenHtml;\nexport function applySlotReplaceChildrenText(id: string): MethodDecorator {\n return applySlot(id, { position: 'replaceChildrenText' });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;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AAsB,CAAC;AAC1D;",
6
+ "names": []
7
+ }
@@ -37,6 +37,8 @@ var import_config = require("../config/config");
37
37
  var import_Inject = require("@dooboostore/simple-boot/decorators/inject/Inject");
38
38
  var import_types = require("../types");
39
39
  var import_core_web = require("@dooboostore/core-web");
40
+ var import_SwcApp = require("../elements/SwcApp");
41
+ var import_applySlot = require("./applySlot");
40
42
  const ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
41
43
  const getElementConfig = (target) => {
42
44
  const constructor = target instanceof Function ? target : target.constructor;
@@ -44,7 +46,7 @@ const getElementConfig = (target) => {
44
46
  };
45
47
  const ensureInit = (inst) => {
46
48
  if (!inst.__swc_initialized) {
47
- inst._swcId = Math.random().toString(36).substring(2, 11);
49
+ inst._swcId = inst?.getAttribute?.("swc-use-ssr") ?? Math.random().toString(36).substring(2, 11);
48
50
  inst._emitHandlers = /* @__PURE__ */ new Map();
49
51
  inst._boundListeners = [];
50
52
  inst.__swc_initialized = true;
@@ -65,6 +67,12 @@ const ensureInit = (inst) => {
65
67
  delete inst[meta.propertyKey];
66
68
  });
67
69
  }
70
+ const slotAllList = (0, import_applySlot.findAllApplySlotMetadata)(target);
71
+ if (slotAllList) {
72
+ slotAllList.filter((it) => it.type === "property").forEach((meta) => {
73
+ delete inst[meta.propertyKey];
74
+ });
75
+ }
68
76
  const hostSet = import_Utils.SwcUtils.getHostSet(inst);
69
77
  const appHosts = import_Utils.SwcUtils.findAllAppHostsIncludingSelfDirect(inst);
70
78
  inst._executeSwcScript?.("swc-on-constructor", hostSet);
@@ -107,7 +115,7 @@ const getHandlers = (inst) => {
107
115
  if (!inst.__swc_attributeEventHandlers) inst.__swc_attributeEventHandlers = /* @__PURE__ */ new Map();
108
116
  return inst.__swc_attributeEventHandlers;
109
117
  };
110
- const setupPrototype = (proto) => {
118
+ const setupPrototype = (proto, win) => {
111
119
  if (proto.__swc_proto_setup) return;
112
120
  proto.__swc_proto_setup = true;
113
121
  proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
@@ -138,7 +146,7 @@ const setupPrototype = (proto) => {
138
146
  proto._invokeLifecycleMethod = function(methodName, hostSet, extraArgs = []) {
139
147
  ensureInit(this);
140
148
  if (typeof this[methodName] !== "function") return;
141
- const useHostSet = hostSet ?? import_Utils.SwcUtils.getHostSet(this);
149
+ const useHostSet = hostSet ?? import_Utils.SwcUtils.getHelperAndHostSet(win, this);
142
150
  const app = useHostSet?.$appHost?.simpleApplication;
143
151
  if (app) {
144
152
  const otherStorage = /* @__PURE__ */ new Map();
@@ -243,61 +251,57 @@ const elementDefine = (name, config = {}) => (constructor) => {
243
251
  const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
244
252
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
245
253
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
246
- const connectedInnerHtmlList = (0, import_lifecycles.getOnConnectedInnerHtmlMetadata)(constructor) || [];
247
254
  const proto = constructor.prototype;
248
- setupPrototype(proto);
255
+ setupPrototype(proto, win);
249
256
  let helperHostSet = null;
250
257
  const originalConnected = proto.connectedCallback;
251
258
  proto.connectedCallback = async function() {
252
259
  ensureInit(this);
253
260
  helperHostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
254
261
  const appHost = helperHostSet.$appHost;
262
+ const useSsr = (0, import_SwcApp.isSSR)(this);
255
263
  try {
256
264
  if (appHost && typeof appHost._connected === "function") {
257
265
  await appHost._connected(this);
258
266
  } else if (appHost && typeof appHost) {
259
- appHost._connected_safari ?? (appHost._connected_safari = []);
260
- appHost._connected_safari.push(this);
267
+ appHost._connected_safari_and_standby ?? (appHost._connected_safari_and_standby = []);
268
+ appHost._connected_safari_and_standby.push(this);
261
269
  }
262
270
  const conf = getElementConfig(this);
263
271
  const currentWin = this._resolveWindow(conf);
264
- const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
272
+ const bMethods = (0, import_lifecycles.getOnConnectedBeforeMetadata)(this).filter((it) => useSsr ? !it.options.ssrFirst : true);
273
+ if (bMethods) {
274
+ for (const m of bMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
275
+ }
276
+ this._executeSwcScript("swc-on-before-connected", helperHostSet);
277
+ const targetConnectedInnerHtmlList = (0, import_lifecycles.getOnConnectedInnerHtmlMetadata)(constructor).filter((it) => useSsr ? !it.options.ssrFirst : true);
278
+ const shadowMode = conf?.useShadow || targetConnectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
265
279
  if (shadowMode && !this.shadowRoot) {
266
280
  const mode = shadowMode === true ? "open" : shadowMode;
267
281
  this.attachShadow({ mode });
268
282
  }
269
- const bMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_BEFORE_CONNECTED_METADATA_KEY);
270
- if (bMethods) {
271
- for (const m of bMethods) await this._invokeLifecycleMethod(m, helperHostSet);
272
- }
273
- this._executeSwcScript("swc-on-before-connected", helperHostSet);
274
- if (connectedInnerHtmlList.length > 0) {
283
+ if (targetConnectedInnerHtmlList.length > 0) {
275
284
  let sContent = "", lContent = "";
276
- for (const meta of connectedInnerHtmlList) {
285
+ for (const meta of targetConnectedInnerHtmlList) {
277
286
  let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
278
287
  const actionExpression = new import_core.ActionExpression(res, {
279
288
  expression: {
280
289
  replace: {
281
- start: meta.options.replaceWrap?.start || "{%{",
282
- end: meta.options.replaceWrap?.end || "}%}"
290
+ start: meta.options.replaceWrap?.start || "[[",
291
+ end: meta.options.replaceWrap?.end || "]]"
283
292
  },
284
293
  callReturn: {
285
- start: meta.options.replaceWrap?.start || "{%{=",
286
- end: meta.options.replaceWrap?.end || "}%}"
294
+ start: meta.options.replaceWrap?.start || "[[=",
295
+ end: meta.options.replaceWrap?.end || "]]"
287
296
  },
288
297
  call: {
289
- start: meta.options.replaceWrap?.start || "{%{@",
290
- end: meta.options.replaceWrap?.end || "}%}"
298
+ start: meta.options.replaceWrap?.start || "[[@",
299
+ end: meta.options.replaceWrap?.end || "]]"
291
300
  }
292
301
  }
293
302
  });
294
303
  actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
295
- try {
296
- const sr = import_core.FunctionUtils.executeReturn({ script: it.script, context: this, args: helperHostSet });
297
- actionExpression.replace(it, sr);
298
- } catch (e) {
299
- console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
300
- }
304
+ actionExpression.replace(it, import_core_web.NodeSlot.slot(`${this._swcId}-${it.script}`));
301
305
  });
302
306
  res = actionExpression.getUnprocessedTemplate();
303
307
  if (res !== void 0) {
@@ -445,9 +449,11 @@ const elementDefine = (name, config = {}) => (constructor) => {
445
449
  });
446
450
  });
447
451
  if (originalConnected) await originalConnected.apply(this);
448
- const aMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_AFTER_CONNECTED_METADATA_KEY);
452
+ const aMethods = (0, import_lifecycles.getOnConnectedAfterMetadata)(this).filter((it) => {
453
+ return useSsr ? !it.options.ssrFirst : true;
454
+ });
449
455
  if (aMethods) {
450
- for (const m of aMethods) await this._invokeLifecycleMethod(m, helperHostSet);
456
+ for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
451
457
  }
452
458
  this._executeSwcScript("swc-on-connected", helperHostSet);
453
459
  this._executeSwcScript("swc-on-after-connected", helperHostSet);
@@ -463,6 +469,9 @@ const elementDefine = (name, config = {}) => (constructor) => {
463
469
  }
464
470
  }
465
471
  } finally {
472
+ for (let mPropertyKey of (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_CONNECTED_COMPLETED_METADATA_KEY)) {
473
+ await this._invokeLifecycleMethod(mPropertyKey, helperHostSet);
474
+ }
466
475
  if (appHost && typeof appHost._connectedDone === "function") {
467
476
  await appHost._connectedDone(this);
468
477
  }
@@ -470,7 +479,6 @@ const elementDefine = (name, config = {}) => (constructor) => {
470
479
  };
471
480
  const originalDisconnected = proto.disconnectedCallback;
472
481
  proto.disconnectedCallback = function() {
473
- console.log("disconnnnnnnnnnnnnnnnnnn", helperHostSet, this);
474
482
  const appHost = helperHostSet.$appHost;
475
483
  if (appHost && typeof appHost._disconnected === "function") {
476
484
  appHost._disconnected(this);