@dooboostore/simple-web-component 1.0.19 → 1.0.22

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 (174) hide show
  1. package/README.md +2759 -201
  2. package/dist/cjs/decorators/addEventListener.js +8 -4
  3. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  4. package/dist/cjs/decorators/{appendChild.js → applyNode.js} +26 -18
  5. package/dist/cjs/decorators/applyNode.js.map +7 -0
  6. package/dist/cjs/decorators/attribute.js +162 -0
  7. package/dist/cjs/decorators/attribute.js.map +7 -0
  8. package/dist/cjs/decorators/{changedAttribute.js → changedAttributeHost.js} +11 -11
  9. package/dist/cjs/decorators/changedAttributeHost.js.map +7 -0
  10. package/dist/cjs/decorators/classList.js +15 -5
  11. package/dist/cjs/decorators/classList.js.map +2 -2
  12. package/dist/cjs/decorators/elementDefine.js +124 -46
  13. package/dist/cjs/decorators/elementDefine.js.map +3 -3
  14. package/dist/cjs/decorators/emitCustomEvent.js +8 -7
  15. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  16. package/dist/cjs/decorators/index.js +3 -3
  17. package/dist/cjs/decorators/index.js.map +2 -2
  18. package/dist/cjs/decorators/lifecycles.js +8 -4
  19. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  20. package/dist/cjs/decorators/onConnectedInnerHtml.js +4 -4
  21. package/dist/cjs/decorators/onConnectedInnerHtml.js.map +2 -2
  22. package/dist/cjs/decorators/query.js +9 -5
  23. package/dist/cjs/decorators/query.js.map +2 -2
  24. package/dist/cjs/decorators/queryAll.js +9 -5
  25. package/dist/cjs/decorators/queryAll.js.map +2 -2
  26. package/dist/cjs/decorators/setAttribute.js +51 -21
  27. package/dist/cjs/decorators/setAttribute.js.map +2 -2
  28. package/dist/cjs/decorators/style.js +4 -4
  29. package/dist/cjs/decorators/style.js.map +2 -2
  30. package/dist/cjs/elements/SwcAppEngine.js +8 -8
  31. package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
  32. package/dist/cjs/elements/SwcAppMixin.js +28 -1
  33. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  34. package/dist/cjs/elements/SwcAsync.js +6 -6
  35. package/dist/cjs/elements/SwcAsync.js.map +2 -2
  36. package/dist/cjs/elements/SwcChoose.js +6 -6
  37. package/dist/cjs/elements/SwcChoose.js.map +2 -2
  38. package/dist/cjs/elements/SwcIf.js +6 -6
  39. package/dist/cjs/elements/SwcIf.js.map +2 -2
  40. package/dist/cjs/elements/SwcLoop.js +6 -6
  41. package/dist/cjs/elements/SwcLoop.js.map +2 -2
  42. package/dist/cjs/elements/register.js +19 -18
  43. package/dist/cjs/elements/register.js.map +2 -2
  44. package/dist/cjs/index.js +6 -17
  45. package/dist/cjs/index.js.map +2 -2
  46. package/dist/cjs/router/ElementRouter.js +7 -7
  47. package/dist/cjs/router/ElementRouter.js.map +2 -2
  48. package/dist/cjs/types.js.map +2 -2
  49. package/dist/esm/decorators/addEventListener.js +5 -1
  50. package/dist/esm/decorators/addEventListener.js.map +2 -2
  51. package/dist/esm/decorators/{appendChild.js → applyNode.js} +23 -15
  52. package/dist/esm/decorators/applyNode.js.map +7 -0
  53. package/dist/esm/decorators/attribute.js +143 -0
  54. package/dist/esm/decorators/attribute.js.map +7 -0
  55. package/dist/esm/decorators/{changedAttribute.js → changedAttributeHost.js} +4 -4
  56. package/dist/esm/decorators/changedAttributeHost.js.map +7 -0
  57. package/dist/esm/decorators/classList.js +12 -2
  58. package/dist/esm/decorators/classList.js.map +2 -2
  59. package/dist/esm/decorators/elementDefine.js +119 -41
  60. package/dist/esm/decorators/elementDefine.js.map +2 -2
  61. package/dist/esm/decorators/emitCustomEvent.js +5 -4
  62. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  63. package/dist/esm/decorators/index.js +3 -3
  64. package/dist/esm/decorators/index.js.map +1 -1
  65. package/dist/esm/decorators/lifecycles.js +5 -1
  66. package/dist/esm/decorators/lifecycles.js.map +2 -2
  67. package/dist/esm/decorators/onConnectedInnerHtml.js +1 -1
  68. package/dist/esm/decorators/onConnectedInnerHtml.js.map +1 -1
  69. package/dist/esm/decorators/query.js +6 -2
  70. package/dist/esm/decorators/query.js.map +2 -2
  71. package/dist/esm/decorators/queryAll.js +6 -2
  72. package/dist/esm/decorators/queryAll.js.map +2 -2
  73. package/dist/esm/decorators/setAttribute.js +47 -17
  74. package/dist/esm/decorators/setAttribute.js.map +2 -2
  75. package/dist/esm/decorators/style.js +1 -1
  76. package/dist/esm/decorators/style.js.map +1 -1
  77. package/dist/esm/elements/SwcAppEngine.js +4 -4
  78. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  79. package/dist/esm/elements/SwcAppMixin.js +28 -1
  80. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  81. package/dist/esm/elements/SwcAsync.js +3 -3
  82. package/dist/esm/elements/SwcAsync.js.map +2 -2
  83. package/dist/esm/elements/SwcChoose.js +3 -3
  84. package/dist/esm/elements/SwcChoose.js.map +2 -2
  85. package/dist/esm/elements/SwcIf.js +3 -3
  86. package/dist/esm/elements/SwcIf.js.map +2 -2
  87. package/dist/esm/elements/SwcLoop.js +3 -3
  88. package/dist/esm/elements/SwcLoop.js.map +2 -2
  89. package/dist/esm/elements/register.js +7 -6
  90. package/dist/esm/elements/register.js.map +2 -2
  91. package/dist/esm/index.js +6 -17
  92. package/dist/esm/index.js.map +2 -2
  93. package/dist/esm/router/ElementRouter.js +2 -2
  94. package/dist/esm/router/ElementRouter.js.map +1 -1
  95. package/dist/esm/types.js.map +2 -2
  96. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +5444 -3317
  97. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  98. package/dist/types/decorators/addEventListener.d.ts +6 -0
  99. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  100. package/dist/types/decorators/applyNode.d.ts +38 -0
  101. package/dist/types/decorators/applyNode.d.ts.map +1 -0
  102. package/dist/types/decorators/attribute.d.ts +29 -0
  103. package/dist/types/decorators/attribute.d.ts.map +1 -0
  104. package/dist/types/decorators/{changedAttribute.d.ts → changedAttributeHost.d.ts} +6 -2
  105. package/dist/types/decorators/changedAttributeHost.d.ts.map +1 -0
  106. package/dist/types/decorators/classList.d.ts +25 -0
  107. package/dist/types/decorators/classList.d.ts.map +1 -1
  108. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  109. package/dist/types/decorators/emitCustomEvent.d.ts +14 -2
  110. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  111. package/dist/types/decorators/index.d.ts +3 -3
  112. package/dist/types/decorators/index.d.ts.map +1 -1
  113. package/dist/types/decorators/lifecycles.d.ts +2 -0
  114. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  115. package/dist/types/decorators/query.d.ts +6 -0
  116. package/dist/types/decorators/query.d.ts.map +1 -1
  117. package/dist/types/decorators/queryAll.d.ts +6 -0
  118. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  119. package/dist/types/decorators/setAttribute.d.ts +8 -0
  120. package/dist/types/decorators/setAttribute.d.ts.map +1 -1
  121. package/dist/types/elements/SwcAppEngine.d.ts +5 -4
  122. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  123. package/dist/types/elements/SwcAppMixin.d.ts +1 -1
  124. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  125. package/dist/types/elements/register.d.ts +1 -1
  126. package/dist/types/elements/register.d.ts.map +1 -1
  127. package/dist/types/index.d.ts +3 -14
  128. package/dist/types/index.d.ts.map +1 -1
  129. package/dist/types/router/ElementRouter.d.ts +1 -1
  130. package/dist/types/router/ElementRouter.d.ts.map +1 -1
  131. package/dist/types/types.d.ts +3 -1
  132. package/dist/types/types.d.ts.map +1 -1
  133. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +5444 -3317
  134. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  135. package/package.json +10 -5
  136. package/src/decorators/addEventListener.ts +10 -1
  137. package/src/decorators/applyNode.ts +127 -0
  138. package/src/decorators/attribute.ts +192 -0
  139. package/src/decorators/{changedAttribute.ts → changedAttributeHost.ts} +6 -2
  140. package/src/decorators/classList.ts +33 -1
  141. package/src/decorators/elementDefine.ts +148 -47
  142. package/src/decorators/emitCustomEvent.ts +14 -6
  143. package/src/decorators/index.ts +3 -3
  144. package/src/decorators/lifecycles.ts +4 -2
  145. package/src/decorators/onConnectedInnerHtml.ts +1 -1
  146. package/src/decorators/query.ts +10 -1
  147. package/src/decorators/queryAll.ts +10 -1
  148. package/src/decorators/setAttribute.ts +57 -17
  149. package/src/decorators/style.ts +1 -1
  150. package/src/elements/SwcAppEngine.ts +10 -8
  151. package/src/elements/SwcAppMixin.ts +34 -2
  152. package/src/elements/SwcAsync.ts +3 -3
  153. package/src/elements/SwcChoose.ts +3 -3
  154. package/src/elements/SwcIf.ts +3 -3
  155. package/src/elements/SwcLoop.ts +3 -3
  156. package/src/elements/register.ts +8 -6
  157. package/src/index.ts +8 -16
  158. package/src/router/ElementRouter.ts +2 -2
  159. package/src/types.ts +3 -1
  160. package/dist/cjs/decorators/appendChild.js.map +0 -7
  161. package/dist/cjs/decorators/changedAttribute.js.map +0 -7
  162. package/dist/cjs/decorators/replaceChildren.js +0 -79
  163. package/dist/cjs/decorators/replaceChildren.js.map +0 -7
  164. package/dist/esm/decorators/appendChild.js.map +0 -7
  165. package/dist/esm/decorators/changedAttribute.js.map +0 -7
  166. package/dist/esm/decorators/replaceChildren.js +0 -60
  167. package/dist/esm/decorators/replaceChildren.js.map +0 -7
  168. package/dist/types/decorators/appendChild.d.ts +0 -17
  169. package/dist/types/decorators/appendChild.d.ts.map +0 -1
  170. package/dist/types/decorators/changedAttribute.d.ts.map +0 -1
  171. package/dist/types/decorators/replaceChildren.d.ts +0 -9
  172. package/dist/types/decorators/replaceChildren.d.ts.map +0 -1
  173. package/src/decorators/appendChild.ts +0 -86
  174. package/src/decorators/replaceChildren.ts +0 -64
