@dooboostore/simple-web-component 1.0.38 → 1.0.40

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 (91) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +88 -871
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +194 -111
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyNode.js +82 -80
  7. package/dist/cjs/decorators/applyNode.js.map +2 -2
  8. package/dist/cjs/decorators/applyProperty.js +213 -0
  9. package/dist/cjs/decorators/applyProperty.js.map +7 -0
  10. package/dist/cjs/decorators/applySlot.js +93 -82
  11. package/dist/cjs/decorators/applySlot.js.map +3 -3
  12. package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
  13. package/dist/cjs/decorators/elementDefine.js +14 -34
  14. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  15. package/dist/cjs/decorators/index.js +2 -2
  16. package/dist/cjs/decorators/index.js.map +2 -2
  17. package/dist/cjs/decorators/lifecycles.js +4 -4
  18. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  19. package/dist/cjs/decorators/state.js +0 -1
  20. package/dist/cjs/decorators/state.js.map +2 -2
  21. package/dist/cjs/elements/SwcApp.js.map +2 -2
  22. package/dist/cjs/types/index.js.map +1 -1
  23. package/dist/esm/SwcAppEngine.js.map +2 -2
  24. package/dist/esm/decorators/applyAttribute.js +196 -113
  25. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  26. package/dist/esm/decorators/applyNode.js +82 -80
  27. package/dist/esm/decorators/applyNode.js.map +2 -2
  28. package/dist/esm/decorators/applyProperty.js +194 -0
  29. package/dist/esm/decorators/applyProperty.js.map +7 -0
  30. package/dist/esm/decorators/applySlot.js +93 -82
  31. package/dist/esm/decorators/applySlot.js.map +3 -3
  32. package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
  33. package/dist/esm/decorators/elementDefine.js +14 -34
  34. package/dist/esm/decorators/elementDefine.js.map +2 -2
  35. package/dist/esm/decorators/index.js +2 -2
  36. package/dist/esm/decorators/index.js.map +1 -1
  37. package/dist/esm/decorators/lifecycles.js +4 -4
  38. package/dist/esm/decorators/lifecycles.js.map +2 -2
  39. package/dist/esm/decorators/state.js +0 -1
  40. package/dist/esm/decorators/state.js.map +2 -2
  41. package/dist/esm/elements/SwcApp.js.map +2 -2
  42. package/dist/esm/types/index.js.map +1 -1
  43. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +525 -513
  44. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  45. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  46. package/dist/types/decorators/applyAttribute.d.ts +56 -15
  47. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  48. package/dist/types/decorators/applyNode.d.ts +28 -24
  49. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  50. package/dist/types/decorators/applyProperty.d.ts +61 -0
  51. package/dist/types/decorators/applyProperty.d.ts.map +1 -0
  52. package/dist/types/decorators/applySlot.d.ts +17 -15
  53. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  54. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  55. package/dist/types/decorators/index.d.ts +2 -2
  56. package/dist/types/decorators/index.d.ts.map +1 -1
  57. package/dist/types/decorators/lifecycles.d.ts +4 -4
  58. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  59. package/dist/types/decorators/state.d.ts.map +1 -1
  60. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  61. package/dist/types/types/index.d.ts +1 -6
  62. package/dist/types/types/index.d.ts.map +1 -1
  63. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +525 -513
  64. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  65. package/package.json +1 -1
  66. package/src/SwcAppEngine.ts +1 -0
  67. package/src/decorators/applyAttribute.ts +311 -126
  68. package/src/decorators/applyNode.ts +108 -105
  69. package/src/decorators/applyProperty.ts +302 -0
  70. package/src/decorators/applySlot.ts +112 -94
  71. package/src/decorators/changedAttributeThis.ts +1 -1
  72. package/src/decorators/elementDefine.ts +44 -33
  73. package/src/decorators/index.ts +2 -3
  74. package/src/decorators/lifecycles.ts +6 -6
  75. package/src/decorators/state.ts +0 -1
  76. package/src/elements/SwcApp.ts +0 -1
  77. package/src/types/index.ts +7 -7
  78. package/dist/cjs/decorators/attribute.js +0 -187
  79. package/dist/cjs/decorators/attribute.js.map +0 -7
  80. package/dist/cjs/decorators/setProperty.js +0 -109
  81. package/dist/cjs/decorators/setProperty.js.map +0 -7
  82. package/dist/esm/decorators/attribute.js +0 -168
  83. package/dist/esm/decorators/attribute.js.map +0 -7
  84. package/dist/esm/decorators/setProperty.js +0 -90
  85. package/dist/esm/decorators/setProperty.js.map +0 -7
  86. package/dist/types/decorators/attribute.d.ts +0 -31
  87. package/dist/types/decorators/attribute.d.ts.map +0 -1
  88. package/dist/types/decorators/setProperty.d.ts +0 -17
  89. package/dist/types/decorators/setProperty.d.ts.map +0 -1
  90. package/src/decorators/attribute.ts +0 -223
  91. package/src/decorators/setProperty.ts +0 -112
