@dooboostore/simple-web-component 1.0.30 → 1.0.32

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 (93) hide show
  1. package/README.md +220 -1
  2. package/dist/cjs/decorators/applyStyle.js +1 -1
  3. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  4. package/dist/cjs/decorators/attribute.js +17 -1
  5. package/dist/cjs/decorators/attribute.js.map +2 -2
  6. package/dist/cjs/decorators/elementDefine.js +29 -12
  7. package/dist/cjs/decorators/elementDefine.js.map +3 -3
  8. package/dist/cjs/elements/SwcAppEngine.js +3 -3
  9. package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
  10. package/dist/cjs/elements/SwcAppMixin.js +1 -8
  11. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  12. package/dist/cjs/elements/SwcAsync.js +71 -78
  13. package/dist/cjs/elements/SwcAsync.js.map +2 -2
  14. package/dist/cjs/elements/SwcChoose.js +66 -81
  15. package/dist/cjs/elements/SwcChoose.js.map +2 -2
  16. package/dist/cjs/elements/SwcIf.js +52 -96
  17. package/dist/cjs/elements/SwcIf.js.map +2 -2
  18. package/dist/cjs/elements/SwcLoop.js +60 -103
  19. package/dist/cjs/elements/SwcLoop.js.map +2 -2
  20. package/dist/cjs/elements/SwcSubTemplates.js +0 -27
  21. package/dist/cjs/elements/SwcSubTemplates.js.map +2 -2
  22. package/dist/cjs/elements/register.js +314 -343
  23. package/dist/cjs/elements/register.js.map +2 -2
  24. package/dist/cjs/router/ElementRouter.js +1 -8
  25. package/dist/cjs/router/ElementRouter.js.map +2 -2
  26. package/dist/cjs/types.js.map +1 -1
  27. package/dist/cjs/utils/Utils.js +31 -24
  28. package/dist/cjs/utils/Utils.js.map +2 -2
  29. package/dist/esm/decorators/applyStyle.js +1 -1
  30. package/dist/esm/decorators/applyStyle.js.map +2 -2
  31. package/dist/esm/decorators/attribute.js +18 -2
  32. package/dist/esm/decorators/attribute.js.map +2 -2
  33. package/dist/esm/decorators/elementDefine.js +27 -10
  34. package/dist/esm/decorators/elementDefine.js.map +3 -3
  35. package/dist/esm/elements/SwcAppEngine.js +3 -3
  36. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  37. package/dist/esm/elements/SwcAppMixin.js +1 -8
  38. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  39. package/dist/esm/elements/SwcAsync.js +72 -60
  40. package/dist/esm/elements/SwcAsync.js.map +2 -2
  41. package/dist/esm/elements/SwcChoose.js +67 -63
  42. package/dist/esm/elements/SwcChoose.js.map +2 -2
  43. package/dist/esm/elements/SwcIf.js +53 -78
  44. package/dist/esm/elements/SwcIf.js.map +2 -2
  45. package/dist/esm/elements/SwcLoop.js +61 -85
  46. package/dist/esm/elements/SwcLoop.js.map +2 -2
  47. package/dist/esm/elements/SwcSubTemplates.js +0 -8
  48. package/dist/esm/elements/SwcSubTemplates.js.map +2 -2
  49. package/dist/esm/elements/register.js +246 -275
  50. package/dist/esm/elements/register.js.map +2 -2
  51. package/dist/esm/router/ElementRouter.js +1 -8
  52. package/dist/esm/router/ElementRouter.js.map +2 -2
  53. package/dist/esm/types.js.map +1 -1
  54. package/dist/esm/utils/Utils.js +31 -24
  55. package/dist/esm/utils/Utils.js.map +2 -2
  56. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2223 -2009
  57. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  58. package/dist/types/decorators/attribute.d.ts.map +1 -1
  59. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  60. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  61. package/dist/types/elements/SwcAsync.d.ts +1 -11
  62. package/dist/types/elements/SwcAsync.d.ts.map +1 -1
  63. package/dist/types/elements/SwcChoose.d.ts +1 -13
  64. package/dist/types/elements/SwcChoose.d.ts.map +1 -1
  65. package/dist/types/elements/SwcIf.d.ts +1 -13
  66. package/dist/types/elements/SwcIf.d.ts.map +1 -1
  67. package/dist/types/elements/SwcLoop.d.ts +1 -13
  68. package/dist/types/elements/SwcLoop.d.ts.map +1 -1
  69. package/dist/types/elements/SwcSubTemplates.d.ts +6 -6
  70. package/dist/types/elements/SwcSubTemplates.d.ts.map +1 -1
  71. package/dist/types/elements/register.d.ts.map +1 -1
  72. package/dist/types/router/ElementRouter.d.ts.map +1 -1
  73. package/dist/types/types.d.ts +11 -1
  74. package/dist/types/types.d.ts.map +1 -1
  75. package/dist/types/utils/Utils.d.ts +10 -0
  76. package/dist/types/utils/Utils.d.ts.map +1 -1
  77. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +2223 -2009
  78. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  79. package/package.json +3 -3
  80. package/src/decorators/applyStyle.ts +1 -1
  81. package/src/decorators/attribute.ts +35 -30
  82. package/src/decorators/elementDefine.ts +32 -10
  83. package/src/elements/SwcAppEngine.ts +3 -3
  84. package/src/elements/SwcAppMixin.ts +6 -27
  85. package/src/elements/SwcAsync.ts +75 -57
  86. package/src/elements/SwcChoose.ts +69 -77
  87. package/src/elements/SwcIf.ts +50 -75
  88. package/src/elements/SwcLoop.ts +56 -82
  89. package/src/elements/SwcSubTemplates.ts +6 -6
  90. package/src/elements/register.ts +234 -285
  91. package/src/router/ElementRouter.ts +1 -12
  92. package/src/types.ts +9 -2
  93. package/src/utils/Utils.ts +48 -37
@@ -20,11 +20,11 @@ __export(register_exports, {
20
20
  registerAllElements: () => registerAllElements
21
21
  });
22
22
  module.exports = __toCommonJS(register_exports);
23
- var import_elementDefine = require("../decorators/elementDefine");
23
+ var import_decorators = require("../decorators");
24
24
  var import_SwcAppMixin = require("./SwcAppMixin");
25
25
  var import_Utils = require("../utils/Utils");
26
26
  var import_core = require("@dooboostore/core");