@@ -34,7 +34,34 @@ function SwcAppMixin(Base) {
34
34
  return this.__swc_engine.router;
35
35
  }
36
36
  async connect(config) {
37
- await this.__swc_engine.connect(config);
37
+ const mode = config?.connectMode || "direct";
38
+ if (mode !== "swap") {
39
+ await this.__swc_engine.connect(config);
40
+ this.setAttribute("swc-connect-mode", "direct");
41
+ return;
42
+ }
43
+ const parent = this.parentNode;
44
+ if (!parent) {
45
+ await this.__swc_engine.connect(config);
46
+ this.setAttribute("swc-connect-mode", "direct");
47
+ return;
48
+ }
49
+ const clonedApp = this.cloneNode(true);
50
+ clonedApp.style.display = "none";
51
+ parent.insertBefore(clonedApp, this.nextSibling);
52
+ try {
53
+ await clonedApp.connect({ ...config || {}, connectMode: "direct" });
54
+ if (this.parentNode) {
55
+ this.parentNode.removeChild(this);
56
+ }
57
+ clonedApp.setAttribute("swc-connect-mode", "swap");
58
+ clonedApp.style.display = "";
59
+ } catch (e) {
60
+ if (clonedApp.parentNode) {
61
+ clonedApp.parentNode.removeChild(clonedApp);
62
+ }
63
+ throw e;
64
+ }
38
65
  }
