@dooboostore/simple-web-component 1.0.34 → 1.0.36

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 (170) hide show
  1. package/README.md +44 -51
  2. package/dist/cjs/decorators/addEventListener.js +12 -4
  3. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +19 -18
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyClass.js +23 -22
  7. package/dist/cjs/decorators/applyClass.js.map +2 -2
  8. package/dist/cjs/decorators/applyNode.js +22 -17
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applyStyle.js +20 -19
  11. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  12. package/dist/cjs/decorators/attribute.js +17 -16
  13. package/dist/cjs/decorators/attribute.js.map +2 -2
  14. package/dist/cjs/decorators/{changedAttributeHost.js → changedAttributeThis.js} +6 -6
  15. package/dist/cjs/decorators/changedAttributeThis.js.map +7 -0
  16. package/dist/cjs/decorators/elementDefine.js +234 -188
  17. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  18. package/dist/cjs/decorators/emitCustomEvent.js +24 -16
  19. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  20. package/dist/cjs/decorators/index.js +1 -1
  21. package/dist/cjs/decorators/index.js.map +1 -1
  22. package/dist/cjs/decorators/lifecycles.js +15 -17
  23. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  24. package/dist/cjs/decorators/query.js +38 -60
  25. package/dist/cjs/decorators/query.js.map +2 -2
  26. package/dist/cjs/decorators/queryAll.js +31 -63
  27. package/dist/cjs/decorators/queryAll.js.map +2 -2
  28. package/dist/cjs/decorators/setProperty.js +13 -12
  29. package/dist/cjs/decorators/setProperty.js.map +2 -2
  30. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
  31. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  32. package/dist/cjs/elements/SwcAppEngine.js +8 -2
  33. package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
  34. package/dist/cjs/elements/SwcAppMixin.js +120 -65
  35. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  36. package/dist/cjs/elements/SwcAsync.js +31 -21
  37. package/dist/cjs/elements/SwcAsync.js.map +2 -2
  38. package/dist/cjs/elements/SwcChoose.js +53 -34
  39. package/dist/cjs/elements/SwcChoose.js.map +2 -2
  40. package/dist/cjs/elements/SwcIf.js +54 -32
  41. package/dist/cjs/elements/SwcIf.js.map +2 -2
  42. package/dist/cjs/elements/SwcLoop.js +111 -37
  43. package/dist/cjs/elements/SwcLoop.js.map +2 -2
  44. package/dist/cjs/elements/register.js +249 -122
  45. package/dist/cjs/elements/register.js.map +2 -2
  46. package/dist/cjs/router/ElementRouter.js +4 -2
  47. package/dist/cjs/router/ElementRouter.js.map +1 -1
  48. package/dist/cjs/types.js.map +1 -1
  49. package/dist/cjs/utils/Utils.js +31 -17
  50. package/dist/cjs/utils/Utils.js.map +2 -2
  51. package/dist/esm/decorators/addEventListener.js +12 -4
  52. package/dist/esm/decorators/addEventListener.js.map +2 -2
  53. package/dist/esm/decorators/applyAttribute.js +19 -18
  54. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  55. package/dist/esm/decorators/applyClass.js +23 -22
  56. package/dist/esm/decorators/applyClass.js.map +2 -2
  57. package/dist/esm/decorators/applyNode.js +22 -17
  58. package/dist/esm/decorators/applyNode.js.map +2 -2
  59. package/dist/esm/decorators/applyStyle.js +20 -19
  60. package/dist/esm/decorators/applyStyle.js.map +2 -2
  61. package/dist/esm/decorators/attribute.js +17 -16
  62. package/dist/esm/decorators/attribute.js.map +2 -2
  63. package/dist/esm/decorators/{changedAttributeHost.js → changedAttributeThis.js} +3 -3
  64. package/dist/esm/decorators/changedAttributeThis.js.map +7 -0
  65. package/dist/esm/decorators/elementDefine.js +233 -187
  66. package/dist/esm/decorators/elementDefine.js.map +2 -2
  67. package/dist/esm/decorators/emitCustomEvent.js +24 -16
  68. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  69. package/dist/esm/decorators/index.js +1 -1
  70. package/dist/esm/decorators/index.js.map +1 -1
  71. package/dist/esm/decorators/lifecycles.js +15 -17
  72. package/dist/esm/decorators/lifecycles.js.map +2 -2
  73. package/dist/esm/decorators/query.js +38 -60
  74. package/dist/esm/decorators/query.js.map +2 -2
  75. package/dist/esm/decorators/queryAll.js +31 -63
  76. package/dist/esm/decorators/queryAll.js.map +2 -2
  77. package/dist/esm/decorators/setProperty.js +13 -12
  78. package/dist/esm/decorators/setProperty.js.map +2 -2
  79. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
  80. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  81. package/dist/esm/elements/SwcAppEngine.js +9 -2
  82. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  83. package/dist/esm/elements/SwcAppMixin.js +122 -66
  84. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  85. package/dist/esm/elements/SwcAsync.js +32 -22
  86. package/dist/esm/elements/SwcAsync.js.map +2 -2
  87. package/dist/esm/elements/SwcChoose.js +54 -35
  88. package/dist/esm/elements/SwcChoose.js.map +2 -2
  89. package/dist/esm/elements/SwcIf.js +55 -33
  90. package/dist/esm/elements/SwcIf.js.map +2 -2
  91. package/dist/esm/elements/SwcLoop.js +112 -38
  92. package/dist/esm/elements/SwcLoop.js.map +2 -2
  93. package/dist/esm/elements/register.js +250 -123
  94. package/dist/esm/elements/register.js.map +2 -2
  95. package/dist/esm/router/ElementRouter.js +5 -2
  96. package/dist/esm/router/ElementRouter.js.map +1 -1
  97. package/dist/esm/types.js.map +1 -1
  98. package/dist/esm/utils/Utils.js +31 -17
  99. package/dist/esm/utils/Utils.js.map +2 -2
  100. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +563 -557
  101. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  102. package/dist/types/decorators/addEventListener.d.ts +5 -7
  103. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  104. package/dist/types/decorators/applyAttribute.d.ts +4 -4
  105. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  106. package/dist/types/decorators/applyClass.d.ts +6 -6
  107. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  108. package/dist/types/decorators/applyNode.d.ts +7 -6
  109. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  110. package/dist/types/decorators/applyStyle.d.ts +4 -4
  111. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  112. package/dist/types/decorators/attribute.d.ts +5 -5
  113. package/dist/types/decorators/attribute.d.ts.map +1 -1
  114. package/dist/types/decorators/changedAttributeThis.d.ts +18 -0
  115. package/dist/types/decorators/changedAttributeThis.d.ts.map +1 -0
  116. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  117. package/dist/types/decorators/emitCustomEvent.d.ts +11 -12
  118. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  119. package/dist/types/decorators/index.d.ts +1 -1
  120. package/dist/types/decorators/lifecycles.d.ts +10 -7
  121. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  122. package/dist/types/decorators/query.d.ts +17 -63
  123. package/dist/types/decorators/query.d.ts.map +1 -1
  124. package/dist/types/decorators/queryAll.d.ts +6 -63
  125. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  126. package/dist/types/decorators/setProperty.d.ts +1 -1
  127. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  128. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +4 -5
  129. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  130. package/dist/types/elements/SwcAppEngine.d.ts +4 -1
  131. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  132. package/dist/types/elements/SwcAppMixin.d.ts +11 -8
  133. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  134. package/dist/types/elements/register.d.ts.map +1 -1
  135. package/dist/types/types.d.ts +3 -2
  136. package/dist/types/types.d.ts.map +1 -1
  137. package/dist/types/utils/Utils.d.ts +11 -8
  138. package/dist/types/utils/Utils.d.ts.map +1 -1
  139. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +563 -557
  140. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  141. package/package.json +3 -3
  142. package/src/decorators/addEventListener.ts +11 -9
  143. package/src/decorators/applyAttribute.ts +16 -15
  144. package/src/decorators/applyClass.ts +18 -17
  145. package/src/decorators/applyNode.ts +34 -21
  146. package/src/decorators/applyStyle.ts +17 -16
  147. package/src/decorators/attribute.ts +21 -20
  148. package/src/decorators/{changedAttributeHost.ts → changedAttributeThis.ts} +13 -14
  149. package/src/decorators/elementDefine.ts +402 -358
  150. package/src/decorators/emitCustomEvent.ts +40 -31
  151. package/src/decorators/index.ts +1 -1
  152. package/src/decorators/lifecycles.ts +11 -10
  153. package/src/decorators/query.ts +51 -124
  154. package/src/decorators/queryAll.ts +30 -127
  155. package/src/decorators/setProperty.ts +12 -11
  156. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +10 -10
  157. package/src/elements/SwcAppEngine.ts +10 -3
  158. package/src/elements/SwcAppMixin.ts +177 -97
  159. package/src/elements/SwcAsync.ts +32 -21
  160. package/src/elements/SwcChoose.ts +74 -37
  161. package/src/elements/SwcIf.ts +60 -23
  162. package/src/elements/SwcLoop.ts +141 -28
  163. package/src/elements/register.ts +300 -102
  164. package/src/types.ts +6 -5
  165. package/src/utils/Utils.ts +40 -23
  166. package/tsconfig.json +2 -2
  167. package/dist/cjs/decorators/changedAttributeHost.js.map +0 -7
  168. package/dist/esm/decorators/changedAttributeHost.js.map +0 -7
  169. package/dist/types/decorators/changedAttributeHost.d.ts +0 -19
  170. package/dist/types/decorators/changedAttributeHost.d.ts.map +0 -1
@@ -5727,6 +5727,11 @@ var Expression;
5727
5727
  })(Expression || (Expression = {}));
5728
5728
 
5729
5729
  // ../core/dist/esm/expression/ActionExpression.js
5730
+ var DEFAULT_EXPRESSION_CONFIG = {
5731
+ "callReturn": { start: "{{=", end: "}}" },
5732
+ "call": { start: "{{@", end: "}}" },
5733
+ "replace": { start: "{{", end: "}}" }
5734
+ };
5730
5735
  var ActionExpression = class {
5731
5736
  constructor(value, config) {
5732
5737
  this.originalTemplate = value || "";
@@ -5740,12 +5745,19 @@ var ActionExpression = class {
5740
5745
  }
5741
5746
  this.maskingTemplate = value;
5742
5747
  this.currentTemplate = value;
5743
- if (config?.wrapExpression) {
5744
- this.processWrapExpressions(this.currentTemplate, config.wrapExpression);
5748
+ const exprConfig = {
5749
+ "callReturn": config?.expression?.["callReturn"] || DEFAULT_EXPRESSION_CONFIG["callReturn"],
5750
+ "call": config?.expression?.call || DEFAULT_EXPRESSION_CONFIG.call,
5751
+ "replace": config?.expression?.replace || DEFAULT_EXPRESSION_CONFIG.replace
5752
+ };
5753
+ const types = ["callReturn", "call", "replace"];
5754
+ types.sort((a, b) => exprConfig[b].start.length - exprConfig[a].start.length);
5755
+ for (const type of types) {
5756
+ const marker = exprConfig[type];
5757
+ if (marker) {
5758
+ this.processExpressionType(type, marker.start, marker.end);
5759
+ }
5745
5760
  }
5746
- this.processCallReturnExpressions(this.currentTemplate);
5747
- this.processCallExpressions(this.currentTemplate);
5748
- this.processReplaceExpressions(this.currentTemplate);
5749
5761
  this.sortExpressionsByPosition();
5750
5762
  this.maskingTemplate = this.currentTemplate;
5751
5763
  }
@@ -5756,45 +5768,17 @@ var ActionExpression = class {
5756
5768
  });
5757
5769
  this.expressions.sort((a, b) => (a.index ?? 0) - (b.index ?? 0));
5758
5770
  }
