@dooboostore/simple-web-component 1.0.39 → 1.0.41

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 (98) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +235 -47
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +194 -111
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyNode.js +58 -43
  7. package/dist/cjs/decorators/applyNode.js.map +2 -2
  8. package/dist/cjs/decorators/applyProperty.js +213 -0
  9. package/dist/cjs/decorators/applyProperty.js.map +7 -0
  10. package/dist/cjs/decorators/applySlot.js +32 -26
  11. package/dist/cjs/decorators/applySlot.js.map +2 -2
  12. package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
  13. package/dist/cjs/decorators/elementDefine.js +17 -30
  14. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  15. package/dist/cjs/decorators/index.js +2 -2
  16. package/dist/cjs/decorators/index.js.map +2 -2
  17. package/dist/cjs/decorators/lifecycles.js +4 -4
  18. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  19. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  20. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  21. package/dist/cjs/elements/SwcApp.js.map +2 -2
  22. package/dist/cjs/elements/SwcAppMixin.js +11 -4
  23. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  24. package/dist/cjs/types/index.js.map +1 -1
  25. package/dist/esm/SwcAppEngine.js.map +2 -2
  26. package/dist/esm/decorators/applyAttribute.js +196 -113
  27. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  28. package/dist/esm/decorators/applyNode.js +58 -43
  29. package/dist/esm/decorators/applyNode.js.map +2 -2
  30. package/dist/esm/decorators/applyProperty.js +194 -0
  31. package/dist/esm/decorators/applyProperty.js.map +7 -0
  32. package/dist/esm/decorators/applySlot.js +32 -26
  33. package/dist/esm/decorators/applySlot.js.map +2 -2
  34. package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
  35. package/dist/esm/decorators/elementDefine.js +17 -30
  36. package/dist/esm/decorators/elementDefine.js.map +2 -2
  37. package/dist/esm/decorators/index.js +2 -2
  38. package/dist/esm/decorators/index.js.map +1 -1
  39. package/dist/esm/decorators/lifecycles.js +4 -4
  40. package/dist/esm/decorators/lifecycles.js.map +2 -2
  41. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  42. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  43. package/dist/esm/elements/SwcApp.js.map +2 -2
  44. package/dist/esm/elements/SwcAppMixin.js +11 -4
  45. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  46. package/dist/esm/types/index.js.map +1 -1
  47. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +441 -401
  48. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  49. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  50. package/dist/types/decorators/applyAttribute.d.ts +56 -15
  51. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  52. package/dist/types/decorators/applyNode.d.ts +28 -24
  53. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  54. package/dist/types/decorators/applyProperty.d.ts +61 -0
  55. package/dist/types/decorators/applyProperty.d.ts.map +1 -0
  56. package/dist/types/decorators/applySlot.d.ts +10 -10
  57. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  58. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  59. package/dist/types/decorators/index.d.ts +2 -2
  60. package/dist/types/decorators/index.d.ts.map +1 -1
  61. package/dist/types/decorators/lifecycles.d.ts +4 -4
  62. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  63. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
  64. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  65. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  66. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  67. package/dist/types/types/index.d.ts +1 -6
  68. package/dist/types/types/index.d.ts.map +1 -1
  69. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +441 -401
  70. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  71. package/package.json +3 -3
  72. package/src/SwcAppEngine.ts +1 -0
  73. package/src/decorators/applyAttribute.ts +311 -126
  74. package/src/decorators/applyNode.ts +68 -57
  75. package/src/decorators/applyProperty.ts +302 -0
  76. package/src/decorators/applySlot.ts +25 -18
  77. package/src/decorators/changedAttributeThis.ts +1 -1
  78. package/src/decorators/elementDefine.ts +41 -30
  79. package/src/decorators/index.ts +2 -3
  80. package/src/decorators/lifecycles.ts +6 -6
  81. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +14 -4
  82. package/src/elements/SwcApp.ts +0 -1
  83. package/src/elements/SwcAppMixin.ts +16 -4
  84. package/src/types/index.ts +7 -7
  85. package/dist/cjs/decorators/attribute.js +0 -187
  86. package/dist/cjs/decorators/attribute.js.map +0 -7
  87. package/dist/cjs/decorators/setProperty.js +0 -109
  88. package/dist/cjs/decorators/setProperty.js.map +0 -7
  89. package/dist/esm/decorators/attribute.js +0 -168
  90. package/dist/esm/decorators/attribute.js.map +0 -7
  91. package/dist/esm/decorators/setProperty.js +0 -90
  92. package/dist/esm/decorators/setProperty.js.map +0 -7
  93. package/dist/types/decorators/attribute.d.ts +0 -31
  94. package/dist/types/decorators/attribute.d.ts.map +0 -1
  95. package/dist/types/decorators/setProperty.d.ts +0 -17
  96. package/dist/types/decorators/setProperty.d.ts.map +0 -1
  97. package/src/decorators/attribute.ts +0 -223
  98. package/src/decorators/setProperty.ts +0 -112
@@ -4212,8 +4212,8 @@ var ConvertUtils;
4212
4212
  }
4213
4213
  }
4214
4214
  if (ValidUtils.isObject(obj)) {
4215
- for (const property in obj) {
4216
- obj[property] = ConvertUtils22.toObject(obj[property]);
4215
+ for (const property2 in obj) {
4216
+ obj[property2] = ConvertUtils22.toObject(obj[property2]);
4217
4217
  }
4218
4218
  }
4219
4219
  return obj;
@@ -4247,10 +4247,10 @@ var ConvertUtils;
4247
4247
  };
