@dooboostore/simple-web-component 1.0.36 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/README.md +396 -68
  2. package/dist/cjs/{elements/SwcAppEngine.js → SwcAppEngine.js} +9 -6
  3. package/dist/cjs/SwcAppEngine.js.map +7 -0
  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 +109 -26
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applySlot.js +129 -0
  11. package/dist/cjs/decorators/applySlot.js.map +7 -0
  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 +90 -52
  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 +2 -0
  18. package/dist/cjs/decorators/index.js.map +2 -2
  19. package/dist/cjs/decorators/lifecycles.js +88 -24
  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 +84 -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 +231 -0
  31. package/dist/cjs/elements/SwcApp.js.map +7 -0
  32. package/dist/cjs/elements/SwcAppMixin.js +78 -80
  33. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  34. package/dist/cjs/elements/index.js +2 -1
  35. package/dist/cjs/elements/index.js.map +2 -2
  36. package/dist/cjs/elements/tt/SwcAppMixin.js +1 -0
  37. package/dist/cjs/elements/tt/SwcAppMixin.js.map +7 -0
  38. package/dist/cjs/elements/tt/SwcAsync.js +1 -0
  39. package/dist/cjs/elements/tt/SwcAsync.js.map +7 -0
  40. package/dist/cjs/elements/tt/SwcAsyncTemplate.js +1 -0
  41. package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +7 -0
  42. package/dist/cjs/elements/tt/SwcChoose.js +1 -0
  43. package/dist/cjs/elements/tt/SwcChoose.js.map +7 -0
  44. package/dist/cjs/elements/tt/SwcChooseTemplate.js +1 -0
  45. package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +7 -0
  46. package/dist/cjs/elements/tt/SwcIf.js +1 -0
  47. package/dist/cjs/elements/tt/SwcIf.js.map +7 -0
  48. package/dist/cjs/elements/tt/SwcIfTemplate.js +1 -0
  49. package/dist/cjs/elements/tt/SwcIfTemplate.js.map +7 -0
  50. package/dist/cjs/elements/tt/SwcLoop.js +1 -0
  51. package/dist/cjs/elements/tt/SwcLoop.js.map +7 -0
  52. package/dist/cjs/elements/tt/SwcLoopTemplate.js +1 -0
  53. package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +7 -0
  54. package/dist/cjs/elements/tt/SwcSubTemplates.js +1 -0
  55. package/dist/cjs/elements/tt/SwcSubTemplates.js.map +7 -0
  56. package/dist/cjs/elements/tt/register.js +1 -0
  57. package/dist/cjs/elements/tt/register.js.map +7 -0
  58. package/dist/cjs/index.js +10 -8
  59. package/dist/cjs/index.js.map +2 -2
  60. package/dist/cjs/{types.js → types/index.js} +1 -1
  61. package/dist/cjs/types/index.js.map +7 -0
  62. package/dist/cjs/types/window.d.js +16 -0
  63. package/dist/cjs/types/window.d.js.map +7 -0
  64. package/dist/cjs/utils/Utils.js +168 -26
  65. package/dist/cjs/utils/Utils.js.map +3 -3
  66. package/dist/esm/{elements/SwcAppEngine.js → SwcAppEngine.js} +7 -4
  67. package/dist/esm/SwcAppEngine.js.map +7 -0
  68. package/dist/esm/decorators/addEventListener.js +20 -4
  69. package/dist/esm/decorators/addEventListener.js.map +2 -2
  70. package/dist/esm/decorators/applyAttribute.js.map +1 -1
  71. package/dist/esm/decorators/applyClass.js.map +1 -1
  72. package/dist/esm/decorators/applyNode.js +109 -26
  73. package/dist/esm/decorators/applyNode.js.map +2 -2
  74. package/dist/esm/decorators/applySlot.js +110 -0
  75. package/dist/esm/decorators/applySlot.js.map +7 -0
  76. package/dist/esm/decorators/applyStyle.js.map +2 -2
  77. package/dist/esm/decorators/attribute.js.map +1 -1
  78. package/dist/esm/decorators/elementDefine.js +96 -58
  79. package/dist/esm/decorators/elementDefine.js.map +2 -2
  80. package/dist/esm/decorators/emitCustomEvent.js.map +1 -1
  81. package/dist/esm/decorators/index.js +2 -0
  82. package/dist/esm/decorators/index.js.map +2 -2
  83. package/dist/esm/decorators/lifecycles.js +88 -24
  84. package/dist/esm/decorators/lifecycles.js.map +3 -3
  85. package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
  86. package/dist/esm/decorators/query.js +1 -1
  87. package/dist/esm/decorators/query.js.map +2 -2
  88. package/dist/esm/decorators/queryAll.js.map +1 -1
  89. package/dist/esm/decorators/setProperty.js.map +1 -1
  90. package/dist/esm/decorators/state.js +65 -0
  91. package/dist/esm/decorators/state.js.map +7 -0
  92. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  93. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  94. package/dist/esm/elements/SwcApp.js +212 -0
  95. package/dist/esm/elements/SwcApp.js.map +7 -0
  96. package/dist/esm/elements/SwcAppMixin.js +76 -78
  97. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  98. package/dist/esm/elements/index.js +2 -1
  99. package/dist/esm/elements/index.js.map +2 -2
  100. package/dist/esm/elements/tt/SwcAppMixin.js +1 -0
  101. package/dist/esm/elements/tt/SwcAppMixin.js.map +7 -0
  102. package/dist/esm/elements/tt/SwcAsync.js +1 -0
  103. package/dist/esm/elements/tt/SwcAsync.js.map +7 -0
  104. package/dist/esm/elements/tt/SwcAsyncTemplate.js +1 -0
  105. package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +7 -0
  106. package/dist/esm/elements/tt/SwcChoose.js +1 -0
  107. package/dist/esm/elements/tt/SwcChoose.js.map +7 -0
  108. package/dist/esm/elements/tt/SwcChooseTemplate.js +1 -0
  109. package/dist/esm/elements/tt/SwcChooseTemplate.js.map +7 -0
  110. package/dist/esm/elements/tt/SwcIf.js +1 -0
  111. package/dist/esm/elements/tt/SwcIf.js.map +7 -0
  112. package/dist/esm/elements/tt/SwcIfTemplate.js +1 -0
  113. package/dist/esm/elements/tt/SwcIfTemplate.js.map +7 -0
  114. package/dist/esm/elements/tt/SwcLoop.js +1 -0
  115. package/dist/esm/elements/tt/SwcLoop.js.map +7 -0
  116. package/dist/esm/elements/tt/SwcLoopTemplate.js +1 -0
  117. package/dist/esm/elements/tt/SwcLoopTemplate.js.map +7 -0
  118. package/dist/esm/elements/tt/SwcSubTemplates.js +1 -0
  119. package/dist/esm/elements/tt/SwcSubTemplates.js.map +7 -0
  120. package/dist/esm/elements/tt/register.js +1 -0
  121. package/dist/esm/elements/tt/register.js.map +7 -0
  122. package/dist/esm/index.js +11 -9
  123. package/dist/esm/index.js.map +2 -2
  124. package/dist/esm/{types.js → types/index.js} +1 -1
  125. package/dist/esm/types/index.js.map +7 -0
  126. package/dist/esm/types/window.d.js +1 -0
  127. package/dist/esm/types/window.d.js.map +7 -0
  128. package/dist/esm/utils/Utils.js +168 -26
  129. package/dist/esm/utils/Utils.js.map +3 -3
  130. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +7477 -2828
  131. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  132. package/dist/types/{elements/SwcAppEngine.d.ts → SwcAppEngine.d.ts} +9 -4
  133. package/dist/types/SwcAppEngine.d.ts.map +1 -0
  134. package/dist/types/decorators/addEventListener.d.ts +5 -2
  135. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  136. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  137. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  138. package/dist/types/decorators/applyNode.d.ts +24 -8
  139. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  140. package/dist/types/decorators/applySlot.d.ts +27 -0
  141. package/dist/types/decorators/applySlot.d.ts.map +1 -0
  142. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  143. package/dist/types/decorators/attribute.d.ts.map +1 -1
  144. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  145. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  146. package/dist/types/decorators/index.d.ts +2 -0
  147. package/dist/types/decorators/index.d.ts.map +1 -1
  148. package/dist/types/decorators/lifecycles.d.ts +26 -15
  149. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  150. package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
  151. package/dist/types/decorators/query.d.ts +1 -1
  152. package/dist/types/decorators/query.d.ts.map +1 -1
  153. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  154. package/dist/types/decorators/setProperty.d.ts +1 -1
  155. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  156. package/dist/types/decorators/state.d.ts +9 -0
  157. package/dist/types/decorators/state.d.ts.map +1 -0
  158. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  159. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +5 -1
  160. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  161. package/dist/types/elements/SwcApp.d.ts +36 -0
  162. package/dist/types/elements/SwcApp.d.ts.map +1 -0
  163. package/dist/types/elements/SwcAppMixin.d.ts +26 -7
  164. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  165. package/dist/types/elements/index.d.ts +2 -1
  166. package/dist/types/elements/index.d.ts.map +1 -1
  167. package/dist/types/elements/tt/SwcAppMixin.d.ts +1 -0
  168. package/dist/types/elements/tt/SwcAppMixin.d.ts.map +1 -0
  169. package/dist/types/elements/tt/SwcAsync.d.ts +1 -0
  170. package/dist/types/elements/tt/SwcAsync.d.ts.map +1 -0
  171. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +1 -0
  172. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +1 -0
  173. package/dist/types/elements/tt/SwcChoose.d.ts +1 -0
  174. package/dist/types/elements/tt/SwcChoose.d.ts.map +1 -0
  175. package/dist/types/elements/tt/SwcChooseTemplate.d.ts +1 -0
  176. package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +1 -0
  177. package/dist/types/elements/tt/SwcIf.d.ts +1 -0
  178. package/dist/types/elements/{SwcIf.d.ts.map → tt/SwcIf.d.ts.map} +1 -1
  179. package/dist/types/elements/tt/SwcIfTemplate.d.ts +1 -0
  180. package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +1 -0
  181. package/dist/types/elements/tt/SwcLoop.d.ts +1 -0
  182. package/dist/types/elements/tt/SwcLoop.d.ts.map +1 -0
  183. package/dist/types/elements/tt/SwcLoopTemplate.d.ts +1 -0
  184. package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +1 -0
  185. package/dist/types/elements/tt/SwcSubTemplates.d.ts +1 -0
  186. package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +1 -0
  187. package/dist/types/elements/tt/register.d.ts +1 -0
  188. package/dist/types/elements/tt/register.d.ts.map +1 -0
  189. package/dist/types/index.d.ts +2 -2
  190. package/dist/types/index.d.ts.map +1 -1
  191. package/dist/types/{types.d.ts → types/index.d.ts} +12 -12
  192. package/dist/types/types/index.d.ts.map +1 -0
  193. package/dist/types/utils/Utils.d.ts +18 -5
  194. package/dist/types/utils/Utils.d.ts.map +1 -1
  195. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +7478 -2829
  196. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  197. package/package.json +4 -4
  198. package/src/{elements/SwcAppEngine.ts → SwcAppEngine.ts} +17 -8
  199. package/src/decorators/addEventListener.ts +21 -5
  200. package/src/decorators/applyAttribute.ts +1 -1
  201. package/src/decorators/applyClass.ts +1 -1
  202. package/src/decorators/applyNode.ts +186 -66
  203. package/src/decorators/applySlot.ts +188 -0
  204. package/src/decorators/applyStyle.ts +4 -4
  205. package/src/decorators/attribute.ts +1 -1
  206. package/src/decorators/elementDefine.ts +142 -68
  207. package/src/decorators/emitCustomEvent.ts +1 -1
  208. package/src/decorators/index.ts +3 -0
  209. package/src/decorators/lifecycles.ts +119 -30
  210. package/src/decorators/publishSwcAppMessage.ts +2 -3
  211. package/src/decorators/query.ts +4 -4
  212. package/src/decorators/queryAll.ts +1 -1
  213. package/src/decorators/setProperty.ts +1 -1
  214. package/src/decorators/state.ts +84 -0
  215. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -1
  216. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +4 -3
  217. package/src/elements/SwcApp.ts +241 -0
  218. package/src/elements/SwcAppMixin.ts +98 -146
  219. package/src/elements/index.ts +4 -1
  220. package/src/elements/tt/SwcAppMixin.ts +13 -0
  221. package/src/elements/tt/SwcAsync.ts +139 -0
  222. package/src/elements/tt/SwcAsyncTemplate.ts +126 -0
  223. package/src/elements/tt/SwcChoose.ts +182 -0
  224. package/src/elements/tt/SwcChooseTemplate.ts +229 -0
  225. package/src/elements/tt/SwcIf.ts +145 -0
  226. package/src/elements/tt/SwcIfTemplate.ts +158 -0
  227. package/src/elements/tt/SwcLoop.ts +222 -0
  228. package/src/elements/tt/SwcLoopTemplate.ts +255 -0
  229. package/src/elements/tt/SwcSubTemplates.ts +6 -0
  230. package/src/elements/tt/register.ts +720 -0
  231. package/src/index.ts +11 -9
  232. package/src/{types.ts → types/index.ts} +15 -11
  233. package/src/types/window.d.ts +46 -0
  234. package/src/utils/Utils.ts +214 -24
  235. package/dist/cjs/elements/SwcAppEngine.js.map +0 -7
  236. package/dist/cjs/elements/SwcAsync.js +0 -129
  237. package/dist/cjs/elements/SwcAsync.js.map +0 -7
  238. package/dist/cjs/elements/SwcChoose.js +0 -155
  239. package/dist/cjs/elements/SwcChoose.js.map +0 -7
  240. package/dist/cjs/elements/SwcIf.js +0 -117
  241. package/dist/cjs/elements/SwcIf.js.map +0 -7
  242. package/dist/cjs/elements/SwcLoop.js +0 -176
  243. package/dist/cjs/elements/SwcLoop.js.map +0 -7
  244. package/dist/cjs/elements/SwcSubTemplates.js +0 -13
  245. package/dist/cjs/elements/SwcSubTemplates.js.map +0 -7
  246. package/dist/cjs/elements/register.js +0 -1026
  247. package/dist/cjs/elements/register.js.map +0 -7
  248. package/dist/cjs/types.js.map +0 -7
  249. package/dist/esm/elements/SwcAppEngine.js.map +0 -7
  250. package/dist/esm/elements/SwcAsync.js +0 -129
  251. package/dist/esm/elements/SwcAsync.js.map +0 -7
  252. package/dist/esm/elements/SwcChoose.js +0 -155
  253. package/dist/esm/elements/SwcChoose.js.map +0 -7
  254. package/dist/esm/elements/SwcIf.js +0 -117
  255. package/dist/esm/elements/SwcIf.js.map +0 -7
  256. package/dist/esm/elements/SwcLoop.js +0 -176
  257. package/dist/esm/elements/SwcLoop.js.map +0 -7
  258. package/dist/esm/elements/SwcSubTemplates.js +0 -13
  259. package/dist/esm/elements/SwcSubTemplates.js.map +0 -7
  260. package/dist/esm/elements/register.js +0 -1007
  261. package/dist/esm/elements/register.js.map +0 -7
  262. package/dist/esm/types.js.map +0 -7
  263. package/dist/types/elements/SwcAppEngine.d.ts.map +0 -1
  264. package/dist/types/elements/SwcAsync.d.ts +0 -2
  265. package/dist/types/elements/SwcAsync.d.ts.map +0 -1
  266. package/dist/types/elements/SwcChoose.d.ts +0 -2
  267. package/dist/types/elements/SwcChoose.d.ts.map +0 -1
  268. package/dist/types/elements/SwcIf.d.ts +0 -2
  269. package/dist/types/elements/SwcLoop.d.ts +0 -2
  270. package/dist/types/elements/SwcLoop.d.ts.map +0 -1
  271. package/dist/types/elements/SwcSubTemplates.d.ts +0 -13
  272. package/dist/types/elements/SwcSubTemplates.d.ts.map +0 -1
  273. package/dist/types/elements/register.d.ts +0 -4
  274. package/dist/types/elements/register.d.ts.map +0 -1
  275. package/dist/types/types.d.ts.map +0 -1
  276. package/src/elements/SwcAsync.ts +0 -126
  277. package/src/elements/SwcChoose.ts +0 -190
  278. package/src/elements/SwcIf.ts +0 -124
  279. package/src/elements/SwcLoop.ts +0 -205
  280. package/src/elements/SwcSubTemplates.ts +0 -6
  281. package/src/elements/register.ts +0 -1022
