@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.
- package/LICENSE.md +7 -0
- package/README.md +235 -47
- package/dist/cjs/SwcAppEngine.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +194 -111
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +58 -43
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +213 -0
- package/dist/cjs/decorators/applyProperty.js.map +7 -0
- package/dist/cjs/decorators/applySlot.js +32 -26
- package/dist/cjs/decorators/applySlot.js.map +2 -2
- package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
- package/dist/cjs/decorators/elementDefine.js +17 -30
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/index.js +2 -2
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +4 -4
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcApp.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +11 -4
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/SwcAppEngine.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +196 -113
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +58 -43
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +194 -0
- package/dist/esm/decorators/applyProperty.js.map +7 -0
- package/dist/esm/decorators/applySlot.js +32 -26
- package/dist/esm/decorators/applySlot.js.map +2 -2
- package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
- package/dist/esm/decorators/elementDefine.js +17 -30
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/index.js +2 -2
- package/dist/esm/decorators/index.js.map +1 -1
- package/dist/esm/decorators/lifecycles.js +4 -4
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcApp.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +11 -4
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +441 -401
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +56 -15
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +28 -24
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +61 -0
- package/dist/types/decorators/applyProperty.d.ts.map +1 -0
- package/dist/types/decorators/applySlot.d.ts +10 -10
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +2 -2
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +4 -4
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/elements/SwcApp.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -6
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +441 -401
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +3 -3
- package/src/SwcAppEngine.ts +1 -0
- package/src/decorators/applyAttribute.ts +311 -126
- package/src/decorators/applyNode.ts +68 -57
- package/src/decorators/applyProperty.ts +302 -0
- package/src/decorators/applySlot.ts +25 -18
- package/src/decorators/changedAttributeThis.ts +1 -1
- package/src/decorators/elementDefine.ts +41 -30
- package/src/decorators/index.ts +2 -3
- package/src/decorators/lifecycles.ts +6 -6
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +14 -4
- package/src/elements/SwcApp.ts +0 -1
- package/src/elements/SwcAppMixin.ts +16 -4
- package/src/types/index.ts +7 -7
- package/dist/cjs/decorators/attribute.js +0 -187
- package/dist/cjs/decorators/attribute.js.map +0 -7
- package/dist/cjs/decorators/setProperty.js +0 -109
- package/dist/cjs/decorators/setProperty.js.map +0 -7
- package/dist/esm/decorators/attribute.js +0 -168
- package/dist/esm/decorators/attribute.js.map +0 -7
- package/dist/esm/decorators/setProperty.js +0 -90
- package/dist/esm/decorators/setProperty.js.map +0 -7
- package/dist/types/decorators/attribute.d.ts +0 -31
- package/dist/types/decorators/attribute.d.ts.map +0 -1
- package/dist/types/decorators/setProperty.d.ts +0 -17
- package/dist/types/decorators/setProperty.d.ts.map +0 -1
- package/src/decorators/attribute.ts +0 -223
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1192
|
-
applyNodeThisAfterBeginLightDom: () => applyNodeThisAfterBeginLightDom,
|
|
1193
|
-
applyNodeThisBeforeEnd: () => applyNodeThisBeforeEnd,
|
|
1194
|
-
applyNodeThisBeforeEndLightDom: () => applyNodeThisBeforeEndLightDom,
|
|
1195
|
-
applyNodeThisBeforeEndShadow: () => applyNodeThisBeforeEndShadow,
|
|
1196
|
-
applyNodeThisInnerHtml: () => applyNodeThisInnerHtml,
|
|
1197
|
-
applyNodeThisReplaceChildren: () => applyNodeThisReplaceChildren,
|
|
1198
|
-
applyNodeThisReplaceChildrenLightDom: () => applyNodeThisReplaceChildrenLightDom,
|
|
1191
|
+
applyProperty: () => applyProperty,
|
|
1199
1192
|
applySlot: () => applySlot,
|
|
1200
|
-
applySlotAppend: () => applySlotAppend,
|
|
1201
|
-
applySlotAppendHtml: () => applySlotAppendHtml,
|
|
1202
|
-
applySlotAppendText: () => applySlotAppendText,
|
|
1203
|
-
applySlotClear: () => applySlotClear,
|
|
1204
|
-
applySlotPrepend: () => applySlotPrepend,
|
|
1205
|
-
applySlotPrependHtml: () => applySlotPrependHtml,
|
|
1206
|
-
applySlotPrependText: () => applySlotPrependText,
|
|
1207
|
-
applySlotReplaceChildren: () => applySlotReplaceChildren,
|
|
1208
|
-
applySlotReplaceChildrenHtml: () => applySlotReplaceChildrenHtml,
|
|
1209
|
-
applySlotReplaceChildrenText: () => applySlotReplaceChildrenText,
|
|
1210
1193
|
applyStyle: () => applyStyle,
|
|
1211
1194
|
applyStyleThis: () => applyStyleThis,
|
|
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
|
-
|
|
1280
|
-
|
|
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
|
-
|
|
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
|
|
4437
|
-
obj[
|
|
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
|
|
4472
|
-
const value = object_o[
|
|
4475
|
+
for (const property2 in object_o) {
|
|
4476
|
+
const value = object_o[property2];
|
|
4473
4477
|
if (value) {
|
|
4474
|
-
results.push(
|
|
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,
|
|
6218
|
-
if (typeof func === "object" &&
|
|
6219
|
-
func = func[
|
|
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
|
|
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
|
|
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 = {}) {
|
|
@@ -9720,6 +9598,185 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9720
9598
|
return ReflectUtils.getMetadata(STATE_METADATA_KEY, constructor) ?? [];
|
|
9721
9599
|
};
|
|
9722
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
|
+
|
|
9723
9780
|
// src/decorators/elementDefine.ts
|
|
9724
9781
|
var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
|
|
9725
9782
|
var getElementConfig = (target) => {
|
|
@@ -9733,13 +9790,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9733
9790
|
inst._boundListeners = [];
|
|
9734
9791
|
inst.__swc_initialized = true;
|
|
9735
9792
|
const target = inst instanceof Function ? inst : inst.constructor;
|
|
9736
|
-
const
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
});
|
|
9793
|
+
const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
|
|
9794
|
+
if (attributeAllList) {
|
|
9795
|
+
attributeAllList.forEach((meta) => {
|
|
9796
|
+
delete inst[meta.propertyKey];
|
|
9797
|
+
});
|
|
9798
|
+
}
|
|
9743
9799
|
const queryList = getQueryMetadata(target);
|
|
9744
9800
|
if (queryList) {
|
|
9745
9801
|
queryList.forEach((meta) => {
|
|
@@ -9752,6 +9808,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9752
9808
|
delete inst[meta.propertyKey];
|
|
9753
9809
|
});
|
|
9754
9810
|
}
|
|
9811
|
+
const propertyAllList = findAllPropertyMetadata(target).filter((it) => it.type === "property");
|
|
9812
|
+
if (propertyAllList) {
|
|
9813
|
+
propertyAllList.forEach((meta) => {
|
|
9814
|
+
delete inst[meta.propertyKey];
|
|
9815
|
+
});
|
|
9816
|
+
}
|
|
9755
9817
|
const stateAllList = findAllStateMetadata(target);
|
|
9756
9818
|
if (stateAllList) {
|
|
9757
9819
|
stateAllList.forEach((meta) => {
|
|
@@ -9805,24 +9867,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9805
9867
|
var setupPrototype = (proto, win) => {
|
|
9806
9868
|
if (proto.__swc_proto_setup) return;
|
|
9807
9869
|
proto.__swc_proto_setup = true;
|
|
9808
|
-
proto.createSlotString = function(id) {
|
|
9809
|
-
return NodeSlot.slot(`${this._swcId}-${id}`);
|
|
9810
|
-
};
|
|
9811
|
-
proto.createEaHtml = function(id, script) {
|
|
9812
|
-
return ElementApply.html(id, script);
|
|
9813
|
-
};
|
|
9814
|
-
proto.createEaText = function(id, script) {
|
|
9815
|
-
return ElementApply.text(id, script);
|
|
9816
|
-
};
|
|
9817
|
-
proto.createEaAttribute = function(id, name, script) {
|
|
9818
|
-
return ElementApply.attribute(id, name, script);
|
|
9819
|
-
};
|
|
9820
|
-
proto.createEaEvent = function(id, name, script) {
|
|
9821
|
-
return ElementApply.event(id, name, script);
|
|
9822
|
-
};
|
|
9823
|
-
proto.createEaProperty = function(id, name, script) {
|
|
9824
|
-
return ElementApply.property(id, name, script);
|
|
9825
|
-
};
|
|
9826
9870
|
proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
|
|
9827
9871
|
ensureInit(this);
|
|
9828
9872
|
const script = this.getAttribute(attrName);
|
|
@@ -9952,8 +9996,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9952
9996
|
const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
|
|
9953
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"];
|
|
9954
9998
|
const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
|
|
9955
|
-
const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.
|
|
9956
|
-
const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.
|
|
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));
|
|
9957
10001
|
const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
|
|
9958
10002
|
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
9959
10003
|
const proto = constructor.prototype;
|
|
@@ -10280,8 +10324,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10280
10324
|
return constructor;
|
|
10281
10325
|
};
|
|
10282
10326
|
|
|
10283
|
-
// src/decorators/
|
|
10284
|
-
var
|
|
10327
|
+
// src/decorators/applyAttribute.ts
|
|
10328
|
+
var ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
|
|
10285
10329
|
var convertValue2 = (val, type) => {
|
|
10286
10330
|
if (val === null || val === void 0) return val;
|
|
10287
10331
|
if (type === Number) return Number(val);
|
|
@@ -10291,7 +10335,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10291
10335
|
var getAttributeValue = (inst, attrName, options) => {
|
|
10292
10336
|
const conf = getElementConfig(inst);
|
|
10293
10337
|
const currentWin = inst._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
10294
|
-
const targets = options?.selector ?
|
|
10338
|
+
const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];
|
|
10295
10339
|
const primaryTarget = targets[0];
|
|
10296
10340
|
if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
|
|
10297
10341
|
let domVal = primaryTarget.getAttribute(attrName);
|
|
@@ -10305,8 +10349,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10305
10349
|
args: SwcUtils.getHelperAndHostSet(currentWin, inst)
|
|
10306
10350
|
});
|
|
10307
10351
|
return convertValue2(result, options?.type);
|
|
10308
|
-
} catch (
|
|
10309
|
-
console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`,
|
|
10352
|
+
} catch (err) {
|
|
10353
|
+
console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);
|
|
10310
10354
|
return convertValue2(domVal, options?.type);
|
|
10311
10355
|
}
|
|
10312
10356
|
}
|
|
@@ -10314,7 +10358,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10314
10358
|
}
|
|
10315
10359
|
return null;
|
|
10316
10360
|
};
|
|
10317
|
-
var
|
|
10361
|
+
var resolveAttributeTargets = (inst, selector, options) => {
|
|
10362
|
+
const conf = getElementConfig(inst);
|
|
10363
|
+
const currentWin = conf.window;
|
|
10318
10364
|
const r = options.root || "auto";
|
|
10319
10365
|
const results = [];
|
|
10320
10366
|
const applyRoot = (target) => {
|
|
@@ -10328,10 +10374,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10328
10374
|
};
|
|
10329
10375
|
if (selector === "$this" || !selector) {
|
|
10330
10376
|
applyRoot(inst);
|
|
10331
|
-
} else if (selector === "$window") {
|
|
10332
|
-
results.push(currentWin);
|
|
10333
|
-
} else if (selector === "$document") {
|
|
10334
|
-
results.push(currentWin.document);
|
|
10335
10377
|
} else {
|
|
10336
10378
|
const hostSet = SwcUtils.getHostSet(inst);
|
|
10337
10379
|
if (selector === "$host") applyRoot(hostSet.$host);
|
|
@@ -10341,6 +10383,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10341
10383
|
else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
|
|
10342
10384
|
else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
10343
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);
|
|
10344
10388
|
else {
|
|
10345
10389
|
if (r === "shadow") {
|
|
10346
10390
|
const found = inst.shadowRoot?.querySelectorAll(selector);
|
|
@@ -10361,79 +10405,128 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10361
10405
|
}
|
|
10362
10406
|
return results;
|
|
10363
10407
|
};
|
|
10364
|
-
function
|
|
10365
|
-
return (target, propertyKey) => {
|
|
10408
|
+
function applyAttribute(selector, targetAttributeNameOrOptions, options) {
|
|
10409
|
+
return (target, propertyKey, descriptor) => {
|
|
10366
10410
|
const constructor = target.constructor;
|
|
10367
|
-
const privateKey = Symbol(String(propertyKey));
|
|
10368
10411
|
const designType = Reflect.getMetadata("design:type", target, propertyKey);
|
|
10369
|
-
|
|
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);
|
|
10370
10425
|
if (!metaList) {
|
|
10371
10426
|
metaList = [];
|
|
10372
|
-
ReflectUtils.defineMetadata(
|
|
10373
|
-
}
|
|
10374
|
-
metaList.push({
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
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));
|
|
10385
10449
|
}
|
|
10386
10450
|
});
|
|
10451
|
+
return resolvedValue;
|
|
10387
10452
|
};
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
const targets = resolveTargetEls(this, selector, options, currentWin);
|
|
10405
|
-
applySetAttribute(this, targets, attrName, nv);
|
|
10406
|
-
},
|
|
10407
|
-
enumerable: true,
|
|
10408
|
-
configurable: true
|
|
10409
|
-
});
|
|
10410
|
-
} catch (err) {
|
|
10411
|
-
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;
|
|
10412
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
|
+
});
|
|
10413
10488
|
};
|
|
10414
10489
|
}
|
|
10415
|
-
function
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
if (typeof
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
return (
|
|
10426
|
-
return attribute("$this", { ...options, name: String(propertyKey) })(target, propertyKey);
|
|
10427
|
-
};
|
|
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);
|
|
10428
10501
|
} else {
|
|
10429
|
-
return (
|
|
10430
|
-
|
|
10431
|
-
|
|
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, {});
|
|
10432
10518
|
}
|
|
10433
10519
|
}
|
|
10434
10520
|
var findAllAttributeMetadata = (target) => {
|
|
10435
10521
|
const actualTarget = target instanceof Function ? target : target.constructor;
|
|
10436
|
-
return ReflectUtils.findAllMetadata(
|
|
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;
|
|
10437
10530
|
};
|
|
10438
10531
|
|
|
10439
10532
|
// src/decorators/applyNode.ts
|
|
@@ -10510,7 +10603,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10510
10603
|
const targetRoot = applyRoot(this);
|
|
10511
10604
|
return targetRoot ? targetRoot.querySelector(selector) : null;
|
|
10512
10605
|
};
|
|
10513
|
-
console.log("fffffffffff");
|
|
10514
10606
|
const targetEl = getTarget();
|
|
10515
10607
|
const res = original.apply(this, args);
|
|
10516
10608
|
const runApply = (target, val) => {
|
|
@@ -10538,91 +10630,103 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10538
10630
|
};
|
|
10539
10631
|
};
|
|
10540
10632
|
}
|
|
10541
|
-
var findAllApplyNodeMetadata = (target) => {
|
|
10542
|
-
const result = /* @__PURE__ */ new Map();
|
|
10543
|
-
const maps = ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
|
|
10544
|
-
maps.forEach((map) => {
|
|
10545
|
-
if (map instanceof Map) {
|
|
10546
|
-
map.forEach((v, k) => result.set(k, v));
|
|
10547
|
-
}
|
|
10548
|
-
});
|
|
10549
|
-
return result;
|
|
10550
|
-
};
|
|
10551
10633
|
function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10552
10634
|
const option = { position: "replaceChildren" };
|
|
10553
10635
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10554
10636
|
const opt = targetOrOptions || {};
|
|
10555
10637
|
return applyNode("$this", { ...option, ...opt });
|
|
10556
10638
|
}
|
|
10557
|
-
function
|
|
10639
|
+
function replaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10558
10640
|
const option = { position: "replaceChildren" };
|
|
10559
10641
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10560
10642
|
const opt = targetOrOptions || {};
|
|
10561
10643
|
return applyNode("$this", { ...opt, ...option });
|
|
10562
10644
|
}
|
|
10563
|
-
function
|
|
10564
|
-
const options = { position: "replaceChildren", root: "light" };
|
|
10565
|
-
if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
|
|
10566
|
-
const opt = targetOrOptions || {};
|
|
10567
|
-
return applyNode("$this", { ...opt, ...options });
|
|
10568
|
-
}
|
|
10569
|
-
function applyNodeThisBeforeEnd(targetOrOptions, propertyKey, descriptor) {
|
|
10645
|
+
function beforeEndNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10570
10646
|
const options = { position: "beforeEnd" };
|
|
10571
10647
|
if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
|
|
10572
10648
|
const opt = targetOrOptions || {};
|
|
10573
10649
|
return applyNode("$this", { ...opt, ...options });
|
|
10574
10650
|
}
|
|
10575
|
-
function
|
|
10651
|
+
function beforeEndLightNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10576
10652
|
const option = { position: "beforeEnd", root: "light" };
|
|
10577
10653
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10578
10654
|
const opt = targetOrOptions || {};
|
|
10579
10655
|
return applyNode("$this", { ...opt, ...option });
|
|
10580
10656
|
}
|
|
10581
|
-
function
|
|
10657
|
+
function beforeEndShadowNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10582
10658
|
const option = { position: "beforeEnd", root: "shadow" };
|
|
10583
10659
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10584
10660
|
const opt = targetOrOptions || {};
|
|
10585
10661
|
return applyNode("$this", { ...opt, ...option });
|
|
10586
10662
|
}
|
|
10587
|
-
function
|
|
10663
|
+
function afterBeginNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10588
10664
|
const option = { position: "afterBegin" };
|
|
10589
10665
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10590
10666
|
const opt = targetOrOptions || {};
|
|
10591
10667
|
return applyNode("$this", { ...opt, ...option });
|
|
10592
10668
|
}
|
|
10593
|
-
function
|
|
10669
|
+
function afterBeginLightNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10594
10670
|
const option = { position: "afterBegin", root: "light" };
|
|
10595
10671
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10596
10672
|
const opt = targetOrOptions || {};
|
|
10597
10673
|
return applyNode("$this", { ...opt, ...option });
|
|
10598
10674
|
}
|
|
10599
|
-
function
|
|
10675
|
+
function innerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10600
10676
|
const option = { position: "innerHtml" };
|
|
10601
10677
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10602
10678
|
const opt = targetOrOptions || {};
|
|
10603
10679
|
return applyNode("$this", { ...opt, ...option });
|
|
10604
10680
|
}
|
|
10605
|
-
function
|
|
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) {
|
|
10606
10688
|
const option = { position: "innerHtml", root: "light" };
|
|
10607
10689
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10608
10690
|
const opt = targetOrOptions || {};
|
|
10609
10691
|
return applyNode("$this", { ...opt, ...option });
|
|
10610
10692
|
}
|
|
10611
|
-
function
|
|
10693
|
+
function replaceChildrenLightNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10612
10694
|
const option = { position: "replaceChildren", root: "light" };
|
|
10613
10695
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10614
10696
|
const opt = targetOrOptions || {};
|
|
10615
10697
|
return applyNode("$this", { ...opt, ...option });
|
|
10616
10698
|
}
|
|
10617
|
-
function
|
|
10699
|
+
function replaceChildrenNode(selector, options = {}) {
|
|
10618
10700
|
return applyNode(selector, { ...options, position: "replaceChildren" });
|
|
10619
10701
|
}
|
|
10620
|
-
function
|
|
10702
|
+
function innerHtmlNode(selector, options = {}) {
|
|
10621
10703
|
return applyNode(selector, { ...options, position: "innerHtml" });
|
|
10622
10704
|
}
|
|
10623
|
-
function
|
|
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 = {}) {
|
|
10624
10712
|
return applyNode(selector, { ...options, position: "innerText" });
|
|
10625
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
|
+
};
|
|
10626
10730
|
|
|
10627
10731
|
// src/decorators/applyClass.ts
|
|
10628
10732
|
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
@@ -10875,89 +10979,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10875
10979
|
return result;
|
|
10876
10980
|
};
|
|
10877
10981
|
|
|
10878
|
-
// src/decorators/setProperty.ts
|
|
10879
|
-
var PROPERTY_SET_METADATA_KEY = Symbol.for("simple-web-component:property-set");
|
|
10880
|
-
var setProperty = (selector, propertyNameOrOptions, options = {}) => {
|
|
10881
|
-
return (target, propertyKey, descriptor) => {
|
|
10882
|
-
const constructor = target.constructor;
|
|
10883
|
-
let metaList = ReflectUtils.getOwnMetadata(PROPERTY_SET_METADATA_KEY, constructor);
|
|
10884
|
-
if (!metaList) {
|
|
10885
|
-
metaList = /* @__PURE__ */ new Map();
|
|
10886
|
-
ReflectUtils.defineMetadata(PROPERTY_SET_METADATA_KEY, metaList, constructor);
|
|
10887
|
-
}
|
|
10888
|
-
let propertyName = typeof propertyNameOrOptions === "string" ? propertyNameOrOptions : void 0;
|
|
10889
|
-
let finalOptions = options;
|
|
10890
|
-
if (typeof propertyNameOrOptions === "object" && propertyNameOrOptions !== null) {
|
|
10891
|
-
finalOptions = propertyNameOrOptions;
|
|
10892
|
-
}
|
|
10893
|
-
metaList.set(propertyKey, {
|
|
10894
|
-
propertyKey,
|
|
10895
|
-
selector,
|
|
10896
|
-
options: { ...finalOptions, name: propertyName }
|
|
10897
|
-
});
|
|
10898
|
-
const original = descriptor.value;
|
|
10899
|
-
descriptor.value = function(...args) {
|
|
10900
|
-
ensureInit(this);
|
|
10901
|
-
const res = original.apply(this, args);
|
|
10902
|
-
const handleResult = (resolvedValue) => {
|
|
10903
|
-
if (resolvedValue !== void 0) {
|
|
10904
|
-
const win = this.ownerDocument?.defaultView || window;
|
|
10905
|
-
const host = this;
|
|
10906
|
-
const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };
|
|
10907
|
-
const r = finalOptions.root || "auto";
|
|
10908
|
-
const targetEls = [];
|
|
10909
|
-
const applyRoot = (t) => {
|
|
10910
|
-
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
10911
|
-
targetEls.push(t);
|
|
10912
|
-
};
|
|
10913
|
-
if (selector === "$this" || !selector) applyRoot(host);
|
|
10914
|
-
else if (selector === "$host") applyRoot(hostSet.$host);
|
|
10915
|
-
else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
|
|
10916
|
-
else if (selector === "$appHost") applyRoot(hostSet.$appHost);
|
|
10917
|
-
else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
|
|
10918
|
-
else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
|
|
10919
|
-
else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
10920
|
-
else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
10921
|
-
else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
|
|
10922
|
-
else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
10923
|
-
else {
|
|
10924
|
-
const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
|
|
10925
|
-
if (targetRoot) {
|
|
10926
|
-
const found = targetRoot.querySelectorAll(selector);
|
|
10927
|
-
if (found) targetEls.push(...Array.from(found));
|
|
10928
|
-
}
|
|
10929
|
-
}
|
|
10930
|
-
targetEls.forEach((targetEl) => {
|
|
10931
|
-
if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
|
|
10932
|
-
return;
|
|
10933
|
-
}
|
|
10934
|
-
const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
|
|
10935
|
-
if (propertyName) {
|
|
10936
|
-
targetEl[propertyName] = resolvedRes;
|
|
10937
|
-
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
10938
|
-
Object.entries(resolvedRes).forEach(([prop, val]) => {
|
|
10939
|
-
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
10940
|
-
targetEl[prop] = finalVal;
|
|
10941
|
-
});
|
|
10942
|
-
} else {
|
|
10943
|
-
targetEl.value = resolvedRes;
|
|
10944
|
-
}
|
|
10945
|
-
});
|
|
10946
|
-
}
|
|
10947
|
-
return resolvedValue;
|
|
10948
|
-
};
|
|
10949
|
-
if (res instanceof Promise) {
|
|
10950
|
-
return res.then(handleResult);
|
|
10951
|
-
} else {
|
|
10952
|
-
return handleResult(res);
|
|
10953
|
-
}
|
|
10954
|
-
};
|
|
10955
|
-
};
|
|
10956
|
-
};
|
|
10957
|
-
var setPropertyThis = (propertyNameOrOptions, options = {}) => {
|
|
10958
|
-
return setProperty("$this", propertyNameOrOptions, options);
|
|
10959
|
-
};
|
|
10960
|
-
|
|
10961
10982
|
// src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts
|
|
10962
10983
|
var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change-while-connected");
|
|
10963
10984
|
function createSubscribeSwcAppRouteChangeWhileConnected(options) {
|
|
@@ -10974,15 +10995,21 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10974
10995
|
return descriptor;
|
|
10975
10996
|
};
|
|
10976
10997
|
}
|
|
10977
|
-
function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions,
|
|
10978
|
-
if (
|
|
10979
|
-
return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions,
|
|
10998
|
+
function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKeyOrConfig, descriptor) {
|
|
10999
|
+
if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === "string" || typeof propertyKeyOrConfig === "symbol")) {
|
|
11000
|
+
return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);
|
|
10980
11001
|
}
|
|
10981
11002
|
let options = {};
|
|
10982
11003
|
if (Array.isArray(targetOrOptions)) {
|
|
10983
11004
|
options.path = targetOrOptions;
|
|
11005
|
+
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
11006
|
+
options = { ...options, ...propertyKeyOrConfig };
|
|
11007
|
+
}
|
|
10984
11008
|
} else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
|
|
10985
11009
|
options.path = targetOrOptions;
|
|
11010
|
+
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
11011
|
+
options = { ...options, ...propertyKeyOrConfig };
|
|
11012
|
+
}
|
|
10986
11013
|
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
10987
11014
|
options = targetOrOptions;
|
|
10988
11015
|
}
|
|
@@ -11108,7 +11135,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11108
11135
|
};
|
|
11109
11136
|
function applySlot(targetId, opt) {
|
|
11110
11137
|
return (targetObj, propertyKey, descriptor) => {
|
|
11111
|
-
const options = { position: "
|
|
11138
|
+
const options = { position: "replaceChildren", ...opt };
|
|
11112
11139
|
const constructor = targetObj.constructor;
|
|
11113
11140
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
11114
11141
|
if (!metaList) {
|
|
@@ -11160,34 +11187,40 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11160
11187
|
};
|
|
11161
11188
|
};
|
|
11162
11189
|
}
|
|
11163
|
-
|
|
11164
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
11165
|
-
return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
11166
|
-
};
|
|
11167
|
-
function applySlotClear(targetId) {
|
|
11190
|
+
function clearSlot(targetId) {
|
|
11168
11191
|
return applySlot(targetId, { position: "clear" });
|
|
11169
11192
|
}
|
|
11170
|
-
function
|
|
11193
|
+
function prependHtmlSlot(targetId) {
|
|
11171
11194
|
return applySlot(targetId, { position: "prependHtml" });
|
|
11172
11195
|
}
|
|
11173
|
-
|
|
11174
|
-
|
|
11196
|
+
function prependSlot(targetId) {
|
|
11197
|
+
return applySlot(targetId, { position: "prepend" });
|
|
11198
|
+
}
|
|
11199
|
+
function prependTextSlot(targetId) {
|
|
11175
11200
|
return applySlot(targetId, { position: "prependText" });
|
|
11176
11201
|
}
|
|
11177
|
-
function
|
|
11202
|
+
function appendHtmlSlot(targetId) {
|
|
11178
11203
|
return applySlot(targetId, { position: "appendHtml" });
|
|
11179
11204
|
}
|
|
11180
|
-
function
|
|
11205
|
+
function appendTextSlot(targetId) {
|
|
11181
11206
|
return applySlot(targetId, { position: "appendText" });
|
|
11182
11207
|
}
|
|
11183
|
-
|
|
11184
|
-
|
|
11208
|
+
function appendSlot(targetId) {
|
|
11209
|
+
return applySlot(targetId, { position: "append" });
|
|
11210
|
+
}
|
|
11211
|
+
function replaceChildrenHtmlSlot(targetId) {
|
|
11185
11212
|
return applySlot(targetId, { position: "replaceChildrenHtml" });
|
|
11186
11213
|
}
|
|
11187
|
-
|
|
11188
|
-
|
|
11214
|
+
function replaceChildrenSlot(targetId) {
|
|
11215
|
+
return applySlot(targetId, { position: "replaceChildren" });
|
|
11216
|
+
}
|
|
11217
|
+
function replaceChildrenTextSlot(targetId) {
|
|
11189
11218
|
return applySlot(targetId, { position: "replaceChildrenText" });
|
|
11190
11219
|
}
|
|
11220
|
+
var findAllApplySlotMetadata = (target) => {
|
|
11221
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
11222
|
+
return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
11223
|
+
};
|
|
11191
11224
|
|
|
11192
11225
|
// ../simple-boot/dist/esm/index.js
|
|
11193
11226
|
var import_reflect_metadata = __toESM(require_Reflect(), 1);
|
|
@@ -11336,9 +11369,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11336
11369
|
}
|
|
11337
11370
|
};
|
|
11338
11371
|
var MetaDataPropertyAtomic = class extends MetaDataAtomic {
|
|
11339
|
-
constructor(target, metaData,
|
|
11372
|
+
constructor(target, metaData, property2, parameter) {
|
|
11340
11373
|
super(target, metaData);
|
|
11341
|
-
this.property =
|
|
11374
|
+
this.property = property2;
|
|
11342
11375
|
this.parameter = parameter;
|
|
11343
11376
|
}
|
|
11344
11377
|
call(...parameter) {
|
|
@@ -13432,7 +13465,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
13432
13465
|
const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
|
|
13433
13466
|
if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
|
|
13434
13467
|
console.log("[SWC-MIXIN] Route change subscribers found");
|
|
13435
|
-
const
|
|
13468
|
+
const sortedSubscribers = [...routeChangeSubscribers].sort((a, b) => {
|
|
13469
|
+
const orderA = a.options?.order ?? 0;
|
|
13470
|
+
const orderB = b.options?.order ?? 0;
|
|
13471
|
+
return orderA - orderB;
|
|
13472
|
+
});
|
|
13473
|
+
for (const metadata of sortedSubscribers) {
|
|
13436
13474
|
const methodName = metadata.propertyKey;
|
|
13437
13475
|
let pathPattern = metadata.options?.path;
|
|
13438
13476
|
const filter = metadata.options?.filter;
|
|
@@ -13460,10 +13498,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
13460
13498
|
const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
|
|
13461
13499
|
const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
|
|
13462
13500
|
if (pathMatched && filterPassed && instance[methodName]) {
|
|
13463
|
-
await instance[methodName]({ ...re, pathData });
|
|
13501
|
+
const result = await instance[methodName]({ ...re, pathData });
|
|
13502
|
+
if (result !== void 0 && result !== null) {
|
|
13503
|
+
break;
|
|
13504
|
+
}
|
|
13464
13505
|
}
|
|
13465
|
-
}
|
|
13466
|
-
await Promise.allSettled(ps);
|
|
13506
|
+
}
|
|
13467
13507
|
}
|
|
13468
13508
|
} finally {
|
|
13469
13509
|
if (this.config?.ssr) {
|