@dooboostore/simple-web-component 1.0.35 → 1.0.36

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 (136) hide show
  1. package/README.md +21 -21
  2. package/dist/cjs/decorators/addEventListener.js +12 -4
  3. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +19 -18
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyClass.js +23 -22
  7. package/dist/cjs/decorators/applyClass.js.map +2 -2
  8. package/dist/cjs/decorators/applyNode.js +18 -17
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applyStyle.js +20 -19
  11. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  12. package/dist/cjs/decorators/attribute.js +16 -15
  13. package/dist/cjs/decorators/attribute.js.map +2 -2
  14. package/dist/cjs/decorators/{changedAttributeHost.js → changedAttributeThis.js} +6 -6
  15. package/dist/cjs/decorators/changedAttributeThis.js.map +7 -0
  16. package/dist/cjs/decorators/elementDefine.js +21 -20
  17. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  18. package/dist/cjs/decorators/emitCustomEvent.js +18 -16
  19. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  20. package/dist/cjs/decorators/index.js +1 -1
  21. package/dist/cjs/decorators/index.js.map +1 -1
  22. package/dist/cjs/decorators/query.js +38 -60
  23. package/dist/cjs/decorators/query.js.map +2 -2
  24. package/dist/cjs/decorators/queryAll.js +31 -63
  25. package/dist/cjs/decorators/queryAll.js.map +2 -2
  26. package/dist/cjs/decorators/setProperty.js +13 -12
  27. package/dist/cjs/decorators/setProperty.js.map +2 -2
  28. package/dist/cjs/elements/SwcAsync.js +6 -6
  29. package/dist/cjs/elements/SwcAsync.js.map +1 -1
  30. package/dist/cjs/elements/SwcChoose.js +5 -5
  31. package/dist/cjs/elements/SwcChoose.js.map +1 -1
  32. package/dist/cjs/elements/SwcIf.js +6 -6
  33. package/dist/cjs/elements/SwcIf.js.map +1 -1
  34. package/dist/cjs/elements/SwcLoop.js +5 -5
  35. package/dist/cjs/elements/SwcLoop.js.map +1 -1
  36. package/dist/cjs/elements/register.js +18 -18
  37. package/dist/cjs/elements/register.js.map +1 -1
  38. package/dist/cjs/types.js.map +1 -1
  39. package/dist/cjs/utils/Utils.js +13 -13
  40. package/dist/cjs/utils/Utils.js.map +2 -2
  41. package/dist/esm/decorators/addEventListener.js +12 -4
  42. package/dist/esm/decorators/addEventListener.js.map +2 -2
  43. package/dist/esm/decorators/applyAttribute.js +19 -18
  44. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  45. package/dist/esm/decorators/applyClass.js +23 -22
  46. package/dist/esm/decorators/applyClass.js.map +2 -2
  47. package/dist/esm/decorators/applyNode.js +18 -17
  48. package/dist/esm/decorators/applyNode.js.map +2 -2
  49. package/dist/esm/decorators/applyStyle.js +20 -19
  50. package/dist/esm/decorators/applyStyle.js.map +2 -2
  51. package/dist/esm/decorators/attribute.js +16 -15
  52. package/dist/esm/decorators/attribute.js.map +2 -2
  53. package/dist/esm/decorators/{changedAttributeHost.js → changedAttributeThis.js} +3 -3
  54. package/dist/esm/decorators/changedAttributeThis.js.map +7 -0
  55. package/dist/esm/decorators/elementDefine.js +19 -18
  56. package/dist/esm/decorators/elementDefine.js.map +2 -2
  57. package/dist/esm/decorators/emitCustomEvent.js +18 -16
  58. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  59. package/dist/esm/decorators/index.js +1 -1
  60. package/dist/esm/decorators/index.js.map +1 -1
  61. package/dist/esm/decorators/query.js +38 -60
  62. package/dist/esm/decorators/query.js.map +2 -2
  63. package/dist/esm/decorators/queryAll.js +31 -63
  64. package/dist/esm/decorators/queryAll.js.map +2 -2
  65. package/dist/esm/decorators/setProperty.js +13 -12
  66. package/dist/esm/decorators/setProperty.js.map +2 -2
  67. package/dist/esm/elements/SwcAsync.js +7 -7
  68. package/dist/esm/elements/SwcAsync.js.map +1 -1
  69. package/dist/esm/elements/SwcChoose.js +6 -6
  70. package/dist/esm/elements/SwcChoose.js.map +1 -1
  71. package/dist/esm/elements/SwcIf.js +7 -7
  72. package/dist/esm/elements/SwcIf.js.map +1 -1
  73. package/dist/esm/elements/SwcLoop.js +6 -6
  74. package/dist/esm/elements/SwcLoop.js.map +1 -1
  75. package/dist/esm/elements/register.js +19 -19
  76. package/dist/esm/elements/register.js.map +1 -1
  77. package/dist/esm/types.js.map +1 -1
  78. package/dist/esm/utils/Utils.js +13 -13
  79. package/dist/esm/utils/Utils.js.map +2 -2
  80. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +271 -308
  81. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  82. package/dist/types/decorators/addEventListener.d.ts +5 -7
  83. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  84. package/dist/types/decorators/applyAttribute.d.ts +4 -4
  85. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  86. package/dist/types/decorators/applyClass.d.ts +6 -6
  87. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  88. package/dist/types/decorators/applyNode.d.ts +6 -6
  89. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  90. package/dist/types/decorators/applyStyle.d.ts +4 -4
  91. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  92. package/dist/types/decorators/attribute.d.ts +5 -5
  93. package/dist/types/decorators/attribute.d.ts.map +1 -1
  94. package/dist/types/decorators/changedAttributeThis.d.ts +18 -0
  95. package/dist/types/decorators/changedAttributeThis.d.ts.map +1 -0
  96. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  97. package/dist/types/decorators/emitCustomEvent.d.ts +4 -9
  98. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  99. package/dist/types/decorators/index.d.ts +1 -1
  100. package/dist/types/decorators/query.d.ts +17 -63
  101. package/dist/types/decorators/query.d.ts.map +1 -1
  102. package/dist/types/decorators/queryAll.d.ts +6 -63
  103. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  104. package/dist/types/decorators/setProperty.d.ts +1 -1
  105. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  106. package/dist/types/types.d.ts +2 -2
  107. package/dist/types/types.d.ts.map +1 -1
  108. package/dist/types/utils/Utils.d.ts +7 -7
  109. package/dist/types/utils/Utils.d.ts.map +1 -1
  110. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +271 -308
  111. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  112. package/package.json +4 -4
  113. package/src/decorators/addEventListener.ts +11 -9
  114. package/src/decorators/applyAttribute.ts +16 -15
  115. package/src/decorators/applyClass.ts +18 -17
  116. package/src/decorators/applyNode.ts +21 -20
  117. package/src/decorators/applyStyle.ts +17 -16
  118. package/src/decorators/attribute.ts +20 -19
  119. package/src/decorators/{changedAttributeHost.ts → changedAttributeThis.ts} +10 -12
  120. package/src/decorators/elementDefine.ts +21 -20
  121. package/src/decorators/emitCustomEvent.ts +21 -26
  122. package/src/decorators/index.ts +1 -1
  123. package/src/decorators/query.ts +51 -124
  124. package/src/decorators/queryAll.ts +30 -127
  125. package/src/decorators/setProperty.ts +12 -11
  126. package/src/elements/SwcAsync.ts +7 -7
  127. package/src/elements/SwcChoose.ts +6 -6
  128. package/src/elements/SwcIf.ts +8 -8
  129. package/src/elements/SwcLoop.ts +6 -6
  130. package/src/elements/register.ts +20 -20
  131. package/src/types.ts +5 -5
  132. package/src/utils/Utils.ts +17 -18
  133. package/dist/cjs/decorators/changedAttributeHost.js.map +0 -7
  134. package/dist/esm/decorators/changedAttributeHost.js.map +0 -7
  135. package/dist/types/decorators/changedAttributeHost.d.ts +0 -20
  136. package/dist/types/decorators/changedAttributeHost.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcIf.ts"],