@@ -3,108 +3,119 @@ import { ensureInit, getElementConfig } from "./elementDefine.js";
3
3
  import { SwcUtils } from "../utils/Utils.js";
4
4
  import { NodeSlot } from "@dooboostore/core-web";
5
5
  const APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
6
- function applySlot(id, options = { position: "replaceChildrenHtml" }) {
6
+ const applyToDom = (swcId, id, pos, nodes) => {
7
+ const nodeSlot = new NodeSlot(void 0, swcId);
8
+ if (pos === "replaceChildrenText" || pos === "replaceChildren" || pos === "replaceChildrenHtml") {
9
+ nodeSlot.replaceChildren(id, ...nodes);
10
+ } else if (pos === "appendHtml" || pos === "append" || pos === "appendText") {
11
+ nodeSlot.append(id, ...nodes);
12
+ } else if (pos === "prependHtml" || pos === "prepend" || pos === "prependText") {
13
+ nodeSlot.prepend(id, ...nodes);
14
+ } else if (pos === "clear") {
15
+ nodeSlot.clear(id);
16
+ }
17
+ };
18
+ function applySlot(targetId, opt) {
7
19
  return (targetObj, propertyKey, descriptor) => {
8
- const type = descriptor === void 0 ? "property" : "method";
9
- if (type === "property") {
10
- Object.defineProperty(targetObj, propertyKey, {
11
- get() {
12
- const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
13
- return nodeSlot;
14
- },
15
- set(nv) {
16
- if (nv) {
17
- } else {
18
- const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
19
- nodeSlot.clear();
20
- }
21
- },
22
- configurable: true,
23
- enumerable: true
24
- });
25
- }
20
+ const options = { position: "replaceChildren", ...opt };
26
21
  const constructor = targetObj.constructor;
27
22
  let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
28
23
  if (!metaList) {
29
24
  metaList = [];
30
25
  ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
31
26
  }
32
- metaList.push({ propertyKey, id, type, options });
33
- if (type === "method") {
34
- const original = descriptor.value;
35
- descriptor.value = function(...args) {
36
- ensureInit(this);
37
- const conf = getElementConfig(this);
38
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
39
- const currentDoc = currentWin.document;
40
- const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
41
- let res = original.apply(this, args);
42
- if (res) {
43
- const nodeSlot = new NodeSlot(this, this._swcId);
44
- const pos = options.position || "replaceChildrenHtml";
45
- const doc = currentWin.document;
46
- if (pos === "replaceChildrenHtml") {
47
- nodeSlot.replaceChildrenHtml(id, res);
48
- } else if (pos === "replaceChildrenText") {
49
- nodeSlot.replaceChildrenText(id, res);
50
- } else if (pos === "appendHtml") {
51
- nodeSlot.appendHtml(id, res);
52
- } else if (pos === "appendText") {
53
- nodeSlot.appendText(id, res);
54
- } else if (pos === "prependHtml") {
55
- nodeSlot.prependHtml(id, res);
56
- } else if (pos === "prependText") {
57
- nodeSlot.prependText(id, res);
58
- } else if (pos === "clear") {
59
- nodeSlot.clear(id);
60
- }
27
+ metaList.push({ propertyKey, targetId, options });
28
+ const original = descriptor.value;
29
+ descriptor.value = function(...args) {
30
+ ensureInit(this);
31
+ const conf = getElementConfig(this);
32
+ const currentWin = conf.window;
33
+ const swcId = this._swcId;
34
+ const currentDoc = currentWin.document;
35
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
36
+ const pos = options.position;
37
+ const resToNodes = (res2) => {
38
+ const nodes = [];
39
+ if (typeof res2 === "string" && (pos === "replaceChildrenHtml" || pos === "appendHtml" || pos === "prependHtml")) {
40
+ const t = currentWin.document.createElement("template");
41
+ t.innerHTML = res2;
42
+ nodes.push(...Array.from(t.content.childNodes));
43
+ } else if (typeof res2 === "string" && (pos === "replaceChildrenText" || pos === "prependText" || pos === "appendText")) {
44
+ nodes.push(currentWin.document.createTextNode(res2));
45
+ } else if (typeof res2 === "object") {
46
+ nodes.push(res2);
61
47
  }
62
- return res;
48
+ SwcUtils.projectProcessHtml(swcId, nodes, currentDoc);
49
+ return nodes;
63
50
  };
64
- }
51
+ const fallbackNodes = [];
52
+ if (options.fallback) {
53
+ const res2 = options.fallback.call(this, hostSet);
54
+ const nodes = resToNodes(res2);
55
+ fallbackNodes.push(...nodes);
56
+ applyToDom(swcId, targetId, options.position, nodes);
57
+ }
58
+ let res = original.apply(this, args);
59
+ if (res instanceof Promise) {
60
+ return res.then((asyncRes) => {
61
+ const nodes = resToNodes(asyncRes);
62
+ fallbackNodes.forEach((it) => it.remove());
63
+ applyToDom(swcId, targetId, options.position, nodes);
64
+ });
65
+ } else {
66
+ const nodes = resToNodes(res);
67
+ applyToDom(swcId, targetId, options.position, nodes);
68
+ }
69
+ };
65
70
  };
66
71
  }
67
- const findAllApplySlotMetadata = (target) => {
68
- const constructor = target instanceof Function ? target : target.constructor;
69
- return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
70
- };
71
- function applySlotClear(id) {
72
- return applySlot(id, { position: "clear" });
72
+ function clearSlot(targetId) {
73
+ return applySlot(targetId, { position: "clear" });
73
74
  }
74
- function applySlotPrependHtml(id) {
75
- return applySlot(id, { position: "prependHtml" });
75
+ function prependHtmlSlot(targetId) {
76
+ return applySlot(targetId, { position: "prependHtml" });
76
77
  }
77
- const applySlotPrepend = applySlotPrependHtml;
78
- function applySlotPrependText(id) {
79
- return applySlot(id, { position: "prependText" });
78
+ function prependSlot(targetId) {
79
+ return applySlot(targetId, { position: "prepend" });
80
80
  }
81
- function applySlotAppendHtml(id) {
82
- return applySlot(id, { position: "appendHtml" });
81
+ function prependTextSlot(targetId) {
82
+ return applySlot(targetId, { position: "prependText" });
83
83
  }
84
- function applySlotAppendText(id) {
85
- return applySlot(id, { position: "appendText" });
84
+ function appendHtmlSlot(targetId) {
85
+ return applySlot(targetId, { position: "appendHtml" });
86
86
  }
87
- const applySlotAppend = applySlotAppendHtml;
88
- function applySlotReplaceChildrenHtml(id) {
89
- return applySlot(id, { position: "replaceChildrenHtml" });
87
+ function appendTextSlot(targetId) {
88
+ return applySlot(targetId, { position: "appendText" });
90
89
  }
91
- const applySlotReplaceChildren = applySlotReplaceChildrenHtml;
92
- function applySlotReplaceChildrenText(id) {
93
- return applySlot(id, { position: "replaceChildrenText" });
90
+ function appendSlot(targetId) {
91
+ return applySlot(targetId, { position: "append" });
94
92
  }
93
+ function replaceChildrenHtmlSlot(targetId) {
94
+ return applySlot(targetId, { position: "replaceChildrenHtml" });
95
+ }
96
+ function replaceChildrenSlot(targetId) {
97
+ return applySlot(targetId, { position: "replaceChildren" });
98
+ }
99
+ function replaceChildrenTextSlot(targetId) {
100
+ return applySlot(targetId, { position: "replaceChildrenText" });
101
+ }
102
+ const findAllApplySlotMetadata = (target) => {
103
+ const constructor = target instanceof Function ? target : target.constructor;
104
+ return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
105
+ };
95
106
  export {
96
107
  APPLY_SLOT_METADATA_KEY,
108
+ appendHtmlSlot,
109
+ appendSlot,
110
+ appendTextSlot,
97
111
  applySlot,
98
- applySlotAppend,
99
- applySlotAppendHtml,
100
- applySlotAppendText,
101
- applySlotClear,
102
- applySlotPrepend,
103
- applySlotPrependHtml,
104
- applySlotPrependText,
105
- applySlotReplaceChildren,
106
- applySlotReplaceChildrenHtml,
107
- applySlotReplaceChildrenText,
108
- findAllApplySlotMetadata
112
+ clearSlot,
113
+ findAllApplySlotMetadata,
114
+ prependHtmlSlot,
115
+ prependSlot,
116
+ prependTextSlot,
117
+ replaceChildrenHtmlSlot,
118
+ replaceChildrenSlot,
119
+ replaceChildrenTextSlot
109
120
  };
110
121
  //# sourceMappingURL=applySlot.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/applySlot.ts"],
4
- "sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from \"../utils/Utils\";\nimport {NodeSlot} from \"@dooboostore/core-web\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplySlotPosition = 'prependHtml' | 'prependText' | 'appendHtml' | 'appendText' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';\n\nexport interface ApplySlotOptions {\n position?: ApplySlotPosition;\n // root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n // filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n // loading?: (helper: HelperHostSet) => any;\n}\n\nexport interface ApplySlotMetadata {\n propertyKey: string | symbol;\n id: string;\n type: 'method' | 'property';\n options: ApplySlotOptions;\n}\n\nexport const APPLY_SLOT_METADATA_KEY = Symbol.for('simple-web-component:apply-slot');\n\n// const normalizeNodes = (res: any, doc: Document): Node[] => {\n// const items = Array.isArray(res) ? res : [res];\n// return items.map(it => {\n// if (it instanceof Node) return it;\n// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n// });\n// };\n\n// const applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, win: Window) => {\n// if (!targetEl) return;\n//\n// const doc = win.document;\n//\n// if (pos === 'innerHtml') {\n// targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';\n// return;\n// }\n//\n// if (pos === 'innerText') {\n// if (targetEl.innerText !== undefined) {\n// targetEl.innerText = res !== undefined && res !== null ? String(res) : '';\n// }\n// return;\n// }\n//\n// const isShadowRoot = targetEl instanceof win.ShadowRoot;\n// const nodes = normalizeNodes(res, doc);\n// if (pos === 'replace') {\n// if (!isShadowRoot) targetEl.replaceWith(...nodes);\n// } else if (pos === 'replaceChildren') {\n// targetEl.replaceChildren(...nodes);\n// } else {\n// if (pos === 'beforeEnd') targetEl.append(...nodes);\n// else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n// else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n// else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n// }\n// };\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n */\nexport function applySlot(id: string, options: ApplySlotOptions = { position: 'replaceChildrenHtml' }): MethodDecorator & PropertyDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const type = descriptor === undefined ? 'property' : 'method';\n\n if (type === 'property') {\n Object.defineProperty(targetObj, propertyKey, {\n get(this: any) {\n const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);\n return nodeSlot;\n },\n set(this: any, nv: any) {\n if(nv) {\n // \uC788\uC744\uB54C \uC544\uBB34\uC77C\uB3C4\uC548\uD568\n } else {\n const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);\n nodeSlot.clear();\n }\n },\n configurable: true,\n enumerable: true,\n })\n // return nodeSlot;\n // return;\n }\n\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor) as ApplySlotMetadata[];\n if (!metaList) {\n metaList = []\n ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({ propertyKey, id, type, options });\n\n\n\n if (type === 'method') {\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n let res = original.apply(this, args);\n if (res) {\n // res = SwcUtils.projectProcessHtml(this, res)\n const nodeSlot = new NodeSlot(this, this._swcId);\n const pos = options.position || 'replaceChildrenHtml';\n const doc = currentWin.document;\n if (pos === 'replaceChildrenHtml') {\n nodeSlot.replaceChildrenHtml(id, res);\n } else if (pos === 'replaceChildrenText') {\n nodeSlot.replaceChildrenText(id, res);\n } else if (pos === 'appendHtml') {\n nodeSlot.appendHtml(id, res);\n } else if (pos === 'appendText') {\n nodeSlot.appendText(id, res);\n } else if (pos === 'prependHtml') {\n nodeSlot.prependHtml(id, res);\n } else if (pos === 'prependText') {\n nodeSlot.prependText(id, res);\n } else if (pos === 'clear') {\n nodeSlot.clear(id);\n }\n\n // const stateContext: any = {...hostSet};\n // getStateMetadata(this).forEach(it => {\n // stateContext[it.name] = this[it.propertyKey]\n // })\n // new ElementApply(this, {id: this._swcId}).apply({target:'noInitialized', context: stateContext, bind: this});\n }\n return res;\n };\n }\n };\n}\n\n// export const findAllApplySlotMetadata = (target: any): Map<string | symbol, ApplySlotMetadata> => {\nexport const findAllApplySlotMetadata = (target: any): ApplySlotMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);\n};\n\nexport function applySlotClear(id: string): MethodDecorator {\n return applySlot(id, { position: 'clear' });\n}\nexport function applySlotPrependHtml(id: string): MethodDecorator {\n return applySlot(id, { position: 'prependHtml' });\n}\nexport const applySlotPrepend = applySlotPrependHtml;\nexport function applySlotPrependText(id: string): MethodDecorator {\n return applySlot(id, { position: 'prependText' });\n}\nexport function applySlotAppendHtml(id: string): MethodDecorator {\n return applySlot(id, { position: 'appendHtml' });\n}\nexport function applySlotAppendText(id: string): MethodDecorator {\n return applySlot(id, { position: 'appendText' });\n}\nexport const applySlotAppend = applySlotAppendHtml;\nexport function applySlotReplaceChildrenHtml(id: string): MethodDecorator {\n return applySlot(id, { position: 'replaceChildrenHtml' });\n}\nexport const applySlotReplaceChildren = applySlotReplaceChildrenHtml;\nexport function applySlotReplaceChildrenText(id: string): MethodDecorator {\n return applySlot(id, { position: 'replaceChildrenText' });\n}\n"],
5
- "mappings": "AAAA,SAAQ,oBAAmB;AAC3B,SAAQ,YAAY,wBAAuB;AAC3C,SAAQ,gBAAe;AACvB,SAAQ,gBAAe;AAiChB,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;AA4C5E,SAAS,UAAU,IAAY,UAA4B,EAAE,UAAU,sBAAsB,GAAwC;AAC1I,SAAO,CAAC,WAAmB,aAA8B,eAAoC;AAC3F,UAAM,OAAO,eAAe,SAAY,aAAa;AAErD,QAAI,SAAS,YAAY;AACjB,aAAO,eAAe,WAAW,aAAa;AAAA,QAC5C,MAAe;AACb,gBAAM,WAAW,IAAI,SAAS,MAAM,GAAG,KAAK,MAAM,IAAI,EAAE,EAAE;AAC1D,iBAAO;AAAA,QACT;AAAA,QACA,IAAe,IAAS;AACtB,cAAG,IAAI;AAAA,UAEP,OAAO;AACL,kBAAM,WAAW,IAAI,SAAS,MAAM,GAAG,KAAK,MAAM,IAAI,EAAE,EAAE;AAC1D,qBAAS,MAAM;AAAA,UACjB;AAAA,QACF;AAAA,QACA,cAAc;AAAA,QACd,YAAY;AAAA,MACd,CAAC;AAAA,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,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,yBAAyB,WAAW;AACtE;AAEO,SAAS,eAAe,IAA6B;AAC1D,SAAO,UAAU,IAAI,EAAE,UAAU,QAAQ,CAAC;AAC5C;AACO,SAAS,qBAAqB,IAA6B;AAChE,SAAO,UAAU,IAAI,EAAE,UAAU,cAAc,CAAC;AAClD;AACO,MAAM,mBAAmB;AACzB,SAAS,qBAAqB,IAA6B;AAChE,SAAO,UAAU,IAAI,EAAE,UAAU,cAAc,CAAC;AAClD;AACO,SAAS,oBAAoB,IAA6B;AAC/D,SAAO,UAAU,IAAI,EAAE,UAAU,aAAa,CAAC;AACjD;AACO,SAAS,oBAAoB,IAA6B;AAC/D,SAAO,UAAU,IAAI,EAAE,UAAU,aAAa,CAAC;AACjD;AACO,MAAM,kBAAkB;AACxB,SAAS,6BAA6B,IAA6B;AACxE,SAAO,UAAU,IAAI,EAAE,UAAU,sBAAsB,CAAC;AAC1D;AACO,MAAM,2BAA2B;AACjC,SAAS,6BAA6B,IAA6B;AACxE,SAAO,UAAU,IAAI,EAAE,UAAU,sBAAsB,CAAC;AAC1D;",
6
- "names": []
4
+ "sourcesContent": ["import {OptionalType, ReflectUtils} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from \"../utils/Utils\";\nimport {NodeSlot} from \"@dooboostore/core-web\";\nimport {HelperHostSet} from \"../types\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplySlotPosition = 'prepend' | 'prependHtml' | 'prependText' | 'append' | 'appendHtml' | 'appendText' | 'replaceChildren' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';\n\nexport interface ApplySlotOptions {\n position: ApplySlotPosition;\n fallback?: (helper: HelperHostSet) => string | Node;\n // root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n // filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n // loading?: (helper: HelperHostSet) => any;\n}\n\nexport interface ApplySlotMetadata {\n propertyKey: string | symbol;\n targetId: string;\n // type: 'method' | 'property';\n options: ApplySlotOptions;\n}\n\nexport const APPLY_SLOT_METADATA_KEY = Symbol.for('simple-web-component:apply-slot');\n\n// const normalizeNodes = (res: any, doc: Document): Node[] => {\n// const items = Array.isArray(res) ? res : [res];\n// return items.map(it => {\n// if (it instanceof Node) return it;\n// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n// });\n// };\n\n// const applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, win: Window) => {\n// if (!targetEl) return;\n//\n// const doc = win.document;\n//\n// if (pos === 'innerHtml') {\n// targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';\n// return;\n// }\n//\n// if (pos === 'innerText') {\n// if (targetEl.innerText !== undefined) {\n// targetEl.innerText = res !== undefined && res !== null ? String(res) : '';\n// }\n// return;\n// }\n//\n// const isShadowRoot = targetEl instanceof win.ShadowRoot;\n// const nodes = normalizeNodes(res, doc);\n// if (pos === 'replace') {\n// if (!isShadowRoot) targetEl.replaceWith(...nodes);\n// } else if (pos === 'replaceChildren') {\n// targetEl.replaceChildren(...nodes);\n// } else {\n// if (pos === 'beforeEnd') targetEl.append(...nodes);\n// else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n// else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n// else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n// }\n// };\n\nconst applyToDom = (swcId: string, id: string, pos: ApplySlotPosition, nodes: Node[]) => {\n const nodeSlot = new NodeSlot(this, swcId);\n if (pos === 'replaceChildrenText' || pos === 'replaceChildren' || pos === 'replaceChildrenHtml') {\n nodeSlot.replaceChildren(id, ...nodes);\n } else if (pos === 'appendHtml' || pos === 'append' || pos === 'appendText') {\n nodeSlot.append(id, ...nodes);\n } else if (pos === 'prependHtml' || pos === 'prepend' || pos === 'prependText') {\n nodeSlot.prepend(id, ...nodes);\n } else if (pos === 'clear') {\n nodeSlot.clear(id);\n }\n}\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n */\nexport function applySlot(targetId: string, opt: OptionalType<ApplySlotOptions, 'position'>): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {\n\n\n const options: ApplySlotOptions = {position: 'replaceChildren', ...opt};\n\n\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor) as ApplySlotMetadata[];\n if (!metaList) {\n metaList = []\n ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({propertyKey, targetId, options});\n\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n\n const conf = getElementConfig(this);\n const currentWin = conf.window;\n const swcId = this._swcId;\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n const pos = options.position;\n\n const resToNodes = (res: string | Node) => {\n const nodes: Node[] = [];\n\n if (typeof res === 'string' && (pos === 'replaceChildrenHtml' || pos === 'appendHtml' || pos === 'prependHtml')) {\n const t = currentWin.document.createElement('template');\n t.innerHTML = res;\n nodes.push(...Array.from(t.content.childNodes));\n } else if (typeof res === 'string' && (pos === 'replaceChildrenText' || pos === 'prependText' || pos === 'appendText')) {\n nodes.push(currentWin.document.createTextNode(res));\n } else if (typeof res === 'object') {\n nodes.push(res);\n }\n SwcUtils.projectProcessHtml(swcId, nodes, currentDoc);\n return nodes;\n }\n\n const fallbackNodes: Node[] = [];\n if (options.fallback) {\n const res: string | Node = options.fallback.call(this, hostSet);\n const nodes: Node[] = resToNodes(res);\n fallbackNodes.push(...nodes);\n applyToDom(swcId, targetId, options.position, nodes);\n }\n\n let res = original.apply(this, args);\n if (res instanceof Promise) {\n return res.then(asyncRes => {\n const nodes = resToNodes(asyncRes)\n fallbackNodes.forEach((it: any) => it.remove());\n applyToDom(swcId, targetId, options.position, nodes);\n })\n } else {\n const nodes: Node[] = resToNodes(res);\n applyToDom(swcId, targetId, options.position, nodes);\n }\n };\n };\n}\n\nexport function clearSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'clear'});\n}\n\nexport function prependHtmlSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prependHtml'});\n}\n\nexport function prependSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prepend'});\n}\n\nexport function prependTextSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prependText'});\n}\n\nexport function appendHtmlSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'appendHtml'});\n}\n\nexport function appendTextSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'appendText'});\n}\n\nexport function appendSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'append'});\n}\n\nexport function replaceChildrenHtmlSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildrenHtml'});\n}\n\nexport function replaceChildrenSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildren'});\n}\n\nexport function replaceChildrenTextSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildrenText'});\n}\n\n// export const findAllApplySlotMetadata = (target: any): Map<string | symbol, ApplySlotMetadata> => {\nexport const findAllApplySlotMetadata = (target: any): ApplySlotMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);\n};"],
5
+ "mappings": "AAAA,SAAsB,oBAAmB;AACzC,SAAQ,YAAY,wBAAuB;AAC3C,SAAQ,gBAAe;AACvB,SAAQ,gBAAe;AAmChB,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;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,UAAmC;AACjE,SAAO,UAAU,UAAU,EAAC,UAAU,cAAa,CAAC;AACtD;AAEO,SAAS,eAAe,UAAmC;AAChE,SAAO,UAAU,UAAU,EAAC,UAAU,aAAY,CAAC;AACrD;AAEO,SAAS,eAAe,UAAmC;AAChE,SAAO,UAAU,UAAU,EAAC,UAAU,aAAY,CAAC;AACrD;AAEO,SAAS,WAAW,UAAmC;AAC5D,SAAO,UAAU,UAAU,EAAC,UAAU,SAAQ,CAAC;AACjD;AAEO,SAAS,wBAAwB,UAAmC;AACzE,SAAO,UAAU,UAAU,EAAC,UAAU,sBAAqB,CAAC;AAC9D;AAEO,SAAS,oBAAoB,UAAmC;AACrE,SAAO,UAAU,UAAU,EAAC,UAAU,kBAAiB,CAAC;AAC1D;AAEO,SAAS,wBAAwB,UAAmC;AACzE,SAAO,UAAU,UAAU,EAAC,UAAU,sBAAqB,CAAC;AAC9D;AAGO,MAAM,2BAA2B,CAAC,WAAqC;AAC5E,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,yBAAyB,WAAW;AACtE;",
6
+ "names": ["res"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/changedAttributeThis.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for('simple-web-component:on-attribute-changed');\n\nexport interface ChangedAttributeThisOptions {\n type?: typeof Number | typeof Boolean | typeof String;\n while?: 'connected';\n}\n\nexport interface ChangedAttributeThisMetadata {\n attributeName: string;\n propertyKey: string | symbol;\n options: ChangedAttributeThisOptions;\n}\n\nconst convertValue = (val: any, type: any): any => {\n if (val === null || val === undefined) return val;\n if (type === Number) return Number(val);\n if (type === Boolean) return val === 'false' || val === '0' ? false : true;\n return val;\n};\n\n/**\n * @changedAttributeThis decorator - fires when any attribute on $this changes\n */\nexport function changedAttributeThis(attributeName?: string, options: ChangedAttributeThisOptions = {}): MethodDecorator {\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) as ChangedAttributeThisMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, metaList, constructor);\n }\n\n const name = attributeName || String(propertyKey);\n metaList.push({\n attributeName: name,\n propertyKey,\n options\n });\n };\n}\n\nexport const getChangedAttributeMetadata = (target: any): ChangedAttributeThisMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);\n};\n\nexport const findAllAttributeChangedMetadata = (target: any): Map<string, ChangedAttributeThisMetadata[]> => {\n const constructor = target instanceof Function ? target : target.constructor;\n const metaList = ReflectUtils.findAllMetadata<ChangedAttributeThisMetadata[]>(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) || [];\n\n const result = new Map<string, ChangedAttributeThisMetadata[]>();\n metaList.forEach(meta => {\n meta.forEach(item => {\n if (!result.has(item.attributeName)) {\n result.set(item.attributeName, []);\n }\n result.get(item.attributeName)!.push(item);\n });\n });\n return result;\n};\n\nexport const convertAttributeValue = (val: any, type?: typeof Number | typeof Boolean | typeof String): any => {\n return convertValue(val, type);\n};\n"],
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for('simple-web-component:on-attribute-changed');\n\nexport interface ChangedAttributeThisOptions {\n type?: typeof Number | typeof Boolean | typeof String;\n while?: 'connected';\n}\n\nexport interface ChangedAttributeThisMetadata {\n attributeName: string;\n propertyKey: string | symbol;\n options: ChangedAttributeThisOptions;\n}\n\nconst convertValue = (val: any, type: any): any => {\n if (val === null || val === undefined) return val;\n if (type === Number) return Number(val);\n if (type === Boolean) return val === 'false' || val === '0' ? false : true;\n return val;\n};\n\n/**\n * @changedAttributeThis decorator - fires when any attribute on $this changes\n */\nexport function changedAttributeThis(attributeName?: string, options: ChangedAttributeThisOptions = {}): MethodDecorator {\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) as ChangedAttributeThisMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, metaList, constructor);\n }\n\n const name = attributeName || String(propertyKey);\n metaList.push({\n attributeName: name,\n propertyKey,\n options\n });\n };\n}\n\nexport const getChangedAttributeMetadata = (target: any): ChangedAttributeThisMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);\n};\n\nexport const findAllAttributeChangedMetadata = (target: any): Map<string, ChangedAttributeThisMetadata[]> => {\n const constructor = target instanceof Function ? target : target.constructor;\n const metaList = ReflectUtils.findAllMetadata<ChangedAttributeThisMetadata[]>(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) || [];\n\n const result = new Map<string, ChangedAttributeThisMetadata[]>();\n metaList.forEach(meta => {\n meta.forEach(item => {\n if (!result.has(item.attributeName)) {\n result.set(item.attributeName, []);\n }\n result.get(item.attributeName)!.push(item);\n });\n });\n return result;\n};\n\nexport const convertAttributeValue = (val: any, type?: typeof Number | typeof Boolean | typeof String): any => {\n return convertValue(val, type);\n};\n"],
5
5
  "mappings": "AAAA,SAAS,oBAAoB;AAEtB,MAAM,oCAAoC,OAAO,IAAI,2CAA2C;AAavG,MAAM,eAAe,CAAC,KAAU,SAAmB;AACjD,MAAI,QAAQ,QAAQ,QAAQ,OAAW,QAAO;AAC9C,MAAI,SAAS,OAAQ,QAAO,OAAO,GAAG;AACtC,MAAI,SAAS,QAAS,QAAO,QAAQ,WAAW,QAAQ,MAAM,QAAQ;AACtE,SAAO;AACT;AAKO,SAAS,qBAAqB,eAAwB,UAAuC,CAAC,GAAoB;AACvH,SAAO,CAAC,QAAgB,gBAAiC;AACvD,UAAM,cAAc,OAAO;AAC3B,QAAI,WAAW,aAAa,eAAe,mCAAmC,WAAW;AACzF,QAAI,CAAC,UAAU;AACb,iBAAW,CAAC;AACZ,mBAAa,eAAe,mCAAmC,UAAU,WAAW;AAAA,IACtF;AAEA,UAAM,OAAO,iBAAiB,OAAO,WAAW;AAChD,aAAS,KAAK;AAAA,MACZ,eAAe;AAAA,MACf;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEO,MAAM,8BAA8B,CAAC,WAA4D;AACtG,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,mCAAmC,WAAW;AAChF;AAEO,MAAM,kCAAkC,CAAC,WAA6D;AAC3G,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,QAAM,WAAW,aAAa,gBAAgD,mCAAmC,WAAW,KAAK,CAAC;AAElI,QAAM,SAAS,oBAAI,IAA4C;AAC/D,WAAS,QAAQ,UAAQ;AACvB,SAAK,QAAQ,UAAQ;AACnB,UAAI,CAAC,OAAO,IAAI,KAAK,aAAa,GAAG;AACnC,eAAO,IAAI,KAAK,eAAe,CAAC,CAAC;AAAA,MACnC;AACA,aAAO,IAAI,KAAK,aAAa,EAAG,KAAK,IAAI;AAAA,IAC3C,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;AAEO,MAAM,wBAAwB,CAAC,KAAU,SAA+D;AAC7G,SAAO,aAAa,KAAK,IAAI;AAC/B;",