27
- var import_changedAttributeHost = require("../decorators/changedAttributeHost");
27
+ var import_core_web = require("@dooboostore/core-web");
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);
@@ -100,312 +100,273 @@ const registerAllElements = (w) => {
100
100
  let SwcLoading = class SwcLoading extends HTMLTemplateElement {
101
101
  };
102
102
  SwcLoading = __decorate([
103
- (0, import_elementDefine.elementDefine)("swc-loading", { extends: "template", window: w })
103
+ (0, import_decorators.elementDefine)("swc-loading", { extends: "template", window: w })
104
104
  ], SwcLoading);
105
105
  let SwcError = class SwcError extends HTMLTemplateElement {
106
106
  };
107
107
  SwcError = __decorate([
108
- (0, import_elementDefine.elementDefine)("swc-error", { extends: "template", window: w })
108
+ (0, import_decorators.elementDefine)("swc-error", { extends: "template", window: w })
109
109
  ], SwcError);
110
110
  let SwcSuccess = class SwcSuccess extends HTMLTemplateElement {
111
111
  };
112
112
  SwcSuccess = __decorate([
113
- (0, import_elementDefine.elementDefine)("swc-success", { extends: "template", window: w })
113
+ (0, import_decorators.elementDefine)("swc-success", { extends: "template", window: w })
114
114
  ], SwcSuccess);
115
115
  let SwcWhen = class SwcWhen extends HTMLTemplateElement {
116
116
  };
117
117
  SwcWhen = __decorate([
118
- (0, import_elementDefine.elementDefine)("swc-when", { extends: "template", window: w })
118
+ (0, import_decorators.elementDefine)("swc-when", { extends: "template", window: w })
119
119
  ], SwcWhen);
120
120
  let SwcOtherwise = class SwcOtherwise extends HTMLTemplateElement {
121
121
  };
122
122
  SwcOtherwise = __decorate([
123
- (0, import_elementDefine.elementDefine)("swc-otherwise", { extends: "template", window: w })
123
+ (0, import_decorators.elementDefine)("swc-otherwise", { extends: "template", window: w })
124
124
  ], SwcOtherwise);
125
125
  let SwcDefault = class SwcDefault extends HTMLTemplateElement {
126
126
  };
127
127
  SwcDefault = __decorate([
128
- (0, import_elementDefine.elementDefine)("swc-default", { extends: "template", window: w })
128
+ (0, import_decorators.elementDefine)("swc-default", { extends: "template", window: w })
129
129
  ], SwcDefault);
130
130
  let SwcApp = class SwcApp extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLElement) {
131
131
  };
132
132
  SwcApp = __decorate([
133
- (0, import_elementDefine.elementDefine)("swc-app", { window: w })
133
+ (0, import_decorators.elementDefine)("swc-app", { window: w })
134
134
  ], SwcApp);
135
135
  let SwcIf = class SwcIf extends HTMLTemplateElement {
136
136
  constructor() {
137
137
  super(...arguments);
138
- this._value = false;
139
138
  this._nodes = [];
140
139
  }
141
140
  get value() {
142
141
  return this._value;
143
142
  }
144
143
  set value(nv) {
145
- this._value = Boolean(nv);
146
- this.render();
144
+ this.refresh(nv);
147
145
  }
148
- _resolvePortal() {
149
- const portalScript = this.getAttribute("on-get-portal");
150
- if (!portalScript)
151
- return this.parentElement;
146
+ replaceExpressions(html, groupArgs, context, wrap) {
147
+ const config = wrap ? { wrapExpression: wrap } : void 0;
148
+ const ae = new import_core.ActionExpression(html, config);
149
+ const filterOptions = wrap ? { type: "replace", wrap } : "replace";
152
150
  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
- _executeCloneCallback(attr, args) {
165
- const script = this.getAttribute(attr);
166
- if (!script)
167
- return;
168
- import_core.FunctionUtils.execute({ script, context: this, args });
169
- }
170
- refreshValue() {
171
- const script = this.getAttribute("on-get-value");
172
- if (!script) {
173
- this.value = false;
174
- return;
175
- }
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);
184
- } else {
185
- this.value = res;
151
+ for (const expr of ae.getExpressions(filterOptions)) {
152
+ try {
153
+ const value = import_core.FunctionUtils.executeReturn({
154
+ script: import_core_web.ConvertUtils.decodeHtmlEntity(expr.script, win.document),
155
+ context,
156
+ args: groupArgs
157
+ });
158
+ ae.replace(expr, String(value));
159
+ } catch (e) {
160
+ console.error(`[SWC] Failed to execute ${expr.original}:`, e);
161
+ }
186
162
  }
163
+ return ae.getUnprocessedTemplate();
164
+ }
165
+ setValue(valueAttr) {
166
+ this.refresh();
167
+ }
168
+ setReplaceWrap(replaceWrapAttr) {
169
+ this.refresh();
187
170
  }
188
- render() {
171
+ refresh(value = this._value) {
189
172
  this.cleanup();
190
- const portal = this._resolvePortal();
191
- if (!portal)
173
+ const portal = this.parentElement;
174
+ if (!portal || !value)
192
175
  return;
193
176
  const win = this.ownerDocument?.defaultView || window;
194
177
  const helperSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
195
- let targetTpl = null;
196
- if (this._value) {
197
- targetTpl = this;
198
- } else {
199
- targetTpl = this.content.querySelector('template[is="swc-default"]');
200
- }
201
- if (targetTpl) {
202
- const clone = targetTpl.content.cloneNode(true);
203
- if (targetTpl === this) {
204
- clone.querySelectorAll('template[is^="swc-"]').forEach((t) => t.remove());
205
- }
206
- this._nodes = Array.from(clone.childNodes);
207
- const elements = this._nodes.filter((n) => n.nodeType === 1);
208
- const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };
209
- this._nodes.forEach((node, nodeIdx) => {
210
- if (node instanceof HTMLElement)
211
- node.__swc_host = this;
212
- this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });
213
- });
214
- this._executeCloneCallback("on-clone-nodes", groupArgs);
215
- if (portal === this.parentElement) {
216
- portal.insertBefore(clone, this.nextSibling);
217
- } else {
218
- portal.appendChild(clone);
219
- }
220
- }
178
+ let htmlString = this.innerHTML;
179
+ const groupArgs = { ...helperSet, $value: value };
180
+ htmlString = this.replaceExpressions(htmlString, groupArgs, this, this._replaceWrap);
181
+ const result = this.ownerDocument?.createElement("template") || document.createElement("template");
182
+ result.innerHTML = htmlString;
183
+ const processedFragment = result.content;
184
+ this._nodes = Array.from(processedFragment.childNodes);
185
+ portal.insertBefore(processedFragment, this.nextSibling);
221
186
  }
222
187
  cleanup() {
223
188
  this._nodes.forEach((n) => n.parentElement?.removeChild(n));
224
189
  this._nodes = [];
225
190
  }
226
- connectedCallback() {
227
- this.refreshValue();
228
- }
229
191
  disconnectedCallback() {
230
192
  this.cleanup();
231
193
  }
232
194
  };
233
195
  __decorate([
234
- (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
196
+ (0, import_decorators.attributeHost)("value"),
197
+ __metadata("design:type", Object)
198
+ ], SwcIf.prototype, "_value", void 0);
199
+ __decorate([
200
+ (0, import_decorators.attributeHost)("replace-wrap"),
201
+ __metadata("design:type", String)
202
+ ], SwcIf.prototype, "_replaceWrap", void 0);
203
+ __decorate([
204
+ (0, import_decorators.changedAttributeHost)("value"),
235
205
  __metadata("design:type", Function),
236
- __metadata("design:paramtypes", []),
206
+ __metadata("design:paramtypes", [String]),
207
+ __metadata("design:returntype", void 0)
208
+ ], SwcIf.prototype, "setValue", null);
209
+ __decorate([
210
+ (0, import_decorators.changedAttributeHost)("replace-wrap"),
211
+ __metadata("design:type", Function),
212
+ __metadata("design:paramtypes", [String]),
237
213
  __metadata("design:returntype", void 0)
238
- ], SwcIf.prototype, "refreshValue", null);
214
+ ], SwcIf.prototype, "setReplaceWrap", null);
239
215
  SwcIf = __decorate([
240
- (0, import_elementDefine.elementDefine)("swc-if", { extends: "template", window: w })
216
+ (0, import_decorators.elementDefine)("swc-if", { extends: "template", window: w })
241
217
  ], SwcIf);