4
- "sourcesContent": ["import { changedAttributeHost } from '../decorators/changedAttributeHost';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils, ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\nimport { SwcIfInterface } from '../types';\nimport { attributeHost, getAttributeValue } from '../decorators';\n\nclass SwcIf extends HTMLTemplateElement implements SwcIfInterface {\n // id =\n // @attributeHost('value')\n _value: any;\n\n @attributeHost('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeHost('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n @attributeHost('skip-if-same')\n _skipIfSame: string | null;\n\n private _nodes: Node[] = [];\n\n get value(): boolean {\n return this._value;\n }\n\n set value(nv: any) {\n // this._value = nv;\n this.refresh(nv);\n }\n\n constructor() {\n super();\n }\n\n @changedAttributeHost('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeHost('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value);\n\n // skip-if-same 속성이 존재하고(true/빈 문자열), 이전 값과 새로운 값이 완전히 동일하면 렌더링 스킵!\n if (this.hasAttribute('skip-if-same') && this._value === targetValue && this._nodes.length > 0) {\n return;\n }\n\n this.cleanup();\n this._value = targetValue;\n\n const portal = this.parentElement;\n if (!portal || !this._value) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $value: this._value, $templateHost: this };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n this._nodes = Array.from(processedFragment.childNodes);\n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) (node as any).__swc_template_host = this;\n });\n\n portal.insertBefore(processedFragment, this.nextSibling);\n }\n\n private cleanup() {\n this._nodes.forEach(n => {\n const realNode = (n as any).__upgraded_instance || n;\n if (realNode.parentElement) {\n realNode.parentElement.removeChild(realNode);\n }\n });\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
4
+ "sourcesContent": ["import { changedAttributeThis } from '../decorators/changedAttributeThis';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils, ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\nimport { SwcIfInterface } from '../types';\nimport { attributeThis, getAttributeValue } from '../decorators';\n\nclass SwcIf extends HTMLTemplateElement implements SwcIfInterface {\n // id =\n // @attributeThis('value')\n _value: any;\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n @attributeThis('skip-if-same')\n _skipIfSame: string | null;\n\n private _nodes: Node[] = [];\n\n get value(): boolean {\n return this._value;\n }\n\n set value(nv: any) {\n // this._value = nv;\n this.refresh(nv);\n }\n\n constructor() {\n super();\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value);\n\n // skip-if-same 속성이 존재하고(true/빈 문자열), 이전 값과 새로운 값이 완전히 동일하면 렌더링 스킵!\n if (this.hasAttribute('skip-if-same') && this._value === targetValue && this._nodes.length > 0) {\n return;\n }\n\n this.cleanup();\n this._value = targetValue;\n\n const portal = this.parentElement;\n if (!portal || !this._value) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $value: this._value, $templateHost: this };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n this._nodes = Array.from(processedFragment.childNodes);\n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) (node as any).__swc_template_host = this;\n });\n\n portal.insertBefore(processedFragment, this.nextSibling);\n }\n\n private cleanup() {\n this._nodes.forEach(n => {\n const realNode = (n as any).__upgraded_instance || n;\n if (realNode.parentElement) {\n realNode.parentElement.removeChild(realNode);\n }\n });\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAE7B,SAAS,eAAe,yBAAyB;AAEjD,MAAM,cAAc,oBAAmB;EAerC,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EAEA,IAAI,MAAM,IAAO;AAEf,SAAK,QAAQ,EAAE;EACjB;EAEA,cAAA;AACE,UAAK;AAZC,SAAA,SAAiB,CAAA;EAazB;EAGQ,SAAS,OAAY,GAAW,GAAS;AAC/C,SAAK,SAAS;AACd,SAAK,QAAQ,KAAK,MAAM;EAC1B;;;;;EAOQ,mBAAmB,MAAc,WAAgB,SAAc,MAAkC;AACvG,QAAI,SAAc;AAClB,QAAI,MAAM;AACR,eAAS;QACP,YAAY;UACV,SAAS,EAAE,OAAO,GAAG,KAAK,KAAK,IAAI,KAAK,GAAG,KAAK,GAAG,GAAE;UACrD,YAAY,EAAE,OAAO,GAAG,KAAK,KAAK,KAAK,KAAK,GAAG,KAAK,GAAG,GAAE;UACzD,MAAM,EAAE,OAAO,GAAG,KAAK,KAAK,KAAK,KAAK,GAAG,KAAK,GAAG,GAAE;;;IAGzD;AACA,UAAM,KAAK,IAAI,iBAAiB,MAAM,MAAM;AAC5C,UAAM,MAAM,KAAK,eAAe,eAAe;AAG/C,eAAW,QAAQ,GAAG,eAAe,SAAS,GAAG;AAC/C,UAAI;AACF,cAAM,QAAQ,cAAc,cAAc;UACxC,QAAQ,aAAa,iBAAiB,KAAK,QAAQ,IAAI,QAAQ;UAC/D;UACA,MAAM;SACP;AACD,WAA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GA,WAAA;EADC,cAAc,oBAAoB;;;AAGnC,WAAA;EADC,cAAc,kBAAkB;;;AAIjC,WAAA;EADC,cAAc,cAAc;;;AAmBrB,WAAA;EADP,qBAAqB,OAAO;;;;;",
6
6
  "names": []
7
7
  }
@@ -7,11 +7,11 @@ var __decorate = function(decorators, target, key, desc) {
7
7
  var __metadata = function(k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { changedAttributeHost } from "../decorators/changedAttributeHost.js";
10
+ import { changedAttributeThis } from "../decorators/changedAttributeThis.js";
11
11
  import { SwcUtils } from "../utils/Utils.js";
12
12
  import { FunctionUtils, ActionExpression } from "@dooboostore/core";
13
13
  import { ConvertUtils } from "@dooboostore/core-web";
14
- import { attributeHost, getAttributeValue } from "../decorators/index.js";
14
+ import { attributeThis, getAttributeValue } from "../decorators/index.js";
15
15
  class SwcLoop extends HTMLTemplateElement {
16
16
  get value() {
17
17
  return this._value;
@@ -32,7 +32,7 @@ class SwcLoop extends HTMLTemplateElement {
32
32
  this._value = value;
33
33
  this.refresh(this._value);
34
34
  }
35
- // @changedAttributeHost('replace-wrap')
35
+ // @changedAttributeThis('replace-wrap')
36
36
  // private setReplaceWrap(replaceWrapAttr?: string | null) {
37
37
  // this.refresh();
38
38
  // }
@@ -160,15 +160,15 @@ class SwcLoop extends HTMLTemplateElement {
160
160
  }
161
161
  }
162
162
  __decorate([
163
- attributeHost("replace-wrap-start"),
163
+ attributeThis("replace-wrap-start"),
164
164
  __metadata("design:type", String)
165
165
  ], SwcLoop.prototype, "_replaceWrapStart", void 0);
166
166
  __decorate([
167
- attributeHost("replace-wrap-end"),
167
+ attributeThis("replace-wrap-end"),
168
168
  __metadata("design:type", String)
169
169
  ], SwcLoop.prototype, "_replaceWrapEnd", void 0);
170
170
  __decorate([
171
- changedAttributeHost("value"),
171
+ changedAttributeThis("value"),
172
172
  __metadata("design:type", Function),
173
173
  __metadata("design:paramtypes", [Object, String, String]),
174
174
  __metadata("design:returntype", void 0)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcLoop.ts"],
4
- "sourcesContent": ["import { changedAttributeHost } from '../decorators/changedAttributeHost';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils, ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\nimport { attributeHost, getAttributeValue } from '../decorators';\n\nclass SwcLoop extends HTMLTemplateElement {\n _value: any[] = [];\n\n @attributeHost('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeHost('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodeGroups: Node[][] = [];\n\n get value(): any[] {\n return this._value;\n }\n\n set value(nv: any[]) {\n this._value = nv;\n this.refresh(nv);\n }\n\n getValue(index: number) {\n return this._value?.[index];\n }\n\n constructor() {\n super();\n // console.log('swc SwcLoop constructor called!');\n // console.log('swc SwcLoop', this.getAttribute('value'));\n }\n\n @changedAttributeHost('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeHost('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n const expressions = ae.getExpressions('replace');\n for (const expr of expressions) {\n const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n try {\n const value = FunctionUtils.executeReturn({\n script: script,\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n private createFragmentAndNodes(items: any[], helperSet: any, startIndex: number = 0): { fragment: DocumentFragment; newNodesGroup: Node[][] } {\n const win = this.ownerDocument?.defaultView || window;\n const fragment = win.document.createDocumentFragment();\n const newNodesGroup: Node[][] = [];\n\n items.forEach((item, i) => {\n const index = startIndex + i;\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const temp = this.ownerDocument?.createElement('template') || document.createElement('template');\n temp.innerHTML = htmlString;\n\n const content = temp.content;\n const nodes = Array.from(content.childNodes);\n\n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n\n nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n newNodesGroup.push(nodes);\n fragment.appendChild(content);\n });\n\n return { fragment, newNodesGroup };\n }\n\n appendItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const startIndex = this._value ? this._value.length : 0;\n\n // 내부 상태(value) 업데이트 (기존 배열에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...(this._value || []), ...items];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, startIndex);\n this._nodeGroups.push(...newNodesGroup);\n\n console.log('뭐야 씨발');\n // append 위치 계산: 기존에 그려진 마지막 노드 뒤에 삽입, 없으면 템플릿 바로 뒤에 삽입\n let insertReference: Node | null = this.nextSibling;\n if (this._nodeGroups.length > items.length) {\n const lastExistingGroup = this._nodeGroups[this._nodeGroups.length - items.length - 1];\n if (lastExistingGroup && lastExistingGroup.length > 0) {\n const lastNode = lastExistingGroup[lastExistingGroup.length - 1];\n insertReference = lastNode.nextSibling;\n }\n }\n\n portal.insertBefore(fragment, insertReference);\n }\n\n async prependItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n // 내부 상태(value) 업데이트 (기존 배열의 앞쪽에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...items, ...(this._value || [])];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, 0);\n\n // 기존의 nodeGroups 배열 맨 앞에 새로운 그룹들을 추가\n this._nodeGroups = [...newNodesGroup, ...this._nodeGroups];\n\n // prepend 위치: 이 템플릿(SwcLoop) 노드의 바로 다음 위치 (가장 위)\n portal.insertBefore(fragment, this.nextSibling);\n }\n\n refresh(value?: any) {\n // 1. 그릴 대상 확정\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value ?? []);\n\n // 2. 화면 정리\n this.cleanup();\n\n // 3. 상태 완전 교체 (이어붙이지 않음!)\n this._value = targetValue;\n\n if (!this._value || this._value.length <= 0) return;\n\n // 4. 화면 다시 그리기 (appendItem을 쓰지 않고 바로 그리기)\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n helperSet.$templateHost = this;\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(this._value, helperSet, 0);\n\n this._nodeGroups = newNodesGroup;\n const portal = SwcUtils.getParentContainer(this);\n if (portal) {\n // console.log('append????!~~~~~!?',fragment)\n portal.insertBefore(fragment, this.nextSibling);\n }\n }\n\n private cleanup() {\n console.log('누가 cleanup');\n this._nodeGroups.forEach(nodes => nodes.forEach(n => n.parentElement?.removeChild(n)));\n this._nodeGroups = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
4
+ "sourcesContent": ["import { changedAttributeThis } from '../decorators/changedAttributeThis';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils, ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\nimport { attributeThis, getAttributeValue } from '../decorators';\n\nclass SwcLoop extends HTMLTemplateElement {\n _value: any[] = [];\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodeGroups: Node[][] = [];\n\n get value(): any[] {\n return this._value;\n }\n\n set value(nv: any[]) {\n this._value = nv;\n this.refresh(nv);\n }\n\n getValue(index: number) {\n return this._value?.[index];\n }\n\n constructor() {\n super();\n // console.log('swc SwcLoop constructor called!');\n // console.log('swc SwcLoop', this.getAttribute('value'));\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n const expressions = ae.getExpressions('replace');\n for (const expr of expressions) {\n const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n try {\n const value = FunctionUtils.executeReturn({\n script: script,\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n private createFragmentAndNodes(items: any[], helperSet: any, startIndex: number = 0): { fragment: DocumentFragment; newNodesGroup: Node[][] } {\n const win = this.ownerDocument?.defaultView || window;\n const fragment = win.document.createDocumentFragment();\n const newNodesGroup: Node[][] = [];\n\n items.forEach((item, i) => {\n const index = startIndex + i;\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const temp = this.ownerDocument?.createElement('template') || document.createElement('template');\n temp.innerHTML = htmlString;\n\n const content = temp.content;\n const nodes = Array.from(content.childNodes);\n\n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n\n nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n newNodesGroup.push(nodes);\n fragment.appendChild(content);\n });\n\n return { fragment, newNodesGroup };\n }\n\n appendItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const startIndex = this._value ? this._value.length : 0;\n\n // 내부 상태(value) 업데이트 (기존 배열에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...(this._value || []), ...items];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, startIndex);\n this._nodeGroups.push(...newNodesGroup);\n\n console.log('뭐야 씨발');\n // append 위치 계산: 기존에 그려진 마지막 노드 뒤에 삽입, 없으면 템플릿 바로 뒤에 삽입\n let insertReference: Node | null = this.nextSibling;\n if (this._nodeGroups.length > items.length) {\n const lastExistingGroup = this._nodeGroups[this._nodeGroups.length - items.length - 1];\n if (lastExistingGroup && lastExistingGroup.length > 0) {\n const lastNode = lastExistingGroup[lastExistingGroup.length - 1];\n insertReference = lastNode.nextSibling;\n }\n }\n\n portal.insertBefore(fragment, insertReference);\n }\n\n async prependItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n // 내부 상태(value) 업데이트 (기존 배열의 앞쪽에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...items, ...(this._value || [])];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, 0);\n\n // 기존의 nodeGroups 배열 맨 앞에 새로운 그룹들을 추가\n this._nodeGroups = [...newNodesGroup, ...this._nodeGroups];\n\n // prepend 위치: 이 템플릿(SwcLoop) 노드의 바로 다음 위치 (가장 위)\n portal.insertBefore(fragment, this.nextSibling);\n }\n\n refresh(value?: any) {\n // 1. 그릴 대상 확정\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value ?? []);\n\n // 2. 화면 정리\n this.cleanup();\n\n // 3. 상태 완전 교체 (이어붙이지 않음!)\n this._value = targetValue;\n\n if (!this._value || this._value.length <= 0) return;\n\n // 4. 화면 다시 그리기 (appendItem을 쓰지 않고 바로 그리기)\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n helperSet.$templateHost = this;\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(this._value, helperSet, 0);\n\n this._nodeGroups = newNodesGroup;\n const portal = SwcUtils.getParentContainer(this);\n if (portal) {\n // console.log('append????!~~~~~!?',fragment)\n portal.insertBefore(fragment, this.nextSibling);\n }\n }\n\n private cleanup() {\n console.log('누가 cleanup');\n this._nodeGroups.forEach(nodes => nodes.forEach(n => n.parentElement?.removeChild(n)));\n this._nodeGroups = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,e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IAAI;AACxD,cAAU,gBAAgB;AAC1B,UAAM,EAAE,UAAU,cAAa,IAAK,KAAK,uBAAuB,KAAK,QAAQ,WAAW,CAAC;AAEzF,SAAK,cAAc;AACnB,UAAM,SAAS,SAAS,mBAAmB,IAAI;AAC/C,QAAI,QAAQ;AAEV,aAAO,aAAa,UAAU,KAAK,WAAW;IAChD;EACF;EAEQ,UAAO;AACb,YAAQ,IAAI,sBAAY;AACxB,SAAK,YAAY,QAAQ,WAAS,MAAM,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC,CAAC;AACrF,SAAK,cAAc,CAAA;EACrB;EAEA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AAjMA,WAAA;EADC,cAAc,oBAAoB;;;AAGnC,WAAA;EADC,cAAc,kBAAkB;;;AAyBzB,WAAA;EADP,qBAAqB,OAAO;;;;;",
6
6
  "names": []
7
7
  }
@@ -7,7 +7,7 @@ var __decorate = function(decorators, target, key, desc) {
7
7
  var __metadata = function(k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { getElementConfig, elementDefine, attributeHost, changedAttributeHost, getAttributeValue } from "../decorators/index.js";
10
+ import { getElementConfig, elementDefine, attributeThis, changedAttributeThis, getAttributeValue } from "../decorators/index.js";
11
11
  import { SwcAppMixin } from "./SwcAppMixin.js";
12
12
  import { SwcUtils } from "../utils/Utils.js";
13
13
  import { FunctionUtils, ActionExpression } from "@dooboostore/core";
@@ -125,7 +125,7 @@ const registerAllElements = (w) => {
125
125
  this._value = value;
126
126
  this.refresh(this._value);
127
127
  }
128
- // @changedAttributeHost('replace-wrap')
128
+ // @changedAttributeThis('replace-wrap')
129
129
  // private setReplaceWrap(replaceWrapAttr?: string | null) {
130
130
  // this.refresh();
131
131
  // }
@@ -195,19 +195,19 @@ const registerAllElements = (w) => {
195
195
  }
196
196
  };
197
197
  __decorate([
198
- attributeHost("replace-wrap-start"),
198
+ attributeThis("replace-wrap-start"),
199
199
  __metadata("design:type", String)
200
200
  ], SwcIf.prototype, "_replaceWrapStart", void 0);
201
201
  __decorate([
202
- attributeHost("replace-wrap-end"),
202
+ attributeThis("replace-wrap-end"),
203
203
  __metadata("design:type", String)
204
204
  ], SwcIf.prototype, "_replaceWrapEnd", void 0);
205
205
  __decorate([
206
- attributeHost("skip-if-same"),
206
+ attributeThis("skip-if-same"),
207
207
  __metadata("design:type", String)
208
208
  ], SwcIf.prototype, "_skipIfSame", void 0);
209
209
  __decorate([
210
- changedAttributeHost("value"),
210
+ changedAttributeThis("value"),
211
211
  __metadata("design:type", Function),
212
212
  __metadata("design:paramtypes", [Object, String, String]),
213
213
  __metadata("design:returntype", void 0)
@@ -236,7 +236,7 @@ const registerAllElements = (w) => {
236
236
  this._value = value;
237
237
  this.refresh(this._value);
238
238
  }
239
- // @changedAttributeHost('replace-wrap')
239
+ // @changedAttributeThis('replace-wrap')
240
240
  // private setReplaceWrap(replaceWrapAttr?: string | null) {
241
241
  // this.refresh();
242
242
  // }
@@ -364,15 +364,15 @@ const registerAllElements = (w) => {
364
364
  }
365
365
  };
366
366
  __decorate([
367
- attributeHost("replace-wrap-start"),
367
+ attributeThis("replace-wrap-start"),
368
368
  __metadata("design:type", String)
369
369
  ], SwcLoop.prototype, "_replaceWrapStart", void 0);
370
370
  __decorate([
371
- attributeHost("replace-wrap-end"),
371
+ attributeThis("replace-wrap-end"),
372
372
  __metadata("design:type", String)
373
373
  ], SwcLoop.prototype, "_replaceWrapEnd", void 0);
374
374
  __decorate([
375
- changedAttributeHost("value"),
375
+ changedAttributeThis("value"),
376
376
  __metadata("design:type", Function),
377
377
  __metadata("design:paramtypes", [Object, String, String]),
378
378
  __metadata("design:returntype", void 0)
@@ -404,7 +404,7 @@ const registerAllElements = (w) => {
404
404
  this._value = value;
405
405
  this.refresh(this._value);
406
406
  }
407
- // @changedAttributeHost('replace-wrap')
407
+ // @changedAttributeThis('replace-wrap')
408
408
  // private setReplaceWrap(replaceWrapAttr?: string | null) {
409
409
  // this.refresh();
410
410
  // }
@@ -508,15 +508,15 @@ const registerAllElements = (w) => {
508
508
  }
509
509
  };
510
510
  __decorate([
511
- attributeHost("replace-wrap-start"),
511
+ attributeThis("replace-wrap-start"),
512
512
  __metadata("design:type", String)
513
513
  ], SwcChoose.prototype, "_replaceWrapStart", void 0);
514
514
  __decorate([
515
- attributeHost("replace-wrap-end"),
515
+ attributeThis("replace-wrap-end"),
516
516
  __metadata("design:type", String)
517
517
  ], SwcChoose.prototype, "_replaceWrapEnd", void 0);
518
518
  __decorate([
519
- changedAttributeHost("value"),
519
+ changedAttributeThis("value"),
520
520
  __metadata("design:type", Function),
521
521
  __metadata("design:paramtypes", [Object, String, String]),
522
522
  __metadata("design:returntype", void 0)
@@ -539,7 +539,7 @@ const registerAllElements = (w) => {
539
539
  setValue(valueAttr) {
540
540
  this.executeAsync(this._value);
541
541
  }
542
- // @changedAttributeHost('replace-wrap')
542
+ // @changedAttributeThis('replace-wrap')
543
543
  // private setReplaceWrap() {
544
544
  // this.executeAsync(this._value);
545
545
  // }
@@ -622,19 +622,19 @@ const registerAllElements = (w) => {
622
622
  }
623
623
  };
624
624
  __decorate([
625
- attributeHost("value"),
625
+ attributeThis("value"),
626
626
  __metadata("design:type", Object)
627
627
  ], SwcAsync.prototype, "_value", void 0);
628
628
  __decorate([
629
- attributeHost("replace-wrap-start"),
629
+ attributeThis("replace-wrap-start"),
630
630
  __metadata("design:type", String)
631
631
  ], SwcAsync.prototype, "_replaceWrapStart", void 0);
632
632
  __decorate([
633
- attributeHost("replace-wrap-end"),
633
+ attributeThis("replace-wrap-end"),
634
634
  __metadata("design:type", String)
635
635
  ], SwcAsync.prototype, "_replaceWrapEnd", void 0);
636
636
  __decorate([
637
- changedAttributeHost("value"),
637
+ changedAttributeThis("value"),
638
638
  __metadata("design:type", Function),
639
639
  __metadata("design:paramtypes", [String]),
640
640
  __metadata("design:returntype", void 0)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/register.ts"],
4
- "sourcesContent": ["import { getElementConfig, elementDefine, attributeHost, changedAttributeHost, getAttributeValue } from '../decorators';\nimport { SwcAppMixin } from './SwcAppMixin';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils,ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\n\ntype Constructor<T> = new (...args: any[]) => T;\n\nexport const registerAllElements = (w: any): Record<string, Constructor<HTMLElement>> => {\n const {\n HTMLElement: _HTMLElement,\n HTMLTemplateElement: _HTMLTemplateElement,\n DocumentFragment: _DocumentFragment,\n Node: _Node,\n Element: _Element,\n HTMLAnchorElement: _HTMLAnchorElement,\n HTMLAreaElement: _HTMLAreaElement,\n HTMLAudioElement: _HTMLAudioElement,\n HTMLBaseElement: _HTMLBaseElement,\n HTMLButtonElement: _HTMLButtonElement,\n HTMLCanvasElement: _HTMLCanvasElement,\n HTMLDataElement: _HTMLDataElement,\n HTMLDataListElement: _HTMLDataListElement,\n HTMLDetailsElement: _HTMLDetailsElement,\n HTMLDialogElement: _HTMLDialogElement,\n HTMLDivElement: _HTMLDivElement,\n HTMLDListElement: _HTMLDListElement,\n HTMLEmbedElement: _HTMLEmbedElement,\n HTMLFieldSetElement: _HTMLFieldSetElement,\n HTMLFormElement: _HTMLFormElement,\n HTMLHRElement: _HTMLHRElement,\n HTMLIFrameElement: _HTMLIFrameElement,\n HTMLImageElement: _HTMLImageElement,\n HTMLInputElement: _HTMLInputElement,\n HTMLLabelElement: _HTMLLabelElement,\n HTMLLegendElement: _HTMLLegendElement,\n HTMLLIElement: _HTMLLIElement,\n HTMLLinkElement: _HTMLLinkElement,\n HTMLMapElement: _HTMLMapElement,\n HTMLMetaElement: _HTMLMetaElement,\n HTMLMeterElement: _HTMLMeterElement,\n HTMLModElement: _HTMLModElement,\n HTMLObjectElement: _HTMLObjectElement,\n HTMLOListElement: _HTMLOListElement,\n HTMLOptGroupElement: _HTMLOptGroupElement,\n HTMLOptionElement: _HTMLOptionElement,\n HTMLOutputElement: _HTMLOutputElement,\n HTMLParagraphElement: _HTMLParagraphElement,\n HTMLParamElement: _HTMLParamElement,\n HTMLPictureElement: _HTMLPictureElement,\n HTMLPreElement: _HTMLPreElement,\n HTMLProgressElement: _HTMLProgressElement,\n HTMLQuoteElement: _HTMLQuoteElement,\n HTMLScriptElement: _HTMLScriptElement,\n HTMLSelectElement: _HTMLSelectElement,\n HTMLSlotElement: _HTMLSlotElement,\n HTMLSourceElement: _HTMLSourceElement,\n HTMLSpanElement: _HTMLSpanElement,\n HTMLStyleElement: _HTMLStyleElement,\n HTMLTableElement: _HTMLTableElement,\n HTMLTableSectionElement: _HTMLTableSectionElement,\n HTMLTableCellElement: _HTMLTableCellElement,\n HTMLTextAreaElement: _HTMLTextAreaElement,\n HTMLTimeElement: _HTMLTimeElement,\n HTMLTitleElement: _HTMLTitleElement,\n HTMLTableRowElement: _HTMLTableRowElement,\n HTMLTrackElement: _HTMLTrackElement,\n HTMLUListElement: _HTMLUListElement,\n HTMLVideoElement: _HTMLVideoElement,\n HTMLHeadingElement: _HTMLHeadingElement,\n HTMLBodyElement: _HTMLBodyElement,\n } = w as any;\n\n const HTMLElement = _HTMLElement as typeof globalThis.HTMLElement;\n const HTMLTemplateElement = _HTMLTemplateElement as typeof globalThis.HTMLTemplateElement;\n const DocumentFragment = _DocumentFragment as typeof globalThis.DocumentFragment;\n const Node = _Node as typeof globalThis.Node;\n const Element = _Element as typeof globalThis.Element;\n const HTMLAnchorElement = _HTMLAnchorElement as typeof globalThis.HTMLAnchorElement;\n const HTMLAreaElement = _HTMLAreaElement as typeof globalThis.HTMLAreaElement;\n const HTMLAudioElement = _HTMLAudioElement as typeof globalThis.HTMLAudioElement;\n const HTMLBaseElement = _HTMLBaseElement as typeof globalThis.HTMLBaseElement;\n const HTMLButtonElement = _HTMLButtonElement as typeof globalThis.HTMLButtonElement;\n const HTMLCanvasElement = _HTMLCanvasElement as typeof globalThis.HTMLCanvasElement;\n const HTMLDataElement = _HTMLDataElement as typeof globalThis.HTMLDataElement;\n const HTMLDataListElement = _HTMLDataListElement as typeof globalThis.HTMLDataListElement;\n const HTMLDetailsElement = _HTMLDetailsElement as typeof globalThis.HTMLDetailsElement;\n const HTMLDialogElement = _HTMLDialogElement as typeof globalThis.HTMLDialogElement;\n const HTMLDivElement = _HTMLDivElement as typeof globalThis.HTMLDivElement;\n const HTMLDListElement = _HTMLDListElement as typeof globalThis.HTMLDListElement;\n const HTMLEmbedElement = _HTMLEmbedElement as typeof globalThis.HTMLEmbedElement;\n const HTMLFieldSetElement = _HTMLFieldSetElement as typeof globalThis.HTMLFieldSetElement;\n const HTMLFormElement = _HTMLFormElement as typeof globalThis.HTMLFormElement;\n const HTMLHRElement = _HTMLHRElement as typeof globalThis.HTMLHRElement;\n const HTMLIFrameElement = _HTMLIFrameElement as typeof globalThis.HTMLIFrameElement;\n const HTMLImageElement = _HTMLImageElement as typeof globalThis.HTMLImageElement;\n const HTMLInputElement = _HTMLInputElement as typeof globalThis.HTMLInputElement;\n const HTMLLabelElement = _HTMLLabelElement as typeof globalThis.HTMLLabelElement;\n const HTMLLegendElement = _HTMLLegendElement as typeof globalThis.HTMLLegendElement;\n const HTMLLIElement = _HTMLLIElement as typeof globalThis.HTMLLIElement;\n const HTMLLinkElement = _HTMLLinkElement as typeof globalThis.HTMLLinkElement;\n const HTMLMapElement = _HTMLMapElement as typeof globalThis.HTMLMapElement;\n const HTMLMetaElement = _HTMLMetaElement as typeof globalThis.HTMLMetaElement;\n const HTMLMeterElement = _HTMLMeterElement as typeof globalThis.HTMLMeterElement;\n const HTMLModElement = _HTMLModElement as typeof globalThis.HTMLModElement;\n const HTMLObjectElement = _HTMLObjectElement as typeof globalThis.HTMLObjectElement;\n const HTMLOListElement = _HTMLOListElement as typeof globalThis.HTMLOListElement;\n const HTMLOptGroupElement = _HTMLOptGroupElement as typeof globalThis.HTMLOptGroupElement;\n const HTMLOptionElement = _HTMLOptionElement as typeof globalThis.HTMLOptionElement;\n const HTMLOutputElement = _HTMLOutputElement as typeof globalThis.HTMLOutputElement;\n const HTMLParagraphElement = _HTMLParagraphElement as typeof globalThis.HTMLParagraphElement;\n const HTMLParamElement = _HTMLParamElement as typeof globalThis.HTMLParamElement;\n const HTMLPictureElement = _HTMLPictureElement as typeof globalThis.HTMLPictureElement;\n const HTMLPreElement = _HTMLPreElement as typeof globalThis.HTMLPreElement;\n const HTMLProgressElement = _HTMLProgressElement as typeof globalThis.HTMLProgressElement;\n const HTMLQuoteElement = _HTMLQuoteElement as typeof globalThis.HTMLQuoteElement;\n const HTMLScriptElement = _HTMLScriptElement as typeof globalThis.HTMLScriptElement;\n const HTMLSelectElement = _HTMLSelectElement as typeof globalThis.HTMLSelectElement;\n const HTMLSlotElement = _HTMLSlotElement as typeof globalThis.HTMLSlotElement;\n const HTMLSourceElement = _HTMLSourceElement as typeof globalThis.HTMLSourceElement;\n const HTMLSpanElement = _HTMLSpanElement as typeof globalThis.HTMLSpanElement;\n const HTMLStyleElement = _HTMLStyleElement as typeof globalThis.HTMLStyleElement;\n const HTMLTableElement = _HTMLTableElement as typeof globalThis.HTMLTableElement;\n const HTMLTableSectionElement = _HTMLTableSectionElement as typeof globalThis.HTMLTableSectionElement;\n const HTMLTableCellElement = _HTMLTableCellElement as typeof globalThis.HTMLTableCellElement;\n const HTMLTextAreaElement = _HTMLTextAreaElement as typeof globalThis.HTMLTextAreaElement;\n const HTMLTimeElement = _HTMLTimeElement as typeof globalThis.HTMLTimeElement;\n const HTMLTitleElement = _HTMLTitleElement as typeof globalThis.HTMLTitleElement;\n const HTMLTableRowElement = _HTMLTableRowElement as typeof globalThis.HTMLTableRowElement;\n const HTMLTrackElement = _HTMLTrackElement as typeof globalThis.HTMLTrackElement;\n const HTMLUListElement = _HTMLUListElement as typeof globalThis.HTMLUListElement;\n const HTMLVideoElement = _HTMLVideoElement as typeof globalThis.HTMLVideoElement;\n const HTMLHeadingElement = _HTMLHeadingElement as typeof globalThis.HTMLHeadingElement;\n const HTMLBodyElement = _HTMLBodyElement as typeof globalThis.HTMLBodyElement;\n\n\n // --- Sub Templates ---\n @elementDefine('swc-loading', { extends: 'template', window: w }) class SwcLoading extends HTMLTemplateElement {}\n @elementDefine('swc-error', { extends: 'template', window: w }) class SwcError extends HTMLTemplateElement {}\n @elementDefine('swc-success', { extends: 'template', window: w }) class SwcSuccess extends HTMLTemplateElement {}\n @elementDefine('swc-when', { extends: 'template', window: w }) class SwcWhen extends HTMLTemplateElement {}\n @elementDefine('swc-otherwise', { extends: 'template', window: w }) class SwcOtherwise extends HTMLTemplateElement {}\n @elementDefine('swc-default', { extends: 'template', window: w }) class SwcDefault extends HTMLTemplateElement {}\n\n // --- Core Elements ---\n @elementDefine('swc-app', { window: w })\n class SwcApp extends SwcAppMixin(HTMLElement) {}\n\n @elementDefine('swc-if', { extends: 'template', window: w })\n class SwcIf extends HTMLTemplateElement {\n // id =\n // @attributeHost('value')\n _value: any;\n\n @attributeHost('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeHost('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n @attributeHost('skip-if-same')\n _skipIfSame: string | null;\n\n private _nodes: Node[] = [];\n\n get value(): boolean {\n return this._value;\n }\n\n set value(nv: any) {\n // this._value = nv;\n this.refresh(nv);\n }\n\n constructor() {\n super();\n }\n\n @changedAttributeHost('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeHost('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value);\n\n // skip-if-same 속성이 존재하고(true/빈 문자열), 이전 값과 새로운 값이 완전히 동일하면 렌더링 스킵!\n if (this.hasAttribute('skip-if-same') && this._value === targetValue && this._nodes.length > 0) {\n return;\n }\n\n this.cleanup();\n this._value = targetValue;\n\n const portal = this.parentElement;\n if (!portal || !this._value) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $value: this._value, $templateHost: this };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n this._nodes = Array.from(processedFragment.childNodes);\n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) (node as any).__swc_template_host = this;\n });\n\n portal.insertBefore(processedFragment, this.nextSibling);\n }\n\n private cleanup() {\n this._nodes.forEach(n => {\n const realNode = (n as any).__upgraded_instance || n;\n if (realNode.parentElement) {\n realNode.parentElement.removeChild(realNode);\n }\n });\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n @elementDefine('swc-loop', { extends: 'template', window: w })\n class SwcLoop extends HTMLTemplateElement {\n _value: any[] = [];\n\n @attributeHost('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeHost('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodeGroups: Node[][] = [];\n\n get value(): any[] {\n return this._value;\n }\n\n set value(nv: any[]) {\n this._value = nv;\n this.refresh(nv);\n }\n\n getValue(index: number) {\n return this._value?.[index];\n }\n\n constructor() {\n super();\n // console.log('swc SwcLoop constructor called!');\n // console.log('swc SwcLoop', this.getAttribute('value'));\n }\n\n @changedAttributeHost('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeHost('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n const expressions = ae.getExpressions('replace');\n for (const expr of expressions) {\n const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n try {\n const value = FunctionUtils.executeReturn({\n script: script,\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n private createFragmentAndNodes(items: any[], helperSet: any, startIndex: number = 0): { fragment: DocumentFragment; newNodesGroup: Node[][] } {\n const win = this.ownerDocument?.defaultView || window;\n const fragment = win.document.createDocumentFragment();\n const newNodesGroup: Node[][] = [];\n\n items.forEach((item, i) => {\n const index = startIndex + i;\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const temp = this.ownerDocument?.createElement('template') || document.createElement('template');\n temp.innerHTML = htmlString;\n\n const content = temp.content;\n const nodes = Array.from(content.childNodes);\n\n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n\n nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n newNodesGroup.push(nodes);\n fragment.appendChild(content);\n });\n\n return { fragment, newNodesGroup };\n }\n\n appendItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const startIndex = this._value ? this._value.length : 0;\n\n // 내부 상태(value) 업데이트 (기존 배열에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...(this._value || []), ...items];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, startIndex);\n this._nodeGroups.push(...newNodesGroup);\n\n console.log('뭐야 씨발');\n // append 위치 계산: 기존에 그려진 마지막 노드 뒤에 삽입, 없으면 템플릿 바로 뒤에 삽입\n let insertReference: Node | null = this.nextSibling;\n if (this._nodeGroups.length > items.length) {\n const lastExistingGroup = this._nodeGroups[this._nodeGroups.length - items.length - 1];\n if (lastExistingGroup && lastExistingGroup.length > 0) {\n const lastNode = lastExistingGroup[lastExistingGroup.length - 1];\n insertReference = lastNode.nextSibling;\n }\n }\n\n portal.insertBefore(fragment, insertReference);\n }\n\n async prependItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n // 내부 상태(value) 업데이트 (기존 배열의 앞쪽에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...items, ...(this._value || [])];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, 0);\n\n // 기존의 nodeGroups 배열 맨 앞에 새로운 그룹들을 추가\n this._nodeGroups = [...newNodesGroup, ...this._nodeGroups];\n\n // prepend 위치: 이 템플릿(SwcLoop) 노드의 바로 다음 위치 (가장 위)\n portal.insertBefore(fragment, this.nextSibling);\n }\n\n refresh(value?: any) {\n // 1. 그릴 대상 확정\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value ?? []);\n\n // 2. 화면 정리\n this.cleanup();\n\n // 3. 상태 완전 교체 (이어붙이지 않음!)\n this._value = targetValue;\n\n if (!this._value || this._value.length <= 0) return;\n\n // 4. 화면 다시 그리기 (appendItem을 쓰지 않고 바로 그리기)\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n helperSet.$templateHost = this;\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(this._value, helperSet, 0);\n\n this._nodeGroups = newNodesGroup;\n const portal = SwcUtils.getParentContainer(this);\n if (portal) {\n // console.log('append????!~~~~~!?',fragment)\n portal.insertBefore(fragment, this.nextSibling);\n }\n }\n\n private cleanup() {\n console.log('누가 cleanup');\n this._nodeGroups.forEach(nodes => nodes.forEach(n => n.parentElement?.removeChild(n)));\n this._nodeGroups = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n @elementDefine('swc-choose', { extends: 'template', window: w })\n class SwcChoose extends HTMLTemplateElement {\n _value: any;\n\n @attributeHost('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeHost('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodes: Node[] = [];\n private _previousTemplate: HTMLTemplateElement | null = null;\n\n get value(): any {\n return this._value;\n }\n\n set value(nv: any) {\n this._value = nv;\n this.refresh(this._value);\n }\n\n constructor() {\n super();\n // console.log('swc chooooooooooooooooooooooooose constructor called!');\n // console.log('swc cccccccss', this.getAttribute('value'));\n }\n\n // static get observedAttributes() {\n // return ['value'];\n // }\n\n attributeChangedCallback(na, o, n) {\n // console.log('-----------------choooooooose attr origin', na, o, n);\n }\n\n @changedAttributeHost('value')\n private setValue(value: any, o: string, n: string) {\n console.log('chooooooose value', value)\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeHost('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n value = getAttributeValue(this, 'value') ?? this._value;\n console.log('[DEBUG] SwcChoose.refresh called, value:', value);\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) {\n console.log('[DEBUG] SwcChoose portal is null!');\n return;\n }\n\n const win = (getElementConfig(this).window ?? this.ownerDocument?.defaultView) || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n const groupArgs = { ...helperSet, $value: value, $templateHost: this };\n\n const templates = Array.from(this.content.querySelectorAll('template'));\n let selected: HTMLTemplateElement | null = null;\n\n for (const t of templates) {\n if (t.getAttribute('is') === 'swc-when') {\n const attrVal = t.getAttribute('test') || '';\n let matches = false;\n\n\n\n const result = FunctionUtils.executeReturn({\n script: attrVal,\n context: t,\n args: groupArgs\n });\n matches = !!result;\n // Use ActionExpression to parse and extract script from value attribute\n // const ae = new ActionExpression(attrVal);\n // const expr = ae.getFirstExpression('replace');\n\n // if (expr) {\n // const decodedScript = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n // const result = FunctionUtils.executeReturn({\n // script: decodedScript,\n // context: t,\n // args: groupArgs\n // });\n // matches = !!result;\n // } else {\n // matches = String(attrVal) === String(value);\n // }\n\n if (matches) {\n selected = t;\n break;\n }\n }\n }\n\n const target = selected || (this.content.querySelector('template[is=\"swc-otherwise\"]') as HTMLTemplateElement);\n\n const skipValue = target?.getAttribute?.('skip-if-same');\n const skipValue2 = this._previousTemplate?.getAttribute?.('skip-if-same');\n const hasSkipIfSame = target?.hasAttribute?.('skip-if-same');\n const isSame = this._previousTemplate === target;\n // console.log('---rrrr---', this._previousTemplate, target, hasSkipIfSame, isSame, skipValue, skipValue2);\n if (hasSkipIfSame && isSame) {\n return;\n }\n\n this.cleanup();\n this._previousTemplate = target;\n\n if (target) {\n let htmlString = target.innerHTML;\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n // console.log('[DEBUG] SwcChoose processedFragment children:', processedFragment._childNodesInternal?.length);\n this._nodes = Array.from(processedFragment.childNodes);\n \n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n \n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n\n console.log(`[DEBUG] SwcChoose before insertBefore, portal: ${portal?.tagName}, isConnected: ${(portal as any)?.isConnected}`);\n portal.insertBefore(processedFragment, this.nextSibling);\n console.log('[DEBUG] SwcChoose after insertBefore');\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n @elementDefine('swc-async', { extends: 'template', window: w })\n class SwcAsync extends HTMLTemplateElement {\n @attributeHost('value')\n _value: any;\n @attributeHost('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeHost('replace-wrap-end')\n _replaceWrapEnd: string | null; resultValue?: any;\n\n get value(): boolean {\n return this._value;\n }\n\n set value(nv: any) {\n this.executeAsync(nv);\n }\n\n private _nodes: Node[] = [];\n\n @changedAttributeHost('value')\n private setValue(valueAttr?: string | null) {\n this.executeAsync(this._value);\n }\n\n // @changedAttributeHost('replace-wrap')\n // private setReplaceWrap() {\n // this.executeAsync(this._value);\n // }\n\n private executeAsync(result: any = this._value) {\n if (result === undefined || result === null) {\n this.refresh('default');\n return;\n }\n\n if (result instanceof Promise) {\n this.refresh('loading');\n result\n .then(v => {\n this.resultValue = v;\n this.refresh('success');\n })\n .catch(e => {\n console.error('[SWC-ASYNC] Promise rejected:', e);\n this.resultValue = e;\n this.refresh('error');\n });\n } else {\n this.resultValue = result;\n this.refresh('success');\n }\n }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(state: string = 'default') {\n // console.log('rrrrrrrrrrrrrrrrr', state);\n this.cleanup();\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const t = this.content.querySelector(`template[is=\"swc-${state}\"]`) as HTMLTemplateElement;\n if (t) {\n let htmlString = t.innerHTML;\n const groupArgs = { ...helperSet, $value: this._value, $state: state, $templateHost: this };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const temp = this.ownerDocument?.createElement('template') || document.createElement('template');\n temp.innerHTML = htmlString;\n const content = temp.content;\n\n this._nodes = Array.from(content.childNodes);\n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) (node as any).__template_swc_host = this;\n });\n\n portal.insertBefore(content, this.nextSibling);\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n // --- \"is\" Elements ---\n @elementDefine('swc-app-a', { extends: 'a', window: w })\n class SwcAppAnchor extends SwcAppMixin(HTMLAnchorElement) {}\n\n @elementDefine('swc-app-area', { extends: 'area', window: w })\n class SwcAppArea extends SwcAppMixin(HTMLAreaElement) {}\n\n @elementDefine('swc-app-audio', { extends: 'audio', window: w })\n class SwcAppAudio extends SwcAppMixin(HTMLAudioElement) {}\n\n @elementDefine('swc-app-base', { extends: 'base', window: w })\n class SwcAppBase extends SwcAppMixin(HTMLBaseElement) {}\n\n @elementDefine('swc-app-button', { extends: 'button', window: w })\n class SwcAppButton extends SwcAppMixin(HTMLButtonElement) {}\n\n @elementDefine('swc-app-canvas', { extends: 'canvas', window: w })\n class SwcAppCanvas extends SwcAppMixin(HTMLCanvasElement) {}\n\n @elementDefine('swc-app-data', { extends: 'data', window: w })\n class SwcAppData extends SwcAppMixin(HTMLDataElement) {}\n\n @elementDefine('swc-app-datalist', { extends: 'datalist', window: w })\n class SwcAppDataList extends SwcAppMixin(HTMLDataListElement) {}\n\n @elementDefine('swc-app-details', { extends: 'details', window: w })\n class SwcAppDetails extends SwcAppMixin(HTMLDetailsElement) {}\n\n @elementDefine('swc-app-dialog', { extends: 'dialog', window: w })\n class SwcAppDialog extends SwcAppMixin(HTMLDialogElement) {}\n\n @elementDefine('swc-app-div', { extends: 'div', window: w })\n class SwcAppDiv extends SwcAppMixin(HTMLDivElement) {}\n\n @elementDefine('swc-app-dl', { extends: 'dl', window: w })\n class SwcAppDList extends SwcAppMixin(HTMLDListElement) {}\n\n @elementDefine('swc-app-embed', { extends: 'embed', window: w })\n class SwcAppEmbed extends SwcAppMixin(HTMLEmbedElement) {}\n\n @elementDefine('swc-app-fieldset', { extends: 'fieldset', window: w })\n class SwcAppFieldSet extends SwcAppMixin(HTMLFieldSetElement) {}\n\n @elementDefine('swc-app-form', { extends: 'form', window: w })\n class SwcAppForm extends SwcAppMixin(HTMLFormElement) {}\n\n @elementDefine('swc-app-hr', { extends: 'hr', window: w })\n class SwcAppHR extends SwcAppMixin(HTMLHRElement) {}\n\n @elementDefine('swc-app-iframe', { extends: 'iframe', window: w })\n class SwcAppIFrame extends SwcAppMixin(HTMLIFrameElement) {}\n\n @elementDefine('swc-app-img', { extends: 'img', window: w })\n class SwcAppImage extends SwcAppMixin(HTMLImageElement) {}\n\n @elementDefine('swc-app-input', { extends: 'input', window: w })\n class SwcAppInput extends SwcAppMixin(HTMLInputElement) {}\n\n @elementDefine('swc-app-label', { extends: 'label', window: w })\n class SwcAppLabel extends SwcAppMixin(HTMLLabelElement) {}\n\n @elementDefine('swc-app-legend', { extends: 'legend', window: w })\n class SwcAppLegend extends SwcAppMixin(HTMLLegendElement) {}\n\n @elementDefine('swc-app-li', { extends: 'li', window: w })\n class SwcAppLI extends SwcAppMixin(HTMLLIElement) {}\n\n @elementDefine('swc-app-link', { extends: 'link', window: w })\n class SwcAppLink extends SwcAppMixin(HTMLLinkElement) {}\n\n @elementDefine('swc-app-map', { extends: 'map', window: w })\n class SwcAppMap extends SwcAppMixin(HTMLMapElement) {}\n\n @elementDefine('swc-app-meta', { extends: 'meta', window: w })\n class SwcAppMeta extends SwcAppMixin(HTMLMetaElement) {}\n\n @elementDefine('swc-app-meter', { extends: 'meter', window: w })\n class SwcAppMeter extends SwcAppMixin(HTMLMeterElement) {}\n\n @elementDefine('swc-app-del', { extends: 'del', window: w })\n class SwcAppMod extends SwcAppMixin(HTMLModElement) {}\n\n @elementDefine('swc-app-object', { extends: 'object', window: w })\n class SwcAppObject extends SwcAppMixin(HTMLObjectElement) {}\n\n @elementDefine('swc-app-ol', { extends: 'ol', window: w })\n class SwcAppOList extends SwcAppMixin(HTMLOListElement) {}\n\n @elementDefine('swc-app-optgroup', { extends: 'optgroup', window: w })\n class SwcAppOptGroup extends SwcAppMixin(HTMLOptGroupElement) {}\n\n @elementDefine('swc-app-option', { extends: 'option', window: w })\n class SwcAppOption extends SwcAppMixin(HTMLOptionElement) {}\n\n @elementDefine('swc-app-output', { extends: 'output', window: w })\n class SwcAppOutput extends SwcAppMixin(HTMLOutputElement) {}\n\n @elementDefine('swc-app-p', { extends: 'p', window: w })\n class SwcAppParagraph extends SwcAppMixin(HTMLParagraphElement) {}\n\n @elementDefine('swc-app-param', { extends: 'param', window: w })\n class SwcAppParam extends SwcAppMixin(HTMLParamElement) {}\n\n @elementDefine('swc-app-picture', { extends: 'picture', window: w })\n class SwcAppPicture extends SwcAppMixin(HTMLPictureElement) {}\n\n @elementDefine('swc-app-pre', { extends: 'pre', window: w })\n class SwcAppPre extends SwcAppMixin(HTMLPreElement) {}\n\n @elementDefine('swc-app-progress', { extends: 'progress', window: w })\n class SwcAppProgress extends SwcAppMixin(HTMLProgressElement) {}\n\n @elementDefine('swc-app-blockquote', { extends: 'blockquote', window: w })\n class SwcAppQuote extends SwcAppMixin(HTMLQuoteElement) {}\n\n @elementDefine('swc-app-script', { extends: 'script', window: w })\n class SwcAppScript extends SwcAppMixin(HTMLScriptElement) {}\n\n @elementDefine('swc-app-select', { extends: 'select', window: w })\n class SwcAppSelect extends SwcAppMixin(HTMLSelectElement) {}\n\n @elementDefine('swc-app-slot', { extends: 'slot', window: w })\n class SwcAppSlot extends SwcAppMixin(HTMLSlotElement) {}\n\n @elementDefine('swc-app-source', { extends: 'source', window: w })\n class SwcAppSource extends SwcAppMixin(HTMLSourceElement) {}\n\n @elementDefine('swc-app-span', { extends: 'span', window: w })\n class SwcAppSpan extends SwcAppMixin(HTMLSpanElement) {}\n\n @elementDefine('swc-app-style', { extends: 'style', window: w })\n class SwcAppStyle extends SwcAppMixin(HTMLStyleElement) {}\n\n @elementDefine('swc-app-table', { extends: 'table', window: w })\n class SwcAppTable extends SwcAppMixin(HTMLTableElement) {}\n\n @elementDefine('swc-app-tbody', { extends: 'tbody', window: w })\n class SwcAppTableSection extends SwcAppMixin(HTMLTableSectionElement) {}\n\n @elementDefine('swc-app-td', { extends: 'td', window: w })\n class SwcAppTableCell extends SwcAppMixin(HTMLTableCellElement) {}\n\n @elementDefine('swc-app-template', { extends: 'template', window: w })\n class SwcAppTemplate extends SwcAppMixin(HTMLTemplateElement) {}\n\n @elementDefine('swc-app-textarea', { extends: 'textarea', window: w })\n class SwcAppTextArea extends SwcAppMixin(HTMLTextAreaElement) {}\n\n @elementDefine('swc-app-time', { extends: 'time', window: w })\n class SwcAppTime extends SwcAppMixin(HTMLTimeElement) {}\n\n @elementDefine('swc-app-title', { extends: 'title', window: w })\n class SwcAppTitle extends SwcAppMixin(HTMLTitleElement) {}\n\n @elementDefine('swc-app-tr', { extends: 'tr', window: w })\n class SwcAppTableRow extends SwcAppMixin(HTMLTableRowElement) {}\n\n @elementDefine('swc-app-track', { extends: 'track', window: w })\n class SwcAppTrack extends SwcAppMixin(HTMLTrackElement) {}\n\n @elementDefine('swc-app-ul', { extends: 'ul', window: w })\n class SwcAppUList extends SwcAppMixin(HTMLUListElement) {}\n\n @elementDefine('swc-app-video', { extends: 'video', window: w })\n class SwcAppVideo extends SwcAppMixin(HTMLVideoElement) {}\n\n @elementDefine('swc-app-h1', { extends: 'h1', window: w })\n class SwcAppHeading extends SwcAppMixin(HTMLHeadingElement) {}\n\n @elementDefine('swc-app-body', { extends: 'body', window: w })\n class SwcAppBody extends SwcAppMixin(HTMLBodyElement) {}\n\n\n return {\n // Sub Templates\n SwcLoading,\n SwcError,\n SwcSuccess,\n SwcWhen,\n SwcOtherwise,\n SwcDefault,\n // Core Elements\n SwcApp,\n SwcIf,\n SwcLoop,\n SwcChoose,\n SwcAsync,\n // App Elements\n SwcAppAnchor,\n SwcAppArea,\n SwcAppAudio,\n SwcAppBase,\n SwcAppButton,\n SwcAppCanvas,\n SwcAppData,\n SwcAppDataList,\n SwcAppDetails,\n SwcAppDialog,\n SwcAppDiv,\n SwcAppDList,\n SwcAppEmbed,\n SwcAppFieldSet,\n SwcAppForm,\n SwcAppHR,\n SwcAppIFrame,\n SwcAppImage,\n SwcAppInput,\n SwcAppLabel,\n SwcAppLegend,\n SwcAppLI,\n SwcAppLink,\n SwcAppMap,\n SwcAppMeta,\n SwcAppMeter,\n SwcAppMod,\n SwcAppObject,\n SwcAppOList,\n SwcAppOptGroup,\n SwcAppOption,\n SwcAppOutput,\n SwcAppParagraph,\n SwcAppParam,\n SwcAppPicture,\n SwcAppPre,\n SwcAppProgress,\n SwcAppQuote,\n SwcAppScript,\n SwcAppSelect,\n SwcAppSlot,\n SwcAppSource,\n SwcAppSpan,\n SwcAppStyle,\n SwcAppTable,\n SwcAppTableSection,\n SwcAppTableCell,\n SwcAppTemplate,\n SwcAppTextArea,\n SwcAppTime,\n SwcAppTitle,\n SwcAppTableRow,\n SwcAppTrack,\n SwcAppUList,\n SwcAppVideo,\n SwcAppHeading,\n SwcAppBody,\n };\n};\n"],
4
+ "sourcesContent": ["import { getElementConfig, elementDefine, attributeThis, changedAttributeThis, getAttributeValue } from '../decorators';\nimport { SwcAppMixin } from './SwcAppMixin';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils,ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\n\ntype Constructor<T> = new (...args: any[]) => T;\n\nexport const registerAllElements = (w: any): Record<string, Constructor<HTMLElement>> => {\n const {\n HTMLElement: _HTMLElement,\n HTMLTemplateElement: _HTMLTemplateElement,\n DocumentFragment: _DocumentFragment,\n Node: _Node,\n Element: _Element,\n HTMLAnchorElement: _HTMLAnchorElement,\n HTMLAreaElement: _HTMLAreaElement,\n HTMLAudioElement: _HTMLAudioElement,\n HTMLBaseElement: _HTMLBaseElement,\n HTMLButtonElement: _HTMLButtonElement,\n HTMLCanvasElement: _HTMLCanvasElement,\n HTMLDataElement: _HTMLDataElement,\n HTMLDataListElement: _HTMLDataListElement,\n HTMLDetailsElement: _HTMLDetailsElement,\n HTMLDialogElement: _HTMLDialogElement,\n HTMLDivElement: _HTMLDivElement,\n HTMLDListElement: _HTMLDListElement,\n HTMLEmbedElement: _HTMLEmbedElement,\n HTMLFieldSetElement: _HTMLFieldSetElement,\n HTMLFormElement: _HTMLFormElement,\n HTMLHRElement: _HTMLHRElement,\n HTMLIFrameElement: _HTMLIFrameElement,\n HTMLImageElement: _HTMLImageElement,\n HTMLInputElement: _HTMLInputElement,\n HTMLLabelElement: _HTMLLabelElement,\n HTMLLegendElement: _HTMLLegendElement,\n HTMLLIElement: _HTMLLIElement,\n HTMLLinkElement: _HTMLLinkElement,\n HTMLMapElement: _HTMLMapElement,\n HTMLMetaElement: _HTMLMetaElement,\n HTMLMeterElement: _HTMLMeterElement,\n HTMLModElement: _HTMLModElement,\n HTMLObjectElement: _HTMLObjectElement,\n HTMLOListElement: _HTMLOListElement,\n HTMLOptGroupElement: _HTMLOptGroupElement,\n HTMLOptionElement: _HTMLOptionElement,\n HTMLOutputElement: _HTMLOutputElement,\n HTMLParagraphElement: _HTMLParagraphElement,\n HTMLParamElement: _HTMLParamElement,\n HTMLPictureElement: _HTMLPictureElement,\n HTMLPreElement: _HTMLPreElement,\n HTMLProgressElement: _HTMLProgressElement,\n HTMLQuoteElement: _HTMLQuoteElement,\n HTMLScriptElement: _HTMLScriptElement,\n HTMLSelectElement: _HTMLSelectElement,\n HTMLSlotElement: _HTMLSlotElement,\n HTMLSourceElement: _HTMLSourceElement,\n HTMLSpanElement: _HTMLSpanElement,\n HTMLStyleElement: _HTMLStyleElement,\n HTMLTableElement: _HTMLTableElement,\n HTMLTableSectionElement: _HTMLTableSectionElement,\n HTMLTableCellElement: _HTMLTableCellElement,\n HTMLTextAreaElement: _HTMLTextAreaElement,\n HTMLTimeElement: _HTMLTimeElement,\n HTMLTitleElement: _HTMLTitleElement,\n HTMLTableRowElement: _HTMLTableRowElement,\n HTMLTrackElement: _HTMLTrackElement,\n HTMLUListElement: _HTMLUListElement,\n HTMLVideoElement: _HTMLVideoElement,\n HTMLHeadingElement: _HTMLHeadingElement,\n HTMLBodyElement: _HTMLBodyElement,\n } = w as any;\n\n const HTMLElement = _HTMLElement as typeof globalThis.HTMLElement;\n const HTMLTemplateElement = _HTMLTemplateElement as typeof globalThis.HTMLTemplateElement;\n const DocumentFragment = _DocumentFragment as typeof globalThis.DocumentFragment;\n const Node = _Node as typeof globalThis.Node;\n const Element = _Element as typeof globalThis.Element;\n const HTMLAnchorElement = _HTMLAnchorElement as typeof globalThis.HTMLAnchorElement;\n const HTMLAreaElement = _HTMLAreaElement as typeof globalThis.HTMLAreaElement;\n const HTMLAudioElement = _HTMLAudioElement as typeof globalThis.HTMLAudioElement;\n const HTMLBaseElement = _HTMLBaseElement as typeof globalThis.HTMLBaseElement;\n const HTMLButtonElement = _HTMLButtonElement as typeof globalThis.HTMLButtonElement;\n const HTMLCanvasElement = _HTMLCanvasElement as typeof globalThis.HTMLCanvasElement;\n const HTMLDataElement = _HTMLDataElement as typeof globalThis.HTMLDataElement;\n const HTMLDataListElement = _HTMLDataListElement as typeof globalThis.HTMLDataListElement;\n const HTMLDetailsElement = _HTMLDetailsElement as typeof globalThis.HTMLDetailsElement;\n const HTMLDialogElement = _HTMLDialogElement as typeof globalThis.HTMLDialogElement;\n const HTMLDivElement = _HTMLDivElement as typeof globalThis.HTMLDivElement;\n const HTMLDListElement = _HTMLDListElement as typeof globalThis.HTMLDListElement;\n const HTMLEmbedElement = _HTMLEmbedElement as typeof globalThis.HTMLEmbedElement;\n const HTMLFieldSetElement = _HTMLFieldSetElement as typeof globalThis.HTMLFieldSetElement;\n const HTMLFormElement = _HTMLFormElement as typeof globalThis.HTMLFormElement;\n const HTMLHRElement = _HTMLHRElement as typeof globalThis.HTMLHRElement;\n const HTMLIFrameElement = _HTMLIFrameElement as typeof globalThis.HTMLIFrameElement;\n const HTMLImageElement = _HTMLImageElement as typeof globalThis.HTMLImageElement;\n const HTMLInputElement = _HTMLInputElement as typeof globalThis.HTMLInputElement;\n const HTMLLabelElement = _HTMLLabelElement as typeof globalThis.HTMLLabelElement;\n const HTMLLegendElement = _HTMLLegendElement as typeof globalThis.HTMLLegendElement;\n const HTMLLIElement = _HTMLLIElement as typeof globalThis.HTMLLIElement;\n const HTMLLinkElement = _HTMLLinkElement as typeof globalThis.HTMLLinkElement;\n const HTMLMapElement = _HTMLMapElement as typeof globalThis.HTMLMapElement;\n const HTMLMetaElement = _HTMLMetaElement as typeof globalThis.HTMLMetaElement;\n const HTMLMeterElement = _HTMLMeterElement as typeof globalThis.HTMLMeterElement;\n const HTMLModElement = _HTMLModElement as typeof globalThis.HTMLModElement;\n const HTMLObjectElement = _HTMLObjectElement as typeof globalThis.HTMLObjectElement;\n const HTMLOListElement = _HTMLOListElement as typeof globalThis.HTMLOListElement;\n const HTMLOptGroupElement = _HTMLOptGroupElement as typeof globalThis.HTMLOptGroupElement;\n const HTMLOptionElement = _HTMLOptionElement as typeof globalThis.HTMLOptionElement;\n const HTMLOutputElement = _HTMLOutputElement as typeof globalThis.HTMLOutputElement;\n const HTMLParagraphElement = _HTMLParagraphElement as typeof globalThis.HTMLParagraphElement;\n const HTMLParamElement = _HTMLParamElement as typeof globalThis.HTMLParamElement;\n const HTMLPictureElement = _HTMLPictureElement as typeof globalThis.HTMLPictureElement;\n const HTMLPreElement = _HTMLPreElement as typeof globalThis.HTMLPreElement;\n const HTMLProgressElement = _HTMLProgressElement as typeof globalThis.HTMLProgressElement;\n const HTMLQuoteElement = _HTMLQuoteElement as typeof globalThis.HTMLQuoteElement;\n const HTMLScriptElement = _HTMLScriptElement as typeof globalThis.HTMLScriptElement;\n const HTMLSelectElement = _HTMLSelectElement as typeof globalThis.HTMLSelectElement;\n const HTMLSlotElement = _HTMLSlotElement as typeof globalThis.HTMLSlotElement;\n const HTMLSourceElement = _HTMLSourceElement as typeof globalThis.HTMLSourceElement;\n const HTMLSpanElement = _HTMLSpanElement as typeof globalThis.HTMLSpanElement;\n const HTMLStyleElement = _HTMLStyleElement as typeof globalThis.HTMLStyleElement;\n const HTMLTableElement = _HTMLTableElement as typeof globalThis.HTMLTableElement;\n const HTMLTableSectionElement = _HTMLTableSectionElement as typeof globalThis.HTMLTableSectionElement;\n const HTMLTableCellElement = _HTMLTableCellElement as typeof globalThis.HTMLTableCellElement;\n const HTMLTextAreaElement = _HTMLTextAreaElement as typeof globalThis.HTMLTextAreaElement;\n const HTMLTimeElement = _HTMLTimeElement as typeof globalThis.HTMLTimeElement;\n const HTMLTitleElement = _HTMLTitleElement as typeof globalThis.HTMLTitleElement;\n const HTMLTableRowElement = _HTMLTableRowElement as typeof globalThis.HTMLTableRowElement;\n const HTMLTrackElement = _HTMLTrackElement as typeof globalThis.HTMLTrackElement;\n const HTMLUListElement = _HTMLUListElement as typeof globalThis.HTMLUListElement;\n const HTMLVideoElement = _HTMLVideoElement as typeof globalThis.HTMLVideoElement;\n const HTMLHeadingElement = _HTMLHeadingElement as typeof globalThis.HTMLHeadingElement;\n const HTMLBodyElement = _HTMLBodyElement as typeof globalThis.HTMLBodyElement;\n\n\n // --- Sub Templates ---\n @elementDefine('swc-loading', { extends: 'template', window: w }) class SwcLoading extends HTMLTemplateElement {}\n @elementDefine('swc-error', { extends: 'template', window: w }) class SwcError extends HTMLTemplateElement {}\n @elementDefine('swc-success', { extends: 'template', window: w }) class SwcSuccess extends HTMLTemplateElement {}\n @elementDefine('swc-when', { extends: 'template', window: w }) class SwcWhen extends HTMLTemplateElement {}\n @elementDefine('swc-otherwise', { extends: 'template', window: w }) class SwcOtherwise extends HTMLTemplateElement {}\n @elementDefine('swc-default', { extends: 'template', window: w }) class SwcDefault extends HTMLTemplateElement {}\n\n // --- Core Elements ---\n @elementDefine('swc-app', { window: w })\n class SwcApp extends SwcAppMixin(HTMLElement) {}\n\n @elementDefine('swc-if', { extends: 'template', window: w })\n class SwcIf extends HTMLTemplateElement {\n // id =\n // @attributeThis('value')\n _value: any;\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n @attributeThis('skip-if-same')\n _skipIfSame: string | null;\n\n private _nodes: Node[] = [];\n\n get value(): boolean {\n return this._value;\n }\n\n set value(nv: any) {\n // this._value = nv;\n this.refresh(nv);\n }\n\n constructor() {\n super();\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value);\n\n // skip-if-same 속성이 존재하고(true/빈 문자열), 이전 값과 새로운 값이 완전히 동일하면 렌더링 스킵!\n if (this.hasAttribute('skip-if-same') && this._value === targetValue && this._nodes.length > 0) {\n return;\n }\n\n this.cleanup();\n this._value = targetValue;\n\n const portal = this.parentElement;\n if (!portal || !this._value) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $value: this._value, $templateHost: this };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n this._nodes = Array.from(processedFragment.childNodes);\n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) (node as any).__swc_template_host = this;\n });\n\n portal.insertBefore(processedFragment, this.nextSibling);\n }\n\n private cleanup() {\n this._nodes.forEach(n => {\n const realNode = (n as any).__upgraded_instance || n;\n if (realNode.parentElement) {\n realNode.parentElement.removeChild(realNode);\n }\n });\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n @elementDefine('swc-loop', { extends: 'template', window: w })\n class SwcLoop extends HTMLTemplateElement {\n _value: any[] = [];\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodeGroups: Node[][] = [];\n\n get value(): any[] {\n return this._value;\n }\n\n set value(nv: any[]) {\n this._value = nv;\n this.refresh(nv);\n }\n\n getValue(index: number) {\n return this._value?.[index];\n }\n\n constructor() {\n super();\n // console.log('swc SwcLoop constructor called!');\n // console.log('swc SwcLoop', this.getAttribute('value'));\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n const expressions = ae.getExpressions('replace');\n for (const expr of expressions) {\n const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n try {\n const value = FunctionUtils.executeReturn({\n script: script,\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n private createFragmentAndNodes(items: any[], helperSet: any, startIndex: number = 0): { fragment: DocumentFragment; newNodesGroup: Node[][] } {\n const win = this.ownerDocument?.defaultView || window;\n const fragment = win.document.createDocumentFragment();\n const newNodesGroup: Node[][] = [];\n\n items.forEach((item, i) => {\n const index = startIndex + i;\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const temp = this.ownerDocument?.createElement('template') || document.createElement('template');\n temp.innerHTML = htmlString;\n\n const content = temp.content;\n const nodes = Array.from(content.childNodes);\n\n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n\n nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n newNodesGroup.push(nodes);\n fragment.appendChild(content);\n });\n\n return { fragment, newNodesGroup };\n }\n\n appendItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const startIndex = this._value ? this._value.length : 0;\n\n // 내부 상태(value) 업데이트 (기존 배열에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...(this._value || []), ...items];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, startIndex);\n this._nodeGroups.push(...newNodesGroup);\n\n console.log('뭐야 씨발');\n // append 위치 계산: 기존에 그려진 마지막 노드 뒤에 삽입, 없으면 템플릿 바로 뒤에 삽입\n let insertReference: Node | null = this.nextSibling;\n if (this._nodeGroups.length > items.length) {\n const lastExistingGroup = this._nodeGroups[this._nodeGroups.length - items.length - 1];\n if (lastExistingGroup && lastExistingGroup.length > 0) {\n const lastNode = lastExistingGroup[lastExistingGroup.length - 1];\n insertReference = lastNode.nextSibling;\n }\n }\n\n portal.insertBefore(fragment, insertReference);\n }\n\n async prependItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n // 내부 상태(value) 업데이트 (기존 배열의 앞쪽에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...items, ...(this._value || [])];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, 0);\n\n // 기존의 nodeGroups 배열 맨 앞에 새로운 그룹들을 추가\n this._nodeGroups = [...newNodesGroup, ...this._nodeGroups];\n\n // prepend 위치: 이 템플릿(SwcLoop) 노드의 바로 다음 위치 (가장 위)\n portal.insertBefore(fragment, this.nextSibling);\n }\n\n refresh(value?: any) {\n // 1. 그릴 대상 확정\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value ?? []);\n\n // 2. 화면 정리\n this.cleanup();\n\n // 3. 상태 완전 교체 (이어붙이지 않음!)\n this._value = targetValue;\n\n if (!this._value || this._value.length <= 0) return;\n\n // 4. 화면 다시 그리기 (appendItem을 쓰지 않고 바로 그리기)\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n helperSet.$templateHost = this;\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(this._value, helperSet, 0);\n\n this._nodeGroups = newNodesGroup;\n const portal = SwcUtils.getParentContainer(this);\n if (portal) {\n // console.log('append????!~~~~~!?',fragment)\n portal.insertBefore(fragment, this.nextSibling);\n }\n }\n\n private cleanup() {\n console.log('누가 cleanup');\n this._nodeGroups.forEach(nodes => nodes.forEach(n => n.parentElement?.removeChild(n)));\n this._nodeGroups = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n @elementDefine('swc-choose', { extends: 'template', window: w })\n class SwcChoose extends HTMLTemplateElement {\n _value: any;\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodes: Node[] = [];\n private _previousTemplate: HTMLTemplateElement | null = null;\n\n get value(): any {\n return this._value;\n }\n\n set value(nv: any) {\n this._value = nv;\n this.refresh(this._value);\n }\n\n constructor() {\n super();\n // console.log('swc chooooooooooooooooooooooooose constructor called!');\n // console.log('swc cccccccss', this.getAttribute('value'));\n }\n\n // static get observedAttributes() {\n // return ['value'];\n // }\n\n attributeChangedCallback(na, o, n) {\n // console.log('-----------------choooooooose attr origin', na, o, n);\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n console.log('chooooooose value', value)\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n value = getAttributeValue(this, 'value') ?? this._value;\n console.log('[DEBUG] SwcChoose.refresh called, value:', value);\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) {\n console.log('[DEBUG] SwcChoose portal is null!');\n return;\n }\n\n const win = (getElementConfig(this).window ?? this.ownerDocument?.defaultView) || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n const groupArgs = { ...helperSet, $value: value, $templateHost: this };\n\n const templates = Array.from(this.content.querySelectorAll('template'));\n let selected: HTMLTemplateElement | null = null;\n\n for (const t of templates) {\n if (t.getAttribute('is') === 'swc-when') {\n const attrVal = t.getAttribute('test') || '';\n let matches = false;\n\n\n\n const result = FunctionUtils.executeReturn({\n script: attrVal,\n context: t,\n args: groupArgs\n });\n matches = !!result;\n // Use ActionExpression to parse and extract script from value attribute\n // const ae = new ActionExpression(attrVal);\n // const expr = ae.getFirstExpression('replace');\n\n // if (expr) {\n // const decodedScript = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n // const result = FunctionUtils.executeReturn({\n // script: decodedScript,\n // context: t,\n // args: groupArgs\n // });\n // matches = !!result;\n // } else {\n // matches = String(attrVal) === String(value);\n // }\n\n if (matches) {\n selected = t;\n break;\n }\n }\n }\n\n const target = selected || (this.content.querySelector('template[is=\"swc-otherwise\"]') as HTMLTemplateElement);\n\n const skipValue = target?.getAttribute?.('skip-if-same');\n const skipValue2 = this._previousTemplate?.getAttribute?.('skip-if-same');\n const hasSkipIfSame = target?.hasAttribute?.('skip-if-same');\n const isSame = this._previousTemplate === target;\n // console.log('---rrrr---', this._previousTemplate, target, hasSkipIfSame, isSame, skipValue, skipValue2);\n if (hasSkipIfSame && isSame) {\n return;\n }\n\n this.cleanup();\n this._previousTemplate = target;\n\n if (target) {\n let htmlString = target.innerHTML;\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n // console.log('[DEBUG] SwcChoose processedFragment children:', processedFragment._childNodesInternal?.length);\n this._nodes = Array.from(processedFragment.childNodes);\n \n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n \n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n\n console.log(`[DEBUG] SwcChoose before insertBefore, portal: ${portal?.tagName}, isConnected: ${(portal as any)?.isConnected}`);\n portal.insertBefore(processedFragment, this.nextSibling);\n console.log('[DEBUG] SwcChoose after insertBefore');\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n @elementDefine('swc-async', { extends: 'template', window: w })\n class SwcAsync extends HTMLTemplateElement {\n @attributeThis('value')\n _value: any;\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null; resultValue?: any;\n\n get value(): boolean {\n return this._value;\n }\n\n set value(nv: any) {\n this.executeAsync(nv);\n }\n\n private _nodes: Node[] = [];\n\n @changedAttributeThis('value')\n private setValue(valueAttr?: string | null) {\n this.executeAsync(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap() {\n // this.executeAsync(this._value);\n // }\n\n private executeAsync(result: any = this._value) {\n if (result === undefined || result === null) {\n this.refresh('default');\n return;\n }\n\n if (result instanceof Promise) {\n this.refresh('loading');\n result\n .then(v => {\n this.resultValue = v;\n this.refresh('success');\n })\n .catch(e => {\n console.error('[SWC-ASYNC] Promise rejected:', e);\n this.resultValue = e;\n this.refresh('error');\n });\n } else {\n this.resultValue = result;\n this.refresh('success');\n }\n }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(state: string = 'default') {\n // console.log('rrrrrrrrrrrrrrrrr', state);\n this.cleanup();\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const t = this.content.querySelector(`template[is=\"swc-${state}\"]`) as HTMLTemplateElement;\n if (t) {\n let htmlString = t.innerHTML;\n const groupArgs = { ...helperSet, $value: this._value, $state: state, $templateHost: this };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const temp = this.ownerDocument?.createElement('template') || document.createElement('template');\n temp.innerHTML = htmlString;\n const content = temp.content;\n\n this._nodes = Array.from(content.childNodes);\n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) (node as any).__template_swc_host = this;\n });\n\n portal.insertBefore(content, this.nextSibling);\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n }\n\n // --- \"is\" Elements ---\n @elementDefine('swc-app-a', { extends: 'a', window: w })\n class SwcAppAnchor extends SwcAppMixin(HTMLAnchorElement) {}\n\n @elementDefine('swc-app-area', { extends: 'area', window: w })\n class SwcAppArea extends SwcAppMixin(HTMLAreaElement) {}\n\n @elementDefine('swc-app-audio', { extends: 'audio', window: w })\n class SwcAppAudio extends SwcAppMixin(HTMLAudioElement) {}\n\n @elementDefine('swc-app-base', { extends: 'base', window: w })\n class SwcAppBase extends SwcAppMixin(HTMLBaseElement) {}\n\n @elementDefine('swc-app-button', { extends: 'button', window: w })\n class SwcAppButton extends SwcAppMixin(HTMLButtonElement) {}\n\n @elementDefine('swc-app-canvas', { extends: 'canvas', window: w })\n class SwcAppCanvas extends SwcAppMixin(HTMLCanvasElement) {}\n\n @elementDefine('swc-app-data', { extends: 'data', window: w })\n class SwcAppData extends SwcAppMixin(HTMLDataElement) {}\n\n @elementDefine('swc-app-datalist', { extends: 'datalist', window: w })\n class SwcAppDataList extends SwcAppMixin(HTMLDataListElement) {}\n\n @elementDefine('swc-app-details', { extends: 'details', window: w })\n class SwcAppDetails extends SwcAppMixin(HTMLDetailsElement) {}\n\n @elementDefine('swc-app-dialog', { extends: 'dialog', window: w })\n class SwcAppDialog extends SwcAppMixin(HTMLDialogElement) {}\n\n @elementDefine('swc-app-div', { extends: 'div', window: w })\n class SwcAppDiv extends SwcAppMixin(HTMLDivElement) {}\n\n @elementDefine('swc-app-dl', { extends: 'dl', window: w })\n class SwcAppDList extends SwcAppMixin(HTMLDListElement) {}\n\n @elementDefine('swc-app-embed', { extends: 'embed', window: w })\n class SwcAppEmbed extends SwcAppMixin(HTMLEmbedElement) {}\n\n @elementDefine('swc-app-fieldset', { extends: 'fieldset', window: w })\n class SwcAppFieldSet extends SwcAppMixin(HTMLFieldSetElement) {}\n\n @elementDefine('swc-app-form', { extends: 'form', window: w })\n class SwcAppForm extends SwcAppMixin(HTMLFormElement) {}\n\n @elementDefine('swc-app-hr', { extends: 'hr', window: w })\n class SwcAppHR extends SwcAppMixin(HTMLHRElement) {}\n\n @elementDefine('swc-app-iframe', { extends: 'iframe', window: w })\n class SwcAppIFrame extends SwcAppMixin(HTMLIFrameElement) {}\n\n @elementDefine('swc-app-img', { extends: 'img', window: w })\n class SwcAppImage extends SwcAppMixin(HTMLImageElement) {}\n\n @elementDefine('swc-app-input', { extends: 'input', window: w })\n class SwcAppInput extends SwcAppMixin(HTMLInputElement) {}\n\n @elementDefine('swc-app-label', { extends: 'label', window: w })\n class SwcAppLabel extends SwcAppMixin(HTMLLabelElement) {}\n\n @elementDefine('swc-app-legend', { extends: 'legend', window: w })\n class SwcAppLegend extends SwcAppMixin(HTMLLegendElement) {}\n\n @elementDefine('swc-app-li', { extends: 'li', window: w })\n class SwcAppLI extends SwcAppMixin(HTMLLIElement) {}\n\n @elementDefine('swc-app-link', { extends: 'link', window: w })\n class SwcAppLink extends SwcAppMixin(HTMLLinkElement) {}\n\n @elementDefine('swc-app-map', { extends: 'map', window: w })\n class SwcAppMap extends SwcAppMixin(HTMLMapElement) {}\n\n @elementDefine('swc-app-meta', { extends: 'meta', window: w })\n class SwcAppMeta extends SwcAppMixin(HTMLMetaElement) {}\n\n @elementDefine('swc-app-meter', { extends: 'meter', window: w })\n class SwcAppMeter extends SwcAppMixin(HTMLMeterElement) {}\n\n @elementDefine('swc-app-del', { extends: 'del', window: w })\n class SwcAppMod extends SwcAppMixin(HTMLModElement) {}\n\n @elementDefine('swc-app-object', { extends: 'object', window: w })\n class SwcAppObject extends SwcAppMixin(HTMLObjectElement) {}\n\n @elementDefine('swc-app-ol', { extends: 'ol', window: w })\n class SwcAppOList extends SwcAppMixin(HTMLOListElement) {}\n\n @elementDefine('swc-app-optgroup', { extends: 'optgroup', window: w })\n class SwcAppOptGroup extends SwcAppMixin(HTMLOptGroupElement) {}\n\n @elementDefine('swc-app-option', { extends: 'option', window: w })\n class SwcAppOption extends SwcAppMixin(HTMLOptionElement) {}\n\n @elementDefine('swc-app-output', { extends: 'output', window: w })\n class SwcAppOutput extends SwcAppMixin(HTMLOutputElement) {}\n\n @elementDefine('swc-app-p', { extends: 'p', window: w })\n class SwcAppParagraph extends SwcAppMixin(HTMLParagraphElement) {}\n\n @elementDefine('swc-app-param', { extends: 'param', window: w })\n class SwcAppParam extends SwcAppMixin(HTMLParamElement) {}\n\n @elementDefine('swc-app-picture', { extends: 'picture', window: w })\n class SwcAppPicture extends SwcAppMixin(HTMLPictureElement) {}\n\n @elementDefine('swc-app-pre', { extends: 'pre', window: w })\n class SwcAppPre extends SwcAppMixin(HTMLPreElement) {}\n\n @elementDefine('swc-app-progress', { extends: 'progress', window: w })\n class SwcAppProgress extends SwcAppMixin(HTMLProgressElement) {}\n\n @elementDefine('swc-app-blockquote', { extends: 'blockquote', window: w })\n class SwcAppQuote extends SwcAppMixin(HTMLQuoteElement) {}\n\n @elementDefine('swc-app-script', { extends: 'script', window: w })\n class SwcAppScript extends SwcAppMixin(HTMLScriptElement) {}\n\n @elementDefine('swc-app-select', { extends: 'select', window: w })\n class SwcAppSelect extends SwcAppMixin(HTMLSelectElement) {}\n\n @elementDefine('swc-app-slot', { extends: 'slot', window: w })\n class SwcAppSlot extends SwcAppMixin(HTMLSlotElement) {}\n\n @elementDefine('swc-app-source', { extends: 'source', window: w })\n class SwcAppSource extends SwcAppMixin(HTMLSourceElement) {}\n\n @elementDefine('swc-app-span', { extends: 'span', window: w })\n class SwcAppSpan extends SwcAppMixin(HTMLSpanElement) {}\n\n @elementDefine('swc-app-style', { extends: 'style', window: w })\n class SwcAppStyle extends SwcAppMixin(HTMLStyleElement) {}\n\n @elementDefine('swc-app-table', { extends: 'table', window: w })\n class SwcAppTable extends SwcAppMixin(HTMLTableElement) {}\n\n @elementDefine('swc-app-tbody', { extends: 'tbody', window: w })\n class SwcAppTableSection extends SwcAppMixin(HTMLTableSectionElement) {}\n\n @elementDefine('swc-app-td', { extends: 'td', window: w })\n class SwcAppTableCell extends SwcAppMixin(HTMLTableCellElement) {}\n\n @elementDefine('swc-app-template', { extends: 'template', window: w })\n class SwcAppTemplate extends SwcAppMixin(HTMLTemplateElement) {}\n\n @elementDefine('swc-app-textarea', { extends: 'textarea', window: w })\n class SwcAppTextArea extends SwcAppMixin(HTMLTextAreaElement) {}\n\n @elementDefine('swc-app-time', { extends: 'time', window: w })\n class SwcAppTime extends SwcAppMixin(HTMLTimeElement) {}\n\n @elementDefine('swc-app-title', { extends: 'title', window: w })\n class SwcAppTitle extends SwcAppMixin(HTMLTitleElement) {}\n\n @elementDefine('swc-app-tr', { extends: 'tr', window: w })\n class SwcAppTableRow extends SwcAppMixin(HTMLTableRowElement) {}\n\n @elementDefine('swc-app-track', { extends: 'track', window: w })\n class SwcAppTrack extends SwcAppMixin(HTMLTrackElement) {}\n\n @elementDefine('swc-app-ul', { extends: 'ul', window: w })\n class SwcAppUList extends SwcAppMixin(HTMLUListElement) {}\n\n @elementDefine('swc-app-video', { extends: 'video', window: w })\n class SwcAppVideo extends SwcAppMixin(HTMLVideoElement) {}\n\n @elementDefine('swc-app-h1', { extends: 'h1', window: w })\n class SwcAppHeading extends SwcAppMixin(HTMLHeadingElement) {}\n\n @elementDefine('swc-app-body', { extends: 'body', window: w })\n class SwcAppBody extends SwcAppMixin(HTMLBodyElement) {}\n\n\n return {\n // Sub Templates\n SwcLoading,\n SwcError,\n SwcSuccess,\n SwcWhen,\n SwcOtherwise,\n SwcDefault,\n // Core Elements\n SwcApp,\n SwcIf,\n SwcLoop,\n SwcChoose,\n SwcAsync,\n // App Elements\n SwcAppAnchor,\n SwcAppArea,\n SwcAppAudio,\n SwcAppBase,\n SwcAppButton,\n SwcAppCanvas,\n SwcAppData,\n SwcAppDataList,\n SwcAppDetails,\n SwcAppDialog,\n SwcAppDiv,\n SwcAppDList,\n SwcAppEmbed,\n SwcAppFieldSet,\n SwcAppForm,\n SwcAppHR,\n SwcAppIFrame,\n SwcAppImage,\n SwcAppInput,\n SwcAppLabel,\n SwcAppLegend,\n SwcAppLI,\n SwcAppLink,\n SwcAppMap,\n SwcAppMeta,\n SwcAppMeter,\n SwcAppMod,\n SwcAppObject,\n SwcAppOList,\n SwcAppOptGroup,\n SwcAppOption,\n SwcAppOutput,\n SwcAppParagraph,\n SwcAppParam,\n SwcAppPicture,\n SwcAppPre,\n SwcAppProgress,\n SwcAppQuote,\n SwcAppScript,\n SwcAppSelect,\n SwcAppSlot,\n SwcAppSource,\n SwcAppSpan,\n SwcAppStyle,\n SwcAppTable,\n SwcAppTableSection,\n SwcAppTableCell,\n SwcAppTemplate,\n SwcAppTextArea,\n SwcAppTime,\n SwcAppTitle,\n SwcAppTableRow,\n SwcAppTrack,\n SwcAppUList,\n SwcAppVideo,\n SwcAppHeading,\n SwcAppBody,\n };\n};\n"],
5
5
  "mappings": ";;;;;;;;;AAAA,SAAS,kBAAkB,eAAe,eAAe,sBAAsB,yBAAyB;AACxG,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,eAAc,wBAAwB;AAC/C,SAAS,oBAAoB;AAItB,MAAM,sBAAsB,CAAC,MAAoD;AACtF,QAAM,EACJ,aAAa,cACb,qBAAqB,sBACrB,kBAAkB,mBAClB,MAAM,OACN,SAAS,UACT,mBAAmB,oBACnB,iBAAiB,kBACjB,kBAAkB,mBAClB,iBAAiB,k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,YAAY,kBAAkB,EAAC;;AAArD,kBAAa,WAAA;IADlB,cAAc,cAAc,EAAE,SAAS,MAAM,QAAQ,EAAC,CAAE;KACnD,aAAa;AAGnB,MAAM,aAAN,MAAM,mBAAmB,YAAY,eAAe,EAAC;;AAA/C,eAAU,WAAA;IADf,cAAc,gBAAgB,EAAE,SAAS,QAAQ,QAAQ,EAAC,CAAE;KACvD,UAAU;AAGhB,SAAO;;IAEL;IACA;IACA;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/types.ts"],
4
- "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType} from \"./elements/SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = ':host' | ':window' | ':document' | ':parentHost' | ':appHost' | ':firstHost' | ':lastHost' | ':firstAppHost' | ':lastAppHost' | ':hosts' | ':appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement; // Current component itself\n $parentHost: HTMLElement | null; // Nearest parent SWC component\n $hosts: HTMLElement[]; // [root, ..., parent, self]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $parentHost (for backward compatibility or clarity)\n $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\nexport interface SwcChooseInterface extends HTMLTemplateElement {\n value: any;\n refresh(): void;\n}\nexport interface SwcIfInterface extends HTMLTemplateElement {\n value: any;\n refresh(): void;\n}\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n"],
4
+ "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType} from \"./elements/SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\nexport interface SwcChooseInterface extends HTMLTemplateElement {\n value: any;\n refresh(): void;\n}\nexport interface SwcIfInterface extends HTMLTemplateElement {\n value: any;\n refresh(): void;\n}\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n"],
5
5
  "mappings": "AAIO,IAAK,sBAAL,kBAAKA,yBAAL;AACL,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,iBAAc;AACd,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,gBAAa;AACb,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,oBAAiB;AACjB,EAAAA,qBAAA,mBAAgB;AAVN,SAAAA;AAAA,GAAA;",
6
6
  "names": ["InjectSituationType"]
7
7
  }
@@ -185,7 +185,7 @@ var SwcUtils;
185
185
  }
186
186
  return current;
187
187
  };
188
- SwcUtils2.findNearestSwcHost = (el) => {
188
+ SwcUtils2.findNearestSwcHostIncludingSelf = (el) => {
189
189
  const el1 = el;
190
190
  if (el1.__swc_host) return el1.__swc_host;
191
191
  let current = el.parentElement || el.getRootNode?.()?.host;
@@ -198,26 +198,26 @@ var SwcUtils;
198
198
  }
199
199
  return void 0;
200
200
  };
201
- SwcUtils2.findAllSwcHosts = (el) => {
201
+ SwcUtils2.findAllSwcHostsIncludingSelf = (el) => {
202
202
  const hosts = [];
203
- let current = (0, SwcUtils2.findNearestSwcHost)(el);
203
+ let current = (0, SwcUtils2.findNearestSwcHostIncludingSelf)(el);
204
204
  while (current) {
205
205
  hosts.push(current);
206
- current = (0, SwcUtils2.findNearestSwcHost)(current);
206
+ current = (0, SwcUtils2.findNearestSwcHostIncludingSelf)(current);
207
207
  }
208
208
  return hosts.reverse();
209
209
  };
210
210
  SwcUtils2.getHosts = (el) => {
211
- const ancestors = (0, SwcUtils2.findAllSwcHosts)(el);
211
+ const ancestors = (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
212
212
  if (getElementConfig(el)) return [...ancestors, el];
213
213
  return ancestors;
214
214
  };
215
215
  SwcUtils2.getHost = (el) => {
216
216
  if (getElementConfig(el)) return el;
217
- return (0, SwcUtils2.findNearestSwcHost)(el);
217
+ return (0, SwcUtils2.findNearestSwcHostIncludingSelf)(el);
218
218
  };
219
219
  SwcUtils2.getAppHosts = (el) => {
220
- const hosts = SwcUtils2.findAllParentAppHostsDirect(el);
220
+ const hosts = SwcUtils2.findAllAppHostsIncludingSelfDirect(el);
221
221
  return hosts;
222
222
  };
223
223
  SwcUtils2.getAppHost = (el) => {
@@ -225,11 +225,11 @@ var SwcUtils;
225
225
  const appHostsWithoutSelf = appHosts.filter((h) => h !== el);
226
226
  return appHostsWithoutSelf.length > 0 ? appHostsWithoutSelf[appHostsWithoutSelf.length - 1] : void 0;
227
227
  };
228
- SwcUtils2.findParentAppHostDirect = (el) => {
229
- const appHosts = (0, SwcUtils2.findAllParentAppHostsDirect)(el);
228
+ SwcUtils2.findAppHostIncludingSelfDirect = (el) => {
229
+ const appHosts = (0, SwcUtils2.findAllAppHostsIncludingSelfDirect)(el);
230
230
  return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;
231
231
  };
232
- SwcUtils2.findAllParentAppHostsDirect = (el) => {
232
+ SwcUtils2.findAllAppHostsIncludingSelfDirect = (el) => {
233
233
  const appHosts = [];
234
234
  const w = el.ownerDocument?.defaultView || (typeof window !== "undefined" ? window : void 0);
235
235
  if (!w) {
@@ -255,7 +255,7 @@ var SwcUtils;
255
255
  return appHosts.reverse();
256
256
  };
257
257
  SwcUtils2.getHostSet = (el) => {
258
- const ancestors = (0, SwcUtils2.findAllSwcHosts)(el);
258
+ const ancestors = (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
259
259
  const $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;
260
260
  const $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;
261
261
  const $hosts = ancestors;
@@ -269,7 +269,7 @@ var SwcUtils;
269
269
  }
270
270
  curr = curr.parentElement || curr.getRootNode().host;
271
271
  }
272
- const $appHosts = SwcUtils2.findAllParentAppHostsDirect(el);
272
+ const $appHosts = SwcUtils2.findAllAppHostsIncludingSelfDirect(el);
273
273
  const $appHost = $appHosts.length > 0 ? $appHosts[$appHosts.length - 1] === el ? $appHosts.length > 1 ? $appHosts[$appHosts.length - 2] : null : $appHosts[$appHosts.length - 1] : null;
274
274
  const $firstAppHost = $appHosts.length > 0 ? $appHosts[0] : null;
275
275
  return {
@@ -277,7 +277,7 @@ var SwcUtils;
277
277
  $parentHost,
278
278
  $hosts,
279
279
  $firstHost,
280
- $lastHost: $parentHost,
280
+ $lastHost: $host,
281
281
  $templateHost: el.__swc_template_host,
282
282
  $appHost,
283
283
  $appHosts,