6
6
  "names": []
7
7
  }
@@ -3,18 +3,17 @@ import { getAddEventListenerMetadata } from "./addEventListener.js";
3
3
  import { findAllLifecycleMetadata, findAllOnConnectedAfterMetadata, findAllOnConnectedBeforeMetadata, findAllOnConnectedMetadata, ON_AFTER_ADOPTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_CONNECTED_COMPLETED_METADATA_KEY, ON_INITIALIZE_METADATA_KEY } from "./lifecycles.js";
4
4
  import { getEmitCustomEventMetadataList } from "./emitCustomEvent.js";
5
5
  import { convertAttributeValue, findAllAttributeChangedMetadata } from "./changedAttributeThis.js";
6
- import { findAllAttributeApplyMetadata } from "./applyAttribute.js";
7
- import { findAllAttributeMetadata, getAttributeValue } from "./attribute.js";
6
+ import { findAllAttributeApplyMetadata, findAllAttributeMetadata, getAttributeValue } from "./applyAttribute.js";
8
7
  import { getQueryMetadata } from "./query.js";
9
8
  import { getQueryAllMetadata } from "./queryAll.js";
10
9
  import { SwcUtils } from "../utils/Utils.js";
11
10
  import { DOM_EVENT_NAMES, HTML_TAG_ENTRIES } from "../config/config.js";
