@dooboostore/simple-web-component 1.0.29 → 1.0.31

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 (108) hide show
  1. package/README.md +651 -27
  2. package/dist/cjs/decorators/elementDefine.js +5 -3
  3. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  4. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  5. package/dist/cjs/decorators/index.js +1 -0
  6. package/dist/cjs/decorators/index.js.map +2 -2
  7. package/dist/cjs/decorators/setProperty.js +97 -0
  8. package/dist/cjs/decorators/setProperty.js.map +7 -0
  9. package/dist/cjs/elements/SwcAppEngine.js +3 -3
  10. package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
  11. package/dist/cjs/elements/SwcAppMixin.js +1 -8
  12. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  13. package/dist/cjs/elements/SwcAsync.js +37 -53
  14. package/dist/cjs/elements/SwcAsync.js.map +2 -2
  15. package/dist/cjs/elements/SwcChoose.js +55 -60
  16. package/dist/cjs/elements/SwcChoose.js.map +2 -2
  17. package/dist/cjs/elements/SwcIf.js +31 -60
  18. package/dist/cjs/elements/SwcIf.js.map +2 -2
  19. package/dist/cjs/elements/SwcLoop.js +20 -43
  20. package/dist/cjs/elements/SwcLoop.js.map +2 -2
  21. package/dist/cjs/elements/SwcSubTemplates.js +0 -27
  22. package/dist/cjs/elements/SwcSubTemplates.js.map +2 -2
  23. package/dist/cjs/elements/register.js +216 -128
  24. package/dist/cjs/elements/register.js.map +2 -2
  25. package/dist/cjs/index.js +2 -1
  26. package/dist/cjs/index.js.map +2 -2
  27. package/dist/cjs/router/ElementRouter.js +1 -8
  28. package/dist/cjs/router/ElementRouter.js.map +2 -2
  29. package/dist/cjs/types.js.map +1 -1
  30. package/dist/cjs/utils/Utils.js +26 -10
  31. package/dist/cjs/utils/Utils.js.map +2 -2
  32. package/dist/esm/decorators/elementDefine.js +5 -3
  33. package/dist/esm/decorators/elementDefine.js.map +2 -2
  34. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  35. package/dist/esm/decorators/index.js +1 -0
  36. package/dist/esm/decorators/index.js.map +2 -2
  37. package/dist/esm/decorators/setProperty.js +78 -0
  38. package/dist/esm/decorators/setProperty.js.map +7 -0
  39. package/dist/esm/elements/SwcAppEngine.js +3 -3
  40. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  41. package/dist/esm/elements/SwcAppMixin.js +1 -8
  42. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  43. package/dist/esm/elements/SwcAsync.js +37 -34
  44. package/dist/esm/elements/SwcAsync.js.map +2 -2
  45. package/dist/esm/elements/SwcChoose.js +55 -41
  46. package/dist/esm/elements/SwcChoose.js.map +2 -2
  47. package/dist/esm/elements/SwcIf.js +31 -41
  48. package/dist/esm/elements/SwcIf.js.map +2 -2
  49. package/dist/esm/elements/SwcLoop.js +20 -24
  50. package/dist/esm/elements/SwcLoop.js.map +2 -2
  51. package/dist/esm/elements/SwcSubTemplates.js +0 -8
  52. package/dist/esm/elements/SwcSubTemplates.js.map +2 -2
  53. package/dist/esm/elements/register.js +216 -128
  54. package/dist/esm/elements/register.js.map +2 -2
  55. package/dist/esm/index.js +2 -1
  56. package/dist/esm/index.js.map +2 -2
  57. package/dist/esm/router/ElementRouter.js +1 -8
  58. package/dist/esm/router/ElementRouter.js.map +2 -2
  59. package/dist/esm/types.js.map +1 -1
  60. package/dist/esm/utils/Utils.js +26 -10
  61. package/dist/esm/utils/Utils.js.map +2 -2
  62. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +105 -13
  63. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  64. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  65. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  66. package/dist/types/decorators/index.d.ts +1 -0
  67. package/dist/types/decorators/index.d.ts.map +1 -1
  68. package/dist/types/decorators/setProperty.d.ts +13 -0
  69. package/dist/types/decorators/setProperty.d.ts.map +1 -0
  70. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  71. package/dist/types/elements/SwcAsync.d.ts +1 -11
  72. package/dist/types/elements/SwcAsync.d.ts.map +1 -1
  73. package/dist/types/elements/SwcChoose.d.ts +1 -13
  74. package/dist/types/elements/SwcChoose.d.ts.map +1 -1
  75. package/dist/types/elements/SwcIf.d.ts +1 -13
  76. package/dist/types/elements/SwcIf.d.ts.map +1 -1
  77. package/dist/types/elements/SwcLoop.d.ts +1 -13
  78. package/dist/types/elements/SwcLoop.d.ts.map +1 -1
  79. package/dist/types/elements/SwcSubTemplates.d.ts +6 -6
  80. package/dist/types/elements/SwcSubTemplates.d.ts.map +1 -1
  81. package/dist/types/elements/register.d.ts +3 -1
  82. package/dist/types/elements/register.d.ts.map +1 -1
  83. package/dist/types/index.d.ts +1 -1
  84. package/dist/types/index.d.ts.map +1 -1
  85. package/dist/types/router/ElementRouter.d.ts.map +1 -1
  86. package/dist/types/types.d.ts +3 -0
  87. package/dist/types/types.d.ts.map +1 -1
  88. package/dist/types/utils/Utils.d.ts +10 -0
  89. package/dist/types/utils/Utils.d.ts.map +1 -1
  90. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +105 -13
  91. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  92. package/package.json +3 -3
  93. package/src/decorators/elementDefine.ts +10 -3
  94. package/src/decorators/emitCustomEvent.ts +1 -0
  95. package/src/decorators/index.ts +1 -0
  96. package/src/decorators/setProperty.ts +97 -0
  97. package/src/elements/SwcAppEngine.ts +3 -3
  98. package/src/elements/SwcAppMixin.ts +7 -28
  99. package/src/elements/SwcAsync.ts +46 -30
  100. package/src/elements/SwcChoose.ts +82 -38
  101. package/src/elements/SwcIf.ts +38 -38
  102. package/src/elements/SwcLoop.ts +24 -19
  103. package/src/elements/SwcSubTemplates.ts +6 -6
  104. package/src/elements/register.ts +261 -121
  105. package/src/index.ts +3 -1
  106. package/src/router/ElementRouter.ts +1 -12
  107. package/src/types.ts +3 -1
  108. package/src/utils/Utils.ts +40 -19
