@dooboostore/simple-web-component 1.0.35 → 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 (284) hide show
  1. package/README.md +58 -21
  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/addEventListener.js +12 -4
  5. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  6. package/dist/cjs/decorators/applyAttribute.js +19 -18
  7. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  8. package/dist/cjs/decorators/applyClass.js +23 -22
  9. package/dist/cjs/decorators/applyClass.js.map +2 -2
  10. package/dist/cjs/decorators/applyNode.js +28 -26
  11. package/dist/cjs/decorators/applyNode.js.map +2 -2
  12. package/dist/cjs/decorators/applySlot.js +122 -0
  13. package/dist/cjs/decorators/applySlot.js.map +7 -0
  14. package/dist/cjs/decorators/applyStyle.js +20 -19
  15. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  16. package/dist/cjs/decorators/attribute.js +16 -15
  17. package/dist/cjs/decorators/attribute.js.map +2 -2
  18. package/dist/cjs/decorators/{changedAttributeHost.js → changedAttributeThis.js} +6 -6
  19. package/dist/cjs/decorators/changedAttributeThis.js.map +7 -0
  20. package/dist/cjs/decorators/elementDefine.js +59 -50
  21. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  22. package/dist/cjs/decorators/emitCustomEvent.js +18 -16
  23. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  24. package/dist/cjs/decorators/index.js +2 -1
  25. package/dist/cjs/decorators/index.js.map +2 -2
  26. package/dist/cjs/decorators/lifecycles.js +56 -8
  27. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  28. package/dist/cjs/decorators/query.js +38 -60
  29. package/dist/cjs/decorators/query.js.map +2 -2
  30. package/dist/cjs/decorators/queryAll.js +31 -63
  31. package/dist/cjs/decorators/queryAll.js.map +2 -2
  32. package/dist/cjs/decorators/setProperty.js +13 -12
  33. package/dist/cjs/decorators/setProperty.js.map +2 -2
  34. package/dist/cjs/elements/{SwcAppMixin.js → SwcApp.js} +107 -57
  35. package/dist/cjs/elements/SwcApp.js.map +7 -0
  36. package/dist/cjs/elements/index.js +21 -2
  37. package/dist/cjs/elements/index.js.map +3 -3
  38. package/dist/cjs/elements/tt/SwcAppMixin.js +1 -0
  39. package/dist/cjs/elements/tt/SwcAppMixin.js.map +7 -0
  40. package/dist/cjs/elements/tt/SwcAsync.js +1 -0
  41. package/dist/cjs/elements/tt/SwcAsync.js.map +7 -0
  42. package/dist/cjs/elements/tt/SwcAsyncTemplate.js +1 -0
  43. package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +7 -0
  44. package/dist/cjs/elements/tt/SwcChoose.js +1 -0
  45. package/dist/cjs/elements/tt/SwcChoose.js.map +7 -0
  46. package/dist/cjs/elements/tt/SwcChooseTemplate.js +1 -0
  47. package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +7 -0
  48. package/dist/cjs/elements/tt/SwcIf.js +1 -0
  49. package/dist/cjs/elements/tt/SwcIf.js.map +7 -0
  50. package/dist/cjs/elements/tt/SwcIfTemplate.js +1 -0
  51. package/dist/cjs/elements/tt/SwcIfTemplate.js.map +7 -0
  52. package/dist/cjs/elements/tt/SwcLoop.js +1 -0
  53. package/dist/cjs/elements/tt/SwcLoop.js.map +7 -0
  54. package/dist/cjs/elements/tt/SwcLoopTemplate.js +1 -0
  55. package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +7 -0
  56. package/dist/cjs/elements/tt/SwcSubTemplates.js +1 -0
  57. package/dist/cjs/elements/tt/SwcSubTemplates.js.map +7 -0
  58. package/dist/cjs/elements/tt/register.js +1 -0
  59. package/dist/cjs/elements/tt/register.js.map +7 -0
  60. package/dist/cjs/index.js +12 -8
  61. package/dist/cjs/index.js.map +2 -2
  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/types.js.map +1 -1
  65. package/dist/cjs/utils/Utils.js +22 -19
  66. package/dist/cjs/utils/Utils.js.map +2 -2
  67. package/dist/esm/{elements/SwcAppEngine.js → SwcAppEngine.js} +4 -4
  68. package/dist/esm/SwcAppEngine.js.map +7 -0
  69. package/dist/esm/decorators/addEventListener.js +12 -4
  70. package/dist/esm/decorators/addEventListener.js.map +2 -2
  71. package/dist/esm/decorators/applyAttribute.js +19 -18
  72. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  73. package/dist/esm/decorators/applyClass.js +23 -22
  74. package/dist/esm/decorators/applyClass.js.map +2 -2
  75. package/dist/esm/decorators/applyNode.js +28 -26
  76. package/dist/esm/decorators/applyNode.js.map +2 -2
  77. package/dist/esm/decorators/applySlot.js +103 -0
  78. package/dist/esm/decorators/applySlot.js.map +7 -0
  79. package/dist/esm/decorators/applyStyle.js +20 -19
  80. package/dist/esm/decorators/applyStyle.js.map +2 -2
  81. package/dist/esm/decorators/attribute.js +16 -15
  82. package/dist/esm/decorators/attribute.js.map +2 -2
  83. package/dist/esm/decorators/{changedAttributeHost.js → changedAttributeThis.js} +3 -3
  84. package/dist/esm/decorators/changedAttributeThis.js.map +7 -0
  85. package/dist/esm/decorators/elementDefine.js +60 -51
  86. package/dist/esm/decorators/elementDefine.js.map +2 -2
  87. package/dist/esm/decorators/emitCustomEvent.js +18 -16
  88. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  89. package/dist/esm/decorators/index.js +2 -1
  90. package/dist/esm/decorators/index.js.map +2 -2
  91. package/dist/esm/decorators/lifecycles.js +56 -8
  92. package/dist/esm/decorators/lifecycles.js.map +2 -2
  93. package/dist/esm/decorators/query.js +38 -60
  94. package/dist/esm/decorators/query.js.map +2 -2
  95. package/dist/esm/decorators/queryAll.js +31 -63
  96. package/dist/esm/decorators/queryAll.js.map +2 -2
  97. package/dist/esm/decorators/setProperty.js +13 -12
  98. package/dist/esm/decorators/setProperty.js.map +2 -2
  99. package/dist/esm/elements/{SwcAppMixin.js → SwcApp.js} +102 -53
  100. package/dist/esm/elements/SwcApp.js.map +7 -0
  101. package/dist/esm/elements/index.js +7 -1
  102. package/dist/esm/elements/index.js.map +2 -2
  103. package/dist/esm/elements/tt/SwcAppMixin.js +1 -0
  104. package/dist/esm/elements/tt/SwcAppMixin.js.map +7 -0
  105. package/dist/esm/elements/tt/SwcAsync.js +1 -0
  106. package/dist/esm/elements/tt/SwcAsync.js.map +7 -0
  107. package/dist/esm/elements/tt/SwcAsyncTemplate.js +1 -0
  108. package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +7 -0
  109. package/dist/esm/elements/tt/SwcChoose.js +1 -0
  110. package/dist/esm/elements/tt/SwcChoose.js.map +7 -0
  111. package/dist/esm/elements/tt/SwcChooseTemplate.js +1 -0
  112. package/dist/esm/elements/tt/SwcChooseTemplate.js.map +7 -0
  113. package/dist/esm/elements/tt/SwcIf.js +1 -0
  114. package/dist/esm/elements/tt/SwcIf.js.map +7 -0
  115. package/dist/esm/elements/tt/SwcIfTemplate.js +1 -0
  116. package/dist/esm/elements/tt/SwcIfTemplate.js.map +7 -0
  117. package/dist/esm/elements/tt/SwcLoop.js +1 -0
  118. package/dist/esm/elements/tt/SwcLoop.js.map +7 -0
  119. package/dist/esm/elements/tt/SwcLoopTemplate.js +1 -0
  120. package/dist/esm/elements/tt/SwcLoopTemplate.js.map +7 -0
  121. package/dist/esm/elements/tt/SwcSubTemplates.js +1 -0
  122. package/dist/esm/elements/tt/SwcSubTemplates.js.map +7 -0
  123. package/dist/esm/elements/tt/register.js +1 -0
  124. package/dist/esm/elements/tt/register.js.map +7 -0
  125. package/dist/esm/index.js +13 -9
  126. package/dist/esm/index.js.map +2 -2
  127. package/dist/esm/types/window.d.js +1 -0
  128. package/dist/esm/types/window.d.js.map +7 -0
  129. package/dist/esm/types.js.map +1 -1
  130. package/dist/esm/utils/Utils.js +22 -19
  131. package/dist/esm/utils/Utils.js.map +2 -2
  132. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +4189 -456
  133. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  134. package/dist/types/{elements/SwcAppEngine.d.ts → SwcAppEngine.d.ts} +9 -4
  135. package/dist/types/SwcAppEngine.d.ts.map +1 -0
  136. package/dist/types/decorators/addEventListener.d.ts +5 -7
  137. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  138. package/dist/types/decorators/applyAttribute.d.ts +4 -4
  139. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  140. package/dist/types/decorators/applyClass.d.ts +6 -6
  141. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  142. package/dist/types/decorators/applyNode.d.ts +9 -9
  143. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  144. package/dist/types/decorators/applySlot.d.ts +27 -0
  145. package/dist/types/decorators/applySlot.d.ts.map +1 -0
  146. package/dist/types/decorators/applyStyle.d.ts +4 -4
  147. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  148. package/dist/types/decorators/attribute.d.ts +5 -5
  149. package/dist/types/decorators/attribute.d.ts.map +1 -1
  150. package/dist/types/decorators/changedAttributeThis.d.ts +18 -0
  151. package/dist/types/decorators/changedAttributeThis.d.ts.map +1 -0
  152. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  153. package/dist/types/decorators/emitCustomEvent.d.ts +4 -9
  154. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  155. package/dist/types/decorators/index.d.ts +2 -1
  156. package/dist/types/decorators/index.d.ts.map +1 -1
  157. package/dist/types/decorators/lifecycles.d.ts +21 -6
  158. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  159. package/dist/types/decorators/query.d.ts +17 -63
  160. package/dist/types/decorators/query.d.ts.map +1 -1
  161. package/dist/types/decorators/queryAll.d.ts +6 -63
  162. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  163. package/dist/types/decorators/setProperty.d.ts +1 -1
  164. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  165. package/dist/types/elements/SwcApp.d.ts +7 -0
  166. package/dist/types/elements/SwcApp.d.ts.map +1 -0
  167. package/dist/types/elements/index.d.ts +2 -1
  168. package/dist/types/elements/index.d.ts.map +1 -1
  169. package/dist/types/elements/tt/SwcAppMixin.d.ts +1 -0
  170. package/dist/types/elements/tt/SwcAppMixin.d.ts.map +1 -0
  171. package/dist/types/elements/tt/SwcAsync.d.ts +1 -0
  172. package/dist/types/elements/tt/SwcAsync.d.ts.map +1 -0
  173. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +1 -0
  174. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +1 -0
  175. package/dist/types/elements/tt/SwcChoose.d.ts +1 -0
  176. package/dist/types/elements/tt/SwcChoose.d.ts.map +1 -0
  177. package/dist/types/elements/tt/SwcChooseTemplate.d.ts +1 -0
  178. package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +1 -0
  179. package/dist/types/elements/tt/SwcIf.d.ts +1 -0
  180. package/dist/types/elements/{SwcIf.d.ts.map → tt/SwcIf.d.ts.map} +1 -1
  181. package/dist/types/elements/tt/SwcIfTemplate.d.ts +1 -0
  182. package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +1 -0
  183. package/dist/types/elements/tt/SwcLoop.d.ts +1 -0
  184. package/dist/types/elements/tt/SwcLoop.d.ts.map +1 -0
  185. package/dist/types/elements/tt/SwcLoopTemplate.d.ts +1 -0
  186. package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +1 -0
  187. package/dist/types/elements/tt/SwcSubTemplates.d.ts +1 -0
  188. package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +1 -0
  189. package/dist/types/elements/tt/register.d.ts +1 -0
  190. package/dist/types/elements/tt/register.d.ts.map +1 -0
  191. package/dist/types/index.d.ts +2 -2
  192. package/dist/types/index.d.ts.map +1 -1
  193. package/dist/types/types.d.ts +5 -5
  194. package/dist/types/types.d.ts.map +1 -1
  195. package/dist/types/utils/Utils.d.ts +13 -12
  196. package/dist/types/utils/Utils.d.ts.map +1 -1
  197. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +4189 -456
  198. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  199. package/package.json +4 -4
  200. package/src/{elements/SwcAppEngine.ts → SwcAppEngine.ts} +12 -7
  201. package/src/decorators/addEventListener.ts +11 -9
  202. package/src/decorators/applyAttribute.ts +16 -15
  203. package/src/decorators/applyClass.ts +18 -17
  204. package/src/decorators/applyNode.ts +30 -27
  205. package/src/decorators/applySlot.ts +228 -0
  206. package/src/decorators/applyStyle.ts +17 -16
  207. package/src/decorators/attribute.ts +20 -19
  208. package/src/decorators/{changedAttributeHost.ts → changedAttributeThis.ts} +10 -12
  209. package/src/decorators/elementDefine.ts +80 -57
  210. package/src/decorators/emitCustomEvent.ts +21 -26
  211. package/src/decorators/index.ts +2 -1
  212. package/src/decorators/lifecycles.ts +76 -11
  213. package/src/decorators/query.ts +51 -124
  214. package/src/decorators/queryAll.ts +30 -127
  215. package/src/decorators/setProperty.ts +12 -11
  216. package/src/elements/{SwcAppMixin.ts → SwcApp.ts} +98 -31
  217. package/src/elements/index.ts +11 -1
  218. package/src/elements/tt/SwcAppMixin.ts +13 -0
  219. package/src/elements/tt/SwcAsync.ts +139 -0
  220. package/src/elements/tt/SwcAsyncTemplate.ts +126 -0
  221. package/src/elements/tt/SwcChoose.ts +182 -0
  222. package/src/elements/tt/SwcChooseTemplate.ts +229 -0
  223. package/src/elements/tt/SwcIf.ts +145 -0
  224. package/src/elements/tt/SwcIfTemplate.ts +158 -0
  225. package/src/elements/tt/SwcLoop.ts +222 -0
  226. package/src/elements/tt/SwcLoopTemplate.ts +255 -0
  227. package/src/elements/tt/SwcSubTemplates.ts +6 -0
  228. package/src/elements/tt/register.ts +720 -0
  229. package/src/index.ts +13 -9
  230. package/src/types/window.d.ts +43 -0
  231. package/src/types.ts +9 -8
  232. package/src/utils/Utils.ts +28 -24
  233. package/dist/cjs/decorators/changedAttributeHost.js.map +0 -7
  234. package/dist/cjs/elements/SwcAppEngine.js.map +0 -7
  235. package/dist/cjs/elements/SwcAppMixin.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/esm/decorators/changedAttributeHost.js.map +0 -7
  249. package/dist/esm/elements/SwcAppEngine.js.map +0 -7
  250. package/dist/esm/elements/SwcAppMixin.js.map +0 -7
  251. package/dist/esm/elements/SwcAsync.js +0 -129
  252. package/dist/esm/elements/SwcAsync.js.map +0 -7
  253. package/dist/esm/elements/SwcChoose.js +0 -155
  254. package/dist/esm/elements/SwcChoose.js.map +0 -7
  255. package/dist/esm/elements/SwcIf.js +0 -117
  256. package/dist/esm/elements/SwcIf.js.map +0 -7
  257. package/dist/esm/elements/SwcLoop.js +0 -176
  258. package/dist/esm/elements/SwcLoop.js.map +0 -7
  259. package/dist/esm/elements/SwcSubTemplates.js +0 -13
  260. package/dist/esm/elements/SwcSubTemplates.js.map +0 -7
  261. package/dist/esm/elements/register.js +0 -1007
  262. package/dist/esm/elements/register.js.map +0 -7
  263. package/dist/types/decorators/changedAttributeHost.d.ts +0 -20
  264. package/dist/types/decorators/changedAttributeHost.d.ts.map +0 -1
  265. package/dist/types/elements/SwcAppEngine.d.ts.map +0 -1
  266. package/dist/types/elements/SwcAppMixin.d.ts +0 -386
  267. package/dist/types/elements/SwcAppMixin.d.ts.map +0 -1
  268. package/dist/types/elements/SwcAsync.d.ts +0 -2
  269. package/dist/types/elements/SwcAsync.d.ts.map +0 -1
  270. package/dist/types/elements/SwcChoose.d.ts +0 -2
  271. package/dist/types/elements/SwcChoose.d.ts.map +0 -1
  272. package/dist/types/elements/SwcIf.d.ts +0 -2
  273. package/dist/types/elements/SwcLoop.d.ts +0 -2
  274. package/dist/types/elements/SwcLoop.d.ts.map +0 -1
  275. package/dist/types/elements/SwcSubTemplates.d.ts +0 -13
  276. package/dist/types/elements/SwcSubTemplates.d.ts.map +0 -1
  277. package/dist/types/elements/register.d.ts +0 -4
  278. package/dist/types/elements/register.d.ts.map +0 -1
  279. package/src/elements/SwcAsync.ts +0 -126
  280. package/src/elements/SwcChoose.ts +0 -190
  281. package/src/elements/SwcIf.ts +0 -124
  282. package/src/elements/SwcLoop.ts +0 -205
  283. package/src/elements/SwcSubTemplates.ts +0 -6
  284. package/src/elements/register.ts +0 -1022
