@dooboostore/simple-web-component 1.0.22 → 1.0.23

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 (71) hide show
  1. package/README.md +361 -19
  2. package/dist/cjs/decorators/applyNode.js +98 -24
  3. package/dist/cjs/decorators/applyNode.js.map +2 -2
  4. package/dist/cjs/decorators/attribute.js +0 -1
  5. package/dist/cjs/decorators/attribute.js.map +2 -2
  6. package/dist/cjs/decorators/classList.js +39 -19
  7. package/dist/cjs/decorators/classList.js.map +2 -2
  8. package/dist/cjs/decorators/elementDefine.js +1 -2
  9. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  10. package/dist/cjs/decorators/index.js +0 -1
  11. package/dist/cjs/decorators/index.js.map +2 -2
  12. package/dist/cjs/decorators/lifecycles.js +25 -0
  13. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  14. package/dist/cjs/decorators/query.js.map +2 -2
  15. package/dist/cjs/decorators/style.js +39 -13
  16. package/dist/cjs/decorators/style.js.map +2 -2
  17. package/dist/cjs/utils/TemplateUtils.js +6 -0
  18. package/dist/cjs/utils/TemplateUtils.js.map +2 -2
  19. package/dist/esm/decorators/applyNode.js +98 -24
  20. package/dist/esm/decorators/applyNode.js.map +2 -2
  21. package/dist/esm/decorators/attribute.js +0 -1
  22. package/dist/esm/decorators/attribute.js.map +2 -2
  23. package/dist/esm/decorators/classList.js +39 -19
  24. package/dist/esm/decorators/classList.js.map +2 -2
  25. package/dist/esm/decorators/elementDefine.js +1 -2
  26. package/dist/esm/decorators/elementDefine.js.map +2 -2
  27. package/dist/esm/decorators/index.js +0 -1
  28. package/dist/esm/decorators/index.js.map +2 -2
  29. package/dist/esm/decorators/lifecycles.js +25 -0
  30. package/dist/esm/decorators/lifecycles.js.map +2 -2
  31. package/dist/esm/decorators/query.js.map +2 -2
  32. package/dist/esm/decorators/style.js +39 -13
  33. package/dist/esm/decorators/style.js.map +2 -2
  34. package/dist/esm/utils/TemplateUtils.js +6 -0
  35. package/dist/esm/utils/TemplateUtils.js.map +2 -2
  36. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +204 -81
  37. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
  38. package/dist/types/decorators/applyNode.d.ts +84 -1
  39. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  40. package/dist/types/decorators/classList.d.ts +12 -10
  41. package/dist/types/decorators/classList.d.ts.map +1 -1
  42. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  43. package/dist/types/decorators/index.d.ts +0 -1
  44. package/dist/types/decorators/index.d.ts.map +1 -1
  45. package/dist/types/decorators/lifecycles.d.ts +14 -0
  46. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  47. package/dist/types/decorators/query.d.ts +0 -3
  48. package/dist/types/decorators/query.d.ts.map +1 -1
  49. package/dist/types/decorators/style.d.ts +28 -3
  50. package/dist/types/decorators/style.d.ts.map +1 -1
  51. package/dist/types/utils/TemplateUtils.d.ts +5 -0
  52. package/dist/types/utils/TemplateUtils.d.ts.map +1 -1
  53. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +204 -81
  54. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
  55. package/package.json +3 -3
  56. package/src/decorators/applyNode.ts +199 -36
  57. package/src/decorators/attribute.ts +1 -1
  58. package/src/decorators/classList.ts +45 -22
  59. package/src/decorators/elementDefine.ts +1 -2
  60. package/src/decorators/index.ts +0 -1
  61. package/src/decorators/lifecycles.ts +40 -0
  62. package/src/decorators/query.ts +0 -2
  63. package/src/decorators/style.ts +64 -13
  64. package/src/utils/TemplateUtils.ts +9 -0
  65. package/dist/cjs/decorators/onConnectedInnerHtml.js +0 -48
  66. package/dist/cjs/decorators/onConnectedInnerHtml.js.map +0 -7
  67. package/dist/esm/decorators/onConnectedInnerHtml.js +0 -29
  68. package/dist/esm/decorators/onConnectedInnerHtml.js.map +0 -7
  69. package/dist/types/decorators/onConnectedInnerHtml.d.ts +0 -15
  70. package/dist/types/decorators/onConnectedInnerHtml.d.ts.map +0 -1
  71. package/src/decorators/onConnectedInnerHtml.ts +0 -42
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/TemplateUtils.ts"],
4
- "sourcesContent": ["export interface CreateElementInfo {\n tagName: string;\n innerHtml?: string;\n}\n\nexport namespace TemplateUtils {\n /**\n * Tagged template function to create a DocumentFragment from HTML string.\n */\n export const htmlFragment = (strings: TemplateStringsArray, ...values: any[]): DocumentFragment => {\n const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? values[i] : ''), '');\n const template = document.createElement('template');\n template.innerHTML = raw.trim();\n return template.content;\n };\n\n /**\n * Tagged template function to create a Text node from string.\n */\n export const textNode = (strings: TemplateStringsArray, ...values: any[]): Text => {\n const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? values[i] : ''), '');\n return document.createTextNode(raw);\n };\n\n /**\n * Generic element creator using a configuration object and attribute map.\n */\n export const createElement = <T extends HTMLElement>(info: CreateElementInfo, attrs: Record<string, any> = {}): T => {\n const el = document.createElement(info.tagName) as T;\n if (info.innerHtml !== undefined) el.innerHTML = info.innerHtml;\n Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n return el;\n };\n\n /**\n * Internal factory to create tagged template functions for specific HTML elements.\n */\n const createTagFunction = <T extends HTMLElement>(tagName: string) => {\n return (strings: TemplateStringsArray, ...values: any[]): T => {\n const el = document.createElement(tagName) as T;\n el.innerHTML = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? values[i] : ''), '');\n return el;\n };\n };\n\n // Specific Element Factories\n export const htmlDivElement = createTagFunction<HTMLDivElement>('div');\n export const htmlSpanElement = createTagFunction<HTMLSpanElement>('span');\n export const htmlButtonElement = createTagFunction<HTMLButtonElement>('button');\n export const htmlUlElement = createTagFunction<HTMLUListElement>('ul');\n export const htmlLiElement = createTagFunction<HTMLLIElement>('li');\n export const htmlInputElement = createTagFunction<HTMLInputElement>('input');\n export const htmlAElement = createTagFunction<HTMLAnchorElement>('a');\n export const htmlPElement = createTagFunction<HTMLParagraphElement>('p');\n export const htmlH1Element = createTagFunction<HTMLHeadingElement>('h1');\n export const htmlH2Element = createTagFunction<HTMLHeadingElement>('h2');\n export const htmlH3Element = createTagFunction<HTMLHeadingElement>('h3');\n export const htmlH4Element = createTagFunction<HTMLHeadingElement>('h4');\n export const htmlH5Element = createTagFunction<HTMLHeadingElement>('h5');\n export const htmlH6Element = createTagFunction<HTMLHeadingElement>('h6');\n export const htmlSectionElement = createTagFunction<HTMLElement>('section');\n export const htmlArticleElement = createTagFunction<HTMLElement>('article');\n}\n\nexport const htmlFragment = TemplateUtils.htmlFragment;\nexport const textNode = TemplateUtils.textNode;\nexport const createElement = TemplateUtils.createElement;\nexport const htmlDivElement = TemplateUtils.htmlDivElement;\nexport const htmlSpanElement = TemplateUtils.htmlSpanElement;\nexport const htmlButtonElement = TemplateUtils.htmlButtonElement;\nexport const htmlUlElement = TemplateUtils.htmlUlElement;\nexport const htmlLiElement = TemplateUtils.htmlLiElement;\nexport const htmlInputElement = TemplateUtils.htmlInputElement;\nexport const htmlAElement = TemplateUtils.htmlAElement;\nexport const htmlPElement = TemplateUtils.htmlPElement;\nexport const htmlH1Element = TemplateUtils.htmlH1Element;\nexport const htmlH2Element = TemplateUtils.htmlH2Element;\nexport const htmlH3Element = TemplateUtils.htmlH3Element;\nexport const htmlH4Element = TemplateUtils.htmlH4Element;\nexport const htmlH5Element = TemplateUtils.htmlH5Element;\nexport const htmlH6Element = TemplateUtils.htmlH6Element;\nexport const htmlSectionElement = TemplateUtils.htmlSectionElement;\nexport const htmlArticleElement = TemplateUtils.htmlArticleElement;\n"],
5
- "mappings": "AAKO,IAAU;AAAA,CAAV,CAAUA,mBAAV;AAIE,EAAMA,eAAA,eAAe,CAAC,YAAkC,WAAoC;AACjG,UAAM,MAAM,QAAQ,OAAO,CAAC,KAAK,KAAK,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AMA,eAAA,eAAe,kBAAwC,GAAG;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,qBAAqB,kBAA+B,SAAS;AACnE,EAAMA,eAAA,qBAAqB,kBAA+B,SAAS;AAAA,GAxD3D;AA2DV,MAAM,eAAe,cAAc;AACnC,MAAM,WAAW,cAAc;AAC/B,MAAM,gBAAgB,cAAc;AACpC,MAAM,iBAAiB,cAAc;AACrC,MAAM,kBAAkB,cAAc;AACtC,MAAM,oBAAoB,cAAc;AACxC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,mBAAmB,cAAc;AACvC,MAAM,eAAe,cAAc;AACnC,MAAM,eAAe,cAAc;AACnC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,qBAAqB,cAAc;AACzC,MAAM,qBAAqB,cAAc;",
4
+ "sourcesContent": ["export interface CreateElementInfo {\n tagName: string;\n innerHtml?: string;\n}\n\nexport namespace TemplateUtils {\n /**\n * Tagged template function to create a DocumentFragment from HTML string.\n */\n export const htmlFragment = (strings: TemplateStringsArray, ...values: any[]): DocumentFragment => {\n const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? values[i] : ''), '');\n const template = document.createElement('template');\n template.innerHTML = raw.trim();\n return template.content;\n };\n\n /**\n * Tagged template function to create a Text node from string.\n */\n export const textNode = (strings: TemplateStringsArray, ...values: any[]): Text => {\n const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? values[i] : ''), '');\n return document.createTextNode(raw);\n };\n\n /**\n * Tagged template function to create a Comment node from string.\n */\n export const commentNode = (strings: TemplateStringsArray, ...values: any[]): Comment => {\n const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? values[i] : ''), '');\n return document.createComment(raw);\n };\n\n /**\n * Generic element creator using a configuration object and attribute map.\n */\n export const createElement = <T extends HTMLElement>(info: CreateElementInfo, attrs: Record<string, any> = {}): T => {\n const el = document.createElement(info.tagName) as T;\n if (info.innerHtml !== undefined) el.innerHTML = info.innerHtml;\n Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n return el;\n };\n\n /**\n * Internal factory to create tagged template functions for specific HTML elements.\n */\n const createTagFunction = <T extends HTMLElement>(tagName: string) => {\n return (strings: TemplateStringsArray, ...values: any[]): T => {\n const el = document.createElement(tagName) as T;\n el.innerHTML = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? values[i] : ''), '');\n return el;\n };\n };\n\n // Specific Element Factories\n export const htmlDivElement = createTagFunction<HTMLDivElement>('div');\n export const htmlSpanElement = createTagFunction<HTMLSpanElement>('span');\n export const htmlButtonElement = createTagFunction<HTMLButtonElement>('button');\n export const htmlUlElement = createTagFunction<HTMLUListElement>('ul');\n export const htmlLiElement = createTagFunction<HTMLLIElement>('li');\n export const htmlInputElement = createTagFunction<HTMLInputElement>('input');\n export const htmlAElement = createTagFunction<HTMLAnchorElement>('a');\n export const htmlPElement = createTagFunction<HTMLParagraphElement>('p');\n export const htmlH1Element = createTagFunction<HTMLHeadingElement>('h1');\n export const htmlH2Element = createTagFunction<HTMLHeadingElement>('h2');\n export const htmlH3Element = createTagFunction<HTMLHeadingElement>('h3');\n export const htmlH4Element = createTagFunction<HTMLHeadingElement>('h4');\n export const htmlH5Element = createTagFunction<HTMLHeadingElement>('h5');\n export const htmlH6Element = createTagFunction<HTMLHeadingElement>('h6');\n export const htmlSectionElement = createTagFunction<HTMLElement>('section');\n export const htmlArticleElement = createTagFunction<HTMLElement>('article');\n}\n\nexport const htmlFragment = TemplateUtils.htmlFragment;\nexport const textNode = TemplateUtils.textNode;\nexport const commentNode = TemplateUtils.commentNode;\nexport const createElement = TemplateUtils.createElement;\nexport const htmlDivElement = TemplateUtils.htmlDivElement;\nexport const htmlSpanElement = TemplateUtils.htmlSpanElement;\nexport const htmlButtonElement = TemplateUtils.htmlButtonElement;\nexport const htmlUlElement = TemplateUtils.htmlUlElement;\nexport const htmlLiElement = TemplateUtils.htmlLiElement;\nexport const htmlInputElement = TemplateUtils.htmlInputElement;\nexport const htmlAElement = TemplateUtils.htmlAElement;\nexport const htmlPElement = TemplateUtils.htmlPElement;\nexport const htmlH1Element = TemplateUtils.htmlH1Element;\nexport const htmlH2Element = TemplateUtils.htmlH2Element;\nexport const htmlH3Element = TemplateUtils.htmlH3Element;\nexport const htmlH4Element = TemplateUtils.htmlH4Element;\nexport const htmlH5Element = TemplateUtils.htmlH5Element;\nexport const htmlH6Element = TemplateUtils.htmlH6Element;\nexport const htmlSectionElement = TemplateUtils.htmlSectionElement;\nexport const htmlArticleElement = TemplateUtils.htmlArticleElement;\n"],
5
+ "mappings": "AAKO,IAAU;AAAA,CAAV,CAAUA,mBAAV;AAIE,EAAMA,eAAA,eAAe,CAAC,YAAkC,WAAoC;AACjG,UAAM,MAAM,QAAQ,OAAO,CAAC,KAAK,KAAK,MAAM,MAAM,OAAO,OAAO,CAAC,MAAM,SAAY,OAAO,CAAC,IAAI,KAAK,EAAE;AACtG,UAAM,WAAW,SAAS,cAAc,UAAU;AAClD,aAAS,YAAY,IAAI,KAAK;AAC9B,WAAO,SAAS;AAAA,EAClB;AAKO,EAAMA,eAAA,WAAW,CAAC,YAAkC,WAAwB;AACjF,UAAM,MAAM,QAAQ,OAAO,CAAC,KAAK,KAAK,MAAM,MAAM,OAAO,OAAO,CAAC,MAAM,SAAY,OAAO,CAAC,IAAI,KAAK,EAAE;AACtG,WA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BAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,gBAAgB,kBAAsC,IAAI;AAChE,EAAMA,eAAA,qBAAqB,kBAA+B,SAAS;AACnE,EAAMA,eAAA,qBAAqB,kBAA+B,SAAS;AAAA,GAhE3D;AAmEV,MAAM,eAAe,cAAc;AACnC,MAAM,WAAW,cAAc;AAC/B,MAAM,cAAc,cAAc;AAClC,MAAM,gBAAgB,cAAc;AACpC,MAAM,iBAAiB,cAAc;AACrC,MAAM,kBAAkB,cAAc;AACtC,MAAM,oBAAoB,cAAc;AACxC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,mBAAmB,cAAc;AACvC,MAAM,eAAe,cAAc;AACnC,MAAM,eAAe,cAAc;AACnC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,gBAAgB,cAAc;AACpC,MAAM,qBAAqB,cAAc;AACzC,MAAM,qBAAqB,cAAc;",
6
6
  "names": ["TemplateUtils"]
