@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
@@ -8,21 +8,76 @@ export const ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for('simple-web-compone
8
8
  export const ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-adopted');
9
9
  export const ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-adopted');
10
10
  export const ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:on-add-event-listener');
11
+ export const ON_CONNECTED_INNER_HTML_METADATA_KEY = Symbol.for('simple-web-component:inner-html');
11
12
  export const ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for('simple-web-component:on-connected-swc-app');
12
- export const INNER_HTML_METADATA_KEY = Symbol.for('simple-web-component:inner-html');
13
+ export const ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for('simple-web-component:on-completed');
13
14
 
14
15
  export const ATTRIBUTE_CHANGED_WILDCARD = '*';
15
16
 
16
17
  export interface InnerHtmlOptions {
18
+ ssrFirst?: boolean;
17
19
  replaceWrap?:{ start: string, end:string},
18
20
  useShadow?: boolean;
19
21
  }
20
-
21
22
  export interface InnerHtmlMetadata {
22
23
  propertyKey: string | symbol;
23
24
  options: InnerHtmlOptions;
24
25
  }
25
26
 
27
+ export interface OnConnectedOptions {
28
+ ssrFirst?: boolean;
29
+ }
30
+ export interface OnConnectedMetadata {
31
+ propertyKey: string | symbol;
32
+ options: OnConnectedOptions;
33
+ }
34
+
35
+
36
+ export function onConnectedBefore(options: OnConnectedOptions): MethodDecorator;
37
+ export function onConnectedBefore(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
38
+ export function onConnectedBefore(arg1?: OnConnectedOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {
39
+ const decorator = (options: OnConnectedOptions, target: Object, propertyKey: string | symbol) => {
40
+ const constructor = target.constructor;
41
+ let list = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);
42
+ if (!list) {
43
+ list = [];
44
+ ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);
45
+ }
46
+ list.push({ propertyKey, options });
47
+ };
48
+
49
+ if (arg2) {
50
+ return decorator({}, arg1!, arg2);
51
+ }
52
+
53
+ return (target: Object, propertyKey: string | symbol) => {
54
+ decorator((arg1 as OnConnectedOptions) || {}, target, propertyKey);
55
+ };
56
+ }
57
+
58
+ export function onConnectedAfter(options: OnConnectedOptions): MethodDecorator;
59
+ export function onConnectedAfter(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
60
+ export function onConnectedAfter(arg1?: OnConnectedOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {
61
+ const decorator = (options: OnConnectedOptions, target: Object, propertyKey: string | symbol) => {
62
+ const constructor = target.constructor;
63
+ let list = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_AFTER_CONNECTED_METADATA_KEY, constructor);
64
+ if (!list) {
65
+ list = [];
66
+ ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);
67
+ }
68
+ list.push({ propertyKey, options });
69
+ };
70
+
71
+ if (arg2) {
72
+ return decorator({}, arg1!, arg2);
73
+ }
74
+
75
+ return (target: Object, propertyKey: string | symbol) => {
76
+ decorator((arg1 as OnConnectedOptions) || {}, target, propertyKey);
77
+ };
78
+ }
79
+
80
+
26
81
  function createLifecycleDecorator(metadataKey: symbol): MethodDecorator {
27
82
  return (target: Object, propertyKey: string | symbol) => {
28
83
  const constructor = target.constructor;
@@ -36,8 +91,8 @@ function createLifecycleDecorator(metadataKey: symbol): MethodDecorator {
36
91
  }
37
92
 
38
93
  export const onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
39
- export const onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
40
- export const onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
94
+ // export const onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
95
+ // export const onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
41
96
  export const onConnected = onConnectedAfter;
42
97
 
43
98
  export const onDisconnectedBefore = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
@@ -50,7 +105,8 @@ export const onAdopted = onAdoptedAfter;
50
105
 
51
106
  export const onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
52
107
 
53
- // export const onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
108
+ export const onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
109
+ export const onConnectedCompleted = createLifecycleDecorator(ON_CONNECTED_COMPLETED_METADATA_KEY);
54
110
 
55
111
  /**
56
112
  * @onConnectedInnerHtml decorator to define the initial HTML content when connected.
@@ -60,10 +116,10 @@ export function onConnectedInnerHtml(target: Object, propertyKey: string | symbo
60
116
  export function onConnectedInnerHtml(arg1?: InnerHtmlOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {
61
117
  const decorator = (options: InnerHtmlOptions, target: Object, propertyKey: string | symbol) => {
62
118
  const constructor = target.constructor;
63
- let list = ReflectUtils.getMetadata<InnerHtmlMetadata[]>(INNER_HTML_METADATA_KEY, constructor);
119
+ let list = ReflectUtils.getMetadata<InnerHtmlMetadata[]>(ON_CONNECTED_INNER_HTML_METADATA_KEY, constructor);
64
120
  if (!list) {
65
121
  list = [];
66
- ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
122
+ ReflectUtils.defineMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, list, constructor);
67
123
  }
68
124
  list.push({ propertyKey, options });
69
125
  };
@@ -80,12 +136,21 @@ export function onConnectedInnerHtml(arg1?: InnerHtmlOptions | Object, arg2?: st
80
136
  /**
81
137
  * 프로토타입 체인을 순회하며 모든 라이프사이클 메서드를 수집합니다.
82
138
  */
83
- export const findAllLifecycleMetadata = <T = (string | symbol)[]>(target: any, metadataKey: symbol): T | undefined => {
139
+ // export const findAllLifecycleMetadata = <T = (string | symbol)[]>(target: any, metadataKey: symbol): T | undefined => {
140
+ export const findAllLifecycleMetadata = (target: any, metadataKey: symbol): (string | symbol)[] => {
84
141
  const results = ReflectUtils.findAllMetadataFlatten(metadataKey, target);
85
- return results.length > 0 ? (results as unknown as T) : undefined;
142
+ return results;
86
143
  };
87
144
 
88
- export const getOnConnectedInnerHtmlMetadata = (target: any): InnerHtmlMetadata[] | undefined => {
145
+ export const getOnConnectedInnerHtmlMetadata = (target: any): InnerHtmlMetadata[] => {
146
+ const constructor = target instanceof Function ? target : target.constructor;
147
+ return ReflectUtils.getMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, constructor) ?? [];
148
+ };
149
+ export const getOnConnectedBeforeMetadata = (target: any): OnConnectedMetadata[] => {
150
+ const constructor = target instanceof Function ? target : target.constructor;
151
+ return ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
152
+ };
153
+ export const getOnConnectedAfterMetadata = (target: any): OnConnectedMetadata[] => {
89
154
  const constructor = target instanceof Function ? target : target.constructor;
90
- return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
155
+ return ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
91
156
  };
@@ -30,8 +30,6 @@ export function query(selectorOrTarget: string, options: any = {}): PropertyDeco
30
30
  }
31
31
  queries.push({ propertyKey, selector: selectorOrTarget, options });
32
32
 
33
- // const propertyType = Reflect.getMetadata("design:type", targetObj, propertyKey);
34
- // console.log(`Property ${String(propertyKey)} type is:`, propertyType.name);
35
33
  Object.defineProperty(targetObj, propertyKey, {
36
34
  get(this: HTMLElement) {
37
35
  ensureInit(this);
@@ -43,25 +41,26 @@ export function query(selectorOrTarget: string, options: any = {}): PropertyDeco
43
41
  if (r === 'auto') return t.shadowRoot || t;
44
42
  if (r === 'shadow') return t.shadowRoot;
45
43
  if (r === 'light') return t;
46
- if (r === 'all') return t.shadowRoot || t; // query only returns one, so shadow preferred
44
+ if (r === 'all') return t.shadowRoot || t;
47
45
  return t;
48
46
  };
49
47
 
50
48
  // --- Special Selectors: HostSet ---
51
49
  const hostSet = SwcUtils.getHostSet(this);
52
- if (selector === ':parentHost') return applyRoot(hostSet.$parentHost);
53
- if (selector === ':appHost') return applyRoot(hostSet.$appHost);
54
- if (selector === ':firstHost') return applyRoot(hostSet.$firstHost);
55
- if (selector === ':lastHost') return applyRoot(hostSet.$lastHost);
56
- if (selector === ':firstAppHost') return applyRoot(hostSet.$firstAppHost);
57
- if (selector === ':lastAppHost') return applyRoot(hostSet.$lastAppHost);
50
+ if (selector === '$this') return applyRoot(this);
51
+ if (selector === '$host') return applyRoot(hostSet.$host);
52
+ if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);
53
+ if (selector === '$appHost') return applyRoot(hostSet.$appHost);
54
+ if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);
55
+ if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);
56
+ if (selector === '$firstAppHost') return applyRoot(hostSet.$firstAppHost);
57
+ if (selector === '$lastAppHost') return applyRoot(hostSet.$lastAppHost);
58
58
 
59
59
  // --- Special Selectors: Env ---
60
60
  const config = getElementConfig(this);
61
61
  const win = config?.window || window;
62
- if (selector === ':window') return win;
63
- if (selector === ':document') return win.document;
64
- if (selector === ':host') return applyRoot(this);
62
+ if (selector === '$window') return win;
63
+ if (selector === '$document') return win.document;
65
64
 
66
65
  // --- Standard Selectors ---
67
66
  if (r === 'shadow') return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
@@ -76,7 +75,7 @@ export function query(selectorOrTarget: string, options: any = {}): PropertyDeco
76
75
  ensureInit(this);
77
76
  if (nv === null || nv === undefined) {
78
77
  const selector = selectorOrTarget;
79
- if (selector.startsWith(':') && selector !== ':host') return;
78
+ if (selector.startsWith('$') && selector !== '$this') return;
80
79
 
81
80
  const r = options.root || 'auto';
82
81
  const targets: Element[] = [];
@@ -103,157 +102,85 @@ export function query(selectorOrTarget: string, options: any = {}): PropertyDeco
103
102
  }
104
103
 
105
104
  /**
106
- * @queryHost decorator - simplified version of @query for :host selector
107
- * Usage: @queryHost testzzs: HTMLElement | undefined;
108
- * Usage: @queryHost() testzzs: HTMLElement | undefined;
109
- * Usage: @queryHost({ root: 'shadow' }) testzzs: HTMLElement | undefined;
105
+ * @queryThis decorator - simplified version of @query for $this selector
110
106
  */
111
- export function queryHost(target: Object, propertyKey: string | symbol): void;
112
- export function queryHost(): PropertyDecorator;
113
- export function queryHost(options: SwcQueryOptions): PropertyDecorator;
114
- export function queryHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
115
- // Direct decorator usage: @queryHost (no parentheses)
116
- if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
117
- return query(':host', {})(targetOrOptions, propertyKey);
118
- }
119
-
120
- // @queryHost() or @queryHost(options)
121
- if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
122
- return query(':host', targetOrOptions as SwcQueryOptions);
123
- } else {
124
- return query(':host', {});
125
- }
126
- }
127
-
128
- /**
129
- * @host - Alias for @queryHost decorator
130
- * Usage: @host element: HTMLElement | undefined;
131
- * Usage: @host() element: HTMLElement | undefined;
132
- * Usage: @host({ root: 'shadow' }) element: HTMLElement | undefined;
133
- */
134
- export const host = queryHost;
135
-
136
- /**
137
- * @parentHost - Query :parentHost (Direct parent SWC component)
138
- * Usage: @parentHost parent: HTMLElement | undefined;
139
- * Usage: @parentHost() parent: HTMLElement | undefined;
140
- * Usage: @parentHost({ root: 'shadow' }) parent: HTMLElement | undefined;
141
- */
142
- export function parentHost(target: Object, propertyKey: string | symbol): void;
143
- export function parentHost(): PropertyDecorator;
144
- export function parentHost(options: SwcQueryOptions): PropertyDecorator;
145
- export function parentHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
107
+ export function queryThis(target: Object, propertyKey: string | symbol): void;
108
+ export function queryThis(): PropertyDecorator;
109
+ export function queryThis(options: SwcQueryOptions): PropertyDecorator;
110
+ export function queryThis(targetOrOptions?: any, propertyKey?: string | symbol): any {
146
111
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
147
- return query(':parentHost', {})(targetOrOptions, propertyKey);
112
+ return query('$this', {})(targetOrOptions, propertyKey);
148
113
  }