242
218
  let SwcLoop = class SwcLoop extends HTMLTemplateElement {
243
219
  constructor() {
244
220
  super(...arguments);
245
- this._value = [];
246
221
  this._nodeGroups = [];
247
222
  }
248
223
  get value() {
249
224
  return this._value;
250
225
  }
251
226
  set value(nv) {
252
- this._value = Array.isArray(nv) ? [...nv] : [];
253
- this.render();
227
+ this.refresh(nv);
254
228
  }
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
- _executeCloneCallback(attr, args) {
272
- const script = this.getAttribute(attr);
273
- if (!script)
274
- return;
275
- import_core.FunctionUtils.execute({ script, context: this, args });
229
+ setValue() {
230
+ this.refresh();
276
231
  }
277
- _cleanup() {
278
- this._nodeGroups.forEach((nodes) => nodes.forEach((n) => n.parentElement?.removeChild(n)));
279
- this._nodeGroups = [];
232
+ setReplaceWrap() {
233
+ this.refresh();
280
234
  }
281
- refreshValue() {
282
- const script = this.getAttribute("on-get-value");
283
- if (!script) {
284
- this.value = [];
285
- return;
286
- }
235
+ replaceExpressions(html, groupArgs, context, wrap) {
236
+ const config = wrap ? { wrapExpression: wrap } : void 0;
237
+ const ae = new import_core.ActionExpression(html, config);
238
+ const filterOptions = wrap ? { type: "replace", wrap } : "replace";
287
239
  const win = this.ownerDocument?.defaultView || window;
288
- const res = import_core.FunctionUtils.executeReturn({
289
- script,
290
- context: this,
291
- args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
292
- });
293
- if (res instanceof Promise) {
294
- res.then((v) => this.value = v).catch(() => this.value = []);
295
- } else {
296
- this.value = res;
240
+ for (const expr of ae.getExpressions(filterOptions)) {
241
+ try {
242
+ const value = import_core.FunctionUtils.executeReturn({
243
+ script: import_core_web.ConvertUtils.decodeHtmlEntity(expr.script, win.document),
244
+ context,
245
+ args: groupArgs
246
+ });
247
+ ae.replace(expr, String(value));
248
+ } catch (e) {
249
+ console.error(`[SWC] Failed to execute ${expr.original}:`, e);
250
+ }
297
251
  }
252
+ return ae.getUnprocessedTemplate();
298
253
  }
299
- render() {
300
- this._cleanup();
301
- const portal = this._resolvePortal();
254
+ refresh(value = this._value) {
255
+ this.cleanup();
256
+ if (value?.length <= 0)
257
+ return;
258
+ const portal = this.parentElement;
302
259
  if (!portal)
303
260
  return;
304
261
  const win = this.ownerDocument?.defaultView || window;
305
262
  const helperSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
306
263
  const fragment = win.document.createDocumentFragment();
307
- if (this._value.length === 0) {
308
- const defaultTpl = this.content.querySelector('template[is="swc-default"]');
309
- if (defaultTpl) {
310
- const clone = defaultTpl.content.cloneNode(true);
311
- const nodes = Array.from(clone.childNodes);
312
- this._nodeGroups.push(nodes);
313
- fragment.appendChild(clone);
314
- }
315
- } else {
316
- this._value.forEach((item, index) => {
317
- const clone = this.content.cloneNode(true);
318
- const subTemplates = clone.querySelectorAll('template[is^="swc-"]');
319
- subTemplates.forEach((t) => t.remove());
320
- const nodes = Array.from(clone.childNodes);
321
- const elements = nodes.filter((n) => n.nodeType === 1);
322
- const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value, $nodes: nodes, $elements: elements, $firstElement: elements[0] };
323
- nodes.forEach((node, nodeIdx) => {
324
- if (node instanceof HTMLElement)
325
- node.__swc_host = this;
326
- this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: node, $nodeIndex: nodeIdx, $isElement: node.nodeType === 1 });
327
- });
328
- this._executeCloneCallback("on-clone-nodes", groupArgs);
329
- this._nodeGroups.push(nodes);
330
- fragment.appendChild(clone);
331
- });
332
- }
333
- if (portal === this.parentElement) {
334
- portal.insertBefore(fragment, this.nextSibling);
335
- } else {
336
- portal.appendChild(fragment);
337
- }
264
+ value.forEach((item, index) => {
265
+ let htmlString = this.innerHTML;
266
+ const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value };
267
+ htmlString = this.replaceExpressions(htmlString, groupArgs, this, this._replaceWrap);
268
+ const temp = this.ownerDocument?.createElement("template") || document.createElement("template");
269
+ temp.innerHTML = htmlString;
270
+ const content = temp.content;
271
+ const nodes = Array.from(content.childNodes);
272
+ this._nodeGroups.push(nodes);
273
+ fragment.appendChild(content);
274
+ });
275
+ portal.insertBefore(fragment, this.nextSibling);
338
276
  }
339
- connectedCallback() {
340
- this.refreshValue();
277
+ cleanup() {
278
+ this._nodeGroups.forEach((nodes) => nodes.forEach((n) => n.parentElement?.removeChild(n)));
279
+ this._nodeGroups = [];
341
280
  }
342
281
  disconnectedCallback() {
343
- this._cleanup();
282
+ this.cleanup();
344
283
  }
345
284
  };
346
285
  __decorate([
347
- (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
286
+ (0, import_decorators.attributeHost)("value"),
287
+ __metadata("design:type", Array)
288
+ ], SwcLoop.prototype, "_value", void 0);
289
+ __decorate([
290
+ (0, import_decorators.attributeHost)("replace-wrap"),
291
+ __metadata("design:type", String)
292
+ ], SwcLoop.prototype, "_replaceWrap", void 0);
293
+ __decorate([
294
+ (0, import_decorators.changedAttributeHost)("value"),
295
+ __metadata("design:type", Function),
296
+ __metadata("design:paramtypes", []),
297
+ __metadata("design:returntype", void 0)
298
+ ], SwcLoop.prototype, "setValue", null);
299
+ __decorate([
300
+ (0, import_decorators.changedAttributeHost)("replace-wrap"),
348
301
  __metadata("design:type", Function),
349
302
  __metadata("design:paramtypes", []),
350
303
  __metadata("design:returntype", void 0)
351
- ], SwcLoop.prototype, "refreshValue", null);
304
+ ], SwcLoop.prototype, "setReplaceWrap", null);
352
305
  SwcLoop = __decorate([
353
- (0, import_elementDefine.elementDefine)("swc-loop", { extends: "template", window: w })
306
+ (0, import_decorators.elementDefine)("swc-loop", { extends: "template", window: w })
354
307
  ], SwcLoop);
355
308
  let SwcChoose = class SwcChoose extends HTMLTemplateElement {
356
309
  constructor() {
357
310
  super(...arguments);
358
311
  this._nodes = [];
359
- this._value = null;
360
312
  this._previousTemplate = null;
361
313
  }
362
314
  get value() {
363
315
  return this._value;
364
316
  }
365
317
  set value(nv) {
366
- this._value = nv;
367
- this.render();
318
+ this.refresh(nv);
368
319
  }
369
- _executeCloneCallback(attr, args) {
370
- const script = this.getAttribute(attr);
371
- if (!script)
372
- return;
373
- import_core.FunctionUtils.execute({ script, context: this, args });
320
+ setValue() {
321
+ this.refresh();
374
322
  }
375
- refresh(valueAttr) {
376
- valueAttr ?? (valueAttr = this.getAttribute("value"));
377
- if (valueAttr === null) {
378
- this.value = null;
379
- return;
380
- }
381
- if (valueAttr.startsWith("{{") && valueAttr.endsWith("}}")) {
382
- const script = valueAttr.slice(2, -2).trim();
383
- const win = this.ownerDocument?.defaultView || window;
384
- const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
385
- this.value = result;
386
- } else {
387
- this.value = valueAttr;
323
+ setReplaceWrap(replaceWrapAttr) {
324
+ this.refresh();
325
+ }
326
+ replaceExpressions(html, groupArgs, context, wrap) {
327
+ const config = wrap ? { wrapExpression: wrap } : void 0;
328
+ const ae = new import_core.ActionExpression(html, config);
329
+ const filterOptions = wrap ? { type: "replace", wrap } : "replace";
330
+ const win = this.ownerDocument?.defaultView || window;
331
+ for (const expr of ae.getExpressions(filterOptions)) {
332
+ try {
333
+ const value = import_core.FunctionUtils.executeReturn({
334
+ script: import_core_web.ConvertUtils.decodeHtmlEntity(expr.script, win.document),
335
+ context,
336
+ args: groupArgs
337
+ });
338
+ ae.replace(expr, String(value));
339
+ } catch (e) {
340
+ console.error(`[SWC] Failed to execute ${expr.original}:`, e);
341
+ }
388
342
  }
343
+ return ae.getUnprocessedTemplate();
389
344
  }
390
- render() {
345
+ refresh(value = this._value) {
346
+ const portal = this.parentElement;
347
+ if (!portal)
348
+ return;
391
349
  const win = this.ownerDocument?.defaultView || window;
392
350
  const helperSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
351
+ const groupArgs = { ...helperSet, $value: value };
393
352
  const templates = Array.from(this.content.querySelectorAll("template"));
394
353
  let selected = null;
395
354
  for (const t of templates) {
396
355
  if (t.getAttribute("is") === "swc-when") {
356
+ const attrVal = t.getAttribute("value") || "";
397
357
  let matches = false;
398
- const value = t.getAttribute("value") || "";
399
- if (value.startsWith("{{") && value.endsWith("}}")) {
400
- const script = value.slice(2, -2).trim();
358
+ const ae = new import_core.ActionExpression(attrVal);
359
+ const expr = ae.getFirstExpression("replace");
360
+ if (expr) {
361
+ const decodedScript = import_core_web.ConvertUtils.decodeHtmlEntity(expr.script, win.document);
401
362
  const result = import_core.FunctionUtils.executeReturn({
402
- script,
363
+ script: decodedScript,
403
364
  context: t,
404
- args: { ...helperSet, $value: this._value }
365
+ args: groupArgs
405
366
  });
406
- matches = result === true;
367
+ matches = !!result;
407
368
  } else {
408
- matches = String(value) === String(this._value);
369
+ matches = String(attrVal) === String(value);
409
370
  }
410
371
  if (matches) {
411
372
  selected = t;
@@ -414,437 +375,447 @@ const registerAllElements = (w) => {
414
375
  }
415
376
  }
416
377
  const target = selected || this.content.querySelector('template[is="swc-otherwise"]');
417
- const targetHasSkipIfSame = target?.hasAttribute("skip-if-same");
418
- const shouldSkip = (this.hasAttribute("skip-if-same") || targetHasSkipIfSame) && this._previousTemplate === target;
419
- if (shouldSkip) {
378
+ const skipValue = target?.getAttribute?.("skip-if-same");
379
+ const skipValue2 = this._previousTemplate?.getAttribute?.("skip-if-same");
380
+ const hasSkipIfSame = target?.hasAttribute?.("skip-if-same");
381
+ const isSame = this._previousTemplate === target;
382
+ if (hasSkipIfSame && isSame) {
420
383
  return;
421
384
  }
422
385
  this.cleanup();
423
386
  this._previousTemplate = target;
424
387
  if (target) {
425
- const clone = target.content.cloneNode(true);
426
- this._nodes = Array.from(clone.childNodes);
427
- const elements = this._nodes.filter((n) => n.nodeType === 1);
428
- const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0] };
429
- this._nodes.forEach((n, nodeIdx) => {
430
- this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });
431
- if (n instanceof HTMLElement) {
432
- Array.from(n.attributes).forEach((attr) => {
433
- const value = attr.value || "";
434
- if (value.startsWith("{{") && value.endsWith("}}")) {
435
- const script = value.slice(2, -2).trim();
436
- const result = import_core.FunctionUtils.executeReturn({
437
- script,
438
- context: n,
439
- args: { ...groupArgs, $value: this._value }
440
- });
441
- n.setAttribute(attr.name, String(result));
442
- }
443
- });
444
- }
445
- });
446
- this._executeCloneCallback("on-clone-nodes", groupArgs);
447
- this.parentElement?.insertBefore(clone, this.nextSibling);
388
+ let htmlString = target.innerHTML;
389
+ htmlString = this.replaceExpressions(htmlString, groupArgs, this, this._replaceWrap);
390
+ const result = this.ownerDocument?.createElement("template") || document.createElement("template");
391
+ result.innerHTML = htmlString;
392
+ const processedFragment = result.content;
393
+ this._nodes = Array.from(processedFragment.childNodes);
394
+ portal.insertBefore(processedFragment, this.nextSibling);
448
395
  }
449
396
  }
450
397
  cleanup() {
451
398
  this._nodes.forEach((n) => n.parentElement?.removeChild(n));
452
399
  this._nodes = [];
453
400
  }
454
- connectedCallback() {
455
- this.refresh();
456
- }
457
401
  disconnectedCallback() {
458
402
  this.cleanup();
459
403
  }
460
404
  };
461
405
  __decorate([
462
- (0, import_changedAttributeHost.changedAttributeHost)("value"),
406
+ (0, import_decorators.attributeHost)("value"),
407
+ __metadata("design:type", Object)
408
+ ], SwcChoose.prototype, "_value", void 0);
409
+ __decorate([
410
+ (0, import_decorators.attributeHost)("replace-wrap"),
411
+ __metadata("design:type", String)
412
+ ], SwcChoose.prototype, "_replaceWrap", void 0);
413
+ __decorate([
414
+ (0, import_decorators.changedAttributeHost)("value"),
415
+ __metadata("design:type", Function),
416
+ __metadata("design:paramtypes", []),
417
+ __metadata("design:returntype", void 0)
418
+ ], SwcChoose.prototype, "setValue", null);
419
+ __decorate([
420
+ (0, import_decorators.changedAttributeHost)("replace-wrap"),
463
421
  __metadata("design:type", Function),
464
422
  __metadata("design:paramtypes", [String]),
465
423
  __metadata("design:returntype", void 0)
466
- ], SwcChoose.prototype, "refresh", null);
424
+ ], SwcChoose.prototype, "setReplaceWrap", null);
467
425
  SwcChoose = __decorate([
468
- (0, import_elementDefine.elementDefine)("swc-choose", { extends: "template", window: w })
426
+ (0, import_decorators.elementDefine)("swc-choose", { extends: "template", window: w })
469
427
  ], SwcChoose);
470
428
  let SwcAsync = class SwcAsync extends HTMLTemplateElement {
471
429
  constructor() {
472
430
  super(...arguments);
473
431
  this._nodes = [];
474
- this._value = null;
475
432
  }
476
- _resolvePortal() {
477
- const portalScript = this.getAttribute("on-get-portal");
478
- if (!portalScript)
479
- return this.parentElement;
480
- const win = this.ownerDocument?.defaultView || window;
481
- const res = import_core.FunctionUtils.executeReturn({
482
- script: portalScript,
483
- context: this,
484
- args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
485
- });
486
- if (res instanceof HTMLElement)
487
- return res;
488
- if (typeof res === "string")
489
- return win.document.querySelector(res);
490
- return this.parentElement;
491
- }
492
- _executeCloneCallback(attr, args) {
493
- const script = this.getAttribute(attr);
494
- if (!script)
495
- return;
496
- import_core.FunctionUtils.execute({ script, context: this, args });
433
+ get value() {
434
+ return this._value;
497
435
  }
498
- refresh() {
499
- const script = this.getAttribute("on-get-value");
500
- if (!script) {
501
- this.render("default");
436
+ set value(nv) {
437
+ this.executeAsync(nv);
438
+ }
439
+ setValue(valueAttr) {
440
+ this.executeAsync(this._value);
441
+ }
442
+ setReplaceWrap() {
443
+ this.executeAsync(this._value);
444
+ }
445
+ executeAsync(result = this._value) {
446
+ if (result === void 0 || result === null) {
447
+ this.refresh("default");
502
448
  return;
503
449
  }
504
- const win = this.ownerDocument?.defaultView || window;
505
- const result = import_core.FunctionUtils.executeReturn({ script, context: this, args: import_Utils.SwcUtils.getHelperAndHostSet(win, this) });
506
450
  if (result instanceof Promise) {
507
- this.render("loading");
451
+ this.refresh("loading");
508
452
  result.then((v) => {
509
- this._value = v;
510
- this.render("success");
511
- }).catch((e) => this.render("error"));
453
+ this.resultValue = v;
454
+ this.refresh("success");
455
+ }).catch((e) => {
456
+ console.error("[SWC-ASYNC] Promise rejected:", e);
457
+ this.resultValue = e;
458
+ this.refresh("error");
459
+ });
512
460
  } else {
513
- this._value = result;
514
- this.render("success");
461
+ this.resultValue = result;
462
+ this.refresh("success");
463
+ }
464
+ }
465
+ replaceExpressions(html, groupArgs, context, wrap) {
466
+ const config = wrap ? { wrapExpression: wrap } : void 0;
467
+ const ae = new import_core.ActionExpression(html, config);
468
+ const filterOptions = wrap ? { type: "replace", wrap } : "replace";
469
+ const win = this.ownerDocument?.defaultView || window;
470
+ for (const expr of ae.getExpressions(filterOptions)) {
471
+ try {
472
+ const value = import_core.FunctionUtils.executeReturn({
473
+ script: import_core_web.ConvertUtils.decodeHtmlEntity(expr.script, win.document),
474
+ context,
475
+ args: groupArgs
476
+ });
477
+ ae.replace(expr, String(value));
478
+ } catch (e) {
479
+ console.error(`[SWC] Failed to execute ${expr.original}:`, e);
480
+ }
515
481
  }
482
+ return ae.getUnprocessedTemplate();
516
483
  }
517
- render(state) {
484
+ refresh(state = "default") {
485
+ console.log("rrrrrrrrrrrrrrrrr", state);
518
486
  this.cleanup();
519
- const portal = this._resolvePortal();
487
+ const portal = this.parentElement;
520
488
  if (!portal)
521
489
  return;
522
490
  const win = this.ownerDocument?.defaultView || window;
523
491
  const helperSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
524
492
  const t = this.content.querySelector(`template[is="swc-${state}"]`);
525
493
  if (t) {
526
- const clone = t.content.cloneNode(true);
527
- this._nodes = Array.from(clone.childNodes);
528
- const elements = this._nodes.filter((n) => n.nodeType === 1);
529
- const groupArgs = { ...helperSet, $value: this._value, $nodes: this._nodes, $elements: elements, $firstElement: elements[0], $state: state };
530
- this._nodes.forEach((n, nodeIdx) => {
531
- if (n instanceof HTMLElement)
532
- n.__swc_host = this;
533
- this._executeCloneCallback("on-clone-node", { ...groupArgs, $node: n, $nodeIndex: nodeIdx, $isElement: n.nodeType === 1 });
534
- });
535
- this._executeCloneCallback("on-clone-nodes", groupArgs);
536
- if (portal === this.parentElement) {
537
- portal.insertBefore(clone, this.nextSibling);
538
- } else {
539
- portal.appendChild(clone);
540
- }
494
+ let htmlString = t.innerHTML;
495
+ const groupArgs = { ...helperSet, $value: this._value, $state: state };
496
+ htmlString = this.replaceExpressions(htmlString, groupArgs, this, this._replaceWrap);
497
+ const temp = this.ownerDocument?.createElement("template") || document.createElement("template");
498
+ temp.innerHTML = htmlString;
499
+ const content = temp.content;
500
+ this._nodes = Array.from(content.childNodes);
501
+ portal.insertBefore(content, this.nextSibling);
541
502
  }
542
503
  }
543
504
  cleanup() {
544
505
  this._nodes.forEach((n) => n.parentElement?.removeChild(n));
545
506
  this._nodes = [];
546
507
  }
547
- connectedCallback() {
548
- console.log("[SwcAsync] connectedCallback called");
549
- this.refresh();
550
- }
551
508
  disconnectedCallback() {
552
509
  this.cleanup();
553
510
  }
554
511
  };
555
512
  __decorate([
556
- (0, import_changedAttributeHost.changedAttributeHost)("on-get-value"),
513
+ (0, import_decorators.attributeHost)("value"),
514
+ __metadata("design:type", Object)
515
+ ], SwcAsync.prototype, "_value", void 0);
516
+ __decorate([
517
+ (0, import_decorators.attributeHost)("replace-wrap"),
518
+ __metadata("design:type", String)
519
+ ], SwcAsync.prototype, "_replaceWrap", void 0);
520
+ __decorate([
521
+ (0, import_decorators.changedAttributeHost)("value"),
522
+ __metadata("design:type", Function),
523
+ __metadata("design:paramtypes", [String]),
524
+ __metadata("design:returntype", void 0)
525
+ ], SwcAsync.prototype, "setValue", null);
526
+ __decorate([
527
+ (0, import_decorators.changedAttributeHost)("replace-wrap"),
557
528
  __metadata("design:type", Function),
558
529
  __metadata("design:paramtypes", []),
559
530
  __metadata("design:returntype", void 0)
560
- ], SwcAsync.prototype, "refresh", null);
531
+ ], SwcAsync.prototype, "setReplaceWrap", null);
561
532
  SwcAsync = __decorate([
562
- (0, import_elementDefine.elementDefine)("swc-async", { extends: "template", window: w })
533
+ (0, import_decorators.elementDefine)("swc-async", { extends: "template", window: w })
563
534
  ], SwcAsync);
564
535
  let SwcAppAnchor = class SwcAppAnchor extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLAnchorElement) {
565
536
  };
566
537
  SwcAppAnchor = __decorate([
567
- (0, import_elementDefine.elementDefine)("swc-app-a", { extends: "a", window: w })
538
+ (0, import_decorators.elementDefine)("swc-app-a", { extends: "a", window: w })
568
539
  ], SwcAppAnchor);
569
540
  let SwcAppArea = class SwcAppArea extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLAreaElement) {
570
541
  };
571
542
  SwcAppArea = __decorate([
572
- (0, import_elementDefine.elementDefine)("swc-app-area", { extends: "area", window: w })
543
+ (0, import_decorators.elementDefine)("swc-app-area", { extends: "area", window: w })
573
544
  ], SwcAppArea);
574
545
  let SwcAppAudio = class SwcAppAudio extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLAudioElement) {
575
546
  };