7
7
  }
@@ -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);
@@ -6068,32 +6065,70 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
6068
6065
  const conf = getElementConfig(this);
6069
6066
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6070
6067
  const currentDoc = currentWin.document;
6071
- let targetEl = null;
6072
- if (selector === ":host" || !selector) {
6073
- targetEl = this;
6068
+ const pos = options.position || "beforeEnd";
6069
+ const r = options.root || "auto";
6070
+ const getTargetRoot = () => {
6071
+ if (r === "shadow")
6072
+ return this.shadowRoot;
6073
+ if (r === "light")
6074
+ return this;
6075
+ if (r === "all")
6076
+ return this.shadowRoot || this;
6077
+ return this.shadowRoot || this;
6078
+ };
6079
+ if (pos === "remove") {
6080
+ if (res) {
6081
+ if (selector === ":host" || !selector) {
6082
+ if (r === "shadow" && this.shadowRoot) {
6083
+ this.shadowRoot.replaceChildren();
6084
+ } else {
6085
+ this.remove();
6086
+ }
6087
+ } else {
6088
+ const targetRoot = getTargetRoot();
6089
+ if (targetRoot) {
6090
+ const targets = targetRoot.querySelectorAll(selector);
6091
+ targets.forEach((el) => el.remove());
6092
+ }
6093
+ }
6094
+ }
6074
6095
  } 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) : "";
