@dooboostore/simple-web-component 1.0.22 → 1.0.24

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 (105) hide show
  1. package/README.md +568 -32
  2. package/dist/cjs/decorators/applyNode.js +195 -26
  3. package/dist/cjs/decorators/applyNode.js.map +2 -2
  4. package/dist/cjs/decorators/attribute.js +21 -3
  5. package/dist/cjs/decorators/attribute.js.map +2 -2
  6. package/dist/cjs/decorators/changedAttributeHost.js.map +2 -2
  7. package/dist/cjs/decorators/classList.js +82 -19
  8. package/dist/cjs/decorators/classList.js.map +2 -2
  9. package/dist/cjs/decorators/elementDefine.js +1 -2
  10. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  11. package/dist/cjs/decorators/index.js +0 -1
  12. package/dist/cjs/decorators/index.js.map +2 -2
  13. package/dist/cjs/decorators/lifecycles.js +25 -0
  14. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  15. package/dist/cjs/decorators/query.js +77 -2
  16. package/dist/cjs/decorators/query.js.map +2 -2
  17. package/dist/cjs/decorators/queryAll.js +77 -2
  18. package/dist/cjs/decorators/queryAll.js.map +2 -2
  19. package/dist/cjs/decorators/setAttribute.js +4 -4
  20. package/dist/cjs/decorators/setAttribute.js.map +2 -2
  21. package/dist/cjs/decorators/style.js +70 -13
  22. package/dist/cjs/decorators/style.js.map +2 -2
  23. package/dist/cjs/index.js +4 -4
  24. package/dist/cjs/index.js.map +2 -2
  25. package/dist/cjs/utils/Utils.js +140 -1
  26. package/dist/cjs/utils/Utils.js.map +2 -2
  27. package/dist/esm/decorators/applyNode.js +195 -26
  28. package/dist/esm/decorators/applyNode.js.map +2 -2
  29. package/dist/esm/decorators/attribute.js +21 -3
  30. package/dist/esm/decorators/attribute.js.map +2 -2
  31. package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
  32. package/dist/esm/decorators/classList.js +82 -19
  33. package/dist/esm/decorators/classList.js.map +2 -2
  34. package/dist/esm/decorators/elementDefine.js +1 -2
  35. package/dist/esm/decorators/elementDefine.js.map +2 -2
  36. package/dist/esm/decorators/index.js +0 -1
  37. package/dist/esm/decorators/index.js.map +2 -2
  38. package/dist/esm/decorators/lifecycles.js +25 -0
  39. package/dist/esm/decorators/lifecycles.js.map +2 -2
  40. package/dist/esm/decorators/query.js +77 -2
  41. package/dist/esm/decorators/query.js.map +2 -2
  42. package/dist/esm/decorators/queryAll.js +77 -2
  43. package/dist/esm/decorators/queryAll.js.map +2 -2
  44. package/dist/esm/decorators/setAttribute.js +4 -4
  45. package/dist/esm/decorators/setAttribute.js.map +2 -2
  46. package/dist/esm/decorators/style.js +70 -13
  47. package/dist/esm/decorators/style.js.map +2 -2
  48. package/dist/esm/index.js +4 -4
  49. package/dist/esm/index.js.map +2 -2
  50. package/dist/esm/utils/Utils.js +140 -1
  51. package/dist/esm/utils/Utils.js.map +2 -2
  52. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +678 -168
  53. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  54. package/dist/types/decorators/applyNode.d.ts +107 -2
  55. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  56. package/dist/types/decorators/attribute.d.ts +11 -4
  57. package/dist/types/decorators/attribute.d.ts.map +1 -1
  58. package/dist/types/decorators/classList.d.ts +22 -10
  59. package/dist/types/decorators/classList.d.ts.map +1 -1
  60. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  61. package/dist/types/decorators/index.d.ts +0 -1
  62. package/dist/types/decorators/index.d.ts.map +1 -1
  63. package/dist/types/decorators/lifecycles.d.ts +14 -0
  64. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  65. package/dist/types/decorators/query.d.ts +68 -7
  66. package/dist/types/decorators/query.d.ts.map +1 -1
  67. package/dist/types/decorators/queryAll.d.ts +70 -1
  68. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  69. package/dist/types/decorators/setAttribute.d.ts.map +1 -1
  70. package/dist/types/decorators/style.d.ts +37 -3
  71. package/dist/types/decorators/style.d.ts.map +1 -1
  72. package/dist/types/index.d.ts +1 -2
  73. package/dist/types/index.d.ts.map +1 -1
  74. package/dist/types/utils/Utils.d.ts +49 -0
  75. package/dist/types/utils/Utils.d.ts.map +1 -1
  76. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +678 -168
  77. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  78. package/package.json +2 -2
  79. package/src/decorators/applyNode.ts +319 -37
  80. package/src/decorators/attribute.ts +44 -11
  81. package/src/decorators/changedAttributeHost.ts +1 -1
  82. package/src/decorators/classList.ts +107 -22
  83. package/src/decorators/elementDefine.ts +1 -2
  84. package/src/decorators/index.ts +0 -1
  85. package/src/decorators/lifecycles.ts +40 -0
  86. package/src/decorators/query.ts +147 -7
  87. package/src/decorators/queryAll.ts +148 -2
  88. package/src/decorators/setAttribute.ts +6 -5
  89. package/src/decorators/style.ts +109 -13
  90. package/src/index.ts +6 -6
  91. package/src/utils/Utils.ts +144 -0
  92. package/dist/cjs/decorators/onConnectedInnerHtml.js +0 -48
  93. package/dist/cjs/decorators/onConnectedInnerHtml.js.map +0 -7
  94. package/dist/cjs/utils/TemplateUtils.js +0 -103
  95. package/dist/cjs/utils/TemplateUtils.js.map +0 -7
  96. package/dist/esm/decorators/onConnectedInnerHtml.js +0 -29
  97. package/dist/esm/decorators/onConnectedInnerHtml.js.map +0 -7
  98. package/dist/esm/utils/TemplateUtils.js +0 -84
  99. package/dist/esm/utils/TemplateUtils.js.map +0 -7
  100. package/dist/types/decorators/onConnectedInnerHtml.d.ts +0 -15
  101. package/dist/types/decorators/onConnectedInnerHtml.d.ts.map +0 -1
  102. package/dist/types/utils/TemplateUtils.d.ts +0 -54
  103. package/dist/types/utils/TemplateUtils.d.ts.map +0 -1
  104. package/src/decorators/onConnectedInnerHtml.ts +0 -42
  105. package/src/utils/TemplateUtils.ts +0 -83