576
547
  SwcAppAudio = __decorate([
577
- (0, import_elementDefine.elementDefine)("swc-app-audio", { extends: "audio", window: w })
548
+ (0, import_decorators.elementDefine)("swc-app-audio", { extends: "audio", window: w })
578
549
  ], SwcAppAudio);
579
550
  let SwcAppBase = class SwcAppBase extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLBaseElement) {
580
551
  };
581
552
  SwcAppBase = __decorate([
582
- (0, import_elementDefine.elementDefine)("swc-app-base", { extends: "base", window: w })
553
+ (0, import_decorators.elementDefine)("swc-app-base", { extends: "base", window: w })
583
554
  ], SwcAppBase);
584
555
  let SwcAppButton = class SwcAppButton extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLButtonElement) {
585
556
  };
586
557
  SwcAppButton = __decorate([
587
- (0, import_elementDefine.elementDefine)("swc-app-button", { extends: "button", window: w })
558
+ (0, import_decorators.elementDefine)("swc-app-button", { extends: "button", window: w })
588
559
  ], SwcAppButton);
589
560
  let SwcAppCanvas = class SwcAppCanvas extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLCanvasElement) {
590
561
  };
591
562
  SwcAppCanvas = __decorate([
592
- (0, import_elementDefine.elementDefine)("swc-app-canvas", { extends: "canvas", window: w })
563
+ (0, import_decorators.elementDefine)("swc-app-canvas", { extends: "canvas", window: w })
593
564
  ], SwcAppCanvas);