6096
+ let targetEl = null;
6097
+ if (selector === ":host" || !selector) {
6098
+ if (r === "shadow") {
6099
+ targetEl = this.shadowRoot;
6100
+ } else {
6101
+ targetEl = this;
6102
+ }
6088
6103
  } 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);
6104
+ const targetRoot = getTargetRoot();
6105
+ targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
6106
+ }
6107
+ if (targetEl) {
6108
+ const isShadowRoot = targetEl instanceof ShadowRoot;
6109
+ const nodes = normalizeNodes(res, currentDoc);
6110
+ if (pos === "replace") {
6111
+ if (!isShadowRoot) {
6112
+ targetEl.replaceWith(...nodes);
6113
+ }
6114
+ } else if (pos === "replaceChildren") {
6115
+ targetEl.replaceChildren(...nodes);
6116
+ } else if (pos === "innerHtml") {
6117
+ targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6118
+ } else if (pos === "innerText") {
6119
+ if (targetEl.innerText !== void 0) {
6120
+ targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6121
+ }
6122
+ } else {
6123
+ if (pos === "beforeEnd")
6124
+ targetEl.append(...nodes);
6125
+ else if (pos === "afterBegin")
6126
+ targetEl.prepend(...nodes);
6127
+ else if (pos === "beforeBegin" && !isShadowRoot)
6128
+ targetEl.before(...nodes);
6129
+ else if (pos === "afterEnd" && !isShadowRoot)
6130
+ targetEl.after(...nodes);
6131
+ }
6097
6132
  }
