@dooboostore/simple-web-component 1.0.38 → 1.0.40

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 (91) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +88 -871
  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 +82 -80
  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 +93 -82
  11. package/dist/cjs/decorators/applySlot.js.map +3 -3
  12. package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
  13. package/dist/cjs/decorators/elementDefine.js +14 -34
  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/state.js +0 -1
  20. package/dist/cjs/decorators/state.js.map +2 -2
  21. package/dist/cjs/elements/SwcApp.js.map +2 -2
  22. package/dist/cjs/types/index.js.map +1 -1
  23. package/dist/esm/SwcAppEngine.js.map +2 -2
  24. package/dist/esm/decorators/applyAttribute.js +196 -113
  25. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  26. package/dist/esm/decorators/applyNode.js +82 -80
  27. package/dist/esm/decorators/applyNode.js.map +2 -2
  28. package/dist/esm/decorators/applyProperty.js +194 -0
  29. package/dist/esm/decorators/applyProperty.js.map +7 -0
  30. package/dist/esm/decorators/applySlot.js +93 -82
  31. package/dist/esm/decorators/applySlot.js.map +3 -3
  32. package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
  33. package/dist/esm/decorators/elementDefine.js +14 -34
  34. package/dist/esm/decorators/elementDefine.js.map +2 -2
  35. package/dist/esm/decorators/index.js +2 -2
  36. package/dist/esm/decorators/index.js.map +1 -1
  37. package/dist/esm/decorators/lifecycles.js +4 -4
  38. package/dist/esm/decorators/lifecycles.js.map +2 -2
  39. package/dist/esm/decorators/state.js +0 -1
  40. package/dist/esm/decorators/state.js.map +2 -2
  41. package/dist/esm/elements/SwcApp.js.map +2 -2
  42. package/dist/esm/types/index.js.map +1 -1
  43. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +525 -513
  44. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  45. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  46. package/dist/types/decorators/applyAttribute.d.ts +56 -15
  47. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  48. package/dist/types/decorators/applyNode.d.ts +28 -24
  49. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  50. package/dist/types/decorators/applyProperty.d.ts +61 -0
  51. package/dist/types/decorators/applyProperty.d.ts.map +1 -0
  52. package/dist/types/decorators/applySlot.d.ts +17 -15
  53. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  54. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  55. package/dist/types/decorators/index.d.ts +2 -2
  56. package/dist/types/decorators/index.d.ts.map +1 -1
  57. package/dist/types/decorators/lifecycles.d.ts +4 -4
  58. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  59. package/dist/types/decorators/state.d.ts.map +1 -1
  60. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  61. package/dist/types/types/index.d.ts +1 -6
  62. package/dist/types/types/index.d.ts.map +1 -1
  63. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +525 -513
  64. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  65. package/package.json +1 -1
  66. package/src/SwcAppEngine.ts +1 -0
  67. package/src/decorators/applyAttribute.ts +311 -126
  68. package/src/decorators/applyNode.ts +108 -105
  69. package/src/decorators/applyProperty.ts +302 -0
  70. package/src/decorators/applySlot.ts +112 -94
  71. package/src/decorators/changedAttributeThis.ts +1 -1
  72. package/src/decorators/elementDefine.ts +44 -33
  73. package/src/decorators/index.ts +2 -3
  74. package/src/decorators/lifecycles.ts +6 -6
  75. package/src/decorators/state.ts +0 -1
  76. package/src/elements/SwcApp.ts +0 -1
  77. package/src/types/index.ts +7 -7
  78. package/dist/cjs/decorators/attribute.js +0 -187
  79. package/dist/cjs/decorators/attribute.js.map +0 -7
  80. package/dist/cjs/decorators/setProperty.js +0 -109
  81. package/dist/cjs/decorators/setProperty.js.map +0 -7
  82. package/dist/esm/decorators/attribute.js +0 -168
  83. package/dist/esm/decorators/attribute.js.map +0 -7
  84. package/dist/esm/decorators/setProperty.js +0 -90
  85. package/dist/esm/decorators/setProperty.js.map +0 -7
  86. package/dist/types/decorators/attribute.d.ts +0 -31
  87. package/dist/types/decorators/attribute.d.ts.map +0 -1
  88. package/dist/types/decorators/setProperty.d.ts +0 -17
  89. package/dist/types/decorators/setProperty.d.ts.map +0 -1
  90. package/src/decorators/attribute.ts +0 -223
  91. package/src/decorators/setProperty.ts +0 -112