@@ -145,49 +145,34 @@ const registerAllElements = (w) => {
145
145
  this._value = Boolean(nv);
146
146
  this.render();
147
147
  }
148
- _resolvePortal() {
149
- const portalScript = this.getAttribute("on-get-portal");
150
- if (!portalScript)
151
- return this.parentElement;
152
- const win = this.ownerDocument?.defaultView || window;
153
- const res = import_core.FunctionUtils.executeReturn({
154
- script: portalScript,
155
- context: this,
156
- args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
157
- });
158
- if (res instanceof HTMLElement)
159
- return res;
160
- if (typeof res === "string")
161
- return win.document.querySelector(res);
162
- return this.parentElement;
163
- }
164
148
  _executeCloneCallback(attr, args) {
165
149
  const script = this.getAttribute(attr);
166
150
  if (!script)
167
151
  return;
168
152
  import_core.FunctionUtils.execute({ script, context: this, args });
169
153
  }
170
- refreshValue() {
171
- const script = this.getAttribute("on-get-value");
172
- if (!script) {
154
+ refreshValue(valueAttr) {
155
+ valueAttr ?? (valueAttr = this.getAttribute("value"));
156
+ if (valueAttr === null) {
173
157
  this.value = false;
174
158
  return;
175
159
  }
176
- const win = this.ownerDocument?.defaultView || window;
177
- const res = import_core.FunctionUtils.executeReturn({
178
- script,
179
- context: this,
180
- args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
181
- });
182
- if (res instanceof Promise) {
183
- res.then((v) => this.value = v).catch(() => this.value = false);
160
+ if (valueAttr.startsWith("{{") && valueAttr.endsWith("}}")) {
161
+ const script = valueAttr.slice(2, -2).trim();
162
+ const win = this.ownerDocument?.defaultView || window;
163
+ const result = import_core.FunctionUtils.executeReturn({
164
+ script,
165
+ context: this,
166
+ args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
167
+ });
168
+ this.value = result;
184
169
  } else {
185
- this.value = res;
170
+ this.value = Boolean(valueAttr);
186
171
  }
187
172
  }
188
173
  render() {
189
174
  this.cleanup();
190
- const portal = this._resolvePortal();
175
+ const portal = this.parentElement;
191
176
  if (!portal)
192
177
  return;
193
178
  const win = this.ownerDocument?.defaultView || window;
@@ -207,16 +192,24 @@ const registerAllElements = (w) => {
207
192
  const elements = this._nodes.filter((n) => n.nodeType === 1);
208
193
  const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };
209
194
  this._nodes.forEach((node, nodeIdx) => {
210
- if (node instanceof HTMLElement)
211
- node.__swc_host = this;
212
195
  this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });
196
+ if (node instanceof HTMLElement) {
197
+ Array.from(node.attributes).forEach((attr) => {
198
+ const value = attr.value || "";
199
+ if (value.startsWith("{{") && value.endsWith("}}")) {
200
+ const script = value.slice(2, -2).trim();
201
+ const result = import_core.FunctionUtils.executeReturn({
202
+ script,
203
+ context: node,
204
+ args: { ...groupArgs, $value: this._value }
205
+ });
206
+ node.setAttribute(attr.name, String(result));
207
+ }
208
+ });
209
+ }
213
210
  });
214
211
  this._executeCloneCallback("on-clone-nodes", groupArgs);
215
- if (portal === this.parentElement) {
216
- portal.insertBefore(clone, this.nextSibling);
217
- } else {
218
- portal.appendChild(clone);
219
- }
212
+ portal.insertBefore(clone, this.nextSibling);
220
213
  }
221
214
  }