6098
6133
  }
6099
6134
  }
@@ -6114,6 +6149,24 @@ var findAllApplyNodeMetadata = (target) => {
6114
6149
  function applyNodeHost(options = { position: "beforeEnd" }) {
6115
6150
  return applyNode(":host", options);
6116
6151
  }
6152
+ var applyBeforeBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeBegin" });
6153
+ var applyAfterBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterBegin" });
6154
+ var applyBeforeEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeEnd" });
6155
+ var applyAfterEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterEnd" });
6156
+ var applyReplaceNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replace" });
6157
+ var applyReplaceChildrenNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replaceChildren" });
6158
+ var applyInnerHtmlNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerHtml" });
6159
+ var applyInnerTextNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerText" });
6160
+ var applyRemoveNode = (selector, options = {}) => applyNode(selector, { ...options, position: "remove" });
6161
+ var applyBeforeBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeBegin" });
6162
+ var applyAfterBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterBegin" });
6163
+ var applyBeforeEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeEnd" });
6164
+ var applyAfterEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterEnd" });
6165
+ var applyReplaceNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replace" });
6166
+ var applyReplaceChildrenNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replaceChildren" });
6167
+ var applyInnerHtmlNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerHtml" });
6168
+ var applyInnerTextNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerText" });
6169
+ var applyRemoveNodeHost = (options = {}) => applyNode(":host", { ...options, position: "remove" });
6117
6170
 
6118
6171
  // src/decorators/query.ts
6119
6172
  var QUERY_METADATA_KEY = Symbol("simple-web-component:query");
@@ -6321,7 +6374,7 @@ function queryAllHost(options) {
6321
6374
  // src/decorators/classList.ts
6322
6375
  var CLASS_LIST_METADATA_KEY = Symbol("simple-web-component:class-list");
6323
6376
  function createClassListDecorator(action) {
6324
- return (selector) => {
6377
+ return (selector, options = {}) => {
6325
6378
  return (target, propertyKey, descriptor) => {
6326
6379
  const constructor = target.constructor;
6327
6380
  let metaList = ReflectUtils.getOwnMetadata(CLASS_LIST_METADATA_KEY, constructor);
@@ -6329,19 +6382,39 @@ function createClassListDecorator(action) {
6329
6382
  metaList = /* @__PURE__ */ new Map();
6330
6383
  ReflectUtils.defineMetadata(CLASS_LIST_METADATA_KEY, metaList, constructor);
6331
6384
  }
6332
- metaList.set(propertyKey, { propertyKey, selector, action });
6385
+ metaList.set(propertyKey, { propertyKey, selector, action, options });
6333
6386
  const original = descriptor.value;
6334
6387
  descriptor.value = async function(...args) {
6335
6388
  ensureInit2(this);
6336
6389
  const res = await original.apply(this, args);
6337
6390
  if (res !== void 0) {
6391
+ const r = options.root || "auto";
6338
6392
  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) {
6393
+ const targetEls = [];
6394
+ if (selector === ":host" || !selector) {
6395
+ targetEls.push(this);
6396
+ } else if (selector === ":parentHost") {
6397
+ if (hostSet.$parentHost) targetEls.push(hostSet.$parentHost);
6398
+ } else if (selector === ":appHost") {
6399
+ if (hostSet.$appHost) targetEls.push(hostSet.$appHost);
6400
+ } else {
6401
+ if (r === "shadow") {
6402
+ const found = this.shadowRoot?.querySelectorAll(selector);
6403
+ if (found) targetEls.push(...found);
6404
+ } else if (r === "light") {
6405
+ const found = this.querySelectorAll(selector);
6406
+ if (found) targetEls.push(...found);
6407
+ } else if (r === "all") {
6408
+ const sFound = this.shadowRoot?.querySelectorAll(selector);
6409
+ const lFound = this.querySelectorAll(selector);
6410
+ if (sFound) targetEls.push(...sFound);
6411
+ if (lFound) targetEls.push(...lFound);
6412
+ } else {
6413
+ const found = (this.shadowRoot || this).querySelectorAll(selector);
6414
+ if (found) targetEls.push(...found);
6415
+ }
6416
+ }
6417
+ targetEls.forEach((targetEl) => {
6345
6418
  if (action === "set") {
6346
6419
  let classes = "";
6347
6420
  if (typeof res === "object" && res !== null && !Array.isArray(res)) {
@@ -6369,23 +6442,23 @@ function createClassListDecorator(action) {
6369
6442
  const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6370
6443
  classes.forEach((c) => targetEl.classList.toggle(c));
6371
6444
  }
6372
- }
6445
+ });
6373
6446
  }
6374
6447
  return res;
6375
6448
  };
6376
6449
  };
6377
6450
  };
6378
6451
  }
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");
6452
+ var setClassList = (selector, options = {}) => createClassListDecorator("set")(selector, options);
6453
+ var updateClassList = (selector, options = {}) => createClassListDecorator("update")(selector, options);
6454
+ var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
6455
+ var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
6456
+ var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
6457
+ var setClassListHost = (options = {}) => createClassListDecorator("set")(":host", options);
6458
+ var updateClassListHost = (options = {}) => createClassListDecorator("update")(":host", options);
6459
+ var addClassListHost = (options = {}) => createClassListDecorator("add")(":host", options);
6460
+ var removeClassListHost = (options = {}) => createClassListDecorator("remove")(":host", options);
6461
+ var toggleClassListHost = (options = {}) => createClassListDecorator("toggle")(":host", options);
6389
6462
  var findAllClassListMetadata = (target) => {
6390
6463
  const result = /* @__PURE__ */ new Map();
6391
6464
  const maps = ReflectUtils.findAllMetadata(CLASS_LIST_METADATA_KEY, target);
@@ -6400,7 +6473,7 @@ var findAllClassListMetadata = (target) => {
6400
6473
  // src/decorators/style.ts
6401
6474
  var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
6402
6475
  function createStyleDecorator(action) {
6403
- return (selector) => {
6476
+ return (selector, options = {}) => {
6404
6477
  return (target, propertyKey, descriptor) => {
6405
6478
  const constructor = target.constructor;
6406
6479
  let metaList = ReflectUtils.getOwnMetadata(STYLE_METADATA_KEY, constructor);
@@ -6408,19 +6481,39 @@ function createStyleDecorator(action) {
6408
6481
  metaList = /* @__PURE__ */ new Map();
6409
6482
  ReflectUtils.defineMetadata(STYLE_METADATA_KEY, metaList, constructor);
6410
6483
  }
6411
- metaList.set(propertyKey, { propertyKey, selector, action });
6484
+ metaList.set(propertyKey, { propertyKey, selector, action, options });
6412
6485
  const original = descriptor.value;
6413
6486
  descriptor.value = async function(...args) {
6414
6487
  ensureInit2(this);
6415
6488
  const res = await original.apply(this, args);
6416
6489
  if (res !== void 0) {
6490
+ const r = options.root || "auto";
6417
6491
  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) {
6492
+ const targetEls = [];
6493
+ if (selector === ":host" || !selector) {
6494
+ targetEls.push(this);
6495
+ } else if (selector === ":parentHost") {
6496
+ if (hostSet.$parentHost) targetEls.push(hostSet.$parentHost);
6497
+ } else if (selector === ":appHost") {
6498
+ if (hostSet.$appHost) targetEls.push(hostSet.$appHost);
6499
+ } else {
6500
+ if (r === "shadow") {
6501
+ const found = this.shadowRoot?.querySelectorAll(selector);
6502
+ if (found) targetEls.push(...found);
6503
+ } else if (r === "light") {
6504
+ const found = this.querySelectorAll(selector);
6505
+ if (found) targetEls.push(...found);
6506
+ } else if (r === "all") {
6507
+ const sFound = this.shadowRoot?.querySelectorAll(selector);
6508
+ const lFound = this.querySelectorAll(selector);
6509
+ if (sFound) targetEls.push(...sFound);
6510
+ if (lFound) targetEls.push(...lFound);
6511
+ } else {
6512
+ const found = (this.shadowRoot || this).querySelectorAll(selector);
6513
+ if (found) targetEls.push(...found);
6514
+ }
6515
+ }
6516
+ targetEls.forEach((targetEl) => {
6424
6517
  if (action === "set") {
6425
6518
  targetEl.style.cssText = "";
6426
6519
  if (typeof res === "object" && res !== null) {
@@ -6436,16 +6529,19 @@ function createStyleDecorator(action) {
6436
6529
  const props = Array.isArray(res) ? res : [res];
6437
6530
  props.forEach((p) => targetEl.style.removeProperty(String(p)));
6438
6531
  }
6439
- }
6532
+ });
6440
6533
  }
6441
6534
  return res;
6442
6535
  };
6443
6536
  };
6444
6537
  };
6445
6538
  }
6446
- var setStyle = createStyleDecorator("set");
6447
- var updateStyle = createStyleDecorator("update");
6448
- var removeStyle = createStyleDecorator("remove");
6539
+ var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
6540
+ var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
6541
+ var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
6542
+ var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
6543
+ var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
6544
+ var removeStyleHost = (options = {}) => createStyleDecorator("remove")(":host", options);
6449
6545
  var findAllStyleMetadata = (target) => {
6450
6546
  const result = /* @__PURE__ */ new Map();
6451
6547
  const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
@@ -7992,6 +8088,10 @@ var TemplateUtils;
7992
8088
  const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
7993
8089
  return document.createTextNode(raw);
7994
8090
  };
8091
+ TemplateUtils2.commentNode = (strings, ...values) => {
8092
+ const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8093
+ return document.createComment(raw);
8094
+ };
7995
8095
  TemplateUtils2.createElement = (info, attrs = {}) => {
7996
8096
  const el = document.createElement(info.tagName);
7997
8097
  if (info.innerHtml !== void 0) el.innerHTML = info.innerHtml;
@@ -8024,6 +8124,7 @@ var TemplateUtils;
8024
8124
  })(TemplateUtils || (TemplateUtils = {}));
8025
8125
  var htmlFragment = TemplateUtils.htmlFragment;
8026
8126
  var textNode = TemplateUtils.textNode;
8127
+ var commentNode = TemplateUtils.commentNode;
8027
8128
  var createElement = TemplateUtils.createElement;
8028
8129
  var htmlDivElement = TemplateUtils.htmlDivElement;
8029
8130
  var htmlSpanElement = TemplateUtils.htmlSpanElement;
@@ -8074,11 +8175,30 @@ export {
8074
8175
  addClassListHost,
8075
8176
  addEventListener,
8076
8177
  addEventListenerHost,
8178
+ applyAfterBeginNode,
8179
+ applyAfterBeginNodeHost,
8180
+ applyAfterEndNode,
8181
+ applyAfterEndNodeHost,
8182
+ applyBeforeBeginNode,
8183
+ applyBeforeBeginNodeHost,
8184
+ applyBeforeEndNode,
8185
+ applyBeforeEndNodeHost,
8186
+ applyInnerHtmlNode,
8187
+ applyInnerHtmlNodeHost,
8188
+ applyInnerTextNode,
8189
+ applyInnerTextNodeHost,
8077
8190
  applyNode,
8078
8191
  applyNodeHost,
8192
+ applyRemoveNode,
8193
+ applyRemoveNodeHost,
8194
+ applyReplaceChildrenNode,
8195
+ applyReplaceChildrenNodeHost,
8196
+ applyReplaceNode,
8197
+ applyReplaceNodeHost,
8079
8198
  attribute,
8080
8199
  attributeHost,
8081
8200
  changedAttributeHost,
8201
+ commentNode,
8082
8202
  createElement,
8083
8203
  elementDefine,
8084
8204
  emitCustomEvent,
@@ -8135,18 +8255,21 @@ export {
8135
8255
  removeClassList,
8136
8256
  removeClassListHost,
8137
8257
  removeStyle,
8258
+ removeStyleHost,
8138
8259
  resolveTargetEls,
8139
8260
  setAttribute,
8140
8261
  setAttributeHost,
8141
8262
  setClassList,
8142
8263
  setClassListHost,
8143
8264
  setStyle,
8265
+ setStyleHost,
8144
8266
  textNode,
8145
8267
  toggleClassList,
8146
8268
  toggleClassListHost,
8147
8269
  updateClassList,
8148
8270
  updateClassListHost,
8149
- updateStyle
8271
+ updateStyle,
8272
+ updateStyleHost
8150
8273
  };
8151
8274
  /*! Bundled license information:
8152
8275