149
114
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
150
- return query(':parentHost', targetOrOptions as SwcQueryOptions);
115
+ return query('$this', targetOrOptions as SwcQueryOptions);
151
116
  } else {
152
- return query(':parentHost', {});
117
+ return query('$this', {});
153
118
  }
154
119
  }
155
120
 
156
- /**
157
- * @appHost - Query :appHost (Nearest <swc-app>)
158
- * Usage: @appHost app: SwcAppInterface | undefined;
159
- * Usage: @appHost() app: SwcAppInterface | undefined;
160
- * Usage: @appHost({ root: 'shadow' }) app: SwcAppInterface | undefined;
161
- */
162
- export function appHost(target: Object, propertyKey: string | symbol): void;
163
- export function appHost(): PropertyDecorator;
164
- export function appHost(options: SwcQueryOptions): PropertyDecorator;
165
- export function appHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
166
- if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
167
- return query(':appHost', {})(targetOrOptions, propertyKey);
168
- }
169
- if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
170
- return query(':appHost', targetOrOptions as SwcQueryOptions);
171
- } else {
172
- return query(':appHost', {});
173
- }
174
- }
175
121
 
176
- /**
177
- * @firstHost - Query :firstHost (First component in hierarchy)
178
- * Usage: @firstHost first: HTMLElement | undefined;
179
- * Usage: @firstHost() first: HTMLElement | undefined;
180
- * Usage: @firstHost({ root: 'shadow' }) first: HTMLElement | undefined;
181
- */
182
- export function firstHost(target: Object, propertyKey: string | symbol): void;
183
- export function firstHost(): PropertyDecorator;
184
- export function firstHost(options: SwcQueryOptions): PropertyDecorator;
185
- export function firstHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
122
+ export function queryWindow(target: Object, propertyKey: string | symbol): void;
123
+ export function queryWindow(): PropertyDecorator;
124
+ export function queryWindow(options: SwcQueryOptions): PropertyDecorator;
125
+ export function queryWindow(targetOrOptions?: any, propertyKey?: string | symbol): any {
186
126
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
187
- return query(':firstHost', {})(targetOrOptions, propertyKey);
127
+ return query('$window', {})(targetOrOptions, propertyKey);
188
128
  }