39
66
  connectedCallback() {
40
67
  if (super.connectedCallback) super.connectedCallback();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcAppMixin.ts"],
4
- "sourcesContent": ["import { SwcAppEngine, SwcAttributeConfigType } from './SwcAppEngine';\n\nexport function SwcAppMixin<T extends { new (...args: any[]): HTMLElement }>(Base: T) {\n return class extends Base {\n __swc_engine = new SwcAppEngine(this as any);\n\n get simpleApplication() {\n return this.__swc_engine.simpleApplication;\n }\n get router() {\n return this.__swc_engine.router;\n }\n\n async connect(config?: SwcAttributeConfigType) {\n await this.__swc_engine.connect(config);\n }\n\n connectedCallback() {\n // @ts-ignore\n if (super.connectedCallback) super.connectedCallback();\n this.connect();\n }\n\n disconnectedCallback() {\n // @ts-ignore\n if (super.disconnectedCallback) super.disconnectedCallback();\n this.__swc_engine.disconnect();\n }\n\n async routing(path: string) {\n await this.__swc_engine.router?.go(path);\n }\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAqD;AAE9C,SAAS,YAA6D,MAAS;AACpF,SAAO,cAAc,KAAK;AAAA,IAAnB;AAAA;AACL,0BAAe,IAAI,iCAAa,IAAW;AAAA;AAAA,IAE3C,IAAI,oBAAoB;AACtB,aAAO,KAAK,aAAa;AAAA,IAC3B;AAAA,IACA,IAAI,SAAS;AACX,aAAO,KAAK,aAAa;AAAA,IAC3B;AAAA,IAEA,MAAM,QAAQ,QAAiC;AAC7C,YAAM,KAAK,aAAa,QAAQ,MAAM;AAAA,IACxC;AAAA,IAEA,oBAAoB;AAElB,UAAI,MAAM,kBAAmB,OAAM,kBAAkB;AACrD,WAAK,QAAQ;AAAA,IACf;AAAA,IAEA,uBAAuB;AAErB,UAAI,MAAM,qBAAsB,OAAM,qBAAqB;AAC3D,WAAK,aAAa,WAAW;AAAA,IAC/B;AAAA,IAEA,MAAM,QAAQ,MAAc;AAC1B,YAAM,KAAK,aAAa,QAAQ,GAAG,IAAI;AAAA,IACzC;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { SwcAppEngine, SwcAttributeConfigType } from './SwcAppEngine';\nimport {SwcAppInterface} from \"../types\";\n\nexport function SwcAppMixin<T extends { new (...args: any[]): HTMLElement }>(Base: T) {\n return class extends Base implements SwcAppInterface{\n __swc_engine = new SwcAppEngine(this as any);\n\n get simpleApplication() {\n return this.__swc_engine.simpleApplication;\n }\n get router() {\n return this.__swc_engine.router;\n }\n\n async connect(config?: SwcAttributeConfigType) {\n const mode = config?.connectMode || 'direct';\n\n if (mode !== 'swap') {\n await this.__swc_engine.connect(config);\n this.setAttribute('swc-connect-mode', 'direct');\n return;\n }\n\n const parent = this.parentNode;\n if (!parent) {\n await this.__swc_engine.connect(config);\n this.setAttribute('swc-connect-mode', 'direct');\n return;\n }\n\n const clonedApp = this.cloneNode(true) as any;\n clonedApp.style.display = 'none';\n parent.insertBefore(clonedApp, this.nextSibling);\n\n try {\n await clonedApp.connect({ ...(config || {}), connectMode: 'direct' });\n if (this.parentNode) {\n this.parentNode.removeChild(this);\n }\n clonedApp.setAttribute('swc-connect-mode', 'swap');\n clonedApp.style.display = '';\n } catch (e) {\n if (clonedApp.parentNode) {\n clonedApp.parentNode.removeChild(clonedApp);\n }\n throw e;\n }\n }\n\n connectedCallback() {\n // @ts-ignore\n if (super.connectedCallback) super.connectedCallback();\n this.connect();\n }\n\n disconnectedCallback() {\n // @ts-ignore\n if (super.disconnectedCallback) super.disconnectedCallback();\n this.__swc_engine.disconnect();\n }\n\n async routing(path: string) {\n await this.__swc_engine.router?.go(path);\n }\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAqD;AAG9C,SAAS,YAA6D,MAAS;AACpF,SAAO,cAAc,KAA+B;AAAA,IAA7C;AAAA;AACL,0BAAe,IAAI,iCAAa,IAAW;AAAA;AAAA,IAE3C,IAAI,oBAAoB;AACtB,aAAO,KAAK,aAAa;AAAA,IAC3B;AAAA,IACA,IAAI,SAAS;AACX,aAAO,KAAK,aAAa;AAAA,IAC3B;AAAA,IAEA,MAAM,QAAQ,QAAiC;AAC7C,YAAM,OAAO,QAAQ,eAAe;AAEpC,UAAI,SAAS,QAAQ;AACnB,cAAM,KAAK,aAAa,QAAQ,MAAM;AACtC,aAAK,aAAa,oBAAoB,QAAQ;AAC9C;AAAA,MACF;AAEA,YAAM,SAAS,KAAK;AACpB,UAAI,CAAC,QAAQ;AACX,cAAM,KAAK,aAAa,QAAQ,MAAM;AACtC,aAAK,aAAa,oBAAoB,QAAQ;AAC9C;AAAA,MACF;AAEA,YAAM,YAAY,KAAK,UAAU,IAAI;AACrC,gBAAU,MAAM,UAAU;AAC1B,aAAO,aAAa,WAAW,KAAK,WAAW;AAE/C,UAAI;AACF,cAAM,UAAU,QAAQ,EAAE,GAAI,UAAU,CAAC,GAAI,aAAa,SAAS,CAAC;AACpE,YAAI,KAAK,YAAY;AACnB,eAAK,WAAW,YAAY,IAAI;AAAA,QAClC;AACA,kBAAU,aAAa,oBAAoB,MAAM;AACjD,kBAAU,MAAM,UAAU;AAAA,MAC5B,SAAS,GAAG;AACV,YAAI,UAAU,YAAY;AACxB,oBAAU,WAAW,YAAY,SAAS;AAAA,QAC5C;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,IAEA,oBAAoB;AAElB,UAAI,MAAM,kBAAmB,OAAM,kBAAkB;AACrD,WAAK,QAAQ;AAAA,IACf;AAAA,IAEA,uBAAuB;AAErB,UAAI,MAAM,qBAAsB,OAAM,qBAAqB;AAC3D,WAAK,aAAa,WAAW;AAAA,IAC/B;AAAA,IAEA,MAAM,QAAQ,MAAc;AAC1B,YAAM,KAAK,aAAa,QAAQ,GAAG,IAAI;AAAA,IACzC;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -20,9 +20,9 @@ __export(SwcAsync_exports, {
20
20
  SwcAsync: () => SwcAsync
21
21
  });
22
22
  module.exports = __toCommonJS(SwcAsync_exports);
23
- var import_changedAttribute = require("../decorators/changedAttribute");
23
+ var import_changedAttributeHost = require("../decorators/changedAttributeHost");
24
24
  var import_Utils = require("../utils/Utils");