@@ -1145,16 +1145,42 @@ var dooboostoreSimpleWebComponent = (() => {
1145
1145
  STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
1146
1146
  SWC_NOT_FOUND: () => SWC_NOT_FOUND,
1147
1147
  SwcUtils: () => SwcUtils,
1148
- TemplateUtils: () => TemplateUtils,
1149
1148
  addClassList: () => addClassList,
1150
1149
  addClassListHost: () => addClassListHost,
1151
1150
  addEventListener: () => addEventListener,
1152
1151
  addEventListenerHost: () => addEventListenerHost,
1152
+ allAppHost: () => allAppHost,
1153
+ allFirstAppHost: () => allFirstAppHost,
1154
+ allFirstHost: () => allFirstHost,
1155
+ allHost: () => allHost,
1156
+ allLastAppHost: () => allLastAppHost,
1157
+ allLastHost: () => allLastHost,
1158
+ allParentHost: () => allParentHost,
1159
+ appHost: () => appHost,
1160
+ applyAfterBeginNode: () => applyAfterBeginNode,
1161
+ applyAfterBeginNodeHost: () => applyAfterBeginNodeHost,
1162
+ applyAfterEndNode: () => applyAfterEndNode,
1163
+ applyAfterEndNodeHost: () => applyAfterEndNodeHost,
1164
+ applyBeforeBeginNode: () => applyBeforeBeginNode,
1165
+ applyBeforeBeginNodeHost: () => applyBeforeBeginNodeHost,
1166
+ applyBeforeEndNode: () => applyBeforeEndNode,
1167
+ applyBeforeEndNodeHost: () => applyBeforeEndNodeHost,
1168
+ applyInnerHtmlNode: () => applyInnerHtmlNode,
1169
+ applyInnerHtmlNodeHost: () => applyInnerHtmlNodeHost,
1170
+ applyInnerTextNode: () => applyInnerTextNode,
1171
+ applyInnerTextNodeHost: () => applyInnerTextNodeHost,
1153
1172
  applyNode: () => applyNode,
1154
1173
  applyNodeHost: () => applyNodeHost,
1174
+ applyRemoveNode: () => applyRemoveNode,
1175
+ applyRemoveNodeHost: () => applyRemoveNodeHost,
1176
+ applyReplaceChildrenNode: () => applyReplaceChildrenNode,
1177
+ applyReplaceChildrenNodeHost: () => applyReplaceChildrenNodeHost,
1178
+ applyReplaceNode: () => applyReplaceNode,
1179
+ applyReplaceNodeHost: () => applyReplaceNodeHost,
1155
1180
  attribute: () => attribute,
1156
1181
  attributeHost: () => attributeHost,
1157
1182
  changedAttributeHost: () => changedAttributeHost,
1183
+ commentNode: () => commentNode,
1158
1184
  createElement: () => createElement,
1159
1185
  elementDefine: () => elementDefine,
1160
1186
  emitCustomEvent: () => emitCustomEvent,
@@ -1167,6 +1193,8 @@ var dooboostoreSimpleWebComponent = (() => {
1167
1193
  findAllLifecycleMetadata: () => findAllLifecycleMetadata,
1168
1194
  findAllSetAttributeMetadata: () => findAllSetAttributeMetadata,
1169
1195
  findAllStyleMetadata: () => findAllStyleMetadata,
1196
+ firstAppHost: () => firstAppHost,
1197
+ firstHost: () => firstHost,
1170
1198
  getAddEventListenerMetadata: () => getAddEventListenerMetadata,
1171
1199
  getChangedAttributeMetadata: () => getChangedAttributeMetadata,
1172
1200
  getElementConfig: () => getElementConfig,
@@ -1175,23 +1203,20 @@ var dooboostoreSimpleWebComponent = (() => {
1175
1203
  getQueryAllMetadata: () => getQueryAllMetadata,
1176
1204
  getQueryMetadata: () => getQueryMetadata,
1177
1205
  getSetAttributeMetadata: () => getSetAttributeMetadata,
1206
+ host: () => host,
1178
1207
  htmlAElement: () => htmlAElement,
1179
1208
  htmlArticleElement: () => htmlArticleElement,
1180
1209
  htmlButtonElement: () => htmlButtonElement,
1181
1210
  htmlDivElement: () => htmlDivElement,
1182
1211
  htmlFragment: () => htmlFragment,
1183
- htmlH1Element: () => htmlH1Element,
1184
- htmlH2Element: () => htmlH2Element,
1185
- htmlH3Element: () => htmlH3Element,
1186
- htmlH4Element: () => htmlH4Element,
1187
- htmlH5Element: () => htmlH5Element,
1188
- htmlH6Element: () => htmlH6Element,
1189
- htmlInputElement: () => htmlInputElement,
1212
+ htmlHeadingElement: () => htmlHeadingElement,
1190
1213
  htmlLiElement: () => htmlLiElement,
1191
1214
  htmlPElement: () => htmlPElement,
1192
1215
  htmlSectionElement: () => htmlSectionElement,
1193
1216
  htmlSpanElement: () => htmlSpanElement,
1194
1217
  htmlUlElement: () => htmlUlElement,
1218
+ lastAppHost: () => lastAppHost,
1219
+ lastHost: () => lastHost,
1195
1220
  onAddEventListener: () => onAddEventListener,
1196
1221
  onAdopted: () => onAdopted,
1197
1222
  onAfterAdopted: () => onAfterAdopted,
@@ -1204,6 +1229,7 @@ var dooboostoreSimpleWebComponent = (() => {
1204
1229
  onConnectedInnerHtml: () => onConnectedInnerHtml,
1205
1230
  onConstructor: () => onConstructor,
1206
1231
  onDisconnected: () => onDisconnected,
1232
+ parentHost: () => parentHost,
1207
1233
  query: () => query,
1208
1234
  queryAll: () => queryAll,
1209
1235
  queryAllHost: () => queryAllHost,
@@ -1211,18 +1237,21 @@ var dooboostoreSimpleWebComponent = (() => {
1211
1237
  removeClassList: () => removeClassList,
1212
1238
  removeClassListHost: () => removeClassListHost,
1213
1239
  removeStyle: () => removeStyle,
1240
+ removeStyleHost: () => removeStyleHost,
1214
1241
  resolveTargetEls: () => resolveTargetEls,
1215
1242
  setAttribute: () => setAttribute,
1216
1243
  setAttributeHost: () => setAttributeHost,
1217
1244
  setClassList: () => setClassList,
1218
1245
  setClassListHost: () => setClassListHost,
1219
1246
  setStyle: () => setStyle,
1247
+ setStyleHost: () => setStyleHost,
1220
1248
  textNode: () => textNode,
1221
1249
  toggleClassList: () => toggleClassList,
1222
1250
  toggleClassListHost: () => toggleClassListHost,
1223
1251
  updateClassList: () => updateClassList,
1224
1252
  updateClassListHost: () => updateClassListHost,
1225
- updateStyle: () => updateStyle
1253
+ updateStyle: () => updateStyle,
1254
+ updateStyleHost: () => updateStyleHost
1226
1255
  });
1227
1256
  var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1228
1257
 
@@ -5829,30 +5858,6 @@ var dooboostoreSimpleWebComponent = (() => {
5829
5858
  })(Path = Expression2.Path || (Expression2.Path = {}));
5830
5859
  })(Expression || (Expression = {}));
5831
5860
 
5832
- // src/decorators/onConnectedInnerHtml.ts
5833
- var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
5834
- function onConnectedInnerHtml(arg1, arg2, arg3) {
5835
- const decorator = (options, target, propertyKey) => {
5836
- const constructor = target.constructor;
5837
- let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5838
- if (!list) {
5839
- list = [];
5840
- ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
5841
- }
5842
- list.push({ propertyKey, options });
5843
- };
5844
- if (arg2) {
5845
- return decorator({}, arg1, arg2);
5846
- }
5847
- return (target, propertyKey) => {
5848
- decorator(arg1 || {}, target, propertyKey);
5849
- };
5850
- }
5851
- var getOnConnectedInnerHtmlMetadata = (target) => {
5852
- const constructor = target instanceof Function ? target : target.constructor;
5853
- return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5854
- };
5855
-
5856
5861
  // src/decorators/addEventListener.ts
5857
5862
  var ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:add-event-listener");
5858
5863
  function addEventListener(selectorOrTarget, type, options = {}) {
@@ -5883,6 +5888,7 @@ var dooboostoreSimpleWebComponent = (() => {
5883
5888
  var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-before-adopted");
5884
5889
  var ON_AFTER_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-after-adopted");
5885
5890
  var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:on-add-event-listener");
5891
+ var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
5886
5892
  var ATTRIBUTE_CHANGED_WILDCARD = "*";
5887
5893
  function createLifecycleDecorator(metadataKey) {
5888
5894
  return (target, propertyKey) => {
@@ -5906,10 +5912,31 @@ var dooboostoreSimpleWebComponent = (() => {
5906
5912
  var onAfterAdopted = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
5907
5913
  var onAdopted = onAfterAdopted;
5908
5914
  var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
5915
+ function onConnectedInnerHtml(arg1, arg2, arg3) {
5916
+ const decorator = (options, target, propertyKey) => {
5917
+ const constructor = target.constructor;
5918
+ let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5919
+ if (!list) {
5920
+ list = [];
5921
+ ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
5922
+ }
5923
+ list.push({ propertyKey, options });
5924
+ };
5925
+ if (arg2) {
5926
+ return decorator({}, arg1, arg2);
5927
+ }
5928
+ return (target, propertyKey) => {
5929
+ decorator(arg1 || {}, target, propertyKey);
5930
+ };
5931
+ }
5909
5932
  var findAllLifecycleMetadata = (target, metadataKey) => {
5910
5933
  const results = ReflectUtils.findAllMetadataFlatten(metadataKey, target);
5911
5934
  return results.length > 0 ? results : void 0;
5912
5935
  };
5936
+ var getOnConnectedInnerHtmlMetadata = (target) => {
5937
+ const constructor = target instanceof Function ? target : target.constructor;
5938
+ return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5939
+ };
5913
5940
 
5914
5941
  // src/decorators/attribute.ts
5915
5942
  var ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:attribute");
@@ -6013,7 +6040,6 @@ var dooboostoreSimpleWebComponent = (() => {
6013
6040
  },
6014
6041
  set(nv) {
6015
6042
  const targetType = options.type || designType;
6016
- console.log("---set", propertyKey, targetType, nv, this, this.__swc_syncing_init);
6017
6043
  const attrName = options.name || String(propertyKey);
6018
6044
  const conf = getElementConfig(this);
6019
6045
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
@@ -6041,8 +6067,27 @@ var dooboostoreSimpleWebComponent = (() => {
6041
6067
  var findAllAttributeMetadata = (target) => {
6042
6068
  return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, target).flat();
6043
6069
  };
6044
- function attributeHost(attrName, options = {}) {
6045
- return attribute(":host", { ...options, name: attrName });
6070
+ function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
6071
+ if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
6072
+ const fieldName = String(propertyKeyOrOptions);
6073
+ return attribute(":host", { name: fieldName })(targetOrAttrOrOptions, propertyKeyOrOptions);
6074
+ }
6075
+ if (typeof targetOrAttrOrOptions === "string") {
6076
+ const attrName = targetOrAttrOrOptions;
6077
+ const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
6078
+ return attribute(":host", { ...options, name: attrName });
6079
+ } else if (typeof targetOrAttrOrOptions === "object") {
6080
+ const options = targetOrAttrOrOptions;
6081
+ return (target, propertyKey) => {
6082
+ const fieldName = String(propertyKey);
6083
+ return attribute(":host", { ...options, name: fieldName })(target, propertyKey);
6084
+ };
6085
+ } else {
6086
+ return (target, propertyKey) => {
6087
+ const fieldName = String(propertyKey);
6088
+ return attribute(":host", { name: fieldName })(target, propertyKey);
6089
+ };
6090
+ }
6046
6091
  }
6047
6092
 
6048
6093
  // src/decorators/changedAttributeHost.ts
@@ -6096,11 +6141,11 @@ var dooboostoreSimpleWebComponent = (() => {
6096
6141
  const applyRoot = (t) => {
6097
6142
  if (!t) return;
6098
6143
  if (r === "auto") {
6099
- targetEls.push(t.shadowRoot || t);
6100
- return;
6144
+ targetEls.push(t);
6145
+ } else {
6146
+ if (r === "light" || r === "all") targetEls.push(t);
6147
+ if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
6101
6148
  }
6102
- if (r === "light" || r === "all") targetEls.push(t);
6103
- if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
6104
6149
  };
6105
6150
  if (selector === ":window") targetEls.push(currentWin);
6106
6151
  else if (selector === ":document") targetEls.push(currentWin.document);
@@ -6182,32 +6227,83 @@ var dooboostoreSimpleWebComponent = (() => {
6182
6227
  const conf = getElementConfig(this);
6183
6228
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6184
6229
  const currentDoc = currentWin.document;
6185
- let targetEl = null;
6186
- if (selector === ":host" || !selector) {
6187
- targetEl = this;
6230
+ const pos = options.position || "beforeEnd";
6231
+ const r = options.root || "auto";
6232
+ const applyRoot = (t) => {
6233
+ if (!t || !(t instanceof HTMLElement))
6234
+ return t;
6235
+ if (r === "auto")
6236
+ return t.shadowRoot || t;
6237
+ if (r === "shadow")
6238
+ return t.shadowRoot;
6239
+ if (r === "light")
6240
+ return t;
6241
+ if (r === "all")
6242
+ return t.shadowRoot || t;
6243
+ return t;
6244
+ };
6245
+ const hostSet = SwcUtils.getHostSet(this);
6246
+ if (pos === "remove") {
6247
+ if (res) {
6248
+ if (selector === ":host" || !selector) {
6249
+ if (r === "shadow" && this.shadowRoot) {
6250
+ this.shadowRoot.replaceChildren();
6251
+ } else {
6252
+ this.remove();
6253
+ }
6254
+ } else {
6255
+ const targetRoot = applyRoot(this);
6256
+ if (targetRoot) {
6257
+ const targets = targetRoot.querySelectorAll(selector);
6258
+ targets.forEach((el) => el.remove());
6259
+ }
6260
+ }
6261
+ }
6188
6262
  } else {
6189
- targetEl = (this.shadowRoot || this).querySelector(selector);
6190
- }
6191
- if (targetEl) {
6192
- const nodes = normalizeNodes(res, currentDoc);
6193
- const pos = options.position || "beforeEnd";
6194
- if (pos === "replace") {
6195
- targetEl.replaceWith(...nodes);
6196
- } else if (pos === "replaceChildren") {
6197
- targetEl.replaceChildren(...nodes);
6198
- } else if (pos === "innerHtml") {
6199
- targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6200
- } else if (pos === "innerText") {
6201
- targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6263
+ let targetEl = null;
6264
+ if (selector === ":host") {
6265
+ targetEl = applyRoot(this);
6266
+ } else if (selector === ":parentHost") {
6267
+ targetEl = applyRoot(hostSet.$parentHost);
6268
+ } else if (selector === ":appHost") {
6269
+ targetEl = applyRoot(hostSet.$appHost);
6270
+ } else if (selector === ":firstHost") {
6271
+ targetEl = applyRoot(hostSet.$firstHost);
6272
+ } else if (selector === ":lastHost") {
6273
+ targetEl = applyRoot(hostSet.$lastHost);
6274
+ } else if (selector === ":firstAppHost") {
6275
+ targetEl = applyRoot(hostSet.$firstHost);
6276
+ } else if (selector === ":lastAppHost") {
6277
+ targetEl = applyRoot(hostSet.$lastAppHost);
6202
6278
  } else {
6203
- if (pos === "beforeEnd")
6204
- targetEl.append(...nodes);
6205
- else if (pos === "afterBegin")
6206
- targetEl.prepend(...nodes);
6207
- else if (pos === "beforeBegin")
6208
- targetEl.before(...nodes);
6209
- else if (pos === "afterEnd")
6210
- targetEl.after(...nodes);
6279
+ const targetRoot = applyRoot(this);
6280
+ targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
6281
+ }
6282
+ if (targetEl) {
6283
+ const isShadowRoot = targetEl instanceof ShadowRoot;
6284
+ const nodes = normalizeNodes(res, currentDoc);
6285
+ if (pos === "replace") {
6286
+ if (!isShadowRoot) {
6287
+ targetEl.replaceWith(...nodes);
6288
+ }
6289
+ } else if (pos === "replaceChildren") {
6290
+ targetEl.replaceChildren(...nodes);
6291
+ } else if (pos === "innerHtml") {
6292
+ targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6293
+ } else if (pos === "innerText") {
6294
+ if (targetEl.innerText !== void 0) {
6295
+ targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6296
+ }
6297
+ } else {
6298
+ if (pos === "beforeEnd")
6299
+ targetEl.append(...nodes);
6300
+ else if (pos === "afterBegin")
6301
+ targetEl.prepend(...nodes);
6302
+ else if (pos === "beforeBegin" && !isShadowRoot)
6303
+ targetEl.before(...nodes);
6304
+ else if (pos === "afterEnd" && !isShadowRoot)
6305
+ targetEl.after(...nodes);
6306
+ }
6211
6307
  }
6212
6308
  }
6213
6309
  }
@@ -6225,8 +6321,107 @@ var dooboostoreSimpleWebComponent = (() => {
6225
6321
  });
6226
6322
  return result;
6227
6323
  };
6228
- function applyNodeHost(options = { position: "beforeEnd" }) {
6229
- return applyNode(":host", options);
6324
+ function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
6325
+ console.log("vvvvv");
6326
+ if (propertyKey !== void 0 && typeof propertyKey === "string" || typeof propertyKey === "symbol") {
6327
+ return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
6328
+ }
6329
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6330
+ const options = targetOrOptions;
6331
+ return applyNode(":host", { ...options, position: options.position || "beforeEnd" });
6332
+ } else {
6333
+ return applyNode(":host", { position: "beforeEnd" });
6334
+ }
6335
+ }
6336
+ function applyBeforeBeginNode(selector, options) {
6337
+ return applyNode(selector, { ...options, position: "beforeBegin" });
6338
+ }
6339
+ function applyAfterBeginNode(selector, options) {
6340
+ return applyNode(selector, { ...options, position: "afterBegin" });
6341
+ }
6342
+ function applyBeforeEndNode(selector, options) {
6343
+ return applyNode(selector, { ...options, position: "beforeEnd" });
6344
+ }
6345
+ function applyAfterEndNode(selector, options) {
6346
+ return applyNode(selector, { ...options, position: "afterEnd" });
6347
+ }
6348
+ function applyReplaceNode(selector, options) {
6349
+ return applyNode(selector, { ...options, position: "replace" });
6350
+ }
6351
+ function applyReplaceChildrenNode(selector, options) {
6352
+ return applyNode(selector, { ...options, position: "replaceChildren" });
6353
+ }
6354
+ function applyInnerHtmlNode(selector, options) {
6355
+ return applyNode(selector, { ...options, position: "innerHtml" });
6356
+ }
6357
+ function applyInnerTextNode(selector, options) {
6358
+ return applyNode(selector, { ...options, position: "innerText" });
6359
+ }
6360
+ function applyRemoveNode(selector, options) {
6361
+ return applyNode(selector, { ...options, position: "remove" });
6362
+ }
6363
+ function applyBeforeBeginNodeHost(targetOrOptions, propertyKey, descriptor) {
6364
+ if (propertyKey !== void 0) {
6365
+ const decorator = applyNode(":host", { position: "beforeBegin" });
6366
+ return decorator(targetOrOptions, propertyKey, descriptor);
6367
+ }
6368
+ return applyNode(":host", { ...targetOrOptions || {}, position: "beforeBegin" });
6369
+ }
6370
+ function applyAfterBeginNodeHost(optionsOrTarget, propertyKey, descriptor) {
6371
+ if (propertyKey !== void 0) {
6372
+ const decorator = applyNode(":host", { position: "afterBegin" });
6373
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6374
+ }
6375
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "afterBegin" });
6376
+ }
6377
+ function applyBeforeEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
6378
+ if (propertyKey !== void 0) {
6379
+ const decorator = applyNode(":host", { position: "beforeEnd" });
6380
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6381
+ }
6382
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "beforeEnd" });
6383
+ }
6384
+ function applyAfterEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
6385
+ if (propertyKey !== void 0) {
6386
+ const decorator = applyNode(":host", { position: "afterEnd" });
6387
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6388
+ }
6389
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "afterEnd" });
6390
+ }
6391
+ function applyReplaceNodeHost(optionsOrTarget, propertyKey, descriptor) {
6392
+ if (propertyKey !== void 0) {
6393
+ const decorator = applyNode(":host", { position: "replace" });
6394
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6395
+ }
6396
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "replace" });
6397
+ }
6398
+ function applyReplaceChildrenNodeHost(optionsOrTarget, propertyKey, descriptor) {
6399
+ if (propertyKey !== void 0) {
6400
+ const decorator = applyNode(":host", { position: "replaceChildren" });
6401
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6402
+ }
6403
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "replaceChildren" });
6404
+ }
6405
+ function applyInnerHtmlNodeHost(optionsOrTarget, propertyKey, descriptor) {
6406
+ if (propertyKey !== void 0) {
6407
+ const decorator = applyNode(":host", { position: "innerHtml" });
6408
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6409
+ }
6410
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "innerHtml" });
6411
+ }
6412
+ function applyInnerTextNodeHost(optionsOrTarget, propertyKey, descriptor) {
6413
+ if (propertyKey !== void 0) {
6414
+ const decorator = applyNode(":host", { position: "innerText" });
6415
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6416
+ }
6417
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "innerText" });
6418
+ }
6419
+ function applyRemoveNodeHost(optionsOrTarget, propertyKey, descriptor) {
6420
+ if (propertyKey !== void 0) {
6421
+ const decorator = applyNode(":host", { position: "remove" });
6422
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6423
+ }
6424
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "remove" });
6230
6425
  }