189
129
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
190
- return query(':firstHost', targetOrOptions as SwcQueryOptions);
130
+ return query('$window', targetOrOptions as SwcQueryOptions);
191
131
  } else {
192
- return query(':firstHost', {});
132
+ return query('$window', {});
193
133
  }
194
134
  }
195
135
 
196
- /**
197
- * @lastHost - Query :lastHost (Last component in hierarchy)
198
- * Usage: @lastHost last: HTMLElement | undefined;
199
- * Usage: @lastHost() last: HTMLElement | undefined;
200
- * Usage: @lastHost({ root: 'shadow' }) last: HTMLElement | undefined;
201
- */
202
- export function lastHost(target: Object, propertyKey: string | symbol): void;
203
- export function lastHost(): PropertyDecorator;
204
- export function lastHost(options: SwcQueryOptions): PropertyDecorator;
205
- export function lastHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
136
+ export function queryDocument(target: Object, propertyKey: string | symbol): void;
137
+ export function queryDocument(): PropertyDecorator;
138
+ export function queryDocument(options: SwcQueryOptions): PropertyDecorator;
139
+ export function queryDocument(targetOrOptions?: any, propertyKey?: string | symbol): any {
206
140
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
207
- return query(':lastHost', {})(targetOrOptions, propertyKey);
141
+ return query('$document', {})(targetOrOptions, propertyKey);
208
142
  }