4248
4248
  ConvertUtils22.concatenateToString = (object_o, unionString_s = "=", spilString_s = " ", pairString_s = "") => {
4249
4249
  const results = [];
4250
- for (const property in object_o) {
4251
- const value = object_o[property];
4250
+ for (const property2 in object_o) {
4251
+ const value = object_o[property2];
4252
4252
  if (value) {
4253
- results.push(property.toString() + unionString_s + pairString_s + value + pairString_s);
4253
+ results.push(property2.toString() + unionString_s + pairString_s + value + pairString_s);
4254
4254
  }
4255
4255
  }
4256
4256
  return results.join(spilString_s);
@@ -5993,9 +5993,9 @@ var ReflectUtils;
5993
5993
  // ../core/dist/esm/function/FunctionUtils.js
5994
5994
  var FunctionUtils;
5995
5995
  ((FunctionUtils2) => {
5996
- FunctionUtils2.getParameterNames = (func, property) => {
5997
- if (typeof func === "object" && property) {
5998
- func = func[property];
5996
+ FunctionUtils2.getParameterNames = (func, property2) => {
5997
+ if (typeof func === "object" && property2) {
5998
+ func = func[property2];
5999
5999
  }
6000
6000
  return new RegExp("(?:" + func.name + "\\s*|^)\\s*\\((.*?)\\)").exec(func.toString().replace(/\n/g, ""))?.[1].replace(/\/\*.*?\*\//g, "").replace(/ /g, "").split(",") ?? [];
6001
6001
  };
@@ -6414,7 +6414,7 @@ var decorator = (options, target, propertyKey) => {
6414
6414
  }
6415
6415
  list.push({ propertyKey, options });
6416
6416
  };
6417
- function onConnectedShadowDom(optionOrTarget, propertyKey, arg3) {
6417
+ function onConnectedShadow(optionOrTarget, propertyKey, arg3) {
6418
6418
  if (propertyKey) {
6419
6419
  return decorator({ useShadow: true }, optionOrTarget, propertyKey);
6420
6420
  }
@@ -6422,7 +6422,7 @@ function onConnectedShadowDom(optionOrTarget, propertyKey, arg3) {
6422
6422
  decorator({ ...optionOrTarget ?? {}, useShadow: true }, target, propertyKey2);
6423
6423
  };
6424
6424
  }
6425
- function onConnectedLightDom(optionOrTarget, propertyKey, arg3) {
6425
+ function onConnectedLight(optionOrTarget, propertyKey, arg3) {
6426
6426
  if (propertyKey) {
6427
6427
  return decorator({ useShadow: false }, optionOrTarget, propertyKey);
6428
6428
  }
@@ -8904,132 +8904,6 @@ var convertAttributeValue = (val, type) => {
8904
8904
  return convertValue(val, type);
8905
8905
  };
8906
8906
 
8907
- // src/decorators/applyAttribute.ts
8908
- var ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
8909
- function createAttributeDecorator(action) {
8910
- return (selector, nameOrOptions, options = {}) => {
8911
- return (target, propertyKey, descriptor) => {
8912
- const constructor = target.constructor;
8913
- let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
8914
- if (!metaList) {
8915
- metaList = /* @__PURE__ */ new Map();
8916
- ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
8917
- }
8918
- let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
8919
- let finalOptions = options;
8920
- if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
8921
- finalOptions = nameOrOptions;
8922
- }
8923
- metaList.set(propertyKey, {
8924
- propertyKey,
8925
- selector,
8926
- action,
8927
- options: { ...finalOptions, name: attributeName }
8928
- });
8929
- const original = descriptor.value;
8930
- descriptor.value = function(...args) {
8931
- ensureInit(this);
8932
- const res = original.apply(this, args);
8933
- const handleResult = (resolvedValue) => {
8934
- if (resolvedValue !== void 0) {
8935
- const win = this.ownerDocument?.defaultView || window;
8936
- const host = this;
8937
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
8938
- const r = finalOptions.root || "auto";
8939
- const targetEls = [];
8940
- const applyRoot = (t) => {
8941
- if (!t || !(t instanceof win.HTMLElement)) return;
8942
- targetEls.push(t);
8943
- };
8944
- if (selector === "$this" || !selector) applyRoot(host);
8945
- else if (selector === "$host") applyRoot(hostSet.$host);
8946
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
8947
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
8948
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
8949
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
8950
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
8951
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
8952
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
8953
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
8954
- else {
8955
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
8956
- if (targetRoot) {
8957
- const found = targetRoot.querySelectorAll(selector);
8958
- if (found) targetEls.push(...Array.from(found));
8959
- }
8960
- }
8961
- targetEls.forEach((targetEl) => {
8962
- if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
8963
- return;
8964
- }
8965
- const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
8966
- if (action === "set" || action === "update") {
8967
- if (attributeName) {
8968
- if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
8969
- targetEl.removeAttribute(attributeName);
8970
- } else {
8971
- targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
8972
- }
8973
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8974
- Object.entries(resolvedRes).forEach(([attr, val]) => {
8975
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
8976
- if (finalVal === null || finalVal === void 0 || finalVal === false) {
8977
- targetEl.removeAttribute(attr);
8978
- } else {
8979
- targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
8980
- }
8981
- });
8982
- }
8983
- } else if (action === "remove") {
8984
- if (attributeName) {
8985
- targetEl.removeAttribute(attributeName);
8986
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
8987
- Object.entries(resolvedRes).forEach(([attr, val]) => {
8988
- const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
8989
- if (shouldRemove) targetEl.removeAttribute(attr);
8990
- });
8991
- } else {
8992
- const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
8993
- attrs.forEach((a) => targetEl.removeAttribute(String(a)));
8994
- }
8995
- }
8996
- });
8997
- }
8998
- return resolvedValue;
8999
- };
9000
- if (res instanceof Promise) {
9001
- return res.then(handleResult);
9002
- } else {
9003
- return handleResult(res);
9004
- }
9005
- };
9006
- return descriptor;
9007
- };
9008
- };
9009
- }
9010
- function applyAttribute(selector, action = "update", options = {}) {
9011
- return createAttributeDecorator(action)(selector, options);
9012
- }
9013
- var setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
9014
- var updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
9015
- var removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
9016
- function applyAttributeThis(action = "update", options = {}) {
9017
- return createAttributeDecorator(action)("$this", options);
9018
- }
9019
- var setAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("set")("$this", nameOrOptions, options);
9020
- var updateAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("update")("$this", nameOrOptions, options);
9021
- var removeAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("remove")("$this", nameOrOptions, options);
9022
- var findAllAttributeApplyMetadata = (target) => {
9023
- const result = /* @__PURE__ */ new Map();
9024
- const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
9025
- maps.forEach((map) => {
9026
- if (map instanceof Map) {
9027
- map.forEach((v, k) => result.set(k, v));
9028
- }
9029
- });
9030
- return result;
9031
- };
9032
-
9033
8907
  // src/decorators/query.ts
9034
8908
  var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
9035
8909
  function query(selectorOrTarget, options = {}) {
@@ -9499,6 +9373,185 @@ var findAllStateMetadata = (target) => {
9499
9373
  return ReflectUtils.getMetadata(STATE_METADATA_KEY, constructor) ?? [];
9500
9374
  };
9501
9375
 
9376
+ // src/decorators/applyProperty.ts
9377
+ var PROPERTY_METADATA_KEY = Symbol.for("simple-web-component:property");
9378
+ var resolvePropertyTargets = (inst, selector, options) => {
9379
+ const conf = getElementConfig(inst);
9380
+ const currentWin = conf.window;
9381
+ const r = options.root || "auto";
9382
+ const results = [];
9383
+ const applyRoot = (target) => {
9384
+ if (!target) return;
9385
+ if (r === "auto") {
9386
+ results.push(target);
9387
+ } else {
9388
+ if (r === "light" || r === "all") results.push(target);
9389
+ if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
9390
+ }
9391
+ };
9392
+ if (selector === "$this" || !selector) {
9393
+ applyRoot(inst);
9394
+ } else if (selector === "$window") {
9395
+ results.push(currentWin);
9396
+ } else if (selector === "$document") {
9397
+ results.push(currentWin.document);
9398
+ } else {
9399
+ const hostSet = SwcUtils.getHostSet(inst);
9400
+ if (selector === "$host") applyRoot(hostSet.$host);
9401
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
9402
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
9403
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
9404
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
9405
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
9406
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
9407
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
9408
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
9409
+ else {
9410
+ if (r === "shadow") {
9411
+ const found = inst.shadowRoot?.querySelectorAll(selector);
9412
+ if (found) results.push(...found);
9413
+ } else if (r === "light") {
9414
+ const found = inst.querySelectorAll(selector);
9415
+ if (found) results.push(...found);
9416
+ } else if (r === "all") {
9417
+ const sMatch = inst.shadowRoot?.querySelectorAll(selector);
9418
+ const lMatch = inst.querySelectorAll(selector);
9419
+ if (sMatch) results.push(...sMatch);
9420
+ if (lMatch) results.push(...lMatch);
9421
+ } else {
9422
+ const found = (inst.shadowRoot || inst).querySelectorAll(selector);
9423
+ if (found) results.push(...found);
9424
+ }
9425
+ }
9426
+ }
9427
+ return results;
9428
+ };
9429
+ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
9430
+ return (target, propertyKey, descriptor) => {
9431
+ const constructor = target.constructor;
9432
+ const metaType = descriptor && typeof descriptor.value === "function" ? "method" : "property";
9433
+ let finalOptions = {};
9434
+ let targetPropertyKey;
9435
+ if (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol") {
9436
+ targetPropertyKey = targetPropertyKeyOrOptions;
9437
+ finalOptions = options || {};
9438
+ } else if (targetPropertyKeyOrOptions) {
9439
+ finalOptions = targetPropertyKeyOrOptions;
9440
+ targetPropertyKey = finalOptions.name || propertyKey;
9441
+ } else {
9442
+ targetPropertyKey = propertyKey;
9443
+ }
9444
+ let metaList = ReflectUtils.getOwnMetadata(PROPERTY_METADATA_KEY, constructor);
9445
+ if (!metaList) {
9446
+ metaList = [];
9447
+ ReflectUtils.defineMetadata(PROPERTY_METADATA_KEY, metaList, constructor);
9448
+ }
9449
+ metaList.push({
9450
+ propertyKey,
9451
+ selector,
9452
+ targetPropertyKey,
9453
+ options: finalOptions,
9454
+ type: metaType
9455
+ });
9456
+ const applyValueToTargets = (inst, resolvedValue) => {
9457
+ if (resolvedValue === void 0) return resolvedValue;
9458
+ const targetEls = resolvePropertyTargets(inst, selector, finalOptions);
9459
+ const conf = getElementConfig(inst);
9460
+ const currentWin = conf.window;
9461
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);
9462
+ targetEls.forEach((targetEl) => {
9463
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {
9464
+ return;
9465
+ }
9466
+ const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
9467
+ targetEl[targetPropertyKey] = resolvedRes;
9468
+ });
9469
+ return resolvedValue;
9470
+ };
9471
+ if (descriptor && typeof descriptor.value === "function") {
9472
+ const original = descriptor.value;
9473
+ descriptor.value = function(...args) {
9474
+ ensureInit(this);
9475
+ const res = original.apply(this, args);
9476
+ if (res instanceof Promise) {
9477
+ return res.then((v) => {
9478
+ applyValueToTargets(this, v);
9479
+ return v;
9480
+ });
9481
+ } else {
9482
+ applyValueToTargets(this, res);
9483
+ return res;
9484
+ }
9485
+ };
9486
+ return;
9487
+ }
9488
+ Object.defineProperty(target, propertyKey, {
9489
+ configurable: true,
9490
+ enumerable: true,
9491
+ get() {
9492
+ ensureInit(this);
9493
+ const targetEls = resolvePropertyTargets(this, selector, finalOptions);
9494
+ const conf = getElementConfig(this);
9495
+ const currentWin = conf.window;
9496
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
9497
+ const filtered = targetEls.filter((el) => {
9498
+ if (finalOptions.filter && !finalOptions.filter(el, el[targetPropertyKey], { currentThis: this, helper: hostSet })) {
9499
+ return false;
9500
+ }
9501
+ return true;
9502
+ });
9503
+ const values = filtered.map((el) => el[targetPropertyKey]);
9504
+ return values.length === 1 ? values[0] : values;
9505
+ },
9506
+ set(value) {
9507
+ ensureInit(this);
9508
+ applyValueToTargets(this, value);
9509
+ }
9510
+ });
9511
+ };
9512
+ }
9513
+ function property(selector, targetPropertyKeyOrOptions, options) {
9514
+ return applyProperty(selector, targetPropertyKeyOrOptions, options);
9515
+ }
9516
+ function propertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
9517
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
9518
+ return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
9519
+ }
9520
+ if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
9521
+ return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
9522
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
9523
+ return applyProperty("$this", void 0, targetOrOptions);
9524
+ } else {
9525
+ return applyProperty("$this", void 0, {});
9526
+ }
9527
+ }
9528
+ function setProperty(selector, targetPropertyKeyOrOptions, options) {
9529
+ return applyProperty(selector, targetPropertyKeyOrOptions, options);
9530
+ }
9531
+ function setPropertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
9532
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
9533
+ return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
9534
+ }
9535
+ if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
9536
+ return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
9537
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
9538
+ return applyProperty("$this", void 0, targetOrOptions);
9539
+ } else {
9540
+ return applyProperty("$this", void 0, {});
9541
+ }
9542
+ }
9543
+ var findAllPropertyMetadata = (target) => {
9544
+ const actualTarget = target instanceof Function ? target : target.constructor;
9545
+ return ReflectUtils.findAllMetadata(PROPERTY_METADATA_KEY, actualTarget).flat();
9546
+ };
9547
+ var findAllPropertyApplyMetadata = (target) => {
9548
+ const result = /* @__PURE__ */ new Map();
9549
+ findAllPropertyMetadata(target).forEach((meta) => {
9550
+ result.set(meta.propertyKey, meta);
9551
+ });
9552
+ return result;
9553
+ };
9554
+
9502
9555
  // src/decorators/elementDefine.ts