@@ -77,20 +77,21 @@ export const resolveTargetEls = (inst: any, selector: string, options: Attribute
77
77
  }
78
78
  };
79
79
 
80
- if (selector === ':host' || !selector) {
80
+ if (selector === '$this' || !selector) {
81
81
  applyRoot(inst);
82
- } else if (selector === ':window') {
82
+ } else if (selector === '$window') {
83
83
  results.push(currentWin);
84
- } else if (selector === ':document') {
84
+ } else if (selector === '$document') {
85
85
  results.push(currentWin.document);
86
86
  } else {
87
87
  const hostSet = SwcUtils.getHostSet(inst);
88
- if (selector === ':parentHost') applyRoot(hostSet.$parentHost);
89
- else if (selector === ':appHost') applyRoot(hostSet.$appHost as any);
90
- else if (selector === ':firstHost') applyRoot(hostSet.$firstHost);
91
- else if (selector === ':lastHost') applyRoot(hostSet.$lastHost);
92
- else if (selector === ':firstAppHost') applyRoot(hostSet.$firstAppHost as any);
93
- else if (selector === ':lastAppHost') applyRoot(hostSet.$lastAppHost as any);
88
+ if (selector === '$host') applyRoot(hostSet.$host);
89
+ else if (selector === '$parentHost') applyRoot(hostSet.$parentHost);
90
+ else if (selector === '$appHost') applyRoot(hostSet.$appHost as any);
91
+ else if (selector === '$firstHost') applyRoot(hostSet.$firstHost);
92
+ else if (selector === '$lastHost') applyRoot(hostSet.$lastHost);
93
+ else if (selector === '$firstAppHost') applyRoot(hostSet.$firstAppHost as any);
94
+ else if (selector === '$lastAppHost') applyRoot(hostSet.$lastAppHost as any);
94
95
  else {
95
96
  if (r === 'shadow') {
96
97
  const found = inst.shadowRoot?.querySelectorAll(selector);
@@ -189,29 +190,29 @@ export function attribute(selector: string, options: AttributeFieldOptions = {})
189
190
  }
190
191
 
191
192
  /**
192
- * @attributeHost decorator to sync a field value with the :host element's attribute.
193
+ * @attributeThis decorator to sync a field value with the $this element's attribute.
193
194
  */
194
- export function attributeHost(target: Object, propertyKey: string | symbol): void;
195
- export function attributeHost(options: AttributeFieldOptions): PropertyDecorator;
196
- export function attributeHost(attrName: string): PropertyDecorator;
197
- export function attributeHost(attrName: string, options: AttributeFieldOptions): PropertyDecorator;
198
- export function attributeHost(targetOrAttrOrOptions?: any, propertyKeyOrOptions?: any): any {
195
+ export function attributeThis(target: Object, propertyKey: string | symbol): void;
196
+ export function attributeThis(options: AttributeFieldOptions): PropertyDecorator;
197
+ export function attributeThis(attrName: string): PropertyDecorator;
198
+ export function attributeThis(attrName: string, options: AttributeFieldOptions): PropertyDecorator;
199
+ export function attributeThis(targetOrAttrOrOptions?: any, propertyKeyOrOptions?: any): any {
199
200
  if (propertyKeyOrOptions !== undefined && (typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol')) {
200
- return attribute(':host', { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
201
+ return attribute('$this', { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
201
202
  }
202
203
 
203
204
  if (typeof targetOrAttrOrOptions === 'string') {
204
205
  const attrName = targetOrAttrOrOptions;
205
206
  const options = (typeof propertyKeyOrOptions === 'object' ? propertyKeyOrOptions : {}) as AttributeFieldOptions;
206
- return attribute(':host', { ...options, name: attrName });
207
+ return attribute('$this', { ...options, name: attrName });
207
208
  } else if (typeof targetOrAttrOrOptions === 'object') {
208
209
  const options = targetOrAttrOrOptions as AttributeFieldOptions;
209
210
  return (target: Object, propertyKey: string | symbol) => {
210
- return attribute(':host', { ...options, name: String(propertyKey) })(target, propertyKey);
211
+ return attribute('$this', { ...options, name: String(propertyKey) })(target, propertyKey);
211
212
  };
212
213
  } else {
213
214
  return (target: Object, propertyKey: string | symbol) => {
214
- return attribute(':host', { name: String(propertyKey) })(target, propertyKey);
215
+ return attribute('$this', { name: String(propertyKey) })(target, propertyKey);
215
216
  };
216
217
  }
217
218
  }
@@ -2,15 +2,15 @@ import { ReflectUtils } from '@dooboostore/core';
2
2
 
3
3
  export const ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for('simple-web-component:on-attribute-changed');
4
4
 
5
- export interface ChangedAttributeHostOptions {
5
+ export interface ChangedAttributeThisOptions {
6
6
  type?: typeof Number | typeof Boolean | typeof String;
7
7
  while?: 'connected';
8
8
  }
9
9
 
10
- export interface ChangedAttributeHostMetadata {
10
+ export interface ChangedAttributeThisMetadata {
11
11
  attributeName: string;
12
12
  propertyKey: string | symbol;
13
- options: ChangedAttributeHostOptions;
13
+ options: ChangedAttributeThisOptions;
14
14
  }
15
15
 
16
16
  const convertValue = (val: any, type: any): any => {
@@ -21,14 +21,12 @@ const convertValue = (val: any, type: any): any => {
21
21
  };
22
22
 
23
23
  /**
24
- * @changedAttributeHost decorator - fires when any attribute on :host changes
25
- * Usage: @changedAttributeHost('data-product-id')
26
- * @changedAttributeHost('count', { type: Number })
24
+ * @changedAttributeThis decorator - fires when any attribute on $this changes
27
25
  */
28
- export function changedAttributeHost(attributeName?: string, options: ChangedAttributeHostOptions = {}): MethodDecorator {
26
+ export function changedAttributeThis(attributeName?: string, options: ChangedAttributeThisOptions = {}): MethodDecorator {
29
27
  return (target: Object, propertyKey: string | symbol) => {
30
28
  const constructor = target.constructor;
31
- let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) as ChangedAttributeHostMetadata[];
29
+ let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) as ChangedAttributeThisMetadata[];
32
30
  if (!metaList) {
33
31
  metaList = [];
34
32
  ReflectUtils.defineMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, metaList, constructor);
@@ -43,16 +41,16 @@ export function changedAttributeHost(attributeName?: string, options: ChangedAtt
43
41
  };
44
42
  }
45
43
 
46
- export const getChangedAttributeMetadata = (target: any): ChangedAttributeHostMetadata[] | undefined => {
44
+ export const getChangedAttributeMetadata = (target: any): ChangedAttributeThisMetadata[] | undefined => {
47
45
  const constructor = target instanceof Function ? target : target.constructor;
48
46
  return ReflectUtils.getMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);
49
47
  };
50
48
 
51
- export const findAllAttributeChangedMetadata = (target: any): Map<string, ChangedAttributeHostMetadata[]> => {
49
+ export const findAllAttributeChangedMetadata = (target: any): Map<string, ChangedAttributeThisMetadata[]> => {
52
50
  const constructor = target instanceof Function ? target : target.constructor;
53
- const metaList = ReflectUtils.findAllMetadata<ChangedAttributeHostMetadata[]>(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) || [];
51
+ const metaList = ReflectUtils.findAllMetadata<ChangedAttributeThisMetadata[]>(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) || [];
54
52
 
55
- const result = new Map<string, ChangedAttributeHostMetadata[]>();
53
+ const result = new Map<string, ChangedAttributeThisMetadata[]>();
56
54
  metaList.forEach(meta => {
57
55
  meta.forEach(item => {
58
56
  if (!result.has(item.attributeName)) {
@@ -1,8 +1,8 @@
1
1
  import {ReflectUtils, FunctionUtils, ActionExpression} 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 {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, getOnConnectedBeforeMetadata, getOnConnectedAfterMetadata, ON_CONNECTED_COMPLETED_METADATA_KEY} from './lifecycles';
4
4
  import {getEmitCustomEventMetadataList} from './emitCustomEvent';
5
- import {findAllAttributeChangedMetadata, convertAttributeValue} from './changedAttributeHost';
5
+ import {findAllAttributeChangedMetadata, convertAttributeValue} from './changedAttributeThis';
6
6
  import {findAllAttributeApplyMetadata} from './applyAttribute';
7
7
  import {findAllAttributeMetadata, getAttributeValue} from './attribute';
8
8
  import {getQueryMetadata} from './query';
@@ -10,8 +10,10 @@ import {getQueryAllMetadata} from './queryAll';
10
10
  import {SwcUtils} from '../utils/Utils';
11
11
  import {HTML_TAG_ENTRIES, DOM_EVENT_NAMES} 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 {InjectSituationType, HostSet, HelperHostSet, SwcAppInterface} from '../types';
14
+ import {ConvertUtils, NodeSlot} from '@dooboostore/core-web';
15
+ import {isSSR} from "../elements/SwcApp";
16
+ import {findAllApplySlotMetadata} from "./applySlot";
15
17
 
16
18
  // --- Core Interfaces & Types ---
17
19
 
@@ -35,9 +37,9 @@ export const getElementConfig = (target: any): ElementMetadata | undefined => {
35
37
  return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
36
38
  };
37
39
 
38
- export const ensureInit = (inst: any) => {
40
+ export const ensureInit = (inst: any) => { // HTMLElement
39
41
  if (!inst.__swc_initialized) {
40
- inst._swcId = Math.random().toString(36).substring(2, 11);
42
+ inst._swcId = inst?.getAttribute?.('swc-use-ssr') ?? Math.random().toString(36).substring(2, 11);
41
43
  inst._emitHandlers = new Map();
42
44
  inst._boundListeners = [];
43
45
  inst.__swc_initialized = true;
@@ -54,7 +56,7 @@ export const ensureInit = (inst: any) => {
54
56
  // ║ ║
55
57
  // ║ 이유: ║
56
58
  // ║ 1. TypeScript는 초기값이 있는 필드를 constructor에서 own property로 생성 ║
57
- // ║ @attributeHost('id') myId: string = "default" → this.myId = "default" ║
59
+ // ║ @attributeThis('id') myId: string = "default" → this.myId = "default" ║
58
60
  // ║ ║
59
61
  // ║ 2. JavaScript의 property lookup은 own property를 먼저 찾음 ║
60
62
  // ║ - this.myId 접근 ║
@@ -89,10 +91,16 @@ export const ensureInit = (inst: any) => {
89
91
  delete (inst as any)[meta.propertyKey];
90
92
  });
91
93
  }
94
+ const slotAllList = findAllApplySlotMetadata(target);
95
+ if (slotAllList) {
96
+ slotAllList.filter(it=>it.type === 'property').forEach(meta => {
97
+ delete (inst as any)[meta.propertyKey];
98
+ });
99
+ }
92
100
 
93
101
  // Call constructor script if present
94
102
  const hostSet = SwcUtils.getHostSet(inst);
95
- const appHosts = SwcUtils.findAllParentAppHostsDirect(inst);
103
+ const appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(inst);
96
104
  inst._executeSwcScript?.('swc-on-constructor', hostSet);
97
105
 
98
106
  // Call @onInitialize lifecycle methods
@@ -116,7 +124,7 @@ const handleGlobalSwcEvent = async (event: Event) => {
116
124
  if (!(node instanceof HTMLElement)) continue;
117
125
  const script = node.getAttribute?.(attrName);
118
126
  if (script && !getElementConfig(node)) {
119
- const host: any = SwcUtils.findNearestSwcHost(node);
127
+ const host: any = SwcUtils.findNearestSwcHostIncludingSelf(node);
120
128
  if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === 'function') {
121
129
  await host.__swc_executeAttributeEvent(node, attrName, script, event);
122
130
  (event as any).__swc_handled = true;
@@ -143,7 +151,7 @@ const getHandlers = (inst: any) => {
143
151
  return inst.__swc_attributeEventHandlers;
144
152
  };
145
153
 
146
- const setupPrototype = (proto: any) => {
154
+ const setupPrototype = (proto: any, win: Window) => {
147
155
  if (proto.__swc_proto_setup) return;
148
156
  proto.__swc_proto_setup = true;
149
157
 
@@ -166,7 +174,7 @@ const setupPrototype = (proto: any) => {
166
174
  proto._resolveWindow = function (localConfig?: ElementConfig): Window {
167
175
  ensureInit(this);
168
176
  if (localConfig?.window) return localConfig.window;
169
- const ancestors = SwcUtils.findAllSwcHosts(this as any);
177
+ const ancestors = SwcUtils.findAllSwcHostsIncludingSelf(this as any);
170
178
  for (let i = ancestors.length - 1; i >= 0; i--) {
171
179
  const aConf = getElementConfig(ancestors[i]);
172
180
  if (aConf?.window) return aConf.window;
@@ -177,7 +185,7 @@ const setupPrototype = (proto: any) => {
177
185
  proto._invokeLifecycleMethod = function (methodName: string | symbol, hostSet?: HostSet, extraArgs: any[] = []) {
178
186
  ensureInit(this);
179
187
  if (typeof (this as any)[methodName] !== 'function') return;
180
- const useHostSet = hostSet ?? SwcUtils.getHostSet(this);
188
+ const useHostSet = hostSet ?? SwcUtils.getHelperAndHostSet(win, this);
181
189
  const app = useHostSet?.$appHost?.simpleApplication;
182
190
  // console.log('---->hh',app, this, methodName);
183
191
  if (app) {
@@ -285,7 +293,7 @@ export const elementDefine =
285
293
  }
286
294
 
287
295
  const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
288
- const emitHostCustomEventList = emitCustomEventList.filter(meta => meta.selector === ':host' || meta.selector === '');
296
+ const emitHostCustomEventList = emitCustomEventList.filter(meta => meta.selector === '$this' || meta.selector === '');
289
297
  const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
290
298
  const attrChangeMap = findAllAttributeChangedMetadata(constructor);
291
299
  const attributeList = findAllAttributeMetadata(constructor);
@@ -297,14 +305,14 @@ export const elementDefine =
297
305
  const attributeApplyNames = Array.from(applyAttributeMap.values())
298
306
  .map(it => it.options.name)
299
307
  .filter(Boolean) as string[];
300
- const hostAttributes = attributeList.filter(it => it.selector === ':host').map(it => it.options.name || String(it.propertyKey));
308
+ const hostAttributes = attributeList.filter(it => it.selector === '$this').map(it => it.options.name || String(it.propertyKey));
301
309
  // Get original static observedAttributes before they're overwritten by Object.defineProperty
302
310
  const originalStaticObservedAttributes = (constructor.observedAttributes ?? []) as string[];
303
311
  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) || [];
312
+ // const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
305
313
 
306
314
  const proto = constructor.prototype;
307
- setupPrototype(proto);
315
+ setupPrototype(proto, win);
308
316
 
309
317
  // 값을 기대하지않는다.
310
318
  let helperHostSet: HelperHostSet | null = null;
@@ -314,61 +322,69 @@ export const elementDefine =
314
322
  // connected 됐을시 최신화
315
323
  helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);
316
324
  const appHost = helperHostSet.$appHost;
325
+ const useSsr = isSSR(this);
326
+ // console.log('isSsr', useSsr, this);
327
+ // console.log('----helperHostSet--->', this, helperHostSet, useSsr)
328
+ // let connectedApp: SwcAppInterface |undefined;
317
329
  try {
318
330
  if (appHost && typeof (appHost as any)._connected === 'function') {
319
- await (appHost as any)._connected(this);
331
+ await (appHost as any)._connected(this);
320
332
  } else if (appHost && typeof (appHost as any)) {
321
- (appHost as any)._connected_safari ??= [];
322
- (appHost as any)._connected_safari.push(this);
333
+ (appHost as any)._connected_safari_and_standby ??= [];
334
+ (appHost as any)._connected_safari_and_standby.push(this);
323
335
  }
324
336
 
325
337
  // const hostSet = SwcUtils.getHostSet(this as any);
326
338
  const conf = getElementConfig(this);
327
339
  const currentWin = (this as any)._resolveWindow(conf);
328
340
 
329
- const shadowMode = conf?.useShadow || connectedInnerHtmlList.find(it => it.options.useShadow)?.options.useShadow;
341
+ const bMethods = getOnConnectedBeforeMetadata(this).filter(it => useSsr ? !it.options.ssrFirst : true);
342
+ // console.log('beforeConnected', bMethods)
343
+ if (bMethods) {
344
+ for (const m of bMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);
345
+ }
346
+ (this as any)._executeSwcScript('swc-on-before-connected', helperHostSet);
347
+
348
+ // console.log('vvvvvvvvvvvvvvvu-seSsr-vvvvvvvvvv>', useSsr, this.tagName, this.getAttribute('seq'))
349
+ // // ssr 처리라서 이미 내려준거그대로 상요하면된다 따라서 호출안한다
350
+ const targetConnectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor).filter(it => useSsr ? !it.options.ssrFirst : true);
351
+ const shadowMode = conf?.useShadow || targetConnectedInnerHtmlList.find(it => it.options.useShadow)?.options.useShadow;
330
352
  if (shadowMode && !this.shadowRoot) {
331
353
  const mode = shadowMode === true ? 'open' : shadowMode;
332
354
  this.attachShadow({mode: mode as ShadowRootMode});
333
355
  }
334
356
 
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);
340
-
341
- if (connectedInnerHtmlList.length > 0) {
357
+ if (targetConnectedInnerHtmlList.length > 0) {
342
358
  let sContent = '',
343
359
  lContent = '';
344
- for (const meta of connectedInnerHtmlList) {
360
+ for (const meta of targetConnectedInnerHtmlList) {
345
361
  // const res = (this as any)[meta.propertyKey]();
346
362
  let res = await (this as any)._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
347
363
  const actionExpression = new ActionExpression(res, {
348
364
  expression: {
349
365
  replace: {
350
- start: meta.options.replaceWrap?.start || '{%{',
351
- end: meta.options.replaceWrap?.end || '}%}'
366
+ start: meta.options.replaceWrap?.start || '[[',
367
+ end: meta.options.replaceWrap?.end || ']]'
352
368
  },
353
369
  callReturn: {
354
- start: meta.options.replaceWrap?.start || '{%{=',
355
- end: meta.options.replaceWrap?.end || '}%}'
370
+ start: meta.options.replaceWrap?.start || '[[=',
371
+ end: meta.options.replaceWrap?.end || ']]'
356
372
  },
357
373
  call: {
358
- start: meta.options.replaceWrap?.start || '{%{@',
359
- end: meta.options.replaceWrap?.end || '}%}'
374
+ start: meta.options.replaceWrap?.start || '[[@',
375
+ end: meta.options.replaceWrap?.end || ']]'
360
376
  }
361
377
  }
362
378
  });
363
379
 
364
380
  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);
371
- }
381
+ actionExpression.replace(it, NodeSlot.slot(`${this._swcId}-${it.script}`));
382
+ // try {
383
+ // const sr = FunctionUtils.executeReturn({script: it.script, context: this, args: helperHostSet});
384
+ // actionExpression.replace(it, sr);
385
+ // } catch (e) {
386
+ // console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
387
+ // }
372
388
  });
373
389
  res = actionExpression.getUnprocessedTemplate();
374
390
 
@@ -402,7 +418,7 @@ export const elementDefine =
402
418
  const nonDelegateListeners: typeof addEventListenerList = [];
403
419
 
404
420
  addEventListenerList.forEach(meta => {
405
- if (meta.options.delegate && meta.selector !== ':window' && meta.selector !== ':document' && meta.selector !== ':parentHost' && meta.selector !== ':appHost' && meta.selector !== ':firstHost' && meta.selector !== ':lastHost' && meta.selector !== ':firstAppHost' && meta.selector !== ':lastAppHost' && meta.selector !== ':hosts' && meta.selector !== ':appHosts' && meta.selector !== ':host' && meta.selector !== '') {
421
+ if (meta.options.delegate && meta.selector !== '$window' && meta.selector !== '$document' && meta.selector !== '$host' && meta.selector !== '$appHost' && meta.selector !== '$firstHost' && meta.selector !== '$lastHost' && meta.selector !== '$firstAppHost' && meta.selector !== '$lastAppHost' && meta.selector !== '$hosts' && meta.selector !== '$appHosts' && meta.selector !== '$this' && meta.selector !== '') {
406
422
  delegateListeners.push(meta);
407
423
  } else {
408
424
  nonDelegateListeners.push(meta);
@@ -482,17 +498,18 @@ export const elementDefine =
482
498
  }
483
499
  };
484
500
 
485
- if (selector === ':window') bindTargets.push(currentWin);
486
- else if (selector === ':document') bindTargets.push(currentWin.document);
487
- else if (selector === ':parentHost') applyRootOption(helperHostSet.$parentHost);
488
- else if (selector === ':appHost') applyRootOption(helperHostSet.$appHost);
489
- else if (selector === ':firstHost') applyRootOption(helperHostSet.$firstHost);
490
- else if (selector === ':lastHost') applyRootOption(helperHostSet.$lastHost);
491
- else if (selector === ':firstAppHost') applyRootOption(helperHostSet.$firstAppHost);
492
- else if (selector === ':lastAppHost') applyRootOption(helperHostSet.$lastAppHost);
493
- else if (selector === ':hosts') helperHostSet.$hosts.forEach(applyRootOption);
494
- else if (selector === ':appHosts') helperHostSet.$appHosts.forEach(applyRootOption);
495
- else if (selector === ':host' || !selector) applyRootOption(this);
501
+ if (selector === '$window') bindTargets.push(currentWin);
502
+ else if (selector === '$document') bindTargets.push(currentWin.document);
503
+ else if (selector === '$host') applyRootOption(helperHostSet.$host);
504
+ else if (selector === '$parentHost') applyRootOption(helperHostSet.$parentHost);
505
+ else if (selector === '$appHost') applyRootOption(helperHostSet.$appHost);
506
+ else if (selector === '$firstHost') applyRootOption(helperHostSet.$firstHost);
507
+ else if (selector === '$lastHost') applyRootOption(helperHostSet.$lastHost);
508
+ else if (selector === '$firstAppHost') applyRootOption(helperHostSet.$firstAppHost);
509
+ else if (selector === '$lastAppHost') applyRootOption(helperHostSet.$lastAppHost);
510
+ else if (selector === '$hosts') helperHostSet.$hosts.forEach(applyRootOption);
511
+ else if (selector === '$appHosts') helperHostSet.$appHosts.forEach(applyRootOption);
512
+ else if (selector === '$this' || !selector) applyRootOption(this);
496
513
  else {
497
514
  const searchRoots: (HTMLElement | ShadowRoot)[] = [];
498
515
  if (r === 'auto') searchRoots.push(this.shadowRoot || (this as any));
@@ -533,15 +550,18 @@ export const elementDefine =
533
550
 
534
551
  if (originalConnected) await (originalConnected.apply(this));
535
552
 
536
- const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
553
+ const aMethods = getOnConnectedAfterMetadata(this).filter(it => {
554
+ return useSsr ? !it.options.ssrFirst : true;
555
+ });
556
+ // console.log('afterConnected', this.tagName, aMethods, getOnConnectedAfterMetadata(this))
537
557
  if (aMethods) {
538
- for (const m of aMethods) await (this as any)._invokeLifecycleMethod(m, helperHostSet);
558
+ for (const m of aMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);
539
559
  }
540
560
  (this as any)._executeSwcScript('swc-on-connected', helperHostSet);
541
561
  (this as any)._executeSwcScript('swc-on-after-connected', helperHostSet);
542
562
  (this as any).__swc_connected = true;
543
563
 
544
- // Trigger @changedAttributeHost with while: 'connected'
564
+ // Trigger @changedAttributeThis with while: 'connected'
545
565
  for (let [name, metaList] of Array.from(attrChangeMap)) {
546
566
  for (const meta of metaList) {
547
567
  if (meta.options.while === 'connected') {
@@ -553,6 +573,9 @@ export const elementDefine =
553
573
  }
554
574
  }
555
575
  } finally {
576
+ for (let mPropertyKey of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) {
577
+ await (this as any)._invokeLifecycleMethod(mPropertyKey, helperHostSet);
578
+ }
556
579
  if (appHost && typeof (appHost as any)._connectedDone === 'function') {
557
580
  await (appHost as any)._connectedDone(this);
558
581
  }
@@ -563,7 +586,7 @@ export const elementDefine =
563
586
  proto.disconnectedCallback = function () {
564
587
  // const helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);
565
588
  // Remove from appHost LAST when disconnected
566
- console.log('disconnnnnnnnnnnnnnnnnnn', helperHostSet, this)
589
+ // console.log('disconnnnnnnnnnnnnnnnnnn', helperHostSet, this)
567
590
  const appHost = helperHostSet.$appHost;
568
591
  if (appHost && typeof (appHost as any)._disconnected === 'function') {
569
592
  (appHost as any)._disconnected(this);
@@ -60,25 +60,27 @@ export function emitCustomEvent(selectorOrTarget: string, type: string, options:
60
60
  const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);
61
61
 
62
62
  const eventTargets: EventTarget[] = [];
63
- if (selectorOrTarget === ':window') eventTargets.push(currentWin);
64
- else if (selectorOrTarget === ':document') eventTargets.push(currentWin.document);
65
- else if (selectorOrTarget === ':parentHost') {
63
+ if (selectorOrTarget === '$window') eventTargets.push(currentWin);
64
+ else if (selectorOrTarget === '$document') eventTargets.push(currentWin.document);
65
+ else if (selectorOrTarget === '$host') {
66
+ if (hostSet.$host) eventTargets.push(hostSet.$host);
67
+ } else if (selectorOrTarget === '$parentHost') {
66
68
  if (hostSet.$parentHost) eventTargets.push(hostSet.$parentHost);
67
- } else if (selectorOrTarget === ':appHost') {
69
+ } else if (selectorOrTarget === '$appHost') {
68
70
  if (hostSet.$appHost) eventTargets.push(hostSet.$appHost);
69
- } else if (selectorOrTarget === ':firstHost') {
71
+ } else if (selectorOrTarget === '$firstHost') {
70
72
  if (hostSet.$firstHost) eventTargets.push(hostSet.$firstHost);
71
- } else if (selectorOrTarget === ':lastHost') {
73
+ } else if (selectorOrTarget === '$lastHost') {
72
74
  if (hostSet.$lastHost) eventTargets.push(hostSet.$lastHost);
73
- } else if (selectorOrTarget === ':firstAppHost') {
75
+ } else if (selectorOrTarget === '$firstAppHost') {
74
76
  if (hostSet.$firstAppHost) eventTargets.push(hostSet.$firstAppHost);
75
- } else if (selectorOrTarget === ':lastAppHost') {
77
+ } else if (selectorOrTarget === '$lastAppHost') {
76
78
  if (hostSet.$lastAppHost) eventTargets.push(hostSet.$lastAppHost);
77
- } else if (selectorOrTarget === ':hosts') {
79
+ } else if (selectorOrTarget === '$hosts') {
78
80
  hostSet.$hosts.forEach(h => eventTargets.push(h));
79
- } else if (selectorOrTarget === ':appHosts') {
81
+ } else if (selectorOrTarget === '$appHosts') {
80
82
  hostSet.$appHosts.forEach(h => eventTargets.push(h));
81
- } else if (selectorOrTarget === ':host' || !selectorOrTarget) {
83
+ } else if (selectorOrTarget === '$this' || !selectorOrTarget) {
82
84
  eventTargets.push(this as any);
83
85
  } else {
84
86
  const r = fullOptions.root || 'auto';
@@ -121,27 +123,20 @@ export const getEmitCustomEventMetadataList = (target: any): EmitCustomEventMeta
121
123
  };
122
124
 
123
125
  /**
124
- * @emitCustomEventHost decorator - simplified version of @emitCustomEvent for :host selector
125
- * Usage: @emitCustomEventHost('navigate') // default attributeName: 'on-emit-navigate'
126
- * Usage: @emitCustomEventHost('navigate', { attributeName: 'on-navigate' })
127
- *
128
- * The attributeName option is used to automatically observe attributes for this event.
129
- * For example, { attributeName: 'on-navigate' } will add 'on-navigate' to observedAttributes.
126
+ * @emitCustomEventThis decorator - simplified version of @emitCustomEvent for $this selector
130
127
  */
131
- export function emitCustomEventHost(type: string, options: EmitCustomEventBaseOptions & SwcQueryOptions & { attributeName?: string }): MethodDecorator ;
132
- export function emitCustomEventHost(type: string, attributeName: string): MethodDecorator ;
133
- export function emitCustomEventHost(type: string): MethodDecorator;
134
- export function emitCustomEventHost(type: string, optionsOrAttributeaName?: string | (EmitCustomEventBaseOptions & SwcQueryOptions & { attributeName?: string })): MethodDecorator {
128
+ export function emitCustomEventThis(type: string, options: EmitCustomEventBaseOptions & SwcQueryOptions & { attributeName?: string }): MethodDecorator ;
129
+ export function emitCustomEventThis(type: string, attributeName: string): MethodDecorator ;
130
+ export function emitCustomEventThis(type: string): MethodDecorator;
131
+ export function emitCustomEventThis(type: string, optionsOrAttributeaName?: string | (EmitCustomEventBaseOptions & SwcQueryOptions & { attributeName?: string })): MethodDecorator {
135
132
  if (optionsOrAttributeaName && typeof optionsOrAttributeaName === 'string') {
136
- return emitCustomEventHost(type, {attributeName: optionsOrAttributeaName});
133
+ return emitCustomEventThis(type, {attributeName: optionsOrAttributeaName});
137
134
  } else if (optionsOrAttributeaName && typeof optionsOrAttributeaName === 'object') {
138
135
  if (!optionsOrAttributeaName.attributeName) {
139
136
  optionsOrAttributeaName.attributeName = `on-emit-${type}`;
140
137
  }
141
- return emitCustomEvent(':host', type, optionsOrAttributeaName);
138
+ return emitCustomEvent('$this', type, optionsOrAttributeaName);
142
139
  } else {
143
- return emitCustomEvent(':host', type, {attributeName: `on-emit-${type}`});
140
+ return emitCustomEvent('$this', type, {attributeName: `on-emit-${type}`});
144
141
  }
145
-
146
-
147
142
  }
@@ -1,7 +1,7 @@
1
1
  export * from './addEventListener';
2
2
  export * from './attribute';
3
3
  export * from './elementDefine';
4
- export * from './changedAttributeHost';
4
+ export * from './changedAttributeThis';
5
5
  export * from './emitCustomEvent';
6
6
  export * from './applyNode';
7
7
  export * from './lifecycles';
@@ -14,3 +14,4 @@ export * from './setProperty';
14
14
  export * from './subscribeSwcAppRouteChangeWhileConnected';
15
15
  export * from './subscribeSwcAppMessageWhileConnected';
16
16
  export * from './publishSwcAppMessage';
17
+ export * from './applySlot';