209
143
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
210
- return query(':lastHost', targetOrOptions as SwcQueryOptions);
144
+ return query('$document', targetOrOptions as SwcQueryOptions);
211
145
  } else {
212
- return query(':lastHost', {});
146
+ return query('$document', {});
213
147
  }
214
148
  }
215
-
216
149
  /**
217
- * @firstAppHost - Query :firstAppHost (First <swc-app> in hierarchy)
218
- * Usage: @firstAppHost app: SwcAppInterface | undefined;
219
- * Usage: @firstAppHost() app: SwcAppInterface | undefined;
220
- * Usage: @firstAppHost({ root: 'shadow' }) app: SwcAppInterface | undefined;
150
+ * @host - Query $host (Direct parent SWC component)
221
151
  */
222
- export function firstAppHost(target: Object, propertyKey: string | symbol): void;
223
- export function firstAppHost(): PropertyDecorator;
224
- export function firstAppHost(options: SwcQueryOptions): PropertyDecorator;
225
- export function firstAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
152
+ export function queryHost(target: Object, propertyKey: string | symbol): void;
153
+ export function queryHost(): PropertyDecorator;
154
+ export function queryHost(options: SwcQueryOptions): PropertyDecorator;
155
+ export function queryHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
226
156
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
227
- return query(':firstAppHost', {})(targetOrOptions, propertyKey);
157
+ return query('$host', {})(targetOrOptions, propertyKey);
228
158
  }