5759
- processWrapExpressions(value, wrapExpression) {
5760
- const wrapChar = wrapExpression.trim();
5761
- const escapedWrap = wrapChar.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5762
- const wrappedCallReturnRegex = new RegExp(`${escapedWrap}\\{\\{=\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
5763
- let match;
5764
- while ((match = wrappedCallReturnRegex.exec(value)) !== null) {
5765
- this.addExpression(match, "call-return", wrapChar);
5766
- }
5767
- const wrappedCallRegex = new RegExp(`${escapedWrap}\\{\\{@\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
5768
- while ((match = wrappedCallRegex.exec(value)) !== null) {
5769
- this.addExpression(match, "call", wrapChar);
5770
- }
5771
- const wrappedReplaceRegex = new RegExp(`${escapedWrap}\\{\\{(?![=@])\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
5772
- while ((match = wrappedReplaceRegex.exec(value)) !== null) {
5773
- this.addExpression(match, "replace", wrapChar);
5774
- }
5775
- }
5776
- processCallReturnExpressions(value) {
5777
- const callReturnRegex = /(?<![a-zA-Z0-9$_@#.])\{\{=\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
5778
- let match;
5779
- while ((match = callReturnRegex.exec(value)) !== null) {
5780
- this.addExpression(match, "call-return");
5781
- }
5782
- }
5783
- processCallExpressions(value) {
5784
- const callRegex = /(?<![a-zA-Z0-9$_@#.])\{\{@\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
5771
+ processExpressionType(type, start, end) {
5772
+ const escapedStart = start.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5773
+ const escapedEnd = end.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5774
+ const regex = new RegExp(`${escapedStart}\\s*([\\s\\S]+?)\\s*${escapedEnd}`, "g");
5785
5775
  let match;
5786
- while ((match = callRegex.exec(value)) !== null) {
5787
- this.addExpression(match, "call");
5776
+ const valueToMatch = this.currentTemplate;
5777
+ while ((match = regex.exec(valueToMatch)) !== null) {
5778
+ this.addExpression(match, type);
5788
5779
  }
5789
5780
  }
5790
- processReplaceExpressions(value) {
5791
- const replaceRegex = /(?<![a-zA-Z0-9$_@#.])\{\{(?![=@])\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
5792
- let match;
5793
- while ((match = replaceRegex.exec(value)) !== null) {
5794
- this.addExpression(match, "replace");
5795
- }
5796
- }
5797
- addExpression(match, type, wrap) {
5781
+ addExpression(match, type) {
5798
5782
  const id = Math.random().toString(36).substr(2, 9);
5799
5783
  const original = match[0];
5800
5784
  const rawScript = match[1];
@@ -5809,13 +5793,9 @@ var ActionExpression = class {
5809
5793
  original,
5810
5794
  script: rawScript.trim(),
5811
5795
  expressionStart,
5812
- expressionEnd,
5813
- ...wrap && { wrap }
5796
+ expressionEnd
5814
5797
  });
5815
5798
  }
5816
- /**
5817
- * 구현 메서드
5818
- */
5819
5799
  replace(idOrExpr, valueOrCallback) {
5820
5800
  const id = typeof idOrExpr === "string" ? idOrExpr : idOrExpr.id;
5821
5801
  let expr;
@@ -5831,9 +5811,6 @@ var ActionExpression = class {
5831
5811
  }
5832
5812
  return this.getUnprocessedTemplate();
5833
5813
  }
5834
- /**
5835
- * 구현 메서드
5836
- */
5837
5814
  getExpressions(typeOrOptions) {
5838
5815
  if (!typeOrOptions) {
5839
5816
  return this.expressions;
@@ -5844,13 +5821,9 @@ var ActionExpression = class {
5844
5821
  const options = typeOrOptions;
5845
5822
  return this.expressions.filter((expr) => {
5846
5823
  if (options.type && expr.type !== options.type) return false;
5847
- if ("wrap" in options && expr.wrap !== options.wrap) return false;
5848
5824
  return true;
5849
5825
  });
5850
5826
  }
5851
- /**
5852
- * 구현 메서드
5853
- */
5854
5827
  getFirstExpression(typeOrOptions) {
5855
5828
  if (!typeOrOptions) {
5856
5829
  return this.getExpressions()[0];
@@ -5860,28 +5833,15 @@ var ActionExpression = class {
5860
5833
  }
5861
5834
  return this.getExpressions(typeOrOptions)[0];
5862
5835
  }
5863
- /**
5864
- * 원본 템플릿을 반환합니다.
5865
- */
5866
5836
  getOriginalTemplate() {
5867
5837
  return this.originalTemplate;
5868
5838
  }
5869
- /**
5870
- * 마스킹 처리된 템플릿을 반환합니다.
5871
- */
5872
5839
  getMaskingTemplate() {
5873
5840
  return this.maskingTemplate;
5874
5841
  }
5875
- /**
5876
- * 현재 처리 상태의 템플릿을 반환합니다.
5877
- */
5878
5842
  getCurrentTemplate() {
5879
5843
  return this.currentTemplate;
5880
5844
  }
5881
- /**
5882
- * 미처리된 마커들을 원본으로 복원한 템플릿을 반환합니다.
5883
- * replace() 호출 후 처리되지 않은 표현식들을 원본 형태로 되돌립니다.
5884
- */
5885
5845
  getUnprocessedTemplate() {
5886
5846
  let result = this.currentTemplate;
5887
5847
  for (const expr of this.expressions) {
@@ -5913,11 +5873,17 @@ var getAddEventListenerMetadata = (target) => {
5913
5873
  const constructor = target instanceof Function ? target : target.constructor;
5914
5874
  return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
5915
5875
  };
5916
- function addEventListenerHost(type, options) {
5917
- return addEventListener(":host", type, options);
5876
+ function addEventListenerThis(type, options) {
5877
+ return addEventListener("$this", type, options);
5918
5878
  }
5919
5879
  function addEventListenerAppHost(type, options) {
5920
- return addEventListener(":appHost", type, options);
5880
+ return addEventListener("$appHost", type, options);
5881
+ }
5882
+ function addEventListenerWindow(type, options) {
5883
+ return addEventListener("$window", type, options);
5884
+ }
5885
+ function addEventListenerDocument(type, options) {
5886
+ return addEventListener("$document", type, options);
5921
5887
  }
5922
5888
 
5923
5889
  // src/decorators/lifecycles.ts
@@ -5944,17 +5910,16 @@ function createLifecycleDecorator(metadataKey) {
5944
5910
  };
5945
5911
  }
5946
5912
  var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
5947
- var onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
5948
- var onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
5949
- var onConnected = onAfterConnected;
5950
- var onBeforeDisconnected = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
5951
- var onAfterDisconnected = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
5952
- var onDisconnected = onAfterDisconnected;
5953
- var onBeforeAdopted = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
5954
- var onAfterAdopted = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
5955
- var onAdopted = onAfterAdopted;
5913
+ var onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
5914
+ var onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
5915
+ var onConnected = onConnectedAfter;
5916
+ var onDisconnectedBefore = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
5917
+ var onDisconnectedAfter = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
5918
+ var onDisconnected = onDisconnectedAfter;
5919
+ var onAdoptedBefore = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
5920
+ var onAdoptedAfter = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
5921
+ var onAdopted = onAdoptedAfter;
5956
5922
  var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
5957
- var onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
5958
5923
  function onConnectedInnerHtml(arg1, arg2, arg3) {
5959
5924
  const decorator = (options, target, propertyKey) => {
5960
5925
  const constructor = target.constructor;
@@ -6110,13 +6075,25 @@ var htmlArticleElement = (options) => {
6110
6075
  };
6111
6076
  var SwcUtils;
6112
6077
  ((SwcUtils2) => {
6078
+ SwcUtils2.getParentContainer = (e) => {
6079
+ return e.parentElement ?? e.getRootNode();
6080
+ };
6113
6081
  SwcUtils2.parsePathPatternsSetAttributeString = (pathPattern, path) => {
6114
6082
  return JSON.stringify(SwcUtils2.parsePathPatternsSet(pathPattern, path)).replace(/"/g, "'");
6115
6083
  };
6116
- SwcUtils2.parsePathPatternsSet = (pathPattern, path) => {
6084
+ SwcUtils2.parsePathPatternsSet = (pathPattern, urlAndRouter) => {
6085
+ urlAndRouter ?? (urlAndRouter = "/");
6086
+ const p = typeof urlAndRouter === "string" ? urlAndRouter : urlAndRouter.value.url;
6087
+ const searchParams = new URLSearchParams();
6088
+ const qs = p.split("?")[1];
6089
+ qs?.split("&").forEach((it) => {
6090
+ const [k, v] = it.split("=");
6091
+ searchParams.set(k, v);
6092
+ });
6117
6093
  return {
6118
- path,
6119
- pathData: SwcUtils2.parsePathPatterns(pathPattern, path)
6094
+ path: p,
6095
+ searchParams,
6096
+ pathData: SwcUtils2.parsePathPatterns(pathPattern, p)
6120
6097
  };
6121
6098
  };
6122
6099
  SwcUtils2.parsePathPatterns = (pathPattern, path) => {
@@ -6156,8 +6133,9 @@ var SwcUtils;
6156
6133
  }
6157
6134
  return current;
6158
6135
  };
6159
- SwcUtils2.findNearestSwcHost = (el) => {
6160
- if (el.__swc_host) return el.__swc_host;
6136
+ SwcUtils2.findNearestSwcHostIncludingSelf = (el) => {
6137
+ const el1 = el;
6138
+ if (el1.__swc_host) return el1.__swc_host;
6161
6139
  let current = el.parentElement || el.getRootNode?.()?.host;
6162
6140
  const doc = el.ownerDocument;
6163
6141
  const win = doc?.defaultView || (typeof window !== "undefined" ? window : void 0);
@@ -6168,26 +6146,26 @@ var SwcUtils;
6168
6146
  }
6169
6147
  return void 0;
6170
6148
  };
6171
- SwcUtils2.findAllSwcHosts = (el) => {
6149
+ SwcUtils2.findAllSwcHostsIncludingSelf = (el) => {
6172
6150
  const hosts = [];
6173
- let current = (0, SwcUtils2.findNearestSwcHost)(el);
6151
+ let current = (0, SwcUtils2.findNearestSwcHostIncludingSelf)(el);
6174
6152
  while (current) {
6175
6153
  hosts.push(current);
6176
- current = (0, SwcUtils2.findNearestSwcHost)(current);
6154
+ current = (0, SwcUtils2.findNearestSwcHostIncludingSelf)(current);
6177
6155
  }
6178
6156
  return hosts.reverse();
6179
6157
  };
6180
6158
  SwcUtils2.getHosts = (el) => {
6181
- const ancestors = (0, SwcUtils2.findAllSwcHosts)(el);
6159
+ const ancestors = (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
6182
6160
  if (getElementConfig(el)) return [...ancestors, el];
6183
6161
  return ancestors;
6184
6162
  };
6185
6163
  SwcUtils2.getHost = (el) => {
6186
6164
  if (getElementConfig(el)) return el;
6187
- return (0, SwcUtils2.findNearestSwcHost)(el);
6165
+ return (0, SwcUtils2.findNearestSwcHostIncludingSelf)(el);
6188
6166
  };
6189
6167
  SwcUtils2.getAppHosts = (el) => {
6190
- const hosts = SwcUtils2.findAllParentAppHostsDirect(el);
6168
+ const hosts = SwcUtils2.findAllAppHostsIncludingSelfDirect(el);
6191
6169
  return hosts;
6192
6170
  };
6193
6171
  SwcUtils2.getAppHost = (el) => {
@@ -6195,11 +6173,11 @@ var SwcUtils;
6195
6173
  const appHostsWithoutSelf = appHosts.filter((h) => h !== el);
6196
6174
  return appHostsWithoutSelf.length > 0 ? appHostsWithoutSelf[appHostsWithoutSelf.length - 1] : void 0;
6197
6175
  };
6198
- SwcUtils2.findParentAppHostDirect = (el) => {
6199
- const appHosts = (0, SwcUtils2.findAllParentAppHostsDirect)(el);
6176
+ SwcUtils2.findAppHostIncludingSelfDirect = (el) => {
6177
+ const appHosts = (0, SwcUtils2.findAllAppHostsIncludingSelfDirect)(el);
6200
6178
  return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;
6201
6179
  };
6202
- SwcUtils2.findAllParentAppHostsDirect = (el) => {
6180
+ SwcUtils2.findAllAppHostsIncludingSelfDirect = (el) => {
6203
6181
  const appHosts = [];
6204
6182
  const w = el.ownerDocument?.defaultView || (typeof window !== "undefined" ? window : void 0);
6205
6183
  if (!w) {
@@ -6225,7 +6203,7 @@ var SwcUtils;
6225
6203
  return appHosts.reverse();
6226
6204
  };
6227
6205
  SwcUtils2.getHostSet = (el) => {
6228
- const ancestors = (0, SwcUtils2.findAllSwcHosts)(el);
6206
+ const ancestors = (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
6229
6207
  const $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;
6230
6208
  const $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;
6231
6209
  const $hosts = ancestors;
@@ -6239,7 +6217,7 @@ var SwcUtils;
6239
6217
  }
6240
6218
  curr = curr.parentElement || curr.getRootNode().host;
6241
6219
  }
6242
- const $appHosts = SwcUtils2.findAllParentAppHostsDirect(el);
6220
+ const $appHosts = SwcUtils2.findAllAppHostsIncludingSelfDirect(el);
6243
6221
  const $appHost = $appHosts.length > 0 ? $appHosts[$appHosts.length - 1] === el ? $appHosts.length > 1 ? $appHosts[$appHosts.length - 2] : null : $appHosts[$appHosts.length - 1] : null;
6244
6222
  const $firstAppHost = $appHosts.length > 0 ? $appHosts[0] : null;
6245
6223
  return {
@@ -6247,7 +6225,8 @@ var SwcUtils;
6247
6225
  $parentHost,
6248
6226
  $hosts,
6249
6227
  $firstHost,
6250
- $lastHost: $parentHost,
6228
+ $lastHost: $host,
6229
+ $templateHost: el.__swc_template_host,
6251
6230
  $appHost,
6252
6231
  $appHosts,
6253
6232
  $firstAppHost,
@@ -6304,25 +6283,27 @@ function emitCustomEvent(selectorOrTarget, type, options = {}) {
6304
6283
  const conf = getElementConfig(this);
6305
6284
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6306
6285
  const eventTargets = [];
6307
- if (selectorOrTarget === ":window") eventTargets.push(currentWin);
6308
- else if (selectorOrTarget === ":document") eventTargets.push(currentWin.document);
6309
- else if (selectorOrTarget === ":parentHost") {
6286
+ if (selectorOrTarget === "$window") eventTargets.push(currentWin);
6287
+ else if (selectorOrTarget === "$document") eventTargets.push(currentWin.document);
6288
+ else if (selectorOrTarget === "$host") {
6289
+ if (hostSet.$host) eventTargets.push(hostSet.$host);
6290
+ } else if (selectorOrTarget === "$parentHost") {
6310
6291
  if (hostSet.$parentHost) eventTargets.push(hostSet.$parentHost);
6311
- } else if (selectorOrTarget === ":appHost") {
6292
+ } else if (selectorOrTarget === "$appHost") {
6312
6293
  if (hostSet.$appHost) eventTargets.push(hostSet.$appHost);
6313
- } else if (selectorOrTarget === ":firstHost") {
6294
+ } else if (selectorOrTarget === "$firstHost") {
6314
6295
  if (hostSet.$firstHost) eventTargets.push(hostSet.$firstHost);
6315
- } else if (selectorOrTarget === ":lastHost") {
6296
+ } else if (selectorOrTarget === "$lastHost") {
6316
6297
  if (hostSet.$lastHost) eventTargets.push(hostSet.$lastHost);
6317
- } else if (selectorOrTarget === ":firstAppHost") {
6298
+ } else if (selectorOrTarget === "$firstAppHost") {
6318
6299
  if (hostSet.$firstAppHost) eventTargets.push(hostSet.$firstAppHost);
6319
- } else if (selectorOrTarget === ":lastAppHost") {
6300
+ } else if (selectorOrTarget === "$lastAppHost") {
6320
6301
  if (hostSet.$lastAppHost) eventTargets.push(hostSet.$lastAppHost);
6321
- } else if (selectorOrTarget === ":hosts") {
6302
+ } else if (selectorOrTarget === "$hosts") {
6322
6303
  hostSet.$hosts.forEach((h) => eventTargets.push(h));
6323
- } else if (selectorOrTarget === ":appHosts") {
6304
+ } else if (selectorOrTarget === "$appHosts") {
6324
6305
  hostSet.$appHosts.forEach((h) => eventTargets.push(h));
6325
- } else if (selectorOrTarget === ":host" || !selectorOrTarget) {
6306
+ } else if (selectorOrTarget === "$this" || !selectorOrTarget) {
6326
6307
  eventTargets.push(this);
6327
6308
  } else {
6328
6309
  const r = fullOptions.root || "auto";
@@ -6358,14 +6339,20 @@ var getEmitCustomEventMetadataList = (target) => {
6358
6339
  const constructor = target instanceof Function ? target : target.constructor;
6359
6340
  return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
6360
6341
  };
6361
- function emitCustomEventHost(type, options = {}) {
6362
- if (!options.attributeName) {
6363
- options.attributeName = `on-emit-${type}`;
6342
+ function emitCustomEventThis(type, optionsOrAttributeaName) {
6343
+ if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "string") {
6344
+ return emitCustomEventThis(type, { attributeName: optionsOrAttributeaName });
6345
+ } else if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "object") {
6346
+ if (!optionsOrAttributeaName.attributeName) {
6347
+ optionsOrAttributeaName.attributeName = `on-emit-${type}`;
6348
+ }
6349
+ return emitCustomEvent("$this", type, optionsOrAttributeaName);
6350
+ } else {
6351
+ return emitCustomEvent("$this", type, { attributeName: `on-emit-${type}` });
6364
6352
  }
6365
- return emitCustomEvent(":host", type, options);
6366
6353
  }
6367
6354
 
6368
- // src/decorators/changedAttributeHost.ts
6355
+ // src/decorators/changedAttributeThis.ts
6369
6356
  var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
6370
6357
  var convertValue = (val, type) => {
6371
6358
  if (val === null || val === void 0) return val;
@@ -6373,7 +6360,7 @@ var convertValue = (val, type) => {
6373
6360
  if (type === Boolean) return val === "false" || val === "0" ? false : true;
6374
6361
  return val;
6375
6362
  };
6376
- function changedAttributeHost(attributeName, options = {}) {
6363
+ function changedAttributeThis(attributeName, options = {}) {
6377
6364
  return (target, propertyKey) => {
6378
6365
  const constructor = target.constructor;
6379
6366
  let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);
@@ -6440,25 +6427,26 @@ function createAttributeDecorator(action) {
6440
6427
  const handleResult = (resolvedValue) => {
6441
6428
  if (resolvedValue !== void 0) {
6442
6429
  const win = this.ownerDocument?.defaultView || window;
6443
- const host2 = this;
6444
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
6430
+ const host = this;
6431
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
6445
6432
  const r = finalOptions.root || "auto";
6446
6433
  const targetEls = [];
6447
6434
  const applyRoot = (t) => {
6448
6435
  if (!t || !(t instanceof win.HTMLElement)) return;
6449
6436
  targetEls.push(t);
6450
6437
  };
6451
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6452
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6453
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6454
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6455
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6456
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6457
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6458
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6459
- else if (selector === ":host" || !selector) applyRoot(host2);
6438
+ if (selector === "$this" || !selector) applyRoot(host);
6439
+ else if (selector === "$host") applyRoot(hostSet.$host);
6440
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
6441
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
6442
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
6443
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
6444
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
6445
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
6446
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
6447
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
6460
6448
  else {
6461
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
6449
+ const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
6462
6450
  if (targetRoot) {
6463
6451
  const found = targetRoot.querySelectorAll(selector);
6464
6452
  if (found) targetEls.push(...Array.from(found));
@@ -6519,12 +6507,12 @@ function applyAttribute(selector, action = "update", options = {}) {
6519
6507
  var setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
6520
6508
  var updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
6521
6509
  var removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
6522
- function applyAttributeHost(action = "update", options = {}) {
6523
- return createAttributeDecorator(action)(":host", options);
6510
+ function applyAttributeThis(action = "update", options = {}) {
6511
+ return createAttributeDecorator(action)("$this", options);
6524
6512
  }
6525
- var setAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("set")(":host", nameOrOptions, options);
6526
- var updateAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("update")(":host", nameOrOptions, options);
6527
- var removeAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("remove")(":host", nameOrOptions, options);
6513
+ var setAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("set")("$this", nameOrOptions, options);
6514
+ var updateAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("update")("$this", nameOrOptions, options);
6515
+ var removeAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("remove")("$this", nameOrOptions, options);
6528
6516
  var findAllAttributeApplyMetadata = (target) => {
6529
6517
  const result = /* @__PURE__ */ new Map();
6530
6518
  const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
@@ -6569,26 +6557,28 @@ function query(selectorOrTarget, options = {}) {
6569
6557
  return t;
6570
6558
  };
6571
6559
  const hostSet = SwcUtils.getHostSet(this);
6572
- if (selector === ":parentHost")
6560
+ if (selector === "$this")
6561
+ return applyRoot(this);
6562
+ if (selector === "$host")
6563
+ return applyRoot(hostSet.$host);
6564
+ if (selector === "$parentHost")
6573
6565
  return applyRoot(hostSet.$parentHost);
6574
- if (selector === ":appHost")
6566
+ if (selector === "$appHost")
6575
6567
  return applyRoot(hostSet.$appHost);
6576
- if (selector === ":firstHost")
6568
+ if (selector === "$firstHost")
6577
6569
  return applyRoot(hostSet.$firstHost);
6578
- if (selector === ":lastHost")
6570
+ if (selector === "$lastHost")
6579
6571
  return applyRoot(hostSet.$lastHost);
6580
- if (selector === ":firstAppHost")
6572
+ if (selector === "$firstAppHost")
6581
6573
  return applyRoot(hostSet.$firstAppHost);
6582
- if (selector === ":lastAppHost")
6574
+ if (selector === "$lastAppHost")
6583
6575
  return applyRoot(hostSet.$lastAppHost);
6584
6576
  const config = getElementConfig(this);
6585
6577
  const win = config?.window || window;
6586
- if (selector === ":window")
6578
+ if (selector === "$window")
6587
6579
  return win;
6588
- if (selector === ":document")
6580
+ if (selector === "$document")
6589
6581
  return win.document;
6590
- if (selector === ":host")
6591
- return applyRoot(this);
6592
6582
  if (r === "shadow")
6593
6583
  return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
6594
6584
  if (r === "light")
@@ -6603,7 +6593,7 @@ function query(selectorOrTarget, options = {}) {
6603
6593
  ensureInit(this);
6604
6594
  if (nv === null || nv === void 0) {
6605
6595
  const selector = selectorOrTarget;
6606
- if (selector.startsWith(":") && selector !== ":host")
6596
+ if (selector.startsWith("$") && selector !== "$this")
6607
6597
  return;
6608
6598
  const r = options.root || "auto";
6609
6599
  const targets = [];
@@ -6631,75 +6621,54 @@ function query(selectorOrTarget, options = {}) {
6631
6621
  });
6632
6622
  };
6633
6623
  }
6634
- function queryHost(targetOrOptions, propertyKey) {
6624
+ function queryThis(targetOrOptions, propertyKey) {
6635
6625
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6636
- return query(":host", {})(targetOrOptions, propertyKey);
6626
+ return query("$this", {})(targetOrOptions, propertyKey);
6637
6627
  }
6638
6628
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6639
- return query(":host", targetOrOptions);
6629
+ return query("$this", targetOrOptions);
6640
6630
  } else {
6641
- return query(":host", {});
6631
+ return query("$this", {});
6642
6632
  }
6643
6633
  }
6644
- var host = queryHost;
6645
- function parentHost(targetOrOptions, propertyKey) {
6634
+ function queryWindow(targetOrOptions, propertyKey) {
6646
6635
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6647
- return query(":parentHost", {})(targetOrOptions, propertyKey);
6636
+ return query("$window", {})(targetOrOptions, propertyKey);
6648
6637
  }
6649
6638
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6650
- return query(":parentHost", targetOrOptions);
6639
+ return query("$window", targetOrOptions);
6651
6640
  } else {
6652
- return query(":parentHost", {});
6641
+ return query("$window", {});
6653
6642
  }
6654
6643
  }
6655
- function appHost(targetOrOptions, propertyKey) {
6644
+ function queryDocument(targetOrOptions, propertyKey) {
6656
6645
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6657
- return query(":appHost", {})(targetOrOptions, propertyKey);
6646
+ return query("$document", {})(targetOrOptions, propertyKey);
6658
6647
  }
6659
6648
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6660
- return query(":appHost", targetOrOptions);
6649
+ return query("$document", targetOrOptions);
6661
6650
  } else {
6662
- return query(":appHost", {});
6651
+ return query("$document", {});
6663
6652
  }
6664
6653
  }
6665
- function firstHost(targetOrOptions, propertyKey) {
6666
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6667
- return query(":firstHost", {})(targetOrOptions, propertyKey);
6668
- }
6669
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6670
- return query(":firstHost", targetOrOptions);
6671
- } else {
6672
- return query(":firstHost", {});
6673
- }
6674
- }
6675
- function lastHost(targetOrOptions, propertyKey) {
6676
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6677
- return query(":lastHost", {})(targetOrOptions, propertyKey);
6678
- }
6679
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6680
- return query(":lastHost", targetOrOptions);
6681
- } else {
6682
- return query(":lastHost", {});
6683
- }
6684
- }
6685
- function firstAppHost(targetOrOptions, propertyKey) {
6654
+ function queryHost(targetOrOptions, propertyKey) {
6686
6655
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6687
- return query(":firstAppHost", {})(targetOrOptions, propertyKey);
6656
+ return query("$host", {})(targetOrOptions, propertyKey);
6688
6657
  }
6689
6658
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6690
- return query(":firstAppHost", targetOrOptions);
6659
+ return query("$host", targetOrOptions);
6691
6660
  } else {
6692
- return query(":firstAppHost", {});
6661
+ return query("$host", {});
6693
6662
  }
6694
6663
  }
6695
- function lastAppHost(targetOrOptions, propertyKey) {
6664
+ function queryAppHost(targetOrOptions, propertyKey) {
6696
6665
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6697
- return query(":lastAppHost", {})(targetOrOptions, propertyKey);
6666
+ return query("$appHost", {})(targetOrOptions, propertyKey);
6698
6667
  }
6699
6668
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6700
- return query(":lastAppHost", targetOrOptions);
6669
+ return query("$appHost", targetOrOptions);
6701
6670
  } else {
6702
- return query(":lastAppHost", {});
6671
+ return query("$appHost", {});
6703
6672
  }
6704
6673
  }
6705
6674
  var getQueryMetadata = (target) => {
@@ -6748,17 +6717,31 @@ function queryAll(selectorOrTarget, options = {}) {
6748
6717
  return results;
6749
6718
  };
6750
6719
  const hostSet = SwcUtils.getHostSet(this);
6751
- if (selector === ":hosts")
6720
+ if (selector === "$hosts")
6752
6721
  return applyRoot(hostSet.$hosts);
6753
- if (selector === ":appHosts")
6722
+ if (selector === "$appHosts")
6754
6723
  return applyRoot(hostSet.$appHosts);
6724
+ if (selector === "$host")
6725
+ return applyRoot(hostSet.$host);
6726
+ if (selector === "$parentHost")
6727
+ return applyRoot(hostSet.$parentHost);
6728
+ if (selector === "$appHost")
6729
+ return applyRoot(hostSet.$appHost);
6730
+ if (selector === "$firstHost")
6731
+ return applyRoot(hostSet.$firstHost);
6732
+ if (selector === "$lastHost")
6733
+ return applyRoot(hostSet.$lastHost);
6734
+ if (selector === "$firstAppHost")
6735
+ return applyRoot(hostSet.$firstAppHost);
6736
+ if (selector === "$lastAppHost")
6737
+ return applyRoot(hostSet.$lastAppHost);
6755
6738
  const config = getElementConfig(this);
6756
6739
  const win = config?.window || window;
6757
- if (selector === ":window")
6740
+ if (selector === "$window")
6758
6741
  return [win];
6759
- if (selector === ":document")
6742
+ if (selector === "$document")
6760
6743
  return [win.document];
6761
- if (selector === ":host")
6744
+ if (selector === "$this")
6762
6745
  return applyRoot(this);
6763
6746
  if (r === "shadow")
6764
6747
  return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
@@ -6776,7 +6759,7 @@ function queryAll(selectorOrTarget, options = {}) {
6776
6759
  ensureInit(this);
6777
6760
  if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
6778
6761
  const selector = selectorOrTarget;
6779
- if (selector.startsWith(":") && selector !== ":host")
6762
+ if (selector.startsWith("$") && selector !== "$this")
6780
6763
  return;
6781
6764
  const r = options.root || "auto";
6782
6765
  let targets = [];
@@ -6799,75 +6782,34 @@ function queryAll(selectorOrTarget, options = {}) {
6799
6782
  });
6800
6783
  };
6801
6784
  }
6802
- function queryAllHost(targetOrOptions, propertyKey) {
6785
+ function queryAllThis(targetOrOptions, propertyKey) {
6803
6786
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6804
- return queryAll(":host", {})(targetOrOptions, propertyKey);
6787
+ return queryAll("$this", {})(targetOrOptions, propertyKey);
6805
6788
  }
6806
6789
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6807
- return queryAll(":host", targetOrOptions);
6790
+ return queryAll("$this", targetOrOptions);
6808
6791
  } else {
6809
- return queryAll(":host", {});
6792
+ return queryAll("$this", {});
6810
6793
  }
6811
6794
  }
6812
- var allHost = queryAllHost;
6813
6795
  function allParentHost(targetOrOptions, propertyKey) {
6814
6796
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6815
- return queryAll(":parentHost", {})(targetOrOptions, propertyKey);
6797
+ return queryAll("$host", {})(targetOrOptions, propertyKey);
6816
6798
  }
6817
6799
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6818
- return queryAll(":parentHost", targetOrOptions);
6800
+ return queryAll("$host", targetOrOptions);
6819
6801
  } else {
6820
- return queryAll(":parentHost", {});
6802
+ return queryAll("$host", {});
6821
6803
  }
6822
6804
  }
6823
6805
  function allAppHost(targetOrOptions, propertyKey) {
6824
6806
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6825
- return queryAll(":appHost", {})(targetOrOptions, propertyKey);
6807
+ return queryAll("$appHost", {})(targetOrOptions, propertyKey);
6826
6808
  }
6827
6809
  if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6828
- return queryAll(":appHost", targetOrOptions);
6810
+ return queryAll("$appHost", targetOrOptions);
6829
6811
  } else {
6830
- return queryAll(":appHost", {});
6831
- }
6832
- }
6833
- function allFirstHost(targetOrOptions, propertyKey) {
6834
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6835
- return queryAll(":firstHost", {})(targetOrOptions, propertyKey);
6836
- }
6837
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6838
- return queryAll(":firstHost", targetOrOptions);
6839
- } else {
6840
- return queryAll(":firstHost", {});
6841
- }
6842
- }
6843
- function allLastHost(targetOrOptions, propertyKey) {
6844
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6845
- return queryAll(":lastHost", {})(targetOrOptions, propertyKey);
6846
- }
6847
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6848
- return queryAll(":lastHost", targetOrOptions);
6849
- } else {
6850
- return queryAll(":lastHost", {});
6851
- }
6852
- }
6853
- function allFirstAppHost(targetOrOptions, propertyKey) {
6854
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6855
- return queryAll(":firstAppHost", {})(targetOrOptions, propertyKey);
6856
- }
6857
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6858
- return queryAll(":firstAppHost", targetOrOptions);
6859
- } else {
6860
- return queryAll(":firstAppHost", {});
6861
- }
6862
- }
6863
- function allLastAppHost(targetOrOptions, propertyKey) {
6864
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6865
- return queryAll(":lastAppHost", {})(targetOrOptions, propertyKey);
6866
- }
6867
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6868
- return queryAll(":lastAppHost", targetOrOptions);
6869
- } else {
6870
- return queryAll(":lastAppHost", {});
6812
+ return queryAll("$appHost", {});
6871
6813
  }
6872
6814
  }
6873
6815
  var getQueryAllMetadata = (target) => {
@@ -7777,7 +7719,7 @@ var ensureInit = (inst) => {
7777
7719
  });
7778
7720
  }
7779
7721
  const hostSet = SwcUtils.getHostSet(inst);
7780
- const appHosts = SwcUtils.findAllParentAppHostsDirect(inst);
7722
+ const appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(inst);
7781
7723
  inst._executeSwcScript?.("swc-on-constructor", hostSet);
7782
7724
  const cMethods = findAllLifecycleMetadata(inst, ON_INITIALIZE_METADATA_KEY);
7783
7725
  if (cMethods) {
@@ -7795,9 +7737,9 @@ var handleGlobalSwcEvent = async (event) => {
7795
7737
  if (!(node instanceof HTMLElement)) continue;
7796
7738
  const script = node.getAttribute?.(attrName);
7797
7739
  if (script && !getElementConfig(node)) {
7798
- const host2 = SwcUtils.findNearestSwcHost(node);
7799
- if (host2 && host2.isConnected && typeof host2.__swc_executeAttributeEvent === "function") {
7800
- await host2.__swc_executeAttributeEvent(node, attrName, script, event);
7740
+ const host = SwcUtils.findNearestSwcHostIncludingSelf(node);
7741
+ if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
7742
+ await host.__swc_executeAttributeEvent(node, attrName, script, event);
7801
7743
  event.__swc_handled = true;
7802
7744
  break;
7803
7745
  }
@@ -7839,7 +7781,7 @@ var setupPrototype = (proto) => {
7839
7781
  proto._resolveWindow = function(localConfig) {
7840
7782
  ensureInit(this);
7841
7783
  if (localConfig?.window) return localConfig.window;
7842
- const ancestors = SwcUtils.findAllSwcHosts(this);
7784
+ const ancestors = SwcUtils.findAllSwcHostsIncludingSelf(this);
7843
7785
  for (let i = ancestors.length - 1; i >= 0; i--) {
7844
7786
  const aConf = getElementConfig(ancestors[i]);
7845
7787
  if (aConf?.window) return aConf.window;
@@ -7853,7 +7795,13 @@ var setupPrototype = (proto) => {
7853
7795
  const app = useHostSet?.$appHost?.simpleApplication;
7854
7796
  if (app) {
7855
7797
  const otherStorage = /* @__PURE__ */ new Map();
7856
- const situations = new SituationTypeContainers([new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTSET" /* HOST_SET */, data: useHostSet }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOST" /* APP_HOST */, data: useHostSet.$appHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOSTS" /* APP_HOSTS */, data: useHostSet.$appHosts }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOST" /* HOST */, data: useHostSet.$host }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTS" /* HOSTS */, data: useHostSet.$hosts }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://FIRSTHOST" /* FIRST_HOST */, data: useHostSet.$firstHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTHOST" /* LAST_HOST */, data: useHostSet.$lastHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://FIRSTAPPHOST" /* FIRST_APP_HOST */, data: useHostSet.$firstAppHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTAPPHOST" /* LAST_APP_HOST */, data: useHostSet.$lastAppHost })]);
7798
+ const situations = new SituationTypeContainers([new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTSET" /* HOST_SET */, data: useHostSet }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOST" /* APP_HOST */, data: useHostSet.$appHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOSTS" /* APP_HOSTS */, data: useHostSet.$appHosts }), new SituationTypeContainer({
7799
+ situationType: "SIMPLE_WEB_COMPONENT://HOST" /* HOST */,
7800
+ data: useHostSet.$host
7801
+ }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTS" /* HOSTS */, data: useHostSet.$hosts }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://FIRSTHOST" /* FIRST_HOST */, data: useHostSet.$firstHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTHOST" /* LAST_HOST */, data: useHostSet.$lastHost }), new SituationTypeContainer({
7802
+ situationType: "SIMPLE_WEB_COMPONENT://FIRSTAPPHOST" /* FIRST_APP_HOST */,
7803
+ data: useHostSet.$firstAppHost
7804
+ }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTAPPHOST" /* LAST_APP_HOST */, data: useHostSet.$lastAppHost })]);
7857
7805
  otherStorage.set(SituationTypeContainers, situations);
7858
7806
  return app.simstanceManager.executeBindParameterSim(
7859
7807
  {
@@ -7937,7 +7885,7 @@ var elementDefine = (name, config = {}) => (constructor) => {
7937
7885
  metadata.extends = extendsTagName;
7938
7886
  }
7939
7887
  const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
7940
- const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === ":host" || meta.selector === "");
7888
+ const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === "$this" || meta.selector === "");
7941
7889
  const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
7942
7890
  const attrChangeMap = findAllAttributeChangedMetadata(constructor);
7943
7891
  const attributeList = findAllAttributeMetadata(constructor);
@@ -7945,204 +7893,245 @@ var elementDefine = (name, config = {}) => (constructor) => {
7945
7893
  const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
7946
7894
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
7947
7895
  const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
7948
- const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
7949
- const proto = constructor.prototype;
7896
+ const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
7950
7897
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
7951
- const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
7952
- ...metadata.observedAttributes ?? [],
7953
- ...originalStaticObservedAttributes,
7954
- ...attrChangeMap.keys(),
7955
- ...attributeApplyNames,
7956
- ...hostAttributes,
7957
- ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
7958
- ...swcLifecycleAttributes,
7959
- ...swcOnEvents
7960
- ])];
7898
+ const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
7961
7899
  const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
7900
+ const proto = constructor.prototype;
7962
7901
  setupPrototype(proto);
7902
+ let helperHostSet = null;
7963
7903
  const originalConnected = proto.connectedCallback;
7964
- proto.connectedCallback = function() {
7904
+ proto.connectedCallback = async function() {
7965
7905
  ensureInit(this);
7966
- const hostSet = SwcUtils.getHostSet(this);
7967
- const appHost2 = hostSet.$appHost;
7968
- const conf = getElementConfig(this);
7969
- const currentWin = this._resolveWindow(conf);
7970
- const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
7971
- if (shadowMode && !this.shadowRoot) {
7972
- const mode = shadowMode === true ? "open" : shadowMode;
7973
- this.attachShadow({ mode });
7974
- }
7975
- this._executeSwcScript("swc-on-before-connected", hostSet);
7976
- const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
7977
- if (bMethods) {
7978
- for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
7979
- }
7980
- if (connectedInnerHtmlList.length > 0) {
7981
- let sContent = "", lContent = "";
7982
- for (const meta of connectedInnerHtmlList) {
7983
- const res = this._invokeLifecycleMethod(meta.propertyKey, hostSet);
7984
- if (res !== void 0) {
7985
- if (meta.options.useShadow || conf?.useShadow) sContent += res;
7986
- else lContent += res;
7906
+ helperHostSet = SwcUtils.getHelperAndHostSet(win, this);
7907
+ const appHost = helperHostSet.$appHost;
7908
+ try {
7909
+ if (appHost && typeof appHost._connected === "function") {
7910
+ await appHost._connected(this);
7911
+ } else if (appHost && typeof appHost) {
7912
+ appHost._connected_safari ?? (appHost._connected_safari = []);
7913
+ appHost._connected_safari.push(this);
7914
+ }
7915
+ const conf = getElementConfig(this);
7916
+ const currentWin = this._resolveWindow(conf);
7917
+ const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
7918
+ if (shadowMode && !this.shadowRoot) {
7919
+ const mode = shadowMode === true ? "open" : shadowMode;
7920
+ this.attachShadow({ mode });
7921
+ }
7922
+ const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
7923
+ if (bMethods) {
7924
+ for (const m of bMethods) await this._invokeLifecycleMethod(m, helperHostSet);
7925
+ }
7926
+ this._executeSwcScript("swc-on-before-connected", helperHostSet);
7927
+ if (connectedInnerHtmlList.length > 0) {
7928
+ let sContent = "", lContent = "";
7929
+ for (const meta of connectedInnerHtmlList) {
7930
+ let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
7931
+ const actionExpression = new ActionExpression(res, {
7932
+ expression: {
7933
+ replace: {
7934
+ start: meta.options.replaceWrap?.start || "{%{",
7935
+ end: meta.options.replaceWrap?.end || "}%}"
7936
+ },
7937
+ callReturn: {
7938
+ start: meta.options.replaceWrap?.start || "{%{=",
7939
+ end: meta.options.replaceWrap?.end || "}%}"
7940
+ },
7941
+ call: {
7942
+ start: meta.options.replaceWrap?.start || "{%{@",
7943
+ end: meta.options.replaceWrap?.end || "}%}"
7944
+ }
7945
+ }
7946
+ });
7947
+ actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
7948
+ try {
7949
+ const sr = FunctionUtils.executeReturn({ script: it.script, context: this, args: helperHostSet });
7950
+ actionExpression.replace(it, sr);
7951
+ } catch (e) {
7952
+ console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
7953
+ }
7954
+ });
7955
+ res = actionExpression.getUnprocessedTemplate();
7956
+ if (res !== void 0) {
7957
+ if (meta.options.useShadow || conf?.useShadow) sContent += res;
7958
+ else lContent += res;
7959
+ }
7960
+ }
7961
+ try {
7962
+ if (this.shadowRoot) {
7963
+ this.shadowRoot.innerHTML = sContent;
7964
+ }
7965
+ if (lContent) {
7966
+ this.innerHTML = lContent;
7967
+ }
7968
+ } catch (e) {
7969
+ console.error("[ElementDefine] innerHTML setting error:", e);
7987
7970
  }
7988
7971
  }
7989
- try {
7990
- if (this.shadowRoot) this.shadowRoot.innerHTML = sContent;
7991
- if (lContent) this.innerHTML = lContent;
7992
- } catch (e) {
7993
- console.error("[ElementDefine] innerHTML setting error:", e);
7972
+ const root = this.getRootNode();
7973
+ if (!globalDelegatedRoots.has(root)) {
7974
+ DOM_EVENT_NAMES.forEach((type) => {
7975
+ root.addEventListener(type, handleGlobalSwcEvent);
7976
+ });
7977
+ globalDelegatedRoots.add(root);
7994
7978
  }
7995
- }
7996
- const root = this.getRootNode();
7997
- if (!globalDelegatedRoots.has(root)) {
7998
- DOM_EVENT_NAMES.forEach((type) => {
7999
- root.addEventListener(type, handleGlobalSwcEvent);
7979
+ const delegateListeners = [];
7980
+ const nonDelegateListeners = [];
7981
+ addEventListenerList.forEach((meta) => {
7982
+ 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 !== "") {
7983
+ delegateListeners.push(meta);
7984
+ } else {
7985
+ nonDelegateListeners.push(meta);
7986
+ }
8000
7987
  });
8001
- globalDelegatedRoots.add(root);
8002
- }
8003
- const delegateListeners = [];
8004
- const nonDelegateListeners = [];
8005
- addEventListenerList.forEach((meta) => {
8006
- 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 !== "") {
8007
- delegateListeners.push(meta);
8008
- } else {
8009
- nonDelegateListeners.push(meta);
8010
- }
8011
- });
8012
- const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
8013
- delegateListeners.forEach((meta) => {
8014
- const r = meta.options.root || "auto";
8015
- const rootKey = `${meta.type}:${r}`;
8016
- if (!delegatesByTypeAndRoot.has(rootKey)) {
8017
- delegatesByTypeAndRoot.set(rootKey, []);
8018
- }
8019
- delegatesByTypeAndRoot.get(rootKey).push(meta);
8020
- });
8021
- delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
8022
- const [type, rStr] = typeRootKey.split(":");
8023
- const r = rStr === "auto" ? "auto" : rStr;
8024
- const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
8025
- const bindRoots = [];
8026
- if (r === "auto") bindRoots.push(this.shadowRoot || this);
8027
- else if (r === "light") bindRoots.push(this);
8028
- else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
8029
- else if (r === "all") {
8030
- bindRoots.push(this);
8031
- if (this.shadowRoot) bindRoots.push(this.shadowRoot);
8032
- }
8033
- bindRoots.forEach((br) => {
8034
- const sortedMetaList = [...metaList].sort((a, b) => {
8035
- const aStop = a.options.stopPropagation ? 1 : 0;
8036
- const bStop = b.options.stopPropagation ? 1 : 0;
8037
- return bStop - aStop;
8038
- });
8039
- const unifiedHandler = async (event) => {
8040
- for (const meta of sortedMetaList) {
8041
- const { selector, options } = meta;
8042
- const matchedEl = event.target.closest(selector);
8043
- if (matchedEl && br.contains(matchedEl)) {
8044
- if (options.filter) {
8045
- const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
8046
- if (!options.filter(event, helper)) {
8047
- continue;
7988
+ const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
7989
+ delegateListeners.forEach((meta) => {
7990
+ const r = meta.options.root || "auto";
7991
+ const rootKey = `${meta.type}:${r}`;
7992
+ if (!delegatesByTypeAndRoot.has(rootKey)) {
7993
+ delegatesByTypeAndRoot.set(rootKey, []);
7994
+ }
7995
+ delegatesByTypeAndRoot.get(rootKey).push(meta);
7996
+ });
7997
+ delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
7998
+ const [type, rStr] = typeRootKey.split(":");
7999
+ const r = rStr === "auto" ? "auto" : rStr;
8000
+ const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
8001
+ const bindRoots = [];
8002
+ if (r === "auto") bindRoots.push(this.shadowRoot || this);
8003
+ else if (r === "light") bindRoots.push(this);
8004
+ else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
8005
+ else if (r === "all") {
8006
+ bindRoots.push(this);
8007
+ if (this.shadowRoot) bindRoots.push(this.shadowRoot);
8008
+ }
8009
+ bindRoots.forEach((br) => {
8010
+ const sortedMetaList = [...metaList].sort((a, b) => {
8011
+ const aStop = a.options.stopPropagation ? 1 : 0;
8012
+ const bStop = b.options.stopPropagation ? 1 : 0;
8013
+ return bStop - aStop;
8014
+ });
8015
+ const unifiedHandler = async (event) => {
8016
+ for (const meta of sortedMetaList) {
8017
+ const { selector, options } = meta;
8018
+ const matchedEl = event.target.closest(selector);
8019
+ if (matchedEl && br.contains(matchedEl)) {
8020
+ if (options.filter) {
8021
+ const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
8022
+ if (!options.filter(event, helper)) {
8023
+ continue;
8024
+ }
8048
8025
  }
8026
+ if (options.stopPropagation) event.stopPropagation();
8027
+ if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8028
+ if (options.preventDefault) event.preventDefault();
8029
+ const currentHostSet = SwcUtils.getHostSet(this);
8030
+ const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
8031
+ await this[meta.propertyKey](event, { ...currentHostSet, $matchedElement: matchedEl }, args);
8032
+ if (event.cancelBubble) break;
8049
8033
  }
8050
- if (options.stopPropagation) event.stopPropagation();
8051
- if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8052
- if (options.preventDefault) event.preventDefault();
8053
- const currentHostSet = SwcUtils.getHostSet(this);
8054
- const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
8055
- await this[meta.propertyKey](event, currentHostSet, matchedEl, args);
8056
- if (event.cancelBubble) break;
8057
8034
  }
8035
+ };
8036
+ br.addEventListener(type, unifiedHandler, opts);
8037
+ this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
8038
+ });
8039
+ });
8040
+ nonDelegateListeners.forEach((meta) => {
8041
+ const { selector, type, options } = meta;
8042
+ const opts = { capture: options.capture, once: options.once, passive: options.passive };
8043
+ const bindTargets = [];
8044
+ const r = options.root || "auto";
8045
+ const applyRootOption = (target) => {
8046
+ if (!target) return;
8047
+ if (r === "auto") {
8048
+ bindTargets.push(target.shadowRoot || target);
8049
+ } else {
8050
+ if (r === "light" || r === "all") bindTargets.push(target);
8051
+ if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
8058
8052
  }
8059
8053
  };
8060
- br.addEventListener(type, unifiedHandler, opts);
8061
- this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
8062
- });
8063
- });
8064
- nonDelegateListeners.forEach((meta) => {
8065
- const { selector, type, options } = meta;
8066
- const opts = { capture: options.capture, once: options.once, passive: options.passive };
8067
- const bindTargets = [];
8068
- const r = options.root || "auto";
8069
- const applyRootOption = (target) => {
8070
- if (!target) return;
8071
- if (r === "auto") {
8072
- bindTargets.push(target.shadowRoot || target);
8073
- } else {
8074
- if (r === "light" || r === "all") bindTargets.push(target);
8075
- if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
8076
- }
8077
- };
8078
- if (selector === ":window") bindTargets.push(currentWin);
8079
- else if (selector === ":document") bindTargets.push(currentWin.document);
8080
- else if (selector === ":parentHost") applyRootOption(hostSet.$parentHost);
8081
- else if (selector === ":appHost") applyRootOption(hostSet.$appHost);
8082
- else if (selector === ":firstHost") applyRootOption(hostSet.$firstHost);
8083
- else if (selector === ":lastHost") applyRootOption(hostSet.$lastHost);
8084
- else if (selector === ":firstAppHost") applyRootOption(hostSet.$firstAppHost);
8085
- else if (selector === ":lastAppHost") applyRootOption(hostSet.$lastAppHost);
8086
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRootOption);
8087
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRootOption);
8088
- else if (selector === ":host" || !selector) applyRootOption(this);
8089
- else {
8090
- const searchRoots = [];
8091
- if (r === "auto") searchRoots.push(this.shadowRoot || this);
8092
- else if (r === "light") searchRoots.push(this);
8093
- else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
8094
- else if (r === "all") {
8095
- searchRoots.push(this);
8096
- if (this.shadowRoot) searchRoots.push(this.shadowRoot);
8054
+ if (selector === "$window") bindTargets.push(currentWin);
8055
+ else if (selector === "$document") bindTargets.push(currentWin.document);
8056
+ else if (selector === "$host") applyRootOption(helperHostSet.$host);
8057
+ else if (selector === "$parentHost") applyRootOption(helperHostSet.$parentHost);
8058
+ else if (selector === "$appHost") applyRootOption(helperHostSet.$appHost);
8059
+ else if (selector === "$firstHost") applyRootOption(helperHostSet.$firstHost);
8060
+ else if (selector === "$lastHost") applyRootOption(helperHostSet.$lastHost);
8061
+ else if (selector === "$firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
8062
+ else if (selector === "$lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
8063
+ else if (selector === "$hosts") helperHostSet.$hosts.forEach(applyRootOption);
8064
+ else if (selector === "$appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
8065
+ else if (selector === "$this" || !selector) applyRootOption(this);
8066
+ else {
8067
+ const searchRoots = [];
8068
+ if (r === "auto") searchRoots.push(this.shadowRoot || this);
8069
+ else if (r === "light") searchRoots.push(this);
8070
+ else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
8071
+ else if (r === "all") {
8072
+ searchRoots.push(this);
8073
+ if (this.shadowRoot) searchRoots.push(this.shadowRoot);
8074
+ }
8075
+ searchRoots.forEach((sr) => {
8076
+ sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
8077
+ });
8097
8078
  }
8098
- searchRoots.forEach((sr) => {
8099
- sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
8079
+ bindTargets.forEach((t) => {
8080
+ const handler = async (event) => {
8081
+ if (options.filter) {
8082
+ const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
8083
+ if (!options.filter(event, { currentThis: this, helper })) {
8084
+ return;
8085
+ }
8086
+ }
8087
+ if (options.stopPropagation) event.stopPropagation();
8088
+ if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8089
+ if (options.preventDefault) event.preventDefault();
8090
+ const currentHostSet = SwcUtils.getHostSet(this);
8091
+ const args = { event, ...currentHostSet, $el: t, $root: t };
8092
+ await this[meta.propertyKey](event, { currentHostSet, $$matchedElement: event.currentTarget }, args);
8093
+ };
8094
+ t.addEventListener(type, handler, opts);
8095
+ if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
8096
+ this._boundListeners.push({ target: t, type, handler, options: opts });
8097
+ }
8100
8098
  });
8101
- }
8102
- bindTargets.forEach((t) => {
8103
- const handler = async (event) => {
8104
- if (options.filter) {
8105
- const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
8106
- if (!options.filter(event, { currentThis: this, helper })) {
8107
- return;
8099
+ });
8100
+ if (originalConnected) await originalConnected.apply(this);
8101
+ const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
8102
+ if (aMethods) {
8103
+ for (const m of aMethods) await this._invokeLifecycleMethod(m, helperHostSet);
8104
+ }
8105
+ this._executeSwcScript("swc-on-connected", helperHostSet);
8106
+ this._executeSwcScript("swc-on-after-connected", helperHostSet);
8107
+ this.__swc_connected = true;
8108
+ for (let [name2, metaList] of Array.from(attrChangeMap)) {
8109
+ for (const meta of metaList) {
8110
+ if (meta.options.while === "connected") {
8111
+ const val = getAttributeValue(this, name2, { type: meta.options.type });
8112
+ if (val !== null) {
8113
+ await this[meta.propertyKey](val, null, name2, helperHostSet);
8108
8114
  }
8109
8115
  }
8110
- if (options.stopPropagation) event.stopPropagation();
8111
- if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8112
- if (options.preventDefault) event.preventDefault();
8113
- const currentHostSet = SwcUtils.getHostSet(this);
8114
- const args = { event, ...currentHostSet, $el: t, $root: t };
8115
- await this[meta.propertyKey](event, currentHostSet, args);
8116
- };
8117
- t.addEventListener(type, handler, opts);
8118
- if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
8119
- this._boundListeners.push({ target: t, type, handler, options: opts });
8120
8116
  }
8121
- });
8122
- });
8123
- if (originalConnected) originalConnected.apply(this);
8124
- const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
8125
- if (aMethods) {
8126
- for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
8127
- }
8128
- this._executeSwcScript("swc-on-connected", hostSet);
8129
- this._executeSwcScript("swc-on-after-connected", hostSet);
8130
- this.__swc_connected = true;
8131
- const appHostss = SwcUtils.findAllParentAppHostsDirect(this);
8132
- if (appHost2 && typeof appHost2._connected === "function") {
8133
- appHost2._connected(this);
8134
- } else if (appHost2 && typeof appHost2) {
8135
- appHost2._connected_safari ?? (appHost2._connected_safari = []);
8136
- appHost2._connected_safari.push(this);
8117
+ }
8118
+ } finally {
8119
+ if (appHost && typeof appHost._connectedDone === "function") {
8120
+ await appHost._connectedDone(this);
8121
+ }
8137
8122
  }
8138
8123
  };
8139
8124
  const originalDisconnected = proto.disconnectedCallback;
8140
8125
  proto.disconnectedCallback = function() {
8141
- const hostSet = SwcUtils.getHostSet(this);
8142
- this._executeSwcScript("swc-on-before-disconnected", hostSet);
8126
+ console.log("disconnnnnnnnnnnnnnnnnnn", helperHostSet, this);
8127
+ const appHost = helperHostSet.$appHost;
8128
+ if (appHost && typeof appHost._disconnected === "function") {
8129
+ appHost._disconnected(this);
8130
+ }
8131
+ this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
8143
8132
  const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
8144
8133
  if (bMethods) {
8145
- for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
8134
+ for (const m of bMethods) this._invokeLifecycleMethod(m, helperHostSet);
8146
8135
  }
8147
8136
  if (this._boundListeners) {
8148
8137
  this._boundListeners.forEach((l) => l.target.removeEventListener(l.type, l.handler, l.options));
@@ -8151,15 +8140,11 @@ var elementDefine = (name, config = {}) => (constructor) => {
8151
8140
  if (originalDisconnected) originalDisconnected.apply(this);
8152
8141
  const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);
8153
8142
  if (aMethods) {
8154
- for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
8143
+ for (const m of aMethods) this._invokeLifecycleMethod(m, helperHostSet);
8155
8144
  }
8156
- this._executeSwcScript("swc-on-disconnected", hostSet);
8157
- this._executeSwcScript("swc-on-after-disconnected", hostSet);
8145
+ this._executeSwcScript("swc-on-disconnected", helperHostSet);
8146
+ this._executeSwcScript("swc-on-after-disconnected", helperHostSet);
8158
8147
  this.__swc_connected = false;
8159
- const appHost2 = hostSet.$appHost;
8160
- if (appHost2 && typeof appHost2._disconnected === "function") {
8161
- appHost2._disconnected(this);
8162
- }
8163
8148
  };
8164
8149
  const originalAdopted = proto.adoptedCallback;
8165
8150
  proto.adoptedCallback = function() {
@@ -8184,12 +8169,12 @@ var elementDefine = (name, config = {}) => (constructor) => {
8184
8169
  let processedVal = newVal;
8185
8170
  if (newVal !== null) {
8186
8171
  const ae = new ActionExpression(newVal);
8187
- const expr = ae.getFirstExpression("call-return");
8172
+ const expr = ae.getFirstExpression("callReturn");
8188
8173
  if (expr) {
8189
8174
  const win2 = this._resolveWindow?.() || (typeof window !== "undefined" ? window : void 0);
8190
8175
  const helperAndHostSet = SwcUtils.getHelperAndHostSet(win2, this);
8176
+ const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
8191
8177
  try {
8192
- const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
8193
8178
  const result = FunctionUtils.executeReturn({
8194
8179
  script,
8195
8180
  context: this,
@@ -8215,6 +8200,9 @@ var elementDefine = (name, config = {}) => (constructor) => {
8215
8200
  const metaList = attrChangeMap.get(name2);
8216
8201
  if (metaList && Array.isArray(metaList)) {
8217
8202
  for (const meta of metaList) {
8203
+ if (meta.options.while === "connected" && !this.__swc_connected) {
8204
+ continue;
8205
+ }
8218
8206
  const convertedVal = convertAttributeValue(processedVal, meta.options.type);
8219
8207
  this[meta.propertyKey](convertedVal, old, name2, hSet);
8220
8208
  }
@@ -8248,7 +8236,7 @@ var getAttributeValue = (inst, attrName, options) => {
8248
8236
  if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
8249
8237
  let domVal = primaryTarget.getAttribute(attrName);
8250
8238
  const ae = new ActionExpression(domVal);
8251
- const expr = ae.getFirstExpression("call-return");
8239
+ const expr = ae.getFirstExpression("callReturn");
8252
8240
  if (expr) {
8253
8241
  try {
8254
8242
  const result = FunctionUtils.executeReturn({
@@ -8278,20 +8266,21 @@ var resolveTargetEls = (inst, selector, options, currentWin) => {
8278
8266
  if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
8279
8267
  }
8280
8268
  };
8281
- if (selector === ":host" || !selector) {
8269
+ if (selector === "$this" || !selector) {
8282
8270
  applyRoot(inst);
8283
- } else if (selector === ":window") {
8271
+ } else if (selector === "$window") {
8284
8272
  results.push(currentWin);
8285
- } else if (selector === ":document") {
8273
+ } else if (selector === "$document") {
8286
8274
  results.push(currentWin.document);
8287
8275
  } else {
8288
8276
  const hostSet = SwcUtils.getHostSet(inst);
8289
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8290
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8291
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8292
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8293
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8294
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8277
+ if (selector === "$host") applyRoot(hostSet.$host);
8278
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
8279
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
8280
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
8281
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
8282
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
8283
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
8295
8284
  else {
8296
8285
  if (r === "shadow") {
8297
8286
  const found = inst.shadowRoot?.querySelectorAll(selector);
@@ -8363,22 +8352,22 @@ function attribute(selector, options = {}) {
8363
8352
  }
8364
8353
  };
8365
8354
  }
8366
- function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
8355
+ function attributeThis(targetOrAttrOrOptions, propertyKeyOrOptions) {
8367
8356
  if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
8368
- return attribute(":host", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
8357
+ return attribute("$this", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
8369
8358
  }
8370
8359
  if (typeof targetOrAttrOrOptions === "string") {
8371
8360
  const attrName = targetOrAttrOrOptions;
8372
8361
  const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
8373
- return attribute(":host", { ...options, name: attrName });
8362
+ return attribute("$this", { ...options, name: attrName });
8374
8363
  } else if (typeof targetOrAttrOrOptions === "object") {
8375
8364
  const options = targetOrAttrOrOptions;
8376
8365
  return (target, propertyKey) => {
8377
- return attribute(":host", { ...options, name: String(propertyKey) })(target, propertyKey);
8366
+ return attribute("$this", { ...options, name: String(propertyKey) })(target, propertyKey);
8378
8367
  };
8379
8368
  } else {
8380
8369
  return (target, propertyKey) => {
8381
- return attribute(":host", { name: String(propertyKey) })(target, propertyKey);
8370
+ return attribute("$this", { name: String(propertyKey) })(target, propertyKey);
8382
8371
  };
8383
8372
  }
8384
8373
  }
@@ -8447,11 +8436,12 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
8447
8436
  if (r === "all") return t.shadowRoot || t;
8448
8437
  return t;
8449
8438
  };
8450
- if (selector === ":host") return applyRoot(this);
8451
- if (selector === ":parentHost") return applyRoot(hostSet.$parentHost);
8452
- if (selector === ":appHost") return applyRoot(hostSet.$appHost);
8453
- if (selector === ":firstHost") return applyRoot(hostSet.$firstHost);
8454
- if (selector === ":lastHost") return applyRoot(hostSet.$lastHost);
8439
+ if (selector === "$this") return applyRoot(this);
8440
+ if (selector === "$host") return applyRoot(hostSet.$host);
8441
+ if (selector === "$parentHost") return applyRoot(hostSet.$parentHost);
8442
+ if (selector === "$appHost") return applyRoot(hostSet.$appHost);
8443
+ if (selector === "$firstHost") return applyRoot(hostSet.$firstHost);
8444
+ if (selector === "$lastHost") return applyRoot(hostSet.$lastHost);
8455
8445
  const targetRoot = applyRoot(this);
8456
8446
  return targetRoot ? targetRoot.querySelector(selector) : null;
8457
8447
  };
@@ -8489,20 +8479,20 @@ var findAllApplyNodeMetadata = (target) => {
8489
8479
  });
8490
8480
  return result;
8491
8481
  };
8492
- function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
8493
- if (propertyKey !== void 0) return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
8482
+ function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
8483
+ if (propertyKey !== void 0) return applyNode("$this", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
8494
8484
  const opt = targetOrOptions || {};
8495
- return applyNode(":host", { position: "beforeEnd", ...opt });
8485
+ return applyNode("$this", { position: "beforeEnd", ...opt });
8496
8486
  }
8497
- function applyReplaceChildrenNodeHost(targetOrOptions, propertyKey, descriptor) {
8498
- if (propertyKey !== void 0) return applyNode(":host", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
8487
+ function applyReplaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
8488
+ if (propertyKey !== void 0) return applyNode("$this", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
8499
8489
  const opt = targetOrOptions || {};
8500
- return applyNode(":host", { position: "replaceChildren", ...opt });
8490
+ return applyNode("$this", { position: "replaceChildren", ...opt });
8501
8491
  }
8502
- function applyInnerHtmlNodeHost(targetOrOptions, propertyKey, descriptor) {
8503
- if (propertyKey !== void 0) return applyNode(":host", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
8492
+ function applyInnerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
8493
+ if (propertyKey !== void 0) return applyNode("$this", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
8504
8494
  const opt = targetOrOptions || {};
8505
- return applyNode(":host", { position: "innerHtml", ...opt });
8495
+ return applyNode("$this", { position: "innerHtml", ...opt });
8506
8496
  }
8507
8497
  function applyReplaceChildrenNode(selector, options = {}) {
8508
8498
  return applyNode(selector, { ...options, position: "replaceChildren" });
@@ -8510,6 +8500,9 @@ function applyReplaceChildrenNode(selector, options = {}) {
8510
8500
  function applyInnerHtmlNode(selector, options = {}) {
8511
8501
  return applyNode(selector, { ...options, position: "innerHtml" });
8512
8502
  }
8503
+ function applyInnerTextNode(selector, options = {}) {
8504
+ return applyNode(selector, { ...options, position: "innerText" });
8505
+ }
8513
8506
 
8514
8507
  // src/decorators/applyClass.ts
8515
8508
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
@@ -8537,25 +8530,26 @@ function createClassDecorator(action) {
8537
8530
  const handleResult = (resolvedValue) => {
8538
8531
  if (resolvedValue !== void 0) {
8539
8532
  const win = this.ownerDocument?.defaultView || window;
8540
- const host2 = this;
8541
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
8533
+ const host = this;
8534
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
8542
8535
  const r = finalOptions.root || "auto";
8543
8536
  const targetEls = [];
8544
8537
  const applyRoot = (t) => {
8545
8538
  if (!t || !(t instanceof win.HTMLElement)) return;
8546
8539
  targetEls.push(t);
8547
8540
  };
8548
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8549
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8550
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8551
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8552
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8553
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8554
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8555
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8556
- else if (selector === ":host" || !selector) applyRoot(host2);
8541
+ if (selector === "$this" || !selector) applyRoot(host);
8542
+ else if (selector === "$host") applyRoot(hostSet.$host);
8543
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
8544
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
8545
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
8546
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
8547
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
8548
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
8549
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
8550
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
8557
8551
  else {
8558
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8552
+ const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
8559
8553
  if (targetRoot) {
8560
8554
  const found = targetRoot.querySelectorAll(selector);
8561
8555
  if (found) targetEls.push(...Array.from(found));
@@ -8629,14 +8623,14 @@ var updateClass = (selector, classMapOrOptions, options = {}) => createClassDeco
8629
8623
  var addClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("add")(selector, classMapOrOptions, options);
8630
8624
  var removeClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("remove")(selector, classMapOrOptions, options);
8631
8625
  var toggleClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("toggle")(selector, classMapOrOptions, options);
8632
- function applyClassHost(action = "update", options = {}) {
8633
- return createClassDecorator(action)(":host", options);
8626
+ function applyClassThis(action = "update", options = {}) {
8627
+ return createClassDecorator(action)("$this", options);
8634
8628
  }
8635
- var setClassHost = (classMapOrOptions, options = {}) => createClassDecorator("set")(":host", classMapOrOptions, options);
8636
- var updateClassHost = (classMapOrOptions, options = {}) => createClassDecorator("update")(":host", classMapOrOptions, options);
8637
- var addClassHost = (classMapOrOptions, options = {}) => createClassDecorator("add")(":host", classMapOrOptions, options);
8638
- var removeClassHost = (classMapOrOptions, options = {}) => createClassDecorator("remove")(":host", classMapOrOptions, options);
8639
- var toggleClassHost = (classMapOrOptions, options = {}) => createClassDecorator("toggle")(":host", classMapOrOptions, options);
8629
+ var setClassThis = (classMapOrOptions, options = {}) => createClassDecorator("set")("$this", classMapOrOptions, options);
8630
+ var updateClassThis = (classMapOrOptions, options = {}) => createClassDecorator("update")("$this", classMapOrOptions, options);
8631
+ var addClassThis = (classMapOrOptions, options = {}) => createClassDecorator("add")("$this", classMapOrOptions, options);
8632
+ var removeClassThis = (classMapOrOptions, options = {}) => createClassDecorator("remove")("$this", classMapOrOptions, options);
8633
+ var toggleClassThis = (classMapOrOptions, options = {}) => createClassDecorator("toggle")("$this", classMapOrOptions, options);
8640
8634
  var findAllClassMetadata = (target) => {
8641
8635
  const result = /* @__PURE__ */ new Map();
8642
8636
  const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
@@ -8667,25 +8661,26 @@ function createStyleDecorator(action) {
8667
8661
  const handleResult = (resolvedValue) => {
8668
8662
  if (resolvedValue !== void 0) {
8669
8663
  const win = this.ownerDocument?.defaultView || window;
8670
- const host2 = this;
8671
- const hostSet = SwcUtils.getHelperAndHostSet(win, host2);
8664
+ const host = this;
8665
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
8672
8666
  const r = options.root || "auto";
8673
8667
  const targetEls = [];
8674
8668
  const applyRoot = (t) => {
8675
8669
  if (!t || !(t instanceof win.HTMLElement)) return;
8676
8670
  targetEls.push(t);
8677
8671
  };
8678
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8679
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8680
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8681
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8682
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8683
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8684
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8685
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8686
- else if (selector === ":host" || !selector) applyRoot(host2);
8672
+ if (selector === "$this" || !selector) applyRoot(host);
8673
+ else if (selector === "$host") applyRoot(hostSet.$host);
8674
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
8675
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
8676
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
8677
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
8678
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
8679
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
8680
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
8681
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
8687
8682
  else {
8688
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8683
+ const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
8689
8684
  if (targetRoot) {
8690
8685
  const found = targetRoot.querySelectorAll(selector);
8691
8686
  if (found) targetEls.push(...Array.from(found));
@@ -8743,12 +8738,12 @@ function applyStyle(selector, action = "update", options = {}) {
8743
8738
  var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
8744
8739
  var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
8745
8740
  var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
8746
- function applyStyleHost(action = "update", options = {}) {
8747
- return createStyleDecorator(action)(":host", options);
8741
+ function applyStyleThis(action = "update", options = {}) {
8742
+ return createStyleDecorator(action)("$this", options);
8748
8743
  }
8749
- var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
8750
- var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
8751
- var removeStyleHost = (options = {}) => createStyleDecorator("remove")(":host", options);
8744
+ var setStyleThis = (options = {}) => createStyleDecorator("set")("$this", options);
8745
+ var updateStyleThis = (options = {}) => createStyleDecorator("update")("$this", options);
8746
+ var removeStyleThis = (options = {}) => createStyleDecorator("remove")("$this", options);
8752
8747
  var findAllStyleMetadata = (target) => {
8753
8748
  const result = /* @__PURE__ */ new Map();
8754
8749
  const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
@@ -8787,25 +8782,26 @@ var setProperty = (selector, propertyNameOrOptions, options = {}) => {
8787
8782
  const handleResult = (resolvedValue) => {
8788
8783
  if (resolvedValue !== void 0) {
8789
8784
  const win = this.ownerDocument?.defaultView || window;
8790
- const host2 = this;
8791
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
8785
+ const host = this;
8786
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
8792
8787
  const r = finalOptions.root || "auto";
8793
8788
  const targetEls = [];
8794
8789
  const applyRoot = (t) => {
8795
8790
  if (!t || !(t instanceof win.HTMLElement)) return;
8796
8791
  targetEls.push(t);
8797
8792
  };
8798
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8799
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8800
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8801
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8802
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8803
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8804
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8805
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8806
- else if (selector === ":host" || !selector) applyRoot(host2);
8793
+ if (selector === "$this" || !selector) applyRoot(host);
8794
+ else if (selector === "$host") applyRoot(hostSet.$host);
8795
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
8796
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
8797
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
8798
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
8799
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
8800
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
8801
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
8802
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
8807
8803
  else {
8808
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8804
+ const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
8809
8805
  if (targetRoot) {
8810
8806
  const found = targetRoot.querySelectorAll(selector);
8811
8807
  if (found) targetEls.push(...Array.from(found));
@@ -8838,8 +8834,8 @@ var setProperty = (selector, propertyNameOrOptions, options = {}) => {
8838
8834
  };
8839
8835
  };
8840
8836
  };
8841
- var setPropertyHost = (propertyNameOrOptions, options = {}) => {
8842
- return setProperty(":host", propertyNameOrOptions, options);
8837
+ var setPropertyThis = (propertyNameOrOptions, options = {}) => {
8838
+ return setProperty("$this", propertyNameOrOptions, options);
8843
8839
  };
8844
8840
 
8845
8841
  // src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts
@@ -8854,7 +8850,7 @@ function createSubscribeSwcAppRouteChangeWhileConnected(options) {
8854
8850
  list = [];
8855
8851
  ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
8856
8852
  }
8857
- list.push({ propertyKey, pathPattern, filter });
8853
+ list.push({ propertyKey, options });
8858
8854
  return descriptor;
8859
8855
  };
8860
8856
  }
@@ -8865,7 +8861,7 @@ function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKey,
8865
8861
  let options = {};
8866
8862
  if (Array.isArray(targetOrOptions)) {
8867
8863
  options.path = targetOrOptions;
8868
- } else if (typeof targetOrOptions === "string") {
8864
+ } else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
8869
8865
  options.path = targetOrOptions;
8870
8866
  } else if (targetOrOptions && typeof targetOrOptions === "object") {
8871
8867
  options = targetOrOptions;
@@ -8934,9 +8930,9 @@ function createPublishSwcAppMessage(messageType) {
8934
8930
  const result = originalMethod.apply(this, args);
8935
8931
  if (result instanceof Promise) {
8936
8932
  result.then((data) => {
8937
- const appHost2 = SwcUtils.getAppHost(this);
8938
- if (appHost2) {
8939
- appHost2.publishMessage({
8933
+ const appHost = SwcUtils.getAppHost(this);
8934
+ if (appHost) {
8935
+ appHost.publishMessage({
8940
8936
  publisher: this,
8941
8937
  data,
8942
8938
  type: messageType
@@ -8946,9 +8942,9 @@ function createPublishSwcAppMessage(messageType) {
8946
8942
  console.warn("publishSwcAppMessage async error:", err);
8947
8943
  });
8948
8944
  } else {
8949
- const appHost2 = SwcUtils.getAppHost(this);
8950
- if (appHost2) {
8951
- appHost2.publishMessage({
8945
+ const appHost = SwcUtils.getAppHost(this);
8946
+ if (appHost) {
8947
+ appHost.publishMessage({
8952
8948
  publisher: this,
8953
8949
  data: result,
8954
8950
  type: messageType
@@ -9011,6 +9007,22 @@ var RouterAction;
9011
9007
  return typeof obj?.hasActivate === "function";
9012
9008
  };
9013
9009
  })(RouterAction || (RouterAction = {}));
9010
+
9011
+ // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
9012
+ var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
9013
+
9014
+ // ../simple-boot/dist/esm/fetch/ApiService.js
9015
+ var ApiServiceInterceptor;
9016
+ ((ApiServiceInterceptor2) => {
9017
+ ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
9018
+ ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
9019
+ try {
9020
+ return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
9021
+ } catch (e) {
9022
+ return [];
9023
+ }
9024
+ };
9025
+ })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
9014
9026
  export {
9015
9027
  ADD_EVENT_LISTENER_METADATA_KEY,
9016
9028
  APPLY_NODE_METADATA_KEY,
@@ -9045,40 +9057,37 @@ export {
9045
9057
  SWC_NOT_FOUND,
9046
9058
  SwcUtils,
9047
9059
  addClass,
9048
- addClassHost,
9060
+ addClassThis,
9049
9061
  addEventListener,
9050
9062
  addEventListenerAppHost,
9051
- addEventListenerHost,
9063
+ addEventListenerDocument,
9064
+ addEventListenerThis,
9065
+ addEventListenerWindow,
9052
9066
  allAppHost,
9053
- allFirstAppHost,
9054
- allFirstHost,
9055
- allHost,
9056
- allLastAppHost,
9057
- allLastHost,
9058
9067
  allParentHost,
9059
- appHost,
9060
9068
  applyAttribute,
9061
- applyAttributeHost,
9069
+ applyAttributeThis,
9062
9070
  applyClass,
9063
- applyClassHost,
9071
+ applyClassThis,
9064
9072
  applyInnerHtmlNode,
9065
- applyInnerHtmlNodeHost,
9073
+ applyInnerHtmlNodeThis,
9074
+ applyInnerTextNode,
9066
9075
  applyNode,
9067
- applyNodeHost,
9076
+ applyNodeThis,
9068
9077
  applyReplaceChildrenNode,
9069
- applyReplaceChildrenNodeHost,
9078
+ applyReplaceChildrenNodeThis,
9070
9079
  applyStyle,
9071
- applyStyleHost,
9080
+ applyStyleThis,
9072
9081
  attribute,
9073
- attributeHost,
9074
- changedAttributeHost,
9082
+ attributeThis,
9083
+ changedAttributeThis,
9075
9084
  commentNode,
9076
9085
  convertAttributeValue,
9077
9086
  convertValue2 as convertValue,
9078
9087
  createElement,
9079
9088
  elementDefine,
9080
9089
  emitCustomEvent,
9081
- emitCustomEventHost,
9090
+ emitCustomEventThis,
9082
9091
  ensureInit,
9083
9092
  findAllApplyNodeMetadata,
9084
9093
  findAllAttributeApplyMetadata,
@@ -9087,8 +9096,6 @@ export {
9087
9096
  findAllClassMetadata,
9088
9097
  findAllLifecycleMetadata,
9089
9098
  findAllStyleMetadata,
9090
- firstAppHost,
9091
- firstHost,
9092
9099
  getAddEventListenerMetadata,
9093
9100
  getAttributeValue,
9094
9101
  getChangedAttributeMetadata,
@@ -9100,7 +9107,6 @@ export {
9100
9107
  getQueryMetadata,
9101
9108
  getSubscribeSwcAppMessageWhileConnectedMetadata,
9102
9109
  getSubscribeSwcAppRouteChangeWhileConnectedMetadata,
9103
- host,
9104
9110
  htmlAElement,
9105
9111
  htmlArticleElement,
9106
9112
  htmlButtonElement,
@@ -9112,53 +9118,53 @@ export {
9112
9118
  htmlSectionElement,
9113
9119
  htmlSpanElement,
9114
9120
  htmlUlElement,
9115
- lastAppHost,
9116
- lastHost,
9117
9121
  onAddEventListener,
9118
9122
  onAdopted,
9119
- onAfterAdopted,
9120
- onAfterConnected,
9121
- onAfterDisconnected,
9122
- onBeforeAdopted,
9123
- onBeforeConnected,
9124
- onBeforeDisconnected,
9123
+ onAdoptedAfter,
9124
+ onAdoptedBefore,
9125
9125
  onConnected,
9126
+ onConnectedAfter,
9127
+ onConnectedBefore,
9126
9128
  onConnectedInnerHtml,
9127
- onConnectedSwcApp,
9128
9129
  onDisconnected,
9130
+ onDisconnectedAfter,
9131
+ onDisconnectedBefore,
9129
9132
  onInitialize,
9130
- parentHost,
9131
9133
  publishSwcAppMessage,
9132
9134
  query,
9133
9135
  queryAll,
9134
- queryAllHost,
9136
+ queryAllThis,
9137
+ queryAppHost,
9138
+ queryDocument,
9135
9139
  queryHost,
9140
+ queryThis,
9141
+ queryWindow,
9136
9142
  removeAttribute,
9137
- removeAttributeHost,
9143
+ removeAttributeThis,
9138
9144
  removeClass,
9139
- removeClassHost,
9145
+ removeClassThis,
9140
9146
  removeStyle,
9141
- removeStyleHost,
9147
+ removeStyleThis,
9142
9148
  resolveTargetEls,
9143
9149
  setAttribute,
9144
- setAttributeHost,
9150
+ setAttributeThis,
9145
9151
  setClass,
9146
- setClassHost,
9152
+ setClassThis,
9147
9153
  setProperty,
9148
- setPropertyHost,
9154
+ setPropertyThis,
9149
9155
  setStyle,
9150
- setStyleHost,
9156
+ setStyleThis,
9151
9157
  subscribeSwcAppMessageWhileConnected,
9152
9158
  subscribeSwcAppRouteChangeWhileConnected,
9153
9159
  textNode,
9154
9160
  toggleClass,
9155
- toggleClassHost,
9161
+ toggleClassThis,
9156
9162
  updateAttribute,
9157
- updateAttributeHost,
9163
+ updateAttributeThis,
9158
9164
  updateClass,
9159
- updateClassHost,
9165
+ updateClassThis,
9160
9166
  updateStyle,
9161
- updateStyleHost
9167
+ updateStyleThis
9162
9168
  };
9163
9169
  /*! Bundled license information:
9164
9170