594
565
  let SwcAppData = class SwcAppData extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLDataElement) {
595
566
  };
596
567
  SwcAppData = __decorate([
597
- (0, import_elementDefine.elementDefine)("swc-app-data", { extends: "data", window: w })
568
+ (0, import_decorators.elementDefine)("swc-app-data", { extends: "data", window: w })
598
569
  ], SwcAppData);
599
570
  let SwcAppDataList = class SwcAppDataList extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLDataListElement) {
600
571
  };
601
572
  SwcAppDataList = __decorate([
602
- (0, import_elementDefine.elementDefine)("swc-app-datalist", { extends: "datalist", window: w })
573
+ (0, import_decorators.elementDefine)("swc-app-datalist", { extends: "datalist", window: w })
603
574
  ], SwcAppDataList);
604
575
  let SwcAppDetails = class SwcAppDetails extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLDetailsElement) {
605
576
  };
606
577
  SwcAppDetails = __decorate([
607
- (0, import_elementDefine.elementDefine)("swc-app-details", { extends: "details", window: w })
578
+ (0, import_decorators.elementDefine)("swc-app-details", { extends: "details", window: w })
608
579
  ], SwcAppDetails);
609
580
  let SwcAppDialog = class SwcAppDialog extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLDialogElement) {
610
581
  };
