@dooboostore/simple-web-component 1.0.43 → 1.0.45

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 (146) hide show
  1. package/README.md +312 -63
  2. package/dist/cjs/SwcAppEngine.js +3 -1
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  5. package/dist/cjs/decorators/applyAttribute.js +66 -43
  6. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  7. package/dist/cjs/decorators/applyClass.js +110 -43
  8. package/dist/cjs/decorators/applyClass.js.map +3 -3
  9. package/dist/cjs/decorators/applyNode.js +200 -112
  10. package/dist/cjs/decorators/applyNode.js.map +2 -2
  11. package/dist/cjs/decorators/applyProperty.js +49 -45
  12. package/dist/cjs/decorators/applyProperty.js.map +2 -2
  13. package/dist/cjs/decorators/applyStyle.js +92 -37
  14. package/dist/cjs/decorators/applyStyle.js.map +3 -3
  15. package/dist/cjs/decorators/{changedAttributeThis.js → changedAttribute.js} +6 -6
  16. package/dist/cjs/decorators/changedAttribute.js.map +7 -0
  17. package/dist/cjs/decorators/elementDefine.js +81 -31
  18. package/dist/cjs/decorators/elementDefine.js.map +3 -3
  19. package/dist/cjs/decorators/emitCustomEvent.js +80 -52
  20. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  21. package/dist/cjs/decorators/index.js +1 -1
  22. package/dist/cjs/decorators/index.js.map +2 -2
  23. package/dist/cjs/decorators/publishSwcAppMessage.js +5 -5
  24. package/dist/cjs/decorators/publishSwcAppMessage.js.map +3 -3
  25. package/dist/cjs/decorators/query.js +133 -147
  26. package/dist/cjs/decorators/query.js.map +3 -3
  27. package/dist/cjs/decorators/queryAll.js +143 -132
  28. package/dist/cjs/decorators/queryAll.js.map +3 -3
  29. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
  30. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
  31. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
  32. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  33. package/dist/cjs/elements/SwcAppMixin.js +17 -2
  34. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  35. package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
  36. package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
  37. package/dist/cjs/index.js +1 -0
  38. package/dist/cjs/index.js.map +2 -2
  39. package/dist/cjs/router/ElementRouter.js +4 -0
  40. package/dist/cjs/router/ElementRouter.js.map +2 -2
  41. package/dist/cjs/types/window.d.js.map +1 -1
  42. package/dist/esm/SwcAppEngine.js +3 -1
  43. package/dist/esm/SwcAppEngine.js.map +2 -2
  44. package/dist/esm/decorators/addEventListener.js.map +2 -2
  45. package/dist/esm/decorators/applyAttribute.js +66 -43
  46. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  47. package/dist/esm/decorators/applyClass.js +110 -43
  48. package/dist/esm/decorators/applyClass.js.map +3 -3
  49. package/dist/esm/decorators/applyNode.js +200 -112
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applyProperty.js +49 -45
  52. package/dist/esm/decorators/applyProperty.js.map +2 -2
  53. package/dist/esm/decorators/applyStyle.js +92 -37
  54. package/dist/esm/decorators/applyStyle.js.map +3 -3
  55. package/dist/esm/decorators/{changedAttributeThis.js → changedAttribute.js} +3 -3
  56. package/dist/esm/decorators/changedAttribute.js.map +7 -0
  57. package/dist/esm/decorators/elementDefine.js +79 -29
  58. package/dist/esm/decorators/elementDefine.js.map +2 -2
  59. package/dist/esm/decorators/emitCustomEvent.js +80 -52
  60. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  61. package/dist/esm/decorators/index.js +1 -1
  62. package/dist/esm/decorators/index.js.map +1 -1
  63. package/dist/esm/decorators/publishSwcAppMessage.js +5 -5
  64. package/dist/esm/decorators/publishSwcAppMessage.js.map +3 -3
  65. package/dist/esm/decorators/query.js +133 -147
  66. package/dist/esm/decorators/query.js.map +3 -3
  67. package/dist/esm/decorators/queryAll.js +143 -132
  68. package/dist/esm/decorators/queryAll.js.map +3 -3
  69. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
  70. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
  71. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
  72. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  73. package/dist/esm/elements/SwcAppMixin.js +18 -3
  74. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  75. package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
  76. package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
  77. package/dist/esm/index.js +1 -0
  78. package/dist/esm/index.js.map +2 -2
  79. package/dist/esm/router/ElementRouter.js +4 -0
  80. package/dist/esm/router/ElementRouter.js.map +2 -2
  81. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +1118 -633
  82. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  83. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  84. package/dist/types/decorators/addEventListener.d.ts +19 -15
  85. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  86. package/dist/types/decorators/applyAttribute.d.ts +45 -26
  87. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  88. package/dist/types/decorators/applyClass.d.ts +19 -38
  89. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  90. package/dist/types/decorators/applyNode.d.ts +175 -32
  91. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  92. package/dist/types/decorators/applyProperty.d.ts +38 -25
  93. package/dist/types/decorators/applyProperty.d.ts.map +1 -1
  94. package/dist/types/decorators/applyStyle.d.ts +10 -9
  95. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  96. package/dist/types/decorators/{changedAttributeThis.d.ts → changedAttribute.d.ts} +2 -2
  97. package/dist/types/decorators/changedAttribute.d.ts.map +1 -0
  98. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  99. package/dist/types/decorators/emitCustomEvent.d.ts +6 -12
  100. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  101. package/dist/types/decorators/index.d.ts +1 -1
  102. package/dist/types/decorators/index.d.ts.map +1 -1
  103. package/dist/types/decorators/publishSwcAppMessage.d.ts +1 -1
  104. package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
  105. package/dist/types/decorators/query.d.ts +16 -29
  106. package/dist/types/decorators/query.d.ts.map +1 -1
  107. package/dist/types/decorators/queryAll.d.ts +16 -23
  108. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  109. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +1 -0
  110. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  111. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
  112. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  113. package/dist/types/elements/SwcAppMixin.d.ts +4 -4
  114. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  115. package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
  116. package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
  117. package/dist/types/index.d.ts +1 -0
  118. package/dist/types/index.d.ts.map +1 -1
  119. package/dist/types/router/ElementRouter.d.ts.map +1 -1
  120. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +1118 -633
  121. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  122. package/package.json +1 -1
  123. package/src/SwcAppEngine.ts +3 -1
  124. package/src/decorators/addEventListener.ts +31 -25
  125. package/src/decorators/applyAttribute.ts +164 -86
  126. package/src/decorators/applyClass.ts +161 -41
  127. package/src/decorators/applyNode.ts +408 -108
  128. package/src/decorators/applyProperty.ts +100 -89
  129. package/src/decorators/applyStyle.ts +131 -37
  130. package/src/decorators/{changedAttributeThis.ts → changedAttribute.ts} +1 -1
  131. package/src/decorators/elementDefine.ts +96 -30
  132. package/src/decorators/emitCustomEvent.ts +92 -60
  133. package/src/decorators/index.ts +1 -1
  134. package/src/decorators/publishSwcAppMessage.ts +1 -1
  135. package/src/decorators/query.ts +155 -162
  136. package/src/decorators/queryAll.ts +157 -139
  137. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -0
  138. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +3 -1
  139. package/src/elements/SwcAppMixin.ts +43 -24
  140. package/src/examples/RxJSOperatorsExample.ts +279 -0
  141. package/src/index.ts +2 -0
  142. package/src/router/ElementRouter.ts +4 -0
  143. package/src/types/window.d.ts +3 -0
  144. package/dist/cjs/decorators/changedAttributeThis.js.map +0 -7
  145. package/dist/esm/decorators/changedAttributeThis.js.map +0 -7
  146. package/dist/types/decorators/changedAttributeThis.d.ts.map +0 -1