222
215
  cleanup() {
@@ -231,9 +224,9 @@ const registerAllElements = (w) => {
231
224
  }
232
225
  };
233
226
  __decorate([
234
- (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
227
+ (0, import_changedAttributeHost.changedAttributeHost)("value"),
235
228
  __metadata("design:type", Function),
236
- __metadata("design:paramtypes", []),
229
+ __metadata("design:paramtypes", [String]),
237
230
  __metadata("design:returntype", void 0)
238
231
  ], SwcIf.prototype, "refreshValue", null);
239
232
  SwcIf = __decorate([
@@ -252,22 +245,6 @@ const registerAllElements = (w) => {
252
245
  this._value = Array.isArray(nv) ? [...nv] : [];
253
246
  this.render();
254
247
  }
255
- _resolvePortal() {
256
- const portalScript = this.getAttribute("on-get-portal");
257
- if (!portalScript)
258
- return this.parentElement;
259
- const win = this.ownerDocument?.defaultView || window;
260
- const res = import_core.FunctionUtils.executeReturn({
261
- script: portalScript,
262
- context: this,
263
- args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
264
- });
265
- if (res instanceof HTMLElement)
266
- return res;
267
- if (typeof res === "string")
268
- return win.document.querySelector(res);
269
- return this.parentElement;
270
- }
271
248
  _executeCloneCallback(attr, args) {
272
249
  const script = this.getAttribute(attr);
273
250
  if (!script)
@@ -279,11 +256,14 @@ const registerAllElements = (w) => {
279
256
  this._nodeGroups = [];
280
257
  }
281
258
  refreshValue() {
282
- const script = this.getAttribute("on-get-value");
259
+ let script = this.getAttribute("value");
283
260
  if (!script) {
284
261
  this.value = [];
285
262
  return;
286
263
  }
264
+ if (script.startsWith("{{") && script.endsWith("}}")) {
265
+ script = script.slice(2, -2).trim();
266
+ }
287
267
  const win = this.ownerDocument?.defaultView || window;
288
268
  const res = import_core.FunctionUtils.executeReturn({
289
269
  script,
@@ -298,7 +278,7 @@ const registerAllElements = (w) => {
298
278
  }
299
279
  render() {
300
280
  this._cleanup();
301
- const portal = this._resolvePortal();
281
+ const portal = this.parentElement;
302
282
  if (!portal)
303
283
  return;
304
284
  const win = this.ownerDocument?.defaultView || window;
@@ -321,9 +301,21 @@ const registerAllElements = (w) => {
321
301
  const elements = nodes.filter((n) => n.nodeType === 1);
322
302
  const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value, $nodes: nodes, $elements: elements, $firstElement: elements[0] };
323
303
  nodes.forEach((node, nodeIdx) => {
324
- if (node instanceof HTMLElement)
325
- node.__swc_host = this;
326
304
  this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });
305
+ if (node instanceof HTMLElement) {
306
+ Array.from(node.attributes).forEach((attr) => {
307
+ const value = attr.value || "";
308
+ if (value.startsWith("{{") && value.endsWith("}}")) {
309
+ const script = value.slice(2, -2).trim();
310
+ const result = import_core.FunctionUtils.executeReturn({
311
+ script,
312
+ context: node,
313
+ args: groupArgs
314
+ });
315
+ node.setAttribute(attr.name, String(result));
316
+ }
317
+ });
318
+ }
327
319
  });
328
320
  this._executeCloneCallback("on-clone-nodes", groupArgs);
329
321
  this._nodeGroups.push(nodes);
@@ -344,7 +336,7 @@ const registerAllElements = (w) => {
344
336
  }
345
337
  };
346
338
  __decorate([
347
- (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
339
+ (0, import_changedAttributeHost.changedAttributeHost)("value"),
348
340
  __metadata("design:type", Function),
349
341
  __metadata("design:paramtypes", []),
350
342
  __metadata("design:returntype", void 0)
@@ -357,6 +349,7 @@ const registerAllElements = (w) => {
357
349
  super(...arguments);
358
350
  this._nodes = [];
359
351
  this._value = null;
352
+ this._previousTemplate = null;
360
353
  }
361
354
  get value() {
362
355
  return this._value;
@@ -365,70 +358,86 @@ const registerAllElements = (w) => {
365
358
  this._value = nv;
366
359
  this.render();
367
360
  }
368
- _resolvePortal() {
369
- const portalScript = this.getAttribute("on-get-portal");
370
- if (!portalScript)
371
- return this.parentElement;
372
- const win = this.ownerDocument?.defaultView || window;
373
- const res = import_core.FunctionUtils.executeReturn({
374
- script: portalScript,
375
- context: this,
376
- args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
377
- });
378
- if (res instanceof HTMLElement)
379
- return res;
380
- if (typeof res === "string")
381
- return win.document.querySelector(res);
382
- return this.parentElement;
383
- }
384
361
  _executeCloneCallback(attr, args) {
385
362
  const script = this.getAttribute(attr);
386
363
  if (!script)
387
364
  return;
388
365
  import_core.FunctionUtils.execute({ script, context: this, args });
389
366
  }
390
- refresh() {
391
- const script = this.getAttribute("on-get-value");
392
- if (!script) {
367
+ refresh(valueAttr) {
368
+ valueAttr ?? (valueAttr = this.getAttribute("value"));
369
+ if (valueAttr === null) {
393
370
  this.value = null;
394
371
  return;
395
372
  }
396
- const win = this.ownerDocument?.defaultView || window;
397
- const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
398
- this.value = result;
373
+ if (valueAttr.startsWith("{{") && valueAttr.endsWith("}}")) {
374
+ const script = valueAttr.slice(2, -2).trim();
375
+ const win = this.ownerDocument?.defaultView || window;
376
+ const helperAndHostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, import_Utils.SwcUtils.findNearestSwcHost(this));
377
+ const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: helperAndHostSet });
378
+ this.value = result;
379
+ } else {
380
+ this.value = valueAttr;
381
+ }
399
382
  }
400
383
  render() {
401
- this.cleanup();
402
- const portal = this._resolvePortal();
403
- if (!portal)
404
- return;
405
384
  const win = this.ownerDocument?.defaultView || window;
406
385
  const helperSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
407
386
  const templates = Array.from(this.content.querySelectorAll("template"));
408
387
  let selected = null;
409
388
  for (const t of templates) {
410
- if (t.getAttribute("is") === "swc-when" && String(t.getAttribute("value")) === String(this._value)) {
411
- selected = t;
412
- break;
389
+ if (t.getAttribute("is") === "swc-when") {
390
+ let matches = false;
391
+ const value = t.getAttribute("value") || "";
392
+ if (value.startsWith("{{") && value.endsWith("}}")) {
393
+ const script = value.slice(2, -2).trim();
394
+ const result = import_core.FunctionUtils.executeReturn({
395
+ script,
396
+ context: t,
397
+ args: { ...helperSet, $value: this._value }
398
+ });
399
+ matches = result === true;
400
+ } else {
401
+ matches = String(value) === String(this._value);
402
+ }
403
+ if (matches) {
404
+ selected = t;
405
+ break;
406
+ }
413
407
  }
414
408
  }
415
409
  const target = selected || this.content.querySelector('template[is="swc-otherwise"]');
410
+ const targetHasSkipIfSame = target?.hasAttribute("skip-if-same");
411
+ const shouldSkip = (this.hasAttribute("skip-if-same") || targetHasSkipIfSame) && this._previousTemplate === target;
412
+ if (shouldSkip) {
413
+ return;
414
+ }
415
+ this.cleanup();
416
+ this._previousTemplate = target;
416
417
  if (target) {
417
418
  const clone = target.content.cloneNode(true);
418
419
  this._nodes = Array.from(clone.childNodes);
419
420
  const elements = this._nodes.filter((n) => n.nodeType === 1);
420
421
  const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };
421
422
  this._nodes.forEach((n, nodeIdx) => {
422
- if (n instanceof HTMLElement)
423
- n.__swc_host = this;
424
423
  this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });
424
+ if (n instanceof HTMLElement) {
425
+ Array.from(n.attributes).forEach((attr) => {
426
+ const value = attr.value || "";
427
+ if (value.startsWith("{{") && value.endsWith("}}")) {
428
+ const script = value.slice(2, -2).trim();
429
+ const result = import_core.FunctionUtils.executeReturn({
430
+ script,
431
+ context: n,
432
+ args: { ...groupArgs, $value: this._value }
433
+ });
434
+ n.setAttribute(attr.name, String(result));
435
+ }
436
+ });
437
+ }
425
438
  });
426
439
  this._executeCloneCallback("on-clone-nodes", groupArgs);
427
- if (portal === this.parentElement) {
428
- portal.insertBefore(clone, this.nextSibling);
429
- } else {
430
- portal.appendChild(clone);
431
- }
440
+ this.parentElement?.insertBefore(clone, this.nextSibling);
432
441
  }
433
442
  }
434
443
  cleanup() {
@@ -443,9 +452,9 @@ const registerAllElements = (w) => {
443
452
  }
444
453
  };
445
454
  __decorate([
446
- (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
455
+ (0, import_changedAttributeHost.changedAttributeHost)("value"),
447
456
  __metadata("design:type", Function),
448
- __metadata("design:paramtypes", []),
457
+ __metadata("design:paramtypes", [String]),
449
458
  __metadata("design:returntype", void 0)
450
459
  ], SwcChoose.prototype, "refresh", null);
451
460
  SwcChoose = __decorate([
@@ -457,34 +466,32 @@ const registerAllElements = (w) => {
457
466
  this._nodes = [];
458
467
  this._value = null;
459
468
  }
460
- _resolvePortal() {
461
- const portalScript = this.getAttribute("on-get-portal");
462
- if (!portalScript)
463
- return this.parentElement;
464
- const win = this.ownerDocument?.defaultView || window;
465
- const res = import_core.FunctionUtils.executeReturn({
466
- script: portalScript,
467
- context: this,
468
- args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
469
- });
470
- if (res instanceof HTMLElement)
471
- return res;
472
- if (typeof res === "string")
473
- return win.document.querySelector(res);
474
- return this.parentElement;
475
- }
476
469
  _executeCloneCallback(attr, args) {
477
470
  const script = this.getAttribute(attr);
478
471
  if (!script)
479
472
  return;
480
473
  import_core.FunctionUtils.execute({ script, context: this, args });
481
474
  }
482
- refresh() {
483
- const script = this.getAttribute("on-get-value");
484
- if (!script)
475
+ refresh(valueAttr) {
476
+ valueAttr ?? (valueAttr = this.getAttribute("value"));
477
+ if (!valueAttr) {
478
+ this.render("default");
485
479
  return;
486
- const win = this.ownerDocument?.defaultView || window;
487
- const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
480
+ }
481
+ if (valueAttr.startsWith("{{") && valueAttr.endsWith("}}")) {
482
+ const script = valueAttr.slice(2, -2).trim();
483
+ const win = this.ownerDocument?.defaultView || window;
484
+ const result = import_core.FunctionUtils.executeReturn({
485
+ script,
486
+ context: this,
487
+ args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
488
+ });
489
+ this.executeAsync(result);
490
+ } else {
491
+ this.executeAsync(valueAttr);
492
+ }
493
+ }
494
+ executeAsync(result) {
488
495
  if (result instanceof Promise) {
489
496
  this.render("loading");
490
497
  result.then((v) => {
@@ -498,7 +505,7 @@ const registerAllElements = (w) => {
498
505
  }
499
506
  render(state) {
500
507
  this.cleanup();
501
- const portal = this._resolvePortal();
508
+ const portal = this.parentElement;
502
509
  if (!portal)
503
510
  return;
504
511
  const win = this.ownerDocument?.defaultView || window;
@@ -510,16 +517,24 @@ const registerAllElements = (w) => {
510
517
  const elements = this._nodes.filter((n) => n.nodeType === 1);
511
518
  const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0], $state: state };
512
519
  this._nodes.forEach((n, nodeIdx) => {
513
- if (n instanceof HTMLElement)
514
- n.__swc_host = this;
515
520
  this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });
521
+ if (n instanceof HTMLElement) {
522
+ Array.from(n.attributes).forEach((attr) => {
523
+ const value = attr.value || "";
524
+ if (value.startsWith("{{") && value.endsWith("}}")) {
525
+ const script = value.slice(2, -2).trim();
526
+ const result = import_core.FunctionUtils.executeReturn({
527
+ script,
528
+ context: n,
529
+ args: groupArgs
530
+ });
531
+ n.setAttribute(attr.name, String(result));
532
+ }
533
+ });
534
+ }
516
535
  });
517
536
  this._executeCloneCallback("on-clone-nodes", groupArgs);
518
- if (portal === this.parentElement) {
519
- portal.insertBefore(clone, this.nextSibling);
520
- } else {
521
- portal.appendChild(clone);
522
- }
537
+ portal.insertBefore(clone, this.nextSibling);
523
538
  }
524
539
  }
525
540
  cleanup() {
@@ -534,9 +549,9 @@ const registerAllElements = (w) => {
534
549
  }
535
550
  };
536
551
  __decorate([
537
- (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
552
+ (0, import_changedAttributeHost.changedAttributeHost)("value"),
538
553
  __metadata("design:type", Function),
539
- __metadata("design:paramtypes", []),
554
+ __metadata("design:paramtypes", [String]),
540
555
  __metadata("design:returntype", void 0)
541
556
  ], SwcAsync.prototype, "refresh", null);
542
557
  SwcAsync = __decorate([
@@ -827,5 +842,78 @@ const registerAllElements = (w) => {
827
842
  SwcAppBody = __decorate([
828
843
  (0, import_elementDefine.elementDefine)("swc-app-body", { extends: "body", window: w })
829
844
  ], SwcAppBody);
845
+ return {
846
+ // Sub Templates
847
+ SwcLoading,
848
+ SwcError,
849
+ SwcSuccess,
850
+ SwcWhen,
851
+ SwcOtherwise,
852
+ SwcDefault,
853
+ // Core Elements
854
+ SwcApp,
855
+ SwcIf,
856
+ SwcLoop,
857
+ SwcChoose,
858
+ SwcAsync,
859
+ // App Elements
860
+ SwcAppAnchor,
861
+ SwcAppArea,
862
+ SwcAppAudio,
863
+ SwcAppBase,
864
+ SwcAppButton,
865
+ SwcAppCanvas,
866
+ SwcAppData,
867
+ SwcAppDataList,
868
+ SwcAppDetails,
869
+ SwcAppDialog,
870
+ SwcAppDiv,
871
+ SwcAppDList,
872
+ SwcAppEmbed,
873
+ SwcAppFieldSet,
874
+ SwcAppForm,
875
+ SwcAppHR,
876
+ SwcAppIFrame,
877
+ SwcAppImage,
878
+ SwcAppInput,
879
+ SwcAppLabel,
880
+ SwcAppLegend,
881
+ SwcAppLI,
882
+ SwcAppLink,
883
+ SwcAppMap,
884
+ SwcAppMeta,
885
+ SwcAppMeter,
886
+ SwcAppMod,
887
+ SwcAppObject,
888
+ SwcAppOList,
889
+ SwcAppOptGroup,
890
+ SwcAppOption,
891
+ SwcAppOutput,
892
+ SwcAppParagraph,
893
+ SwcAppParam,
894
+ SwcAppPicture,
895
+ SwcAppPre,
896
+ SwcAppProgress,
897
+ SwcAppQuote,
898
+ SwcAppScript,
899
+ SwcAppSelect,
900
+ SwcAppSlot,
901
+ SwcAppSource,
902
+ SwcAppSpan,
903
+ SwcAppStyle,
904
+ SwcAppTable,
905
+ SwcAppTableSection,
906
+ SwcAppTableCell,
907
+ SwcAppTemplate,
908
+ SwcAppTextArea,
909
+ SwcAppTime,
910
+ SwcAppTitle,
911
+ SwcAppTableRow,
912
+ SwcAppTrack,
913
+ SwcAppUList,
914
+ SwcAppVideo,
915
+ SwcAppHeading,
916
+ SwcAppBody
917
+ };
830
918
  };
831
919
  //# sourceMappingURL=register.js.map