@dooboostore/simple-web-component 1.0.33 → 1.0.35

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 (150) hide show
  1. package/README.md +23 -30
  2. package/dist/cjs/decorators/addEventListener.js.map +1 -1
  3. package/dist/cjs/decorators/applyAttribute.js +67 -57
  4. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  5. package/dist/cjs/decorators/applyClass.js +80 -70
  6. package/dist/cjs/decorators/applyClass.js.map +2 -2
  7. package/dist/cjs/decorators/applyNode.js +5 -8
  8. package/dist/cjs/decorators/applyNode.js.map +2 -2
  9. package/dist/cjs/decorators/applyStyle.js +66 -56
  10. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  11. package/dist/cjs/decorators/attribute.js +35 -29
  12. package/dist/cjs/decorators/attribute.js.map +2 -2
  13. package/dist/cjs/decorators/changedAttributeHost.js +32 -12
  14. package/dist/cjs/decorators/changedAttributeHost.js.map +2 -2
  15. package/dist/cjs/decorators/elementDefine.js +238 -180
  16. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  17. package/dist/cjs/decorators/emitCustomEvent.js +67 -48
  18. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  19. package/dist/cjs/decorators/lifecycles.js +15 -17
  20. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  21. package/dist/cjs/decorators/setProperty.js +50 -39
  22. package/dist/cjs/decorators/setProperty.js.map +2 -2
  23. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  24. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
  25. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  26. package/dist/cjs/elements/SwcAppEngine.js +14 -8
  27. package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
  28. package/dist/cjs/elements/SwcAppMixin.js +154 -81
  29. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  30. package/dist/cjs/elements/SwcAsync.js +28 -18
  31. package/dist/cjs/elements/SwcAsync.js.map +2 -2
  32. package/dist/cjs/elements/SwcChoose.js +68 -45
  33. package/dist/cjs/elements/SwcChoose.js.map +2 -2
  34. package/dist/cjs/elements/SwcIf.js +52 -30
  35. package/dist/cjs/elements/SwcIf.js.map +2 -2
  36. package/dist/cjs/elements/SwcLoop.js +109 -35
  37. package/dist/cjs/elements/SwcLoop.js.map +2 -2
  38. package/dist/cjs/elements/register.js +263 -131
  39. package/dist/cjs/elements/register.js.map +2 -2
  40. package/dist/cjs/router/ElementRouter.js +4 -2
  41. package/dist/cjs/router/ElementRouter.js.map +1 -1
  42. package/dist/cjs/types.js.map +1 -1
  43. package/dist/cjs/utils/Utils.js +25 -7
  44. package/dist/cjs/utils/Utils.js.map +2 -2
  45. package/dist/esm/decorators/addEventListener.js.map +1 -1
  46. package/dist/esm/decorators/applyAttribute.js +67 -57
  47. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  48. package/dist/esm/decorators/applyClass.js +80 -70
  49. package/dist/esm/decorators/applyClass.js.map +2 -2
  50. package/dist/esm/decorators/applyNode.js +5 -8
  51. package/dist/esm/decorators/applyNode.js.map +2 -2
  52. package/dist/esm/decorators/applyStyle.js +66 -56
  53. package/dist/esm/decorators/applyStyle.js.map +2 -2
  54. package/dist/esm/decorators/attribute.js +35 -29
  55. package/dist/esm/decorators/attribute.js.map +2 -2
  56. package/dist/esm/decorators/changedAttributeHost.js +32 -12
  57. package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
  58. package/dist/esm/decorators/elementDefine.js +240 -182
  59. package/dist/esm/decorators/elementDefine.js.map +2 -2
  60. package/dist/esm/decorators/emitCustomEvent.js +67 -48
  61. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  62. package/dist/esm/decorators/lifecycles.js +15 -17
  63. package/dist/esm/decorators/lifecycles.js.map +2 -2
  64. package/dist/esm/decorators/setProperty.js +50 -39
  65. package/dist/esm/decorators/setProperty.js.map +2 -2
  66. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  67. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
  68. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  69. package/dist/esm/elements/SwcAppEngine.js +14 -7
  70. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  71. package/dist/esm/elements/SwcAppMixin.js +156 -82
  72. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  73. package/dist/esm/elements/SwcAsync.js +28 -18
  74. package/dist/esm/elements/SwcAsync.js.map +2 -2
  75. package/dist/esm/elements/SwcChoose.js +69 -46
  76. package/dist/esm/elements/SwcChoose.js.map +2 -2
  77. package/dist/esm/elements/SwcIf.js +53 -31
  78. package/dist/esm/elements/SwcIf.js.map +2 -2
  79. package/dist/esm/elements/SwcLoop.js +110 -36
  80. package/dist/esm/elements/SwcLoop.js.map +2 -2
  81. package/dist/esm/elements/register.js +264 -132
  82. package/dist/esm/elements/register.js.map +2 -2
  83. package/dist/esm/router/ElementRouter.js +5 -2
  84. package/dist/esm/router/ElementRouter.js.map +1 -1
  85. package/dist/esm/types.js.map +1 -1
  86. package/dist/esm/utils/Utils.js +25 -7
  87. package/dist/esm/utils/Utils.js.map +2 -2
  88. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +728 -595
  89. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  90. package/dist/types/decorators/addEventListener.d.ts +4 -1
  91. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  92. package/dist/types/decorators/applyAttribute.d.ts +5 -1
  93. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  94. package/dist/types/decorators/applyClass.d.ts +4 -0
  95. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  96. package/dist/types/decorators/applyNode.d.ts +5 -1
  97. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  98. package/dist/types/decorators/applyStyle.d.ts +5 -1
  99. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  100. package/dist/types/decorators/attribute.d.ts +5 -0
  101. package/dist/types/decorators/attribute.d.ts.map +1 -1
  102. package/dist/types/decorators/changedAttributeHost.d.ts +14 -3
  103. package/dist/types/decorators/changedAttributeHost.d.ts.map +1 -1
  104. package/dist/types/decorators/elementDefine.d.ts +1 -1
  105. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  106. package/dist/types/decorators/emitCustomEvent.d.ts +15 -7
  107. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  108. package/dist/types/decorators/lifecycles.d.ts +10 -7
  109. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  110. package/dist/types/decorators/setProperty.d.ts +5 -1
  111. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  112. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +2 -2
  113. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  114. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +5 -6
  115. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  116. package/dist/types/elements/SwcAppEngine.d.ts +9 -3
  117. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  118. package/dist/types/elements/SwcAppMixin.d.ts +12 -7
  119. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  120. package/dist/types/elements/register.d.ts.map +1 -1
  121. package/dist/types/types.d.ts +1 -0
  122. package/dist/types/types.d.ts.map +1 -1
  123. package/dist/types/utils/Utils.d.ts +4 -1
  124. package/dist/types/utils/Utils.d.ts.map +1 -1
  125. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +728 -595
  126. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  127. package/package.json +5 -5
  128. package/src/decorators/addEventListener.ts +1 -1
  129. package/src/decorators/applyAttribute.ts +74 -61
  130. package/src/decorators/applyClass.ts +91 -77
  131. package/src/decorators/applyNode.ts +16 -13
  132. package/src/decorators/applyStyle.ts +75 -61
  133. package/src/decorators/attribute.ts +55 -43
  134. package/src/decorators/changedAttributeHost.ts +49 -15
  135. package/src/decorators/elementDefine.ts +401 -340
  136. package/src/decorators/emitCustomEvent.ts +92 -62
  137. package/src/decorators/lifecycles.ts +11 -10
  138. package/src/decorators/setProperty.ts +58 -44
  139. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +2 -2
  140. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +11 -11
  141. package/src/elements/SwcAppEngine.ts +19 -13
  142. package/src/elements/SwcAppMixin.ts +214 -102
  143. package/src/elements/SwcAsync.ts +28 -17
  144. package/src/elements/SwcChoose.ts +94 -36
  145. package/src/elements/SwcIf.ts +59 -22
  146. package/src/elements/SwcLoop.ts +140 -27
  147. package/src/elements/register.ts +319 -100
  148. package/src/types.ts +1 -0
  149. package/src/utils/Utils.ts +38 -10
  150. package/tsconfig.json +2 -2