229
159
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
230
- return query(':firstAppHost', targetOrOptions as SwcQueryOptions);
160
+ return query('$host', targetOrOptions as SwcQueryOptions);
231
161
  } else {
232
- return query(':firstAppHost', {});
162
+ return query('$host', {});
233
163
  }
234
164
  }
235
165
 
236
166
  /**
237
- * @lastAppHost - Query :lastAppHost (Last <swc-app> in hierarchy)
238
- * Usage: @lastAppHost app: SwcAppInterface | undefined;
239
- * Usage: @lastAppHost() app: SwcAppInterface | undefined;
240
- * Usage: @lastAppHost({ root: 'shadow' }) app: SwcAppInterface | undefined;
167
+ * @appHost - Query $appHost (Nearest <swc-app>)
241
168
  */
242
- export function lastAppHost(target: Object, propertyKey: string | symbol): void;
243
- export function lastAppHost(): PropertyDecorator;
244
- export function lastAppHost(options: SwcQueryOptions): PropertyDecorator;
245
- export function lastAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
169
+ export function queryAppHost(target: Object, propertyKey: string | symbol): void;
170
+ export function queryAppHost(): PropertyDecorator;
171
+ export function queryAppHost(options: SwcQueryOptions): PropertyDecorator;
172
+ export function queryAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
246
173
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
247
- return query(':lastAppHost', {})(targetOrOptions, propertyKey);
174
+ return query('$appHost', {})(targetOrOptions, propertyKey);
248
175
  }
249
176
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
250
- return query(':lastAppHost', targetOrOptions as SwcQueryOptions);
177
+ return query('$appHost', targetOrOptions as SwcQueryOptions);
251
178
  } else {
252
- return query(':lastAppHost', {});
179
+ return query('$appHost', {});
253
180
  }
254
181
  }
255
182
 
256
183
  export const getQueryMetadata = (target: any): QueryMetadata[] | undefined => {
257
184
  const constructor = target instanceof Function ? target : target.constructor;
258
185
  return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
259
- };
186
+ };
@@ -56,15 +56,22 @@ export function queryAll(selectorOrTarget: string, options: any = {}): PropertyD
56
56
 
57
57
  // --- Special Selectors: HostSet ---
58
58
  const hostSet = SwcUtils.getHostSet(this);
59
- if (selector === ':hosts') return applyRoot(hostSet.$hosts);
60
- if (selector === ':appHosts') return applyRoot(hostSet.$appHosts);
59
+ if (selector === '$hosts') return applyRoot(hostSet.$hosts);
60
+ if (selector === '$appHosts') return applyRoot(hostSet.$appHosts);
61
+ if (selector === '$host') return applyRoot(hostSet.$host);
62
+ if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);
63
+ if (selector === '$appHost') return applyRoot(hostSet.$appHost);
64
+ if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);
65
+ if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);
66
+ if (selector === '$firstAppHost') return applyRoot(hostSet.$firstAppHost);
67
+ if (selector === '$lastAppHost') return applyRoot(hostSet.$lastAppHost);
61
68
 
62
69
  // --- Special Selectors: Env ---
63
70
  const config = getElementConfig(this);