25
- var import_FunctionUtils = require("@dooboostore/core/function/FunctionUtils");
25
+ var import_core = require("@dooboostore/core");
26
26
  var __decorate = function(decorators, target, key, desc) {
27
27
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
28
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -43,7 +43,7 @@ class SwcAsync extends HTMLTemplateElement {
43
43
  if (!portalScript)
44
44
  return this.parentElement;
45
45
  const win = this.ownerDocument?.defaultView || window;
46
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
46
+ const res = import_core.FunctionUtils.executeReturn({
47
47
  script: portalScript,
48
48
  context: this,
49
49
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -58,14 +58,14 @@ class SwcAsync extends HTMLTemplateElement {
58
58
  const script = this.getAttribute(attr);
59
59
  if (!script)
60
60
  return;
61
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
61
+ import_core.FunctionUtils.execute({ script, context: this, args });
62
62
  }
63
63
  refresh() {
64
64
  const script = this.getAttribute("on-get-value");
65
65
  if (!script)
66
66
  return;
67
67
  const win = this.ownerDocument?.defaultView || window;
68
- const result = import_FunctionUtils.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
68
+ const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
69
69
  if (result instanceof Promise) {
70
70
  this.render("loading");
71
71
  result.then((v) => {
@@ -115,7 +115,7 @@ class SwcAsync extends HTMLTemplateElement {
115
115
  }
116
116
  }
117
117
  __decorate([
118
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
118
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
119
119
  __metadata("design:type", Function),
120
120
  __metadata("design:paramtypes", []),
121
121
  __metadata("design:returntype", void 0)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcAsync.ts"],
4
- "sourcesContent": ["import { changedAttribute } from '../decorators/changedAttribute';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core/function/FunctionUtils';\n\nexport class SwcAsync extends HTMLTemplateElement {\n private _nodes: Node[] = [];\n private _value: any = null;\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n @changedAttribute('on-get-value')\n private refresh() {\n const script = this.getAttribute('on-get-value');\n if (!script) return;\n const win = this.ownerDocument?.defaultView || window;\n const result = FunctionUtils.executeReturn({ script, context: this, args: SwcUtils.getHelperAndHostSet(win, this) });\n\n if (result instanceof Promise) {\n this.render('loading');\n result\n .then(v => {\n this._value = v;\n this.render('success');\n })\n .catch(e => this.render('error'));\n } else {\n this._value = result;\n this.render('success');\n }\n }\n\n private render(state: string) {\n this.cleanup();\n const portal = this._resolvePortal();\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 const clone = t.content.cloneNode(true) as DocumentFragment;\n this._nodes = Array.from(clone.childNodes);\n const elements = this._nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0], $state: state };\n\n this._nodes.forEach((n, nodeIdx) => {\n if (n instanceof HTMLElement) (n as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n\n if (portal === this.parentElement) {\n portal.insertBefore(clone, this.nextSibling);\n } else {\n portal.appendChild(clone);\n }\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n connectedCallback() {\n this.refresh();\n }\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,8BAAiC;AACjC,mBAAyB;AACzB,2BAA8B;;;;;;;;;;AA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,cAAc,oBAAoB,KAAK,IAAI;AAClE,QAAI,GAAG;AACL,YAAM,QAAQ,EAAE,QAAQ,UAAU,IAAI;AACtC,WAAK,SAAS,MAAM,KAAK,MAAM,UAAU;AACzC,YAAM,WAAW,KAAK,OAAO,OAAO,OAAK,EAAE,aAAa,CAAC;AACzD,YAAM,YAAY,EAAE,GAAG,WAAW,QAAQ,KAAK,QAAQ,QAAQ,KAAK,QAAQ,WAAW,UAAU,eAAe,SAAS,CAAC,GAAG,QAAQ,MAAK;AAE1I,WAAK,OAAO,QAAQ,CAAC,GAAG,YAAW;AACjC,YAAI,aAAa;AAAc,YAAU,aAAa;AACtD,aAAK,sBAAsB,iBAAiB,EAAE,GAAG,WAAW,OAAO,GAAG,YAAY,SAAS,YAAY,EAAE,aAAa,EAAC,CAAE;MAC3H,CAAC;AAED,WAAK,sBAAsB,kBAAkB,SAAS;AAEtD,UAAI,WAAW,KAAK,eAAe;AACjC,eAAO,aAAa,OAAO,KAAK,WAAW;MAC7C,OAAO;AACL,eAAO,YAAY,KAAK;MAC1B;IACF;EACF;EAEQ,UAAO;AACb,SAAK,OAAO,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC;AACxD,SAAK,SAAS,CAAA;EAChB;EAEA,oBAAiB;AACf,SAAK,QAAO;EACd;EACA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AA5DQ,WAAA;MADP,0CAAiB,cAAc;;;;;",
4
+ "sourcesContent": ["import { changedAttributeHost } from '../decorators/changedAttributeHost';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core';\n\nexport class SwcAsync extends HTMLTemplateElement {\n private _nodes: Node[] = [];\n private _value: any = null;\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n @changedAttributeHost('on-get-value')\n private refresh() {\n const script = this.getAttribute('on-get-value');\n if (!script) return;\n const win = this.ownerDocument?.defaultView || window;\n const result = FunctionUtils.executeReturn({ script, context: this, args: SwcUtils.getHelperAndHostSet(win, this) });\n\n if (result instanceof Promise) {\n this.render('loading');\n result\n .then(v => {\n this._value = v;\n this.render('success');\n })\n .catch(e => this.render('error'));\n } else {\n this._value = result;\n this.render('success');\n }\n }\n\n private render(state: string) {\n this.cleanup();\n const portal = this._resolvePortal();\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 const clone = t.content.cloneNode(true) as DocumentFragment;\n this._nodes = Array.from(clone.childNodes);\n const elements = this._nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0], $state: state };\n\n this._nodes.forEach((n, nodeIdx) => {\n if (n instanceof HTMLElement) (n as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n\n if (portal === this.parentElement) {\n portal.insertBefore(clone, this.nextSibling);\n } else {\n portal.appendChild(clone);\n }\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n connectedCallback() {\n this.refresh();\n }\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAqC;AACr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K,IAAI;AAExD,UAAM,IAAI,KAAK,QAAQ,cAAc,oBAAoB,KAAK,IAAI;AAClE,QAAI,GAAG;AACL,YAAM,QAAQ,EAAE,QAAQ,UAAU,IAAI;AACtC,WAAK,SAAS,MAAM,KAAK,MAAM,UAAU;AACzC,YAAM,WAAW,KAAK,OAAO,OAAO,OAAK,EAAE,aAAa,CAAC;AACzD,YAAM,YAAY,EAAE,GAAG,WAAW,QAAQ,KAAK,QAAQ,QAAQ,KAAK,QAAQ,WAAW,UAAU,eAAe,SAAS,CAAC,GAAG,QAAQ,MAAK;AAE1I,WAAK,OAAO,QAAQ,CAAC,GAAG,YAAW;AACjC,YAAI,aAAa;AAAc,YAAU,aAAa;AACtD,aAAK,sBAAsB,iBAAiB,EAAE,GAAG,WAAW,OAAO,GAAG,YAAY,SAAS,YAAY,EAAE,aAAa,EAAC,CAAE;MAC3H,CAAC;AAED,WAAK,sBAAsB,kBAAkB,SAAS;AAEtD,UAAI,WAAW,KAAK,eAAe;AACjC,eAAO,aAAa,OAAO,KAAK,WAAW;MAC7C,OAAO;AACL,eAAO,YAAY,KAAK;MAC1B;IACF;EACF;EAEQ,UAAO;AACb,SAAK,OAAO,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC;AACxD,SAAK,SAAS,CAAA;EAChB;EAEA,oBAAiB;AACf,SAAK,QAAO;EACd;EACA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AA5DQ,WAAA;MADP,kDAAqB,cAAc;;;;;",
6
6
  "names": []
7
7
  }
@@ -20,9 +20,9 @@ __export(SwcChoose_exports, {
20
20
  SwcChoose: () => SwcChoose
21
21
  });
22
22
  module.exports = __toCommonJS(SwcChoose_exports);
23
- var import_changedAttribute = require("../decorators/changedAttribute");
23
+ var import_changedAttributeHost = require("../decorators/changedAttributeHost");
24
24
  var import_Utils = require("../utils/Utils");
25
- var import_FunctionUtils = require("@dooboostore/core/function/FunctionUtils");
25
+ var import_core = require("@dooboostore/core");
26
26
  var __decorate = function(decorators, target, key, desc) {
27
27
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
28
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -50,7 +50,7 @@ class SwcChoose extends HTMLTemplateElement {
50
50
  if (!portalScript)
51
51
  return this.parentElement;
52
52
  const win = this.ownerDocument?.defaultView || window;
53
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
53
+ const res = import_core.FunctionUtils.executeReturn({
54
54
  script: portalScript,
55
55
  context: this,
56
56
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -65,7 +65,7 @@ class SwcChoose extends HTMLTemplateElement {
65
65
  const script = this.getAttribute(attr);
66
66
  if (!script)
67
67
  return;
68
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
68
+ import_core.FunctionUtils.execute({ script, context: this, args });
69
69
  }
70
70
  refresh() {
71
71
  const script = this.getAttribute("on-get-value");
@@ -74,7 +74,7 @@ class SwcChoose extends HTMLTemplateElement {
74
74
  return;
75
75
  }
76
76
  const win = this.ownerDocument?.defaultView || window;
77
- const result = import_FunctionUtils.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
77
+ const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
78
78
  this.value = result;
79
79
  }
80
80
  render() {
@@ -123,7 +123,7 @@ class SwcChoose extends HTMLTemplateElement {
123
123
  }
124
124
  }
125
125
  __decorate([
126
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
126
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
127
127
  __metadata("design:type", Function),
128
128
  __metadata("design:paramtypes", []),
129
129
  __metadata("design:returntype", void 0)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcChoose.ts"],
4
- "sourcesContent": ["import { changedAttribute } from '../decorators/changedAttribute';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core/function/FunctionUtils';\n\nexport class SwcChoose extends HTMLTemplateElement {\n private _nodes: Node[] = [];\n private _value: any = null;\n\n get value(): any {\n return this._value;\n }\n set value(nv: any) {\n this._value = nv;\n this.render();\n }\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n @changedAttribute('on-get-value')\n private refresh() {\n const script = this.getAttribute('on-get-value');\n if (!script) {\n this.value = null;\n return;\n }\n const win = this.ownerDocument?.defaultView || window;\n const result = FunctionUtils.executeReturn({ script, context: this, args: SwcUtils.getHelperAndHostSet(win, this) });\n this.value = result;\n }\n\n private render() {\n this.cleanup();\n const portal = this._resolvePortal();\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const templates = Array.from(this.content.querySelectorAll('template'));\n let selected: HTMLTemplateElement | null = null;\n for (const t of templates) {\n if (t.getAttribute('is') === 'swc-when' && String(t.getAttribute('value')) === String(this._value)) {\n selected = t;\n break;\n }\n }\n const target = selected || (this.content.querySelector('template[is=\"swc-otherwise\"]') as HTMLTemplateElement);\n\n if (target) {\n const clone = target.content.cloneNode(true) as DocumentFragment;\n this._nodes = Array.from(clone.childNodes);\n const elements = this._nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };\n\n this._nodes.forEach((n, nodeIdx) => {\n if (n instanceof HTMLElement) (n as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n\n if (portal === this.parentElement) {\n portal.insertBefore(clone, this.nextSibling);\n } else {\n portal.appendChild(clone);\n }\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n connectedCallback() {\n this.refresh();\n }\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,8BAAiC;AACjC,mBAAyB;AACzB,2BAA8B;;;;;;;;;;AAExB,MAAO,kBAAkB,oBAAmB;EAAlD,cAAA;;AACU,SAAA,SAAiB,CAAA;AACjB,SAAA,SAAc;EA8FxB;EA5FE,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EACA,IAAI,MAAM,IAAO;AACf,SAAK,SAAS;AACd,SAAK,OAAM;EACb;EAEQ,iBAAc;AACpB,UAAM,eAAe,KAAK,aAAa,eAAe;AACtD,QAAI,CAAC;AAAc,aAAO,KAAK;AAE/B,UAAM,MAAM,KAAK,eAAe,eAAe;AAC/C,UAAM,MAAM,mCAAc,cAAc;MACtC,QAAQ;MACR,SAAS;MACT,MAAM,sBAAS,oBAAoB,KAAK,IAAI;KAC7C;AAED,QAAI,eAAe;AAAa,aAAO;AACvC,QAAI,OAAO,QAAQ;AAAU,aAAO,IAAI,SAAS,cAAc,GAAG;AAClE,WAAO,KAAK;EACd;EAEQ,sBAAsB,MAAc,MAAS;AACnD,UAAM,SAAS,KAAK,aAAa,IAAI;AACrC,QAAI,CAAC;AAAQ;AACb,uCAAc,QAAQ,EAAE,QAAQ,SAAS,MAAM,KAAI,CAAE;EACvD;EAGQ,UAAO;AACb,UAAM,SAAS,KAAK,aAAa,cAAc;AAC/C,Q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AK,WAAW;MAC7C,OAAO;AACL,eAAO,YAAY,KAAK;MAC1B;IACF;EACF;EAEQ,UAAO;AACb,SAAK,OAAO,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC;AACxD,SAAK,SAAS,CAAA;EAChB;EAEA,oBAAiB;AACf,SAAK,QAAO;EACd;EACA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AA5DQ,WAAA;MADP,0CAAiB,cAAc;;;;;",
4
+ "sourcesContent": ["import { changedAttributeHost } from '../decorators/changedAttributeHost';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core';\n\nexport class SwcChoose extends HTMLTemplateElement {\n private _nodes: Node[] = [];\n private _value: any = null;\n\n get value(): any {\n return this._value;\n }\n set value(nv: any) {\n this._value = nv;\n this.render();\n }\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n @changedAttributeHost('on-get-value')\n private refresh() {\n const script = this.getAttribute('on-get-value');\n if (!script) {\n this.value = null;\n return;\n }\n const win = this.ownerDocument?.defaultView || window;\n const result = FunctionUtils.executeReturn({ script, context: this, args: SwcUtils.getHelperAndHostSet(win, this) });\n this.value = result;\n }\n\n private render() {\n this.cleanup();\n const portal = this._resolvePortal();\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const templates = Array.from(this.content.querySelectorAll('template'));\n let selected: HTMLTemplateElement | null = null;\n for (const t of templates) {\n if (t.getAttribute('is') === 'swc-when' && String(t.getAttribute('value')) === String(this._value)) {\n selected = t;\n break;\n }\n }\n const target = selected || (this.content.querySelector('template[is=\"swc-otherwise\"]') as HTMLTemplateElement);\n\n if (target) {\n const clone = target.content.cloneNode(true) as DocumentFragment;\n this._nodes = Array.from(clone.childNodes);\n const elements = this._nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };\n\n this._nodes.forEach((n, nodeIdx) => {\n if (n instanceof HTMLElement) (n as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n\n if (portal === this.parentElement) {\n portal.insertBefore(clone, this.nextSibling);\n } else {\n portal.appendChild(clone);\n }\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n connectedCallback() {\n this.refresh();\n }\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAqC;AACrC,mBAAyB;AACzB,kBAA8B;;;;;;;;;;AAExB,MAAO,kBAAkB,oBAAmB;EAAlD,cAAA;;AACU,SAAA,SAAiB,CAAA;AACjB,SAAA,SAAc;EA8FxB;EA5FE,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EACA,IAAI,MAAM,IAAO;AACf,SAAK,SAAS;AACd,SAAK,OAAM;EACb;EAEQ,iBAAc;AACpB,UAAM,eAAe,KAAK,aAAa,eAAe;AACtD,QAAI,CAAC;AAAc,aAAO,KAAK;AAE/B,UAAM,MAAM,KAAK,eAAe,eAAe;AAC/C,UAAM,MAAM,0BAAc,cAAc;MACtC,QAAQ;MACR,SAAS;MACT,MAAM,sBAAS,oBAAoB,KAAK,IAAI;KAC7C;AAED,QAAI,eAAe;AAAa,aAAO;AACv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C;AAE3H,WAAK,OAAO,QAAQ,CAAC,GAAG,YAAW;AACjC,YAAI,aAAa;AAAc,YAAU,aAAa;AACtD,aAAK,sBAAsB,iBAAiB,EAAE,GAAG,WAAW,OAAO,GAAG,YAAY,SAAS,YAAY,EAAE,aAAa,EAAC,CAAE;MAC3H,CAAC;AAED,WAAK,sBAAsB,kBAAkB,SAAS;AAEtD,UAAI,WAAW,KAAK,eAAe;AACjC,eAAO,aAAa,OAAO,KAAK,WAAW;MAC7C,OAAO;AACL,eAAO,YAAY,KAAK;MAC1B;IACF;EACF;EAEQ,UAAO;AACb,SAAK,OAAO,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC;AACxD,SAAK,SAAS,CAAA;EAChB;EAEA,oBAAiB;AACf,SAAK,QAAO;EACd;EACA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AA5DQ,WAAA;MADP,kDAAqB,cAAc;;;;;",
6
6
  "names": []
7
7
  }
@@ -20,9 +20,9 @@ __export(SwcIf_exports, {
20
20
  SwcIf: () => SwcIf
21
21
  });
22
22
  module.exports = __toCommonJS(SwcIf_exports);
23
- var import_changedAttribute = require("../decorators/changedAttribute");
23
+ var import_changedAttributeHost = require("../decorators/changedAttributeHost");
24
24
  var import_Utils = require("../utils/Utils");
25
- var import_FunctionUtils = require("@dooboostore/core/function/FunctionUtils");
25
+ var import_core = require("@dooboostore/core");
26
26
  var __decorate = function(decorators, target, key, desc) {
27
27
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
28
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -50,7 +50,7 @@ class SwcIf extends HTMLTemplateElement {
50
50
  if (!portalScript)
51
51
  return this.parentElement;
52
52
  const win = this.ownerDocument?.defaultView || window;
53
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
53
+ const res = import_core.FunctionUtils.executeReturn({
54
54
  script: portalScript,
55
55
  context: this,
56
56
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -65,7 +65,7 @@ class SwcIf extends HTMLTemplateElement {
65
65
  const script = this.getAttribute(attr);
66
66
  if (!script)
67
67
  return;
68
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
68
+ import_core.FunctionUtils.execute({ script, context: this, args });
69
69
  }
70
70
  refreshValue() {
71
71
  const script = this.getAttribute("on-get-value");
@@ -74,7 +74,7 @@ class SwcIf extends HTMLTemplateElement {
74
74
  return;
75
75
  }
76
76
  const win = this.ownerDocument?.defaultView || window;
77
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
77
+ const res = import_core.FunctionUtils.executeReturn({
78
78
  script,
79
79
  context: this,
80
80
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -131,7 +131,7 @@ class SwcIf extends HTMLTemplateElement {
131
131
  }
132
132
  }
133
133
  __decorate([
134
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
134
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
135
135
  __metadata("design:type", Function),
136
136
  __metadata("design:paramtypes", []),
137
137
  __metadata("design:returntype", void 0)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/SwcIf.ts"],
4
- "sourcesContent": ["import { changedAttribute } from '../decorators/changedAttribute';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core/function/FunctionUtils';\n\nexport class SwcIf extends HTMLTemplateElement {\n private _value = false;\n private _nodes: Node[] = [];\n\n get value(): boolean {\n return this._value;\n }\n set value(nv: any) {\n this._value = Boolean(nv);\n this.render();\n }\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n @changedAttribute('on-get-value')\n private refreshValue() {\n const script = this.getAttribute('on-get-value');\n if (!script) {\n this.value = false;\n return;\n }\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof Promise) {\n res.then(v => (this.value = v)).catch(() => (this.value = false));\n } else {\n this.value = res;\n }\n }\n\n private render() {\n this.cleanup();\n const portal = this._resolvePortal();\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n let targetTpl: HTMLTemplateElement | null = null;\n if (this._value) {\n targetTpl = this;\n } else {\n targetTpl = this.content.querySelector('template[is=\"swc-default\"]') as HTMLTemplateElement;\n }\n\n if (targetTpl) {\n const clone = targetTpl.content.cloneNode(true) as DocumentFragment;\n // If it's the host template, remove sub-templates from clone\n if (targetTpl === this) {\n clone.querySelectorAll('template[is^=\"swc-\"]').forEach(t => t.remove());\n }\n\n this._nodes = Array.from(clone.childNodes);\n const elements = this._nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };\n\n this._nodes.forEach((node, nodeIdx) => {\n if (node instanceof HTMLElement) (node as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n\n if (portal === this.parentElement) {\n portal.insertBefore(clone, this.nextSibling);\n } else {\n portal.appendChild(clone);\n }\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }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4
+ "sourcesContent": ["import { changedAttributeHost } from '../decorators/changedAttributeHost';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core';\n\nexport class SwcIf extends HTMLTemplateElement {\n private _value = false;\n private _nodes: Node[] = [];\n\n get value(): boolean {\n return this._value;\n }\n set value(nv: any) {\n this._value = Boolean(nv);\n this.render();\n }\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n @changedAttributeHost('on-get-value')\n private refreshValue() {\n const script = this.getAttribute('on-get-value');\n if (!script) {\n this.value = false;\n return;\n }\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof Promise) {\n res.then(v => (this.value = v)).catch(() => (this.value = false));\n } else {\n this.value = res;\n }\n }\n\n private render() {\n this.cleanup();\n const portal = this._resolvePortal();\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n let targetTpl: HTMLTemplateElement | null = null;\n if (this._value) {\n targetTpl = this;\n } else {\n targetTpl = this.content.querySelector('template[is=\"swc-default\"]') as HTMLTemplateElement;\n }\n\n if (targetTpl) {\n const clone = targetTpl.content.cloneNode(true) as DocumentFragment;\n // If it's the host template, remove sub-templates from clone\n if (targetTpl === this) {\n clone.querySelectorAll('template[is^=\"swc-\"]').forEach(t => t.remove());\n }\n\n this._nodes = Array.from(clone.childNodes);\n const elements = this._nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };\n\n this._nodes.forEach((node, nodeIdx) => {\n if (node instanceof HTMLElement) (node as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n\n if (portal === this.parentElement) {\n portal.insertBefore(clone, this.nextSibling);\n } else {\n portal.appendChild(clone);\n }\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n connectedCallback() {\n this.refreshValue();\n }\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAqC;AACrC,mBAAyB;AACzB,kBAA8B;;;;;;;;;;AAExB,MAAO,cAAc,oBAAmB;EAA9C,cAAA;;AACU,SAAA,SAAS;AACT,SAAA,SAAiB,CAAA;EAyG3B;EAvGE,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EACA,IAAI,MAAM,IAAO;AACf,SAAK,SAAS,QAAQ,EAAE;AACxB,SAAK,OAAM;EACb;EAEQ,iBAAc;AACpB,UAAM,eAAe,KAAK,aAAa,eAAe;AACtD,QAAI,CAAC;AAAc,aAAO,KAAK;AAE/B,UAAM,MAAM,KAAK,eAAe,eAAe;AAC/C,UAAM,MAAM,0BAAc,cAAc;MACtC,QAAQ;MACR,SAAS;MACT,MAAM,sBAAS,oBAAoB,KAAK,IAAI;KAC7C;AAED,QAAI,eAAe;AAAa,aAAO;AACvC,QAAI,OAAO,QAAQ;AAAU,aAAO,IAAI,SAAS,cAAc,GAAG;AAClE,WAAO,KAAK;EACd;EAEQ,sBAAsB,MAAc,MAAS;AACnD,UAAM,SAAS,KAAK,aAAa,IAAI;AACrC,QAAI,CAAC;AAAQ;AACb,8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AM,YAAY,SAAS,YAAY,KAAK,aAAa,EAAC,CAAE;MACjI,CAAC;AAED,WAAK,sBAAsB,kBAAkB,SAAS;AAEtD,UAAI,WAAW,KAAK,eAAe;AACjC,eAAO,aAAa,OAAO,KAAK,WAAW;MAC7C,OAAO;AACL,eAAO,YAAY,KAAK;MAC1B;IACF;EACF;EAEQ,UAAO;AACb,SAAK,OAAO,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC;AACxD,SAAK,SAAS,CAAA;EAChB;EAEA,oBAAiB;AACf,SAAK,aAAY;EACnB;EACA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AAvEQ,WAAA;MADP,kDAAqB,cAAc;;;;;",
6
6
  "names": []
7
7
  }
@@ -20,9 +20,9 @@ __export(SwcLoop_exports, {
20
20
  SwcLoop: () => SwcLoop
21
21
  });
22
22
  module.exports = __toCommonJS(SwcLoop_exports);
23
- var import_changedAttribute = require("../decorators/changedAttribute");
23
+ var import_changedAttributeHost = require("../decorators/changedAttributeHost");
24
24
  var import_Utils = require("../utils/Utils");
25
- var import_FunctionUtils = require("@dooboostore/core/function/FunctionUtils");
25
+ var import_core = require("@dooboostore/core");
26
26
  var __decorate = function(decorators, target, key, desc) {
27
27
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
28
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -50,7 +50,7 @@ class SwcLoop extends HTMLTemplateElement {
50
50
  if (!portalScript)
51
51
  return this.parentElement;
52
52
  const win = this.ownerDocument?.defaultView || window;
53
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
53
+ const res = import_core.FunctionUtils.executeReturn({
54
54
  script: portalScript,
55
55
  context: this,
56
56
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -65,7 +65,7 @@ class SwcLoop extends HTMLTemplateElement {
65
65
  const script = this.getAttribute(attr);
66
66
  if (!script)
67
67
  return;
68
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
68
+ import_core.FunctionUtils.execute({ script, context: this, args });
69
69
  }
70
70
  _cleanup() {
71
71
  this._nodeGroups.forEach((nodes) => nodes.forEach((n) => n.parentElement?.removeChild(n)));
@@ -78,7 +78,7 @@ class SwcLoop extends HTMLTemplateElement {
78
78
  return;
79
79
  }
80
80
  const win = this.ownerDocument?.defaultView || window;
81
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
81
+ const res = import_core.FunctionUtils.executeReturn({
82
82
  script,
83
83
  context: this,
84
84
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -137,7 +137,7 @@ class SwcLoop extends HTMLTemplateElement {
137
137
  }
138
138
  }
139
139
  __decorate([
140
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
140
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
141
141
  __metadata("design:type", Function),
142
142
  __metadata("design:paramtypes", []),
143
143
  __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 { changedAttribute } from '../decorators/changedAttribute';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core/function/FunctionUtils';\n\nexport class SwcLoop extends HTMLTemplateElement {\n private _value: any[] = [];\n private _nodeGroups: Node[][] = [];\n\n get value(): any[] {\n return this._value;\n }\n set value(nv: any[]) {\n this._value = Array.isArray(nv) ? [...nv] : [];\n this.render();\n }\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n private _cleanup() {\n this._nodeGroups.forEach(nodes => nodes.forEach(n => n.parentElement?.removeChild(n)));\n this._nodeGroups = [];\n }\n\n @changedAttribute('on-get-value')\n private refreshValue() {\n const script = this.getAttribute('on-get-value');\n if (!script) {\n this.value = [];\n return;\n }\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof Promise) {\n res.then(v => (this.value = v)).catch(() => (this.value = []));\n } else {\n this.value = res;\n }\n }\n\n render() {\n this._cleanup();\n const portal = this._resolvePortal();\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n const fragment = win.document.createDocumentFragment();\n\n if (this._value.length === 0) {\n const defaultTpl = this.content.querySelector('template[is=\"swc-default\"]') as HTMLTemplateElement;\n if (defaultTpl) {\n const clone = defaultTpl.content.cloneNode(true);\n const nodes = Array.from(clone.childNodes);\n this._nodeGroups.push(nodes);\n fragment.appendChild(clone);\n }\n } else {\n this._value.forEach((item, index) => {\n const clone = this.content.cloneNode(true) as DocumentFragment;\n // Filter out sub-templates\n const subTemplates = clone.querySelectorAll('template[is^=\"swc-\"]');\n subTemplates.forEach(t => t.remove());\n\n const nodes = Array.from(clone.childNodes);\n const elements = nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n\n const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value, $nodes: nodes, $elements: elements, $firstElement: elements[0] };\n\n nodes.forEach((node, nodeIdx) => {\n if (node instanceof HTMLElement) (node as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n this._nodeGroups.push(nodes);\n fragment.appendChild(clone);\n });\n }\n\n if (portal === this.parentElement) {\n portal.insertBefore(fragment, this.nextSibling);\n } else {\n portal.appendChild(fragment);\n }\n }\n\n connectedCallback() {\n this.refreshValue();\n }\n disconnectedCallback() {\n this._cleanup();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,8BAAiC;AACjC,mBAAyB;AACzB,2BAA8B;;;;;;;;;;AAExB,MAAO,gBAAgB,oBAAmB;EAAhD,cAAA;;AACU,SAAA,SAAgB,CAAA;AAChB,SAAA,cAAwB,CAAA;EA+GlC;EA7GE,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EACA,IAAI,MAAM,IAAS;AACjB,SAAK,SAAS,MAAM,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAA;AAC5C,SAAK,OAAM;EACb;EAEQ,iBAAc;AACpB,UAAM,eAAe,KAAK,aAAa,eAAe;AACtD,QAAI,CAAC;AAAc,aAAO,KAAK;AAE/B,UAAM,MAAM,KAAK,eAAe,eAAe;AAC/C,UAAM,MAAM,mCAAc,cAAc;MACtC,QAAQ;MACR,SAAS;MACT,MAAM,sBAAS,oBAAoB,KAAK,IAAI;KAC7C;AAED,QAAI,eAAe;AAAa,aAAO;AACvC,QAAI,OAAO,QAAQ;AAAU,aAAO,IAAI,SAAS,cAAc,GAAG;AAClE,WAAO,KAAK;EACd;EAEQ,sBAAsB,MAAc,MAAS;AACnD,UAAM,SAAS,KAAK,aAAa,IAAI;AACrC,QAAI,CAAC;AAAQ;AACb,uCAAc,QAAQ,EAAE,QAAQ,SAAS,MAAM,KAAI,CAAE;EACvD;EAEQ,WAAQ;AACd,SAAK,YAAY,QAAQ,WAAS,MAAM,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC,CAAC;AACrF,SAAK,cAAc,CAAA;EACrB;EAGQ,eAAY;AAClB,UAAM,SAAS,KAAK,aAAa,cAAc;AAC/C,QAAI,CAAC,QAAQ;AACX,WAAK,QAAQ,CAAA;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Ac,iBAAa,aAAa;AAC5D,eAAK,sBAAsB,iBAAiB,EAAE,GAAG,WAAW,OAAO,MAAM,YAAY,SAAS,YAAY,KAAK,aAAa,EAAC,CAAE;QACjI,CAAC;AAED,aAAK,sBAAsB,kBAAkB,SAAS;AACtD,aAAK,YAAY,KAAK,KAAK;AAC3B,iBAAS,YAAY,KAAK;MAC5B,CAAC;IACH;AAEA,QAAI,WAAW,KAAK,eAAe;AACjC,aAAO,aAAa,UAAU,KAAK,WAAW;IAChD,OAAO;AACL,aAAO,YAAY,QAAQ;IAC7B;EACF;EAEA,oBAAiB;AACf,SAAK,aAAY;EACnB;EACA,uBAAoB;AAClB,SAAK,SAAQ;EACf;;AAxEQ,WAAA;MADP,0CAAiB,cAAc;;;;;",
4
+ "sourcesContent": ["import { changedAttributeHost } from '../decorators/changedAttributeHost';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils } from '@dooboostore/core';\n\nexport class SwcLoop extends HTMLTemplateElement {\n private _value: any[] = [];\n private _nodeGroups: Node[][] = [];\n\n get value(): any[] {\n return this._value;\n }\n set value(nv: any[]) {\n this._value = Array.isArray(nv) ? [...nv] : [];\n this.render();\n }\n\n private _resolvePortal(): Element | null {\n const portalScript = this.getAttribute('on-get-portal');\n if (!portalScript) return this.parentElement;\n\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script: portalScript,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof HTMLElement) return res;\n if (typeof res === 'string') return win.document.querySelector(res);\n return this.parentElement;\n }\n\n private _executeCloneCallback(attr: string, args: any) {\n const script = this.getAttribute(attr);\n if (!script) return;\n FunctionUtils.execute({ script, context: this, args });\n }\n\n private _cleanup() {\n this._nodeGroups.forEach(nodes => nodes.forEach(n => n.parentElement?.removeChild(n)));\n this._nodeGroups = [];\n }\n\n @changedAttributeHost('on-get-value')\n private refreshValue() {\n const script = this.getAttribute('on-get-value');\n if (!script) {\n this.value = [];\n return;\n }\n const win = this.ownerDocument?.defaultView || window;\n const res = FunctionUtils.executeReturn({\n script,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n\n if (res instanceof Promise) {\n res.then(v => (this.value = v)).catch(() => (this.value = []));\n } else {\n this.value = res;\n }\n }\n\n render() {\n this._cleanup();\n const portal = this._resolvePortal();\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n const fragment = win.document.createDocumentFragment();\n\n if (this._value.length === 0) {\n const defaultTpl = this.content.querySelector('template[is=\"swc-default\"]') as HTMLTemplateElement;\n if (defaultTpl) {\n const clone = defaultTpl.content.cloneNode(true);\n const nodes = Array.from(clone.childNodes);\n this._nodeGroups.push(nodes);\n fragment.appendChild(clone);\n }\n } else {\n this._value.forEach((item, index) => {\n const clone = this.content.cloneNode(true) as DocumentFragment;\n // Filter out sub-templates\n const subTemplates = clone.querySelectorAll('template[is^=\"swc-\"]');\n subTemplates.forEach(t => t.remove());\n\n const nodes = Array.from(clone.childNodes);\n const elements = nodes.filter(n => n.nodeType === 1) as HTMLElement[];\n\n const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value, $nodes: nodes, $elements: elements, $firstElement: elements[0] };\n\n nodes.forEach((node, nodeIdx) => {\n if (node instanceof HTMLElement) (node as any).__swc_host = this;\n this._executeCloneCallback('on-clone-node', { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });\n });\n\n this._executeCloneCallback('on-clone-nodes', groupArgs);\n this._nodeGroups.push(nodes);\n fragment.appendChild(clone);\n });\n }\n\n if (portal === this.parentElement) {\n portal.insertBefore(fragment, this.nextSibling);\n } else {\n portal.appendChild(fragment);\n }\n }\n\n connectedCallback() {\n this.refreshValue();\n }\n disconnectedCallback() {\n this._cleanup();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAqC;AACrC,mBAAyB;AACzB,kBAA8B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H;AAEA,QAAI,WAAW,KAAK,eAAe;AACjC,aAAO,aAAa,UAAU,KAAK,WAAW;IAChD,OAAO;AACL,aAAO,YAAY,QAAQ;IAC7B;EACF;EAEA,oBAAiB;AACf,SAAK,aAAY;EACnB;EACA,uBAAoB;AAClB,SAAK,SAAQ;EACf;;AAxEQ,WAAA;MADP,kDAAqB,cAAc;;;;;",
6
6
  "names": []
7
7
  }
@@ -23,8 +23,8 @@ module.exports = __toCommonJS(register_exports);
23
23
  var import_elementDefine = require("../decorators/elementDefine");
24
24
  var import_SwcAppMixin = require("./SwcAppMixin");
25
25
  var import_Utils = require("../utils/Utils");
26
- var import_FunctionUtils = require("@dooboostore/core/function/FunctionUtils");
27
- var import_changedAttribute = require("../decorators/changedAttribute");
26
+ var import_core = require("@dooboostore/core");
27
+ var import_changedAttributeHost = require("../decorators/changedAttributeHost");
28
28
  var __decorate = function(decorators, target, key, desc) {
29
29
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30
30
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -150,7 +150,7 @@ const registerAllElements = (w) => {
150
150
  if (!portalScript)
151
151
  return this.parentElement;
152
152
  const win = this.ownerDocument?.defaultView || window;
153
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
153
+ const res = import_core.FunctionUtils.executeReturn({
154
154
  script: portalScript,
155
155
  context: this,
156
156
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -165,7 +165,7 @@ const registerAllElements = (w) => {
165
165
  const script = this.getAttribute(attr);
166
166
  if (!script)
167
167
  return;
168
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
168
+ import_core.FunctionUtils.execute({ script, context: this, args });
169
169
  }
170
170
  refreshValue() {
171
171
  const script = this.getAttribute("on-get-value");
@@ -174,7 +174,7 @@ const registerAllElements = (w) => {
174
174
  return;
175
175
  }
176
176
  const win = this.ownerDocument?.defaultView || window;
177
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
177
+ const res = import_core.FunctionUtils.executeReturn({
178
178
  script,
179
179
  context: this,
180
180
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -231,7 +231,7 @@ const registerAllElements = (w) => {
231
231
  }
232
232
  };
233
233
  __decorate([
234
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
234
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
235
235
  __metadata("design:type", Function),
236
236
  __metadata("design:paramtypes", []),
237
237
  __metadata("design:returntype", void 0)
@@ -257,7 +257,7 @@ const registerAllElements = (w) => {
257
257
  if (!portalScript)
258
258
  return this.parentElement;
259
259
  const win = this.ownerDocument?.defaultView || window;
260
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
260
+ const res = import_core.FunctionUtils.executeReturn({
261
261
  script: portalScript,
262
262
  context: this,
263
263
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -272,7 +272,7 @@ const registerAllElements = (w) => {
272
272
  const script = this.getAttribute(attr);
273
273
  if (!script)
274
274
  return;
275
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
275
+ import_core.FunctionUtils.execute({ script, context: this, args });
276
276
  }
277
277
  _cleanup() {
278
278
  this._nodeGroups.forEach((nodes) => nodes.forEach((n) => n.parentElement?.removeChild(n)));
@@ -285,7 +285,7 @@ const registerAllElements = (w) => {
285
285
  return;
286
286
  }
287
287
  const win = this.ownerDocument?.defaultView || window;
288
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
288
+ const res = import_core.FunctionUtils.executeReturn({
289
289
  script,
290
290
  context: this,
291
291
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -344,7 +344,7 @@ const registerAllElements = (w) => {
344
344
  }
345
345
  };
346
346
  __decorate([
347
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
347
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
348
348
  __metadata("design:type", Function),
349
349
  __metadata("design:paramtypes", []),
350
350
  __metadata("design:returntype", void 0)
@@ -370,7 +370,7 @@ const registerAllElements = (w) => {
370
370
  if (!portalScript)
371
371
  return this.parentElement;
372
372
  const win = this.ownerDocument?.defaultView || window;
373
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
373
+ const res = import_core.FunctionUtils.executeReturn({
374
374
  script: portalScript,
375
375
  context: this,
376
376
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -385,7 +385,7 @@ const registerAllElements = (w) => {
385
385
  const script = this.getAttribute(attr);
386
386
  if (!script)
387
387
  return;
388
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
388
+ import_core.FunctionUtils.execute({ script, context: this, args });
389
389
  }
390
390
  refresh() {
391
391
  const script = this.getAttribute("on-get-value");
@@ -394,7 +394,7 @@ const registerAllElements = (w) => {
394
394
  return;
395
395
  }
396
396
  const win = this.ownerDocument?.defaultView || window;
397
- const result = import_FunctionUtils.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
397
+ const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
398
398
  this.value = result;
399
399
  }
400
400
  render() {
@@ -443,7 +443,7 @@ const registerAllElements = (w) => {
443
443
  }
444
444
  };
445
445
  __decorate([
446
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
446
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
447
447
  __metadata("design:type", Function),
448
448
  __metadata("design:paramtypes", []),
449
449
  __metadata("design:returntype", void 0)
@@ -462,7 +462,7 @@ const registerAllElements = (w) => {
462
462
  if (!portalScript)
463
463
  return this.parentElement;
464
464
  const win = this.ownerDocument?.defaultView || window;
465
- const res = import_FunctionUtils.FunctionUtils.executeReturn({
465
+ const res = import_core.FunctionUtils.executeReturn({
466
466
  script: portalScript,
467
467
  context: this,
468
468
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
@@ -477,14 +477,14 @@ const registerAllElements = (w) => {
477
477
  const script = this.getAttribute(attr);
478
478
  if (!script)
479
479
  return;
480
- import_FunctionUtils.FunctionUtils.execute({ script, context: this, args });
480
+ import_core.FunctionUtils.execute({ script, context: this, args });
481
481
  }
482
482
  refresh() {
483
483
  const script = this.getAttribute("on-get-value");
484
484
  if (!script)
485
485
  return;
486
486
  const win = this.ownerDocument?.defaultView || window;
487
- const result = import_FunctionUtils.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
487
+ const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
488
488
  if (result instanceof Promise) {
489
489
  this.render("loading");
490
490
  result.then((v) => {
@@ -534,7 +534,7 @@ const registerAllElements = (w) => {
534
534
  }
535
535
  };
536
536
  __decorate([
537
- (0, import_changedAttribute.changedAttribute)("on-get-value"),
537
+ (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
538
538
  __metadata("design:type", Function),
539
539
  __metadata("design:paramtypes", []),
540
540
  __metadata("design:returntype", void 0)
@@ -827,5 +827,6 @@ const registerAllElements = (w) => {
827
827
  SwcAppBody = __decorate([
828
828
  (0, import_elementDefine.elementDefine)("swc-app-body", { extends: "body", window: w })
829
829
  ], SwcAppBody);
830
+ return [];
830
831
  };
831
832
  //# sourceMappingURL=register.js.map