@@ -0,0 +1,188 @@
1
+ import {ReflectUtils} from '@dooboostore/core';
2
+ import {ensureInit, getElementConfig} from './elementDefine';
3
+ import {SwcUtils} from "../utils/Utils";
4
+ import {NodeSlot} from "@dooboostore/core-web";
5
+ /*
6
+ <!-- beforebegin -->
7
+ <p> <-- it's me
8
+ <!-- afterbegin -->
9
+ foo
10
+ <!-- beforeend -->
11
+ </p>
12
+ <!-- afterend -->
13
+ */
14
+ export type ApplySlotPosition = 'prependHtml' | 'prependText' | 'appendHtml' | 'appendText' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';
15
+
16
+ export interface ApplySlotOptions {
17
+ position?: ApplySlotPosition;
18
+ // root?: SwcRootType;
19
+ /**
20
+ * Filter function to determine whether to perform DOM operation.
21
+ * If it returns false, the operation is skipped.
22
+ */
23
+ // filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;
24
+ /**
25
+ * Optional loading content to display while an async method is executing.
26
+ */
27
+ // loading?: (helper: HelperHostSet) => any;
28
+ }
29
+
30
+ export interface ApplySlotMetadata {
31
+ propertyKey: string | symbol;
32
+ id: string;
33
+ type: 'method' | 'property';
34
+ options: ApplySlotOptions;
35
+ }
36
+
37
+ export const APPLY_SLOT_METADATA_KEY = Symbol.for('simple-web-component:apply-slot');
38
+
39
+ // const normalizeNodes = (res: any, doc: Document): Node[] => {
40
+ // const items = Array.isArray(res) ? res : [res];
41
+ // return items.map(it => {
42
+ // if (it instanceof Node) return it;
43
+ // return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');
44
+ // });
45
+ // };
46
+
47
+ // const applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, win: Window) => {
48
+ // if (!targetEl) return;
49
+ //
50
+ // const doc = win.document;
51
+ //
52
+ // if (pos === 'innerHtml') {
53
+ // targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';
54
+ // return;
55
+ // }
56
+ //
57
+ // if (pos === 'innerText') {
58
+ // if (targetEl.innerText !== undefined) {
59
+ // targetEl.innerText = res !== undefined && res !== null ? String(res) : '';
60
+ // }
61
+ // return;
62
+ // }
63
+ //
64
+ // const isShadowRoot = targetEl instanceof win.ShadowRoot;
65
+ // const nodes = normalizeNodes(res, doc);
66
+ // if (pos === 'replace') {
67
+ // if (!isShadowRoot) targetEl.replaceWith(...nodes);
68
+ // } else if (pos === 'replaceChildren') {
69
+ // targetEl.replaceChildren(...nodes);
70
+ // } else {
71
+ // if (pos === 'beforeEnd') targetEl.append(...nodes);
72
+ // else if (pos === 'afterBegin') targetEl.prepend(...nodes);
73
+ // else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);
74
+ // else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);
75
+ // }
76
+ // };
77
+
78
+ /**
79
+ * @applyNode decorator to surgically add/replace nodes to a target element.
80
+ */
81
+ export function applySlot(id: string, options: ApplySlotOptions = { position: 'replaceChildrenHtml' }): MethodDecorator & PropertyDecorator {
82
+ return (targetObj: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {
83
+ const type = descriptor === undefined ? 'property' : 'method';
84
+
85
+ if (type === 'property') {
86
+ Object.defineProperty(targetObj, propertyKey, {
87
+ get(this: any) {
88
+ const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
89
+ return nodeSlot;
90
+ },
91
+ set(this: any, nv: any) {
92
+ if(nv) {
93
+ // 있을때 아무일도안함
94
+ } else {
95
+ const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
96
+ nodeSlot.clear();
97
+ }
98
+ },
99
+ configurable: true,
100
+ enumerable: true,
101
+ })
102
+ // return nodeSlot;
103
+ // return;
104
+ }
105
+
106
+ const constructor = targetObj.constructor;
107
+ let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor) as ApplySlotMetadata[];
108
+ if (!metaList) {
109
+ metaList = []
110
+ ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
111
+ }
112
+ metaList.push({ propertyKey, id, type, options });
113
+
114
+
115
+
116
+ if (type === 'method') {
117
+ const original = descriptor.value;
118
+ descriptor.value = function (...args: any[]) {
119
+ ensureInit(this);
120
+
121
+ const conf = getElementConfig(this);
122
+ const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);
123
+ const currentDoc = currentWin.document;
124
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
125
+ let res = original.apply(this, args);
126
+ if (res) {
127
+ // res = SwcUtils.projectProcessHtml(this, res)
128
+ const nodeSlot = new NodeSlot(this, this._swcId);
129
+ const pos = options.position || 'replaceChildrenHtml';
130
+ const doc = currentWin.document;
131
+ if (pos === 'replaceChildrenHtml') {
132
+ nodeSlot.replaceChildrenHtml(id, res);
133
+ } else if (pos === 'replaceChildrenText') {
134
+ nodeSlot.replaceChildrenText(id, res);
135
+ } else if (pos === 'appendHtml') {
136
+ nodeSlot.appendHtml(id, res);
137
+ } else if (pos === 'appendText') {
138
+ nodeSlot.appendText(id, res);
139
+ } else if (pos === 'prependHtml') {
140
+ nodeSlot.prependHtml(id, res);
141
+ } else if (pos === 'prependText') {
142
+ nodeSlot.prependText(id, res);
143
+ } else if (pos === 'clear') {
144
+ nodeSlot.clear(id);
145
+ }
146
+
147
+ // const stateContext: any = {...hostSet};
148
+ // getStateMetadata(this).forEach(it => {
149
+ // stateContext[it.name] = this[it.propertyKey]
150
+ // })
151
+ // new ElementApply(this, {id: this._swcId}).apply({target:'noInitialized', context: stateContext, bind: this});
152
+ }
153
+ return res;
154
+ };
155
+ }
156
+ };
157
+ }
158
+
159
+ // export const findAllApplySlotMetadata = (target: any): Map<string | symbol, ApplySlotMetadata> => {
160
+ export const findAllApplySlotMetadata = (target: any): ApplySlotMetadata[] => {
161
+ const constructor = target instanceof Function ? target : target.constructor;
162
+ return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
163
+ };
164
+
165
+ export function applySlotClear(id: string): MethodDecorator {
166
+ return applySlot(id, { position: 'clear' });
167
+ }
168
+ export function applySlotPrependHtml(id: string): MethodDecorator {
169
+ return applySlot(id, { position: 'prependHtml' });
170
+ }
171
+ export const applySlotPrepend = applySlotPrependHtml;
172
+ export function applySlotPrependText(id: string): MethodDecorator {
173
+ return applySlot(id, { position: 'prependText' });
174
+ }
175
+ export function applySlotAppendHtml(id: string): MethodDecorator {
176
+ return applySlot(id, { position: 'appendHtml' });
177
+ }
178
+ export function applySlotAppendText(id: string): MethodDecorator {
179
+ return applySlot(id, { position: 'appendText' });
180
+ }
181
+ export const applySlotAppend = applySlotAppendHtml;
182
+ export function applySlotReplaceChildrenHtml(id: string): MethodDecorator {
183
+ return applySlot(id, { position: 'replaceChildrenHtml' });
184
+ }
185
+ export const applySlotReplaceChildren = applySlotReplaceChildrenHtml;
186
+ export function applySlotReplaceChildrenText(id: string): MethodDecorator {
187
+ return applySlot(id, { position: 'replaceChildrenText' });
188
+ }
@@ -1,7 +1,7 @@
1
- import { ReflectUtils } from '@dooboostore/core';
2
- import { ensureInit } from './elementDefine';
3
- import { SwcUtils } from '../utils/Utils';
4
- import { SwcQueryOptions, HelperHostSet } from '../types';
1
+ import {ReflectUtils} from '@dooboostore/core';
2
+ import {ensureInit} from './elementDefine';
3
+ import {SwcUtils} from '../utils/Utils';
4
+ import { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';
5
5
 
6
6
  export type StyleAction = 'set' | 'update' | 'remove';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { ReflectUtils, FunctionUtils, ActionExpression } from '@dooboostore/core';
2
2
  import { ensureInit, getElementConfig } from './elementDefine';
3
3
  import { SwcUtils } from '../utils/Utils';
4
- import { SpecialSelector, SwcQueryOptions } from '../types';
4
+ import { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';
5
5
  import { ConvertUtils } from '@dooboostore/core-web';
6
6
  export interface AttributeFieldOptions extends SwcQueryOptions {
7
7
  name?: string;
@@ -1,17 +1,20 @@
1
- import {ReflectUtils, FunctionUtils, ActionExpression} from '@dooboostore/core';
1
+ import {ActionExpression, FunctionUtils, ReflectUtils} from '@dooboostore/core';
2
2
  import {getAddEventListenerMetadata} from './addEventListener';
3
- import {ON_INITIALIZE_METADATA_KEY, ON_BEFORE_CONNECTED_METADATA_KEY, ON_AFTER_CONNECTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_AFTER_ADOPTED_METADATA_KEY, findAllLifecycleMetadata, getOnConnectedInnerHtmlMetadata} from './lifecycles';
3
+ import {findAllLifecycleMetadata, findAllOnConnectedAfterMetadata, findAllOnConnectedBeforeMetadata, findAllOnConnectedMetadata, ON_AFTER_ADOPTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_CONNECTED_COMPLETED_METADATA_KEY, ON_INITIALIZE_METADATA_KEY} from './lifecycles';
4
4
  import {getEmitCustomEventMetadataList} from './emitCustomEvent';
5
- import {findAllAttributeChangedMetadata, convertAttributeValue} from './changedAttributeThis';
5
+ import {convertAttributeValue, findAllAttributeChangedMetadata} from './changedAttributeThis';
6
6
  import {findAllAttributeApplyMetadata} from './applyAttribute';
7
7
  import {findAllAttributeMetadata, getAttributeValue} from './attribute';
8
8
  import {getQueryMetadata} from './query';
9
9
  import {getQueryAllMetadata} from './queryAll';
10
10
  import {SwcUtils} from '../utils/Utils';
11
- import {HTML_TAG_ENTRIES, DOM_EVENT_NAMES} from '../config/config';
11
+ import {DOM_EVENT_NAMES, HTML_TAG_ENTRIES} from '../config/config';
12
12
  import {SituationTypeContainer, SituationTypeContainers} from '@dooboostore/simple-boot/decorators/inject/Inject';
13
- import {InjectSituationType, HostSet, HelperHostSet} from '../types';
14
- import {ConvertUtils} from '@dooboostore/core-web';
13
+ import {HelperHostSet, HostSet, InjectSituationType} from '../types';
14
+ import {ConvertUtils, ElementApply, NodeSlot} from '@dooboostore/core-web';
15
+ import {isSSR} from "../elements/SwcAppMixin";
16
+ import {findAllApplySlotMetadata} from "./applySlot";
17
+ import {findAllStateMetadata} from "./state";
15
18
 
16
19
  // --- Core Interfaces & Types ---
17
20
 
@@ -35,13 +38,12 @@ export const getElementConfig = (target: any): ElementMetadata | undefined => {
35
38
  return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
36
39
  };
37
40
 
38
- export const ensureInit = (inst: any) => {
41
+ export const ensureInit = (inst: any) => { // HTMLElement
39
42
  if (!inst.__swc_initialized) {
40
- inst._swcId = Math.random().toString(36).substring(2, 11);
43
+ inst._swcId = inst?.getAttribute?.('swc-use-ssr') ?? 's' + Math.random().toString(36).substring(2, 11).toLowerCase();
41
44
  inst._emitHandlers = new Map();
42
45
  inst._boundListeners = [];
43
46
  inst.__swc_initialized = true;
44
-
45
47
  // const attributeList = findAllQ(inst);
46
48
  // attributeList.forEach(meta => {
47
49
  // delete (inst as any)[meta.propertyKey];
@@ -52,7 +54,7 @@ export const ensureInit = (inst: any) => {
52
54
  // ╔════════════════════════════════════════════════════════════════════════════════╗
53
55
  // ║ decorator 필드의 own property 삭제 ║
54
56
  // ║ ║
55
- // ║ 이유: ║
57
+ // ║ 이유: own property가 있으면 prototype의 getter/setter는 절대 안 탄다 ║
56
58
  // ║ 1. TypeScript는 초기값이 있는 필드를 constructor에서 own property로 생성 ║
57
59
  // ║ @attributeThis('id') myId: string = "default" → this.myId = "default" ║
58
60
  // ║ ║
@@ -71,7 +73,11 @@ export const ensureInit = (inst: any) => {
71
73
  // @attribute 필드의 own property 삭제 → getter/setter 작동
72
74
  const attributeList = findAllAttributeMetadata(target);
73
75
  attributeList.forEach(meta => {
76
+ const initUserData = (inst as any)[meta.propertyKey];
74
77
  delete (inst as any)[meta.propertyKey];
78
+ // undefined 이면은 외부 attribute string html을 리스팩한다
79
+ if (initUserData !== undefined)
80
+ (inst as any)[meta.propertyKey] = initUserData;
75
81
  });
76
82
 
77
83
  // @query 필드의 own property 삭제 → getter 작동
@@ -89,6 +95,20 @@ export const ensureInit = (inst: any) => {
89
95
  delete (inst as any)[meta.propertyKey];
90
96
  });
91
97
  }
98
+ const slotAllList = findAllApplySlotMetadata(target);
99
+ if (slotAllList) {
100
+ slotAllList.filter(it => it.type === 'property').forEach(meta => {
101
+ delete (inst as any)[meta.propertyKey];
102
+ });
103
+ }
104
+ const stateAllList = findAllStateMetadata(target);
105
+ if (stateAllList) {
106
+ stateAllList.forEach(meta => {
107
+ const initUserData = (inst as any)[meta.propertyKey];
108
+ delete (inst as any)[meta.propertyKey];
109
+ (inst as any)[meta.propertyKey] = initUserData;
110
+ });
111
+ }
92
112
 
93
113
  // Call constructor script if present
94
114
  const hostSet = SwcUtils.getHostSet(inst);
@@ -103,9 +123,11 @@ export const ensureInit = (inst: any) => {
103
123
  }
104
124
  };
105
125
 
126
+
127
+ // 훔 이게맞나?? global로 관리하는게..훔... 왜이렇게 했을까..
106
128
  // --- Global Event Handling ---
107
129
  const globalDelegatedRoots = new WeakSet<Node>();
108
-
130
+ // 여기에서 중복 호출안되게 잘막아준다 ..
109
131
  const handleGlobalSwcEvent = async (event: Event) => {
110
132
  if ((event as any).__swc_handled) return;
111
133
  const path = event.composedPath();
@@ -143,10 +165,32 @@ const getHandlers = (inst: any) => {
143
165
  return inst.__swc_attributeEventHandlers;
144
166
  };
145
167
 
146
- const setupPrototype = (proto: any) => {
168
+ const setupPrototype = (proto: any, win: Window) => {
147
169
  if (proto.__swc_proto_setup) return;
148
170
  proto.__swc_proto_setup = true;
149
171
 
172
+
173
+ proto.createSlotString = function (id: string) {
174
+ return NodeSlot.slot(`${this._swcId}-${id}`);
175
+ }
176
+ proto.createEaHtml = function (id: string, script: string) {
177
+ return ElementApply.html(id, script);
178
+ }
179
+ proto.createEaText = function (id: string, script: string) {
180
+ return ElementApply.text(id, script);
181
+ }
182
+ proto.createEaAttribute = function (id: string, name: string, script: string) {
183
+ return ElementApply.attribute(id, name, script);
184
+ }
185
+ proto.createEaEvent = function (id: string, name: string, script: string) {
186
+ return ElementApply.event(id, name, script);
187
+ }
188
+ proto.createEaProperty = function (id: string, name: string, script: string) {
189
+ return ElementApply.property(id, name, script);
190
+ }
191
+
192
+ // swc-id-asdasdasdasd-click=" :value="" {: value fsdfsdafsad :} {html: aaa :} {text: asdas :}
193
+
150
194
  proto._executeSwcScript = function (attrName: string, hostSet: HostSet, extraArgs: Record<string, any> = {}) {
151
195
  ensureInit(this);
152
196
  const script = this.getAttribute(attrName);
@@ -177,7 +221,7 @@ const setupPrototype = (proto: any) => {
177
221
  proto._invokeLifecycleMethod = function (methodName: string | symbol, hostSet?: HostSet, extraArgs: any[] = []) {
178
222
  ensureInit(this);
179
223
  if (typeof (this as any)[methodName] !== 'function') return;
180
- const useHostSet = hostSet ?? SwcUtils.getHostSet(this);
224
+ const useHostSet = hostSet ?? SwcUtils.getHelperAndHostSet(win, this);
181
225
  const app = useHostSet?.$appHost?.simpleApplication;
182
226
  // console.log('---->hh',app, this, methodName);
183
227
  if (app) {
@@ -301,10 +345,10 @@ export const elementDefine =
301
345
  // Get original static observedAttributes before they're overwritten by Object.defineProperty
302
346
  const originalStaticObservedAttributes = (constructor.observedAttributes ?? []) as string[];
303
347
  const mergedObservedAttributes = [...new Set([...(metadata.observedAttributes ?? []), ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map(it => (it.options as any).attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
304
- const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
348
+ // const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
305
349
 
306
350
  const proto = constructor.prototype;
307
- setupPrototype(proto);
351
+ setupPrototype(proto, win);
308
352
 
309
353
  // 값을 기대하지않는다.
310
354
  let helperHostSet: HelperHostSet | null = null;
@@ -314,82 +358,93 @@ export const elementDefine =
314
358
  // connected 됐을시 최신화
315
359
  helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);
316
360
  const appHost = helperHostSet.$appHost;
361
+ const useSsr = isSSR(this);
362
+ // console.log('isSsr', useSsr, this);
363
+ // console.log('----helperHostSet--->', this, helperHostSet, useSsr)
364
+ // let connectedApp: SwcAppInterface |undefined;
317
365
  try {
318
366
  if (appHost && typeof (appHost as any)._connected === 'function') {
319
- await (appHost as any)._connected(this);
367
+ await (appHost as any)._connected(this);
320
368
  } else if (appHost && typeof (appHost as any)) {
321
- (appHost as any)._connected_safari ??= [];
322
- (appHost as any)._connected_safari.push(this);
369
+ (appHost as any)._connected_safari_and_standby ??= [];
370
+ (appHost as any)._connected_safari_and_standby.push(this);
323
371
  }
324
372
 
325
373
  // const hostSet = SwcUtils.getHostSet(this as any);
326
374
  const conf = getElementConfig(this);
327
375
  const currentWin = (this as any)._resolveWindow(conf);
328
376
 
329
- const shadowMode = conf?.useShadow || connectedInnerHtmlList.find(it => it.options.useShadow)?.options.useShadow;
377
+ const bMethods = findAllOnConnectedBeforeMetadata(this).filter(it => useSsr ? !it.options.ssrFirst : true);
378
+ // console.log('beforeConnected', bMethods)
379
+ if (bMethods) {
380
+ for (const m of bMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);
381
+ }
382
+ (this as any)._executeSwcScript('swc-on-before-connected', helperHostSet);
383
+
384
+ // console.log('vvvvvvvvvvvvvvvu-seSsr-vvvvvvvvvv>', useSsr, this.tagName, this.getAttribute('seq'))
385
+ // // ssr 처리라서 이미 내려준거그대로 상요하면된다 따라서 호출안한다
386
+ const targetConnectedList = findAllOnConnectedMetadata(constructor).filter(it => useSsr ? !it.options.ssrFirst : true);
387
+ const shadowMode = conf?.useShadow || targetConnectedList.find(it => it.options.useShadow)?.options.useShadow;
388
+ // console.log('--------->', this.tagName, shadowMode && !this.shadowRoot)
330
389
  if (shadowMode && !this.shadowRoot) {
331
390
  const mode = shadowMode === true ? 'open' : shadowMode;
332
- this.attachShadow({mode: mode as ShadowRootMode});
391
+ console.log('tagName=', this.tagName, 'mode', mode, this.shadowRoot);
392
+ // if (this.tagName!=='INDEX-ROUTER') {
393
+ this.attachShadow({mode: mode as ShadowRootMode});
394
+ // }
333
395
  }
334
396
 
335
- const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
336
- if (bMethods) {
337
- for (const m of bMethods) await (this as any)._invokeLifecycleMethod(m, helperHostSet);
338
- }
339
- (this as any)._executeSwcScript('swc-on-before-connected', helperHostSet);
397
+ const stateContext: any = {...helperHostSet};
398
+ findAllStateMetadata(this).forEach(it => {
399
+ stateContext[it.name] = this[it.propertyKey]
400
+ })
401
+
402
+ const shadowChildren: Node[] = [];
403
+ const lightChildren: Node[] = [];
340
404
 
341
- if (connectedInnerHtmlList.length > 0) {
342
- let sContent = '',
343
- lContent = '';
344
- for (const meta of connectedInnerHtmlList) {
405
+ console.log('targetConnectList', this.tagName, targetConnectedList.length)
406
+ if (targetConnectedList.length > 0) {
407
+ // let sContent = '',
408
+ // lContent = '';
409
+ for (const meta of targetConnectedList) {
345
410
  // const res = (this as any)[meta.propertyKey]();
346
411
  let res = await (this as any)._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
347
- const actionExpression = new ActionExpression(res, {
348
- expression: {
349
- replace: {
350
- start: meta.options.replaceWrap?.start || '{%{',
351
- end: meta.options.replaceWrap?.end || '}%}'
352
- },
353
- callReturn: {
354
- start: meta.options.replaceWrap?.start || '{%{=',
355
- end: meta.options.replaceWrap?.end || '}%}'
356
- },
357
- call: {
358
- start: meta.options.replaceWrap?.start || '{%{@',
359
- end: meta.options.replaceWrap?.end || '}%}'
360
- }
361
- }
362
- });
412
+ // res = SwcUtils.projectProcessHtml(this, res);
413
+ if (typeof res === 'string') {
414
+ const htmlTemplateElement = doc.createElement('template');
415
+ htmlTemplateElement.innerHTML = res;//SwcUtils.projectProcessHtml(this._swcId, res, doc);
416
+ res = htmlTemplateElement.content;
417
+ }
363
418
 
364
- actionExpression.getExpressions().filter(it => it.type === 'replace').forEach(it => {
365
- try {
366
- // const helperHostSet22 = SwcUtils.getHelperAndHostSet(win, this as any);
367
- const sr = FunctionUtils.executeReturn({script: it.script, context: this, args: helperHostSet});
368
- actionExpression.replace(it, sr);
369
- } catch (e) {
370
- console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
419
+ if (res) {
420
+ const nodes = Array.isArray(res) ? res : [res];
421
+ if (meta.options.useShadow || conf?.useShadow) {
422
+ shadowChildren.push(...nodes);
423
+ }else {
424
+ lightChildren.push(...nodes);
371
425
  }
372
- });
373
- res = actionExpression.getUnprocessedTemplate();
374
-
375
- if (res !== undefined) {
376
- if (meta.options.useShadow || conf?.useShadow) sContent += res;
377
- else lContent += res;
378
426
  }
379
427
  }
380
428
  try {
381
429
  if (this.shadowRoot) {
382
- this.shadowRoot.innerHTML = sContent;
430
+ const applyShadowChildren = SwcUtils.projectProcessHtml(this._swcId, shadowChildren, doc);
431
+ this.shadowRoot.replaceChildren(...applyShadowChildren)
383
432
  }
384
- if (lContent) {
385
- this.innerHTML = lContent;
433
+ if (lightChildren.length) {
434
+ const applyLightChildren = SwcUtils.projectProcessHtml(this._swcId, lightChildren, doc);
435
+ this.replaceChildren(...applyLightChildren)
386
436
  }
437
+
387
438
  } catch (e) {
388
439
  console.error('[ElementDefine] innerHTML setting error:', e);
389
440
  }
441
+ new ElementApply(this, {id: this._swcId}).apply({context: stateContext, bind: this});
442
+ } else {
443
+ new ElementApply(this, {id: this._swcId}).apply({exclude: {html: true, text: true, attribute: true}, context: stateContext, bind: this});
390
444
  }
391
445
 
392
- const root = this.getRootNode();
446
+ // global delegate event
447
+ const root = this.getRootNode()
393
448
  if (!globalDelegatedRoots.has(root)) {
394
449
  DOM_EVENT_NAMES.forEach(type => {
395
450
  root.addEventListener(type, handleGlobalSwcEvent);
@@ -397,6 +452,7 @@ export const elementDefine =
397
452
  globalDelegatedRoots.add(root);
398
453
  }
399
454
 
455
+
400
456
  // Separate delegate and non-delegate listeners
401
457
  const delegateListeners: typeof addEventListenerList = [];
402
458
  const nonDelegateListeners: typeof addEventListenerList = [];
@@ -526,17 +582,18 @@ export const elementDefine =
526
582
  await (this as any)[meta.propertyKey](event, {currentHostSet, $$matchedElement: event.currentTarget}, args);
527
583
  };
528
584
  t.addEventListener(type, handler, opts);
529
- if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
530
- (this as any)._boundListeners.push({target: t, type, handler, options: opts});
531
- }
585
+ (this as any)._boundListeners.push({target: t, type, handler, options: opts});
532
586
  });
533
587
  });
534
588
 
535
589
  if (originalConnected) await (originalConnected.apply(this));
536
590
 
537
- const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
591
+ const aMethods = findAllOnConnectedAfterMetadata(this).filter(it => {
592
+ return useSsr ? !it.options.ssrFirst : true;
593
+ });
594
+ // console.log('afterConnected', this.tagName, aMethods, getOnConnectedAfterMetadata(this))
538
595
  if (aMethods) {
539
- for (const m of aMethods) await (this as any)._invokeLifecycleMethod(m, helperHostSet);
596
+ for (const m of aMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);
540
597
  }
541
598
  (this as any)._executeSwcScript('swc-on-connected', helperHostSet);
542
599
  (this as any)._executeSwcScript('swc-on-after-connected', helperHostSet);
@@ -554,6 +611,9 @@ export const elementDefine =
554
611
  }
555
612
  }
556
613
  } finally {
614
+ for (let mPropertyKey of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) {
615
+ await (this as any)._invokeLifecycleMethod(mPropertyKey, helperHostSet);
616
+ }
557
617
  if (appHost && typeof (appHost as any)._connectedDone === 'function') {
558
618
  await (appHost as any)._connectedDone(this);
559
619
  }
@@ -564,7 +624,7 @@ export const elementDefine =
564
624
  proto.disconnectedCallback = function () {
565
625
  // const helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);
566
626
  // Remove from appHost LAST when disconnected
567
- console.log('disconnnnnnnnnnnnnnnnnnn', helperHostSet, this)
627
+ // console.log('disconnnnnnnnnnnnnnnnnnn', helperHostSet, this)
568
628
  const appHost = helperHostSet.$appHost;
569
629
  if (appHost && typeof (appHost as any)._disconnected === 'function') {
570
630
  (appHost as any)._disconnected(this);
@@ -581,6 +641,20 @@ export const elementDefine =
581
641
  (this as any)._boundListeners = [];
582
642
  }
583
643
 
644
+ new ElementApply(this, {id: this._swcId}).removeAllEventListener();
645
+
646
+ // globalDelegatedRoots remove
647
+ // const roots = [this, this.getRootNode()];
648
+ // if (this.shadowRoot) {
649
+ // roots.push(this.shadowRoot);
650
+ // }
651
+ // roots.forEach(root => {
652
+ // DOM_EVENT_NAMES.forEach(type => {
653
+ // root.removeEventListener(type, handleGlobalSwcEvent);
654
+ // });
655
+ // }
656
+ // )
657
+
584
658
  if (originalDisconnected) originalDisconnected.apply(this);
585
659
 
586
660
  const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);
@@ -1,5 +1,5 @@
1
1
  import {ReflectUtils} from '@dooboostore/core';
2
- import {SpecialSelector, SwcQueryOptions, HelperHostSet} from '../types';
2
+ import { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';
3
3
  import {ensureInit, getElementConfig} from './elementDefine';
4
4
  import {SwcUtils} from '../utils/Utils';
5
5
 
@@ -14,3 +14,6 @@ export * from './setProperty';
14
14
  export * from './subscribeSwcAppRouteChangeWhileConnected';
15
15
  export * from './subscribeSwcAppMessageWhileConnected';
16
16
  export * from './publishSwcAppMessage';
17
+ export * from './applySlot';
18
+ export * from './state';
19
+