12
11
  import { SituationTypeContainer, SituationTypeContainers } from "@dooboostore/simple-boot/decorators/inject/Inject";
13
12
  import { InjectSituationType } from "../types/index.js";
14
- import { ConvertUtils, ElementApply, NodeSlot } from "@dooboostore/core-web";
13
+ import { ConvertUtils, ElementApply } from "@dooboostore/core-web";
15
14
  import { isSSR } from "../elements/SwcAppMixin.js";
16
- import { findAllApplySlotMetadata } from "./applySlot.js";
17
15
  import { findAllStateMetadata } from "./state.js";
16
+ import { findAllPropertyMetadata } from "./applyProperty.js";
18
17
  const ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
19
18
  const getElementConfig = (target) => {
20
19
  const constructor = target instanceof Function ? target : target.constructor;
@@ -27,13 +26,12 @@ const ensureInit = (inst) => {
27
26
  inst._boundListeners = [];
28
27
  inst.__swc_initialized = true;
29
28
  const target = inst instanceof Function ? inst : inst.constructor;
30
- const attributeList = findAllAttributeMetadata(target);
31
- attributeList.forEach((meta) => {
32
- const initUserData = inst[meta.propertyKey];
33
- delete inst[meta.propertyKey];
34
- if (initUserData !== void 0)
35
- inst[meta.propertyKey] = initUserData;
36
- });
29
+ const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
30
+ if (attributeAllList) {
31
+ attributeAllList.forEach((meta) => {
32
+ delete inst[meta.propertyKey];
33
+ });
34
+ }
37
35
  const queryList = getQueryMetadata(target);
38
36
  if (queryList) {
39
37
  queryList.forEach((meta) => {
@@ -46,9 +44,9 @@ const ensureInit = (inst) => {
46
44
  delete inst[meta.propertyKey];
47
45
  });
48
46
  }
49
- const slotAllList = findAllApplySlotMetadata(target);
50
- if (slotAllList) {
51
- slotAllList.filter((it) => it.type === "property").forEach((meta) => {
47
+ const propertyAllList = findAllPropertyMetadata(target).filter((it) => it.type === "property");
48
+ if (propertyAllList) {
49
+ propertyAllList.forEach((meta) => {
52
50
  delete inst[meta.propertyKey];
53
51
  });
54
52
  }
@@ -105,24 +103,6 @@ const getHandlers = (inst) => {
105
103
  const setupPrototype = (proto, win) => {
106
104
  if (proto.__swc_proto_setup) return;
107
105
  proto.__swc_proto_setup = true;
108
- proto.createSlotString = function(id) {
109
- return NodeSlot.slot(`${this._swcId}-${id}`);
110
- };
111
- proto.createEaHtml = function(id, script) {
112
- return ElementApply.html(id, script);
113
- };
114
- proto.createEaText = function(id, script) {
115
- return ElementApply.text(id, script);
116
- };
117
- proto.createEaAttribute = function(id, name, script) {
118
- return ElementApply.attribute(id, name, script);
119
- };
120
- proto.createEaEvent = function(id, name, script) {
121
- return ElementApply.event(id, name, script);
122
- };
123
- proto.createEaProperty = function(id, name, script) {
124
- return ElementApply.property(id, name, script);
125
- };
126
106
  proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
127
107
  ensureInit(this);
128
108
  const script = this.getAttribute(attrName);
@@ -252,8 +232,8 @@ const elementDefine = (name, config = {}) => (constructor) => {
252
232
  const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
253
233
  const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
254
234
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
255
- const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
256
- const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
235
+ const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.targetAttributeName).filter(Boolean);
236
+ const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.propertyKey || String(it.propertyKey));
257
237
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
258
238
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
259
239
  const proto = constructor.prototype;