611
582
  SwcAppDialog = __decorate([
612
- (0, import_elementDefine.elementDefine)("swc-app-dialog", { extends: "dialog", window: w })
583
+ (0, import_decorators.elementDefine)("swc-app-dialog", { extends: "dialog", window: w })
613
584
  ], SwcAppDialog);
614
585
  let SwcAppDiv = class SwcAppDiv extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLDivElement) {
615
586
  };
616
587
  SwcAppDiv = __decorate([
617
- (0, import_elementDefine.elementDefine)("swc-app-div", { extends: "div", window: w })
588
+ (0, import_decorators.elementDefine)("swc-app-div", { extends: "div", window: w })
618
589
  ], SwcAppDiv);
619
590
  let SwcAppDList = class SwcAppDList extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLDListElement) {
620
591
  };
621
592
  SwcAppDList = __decorate([
622
- (0, import_elementDefine.elementDefine)("swc-app-dl", { extends: "dl", window: w })
593
+ (0, import_decorators.elementDefine)("swc-app-dl", { extends: "dl", window: w })
623
594
  ], SwcAppDList);
624
595
  let SwcAppEmbed = class SwcAppEmbed extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLEmbedElement) {
625
596
  };
626
597
  SwcAppEmbed = __decorate([
627
- (0, import_elementDefine.elementDefine)("swc-app-embed", { extends: "embed", window: w })
598
+ (0, import_decorators.elementDefine)("swc-app-embed", { extends: "embed", window: w })
628
599
  ], SwcAppEmbed);
629
600
  let SwcAppFieldSet = class SwcAppFieldSet extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLFieldSetElement) {
630
601
  };
631
602
  SwcAppFieldSet = __decorate([
632
- (0, import_elementDefine.elementDefine)("swc-app-fieldset", { extends: "fieldset", window: w })
603
+ (0, import_decorators.elementDefine)("swc-app-fieldset", { extends: "fieldset", window: w })
633
604
  ], SwcAppFieldSet);
634
605
  let SwcAppForm = class SwcAppForm extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLFormElement) {
635
606
  };
636
607
  SwcAppForm = __decorate([
637
- (0, import_elementDefine.elementDefine)("swc-app-form", { extends: "form", window: w })
608
+ (0, import_decorators.elementDefine)("swc-app-form", { extends: "form", window: w })
638
609
  ], SwcAppForm);
639
610
  let SwcAppHR = class SwcAppHR extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLHRElement) {
640
611
  };
641
612
  SwcAppHR = __decorate([
642
- (0, import_elementDefine.elementDefine)("swc-app-hr", { extends: "hr", window: w })
613
+ (0, import_decorators.elementDefine)("swc-app-hr", { extends: "hr", window: w })
643
614
  ], SwcAppHR);
644
615
  let SwcAppIFrame = class SwcAppIFrame extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLIFrameElement) {
645
616
  };
646
617
  SwcAppIFrame = __decorate([
647
- (0, import_elementDefine.elementDefine)("swc-app-iframe", { extends: "iframe", window: w })
618
+ (0, import_decorators.elementDefine)("swc-app-iframe", { extends: "iframe", window: w })
648
619
  ], SwcAppIFrame);
649
620
  let SwcAppImage = class SwcAppImage extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLImageElement) {
650
621
  };
651
622
  SwcAppImage = __decorate([
652
- (0, import_elementDefine.elementDefine)("swc-app-img", { extends: "img", window: w })
623
+ (0, import_decorators.elementDefine)("swc-app-img", { extends: "img", window: w })
653
624
  ], SwcAppImage);
654
625
  let SwcAppInput = class SwcAppInput extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLInputElement) {
655
626
  };
656
627
  SwcAppInput = __decorate([
657
- (0, import_elementDefine.elementDefine)("swc-app-input", { extends: "input", window: w })
628
+ (0, import_decorators.elementDefine)("swc-app-input", { extends: "input", window: w })
658
629
  ], SwcAppInput);
659
630
  let SwcAppLabel = class SwcAppLabel extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLLabelElement) {
660
631
  };
661
632
  SwcAppLabel = __decorate([
662
- (0, import_elementDefine.elementDefine)("swc-app-label", { extends: "label", window: w })
633
+ (0, import_decorators.elementDefine)("swc-app-label", { extends: "label", window: w })
663
634
  ], SwcAppLabel);