6231
6426
 
6232
6427
  // src/decorators/query.ts
@@ -6328,8 +6523,76 @@ var dooboostoreSimpleWebComponent = (() => {
6328
6523
  const constructor = target instanceof Function ? target : target.constructor;
6329
6524
  return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6330
6525
  };
6331
- function queryHost(options) {
6332
- return query(":host", options);
6526
+ function queryHost(targetOrOptions, propertyKey) {
6527
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6528
+ return query(":host", {})(targetOrOptions, propertyKey);
6529
+ }
6530
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6531
+ return query(":host", targetOrOptions);
6532
+ } else {
6533
+ return query(":host", {});
6534
+ }
6535
+ }
6536
+ var host = queryHost;
6537
+ function parentHost(targetOrOptions, propertyKey) {
6538
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6539
+ return query(":parentHost", {})(targetOrOptions, propertyKey);
6540
+ }
6541
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6542
+ return query(":parentHost", targetOrOptions);
6543
+ } else {
6544
+ return query(":parentHost", {});
6545
+ }
6546
+ }
6547
+ function appHost(targetOrOptions, propertyKey) {
6548
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6549
+ return query(":appHost", {})(targetOrOptions, propertyKey);
6550
+ }
6551
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6552
+ return query(":appHost", targetOrOptions);
6553
+ } else {
6554
+ return query(":appHost", {});
6555
+ }
6556
+ }
6557
+ function firstHost(targetOrOptions, propertyKey) {
6558
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6559
+ return query(":firstHost", {})(targetOrOptions, propertyKey);
6560
+ }
6561
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6562
+ return query(":firstHost", targetOrOptions);
6563
+ } else {
6564
+ return query(":firstHost", {});
6565
+ }
6566
+ }
6567
+ function lastHost(targetOrOptions, propertyKey) {
6568
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6569
+ return query(":lastHost", {})(targetOrOptions, propertyKey);
6570
+ }
6571
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6572
+ return query(":lastHost", targetOrOptions);
6573
+ } else {
6574
+ return query(":lastHost", {});
6575
+ }
6576
+ }
6577
+ function firstAppHost(targetOrOptions, propertyKey) {
6578
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6579
+ return query(":firstAppHost", {})(targetOrOptions, propertyKey);
6580
+ }
6581
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6582
+ return query(":firstAppHost", targetOrOptions);
6583
+ } else {
6584
+ return query(":firstAppHost", {});
6585
+ }
6586
+ }
6587
+ function lastAppHost(targetOrOptions, propertyKey) {
6588
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6589
+ return query(":lastAppHost", {})(targetOrOptions, propertyKey);
6590
+ }
6591
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6592
+ return query(":lastAppHost", targetOrOptions);
6593
+ } else {
6594
+ return query(":lastAppHost", {});
6595
+ }
6333
6596
  }