@@ -1158,6 +1158,7 @@ var dooboostoreSimpleWebComponent = (() => {
1158
1158
  SwcAppAside: () => SwcAppAside,
1159
1159
  SwcAppBody: () => SwcAppBody,
1160
1160
  SwcAppDiv: () => SwcAppDiv,
1161
+ SwcAppEngine: () => SwcAppEngine,
1161
1162
  SwcAppFooter: () => SwcAppFooter,
1162
1163
  SwcAppHeader: () => SwcAppHeader,
1163
1164
  SwcAppMain: () => SwcAppMain,
@@ -1166,7 +1167,6 @@ var dooboostoreSimpleWebComponent = (() => {
1166
1167
  SwcAppSection: () => SwcAppSection,
1167
1168
  SwcUtils: () => SwcUtils,
1168
1169
  addClass: () => addClass,
1169
- addClassThis: () => addClassThis,
1170
1170
  addEventListener: () => addEventListener,
1171
1171
  addEventListenerAppHost: () => addEventListenerAppHost,
1172
1172
  addEventListenerDelegate: () => addEventListenerDelegate,
@@ -1176,28 +1176,21 @@ var dooboostoreSimpleWebComponent = (() => {
1176
1176
  addEventListenerDocument: () => addEventListenerDocument,
1177
1177
  addEventListenerThis: () => addEventListenerThis,
1178
1178
  addEventListenerWindow: () => addEventListenerWindow,
1179
- afterBeginLightNodeThis: () => afterBeginLightNodeThis,
1180
- afterBeginNodeThis: () => afterBeginNodeThis,
1181
- allAppHost: () => allAppHost,
1182
- allParentHost: () => allParentHost,
1183
1179
  appendHtmlSlot: () => appendHtmlSlot,
1184
1180
  appendSlot: () => appendSlot,
1185
1181
  appendTextSlot: () => appendTextSlot,
1186
1182
  applyAttribute: () => applyAttribute,
1187
1183
  applyClass: () => applyClass,
1188
- applyClassThis: () => applyClassThis,
1189
1184
  applyNode: () => applyNode,
1190
- applyNodeThis: () => applyNodeThis,
1191
1185
  applyProperty: () => applyProperty,
1192
1186
  applySlot: () => applySlot,
1193
1187
  applyStyle: () => applyStyle,
1194
- applyStyleThis: () => applyStyleThis,
1195
1188
  attribute: () => attribute,
1196
- attributeThis: () => attributeThis,
1197
- beforeEndLightNodeThis: () => beforeEndLightNodeThis,
1198
- beforeEndNodeThis: () => beforeEndNodeThis,
1199
- beforeEndShadowNodeThis: () => beforeEndShadowNodeThis,
1200
- changedAttributeThis: () => changedAttributeThis,
1189
+ changedAttribute: () => changedAttribute,
1190
+ changedRoute: () => changedRoute,
1191
+ clearChildrenLight: () => clearChildrenLight,
1192
+ clearChildrenNode: () => clearChildrenNode,
1193
+ clearNode: () => clearNode,
1201
1194
  clearSlot: () => clearSlot,
1202
1195
  commentNode: () => commentNode,
1203
1196
  convertAttributeValue: () => convertAttributeValue,
@@ -1217,7 +1210,6 @@ var dooboostoreSimpleWebComponent = (() => {
1217
1210
  elementDefine: () => elementDefine,
1218
1211
  emit: () => emit,
1219
1212
  emitCustomEvent: () => emitCustomEvent,
1220
- emitCustomEventThis: () => emitCustomEventThis,
1221
1213
  ensureInit: () => ensureInit,
1222
1214
  event: () => event,
1223
1215
  eventDelegate: () => eventDelegate,
@@ -1260,15 +1252,17 @@ var dooboostoreSimpleWebComponent = (() => {
1260
1252
  htmlSectionElement: () => htmlSectionElement,
1261
1253
  htmlSpanElement: () => htmlSpanElement,
1262
1254
  htmlUlElement: () => htmlUlElement,
1263
- innerHtmlLightNode: () => innerHtmlLightNode,
1264
- innerHtmlLightNodeThis: () => innerHtmlLightNodeThis,
1265
- innerHtmlNode: () => innerHtmlNode,
1266
- innerHtmlNodeThis: () => innerHtmlNodeThis,
1267
- innerHtmlShadowNode: () => innerHtmlShadowNode,
1268
- innerTextLightNode: () => innerTextLightNode,
1269
- innerTextNode: () => innerTextNode,
1270
- innerTextNodeThis: () => innerTextNodeThis,
1271
- innerTextShadowNode: () => innerTextShadowNode,
1255
+ innerHtml: () => innerHtml,
1256
+ innerHtmlLight: () => innerHtmlLight,
1257
+ innerHtmlShadow: () => innerHtmlShadow,
1258
+ innerText: () => innerText,
1259
+ innerTextLight: () => innerTextLight,
1260
+ innerTextShadow: () => innerTextShadow,
1261
+ insertAfterBegin: () => insertAfterBegin,
1262
+ insertAfterBeginLight: () => insertAfterBeginLight,
1263
+ insertBeforeEnd: () => insertBeforeEnd,
1264
+ insertBeforeEndLight: () => insertBeforeEndLight,
1265
+ insertBeforeEndShadow: () => insertBeforeEndShadow,
1272
1266
  isSSR: () => isSSR,
1273
1267
  onAdopted: () => onAdopted,
1274
1268
  onAdoptedAfter: () => onAdoptedAfter,
@@ -1288,39 +1282,26 @@ var dooboostoreSimpleWebComponent = (() => {
1288
1282
  prependSlot: () => prependSlot,
1289
1283
  prependTextSlot: () => prependTextSlot,
1290
1284
  property: () => property,
1291
- propertyThis: () => propertyThis,
1292
- publish: () => publish,
1285
+ publishMessage: () => publishMessage,
1293
1286
  publishSwcAppMessage: () => publishSwcAppMessage,
1294
1287
  query: () => query,
1295
1288
  queryAll: () => queryAll,
1296
- queryAllThis: () => queryAllThis,
1297
- queryAppHost: () => queryAppHost,
1298
- queryDocument: () => queryDocument,
1299
- queryHost: () => queryHost,
1300
- queryThis: () => queryThis,
1301
- queryWindow: () => queryWindow,
1289
+ receiveMessage: () => receiveMessage,
1302
1290
  removeClass: () => removeClass,
1303
- removeClassThis: () => removeClassThis,
1304
1291
  removeSSRAttribute: () => removeSSRAttribute,
1305
1292
  removeStyle: () => removeStyle,
1306
- removeStyleThis: () => removeStyleThis,
1293
+ replaceChildren: () => replaceChildren,
1307
1294
  replaceChildrenHtmlSlot: () => replaceChildrenHtmlSlot,
1308
- replaceChildrenLightNodeThis: () => replaceChildrenLightNodeThis,
1309
- replaceChildrenNode: () => replaceChildrenNode,
1310
- replaceChildrenNodeThis: () => replaceChildrenNodeThis,
1295
+ replaceChildrenLight: () => replaceChildrenLight,
1311
1296
  replaceChildrenSlot: () => replaceChildrenSlot,
1312
1297
  replaceChildrenTextSlot: () => replaceChildrenTextSlot,
1313
1298
  resolveAttributeTargets: () => resolveAttributeTargets,
1314
1299
  resolvePropertyTargets: () => resolvePropertyTargets,
1315
1300
  setAttribute: () => setAttribute,
1316
- setAttributeThis: () => setAttributeThis,
1317
1301
  setClass: () => setClass,
1318
- setClassThis: () => setClassThis,
1319
1302
  setProperty: () => setProperty,
1320
- setPropertyThis: () => setPropertyThis,
1321
1303
  setSSRAttribute: () => setSSRAttribute,
1322
1304
  setStyle: () => setStyle,
1323
- setStyleThis: () => setStyleThis,
1324
1305
  state: () => state,
1325
1306
  subscribeSwcAppMessageWhileConnected: () => subscribeSwcAppMessageWhileConnected,
1326
1307
  subscribeSwcAppRouteChangeWhileConnected: () => subscribeSwcAppRouteChangeWhileConnected,
@@ -1337,11 +1318,8 @@ var dooboostoreSimpleWebComponent = (() => {
1337
1318
  swcAppTagName: () => swcAppTagName,
1338
1319
  textNode: () => textNode,
1339
1320
  toggleClass: () => toggleClass,
1340
- toggleClassThis: () => toggleClassThis,
1341
1321
  updateClass: () => updateClass,
1342
- updateClassThis: () => updateClassThis,
1343
- updateStyle: () => updateStyle,
1344
- updateStyleThis: () => updateStyleThis
1322
+ updateStyle: () => updateStyle
1345
1323
  });
1346
1324
  var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1347
1325
 
@@ -6573,6 +6551,155 @@ var dooboostoreSimpleWebComponent = (() => {
6573
6551
  return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
6574
6552
  };
6575
6553
 
6554
+ // ../core/dist/esm/message/operators/debounceTime.js
6555
+ function debounceTime(duration, config) {
6556
+ return (source) => {
6557
+ return new Observable((subscriber) => {
6558
+ const setTimeoutFn = config?.setTimeout || setTimeout;
6559
+ const clearTimeoutFn = config?.clearTimeout || clearTimeout;
6560
+ let timeoutId = null;
6561
+ let lastValue;
6562
+ let hasValue = false;
6563
+ const subscription = source.subscribe({
6564
+ next: (value) => {
6565
+ clearTimeoutFn(timeoutId);
6566
+ lastValue = value;
6567
+ hasValue = true;
6568
+ timeoutId = setTimeoutFn(() => {
6569
+ if (hasValue) {
6570
+ subscriber.next(lastValue);
6571
+ hasValue = false;
6572
+ }
6573
+ }, duration);
6574
+ },
6575
+ error: (err) => {
6576
+ clearTimeoutFn(timeoutId);
6577
+ subscriber.error(err);
6578
+ },
6579
+ complete: () => {
6580
+ clearTimeoutFn(timeoutId);
6581
+ if (hasValue) {
6582
+ subscriber.next(lastValue);
6583
+ }
6584
+ subscriber.complete();
6585
+ }
6586
+ });
6587
+ return subscription;
6588
+ });
6589
+ };
6590
+ }
6591
+
6592
+ // ../core/dist/esm/message/operators/distinctUntilChanged.js
6593
+ function distinctUntilChanged(comparator) {
6594
+ return (source) => {
6595
+ return new Observable((subscriber) => {
6596
+ let hasValue = false;
6597
+ let previousValue;
6598
+ const subscription = source.subscribe({
6599
+ next: (value) => {
6600
+ const areEqual = hasValue ? comparator ? comparator(previousValue, value) : previousValue === value : false;
6601
+ if (!areEqual) {
6602
+ hasValue = true;
6603
+ previousValue = value;
6604
+ subscriber.next(value);
6605
+ }
6606
+ },
6607
+ error: (err) => {
6608
+ subscriber.error(err);
6609
+ },
6610
+ complete: () => {
6611
+ subscriber.complete();
6612
+ }
6613
+ });
6614
+ return subscription;
6615
+ });
6616
+ };
6617
+ }
6618
+
6619
+ // ../core/dist/esm/message/operators/throttleTime.js
6620
+ function throttleTime(duration, config) {
6621
+ const leading = config?.leading ?? true;
6622
+ const trailing = config?.trailing ?? false;
6623
+ const setTimeoutFn = config?.setTimeout || setTimeout;
6624
+ const clearTimeoutFn = config?.clearTimeout || clearTimeout;
6625
+ return (source) => {
6626
+ return new Observable((subscriber) => {
6627
+ let throttled = false;
6628
+ let trailingValue;
6629
+ let hasTrailingValue = false;
6630
+ let timeoutId = null;
6631
+ const endThrottle = () => {
6632
+ if (timeoutId !== null) {
6633
+ clearTimeoutFn(timeoutId);
6634
+ timeoutId = null;
6635
+ }
6636
+ throttled = false;
6637
+ if (trailing && hasTrailingValue) {
6638
+ const valueToEmit = trailingValue;
6639
+ hasTrailingValue = false;
6640
+ trailingValue = void 0;
6641
+ Promise.resolve().then(() => {
6642
+ if (!subscriber.closed) {
6643
+ subscriber.next(valueToEmit);
6644
+ startThrottle();
6645
+ }
6646
+ });
6647
+ }
6648
+ };
6649
+ const startThrottle = () => {
6650
+ if (throttled) {
6651
+ return;
6652
+ }
6653
+ throttled = true;
6654
+ timeoutId = setTimeoutFn(() => {
6655
+ endThrottle();
6656
+ }, duration);
6657
+ };
6658
+ const subscription = source.subscribe({
6659
+ next: (value) => {
6660
+ if (!throttled) {
6661
+ if (leading) {
6662
+ subscriber.next(value);
6663
+ } else if (trailing) {
6664
+ trailingValue = value;
6665
+ hasTrailingValue = true;
6666
+ }
6667
+ startThrottle();
6668
+ } else if (trailing) {
6669
+ trailingValue = value;
6670
+ hasTrailingValue = true;
6671
+ }
6672
+ },
6673
+ error: (err) => {
6674
+ if (timeoutId !== null) {
6675
+ clearTimeoutFn(timeoutId);
6676
+ timeoutId = null;
6677
+ }
6678
+ throttled = false;
6679
+ subscriber.error(err);
6680
+ },
6681
+ complete: () => {
6682
+ if (timeoutId !== null) {
6683
+ clearTimeoutFn(timeoutId);
6684
+ timeoutId = null;
6685
+ }
6686
+ if (trailing && hasTrailingValue) {
6687
+ subscriber.next(trailingValue);
6688
+ }
6689
+ subscriber.complete();
6690
+ }
6691
+ });
6692
+ return () => {
6693
+ subscription.unsubscribe();
6694
+ if (timeoutId !== null) {
6695
+ clearTimeoutFn(timeoutId);
6696
+ timeoutId = null;
6697
+ }
6698
+ };
6699
+ });
6700
+ };
6701
+ }
6702
+
6576
6703
  // src/decorators/lifecycles.ts
6577
6704
  var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
6578
6705
  var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
@@ -7077,7 +7204,7 @@ var dooboostoreSimpleWebComponent = (() => {
7077
7204
  if (!config?.targetVariableName || config?.targetVariableName && tit.variables.find((v) => v === config?.targetVariableName)) {
7078
7205
  const data = new Function("ctx", `
7079
7206
  with(ctx) {
7080
- return function(){
7207
+ return function(event){
7081
7208
  return (${this.stripWrap(tit.script)});
7082
7209
  }
7083
7210
  }
@@ -9031,18 +9158,32 @@ var dooboostoreSimpleWebComponent = (() => {
9031
9158
 
9032
9159
  // src/decorators/emitCustomEvent.ts
9033
9160
  var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
9034
- function emitCustomEvent(selectorOrTarget, type, options = {}) {
9161
+ function emitCustomEvent(selectorOrTarget, typeOrPropertyKey, optionsOrDescriptor) {
9162
+ if (typeof selectorOrTarget === "object" && typeof typeOrPropertyKey === "string" && typeof optionsOrDescriptor === "object" && "value" in optionsOrDescriptor) {
9163
+ throw new Error(`@emitCustomEvent decorator cannot be used on properties. (Property: ${String(typeOrPropertyKey)})`);
9164
+ }
9165
+ if ((typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") && typeof typeOrPropertyKey === "string") {
9166
+ return createEmitDecorator(selectorOrTarget, typeOrPropertyKey, optionsOrDescriptor);
9167
+ }
9168
+ if (typeof selectorOrTarget === "string" && typeOrPropertyKey !== "string") {
9169
+ return createEmitDecorator("$this", selectorOrTarget, typeOrPropertyKey);
9170
+ }
9171
+ throw new Error("Invalid @emitCustomEvent usage");
9172
+ }
9173
+ function createEmitDecorator(selector, type, options) {
9035
9174
  return (targetObj, propertyKey, descriptor) => {
9036
9175
  const constructor = targetObj.constructor;
9037
- const fullOptions = { ...options, type };
9038
- if (fullOptions.bubbles === void 0) fullOptions.bubbles = true;
9039
- if (fullOptions.composed === void 0) fullOptions.composed = true;
9176
+ const fullOptions = { ...options || {}, type };
9177
+ if (fullOptions.bubbles === void 0)
9178
+ fullOptions.bubbles = true;
9179
+ if (fullOptions.composed === void 0)
9180
+ fullOptions.composed = true;
9040
9181
  let list = ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
9041
9182
  if (!list) {
9042
9183
  list = [];
9043
9184
  ReflectUtils.defineMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, list, constructor);
9044
9185
  }
9045
- list.push({ propertyKey, selector: selectorOrTarget, type, options: fullOptions });
9186
+ list.push({ propertyKey, selector, type, options: fullOptions });
9046
9187
  const original = descriptor.value;
9047
9188
  descriptor.value = function(...args) {
9048
9189
  ensureInit(this);
@@ -9054,45 +9195,72 @@ var dooboostoreSimpleWebComponent = (() => {
9054
9195
  composed: fullOptions.composed,
9055
9196
  cancelable: fullOptions.cancelable
9056
9197
  });
9057
- const hostSet = SwcUtils.getHostSet(this);
9058
9198
  const conf = getElementConfig(this);
9059
9199
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
9200
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
9060
9201
  const eventTargets = [];
9061
- if (selectorOrTarget === "$window") eventTargets.push(currentWin);
9062
- else if (selectorOrTarget === "$document") eventTargets.push(currentWin.document);
9063
- else if (selectorOrTarget === "$host") {
9064
- if (hostSet.$host) eventTargets.push(hostSet.$host);
9065
- } else if (selectorOrTarget === "$parentHost") {
9066
- if (hostSet.$parentHost) eventTargets.push(hostSet.$parentHost);
9067
- } else if (selectorOrTarget === "$appHost") {
9068
- if (hostSet.$appHost) eventTargets.push(hostSet.$appHost);
9069
- } else if (selectorOrTarget === "$firstHost") {
9070
- if (hostSet.$firstHost) eventTargets.push(hostSet.$firstHost);
9071
- } else if (selectorOrTarget === "$lastHost") {
9072
- if (hostSet.$lastHost) eventTargets.push(hostSet.$lastHost);
9073
- } else if (selectorOrTarget === "$firstAppHost") {
9074
- if (hostSet.$firstAppHost) eventTargets.push(hostSet.$firstAppHost);
9075
- } else if (selectorOrTarget === "$lastAppHost") {
9076
- if (hostSet.$lastAppHost) eventTargets.push(hostSet.$lastAppHost);
9077
- } else if (selectorOrTarget === "$hosts") {
9078
- hostSet.$hosts.forEach((h) => eventTargets.push(h));
9079
- } else if (selectorOrTarget === "$appHosts") {
9080
- hostSet.$appHosts.forEach((h) => eventTargets.push(h));
9081
- } else if (selectorOrTarget === "$this" || !selectorOrTarget) {
9082
- eventTargets.push(this);
9202
+ let resolvedSelector = selector;
9203
+ if (typeof selector === "function") {
9204
+ resolvedSelector = selector(this, hostSet);
9205
+ }
9206
+ if (resolvedSelector instanceof currentWin.Element) {
9207
+ eventTargets.push(resolvedSelector);
9208
+ } else if (resolvedSelector instanceof currentWin.NodeList) {
9209
+ eventTargets.push(...Array.from(resolvedSelector));
9210
+ } else if (Array.isArray(resolvedSelector)) {
9211
+ eventTargets.push(...resolvedSelector);
9212
+ } else if (resolvedSelector === null) {
9083
9213
  } else {
9084
- const r = fullOptions.root || "auto";
9085
- const searchRoots = [];
9086
- if (r === "auto") searchRoots.push(this.shadowRoot || this);
9087
- else if (r === "light") searchRoots.push(this);
9088
- else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
9089
- else if (r === "all") {
9090
- searchRoots.push(this);
9091
- if (this.shadowRoot) searchRoots.push(this.shadowRoot);
9214
+ const stringSelector = resolvedSelector;
9215
+ if (stringSelector === "$window")
9216
+ eventTargets.push(currentWin);
9217
+ else if (stringSelector === "$document")
9218
+ eventTargets.push(currentWin.document);
9219
+ else if (stringSelector === "$host") {
9220
+ if (hostSet.$host)
9221
+ eventTargets.push(hostSet.$host);
9222
+ } else if (stringSelector === "$parentHost") {
9223
+ if (hostSet.$parentHost)
9224
+ eventTargets.push(hostSet.$parentHost);
9225
+ } else if (stringSelector === "$appHost") {
9226
+ if (hostSet.$appHost)
9227
+ eventTargets.push(hostSet.$appHost);
9228
+ } else if (stringSelector === "$firstHost") {
9229
+ if (hostSet.$firstHost)
9230
+ eventTargets.push(hostSet.$firstHost);
9231
+ } else if (stringSelector === "$lastHost") {
9232
+ if (hostSet.$lastHost)
9233
+ eventTargets.push(hostSet.$lastHost);
9234
+ } else if (stringSelector === "$firstAppHost") {
9235
+ if (hostSet.$firstAppHost)
9236
+ eventTargets.push(hostSet.$firstAppHost);
9237
+ } else if (stringSelector === "$lastAppHost") {
9238
+ if (hostSet.$lastAppHost)
9239
+ eventTargets.push(hostSet.$lastAppHost);
9240
+ } else if (stringSelector === "$hosts") {
9241
+ hostSet.$hosts.forEach((h) => eventTargets.push(h));
9242
+ } else if (stringSelector === "$appHosts") {
9243
+ hostSet.$appHosts.forEach((h) => eventTargets.push(h));
9244
+ } else if (stringSelector === "$this" || !stringSelector) {
9245
+ eventTargets.push(this);
9246
+ } else {
9247
+ const r = fullOptions.root || "auto";
9248
+ const searchRoots = [];
9249
+ if (r === "auto")
9250
+ searchRoots.push(this.shadowRoot || this);
9251
+ else if (r === "light")
9252
+ searchRoots.push(this);
9253
+ else if (r === "shadow" && this.shadowRoot)
9254
+ searchRoots.push(this.shadowRoot);
9255
+ else if (r === "all") {
9256
+ searchRoots.push(this);
9257
+ if (this.shadowRoot)
9258
+ searchRoots.push(this.shadowRoot);
9259
+ }
9260
+ searchRoots.forEach((sr) => {
9261
+ sr.querySelectorAll(stringSelector).forEach((el) => eventTargets.push(el));
9262
+ });
9092
9263
  }
9093
- searchRoots.forEach((sr) => {
9094
- sr.querySelectorAll(selectorOrTarget).forEach((el) => eventTargets.push(el));
9095
- });
9096
9264
  }
9097
9265
  eventTargets.forEach((t) => {
9098
9266
  if (fullOptions.filter && !fullOptions.filter(t, detail, { currentThis: this, helper: hostSet })) {
@@ -9115,20 +9283,8 @@ var dooboostoreSimpleWebComponent = (() => {
9115
9283
  return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
9116
9284
  };
9117
9285
  var emit = emitCustomEvent;
9118
- function emitCustomEventThis(type, optionsOrAttributeaName) {
9119
- if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "string") {
9120
- return emitCustomEventThis(type, { attributeName: optionsOrAttributeaName });
9121
- } else if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "object") {
9122
- if (!optionsOrAttributeaName.attributeName) {
9123
- optionsOrAttributeaName.attributeName = `on-emit-${type}`;
9124
- }
9125
- return emitCustomEvent("$this", type, optionsOrAttributeaName);
9126
- } else {
9127
- return emitCustomEvent("$this", type, { attributeName: `on-emit-${type}` });
9128
- }
9129
- }
9130
9286
 
9131
- // src/decorators/changedAttributeThis.ts
9287
+ // src/decorators/changedAttribute.ts
9132
9288
  var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
9133
9289
  var convertValue = (val, type) => {
9134
9290
  if (val === null || val === void 0) return val;
@@ -9136,7 +9292,7 @@ var dooboostoreSimpleWebComponent = (() => {
9136
9292
  if (type === Boolean) return val === "false" || val === "0" ? false : true;
9137
9293
  return val;
9138
9294
  };
9139
- function changedAttributeThis(attributeName, options = {}) {
9295
+ function changedAttribute(attributeName, options = {}) {
9140
9296
  return (target, propertyKey) => {
9141
9297
  const constructor = target.constructor;
9142
9298
  let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);
@@ -9176,150 +9332,141 @@ var dooboostoreSimpleWebComponent = (() => {
9176
9332
 
9177
9333
  // src/decorators/query.ts
9178
9334
  var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
9179
- function query(selectorOrTarget, options = {}) {
9180
- return (targetObj, propertyKey, descriptor) => {
9181
- if (descriptor !== void 0) {
9182
- throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
9183
- }
9184
- const constructor = targetObj.constructor;
9185
- let queries = ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
9186
- if (!queries) {
9187
- queries = [];
9188
- ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);
9189
- }
9190
- queries.push({ propertyKey, selector: selectorOrTarget, options });
9191
- Object.defineProperty(targetObj, propertyKey, {
9192
- get() {
9193
- ensureInit(this);
9194
- const selector = selectorOrTarget;
9195
- const r = options.root || "auto";
9196
- const applyRoot = (t) => {
9197
- if (!t || !(t instanceof HTMLElement))
9198
- return t;
9199
- if (r === "auto")
9200
- return t.shadowRoot || t;
9201
- if (r === "shadow")
9202
- return t.shadowRoot;
9203
- if (r === "light")
9204
- return t;
9205
- if (r === "all")
9206
- return t.shadowRoot || t;
9207
- return t;
9208
- };
9209
- const hostSet = SwcUtils.getHostSet(this);
9210
- if (selector === "$this")
9211
- return applyRoot(this);
9212
- if (selector === "$host")
9213
- return applyRoot(hostSet.$host);
9214
- if (selector === "$parentHost")
9215
- return applyRoot(hostSet.$parentHost);
9216
- if (selector === "$appHost")
9217
- return applyRoot(hostSet.$appHost);
9218
- if (selector === "$firstHost")
9219
- return applyRoot(hostSet.$firstHost);
9220
- if (selector === "$lastHost")
9221
- return applyRoot(hostSet.$lastHost);
9222
- if (selector === "$firstAppHost")
9223
- return applyRoot(hostSet.$firstAppHost);
9224
- if (selector === "$lastAppHost")
9225
- return applyRoot(hostSet.$lastAppHost);
9226
- const config = getElementConfig(this);
9227
- const win = config?.window || window;
9228
- if (selector === "$window")
9229
- return win;
9230
- if (selector === "$document")
9231
- return win.document;
9232
- if (r === "shadow")
9233
- return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
9234
- if (r === "light")
9235
- return this.querySelector(selector);
9236
- if (r === "all") {
9237
- const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
9238
- return shadowMatch || this.querySelector(selector);
9239
- }
9240
- return (this.shadowRoot || this).querySelector(selector);
9241
- },
9242
- set(nv) {
9243
- ensureInit(this);
9244
- if (nv === null || nv === void 0) {
9245
- const selector = selectorOrTarget;
9246
- if (selector.startsWith("$") && selector !== "$this")
9247
- return;
9248
- const r = options.root || "auto";
9249
- const targets = [];
9250
- if (r === "shadow") {
9251
- if (this.shadowRoot?.querySelector(selector))
9252
- targets.push(this.shadowRoot.querySelector(selector));
9253
- } else if (r === "light") {
9254
- if (this.querySelector(selector))
9255
- targets.push(this.querySelector(selector));
9256
- } else if (r === "all") {
9257
- if (this.shadowRoot?.querySelector(selector))
9258
- targets.push(this.shadowRoot.querySelector(selector));
9259
- if (this.querySelector(selector))
9260
- targets.push(this.querySelector(selector));
9335
+ function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
9336
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
9337
+ throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
9338
+ }
9339
+ if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
9340
+ return (targetObj, propertyKey, descriptor2) => {
9341
+ if (descriptor2 !== void 0) {
9342
+ throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
9343
+ }
9344
+ const constructor = targetObj.constructor;
9345
+ let queries = ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
9346
+ if (!queries) {
9347
+ queries = [];
9348
+ ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);
9349
+ }
9350
+ queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
9351
+ Object.defineProperty(targetObj, propertyKey, {
9352
+ get() {
9353
+ ensureInit(this);
9354
+ const config = getElementConfig(this);
9355
+ const win = config?.window || window;
9356
+ const hostSet = SwcUtils.getHelperAndHostSet(win, this);
9357
+ let resolvedSelector;
9358
+ let resolvedElement = null;
9359
+ if (typeof selectorOrTarget === "function") {
9360
+ const result = selectorOrTarget(this, hostSet);
9361
+ if (result instanceof win.Node || result instanceof win.Element) {
9362
+ resolvedElement = result instanceof win.HTMLElement ? result : null;
9363
+ } else if (result instanceof win.NodeList || Array.isArray(result)) {
9364
+ resolvedElement = result.length > 0 && result[0] instanceof win.HTMLElement ? result[0] : null;
9365
+ }
9261
9366
  } else {
9262
- const el = (this.shadowRoot || this).querySelector(selector);
9263
- if (el)
9264
- targets.push(el);
9367
+ resolvedSelector = selectorOrTarget;
9368
+ const r = optionsOrPropertyKey?.root || "auto";
9369
+ const applyRoot = (t) => {
9370
+ if (!t || !(t instanceof HTMLElement))
9371
+ return t;
9372
+ if (r === "auto")
9373
+ return t.shadowRoot || t;
9374
+ if (r === "shadow")
9375
+ return t.shadowRoot;
9376
+ if (r === "light")
9377
+ return t;
9378
+ if (r === "all")
9379
+ return t.shadowRoot || t;
9380
+ return t;
9381
+ };
9382
+ if (resolvedSelector === "$this")
9383
+ resolvedElement = applyRoot(this);
9384
+ else if (resolvedSelector === "$host")
9385
+ resolvedElement = applyRoot(hostSet.$host);
9386
+ else if (resolvedSelector === "$parentHost")
9387
+ resolvedElement = applyRoot(hostSet.$parentHost);
9388
+ else if (resolvedSelector === "$appHost")
9389
+ resolvedElement = applyRoot(hostSet.$appHost);
9390
+ else if (resolvedSelector === "$firstHost")
9391
+ resolvedElement = applyRoot(hostSet.$firstHost);
9392
+ else if (resolvedSelector === "$lastHost")
9393
+ resolvedElement = applyRoot(hostSet.$lastHost);
9394
+ else if (resolvedSelector === "$firstAppHost")
9395
+ resolvedElement = applyRoot(hostSet.$firstAppHost);
9396
+ else if (resolvedSelector === "$lastAppHost")
9397
+ resolvedElement = applyRoot(hostSet.$lastAppHost);
9398
+ else if (resolvedSelector === "$window")
9399
+ return win;
9400
+ else if (resolvedSelector === "$document")
9401
+ return win.document;
9402
+ else {
9403
+ if (r === "shadow")
9404
+ resolvedElement = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
9405
+ else if (r === "light")
9406
+ resolvedElement = this.querySelector(resolvedSelector);
9407
+ else if (r === "all") {
9408
+ const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
9409
+ resolvedElement = shadowMatch || this.querySelector(resolvedSelector);
9410
+ } else
9411
+ resolvedElement = (this.shadowRoot || this).querySelector(resolvedSelector);
9412
+ }
9265
9413
  }
9266
- targets.forEach((t) => t.remove());
9267
- }
9268
- },
9269
- enumerable: true,
9270
- configurable: true
9271
- });
9272
- };
9273
- }
9274
- function queryThis(targetOrOptions, propertyKey) {
9275
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9276
- return query("$this", {})(targetOrOptions, propertyKey);
9277
- }
9278
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9279
- return query("$this", targetOrOptions);
9280
- } else {
9281
- return query("$this", {});
9282
- }
9283
- }
9284
- function queryWindow(targetOrOptions, propertyKey) {
9285
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9286
- return query("$window", {})(targetOrOptions, propertyKey);
9287
- }
9288
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9289
- return query("$window", targetOrOptions);
9290
- } else {
9291
- return query("$window", {});
9292
- }
9293
- }
9294
- function queryDocument(targetOrOptions, propertyKey) {
9295
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9296
- return query("$document", {})(targetOrOptions, propertyKey);
9297
- }
9298
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9299
- return query("$document", targetOrOptions);
9300
- } else {
9301
- return query("$document", {});
9302
- }
9303
- }
9304
- function queryHost(targetOrOptions, propertyKey) {
9305
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9306
- return query("$host", {})(targetOrOptions, propertyKey);
9307
- }
9308
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9309
- return query("$host", targetOrOptions);
9310
- } else {
9311
- return query("$host", {});
9312
- }
9313
- }
9314
- function queryAppHost(targetOrOptions, propertyKey) {
9315
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9316
- return query("$appHost", {})(targetOrOptions, propertyKey);
9317
- }
9318
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9319
- return query("$appHost", targetOrOptions);
9320
- } else {
9321
- return query("$appHost", {});
9414
+ if (resolvedElement instanceof win.HTMLElement && optionsOrPropertyKey?.filter) {
9415
+ const shouldInclude = optionsOrPropertyKey.filter(resolvedElement, { currentThis: this, helper: hostSet });
9416
+ if (!shouldInclude) {
9417
+ return null;
9418
+ }
9419
+ }
9420
+ return resolvedElement;
9421
+ },
9422
+ set(nv) {
9423
+ ensureInit(this);
9424
+ if (nv === null || nv === void 0) {
9425
+ const config = getElementConfig(this);
9426
+ const win = config?.window || window;
9427
+ const hostSet = SwcUtils.getHelperAndHostSet(win, this);
9428
+ if (typeof selectorOrTarget === "function") {
9429
+ const result = selectorOrTarget(this, hostSet);
9430
+ if (result instanceof win.Element) {
9431
+ result.remove();
9432
+ } else if (result instanceof win.NodeList || Array.isArray(result)) {
9433
+ const el = result.length > 0 ? result[0] : null;
9434
+ if (el instanceof win.Element) {
9435
+ el.remove();
9436
+ }
9437
+ }
9438
+ return;
9439
+ }
9440
+ const resolvedSelector = selectorOrTarget;
9441
+ if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
9442
+ return;
9443
+ const r = optionsOrPropertyKey?.root || "auto";
9444
+ const targets = [];
9445
+ if (r === "shadow") {
9446
+ if (this.shadowRoot?.querySelector(resolvedSelector))
9447
+ targets.push(this.shadowRoot.querySelector(resolvedSelector));
9448
+ } else if (r === "light") {
9449
+ if (this.querySelector(resolvedSelector))
9450
+ targets.push(this.querySelector(resolvedSelector));
9451
+ } else if (r === "all") {
9452
+ if (this.shadowRoot?.querySelector(resolvedSelector))
9453
+ targets.push(this.shadowRoot.querySelector(resolvedSelector));
9454
+ if (this.querySelector(resolvedSelector))
9455
+ targets.push(this.querySelector(resolvedSelector));
9456
+ } else {
9457
+ const el = (this.shadowRoot || this).querySelector(resolvedSelector);
9458
+ if (el)
9459
+ targets.push(el);
9460
+ }
9461
+ targets.forEach((t) => t.remove());
9462
+ }
9463
+ },
9464
+ enumerable: true,
9465
+ configurable: true
9466
+ });
9467
+ };
9322
9468
  }
9469
+ return query("$this", selectorOrTarget);
9323
9470
  }
9324
9471
  var getQueryMetadata = (target) => {
9325
9472
  const constructor = target instanceof Function ? target : target.constructor;
@@ -9328,139 +9475,153 @@ var dooboostoreSimpleWebComponent = (() => {
9328
9475
 
9329
9476
  // src/decorators/queryAll.ts
9330
9477
  var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
9331
- function queryAll(selectorOrTarget, options = {}) {
9332
- return (targetObj, propertyKey, descriptor) => {
9333
- if (descriptor !== void 0) {
9334
- throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
9335
- }
9336
- const constructor = targetObj.constructor;
9337
- let queries = ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
9338
- if (!queries) {
9339
- queries = [];
9340
- ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
9341
- }
9342
- queries.push({ propertyKey, selector: selectorOrTarget, options });
9343
- Object.defineProperty(targetObj, propertyKey, {
9344
- get() {
9345
- ensureInit(this);
9346
- const selector = selectorOrTarget;
9347
- const r = options.root || "auto";
9348
- const applyRoot = (t) => {
9349
- if (!t)
9350
- return [];
9351
- const items = Array.isArray(t) ? t : [t];
9352
- const results = [];
9353
- items.forEach((it) => {
9354
- if (!(it instanceof HTMLElement)) {
9355
- results.push(it);
9356
- return;
9478
+ function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
9479
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
9480
+ throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
9481
+ }
9482
+ if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
9483
+ return (targetObj, propertyKey, descriptor2) => {
9484
+ if (descriptor2 !== void 0) {
9485
+ throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
9486
+ }
9487
+ const constructor = targetObj.constructor;
9488
+ let queries = ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
9489
+ if (!queries) {
9490
+ queries = [];
9491
+ ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
9492
+ }
9493
+ queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
9494
+ Object.defineProperty(targetObj, propertyKey, {
9495
+ get() {
9496
+ ensureInit(this);
9497
+ const config = getElementConfig(this);
9498
+ const win = config?.window || window;
9499
+ const hostSet = SwcUtils.getHelperAndHostSet(win, this);
9500
+ let resolvedSelector;
9501
+ let resolvedElements = [];
9502
+ if (typeof selectorOrTarget === "function") {
9503
+ const result = selectorOrTarget(this, hostSet);
9504
+ if (result instanceof win.NodeList) {
9505
+ resolvedElements = Array.from(result).filter((el) => el instanceof win.HTMLElement);
9506
+ } else if (Array.isArray(result)) {
9507
+ resolvedElements = result.filter((el) => el instanceof win.HTMLElement);
9357
9508
  }
9358
- if (r === "auto")
9359
- results.push(it.shadowRoot || it);
9509
+ } else {
9510
+ resolvedSelector = selectorOrTarget;
9511
+ const r = optionsOrPropertyKey?.root || "auto";
9512
+ const applyRoot = (t) => {
9513
+ if (!t)
9514
+ return [];
9515
+ const items = Array.isArray(t) ? t : [t];
9516
+ const results = [];
9517
+ items.forEach((it) => {
9518
+ if (!(it instanceof HTMLElement)) {
9519
+ results.push(it);
9520
+ return;
9521
+ }
9522
+ if (r === "auto")
9523
+ results.push(it.shadowRoot || it);
9524
+ else {
9525
+ if (r === "light" || r === "all")
9526
+ results.push(it);
9527
+ if ((r === "shadow" || r === "all") && it.shadowRoot)
9528
+ results.push(it.shadowRoot);
9529
+ }
9530
+ });
9531
+ return results;
9532
+ };
9533
+ if (resolvedSelector === "$hosts")
9534
+ resolvedElements = applyRoot(hostSet.$hosts).filter((el) => el instanceof HTMLElement);
9535
+ else if (resolvedSelector === "$appHosts")
9536
+ resolvedElements = applyRoot(hostSet.$appHosts).filter((el) => el instanceof HTMLElement);
9537
+ else if (resolvedSelector === "$host")
9538
+ resolvedElements = applyRoot(hostSet.$host).filter((el) => el instanceof HTMLElement);
9539
+ else if (resolvedSelector === "$parentHost")
9540
+ resolvedElements = applyRoot(hostSet.$parentHost).filter((el) => el instanceof HTMLElement);
9541
+ else if (resolvedSelector === "$appHost")
9542
+ resolvedElements = applyRoot(hostSet.$appHost).filter((el) => el instanceof HTMLElement);
9543
+ else if (resolvedSelector === "$firstHost")
9544
+ resolvedElements = applyRoot(hostSet.$firstHost).filter((el) => el instanceof HTMLElement);
9545
+ else if (resolvedSelector === "$lastHost")
9546
+ resolvedElements = applyRoot(hostSet.$lastHost).filter((el) => el instanceof HTMLElement);
9547
+ else if (resolvedSelector === "$firstAppHost")
9548
+ resolvedElements = applyRoot(hostSet.$firstAppHost).filter((el) => el instanceof HTMLElement);
9549
+ else if (resolvedSelector === "$lastAppHost")
9550
+ resolvedElements = applyRoot(hostSet.$lastAppHost).filter((el) => el instanceof HTMLElement);
9551
+ else if (resolvedSelector === "$window")
9552
+ return [win];
9553
+ else if (resolvedSelector === "$document")
9554
+ return [win.document];
9555
+ else if (resolvedSelector === "$this")
9556
+ resolvedElements = applyRoot(this).filter((el) => el instanceof HTMLElement);
9360
9557
  else {
9361
- if (r === "light" || r === "all")
9362
- results.push(it);
9363
- if ((r === "shadow" || r === "all") && it.shadowRoot)
9364
- results.push(it.shadowRoot);
9558
+ if (r === "shadow")
9559
+ resolvedElements = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
9560
+ else if (r === "light")
9561
+ resolvedElements = Array.from(this.querySelectorAll(resolvedSelector));
9562
+ else if (r === "all") {
9563
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
9564
+ const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
9565
+ resolvedElements = [...sNodes, ...lNodes];
9566
+ } else
9567
+ resolvedElements = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
9365
9568
  }
9366
- });
9367
- return results;
9368
- };
9369
- const hostSet = SwcUtils.getHostSet(this);
9370
- if (selector === "$hosts")
9371
- return applyRoot(hostSet.$hosts);
9372
- if (selector === "$appHosts")
9373
- return applyRoot(hostSet.$appHosts);
9374
- if (selector === "$host")
9375
- return applyRoot(hostSet.$host);
9376
- if (selector === "$parentHost")
9377
- return applyRoot(hostSet.$parentHost);
9378
- if (selector === "$appHost")
9379
- return applyRoot(hostSet.$appHost);
9380
- if (selector === "$firstHost")
9381
- return applyRoot(hostSet.$firstHost);
9382
- if (selector === "$lastHost")
9383
- return applyRoot(hostSet.$lastHost);
9384
- if (selector === "$firstAppHost")
9385
- return applyRoot(hostSet.$firstAppHost);
9386
- if (selector === "$lastAppHost")
9387
- return applyRoot(hostSet.$lastAppHost);
9388
- const config = getElementConfig(this);
9389
- const win = config?.window || window;
9390
- if (selector === "$window")
9391
- return [win];
9392
- if (selector === "$document")
9393
- return [win.document];
9394
- if (selector === "$this")
9395
- return applyRoot(this);
9396
- if (r === "shadow")
9397
- return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
9398
- if (r === "light")
9399
- return Array.from(this.querySelectorAll(selector));
9400
- if (r === "all") {
9401
- const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
9402
- const lNodes = Array.from(this.querySelectorAll(selector));
9403
- return [...sNodes, ...lNodes];
9404
- }
9405
- const root = this.shadowRoot || this;
9406
- return Array.from(root.querySelectorAll(selector));
9407
- },
9408
- set(nv) {
9409
- ensureInit(this);
9410
- if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
9411
- const selector = selectorOrTarget;
9412
- if (selector.startsWith("$") && selector !== "$this")
9413
- return;
9414
- const r = options.root || "auto";
9415
- let targets = [];
9416
- if (r === "shadow")
9417
- targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
9418
- else if (r === "light")
9419
- targets = Array.from(this.querySelectorAll(selector));
9420
- else if (r === "all") {
9421
- const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
9422
- const lNodes = Array.from(this.querySelectorAll(selector));
9423
- targets = [...sNodes, ...lNodes];
9424
- } else {
9425
- targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
9426
9569
  }
9427
- targets.forEach((t) => t.remove());
9428
- }
9429
- },
9430
- enumerable: true,
9431
- configurable: true
9432
- });
9433
- };
9434
- }
9435
- function queryAllThis(targetOrOptions, propertyKey) {
9436
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9437
- return queryAll("$this", {})(targetOrOptions, propertyKey);
9438
- }
9439
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9440
- return queryAll("$this", targetOrOptions);
9441
- } else {
9442
- return queryAll("$this", {});
9443
- }
9444
- }
9445
- function allParentHost(targetOrOptions, propertyKey) {
9446
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9447
- return queryAll("$host", {})(targetOrOptions, propertyKey);
9448
- }
9449
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9450
- return queryAll("$host", targetOrOptions);
9451
- } else {
9452
- return queryAll("$host", {});
9453
- }
9454
- }
9455
- function allAppHost(targetOrOptions, propertyKey) {
9456
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
9457
- return queryAll("$appHost", {})(targetOrOptions, propertyKey);
9458
- }
9459
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
9460
- return queryAll("$appHost", targetOrOptions);
9461
- } else {
9462
- return queryAll("$appHost", {});
9570
+ if (optionsOrPropertyKey?.filter) {
9571
+ resolvedElements = resolvedElements.filter((el) => {
9572
+ if (!(el instanceof win.HTMLElement))
9573
+ return true;
9574
+ return optionsOrPropertyKey.filter(el, { currentThis: this, helper: hostSet });
9575
+ });
9576
+ }
9577
+ return resolvedElements;
9578
+ },
9579
+ set(nv) {
9580
+ ensureInit(this);
9581
+ if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
9582
+ const config = getElementConfig(this);
9583
+ const win = config?.window || window;
9584
+ const hostSet = SwcUtils.getHelperAndHostSet(win, this);
9585
+ if (typeof selectorOrTarget === "function") {
9586
+ const result = selectorOrTarget(this, hostSet);
9587
+ if (result instanceof win.NodeList) {
9588
+ Array.from(result).forEach((el) => {
9589
+ if (el instanceof win.Element)
9590
+ el.remove();
9591
+ });
9592
+ } else if (Array.isArray(result)) {
9593
+ result.forEach((el) => {
9594
+ if (el instanceof win.Element)
9595
+ el.remove();
9596
+ });
9597
+ }
9598
+ return;
9599
+ }
9600
+ const resolvedSelector = selectorOrTarget;
9601
+ if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
9602
+ return;
9603
+ const r = optionsOrPropertyKey?.root || "auto";
9604
+ let targets = [];
9605
+ if (r === "shadow")
9606
+ targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
9607
+ else if (r === "light")
9608
+ targets = Array.from(this.querySelectorAll(resolvedSelector));
9609
+ else if (r === "all") {
9610
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
9611
+ const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
9612
+ targets = [...sNodes, ...lNodes];
9613
+ } else {
9614
+ targets = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
9615
+ }
9616
+ targets.forEach((t) => t.remove());
9617
+ }
9618
+ },
9619
+ enumerable: true,
9620
+ configurable: true
9621
+ });
9622
+ };
9463
9623
  }
9624
+ return queryAll("$this", selectorOrTarget);
9464
9625
  }
9465
9626
  var getQueryAllMetadata = (target) => {
9466
9627
  const constructor = target instanceof Function ? target : target.constructor;
@@ -9650,6 +9811,27 @@ var dooboostoreSimpleWebComponent = (() => {
9650
9811
  const currentWin = conf.window;
9651
9812
  const r = options.root || "auto";
9652
9813
  const results = [];
9814
+ let resolvedSelector = selector;
9815
+ if (typeof selector === "function") {
9816
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);
9817
+ resolvedSelector = selector(inst, hostSet);
9818
+ }
9819
+ if (resolvedSelector instanceof currentWin.Element) {
9820
+ results.push(resolvedSelector);
9821
+ return results;
9822
+ }
9823
+ if (resolvedSelector instanceof currentWin.NodeList) {
9824
+ results.push(...Array.from(resolvedSelector));
9825
+ return results;
9826
+ }
9827
+ if (Array.isArray(resolvedSelector)) {
9828
+ results.push(...resolvedSelector);
9829
+ return results;
9830
+ }
9831
+ if (resolvedSelector === null) {
9832
+ return results;
9833
+ }
9834
+ const stringSelector = resolvedSelector;
9653
9835
  const applyRoot = (target) => {
9654
9836
  if (!target) return;
9655
9837
  if (r === "auto") {
@@ -9659,37 +9841,37 @@ var dooboostoreSimpleWebComponent = (() => {
9659
9841
  if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
9660
9842
  }
9661
9843
  };
9662
- if (selector === "$this" || !selector) {
9844
+ if (stringSelector === "$this" || !stringSelector) {
9663
9845
  applyRoot(inst);
9664
- } else if (selector === "$window") {
9846
+ } else if (stringSelector === "$window") {
9665
9847
  results.push(currentWin);
9666
- } else if (selector === "$document") {
9848
+ } else if (stringSelector === "$document") {
9667
9849
  results.push(currentWin.document);
9668
9850
  } else {
9669
9851
  const hostSet = SwcUtils.getHostSet(inst);
9670
- if (selector === "$host") applyRoot(hostSet.$host);
9671
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
9672
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
9673
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
9674
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
9675
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
9676
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
9677
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
9678
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
9852
+ if (stringSelector === "$host") applyRoot(hostSet.$host);
9853
+ else if (stringSelector === "$parentHost") applyRoot(hostSet.$parentHost);
9854
+ else if (stringSelector === "$appHost") applyRoot(hostSet.$appHost);
9855
+ else if (stringSelector === "$firstHost") applyRoot(hostSet.$firstHost);
9856
+ else if (stringSelector === "$lastHost") applyRoot(hostSet.$lastHost);
9857
+ else if (stringSelector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
9858
+ else if (stringSelector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
9859
+ else if (stringSelector === "$hosts") hostSet.$hosts.forEach(applyRoot);
9860
+ else if (stringSelector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
9679
9861
  else {
9680
9862
  if (r === "shadow") {
9681
- const found = inst.shadowRoot?.querySelectorAll(selector);
9863
+ const found = inst.shadowRoot?.querySelectorAll(stringSelector);
9682
9864
  if (found) results.push(...found);
9683
9865
  } else if (r === "light") {
9684
- const found = inst.querySelectorAll(selector);
9866
+ const found = inst.querySelectorAll(stringSelector);
9685
9867
  if (found) results.push(...found);
9686
9868
  } else if (r === "all") {
9687
- const sMatch = inst.shadowRoot?.querySelectorAll(selector);
9688
- const lMatch = inst.querySelectorAll(selector);
9869
+ const sMatch = inst.shadowRoot?.querySelectorAll(stringSelector);
9870
+ const lMatch = inst.querySelectorAll(stringSelector);
9689
9871
  if (sMatch) results.push(...sMatch);
9690
9872
  if (lMatch) results.push(...lMatch);
9691
9873
  } else {
9692
- const found = (inst.shadowRoot || inst).querySelectorAll(selector);
9874
+ const found = (inst.shadowRoot || inst).querySelectorAll(stringSelector);
9693
9875
  if (found) results.push(...found);
9694
9876
  }
9695
9877
  }
@@ -9788,35 +9970,20 @@ var dooboostoreSimpleWebComponent = (() => {
9788
9970
  });
9789
9971
  };
9790
9972
  }
9791
- function property(selector, targetPropertyKeyOrOptions, options) {
9792
- return applyProperty(selector, targetPropertyKeyOrOptions, options);
9793
- }
9794
- function propertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
9795
- if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
9796
- return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
9973
+ function property(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor) {
9974
+ if (optionsOrDescriptor !== void 0 && (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol")) {
9975
+ return applyProperty("$this", void 0, {})(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
9797
9976
  }
9798
- if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
9799
- return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
9800
- } else if (targetOrOptions && typeof targetOrOptions === "object") {
9801
- return applyProperty("$this", void 0, targetOrOptions);
9802
- } else {
9803
- return applyProperty("$this", void 0, {});
9977
+ if (typeof selectorOrTarget === "string") {
9978
+ return applyProperty(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
9804
9979
  }
9980
+ return applyProperty("$this", void 0, selectorOrTarget);
9805
9981
  }
9806
- function setProperty(selector, targetPropertyKeyOrOptions, options) {
9807
- return applyProperty(selector, targetPropertyKeyOrOptions, options);
9808
- }
9809
- function setPropertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
9810
- if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
9811
- return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
9812
- }
9813
- if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
9814
- return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
9815
- } else if (targetOrOptions && typeof targetOrOptions === "object") {
9816
- return applyProperty("$this", void 0, targetOrOptions);
9817
- } else {
9818
- return applyProperty("$this", void 0, {});
9982
+ function setProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined) {
9983
+ if (typeof selectorOrOptions === "string") {
9984
+ return applyProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined);
9819
9985
  }
9986
+ return applyProperty("$this", void 0, selectorOrOptions);
9820
9987
  }
9821
9988
  var findAllPropertyMetadata = (target) => {
9822
9989
  const actualTarget = target instanceof Function ? target : target.constructor;
@@ -10129,7 +10296,8 @@ var dooboostoreSimpleWebComponent = (() => {
10129
10296
  const delegateListeners = [];
10130
10297
  const nonDelegateListeners = [];
10131
10298
  addEventListenerList.forEach((meta) => {
10132
- if (meta.options.delegate && meta.selector !== "$window" && meta.selector !== "$document" && meta.selector !== "$host" && meta.selector !== "$appHost" && meta.selector !== "$firstHost" && meta.selector !== "$lastHost" && meta.selector !== "$firstAppHost" && meta.selector !== "$lastAppHost" && meta.selector !== "$hosts" && meta.selector !== "$appHosts" && meta.selector !== "$this" && meta.selector !== "") {
10299
+ const isStringSelector = typeof meta.selector === "string";
10300
+ if (meta.options.delegate && isStringSelector && meta.selector !== "$window" && meta.selector !== "$document" && meta.selector !== "$host" && meta.selector !== "$appHost" && meta.selector !== "$firstHost" && meta.selector !== "$lastHost" && meta.selector !== "$firstAppHost" && meta.selector !== "$lastAppHost" && meta.selector !== "$hosts" && meta.selector !== "$appHosts" && meta.selector !== "$this" && meta.selector !== "") {
10133
10301
  delegateListeners.push(meta);
10134
10302
  } else {
10135
10303
  nonDelegateListeners.push(meta);
@@ -10192,6 +10360,22 @@ var dooboostoreSimpleWebComponent = (() => {
10192
10360
  const opts = { capture: options.capture, once: options.once, passive: options.passive };
10193
10361
  const bindTargets = [];
10194
10362
  const r = options.root || "auto";
10363
+ let resolvedSelector = null;
10364
+ if (typeof selector === "function") {
10365
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
10366
+ const result = selector(this, hostSet);
10367
+ if (typeof result === "string") {
10368
+ resolvedSelector = result;
10369
+ } else if (result instanceof currentWin.Element) {
10370
+ bindTargets.push(result);
10371
+ } else if (result instanceof currentWin.NodeList) {
10372
+ bindTargets.push(...Array.from(result));
10373
+ } else if (Array.isArray(result)) {
10374
+ bindTargets.push(...result);
10375
+ }
10376
+ } else {
10377
+ resolvedSelector = selector;
10378
+ }
10195
10379
  const applyRootOption = (target) => {
10196
10380
  if (!target) return;
10197
10381
  if (r === "auto") {
@@ -10201,30 +10385,32 @@ var dooboostoreSimpleWebComponent = (() => {
10201
10385
  if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
10202
10386
  }
10203
10387
  };
10204
- if (selector === "$window") bindTargets.push(currentWin);
10205
- else if (selector === "$document") bindTargets.push(currentWin.document);
10206
- else if (selector === "$host") applyRootOption(helperHostSet.$host);
10207
- else if (selector === "$parentHost") applyRootOption(helperHostSet.$parentHost);
10208
- else if (selector === "$appHost") applyRootOption(helperHostSet.$appHost);
10209
- else if (selector === "$firstHost") applyRootOption(helperHostSet.$firstHost);
10210
- else if (selector === "$lastHost") applyRootOption(helperHostSet.$lastHost);
10211
- else if (selector === "$firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
10212
- else if (selector === "$lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
10213
- else if (selector === "$hosts") helperHostSet.$hosts.forEach(applyRootOption);
10214
- else if (selector === "$appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
10215
- else if (selector === "$this" || !selector) applyRootOption(this);
10216
- else {
10217
- const searchRoots = [];
10218
- if (r === "auto") searchRoots.push(this.shadowRoot || this);
10219
- else if (r === "light") searchRoots.push(this);
10220
- else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
10221
- else if (r === "all") {
10222
- searchRoots.push(this);
10223
- if (this.shadowRoot) searchRoots.push(this.shadowRoot);
10388
+ if (resolvedSelector) {
10389
+ if (resolvedSelector === "$window") bindTargets.push(currentWin);
10390
+ else if (resolvedSelector === "$document") bindTargets.push(currentWin.document);
10391
+ else if (resolvedSelector === "$host") applyRootOption(helperHostSet.$host);
10392
+ else if (resolvedSelector === "$parentHost") applyRootOption(helperHostSet.$parentHost);
10393
+ else if (resolvedSelector === "$appHost") applyRootOption(helperHostSet.$appHost);
10394
+ else if (resolvedSelector === "$firstHost") applyRootOption(helperHostSet.$firstHost);
10395
+ else if (resolvedSelector === "$lastHost") applyRootOption(helperHostSet.$lastHost);
10396
+ else if (resolvedSelector === "$firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
10397
+ else if (resolvedSelector === "$lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
10398
+ else if (resolvedSelector === "$hosts") helperHostSet.$hosts.forEach(applyRootOption);
10399
+ else if (resolvedSelector === "$appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
10400
+ else if (resolvedSelector === "$this" || !resolvedSelector) applyRootOption(this);
10401
+ else {
10402
+ const searchRoots = [];
10403
+ if (r === "auto") searchRoots.push(this.shadowRoot || this);
10404
+ else if (r === "light") searchRoots.push(this);
10405
+ else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
10406
+ else if (r === "all") {
10407
+ searchRoots.push(this);
10408
+ if (this.shadowRoot) searchRoots.push(this.shadowRoot);
10409
+ }
10410
+ searchRoots.forEach((sr) => {
10411
+ sr.querySelectorAll(resolvedSelector).forEach((el) => bindTargets.push(el));
10412
+ });
10224
10413
  }
10225
- searchRoots.forEach((sr) => {
10226
- sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
10227
- });
10228
10414
  }
10229
10415
  bindTargets.forEach((t) => {
10230
10416
  const handler = async (event2) => {
@@ -10239,10 +10425,34 @@ var dooboostoreSimpleWebComponent = (() => {
10239
10425
  if (options.preventDefault) event2.preventDefault();
10240
10426
  const currentHostSet = SwcUtils.getHostSet(this);
10241
10427
  const args = { event: event2, ...currentHostSet, $el: t, $root: t };
10242
- await this[meta.propertyKey](event2, { currentHostSet, $$matchedElement: event2.currentTarget }, args);
10428
+ await this[meta.propertyKey](event2, { currentHostSet, $matchedElement: event2.currentTarget }, args);
10429
+ };
10430
+ const eventSubject = new Subject();
10431
+ let eventStream = eventSubject;
10432
+ if (options.debounceTime !== void 0 && options.debounceTime > 0) {
10433
+ eventStream = eventStream.pipe(debounceTime(options.debounceTime));
10434
+ }
10435
+ if (options.throttleTime !== void 0 && options.throttleTime > 0) {
10436
+ eventStream = eventStream.pipe(throttleTime(options.throttleTime));
10437
+ }
10438
+ if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
10439
+ if (typeof options.distinctUntilChanged === "function") {
10440
+ eventStream = eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged));
10441
+ } else {
10442
+ eventStream = eventStream.pipe(distinctUntilChanged());
10443
+ }
10444
+ }
10445
+ const subscription = eventStream.subscribe({
10446
+ next: (event2) => {
10447
+ handler(event2).catch((err) => console.error("Event handler error:", err));
10448
+ },
10449
+ error: (err) => console.error("Event stream error:", err)
10450
+ });
10451
+ const wrappedHandler = (event2) => {
10452
+ eventSubject.next(event2);
10243
10453
  };
10244
- t.addEventListener(type, handler, opts);
10245
- this._boundListeners.push({ target: t, type, handler, options: opts });
10454
+ t.addEventListener(type, wrappedHandler, opts);
10455
+ this._boundListeners.push({ target: t, type, handler: wrappedHandler, options: opts, subscription });
10246
10456
  });
10247
10457
  });
10248
10458
  if (originalConnected) await originalConnected.apply(this);
@@ -10282,7 +10492,12 @@ var dooboostoreSimpleWebComponent = (() => {
10282
10492
  const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
10283
10493
  for (const m of bMethods) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
10284
10494
  if (this._boundListeners) {
10285
- this._boundListeners.forEach((l) => l.target.removeEventListener(l.type, l.handler, l.options));
10495
+ this._boundListeners.forEach((l) => {
10496
+ l.target.removeEventListener(l.type, l.handler, l.options);
10497
+ if (l.subscription && typeof l.subscription.unsubscribe === "function") {
10498
+ l.subscription.unsubscribe();
10499
+ }
10500
+ });
10286
10501
  this._boundListeners = [];
10287
10502
  }
10288
10503
  new ElementApply(this, { id: this._swcId }).removeAllEventListener();
@@ -10365,6 +10580,13 @@ var dooboostoreSimpleWebComponent = (() => {
10365
10580
 
10366
10581
  // src/decorators/applyAttribute.ts
10367
10582
  var ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
10583
+ var isCssSelector = (str) => {
10584
+ if (!str) return false;
10585
+ if (str.startsWith("$")) return true;
10586
+ if (/^[#.\[\:>+~]/.test(str)) return true;
10587
+ if (/[>+~:\[\]]/.test(str)) return true;
10588
+ return false;
10589
+ };
10368
10590
  var convertValue2 = (val, type) => {
10369
10591
  if (val === null || val === void 0) return val;
10370
10592
  if (type === Number) return Number(val);
@@ -10402,6 +10624,27 @@ var dooboostoreSimpleWebComponent = (() => {
10402
10624
  const currentWin = conf.window;
10403
10625
  const r = options.root || "auto";
10404
10626
  const results = [];
10627
+ let resolvedSelector = selector;
10628
+ if (typeof selector === "function") {
10629
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);
10630
+ resolvedSelector = selector(inst, hostSet);
10631
+ }
10632
+ if (resolvedSelector instanceof currentWin.Element) {
10633
+ results.push(resolvedSelector);
10634
+ return results;
10635
+ }
10636
+ if (resolvedSelector instanceof currentWin.NodeList) {
10637
+ results.push(...Array.from(resolvedSelector));
10638
+ return results;
10639
+ }
10640
+ if (Array.isArray(resolvedSelector)) {
10641
+ results.push(...resolvedSelector);
10642
+ return results;
10643
+ }
10644
+ if (resolvedSelector === null) {
10645
+ return results;
10646
+ }
10647
+ const stringSelector = resolvedSelector;
10405
10648
  const applyRoot = (target) => {
10406
10649
  if (!target) return;
10407
10650
  if (r === "auto") {
@@ -10411,33 +10654,33 @@ var dooboostoreSimpleWebComponent = (() => {
10411
10654
  if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
10412
10655
  }
10413
10656
  };
10414
- if (selector === "$this" || !selector) {
10657
+ if (stringSelector === "$this" || !stringSelector) {
10415
10658
  applyRoot(inst);
10416
10659
  } else {
10417
10660
  const hostSet = SwcUtils.getHostSet(inst);
10418
- if (selector === "$host") applyRoot(hostSet.$host);
10419
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
10420
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
10421
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
10422
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
10423
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
10424
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
10425
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
10426
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
10661
+ if (stringSelector === "$host") applyRoot(hostSet.$host);
10662
+ else if (stringSelector === "$parentHost") applyRoot(hostSet.$parentHost);
10663
+ else if (stringSelector === "$appHost") applyRoot(hostSet.$appHost);
10664
+ else if (stringSelector === "$firstHost") applyRoot(hostSet.$firstHost);
10665
+ else if (stringSelector === "$lastHost") applyRoot(hostSet.$lastHost);
10666
+ else if (stringSelector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
10667
+ else if (stringSelector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
10668
+ else if (stringSelector === "$hosts") hostSet.$hosts.forEach(applyRoot);
10669
+ else if (stringSelector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
10427
10670
  else {
10428
10671
  if (r === "shadow") {
10429
- const found = inst.shadowRoot?.querySelectorAll(selector);
10672
+ const found = inst.shadowRoot?.querySelectorAll(stringSelector);
10430
10673
  if (found) results.push(...found);
10431
10674
  } else if (r === "light") {
10432
- const found = inst.querySelectorAll(selector);
10675
+ const found = inst.querySelectorAll(stringSelector);
10433
10676
  if (found) results.push(...found);
10434
10677
  } else if (r === "all") {
10435
- const sMatch = inst.shadowRoot?.querySelectorAll(selector);
10436
- const lMatch = inst.querySelectorAll(selector);
10678
+ const sMatch = inst.shadowRoot?.querySelectorAll(stringSelector);
10679
+ const lMatch = inst.querySelectorAll(stringSelector);
10437
10680
  if (sMatch) results.push(...sMatch);
10438
10681
  if (lMatch) results.push(...lMatch);
10439
10682
  } else {
10440
- const found = (inst.shadowRoot || inst).querySelectorAll(selector);
10683
+ const found = (inst.shadowRoot || inst).querySelectorAll(stringSelector);
10441
10684
  if (found) results.push(...found);
10442
10685
  }
10443
10686
  }
@@ -10535,35 +10778,32 @@ var dooboostoreSimpleWebComponent = (() => {
10535
10778
  });
10536
10779
  };
10537
10780
  }
10538
- function attribute(selector, targetAttributeNameOrOptions, options) {
10539
- return applyAttribute(selector, targetAttributeNameOrOptions, options);
10540
- }
10541
- function attributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
10542
- if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") {
10543
- return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
10544
- }
10545
- if (typeof targetOrOptions === "string") {
10546
- return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
10547
- } else if (targetOrOptions && typeof targetOrOptions === "object") {
10548
- return applyAttribute("$this", void 0, targetOrOptions);
10549
- } else {
10550
- return applyAttribute("$this", void 0, {});
10781
+ function attribute(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor) {
10782
+ if (optionsOrDescriptor !== void 0 && (typeof attributeNameOrOptions === "string" || typeof attributeNameOrOptions === "symbol")) {
10783
+ return applyAttribute("$this", void 0, {})(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor);
10784
+ }
10785
+ if (typeof selectorOrAttributeOrTarget === "string") {
10786
+ const isSelector = isCssSelector(selectorOrAttributeOrTarget);
10787
+ if (isSelector) {
10788
+ return applyAttribute(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor);
10789
+ } else {
10790
+ const options = typeof attributeNameOrOptions === "object" && attributeNameOrOptions !== null ? attributeNameOrOptions : {};
10791
+ return applyAttribute("$this", selectorOrAttributeOrTarget, options);
10792
+ }
10551
10793
  }
10794
+ return applyAttribute("$this", void 0, selectorOrAttributeOrTarget);
10552
10795
  }
10553
- function setAttribute(selector, targetAttributeNameOrOptions, options) {
10554
- return applyAttribute(selector, targetAttributeNameOrOptions, options);
10555
- }
10556
- function setAttributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
10557
- if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
10558
- return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
10559
- }
10560
- if (typeof targetOrOptions === "string") {
10561
- return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
10562
- } else if (targetOrOptions && typeof targetOrOptions === "object") {
10563
- return applyAttribute("$this", void 0, targetOrOptions);
10564
- } else {
10565
- return applyAttribute("$this", void 0, {});
10796
+ function setAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined) {
10797
+ if (typeof selectorOrAttributeOrOptions === "string") {
10798
+ const isSelector = isCssSelector(selectorOrAttributeOrOptions);
10799
+ if (isSelector) {
10800
+ return applyAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined);
10801
+ } else {
10802
+ const options = typeof attributeNameOrOptions === "object" && attributeNameOrOptions !== null ? attributeNameOrOptions : {};
10803
+ return applyAttribute("$this", selectorOrAttributeOrOptions, options);
10804
+ }
10566
10805
  }
10806
+ return applyAttribute("$this", void 0, selectorOrAttributeOrOptions);
10567
10807
  }
10568
10808
  var findAllAttributeMetadata = (target) => {
10569
10809
  const actualTarget = target instanceof Function ? target : target.constructor;
@@ -10579,8 +10819,32 @@ var dooboostoreSimpleWebComponent = (() => {
10579
10819
 
10580
10820
  // src/decorators/applyNode.ts
10581
10821
  var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
10822
+ var resolveSelector = (selector, inst, win) => {
10823
+ if (typeof selector === "function") {
10824
+ const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
10825
+ const result = selector(inst, hostSet);
10826
+ if (result instanceof win.Element) {
10827
+ return result;
10828
+ }
10829
+ if (result instanceof win.NodeList) {
10830
+ return result.length > 0 ? result[0] : null;
10831
+ }
10832
+ if (Array.isArray(result)) {
10833
+ return result.length > 0 ? result[0] : null;
10834
+ }
10835
+ if (result === null) {
10836
+ return null;
10837
+ }
10838
+ return result;
10839
+ }
10840
+ return selector;
10841
+ };
10582
10842
  var applyToDom = (currentThis, targetEl, res, pos, win, host) => {
10583
10843
  if (!targetEl) return;
10844
+ if (pos === "clearChildren") {
10845
+ targetEl.replaceChildren();
10846
+ return [];
10847
+ }
10584
10848
  const doc = win.document;
10585
10849
  const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
10586
10850
  const id = currentThis._swcId;
@@ -10616,7 +10880,16 @@ var dooboostoreSimpleWebComponent = (() => {
10616
10880
  new ElementApply(targetEl, { id }).apply({ target: "noInitialized", context: stateContext, bind: currentThis });
10617
10881
  return nodes;
10618
10882
  };
10619
- function applyNode(selector, options = { position: "replaceChildren" }) {
10883
+ function applyNode(selectorOrOptions, maybeOptions) {
10884
+ let selector;
10885
+ let options;
10886
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
10887
+ selector = selectorOrOptions;
10888
+ options = maybeOptions || { position: "replaceChildren" };
10889
+ } else {
10890
+ selector = "$this";
10891
+ options = selectorOrOptions || { position: "replaceChildren" };
10892
+ }
10620
10893
  return (targetObj, propertyKey, descriptor) => {
10621
10894
  const constructor = targetObj.constructor;
10622
10895
  let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor);
@@ -10642,14 +10915,22 @@ var dooboostoreSimpleWebComponent = (() => {
10642
10915
  if (r === "all") return t.shadowRoot || t;
10643
10916
  return t;
10644
10917
  };
10645
- if (selector === "$this") return applyRoot(this);
10646
- if (selector === "$host") return applyRoot(hostSet.$host);
10647
- if (selector === "$parentHost") return applyRoot(hostSet.$parentHost);
10648
- if (selector === "$appHost") return applyRoot(hostSet.$appHost);
10649
- if (selector === "$firstHost") return applyRoot(hostSet.$firstHost);
10650
- if (selector === "$lastHost") return applyRoot(hostSet.$lastHost);
10918
+ const resolved = resolveSelector(selector, this, currentWin);
10919
+ if (resolved instanceof currentWin.Element) {
10920
+ return applyRoot(resolved);
10921
+ }
10922
+ if (resolved === null) {
10923
+ return null;
10924
+ }
10925
+ const stringSelector = resolved;
10926
+ if (stringSelector === "$this") return applyRoot(this);
10927
+ if (stringSelector === "$host") return applyRoot(hostSet.$host);
10928
+ if (stringSelector === "$parentHost") return applyRoot(hostSet.$parentHost);
10929
+ if (stringSelector === "$appHost") return applyRoot(hostSet.$appHost);
10930
+ if (stringSelector === "$firstHost") return applyRoot(hostSet.$firstHost);
10931
+ if (stringSelector === "$lastHost") return applyRoot(hostSet.$lastHost);
10651
10932
  const targetRoot = applyRoot(this);
10652
- return targetRoot ? targetRoot.querySelector(selector) : null;
10933
+ return targetRoot ? targetRoot.querySelector(stringSelector) : null;
10653
10934
  };
10654
10935
  const targetEl = getTarget();
10655
10936
  const res = original.apply(this, args);
@@ -10687,92 +10968,141 @@ var dooboostoreSimpleWebComponent = (() => {
10687
10968
  };
10688
10969
  };
10689
10970
  }
10690
- function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
10691
- const option = { position: "replaceChildren" };
10692
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10693
- const opt = targetOrOptions || {};
10694
- return applyNode("$this", { ...option, ...opt });
10695
- }
10696
- function replaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
10697
- const option = { position: "replaceChildren" };
10698
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10699
- const opt = targetOrOptions || {};
10700
- return applyNode("$this", { ...opt, ...option });
10701
- }
10702
- function beforeEndNodeThis(targetOrOptions, propertyKey, descriptor) {
10703
- const options = { position: "beforeEnd" };
10704
- if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
10705
- const opt = targetOrOptions || {};
10706
- return applyNode("$this", { ...opt, ...options });
10707
- }
10708
- function beforeEndLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10709
- const option = { position: "beforeEnd", root: "light" };
10710
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10711
- const opt = targetOrOptions || {};
10712
- return applyNode("$this", { ...opt, ...option });
10971
+ function replaceChildren(selectorOrOptions, maybeOptions, descriptor) {
10972
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
10973
+ return applyNode({ position: "replaceChildren" })(selectorOrOptions, maybeOptions, descriptor);
10974
+ }
10975
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
10976
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren" });
10977
+ }
10978
+ return applyNode({ ...selectorOrOptions, position: "replaceChildren" });
10713
10979
  }
10714
- function beforeEndShadowNodeThis(targetOrOptions, propertyKey, descriptor) {
10715
- const option = { position: "beforeEnd", root: "shadow" };
10716
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10717
- const opt = targetOrOptions || {};
10718
- return applyNode("$this", { ...opt, ...option });
10980
+ function clearChildrenNode(selectorOrOptions, maybeOptions, descriptor) {
10981
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
10982
+ return applyNode({ position: "clearChildren" })(selectorOrOptions, maybeOptions, descriptor);
10983
+ }
10984
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
10985
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren" });
10986
+ }
10987
+ return applyNode({ ...selectorOrOptions, position: "clearChildren" });
10719
10988
  }
10720
- function afterBeginNodeThis(targetOrOptions, propertyKey, descriptor) {
10721
- const option = { position: "afterBegin" };
10722
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10723
- const opt = targetOrOptions || {};
10724
- return applyNode("$this", { ...opt, ...option });
10989
+ var clearNode = clearChildrenNode;
10990
+ function innerHtml(selectorOrOptions, maybeOptions, descriptor) {
10991
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
10992
+ return applyNode({ position: "innerHtml" })(selectorOrOptions, maybeOptions, descriptor);
10993
+ }
10994
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
10995
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml" });
10996
+ }
10997
+ return applyNode({ ...selectorOrOptions, position: "innerHtml" });
10725
10998
  }
10726
- function afterBeginLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10727
- const option = { position: "afterBegin", root: "light" };
10728
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10729
- const opt = targetOrOptions || {};
10730
- return applyNode("$this", { ...opt, ...option });
10999
+ function innerHtmlLight(selectorOrOptions, maybeOptions, descriptor) {
11000
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11001
+ return applyNode({ position: "innerHtml", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
11002
+ }
11003
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11004
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "light" });
11005
+ }
11006
+ return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "light" });
10731
11007
  }
10732
- function innerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
10733
- const option = { position: "innerHtml" };
10734
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10735
- const opt = targetOrOptions || {};
10736
- return applyNode("$this", { ...opt, ...option });
11008
+ function innerHtmlShadow(selectorOrOptions, maybeOptions, descriptor) {
11009
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11010
+ return applyNode({ position: "innerHtml", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
11011
+ }
11012
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11013
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "shadow" });
11014
+ }
11015
+ return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "shadow" });
10737
11016
  }
10738
- function innerTextNodeThis(targetOrOptions, propertyKey, descriptor) {
10739
- const option = { position: "innerText" };
10740
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10741
- const opt = targetOrOptions || {};
10742
- return applyNode("$this", { ...opt, ...option });
11017
+ function innerText(selectorOrOptions, maybeOptions, descriptor) {
11018
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11019
+ return applyNode({ position: "innerText" })(selectorOrOptions, maybeOptions, descriptor);
11020
+ }
11021
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11022
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText" });
11023
+ }
11024
+ return applyNode({ ...selectorOrOptions, position: "innerText" });
10743
11025
  }
10744
- function innerHtmlLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10745
- const option = { position: "innerHtml", root: "light" };
10746
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10747
- const opt = targetOrOptions || {};
10748
- return applyNode("$this", { ...opt, ...option });
11026
+ function innerTextLight(selectorOrOptions, maybeOptions, descriptor) {
11027
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11028
+ return applyNode({ position: "innerText", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
11029
+ }
11030
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11031
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "light" });
11032
+ }
11033
+ return applyNode({ ...selectorOrOptions, position: "innerText", root: "light" });
10749
11034
  }
10750
- function replaceChildrenLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10751
- const option = { position: "replaceChildren", root: "light" };
10752
- if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10753
- const opt = targetOrOptions || {};
10754
- return applyNode("$this", { ...opt, ...option });
11035
+ function innerTextShadow(selectorOrOptions, maybeOptions, descriptor) {
11036
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11037
+ return applyNode({ position: "innerText", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
11038
+ }
11039
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11040
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "shadow" });
11041
+ }
11042
+ return applyNode({ ...selectorOrOptions, position: "innerText", root: "shadow" });
10755
11043
  }
10756
- function replaceChildrenNode(selector, options = {}) {
10757
- return applyNode(selector, { ...options, position: "replaceChildren" });
11044
+ function insertBeforeEnd(selectorOrOptions, maybeOptions, descriptor) {
11045
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11046
+ return applyNode({ position: "beforeEnd" })(selectorOrOptions, maybeOptions, descriptor);
11047
+ }
11048
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11049
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd" });
11050
+ }
11051
+ return applyNode({ ...selectorOrOptions, position: "beforeEnd" });
10758
11052
  }
10759
- function innerHtmlNode(selector, options = {}) {
10760
- return applyNode(selector, { ...options, position: "innerHtml" });
11053
+ function insertBeforeEndLight(selectorOrOptions, maybeOptions, descriptor) {
11054
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11055
+ return applyNode({ position: "beforeEnd", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
11056
+ }
11057
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11058
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "light" });
11059
+ }
11060
+ return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "light" });
10761
11061
  }
10762
- function innerHtmlLightNode(selector, options = {}) {
10763
- return applyNode(selector, { ...options, position: "innerHtml", root: "light" });
11062
+ function insertBeforeEndShadow(selectorOrOptions, maybeOptions, descriptor) {
11063
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11064
+ return applyNode({ position: "beforeEnd", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
11065
+ }
11066
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11067
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "shadow" });
11068
+ }
11069
+ return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "shadow" });
10764
11070
  }
10765
- function innerHtmlShadowNode(selector, options = {}) {
10766
- return applyNode(selector, { ...options, position: "innerHtml", root: "shadow" });
11071
+ function insertAfterBegin(selectorOrOptions, maybeOptions, descriptor) {
11072
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11073
+ return applyNode({ position: "afterBegin" })(selectorOrOptions, maybeOptions, descriptor);
11074
+ }
11075
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11076
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin" });
11077
+ }
11078
+ return applyNode({ ...selectorOrOptions, position: "afterBegin" });
10767
11079
  }
10768
- function innerTextNode(selector, options = {}) {
10769
- return applyNode(selector, { ...options, position: "innerText" });
11080
+ function insertAfterBeginLight(selectorOrOptions, maybeOptions, descriptor) {
11081
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11082
+ return applyNode({ position: "afterBegin", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
11083
+ }
11084
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11085
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin", root: "light" });
11086
+ }
11087
+ return applyNode({ ...selectorOrOptions, position: "afterBegin", root: "light" });
10770
11088
  }
10771
- function innerTextLightNode(selector, options = {}) {
10772
- return applyNode(selector, { ...options, position: "innerText", root: "light" });
11089
+ function replaceChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
11090
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11091
+ return applyNode({ position: "replaceChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
11092
+ }
11093
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11094
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren", root: "light" });
11095
+ }
11096
+ return applyNode({ ...selectorOrOptions, position: "replaceChildren", root: "light" });
10773
11097
  }
10774
- function innerTextShadowNode(selector, options = {}) {
10775
- return applyNode(selector, { ...options, position: "innerText", root: "shadow" });
11098
+ function clearChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
11099
+ if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
11100
+ return applyNode({ position: "clearChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
11101
+ }
11102
+ if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
11103
+ return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren", root: "light" });
11104
+ }
11105
+ return applyNode({ ...selectorOrOptions, position: "clearChildren", root: "light" });
10776
11106
  }
10777
11107
  var findAllApplyNodeMetadata = (target) => {
10778
11108
  const result = /* @__PURE__ */ new Map();
@@ -10787,6 +11117,58 @@ var dooboostoreSimpleWebComponent = (() => {
10787
11117
 
10788
11118
  // src/decorators/applyClass.ts
10789
11119
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
11120
+ var resolveSelector2 = (selector, inst, win) => {
11121
+ if (typeof selector === "function") {
11122
+ const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
11123
+ const result = selector(inst, hostSet);
11124
+ if (result instanceof win.Element) {
11125
+ return [result];
11126
+ }
11127
+ if (result instanceof win.NodeList) {
11128
+ return Array.from(result);
11129
+ }
11130
+ if (Array.isArray(result)) {
11131
+ return result;
11132
+ }
11133
+ if (result === null) {
11134
+ return [];
11135
+ }
11136
+ return result;
11137
+ }
11138
+ return selector;
11139
+ };
11140
+ var getTargetElements = (selector, inst, win, root) => {
11141
+ const resolved = resolveSelector2(selector, inst, win);
11142
+ if (Array.isArray(resolved)) {
11143
+ return resolved;
11144
+ }
11145
+ const stringSelector = resolved;
11146
+ const targetEls = [];
11147
+ const host = inst;
11148
+ const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
11149
+ const applyRoot = (t) => {
11150
+ if (!t || !(t instanceof win.HTMLElement)) return;
11151
+ targetEls.push(t);
11152
+ };
11153
+ if (stringSelector === "$this" || !stringSelector) applyRoot(host);
11154
+ else if (stringSelector === "$host") applyRoot(hostSet.$host);
11155
+ else if (stringSelector === "$parentHost") applyRoot(hostSet.$parentHost);
11156
+ else if (stringSelector === "$appHost") applyRoot(hostSet.$appHost);
11157
+ else if (stringSelector === "$firstHost") applyRoot(hostSet.$firstHost);
11158
+ else if (stringSelector === "$lastHost") applyRoot(hostSet.$lastHost);
11159
+ else if (stringSelector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
11160
+ else if (stringSelector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
11161
+ else if (stringSelector === "$hosts") hostSet.$hosts.forEach(applyRoot);
11162
+ else if (stringSelector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
11163
+ else {
11164
+ const targetRoot = root === "auto" ? host.shadowRoot || host : root === "shadow" ? host.shadowRoot : host;
11165
+ if (targetRoot) {
11166
+ const found = targetRoot.querySelectorAll(stringSelector);
11167
+ if (found) targetEls.push(...Array.from(found));
11168
+ }
11169
+ }
11170
+ return targetEls;
11171
+ };
10790
11172
  function createClassDecorator(action) {
10791
11173
  return (selector, classMapOrOptions, options = {}) => {
10792
11174
  return (target, propertyKey, descriptor) => {
@@ -10821,28 +11203,7 @@ var dooboostoreSimpleWebComponent = (() => {
10821
11203
  const host = this;
10822
11204
  const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
10823
11205
  const r = finalOptions.root || "auto";
10824
- const targetEls = [];
10825
- const applyRoot = (t) => {
10826
- if (!t || !(t instanceof win.HTMLElement)) return;
10827
- targetEls.push(t);
10828
- };
10829
- if (selector === "$this" || !selector) applyRoot(host);
10830
- else if (selector === "$host") applyRoot(hostSet.$host);
10831
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
10832
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
10833
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
10834
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
10835
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
10836
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
10837
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
10838
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
10839
- else {
10840
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
10841
- if (targetRoot) {
10842
- const found = targetRoot.querySelectorAll(selector);
10843
- if (found) targetEls.push(...Array.from(found));
10844
- }
10845
- }
11206
+ const targetEls = getTargetElements(selector, this, win, r);
10846
11207
  targetEls.forEach((targetEl) => {
10847
11208
  if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
10848
11209
  return;
@@ -10903,22 +11264,64 @@ var dooboostoreSimpleWebComponent = (() => {
10903
11264
  };
10904
11265
  };
10905
11266
  }
10906
- function applyClass(selector, action = "update", options = {}) {
10907
- return createClassDecorator(action)(selector, options);
10908
- }
10909
- var setClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("set")(selector, classMapOrOptions, options);
10910
- var updateClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("update")(selector, classMapOrOptions, options);
10911
- var addClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("add")(selector, classMapOrOptions, options);
10912
- var removeClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("remove")(selector, classMapOrOptions, options);
10913
- var toggleClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("toggle")(selector, classMapOrOptions, options);
10914
- function applyClassThis(action = "update", options = {}) {
11267
+ function applyClass(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
11268
+ if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
11269
+ return createClassDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
11270
+ }
11271
+ if (typeof selectorOrTarget === "string") {
11272
+ const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
11273
+ const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
11274
+ return createClassDecorator(action2)(selectorOrTarget, options2);
11275
+ }
11276
+ const action = typeof selectorOrTarget === "string" ? selectorOrTarget : "update";
11277
+ const options = typeof selectorOrTarget === "object" ? selectorOrTarget : actionOrPropertyKey;
10915
11278
  return createClassDecorator(action)("$this", options);
10916
11279
  }
10917
- var setClassThis = (classMapOrOptions, options = {}) => createClassDecorator("set")("$this", classMapOrOptions, options);
10918
- var updateClassThis = (classMapOrOptions, options = {}) => createClassDecorator("update")("$this", classMapOrOptions, options);
10919
- var addClassThis = (classMapOrOptions, options = {}) => createClassDecorator("add")("$this", classMapOrOptions, options);
10920
- var removeClassThis = (classMapOrOptions, options = {}) => createClassDecorator("remove")("$this", classMapOrOptions, options);
10921
- var toggleClassThis = (classMapOrOptions, options = {}) => createClassDecorator("toggle")("$this", classMapOrOptions, options);
11280
+ function setClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
11281
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
11282
+ return createClassDecorator("set")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11283
+ }
11284
+ if (typeof selectorOrTarget === "string") {
11285
+ return createClassDecorator("set")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11286
+ }
11287
+ return createClassDecorator("set")("$this", selectorOrTarget);
11288
+ }
11289
+ function updateClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
11290
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
11291
+ return createClassDecorator("update")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11292
+ }
11293
+ if (typeof selectorOrTarget === "string") {
11294
+ return createClassDecorator("update")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11295
+ }
11296
+ return createClassDecorator("update")("$this", selectorOrTarget);
11297
+ }
11298
+ function addClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
11299
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
11300
+ return createClassDecorator("add")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11301
+ }
11302
+ if (typeof selectorOrTarget === "string") {
11303
+ return createClassDecorator("add")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11304
+ }
11305
+ return createClassDecorator("add")("$this", selectorOrTarget);
11306
+ }
11307
+ function removeClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
11308
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
11309
+ return createClassDecorator("remove")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11310
+ }
11311
+ if (typeof selectorOrTarget === "string") {
11312
+ return createClassDecorator("remove")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11313
+ }
11314
+ return createClassDecorator("remove")("$this", selectorOrTarget);
11315
+ }
11316
+ function toggleClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
11317
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
11318
+ return createClassDecorator("toggle")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11319
+ }
11320
+ if (typeof selectorOrTarget === "string") {
11321
+ return createClassDecorator("toggle")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
11322
+ }
11323
+ return createClassDecorator("toggle")("$this", selectorOrTarget);
11324
+ }
10922
11325
  var findAllClassMetadata = (target) => {
10923
11326
  const result = /* @__PURE__ */ new Map();
10924
11327
  const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
@@ -10932,6 +11335,58 @@ var dooboostoreSimpleWebComponent = (() => {
10932
11335
 
10933
11336
  // src/decorators/applyStyle.ts
10934
11337
  var STYLE_METADATA_KEY = Symbol.for("simple-web-component:style");
11338
+ var resolveSelector3 = (selector, inst, win) => {
11339
+ if (typeof selector === "function") {
11340
+ const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
11341
+ const result = selector(inst, hostSet);
11342
+ if (result instanceof win.Element) {
11343
+ return [result];
11344
+ }
11345
+ if (result instanceof win.NodeList) {
11346
+ return Array.from(result);
11347
+ }
11348
+ if (Array.isArray(result)) {
11349
+ return result;
11350
+ }
11351
+ if (result === null) {
11352
+ return [];
11353
+ }
11354
+ return result;
11355
+ }
11356
+ return selector;
11357
+ };
11358
+ var getTargetElements2 = (selector, inst, win, root) => {
11359
+ const resolved = resolveSelector3(selector, inst, win);
11360
+ if (Array.isArray(resolved)) {
11361
+ return resolved;
11362
+ }
11363
+ const stringSelector = resolved;
11364
+ const targetEls = [];
11365
+ const host = inst;
11366
+ const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
11367
+ const applyRoot = (t) => {
11368
+ if (!t || !(t instanceof win.HTMLElement)) return;
11369
+ targetEls.push(t);
11370
+ };
11371
+ if (stringSelector === "$this" || !stringSelector) applyRoot(host);
11372
+ else if (stringSelector === "$host") applyRoot(hostSet.$host);
11373
+ else if (stringSelector === "$parentHost") applyRoot(hostSet.$parentHost);
11374
+ else if (stringSelector === "$appHost") applyRoot(hostSet.$appHost);
11375
+ else if (stringSelector === "$firstHost") applyRoot(hostSet.$firstHost);
11376
+ else if (stringSelector === "$lastHost") applyRoot(hostSet.$lastHost);
11377
+ else if (stringSelector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
11378
+ else if (stringSelector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
11379
+ else if (stringSelector === "$hosts") hostSet.$hosts.forEach(applyRoot);
11380
+ else if (stringSelector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
11381
+ else {
11382
+ const targetRoot = root === "auto" ? host.shadowRoot || host : root === "shadow" ? host.shadowRoot : host;
11383
+ if (targetRoot) {
11384
+ const found = targetRoot.querySelectorAll(stringSelector);
11385
+ if (found) targetEls.push(...Array.from(found));
11386
+ }
11387
+ }
11388
+ return targetEls;
11389
+ };
10935
11390
  function createStyleDecorator(action) {
10936
11391
  return (selector, options = {}) => {
10937
11392
  return (target, propertyKey, descriptor) => {
@@ -10959,28 +11414,7 @@ var dooboostoreSimpleWebComponent = (() => {
10959
11414
  const host = this;
10960
11415
  const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
10961
11416
  const r = options.root || "auto";
10962
- const targetEls = [];
10963
- const applyRoot = (t) => {
10964
- if (!t || !(t instanceof win.HTMLElement)) return;
10965
- targetEls.push(t);
10966
- };
10967
- if (selector === "$this" || !selector) applyRoot(host);
10968
- else if (selector === "$host") applyRoot(hostSet.$host);
10969
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
10970
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
10971
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
10972
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
10973
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
10974
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
10975
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
10976
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
10977
- else {
10978
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
10979
- if (targetRoot) {
10980
- const found = targetRoot.querySelectorAll(selector);
10981
- if (found) targetEls.push(...Array.from(found));
10982
- }
10983
- }
11417
+ const targetEls = getTargetElements2(selector, this, win, r);
10984
11418
  targetEls.forEach((targetEl) => {
10985
11419
  if (options.filter && !options.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
10986
11420
  return;
@@ -11027,18 +11461,46 @@ var dooboostoreSimpleWebComponent = (() => {
11027
11461
  };
11028
11462
  };
11029
11463
  }
11030
- function applyStyle(selector, action = "update", options = {}) {
11031
- return createStyleDecorator(action)(selector, options);
11032
- }
11033
- var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
11034
- var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
11035
- var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
11036
- function applyStyleThis(action = "update", options = {}) {
11464
+ function applyStyle(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
11465
+ if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
11466
+ return createStyleDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
11467
+ }
11468
+ if (typeof selectorOrTarget === "string") {
11469
+ const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
11470
+ const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
11471
+ return createStyleDecorator(action2)(selectorOrTarget, options2);
11472
+ }
11473
+ const action = typeof selectorOrTarget === "string" ? selectorOrTarget : "update";
11474
+ const options = typeof selectorOrTarget === "object" ? selectorOrTarget : actionOrPropertyKey;
11037
11475
  return createStyleDecorator(action)("$this", options);
11038
11476
  }
11039
- var setStyleThis = (options = {}) => createStyleDecorator("set")("$this", options);
11040
- var updateStyleThis = (options = {}) => createStyleDecorator("update")("$this", options);
11041
- var removeStyleThis = (options = {}) => createStyleDecorator("remove")("$this", options);
11477
+ function setStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
11478
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
11479
+ return createStyleDecorator("set")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
11480
+ }
11481
+ if (typeof selectorOrTarget === "string") {
11482
+ return createStyleDecorator("set")(selectorOrTarget, optionsOrPropertyKey);
11483
+ }
11484
+ return createStyleDecorator("set")("$this", selectorOrTarget);
11485
+ }
11486
+ function updateStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
11487
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
11488
+ return createStyleDecorator("update")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
11489
+ }
11490
+ if (typeof selectorOrTarget === "string") {
11491
+ return createStyleDecorator("update")(selectorOrTarget, optionsOrPropertyKey);
11492
+ }
11493
+ return createStyleDecorator("update")("$this", selectorOrTarget);
11494
+ }
11495
+ function removeStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
11496
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
11497
+ return createStyleDecorator("remove")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
11498
+ }
11499
+ if (typeof selectorOrTarget === "string") {
11500
+ return createStyleDecorator("remove")(selectorOrTarget, optionsOrPropertyKey);
11501
+ }
11502
+ return createStyleDecorator("remove")("$this", selectorOrTarget);
11503
+ }
11042
11504
  var findAllStyleMetadata = (target) => {
11043
11505
  const result = /* @__PURE__ */ new Map();
11044
11506
  const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
@@ -11086,6 +11548,7 @@ var dooboostoreSimpleWebComponent = (() => {
11086
11548
  }
11087
11549
  return createSubscribeSwcAppRouteChangeWhileConnected(options);
11088
11550
  }
11551
+ var changedRoute = subscribeSwcAppRouteChangeWhileConnected;
11089
11552
  var getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
11090
11553
  const constructor = target instanceof Function ? target : target.constructor;
11091
11554
  const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
@@ -11126,6 +11589,7 @@ var dooboostoreSimpleWebComponent = (() => {
11126
11589
  }
11127
11590
  return createSubscribeSwcAppMessageWhileConnected(options, messageType);
11128
11591
  }
11592
+ var receiveMessage = subscribeSwcAppMessageWhileConnected;
11129
11593
  var getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
11130
11594
  const constructor = target instanceof Function ? target : target.constructor;
11131
11595
  return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
@@ -11155,7 +11619,7 @@ var dooboostoreSimpleWebComponent = (() => {
11155
11619
  }
11156
11620
  return v;
11157
11621
  };
11158
- const publishMessage = (data) => {
11622
+ const publishMessage2 = (data) => {
11159
11623
  const appHost = SwcUtils.getAppHost(this);
11160
11624
  if (appHost) {
11161
11625
  appHost.publishMessage({
@@ -11168,13 +11632,13 @@ var dooboostoreSimpleWebComponent = (() => {
11168
11632
  if (result instanceof Promise) {
11169
11633
  result.then((data) => {
11170
11634
  const extracted = extractValue(data);
11171
- publishMessage(extracted);
11635
+ publishMessage2(extracted);
11172
11636
  }).catch((err) => {
11173
11637
  console.warn("publishSwcAppMessage async error:", err);
11174
11638
  });
11175
11639
  } else {
11176
11640
  const extracted = extractValue(result);
11177
- publishMessage(extracted);
11641
+ publishMessage2(extracted);
11178
11642
  }
11179
11643
  return result;
11180
11644
  };
@@ -11199,7 +11663,7 @@ var dooboostoreSimpleWebComponent = (() => {
11199
11663
  }
11200
11664
  return createPublishSwcAppMessage(messageType, options);
11201
11665
  }
11202
- var publish = publishSwcAppMessage;
11666
+ var publishMessage = publishSwcAppMessage;
11203
11667
  var getPublishSwcAppMessageMetadata = (target) => {
11204
11668
  const constructor = target instanceof Function ? target : target.constructor;
11205
11669
  return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
@@ -13316,6 +13780,10 @@ var dooboostoreSimpleWebComponent = (() => {
13316
13780
  super(config);
13317
13781
  __publicField(this, "_history", []);
13318
13782
  __publicField(this, "_currentIndex", -1);
13783
+ if (config.firstUrl) {
13784
+ this._history.push({ url: config.firstUrl, data: null, title: void 0 });
13785
+ this._currentIndex = 0;
13786
+ }
13319
13787
  }
13320
13788
  // Override pushState to manage internal history
13321
13789
  pushState(data, title, path, config) {
@@ -13487,7 +13955,9 @@ var dooboostoreSimpleWebComponent = (() => {
13487
13955
  if (this.router) otherInstanceSim.set(Router, this.router);
13488
13956
  this.simpleApplication.run(otherInstanceSim);
13489
13957
  if (this._config.onStartedLazyDefineComponent) {
13490
- await Promise.all(this._config.onStartedLazyDefineComponent.map((it) => it(this._config.window)));
13958
+ await Promise.all(this._config.onStartedLazyDefineComponent.map((it) => {
13959
+ it(this._config.window);
13960
+ }));
13491
13961
  }
13492
13962
  if (this._config.onEngineStarted) {
13493
13963
  await this._config.onEngineStarted(this.simpleApplication, this.host);
@@ -13564,6 +14034,13 @@ var dooboostoreSimpleWebComponent = (() => {
13564
14034
  const methodName = metadata.propertyKey;
13565
14035
  let pathPattern = metadata.options?.path;
13566
14036
  const filter = metadata.options?.filter;
14037
+ const extractValue = (v) => {
14038
+ const keyToUse = metadata.options?.valueKey ?? SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY;
14039
+ if (v && typeof v === "object" && keyToUse in v) {
14040
+ return v[keyToUse];
14041
+ }
14042
+ return v;
14043
+ };
13567
14044
  if (typeof pathPattern === "function") {
13568
14045
  pathPattern = pathPattern(instance);
13569
14046
  }
@@ -13588,7 +14065,7 @@ var dooboostoreSimpleWebComponent = (() => {
13588
14065
  const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
13589
14066
  const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
13590
14067
  if (pathMatched && filterPassed && instance[methodName]) {
13591
- const result = await instance[methodName]({ ...re, pathData });
14068
+ const result = extractValue(await instance[methodName]({ ...re, pathData }));
13592
14069
  if (result !== void 0 && result !== null) {
13593
14070
  break;
13594
14071
  }
@@ -13703,7 +14180,15 @@ var dooboostoreSimpleWebComponent = (() => {
13703
14180
  context: this,
13704
14181
  args: SwcUtils.getHelperAndHostSet(win, this)
13705
14182
  });
13706
- this.connect(userConfig);
14183
+ if (userConfig instanceof Promise) {
14184
+ userConfig.then((resolvedConfig) => {
14185
+ this.connect(resolvedConfig);
14186
+ }).catch((e) => {
14187
+ console.error("[SWC-MIXIN] Script execution failed:", e);
14188
+ });
14189
+ } else {
14190
+ this.connect(userConfig);
14191
+ }
13707
14192
  } catch (e) {
13708
14193
  console.error("[SWC-MIXIN] Script execution failed:", e);
13709
14194
  }