64
71
  const win = config?.window || window;
65
- if (selector === ':window') return [win];
66
- if (selector === ':document') return [win.document];
67
- if (selector === ':host') return applyRoot(this);
72
+ if (selector === '$window') return [win];
73
+ if (selector === '$document') return [win.document];
74
+ if (selector === '$this') return applyRoot(this);
68
75
 
69
76
  // --- Standard Selectors ---
70
77
  if (r === 'shadow') return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
@@ -81,7 +88,7 @@ export function queryAll(selectorOrTarget: string, options: any = {}): PropertyD
81
88
  ensureInit(this);
82
89
  if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {
83
90
  const selector = selectorOrTarget;
84
- if (selector.startsWith(':') && selector !== ':host') return;
91
+ if (selector.startsWith('$') && selector !== '$this') return;
85
92
 
86
93
  const r = options.root || 'auto';
87
94
  let targets: (Element | Node)[] = [];
@@ -102,164 +109,60 @@ export function queryAll(selectorOrTarget: string, options: any = {}): PropertyD
102
109
  });
103
110
  };
104
111
  }
112
+
105
113
  /**
106
- * @hostQueryAll decorator - simplified version of @queryAll for :host selector
107
- * Usage: @hostQueryAll()
108
- * Usage: @hostQueryAll({ root: 'shadow' })
109
- */
110
- /**
111
- * @queryAllHost decorator - simplified version of @queryAll for :host selector
112
- * Usage: @queryAllHost items: HTMLElement[];
113
- * Usage: @queryAllHost() items: HTMLElement[];
114
- * Usage: @queryAllHost({ root: 'shadow' }) items: HTMLElement[];
114
+ * @queryAllThis decorator - simplified version of @queryAll for $this selector
115
115
  */
116
- export function queryAllHost(target: Object, propertyKey: string | symbol): void;
117
- export function queryAllHost(): PropertyDecorator;
118
- export function queryAllHost(options: SwcQueryOptions): PropertyDecorator;
119
- export function queryAllHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
120
- // Direct decorator usage: @queryAllHost (no parentheses)
116
+ export function queryAllThis(target: Object, propertyKey: string | symbol): void;
117
+ export function queryAllThis(): PropertyDecorator;
118
+ export function queryAllThis(options: SwcQueryOptions): PropertyDecorator;
119
+ export function queryAllThis(targetOrOptions?: any, propertyKey?: string | symbol): any {
121
120
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
122
- return queryAll(':host', {})(targetOrOptions, propertyKey);
121
+ return queryAll('$this', {})(targetOrOptions, propertyKey);
123
122
  }
124
123
 
125
- // @queryAllHost() or @queryAllHost(options)
126
124
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
127
- return queryAll(':host', targetOrOptions as SwcQueryOptions);
125
+ return queryAll('$this', targetOrOptions as SwcQueryOptions);
128
126
  } else {
129
- return queryAll(':host', {});
127
+ return queryAll('$this', {});
130
128
  }
131
129
  }
132
130
 
133
131
  /**
134
- * @allHost - Alias for @queryAllHost decorator
135
- * Usage: @allHost items: HTMLElement[];
136
- * Usage: @allHost() items: HTMLElement[];
137
- * Usage: @allHost({ root: 'shadow' }) items: HTMLElement[];
138
- */
139
- export const allHost = queryAllHost;
140
- /**
141
- * @allParentHost - Query all :parentHost (All parent SWC components)
142
- * Usage: @allParentHost parents: HTMLElement[];
143
- * Usage: @allParentHost() parents: HTMLElement[];
144
- * Usage: @allParentHost({ root: 'shadow' }) parents: HTMLElement[];
132
+ * @allParentHost - Query all parent SWC components
145
133
  */
146
134
  export function allParentHost(target: Object, propertyKey: string | symbol): void;
147
135
  export function allParentHost(): PropertyDecorator;
148
136
  export function allParentHost(options: SwcQueryOptions): PropertyDecorator;
149
137
  export function allParentHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
150
138
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
151
- return queryAll(':parentHost', {})(targetOrOptions, propertyKey);
139
+ return queryAll('$host', {})(targetOrOptions, propertyKey);
152
140
  }