664
635
  let SwcAppLegend = class SwcAppLegend extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLLegendElement) {
665
636
  };
666
637
  SwcAppLegend = __decorate([
667
- (0, import_elementDefine.elementDefine)("swc-app-legend", { extends: "legend", window: w })
638
+ (0, import_decorators.elementDefine)("swc-app-legend", { extends: "legend", window: w })
668
639
  ], SwcAppLegend);
669
640
  let SwcAppLI = class SwcAppLI extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLLIElement) {
670
641
  };
671
642
  SwcAppLI = __decorate([
672
- (0, import_elementDefine.elementDefine)("swc-app-li", { extends: "li", window: w })
643
+ (0, import_decorators.elementDefine)("swc-app-li", { extends: "li", window: w })
673
644
  ], SwcAppLI);
674
645
  let SwcAppLink = class SwcAppLink extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLLinkElement) {
675
646
  };
676
647
  SwcAppLink = __decorate([
677
- (0, import_elementDefine.elementDefine)("swc-app-link", { extends: "link", window: w })
648
+ (0, import_decorators.elementDefine)("swc-app-link", { extends: "link", window: w })
678
649
  ], SwcAppLink);
679
650
  let SwcAppMap = class SwcAppMap extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLMapElement) {
680
651
  };
681
652
  SwcAppMap = __decorate([
682
- (0, import_elementDefine.elementDefine)("swc-app-map", { extends: "map", window: w })
653
+ (0, import_decorators.elementDefine)("swc-app-map", { extends: "map", window: w })
683
654
  ], SwcAppMap);
684
655
  let SwcAppMeta = class SwcAppMeta extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLMetaElement) {
685
656
  };
686
657
  SwcAppMeta = __decorate([
687
- (0, import_elementDefine.elementDefine)("swc-app-meta", { extends: "meta", window: w })
658
+ (0, import_decorators.elementDefine)("swc-app-meta", { extends: "meta", window: w })
688
659
  ], SwcAppMeta);
689
660
  let SwcAppMeter = class SwcAppMeter extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLMeterElement) {
690
661
  };
691
662
  SwcAppMeter = __decorate([
692
- (0, import_elementDefine.elementDefine)("swc-app-meter", { extends: "meter", window: w })
663
+ (0, import_decorators.elementDefine)("swc-app-meter", { extends: "meter", window: w })
693
664
  ], SwcAppMeter);
694
665
  let SwcAppMod = class SwcAppMod extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLModElement) {
695
666
  };
696
667
  SwcAppMod = __decorate([
697
- (0, import_elementDefine.elementDefine)("swc-app-del", { extends: "del", window: w })
668
+ (0, import_decorators.elementDefine)("swc-app-del", { extends: "del", window: w })
698
669
  ], SwcAppMod);
699
670
  let SwcAppObject = class SwcAppObject extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLObjectElement) {
700
671
  };
701
672
  SwcAppObject = __decorate([
702
- (0, import_elementDefine.elementDefine)("swc-app-object", { extends: "object", window: w })
673
+ (0, import_decorators.elementDefine)("swc-app-object", { extends: "object", window: w })
703
674
  ], SwcAppObject);
704
675
  let SwcAppOList = class SwcAppOList extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLOListElement) {
705
676
  };
706
677
  SwcAppOList = __decorate([
707
- (0, import_elementDefine.elementDefine)("swc-app-ol", { extends: "ol", window: w })
678
+ (0, import_decorators.elementDefine)("swc-app-ol", { extends: "ol", window: w })
708
679
  ], SwcAppOList);
709
680
  let SwcAppOptGroup = class SwcAppOptGroup extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLOptGroupElement) {
710
681
  };
711
682
  SwcAppOptGroup = __decorate([
712
- (0, import_elementDefine.elementDefine)("swc-app-optgroup", { extends: "optgroup", window: w })
683
+ (0, import_decorators.elementDefine)("swc-app-optgroup", { extends: "optgroup", window: w })
713
684
  ], SwcAppOptGroup);
714
685
  let SwcAppOption = class SwcAppOption extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLOptionElement) {
715
686
  };
716
687
  SwcAppOption = __decorate([
717
- (0, import_elementDefine.elementDefine)("swc-app-option", { extends: "option", window: w })
688
+ (0, import_decorators.elementDefine)("swc-app-option", { extends: "option", window: w })
718
689
  ], SwcAppOption);
719
690
  let SwcAppOutput = class SwcAppOutput extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLOutputElement) {
720
691
  };
721
692
  SwcAppOutput = __decorate([
722
- (0, import_elementDefine.elementDefine)("swc-app-output", { extends: "output", window: w })
693
+ (0, import_decorators.elementDefine)("swc-app-output", { extends: "output", window: w })
723
694
  ], SwcAppOutput);
724
695
  let SwcAppParagraph = class SwcAppParagraph extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLParagraphElement) {
725
696
  };
726
697
  SwcAppParagraph = __decorate([
727
- (0, import_elementDefine.elementDefine)("swc-app-p", { extends: "p", window: w })
698
+ (0, import_decorators.elementDefine)("swc-app-p", { extends: "p", window: w })
728
699
  ], SwcAppParagraph);
729
700
  let SwcAppParam = class SwcAppParam extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLParamElement) {
730
701
  };
731
702
  SwcAppParam = __decorate([
732
- (0, import_elementDefine.elementDefine)("swc-app-param", { extends: "param", window: w })
703
+ (0, import_decorators.elementDefine)("swc-app-param", { extends: "param", window: w })
733
704
  ], SwcAppParam);
734
705
  let SwcAppPicture = class SwcAppPicture extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLPictureElement) {
735
706
  };
736
707
  SwcAppPicture = __decorate([
737
- (0, import_elementDefine.elementDefine)("swc-app-picture", { extends: "picture", window: w })
708
+ (0, import_decorators.elementDefine)("swc-app-picture", { extends: "picture", window: w })
738
709
  ], SwcAppPicture);
739
710
  let SwcAppPre = class SwcAppPre extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLPreElement) {
740
711
  };
741
712
  SwcAppPre = __decorate([
742
- (0, import_elementDefine.elementDefine)("swc-app-pre", { extends: "pre", window: w })
713
+ (0, import_decorators.elementDefine)("swc-app-pre", { extends: "pre", window: w })
743
714
  ], SwcAppPre);
744
715
  let SwcAppProgress = class SwcAppProgress extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLProgressElement) {
745
716
  };
746
717
  SwcAppProgress = __decorate([
747
- (0, import_elementDefine.elementDefine)("swc-app-progress", { extends: "progress", window: w })
718
+ (0, import_decorators.elementDefine)("swc-app-progress", { extends: "progress", window: w })
748
719
  ], SwcAppProgress);
749
720
  let SwcAppQuote = class SwcAppQuote extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLQuoteElement) {
750
721
  };
751
722
  SwcAppQuote = __decorate([
752
- (0, import_elementDefine.elementDefine)("swc-app-blockquote", { extends: "blockquote", window: w })
723
+ (0, import_decorators.elementDefine)("swc-app-blockquote", { extends: "blockquote", window: w })
753
724
  ], SwcAppQuote);
754
725
  let SwcAppScript = class SwcAppScript extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLScriptElement) {
755
726
  };