9503
9556
  var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
9504
9557
  var getElementConfig = (target) => {
@@ -9512,13 +9565,12 @@ var ensureInit = (inst) => {
9512
9565
  inst._boundListeners = [];
9513
9566
  inst.__swc_initialized = true;
9514
9567
  const target = inst instanceof Function ? inst : inst.constructor;
9515
- const attributeList = findAllAttributeMetadata(target);
9516
- attributeList.forEach((meta) => {
9517
- const initUserData = inst[meta.propertyKey];
9518
- delete inst[meta.propertyKey];
9519
- if (initUserData !== void 0)
9520
- inst[meta.propertyKey] = initUserData;
9521
- });
9568
+ const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
9569
+ if (attributeAllList) {
9570
+ attributeAllList.forEach((meta) => {
9571
+ delete inst[meta.propertyKey];
9572
+ });
9573
+ }
9522
9574
  const queryList = getQueryMetadata(target);
9523
9575
  if (queryList) {
9524
9576
  queryList.forEach((meta) => {
@@ -9531,6 +9583,12 @@ var ensureInit = (inst) => {
9531
9583
  delete inst[meta.propertyKey];
9532
9584
  });
9533
9585
  }
9586
+ const propertyAllList = findAllPropertyMetadata(target).filter((it) => it.type === "property");
9587
+ if (propertyAllList) {
9588
+ propertyAllList.forEach((meta) => {
9589
+ delete inst[meta.propertyKey];
9590
+ });
9591
+ }
9534
9592
  const stateAllList = findAllStateMetadata(target);
9535
9593
  if (stateAllList) {
9536
9594
  stateAllList.forEach((meta) => {
@@ -9584,24 +9642,6 @@ var getHandlers = (inst) => {
9584
9642
  var setupPrototype = (proto, win) => {
9585
9643
  if (proto.__swc_proto_setup) return;
9586
9644
  proto.__swc_proto_setup = true;
9587
- proto.createSlotString = function(id) {
9588
- return NodeSlot.slot(`${this._swcId}-${id}`);
9589
- };
9590
- proto.createEaHtml = function(id, script) {
9591
- return ElementApply.html(id, script);
9592
- };
9593
- proto.createEaText = function(id, script) {
9594
- return ElementApply.text(id, script);
9595
- };
9596
- proto.createEaAttribute = function(id, name, script) {
9597
- return ElementApply.attribute(id, name, script);
9598
- };
9599
- proto.createEaEvent = function(id, name, script) {
9600
- return ElementApply.event(id, name, script);
9601
- };
9602
- proto.createEaProperty = function(id, name, script) {
9603
- return ElementApply.property(id, name, script);
9604
- };
9605
9645
  proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
9606
9646
  ensureInit(this);
9607
9647
  const script = this.getAttribute(attrName);
@@ -9731,8 +9771,8 @@ var elementDefine = (name, config = {}) => (constructor) => {
9731
9771
  const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
9732
9772
  const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
9733
9773
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
9734
- const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
9735
- const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
9774
+ const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.targetAttributeName).filter(Boolean);
9775
+ const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.propertyKey || String(it.propertyKey));
9736
9776
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
9737
9777
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
9738
9778
  const proto = constructor.prototype;
@@ -10059,8 +10099,8 @@ var elementDefine = (name, config = {}) => (constructor) => {
10059
10099
  return constructor;
10060
10100
  };
10061
10101
 
10062
- // src/decorators/attribute.ts
10063
- var ATTRIBUTE_FIELD_METADATA_KEY = Symbol.for("simple-web-component:attribute-field");
10102
+ // src/decorators/applyAttribute.ts
10103
+ var ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
10064
10104
  var convertValue2 = (val, type) => {
10065
10105
  if (val === null || val === void 0) return val;
10066
10106
  if (type === Number) return Number(val);
@@ -10070,7 +10110,7 @@ var convertValue2 = (val, type) => {
10070
10110
  var getAttributeValue = (inst, attrName, options) => {
10071
10111
  const conf = getElementConfig(inst);
10072
10112
  const currentWin = inst._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
10073
- const targets = options?.selector ? resolveTargetEls(inst, options.selector, options, currentWin) : [inst];
10113
+ const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];
10074
10114
  const primaryTarget = targets[0];
10075
10115
  if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
10076
10116
  let domVal = primaryTarget.getAttribute(attrName);
@@ -10084,8 +10124,8 @@ var getAttributeValue = (inst, attrName, options) => {
10084
10124
  args: SwcUtils.getHelperAndHostSet(currentWin, inst)
10085
10125
  });
10086
10126
  return convertValue2(result, options?.type);
10087
- } catch (e) {
10088
- console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, e);
10127
+ } catch (err) {
10128
+ console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);
10089
10129
  return convertValue2(domVal, options?.type);
10090
10130
  }
10091
10131
  }
@@ -10093,7 +10133,9 @@ var getAttributeValue = (inst, attrName, options) => {
10093
10133
  }
10094
10134
  return null;
10095
10135
  };
10096
- var resolveTargetEls = (inst, selector, options, currentWin) => {
10136
+ var resolveAttributeTargets = (inst, selector, options) => {
10137
+ const conf = getElementConfig(inst);
10138
+ const currentWin = conf.window;
10097
10139
  const r = options.root || "auto";
10098
10140
  const results = [];
10099
10141
  const applyRoot = (target) => {
@@ -10107,10 +10149,6 @@ var resolveTargetEls = (inst, selector, options, currentWin) => {
10107
10149
  };
10108
10150
  if (selector === "$this" || !selector) {
10109
10151
  applyRoot(inst);
10110
- } else if (selector === "$window") {
10111
- results.push(currentWin);
10112
- } else if (selector === "$document") {
10113
- results.push(currentWin.document);
10114
10152
  } else {
10115
10153
  const hostSet = SwcUtils.getHostSet(inst);
10116
10154
  if (selector === "$host") applyRoot(hostSet.$host);
@@ -10120,6 +10158,8 @@ var resolveTargetEls = (inst, selector, options, currentWin) => {
10120
10158
  else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
10121
10159
  else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
10122
10160
  else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
10161
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
10162
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
10123
10163
  else {
10124
10164
  if (r === "shadow") {
10125
10165
  const found = inst.shadowRoot?.querySelectorAll(selector);
@@ -10140,79 +10180,128 @@ var resolveTargetEls = (inst, selector, options, currentWin) => {
10140
10180
  }
10141
10181
  return results;
10142
10182
  };
10143
- function attribute(selector, options = {}) {
10144
- return (target, propertyKey) => {
10183
+ function applyAttribute(selector, targetAttributeNameOrOptions, options) {
10184
+ return (target, propertyKey, descriptor) => {
10145
10185
  const constructor = target.constructor;
10146
- const privateKey = Symbol(String(propertyKey));
10147
10186
  const designType = Reflect.getMetadata("design:type", target, propertyKey);
10148
- let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_FIELD_METADATA_KEY, constructor);
10187
+ const metaType = descriptor && typeof descriptor.value === "function" ? "method" : "property";
10188
+ let finalOptions = {};
10189
+ let targetAttributeName;
10190
+ if (typeof targetAttributeNameOrOptions === "string") {
10191
+ targetAttributeName = targetAttributeNameOrOptions;
10192
+ finalOptions = options || {};
10193
+ } else if (targetAttributeNameOrOptions) {
10194
+ finalOptions = targetAttributeNameOrOptions;
10195
+ targetAttributeName = finalOptions.name || String(propertyKey);
10196
+ } else {
10197
+ targetAttributeName = String(propertyKey);
10198
+ }
10199
+ let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor);
10149
10200
  if (!metaList) {
10150
10201
  metaList = [];
10151
- ReflectUtils.defineMetadata(ATTRIBUTE_FIELD_METADATA_KEY, metaList, constructor);
10152
- }
10153
- metaList.push({ propertyKey, selector, options, privateKey });
10154
- const applySetAttribute = (inst, targets, attrName, nv) => {
10155
- targets.forEach((it) => {
10156
- if (it && typeof it.setAttribute === "function") {
10157
- if (nv === null) {
10158
- it.removeAttribute(attrName);
10159
- } else {
10160
- it.setAttribute(attrName, String(nv));
10161
- }
10162
- } else {
10163
- inst[privateKey] = nv;
10202
+ ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);
10203
+ }
10204
+ metaList.push({
10205
+ propertyKey,
10206
+ selector,
10207
+ targetAttributeName,
10208
+ options: finalOptions,
10209
+ type: metaType
10210
+ });
10211
+ const applyValueToTargets = (inst, resolvedValue) => {
10212
+ const conf = getElementConfig(inst);
10213
+ const currentWin = conf.window;
10214
+ const targetEls = resolveAttributeTargets(inst, selector, finalOptions);
10215
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);
10216
+ targetEls.forEach((targetEl) => {
10217
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {
10218
+ return;
10219
+ }
10220
+ if (resolvedValue === null) {
10221
+ targetEl.removeAttribute(targetAttributeName);
10222
+ } else if (resolvedValue !== void 0) {
10223
+ targetEl.setAttribute(targetAttributeName, resolvedValue === true ? "" : String(resolvedValue));
10164
10224
  }
10165
10225
  });
10226
+ return resolvedValue;
10166
10227
  };
10167
- try {
10168
- Object.defineProperty(target, propertyKey, {
10169
- get() {
10170
- const attrName = options.name || String(propertyKey);
10171
- const mergedOptions = {
10172
- ...options,
10173
- selector,
10174
- type: options.type || designType
10175
- };
10176
- const result = getAttributeValue(this, attrName, mergedOptions);
10177
- return result !== null ? result : this[privateKey];
10178
- },
10179
- set(nv) {
10180
- const attrName = options.name || String(propertyKey);
10181
- const conf = getElementConfig(this);
10182
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
10183
- const targets = resolveTargetEls(this, selector, options, currentWin);
10184
- applySetAttribute(this, targets, attrName, nv);
10185
- },
10186
- enumerable: true,
10187
- configurable: true
10188
- });
10189
- } catch (err) {
10190
- console.error("[SWC] defineProperty error:", err);
10228
+ if (descriptor && typeof descriptor.value === "function") {
10229
+ const original = descriptor.value;
10230
+ descriptor.value = function(...args) {
10231
+ ensureInit(this);
10232
+ const res = original.apply(this, args);
10233
+ if (res instanceof Promise) {
10234
+ return res.then((v) => {
10235
+ applyValueToTargets(this, v);
10236
+ return v;
10237
+ });
10238
+ } else {
10239
+ applyValueToTargets(this, res);
10240
+ return res;
10241
+ }
10242
+ };
10243
+ return;
10191
10244
  }
10245
+ Object.defineProperty(target, propertyKey, {
10246
+ configurable: true,
10247
+ enumerable: true,
10248
+ get() {
10249
+ ensureInit(this);
10250
+ const mergedOptions = { ...finalOptions, selector, type: finalOptions.type || designType };
10251
+ return getAttributeValue(this, targetAttributeName, mergedOptions);
10252
+ },
10253
+ set(value) {
10254
+ ensureInit(this);
10255
+ if (value instanceof Promise) {
10256
+ value.then((v) => applyValueToTargets(this, v)).catch(() => {
10257
+ });
10258
+ } else {
10259
+ applyValueToTargets(this, value);
10260
+ }
10261
+ }
10262
+ });
10192
10263
  };
10193
10264
  }
10194
- function attributeThis(targetOrAttrOrOptions, propertyKeyOrOptions) {
10195
- if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
10196
- return attribute("$this", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
10197
- }
10198
- if (typeof targetOrAttrOrOptions === "string") {
10199
- const attrName = targetOrAttrOrOptions;
10200
- const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
10201
- return attribute("$this", { ...options, name: attrName });
10202
- } else if (typeof targetOrAttrOrOptions === "object") {
10203
- const options = targetOrAttrOrOptions;
10204
- return (target, propertyKey) => {
10205
- return attribute("$this", { ...options, name: String(propertyKey) })(target, propertyKey);
10206
- };
10265
+ function attribute(selector, targetAttributeNameOrOptions, options) {
10266
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
10267
+ }
10268
+ function attributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
10269
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") {
10270
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
10271
+ }
10272
+ if (typeof targetOrOptions === "string") {
10273
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
10274
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
10275
+ return applyAttribute("$this", void 0, targetOrOptions);
10207
10276
  } else {
10208
- return (target, propertyKey) => {
10209
- return attribute("$this", { name: String(propertyKey) })(target, propertyKey);
10210
- };
10277
+ return applyAttribute("$this", void 0, {});
10278
+ }
10279
+ }
10280
+ function setAttribute(selector, targetAttributeNameOrOptions, options) {
10281
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
10282
+ }
10283
+ function setAttributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
10284
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
10285
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
10286
+ }
10287
+ if (typeof targetOrOptions === "string") {
10288
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
10289
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
10290
+ return applyAttribute("$this", void 0, targetOrOptions);
10291
+ } else {
10292
+ return applyAttribute("$this", void 0, {});
10211
10293
  }
10212
10294
  }
10213
10295
  var findAllAttributeMetadata = (target) => {
10214
10296
  const actualTarget = target instanceof Function ? target : target.constructor;
10215
- return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, actualTarget).flat();
10297
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, actualTarget).flat();
10298
+ };
10299
+ var findAllAttributeApplyMetadata = (target) => {
10300
+ const result = /* @__PURE__ */ new Map();
10301
+ findAllAttributeMetadata(target).forEach((meta) => {
10302
+ result.set(meta.propertyKey, meta);
10303
+ });
10304
+ return result;
10216
10305
  };
10217
10306
 
10218
10307
  // src/decorators/applyNode.ts
@@ -10289,7 +10378,6 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
10289
10378
  const targetRoot = applyRoot(this);
10290
10379
  return targetRoot ? targetRoot.querySelector(selector) : null;
10291
10380
  };
10292
- console.log("fffffffffff");
10293
10381
  const targetEl = getTarget();
10294
10382
  const res = original.apply(this, args);
10295
10383
  const runApply = (target, val) => {
@@ -10317,91 +10405,103 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
10317
10405
  };
10318
10406
  };
10319
10407
  }
10320
- var findAllApplyNodeMetadata = (target) => {
10321
- const result = /* @__PURE__ */ new Map();
10322
- const maps = ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
10323
- maps.forEach((map) => {
10324
- if (map instanceof Map) {
10325
- map.forEach((v, k) => result.set(k, v));
10326
- }
10327
- });
10328
- return result;
10329
- };
10330
10408
  function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
10331
10409
  const option = { position: "replaceChildren" };
10332
10410
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10333
10411
  const opt = targetOrOptions || {};
10334
10412
  return applyNode("$this", { ...option, ...opt });
10335
10413
  }
10336
- function applyNodeThisReplaceChildren(targetOrOptions, propertyKey, descriptor) {
10414
+ function replaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
10337
10415
  const option = { position: "replaceChildren" };
10338
10416
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10339
10417
  const opt = targetOrOptions || {};
10340
10418
  return applyNode("$this", { ...opt, ...option });
10341
10419
  }
10342
- function applyNodeThisReplaceChildrenLightDom(targetOrOptions, propertyKey, descriptor) {
10343
- const options = { position: "replaceChildren", root: "light" };
10344
- if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
10345
- const opt = targetOrOptions || {};
10346
- return applyNode("$this", { ...opt, ...options });
10347
- }
10348
- function applyNodeThisBeforeEnd(targetOrOptions, propertyKey, descriptor) {
10420
+ function beforeEndNodeThis(targetOrOptions, propertyKey, descriptor) {
10349
10421
  const options = { position: "beforeEnd" };
10350
10422
  if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
10351
10423
  const opt = targetOrOptions || {};
10352
10424
  return applyNode("$this", { ...opt, ...options });
10353
10425
  }
10354
- function applyNodeThisBeforeEndLightDom(targetOrOptions, propertyKey, descriptor) {
10426
+ function beforeEndLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10355
10427
  const option = { position: "beforeEnd", root: "light" };
10356
10428
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10357
10429
  const opt = targetOrOptions || {};
10358
10430
  return applyNode("$this", { ...opt, ...option });
10359
10431
  }
10360
- function applyNodeThisBeforeEndShadow(targetOrOptions, propertyKey, descriptor) {
10432
+ function beforeEndShadowNodeThis(targetOrOptions, propertyKey, descriptor) {
10361
10433
  const option = { position: "beforeEnd", root: "shadow" };
10362
10434
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10363
10435
  const opt = targetOrOptions || {};
10364
10436
  return applyNode("$this", { ...opt, ...option });
10365
10437
  }
10366
- function applyNodeThisAfterBegin(targetOrOptions, propertyKey, descriptor) {
10438
+ function afterBeginNodeThis(targetOrOptions, propertyKey, descriptor) {
10367
10439
  const option = { position: "afterBegin" };
10368
10440
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10369
10441
  const opt = targetOrOptions || {};
10370
10442
  return applyNode("$this", { ...opt, ...option });
10371
10443
  }
10372
- function applyNodeThisAfterBeginLightDom(targetOrOptions, propertyKey, descriptor) {
10444
+ function afterBeginLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10373
10445
  const option = { position: "afterBegin", root: "light" };
10374
10446
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10375
10447
  const opt = targetOrOptions || {};
10376
10448
  return applyNode("$this", { ...opt, ...option });
10377
10449
  }
10378
- function applyNodeThisInnerHtml(targetOrOptions, propertyKey, descriptor) {
10450
+ function innerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
10379
10451
  const option = { position: "innerHtml" };
10380
10452
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10381
10453
  const opt = targetOrOptions || {};
10382
10454
  return applyNode("$this", { ...opt, ...option });
10383
10455
  }
10384
- function applyThisInnerHtmlNodeLightDom(targetOrOptions, propertyKey, descriptor) {
10456
+ function innerTextNodeThis(targetOrOptions, propertyKey, descriptor) {
10457
+ const option = { position: "innerText" };
10458
+ if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10459
+ const opt = targetOrOptions || {};
10460
+ return applyNode("$this", { ...opt, ...option });
10461
+ }
10462
+ function innerHtmlLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10385
10463
  const option = { position: "innerHtml", root: "light" };
10386
10464
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10387
10465
  const opt = targetOrOptions || {};
10388
10466
  return applyNode("$this", { ...opt, ...option });
10389
10467
  }
10390
- function applyThisReplaceChildrenNodeLightDom(targetOrOptions, propertyKey, descriptor) {
10468
+ function replaceChildrenLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10391
10469
  const option = { position: "replaceChildren", root: "light" };
10392
10470
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10393
10471
  const opt = targetOrOptions || {};
10394
10472
  return applyNode("$this", { ...opt, ...option });
10395
10473
  }
10396
- function applyNodeReplaceChildren(selector, options = {}) {
10474
+ function replaceChildrenNode(selector, options = {}) {
10397
10475
  return applyNode(selector, { ...options, position: "replaceChildren" });
10398
10476
  }
10399
- function applyNodeInnerHtml(selector, options = {}) {
10477
+ function innerHtmlNode(selector, options = {}) {
10400
10478
  return applyNode(selector, { ...options, position: "innerHtml" });
10401
10479
  }
10402
- function applyNodeInnerText(selector, options = {}) {
10480
+ function innerHtmlLightNode(selector, options = {}) {
10481
+ return applyNode(selector, { ...options, position: "innerHtml", root: "light" });
10482
+ }
10483
+ function innerHtmlShadowNode(selector, options = {}) {
10484
+ return applyNode(selector, { ...options, position: "innerHtml", root: "shadow" });
10485
+ }
10486
+ function innerTextNode(selector, options = {}) {
10403
10487
  return applyNode(selector, { ...options, position: "innerText" });
10404
10488
  }
10489
+ function innerTextLightNode(selector, options = {}) {
10490
+ return applyNode(selector, { ...options, position: "innerText", root: "light" });
10491
+ }
10492
+ function innerTextShadowNode(selector, options = {}) {
10493
+ return applyNode(selector, { ...options, position: "innerText", root: "shadow" });
10494
+ }
10495
+ var findAllApplyNodeMetadata = (target) => {
10496
+ const result = /* @__PURE__ */ new Map();
10497
+ const maps = ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
10498
+ maps.forEach((map) => {
10499
+ if (map instanceof Map) {
10500
+ map.forEach((v, k) => result.set(k, v));
10501
+ }
10502
+ });
10503
+ return result;
10504
+ };
10405
10505
 
10406
10506
  // src/decorators/applyClass.ts
10407
10507
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
@@ -10654,89 +10754,6 @@ var findAllStyleMetadata = (target) => {
10654
10754
  return result;
10655
10755
  };
10656
10756
 
10657
- // src/decorators/setProperty.ts
10658
- var PROPERTY_SET_METADATA_KEY = Symbol.for("simple-web-component:property-set");
10659
- var setProperty = (selector, propertyNameOrOptions, options = {}) => {
10660
- return (target, propertyKey, descriptor) => {
10661
- const constructor = target.constructor;
10662
- let metaList = ReflectUtils.getOwnMetadata(PROPERTY_SET_METADATA_KEY, constructor);
10663
- if (!metaList) {
10664
- metaList = /* @__PURE__ */ new Map();
10665
- ReflectUtils.defineMetadata(PROPERTY_SET_METADATA_KEY, metaList, constructor);
10666
- }
10667
- let propertyName = typeof propertyNameOrOptions === "string" ? propertyNameOrOptions : void 0;
10668
- let finalOptions = options;
10669
- if (typeof propertyNameOrOptions === "object" && propertyNameOrOptions !== null) {
10670
- finalOptions = propertyNameOrOptions;
10671
- }
10672
- metaList.set(propertyKey, {
10673
- propertyKey,
10674
- selector,
10675
- options: { ...finalOptions, name: propertyName }
10676
- });
10677
- const original = descriptor.value;
10678
- descriptor.value = function(...args) {
10679
- ensureInit(this);
10680
- const res = original.apply(this, args);
10681
- const handleResult = (resolvedValue) => {
10682
- if (resolvedValue !== void 0) {
10683
- const win = this.ownerDocument?.defaultView || window;
10684
- const host = this;
10685
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
10686
- const r = finalOptions.root || "auto";
10687
- const targetEls = [];
10688
- const applyRoot = (t) => {
10689
- if (!t || !(t instanceof win.HTMLElement)) return;
10690
- targetEls.push(t);
10691
- };
10692
- if (selector === "$this" || !selector) applyRoot(host);
10693
- else if (selector === "$host") applyRoot(hostSet.$host);
10694
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
10695
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
10696
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
10697
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
10698
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
10699
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
10700
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
10701
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
10702
- else {
10703
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
10704
- if (targetRoot) {
10705
- const found = targetRoot.querySelectorAll(selector);
10706
- if (found) targetEls.push(...Array.from(found));
10707
- }
10708
- }
10709
- targetEls.forEach((targetEl) => {
10710
- if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
10711
- return;
10712
- }
10713
- const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
10714
- if (propertyName) {
10715
- targetEl[propertyName] = resolvedRes;
10716
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
10717
- Object.entries(resolvedRes).forEach(([prop, val]) => {
10718
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
10719
- targetEl[prop] = finalVal;
10720
- });
10721
- } else {
10722
- targetEl.value = resolvedRes;
10723
- }
10724
- });
10725
- }
10726
- return resolvedValue;
10727
- };
10728
- if (res instanceof Promise) {
10729
- return res.then(handleResult);
10730
- } else {
10731
- return handleResult(res);
10732
- }
10733
- };
10734
- };
10735
- };
10736
- var setPropertyThis = (propertyNameOrOptions, options = {}) => {
10737
- return setProperty("$this", propertyNameOrOptions, options);
10738
- };
10739
-
10740
10757
  // src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts
10741
10758
  var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change-while-connected");
10742
10759
  function createSubscribeSwcAppRouteChangeWhileConnected(options) {
@@ -10753,15 +10770,21 @@ function createSubscribeSwcAppRouteChangeWhileConnected(options) {
10753
10770
  return descriptor;
10754
10771
  };
10755
10772
  }
10756
- function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKey, descriptor) {
10757
- if (propertyKey && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
10758
- return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKey, descriptor);
10773
+ function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKeyOrConfig, descriptor) {
10774
+ if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === "string" || typeof propertyKeyOrConfig === "symbol")) {
10775
+ return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);
10759
10776
  }
10760
10777
  let options = {};
10761
10778
  if (Array.isArray(targetOrOptions)) {
10762
10779
  options.path = targetOrOptions;
10780
+ if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
10781
+ options = { ...options, ...propertyKeyOrConfig };
10782
+ }
10763
10783
  } else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
10764
10784
  options.path = targetOrOptions;
10785
+ if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
10786
+ options = { ...options, ...propertyKeyOrConfig };
10787
+ }
10765
10788
  } else if (targetOrOptions && typeof targetOrOptions === "object") {
10766
10789
  options = targetOrOptions;
10767
10790
  }
@@ -10887,7 +10910,7 @@ var applyToDom2 = (swcId, id, pos, nodes) => {
10887
10910
  };
10888
10911
  function applySlot(targetId, opt) {
10889
10912
  return (targetObj, propertyKey, descriptor) => {
10890
- const options = { position: "replaceChildrenHtml", ...opt };
10913
+ const options = { position: "replaceChildren", ...opt };
10891
10914
  const constructor = targetObj.constructor;
10892
10915
  let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
10893
10916
  if (!metaList) {
@@ -10939,34 +10962,40 @@ function applySlot(targetId, opt) {
10939
10962
  };
10940
10963
  };
10941
10964
  }
10942
- var findAllApplySlotMetadata = (target) => {
10943
- const constructor = target instanceof Function ? target : target.constructor;
10944
- return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
10945
- };
10946
- function applySlotClear(targetId) {
10965
+ function clearSlot(targetId) {
10947
10966
  return applySlot(targetId, { position: "clear" });
10948
10967
  }
10949
- function applySlotPrependHtml(targetId) {
10968
+ function prependHtmlSlot(targetId) {
10950
10969
  return applySlot(targetId, { position: "prependHtml" });
10951
10970
  }
10952
- var applySlotPrepend = applySlotPrependHtml;
10953
- function applySlotPrependText(targetId) {
10971
+ function prependSlot(targetId) {
10972
+ return applySlot(targetId, { position: "prepend" });
10973
+ }
10974
+ function prependTextSlot(targetId) {
10954
10975
  return applySlot(targetId, { position: "prependText" });
10955
10976
  }
10956
- function applySlotAppendHtml(targetId) {
10977
+ function appendHtmlSlot(targetId) {
10957
10978
  return applySlot(targetId, { position: "appendHtml" });
10958
10979
  }
10959
- function applySlotAppendText(targetId) {
10980
+ function appendTextSlot(targetId) {
10960
10981
  return applySlot(targetId, { position: "appendText" });
10961
10982
  }
10962
- var applySlotAppend = applySlotAppendHtml;
10963
- function applySlotReplaceChildrenHtml(targetId) {
10983
+ function appendSlot(targetId) {
10984
+ return applySlot(targetId, { position: "append" });
10985
+ }
10986
+ function replaceChildrenHtmlSlot(targetId) {
10964
10987
  return applySlot(targetId, { position: "replaceChildrenHtml" });
10965
10988
  }
10966
- var applySlotReplaceChildren = applySlotReplaceChildrenHtml;
10967
- function applySlotReplaceChildrenText(targetId) {
10989
+ function replaceChildrenSlot(targetId) {
10990
+ return applySlot(targetId, { position: "replaceChildren" });
10991
+ }
10992
+ function replaceChildrenTextSlot(targetId) {
10968
10993
  return applySlot(targetId, { position: "replaceChildrenText" });
10969
10994
  }
10995
+ var findAllApplySlotMetadata = (target) => {
10996
+ const constructor = target instanceof Function ? target : target.constructor;
10997
+ return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
10998
+ };
10970
10999
 
10971
11000
  // ../simple-boot/dist/esm/index.js
10972
11001
  var import_reflect_metadata = __toESM(require_Reflect(), 1);
@@ -11115,9 +11144,9 @@ var MetaDataAtomic = class {
11115
11144
  }
11116
11145
  };
11117
11146
  var MetaDataPropertyAtomic = class extends MetaDataAtomic {
11118
- constructor(target, metaData, property, parameter) {
11147
+ constructor(target, metaData, property2, parameter) {
11119
11148
  super(target, metaData);
11120
- this.property = property;
11149
+ this.property = property2;
11121
11150
  this.parameter = parameter;
11122
11151
  }
11123
11152
  call(...parameter) {
@@ -13211,7 +13240,12 @@ function SwcAppMixin(Base) {
13211
13240
  const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
13212
13241
  if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
13213
13242
  console.log("[SWC-MIXIN] Route change subscribers found");
13214
- const ps = routeChangeSubscribers.map(async (metadata) => {
13243
+ const sortedSubscribers = [...routeChangeSubscribers].sort((a, b) => {
13244
+ const orderA = a.options?.order ?? 0;
13245
+ const orderB = b.options?.order ?? 0;
13246
+ return orderA - orderB;
13247
+ });
13248
+ for (const metadata of sortedSubscribers) {
13215
13249
  const methodName = metadata.propertyKey;
13216
13250
  let pathPattern = metadata.options?.path;
13217
13251
  const filter = metadata.options?.filter;
@@ -13239,10 +13273,12 @@ function SwcAppMixin(Base) {
13239
13273
  const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
13240
13274
  const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
13241
13275
  if (pathMatched && filterPassed && instance[methodName]) {
13242
- await instance[methodName]({ ...re, pathData });
13276
+ const result = await instance[methodName]({ ...re, pathData });
13277
+ if (result !== void 0 && result !== null) {
13278
+ break;
13279
+ }
13243
13280
  }
13244
- });
13245
- await Promise.allSettled(ps);
13281
+ }
13246
13282
  }
13247
13283
  } finally {
13248
13284
  if (this.config?.ssr) {
@@ -13590,9 +13626,8 @@ export {
13590
13626
  ADD_EVENT_LISTENER_METADATA_KEY,
13591
13627
  APPLY_NODE_METADATA_KEY,
13592
13628
  APPLY_SLOT_METADATA_KEY,
13593
- ATTRIBUTE_APPLY_METADATA_KEY,
13594
13629
  ATTRIBUTE_CHANGED_WILDCARD,
13595
- ATTRIBUTE_FIELD_METADATA_KEY,
13630
+ ATTRIBUTE_METADATA_KEY,
13596
13631
  BROWSER_GLOBALS,
13597
13632
  CLASS_METADATA_KEY,
13598
13633
  DOM_EVENT_NAMES,
@@ -13612,7 +13647,7 @@ export {
13612
13647
  ON_CONNECTED_METADATA_KEY,
13613
13648
  ON_CONNECTED_SWC_APP_METADATA_KEY,
13614
13649
  ON_INITIALIZE_METADATA_KEY,
13615
- PROPERTY_SET_METADATA_KEY,
13650
+ PROPERTY_METADATA_KEY,
13616
13651
  PUBLISH_SWC_APP_MESSAGE_METADATA_KEY,
13617
13652
  QUERY_ALL_METADATA_KEY,
13618
13653
  QUERY_METADATA_KEY,
@@ -13644,43 +13679,29 @@ export {
13644
13679
  addEventListenerDocument,
13645
13680
  addEventListenerThis,
13646
13681
  addEventListenerWindow,
13682
+ afterBeginLightNodeThis,
13683
+ afterBeginNodeThis,
13647
13684
  allAppHost,
13648
13685
  allParentHost,
13686
+ appendHtmlSlot,
13687
+ appendSlot,
13688
+ appendTextSlot,
13649
13689
  applyAttribute,
13650
- applyAttributeThis,
13651
13690
  applyClass,
13652
13691
  applyClassThis,
13653
13692
  applyNode,
13654
- applyNodeInnerHtml,
13655
- applyNodeInnerText,
13656
- applyNodeReplaceChildren,
13657
13693
  applyNodeThis,
13658
- applyNodeThisAfterBegin,
13659
- applyNodeThisAfterBeginLightDom,
13660
- applyNodeThisBeforeEnd,
13661
- applyNodeThisBeforeEndLightDom,
13662
- applyNodeThisBeforeEndShadow,
13663
- applyNodeThisInnerHtml,
13664
- applyNodeThisReplaceChildren,
13665
- applyNodeThisReplaceChildrenLightDom,
13694
+ applyProperty,
13666
13695
  applySlot,
13667
- applySlotAppend,
13668
- applySlotAppendHtml,
13669
- applySlotAppendText,
13670
- applySlotClear,
13671
- applySlotPrepend,
13672
- applySlotPrependHtml,
13673
- applySlotPrependText,
13674
- applySlotReplaceChildren,
13675
- applySlotReplaceChildrenHtml,
13676
- applySlotReplaceChildrenText,
13677
13696
  applyStyle,
13678
13697
  applyStyleThis,
13679
- applyThisInnerHtmlNodeLightDom,
13680
- applyThisReplaceChildrenNodeLightDom,
13681
13698
  attribute,
13682
13699
  attributeThis,
13700
+ beforeEndLightNodeThis,
13701
+ beforeEndNodeThis,
13702
+ beforeEndShadowNodeThis,
13683
13703
  changedAttributeThis,
13704
+ clearSlot,
13684
13705
  commentNode,
13685
13706
  convertAttributeValue,
13686
13707
  convertValue2 as convertValue,
@@ -13710,6 +13731,8 @@ export {
13710
13731
  findAllOnConnectedAfterMetadata,
13711
13732
  findAllOnConnectedBeforeMetadata,
13712
13733
  findAllOnConnectedMetadata,
13734
+ findAllPropertyApplyMetadata,
13735
+ findAllPropertyMetadata,
13713
13736
  findAllStateMetadata,
13714
13737
  findAllStyleMetadata,
13715
13738
  getAddEventListenerMetadata,
@@ -13734,6 +13757,15 @@ export {
13734
13757
  htmlSectionElement,
13735
13758
  htmlSpanElement,
13736
13759
  htmlUlElement,
13760
+ innerHtmlLightNode,
13761
+ innerHtmlLightNodeThis,
13762
+ innerHtmlNode,
13763
+ innerHtmlNodeThis,
13764
+ innerHtmlShadowNode,
13765
+ innerTextLightNode,
13766
+ innerTextNode,
13767
+ innerTextNodeThis,
13768
+ innerTextShadowNode,
13737
13769
  isSSR,
13738
13770
  onAddEventListener,
13739
13771
  onAdopted,
@@ -13743,13 +13775,18 @@ export {
13743
13775
  onConnectedAfter,
13744
13776
  onConnectedBefore,
13745
13777
  onConnectedCompleted,
13746
- onConnectedLightDom,
13747
- onConnectedShadowDom,
13778
+ onConnectedLight,
13779
+ onConnectedShadow,
13748
13780
  onConnectedSwcApp,
13749
13781
  onDisconnected,
13750
13782
  onDisconnectedAfter,
13751
13783
  onDisconnectedBefore,
13752
13784
  onInitialize,
13785
+ prependHtmlSlot,
13786
+ prependSlot,
13787
+ prependTextSlot,
13788
+ property,
13789
+ propertyThis,
13753
13790
  publishSwcAppMessage,
13754
13791
  query,
13755
13792
  queryAll,
@@ -13759,14 +13796,19 @@ export {
13759
13796
  queryHost,
13760
13797
  queryThis,
13761
13798
  queryWindow,
13762
- removeAttribute,
13763
- removeAttributeThis,
13764
13799
  removeClass,
13765
13800
  removeClassThis,
13766
13801
  removeSSRAttribute,
13767
13802
  removeStyle,
13768
13803
  removeStyleThis,
13769
- resolveTargetEls,
13804
+ replaceChildrenHtmlSlot,
13805
+ replaceChildrenLightNodeThis,
13806
+ replaceChildrenNode,
13807
+ replaceChildrenNodeThis,
13808
+ replaceChildrenSlot,
13809
+ replaceChildrenTextSlot,
13810
+ resolveAttributeTargets,
13811
+ resolvePropertyTargets,
13770
13812
  setAttribute,
13771
13813
  setAttributeThis,
13772
13814
  setClass,
@@ -13793,8 +13835,6 @@ export {
13793
13835
  textNode,
13794
13836
  toggleClass,
13795
13837
  toggleClassThis,
13796
- updateAttribute,
13797
- updateAttributeThis,
13798
13838
  updateClass,
13799
13839
  updateClassThis,
13800
13840
  updateStyle,