153
141
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
154
- return queryAll(':parentHost', targetOrOptions as SwcQueryOptions);
142
+ return queryAll('$host', targetOrOptions as SwcQueryOptions);
155
143
  } else {
156
- return queryAll(':parentHost', {});
144
+ return queryAll('$host', {});
157
145
  }
158
146
  }
159
147
 
160
148
  /**
161
- * @allAppHost - Query all :appHost (All <swc-app> instances)
162
- * Usage: @allAppHost apps: SwcAppInterface[];
163
- * Usage: @allAppHost() apps: SwcAppInterface[];
164
- * Usage: @allAppHost({ root: 'shadow' }) apps: SwcAppInterface[];
149
+ * @allAppHost - Query all $appHost (All <swc-app> instances)
165
150
  */
166
151
  export function allAppHost(target: Object, propertyKey: string | symbol): void;
167
152
  export function allAppHost(): PropertyDecorator;
168
153
  export function allAppHost(options: SwcQueryOptions): PropertyDecorator;
169
154
  export function allAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
170
155
  if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
171
- return queryAll(':appHost', {})(targetOrOptions, propertyKey);
172
- }
173
- if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
174
- return queryAll(':appHost', targetOrOptions as SwcQueryOptions);
175
- } else {
176
- return queryAll(':appHost', {});
177
- }
178
- }
179
-
180
- /**
181
- * @allFirstHost - Query all :firstHost (All first components in hierarchy)
182
- * Usage: @allFirstHost firsts: HTMLElement[];
183
- * Usage: @allFirstHost() firsts: HTMLElement[];
184
- * Usage: @allFirstHost({ root: 'shadow' }) firsts: HTMLElement[];
185
- */
186
- export function allFirstHost(target: Object, propertyKey: string | symbol): void;
187
- export function allFirstHost(): PropertyDecorator;
188
- export function allFirstHost(options: SwcQueryOptions): PropertyDecorator;
189
- export function allFirstHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
190
- if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
191
- return queryAll(':firstHost', {})(targetOrOptions, propertyKey);
156
+ return queryAll('$appHost', {})(targetOrOptions, propertyKey);
192
157
  }
193
158
  if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
194
- return queryAll(':firstHost', targetOrOptions as SwcQueryOptions);
159
+ return queryAll('$appHost', targetOrOptions as SwcQueryOptions);
195
160
  } else {
196
- return queryAll(':firstHost', {});
161
+ return queryAll('$appHost', {});
197
162
  }
198
163
  }
199
164
 
200
- /**
201
- * @allLastHost - Query all :lastHost (All last components in hierarchy)
202
- * Usage: @allLastHost lasts: HTMLElement[];
203
- * Usage: @allLastHost() lasts: HTMLElement[];
204
- * Usage: @allLastHost({ root: 'shadow' }) lasts: HTMLElement[];
205
- */
206
- export function allLastHost(target: Object, propertyKey: string | symbol): void;
207
- export function allLastHost(): PropertyDecorator;
208
- export function allLastHost(options: SwcQueryOptions): PropertyDecorator;
209
- export function allLastHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
210
- if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
211
- return queryAll(':lastHost', {})(targetOrOptions, propertyKey);
212
- }
213
- if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
214
- return queryAll(':lastHost', targetOrOptions as SwcQueryOptions);
215
- } else {
216
- return queryAll(':lastHost', {});
217
- }
218
- }
219
-
220
- /**
221
- * @allFirstAppHost - Query all :firstAppHost (All first <swc-app> in hierarchy)
222
- * Usage: @allFirstAppHost apps: SwcAppInterface[];
223
- * Usage: @allFirstAppHost() apps: SwcAppInterface[];
224
- * Usage: @allFirstAppHost({ root: 'shadow' }) apps: SwcAppInterface[];
225
- */
226
- export function allFirstAppHost(target: Object, propertyKey: string | symbol): void;
227
- export function allFirstAppHost(): PropertyDecorator;
228
- export function allFirstAppHost(options: SwcQueryOptions): PropertyDecorator;
229
- export function allFirstAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
230
- if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
231
- return queryAll(':firstAppHost', {})(targetOrOptions, propertyKey);
232
- }
233
- if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
234
- return queryAll(':firstAppHost', targetOrOptions as SwcQueryOptions);
235
- } else {
236
- return queryAll(':firstAppHost', {});
237
- }
238
- }
239
-
240
- /**
241
- * @allLastAppHost - Query all :lastAppHost (All last <swc-app> in hierarchy)
242
- * Usage: @allLastAppHost apps: SwcAppInterface[];
243
- * Usage: @allLastAppHost() apps: SwcAppInterface[];
244
- * Usage: @allLastAppHost({ root: 'shadow' }) apps: SwcAppInterface[];
245
- */
246
- export function allLastAppHost(target: Object, propertyKey: string | symbol): void;
247
- export function allLastAppHost(): PropertyDecorator;
248
- export function allLastAppHost(options: SwcQueryOptions): PropertyDecorator;
249
- export function allLastAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {
250
- if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {
251
- return queryAll(':lastAppHost', {})(targetOrOptions, propertyKey);
252
- }
253
- if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {
254
- return queryAll(':lastAppHost', targetOrOptions as SwcQueryOptions);
255
- } else {
256
- return queryAll(':lastAppHost', {});
257
- }
258
- }
259
-
260
-
261
165
  export const getQueryAllMetadata = (target: any): QueryAllMetadata[] | undefined => {
262
166
  const constructor = target instanceof Function ? target : target.constructor;
263
167
  return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
264
168
  };