756
727
  SwcAppScript = __decorate([
757
- (0, import_elementDefine.elementDefine)("swc-app-script", { extends: "script", window: w })
728
+ (0, import_decorators.elementDefine)("swc-app-script", { extends: "script", window: w })
758
729
  ], SwcAppScript);
759
730
  let SwcAppSelect = class SwcAppSelect extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLSelectElement) {
760
731
  };
761
732
  SwcAppSelect = __decorate([
762
- (0, import_elementDefine.elementDefine)("swc-app-select", { extends: "select", window: w })
733
+ (0, import_decorators.elementDefine)("swc-app-select", { extends: "select", window: w })
763
734
  ], SwcAppSelect);
764
735
  let SwcAppSlot = class SwcAppSlot extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLSlotElement) {
765
736
  };
766
737
  SwcAppSlot = __decorate([
767
- (0, import_elementDefine.elementDefine)("swc-app-slot", { extends: "slot", window: w })
738
+ (0, import_decorators.elementDefine)("swc-app-slot", { extends: "slot", window: w })
768
739
  ], SwcAppSlot);
769
740
  let SwcAppSource = class SwcAppSource extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLSourceElement) {
770
741
  };
771
742
  SwcAppSource = __decorate([
772
- (0, import_elementDefine.elementDefine)("swc-app-source", { extends: "source", window: w })
743
+ (0, import_decorators.elementDefine)("swc-app-source", { extends: "source", window: w })
773
744
  ], SwcAppSource);
774
745
  let SwcAppSpan = class SwcAppSpan extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLSpanElement) {
775
746
  };
776
747
  SwcAppSpan = __decorate([
777
- (0, import_elementDefine.elementDefine)("swc-app-span", { extends: "span", window: w })
748
+ (0, import_decorators.elementDefine)("swc-app-span", { extends: "span", window: w })
778
749
  ], SwcAppSpan);
779
750
  let SwcAppStyle = class SwcAppStyle extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLStyleElement) {
780
751
  };
781
752
  SwcAppStyle = __decorate([
782
- (0, import_elementDefine.elementDefine)("swc-app-style", { extends: "style", window: w })
753
+ (0, import_decorators.elementDefine)("swc-app-style", { extends: "style", window: w })
783
754
  ], SwcAppStyle);
784
755
  let SwcAppTable = class SwcAppTable extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTableElement) {
785
756
  };
786
757
  SwcAppTable = __decorate([
787
- (0, import_elementDefine.elementDefine)("swc-app-table", { extends: "table", window: w })
758
+ (0, import_decorators.elementDefine)("swc-app-table", { extends: "table", window: w })
788
759
  ], SwcAppTable);
789
760
  let SwcAppTableSection = class SwcAppTableSection extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTableSectionElement) {
790
761
  };
791
762
  SwcAppTableSection = __decorate([
792
- (0, import_elementDefine.elementDefine)("swc-app-tbody", { extends: "tbody", window: w })
763
+ (0, import_decorators.elementDefine)("swc-app-tbody", { extends: "tbody", window: w })
793
764
  ], SwcAppTableSection);
794
765
  let SwcAppTableCell = class SwcAppTableCell extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTableCellElement) {
795
766
  };
796
767
  SwcAppTableCell = __decorate([
797
- (0, import_elementDefine.elementDefine)("swc-app-td", { extends: "td", window: w })
768
+ (0, import_decorators.elementDefine)("swc-app-td", { extends: "td", window: w })
798
769
  ], SwcAppTableCell);
799
770
  let SwcAppTemplate = class SwcAppTemplate extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTemplateElement) {
800
771
  };
801
772
  SwcAppTemplate = __decorate([
802
- (0, import_elementDefine.elementDefine)("swc-app-template", { extends: "template", window: w })
773
+ (0, import_decorators.elementDefine)("swc-app-template", { extends: "template", window: w })
803
774
  ], SwcAppTemplate);
804
775
  let SwcAppTextArea = class SwcAppTextArea extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTextAreaElement) {
805
776
  };
806
777
  SwcAppTextArea = __decorate([
807
- (0, import_elementDefine.elementDefine)("swc-app-textarea", { extends: "textarea", window: w })
778
+ (0, import_decorators.elementDefine)("swc-app-textarea", { extends: "textarea", window: w })
808
779
  ], SwcAppTextArea);
809
780
  let SwcAppTime = class SwcAppTime extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTimeElement) {
810
781
  };
811
782
  SwcAppTime = __decorate([
812
- (0, import_elementDefine.elementDefine)("swc-app-time", { extends: "time", window: w })
783
+ (0, import_decorators.elementDefine)("swc-app-time", { extends: "time", window: w })
813
784
  ], SwcAppTime);
814
785
  let SwcAppTitle = class SwcAppTitle extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTitleElement) {
815
786
  };
816
787
  SwcAppTitle = __decorate([
817
- (0, import_elementDefine.elementDefine)("swc-app-title", { extends: "title", window: w })
788
+ (0, import_decorators.elementDefine)("swc-app-title", { extends: "title", window: w })
818
789
  ], SwcAppTitle);
819
790
  let SwcAppTableRow = class SwcAppTableRow extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTableRowElement) {
820
791
  };
821
792
  SwcAppTableRow = __decorate([
822
- (0, import_elementDefine.elementDefine)("swc-app-tr", { extends: "tr", window: w })
793
+ (0, import_decorators.elementDefine)("swc-app-tr", { extends: "tr", window: w })
823
794
  ], SwcAppTableRow);
824
795
  let SwcAppTrack = class SwcAppTrack extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLTrackElement) {
825
796
  };
826
797
  SwcAppTrack = __decorate([
827
- (0, import_elementDefine.elementDefine)("swc-app-track", { extends: "track", window: w })
798
+ (0, import_decorators.elementDefine)("swc-app-track", { extends: "track", window: w })
828
799
  ], SwcAppTrack);
829
800
  let SwcAppUList = class SwcAppUList extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLUListElement) {
830
801
  };
831
802
  SwcAppUList = __decorate([
832
- (0, import_elementDefine.elementDefine)("swc-app-ul", { extends: "ul", window: w })
803
+ (0, import_decorators.elementDefine)("swc-app-ul", { extends: "ul", window: w })
833
804
  ], SwcAppUList);
834
805
  let SwcAppVideo = class SwcAppVideo extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLVideoElement) {
835
806
  };
836
807
  SwcAppVideo = __decorate([
837
- (0, import_elementDefine.elementDefine)("swc-app-video", { extends: "video", window: w })
808
+ (0, import_decorators.elementDefine)("swc-app-video", { extends: "video", window: w })
838
809
  ], SwcAppVideo);
839
810
  let SwcAppHeading = class SwcAppHeading extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLHeadingElement) {
840
811
  };
841
812
  SwcAppHeading = __decorate([
842
- (0, import_elementDefine.elementDefine)("swc-app-h1", { extends: "h1", window: w })
813
+ (0, import_decorators.elementDefine)("swc-app-h1", { extends: "h1", window: w })
843
814
  ], SwcAppHeading);
844
815
  let SwcAppBody = class SwcAppBody extends (0, import_SwcAppMixin.SwcAppMixin)(HTMLBodyElement) {
845
816
  };
846
817
  SwcAppBody = __decorate([
847
- (0, import_elementDefine.elementDefine)("swc-app-body", { extends: "body", window: w })
818
+ (0, import_decorators.elementDefine)("swc-app-body", { extends: "body", window: w })
848
819
  ], SwcAppBody);
849
820
  return {
850
821
  // Sub Templates