@@ -1169,6 +1169,7 @@ var dooboostoreSimpleWebComponent = (() => {
1169
1169
  applyClassHost: () => applyClassHost,
1170
1170
  applyInnerHtmlNode: () => applyInnerHtmlNode,
1171
1171
  applyInnerHtmlNodeHost: () => applyInnerHtmlNodeHost,
1172
+ applyInnerTextNode: () => applyInnerTextNode,
1172
1173
  applyNode: () => applyNode,
1173
1174
  applyNodeHost: () => applyNodeHost,
1174
1175
  applyReplaceChildrenNode: () => applyReplaceChildrenNode,
@@ -1179,6 +1180,8 @@ var dooboostoreSimpleWebComponent = (() => {
1179
1180
  attributeHost: () => attributeHost,
1180
1181
  changedAttributeHost: () => changedAttributeHost,
1181
1182
  commentNode: () => commentNode,
1183
+ convertAttributeValue: () => convertAttributeValue,
1184
+ convertValue: () => convertValue2,
1182
1185
  createElement: () => createElement,
1183
1186
  elementDefine: () => elementDefine,
1184
1187
  emitCustomEvent: () => emitCustomEvent,
@@ -1194,6 +1197,7 @@ var dooboostoreSimpleWebComponent = (() => {
1194
1197
  firstAppHost: () => firstAppHost,
1195
1198
  firstHost: () => firstHost,
1196
1199
  getAddEventListenerMetadata: () => getAddEventListenerMetadata,
1200
+ getAttributeValue: () => getAttributeValue,
1197
1201
  getChangedAttributeMetadata: () => getChangedAttributeMetadata,
1198
1202
  getElementConfig: () => getElementConfig,
1199
1203
  getEmitCustomEventMetadataList: () => getEmitCustomEventMetadataList,
@@ -1219,16 +1223,15 @@ var dooboostoreSimpleWebComponent = (() => {
1219
1223
  lastHost: () => lastHost,
1220
1224
  onAddEventListener: () => onAddEventListener,
1221
1225
  onAdopted: () => onAdopted,
1222
- onAfterAdopted: () => onAfterAdopted,
1223
- onAfterConnected: () => onAfterConnected,
1224
- onAfterDisconnected: () => onAfterDisconnected,
1225
- onBeforeAdopted: () => onBeforeAdopted,
1226
- onBeforeConnected: () => onBeforeConnected,
1227
- onBeforeDisconnected: () => onBeforeDisconnected,
1226
+ onAdoptedAfter: () => onAdoptedAfter,
1227
+ onAdoptedBefore: () => onAdoptedBefore,
1228
1228
  onConnected: () => onConnected,
1229
+ onConnectedAfter: () => onConnectedAfter,
1230
+ onConnectedBefore: () => onConnectedBefore,
1229
1231
  onConnectedInnerHtml: () => onConnectedInnerHtml,
1230
- onConnectedSwcApp: () => onConnectedSwcApp,
1231
1232
  onDisconnected: () => onDisconnected,
1233
+ onDisconnectedAfter: () => onDisconnectedAfter,
1234
+ onDisconnectedBefore: () => onDisconnectedBefore,
1232
1235
  onInitialize: () => onInitialize,
1233
1236
  parentHost: () => parentHost,
1234
1237
  publishSwcAppMessage: () => publishSwcAppMessage,
@@ -5880,6 +5883,11 @@ var dooboostoreSimpleWebComponent = (() => {
5880
5883
  })(Expression || (Expression = {}));
5881
5884
 
5882
5885
  // ../core/dist/esm/expression/ActionExpression.js
5886
+ var DEFAULT_EXPRESSION_CONFIG = {
5887
+ "callReturn": { start: "{{=", end: "}}" },
5888
+ "call": { start: "{{@", end: "}}" },
5889
+ "replace": { start: "{{", end: "}}" }
5890
+ };
5883
5891
  var ActionExpression = class {
5884
5892
  constructor(value, config) {
5885
5893
  this.originalTemplate = value || "";
@@ -5893,12 +5901,19 @@ var dooboostoreSimpleWebComponent = (() => {
5893
5901
  }
5894
5902
  this.maskingTemplate = value;
5895
5903
  this.currentTemplate = value;
5896
- if (config?.wrapExpression) {
5897
- this.processWrapExpressions(this.currentTemplate, config.wrapExpression);
5904
+ const exprConfig = {
5905
+ "callReturn": config?.expression?.["callReturn"] || DEFAULT_EXPRESSION_CONFIG["callReturn"],
5906
+ "call": config?.expression?.call || DEFAULT_EXPRESSION_CONFIG.call,
5907
+ "replace": config?.expression?.replace || DEFAULT_EXPRESSION_CONFIG.replace
5908
+ };
5909
+ const types = ["callReturn", "call", "replace"];
5910
+ types.sort((a, b) => exprConfig[b].start.length - exprConfig[a].start.length);
5911
+ for (const type of types) {
5912
+ const marker = exprConfig[type];
5913
+ if (marker) {
5914
+ this.processExpressionType(type, marker.start, marker.end);
5915
+ }
5898
5916
  }
5899
- this.processCallReturnExpressions(this.currentTemplate);
5900
- this.processCallExpressions(this.currentTemplate);
5901
- this.processReplaceExpressions(this.currentTemplate);
5902
5917
  this.sortExpressionsByPosition();
5903
5918
  this.maskingTemplate = this.currentTemplate;
5904
5919
  }
@@ -5909,45 +5924,17 @@ var dooboostoreSimpleWebComponent = (() => {
5909
5924
  });
5910
5925
  this.expressions.sort((a, b) => (a.index ?? 0) - (b.index ?? 0));
5911
5926
  }
5912
- processWrapExpressions(value, wrapExpression) {
5913
- const wrapChar = wrapExpression.trim();
5914
- const escapedWrap = wrapChar.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5915
- const wrappedCallReturnRegex = new RegExp(`${escapedWrap}\\{\\{=\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
5916
- let match;
5917
- while ((match = wrappedCallReturnRegex.exec(value)) !== null) {
5918
- this.addExpression(match, "call-return", wrapChar);
5919
- }
5920
- const wrappedCallRegex = new RegExp(`${escapedWrap}\\{\\{@\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
5921
- while ((match = wrappedCallRegex.exec(value)) !== null) {
5922
- this.addExpression(match, "call", wrapChar);
5923
- }
5924
- const wrappedReplaceRegex = new RegExp(`${escapedWrap}\\{\\{(?![=@])\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
5925
- while ((match = wrappedReplaceRegex.exec(value)) !== null) {
5926
- this.addExpression(match, "replace", wrapChar);
5927
- }
5928
- }
5929
- processCallReturnExpressions(value) {
5930
- const callReturnRegex = /(?<![a-zA-Z0-9$_@#.])\{\{=\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
5931
- let match;
5932
- while ((match = callReturnRegex.exec(value)) !== null) {
5933
- this.addExpression(match, "call-return");
5934
- }
5935
- }
5936
- processCallExpressions(value) {
5937
- const callRegex = /(?<![a-zA-Z0-9$_@#.])\{\{@\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
5927
+ processExpressionType(type, start, end) {
5928
+ const escapedStart = start.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5929
+ const escapedEnd = end.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5930
+ const regex = new RegExp(`${escapedStart}\\s*([\\s\\S]+?)\\s*${escapedEnd}`, "g");
5938
5931
  let match;
5939
- while ((match = callRegex.exec(value)) !== null) {
5940
- this.addExpression(match, "call");
5932
+ const valueToMatch = this.currentTemplate;
5933
+ while ((match = regex.exec(valueToMatch)) !== null) {
5934
+ this.addExpression(match, type);
5941
5935
  }
5942
5936
  }
5943
- processReplaceExpressions(value) {
5944
- const replaceRegex = /(?<![a-zA-Z0-9$_@#.])\{\{(?![=@])\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
5945
- let match;
5946
- while ((match = replaceRegex.exec(value)) !== null) {
5947
- this.addExpression(match, "replace");
5948
- }
5949
- }
5950
- addExpression(match, type, wrap) {
5937
+ addExpression(match, type) {
5951
5938
  const id = Math.random().toString(36).substr(2, 9);
5952
5939
  const original = match[0];
5953
5940
  const rawScript = match[1];
@@ -5962,13 +5949,9 @@ var dooboostoreSimpleWebComponent = (() => {
5962
5949
  original,
5963
5950
  script: rawScript.trim(),
5964
5951
  expressionStart,
5965
- expressionEnd,
5966
- ...wrap && { wrap }
5952
+ expressionEnd
5967
5953
  });
5968
5954
  }
5969
- /**
5970
- * 구현 메서드
5971
- */
5972
5955
  replace(idOrExpr, valueOrCallback) {
5973
5956
  const id = typeof idOrExpr === "string" ? idOrExpr : idOrExpr.id;
5974
5957
  let expr;
@@ -5984,9 +5967,6 @@ var dooboostoreSimpleWebComponent = (() => {
5984
5967
  }
5985
5968
  return this.getUnprocessedTemplate();
5986
5969
  }
5987
- /**
5988
- * 구현 메서드
5989
- */
5990
5970
  getExpressions(typeOrOptions) {
5991
5971
  if (!typeOrOptions) {
5992
5972
  return this.expressions;
@@ -5997,13 +5977,9 @@ var dooboostoreSimpleWebComponent = (() => {
5997
5977
  const options = typeOrOptions;
5998
5978
  return this.expressions.filter((expr) => {
5999
5979
  if (options.type && expr.type !== options.type) return false;
6000
- if ("wrap" in options && expr.wrap !== options.wrap) return false;
6001
5980
  return true;
6002
5981
  });
6003
5982
  }
6004
- /**
6005
- * 구현 메서드
6006
- */
6007
5983
  getFirstExpression(typeOrOptions) {
6008
5984
  if (!typeOrOptions) {
6009
5985
  return this.getExpressions()[0];
@@ -6013,28 +5989,15 @@ var dooboostoreSimpleWebComponent = (() => {
6013
5989
  }
6014
5990
  return this.getExpressions(typeOrOptions)[0];
6015
5991
  }
6016
- /**
6017
- * 원본 템플릿을 반환합니다.
6018
- */
6019
5992
  getOriginalTemplate() {
6020
5993
  return this.originalTemplate;
6021
5994
  }
6022
- /**
6023
- * 마스킹 처리된 템플릿을 반환합니다.
6024
- */
6025
5995
  getMaskingTemplate() {
6026
5996
  return this.maskingTemplate;
6027
5997
  }
6028
- /**
6029
- * 현재 처리 상태의 템플릿을 반환합니다.
6030
- */
6031
5998
  getCurrentTemplate() {
6032
5999
  return this.currentTemplate;
6033
6000
  }
6034
- /**
6035
- * 미처리된 마커들을 원본으로 복원한 템플릿을 반환합니다.
6036
- * replace() 호출 후 처리되지 않은 표현식들을 원본 형태로 되돌립니다.
6037
- */
6038
6001
  getUnprocessedTemplate() {
6039
6002
  let result = this.currentTemplate;
6040
6003
  for (const expr of this.expressions) {
@@ -6097,17 +6060,16 @@ var dooboostoreSimpleWebComponent = (() => {
6097
6060
  };
6098
6061
  }
6099
6062
  var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
6100
- var onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
6101
- var onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
6102
- var onConnected = onAfterConnected;
6103
- var onBeforeDisconnected = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
6104
- var onAfterDisconnected = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
6105
- var onDisconnected = onAfterDisconnected;
6106
- var onBeforeAdopted = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
6107
- var onAfterAdopted = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
6108
- var onAdopted = onAfterAdopted;
6063
+ var onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
6064
+ var onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
6065
+ var onConnected = onConnectedAfter;
6066
+ var onDisconnectedBefore = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
6067
+ var onDisconnectedAfter = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
6068
+ var onDisconnected = onDisconnectedAfter;
6069
+ var onAdoptedBefore = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
6070
+ var onAdoptedAfter = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
6071
+ var onAdopted = onAdoptedAfter;
6109
6072
  var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
6110
- var onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
6111
6073
  function onConnectedInnerHtml(arg1, arg2, arg3) {
6112
6074
  const decorator = (options, target, propertyKey) => {
6113
6075
  const constructor = target.constructor;
@@ -6263,13 +6225,25 @@ var dooboostoreSimpleWebComponent = (() => {
6263
6225
  };
6264
6226
  var SwcUtils;
6265
6227
  ((SwcUtils2) => {
6228
+ SwcUtils2.getParentContainer = (e) => {
6229
+ return e.parentElement ?? e.getRootNode();
6230
+ };
6266
6231
  SwcUtils2.parsePathPatternsSetAttributeString = (pathPattern, path) => {
6267
6232
  return JSON.stringify(SwcUtils2.parsePathPatternsSet(pathPattern, path)).replace(/"/g, "'");
6268
6233
  };
6269
- SwcUtils2.parsePathPatternsSet = (pathPattern, path) => {
6234
+ SwcUtils2.parsePathPatternsSet = (pathPattern, urlAndRouter) => {
6235
+ urlAndRouter ?? (urlAndRouter = "/");
6236
+ const p = typeof urlAndRouter === "string" ? urlAndRouter : urlAndRouter.value.url;
6237
+ const searchParams = new URLSearchParams();
6238
+ const qs = p.split("?")[1];
6239
+ qs?.split("&").forEach((it) => {
6240
+ const [k, v] = it.split("=");
6241
+ searchParams.set(k, v);
6242
+ });
6270
6243
  return {
6271
- path,
6272
- pathData: SwcUtils2.parsePathPatterns(pathPattern, path)
6244
+ path: p,
6245
+ searchParams,
6246
+ pathData: SwcUtils2.parsePathPatterns(pathPattern, p)
6273
6247
  };
6274
6248
  };
6275
6249
  SwcUtils2.parsePathPatterns = (pathPattern, path) => {
@@ -6310,7 +6284,8 @@ var dooboostoreSimpleWebComponent = (() => {
6310
6284
  return current;
6311
6285
  };
6312
6286
  SwcUtils2.findNearestSwcHost = (el) => {
6313
- if (el.__swc_host) return el.__swc_host;
6287
+ const el1 = el;
6288
+ if (el1.__swc_host) return el1.__swc_host;
6314
6289
  let current = el.parentElement || el.getRootNode?.()?.host;
6315
6290
  const doc = el.ownerDocument;
6316
6291
  const win = doc?.defaultView || (typeof window !== "undefined" ? window : void 0);
@@ -6340,8 +6315,8 @@ var dooboostoreSimpleWebComponent = (() => {
6340
6315
  return (0, SwcUtils2.findNearestSwcHost)(el);
6341
6316
  };
6342
6317
  SwcUtils2.getAppHosts = (el) => {
6343
- const hosts = (0, SwcUtils2.getHosts)(el);
6344
- return hosts.filter((host2) => host2.tagName.toLowerCase() === "swc-app" || host2.getAttribute("is")?.startsWith("swc-app-"));
6318
+ const hosts = SwcUtils2.findAllParentAppHostsDirect(el);
6319
+ return hosts;
6345
6320
  };
6346
6321
  SwcUtils2.getAppHost = (el) => {
6347
6322
  const appHosts = (0, SwcUtils2.getAppHosts)(el);
@@ -6354,6 +6329,10 @@ var dooboostoreSimpleWebComponent = (() => {
6354
6329
  };
6355
6330
  SwcUtils2.findAllParentAppHostsDirect = (el) => {
6356
6331
  const appHosts = [];
6332
+ const w = el.ownerDocument?.defaultView || (typeof window !== "undefined" ? window : void 0);
6333
+ if (!w) {
6334
+ return appHosts;
6335
+ }
6357
6336
  let current = el;
6358
6337
  while (current) {
6359
6338
  const isAppHost = current.tagName.toLowerCase() === "swc-app" || current.getAttribute("is")?.startsWith("swc-app-");
@@ -6364,7 +6343,7 @@ var dooboostoreSimpleWebComponent = (() => {
6364
6343
  current = current.parentElement;
6365
6344
  } else {
6366
6345
  const root = current.getRootNode();
6367
- if (root instanceof ShadowRoot) {
6346
+ if (w.ShadowRoot && root instanceof w.ShadowRoot) {
6368
6347
  current = root.host;
6369
6348
  } else {
6370
6349
  break;
@@ -6397,6 +6376,7 @@ var dooboostoreSimpleWebComponent = (() => {
6397
6376
  $hosts,
6398
6377
  $firstHost,
6399
6378
  $lastHost: $parentHost,
6379
+ $templateHost: el.__swc_template_host,
6400
6380
  $appHost,
6401
6381
  $appHosts,
6402
6382
  $firstAppHost,
@@ -6439,54 +6419,67 @@ var dooboostoreSimpleWebComponent = (() => {
6439
6419
  }
6440
6420
  list.push({ propertyKey, selector: selectorOrTarget, type, options: fullOptions });
6441
6421
  const original = descriptor.value;
6442
- descriptor.value = async function(...args) {
6422
+ descriptor.value = function(...args) {
6443
6423
  ensureInit(this);
6444
- const detail = await original.apply(this, args);
6445
- const event = new CustomEvent(type, {
6446
- detail,
6447
- bubbles: fullOptions.bubbles,
6448
- composed: fullOptions.composed,
6449
- cancelable: fullOptions.cancelable
6450
- });
6451
- const hostSet = SwcUtils.getHostSet(this);
6452
- const conf = getElementConfig(this);
6453
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6454
- const eventTargets = [];
6455
- if (selectorOrTarget === ":window") eventTargets.push(currentWin);
6456
- else if (selectorOrTarget === ":document") eventTargets.push(currentWin.document);
6457
- else if (selectorOrTarget === ":parentHost") {
6458
- if (hostSet.$parentHost) eventTargets.push(hostSet.$parentHost);
6459
- } else if (selectorOrTarget === ":appHost") {
6460
- if (hostSet.$appHost) eventTargets.push(hostSet.$appHost);
6461
- } else if (selectorOrTarget === ":firstHost") {
6462
- if (hostSet.$firstHost) eventTargets.push(hostSet.$firstHost);
6463
- } else if (selectorOrTarget === ":lastHost") {
6464
- if (hostSet.$lastHost) eventTargets.push(hostSet.$lastHost);
6465
- } else if (selectorOrTarget === ":firstAppHost") {
6466
- if (hostSet.$firstAppHost) eventTargets.push(hostSet.$firstAppHost);
6467
- } else if (selectorOrTarget === ":lastAppHost") {
6468
- if (hostSet.$lastAppHost) eventTargets.push(hostSet.$lastAppHost);
6469
- } else if (selectorOrTarget === ":hosts") {
6470
- hostSet.$hosts.forEach((h) => eventTargets.push(h));
6471
- } else if (selectorOrTarget === ":appHosts") {
6472
- hostSet.$appHosts.forEach((h) => eventTargets.push(h));
6473
- } else if (selectorOrTarget === ":host" || !selectorOrTarget) eventTargets.push(this);
6474
- else {
6475
- const r = fullOptions.root || "auto";
6476
- const searchRoots = [];
6477
- if (r === "auto") searchRoots.push(this.shadowRoot || this);
6478
- else if (r === "light") searchRoots.push(this);
6479
- else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
6480
- else if (r === "all") {
6481
- searchRoots.push(this);
6482
- if (this.shadowRoot) searchRoots.push(this.shadowRoot);
6424
+ const res = original.apply(this, args);
6425
+ const handleResult = (detail) => {
6426
+ const event = new CustomEvent(type, {
6427
+ detail,
6428
+ bubbles: fullOptions.bubbles,
6429
+ composed: fullOptions.composed,
6430
+ cancelable: fullOptions.cancelable
6431
+ });
6432
+ const hostSet = SwcUtils.getHostSet(this);
6433
+ const conf = getElementConfig(this);
6434
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6435
+ const eventTargets = [];
6436
+ if (selectorOrTarget === ":window") eventTargets.push(currentWin);
6437
+ else if (selectorOrTarget === ":document") eventTargets.push(currentWin.document);
6438
+ else if (selectorOrTarget === ":parentHost") {
6439
+ if (hostSet.$parentHost) eventTargets.push(hostSet.$parentHost);
6440
+ } else if (selectorOrTarget === ":appHost") {
6441
+ if (hostSet.$appHost) eventTargets.push(hostSet.$appHost);
6442
+ } else if (selectorOrTarget === ":firstHost") {
6443
+ if (hostSet.$firstHost) eventTargets.push(hostSet.$firstHost);
6444
+ } else if (selectorOrTarget === ":lastHost") {
6445
+ if (hostSet.$lastHost) eventTargets.push(hostSet.$lastHost);
6446
+ } else if (selectorOrTarget === ":firstAppHost") {
6447
+ if (hostSet.$firstAppHost) eventTargets.push(hostSet.$firstAppHost);
6448
+ } else if (selectorOrTarget === ":lastAppHost") {
6449
+ if (hostSet.$lastAppHost) eventTargets.push(hostSet.$lastAppHost);
6450
+ } else if (selectorOrTarget === ":hosts") {
6451
+ hostSet.$hosts.forEach((h) => eventTargets.push(h));
6452
+ } else if (selectorOrTarget === ":appHosts") {
6453
+ hostSet.$appHosts.forEach((h) => eventTargets.push(h));
6454
+ } else if (selectorOrTarget === ":host" || !selectorOrTarget) {
6455
+ eventTargets.push(this);
6456
+ } else {
6457
+ const r = fullOptions.root || "auto";
6458
+ const searchRoots = [];
6459
+ if (r === "auto") searchRoots.push(this.shadowRoot || this);
6460
+ else if (r === "light") searchRoots.push(this);
6461
+ else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
6462
+ else if (r === "all") {
6463
+ searchRoots.push(this);
6464
+ if (this.shadowRoot) searchRoots.push(this.shadowRoot);
6465
+ }
6466
+ searchRoots.forEach((sr) => {
6467
+ sr.querySelectorAll(selectorOrTarget).forEach((el) => eventTargets.push(el));
6468
+ });
6483
6469
  }
6484
- searchRoots.forEach((sr) => {
6485
- sr.querySelectorAll(selectorOrTarget).forEach((el) => eventTargets.push(el));
6470
+ eventTargets.forEach((t) => {
6471
+ if (fullOptions.filter && !fullOptions.filter(t, detail, { currentThis: this, helper: hostSet })) {
6472
+ return;
6473
+ }
6474
+ t.dispatchEvent(event);
6486
6475
  });
6476
+ return detail;
6477
+ };
6478
+ if (res instanceof Promise) {
6479
+ return res.then(handleResult);
6480
+ } else {
6481
+ return handleResult(res);
6487
6482
  }
6488
- eventTargets.forEach((t) => t.dispatchEvent(event));
6489
- return detail;
6490
6483
  };
6491
6484
  };
6492
6485
  }
@@ -6494,30 +6487,41 @@ var dooboostoreSimpleWebComponent = (() => {
6494
6487
  const constructor = target instanceof Function ? target : target.constructor;
6495
6488
  return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
6496
6489
  };
6497
- function emitCustomEventHost(type, options = {}) {
6498
- if (!options.attributeName) {
6499
- options.attributeName = `on-emit-${type}`;
6490
+ function emitCustomEventHost(type, optionsOrAttributeaName) {
6491
+ if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "string") {
6492
+ return emitCustomEventHost(type, { attributeName: optionsOrAttributeaName });
6493
+ } else if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "object") {
6494
+ if (!optionsOrAttributeaName.attributeName) {
6495
+ optionsOrAttributeaName.attributeName = `on-emit-${type}`;
6496
+ }
6497
+ return emitCustomEvent(":host", type, optionsOrAttributeaName);
6498
+ } else {
6499
+ return emitCustomEvent(":host", type, { attributeName: `on-emit-${type}` });
6500
6500
  }
6501
- return emitCustomEvent(":host", type, options);
6502
6501
  }
6503
6502
 
6504
6503
  // src/decorators/changedAttributeHost.ts
6505
6504
  var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
6506
- function changedAttributeHost(attributeName) {
6505
+ var convertValue = (val, type) => {
6506
+ if (val === null || val === void 0) return val;
6507
+ if (type === Number) return Number(val);
6508
+ if (type === Boolean) return val === "false" || val === "0" ? false : true;
6509
+ return val;
6510
+ };
6511
+ function changedAttributeHost(attributeName, options = {}) {
6507
6512
  return (target, propertyKey) => {
6508
6513
  const constructor = target.constructor;
6509
- let meta = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);
6510
- if (!meta) {
6511
- meta = /* @__PURE__ */ new Map();
6512
- ReflectUtils.defineMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, meta, constructor);
6514
+ let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);
6515
+ if (!metaList) {
6516
+ metaList = [];
6517
+ ReflectUtils.defineMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, metaList, constructor);
6513
6518
  }
6514
6519
  const name = attributeName || String(propertyKey);
6515
- let methods = meta.get(name);
6516
- if (!methods) {
6517
- methods = [];
6518
- meta.set(name, methods);
6519
- }
6520
- if (!methods.includes(propertyKey)) methods.push(propertyKey);
6520
+ metaList.push({
6521
+ attributeName: name,
6522
+ propertyKey,
6523
+ options
6524
+ });
6521
6525
  };
6522
6526
  }
6523
6527
  var getChangedAttributeMetadata = (target) => {
@@ -6525,7 +6529,21 @@ var dooboostoreSimpleWebComponent = (() => {
6525
6529
  return ReflectUtils.getMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);
6526
6530
  };
6527
6531
  var findAllAttributeChangedMetadata = (target) => {
6528
- return ReflectUtils.findAllMapMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, target);
6532
+ const constructor = target instanceof Function ? target : target.constructor;
6533
+ const metaList = ReflectUtils.findAllMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) || [];
6534
+ const result = /* @__PURE__ */ new Map();
6535
+ metaList.forEach((meta) => {
6536
+ meta.forEach((item) => {
6537
+ if (!result.has(item.attributeName)) {
6538
+ result.set(item.attributeName, []);
6539
+ }
6540
+ result.get(item.attributeName).push(item);
6541
+ });
6542
+ });
6543
+ return result;
6544
+ };
6545
+ var convertAttributeValue = (val, type) => {
6546
+ return convertValue(val, type);
6529
6547
  };
6530
6548
 
6531
6549
  // src/decorators/applyAttribute.ts
@@ -6551,70 +6569,80 @@ var dooboostoreSimpleWebComponent = (() => {
6551
6569
  options: { ...finalOptions, name: attributeName }
6552
6570
  });
6553
6571
  const original = descriptor.value;
6554
- descriptor.value = async function(...args) {
6572
+ descriptor.value = function(...args) {
6555
6573
  ensureInit(this);
6556
- const res = await original.apply(this, args);
6557
- if (res !== void 0) {
6558
- const win = this.ownerDocument?.defaultView || window;
6559
- const host2 = this;
6560
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
6561
- const r = finalOptions.root || "auto";
6562
- const targetEls = [];
6563
- const applyRoot = (t) => {
6564
- if (!t || !(t instanceof win.HTMLElement)) return;
6565
- targetEls.push(t);
6566
- };
6567
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6568
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6569
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6570
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6571
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6572
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6573
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6574
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6575
- else if (selector === ":host" || !selector) applyRoot(host2);
6576
- else {
6577
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
6578
- if (targetRoot) {
6579
- const found = targetRoot.querySelectorAll(selector);
6580
- if (found) targetEls.push(...Array.from(found));
6574
+ const res = original.apply(this, args);
6575
+ const handleResult = (resolvedValue) => {
6576
+ if (resolvedValue !== void 0) {
6577
+ const win = this.ownerDocument?.defaultView || window;
6578
+ const host2 = this;
6579
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
6580
+ const r = finalOptions.root || "auto";
6581
+ const targetEls = [];
6582
+ const applyRoot = (t) => {
6583
+ if (!t || !(t instanceof win.HTMLElement)) return;
6584
+ targetEls.push(t);
6585
+ };
6586
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6587
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6588
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6589
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6590
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6591
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6592
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6593
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6594
+ else if (selector === ":host" || !selector) applyRoot(host2);
6595
+ else {
6596
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
6597
+ if (targetRoot) {
6598
+ const found = targetRoot.querySelectorAll(selector);
6599
+ if (found) targetEls.push(...Array.from(found));
6600
+ }
6581
6601
  }
6582
- }
6583
- targetEls.forEach((targetEl) => {
6584
- const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
6585
- if (action === "set" || action === "update") {
6586
- if (attributeName) {
6587
- if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
6602
+ targetEls.forEach((targetEl) => {
6603
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
6604
+ return;
6605
+ }
6606
+ const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
6607
+ if (action === "set" || action === "update") {
6608
+ if (attributeName) {
6609
+ if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
6610
+ targetEl.removeAttribute(attributeName);
6611
+ } else {
6612
+ targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
6613
+ }
6614
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
6615
+ Object.entries(resolvedRes).forEach(([attr, val]) => {
6616
+ const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
6617
+ if (finalVal === null || finalVal === void 0 || finalVal === false) {
6618
+ targetEl.removeAttribute(attr);
6619
+ } else {
6620
+ targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
6621
+ }
6622
+ });
6623
+ }
6624
+ } else if (action === "remove") {
6625
+ if (attributeName) {
6588
6626
  targetEl.removeAttribute(attributeName);
6627
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
6628
+ Object.entries(resolvedRes).forEach(([attr, val]) => {
6629
+ const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
6630
+ if (shouldRemove) targetEl.removeAttribute(attr);
6631
+ });
6589
6632
  } else {
6590
- targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
6633
+ const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
6634
+ attrs.forEach((a) => targetEl.removeAttribute(String(a)));
6591
6635
  }
6592
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
6593
- Object.entries(resolvedRes).forEach(([attr, val]) => {
6594
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
6595
- if (finalVal === null || finalVal === void 0 || finalVal === false) {
6596
- targetEl.removeAttribute(attr);
6597
- } else {
6598
- targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
6599
- }
6600
- });
6601
6636
  }
6602
- } else if (action === "remove") {
6603
- if (attributeName) {
6604
- targetEl.removeAttribute(attributeName);
6605
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
6606
- Object.entries(resolvedRes).forEach(([attr, val]) => {
6607
- const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
6608
- if (shouldRemove) targetEl.removeAttribute(attr);
6609
- });
6610
- } else {
6611
- const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
6612
- attrs.forEach((a) => targetEl.removeAttribute(String(a)));
6613
- }
6614
- }
6615
- });
6637
+ });
6638
+ }
6639
+ return resolvedValue;
6640
+ };
6641
+ if (res instanceof Promise) {
6642
+ return res.then(handleResult);
6643
+ } else {
6644
+ return handleResult(res);
6616
6645
  }
6617
- return res;
6618
6646
  };
6619
6647
  return descriptor;
6620
6648
  };
@@ -7912,7 +7940,7 @@ var dooboostoreSimpleWebComponent = (() => {
7912
7940
  }
7913
7941
  };
7914
7942
  function buildEnv(configWindow) {
7915
- const win = configWindow || (typeof window !== "undefined" ? window : void 0);
7943
+ const win = configWindow;
7916
7944
  const doc = win?.document;
7917
7945
  const builtInTagMap = /* @__PURE__ */ new Map();
7918
7946
  for (const [cls, tag] of HTML_TAG_ENTRIES) {
@@ -7951,7 +7979,7 @@ var dooboostoreSimpleWebComponent = (() => {
7951
7979
  const aConf = getElementConfig(ancestors[i]);
7952
7980
  if (aConf?.window) return aConf.window;
7953
7981
  }
7954
- return typeof window !== "undefined" ? window : void 0;
7982
+ return getElementConfig(this).window ?? (typeof window !== "undefined" ? window : void 0);
7955
7983
  };
7956
7984
  proto._invokeLifecycleMethod = function(methodName, hostSet, extraArgs = []) {
7957
7985
  ensureInit(this);
@@ -7960,7 +7988,13 @@ var dooboostoreSimpleWebComponent = (() => {
7960
7988
  const app = useHostSet?.$appHost?.simpleApplication;
7961
7989
  if (app) {
7962
7990
  const otherStorage = /* @__PURE__ */ new Map();
7963
- 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 })]);
7991
+ 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({
7992
+ situationType: "SIMPLE_WEB_COMPONENT://HOST" /* HOST */,
7993
+ data: useHostSet.$host
7994
+ }), 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({
7995
+ situationType: "SIMPLE_WEB_COMPONENT://FIRSTAPPHOST" /* FIRST_APP_HOST */,
7996
+ data: useHostSet.$firstAppHost
7997
+ }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTAPPHOST" /* LAST_APP_HOST */, data: useHostSet.$lastAppHost })]);
7964
7998
  otherStorage.set(SituationTypeContainers, situations);
7965
7999
  return app.simstanceManager.executeBindParameterSim(
7966
8000
  {
@@ -8053,195 +8087,243 @@ var dooboostoreSimpleWebComponent = (() => {
8053
8087
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
8054
8088
  const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
8055
8089
  const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
8056
- const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
8057
- ...metadata.observedAttributes ?? [],
8058
- ...attrChangeMap.keys(),
8059
- ...attributeApplyNames,
8060
- ...hostAttributes,
8061
- ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
8062
- ...swcLifecycleAttributes,
8063
- ...swcOnEvents
8064
- ])];
8090
+ const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
8091
+ const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
8065
8092
  const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
8066
8093
  const proto = constructor.prototype;
8067
8094
  setupPrototype(proto);
8095
+ let helperHostSet = null;
8068
8096
  const originalConnected = proto.connectedCallback;
8069
- proto.connectedCallback = function() {
8097
+ proto.connectedCallback = async function() {
8070
8098
  ensureInit(this);
8071
- const hostSet = SwcUtils.getHostSet(this);
8072
- const appHost2 = hostSet.$appHost;
8073
- const conf = getElementConfig(this);
8074
- const currentWin = this._resolveWindow(conf);
8075
- if ((connectedInnerHtmlList.some((it) => it.options.useShadow === true) || conf?.useShadow === true) && !this.shadowRoot) {
8076
- this.attachShadow({ mode: "open" });
8077
- }
8078
- this._executeSwcScript("swc-on-before-connected", hostSet);
8079
- const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
8080
- if (bMethods) {
8081
- for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
8082
- }
8083
- if (connectedInnerHtmlList.length > 0) {
8084
- let sContent = "", lContent = "";
8085
- for (const meta of connectedInnerHtmlList) {
8086
- const res = this._invokeLifecycleMethod(meta.propertyKey, hostSet);
8087
- if (res !== void 0) {
8088
- if (meta.options.useShadow) sContent += res;
8089
- else lContent += res;
8090
- }
8091
- }
8092
- if (this.shadowRoot) this.shadowRoot.innerHTML = sContent;
8093
- if (lContent) this.innerHTML = lContent;
8094
- }
8095
- const root = this.getRootNode();
8096
- if (!globalDelegatedRoots.has(root)) {
8097
- DOM_EVENT_NAMES.forEach((type) => {
8098
- root.addEventListener(type, handleGlobalSwcEvent);
8099
- });
8100
- globalDelegatedRoots.add(root);
8101
- }
8102
- const delegateListeners = [];
8103
- const nonDelegateListeners = [];
8104
- addEventListenerList.forEach((meta) => {
8105
- 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 !== "") {
8106
- delegateListeners.push(meta);
8107
- } else {
8108
- nonDelegateListeners.push(meta);
8099
+ helperHostSet = SwcUtils.getHelperAndHostSet(win, this);
8100
+ const appHost2 = helperHostSet.$appHost;
8101
+ try {
8102
+ if (appHost2 && typeof appHost2._connected === "function") {
8103
+ await appHost2._connected(this);
8104
+ } else if (appHost2 && typeof appHost2) {
8105
+ appHost2._connected_safari ?? (appHost2._connected_safari = []);
8106
+ appHost2._connected_safari.push(this);
8109
8107
  }
8110
- });
8111
- const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
8112
- delegateListeners.forEach((meta) => {
8113
- const r = meta.options.root || "auto";
8114
- const rootKey = `${meta.type}:${r}`;
8115
- if (!delegatesByTypeAndRoot.has(rootKey)) {
8116
- delegatesByTypeAndRoot.set(rootKey, []);
8117
- }
8118
- delegatesByTypeAndRoot.get(rootKey).push(meta);
8119
- });
8120
- delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
8121
- const [type, rStr] = typeRootKey.split(":");
8122
- const r = rStr === "auto" ? "auto" : rStr;
8123
- const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
8124
- const bindRoots = [];
8125
- if (r === "auto") bindRoots.push(this.shadowRoot || this);
8126
- else if (r === "light") bindRoots.push(this);
8127
- else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
8128
- else if (r === "all") {
8129
- bindRoots.push(this);
8130
- if (this.shadowRoot) bindRoots.push(this.shadowRoot);
8131
- }
8132
- bindRoots.forEach((br) => {
8133
- const sortedMetaList = [...metaList].sort((a, b) => {
8134
- const aStop = a.options.stopPropagation ? 1 : 0;
8135
- const bStop = b.options.stopPropagation ? 1 : 0;
8136
- return bStop - aStop;
8137
- });
8138
- const unifiedHandler = async (event) => {
8139
- for (const meta of sortedMetaList) {
8140
- const { selector, options } = meta;
8141
- const matchedEl = event.target.closest(selector);
8142
- if (matchedEl && br.contains(matchedEl)) {
8143
- if (options.filter) {
8144
- const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
8145
- if (!options.filter(event, helper)) {
8146
- continue;
8147
- }
8108
+ const conf = getElementConfig(this);
8109
+ const currentWin = this._resolveWindow(conf);
8110
+ const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
8111
+ if (shadowMode && !this.shadowRoot) {
8112
+ const mode = shadowMode === true ? "open" : shadowMode;
8113
+ this.attachShadow({ mode });
8114
+ }
8115
+ const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
8116
+ if (bMethods) {
8117
+ for (const m of bMethods) await this._invokeLifecycleMethod(m, helperHostSet);
8118
+ }
8119
+ this._executeSwcScript("swc-on-before-connected", helperHostSet);
8120
+ if (connectedInnerHtmlList.length > 0) {
8121
+ let sContent = "", lContent = "";
8122
+ for (const meta of connectedInnerHtmlList) {
8123
+ let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
8124
+ const actionExpression = new ActionExpression(res, {
8125
+ expression: {
8126
+ replace: {
8127
+ start: meta.options.replaceWrap?.start || "{%{",
8128
+ end: meta.options.replaceWrap?.end || "}%}"
8129
+ },
8130
+ callReturn: {
8131
+ start: meta.options.replaceWrap?.start || "{%{=",
8132
+ end: meta.options.replaceWrap?.end || "}%}"
8133
+ },
8134
+ call: {
8135
+ start: meta.options.replaceWrap?.start || "{%{@",
8136
+ end: meta.options.replaceWrap?.end || "}%}"
8148
8137
  }
8149
- if (options.stopPropagation) event.stopPropagation();
8150
- if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8151
- if (options.preventDefault) event.preventDefault();
8152
- const currentHostSet = SwcUtils.getHostSet(this);
8153
- const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
8154
- await this[meta.propertyKey](event, currentHostSet, matchedEl, args);
8155
- if (event.cancelBubble) break;
8156
8138
  }
8139
+ });
8140
+ actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
8141
+ try {
8142
+ const sr = FunctionUtils.executeReturn({ script: it.script, context: this, args: helperHostSet });
8143
+ actionExpression.replace(it, sr);
8144
+ } catch (e) {
8145
+ console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
8146
+ }
8147
+ });
8148
+ res = actionExpression.getUnprocessedTemplate();
8149
+ if (res !== void 0) {
8150
+ if (meta.options.useShadow || conf?.useShadow) sContent += res;
8151
+ else lContent += res;
8157
8152
  }
8158
- };
8159
- br.addEventListener(type, unifiedHandler, opts);
8160
- this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
8161
- });
8162
- });
8163
- nonDelegateListeners.forEach((meta) => {
8164
- const { selector, type, options } = meta;
8165
- const opts = { capture: options.capture, once: options.once, passive: options.passive };
8166
- const bindTargets = [];
8167
- const r = options.root || "auto";
8168
- const applyRootOption = (target) => {
8169
- if (!target) return;
8170
- if (r === "auto") {
8171
- bindTargets.push(target.shadowRoot || target);
8172
- } else {
8173
- if (r === "light" || r === "all") bindTargets.push(target);
8174
- if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
8175
8153
  }
8176
- };
8177
- if (selector === ":window") bindTargets.push(currentWin);
8178
- else if (selector === ":document") bindTargets.push(currentWin.document);
8179
- else if (selector === ":parentHost") applyRootOption(hostSet.$parentHost);
8180
- else if (selector === ":appHost") applyRootOption(hostSet.$appHost);
8181
- else if (selector === ":firstHost") applyRootOption(hostSet.$firstHost);
8182
- else if (selector === ":lastHost") applyRootOption(hostSet.$lastHost);
8183
- else if (selector === ":firstAppHost") applyRootOption(hostSet.$firstAppHost);
8184
- else if (selector === ":lastAppHost") applyRootOption(hostSet.$lastAppHost);
8185
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRootOption);
8186
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRootOption);
8187
- else if (selector === ":host" || !selector) applyRootOption(this);
8188
- else {
8189
- const searchRoots = [];
8190
- if (r === "auto") searchRoots.push(this.shadowRoot || this);
8191
- else if (r === "light") searchRoots.push(this);
8192
- else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
8193
- else if (r === "all") {
8194
- searchRoots.push(this);
8195
- if (this.shadowRoot) searchRoots.push(this.shadowRoot);
8154
+ try {
8155
+ if (this.shadowRoot) {
8156
+ this.shadowRoot.innerHTML = sContent;
8157
+ }
8158
+ if (lContent) {
8159
+ this.innerHTML = lContent;
8160
+ }
8161
+ } catch (e) {
8162
+ console.error("[ElementDefine] innerHTML setting error:", e);
8196
8163
  }
8197
- searchRoots.forEach((sr) => {
8198
- sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
8164
+ }
8165
+ const root = this.getRootNode();
8166
+ if (!globalDelegatedRoots.has(root)) {
8167
+ DOM_EVENT_NAMES.forEach((type) => {
8168
+ root.addEventListener(type, handleGlobalSwcEvent);
8199
8169
  });
8170
+ globalDelegatedRoots.add(root);
8200
8171
  }
8201
- bindTargets.forEach((t) => {
8202
- const handler = async (event) => {
8203
- if (options.filter) {
8204
- const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
8205
- if (!options.filter(event, helper)) {
8206
- return;
8172
+ const delegateListeners = [];
8173
+ const nonDelegateListeners = [];
8174
+ addEventListenerList.forEach((meta) => {
8175
+ 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 !== "") {
8176
+ delegateListeners.push(meta);
8177
+ } else {
8178
+ nonDelegateListeners.push(meta);
8179
+ }
8180
+ });
8181
+ const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
8182
+ delegateListeners.forEach((meta) => {
8183
+ const r = meta.options.root || "auto";
8184
+ const rootKey = `${meta.type}:${r}`;
8185
+ if (!delegatesByTypeAndRoot.has(rootKey)) {
8186
+ delegatesByTypeAndRoot.set(rootKey, []);
8187
+ }
8188
+ delegatesByTypeAndRoot.get(rootKey).push(meta);
8189
+ });
8190
+ delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
8191
+ const [type, rStr] = typeRootKey.split(":");
8192
+ const r = rStr === "auto" ? "auto" : rStr;
8193
+ const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
8194
+ const bindRoots = [];
8195
+ if (r === "auto") bindRoots.push(this.shadowRoot || this);
8196
+ else if (r === "light") bindRoots.push(this);
8197
+ else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
8198
+ else if (r === "all") {
8199
+ bindRoots.push(this);
8200
+ if (this.shadowRoot) bindRoots.push(this.shadowRoot);
8201
+ }
8202
+ bindRoots.forEach((br) => {
8203
+ const sortedMetaList = [...metaList].sort((a, b) => {
8204
+ const aStop = a.options.stopPropagation ? 1 : 0;
8205
+ const bStop = b.options.stopPropagation ? 1 : 0;
8206
+ return bStop - aStop;
8207
+ });
8208
+ const unifiedHandler = async (event) => {
8209
+ for (const meta of sortedMetaList) {
8210
+ const { selector, options } = meta;
8211
+ const matchedEl = event.target.closest(selector);
8212
+ if (matchedEl && br.contains(matchedEl)) {
8213
+ if (options.filter) {
8214
+ const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
8215
+ if (!options.filter(event, helper)) {
8216
+ continue;
8217
+ }
8218
+ }
8219
+ if (options.stopPropagation) event.stopPropagation();
8220
+ if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8221
+ if (options.preventDefault) event.preventDefault();
8222
+ const currentHostSet = SwcUtils.getHostSet(this);
8223
+ const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
8224
+ await this[meta.propertyKey](event, { ...currentHostSet, $matchedElement: matchedEl }, args);
8225
+ if (event.cancelBubble) break;
8226
+ }
8207
8227
  }
8228
+ };
8229
+ br.addEventListener(type, unifiedHandler, opts);
8230
+ this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
8231
+ });
8232
+ });
8233
+ nonDelegateListeners.forEach((meta) => {
8234
+ const { selector, type, options } = meta;
8235
+ const opts = { capture: options.capture, once: options.once, passive: options.passive };
8236
+ const bindTargets = [];
8237
+ const r = options.root || "auto";
8238
+ const applyRootOption = (target) => {
8239
+ if (!target) return;
8240
+ if (r === "auto") {
8241
+ bindTargets.push(target.shadowRoot || target);
8242
+ } else {
8243
+ if (r === "light" || r === "all") bindTargets.push(target);
8244
+ if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
8208
8245
  }
8209
- if (options.stopPropagation) event.stopPropagation();
8210
- if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8211
- if (options.preventDefault) event.preventDefault();
8212
- const currentHostSet = SwcUtils.getHostSet(this);
8213
- const args = { event, ...currentHostSet, $el: t, $root: t };
8214
- await this[meta.propertyKey](event, currentHostSet, args);
8215
8246
  };
8216
- t.addEventListener(type, handler, opts);
8217
- if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
8218
- this._boundListeners.push({ target: t, type, handler, options: opts });
8247
+ if (selector === ":window") bindTargets.push(currentWin);
8248
+ else if (selector === ":document") bindTargets.push(currentWin.document);
8249
+ else if (selector === ":parentHost") applyRootOption(helperHostSet.$parentHost);
8250
+ else if (selector === ":appHost") applyRootOption(helperHostSet.$appHost);
8251
+ else if (selector === ":firstHost") applyRootOption(helperHostSet.$firstHost);
8252
+ else if (selector === ":lastHost") applyRootOption(helperHostSet.$lastHost);
8253
+ else if (selector === ":firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
8254
+ else if (selector === ":lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
8255
+ else if (selector === ":hosts") helperHostSet.$hosts.forEach(applyRootOption);
8256
+ else if (selector === ":appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
8257
+ else if (selector === ":host" || !selector) applyRootOption(this);
8258
+ else {
8259
+ const searchRoots = [];
8260
+ if (r === "auto") searchRoots.push(this.shadowRoot || this);
8261
+ else if (r === "light") searchRoots.push(this);
8262
+ else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
8263
+ else if (r === "all") {
8264
+ searchRoots.push(this);
8265
+ if (this.shadowRoot) searchRoots.push(this.shadowRoot);
8266
+ }
8267
+ searchRoots.forEach((sr) => {
8268
+ sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
8269
+ });
8219
8270
  }
8271
+ bindTargets.forEach((t) => {
8272
+ const handler = async (event) => {
8273
+ if (options.filter) {
8274
+ const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
8275
+ if (!options.filter(event, { currentThis: this, helper })) {
8276
+ return;
8277
+ }
8278
+ }
8279
+ if (options.stopPropagation) event.stopPropagation();
8280
+ if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8281
+ if (options.preventDefault) event.preventDefault();
8282
+ const currentHostSet = SwcUtils.getHostSet(this);
8283
+ const args = { event, ...currentHostSet, $el: t, $root: t };
8284
+ await this[meta.propertyKey](event, { currentHostSet, $$matchedElement: event.currentTarget }, args);
8285
+ };
8286
+ t.addEventListener(type, handler, opts);
8287
+ if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
8288
+ this._boundListeners.push({ target: t, type, handler, options: opts });
8289
+ }
8290
+ });
8220
8291
  });
8221
- });
8222
- if (originalConnected) originalConnected.apply(this);
8223
- const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
8224
- if (aMethods) {
8225
- for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
8226
- }
8227
- this._executeSwcScript("swc-on-connected", hostSet);
8228
- this._executeSwcScript("swc-on-after-connected", hostSet);
8229
- this.__swc_connected = true;
8230
- const appHostss = SwcUtils.findAllParentAppHostsDirect(this);
8231
- if (appHost2 && typeof appHost2._connected === "function") {
8232
- appHost2._connected(this);
8233
- } else if (appHost2 && typeof appHost2) {
8234
- appHost2._connected_safari ?? (appHost2._connected_safari = []);
8235
- appHost2._connected_safari.push(this);
8292
+ if (originalConnected) await originalConnected.apply(this);
8293
+ const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
8294
+ if (aMethods) {
8295
+ for (const m of aMethods) await this._invokeLifecycleMethod(m, helperHostSet);
8296
+ }
8297
+ this._executeSwcScript("swc-on-connected", helperHostSet);
8298
+ this._executeSwcScript("swc-on-after-connected", helperHostSet);
8299
+ this.__swc_connected = true;
8300
+ for (let [name2, metaList] of Array.from(attrChangeMap)) {
8301
+ for (const meta of metaList) {
8302
+ if (meta.options.while === "connected") {
8303
+ const val = getAttributeValue(this, name2, { type: meta.options.type });
8304
+ if (val !== null) {
8305
+ await this[meta.propertyKey](val, null, name2, helperHostSet);
8306
+ }
8307
+ }
8308
+ }
8309
+ }
8310
+ } finally {
8311
+ if (appHost2 && typeof appHost2._connectedDone === "function") {
8312
+ await appHost2._connectedDone(this);
8313
+ }
8236
8314
  }
8237
8315
  };
8238
8316
  const originalDisconnected = proto.disconnectedCallback;
8239
8317
  proto.disconnectedCallback = function() {
8240
- const hostSet = SwcUtils.getHostSet(this);
8241
- this._executeSwcScript("swc-on-before-disconnected", hostSet);
8318
+ console.log("disconnnnnnnnnnnnnnnnnnn", helperHostSet, this);
8319
+ const appHost2 = helperHostSet.$appHost;
8320
+ if (appHost2 && typeof appHost2._disconnected === "function") {
8321
+ appHost2._disconnected(this);
8322
+ }
8323
+ this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
8242
8324
  const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
8243
8325
  if (bMethods) {
8244
- for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
8326
+ for (const m of bMethods) this._invokeLifecycleMethod(m, helperHostSet);
8245
8327
  }
8246
8328
  if (this._boundListeners) {
8247
8329
  this._boundListeners.forEach((l) => l.target.removeEventListener(l.type, l.handler, l.options));
@@ -8250,15 +8332,11 @@ var dooboostoreSimpleWebComponent = (() => {
8250
8332
  if (originalDisconnected) originalDisconnected.apply(this);
8251
8333
  const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);
8252
8334
  if (aMethods) {
8253
- for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
8335
+ for (const m of aMethods) this._invokeLifecycleMethod(m, helperHostSet);
8254
8336
  }
8255
- this._executeSwcScript("swc-on-disconnected", hostSet);
8256
- this._executeSwcScript("swc-on-after-disconnected", hostSet);
8337
+ this._executeSwcScript("swc-on-disconnected", helperHostSet);
8338
+ this._executeSwcScript("swc-on-after-disconnected", helperHostSet);
8257
8339
  this.__swc_connected = false;
8258
- const appHost2 = hostSet.$appHost;
8259
- if (appHost2 && typeof appHost2._disconnected === "function") {
8260
- appHost2._disconnected(this);
8261
- }
8262
8340
  };
8263
8341
  const originalAdopted = proto.adoptedCallback;
8264
8342
  proto.adoptedCallback = function() {
@@ -8283,18 +8361,20 @@ var dooboostoreSimpleWebComponent = (() => {
8283
8361
  let processedVal = newVal;
8284
8362
  if (newVal !== null) {
8285
8363
  const ae = new ActionExpression(newVal);
8286
- const expr = ae.getFirstExpression("call-return");
8364
+ const expr = ae.getFirstExpression("callReturn");
8287
8365
  if (expr) {
8288
8366
  const win2 = this._resolveWindow?.() || (typeof window !== "undefined" ? window : void 0);
8367
+ const helperAndHostSet = SwcUtils.getHelperAndHostSet(win2, this);
8368
+ const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
8289
8369
  try {
8290
8370
  const result = FunctionUtils.executeReturn({
8291
- script: ConvertUtils2.decodeHtmlEntity(expr.script, win2.document),
8371
+ script,
8292
8372
  context: this,
8293
- args: SwcUtils.getHelperAndHostSet(win2, this)
8373
+ args: helperAndHostSet
8294
8374
  });
8295
- processedVal = String(result);
8375
+ processedVal = result;
8296
8376
  } catch (e) {
8297
- console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name2}:`, e);
8377
+ console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name2}: ${helperAndHostSet}`, e);
8298
8378
  processedVal = newVal;
8299
8379
  }
8300
8380
  }
@@ -8309,9 +8389,15 @@ var dooboostoreSimpleWebComponent = (() => {
8309
8389
  if (hostCustomEventMeta && newVal !== null) {
8310
8390
  this._bindAttributeEvent(this, name2, newVal, hostCustomEventMeta.type);
8311
8391
  }
8312
- const mKeys = attrChangeMap.get(name2);
8313
- if (mKeys && Array.isArray(mKeys)) {
8314
- for (const key of mKeys) this[key](processedVal, old, name2, hSet);
8392
+ const metaList = attrChangeMap.get(name2);
8393
+ if (metaList && Array.isArray(metaList)) {
8394
+ for (const meta of metaList) {
8395
+ if (meta.options.while === "connected" && !this.__swc_connected) {
8396
+ continue;
8397
+ }
8398
+ const convertedVal = convertAttributeValue(processedVal, meta.options.type);
8399
+ this[meta.propertyKey](convertedVal, old, name2, hSet);
8400
+ }
8315
8401
  }
8316
8402
  };
8317
8403
  Object.defineProperty(constructor, "observedAttributes", {
@@ -8328,12 +8414,38 @@ var dooboostoreSimpleWebComponent = (() => {
8328
8414
 
8329
8415
  // src/decorators/attribute.ts
8330
8416
  var ATTRIBUTE_FIELD_METADATA_KEY = Symbol.for("simple-web-component:attribute-field");
8331
- var convertValue = (val, type) => {
8417
+ var convertValue2 = (val, type) => {
8332
8418
  if (val === null || val === void 0) return val;
8333
8419
  if (type === Number) return Number(val);
8334
8420
  if (type === Boolean) return val === "false" || val === "0" ? false : true;
8335
8421
  return val;
8336
8422
  };
8423
+ var getAttributeValue = (inst, attrName, options) => {
8424
+ const conf = getElementConfig(inst);
8425
+ const currentWin = inst._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
8426
+ const targets = options?.selector ? resolveTargetEls(inst, options.selector, options, currentWin) : [inst];
8427
+ const primaryTarget = targets[0];
8428
+ if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
8429
+ let domVal = primaryTarget.getAttribute(attrName);
8430
+ const ae = new ActionExpression(domVal);
8431
+ const expr = ae.getFirstExpression("callReturn");
8432
+ if (expr) {
8433
+ try {
8434
+ const result = FunctionUtils.executeReturn({
8435
+ script: ConvertUtils2.decodeHtmlEntity(expr.script, currentWin.document),
8436
+ context: inst,
8437
+ args: SwcUtils.getHelperAndHostSet(currentWin, inst)
8438
+ });
8439
+ return convertValue2(result, options?.type);
8440
+ } catch (e) {
8441
+ console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, e);
8442
+ return convertValue2(domVal, options?.type);
8443
+ }
8444
+ }
8445
+ return convertValue2(domVal, options?.type);
8446
+ }
8447
+ return null;
8448
+ };
8337
8449
  var resolveTargetEls = (inst, selector, options, currentWin) => {
8338
8450
  const r = options.root || "auto";
8339
8451
  const results = [];
@@ -8408,35 +8520,13 @@ var dooboostoreSimpleWebComponent = (() => {
8408
8520
  Object.defineProperty(target, propertyKey, {
8409
8521
  get() {
8410
8522
  const attrName = options.name || String(propertyKey);
8411
- const conf = getElementConfig(this);
8412
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
8413
- const targetType = options.type || designType;
8414
- const targets = resolveTargetEls(this, selector, options, currentWin);
8415
- const primaryTarget = targets[0];
8416
- if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
8417
- if (primaryTarget.hasAttribute(attrName)) {
8418
- let domVal = primaryTarget.getAttribute(attrName);
8419
- const ae = new ActionExpression(domVal);
8420
- const expr = ae.getFirstExpression("call-return");
8421
- if (expr) {
8422
- try {
8423
- const result = FunctionUtils.executeReturn({
8424
- script: ConvertUtils2.decodeHtmlEntity(expr.script, currentWin.document),
8425
- context: this,
8426
- args: SwcUtils.getHelperAndHostSet(currentWin, this)
8427
- });
8428
- return convertValue(result, targetType);
8429
- } catch (e) {
8430
- console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, e);
8431
- return convertValue(domVal, targetType);
8432
- }
8433
- }
8434
- return convertValue(domVal, targetType);
8435
- }
8436
- return null;
8437
- }
8438
- const data = convertValue(this[privateKey], targetType);
8439
- return data;
8523
+ const mergedOptions = {
8524
+ ...options,
8525
+ selector,
8526
+ type: options.type || designType
8527
+ };
8528
+ const result = getAttributeValue(this, attrName, mergedOptions);
8529
+ return result !== null ? result : this[privateKey];
8440
8530
  },
8441
8531
  set(nv) {
8442
8532
  const attrName = options.name || String(propertyKey);
@@ -8549,14 +8639,7 @@ var dooboostoreSimpleWebComponent = (() => {
8549
8639
  const res = original.apply(this, args);
8550
8640
  const runApply = (target, val) => {
8551
8641
  const pos = options.position || "beforeEnd";
8552
- const defaultFilter = (t, v) => {
8553
- if (v instanceof Node) return !t.contains(v);
8554
- if (pos === "innerHtml" && typeof v === "string") return t.innerHTML !== v;
8555
- if (pos === "replaceChildren" && v instanceof Node) return !t.contains(v);
8556
- return true;
8557
- };
8558
- const activeFilter = options.filter || defaultFilter;
8559
- if (activeFilter(target, val, hostSet)) {
8642
+ if (!options.filter || options.filter(target, val, { currentThis: this, helper: hostSet })) {
8560
8643
  applyToDom(target, val, pos, currentDoc);
8561
8644
  }
8562
8645
  };
@@ -8607,6 +8690,9 @@ var dooboostoreSimpleWebComponent = (() => {
8607
8690
  function applyInnerHtmlNode(selector, options = {}) {
8608
8691
  return applyNode(selector, { ...options, position: "innerHtml" });
8609
8692
  }
8693
+ function applyInnerTextNode(selector, options = {}) {
8694
+ return applyNode(selector, { ...options, position: "innerText" });
8695
+ }
8610
8696
 
8611
8697
  // src/decorators/applyClass.ts
8612
8698
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
@@ -8628,81 +8714,91 @@ var dooboostoreSimpleWebComponent = (() => {
8628
8714
  }
8629
8715
  metaList.set(propertyKey, { propertyKey, selector, action, options: finalOptions });
8630
8716
  const original = descriptor.value;
8631
- descriptor.value = async function(...args) {
8717
+ descriptor.value = function(...args) {
8632
8718
  ensureInit(this);
8633
- const res = await original.apply(this, args);
8634
- if (res !== void 0) {
8635
- const win = this.ownerDocument?.defaultView || window;
8636
- const host2 = this;
8637
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
8638
- const r = finalOptions.root || "auto";
8639
- const targetEls = [];
8640
- const applyRoot = (t) => {
8641
- if (!t || !(t instanceof win.HTMLElement)) return;
8642
- targetEls.push(t);
8643
- };
8644
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8645
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8646
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8647
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8648
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8649
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8650
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8651
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8652
- else if (selector === ":host" || !selector) applyRoot(host2);
8653
- else {
8654
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8655
- if (targetRoot) {
8656
- const found = targetRoot.querySelectorAll(selector);
8657
- if (found) targetEls.push(...Array.from(found));
8658
- }
8659
- }
8660
- targetEls.forEach((targetEl) => {
8661
- const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
8662
- if (action === "set") {
8663
- let classes = "";
8664
- if (classMap && typeof classMap === "string") {
8665
- classes = resolvedRes ? classMap : "";
8666
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8667
- classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls]) => cls).join(" ");
8668
- } else {
8669
- classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
8719
+ const res = original.apply(this, args);
8720
+ const handleResult = (resolvedValue) => {
8721
+ if (resolvedValue !== void 0) {
8722
+ const win = this.ownerDocument?.defaultView || window;
8723
+ const host2 = this;
8724
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
8725
+ const r = finalOptions.root || "auto";
8726
+ const targetEls = [];
8727
+ const applyRoot = (t) => {
8728
+ if (!t || !(t instanceof win.HTMLElement)) return;
8729
+ targetEls.push(t);
8730
+ };
8731
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8732
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8733
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8734
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8735
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8736
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8737
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8738
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8739
+ else if (selector === ":host" || !selector) applyRoot(host2);
8740
+ else {
8741
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8742
+ if (targetRoot) {
8743
+ const found = targetRoot.querySelectorAll(selector);
8744
+ if (found) targetEls.push(...Array.from(found));
8670
8745
  }
8671
- targetEl.className = classes;
8672
- } else if (action === "update" || action === "toggle") {
8673
- if (classMap && typeof classMap === "string") {
8674
- targetEl.classList.toggle(classMap, !!resolvedRes);
8675
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8676
- Object.entries(resolvedRes).forEach(([cls, force]) => {
8677
- const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
8678
- targetEl.classList.toggle(cls, isActive);
8679
- });
8680
- } else {
8681
- const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
8682
- if (action === "update") targetEl.classList.add(...classes);
8683
- else classes.forEach((c) => targetEl.classList.toggle(c));
8746
+ }
8747
+ targetEls.forEach((targetEl) => {
8748
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
8749
+ return;
8684
8750
  }
8685
- } else if (action === "add" || action === "remove") {
8686
- if (classMap && typeof classMap === "string" && !!resolvedRes) {
8687
- if (action === "add") targetEl.classList.add(classMap);
8688
- else targetEl.classList.remove(classMap);
8689
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8690
- Object.entries(resolvedRes).forEach(([cls, force]) => {
8691
- const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
8692
- if (shouldExecute) {
8693
- if (action === "add") targetEl.classList.add(cls);
8694
- else targetEl.classList.remove(cls);
8695
- }
8696
- });
8697
- } else {
8698
- const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
8699
- if (action === "add") targetEl.classList.add(...classes);
8700
- else targetEl.classList.remove(...classes);
8751
+ const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
8752
+ if (action === "set") {
8753
+ let classes = "";
8754
+ if (classMap && typeof classMap === "string") {
8755
+ classes = resolvedRes ? classMap : "";
8756
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8757
+ classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls]) => cls).join(" ");
8758
+ } else {
8759
+ classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
8760
+ }
8761
+ targetEl.className = classes;
8762
+ } else if (action === "update" || action === "toggle") {
8763
+ if (classMap && typeof classMap === "string") {
8764
+ targetEl.classList.toggle(classMap, !!resolvedRes);
8765
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8766
+ Object.entries(resolvedRes).forEach(([cls, force]) => {
8767
+ const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
8768
+ targetEl.classList.toggle(cls, isActive);
8769
+ });
8770
+ } else {
8771
+ const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
8772
+ if (action === "update") targetEl.classList.add(...classes);
8773
+ else classes.forEach((c) => targetEl.classList.toggle(c));
8774
+ }
8775
+ } else if (action === "add" || action === "remove") {
8776
+ if (classMap && typeof classMap === "string" && !!resolvedRes) {
8777
+ if (action === "add") targetEl.classList.add(classMap);
8778
+ else targetEl.classList.remove(classMap);
8779
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8780
+ Object.entries(resolvedRes).forEach(([cls, force]) => {
8781
+ const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
8782
+ if (shouldExecute) {
8783
+ if (action === "add") targetEl.classList.add(cls);
8784
+ else targetEl.classList.remove(cls);
8785
+ }
8786
+ });
8787
+ } else {
8788
+ const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
8789
+ if (action === "add") targetEl.classList.add(...classes);
8790
+ else targetEl.classList.remove(...classes);
8791
+ }
8701
8792
  }
8702
- }
8703
- });
8793
+ });
8794
+ }
8795
+ return resolvedValue;
8796
+ };
8797
+ if (res instanceof Promise) {
8798
+ return res.then(handleResult);
8799
+ } else {
8800
+ return handleResult(res);
8704
8801
  }
8705
- return res;
8706
8802
  };
8707
8803
  return descriptor;
8708
8804
  };
@@ -8748,67 +8844,77 @@ var dooboostoreSimpleWebComponent = (() => {
8748
8844
  }
8749
8845
  metaList.set(propertyKey, { propertyKey, selector, action, options });
8750
8846
  const original = descriptor.value;
8751
- descriptor.value = async function(...args) {
8847
+ descriptor.value = function(...args) {
8752
8848
  ensureInit(this);
8753
- const res = await original.apply(this, args);
8754
- if (res !== void 0) {
8755
- const win = this.ownerDocument?.defaultView || window;
8756
- const host2 = this;
8757
- const hostSet = SwcUtils.getHelperAndHostSet(win, host2);
8758
- const r = options.root || "auto";
8759
- const targetEls = [];
8760
- const applyRoot = (t) => {
8761
- if (!t || !(t instanceof win.HTMLElement)) return;
8762
- targetEls.push(t);
8763
- };
8764
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8765
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8766
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8767
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8768
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8769
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8770
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8771
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8772
- else if (selector === ":host" || !selector) applyRoot(host2);
8773
- else {
8774
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8775
- if (targetRoot) {
8776
- const found = targetRoot.querySelectorAll(selector);
8777
- if (found) targetEls.push(...Array.from(found));
8849
+ const res = original.apply(this, args);
8850
+ const handleResult = (resolvedValue) => {
8851
+ if (resolvedValue !== void 0) {
8852
+ const win = this.ownerDocument?.defaultView || window;
8853
+ const host2 = this;
8854
+ const hostSet = SwcUtils.getHelperAndHostSet(win, host2);
8855
+ const r = options.root || "auto";
8856
+ const targetEls = [];
8857
+ const applyRoot = (t) => {
8858
+ if (!t || !(t instanceof win.HTMLElement)) return;
8859
+ targetEls.push(t);
8860
+ };
8861
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8862
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8863
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8864
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8865
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8866
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8867
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8868
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8869
+ else if (selector === ":host" || !selector) applyRoot(host2);
8870
+ else {
8871
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8872
+ if (targetRoot) {
8873
+ const found = targetRoot.querySelectorAll(selector);
8874
+ if (found) targetEls.push(...Array.from(found));
8875
+ }
8778
8876
  }
8779
- }
8780
- targetEls.forEach((targetEl) => {
8781
- const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
8782
- if (action === "set" || action === "update") {
8783
- if (action === "set") targetEl.style.cssText = "";
8784
- if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8785
- Object.entries(resolvedRes).forEach(([prop, val]) => {
8786
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
8787
- if (finalVal === null || finalVal === void 0) {
8788
- targetEl.style.removeProperty(prop);
8789
- } else {
8790
- targetEl.style[prop] = String(finalVal);
8791
- }
8792
- });
8793
- } else if (typeof resolvedRes === "string") {
8794
- targetEl.style.cssText = resolvedRes;
8877
+ targetEls.forEach((targetEl) => {
8878
+ if (options.filter && !options.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
8879
+ return;
8795
8880
  }
8796
- } else if (action === "remove") {
8797
- if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8798
- Object.entries(resolvedRes).forEach(([prop, val]) => {
8799
- const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
8800
- if (shouldRemove) {
8801
- targetEl.style.removeProperty(prop);
8802
- }
8803
- });
8804
- } else {
8805
- const props = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
8806
- props.forEach((p) => targetEl.style.removeProperty(String(p)));
8881
+ const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
8882
+ if (action === "set" || action === "update") {
8883
+ if (action === "set") targetEl.style.cssText = "";
8884
+ if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8885
+ Object.entries(resolvedRes).forEach(([prop, val]) => {
8886
+ const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
8887
+ if (finalVal === null || finalVal === void 0) {
8888
+ targetEl.style.removeProperty(prop);
8889
+ } else {
8890
+ targetEl.style[prop] = String(finalVal);
8891
+ }
8892
+ });
8893
+ } else if (typeof resolvedRes === "string") {
8894
+ targetEl.style.cssText = resolvedRes;
8895
+ }
8896
+ } else if (action === "remove") {
8897
+ if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8898
+ Object.entries(resolvedRes).forEach(([prop, val]) => {
8899
+ const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
8900
+ if (shouldRemove) {
8901
+ targetEl.style.removeProperty(prop);
8902
+ }
8903
+ });
8904
+ } else {
8905
+ const props = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
8906
+ props.forEach((p) => targetEl.style.removeProperty(String(p)));
8907
+ }
8807
8908
  }
8808
- }
8809
- });
8909
+ });
8910
+ }
8911
+ return resolvedValue;
8912
+ };
8913
+ if (res instanceof Promise) {
8914
+ return res.then(handleResult);
8915
+ } else {
8916
+ return handleResult(res);
8810
8917
  }
8811
- return res;
8812
8918
  };
8813
8919
  return descriptor;
8814
8920
  };
@@ -8858,48 +8964,59 @@ var dooboostoreSimpleWebComponent = (() => {
8858
8964
  options: { ...finalOptions, name: propertyName }
8859
8965
  });
8860
8966
  const original = descriptor.value;
8861
- descriptor.value = async function(...args) {
8967
+ descriptor.value = function(...args) {
8862
8968
  ensureInit(this);
8863
- const res = await original.apply(this, args);
8864
- if (res !== void 0) {
8865
- const win = this.ownerDocument?.defaultView || window;
8866
- const host2 = this;
8867
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
8868
- const r = finalOptions.root || "auto";
8869
- const targetEls = [];
8870
- const applyRoot = (t) => {
8871
- if (!t || !(t instanceof win.HTMLElement)) return;
8872
- targetEls.push(t);
8873
- };
8874
- if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8875
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8876
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8877
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8878
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8879
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8880
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8881
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8882
- else if (selector === ":host" || !selector) applyRoot(host2);
8883
- else {
8884
- const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8885
- if (targetRoot) {
8886
- const found = targetRoot.querySelectorAll(selector);
8887
- if (found) targetEls.push(...Array.from(found));
8969
+ const res = original.apply(this, args);
8970
+ const handleResult = (resolvedValue) => {
8971
+ if (resolvedValue !== void 0) {
8972
+ const win = this.ownerDocument?.defaultView || window;
8973
+ const host2 = this;
8974
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
8975
+ const r = finalOptions.root || "auto";
8976
+ const targetEls = [];
8977
+ const applyRoot = (t) => {
8978
+ if (!t || !(t instanceof win.HTMLElement)) return;
8979
+ targetEls.push(t);
8980
+ };
8981
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
8982
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
8983
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
8984
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
8985
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
8986
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
8987
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
8988
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
8989
+ else if (selector === ":host" || !selector) applyRoot(host2);
8990
+ else {
8991
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
8992
+ if (targetRoot) {
8993
+ const found = targetRoot.querySelectorAll(selector);
8994
+ if (found) targetEls.push(...Array.from(found));
8995
+ }
8888
8996
  }
8997
+ targetEls.forEach((targetEl) => {
8998
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
8999
+ return;
9000
+ }
9001
+ const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
9002
+ if (propertyName) {
9003
+ targetEl[propertyName] = resolvedRes;
9004
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
9005
+ Object.entries(resolvedRes).forEach(([prop, val]) => {
9006
+ const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
9007
+ targetEl[prop] = finalVal;
9008
+ });
9009
+ } else {
9010
+ targetEl.value = resolvedRes;
9011
+ }
9012
+ });
8889
9013
  }
8890
- targetEls.forEach((targetEl) => {
8891
- const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
8892
- if (propertyName) {
8893
- targetEl[propertyName] = resolvedRes;
8894
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8895
- Object.entries(resolvedRes).forEach(([prop, val]) => {
8896
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
8897
- targetEl[prop] = finalVal;
8898
- });
8899
- } else {
8900
- targetEl.value = resolvedRes;
8901
- }
8902
- });
9014
+ return resolvedValue;
9015
+ };
9016
+ if (res instanceof Promise) {
9017
+ return res.then(handleResult);
9018
+ } else {
9019
+ return handleResult(res);
8903
9020
  }
8904
9021
  };
8905
9022
  };
@@ -8920,7 +9037,7 @@ var dooboostoreSimpleWebComponent = (() => {
8920
9037
  list = [];
8921
9038
  ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
8922
9039
  }
8923
- list.push({ propertyKey, pathPattern, filter });
9040
+ list.push({ propertyKey, options });
8924
9041
  return descriptor;
8925
9042
  };
8926
9043
  }
@@ -8931,7 +9048,7 @@ var dooboostoreSimpleWebComponent = (() => {
8931
9048
  let options = {};
8932
9049
  if (Array.isArray(targetOrOptions)) {
8933
9050
  options.path = targetOrOptions;
8934
- } else if (typeof targetOrOptions === "string") {
9051
+ } else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
8935
9052
  options.path = targetOrOptions;
8936
9053
  } else if (targetOrOptions && typeof targetOrOptions === "object") {
8937
9054
  options = targetOrOptions;
@@ -9077,6 +9194,22 @@ var dooboostoreSimpleWebComponent = (() => {
9077
9194
  return typeof obj?.hasActivate === "function";
9078
9195
  };
9079
9196
  })(RouterAction || (RouterAction = {}));
9197
+
9198
+ // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
9199
+ var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
9200
+
9201
+ // ../simple-boot/dist/esm/fetch/ApiService.js
9202
+ var ApiServiceInterceptor;
9203
+ ((ApiServiceInterceptor2) => {
9204
+ ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
9205
+ ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
9206
+ try {
9207
+ return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
9208
+ } catch (e) {
9209
+ return [];
9210
+ }
9211
+ };
9212
+ })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
9080
9213
  return __toCommonJS(bundle_entry_exports);
9081
9214
  })();
9082
9215
  /*! Bundled license information: