@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
@@ -5715,30 +5715,6 @@ var Expression;
5715
5715
  })(Path = Expression2.Path || (Expression2.Path = {}));
5716
5716
  })(Expression || (Expression = {}));
5717
5717
 
5718
- // src/decorators/onConnectedInnerHtml.ts
5719
- var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
5720
- function onConnectedInnerHtml(arg1, arg2, arg3) {
5721
- const decorator = (options, target, propertyKey) => {
5722
- const constructor = target.constructor;
5723
- let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5724
- if (!list) {
5725
- list = [];
5726
- ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
5727
- }
5728
- list.push({ propertyKey, options });
5729
- };
5730
- if (arg2) {
5731
- return decorator({}, arg1, arg2);
5732
- }
5733
- return (target, propertyKey) => {
5734
- decorator(arg1 || {}, target, propertyKey);
5735
- };
5736
- }
5737
- var getOnConnectedInnerHtmlMetadata = (target) => {
5738
- const constructor = target instanceof Function ? target : target.constructor;
5739
- return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5740
- };
5741
-
5742
5718
  // src/decorators/addEventListener.ts
5743
5719
  var ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:add-event-listener");
5744
5720
  function addEventListener(selectorOrTarget, type, options = {}) {
@@ -5769,6 +5745,7 @@ var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-d
5769
5745
  var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-before-adopted");
5770
5746
  var ON_AFTER_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-after-adopted");
5771
5747
  var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:on-add-event-listener");
5748
+ var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
5772
5749
  var ATTRIBUTE_CHANGED_WILDCARD = "*";
5773
5750
  function createLifecycleDecorator(metadataKey) {
5774
5751
  return (target, propertyKey) => {
@@ -5792,10 +5769,31 @@ var onBeforeAdopted = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
5792
5769
  var onAfterAdopted = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
5793
5770
  var onAdopted = onAfterAdopted;
5794
5771
  var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
5772
+ function onConnectedInnerHtml(arg1, arg2, arg3) {
5773
+ const decorator = (options, target, propertyKey) => {
5774
+ const constructor = target.constructor;
5775
+ let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5776
+ if (!list) {
5777
+ list = [];
5778
+ ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
5779
+ }
5780
+ list.push({ propertyKey, options });
5781
+ };
5782
+ if (arg2) {
5783
+ return decorator({}, arg1, arg2);
5784
+ }
5785
+ return (target, propertyKey) => {
5786
+ decorator(arg1 || {}, target, propertyKey);
5787
+ };
5788
+ }
5795
5789
  var findAllLifecycleMetadata = (target, metadataKey) => {
5796
5790
  const results = ReflectUtils.findAllMetadataFlatten(metadataKey, target);
5797
5791
  return results.length > 0 ? results : void 0;
5798
5792
  };
5793
+ var getOnConnectedInnerHtmlMetadata = (target) => {
5794
+ const constructor = target instanceof Function ? target : target.constructor;
5795
+ return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
5796
+ };
5799
5797
 
5800
5798
  // src/decorators/attribute.ts
5801
5799
  var ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:attribute");
@@ -5899,7 +5897,6 @@ function attribute(selector, options = {}) {
5899
5897
  },
5900
5898
  set(nv) {
5901
5899
  const targetType = options.type || designType;
5902
- console.log("---set", propertyKey, targetType, nv, this, this.__swc_syncing_init);
5903
5900
  const attrName = options.name || String(propertyKey);
5904
5901
  const conf = getElementConfig(this);
5905
5902
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
@@ -5927,8 +5924,27 @@ function attribute(selector, options = {}) {
5927
5924
  var findAllAttributeMetadata = (target) => {
5928
5925
  return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, target).flat();
5929
5926
  };
5930
- function attributeHost(attrName, options = {}) {
5931
- return attribute(":host", { ...options, name: attrName });
5927
+ function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
5928
+ if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
5929
+ const fieldName = String(propertyKeyOrOptions);
5930
+ return attribute(":host", { name: fieldName })(targetOrAttrOrOptions, propertyKeyOrOptions);
5931
+ }
5932
+ if (typeof targetOrAttrOrOptions === "string") {
5933
+ const attrName = targetOrAttrOrOptions;
5934
+ const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
5935
+ return attribute(":host", { ...options, name: attrName });
5936
+ } else if (typeof targetOrAttrOrOptions === "object") {
5937
+ const options = targetOrAttrOrOptions;
5938
+ return (target, propertyKey) => {
5939
+ const fieldName = String(propertyKey);
5940
+ return attribute(":host", { ...options, name: fieldName })(target, propertyKey);
5941
+ };
5942
+ } else {
5943
+ return (target, propertyKey) => {
5944
+ const fieldName = String(propertyKey);
5945
+ return attribute(":host", { name: fieldName })(target, propertyKey);
5946
+ };
5947
+ }
5932
5948
  }
5933
5949
 
5934
5950
  // src/decorators/changedAttributeHost.ts
@@ -5982,11 +5998,11 @@ function setAttribute(selector, name, options = {}) {
5982
5998
  const applyRoot = (t) => {
5983
5999
  if (!t) return;
5984
6000
  if (r === "auto") {
5985
- targetEls.push(t.shadowRoot || t);
5986
- return;
6001
+ targetEls.push(t);
6002
+ } else {
6003
+ if (r === "light" || r === "all") targetEls.push(t);
6004
+ if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
5987
6005
  }
5988
- if (r === "light" || r === "all") targetEls.push(t);
5989
- if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
5990
6006
  };
5991
6007
  if (selector === ":window") targetEls.push(currentWin);
5992
6008
  else if (selector === ":document") targetEls.push(currentWin.document);
@@ -6068,32 +6084,83 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
6068
6084
  const conf = getElementConfig(this);
6069
6085
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6070
6086
  const currentDoc = currentWin.document;
6071
- let targetEl = null;
6072
- if (selector === ":host" || !selector) {
6073
- targetEl = this;
6087
+ const pos = options.position || "beforeEnd";
6088
+ const r = options.root || "auto";
6089
+ const applyRoot = (t) => {
6090
+ if (!t || !(t instanceof HTMLElement))
6091
+ return t;
6092
+ if (r === "auto")
6093
+ return t.shadowRoot || t;
6094
+ if (r === "shadow")
6095
+ return t.shadowRoot;
6096
+ if (r === "light")
6097
+ return t;
6098
+ if (r === "all")
6099
+ return t.shadowRoot || t;
6100
+ return t;
6101
+ };
6102
+ const hostSet = SwcUtils.getHostSet(this);
6103
+ if (pos === "remove") {
6104
+ if (res) {
6105
+ if (selector === ":host" || !selector) {
6106
+ if (r === "shadow" && this.shadowRoot) {
6107
+ this.shadowRoot.replaceChildren();
6108
+ } else {
6109
+ this.remove();
6110
+ }
6111
+ } else {
6112
+ const targetRoot = applyRoot(this);
6113
+ if (targetRoot) {
6114
+ const targets = targetRoot.querySelectorAll(selector);
6115
+ targets.forEach((el) => el.remove());
6116
+ }
6117
+ }
6118
+ }
6074
6119
  } else {
6075
- targetEl = (this.shadowRoot || this).querySelector(selector);
6076
- }
6077
- if (targetEl) {
6078
- const nodes = normalizeNodes(res, currentDoc);
6079
- const pos = options.position || "beforeEnd";
6080
- if (pos === "replace") {
6081
- targetEl.replaceWith(...nodes);
6082
- } else if (pos === "replaceChildren") {
6083
- targetEl.replaceChildren(...nodes);
6084
- } else if (pos === "innerHtml") {
6085
- targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6086
- } else if (pos === "innerText") {
6087
- targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6120
+ let targetEl = null;
6121
+ if (selector === ":host") {
6122
+ targetEl = applyRoot(this);
6123
+ } else if (selector === ":parentHost") {
6124
+ targetEl = applyRoot(hostSet.$parentHost);
6125
+ } else if (selector === ":appHost") {
6126
+ targetEl = applyRoot(hostSet.$appHost);
6127
+ } else if (selector === ":firstHost") {
6128
+ targetEl = applyRoot(hostSet.$firstHost);
6129
+ } else if (selector === ":lastHost") {
6130
+ targetEl = applyRoot(hostSet.$lastHost);
6131
+ } else if (selector === ":firstAppHost") {
6132
+ targetEl = applyRoot(hostSet.$firstHost);
6133
+ } else if (selector === ":lastAppHost") {
6134
+ targetEl = applyRoot(hostSet.$lastAppHost);
6088
6135
  } else {
6089
- if (pos === "beforeEnd")
6090
- targetEl.append(...nodes);
6091
- else if (pos === "afterBegin")
6092
- targetEl.prepend(...nodes);
6093
- else if (pos === "beforeBegin")
6094
- targetEl.before(...nodes);
6095
- else if (pos === "afterEnd")
6096
- targetEl.after(...nodes);
6136
+ const targetRoot = applyRoot(this);
6137
+ targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
6138
+ }
6139
+ if (targetEl) {
6140
+ const isShadowRoot = targetEl instanceof ShadowRoot;
6141
+ const nodes = normalizeNodes(res, currentDoc);
6142
+ if (pos === "replace") {
6143
+ if (!isShadowRoot) {
6144
+ targetEl.replaceWith(...nodes);
6145
+ }
6146
+ } else if (pos === "replaceChildren") {
6147
+ targetEl.replaceChildren(...nodes);
6148
+ } else if (pos === "innerHtml") {
6149
+ targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6150
+ } else if (pos === "innerText") {
6151
+ if (targetEl.innerText !== void 0) {
6152
+ targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6153
+ }
6154
+ } else {
6155
+ if (pos === "beforeEnd")
6156
+ targetEl.append(...nodes);
6157
+ else if (pos === "afterBegin")
6158
+ targetEl.prepend(...nodes);
6159
+ else if (pos === "beforeBegin" && !isShadowRoot)
6160
+ targetEl.before(...nodes);
6161
+ else if (pos === "afterEnd" && !isShadowRoot)
6162
+ targetEl.after(...nodes);
6163
+ }
6097
6164
  }
6098
6165
  }
6099
6166
  }
@@ -6111,8 +6178,107 @@ var findAllApplyNodeMetadata = (target) => {
6111
6178
  });
6112
6179
  return result;
6113
6180
  };
6114
- function applyNodeHost(options = { position: "beforeEnd" }) {
6115
- return applyNode(":host", options);
6181
+ function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
6182
+ console.log("vvvvv");
6183
+ if (propertyKey !== void 0 && typeof propertyKey === "string" || typeof propertyKey === "symbol") {
6184
+ return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
6185
+ }
6186
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6187
+ const options = targetOrOptions;
6188
+ return applyNode(":host", { ...options, position: options.position || "beforeEnd" });
6189
+ } else {
6190
+ return applyNode(":host", { position: "beforeEnd" });
6191
+ }
6192
+ }
6193
+ function applyBeforeBeginNode(selector, options) {
6194
+ return applyNode(selector, { ...options, position: "beforeBegin" });
6195
+ }
6196
+ function applyAfterBeginNode(selector, options) {
6197
+ return applyNode(selector, { ...options, position: "afterBegin" });
6198
+ }
6199
+ function applyBeforeEndNode(selector, options) {
6200
+ return applyNode(selector, { ...options, position: "beforeEnd" });
6201
+ }
6202
+ function applyAfterEndNode(selector, options) {
6203
+ return applyNode(selector, { ...options, position: "afterEnd" });
6204
+ }
6205
+ function applyReplaceNode(selector, options) {
6206
+ return applyNode(selector, { ...options, position: "replace" });
6207
+ }
6208
+ function applyReplaceChildrenNode(selector, options) {
6209
+ return applyNode(selector, { ...options, position: "replaceChildren" });
6210
+ }
6211
+ function applyInnerHtmlNode(selector, options) {
6212
+ return applyNode(selector, { ...options, position: "innerHtml" });
6213
+ }
6214
+ function applyInnerTextNode(selector, options) {
6215
+ return applyNode(selector, { ...options, position: "innerText" });
6216
+ }
6217
+ function applyRemoveNode(selector, options) {
6218
+ return applyNode(selector, { ...options, position: "remove" });
6219
+ }
6220
+ function applyBeforeBeginNodeHost(targetOrOptions, propertyKey, descriptor) {
6221
+ if (propertyKey !== void 0) {
6222
+ const decorator = applyNode(":host", { position: "beforeBegin" });
6223
+ return decorator(targetOrOptions, propertyKey, descriptor);
6224
+ }
6225
+ return applyNode(":host", { ...targetOrOptions || {}, position: "beforeBegin" });
6226
+ }
6227
+ function applyAfterBeginNodeHost(optionsOrTarget, propertyKey, descriptor) {
6228
+ if (propertyKey !== void 0) {
6229
+ const decorator = applyNode(":host", { position: "afterBegin" });
6230
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6231
+ }
6232
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "afterBegin" });
6233
+ }
6234
+ function applyBeforeEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
6235
+ if (propertyKey !== void 0) {
6236
+ const decorator = applyNode(":host", { position: "beforeEnd" });
6237
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6238
+ }
6239
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "beforeEnd" });
6240
+ }
6241
+ function applyAfterEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
6242
+ if (propertyKey !== void 0) {
6243
+ const decorator = applyNode(":host", { position: "afterEnd" });
6244
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6245
+ }
6246
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "afterEnd" });
6247
+ }
6248
+ function applyReplaceNodeHost(optionsOrTarget, propertyKey, descriptor) {
6249
+ if (propertyKey !== void 0) {
6250
+ const decorator = applyNode(":host", { position: "replace" });
6251
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6252
+ }
6253
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "replace" });
6254
+ }
6255
+ function applyReplaceChildrenNodeHost(optionsOrTarget, propertyKey, descriptor) {
6256
+ if (propertyKey !== void 0) {
6257
+ const decorator = applyNode(":host", { position: "replaceChildren" });
6258
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6259
+ }
6260
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "replaceChildren" });
6261
+ }
6262
+ function applyInnerHtmlNodeHost(optionsOrTarget, propertyKey, descriptor) {
6263
+ if (propertyKey !== void 0) {
6264
+ const decorator = applyNode(":host", { position: "innerHtml" });
6265
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6266
+ }
6267
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "innerHtml" });
6268
+ }
6269
+ function applyInnerTextNodeHost(optionsOrTarget, propertyKey, descriptor) {
6270
+ if (propertyKey !== void 0) {
6271
+ const decorator = applyNode(":host", { position: "innerText" });
6272
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6273
+ }
6274
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "innerText" });
6275
+ }
6276
+ function applyRemoveNodeHost(optionsOrTarget, propertyKey, descriptor) {
6277
+ if (propertyKey !== void 0) {
6278
+ const decorator = applyNode(":host", { position: "remove" });
6279
+ return decorator(optionsOrTarget, propertyKey, descriptor);
6280
+ }
6281
+ return applyNode(":host", { ...optionsOrTarget || {}, position: "remove" });
6116
6282
  }
6117
6283
 
6118
6284
  // src/decorators/query.ts
@@ -6214,8 +6380,76 @@ var getQueryMetadata = (target) => {
6214
6380
  const constructor = target instanceof Function ? target : target.constructor;
6215
6381
  return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6216
6382
  };
6217
- function queryHost(options) {
6218
- return query(":host", options);
6383
+ function queryHost(targetOrOptions, propertyKey) {
6384
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6385
+ return query(":host", {})(targetOrOptions, propertyKey);
6386
+ }
6387
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6388
+ return query(":host", targetOrOptions);
6389
+ } else {
6390
+ return query(":host", {});
6391
+ }
6392
+ }
6393
+ var host = queryHost;
6394
+ function parentHost(targetOrOptions, propertyKey) {
6395
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6396
+ return query(":parentHost", {})(targetOrOptions, propertyKey);
6397
+ }
6398
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6399
+ return query(":parentHost", targetOrOptions);
6400
+ } else {
6401
+ return query(":parentHost", {});
6402
+ }
6403
+ }
6404
+ function appHost(targetOrOptions, propertyKey) {
6405
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6406
+ return query(":appHost", {})(targetOrOptions, propertyKey);
6407
+ }
6408
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6409
+ return query(":appHost", targetOrOptions);
6410
+ } else {
6411
+ return query(":appHost", {});
6412
+ }
6413
+ }
6414
+ function firstHost(targetOrOptions, propertyKey) {
6415
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6416
+ return query(":firstHost", {})(targetOrOptions, propertyKey);
6417
+ }
6418
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6419
+ return query(":firstHost", targetOrOptions);
6420
+ } else {
6421
+ return query(":firstHost", {});
6422
+ }
6423
+ }
6424
+ function lastHost(targetOrOptions, propertyKey) {
6425
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6426
+ return query(":lastHost", {})(targetOrOptions, propertyKey);
6427
+ }
6428
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6429
+ return query(":lastHost", targetOrOptions);
6430
+ } else {
6431
+ return query(":lastHost", {});
6432
+ }
6433
+ }
6434
+ function firstAppHost(targetOrOptions, propertyKey) {
6435
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6436
+ return query(":firstAppHost", {})(targetOrOptions, propertyKey);
6437
+ }
6438
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6439
+ return query(":firstAppHost", targetOrOptions);
6440
+ } else {
6441
+ return query(":firstAppHost", {});
6442
+ }
6443
+ }
6444
+ function lastAppHost(targetOrOptions, propertyKey) {
6445
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6446
+ return query(":lastAppHost", {})(targetOrOptions, propertyKey);
6447
+ }
6448
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6449
+ return query(":lastAppHost", targetOrOptions);
6450
+ } else {
6451
+ return query(":lastAppHost", {});
6452
+ }
6219
6453
  }
6220
6454
 
6221
6455
  // src/decorators/queryAll.ts
@@ -6314,14 +6548,82 @@ var getQueryAllMetadata = (target) => {
6314
6548
  const constructor = target instanceof Function ? target : target.constructor;
6315
6549
  return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6316
6550
  };
6317
- function queryAllHost(options) {
6318
- return queryAll(":host", options);
6551
+ function queryAllHost(targetOrOptions, propertyKey) {
6552
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6553
+ return queryAll(":host", {})(targetOrOptions, propertyKey);
6554
+ }
6555
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6556
+ return queryAll(":host", targetOrOptions);
6557
+ } else {
6558
+ return queryAll(":host", {});
6559
+ }
6560
+ }
6561
+ var allHost = queryAllHost;
6562
+ function allParentHost(targetOrOptions, propertyKey) {
6563
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6564
+ return queryAll(":parentHost", {})(targetOrOptions, propertyKey);
6565
+ }
6566
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6567
+ return queryAll(":parentHost", targetOrOptions);
6568
+ } else {
6569
+ return queryAll(":parentHost", {});
6570
+ }
6571
+ }
6572
+ function allAppHost(targetOrOptions, propertyKey) {
6573
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6574
+ return queryAll(":appHost", {})(targetOrOptions, propertyKey);
6575
+ }
6576
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6577
+ return queryAll(":appHost", targetOrOptions);
6578
+ } else {
6579
+ return queryAll(":appHost", {});
6580
+ }
6581
+ }
6582
+ function allFirstHost(targetOrOptions, propertyKey) {
6583
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6584
+ return queryAll(":firstHost", {})(targetOrOptions, propertyKey);
6585
+ }
6586
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6587
+ return queryAll(":firstHost", targetOrOptions);
6588
+ } else {
6589
+ return queryAll(":firstHost", {});
6590
+ }
6591
+ }
6592
+ function allLastHost(targetOrOptions, propertyKey) {
6593
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6594
+ return queryAll(":lastHost", {})(targetOrOptions, propertyKey);
6595
+ }
6596
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6597
+ return queryAll(":lastHost", targetOrOptions);
6598
+ } else {
6599
+ return queryAll(":lastHost", {});
6600
+ }
6601
+ }
6602
+ function allFirstAppHost(targetOrOptions, propertyKey) {
6603
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6604
+ return queryAll(":firstAppHost", {})(targetOrOptions, propertyKey);
6605
+ }
6606
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6607
+ return queryAll(":firstAppHost", targetOrOptions);
6608
+ } else {
6609
+ return queryAll(":firstAppHost", {});
6610
+ }
6611
+ }
6612
+ function allLastAppHost(targetOrOptions, propertyKey) {
6613
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6614
+ return queryAll(":lastAppHost", {})(targetOrOptions, propertyKey);
6615
+ }
6616
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6617
+ return queryAll(":lastAppHost", targetOrOptions);
6618
+ } else {
6619
+ return queryAll(":lastAppHost", {});
6620
+ }
6319
6621
  }
6320
6622
 
6321
6623
  // src/decorators/classList.ts
6322
6624
  var CLASS_LIST_METADATA_KEY = Symbol("simple-web-component:class-list");
6323
6625
  function createClassListDecorator(action) {
6324
- return (selector) => {
6626
+ return (selector, options = {}) => {
6325
6627
  return (target, propertyKey, descriptor) => {
6326
6628
  const constructor = target.constructor;
6327
6629
  let metaList = ReflectUtils.getOwnMetadata(CLASS_LIST_METADATA_KEY, constructor);
@@ -6329,19 +6631,52 @@ function createClassListDecorator(action) {
6329
6631
  metaList = /* @__PURE__ */ new Map();
6330
6632
  ReflectUtils.defineMetadata(CLASS_LIST_METADATA_KEY, metaList, constructor);
6331
6633
  }
6332
- metaList.set(propertyKey, { propertyKey, selector, action });
6634
+ metaList.set(propertyKey, { propertyKey, selector, action, options });
6333
6635
  const original = descriptor.value;
6334
6636
  descriptor.value = async function(...args) {
6335
6637
  ensureInit2(this);
6336
6638
  const res = await original.apply(this, args);
6337
6639
  if (res !== void 0) {
6640
+ const r = options.root || "auto";
6338
6641
  const hostSet = SwcUtils.getHostSet(this);
6339
- let targetEl = null;
6340
- if (selector === ":host" || !selector) targetEl = this;
6341
- else if (selector === ":parentHost") targetEl = hostSet.$parentHost;
6342
- else if (selector === ":appHost") targetEl = hostSet.$appHost;
6343
- else targetEl = (this.shadowRoot || this).querySelector(selector);
6344
- if (targetEl) {
6642
+ const targetEls = [];
6643
+ const applyRoot = (t) => {
6644
+ if (!t || !(t instanceof HTMLElement)) return;
6645
+ if (r === "auto") {
6646
+ targetEls.push(t);
6647
+ } else {
6648
+ if (r === "light" || r === "all") targetEls.push(t);
6649
+ if ((r === "shadow" || r === "all") && t.shadowRoot) {
6650
+ }
6651
+ }
6652
+ };
6653
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6654
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6655
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6656
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6657
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6658
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6659
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6660
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6661
+ else if (selector === ":host" || !selector) applyRoot(this);
6662
+ else {
6663
+ if (r === "shadow") {
6664
+ const found = this.shadowRoot?.querySelectorAll(selector);
6665
+ if (found) targetEls.push(...Array.from(found));
6666
+ } else if (r === "light") {
6667
+ const found = this.querySelectorAll(selector);
6668
+ if (found) targetEls.push(...Array.from(found));
6669
+ } else if (r === "all") {
6670
+ const sFound = this.shadowRoot?.querySelectorAll(selector);
6671
+ const lFound = this.querySelectorAll(selector);
6672
+ if (sFound) targetEls.push(...Array.from(sFound));
6673
+ if (lFound) targetEls.push(...Array.from(lFound));
6674
+ } else {
6675
+ const found = (this.shadowRoot || this).querySelectorAll(selector);
6676
+ if (found) targetEls.push(...Array.from(found));
6677
+ }
6678
+ }
6679
+ targetEls.forEach((targetEl) => {
6345
6680
  if (action === "set") {
6346
6681
  let classes = "";
6347
6682
  if (typeof res === "object" && res !== null && !Array.isArray(res)) {
@@ -6369,23 +6704,53 @@ function createClassListDecorator(action) {
6369
6704
  const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6370
6705
  classes.forEach((c) => targetEl.classList.toggle(c));
6371
6706
  }
6372
- }
6707
+ });
6373
6708
  }
6374
6709
  return res;
6375
6710
  };
6376
6711
  };
6377
6712
  };
6378
6713
  }
6379
- var setClassList = createClassListDecorator("set");
6380
- var updateClassList = createClassListDecorator("update");
6381
- var addClassList = createClassListDecorator("add");
6382
- var removeClassList = createClassListDecorator("remove");
6383
- var toggleClassList = createClassListDecorator("toggle");
6384
- var setClassListHost = createClassListDecorator("set").bind(null, ":host");
6385
- var updateClassListHost = createClassListDecorator("update").bind(null, ":host");
6386
- var addClassListHost = createClassListDecorator("add").bind(null, ":host");
6387
- var removeClassListHost = createClassListDecorator("remove").bind(null, ":host");
6388
- var toggleClassListHost = createClassListDecorator("toggle").bind(null, ":host");
6714
+ var setClassList = (selector, options = {}) => createClassListDecorator("set")(selector, options);
6715
+ var updateClassList = (selector, options = {}) => createClassListDecorator("update")(selector, options);
6716
+ var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
6717
+ var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
6718
+ var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
6719
+ function setClassListHost(targetOrOptions, propertyKey, descriptor) {
6720
+ if (propertyKey !== void 0) {
6721
+ const decorator = createClassListDecorator("set")(":host", {});
6722
+ return decorator(targetOrOptions, propertyKey, descriptor);
6723
+ }
6724
+ return createClassListDecorator("set")(":host", targetOrOptions || {});
6725
+ }
6726
+ function updateClassListHost(targetOrOptions, propertyKey, descriptor) {
6727
+ if (propertyKey !== void 0) {
6728
+ const decorator = createClassListDecorator("update")(":host", {});
6729
+ return decorator(targetOrOptions, propertyKey, descriptor);
6730
+ }
6731
+ return createClassListDecorator("update")(":host", targetOrOptions || {});
6732
+ }
6733
+ function addClassListHost(targetOrOptions, propertyKey, descriptor) {
6734
+ if (propertyKey !== void 0) {
6735
+ const decorator = createClassListDecorator("add")(":host", {});
6736
+ return decorator(targetOrOptions, propertyKey, descriptor);
6737
+ }
6738
+ return createClassListDecorator("add")(":host", targetOrOptions || {});
6739
+ }
6740
+ function removeClassListHost(targetOrOptions, propertyKey, descriptor) {
6741
+ if (propertyKey !== void 0) {
6742
+ const decorator = createClassListDecorator("remove")(":host", {});
6743
+ return decorator(targetOrOptions, propertyKey, descriptor);
6744
+ }
6745
+ return createClassListDecorator("remove")(":host", targetOrOptions || {});
6746
+ }
6747
+ function toggleClassListHost(targetOrOptions, propertyKey, descriptor) {
6748
+ if (propertyKey !== void 0) {
6749
+ const decorator = createClassListDecorator("toggle")(":host", {});
6750
+ return decorator(targetOrOptions, propertyKey, descriptor);
6751
+ }
6752
+ return createClassListDecorator("toggle")(":host", targetOrOptions || {});
6753
+ }
6389
6754
  var findAllClassListMetadata = (target) => {
6390
6755
  const result = /* @__PURE__ */ new Map();
6391
6756
  const maps = ReflectUtils.findAllMetadata(CLASS_LIST_METADATA_KEY, target);
@@ -6400,7 +6765,7 @@ var findAllClassListMetadata = (target) => {
6400
6765
  // src/decorators/style.ts
6401
6766
  var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
6402
6767
  function createStyleDecorator(action) {
6403
- return (selector) => {
6768
+ return (selector, options = {}) => {
6404
6769
  return (target, propertyKey, descriptor) => {
6405
6770
  const constructor = target.constructor;
6406
6771
  let metaList = ReflectUtils.getOwnMetadata(STYLE_METADATA_KEY, constructor);
@@ -6408,19 +6773,52 @@ function createStyleDecorator(action) {
6408
6773
  metaList = /* @__PURE__ */ new Map();
6409
6774
  ReflectUtils.defineMetadata(STYLE_METADATA_KEY, metaList, constructor);
6410
6775
  }
6411
- metaList.set(propertyKey, { propertyKey, selector, action });
6776
+ metaList.set(propertyKey, { propertyKey, selector, action, options });
6412
6777
  const original = descriptor.value;
6413
6778
  descriptor.value = async function(...args) {
6414
6779
  ensureInit2(this);
6415
6780
  const res = await original.apply(this, args);
6416
6781
  if (res !== void 0) {
6782
+ const r = options.root || "auto";
6417
6783
  const hostSet = SwcUtils.getHostSet(this);
6418
- let targetEl = null;
6419
- if (selector === ":host" || !selector) targetEl = this;
6420
- else if (selector === ":parentHost") targetEl = hostSet.$parentHost;
6421
- else if (selector === ":appHost") targetEl = hostSet.$appHost;
6422
- else targetEl = (this.shadowRoot || this).querySelector(selector);
6423
- if (targetEl) {
6784
+ const targetEls = [];
6785
+ const applyRoot = (t) => {
6786
+ if (!t || !(t instanceof HTMLElement)) return;
6787
+ if (r === "auto") {
6788
+ targetEls.push(t);
6789
+ } else {
6790
+ if (r === "light" || r === "all") targetEls.push(t);
6791
+ if ((r === "shadow" || r === "all") && t.shadowRoot) {
6792
+ }
6793
+ }
6794
+ };
6795
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6796
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6797
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6798
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6799
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6800
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6801
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6802
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6803
+ else if (selector === ":host" || !selector) applyRoot(this);
6804
+ else {
6805
+ if (r === "shadow") {
6806
+ const found = this.shadowRoot?.querySelectorAll(selector);
6807
+ if (found) targetEls.push(...Array.from(found));
6808
+ } else if (r === "light") {
6809
+ const found = this.querySelectorAll(selector);
6810
+ if (found) targetEls.push(...Array.from(found));
6811
+ } else if (r === "all") {
6812
+ const sFound = this.shadowRoot?.querySelectorAll(selector);
6813
+ const lFound = this.querySelectorAll(selector);
6814
+ if (sFound) targetEls.push(...Array.from(sFound));
6815
+ if (lFound) targetEls.push(...Array.from(lFound));
6816
+ } else {
6817
+ const found = (this.shadowRoot || this).querySelectorAll(selector);
6818
+ if (found) targetEls.push(...Array.from(found));
6819
+ }
6820
+ }
6821
+ targetEls.forEach((targetEl) => {
6424
6822
  if (action === "set") {
6425
6823
  targetEl.style.cssText = "";
6426
6824
  if (typeof res === "object" && res !== null) {
@@ -6436,16 +6834,37 @@ function createStyleDecorator(action) {
6436
6834
  const props = Array.isArray(res) ? res : [res];
6437
6835
  props.forEach((p) => targetEl.style.removeProperty(String(p)));
6438
6836
  }
6439
- }
6837
+ });
6440
6838
  }
6441
6839
  return res;
6442
6840
  };
6443
6841
  };
6444
6842
  };
6445
6843
  }
6446
- var setStyle = createStyleDecorator("set");
6447
- var updateStyle = createStyleDecorator("update");
6448
- var removeStyle = createStyleDecorator("remove");
6844
+ var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
6845
+ function setStyleHost(targetOrOptions, propertyKey, descriptor) {
6846
+ if (propertyKey !== void 0) {
6847
+ const decorator = createStyleDecorator("set")(":host", {});
6848
+ return decorator(targetOrOptions, propertyKey, descriptor);
6849
+ }
6850
+ return createStyleDecorator("set")(":host", targetOrOptions || {});
6851
+ }
6852
+ var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
6853
+ function updateStyleHost(targetOrOptions, propertyKey, descriptor) {
6854
+ if (propertyKey !== void 0) {
6855
+ const decorator = createStyleDecorator("update")(":host", {});
6856
+ return decorator(targetOrOptions, propertyKey, descriptor);
6857
+ }
6858
+ return createStyleDecorator("update")(":host", targetOrOptions || {});
6859
+ }
6860
+ var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
6861
+ function removeStyleHost(targetOrOptions, propertyKey, descriptor) {
6862
+ if (propertyKey !== void 0) {
6863
+ const decorator = createStyleDecorator("remove")(":host", {});
6864
+ return decorator(targetOrOptions, propertyKey, descriptor);
6865
+ }
6866
+ return createStyleDecorator("remove")(":host", targetOrOptions || {});
6867
+ }
6449
6868
  var findAllStyleMetadata = (target) => {
6450
6869
  const result = /* @__PURE__ */ new Map();
6451
6870
  const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
@@ -6459,6 +6878,131 @@ var findAllStyleMetadata = (target) => {
6459
6878
 
6460
6879
  // src/utils/Utils.ts
6461
6880
  var SWC_NOT_FOUND = Symbol("SWC_NOT_FOUND");
6881
+ var htmlFragment = (html, doc) => {
6882
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
6883
+ if (!d) throw new Error("Document is not available");
6884
+ const template = d.createElement("template");
6885
+ template.innerHTML = html.trim();
6886
+ return template.content;
6887
+ };
6888
+ var textNode = (text, doc) => {
6889
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
6890
+ if (!d) throw new Error("Document is not available");
6891
+ return d.createTextNode(text !== void 0 && text !== null ? String(text) : "");
6892
+ };
6893
+ var commentNode = (comment, doc) => {
6894
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
6895
+ if (!d) throw new Error("Document is not available");
6896
+ return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
6897
+ };
6898
+ var createElement = (tagName, options) => {
6899
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6900
+ if (!d) throw new Error("Document is not available");
6901
+ const el = d.createElement(tagName);
6902
+ if (options?.html) el.innerHTML = options.html;
6903
+ if (options?.attrs) {
6904
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6905
+ }
6906
+ return el;
6907
+ };
6908
+ var htmlDivElement = (html, options) => {
6909
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6910
+ if (!d) throw new Error("Document is not available");
6911
+ const el = d.createElement("div");
6912
+ el.innerHTML = html.trim();
6913
+ if (options?.attrs) {
6914
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6915
+ }
6916
+ return el;
6917
+ };
6918
+ var htmlSpanElement = (html, options) => {
6919
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6920
+ if (!d) throw new Error("Document is not available");
6921
+ const el = d.createElement("span");
6922
+ el.innerHTML = html.trim();
6923
+ if (options?.attrs) {
6924
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6925
+ }
6926
+ return el;
6927
+ };
6928
+ var htmlButtonElement = (html, options) => {
6929
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6930
+ if (!d) throw new Error("Document is not available");
6931
+ const el = d.createElement("button");
6932
+ el.innerHTML = html.trim();
6933
+ if (options?.attrs) {
6934
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6935
+ }
6936
+ return el;
6937
+ };
6938
+ var htmlUlElement = (options) => {
6939
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6940
+ if (!d) throw new Error("Document is not available");
6941
+ const el = d.createElement("ul");
6942
+ if (options?.attrs) {
6943
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6944
+ }
6945
+ return el;
6946
+ };
6947
+ var htmlLiElement = (html, options) => {
6948
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6949
+ if (!d) throw new Error("Document is not available");
6950
+ const el = d.createElement("li");
6951
+ el.innerHTML = html.trim();
6952
+ if (options?.attrs) {
6953
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6954
+ }
6955
+ return el;
6956
+ };
6957
+ var htmlAElement = (html, options) => {
6958
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6959
+ if (!d) throw new Error("Document is not available");
6960
+ const el = d.createElement("a");
6961
+ el.innerHTML = html.trim();
6962
+ if (options?.href) el.href = options.href;
6963
+ if (options?.attrs) {
6964
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6965
+ }
6966
+ return el;
6967
+ };
6968
+ var htmlPElement = (html, options) => {
6969
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6970
+ if (!d) throw new Error("Document is not available");
6971
+ const el = d.createElement("p");
6972
+ el.innerHTML = html.trim();
6973
+ if (options?.attrs) {
6974
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6975
+ }
6976
+ return el;
6977
+ };
6978
+ var htmlHeadingElement = (level, html, options) => {
6979
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6980
+ if (!d) throw new Error("Document is not available");
6981
+ const el = d.createElement(`h${level}`);
6982
+ el.innerHTML = html.trim();
6983
+ if (options?.attrs) {
6984
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6985
+ }
6986
+ return el;
6987
+ };
6988
+ var htmlSectionElement = (options) => {
6989
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6990
+ if (!d) throw new Error("Document is not available");
6991
+ const el = d.createElement("section");
6992
+ if (options?.attrs) {
6993
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6994
+ }
6995
+ return el;
6996
+ };
6997
+ var htmlArticleElement = (options) => {
6998
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6999
+ if (!d) throw new Error("Document is not available");
7000
+ const el = d.createElement("article");
7001
+ if (options?.attrs) {
7002
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7003
+ }
7004
+ return el;
7005
+ };
6462
7006
  var SwcUtils;
6463
7007
  ((SwcUtils2) => {
6464
7008
  SwcUtils2.getHelperSet = (win) => {
@@ -6521,7 +7065,7 @@ var SwcUtils;
6521
7065
  };
6522
7066
  SwcUtils2.getAppHosts = (el) => {
6523
7067
  const hosts = (0, SwcUtils2.getHosts)(el);
6524
- return hosts.filter((host) => host.tagName.toLowerCase() === "swc-app" || host.getAttribute("is")?.startsWith("swc-app-"));
7068
+ return hosts.filter((host2) => host2.tagName.toLowerCase() === "swc-app" || host2.getAttribute("is")?.startsWith("swc-app-"));
6525
7069
  };
6526
7070
  SwcUtils2.getAppHost = (el) => {
6527
7071
  const appHosts = (0, SwcUtils2.getAppHosts)(el);
@@ -6778,9 +7322,9 @@ var handleGlobalSwcEvent = async (event) => {
6778
7322
  if (!(node instanceof HTMLElement)) continue;
6779
7323
  const script = node.getAttribute?.(attrName);
6780
7324
  if (script && !getElementConfig(node)) {
6781
- const host = SwcUtils.findNearestSwcHost(node);
6782
- if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
6783
- await host.__swc_executeAttributeEvent(node, attrName, script, event);
7325
+ const host2 = SwcUtils.findNearestSwcHost(node);
7326
+ if (host2 && host2.isConnected && typeof host2.__swc_executeAttributeEvent === "function") {
7327
+ await host2.__swc_executeAttributeEvent(node, attrName, script, event);
6784
7328
  event.__swc_handled = true;
6785
7329
  break;
6786
7330
  }
@@ -7978,69 +8522,6 @@ var ValidUtils2;
7978
8522
  return /Mobi/i.test(targetWindow.navigator.userAgent);
7979
8523
  };
7980
8524
  })(ValidUtils2 || (ValidUtils2 = {}));
7981
-
7982
- // src/utils/TemplateUtils.ts
7983
- var TemplateUtils;
7984
- ((TemplateUtils2) => {
7985
- TemplateUtils2.htmlFragment = (strings, ...values) => {
7986
- const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
7987
- const template = document.createElement("template");
7988
- template.innerHTML = raw.trim();
7989
- return template.content;
7990
- };
7991
- TemplateUtils2.textNode = (strings, ...values) => {
7992
- const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
7993
- return document.createTextNode(raw);
7994
- };
7995
- TemplateUtils2.createElement = (info, attrs = {}) => {
7996
- const el = document.createElement(info.tagName);
7997
- if (info.innerHtml !== void 0) el.innerHTML = info.innerHtml;
7998
- Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7999
- return el;
8000
- };
8001
- const createTagFunction = (tagName) => {
8002
- return (strings, ...values) => {
8003
- const el = document.createElement(tagName);
8004
- el.innerHTML = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8005
- return el;
8006
- };
8007
- };
8008
- TemplateUtils2.htmlDivElement = createTagFunction("div");
8009
- TemplateUtils2.htmlSpanElement = createTagFunction("span");
8010
- TemplateUtils2.htmlButtonElement = createTagFunction("button");
8011
- TemplateUtils2.htmlUlElement = createTagFunction("ul");
8012
- TemplateUtils2.htmlLiElement = createTagFunction("li");
8013
- TemplateUtils2.htmlInputElement = createTagFunction("input");
8014
- TemplateUtils2.htmlAElement = createTagFunction("a");
8015
- TemplateUtils2.htmlPElement = createTagFunction("p");
8016
- TemplateUtils2.htmlH1Element = createTagFunction("h1");
8017
- TemplateUtils2.htmlH2Element = createTagFunction("h2");
8018
- TemplateUtils2.htmlH3Element = createTagFunction("h3");
8019
- TemplateUtils2.htmlH4Element = createTagFunction("h4");
8020
- TemplateUtils2.htmlH5Element = createTagFunction("h5");
8021
- TemplateUtils2.htmlH6Element = createTagFunction("h6");
8022
- TemplateUtils2.htmlSectionElement = createTagFunction("section");
8023
- TemplateUtils2.htmlArticleElement = createTagFunction("article");
8024
- })(TemplateUtils || (TemplateUtils = {}));
8025
- var htmlFragment = TemplateUtils.htmlFragment;
8026
- var textNode = TemplateUtils.textNode;
8027
- var createElement = TemplateUtils.createElement;
8028
- var htmlDivElement = TemplateUtils.htmlDivElement;
8029
- var htmlSpanElement = TemplateUtils.htmlSpanElement;
8030
- var htmlButtonElement = TemplateUtils.htmlButtonElement;
8031
- var htmlUlElement = TemplateUtils.htmlUlElement;
8032
- var htmlLiElement = TemplateUtils.htmlLiElement;
8033
- var htmlInputElement = TemplateUtils.htmlInputElement;
8034
- var htmlAElement = TemplateUtils.htmlAElement;
8035
- var htmlPElement = TemplateUtils.htmlPElement;
8036
- var htmlH1Element = TemplateUtils.htmlH1Element;
8037
- var htmlH2Element = TemplateUtils.htmlH2Element;
8038
- var htmlH3Element = TemplateUtils.htmlH3Element;
8039
- var htmlH4Element = TemplateUtils.htmlH4Element;
8040
- var htmlH5Element = TemplateUtils.htmlH5Element;
8041
- var htmlH6Element = TemplateUtils.htmlH6Element;
8042
- var htmlSectionElement = TemplateUtils.htmlSectionElement;
8043
- var htmlArticleElement = TemplateUtils.htmlArticleElement;
8044
8525
  export {
8045
8526
  ADD_EVENT_LISTENER_METADATA_KEY,
8046
8527
  APPLY_NODE_METADATA_KEY,
@@ -8069,16 +8550,42 @@ export {
8069
8550
  STYLE_METADATA_KEY,
8070
8551
  SWC_NOT_FOUND,
8071
8552
  SwcUtils,
8072
- TemplateUtils,
8073
8553
  addClassList,
8074
8554
  addClassListHost,
8075
8555
  addEventListener,
8076
8556
  addEventListenerHost,
8557
+ allAppHost,
8558
+ allFirstAppHost,
8559
+ allFirstHost,
8560
+ allHost,
8561
+ allLastAppHost,
8562
+ allLastHost,
8563
+ allParentHost,
8564
+ appHost,
8565
+ applyAfterBeginNode,
8566
+ applyAfterBeginNodeHost,
8567
+ applyAfterEndNode,
8568
+ applyAfterEndNodeHost,
8569
+ applyBeforeBeginNode,
8570
+ applyBeforeBeginNodeHost,
8571
+ applyBeforeEndNode,
8572
+ applyBeforeEndNodeHost,
8573
+ applyInnerHtmlNode,
8574
+ applyInnerHtmlNodeHost,
8575
+ applyInnerTextNode,
8576
+ applyInnerTextNodeHost,
8077
8577
  applyNode,
8078
8578
  applyNodeHost,
8579
+ applyRemoveNode,
8580
+ applyRemoveNodeHost,
8581
+ applyReplaceChildrenNode,
8582
+ applyReplaceChildrenNodeHost,
8583
+ applyReplaceNode,
8584
+ applyReplaceNodeHost,
8079
8585
  attribute,
8080
8586
  attributeHost,
8081
8587
  changedAttributeHost,
8588
+ commentNode,
8082
8589
  createElement,
8083
8590
  elementDefine,
8084
8591
  emitCustomEvent,
@@ -8091,6 +8598,8 @@ export {
8091
8598
  findAllLifecycleMetadata,
8092
8599
  findAllSetAttributeMetadata,
8093
8600
  findAllStyleMetadata,
8601
+ firstAppHost,
8602
+ firstHost,
8094
8603
  getAddEventListenerMetadata,
8095
8604
  getChangedAttributeMetadata,
8096
8605
  getElementConfig,
@@ -8099,23 +8608,20 @@ export {
8099
8608
  getQueryAllMetadata,
8100
8609
  getQueryMetadata,
8101
8610
  getSetAttributeMetadata,
8611
+ host,
8102
8612
  htmlAElement,
8103
8613
  htmlArticleElement,
8104
8614
  htmlButtonElement,
8105
8615
  htmlDivElement,
8106
8616
  htmlFragment,
8107
- htmlH1Element,
8108
- htmlH2Element,
8109
- htmlH3Element,
8110
- htmlH4Element,
8111
- htmlH5Element,
8112
- htmlH6Element,
8113
- htmlInputElement,
8617
+ htmlHeadingElement,
8114
8618
  htmlLiElement,
8115
8619
  htmlPElement,
8116
8620
  htmlSectionElement,
8117
8621
  htmlSpanElement,
8118
8622
  htmlUlElement,
8623
+ lastAppHost,
8624
+ lastHost,
8119
8625
  onAddEventListener,
8120
8626
  onAdopted,
8121
8627
  onAfterAdopted,
@@ -8128,6 +8634,7 @@ export {
8128
8634
  onConnectedInnerHtml,
8129
8635
  onConstructor,
8130
8636
  onDisconnected,
8637
+ parentHost,
8131
8638
  query,
8132
8639
  queryAll,
8133
8640
  queryAllHost,
@@ -8135,18 +8642,21 @@ export {
8135
8642
  removeClassList,
8136
8643
  removeClassListHost,
8137
8644
  removeStyle,
8645
+ removeStyleHost,
8138
8646
  resolveTargetEls,
8139
8647
  setAttribute,
8140
8648
  setAttributeHost,
8141
8649
  setClassList,
8142
8650
  setClassListHost,
8143
8651
  setStyle,
8652
+ setStyleHost,
8144
8653
  textNode,
8145
8654
  toggleClassList,
8146
8655
  toggleClassListHost,
8147
8656
  updateClassList,
8148
8657
  updateClassListHost,
8149
- updateStyle
8658
+ updateStyle,
8659
+ updateStyleHost
8150
8660
  };
8151
8661
  /*! Bundled license information:
8152
8662