@@ -1123,9 +1123,8 @@ var dooboostoreSimpleWebComponent = (() => {
1123
1123
  ADD_EVENT_LISTENER_METADATA_KEY: () => ADD_EVENT_LISTENER_METADATA_KEY,
1124
1124
  APPLY_NODE_METADATA_KEY: () => APPLY_NODE_METADATA_KEY,
1125
1125
  APPLY_SLOT_METADATA_KEY: () => APPLY_SLOT_METADATA_KEY,
1126
- ATTRIBUTE_APPLY_METADATA_KEY: () => ATTRIBUTE_APPLY_METADATA_KEY,
1127
1126
  ATTRIBUTE_CHANGED_WILDCARD: () => ATTRIBUTE_CHANGED_WILDCARD,
1128
- ATTRIBUTE_FIELD_METADATA_KEY: () => ATTRIBUTE_FIELD_METADATA_KEY,
1127
+ ATTRIBUTE_METADATA_KEY: () => ATTRIBUTE_METADATA_KEY,
1129
1128
  BROWSER_GLOBALS: () => BROWSER_GLOBALS,
1130
1129
  CLASS_METADATA_KEY: () => CLASS_METADATA_KEY,
1131
1130
  DOM_EVENT_NAMES: () => DOM_EVENT_NAMES,
@@ -1145,7 +1144,7 @@ var dooboostoreSimpleWebComponent = (() => {
1145
1144
  ON_CONNECTED_METADATA_KEY: () => ON_CONNECTED_METADATA_KEY,
1146
1145
  ON_CONNECTED_SWC_APP_METADATA_KEY: () => ON_CONNECTED_SWC_APP_METADATA_KEY,
1147
1146
  ON_INITIALIZE_METADATA_KEY: () => ON_INITIALIZE_METADATA_KEY,
1148
- PROPERTY_SET_METADATA_KEY: () => PROPERTY_SET_METADATA_KEY,
1147
+ PROPERTY_METADATA_KEY: () => PROPERTY_METADATA_KEY,
1149
1148
  PUBLISH_SWC_APP_MESSAGE_METADATA_KEY: () => PUBLISH_SWC_APP_MESSAGE_METADATA_KEY,
1150
1149
  QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
1151
1150
  QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
@@ -1177,43 +1176,29 @@ var dooboostoreSimpleWebComponent = (() => {
1177
1176
  addEventListenerDocument: () => addEventListenerDocument,
1178
1177
  addEventListenerThis: () => addEventListenerThis,
1179
1178
  addEventListenerWindow: () => addEventListenerWindow,
1179
+ afterBeginLightNodeThis: () => afterBeginLightNodeThis,
1180
+ afterBeginNodeThis: () => afterBeginNodeThis,
1180
1181
  allAppHost: () => allAppHost,
1181
1182
  allParentHost: () => allParentHost,
1183
+ appendHtmlSlot: () => appendHtmlSlot,
1184
+ appendSlot: () => appendSlot,
1185
+ appendTextSlot: () => appendTextSlot,
1182
1186
  applyAttribute: () => applyAttribute,
1183
- applyAttributeThis: () => applyAttributeThis,
1184
1187
  applyClass: () => applyClass,
1185
1188
  applyClassThis: () => applyClassThis,
1186
1189
  applyNode: () => applyNode,
1187
- applyNodeInnerHtml: () => applyNodeInnerHtml,
1188
- applyNodeInnerText: () => applyNodeInnerText,
1189
- applyNodeReplaceChildren: () => applyNodeReplaceChildren,
1190
1190
  applyNodeThis: () => applyNodeThis,
1191
- applyNodeThisAfterBegin: () => applyNodeThisAfterBegin,
1192
- applyNodeThisAfterBeginLightDom: () => applyNodeThisAfterBeginLightDom,
1193
- applyNodeThisBeforeEnd: () => applyNodeThisBeforeEnd,
1194
- applyNodeThisBeforeEndLightDom: () => applyNodeThisBeforeEndLightDom,
1195
- applyNodeThisBeforeEndShadow: () => applyNodeThisBeforeEndShadow,
1196
- applyNodeThisReplaceChildren: () => applyNodeThisReplaceChildren,
1197
- applyNodeThisReplaceChildrenLightDom: () => applyNodeThisReplaceChildrenLightDom,
1191
+ applyProperty: () => applyProperty,
1198
1192
  applySlot: () => applySlot,
1199
- applySlotAppend: () => applySlotAppend,
1200
- applySlotAppendHtml: () => applySlotAppendHtml,
1201
- applySlotAppendText: () => applySlotAppendText,
1202
- applySlotClear: () => applySlotClear,
1203
- applySlotPrepend: () => applySlotPrepend,
1204
- applySlotPrependHtml: () => applySlotPrependHtml,
1205
- applySlotPrependText: () => applySlotPrependText,
1206
- applySlotReplaceChildren: () => applySlotReplaceChildren,
1207
- applySlotReplaceChildrenHtml: () => applySlotReplaceChildrenHtml,
1208
- applySlotReplaceChildrenText: () => applySlotReplaceChildrenText,
1209
1193
  applyStyle: () => applyStyle,
1210
1194
  applyStyleThis: () => applyStyleThis,
1211
- applyThisInnerHtmlNode: () => applyThisInnerHtmlNode,
1212
- applyThisInnerHtmlNodeLightDom: () => applyThisInnerHtmlNodeLightDom,
1213
- applyThisReplaceChildrenNodeLightDom: () => applyThisReplaceChildrenNodeLightDom,
1214
1195
  attribute: () => attribute,
1215
1196
  attributeThis: () => attributeThis,
1197
+ beforeEndLightNodeThis: () => beforeEndLightNodeThis,
1198
+ beforeEndNodeThis: () => beforeEndNodeThis,
1199
+ beforeEndShadowNodeThis: () => beforeEndShadowNodeThis,
1216
1200
  changedAttributeThis: () => changedAttributeThis,
1201
+ clearSlot: () => clearSlot,
1217
1202
  commentNode: () => commentNode,
1218
1203
  convertAttributeValue: () => convertAttributeValue,
1219
1204
  convertValue: () => convertValue2,
@@ -1243,6 +1228,8 @@ var dooboostoreSimpleWebComponent = (() => {
1243
1228
  findAllOnConnectedAfterMetadata: () => findAllOnConnectedAfterMetadata,
1244
1229
  findAllOnConnectedBeforeMetadata: () => findAllOnConnectedBeforeMetadata,
1245
1230
  findAllOnConnectedMetadata: () => findAllOnConnectedMetadata,
1231
+ findAllPropertyApplyMetadata: () => findAllPropertyApplyMetadata,
1232
+ findAllPropertyMetadata: () => findAllPropertyMetadata,
1246
1233
  findAllStateMetadata: () => findAllStateMetadata,
1247
1234
  findAllStyleMetadata: () => findAllStyleMetadata,
1248
1235
  getAddEventListenerMetadata: () => getAddEventListenerMetadata,
@@ -1267,6 +1254,15 @@ var dooboostoreSimpleWebComponent = (() => {
1267
1254
  htmlSectionElement: () => htmlSectionElement,
1268
1255
  htmlSpanElement: () => htmlSpanElement,
1269
1256
  htmlUlElement: () => htmlUlElement,
1257
+ innerHtmlLightNode: () => innerHtmlLightNode,
1258
+ innerHtmlLightNodeThis: () => innerHtmlLightNodeThis,
1259
+ innerHtmlNode: () => innerHtmlNode,
1260
+ innerHtmlNodeThis: () => innerHtmlNodeThis,
1261
+ innerHtmlShadowNode: () => innerHtmlShadowNode,
1262
+ innerTextLightNode: () => innerTextLightNode,
1263
+ innerTextNode: () => innerTextNode,
1264
+ innerTextNodeThis: () => innerTextNodeThis,
1265
+ innerTextShadowNode: () => innerTextShadowNode,
1270
1266
  isSSR: () => isSSR,
1271
1267
  onAddEventListener: () => onAddEventListener,
1272
1268
  onAdopted: () => onAdopted,
@@ -1276,13 +1272,18 @@ var dooboostoreSimpleWebComponent = (() => {
1276
1272
  onConnectedAfter: () => onConnectedAfter,
1277
1273
  onConnectedBefore: () => onConnectedBefore,
1278
1274
  onConnectedCompleted: () => onConnectedCompleted,
1279
- onConnectedLightDom: () => onConnectedLightDom,
1280
- onConnectedShadowDom: () => onConnectedShadowDom,
1275
+ onConnectedLight: () => onConnectedLight,
1276
+ onConnectedShadow: () => onConnectedShadow,
1281
1277
  onConnectedSwcApp: () => onConnectedSwcApp,
1282
1278
  onDisconnected: () => onDisconnected,
1283
1279
  onDisconnectedAfter: () => onDisconnectedAfter,
1284
1280
  onDisconnectedBefore: () => onDisconnectedBefore,
1285
1281
  onInitialize: () => onInitialize,
1282
+ prependHtmlSlot: () => prependHtmlSlot,
1283
+ prependSlot: () => prependSlot,
1284
+ prependTextSlot: () => prependTextSlot,
1285
+ property: () => property,
1286
+ propertyThis: () => propertyThis,
1286
1287
  publishSwcAppMessage: () => publishSwcAppMessage,
1287
1288
  query: () => query,
1288
1289
  queryAll: () => queryAll,
@@ -1292,14 +1293,19 @@ var dooboostoreSimpleWebComponent = (() => {
1292
1293
  queryHost: () => queryHost,
1293
1294
  queryThis: () => queryThis,
1294
1295
  queryWindow: () => queryWindow,
1295
- removeAttribute: () => removeAttribute,
1296
- removeAttributeThis: () => removeAttributeThis,
1297
1296
  removeClass: () => removeClass,
1298
1297
  removeClassThis: () => removeClassThis,
1299
1298
  removeSSRAttribute: () => removeSSRAttribute,
1300
1299
  removeStyle: () => removeStyle,
1301
1300
  removeStyleThis: () => removeStyleThis,
1302
- resolveTargetEls: () => resolveTargetEls,
1301
+ replaceChildrenHtmlSlot: () => replaceChildrenHtmlSlot,
1302
+ replaceChildrenLightNodeThis: () => replaceChildrenLightNodeThis,
1303
+ replaceChildrenNode: () => replaceChildrenNode,
1304
+ replaceChildrenNodeThis: () => replaceChildrenNodeThis,
1305
+ replaceChildrenSlot: () => replaceChildrenSlot,
1306
+ replaceChildrenTextSlot: () => replaceChildrenTextSlot,
1307
+ resolveAttributeTargets: () => resolveAttributeTargets,
1308
+ resolvePropertyTargets: () => resolvePropertyTargets,
1303
1309
  setAttribute: () => setAttribute,
1304
1310
  setAttributeThis: () => setAttributeThis,
1305
1311
  setClass: () => setClass,
@@ -1326,8 +1332,6 @@ var dooboostoreSimpleWebComponent = (() => {
1326
1332
  textNode: () => textNode,
1327
1333
  toggleClass: () => toggleClass,
1328
1334
  toggleClassThis: () => toggleClassThis,
1329
- updateAttribute: () => updateAttribute,
1330
- updateAttributeThis: () => updateAttributeThis,
1331
1335
  updateClass: () => updateClass,
1332
1336
  updateClassThis: () => updateClassThis,
1333
1337
  updateStyle: () => updateStyle,
@@ -4433,8 +4437,8 @@ var dooboostoreSimpleWebComponent = (() => {
4433
4437
  }
4434
4438
  }
4435
4439
  if (ValidUtils.isObject(obj)) {
4436
- for (const property in obj) {
4437
- obj[property] = ConvertUtils22.toObject(obj[property]);
4440
+ for (const property2 in obj) {
4441
+ obj[property2] = ConvertUtils22.toObject(obj[property2]);
4438
4442
  }
4439
4443
  }
4440
4444
  return obj;
@@ -4468,10 +4472,10 @@ var dooboostoreSimpleWebComponent = (() => {
4468
4472
  };
4469
4473
  ConvertUtils22.concatenateToString = (object_o, unionString_s = "=", spilString_s = " ", pairString_s = "") => {
4470
4474
  const results = [];
4471
- for (const property in object_o) {
4472
- const value = object_o[property];
4475
+ for (const property2 in object_o) {
4476
+ const value = object_o[property2];
4473
4477
  if (value) {
4474
- results.push(property.toString() + unionString_s + pairString_s + value + pairString_s);
4478
+ results.push(property2.toString() + unionString_s + pairString_s + value + pairString_s);
4475
4479
  }
4476
4480
  }
4477
4481
  return results.join(spilString_s);
@@ -6214,9 +6218,9 @@ var dooboostoreSimpleWebComponent = (() => {
6214
6218
  // ../core/dist/esm/function/FunctionUtils.js
6215
6219
  var FunctionUtils;
6216
6220
  ((FunctionUtils2) => {
6217
- FunctionUtils2.getParameterNames = (func, property) => {
6218
- if (typeof func === "object" && property) {
6219
- func = func[property];
6221
+ FunctionUtils2.getParameterNames = (func, property2) => {
6222
+ if (typeof func === "object" && property2) {
6223
+ func = func[property2];
6220
6224
  }
6221
6225
  return new RegExp("(?:" + func.name + "\\s*|^)\\s*\\((.*?)\\)").exec(func.toString().replace(/\n/g, ""))?.[1].replace(/\/\*.*?\*\//g, "").replace(/ /g, "").split(",") ?? [];
6222
6226
  };
@@ -6635,7 +6639,7 @@ var dooboostoreSimpleWebComponent = (() => {
6635
6639
  }
6636
6640
  list.push({ propertyKey, options });
6637
6641
  };
6638
- function onConnectedShadowDom(optionOrTarget, propertyKey, arg3) {
6642
+ function onConnectedShadow(optionOrTarget, propertyKey, arg3) {
6639
6643
  if (propertyKey) {
6640
6644
  return decorator({ useShadow: true }, optionOrTarget, propertyKey);
6641
6645
  }
@@ -6643,7 +6647,7 @@ var dooboostoreSimpleWebComponent = (() => {
6643
6647
  decorator({ ...optionOrTarget ?? {}, useShadow: true }, target, propertyKey2);
6644
6648
  };
6645
6649
  }
6646
- function onConnectedLightDom(optionOrTarget, propertyKey, arg3) {
6650
+ function onConnectedLight(optionOrTarget, propertyKey, arg3) {
6647
6651
  if (propertyKey) {
6648
6652
  return decorator({ useShadow: false }, optionOrTarget, propertyKey);
6649
6653
  }
@@ -9125,132 +9129,6 @@ var dooboostoreSimpleWebComponent = (() => {
9125
9129
  return convertValue(val, type);
9126
9130
  };
9127
9131
 
9128
- // src/decorators/applyAttribute.ts
9129
- var ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
9130
- function createAttributeDecorator(action) {
9131
- return (selector, nameOrOptions, options = {}) => {
9132
- return (target, propertyKey, descriptor) => {
9133
- const constructor = target.constructor;
9134
- let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
9135
- if (!metaList) {
9136
- metaList = /* @__PURE__ */ new Map();
9137
- ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
9138
- }
9139
- let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
9140
- let finalOptions = options;
9141
- if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
9142
- finalOptions = nameOrOptions;
9143
- }
9144
- metaList.set(propertyKey, {
9145
- propertyKey,
9146
- selector,
9147
- action,
9148
- options: { ...finalOptions, name: attributeName }
9149
- });
9150
- const original = descriptor.value;
9151
- descriptor.value = function(...args) {
9152
- ensureInit(this);
9153
- const res = original.apply(this, args);
9154
- const handleResult = (resolvedValue) => {
9155
- if (resolvedValue !== void 0) {
9156
- const win = this.ownerDocument?.defaultView || window;
9157
- const host = this;
9158
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
9159
- const r = finalOptions.root || "auto";
9160
- const targetEls = [];
9161
- const applyRoot = (t) => {
9162
- if (!t || !(t instanceof win.HTMLElement)) return;
9163
- targetEls.push(t);
9164
- };
9165
- if (selector === "$this" || !selector) applyRoot(host);
9166
- else if (selector === "$host") applyRoot(hostSet.$host);
9167
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
9168
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
9169
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
9170
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
9171
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
9172
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
9173
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
9174
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
9175
- else {
9176
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
9177
- if (targetRoot) {
9178
- const found = targetRoot.querySelectorAll(selector);
9179
- if (found) targetEls.push(...Array.from(found));
9180
- }
9181
- }
9182
- targetEls.forEach((targetEl) => {
9183
- if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
9184
- return;
9185
- }
9186
- const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
9187
- if (action === "set" || action === "update") {
9188
- if (attributeName) {
9189
- if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
9190
- targetEl.removeAttribute(attributeName);
9191
- } else {
9192
- targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
9193
- }
9194
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
9195
- Object.entries(resolvedRes).forEach(([attr, val]) => {
9196
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
9197
- if (finalVal === null || finalVal === void 0 || finalVal === false) {
9198
- targetEl.removeAttribute(attr);
9199
- } else {
9200
- targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
9201
- }
9202
- });
9203
- }
9204
- } else if (action === "remove") {
9205
- if (attributeName) {
9206
- targetEl.removeAttribute(attributeName);
9207
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
9208
- Object.entries(resolvedRes).forEach(([attr, val]) => {
9209
- const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
9210
- if (shouldRemove) targetEl.removeAttribute(attr);
9211
- });
9212
- } else {
9213
- const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
9214
- attrs.forEach((a) => targetEl.removeAttribute(String(a)));
9215
- }
9216
- }
9217
- });
9218
- }
9219
- return resolvedValue;
9220
- };
9221
- if (res instanceof Promise) {
9222
- return res.then(handleResult);
9223
- } else {
9224
- return handleResult(res);
9225
- }
9226
- };
9227
- return descriptor;
9228
- };
9229
- };
9230
- }
9231
- function applyAttribute(selector, action = "update", options = {}) {
9232
- return createAttributeDecorator(action)(selector, options);
9233
- }
9234
- var setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
9235
- var updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
9236
- var removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
9237
- function applyAttributeThis(action = "update", options = {}) {
9238
- return createAttributeDecorator(action)("$this", options);
9239
- }
9240
- var setAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("set")("$this", nameOrOptions, options);
9241
- var updateAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("update")("$this", nameOrOptions, options);
9242
- var removeAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("remove")("$this", nameOrOptions, options);
9243
- var findAllAttributeApplyMetadata = (target) => {
9244
- const result = /* @__PURE__ */ new Map();
9245
- const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
9246
- maps.forEach((map) => {
9247
- if (map instanceof Map) {
9248
- map.forEach((v, k) => result.set(k, v));
9249
- }
9250
- });
9251
- return result;
9252
- };
9253
-
9254
9132
  // src/decorators/query.ts
9255
9133
  var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
9256
9134
  function query(selectorOrTarget, options = {}) {
@@ -9664,98 +9542,6 @@ var dooboostoreSimpleWebComponent = (() => {
9664
9542
  return InjectSituationType2;
9665
9543
  })(InjectSituationType || {});
9666
9544
 
9667
- // src/decorators/applySlot.ts
9668
- var APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
9669
- function applySlot(id, options = { position: "replaceChildrenHtml" }) {
9670
- return (targetObj, propertyKey, descriptor) => {
9671
- const type = descriptor === void 0 ? "property" : "method";
9672
- if (type === "property") {
9673
- Object.defineProperty(targetObj, propertyKey, {
9674
- get() {
9675
- const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
9676
- return nodeSlot;
9677
- },
9678
- set(nv) {
9679
- if (nv) {
9680
- } else {
9681
- const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
9682
- nodeSlot.clear();
9683
- }
9684
- },
9685
- configurable: true,
9686
- enumerable: true
9687
- });
9688
- }
9689
- const constructor = targetObj.constructor;
9690
- let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
9691
- if (!metaList) {
9692
- metaList = [];
9693
- ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
9694
- }
9695
- metaList.push({ propertyKey, id, type, options });
9696
- if (type === "method") {
9697
- const original = descriptor.value;
9698
- descriptor.value = function(...args) {
9699
- ensureInit(this);
9700
- const conf = getElementConfig(this);
9701
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
9702
- const currentDoc = currentWin.document;
9703
- const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
9704
- let res = original.apply(this, args);
9705
- if (res) {
9706
- const nodeSlot = new NodeSlot(this, this._swcId);
9707
- const pos = options.position || "replaceChildrenHtml";
9708
- const doc = currentWin.document;
9709
- if (pos === "replaceChildrenHtml") {
9710
- nodeSlot.replaceChildrenHtml(id, res);
9711
- } else if (pos === "replaceChildrenText") {
9712
- nodeSlot.replaceChildrenText(id, res);
9713
- } else if (pos === "appendHtml") {
9714
- nodeSlot.appendHtml(id, res);
9715
- } else if (pos === "appendText") {
9716
- nodeSlot.appendText(id, res);
9717
- } else if (pos === "prependHtml") {
9718
- nodeSlot.prependHtml(id, res);
9719
- } else if (pos === "prependText") {
9720
- nodeSlot.prependText(id, res);
9721
- } else if (pos === "clear") {
9722
- nodeSlot.clear(id);
9723
- }
9724
- }
9725
- return res;
9726
- };
9727
- }
9728
- };
9729
- }
9730
- var findAllApplySlotMetadata = (target) => {
9731
- const constructor = target instanceof Function ? target : target.constructor;
9732
- return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
9733
- };
9734
- function applySlotClear(id) {
9735
- return applySlot(id, { position: "clear" });
9736
- }
9737
- function applySlotPrependHtml(id) {
9738
- return applySlot(id, { position: "prependHtml" });
9739
- }
9740
- var applySlotPrepend = applySlotPrependHtml;
9741
- function applySlotPrependText(id) {
9742
- return applySlot(id, { position: "prependText" });
9743
- }
9744
- function applySlotAppendHtml(id) {
9745
- return applySlot(id, { position: "appendHtml" });
9746
- }
9747
- function applySlotAppendText(id) {
9748
- return applySlot(id, { position: "appendText" });
9749
- }
9750
- var applySlotAppend = applySlotAppendHtml;
9751
- function applySlotReplaceChildrenHtml(id) {
9752
- return applySlot(id, { position: "replaceChildrenHtml" });
9753
- }
9754
- var applySlotReplaceChildren = applySlotReplaceChildrenHtml;
9755
- function applySlotReplaceChildrenText(id) {
9756
- return applySlot(id, { position: "replaceChildrenText" });
9757
- }
9758
-
9759
9545
  // src/decorators/state.ts
9760
9546
  var STATE_METADATA_KEY = Symbol.for("simple-web-component:state");
9761
9547
  function state(nameOrTarget, propertyKey) {
@@ -9763,7 +9549,6 @@ var dooboostoreSimpleWebComponent = (() => {
9763
9549
  let storage = targetObj[stateMetadata.propertyKey];
9764
9550
  Object.defineProperty(targetObj, stateMetadata.propertyKey, {
9765
9551
  set(nv) {
9766
- console.log("setState!!", nv);
9767
9552
  storage = nv;
9768
9553
  const config = getElementConfig(this);
9769
9554
  const ea = new ElementApply(this, { id: this._swcId });
@@ -9813,6 +9598,185 @@ var dooboostoreSimpleWebComponent = (() => {
9813
9598
  return ReflectUtils.getMetadata(STATE_METADATA_KEY, constructor) ?? [];
9814
9599
  };
9815
9600
 
9601
+ // src/decorators/applyProperty.ts
9602
+ var PROPERTY_METADATA_KEY = Symbol.for("simple-web-component:property");
9603
+ var resolvePropertyTargets = (inst, selector, options) => {
9604
+ const conf = getElementConfig(inst);
9605
+ const currentWin = conf.window;
9606
+ const r = options.root || "auto";
9607
+ const results = [];
9608
+ const applyRoot = (target) => {
9609
+ if (!target) return;
9610
+ if (r === "auto") {
9611
+ results.push(target);
9612
+ } else {
9613
+ if (r === "light" || r === "all") results.push(target);
9614
+ if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
9615
+ }
9616
+ };
9617
+ if (selector === "$this" || !selector) {
9618
+ applyRoot(inst);
9619
+ } else if (selector === "$window") {
9620
+ results.push(currentWin);
9621
+ } else if (selector === "$document") {
9622
+ results.push(currentWin.document);
9623
+ } else {
9624
+ const hostSet = SwcUtils.getHostSet(inst);
9625
+ if (selector === "$host") applyRoot(hostSet.$host);
9626
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
9627
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
9628
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
9629
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
9630
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
9631
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
9632
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
9633
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
9634
+ else {
9635
+ if (r === "shadow") {
9636
+ const found = inst.shadowRoot?.querySelectorAll(selector);
9637
+ if (found) results.push(...found);
9638
+ } else if (r === "light") {
9639
+ const found = inst.querySelectorAll(selector);
9640
+ if (found) results.push(...found);
9641
+ } else if (r === "all") {
9642
+ const sMatch = inst.shadowRoot?.querySelectorAll(selector);
9643
+ const lMatch = inst.querySelectorAll(selector);
9644
+ if (sMatch) results.push(...sMatch);
9645
+ if (lMatch) results.push(...lMatch);
9646
+ } else {
9647
+ const found = (inst.shadowRoot || inst).querySelectorAll(selector);
9648
+ if (found) results.push(...found);
9649
+ }
9650
+ }
9651
+ }
9652
+ return results;
9653
+ };
9654
+ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
9655
+ return (target, propertyKey, descriptor) => {
9656
+ const constructor = target.constructor;
9657
+ const metaType = descriptor && typeof descriptor.value === "function" ? "method" : "property";
9658
+ let finalOptions = {};
9659
+ let targetPropertyKey;
9660
+ if (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol") {
9661
+ targetPropertyKey = targetPropertyKeyOrOptions;
9662
+ finalOptions = options || {};
9663
+ } else if (targetPropertyKeyOrOptions) {
9664
+ finalOptions = targetPropertyKeyOrOptions;
9665
+ targetPropertyKey = finalOptions.name || propertyKey;
9666
+ } else {
9667
+ targetPropertyKey = propertyKey;
9668
+ }
9669
+ let metaList = ReflectUtils.getOwnMetadata(PROPERTY_METADATA_KEY, constructor);
9670
+ if (!metaList) {
9671
+ metaList = [];
9672
+ ReflectUtils.defineMetadata(PROPERTY_METADATA_KEY, metaList, constructor);
9673
+ }
9674
+ metaList.push({
9675
+ propertyKey,
9676
+ selector,
9677
+ targetPropertyKey,
9678
+ options: finalOptions,
9679
+ type: metaType
9680
+ });
9681
+ const applyValueToTargets = (inst, resolvedValue) => {
9682
+ if (resolvedValue === void 0) return resolvedValue;
9683
+ const targetEls = resolvePropertyTargets(inst, selector, finalOptions);
9684
+ const conf = getElementConfig(inst);
9685
+ const currentWin = conf.window;
9686
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);
9687
+ targetEls.forEach((targetEl) => {
9688
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {
9689
+ return;
9690
+ }
9691
+ const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
9692
+ targetEl[targetPropertyKey] = resolvedRes;
9693
+ });
9694
+ return resolvedValue;
9695
+ };
9696
+ if (descriptor && typeof descriptor.value === "function") {
9697
+ const original = descriptor.value;
9698
+ descriptor.value = function(...args) {
9699
+ ensureInit(this);
9700
+ const res = original.apply(this, args);
9701
+ if (res instanceof Promise) {
9702
+ return res.then((v) => {
9703
+ applyValueToTargets(this, v);
9704
+ return v;
9705
+ });
9706
+ } else {
9707
+ applyValueToTargets(this, res);
9708
+ return res;
9709
+ }
9710
+ };
9711
+ return;
9712
+ }
9713
+ Object.defineProperty(target, propertyKey, {
9714
+ configurable: true,
9715
+ enumerable: true,
9716
+ get() {
9717
+ ensureInit(this);
9718
+ const targetEls = resolvePropertyTargets(this, selector, finalOptions);
9719
+ const conf = getElementConfig(this);
9720
+ const currentWin = conf.window;
9721
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
9722
+ const filtered = targetEls.filter((el) => {
9723
+ if (finalOptions.filter && !finalOptions.filter(el, el[targetPropertyKey], { currentThis: this, helper: hostSet })) {
9724
+ return false;
9725
+ }
9726
+ return true;
9727
+ });
9728
+ const values = filtered.map((el) => el[targetPropertyKey]);
9729
+ return values.length === 1 ? values[0] : values;
9730
+ },
9731
+ set(value) {
9732
+ ensureInit(this);
9733
+ applyValueToTargets(this, value);
9734
+ }
9735
+ });
9736
+ };
9737
+ }
9738
+ function property(selector, targetPropertyKeyOrOptions, options) {
9739
+ return applyProperty(selector, targetPropertyKeyOrOptions, options);
9740
+ }
9741
+ function propertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
9742
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
9743
+ return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
9744
+ }
9745
+ if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
9746
+ return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
9747
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
9748
+ return applyProperty("$this", void 0, targetOrOptions);
9749
+ } else {
9750
+ return applyProperty("$this", void 0, {});
9751
+ }
9752
+ }
9753
+ function setProperty(selector, targetPropertyKeyOrOptions, options) {
9754
+ return applyProperty(selector, targetPropertyKeyOrOptions, options);
9755
+ }
9756
+ function setPropertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
9757
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
9758
+ return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
9759
+ }
9760
+ if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
9761
+ return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
9762
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
9763
+ return applyProperty("$this", void 0, targetOrOptions);
9764
+ } else {
9765
+ return applyProperty("$this", void 0, {});
9766
+ }
9767
+ }
9768
+ var findAllPropertyMetadata = (target) => {
9769
+ const actualTarget = target instanceof Function ? target : target.constructor;
9770
+ return ReflectUtils.findAllMetadata(PROPERTY_METADATA_KEY, actualTarget).flat();
9771
+ };
9772
+ var findAllPropertyApplyMetadata = (target) => {
9773
+ const result = /* @__PURE__ */ new Map();
9774
+ findAllPropertyMetadata(target).forEach((meta) => {
9775
+ result.set(meta.propertyKey, meta);
9776
+ });
9777
+ return result;
9778
+ };
9779
+
9816
9780
  // src/decorators/elementDefine.ts
9817
9781
  var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
9818
9782
  var getElementConfig = (target) => {
@@ -9826,13 +9790,12 @@ var dooboostoreSimpleWebComponent = (() => {
9826
9790
  inst._boundListeners = [];
9827
9791
  inst.__swc_initialized = true;
9828
9792
  const target = inst instanceof Function ? inst : inst.constructor;
9829
- const attributeList = findAllAttributeMetadata(target);
9830
- attributeList.forEach((meta) => {
9831
- const initUserData = inst[meta.propertyKey];
9832
- delete inst[meta.propertyKey];
9833
- if (initUserData !== void 0)
9834
- inst[meta.propertyKey] = initUserData;
9835
- });
9793
+ const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
9794
+ if (attributeAllList) {
9795
+ attributeAllList.forEach((meta) => {
9796
+ delete inst[meta.propertyKey];
9797
+ });
9798
+ }
9836
9799
  const queryList = getQueryMetadata(target);
9837
9800
  if (queryList) {
9838
9801
  queryList.forEach((meta) => {
@@ -9845,9 +9808,9 @@ var dooboostoreSimpleWebComponent = (() => {
9845
9808
  delete inst[meta.propertyKey];
9846
9809
  });
9847
9810
  }
9848
- const slotAllList = findAllApplySlotMetadata(target);
9849
- if (slotAllList) {
9850
- slotAllList.filter((it) => it.type === "property").forEach((meta) => {
9811
+ const propertyAllList = findAllPropertyMetadata(target).filter((it) => it.type === "property");
9812
+ if (propertyAllList) {
9813
+ propertyAllList.forEach((meta) => {
9851
9814
  delete inst[meta.propertyKey];
9852
9815
  });
9853
9816
  }
@@ -9904,24 +9867,6 @@ var dooboostoreSimpleWebComponent = (() => {
9904
9867
  var setupPrototype = (proto, win) => {
9905
9868
  if (proto.__swc_proto_setup) return;
9906
9869
  proto.__swc_proto_setup = true;
9907
- proto.createSlotString = function(id) {
9908
- return NodeSlot.slot(`${this._swcId}-${id}`);
9909
- };
9910
- proto.createEaHtml = function(id, script) {
9911
- return ElementApply.html(id, script);
9912
- };
9913
- proto.createEaText = function(id, script) {
9914
- return ElementApply.text(id, script);
9915
- };
9916
- proto.createEaAttribute = function(id, name, script) {
9917
- return ElementApply.attribute(id, name, script);
9918
- };
9919
- proto.createEaEvent = function(id, name, script) {
9920
- return ElementApply.event(id, name, script);
9921
- };
9922
- proto.createEaProperty = function(id, name, script) {
9923
- return ElementApply.property(id, name, script);
9924
- };
9925
9870
  proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
9926
9871
  ensureInit(this);
9927
9872
  const script = this.getAttribute(attrName);
@@ -10051,8 +9996,8 @@ var dooboostoreSimpleWebComponent = (() => {
10051
9996
  const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
10052
9997
  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"];
10053
9998
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
10054
- const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
10055
- const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
9999
+ const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.targetAttributeName).filter(Boolean);
10000
+ const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.propertyKey || String(it.propertyKey));
10056
10001
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
10057
10002
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
10058
10003
  const proto = constructor.prototype;
@@ -10379,8 +10324,8 @@ var dooboostoreSimpleWebComponent = (() => {
10379
10324
  return constructor;
10380
10325
  };
10381
10326
 
10382
- // src/decorators/attribute.ts
10383
- var ATTRIBUTE_FIELD_METADATA_KEY = Symbol.for("simple-web-component:attribute-field");
10327
+ // src/decorators/applyAttribute.ts
10328
+ var ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
10384
10329
  var convertValue2 = (val, type) => {
10385
10330
  if (val === null || val === void 0) return val;
10386
10331
  if (type === Number) return Number(val);
@@ -10390,7 +10335,7 @@ var dooboostoreSimpleWebComponent = (() => {
10390
10335
  var getAttributeValue = (inst, attrName, options) => {
10391
10336
  const conf = getElementConfig(inst);
10392
10337
  const currentWin = inst._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
10393
- const targets = options?.selector ? resolveTargetEls(inst, options.selector, options, currentWin) : [inst];
10338
+ const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];
10394
10339
  const primaryTarget = targets[0];
10395
10340
  if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
10396
10341
  let domVal = primaryTarget.getAttribute(attrName);
@@ -10404,8 +10349,8 @@ var dooboostoreSimpleWebComponent = (() => {
10404
10349
  args: SwcUtils.getHelperAndHostSet(currentWin, inst)
10405
10350
  });
10406
10351
  return convertValue2(result, options?.type);
10407
- } catch (e) {
10408
- console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, e);
10352
+ } catch (err) {
10353
+ console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);
10409
10354
  return convertValue2(domVal, options?.type);
10410
10355
  }
10411
10356
  }
@@ -10413,7 +10358,9 @@ var dooboostoreSimpleWebComponent = (() => {
10413
10358
  }
10414
10359
  return null;
10415
10360
  };
10416
- var resolveTargetEls = (inst, selector, options, currentWin) => {
10361
+ var resolveAttributeTargets = (inst, selector, options) => {
10362
+ const conf = getElementConfig(inst);
10363
+ const currentWin = conf.window;
10417
10364
  const r = options.root || "auto";
10418
10365
  const results = [];
10419
10366
  const applyRoot = (target) => {
@@ -10427,10 +10374,6 @@ var dooboostoreSimpleWebComponent = (() => {
10427
10374
  };
10428
10375
  if (selector === "$this" || !selector) {
10429
10376
  applyRoot(inst);
10430
- } else if (selector === "$window") {
10431
- results.push(currentWin);
10432
- } else if (selector === "$document") {
10433
- results.push(currentWin.document);
10434
10377
  } else {
10435
10378
  const hostSet = SwcUtils.getHostSet(inst);
10436
10379
  if (selector === "$host") applyRoot(hostSet.$host);
@@ -10440,6 +10383,8 @@ var dooboostoreSimpleWebComponent = (() => {
10440
10383
  else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
10441
10384
  else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
10442
10385
  else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
10386
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
10387
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
10443
10388
  else {
10444
10389
  if (r === "shadow") {
10445
10390
  const found = inst.shadowRoot?.querySelectorAll(selector);
@@ -10460,133 +10405,168 @@ var dooboostoreSimpleWebComponent = (() => {
10460
10405
  }
10461
10406
  return results;
10462
10407
  };
10463
- function attribute(selector, options = {}) {
10464
- return (target, propertyKey) => {
10408
+ function applyAttribute(selector, targetAttributeNameOrOptions, options) {
10409
+ return (target, propertyKey, descriptor) => {
10465
10410
  const constructor = target.constructor;
10466
- const privateKey = Symbol(String(propertyKey));
10467
10411
  const designType = Reflect.getMetadata("design:type", target, propertyKey);
10468
- let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_FIELD_METADATA_KEY, constructor);
10412
+ const metaType = descriptor && typeof descriptor.value === "function" ? "method" : "property";
10413
+ let finalOptions = {};
10414
+ let targetAttributeName;
10415
+ if (typeof targetAttributeNameOrOptions === "string") {
10416
+ targetAttributeName = targetAttributeNameOrOptions;
10417
+ finalOptions = options || {};
10418
+ } else if (targetAttributeNameOrOptions) {
10419
+ finalOptions = targetAttributeNameOrOptions;
10420
+ targetAttributeName = finalOptions.name || String(propertyKey);
10421
+ } else {
10422
+ targetAttributeName = String(propertyKey);
10423
+ }
10424
+ let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor);
10469
10425
  if (!metaList) {
10470
10426
  metaList = [];
10471
- ReflectUtils.defineMetadata(ATTRIBUTE_FIELD_METADATA_KEY, metaList, constructor);
10472
- }
10473
- metaList.push({ propertyKey, selector, options, privateKey });
10474
- const applySetAttribute = (inst, targets, attrName, nv) => {
10475
- targets.forEach((it) => {
10476
- if (it && typeof it.setAttribute === "function") {
10477
- if (nv === null) {
10478
- it.removeAttribute(attrName);
10479
- } else {
10480
- it.setAttribute(attrName, String(nv));
10481
- }
10482
- } else {
10483
- inst[privateKey] = nv;
10427
+ ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);
10428
+ }
10429
+ metaList.push({
10430
+ propertyKey,
10431
+ selector,
10432
+ targetAttributeName,
10433
+ options: finalOptions,
10434
+ type: metaType
10435
+ });
10436
+ const applyValueToTargets = (inst, resolvedValue) => {
10437
+ const conf = getElementConfig(inst);
10438
+ const currentWin = conf.window;
10439
+ const targetEls = resolveAttributeTargets(inst, selector, finalOptions);
10440
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);
10441
+ targetEls.forEach((targetEl) => {
10442
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {
10443
+ return;
10444
+ }
10445
+ if (resolvedValue === null) {
10446
+ targetEl.removeAttribute(targetAttributeName);
10447
+ } else if (resolvedValue !== void 0) {
10448
+ targetEl.setAttribute(targetAttributeName, resolvedValue === true ? "" : String(resolvedValue));
10484
10449
  }
10485
10450
  });
10451
+ return resolvedValue;
10486
10452
  };
10487
- try {
10488
- Object.defineProperty(target, propertyKey, {
10489
- get() {
10490
- const attrName = options.name || String(propertyKey);
10491
- const mergedOptions = {
10492
- ...options,
10493
- selector,
10494
- type: options.type || designType
10495
- };
10496
- const result = getAttributeValue(this, attrName, mergedOptions);
10497
- return result !== null ? result : this[privateKey];
10498
- },
10499
- set(nv) {
10500
- const attrName = options.name || String(propertyKey);
10501
- const conf = getElementConfig(this);
10502
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
10503
- const targets = resolveTargetEls(this, selector, options, currentWin);
10504
- applySetAttribute(this, targets, attrName, nv);
10505
- },
10506
- enumerable: true,
10507
- configurable: true
10508
- });
10509
- } catch (err) {
10510
- console.error("[SWC] defineProperty error:", err);
10453
+ if (descriptor && typeof descriptor.value === "function") {
10454
+ const original = descriptor.value;
10455
+ descriptor.value = function(...args) {
10456
+ ensureInit(this);
10457
+ const res = original.apply(this, args);
10458
+ if (res instanceof Promise) {
10459
+ return res.then((v) => {
10460
+ applyValueToTargets(this, v);
10461
+ return v;
10462
+ });
10463
+ } else {
10464
+ applyValueToTargets(this, res);
10465
+ return res;
10466
+ }
10467
+ };
10468
+ return;
10511
10469
  }
10470
+ Object.defineProperty(target, propertyKey, {
10471
+ configurable: true,
10472
+ enumerable: true,
10473
+ get() {
10474
+ ensureInit(this);
10475
+ const mergedOptions = { ...finalOptions, selector, type: finalOptions.type || designType };
10476
+ return getAttributeValue(this, targetAttributeName, mergedOptions);
10477
+ },
10478
+ set(value) {
10479
+ ensureInit(this);
10480
+ if (value instanceof Promise) {
10481
+ value.then((v) => applyValueToTargets(this, v)).catch(() => {
10482
+ });
10483
+ } else {
10484
+ applyValueToTargets(this, value);
10485
+ }
10486
+ }
10487
+ });
10512
10488
  };
10513
10489
  }
10514
- function attributeThis(targetOrAttrOrOptions, propertyKeyOrOptions) {
10515
- if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
10516
- return attribute("$this", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
10517
- }
10518
- if (typeof targetOrAttrOrOptions === "string") {
10519
- const attrName = targetOrAttrOrOptions;
10520
- const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
10521
- return attribute("$this", { ...options, name: attrName });
10522
- } else if (typeof targetOrAttrOrOptions === "object") {
10523
- const options = targetOrAttrOrOptions;
10524
- return (target, propertyKey) => {
10525
- return attribute("$this", { ...options, name: String(propertyKey) })(target, propertyKey);
10526
- };
10490
+ function attribute(selector, targetAttributeNameOrOptions, options) {
10491
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
10492
+ }
10493
+ function attributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
10494
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") {
10495
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
10496
+ }
10497
+ if (typeof targetOrOptions === "string") {
10498
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
10499
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
10500
+ return applyAttribute("$this", void 0, targetOrOptions);
10527
10501
  } else {
10528
- return (target, propertyKey) => {
10529
- return attribute("$this", { name: String(propertyKey) })(target, propertyKey);
10530
- };
10502
+ return applyAttribute("$this", void 0, {});
10503
+ }
10504
+ }
10505
+ function setAttribute(selector, targetAttributeNameOrOptions, options) {
10506
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
10507
+ }
10508
+ function setAttributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
10509
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
10510
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
10511
+ }
10512
+ if (typeof targetOrOptions === "string") {
10513
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
10514
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
10515
+ return applyAttribute("$this", void 0, targetOrOptions);
10516
+ } else {
10517
+ return applyAttribute("$this", void 0, {});
10531
10518
  }
10532
10519
  }
10533
10520
  var findAllAttributeMetadata = (target) => {
10534
10521
  const actualTarget = target instanceof Function ? target : target.constructor;
10535
- return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, actualTarget).flat();
10522
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, actualTarget).flat();
10523
+ };
10524
+ var findAllAttributeApplyMetadata = (target) => {
10525
+ const result = /* @__PURE__ */ new Map();
10526
+ findAllAttributeMetadata(target).forEach((meta) => {
10527
+ result.set(meta.propertyKey, meta);
10528
+ });
10529
+ return result;
10536
10530
  };
10537
10531
 
10538
10532
  // src/decorators/applyNode.ts
10539
10533
  var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
10540
- var normalizeNodes = (res, doc) => {
10541
- const items = Array.isArray(res) ? res : [res];
10542
- return items.map((it) => {
10543
- if (it instanceof Node) return it;
10544
- return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
10545
- });
10546
- };
10547
10534
  var applyToDom = (currentThis, targetEl, res, pos, win, host) => {
10548
10535
  if (!targetEl) return;
10549
10536
  const doc = win.document;
10550
10537
  const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
10551
10538
  const id = currentThis._swcId;
10552
- try {
10553
- if (typeof res === "string") {
10554
- const processed = SwcUtils.projectProcessHtml(id, res, doc);
10555
- if (processed !== void 0) res = processed;
10556
- } else if (res) {
10557
- SwcUtils.projectProcessHtml(id, res, doc);
10558
- }
10559
- } catch (e) {
10560
- }
10561
- if (pos === "innerHtml") {
10562
- targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
10563
- return;
10564
- }
10565
- if (pos === "innerText") {
10566
- if (targetEl.innerText !== void 0) {
10567
- targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
10568
- }
10569
- return;
10570
- }
10571
- const stateContext = { ...hostSet };
10572
- findAllStateMetadata(currentThis).forEach((it) => {
10573
- stateContext[it.name] = currentThis[it.propertyKey];
10574
- });
10575
- new ElementApply(currentThis, { id: currentThis._swcId }).apply({ target: "noInitialized", context: stateContext, bind: currentThis });
10539
+ const nodes = [];
10540
+ if (typeof res === "string" && pos === "innerHtml") {
10541
+ const t = win.document.createElement("template");
10542
+ t.innerHTML = res;
10543
+ nodes.push(...Array.from(t.content.childNodes));
10544
+ } else if (typeof res === "string" && pos === "innerText") {
10545
+ nodes.push(win.document.createTextNode(res));
10546
+ }
10547
+ SwcUtils.projectProcessHtml(id, nodes, doc);
10576
10548
  const isShadowRoot = targetEl instanceof win.ShadowRoot;
10577
- const nodes = normalizeNodes(res, doc);
10578
10549
  if (pos === "replace") {
10579
10550
  if (!isShadowRoot) targetEl.replaceWith(...nodes);
10551
+ } else if (pos === "innerHtml") {
10552
+ targetEl.replaceChildren(...nodes);
10553
+ } else if (pos === "innerText") {
10554
+ targetEl.replaceChildren(...nodes);
10580
10555
  } else if (pos === "replaceChildren") {
10581
10556
  targetEl.replaceChildren(...nodes);
10582
10557
  } else {
10583
10558
  if (pos === "beforeEnd") {
10584
- console.log("tarbbbbbbbbbbbbbb");
10585
10559
  targetEl.append(...nodes);
10586
10560
  } else if (pos === "afterBegin") targetEl.prepend(...nodes);
10587
10561
  else if (pos === "beforeBegin" && !isShadowRoot) targetEl.before(...nodes);
10588
10562
  else if (pos === "afterEnd" && !isShadowRoot) targetEl.after(...nodes);
10589
10563
  }
10564
+ const stateContext = { ...hostSet };
10565
+ findAllStateMetadata(currentThis).forEach((it) => {
10566
+ stateContext[it.name] = currentThis[it.propertyKey];
10567
+ });
10568
+ new ElementApply(targetEl, { id }).apply({ target: "noInitialized", context: stateContext, bind: currentThis });
10569
+ return nodes;
10590
10570
  };
10591
10571
  function applyNode(selector, options = { position: "replaceChildren" }) {
10592
10572
  return (targetObj, propertyKey, descriptor) => {
@@ -10623,7 +10603,6 @@ var dooboostoreSimpleWebComponent = (() => {
10623
10603
  const targetRoot = applyRoot(this);
10624
10604
  return targetRoot ? targetRoot.querySelector(selector) : null;
10625
10605
  };
10626
- console.log("fffffffffff");
10627
10606
  const targetEl = getTarget();
10628
10607
  const res = original.apply(this, args);
10629
10608
  const runApply = (target, val) => {
@@ -10633,13 +10612,14 @@ var dooboostoreSimpleWebComponent = (() => {
10633
10612
  applyToDom(this, target, processedVal, pos, currentWin);
10634
10613
  }
10635
10614
  };
10615
+ const fallbackNodes = [];
10616
+ if (targetEl && options.fallback) {
10617
+ const loadingRes = options.fallback.call(this, hostSet);
10618
+ fallbackNodes.push(...applyToDom(this, targetEl, loadingRes, options.position || "beforeEnd", currentWin));
10619
+ }
10636
10620
  if (res instanceof Promise) {
10637
- if (targetEl && options.fallback) {
10638
- const loadingRes = options.fallback.call(this, hostSet);
10639
- applyToDom(this, targetEl, loadingRes, options.position || "beforeEnd", currentWin);
10640
- }
10641
10621
  return res.then((finalRes) => {
10642
- console.log("amnkj");
10622
+ fallbackNodes.forEach((it) => it.remove());
10643
10623
  if (finalRes !== void 0 && targetEl) runApply(targetEl, finalRes);
10644
10624
  return finalRes;
10645
10625
  });
@@ -10650,91 +10630,103 @@ var dooboostoreSimpleWebComponent = (() => {
10650
10630
  };
10651
10631
  };
10652
10632
  }
10653
- var findAllApplyNodeMetadata = (target) => {
10654
- const result = /* @__PURE__ */ new Map();
10655
- const maps = ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
10656
- maps.forEach((map) => {
10657
- if (map instanceof Map) {
10658
- map.forEach((v, k) => result.set(k, v));
10659
- }
10660
- });
10661
- return result;
10662
- };
10663
10633
  function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
10664
10634
  const option = { position: "replaceChildren" };
10665
10635
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10666
10636
  const opt = targetOrOptions || {};
10667
10637
  return applyNode("$this", { ...option, ...opt });
10668
10638
  }
10669
- function applyNodeThisReplaceChildren(targetOrOptions, propertyKey, descriptor) {
10639
+ function replaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
10670
10640
  const option = { position: "replaceChildren" };
10671
10641
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10672
10642
  const opt = targetOrOptions || {};
10673
10643
  return applyNode("$this", { ...opt, ...option });
10674
10644
  }
10675
- function applyNodeThisReplaceChildrenLightDom(targetOrOptions, propertyKey, descriptor) {
10676
- const options = { position: "replaceChildren", root: "light" };
10677
- if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
10678
- const opt = targetOrOptions || {};
10679
- return applyNode("$this", { ...opt, ...options });
10680
- }
10681
- function applyNodeThisBeforeEnd(targetOrOptions, propertyKey, descriptor) {
10645
+ function beforeEndNodeThis(targetOrOptions, propertyKey, descriptor) {
10682
10646
  const options = { position: "beforeEnd" };
10683
10647
  if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
10684
10648
  const opt = targetOrOptions || {};
10685
10649
  return applyNode("$this", { ...opt, ...options });
10686
10650
  }
10687
- function applyNodeThisBeforeEndLightDom(targetOrOptions, propertyKey, descriptor) {
10651
+ function beforeEndLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10688
10652
  const option = { position: "beforeEnd", root: "light" };
10689
10653
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10690
10654
  const opt = targetOrOptions || {};
10691
10655
  return applyNode("$this", { ...opt, ...option });
10692
10656
  }
10693
- function applyNodeThisBeforeEndShadow(targetOrOptions, propertyKey, descriptor) {
10657
+ function beforeEndShadowNodeThis(targetOrOptions, propertyKey, descriptor) {
10694
10658
  const option = { position: "beforeEnd", root: "shadow" };
10695
10659
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10696
10660
  const opt = targetOrOptions || {};
10697
10661
  return applyNode("$this", { ...opt, ...option });
10698
10662
  }
10699
- function applyNodeThisAfterBegin(targetOrOptions, propertyKey, descriptor) {
10663
+ function afterBeginNodeThis(targetOrOptions, propertyKey, descriptor) {
10700
10664
  const option = { position: "afterBegin" };
10701
10665
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10702
10666
  const opt = targetOrOptions || {};
10703
10667
  return applyNode("$this", { ...opt, ...option });
10704
10668
  }
10705
- function applyNodeThisAfterBeginLightDom(targetOrOptions, propertyKey, descriptor) {
10669
+ function afterBeginLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10706
10670
  const option = { position: "afterBegin", root: "light" };
10707
10671
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10708
10672
  const opt = targetOrOptions || {};
10709
10673
  return applyNode("$this", { ...opt, ...option });
10710
10674
  }
10711
- function applyThisInnerHtmlNode(targetOrOptions, propertyKey, descriptor) {
10675
+ function innerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
10712
10676
  const option = { position: "innerHtml" };
10713
10677
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10714
10678
  const opt = targetOrOptions || {};
10715
10679
  return applyNode("$this", { ...opt, ...option });
10716
10680
  }
10717
- function applyThisInnerHtmlNodeLightDom(targetOrOptions, propertyKey, descriptor) {
10681
+ function innerTextNodeThis(targetOrOptions, propertyKey, descriptor) {
10682
+ const option = { position: "innerText" };
10683
+ if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10684
+ const opt = targetOrOptions || {};
10685
+ return applyNode("$this", { ...opt, ...option });
10686
+ }
10687
+ function innerHtmlLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10718
10688
  const option = { position: "innerHtml", root: "light" };
10719
10689
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10720
10690
  const opt = targetOrOptions || {};
10721
10691
  return applyNode("$this", { ...opt, ...option });
10722
10692
  }
10723
- function applyThisReplaceChildrenNodeLightDom(targetOrOptions, propertyKey, descriptor) {
10693
+ function replaceChildrenLightNodeThis(targetOrOptions, propertyKey, descriptor) {
10724
10694
  const option = { position: "replaceChildren", root: "light" };
10725
10695
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
10726
10696
  const opt = targetOrOptions || {};
10727
10697
  return applyNode("$this", { ...opt, ...option });
10728
10698
  }
10729
- function applyNodeReplaceChildren(selector, options = {}) {
10699
+ function replaceChildrenNode(selector, options = {}) {
10730
10700
  return applyNode(selector, { ...options, position: "replaceChildren" });
10731
10701
  }
10732
- function applyNodeInnerHtml(selector, options = {}) {
10702
+ function innerHtmlNode(selector, options = {}) {
10733
10703
  return applyNode(selector, { ...options, position: "innerHtml" });
10734
10704
  }
10735
- function applyNodeInnerText(selector, options = {}) {
10705
+ function innerHtmlLightNode(selector, options = {}) {
10706
+ return applyNode(selector, { ...options, position: "innerHtml", root: "light" });
10707
+ }
10708
+ function innerHtmlShadowNode(selector, options = {}) {
10709
+ return applyNode(selector, { ...options, position: "innerHtml", root: "shadow" });
10710
+ }
10711
+ function innerTextNode(selector, options = {}) {
10736
10712
  return applyNode(selector, { ...options, position: "innerText" });
10737
10713
  }
10714
+ function innerTextLightNode(selector, options = {}) {
10715
+ return applyNode(selector, { ...options, position: "innerText", root: "light" });
10716
+ }
10717
+ function innerTextShadowNode(selector, options = {}) {
10718
+ return applyNode(selector, { ...options, position: "innerText", root: "shadow" });
10719
+ }
10720
+ var findAllApplyNodeMetadata = (target) => {
10721
+ const result = /* @__PURE__ */ new Map();
10722
+ const maps = ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
10723
+ maps.forEach((map) => {
10724
+ if (map instanceof Map) {
10725
+ map.forEach((v, k) => result.set(k, v));
10726
+ }
10727
+ });
10728
+ return result;
10729
+ };
10738
10730
 
10739
10731
  // src/decorators/applyClass.ts
10740
10732
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
@@ -10987,89 +10979,6 @@ var dooboostoreSimpleWebComponent = (() => {
10987
10979
  return result;
10988
10980
  };
10989
10981
 
10990
- // src/decorators/setProperty.ts
10991
- var PROPERTY_SET_METADATA_KEY = Symbol.for("simple-web-component:property-set");
10992
- var setProperty = (selector, propertyNameOrOptions, options = {}) => {
10993
- return (target, propertyKey, descriptor) => {
10994
- const constructor = target.constructor;
10995
- let metaList = ReflectUtils.getOwnMetadata(PROPERTY_SET_METADATA_KEY, constructor);
10996
- if (!metaList) {
10997
- metaList = /* @__PURE__ */ new Map();
10998
- ReflectUtils.defineMetadata(PROPERTY_SET_METADATA_KEY, metaList, constructor);
10999
- }
11000
- let propertyName = typeof propertyNameOrOptions === "string" ? propertyNameOrOptions : void 0;
11001
- let finalOptions = options;
11002
- if (typeof propertyNameOrOptions === "object" && propertyNameOrOptions !== null) {
11003
- finalOptions = propertyNameOrOptions;
11004
- }
11005
- metaList.set(propertyKey, {
11006
- propertyKey,
11007
- selector,
11008
- options: { ...finalOptions, name: propertyName }
11009
- });
11010
- const original = descriptor.value;
11011
- descriptor.value = function(...args) {
11012
- ensureInit(this);
11013
- const res = original.apply(this, args);
11014
- const handleResult = (resolvedValue) => {
11015
- if (resolvedValue !== void 0) {
11016
- const win = this.ownerDocument?.defaultView || window;
11017
- const host = this;
11018
- const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
11019
- const r = finalOptions.root || "auto";
11020
- const targetEls = [];
11021
- const applyRoot = (t) => {
11022
- if (!t || !(t instanceof win.HTMLElement)) return;
11023
- targetEls.push(t);
11024
- };
11025
- if (selector === "$this" || !selector) applyRoot(host);
11026
- else if (selector === "$host") applyRoot(hostSet.$host);
11027
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
11028
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
11029
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
11030
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
11031
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
11032
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
11033
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
11034
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
11035
- else {
11036
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
11037
- if (targetRoot) {
11038
- const found = targetRoot.querySelectorAll(selector);
11039
- if (found) targetEls.push(...Array.from(found));
11040
- }
11041
- }
11042
- targetEls.forEach((targetEl) => {
11043
- if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
11044
- return;
11045
- }
11046
- const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
11047
- if (propertyName) {
11048
- targetEl[propertyName] = resolvedRes;
11049
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
11050
- Object.entries(resolvedRes).forEach(([prop, val]) => {
11051
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
11052
- targetEl[prop] = finalVal;
11053
- });
11054
- } else {
11055
- targetEl.value = resolvedRes;
11056
- }
11057
- });
11058
- }
11059
- return resolvedValue;
11060
- };
11061
- if (res instanceof Promise) {
11062
- return res.then(handleResult);
11063
- } else {
11064
- return handleResult(res);
11065
- }
11066
- };
11067
- };
11068
- };
11069
- var setPropertyThis = (propertyNameOrOptions, options = {}) => {
11070
- return setProperty("$this", propertyNameOrOptions, options);
11071
- };
11072
-
11073
10982
  // src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts
11074
10983
  var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change-while-connected");
11075
10984
  function createSubscribeSwcAppRouteChangeWhileConnected(options) {
@@ -11204,6 +11113,109 @@ var dooboostoreSimpleWebComponent = (() => {
11204
11113
  return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
11205
11114
  };
11206
11115
 
11116
+ // src/decorators/applySlot.ts
11117
+ var APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
11118
+ var applyToDom2 = (swcId, id, pos, nodes) => {
11119
+ const nodeSlot = new NodeSlot(void 0, swcId);
11120
+ if (pos === "replaceChildrenText" || pos === "replaceChildren" || pos === "replaceChildrenHtml") {
11121
+ nodeSlot.replaceChildren(id, ...nodes);
11122
+ } else if (pos === "appendHtml" || pos === "append" || pos === "appendText") {
11123
+ nodeSlot.append(id, ...nodes);
11124
+ } else if (pos === "prependHtml" || pos === "prepend" || pos === "prependText") {
11125
+ nodeSlot.prepend(id, ...nodes);
11126
+ } else if (pos === "clear") {
11127
+ nodeSlot.clear(id);
11128
+ }
11129
+ };
11130
+ function applySlot(targetId, opt) {
11131
+ return (targetObj, propertyKey, descriptor) => {
11132
+ const options = { position: "replaceChildren", ...opt };
11133
+ const constructor = targetObj.constructor;
11134
+ let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
11135
+ if (!metaList) {
11136
+ metaList = [];
11137
+ ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
11138
+ }
11139
+ metaList.push({ propertyKey, targetId, options });
11140
+ const original = descriptor.value;
11141
+ descriptor.value = function(...args) {
11142
+ ensureInit(this);
11143
+ const conf = getElementConfig(this);
11144
+ const currentWin = conf.window;
11145
+ const swcId = this._swcId;
11146
+ const currentDoc = currentWin.document;
11147
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
11148
+ const pos = options.position;
11149
+ const resToNodes = (res2) => {
11150
+ const nodes = [];
11151
+ if (typeof res2 === "string" && (pos === "replaceChildrenHtml" || pos === "appendHtml" || pos === "prependHtml")) {
11152
+ const t = currentWin.document.createElement("template");
11153
+ t.innerHTML = res2;
11154
+ nodes.push(...Array.from(t.content.childNodes));
11155
+ } else if (typeof res2 === "string" && (pos === "replaceChildrenText" || pos === "prependText" || pos === "appendText")) {
11156
+ nodes.push(currentWin.document.createTextNode(res2));
11157
+ } else if (typeof res2 === "object") {
11158
+ nodes.push(res2);
11159
+ }
11160
+ SwcUtils.projectProcessHtml(swcId, nodes, currentDoc);
11161
+ return nodes;
11162
+ };
11163
+ const fallbackNodes = [];
11164
+ if (options.fallback) {
11165
+ const res2 = options.fallback.call(this, hostSet);
11166
+ const nodes = resToNodes(res2);
11167
+ fallbackNodes.push(...nodes);
11168
+ applyToDom2(swcId, targetId, options.position, nodes);
11169
+ }
11170
+ let res = original.apply(this, args);
11171
+ if (res instanceof Promise) {
11172
+ return res.then((asyncRes) => {
11173
+ const nodes = resToNodes(asyncRes);
11174
+ fallbackNodes.forEach((it) => it.remove());
11175
+ applyToDom2(swcId, targetId, options.position, nodes);
11176
+ });
11177
+ } else {
11178
+ const nodes = resToNodes(res);
11179
+ applyToDom2(swcId, targetId, options.position, nodes);
11180
+ }
11181
+ };
11182
+ };
11183
+ }
11184
+ function clearSlot(targetId) {
11185
+ return applySlot(targetId, { position: "clear" });
11186
+ }
11187
+ function prependHtmlSlot(targetId) {
11188
+ return applySlot(targetId, { position: "prependHtml" });
11189
+ }
11190
+ function prependSlot(targetId) {
11191
+ return applySlot(targetId, { position: "prepend" });
11192
+ }
11193
+ function prependTextSlot(targetId) {
11194
+ return applySlot(targetId, { position: "prependText" });
11195
+ }
11196
+ function appendHtmlSlot(targetId) {
11197
+ return applySlot(targetId, { position: "appendHtml" });
11198
+ }
11199
+ function appendTextSlot(targetId) {
11200
+ return applySlot(targetId, { position: "appendText" });
11201
+ }
11202
+ function appendSlot(targetId) {
11203
+ return applySlot(targetId, { position: "append" });
11204
+ }
11205
+ function replaceChildrenHtmlSlot(targetId) {
11206
+ return applySlot(targetId, { position: "replaceChildrenHtml" });
11207
+ }
11208
+ function replaceChildrenSlot(targetId) {
11209
+ return applySlot(targetId, { position: "replaceChildren" });
11210
+ }
11211
+ function replaceChildrenTextSlot(targetId) {
11212
+ return applySlot(targetId, { position: "replaceChildrenText" });
11213
+ }
11214
+ var findAllApplySlotMetadata = (target) => {
11215
+ const constructor = target instanceof Function ? target : target.constructor;
11216
+ return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
11217
+ };
11218
+
11207
11219
  // ../simple-boot/dist/esm/index.js
11208
11220
  var import_reflect_metadata = __toESM(require_Reflect(), 1);
11209
11221
 
@@ -11351,9 +11363,9 @@ var dooboostoreSimpleWebComponent = (() => {
11351
11363
  }
11352
11364
  };
11353
11365
  var MetaDataPropertyAtomic = class extends MetaDataAtomic {
11354
- constructor(target, metaData, property, parameter) {
11366
+ constructor(target, metaData, property2, parameter) {
11355
11367
  super(target, metaData);
11356
- this.property = property;
11368
+ this.property = property2;
11357
11369
  this.parameter = parameter;
11358
11370
  }
11359
11371
  call(...parameter) {