265
-
@@ -56,15 +56,16 @@ export const setProperty = (selector: string, propertyNameOrOptions?: string | P
56
56
  targetEls.push(t);
57
57
  };
58
58
 
59
- if (selector === ':parentHost') applyRoot(hostSet.$parentHost);
60
- else if (selector === ':appHost') applyRoot(hostSet.$appHost);
61
- else if (selector === ':firstHost') applyRoot(hostSet.$firstHost);
62
- else if (selector === ':lastHost') applyRoot(hostSet.$lastHost);
63
- else if (selector === ':firstAppHost') applyRoot(hostSet.$firstAppHost);
64
- else if (selector === ':lastAppHost') applyRoot(hostSet.$lastAppHost);
65
- else if (selector === ':hosts') hostSet.$hosts.forEach(applyRoot);
66
- else if (selector === ':appHosts') hostSet.$appHosts.forEach(applyRoot);
67
- else if (selector === ':host' || !selector) applyRoot(host);
59
+ if (selector === '$this' || !selector) applyRoot(host);
60
+ else if (selector === '$host') applyRoot(hostSet.$host);
61
+ else if (selector === '$parentHost') applyRoot(hostSet.$parentHost);
62
+ else if (selector === '$appHost') applyRoot(hostSet.$appHost);
63
+ else if (selector === '$firstHost') applyRoot(hostSet.$firstHost);
64
+ else if (selector === '$lastHost') applyRoot(hostSet.$lastHost);
65
+ else if (selector === '$firstAppHost') applyRoot(hostSet.$firstAppHost);
66
+ else if (selector === '$lastAppHost') applyRoot(hostSet.$lastAppHost);
67
+ else if (selector === '$hosts') hostSet.$hosts.forEach(applyRoot);
68
+ else if (selector === '$appHosts') hostSet.$appHosts.forEach(applyRoot);
68
69
  else {
69
70
  const targetRoot = r === 'auto' ? (host.shadowRoot || host) : (r === 'shadow' ? host.shadowRoot : host);
70
71
  if (targetRoot) {
@@ -106,6 +107,6 @@ export const setProperty = (selector: string, propertyNameOrOptions?: string | P
106
107
  };
107
108
  };
108
109
 
109
- export const setPropertyHost = (propertyNameOrOptions?: string | PropertySetOptions, options: PropertySetOptions = {}): MethodDecorator => {
110
- return setProperty(':host', propertyNameOrOptions, options);
110
+ export const setPropertyThis = (propertyNameOrOptions?: string | PropertySetOptions, options: PropertySetOptions = {}): MethodDecorator => {
111
+ return setProperty('$this', propertyNameOrOptions, options);
111
112
  };