6334
6597
 
6335
6598
  // src/decorators/queryAll.ts
@@ -6428,14 +6691,82 @@ var dooboostoreSimpleWebComponent = (() => {
6428
6691
  const constructor = target instanceof Function ? target : target.constructor;
6429
6692
  return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6430
6693
  };
6431
- function queryAllHost(options) {
6432
- return queryAll(":host", options);
6694
+ function queryAllHost(targetOrOptions, propertyKey) {
6695
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6696
+ return queryAll(":host", {})(targetOrOptions, propertyKey);
6697
+ }
6698
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6699
+ return queryAll(":host", targetOrOptions);
6700
+ } else {
6701
+ return queryAll(":host", {});
6702
+ }
6703
+ }
6704
+ var allHost = queryAllHost;
6705
+ function allParentHost(targetOrOptions, propertyKey) {
6706
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6707
+ return queryAll(":parentHost", {})(targetOrOptions, propertyKey);
6708
+ }
6709
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6710
+ return queryAll(":parentHost", targetOrOptions);
6711
+ } else {
6712
+ return queryAll(":parentHost", {});
6713
+ }
6714
+ }
6715
+ function allAppHost(targetOrOptions, propertyKey) {
6716
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6717
+ return queryAll(":appHost", {})(targetOrOptions, propertyKey);
6718
+ }
6719
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6720
+ return queryAll(":appHost", targetOrOptions);
6721
+ } else {
6722
+ return queryAll(":appHost", {});
6723
+ }
6724
+ }
6725
+ function allFirstHost(targetOrOptions, propertyKey) {
6726
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6727
+ return queryAll(":firstHost", {})(targetOrOptions, propertyKey);
6728
+ }
6729
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6730
+ return queryAll(":firstHost", targetOrOptions);
6731
+ } else {
6732
+ return queryAll(":firstHost", {});
6733
+ }
6734
+ }
6735
+ function allLastHost(targetOrOptions, propertyKey) {
6736
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6737
+ return queryAll(":lastHost", {})(targetOrOptions, propertyKey);
6738
+ }
6739
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6740
+ return queryAll(":lastHost", targetOrOptions);
6741
+ } else {
6742
+ return queryAll(":lastHost", {});
6743
+ }
6744
+ }
6745
+ function allFirstAppHost(targetOrOptions, propertyKey) {
6746
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6747
+ return queryAll(":firstAppHost", {})(targetOrOptions, propertyKey);
6748
+ }
6749
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6750
+ return queryAll(":firstAppHost", targetOrOptions);
6751
+ } else {
6752
+ return queryAll(":firstAppHost", {});
6753
+ }
6754
+ }
6755
+ function allLastAppHost(targetOrOptions, propertyKey) {
6756
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6757
+ return queryAll(":lastAppHost", {})(targetOrOptions, propertyKey);
6758
+ }
6759
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6760
+ return queryAll(":lastAppHost", targetOrOptions);
6761
+ } else {
6762
+ return queryAll(":lastAppHost", {});
6763
+ }
6433
6764
  }
6434
6765
 
6435
6766
  // src/decorators/classList.ts
6436
6767
  var CLASS_LIST_METADATA_KEY = Symbol("simple-web-component:class-list");
6437
6768
  function createClassListDecorator(action) {
6438
- return (selector) => {
6769
+ return (selector, options = {}) => {
6439
6770
  return (target, propertyKey, descriptor) => {
6440
6771
  const constructor = target.constructor;
6441
6772
  let metaList = ReflectUtils.getOwnMetadata(CLASS_LIST_METADATA_KEY, constructor);
@@ -6443,19 +6774,52 @@ var dooboostoreSimpleWebComponent = (() => {
6443
6774
  metaList = /* @__PURE__ */ new Map();
6444
6775
  ReflectUtils.defineMetadata(CLASS_LIST_METADATA_KEY, metaList, constructor);
6445
6776
  }
6446
- metaList.set(propertyKey, { propertyKey, selector, action });
6777
+ metaList.set(propertyKey, { propertyKey, selector, action, options });
6447
6778
  const original = descriptor.value;
6448
6779
  descriptor.value = async function(...args) {
6449
6780
  ensureInit2(this);
6450
6781
  const res = await original.apply(this, args);
6451
6782
  if (res !== void 0) {
6783
+ const r = options.root || "auto";
6452
6784
  const hostSet = SwcUtils.getHostSet(this);
6453
- let targetEl = null;
6454
- if (selector === ":host" || !selector) targetEl = this;
6455
- else if (selector === ":parentHost") targetEl = hostSet.$parentHost;
6456
- else if (selector === ":appHost") targetEl = hostSet.$appHost;
6457
- else targetEl = (this.shadowRoot || this).querySelector(selector);
6458
- if (targetEl) {
6785
+ const targetEls = [];
6786
+ const applyRoot = (t) => {
6787
+ if (!t || !(t instanceof HTMLElement)) return;
6788
+ if (r === "auto") {
6789
+ targetEls.push(t);
6790
+ } else {
6791
+ if (r === "light" || r === "all") targetEls.push(t);
6792
+ if ((r === "shadow" || r === "all") && t.shadowRoot) {
6793
+ }
6794
+ }
6795
+ };
6796
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6797
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6798
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6799
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6800
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6801
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6802
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6803
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6804
+ else if (selector === ":host" || !selector) applyRoot(this);
6805
+ else {
6806
+ if (r === "shadow") {
6807
+ const found = this.shadowRoot?.querySelectorAll(selector);
6808
+ if (found) targetEls.push(...Array.from(found));
6809
+ } else if (r === "light") {
6810
+ const found = this.querySelectorAll(selector);
6811
+ if (found) targetEls.push(...Array.from(found));
6812
+ } else if (r === "all") {
6813
+ const sFound = this.shadowRoot?.querySelectorAll(selector);
6814
+ const lFound = this.querySelectorAll(selector);
6815
+ if (sFound) targetEls.push(...Array.from(sFound));
6816
+ if (lFound) targetEls.push(...Array.from(lFound));
6817
+ } else {
6818
+ const found = (this.shadowRoot || this).querySelectorAll(selector);
6819
+ if (found) targetEls.push(...Array.from(found));
6820
+ }
6821
+ }
6822
+ targetEls.forEach((targetEl) => {
6459
6823
  if (action === "set") {
6460
6824
  let classes = "";
6461
6825
  if (typeof res === "object" && res !== null && !Array.isArray(res)) {
@@ -6483,23 +6847,53 @@ var dooboostoreSimpleWebComponent = (() => {
6483
6847
  const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6484
6848
  classes.forEach((c) => targetEl.classList.toggle(c));
6485
6849
  }
6486
- }
6850
+ });
6487
6851
  }
6488
6852
  return res;
6489
6853
  };
6490
6854
  };
6491
6855
  };
6492
6856
  }
6493
- var setClassList = createClassListDecorator("set");
6494
- var updateClassList = createClassListDecorator("update");
6495
- var addClassList = createClassListDecorator("add");
6496
- var removeClassList = createClassListDecorator("remove");
6497
- var toggleClassList = createClassListDecorator("toggle");
6498
- var setClassListHost = createClassListDecorator("set").bind(null, ":host");
6499
- var updateClassListHost = createClassListDecorator("update").bind(null, ":host");
6500
- var addClassListHost = createClassListDecorator("add").bind(null, ":host");
6501
- var removeClassListHost = createClassListDecorator("remove").bind(null, ":host");
6502
- var toggleClassListHost = createClassListDecorator("toggle").bind(null, ":host");
6857
+ var setClassList = (selector, options = {}) => createClassListDecorator("set")(selector, options);
6858
+ var updateClassList = (selector, options = {}) => createClassListDecorator("update")(selector, options);
6859
+ var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
6860
+ var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
6861
+ var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
6862
+ function setClassListHost(targetOrOptions, propertyKey, descriptor) {
6863
+ if (propertyKey !== void 0) {
6864
+ const decorator = createClassListDecorator("set")(":host", {});
6865
+ return decorator(targetOrOptions, propertyKey, descriptor);
6866
+ }
6867
+ return createClassListDecorator("set")(":host", targetOrOptions || {});
6868
+ }
6869
+ function updateClassListHost(targetOrOptions, propertyKey, descriptor) {
6870
+ if (propertyKey !== void 0) {
6871
+ const decorator = createClassListDecorator("update")(":host", {});
6872
+ return decorator(targetOrOptions, propertyKey, descriptor);
6873
+ }
6874
+ return createClassListDecorator("update")(":host", targetOrOptions || {});
6875
+ }
6876
+ function addClassListHost(targetOrOptions, propertyKey, descriptor) {
6877
+ if (propertyKey !== void 0) {
6878
+ const decorator = createClassListDecorator("add")(":host", {});
6879
+ return decorator(targetOrOptions, propertyKey, descriptor);
6880
+ }
6881
+ return createClassListDecorator("add")(":host", targetOrOptions || {});
6882
+ }
6883
+ function removeClassListHost(targetOrOptions, propertyKey, descriptor) {
6884
+ if (propertyKey !== void 0) {
6885
+ const decorator = createClassListDecorator("remove")(":host", {});
6886
+ return decorator(targetOrOptions, propertyKey, descriptor);
6887
+ }
6888
+ return createClassListDecorator("remove")(":host", targetOrOptions || {});
6889
+ }
6890
+ function toggleClassListHost(targetOrOptions, propertyKey, descriptor) {
6891
+ if (propertyKey !== void 0) {
6892
+ const decorator = createClassListDecorator("toggle")(":host", {});
6893
+ return decorator(targetOrOptions, propertyKey, descriptor);
6894
+ }
6895
+ return createClassListDecorator("toggle")(":host", targetOrOptions || {});
6896
+ }
6503
6897
  var findAllClassListMetadata = (target) => {
6504
6898
  const result = /* @__PURE__ */ new Map();
6505
6899
  const maps = ReflectUtils.findAllMetadata(CLASS_LIST_METADATA_KEY, target);
@@ -6514,7 +6908,7 @@ var dooboostoreSimpleWebComponent = (() => {
6514
6908
  // src/decorators/style.ts
6515
6909
  var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
6516
6910
  function createStyleDecorator(action) {
6517
- return (selector) => {
6911
+ return (selector, options = {}) => {
6518
6912
  return (target, propertyKey, descriptor) => {
6519
6913
  const constructor = target.constructor;
6520
6914
  let metaList = ReflectUtils.getOwnMetadata(STYLE_METADATA_KEY, constructor);
@@ -6522,19 +6916,52 @@ var dooboostoreSimpleWebComponent = (() => {
6522
6916
  metaList = /* @__PURE__ */ new Map();
6523
6917
  ReflectUtils.defineMetadata(STYLE_METADATA_KEY, metaList, constructor);
6524
6918
  }
6525
- metaList.set(propertyKey, { propertyKey, selector, action });
6919
+ metaList.set(propertyKey, { propertyKey, selector, action, options });
6526
6920
  const original = descriptor.value;
6527
6921
  descriptor.value = async function(...args) {
6528
6922
  ensureInit2(this);
6529
6923
  const res = await original.apply(this, args);
6530
6924
  if (res !== void 0) {
6925
+ const r = options.root || "auto";
6531
6926
  const hostSet = SwcUtils.getHostSet(this);
6532
- let targetEl = null;
6533
- if (selector === ":host" || !selector) targetEl = this;
6534
- else if (selector === ":parentHost") targetEl = hostSet.$parentHost;
6535
- else if (selector === ":appHost") targetEl = hostSet.$appHost;
6536
- else targetEl = (this.shadowRoot || this).querySelector(selector);
6537
- if (targetEl) {
6927
+ const targetEls = [];
6928
+ const applyRoot = (t) => {
6929
+ if (!t || !(t instanceof HTMLElement)) return;
6930
+ if (r === "auto") {
6931
+ targetEls.push(t);
6932
+ } else {
6933
+ if (r === "light" || r === "all") targetEls.push(t);
6934
+ if ((r === "shadow" || r === "all") && t.shadowRoot) {
6935
+ }
6936
+ }
6937
+ };
6938
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6939
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6940
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6941
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6942
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6943
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6944
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6945
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6946
+ else if (selector === ":host" || !selector) applyRoot(this);
6947
+ else {
6948
+ if (r === "shadow") {
6949
+ const found = this.shadowRoot?.querySelectorAll(selector);
6950
+ if (found) targetEls.push(...Array.from(found));
6951
+ } else if (r === "light") {
6952
+ const found = this.querySelectorAll(selector);
6953
+ if (found) targetEls.push(...Array.from(found));
6954
+ } else if (r === "all") {
6955
+ const sFound = this.shadowRoot?.querySelectorAll(selector);
6956
+ const lFound = this.querySelectorAll(selector);
6957
+ if (sFound) targetEls.push(...Array.from(sFound));
6958
+ if (lFound) targetEls.push(...Array.from(lFound));
6959
+ } else {
6960
+ const found = (this.shadowRoot || this).querySelectorAll(selector);
6961
+ if (found) targetEls.push(...Array.from(found));
6962
+ }
6963
+ }
6964
+ targetEls.forEach((targetEl) => {
6538
6965
  if (action === "set") {
6539
6966
  targetEl.style.cssText = "";
6540
6967
  if (typeof res === "object" && res !== null) {
@@ -6550,16 +6977,37 @@ var dooboostoreSimpleWebComponent = (() => {
6550
6977
  const props = Array.isArray(res) ? res : [res];
6551
6978
  props.forEach((p) => targetEl.style.removeProperty(String(p)));
6552
6979
  }
6553
- }
6980
+ });
6554
6981
  }
6555
6982
  return res;
6556
6983
  };
6557
6984
  };
6558
6985
  };
6559
6986
  }
6560
- var setStyle = createStyleDecorator("set");
6561
- var updateStyle = createStyleDecorator("update");
6562
- var removeStyle = createStyleDecorator("remove");
6987
+ var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
6988
+ function setStyleHost(targetOrOptions, propertyKey, descriptor) {
6989
+ if (propertyKey !== void 0) {
6990
+ const decorator = createStyleDecorator("set")(":host", {});
6991
+ return decorator(targetOrOptions, propertyKey, descriptor);
6992
+ }
6993
+ return createStyleDecorator("set")(":host", targetOrOptions || {});
6994
+ }
6995
+ var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
6996
+ function updateStyleHost(targetOrOptions, propertyKey, descriptor) {
6997
+ if (propertyKey !== void 0) {
6998
+ const decorator = createStyleDecorator("update")(":host", {});
6999
+ return decorator(targetOrOptions, propertyKey, descriptor);
7000
+ }
7001
+ return createStyleDecorator("update")(":host", targetOrOptions || {});
7002
+ }
7003
+ var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
7004
+ function removeStyleHost(targetOrOptions, propertyKey, descriptor) {
7005
+ if (propertyKey !== void 0) {
7006
+ const decorator = createStyleDecorator("remove")(":host", {});
7007
+ return decorator(targetOrOptions, propertyKey, descriptor);
7008
+ }
7009
+ return createStyleDecorator("remove")(":host", targetOrOptions || {});
7010
+ }
6563
7011
  var findAllStyleMetadata = (target) => {
6564
7012
  const result = /* @__PURE__ */ new Map();
6565
7013
  const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
@@ -6573,6 +7021,131 @@ var dooboostoreSimpleWebComponent = (() => {
6573
7021
 
6574
7022
  // src/utils/Utils.ts
6575
7023
  var SWC_NOT_FOUND = Symbol("SWC_NOT_FOUND");
7024
+ var htmlFragment = (html, doc) => {
7025
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
7026
+ if (!d) throw new Error("Document is not available");
7027
+ const template = d.createElement("template");
7028
+ template.innerHTML = html.trim();
7029
+ return template.content;
7030
+ };
7031
+ var textNode = (text, doc) => {
7032
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
7033
+ if (!d) throw new Error("Document is not available");
7034
+ return d.createTextNode(text !== void 0 && text !== null ? String(text) : "");
7035
+ };
7036
+ var commentNode = (comment, doc) => {
7037
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
7038
+ if (!d) throw new Error("Document is not available");
7039
+ return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
7040
+ };
7041
+ var createElement = (tagName, options) => {
7042
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7043
+ if (!d) throw new Error("Document is not available");
7044
+ const el = d.createElement(tagName);
7045
+ if (options?.html) el.innerHTML = options.html;
7046
+ if (options?.attrs) {
7047
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7048
+ }
7049
+ return el;
7050
+ };
7051
+ var htmlDivElement = (html, options) => {
7052
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7053
+ if (!d) throw new Error("Document is not available");
7054
+ const el = d.createElement("div");
7055
+ el.innerHTML = html.trim();
7056
+ if (options?.attrs) {
7057
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7058
+ }
7059
+ return el;
7060
+ };
7061
+ var htmlSpanElement = (html, options) => {
7062
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7063
+ if (!d) throw new Error("Document is not available");
7064
+ const el = d.createElement("span");
7065
+ el.innerHTML = html.trim();
7066
+ if (options?.attrs) {
7067
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7068
+ }
7069
+ return el;
7070
+ };
7071
+ var htmlButtonElement = (html, options) => {
7072
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7073
+ if (!d) throw new Error("Document is not available");
7074
+ const el = d.createElement("button");
7075
+ el.innerHTML = html.trim();
7076
+ if (options?.attrs) {
7077
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7078
+ }
7079
+ return el;
7080
+ };
7081
+ var htmlUlElement = (options) => {
7082
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7083
+ if (!d) throw new Error("Document is not available");
7084
+ const el = d.createElement("ul");
7085
+ if (options?.attrs) {
7086
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7087
+ }
7088
+ return el;
7089
+ };
7090
+ var htmlLiElement = (html, options) => {
7091
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7092
+ if (!d) throw new Error("Document is not available");
7093
+ const el = d.createElement("li");
7094
+ el.innerHTML = html.trim();
7095
+ if (options?.attrs) {
7096
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7097
+ }
7098
+ return el;
7099
+ };
7100
+ var htmlAElement = (html, options) => {
7101
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7102
+ if (!d) throw new Error("Document is not available");
7103
+ const el = d.createElement("a");
7104
+ el.innerHTML = html.trim();
7105
+ if (options?.href) el.href = options.href;
7106
+ if (options?.attrs) {
7107
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7108
+ }
7109
+ return el;
7110
+ };
7111
+ var htmlPElement = (html, options) => {
7112
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7113
+ if (!d) throw new Error("Document is not available");
7114
+ const el = d.createElement("p");
7115
+ el.innerHTML = html.trim();
7116
+ if (options?.attrs) {
7117
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7118
+ }
7119
+ return el;
7120
+ };
7121
+ var htmlHeadingElement = (level, html, options) => {
7122
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7123
+ if (!d) throw new Error("Document is not available");
7124
+ const el = d.createElement(`h${level}`);
7125
+ el.innerHTML = html.trim();
7126
+ if (options?.attrs) {
7127
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7128
+ }
7129
+ return el;
7130
+ };
7131
+ var htmlSectionElement = (options) => {
7132
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7133
+ if (!d) throw new Error("Document is not available");
7134
+ const el = d.createElement("section");
7135
+ if (options?.attrs) {
7136
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7137
+ }
7138
+ return el;
7139
+ };
7140
+ var htmlArticleElement = (options) => {
7141
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7142
+ if (!d) throw new Error("Document is not available");
7143
+ const el = d.createElement("article");
7144
+ if (options?.attrs) {
7145
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7146
+ }
7147
+ return el;
7148
+ };
6576
7149
  var SwcUtils;
6577
7150
  ((SwcUtils2) => {
6578
7151
  SwcUtils2.getHelperSet = (win) => {
@@ -6635,7 +7208,7 @@ var dooboostoreSimpleWebComponent = (() => {
6635
7208
  };
6636
7209
  SwcUtils2.getAppHosts = (el) => {
6637
7210
  const hosts = (0, SwcUtils2.getHosts)(el);
6638
- return hosts.filter((host) => host.tagName.toLowerCase() === "swc-app" || host.getAttribute("is")?.startsWith("swc-app-"));
7211
+ return hosts.filter((host2) => host2.tagName.toLowerCase() === "swc-app" || host2.getAttribute("is")?.startsWith("swc-app-"));
6639
7212
  };
6640
7213
  SwcUtils2.getAppHost = (el) => {
6641
7214
  const appHosts = (0, SwcUtils2.getAppHosts)(el);
@@ -6892,9 +7465,9 @@ var dooboostoreSimpleWebComponent = (() => {
6892
7465
  if (!(node instanceof HTMLElement)) continue;
6893
7466
  const script = node.getAttribute?.(attrName);
6894
7467
  if (script && !getElementConfig(node)) {
6895
- const host = SwcUtils.findNearestSwcHost(node);
6896
- if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
6897
- await host.__swc_executeAttributeEvent(node, attrName, script, event);
7468
+ const host2 = SwcUtils.findNearestSwcHost(node);
7469
+ if (host2 && host2.isConnected && typeof host2.__swc_executeAttributeEvent === "function") {
7470
+ await host2.__swc_executeAttributeEvent(node, attrName, script, event);
6898
7471
  event.__swc_handled = true;
6899
7472
  break;
6900
7473
  }
@@ -8092,69 +8665,6 @@ var dooboostoreSimpleWebComponent = (() => {
8092
8665
  return /Mobi/i.test(targetWindow.navigator.userAgent);
8093
8666
  };
8094
8667
  })(ValidUtils2 || (ValidUtils2 = {}));
8095
-
8096
- // src/utils/TemplateUtils.ts
8097
- var TemplateUtils;
8098
- ((TemplateUtils2) => {
8099
- TemplateUtils2.htmlFragment = (strings, ...values) => {
8100
- const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8101
- const template = document.createElement("template");
8102
- template.innerHTML = raw.trim();
8103
- return template.content;
8104
- };
8105
- TemplateUtils2.textNode = (strings, ...values) => {
8106
- const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8107
- return document.createTextNode(raw);
8108
- };
8109
- TemplateUtils2.createElement = (info, attrs = {}) => {
8110
- const el = document.createElement(info.tagName);
8111
- if (info.innerHtml !== void 0) el.innerHTML = info.innerHtml;
8112
- Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
8113
- return el;
8114
- };
8115
- const createTagFunction = (tagName) => {
8116
- return (strings, ...values) => {
8117
- const el = document.createElement(tagName);
8118
- el.innerHTML = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8119
- return el;
8120
- };
8121
- };
8122
- TemplateUtils2.htmlDivElement = createTagFunction("div");
8123
- TemplateUtils2.htmlSpanElement = createTagFunction("span");
8124
- TemplateUtils2.htmlButtonElement = createTagFunction("button");
8125
- TemplateUtils2.htmlUlElement = createTagFunction("ul");
8126
- TemplateUtils2.htmlLiElement = createTagFunction("li");
8127
- TemplateUtils2.htmlInputElement = createTagFunction("input");
8128
- TemplateUtils2.htmlAElement = createTagFunction("a");
8129
- TemplateUtils2.htmlPElement = createTagFunction("p");
8130
- TemplateUtils2.htmlH1Element = createTagFunction("h1");
8131
- TemplateUtils2.htmlH2Element = createTagFunction("h2");
8132
- TemplateUtils2.htmlH3Element = createTagFunction("h3");
8133
- TemplateUtils2.htmlH4Element = createTagFunction("h4");
8134
- TemplateUtils2.htmlH5Element = createTagFunction("h5");
8135
- TemplateUtils2.htmlH6Element = createTagFunction("h6");
8136
- TemplateUtils2.htmlSectionElement = createTagFunction("section");
8137
- TemplateUtils2.htmlArticleElement = createTagFunction("article");
8138
- })(TemplateUtils || (TemplateUtils = {}));
8139
- var htmlFragment = TemplateUtils.htmlFragment;
8140
- var textNode = TemplateUtils.textNode;
8141
- var createElement = TemplateUtils.createElement;
8142
- var htmlDivElement = TemplateUtils.htmlDivElement;
8143
- var htmlSpanElement = TemplateUtils.htmlSpanElement;
8144
- var htmlButtonElement = TemplateUtils.htmlButtonElement;
8145
- var htmlUlElement = TemplateUtils.htmlUlElement;
8146
- var htmlLiElement = TemplateUtils.htmlLiElement;
8147
- var htmlInputElement = TemplateUtils.htmlInputElement;
8148
- var htmlAElement = TemplateUtils.htmlAElement;
8149
- var htmlPElement = TemplateUtils.htmlPElement;
8150
- var htmlH1Element = TemplateUtils.htmlH1Element;
8151
- var htmlH2Element = TemplateUtils.htmlH2Element;
8152
- var htmlH3Element = TemplateUtils.htmlH3Element;
8153
- var htmlH4Element = TemplateUtils.htmlH4Element;
8154
- var htmlH5Element = TemplateUtils.htmlH5Element;
8155
- var htmlH6Element = TemplateUtils.htmlH6Element;
8156
- var htmlSectionElement = TemplateUtils.htmlSectionElement;
8157
- var htmlArticleElement = TemplateUtils.htmlArticleElement;
8158
8668
  return __toCommonJS(bundle_entry_exports);
8159
8669
  })();
8160
8670
  /*! Bundled license information: