@dooboostore/simple-web-component 1.0.42 → 1.0.44
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/README.md +689 -85
- package/dist/cjs/SwcAppEngine.js +3 -1
- package/dist/cjs/SwcAppEngine.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +10 -0
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +41 -30
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +66 -23
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +176 -107
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +21 -30
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +11 -2
- package/dist/cjs/decorators/applySlot.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +48 -17
- package/dist/cjs/decorators/applyStyle.js.map +3 -3
- package/dist/cjs/decorators/{changedAttributeThis.js → changedAttribute.js} +6 -6
- package/dist/cjs/decorators/changedAttribute.js.map +7 -0
- package/dist/cjs/decorators/elementDefine.js +37 -6
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +58 -42
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +1 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/publishSwcAppMessage.js +37 -23
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +3 -3
- package/dist/cjs/decorators/query.js +96 -145
- package/dist/cjs/decorators/query.js.map +3 -3
- package/dist/cjs/decorators/queryAll.js +104 -131
- package/dist/cjs/decorators/queryAll.js.map +3 -3
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +17 -2
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/router/ElementRouter.js +4 -0
- package/dist/cjs/router/ElementRouter.js.map +2 -2
- package/dist/esm/SwcAppEngine.js +3 -1
- package/dist/esm/SwcAppEngine.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +10 -0
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +41 -30
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +66 -23
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +176 -107
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +21 -30
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +11 -2
- package/dist/esm/decorators/applySlot.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +48 -17
- package/dist/esm/decorators/applyStyle.js.map +3 -3
- package/dist/esm/decorators/{changedAttributeThis.js → changedAttribute.js} +3 -3
- package/dist/esm/decorators/changedAttribute.js.map +7 -0
- package/dist/esm/decorators/elementDefine.js +35 -4
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +58 -42
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +1 -1
- package/dist/esm/decorators/index.js.map +1 -1
- package/dist/esm/decorators/publishSwcAppMessage.js +37 -23
- package/dist/esm/decorators/publishSwcAppMessage.js.map +3 -3
- package/dist/esm/decorators/query.js +96 -145
- package/dist/esm/decorators/query.js.map +3 -3
- package/dist/esm/decorators/queryAll.js +104 -131
- package/dist/esm/decorators/queryAll.js.map +3 -3
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +18 -3
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
- package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/router/ElementRouter.js +4 -0
- package/dist/esm/router/ElementRouter.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +900 -578
- 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/addEventListener.d.ts +22 -14
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +61 -20
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +22 -36
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +178 -30
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +53 -18
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts +6 -0
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +13 -7
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/{changedAttributeThis.d.ts → changedAttribute.d.ts} +2 -2
- package/dist/types/decorators/changedAttribute.d.ts.map +1 -0
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +20 -10
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +1 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts +19 -0
- package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +3 -26
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +3 -20
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +1 -0
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.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/SwcAppMixin.d.ts +4 -4
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/router/ElementRouter.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +900 -578
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +7 -9
- package/src/SwcAppEngine.ts +3 -1
- package/src/decorators/addEventListener.ts +35 -24
- package/src/decorators/applyAttribute.ts +167 -65
- package/src/decorators/applyClass.ts +113 -17
- package/src/decorators/applyNode.ts +383 -102
- package/src/decorators/applyProperty.ts +99 -65
- package/src/decorators/applySlot.ts +24 -10
- package/src/decorators/applyStyle.ts +83 -13
- package/src/decorators/{changedAttributeThis.ts → changedAttribute.ts} +1 -1
- package/src/decorators/elementDefine.ts +47 -4
- package/src/decorators/emitCustomEvent.ts +62 -35
- package/src/decorators/index.ts +1 -1
- package/src/decorators/publishSwcAppMessage.ts +71 -27
- package/src/decorators/query.ts +90 -159
- package/src/decorators/queryAll.ts +92 -134
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -0
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +3 -1
- package/src/elements/SwcAppMixin.ts +43 -24
- package/src/examples/RxJSOperatorsExample.ts +279 -0
- package/src/index.ts +2 -0
- package/src/router/ElementRouter.ts +4 -0
- package/dist/cjs/decorators/changedAttributeThis.js.map +0 -7
- package/dist/esm/decorators/changedAttributeThis.js.map +0 -7
- package/dist/types/decorators/changedAttributeThis.d.ts.map +0 -1
|
@@ -1158,6 +1158,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1158
1158
|
SwcAppAside: () => SwcAppAside,
|
|
1159
1159
|
SwcAppBody: () => SwcAppBody,
|
|
1160
1160
|
SwcAppDiv: () => SwcAppDiv,
|
|
1161
|
+
SwcAppEngine: () => SwcAppEngine,
|
|
1161
1162
|
SwcAppFooter: () => SwcAppFooter,
|
|
1162
1163
|
SwcAppHeader: () => SwcAppHeader,
|
|
1163
1164
|
SwcAppMain: () => SwcAppMain,
|
|
@@ -1166,7 +1167,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1166
1167
|
SwcAppSection: () => SwcAppSection,
|
|
1167
1168
|
SwcUtils: () => SwcUtils,
|
|
1168
1169
|
addClass: () => addClass,
|
|
1169
|
-
addClassThis: () => addClassThis,
|
|
1170
1170
|
addEventListener: () => addEventListener,
|
|
1171
1171
|
addEventListenerAppHost: () => addEventListenerAppHost,
|
|
1172
1172
|
addEventListenerDelegate: () => addEventListenerDelegate,
|
|
@@ -1176,28 +1176,21 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1176
1176
|
addEventListenerDocument: () => addEventListenerDocument,
|
|
1177
1177
|
addEventListenerThis: () => addEventListenerThis,
|
|
1178
1178
|
addEventListenerWindow: () => addEventListenerWindow,
|
|
1179
|
-
afterBeginLightNodeThis: () => afterBeginLightNodeThis,
|
|
1180
|
-
afterBeginNodeThis: () => afterBeginNodeThis,
|
|
1181
|
-
allAppHost: () => allAppHost,
|
|
1182
|
-
allParentHost: () => allParentHost,
|
|
1183
1179
|
appendHtmlSlot: () => appendHtmlSlot,
|
|
1184
1180
|
appendSlot: () => appendSlot,
|
|
1185
1181
|
appendTextSlot: () => appendTextSlot,
|
|
1186
1182
|
applyAttribute: () => applyAttribute,
|
|
1187
1183
|
applyClass: () => applyClass,
|
|
1188
|
-
applyClassThis: () => applyClassThis,
|
|
1189
1184
|
applyNode: () => applyNode,
|
|
1190
|
-
applyNodeThis: () => applyNodeThis,
|
|
1191
1185
|
applyProperty: () => applyProperty,
|
|
1192
1186
|
applySlot: () => applySlot,
|
|
1193
1187
|
applyStyle: () => applyStyle,
|
|
1194
|
-
applyStyleThis: () => applyStyleThis,
|
|
1195
1188
|
attribute: () => attribute,
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1189
|
+
changedAttribute: () => changedAttribute,
|
|
1190
|
+
changedRoute: () => changedRoute,
|
|
1191
|
+
clearChildrenLight: () => clearChildrenLight,
|
|
1192
|
+
clearChildrenNode: () => clearChildrenNode,
|
|
1193
|
+
clearNode: () => clearNode,
|
|
1201
1194
|
clearSlot: () => clearSlot,
|
|
1202
1195
|
commentNode: () => commentNode,
|
|
1203
1196
|
convertAttributeValue: () => convertAttributeValue,
|
|
@@ -1215,9 +1208,14 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1215
1208
|
defineSwcAppNav: () => defineSwcAppNav,
|
|
1216
1209
|
defineSwcAppSection: () => defineSwcAppSection,
|
|
1217
1210
|
elementDefine: () => elementDefine,
|
|
1211
|
+
emit: () => emit,
|
|
1218
1212
|
emitCustomEvent: () => emitCustomEvent,
|
|
1219
|
-
emitCustomEventThis: () => emitCustomEventThis,
|
|
1220
1213
|
ensureInit: () => ensureInit,
|
|
1214
|
+
event: () => event,
|
|
1215
|
+
eventDelegate: () => eventDelegate,
|
|
1216
|
+
eventDelegateAllDom: () => eventDelegateAllDom,
|
|
1217
|
+
eventDelegateLightDom: () => eventDelegateLightDom,
|
|
1218
|
+
eventDelegateShadowDom: () => eventDelegateShadowDom,
|
|
1221
1219
|
findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
|
|
1222
1220
|
findAllApplySlotMetadata: () => findAllApplySlotMetadata,
|
|
1223
1221
|
findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
|
|
@@ -1254,15 +1252,17 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1254
1252
|
htmlSectionElement: () => htmlSectionElement,
|
|
1255
1253
|
htmlSpanElement: () => htmlSpanElement,
|
|
1256
1254
|
htmlUlElement: () => htmlUlElement,
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1255
|
+
innerHtml: () => innerHtml,
|
|
1256
|
+
innerHtmlLight: () => innerHtmlLight,
|
|
1257
|
+
innerHtmlShadow: () => innerHtmlShadow,
|
|
1258
|
+
innerText: () => innerText,
|
|
1259
|
+
innerTextLight: () => innerTextLight,
|
|
1260
|
+
innerTextShadow: () => innerTextShadow,
|
|
1261
|
+
insertAfterBegin: () => insertAfterBegin,
|
|
1262
|
+
insertAfterBeginLight: () => insertAfterBeginLight,
|
|
1263
|
+
insertBeforeEnd: () => insertBeforeEnd,
|
|
1264
|
+
insertBeforeEndLight: () => insertBeforeEndLight,
|
|
1265
|
+
insertBeforeEndShadow: () => insertBeforeEndShadow,
|
|
1266
1266
|
isSSR: () => isSSR,
|
|
1267
1267
|
onAdopted: () => onAdopted,
|
|
1268
1268
|
onAdoptedAfter: () => onAdoptedAfter,
|
|
@@ -1282,38 +1282,26 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1282
1282
|
prependSlot: () => prependSlot,
|
|
1283
1283
|
prependTextSlot: () => prependTextSlot,
|
|
1284
1284
|
property: () => property,
|
|
1285
|
-
|
|
1285
|
+
publishMessage: () => publishMessage,
|
|
1286
1286
|
publishSwcAppMessage: () => publishSwcAppMessage,
|
|
1287
1287
|
query: () => query,
|
|
1288
1288
|
queryAll: () => queryAll,
|
|
1289
|
-
|
|
1290
|
-
queryAppHost: () => queryAppHost,
|
|
1291
|
-
queryDocument: () => queryDocument,
|
|
1292
|
-
queryHost: () => queryHost,
|
|
1293
|
-
queryThis: () => queryThis,
|
|
1294
|
-
queryWindow: () => queryWindow,
|
|
1289
|
+
receiveMessage: () => receiveMessage,
|
|
1295
1290
|
removeClass: () => removeClass,
|
|
1296
|
-
removeClassThis: () => removeClassThis,
|
|
1297
1291
|
removeSSRAttribute: () => removeSSRAttribute,
|
|
1298
1292
|
removeStyle: () => removeStyle,
|
|
1299
|
-
|
|
1293
|
+
replaceChildren: () => replaceChildren,
|
|
1300
1294
|
replaceChildrenHtmlSlot: () => replaceChildrenHtmlSlot,
|
|
1301
|
-
|
|
1302
|
-
replaceChildrenNode: () => replaceChildrenNode,
|
|
1303
|
-
replaceChildrenNodeThis: () => replaceChildrenNodeThis,
|
|
1295
|
+
replaceChildrenLight: () => replaceChildrenLight,
|
|
1304
1296
|
replaceChildrenSlot: () => replaceChildrenSlot,
|
|
1305
1297
|
replaceChildrenTextSlot: () => replaceChildrenTextSlot,
|
|
1306
1298
|
resolveAttributeTargets: () => resolveAttributeTargets,
|
|
1307
1299
|
resolvePropertyTargets: () => resolvePropertyTargets,
|
|
1308
1300
|
setAttribute: () => setAttribute,
|
|
1309
|
-
setAttributeThis: () => setAttributeThis,
|
|
1310
1301
|
setClass: () => setClass,
|
|
1311
|
-
setClassThis: () => setClassThis,
|
|
1312
1302
|
setProperty: () => setProperty,
|
|
1313
|
-
setPropertyThis: () => setPropertyThis,
|
|
1314
1303
|
setSSRAttribute: () => setSSRAttribute,
|
|
1315
1304
|
setStyle: () => setStyle,
|
|
1316
|
-
setStyleThis: () => setStyleThis,
|
|
1317
1305
|
state: () => state,
|
|
1318
1306
|
subscribeSwcAppMessageWhileConnected: () => subscribeSwcAppMessageWhileConnected,
|
|
1319
1307
|
subscribeSwcAppRouteChangeWhileConnected: () => subscribeSwcAppRouteChangeWhileConnected,
|
|
@@ -1330,11 +1318,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1330
1318
|
swcAppTagName: () => swcAppTagName,
|
|
1331
1319
|
textNode: () => textNode,
|
|
1332
1320
|
toggleClass: () => toggleClass,
|
|
1333
|
-
toggleClassThis: () => toggleClassThis,
|
|
1334
1321
|
updateClass: () => updateClass,
|
|
1335
|
-
|
|
1336
|
-
updateStyle: () => updateStyle,
|
|
1337
|
-
updateStyleThis: () => updateStyleThis
|
|
1322
|
+
updateStyle: () => updateStyle
|
|
1338
1323
|
});
|
|
1339
1324
|
var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
|
|
1340
1325
|
|
|
@@ -6544,6 +6529,11 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6544
6529
|
function addEventListenerDelegate(selector, type, options) {
|
|
6545
6530
|
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
6546
6531
|
}
|
|
6532
|
+
var event = addEventListener;
|
|
6533
|
+
var eventDelegateLightDom = addEventListenerDelegateLightDom;
|
|
6534
|
+
var eventDelegateShadowDom = addEventListenerDelegateShadowDom;
|
|
6535
|
+
var eventDelegateAllDom = addEventListenerDelegateAllDom;
|
|
6536
|
+
var eventDelegate = addEventListenerDelegate;
|
|
6547
6537
|
function addEventListenerThis(type, options) {
|
|
6548
6538
|
return addEventListener("$this", type, options);
|
|
6549
6539
|
}
|
|
@@ -6561,6 +6551,155 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6561
6551
|
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
6562
6552
|
};
|
|
6563
6553
|
|
|
6554
|
+
// ../core/dist/esm/message/operators/debounceTime.js
|
|
6555
|
+
function debounceTime(duration, config) {
|
|
6556
|
+
return (source) => {
|
|
6557
|
+
return new Observable((subscriber) => {
|
|
6558
|
+
const setTimeoutFn = config?.setTimeout || setTimeout;
|
|
6559
|
+
const clearTimeoutFn = config?.clearTimeout || clearTimeout;
|
|
6560
|
+
let timeoutId = null;
|
|
6561
|
+
let lastValue;
|
|
6562
|
+
let hasValue = false;
|
|
6563
|
+
const subscription = source.subscribe({
|
|
6564
|
+
next: (value) => {
|
|
6565
|
+
clearTimeoutFn(timeoutId);
|
|
6566
|
+
lastValue = value;
|
|
6567
|
+
hasValue = true;
|
|
6568
|
+
timeoutId = setTimeoutFn(() => {
|
|
6569
|
+
if (hasValue) {
|
|
6570
|
+
subscriber.next(lastValue);
|
|
6571
|
+
hasValue = false;
|
|
6572
|
+
}
|
|
6573
|
+
}, duration);
|
|
6574
|
+
},
|
|
6575
|
+
error: (err) => {
|
|
6576
|
+
clearTimeoutFn(timeoutId);
|
|
6577
|
+
subscriber.error(err);
|
|
6578
|
+
},
|
|
6579
|
+
complete: () => {
|
|
6580
|
+
clearTimeoutFn(timeoutId);
|
|
6581
|
+
if (hasValue) {
|
|
6582
|
+
subscriber.next(lastValue);
|
|
6583
|
+
}
|
|
6584
|
+
subscriber.complete();
|
|
6585
|
+
}
|
|
6586
|
+
});
|
|
6587
|
+
return subscription;
|
|
6588
|
+
});
|
|
6589
|
+
};
|
|
6590
|
+
}
|
|
6591
|
+
|
|
6592
|
+
// ../core/dist/esm/message/operators/distinctUntilChanged.js
|
|
6593
|
+
function distinctUntilChanged(comparator) {
|
|
6594
|
+
return (source) => {
|
|
6595
|
+
return new Observable((subscriber) => {
|
|
6596
|
+
let hasValue = false;
|
|
6597
|
+
let previousValue;
|
|
6598
|
+
const subscription = source.subscribe({
|
|
6599
|
+
next: (value) => {
|
|
6600
|
+
const areEqual = hasValue ? comparator ? comparator(previousValue, value) : previousValue === value : false;
|
|
6601
|
+
if (!areEqual) {
|
|
6602
|
+
hasValue = true;
|
|
6603
|
+
previousValue = value;
|
|
6604
|
+
subscriber.next(value);
|
|
6605
|
+
}
|
|
6606
|
+
},
|
|
6607
|
+
error: (err) => {
|
|
6608
|
+
subscriber.error(err);
|
|
6609
|
+
},
|
|
6610
|
+
complete: () => {
|
|
6611
|
+
subscriber.complete();
|
|
6612
|
+
}
|
|
6613
|
+
});
|
|
6614
|
+
return subscription;
|
|
6615
|
+
});
|
|
6616
|
+
};
|
|
6617
|
+
}
|
|
6618
|
+
|
|
6619
|
+
// ../core/dist/esm/message/operators/throttleTime.js
|
|
6620
|
+
function throttleTime(duration, config) {
|
|
6621
|
+
const leading = config?.leading ?? true;
|
|
6622
|
+
const trailing = config?.trailing ?? false;
|
|
6623
|
+
const setTimeoutFn = config?.setTimeout || setTimeout;
|
|
6624
|
+
const clearTimeoutFn = config?.clearTimeout || clearTimeout;
|
|
6625
|
+
return (source) => {
|
|
6626
|
+
return new Observable((subscriber) => {
|
|
6627
|
+
let throttled = false;
|
|
6628
|
+
let trailingValue;
|
|
6629
|
+
let hasTrailingValue = false;
|
|
6630
|
+
let timeoutId = null;
|
|
6631
|
+
const endThrottle = () => {
|
|
6632
|
+
if (timeoutId !== null) {
|
|
6633
|
+
clearTimeoutFn(timeoutId);
|
|
6634
|
+
timeoutId = null;
|
|
6635
|
+
}
|
|
6636
|
+
throttled = false;
|
|
6637
|
+
if (trailing && hasTrailingValue) {
|
|
6638
|
+
const valueToEmit = trailingValue;
|
|
6639
|
+
hasTrailingValue = false;
|
|
6640
|
+
trailingValue = void 0;
|
|
6641
|
+
Promise.resolve().then(() => {
|
|
6642
|
+
if (!subscriber.closed) {
|
|
6643
|
+
subscriber.next(valueToEmit);
|
|
6644
|
+
startThrottle();
|
|
6645
|
+
}
|
|
6646
|
+
});
|
|
6647
|
+
}
|
|
6648
|
+
};
|
|
6649
|
+
const startThrottle = () => {
|
|
6650
|
+
if (throttled) {
|
|
6651
|
+
return;
|
|
6652
|
+
}
|
|
6653
|
+
throttled = true;
|
|
6654
|
+
timeoutId = setTimeoutFn(() => {
|
|
6655
|
+
endThrottle();
|
|
6656
|
+
}, duration);
|
|
6657
|
+
};
|
|
6658
|
+
const subscription = source.subscribe({
|
|
6659
|
+
next: (value) => {
|
|
6660
|
+
if (!throttled) {
|
|
6661
|
+
if (leading) {
|
|
6662
|
+
subscriber.next(value);
|
|
6663
|
+
} else if (trailing) {
|
|
6664
|
+
trailingValue = value;
|
|
6665
|
+
hasTrailingValue = true;
|
|
6666
|
+
}
|
|
6667
|
+
startThrottle();
|
|
6668
|
+
} else if (trailing) {
|
|
6669
|
+
trailingValue = value;
|
|
6670
|
+
hasTrailingValue = true;
|
|
6671
|
+
}
|
|
6672
|
+
},
|
|
6673
|
+
error: (err) => {
|
|
6674
|
+
if (timeoutId !== null) {
|
|
6675
|
+
clearTimeoutFn(timeoutId);
|
|
6676
|
+
timeoutId = null;
|
|
6677
|
+
}
|
|
6678
|
+
throttled = false;
|
|
6679
|
+
subscriber.error(err);
|
|
6680
|
+
},
|
|
6681
|
+
complete: () => {
|
|
6682
|
+
if (timeoutId !== null) {
|
|
6683
|
+
clearTimeoutFn(timeoutId);
|
|
6684
|
+
timeoutId = null;
|
|
6685
|
+
}
|
|
6686
|
+
if (trailing && hasTrailingValue) {
|
|
6687
|
+
subscriber.next(trailingValue);
|
|
6688
|
+
}
|
|
6689
|
+
subscriber.complete();
|
|
6690
|
+
}
|
|
6691
|
+
});
|
|
6692
|
+
return () => {
|
|
6693
|
+
subscription.unsubscribe();
|
|
6694
|
+
if (timeoutId !== null) {
|
|
6695
|
+
clearTimeoutFn(timeoutId);
|
|
6696
|
+
timeoutId = null;
|
|
6697
|
+
}
|
|
6698
|
+
};
|
|
6699
|
+
});
|
|
6700
|
+
};
|
|
6701
|
+
}
|
|
6702
|
+
|
|
6564
6703
|
// src/decorators/lifecycles.ts
|
|
6565
6704
|
var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
6566
6705
|
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
@@ -7065,7 +7204,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7065
7204
|
if (!config?.targetVariableName || config?.targetVariableName && tit.variables.find((v) => v === config?.targetVariableName)) {
|
|
7066
7205
|
const data = new Function("ctx", `
|
|
7067
7206
|
with(ctx) {
|
|
7068
|
-
return function(){
|
|
7207
|
+
return function(event){
|
|
7069
7208
|
return (${this.stripWrap(tit.script)});
|
|
7070
7209
|
}
|
|
7071
7210
|
}
|
|
@@ -7718,7 +7857,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7718
7857
|
};
|
|
7719
7858
|
DocumentUtils2.eventObservable = (document2, type, options) => {
|
|
7720
7859
|
return new Observable((subscriber) => {
|
|
7721
|
-
const handler = (
|
|
7860
|
+
const handler = (event2) => subscriber.next(event2);
|
|
7722
7861
|
window.addEventListener(type, handler, options);
|
|
7723
7862
|
return () => {
|
|
7724
7863
|
window.removeEventListener(type, handler, options);
|
|
@@ -7732,7 +7871,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7732
7871
|
((EventUtils2) => {
|
|
7733
7872
|
EventUtils2.htmlElementEventObservable = (element, type, options) => {
|
|
7734
7873
|
return new Observable((subscriber) => {
|
|
7735
|
-
const handler = (
|
|
7874
|
+
const handler = (event2) => subscriber.next(event2);
|
|
7736
7875
|
element.addEventListener(type, handler, options);
|
|
7737
7876
|
return () => {
|
|
7738
7877
|
element.removeEventListener(type, handler, options);
|
|
@@ -7746,7 +7885,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7746
7885
|
((WindowUtils2) => {
|
|
7747
7886
|
WindowUtils2.eventObservable = (window2, type, options) => {
|
|
7748
7887
|
return new Observable((subscriber) => {
|
|
7749
|
-
const handler = (
|
|
7888
|
+
const handler = (event2) => subscriber.next(event2);
|
|
7750
7889
|
window2.addEventListener(type, handler, options);
|
|
7751
7890
|
return () => {
|
|
7752
7891
|
window2.removeEventListener(type, handler, options);
|
|
@@ -8123,7 +8262,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8123
8262
|
routeData = { ...this.getRouteData(), triggerPoint: "first-end" };
|
|
8124
8263
|
this.behaviorSubject = new BehaviorSubject(routeData);
|
|
8125
8264
|
}
|
|
8126
|
-
this.config.window.addEventListener("popstate", (
|
|
8265
|
+
this.config.window.addEventListener("popstate", (event2) => {
|
|
8127
8266
|
const routeData2 = { ...this.getRouteData(), triggerPoint: "end" };
|
|
8128
8267
|
this.behaviorSubject.next(routeData2);
|
|
8129
8268
|
});
|
|
@@ -8515,7 +8654,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8515
8654
|
divideSize
|
|
8516
8655
|
}) => {
|
|
8517
8656
|
return new Observable((subscriber) => {
|
|
8518
|
-
const handler = (
|
|
8657
|
+
const handler = (event2) => subscriber.next(event2);
|
|
8519
8658
|
let fps2 = 0;
|
|
8520
8659
|
const getDrawFpsGap = () => {
|
|
8521
8660
|
return Math.floor(fps2 / divideSize);
|
|
@@ -9019,24 +9158,38 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9019
9158
|
|
|
9020
9159
|
// src/decorators/emitCustomEvent.ts
|
|
9021
9160
|
var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
|
|
9022
|
-
function emitCustomEvent(selectorOrTarget,
|
|
9161
|
+
function emitCustomEvent(selectorOrTarget, typeOrPropertyKey, optionsOrDescriptor) {
|
|
9162
|
+
if (typeof selectorOrTarget === "object" && typeof typeOrPropertyKey === "string" && typeof optionsOrDescriptor === "object" && "value" in optionsOrDescriptor) {
|
|
9163
|
+
throw new Error(`@emitCustomEvent decorator cannot be used on properties. (Property: ${String(typeOrPropertyKey)})`);
|
|
9164
|
+
}
|
|
9165
|
+
if (typeof selectorOrTarget === "string" && typeof typeOrPropertyKey === "string") {
|
|
9166
|
+
return createEmitDecorator(selectorOrTarget, typeOrPropertyKey, optionsOrDescriptor);
|
|
9167
|
+
}
|
|
9168
|
+
if (typeof selectorOrTarget === "string" && typeOrPropertyKey !== "string") {
|
|
9169
|
+
return createEmitDecorator("$this", selectorOrTarget, typeOrPropertyKey);
|
|
9170
|
+
}
|
|
9171
|
+
throw new Error("Invalid @emitCustomEvent usage");
|
|
9172
|
+
}
|
|
9173
|
+
function createEmitDecorator(selector, type, options) {
|
|
9023
9174
|
return (targetObj, propertyKey, descriptor) => {
|
|
9024
9175
|
const constructor = targetObj.constructor;
|
|
9025
|
-
const fullOptions = { ...options, type };
|
|
9026
|
-
if (fullOptions.bubbles === void 0)
|
|
9027
|
-
|
|
9176
|
+
const fullOptions = { ...options || {}, type };
|
|
9177
|
+
if (fullOptions.bubbles === void 0)
|
|
9178
|
+
fullOptions.bubbles = true;
|
|
9179
|
+
if (fullOptions.composed === void 0)
|
|
9180
|
+
fullOptions.composed = true;
|
|
9028
9181
|
let list = ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
9029
9182
|
if (!list) {
|
|
9030
9183
|
list = [];
|
|
9031
9184
|
ReflectUtils.defineMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, list, constructor);
|
|
9032
9185
|
}
|
|
9033
|
-
list.push({ propertyKey, selector
|
|
9186
|
+
list.push({ propertyKey, selector, type, options: fullOptions });
|
|
9034
9187
|
const original = descriptor.value;
|
|
9035
9188
|
descriptor.value = function(...args) {
|
|
9036
9189
|
ensureInit(this);
|
|
9037
9190
|
const res = original.apply(this, args);
|
|
9038
9191
|
const handleResult = (detail) => {
|
|
9039
|
-
const
|
|
9192
|
+
const event2 = new CustomEvent(type, {
|
|
9040
9193
|
detail,
|
|
9041
9194
|
bubbles: fullOptions.bubbles,
|
|
9042
9195
|
composed: fullOptions.composed,
|
|
@@ -9046,47 +9199,60 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9046
9199
|
const conf = getElementConfig(this);
|
|
9047
9200
|
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
9048
9201
|
const eventTargets = [];
|
|
9049
|
-
if (
|
|
9050
|
-
|
|
9051
|
-
else if (
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
if (hostSet.$
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
} else if (
|
|
9060
|
-
if (hostSet.$
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
} else if (
|
|
9202
|
+
if (selector === "$window")
|
|
9203
|
+
eventTargets.push(currentWin);
|
|
9204
|
+
else if (selector === "$document")
|
|
9205
|
+
eventTargets.push(currentWin.document);
|
|
9206
|
+
else if (selector === "$host") {
|
|
9207
|
+
if (hostSet.$host)
|
|
9208
|
+
eventTargets.push(hostSet.$host);
|
|
9209
|
+
} else if (selector === "$parentHost") {
|
|
9210
|
+
if (hostSet.$parentHost)
|
|
9211
|
+
eventTargets.push(hostSet.$parentHost);
|
|
9212
|
+
} else if (selector === "$appHost") {
|
|
9213
|
+
if (hostSet.$appHost)
|
|
9214
|
+
eventTargets.push(hostSet.$appHost);
|
|
9215
|
+
} else if (selector === "$firstHost") {
|
|
9216
|
+
if (hostSet.$firstHost)
|
|
9217
|
+
eventTargets.push(hostSet.$firstHost);
|
|
9218
|
+
} else if (selector === "$lastHost") {
|
|
9219
|
+
if (hostSet.$lastHost)
|
|
9220
|
+
eventTargets.push(hostSet.$lastHost);
|
|
9221
|
+
} else if (selector === "$firstAppHost") {
|
|
9222
|
+
if (hostSet.$firstAppHost)
|
|
9223
|
+
eventTargets.push(hostSet.$firstAppHost);
|
|
9224
|
+
} else if (selector === "$lastAppHost") {
|
|
9225
|
+
if (hostSet.$lastAppHost)
|
|
9226
|
+
eventTargets.push(hostSet.$lastAppHost);
|
|
9227
|
+
} else if (selector === "$hosts") {
|
|
9066
9228
|
hostSet.$hosts.forEach((h) => eventTargets.push(h));
|
|
9067
|
-
} else if (
|
|
9229
|
+
} else if (selector === "$appHosts") {
|
|
9068
9230
|
hostSet.$appHosts.forEach((h) => eventTargets.push(h));
|
|
9069
|
-
} else if (
|
|
9231
|
+
} else if (selector === "$this" || !selector) {
|
|
9070
9232
|
eventTargets.push(this);
|
|
9071
9233
|
} else {
|
|
9072
9234
|
const r = fullOptions.root || "auto";
|
|
9073
9235
|
const searchRoots = [];
|
|
9074
|
-
if (r === "auto")
|
|
9075
|
-
|
|
9076
|
-
else if (r === "
|
|
9236
|
+
if (r === "auto")
|
|
9237
|
+
searchRoots.push(this.shadowRoot || this);
|
|
9238
|
+
else if (r === "light")
|
|
9239
|
+
searchRoots.push(this);
|
|
9240
|
+
else if (r === "shadow" && this.shadowRoot)
|
|
9241
|
+
searchRoots.push(this.shadowRoot);
|
|
9077
9242
|
else if (r === "all") {
|
|
9078
9243
|
searchRoots.push(this);
|
|
9079
|
-
if (this.shadowRoot)
|
|
9244
|
+
if (this.shadowRoot)
|
|
9245
|
+
searchRoots.push(this.shadowRoot);
|
|
9080
9246
|
}
|
|
9081
9247
|
searchRoots.forEach((sr) => {
|
|
9082
|
-
sr.querySelectorAll(
|
|
9248
|
+
sr.querySelectorAll(selector).forEach((el) => eventTargets.push(el));
|
|
9083
9249
|
});
|
|
9084
9250
|
}
|
|
9085
9251
|
eventTargets.forEach((t) => {
|
|
9086
9252
|
if (fullOptions.filter && !fullOptions.filter(t, detail, { currentThis: this, helper: hostSet })) {
|
|
9087
9253
|
return;
|
|
9088
9254
|
}
|
|
9089
|
-
t.dispatchEvent(
|
|
9255
|
+
t.dispatchEvent(event2);
|
|
9090
9256
|
});
|
|
9091
9257
|
return detail;
|
|
9092
9258
|
};
|
|
@@ -9102,20 +9268,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9102
9268
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
9103
9269
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
9104
9270
|
};
|
|
9105
|
-
|
|
9106
|
-
if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "string") {
|
|
9107
|
-
return emitCustomEventThis(type, { attributeName: optionsOrAttributeaName });
|
|
9108
|
-
} else if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "object") {
|
|
9109
|
-
if (!optionsOrAttributeaName.attributeName) {
|
|
9110
|
-
optionsOrAttributeaName.attributeName = `on-emit-${type}`;
|
|
9111
|
-
}
|
|
9112
|
-
return emitCustomEvent("$this", type, optionsOrAttributeaName);
|
|
9113
|
-
} else {
|
|
9114
|
-
return emitCustomEvent("$this", type, { attributeName: `on-emit-${type}` });
|
|
9115
|
-
}
|
|
9116
|
-
}
|
|
9271
|
+
var emit = emitCustomEvent;
|
|
9117
9272
|
|
|
9118
|
-
// src/decorators/
|
|
9273
|
+
// src/decorators/changedAttribute.ts
|
|
9119
9274
|
var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
|
|
9120
9275
|
var convertValue = (val, type) => {
|
|
9121
9276
|
if (val === null || val === void 0) return val;
|
|
@@ -9123,7 +9278,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9123
9278
|
if (type === Boolean) return val === "false" || val === "0" ? false : true;
|
|
9124
9279
|
return val;
|
|
9125
9280
|
};
|
|
9126
|
-
function
|
|
9281
|
+
function changedAttribute(attributeName, options = {}) {
|
|
9127
9282
|
return (target, propertyKey) => {
|
|
9128
9283
|
const constructor = target.constructor;
|
|
9129
9284
|
let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);
|
|
@@ -9163,150 +9318,106 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9163
9318
|
|
|
9164
9319
|
// src/decorators/query.ts
|
|
9165
9320
|
var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
|
|
9166
|
-
function query(selectorOrTarget,
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9321
|
+
function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
9322
|
+
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
9323
|
+
throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
|
|
9324
|
+
}
|
|
9325
|
+
if (typeof selectorOrTarget === "string") {
|
|
9326
|
+
return (targetObj, propertyKey, descriptor2) => {
|
|
9327
|
+
if (descriptor2 !== void 0) {
|
|
9328
|
+
throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
|
|
9329
|
+
}
|
|
9330
|
+
const constructor = targetObj.constructor;
|
|
9331
|
+
let queries = ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
9332
|
+
if (!queries) {
|
|
9333
|
+
queries = [];
|
|
9334
|
+
ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);
|
|
9335
|
+
}
|
|
9336
|
+
queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
|
|
9337
|
+
Object.defineProperty(targetObj, propertyKey, {
|
|
9338
|
+
get() {
|
|
9339
|
+
ensureInit(this);
|
|
9340
|
+
const selector = selectorOrTarget;
|
|
9341
|
+
const r = optionsOrPropertyKey?.root || "auto";
|
|
9342
|
+
const applyRoot = (t) => {
|
|
9343
|
+
if (!t || !(t instanceof HTMLElement))
|
|
9344
|
+
return t;
|
|
9345
|
+
if (r === "auto")
|
|
9346
|
+
return t.shadowRoot || t;
|
|
9347
|
+
if (r === "shadow")
|
|
9348
|
+
return t.shadowRoot;
|
|
9349
|
+
if (r === "light")
|
|
9350
|
+
return t;
|
|
9351
|
+
if (r === "all")
|
|
9352
|
+
return t.shadowRoot || t;
|
|
9185
9353
|
return t;
|
|
9186
|
-
|
|
9187
|
-
|
|
9354
|
+
};
|
|
9355
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
9356
|
+
if (selector === "$this")
|
|
9357
|
+
return applyRoot(this);
|
|
9358
|
+
if (selector === "$host")
|
|
9359
|
+
return applyRoot(hostSet.$host);
|
|
9360
|
+
if (selector === "$parentHost")
|
|
9361
|
+
return applyRoot(hostSet.$parentHost);
|
|
9362
|
+
if (selector === "$appHost")
|
|
9363
|
+
return applyRoot(hostSet.$appHost);
|
|
9364
|
+
if (selector === "$firstHost")
|
|
9365
|
+
return applyRoot(hostSet.$firstHost);
|
|
9366
|
+
if (selector === "$lastHost")
|
|
9367
|
+
return applyRoot(hostSet.$lastHost);
|
|
9368
|
+
if (selector === "$firstAppHost")
|
|
9369
|
+
return applyRoot(hostSet.$firstAppHost);
|
|
9370
|
+
if (selector === "$lastAppHost")
|
|
9371
|
+
return applyRoot(hostSet.$lastAppHost);
|
|
9372
|
+
const config = getElementConfig(this);
|
|
9373
|
+
const win = config?.window || window;
|
|
9374
|
+
if (selector === "$window")
|
|
9375
|
+
return win;
|
|
9376
|
+
if (selector === "$document")
|
|
9377
|
+
return win.document;
|
|
9188
9378
|
if (r === "shadow")
|
|
9189
|
-
return
|
|
9379
|
+
return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
|
|
9190
9380
|
if (r === "light")
|
|
9191
|
-
return
|
|
9192
|
-
if (r === "all")
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
};
|
|
9196
|
-
const hostSet = SwcUtils.getHostSet(this);
|
|
9197
|
-
if (selector === "$this")
|
|
9198
|
-
return applyRoot(this);
|
|
9199
|
-
if (selector === "$host")
|
|
9200
|
-
return applyRoot(hostSet.$host);
|
|
9201
|
-
if (selector === "$parentHost")
|
|
9202
|
-
return applyRoot(hostSet.$parentHost);
|
|
9203
|
-
if (selector === "$appHost")
|
|
9204
|
-
return applyRoot(hostSet.$appHost);
|
|
9205
|
-
if (selector === "$firstHost")
|
|
9206
|
-
return applyRoot(hostSet.$firstHost);
|
|
9207
|
-
if (selector === "$lastHost")
|
|
9208
|
-
return applyRoot(hostSet.$lastHost);
|
|
9209
|
-
if (selector === "$firstAppHost")
|
|
9210
|
-
return applyRoot(hostSet.$firstAppHost);
|
|
9211
|
-
if (selector === "$lastAppHost")
|
|
9212
|
-
return applyRoot(hostSet.$lastAppHost);
|
|
9213
|
-
const config = getElementConfig(this);
|
|
9214
|
-
const win = config?.window || window;
|
|
9215
|
-
if (selector === "$window")
|
|
9216
|
-
return win;
|
|
9217
|
-
if (selector === "$document")
|
|
9218
|
-
return win.document;
|
|
9219
|
-
if (r === "shadow")
|
|
9220
|
-
return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
|
|
9221
|
-
if (r === "light")
|
|
9222
|
-
return this.querySelector(selector);
|
|
9223
|
-
if (r === "all") {
|
|
9224
|
-
const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
|
|
9225
|
-
return shadowMatch || this.querySelector(selector);
|
|
9226
|
-
}
|
|
9227
|
-
return (this.shadowRoot || this).querySelector(selector);
|
|
9228
|
-
},
|
|
9229
|
-
set(nv) {
|
|
9230
|
-
ensureInit(this);
|
|
9231
|
-
if (nv === null || nv === void 0) {
|
|
9232
|
-
const selector = selectorOrTarget;
|
|
9233
|
-
if (selector.startsWith("$") && selector !== "$this")
|
|
9234
|
-
return;
|
|
9235
|
-
const r = options.root || "auto";
|
|
9236
|
-
const targets = [];
|
|
9237
|
-
if (r === "shadow") {
|
|
9238
|
-
if (this.shadowRoot?.querySelector(selector))
|
|
9239
|
-
targets.push(this.shadowRoot.querySelector(selector));
|
|
9240
|
-
} else if (r === "light") {
|
|
9241
|
-
if (this.querySelector(selector))
|
|
9242
|
-
targets.push(this.querySelector(selector));
|
|
9243
|
-
} else if (r === "all") {
|
|
9244
|
-
if (this.shadowRoot?.querySelector(selector))
|
|
9245
|
-
targets.push(this.shadowRoot.querySelector(selector));
|
|
9246
|
-
if (this.querySelector(selector))
|
|
9247
|
-
targets.push(this.querySelector(selector));
|
|
9248
|
-
} else {
|
|
9249
|
-
const el = (this.shadowRoot || this).querySelector(selector);
|
|
9250
|
-
if (el)
|
|
9251
|
-
targets.push(el);
|
|
9381
|
+
return this.querySelector(selector);
|
|
9382
|
+
if (r === "all") {
|
|
9383
|
+
const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
|
|
9384
|
+
return shadowMatch || this.querySelector(selector);
|
|
9252
9385
|
}
|
|
9253
|
-
|
|
9254
|
-
}
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
return query("$document", targetOrOptions);
|
|
9287
|
-
} else {
|
|
9288
|
-
return query("$document", {});
|
|
9289
|
-
}
|
|
9290
|
-
}
|
|
9291
|
-
function queryHost(targetOrOptions, propertyKey) {
|
|
9292
|
-
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
9293
|
-
return query("$host", {})(targetOrOptions, propertyKey);
|
|
9294
|
-
}
|
|
9295
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
9296
|
-
return query("$host", targetOrOptions);
|
|
9297
|
-
} else {
|
|
9298
|
-
return query("$host", {});
|
|
9299
|
-
}
|
|
9300
|
-
}
|
|
9301
|
-
function queryAppHost(targetOrOptions, propertyKey) {
|
|
9302
|
-
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
9303
|
-
return query("$appHost", {})(targetOrOptions, propertyKey);
|
|
9304
|
-
}
|
|
9305
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
9306
|
-
return query("$appHost", targetOrOptions);
|
|
9307
|
-
} else {
|
|
9308
|
-
return query("$appHost", {});
|
|
9386
|
+
return (this.shadowRoot || this).querySelector(selector);
|
|
9387
|
+
},
|
|
9388
|
+
set(nv) {
|
|
9389
|
+
ensureInit(this);
|
|
9390
|
+
if (nv === null || nv === void 0) {
|
|
9391
|
+
const selector = selectorOrTarget;
|
|
9392
|
+
if (selector.startsWith("$") && selector !== "$this")
|
|
9393
|
+
return;
|
|
9394
|
+
const r = optionsOrPropertyKey?.root || "auto";
|
|
9395
|
+
const targets = [];
|
|
9396
|
+
if (r === "shadow") {
|
|
9397
|
+
if (this.shadowRoot?.querySelector(selector))
|
|
9398
|
+
targets.push(this.shadowRoot.querySelector(selector));
|
|
9399
|
+
} else if (r === "light") {
|
|
9400
|
+
if (this.querySelector(selector))
|
|
9401
|
+
targets.push(this.querySelector(selector));
|
|
9402
|
+
} else if (r === "all") {
|
|
9403
|
+
if (this.shadowRoot?.querySelector(selector))
|
|
9404
|
+
targets.push(this.shadowRoot.querySelector(selector));
|
|
9405
|
+
if (this.querySelector(selector))
|
|
9406
|
+
targets.push(this.querySelector(selector));
|
|
9407
|
+
} else {
|
|
9408
|
+
const el = (this.shadowRoot || this).querySelector(selector);
|
|
9409
|
+
if (el)
|
|
9410
|
+
targets.push(el);
|
|
9411
|
+
}
|
|
9412
|
+
targets.forEach((t) => t.remove());
|
|
9413
|
+
}
|
|
9414
|
+
},
|
|
9415
|
+
enumerable: true,
|
|
9416
|
+
configurable: true
|
|
9417
|
+
});
|
|
9418
|
+
};
|
|
9309
9419
|
}
|
|
9420
|
+
return query("$this", selectorOrTarget);
|
|
9310
9421
|
}
|
|
9311
9422
|
var getQueryMetadata = (target) => {
|
|
9312
9423
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
@@ -9315,139 +9426,115 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9315
9426
|
|
|
9316
9427
|
// src/decorators/queryAll.ts
|
|
9317
9428
|
var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
|
|
9318
|
-
function queryAll(selectorOrTarget,
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
return [];
|
|
9338
|
-
const items = Array.isArray(t) ? t : [t];
|
|
9339
|
-
const results = [];
|
|
9340
|
-
items.forEach((it) => {
|
|
9341
|
-
if (!(it instanceof HTMLElement)) {
|
|
9342
|
-
results.push(it);
|
|
9343
|
-
return;
|
|
9344
|
-
}
|
|
9345
|
-
if (r === "auto")
|
|
9346
|
-
results.push(it.shadowRoot || it);
|
|
9347
|
-
else {
|
|
9348
|
-
if (r === "light" || r === "all")
|
|
9349
|
-
results.push(it);
|
|
9350
|
-
if ((r === "shadow" || r === "all") && it.shadowRoot)
|
|
9351
|
-
results.push(it.shadowRoot);
|
|
9352
|
-
}
|
|
9353
|
-
});
|
|
9354
|
-
return results;
|
|
9355
|
-
};
|
|
9356
|
-
const hostSet = SwcUtils.getHostSet(this);
|
|
9357
|
-
if (selector === "$hosts")
|
|
9358
|
-
return applyRoot(hostSet.$hosts);
|
|
9359
|
-
if (selector === "$appHosts")
|
|
9360
|
-
return applyRoot(hostSet.$appHosts);
|
|
9361
|
-
if (selector === "$host")
|
|
9362
|
-
return applyRoot(hostSet.$host);
|
|
9363
|
-
if (selector === "$parentHost")
|
|
9364
|
-
return applyRoot(hostSet.$parentHost);
|
|
9365
|
-
if (selector === "$appHost")
|
|
9366
|
-
return applyRoot(hostSet.$appHost);
|
|
9367
|
-
if (selector === "$firstHost")
|
|
9368
|
-
return applyRoot(hostSet.$firstHost);
|
|
9369
|
-
if (selector === "$lastHost")
|
|
9370
|
-
return applyRoot(hostSet.$lastHost);
|
|
9371
|
-
if (selector === "$firstAppHost")
|
|
9372
|
-
return applyRoot(hostSet.$firstAppHost);
|
|
9373
|
-
if (selector === "$lastAppHost")
|
|
9374
|
-
return applyRoot(hostSet.$lastAppHost);
|
|
9375
|
-
const config = getElementConfig(this);
|
|
9376
|
-
const win = config?.window || window;
|
|
9377
|
-
if (selector === "$window")
|
|
9378
|
-
return [win];
|
|
9379
|
-
if (selector === "$document")
|
|
9380
|
-
return [win.document];
|
|
9381
|
-
if (selector === "$this")
|
|
9382
|
-
return applyRoot(this);
|
|
9383
|
-
if (r === "shadow")
|
|
9384
|
-
return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
9385
|
-
if (r === "light")
|
|
9386
|
-
return Array.from(this.querySelectorAll(selector));
|
|
9387
|
-
if (r === "all") {
|
|
9388
|
-
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
9389
|
-
const lNodes = Array.from(this.querySelectorAll(selector));
|
|
9390
|
-
return [...sNodes, ...lNodes];
|
|
9391
|
-
}
|
|
9392
|
-
const root = this.shadowRoot || this;
|
|
9393
|
-
return Array.from(root.querySelectorAll(selector));
|
|
9394
|
-
},
|
|
9395
|
-
set(nv) {
|
|
9396
|
-
ensureInit(this);
|
|
9397
|
-
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
9429
|
+
function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
9430
|
+
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
9431
|
+
throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
|
|
9432
|
+
}
|
|
9433
|
+
if (typeof selectorOrTarget === "string") {
|
|
9434
|
+
return (targetObj, propertyKey, descriptor2) => {
|
|
9435
|
+
if (descriptor2 !== void 0) {
|
|
9436
|
+
throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
|
|
9437
|
+
}
|
|
9438
|
+
const constructor = targetObj.constructor;
|
|
9439
|
+
let queries = ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
9440
|
+
if (!queries) {
|
|
9441
|
+
queries = [];
|
|
9442
|
+
ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
|
|
9443
|
+
}
|
|
9444
|
+
queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
|
|
9445
|
+
Object.defineProperty(targetObj, propertyKey, {
|
|
9446
|
+
get() {
|
|
9447
|
+
ensureInit(this);
|
|
9398
9448
|
const selector = selectorOrTarget;
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9449
|
+
const r = optionsOrPropertyKey?.root || "auto";
|
|
9450
|
+
const applyRoot = (t) => {
|
|
9451
|
+
if (!t)
|
|
9452
|
+
return [];
|
|
9453
|
+
const items = Array.isArray(t) ? t : [t];
|
|
9454
|
+
const results = [];
|
|
9455
|
+
items.forEach((it) => {
|
|
9456
|
+
if (!(it instanceof HTMLElement)) {
|
|
9457
|
+
results.push(it);
|
|
9458
|
+
return;
|
|
9459
|
+
}
|
|
9460
|
+
if (r === "auto")
|
|
9461
|
+
results.push(it.shadowRoot || it);
|
|
9462
|
+
else {
|
|
9463
|
+
if (r === "light" || r === "all")
|
|
9464
|
+
results.push(it);
|
|
9465
|
+
if ((r === "shadow" || r === "all") && it.shadowRoot)
|
|
9466
|
+
results.push(it.shadowRoot);
|
|
9467
|
+
}
|
|
9468
|
+
});
|
|
9469
|
+
return results;
|
|
9470
|
+
};
|
|
9471
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
9472
|
+
if (selector === "$hosts")
|
|
9473
|
+
return applyRoot(hostSet.$hosts);
|
|
9474
|
+
if (selector === "$appHosts")
|
|
9475
|
+
return applyRoot(hostSet.$appHosts);
|
|
9476
|
+
if (selector === "$host")
|
|
9477
|
+
return applyRoot(hostSet.$host);
|
|
9478
|
+
if (selector === "$parentHost")
|
|
9479
|
+
return applyRoot(hostSet.$parentHost);
|
|
9480
|
+
if (selector === "$appHost")
|
|
9481
|
+
return applyRoot(hostSet.$appHost);
|
|
9482
|
+
if (selector === "$firstHost")
|
|
9483
|
+
return applyRoot(hostSet.$firstHost);
|
|
9484
|
+
if (selector === "$lastHost")
|
|
9485
|
+
return applyRoot(hostSet.$lastHost);
|
|
9486
|
+
if (selector === "$firstAppHost")
|
|
9487
|
+
return applyRoot(hostSet.$firstAppHost);
|
|
9488
|
+
if (selector === "$lastAppHost")
|
|
9489
|
+
return applyRoot(hostSet.$lastAppHost);
|
|
9490
|
+
const config = getElementConfig(this);
|
|
9491
|
+
const win = config?.window || window;
|
|
9492
|
+
if (selector === "$window")
|
|
9493
|
+
return [win];
|
|
9494
|
+
if (selector === "$document")
|
|
9495
|
+
return [win.document];
|
|
9496
|
+
if (selector === "$this")
|
|
9497
|
+
return applyRoot(this);
|
|
9403
9498
|
if (r === "shadow")
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9499
|
+
return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
9500
|
+
if (r === "light")
|
|
9501
|
+
return Array.from(this.querySelectorAll(selector));
|
|
9502
|
+
if (r === "all") {
|
|
9408
9503
|
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
9409
9504
|
const lNodes = Array.from(this.querySelectorAll(selector));
|
|
9410
|
-
|
|
9411
|
-
} else {
|
|
9412
|
-
targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
|
|
9505
|
+
return [...sNodes, ...lNodes];
|
|
9413
9506
|
}
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
9444
|
-
return queryAll("$appHost", {})(targetOrOptions, propertyKey);
|
|
9445
|
-
}
|
|
9446
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
9447
|
-
return queryAll("$appHost", targetOrOptions);
|
|
9448
|
-
} else {
|
|
9449
|
-
return queryAll("$appHost", {});
|
|
9507
|
+
const root = this.shadowRoot || this;
|
|
9508
|
+
return Array.from(root.querySelectorAll(selector));
|
|
9509
|
+
},
|
|
9510
|
+
set(nv) {
|
|
9511
|
+
ensureInit(this);
|
|
9512
|
+
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
9513
|
+
const selector = selectorOrTarget;
|
|
9514
|
+
if (selector.startsWith("$") && selector !== "$this")
|
|
9515
|
+
return;
|
|
9516
|
+
const r = optionsOrPropertyKey?.root || "auto";
|
|
9517
|
+
let targets = [];
|
|
9518
|
+
if (r === "shadow")
|
|
9519
|
+
targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
9520
|
+
else if (r === "light")
|
|
9521
|
+
targets = Array.from(this.querySelectorAll(selector));
|
|
9522
|
+
else if (r === "all") {
|
|
9523
|
+
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
9524
|
+
const lNodes = Array.from(this.querySelectorAll(selector));
|
|
9525
|
+
targets = [...sNodes, ...lNodes];
|
|
9526
|
+
} else {
|
|
9527
|
+
targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
|
|
9528
|
+
}
|
|
9529
|
+
targets.forEach((t) => t.remove());
|
|
9530
|
+
}
|
|
9531
|
+
},
|
|
9532
|
+
enumerable: true,
|
|
9533
|
+
configurable: true
|
|
9534
|
+
});
|
|
9535
|
+
};
|
|
9450
9536
|
}
|
|
9537
|
+
return queryAll("$this", selectorOrTarget);
|
|
9451
9538
|
}
|
|
9452
9539
|
var getQueryAllMetadata = (target) => {
|
|
9453
9540
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
@@ -9730,13 +9817,21 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9730
9817
|
descriptor.value = function(...args) {
|
|
9731
9818
|
ensureInit(this);
|
|
9732
9819
|
const res = original.apply(this, args);
|
|
9820
|
+
const extractValue = (v) => {
|
|
9821
|
+
if (v && typeof v === "object" && PROPERTY_METADATA_KEY in v) {
|
|
9822
|
+
return v[PROPERTY_METADATA_KEY];
|
|
9823
|
+
}
|
|
9824
|
+
return v;
|
|
9825
|
+
};
|
|
9733
9826
|
if (res instanceof Promise) {
|
|
9734
9827
|
return res.then((v) => {
|
|
9735
|
-
|
|
9828
|
+
const extracted = extractValue(v);
|
|
9829
|
+
applyValueToTargets(this, extracted);
|
|
9736
9830
|
return v;
|
|
9737
9831
|
});
|
|
9738
9832
|
} else {
|
|
9739
|
-
|
|
9833
|
+
const extracted = extractValue(res);
|
|
9834
|
+
applyValueToTargets(this, extracted);
|
|
9740
9835
|
return res;
|
|
9741
9836
|
}
|
|
9742
9837
|
};
|
|
@@ -9767,35 +9862,20 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9767
9862
|
});
|
|
9768
9863
|
};
|
|
9769
9864
|
}
|
|
9770
|
-
function property(
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
function propertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
|
|
9774
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
9775
|
-
return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
|
|
9865
|
+
function property(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor) {
|
|
9866
|
+
if (optionsOrDescriptor !== void 0 && (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol")) {
|
|
9867
|
+
return applyProperty("$this", void 0, {})(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
9776
9868
|
}
|
|
9777
|
-
if (typeof
|
|
9778
|
-
return applyProperty(
|
|
9779
|
-
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
9780
|
-
return applyProperty("$this", void 0, targetOrOptions);
|
|
9781
|
-
} else {
|
|
9782
|
-
return applyProperty("$this", void 0, {});
|
|
9869
|
+
if (typeof selectorOrTarget === "string") {
|
|
9870
|
+
return applyProperty(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
9783
9871
|
}
|
|
9872
|
+
return applyProperty("$this", void 0, selectorOrTarget);
|
|
9784
9873
|
}
|
|
9785
|
-
function setProperty(
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
function setPropertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
|
|
9789
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
9790
|
-
return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
|
|
9791
|
-
}
|
|
9792
|
-
if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
|
|
9793
|
-
return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
|
|
9794
|
-
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
9795
|
-
return applyProperty("$this", void 0, targetOrOptions);
|
|
9796
|
-
} else {
|
|
9797
|
-
return applyProperty("$this", void 0, {});
|
|
9874
|
+
function setProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined) {
|
|
9875
|
+
if (typeof selectorOrOptions === "string") {
|
|
9876
|
+
return applyProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined);
|
|
9798
9877
|
}
|
|
9878
|
+
return applyProperty("$this", void 0, selectorOrOptions);
|
|
9799
9879
|
}
|
|
9800
9880
|
var findAllPropertyMetadata = (target) => {
|
|
9801
9881
|
const actualTarget = target instanceof Function ? target : target.constructor;
|
|
@@ -9862,10 +9942,10 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9862
9942
|
}
|
|
9863
9943
|
};
|
|
9864
9944
|
var globalDelegatedRoots = /* @__PURE__ */ new WeakSet();
|
|
9865
|
-
var handleGlobalSwcEvent = async (
|
|
9866
|
-
if (
|
|
9867
|
-
const path =
|
|
9868
|
-
const type =
|
|
9945
|
+
var handleGlobalSwcEvent = async (event2) => {
|
|
9946
|
+
if (event2.__swc_handled) return;
|
|
9947
|
+
const path = event2.composedPath();
|
|
9948
|
+
const type = event2.type;
|
|
9869
9949
|
const attrName = `swc-on-${type}`;
|
|
9870
9950
|
for (const node of path) {
|
|
9871
9951
|
if (!(node instanceof HTMLElement)) continue;
|
|
@@ -9873,8 +9953,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9873
9953
|
if (script && !getElementConfig(node)) {
|
|
9874
9954
|
const host = SwcUtils.findNearestSwcHostIncludingSelf(node);
|
|
9875
9955
|
if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
|
|
9876
|
-
await host.__swc_executeAttributeEvent(node, attrName, script,
|
|
9877
|
-
|
|
9956
|
+
await host.__swc_executeAttributeEvent(node, attrName, script, event2);
|
|
9957
|
+
event2.__swc_handled = true;
|
|
9878
9958
|
break;
|
|
9879
9959
|
}
|
|
9880
9960
|
}
|
|
@@ -9963,14 +10043,14 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9963
10043
|
}
|
|
9964
10044
|
const oldHandler = handlers.get(attrName);
|
|
9965
10045
|
if (oldHandler) el.removeEventListener(eventName, oldHandler);
|
|
9966
|
-
const handler = async (
|
|
10046
|
+
const handler = async (event2) => {
|
|
9967
10047
|
const hostSet = SwcUtils.getHostSet(el);
|
|
9968
10048
|
const conf = getElementConfig(this);
|
|
9969
10049
|
const currentWin = this._resolveWindow(conf);
|
|
9970
10050
|
const helpers = SwcUtils.getHelperSet(currentWin);
|
|
9971
10051
|
const args = {
|
|
9972
|
-
event,
|
|
9973
|
-
$data:
|
|
10052
|
+
event: event2,
|
|
10053
|
+
$data: event2.detail,
|
|
9974
10054
|
...hostSet,
|
|
9975
10055
|
...helpers,
|
|
9976
10056
|
$el: el,
|
|
@@ -9981,16 +10061,16 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9981
10061
|
el.addEventListener(eventName, handler);
|
|
9982
10062
|
handlers.set(attrName, handler);
|
|
9983
10063
|
};
|
|
9984
|
-
proto.__swc_executeAttributeEvent = async function(el, attrName, script,
|
|
10064
|
+
proto.__swc_executeAttributeEvent = async function(el, attrName, script, event2) {
|
|
9985
10065
|
ensureInit(this);
|
|
9986
10066
|
const hostSet = SwcUtils.getHostSet(el);
|
|
9987
10067
|
const conf = getElementConfig(this);
|
|
9988
10068
|
const currentWin = this._resolveWindow(conf);
|
|
9989
10069
|
const currentHelpers = SwcUtils.getHelperSet(currentWin);
|
|
9990
|
-
const detail =
|
|
10070
|
+
const detail = event2.detail;
|
|
9991
10071
|
const args = {
|
|
9992
|
-
event,
|
|
9993
|
-
$event:
|
|
10072
|
+
event: event2,
|
|
10073
|
+
$event: event2,
|
|
9994
10074
|
$data: detail,
|
|
9995
10075
|
$detail: detail,
|
|
9996
10076
|
...hostSet,
|
|
@@ -10141,24 +10221,24 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10141
10221
|
const bStop = b.options.stopPropagation ? 1 : 0;
|
|
10142
10222
|
return bStop - aStop;
|
|
10143
10223
|
});
|
|
10144
|
-
const unifiedHandler = async (
|
|
10224
|
+
const unifiedHandler = async (event2) => {
|
|
10145
10225
|
for (const meta of sortedMetaList) {
|
|
10146
10226
|
const { selector, options } = meta;
|
|
10147
|
-
const matchedEl =
|
|
10227
|
+
const matchedEl = event2.target.closest(selector);
|
|
10148
10228
|
if (matchedEl && br.contains(matchedEl)) {
|
|
10149
10229
|
if (options.filter) {
|
|
10150
10230
|
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
10151
|
-
if (!options.filter(
|
|
10231
|
+
if (!options.filter(event2, helper)) {
|
|
10152
10232
|
continue;
|
|
10153
10233
|
}
|
|
10154
10234
|
}
|
|
10155
|
-
if (options.stopPropagation)
|
|
10156
|
-
if (options.stopImmediatePropagation)
|
|
10157
|
-
if (options.preventDefault)
|
|
10235
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
10236
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
10237
|
+
if (options.preventDefault) event2.preventDefault();
|
|
10158
10238
|
const currentHostSet = SwcUtils.getHostSet(this);
|
|
10159
|
-
const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
|
|
10160
|
-
await this[meta.propertyKey](
|
|
10161
|
-
if (
|
|
10239
|
+
const args = { event: event2, ...currentHostSet, $el: matchedEl, $root: br };
|
|
10240
|
+
await this[meta.propertyKey](event2, { ...currentHostSet, $matchedElement: matchedEl }, args);
|
|
10241
|
+
if (event2.cancelBubble) break;
|
|
10162
10242
|
}
|
|
10163
10243
|
}
|
|
10164
10244
|
};
|
|
@@ -10206,22 +10286,46 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10206
10286
|
});
|
|
10207
10287
|
}
|
|
10208
10288
|
bindTargets.forEach((t) => {
|
|
10209
|
-
const handler = async (
|
|
10289
|
+
const handler = async (event2) => {
|
|
10210
10290
|
if (options.filter) {
|
|
10211
10291
|
const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
|
|
10212
|
-
if (!options.filter(
|
|
10292
|
+
if (!options.filter(event2, { currentThis: this, helper })) {
|
|
10213
10293
|
return;
|
|
10214
10294
|
}
|
|
10215
10295
|
}
|
|
10216
|
-
if (options.stopPropagation)
|
|
10217
|
-
if (options.stopImmediatePropagation)
|
|
10218
|
-
if (options.preventDefault)
|
|
10296
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
10297
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
10298
|
+
if (options.preventDefault) event2.preventDefault();
|
|
10219
10299
|
const currentHostSet = SwcUtils.getHostSet(this);
|
|
10220
|
-
const args = { event, ...currentHostSet, $el: t, $root: t };
|
|
10221
|
-
await this[meta.propertyKey](
|
|
10300
|
+
const args = { event: event2, ...currentHostSet, $el: t, $root: t };
|
|
10301
|
+
await this[meta.propertyKey](event2, { currentHostSet, $$matchedElement: event2.currentTarget }, args);
|
|
10302
|
+
};
|
|
10303
|
+
const eventSubject = new Subject();
|
|
10304
|
+
let eventStream = eventSubject;
|
|
10305
|
+
if (options.debounceTime !== void 0 && options.debounceTime > 0) {
|
|
10306
|
+
eventStream = eventStream.pipe(debounceTime(options.debounceTime));
|
|
10307
|
+
}
|
|
10308
|
+
if (options.throttleTime !== void 0 && options.throttleTime > 0) {
|
|
10309
|
+
eventStream = eventStream.pipe(throttleTime(options.throttleTime));
|
|
10310
|
+
}
|
|
10311
|
+
if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
|
|
10312
|
+
if (typeof options.distinctUntilChanged === "function") {
|
|
10313
|
+
eventStream = eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged));
|
|
10314
|
+
} else {
|
|
10315
|
+
eventStream = eventStream.pipe(distinctUntilChanged());
|
|
10316
|
+
}
|
|
10317
|
+
}
|
|
10318
|
+
const subscription = eventStream.subscribe({
|
|
10319
|
+
next: (event2) => {
|
|
10320
|
+
handler(event2).catch((err) => console.error("Event handler error:", err));
|
|
10321
|
+
},
|
|
10322
|
+
error: (err) => console.error("Event stream error:", err)
|
|
10323
|
+
});
|
|
10324
|
+
const wrappedHandler = (event2) => {
|
|
10325
|
+
eventSubject.next(event2);
|
|
10222
10326
|
};
|
|
10223
|
-
t.addEventListener(type,
|
|
10224
|
-
this._boundListeners.push({ target: t, type, handler, options: opts });
|
|
10327
|
+
t.addEventListener(type, wrappedHandler, opts);
|
|
10328
|
+
this._boundListeners.push({ target: t, type, handler: wrappedHandler, options: opts, subscription });
|
|
10225
10329
|
});
|
|
10226
10330
|
});
|
|
10227
10331
|
if (originalConnected) await originalConnected.apply(this);
|
|
@@ -10261,7 +10365,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10261
10365
|
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
10262
10366
|
for (const m of bMethods) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
10263
10367
|
if (this._boundListeners) {
|
|
10264
|
-
this._boundListeners.forEach((l) =>
|
|
10368
|
+
this._boundListeners.forEach((l) => {
|
|
10369
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
10370
|
+
if (l.subscription && typeof l.subscription.unsubscribe === "function") {
|
|
10371
|
+
l.subscription.unsubscribe();
|
|
10372
|
+
}
|
|
10373
|
+
});
|
|
10265
10374
|
this._boundListeners = [];
|
|
10266
10375
|
}
|
|
10267
10376
|
new ElementApply(this, { id: this._swcId }).removeAllEventListener();
|
|
@@ -10344,6 +10453,13 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10344
10453
|
|
|
10345
10454
|
// src/decorators/applyAttribute.ts
|
|
10346
10455
|
var ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
|
|
10456
|
+
var isCssSelector = (str) => {
|
|
10457
|
+
if (!str) return false;
|
|
10458
|
+
if (str.startsWith("$")) return true;
|
|
10459
|
+
if (/^[#.\[\:>+~]/.test(str)) return true;
|
|
10460
|
+
if (/[>+~:\[\]]/.test(str)) return true;
|
|
10461
|
+
return false;
|
|
10462
|
+
};
|
|
10347
10463
|
var convertValue2 = (val, type) => {
|
|
10348
10464
|
if (val === null || val === void 0) return val;
|
|
10349
10465
|
if (type === Number) return Number(val);
|
|
@@ -10473,13 +10589,22 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10473
10589
|
descriptor.value = function(...args) {
|
|
10474
10590
|
ensureInit(this);
|
|
10475
10591
|
const res = original.apply(this, args);
|
|
10592
|
+
const extractValue = (v) => {
|
|
10593
|
+
const keyToUse = finalOptions.valueKey ?? ATTRIBUTE_METADATA_KEY;
|
|
10594
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10595
|
+
return v[keyToUse];
|
|
10596
|
+
}
|
|
10597
|
+
return v;
|
|
10598
|
+
};
|
|
10476
10599
|
if (res instanceof Promise) {
|
|
10477
10600
|
return res.then((v) => {
|
|
10478
|
-
|
|
10601
|
+
const extracted = extractValue(v);
|
|
10602
|
+
applyValueToTargets(this, extracted);
|
|
10479
10603
|
return v;
|
|
10480
10604
|
});
|
|
10481
10605
|
} else {
|
|
10482
|
-
|
|
10606
|
+
const extracted = extractValue(res);
|
|
10607
|
+
applyValueToTargets(this, extracted);
|
|
10483
10608
|
return res;
|
|
10484
10609
|
}
|
|
10485
10610
|
};
|
|
@@ -10505,35 +10630,32 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10505
10630
|
});
|
|
10506
10631
|
};
|
|
10507
10632
|
}
|
|
10508
|
-
function attribute(
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
if (typeof
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
return applyAttribute("$this", void 0, {});
|
|
10633
|
+
function attribute(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor) {
|
|
10634
|
+
if (optionsOrDescriptor !== void 0 && (typeof attributeNameOrOptions === "string" || typeof attributeNameOrOptions === "symbol")) {
|
|
10635
|
+
return applyAttribute("$this", void 0, {})(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor);
|
|
10636
|
+
}
|
|
10637
|
+
if (typeof selectorOrAttributeOrTarget === "string") {
|
|
10638
|
+
const isSelector = isCssSelector(selectorOrAttributeOrTarget);
|
|
10639
|
+
if (isSelector) {
|
|
10640
|
+
return applyAttribute(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor);
|
|
10641
|
+
} else {
|
|
10642
|
+
const options = typeof attributeNameOrOptions === "object" && attributeNameOrOptions !== null ? attributeNameOrOptions : {};
|
|
10643
|
+
return applyAttribute("$this", selectorOrAttributeOrTarget, options);
|
|
10644
|
+
}
|
|
10521
10645
|
}
|
|
10646
|
+
return applyAttribute("$this", void 0, selectorOrAttributeOrTarget);
|
|
10522
10647
|
}
|
|
10523
|
-
function setAttribute(
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
10533
|
-
return applyAttribute("$this", void 0, targetOrOptions);
|
|
10534
|
-
} else {
|
|
10535
|
-
return applyAttribute("$this", void 0, {});
|
|
10648
|
+
function setAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined) {
|
|
10649
|
+
if (typeof selectorOrAttributeOrOptions === "string") {
|
|
10650
|
+
const isSelector = isCssSelector(selectorOrAttributeOrOptions);
|
|
10651
|
+
if (isSelector) {
|
|
10652
|
+
return applyAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined);
|
|
10653
|
+
} else {
|
|
10654
|
+
const options = typeof attributeNameOrOptions === "object" && attributeNameOrOptions !== null ? attributeNameOrOptions : {};
|
|
10655
|
+
return applyAttribute("$this", selectorOrAttributeOrOptions, options);
|
|
10656
|
+
}
|
|
10536
10657
|
}
|
|
10658
|
+
return applyAttribute("$this", void 0, selectorOrAttributeOrOptions);
|
|
10537
10659
|
}
|
|
10538
10660
|
var findAllAttributeMetadata = (target) => {
|
|
10539
10661
|
const actualTarget = target instanceof Function ? target : target.constructor;
|
|
@@ -10551,6 +10673,10 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10551
10673
|
var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
10552
10674
|
var applyToDom = (currentThis, targetEl, res, pos, win, host) => {
|
|
10553
10675
|
if (!targetEl) return;
|
|
10676
|
+
if (pos === "clearChildren") {
|
|
10677
|
+
targetEl.replaceChildren();
|
|
10678
|
+
return [];
|
|
10679
|
+
}
|
|
10554
10680
|
const doc = win.document;
|
|
10555
10681
|
const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
|
|
10556
10682
|
const id = currentThis._swcId;
|
|
@@ -10586,7 +10712,16 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10586
10712
|
new ElementApply(targetEl, { id }).apply({ target: "noInitialized", context: stateContext, bind: currentThis });
|
|
10587
10713
|
return nodes;
|
|
10588
10714
|
};
|
|
10589
|
-
function applyNode(
|
|
10715
|
+
function applyNode(selectorOrOptions, maybeOptions) {
|
|
10716
|
+
let selector;
|
|
10717
|
+
let options;
|
|
10718
|
+
if (typeof selectorOrOptions === "string") {
|
|
10719
|
+
selector = selectorOrOptions;
|
|
10720
|
+
options = maybeOptions || { position: "replaceChildren" };
|
|
10721
|
+
} else {
|
|
10722
|
+
selector = "$this";
|
|
10723
|
+
options = selectorOrOptions || { position: "replaceChildren" };
|
|
10724
|
+
}
|
|
10590
10725
|
return (targetObj, propertyKey, descriptor) => {
|
|
10591
10726
|
const constructor = targetObj.constructor;
|
|
10592
10727
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor);
|
|
@@ -10623,6 +10758,13 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10623
10758
|
};
|
|
10624
10759
|
const targetEl = getTarget();
|
|
10625
10760
|
const res = original.apply(this, args);
|
|
10761
|
+
const extractValue = (v) => {
|
|
10762
|
+
const keyToUse = options.valueKey ?? APPLY_NODE_METADATA_KEY;
|
|
10763
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10764
|
+
return v[keyToUse];
|
|
10765
|
+
}
|
|
10766
|
+
return v;
|
|
10767
|
+
};
|
|
10626
10768
|
const runApply = (target, val) => {
|
|
10627
10769
|
const pos = options.position || "beforeEnd";
|
|
10628
10770
|
const processedVal = val;
|
|
@@ -10637,103 +10779,154 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10637
10779
|
}
|
|
10638
10780
|
if (res instanceof Promise) {
|
|
10639
10781
|
return res.then((finalRes) => {
|
|
10782
|
+
const extracted = extractValue(finalRes);
|
|
10640
10783
|
fallbackNodes.forEach((it) => it.remove());
|
|
10641
|
-
if (
|
|
10784
|
+
if (extracted !== void 0 && targetEl) runApply(targetEl, extracted);
|
|
10642
10785
|
return finalRes;
|
|
10643
10786
|
});
|
|
10644
10787
|
} else {
|
|
10645
|
-
|
|
10788
|
+
const extracted = extractValue(res);
|
|
10789
|
+
if (extracted !== void 0 && targetEl) runApply(targetEl, extracted);
|
|
10646
10790
|
return res;
|
|
10647
10791
|
}
|
|
10648
10792
|
};
|
|
10649
10793
|
};
|
|
10650
10794
|
}
|
|
10651
|
-
function
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10660
|
-
const opt = targetOrOptions || {};
|
|
10661
|
-
return applyNode("$this", { ...opt, ...option });
|
|
10662
|
-
}
|
|
10663
|
-
function beforeEndNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10664
|
-
const options = { position: "beforeEnd" };
|
|
10665
|
-
if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
|
|
10666
|
-
const opt = targetOrOptions || {};
|
|
10667
|
-
return applyNode("$this", { ...opt, ...options });
|
|
10668
|
-
}
|
|
10669
|
-
function beforeEndLightNodeThis(targetOrOptions, propertyKey, descriptor) {
|
|
10670
|
-
const option = { position: "beforeEnd", root: "light" };
|
|
10671
|
-
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10672
|
-
const opt = targetOrOptions || {};
|
|
10673
|
-
return applyNode("$this", { ...opt, ...option });
|
|
10795
|
+
function replaceChildren(selectorOrOptions, maybeOptions, descriptor) {
|
|
10796
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10797
|
+
return applyNode({ position: "replaceChildren" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10798
|
+
}
|
|
10799
|
+
if (typeof selectorOrOptions === "string") {
|
|
10800
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren" });
|
|
10801
|
+
}
|
|
10802
|
+
return applyNode({ ...selectorOrOptions, position: "replaceChildren" });
|
|
10674
10803
|
}
|
|
10675
|
-
function
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10804
|
+
function clearChildrenNode(selectorOrOptions, maybeOptions, descriptor) {
|
|
10805
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10806
|
+
return applyNode({ position: "clearChildren" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10807
|
+
}
|
|
10808
|
+
if (typeof selectorOrOptions === "string") {
|
|
10809
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren" });
|
|
10810
|
+
}
|
|
10811
|
+
return applyNode({ ...selectorOrOptions, position: "clearChildren" });
|
|
10680
10812
|
}
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
if (
|
|
10684
|
-
|
|
10685
|
-
|
|
10813
|
+
var clearNode = clearChildrenNode;
|
|
10814
|
+
function innerHtml(selectorOrOptions, maybeOptions, descriptor) {
|
|
10815
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10816
|
+
return applyNode({ position: "innerHtml" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10817
|
+
}
|
|
10818
|
+
if (typeof selectorOrOptions === "string") {
|
|
10819
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml" });
|
|
10820
|
+
}
|
|
10821
|
+
return applyNode({ ...selectorOrOptions, position: "innerHtml" });
|
|
10686
10822
|
}
|
|
10687
|
-
function
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10823
|
+
function innerHtmlLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
10824
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10825
|
+
return applyNode({ position: "innerHtml", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10826
|
+
}
|
|
10827
|
+
if (typeof selectorOrOptions === "string") {
|
|
10828
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "light" });
|
|
10829
|
+
}
|
|
10830
|
+
return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "light" });
|
|
10692
10831
|
}
|
|
10693
|
-
function
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10832
|
+
function innerHtmlShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
10833
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10834
|
+
return applyNode({ position: "innerHtml", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10835
|
+
}
|
|
10836
|
+
if (typeof selectorOrOptions === "string") {
|
|
10837
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "shadow" });
|
|
10838
|
+
}
|
|
10839
|
+
return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "shadow" });
|
|
10698
10840
|
}
|
|
10699
|
-
function
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10841
|
+
function innerText(selectorOrOptions, maybeOptions, descriptor) {
|
|
10842
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10843
|
+
return applyNode({ position: "innerText" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10844
|
+
}
|
|
10845
|
+
if (typeof selectorOrOptions === "string") {
|
|
10846
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText" });
|
|
10847
|
+
}
|
|
10848
|
+
return applyNode({ ...selectorOrOptions, position: "innerText" });
|
|
10704
10849
|
}
|
|
10705
|
-
function
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10850
|
+
function innerTextLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
10851
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10852
|
+
return applyNode({ position: "innerText", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10853
|
+
}
|
|
10854
|
+
if (typeof selectorOrOptions === "string") {
|
|
10855
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "light" });
|
|
10856
|
+
}
|
|
10857
|
+
return applyNode({ ...selectorOrOptions, position: "innerText", root: "light" });
|
|
10710
10858
|
}
|
|
10711
|
-
function
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10859
|
+
function innerTextShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
10860
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10861
|
+
return applyNode({ position: "innerText", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10862
|
+
}
|
|
10863
|
+
if (typeof selectorOrOptions === "string") {
|
|
10864
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "shadow" });
|
|
10865
|
+
}
|
|
10866
|
+
return applyNode({ ...selectorOrOptions, position: "innerText", root: "shadow" });
|
|
10716
10867
|
}
|
|
10717
|
-
function
|
|
10718
|
-
|
|
10868
|
+
function insertBeforeEnd(selectorOrOptions, maybeOptions, descriptor) {
|
|
10869
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10870
|
+
return applyNode({ position: "beforeEnd" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10871
|
+
}
|
|
10872
|
+
if (typeof selectorOrOptions === "string") {
|
|
10873
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd" });
|
|
10874
|
+
}
|
|
10875
|
+
return applyNode({ ...selectorOrOptions, position: "beforeEnd" });
|
|
10719
10876
|
}
|
|
10720
|
-
function
|
|
10721
|
-
|
|
10877
|
+
function insertBeforeEndLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
10878
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10879
|
+
return applyNode({ position: "beforeEnd", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10880
|
+
}
|
|
10881
|
+
if (typeof selectorOrOptions === "string") {
|
|
10882
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "light" });
|
|
10883
|
+
}
|
|
10884
|
+
return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "light" });
|
|
10722
10885
|
}
|
|
10723
|
-
function
|
|
10724
|
-
|
|
10886
|
+
function insertBeforeEndShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
10887
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10888
|
+
return applyNode({ position: "beforeEnd", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10889
|
+
}
|
|
10890
|
+
if (typeof selectorOrOptions === "string") {
|
|
10891
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "shadow" });
|
|
10892
|
+
}
|
|
10893
|
+
return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "shadow" });
|
|
10725
10894
|
}
|
|
10726
|
-
function
|
|
10727
|
-
|
|
10895
|
+
function insertAfterBegin(selectorOrOptions, maybeOptions, descriptor) {
|
|
10896
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10897
|
+
return applyNode({ position: "afterBegin" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10898
|
+
}
|
|
10899
|
+
if (typeof selectorOrOptions === "string") {
|
|
10900
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin" });
|
|
10901
|
+
}
|
|
10902
|
+
return applyNode({ ...selectorOrOptions, position: "afterBegin" });
|
|
10728
10903
|
}
|
|
10729
|
-
function
|
|
10730
|
-
|
|
10904
|
+
function insertAfterBeginLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
10905
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10906
|
+
return applyNode({ position: "afterBegin", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10907
|
+
}
|
|
10908
|
+
if (typeof selectorOrOptions === "string") {
|
|
10909
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin", root: "light" });
|
|
10910
|
+
}
|
|
10911
|
+
return applyNode({ ...selectorOrOptions, position: "afterBegin", root: "light" });
|
|
10731
10912
|
}
|
|
10732
|
-
function
|
|
10733
|
-
|
|
10913
|
+
function replaceChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
10914
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10915
|
+
return applyNode({ position: "replaceChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10916
|
+
}
|
|
10917
|
+
if (typeof selectorOrOptions === "string") {
|
|
10918
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren", root: "light" });
|
|
10919
|
+
}
|
|
10920
|
+
return applyNode({ ...selectorOrOptions, position: "replaceChildren", root: "light" });
|
|
10734
10921
|
}
|
|
10735
|
-
function
|
|
10736
|
-
|
|
10922
|
+
function clearChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
10923
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
10924
|
+
return applyNode({ position: "clearChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
10925
|
+
}
|
|
10926
|
+
if (typeof selectorOrOptions === "string") {
|
|
10927
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren", root: "light" });
|
|
10928
|
+
}
|
|
10929
|
+
return applyNode({ ...selectorOrOptions, position: "clearChildren", root: "light" });
|
|
10737
10930
|
}
|
|
10738
10931
|
var findAllApplyNodeMetadata = (target) => {
|
|
10739
10932
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -10769,6 +10962,13 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10769
10962
|
descriptor.value = function(...args) {
|
|
10770
10963
|
ensureInit(this);
|
|
10771
10964
|
const res = original.apply(this, args);
|
|
10965
|
+
const extractValue = (v) => {
|
|
10966
|
+
const keyToUse = finalOptions.valueKey ?? CLASS_METADATA_KEY;
|
|
10967
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10968
|
+
return v[keyToUse];
|
|
10969
|
+
}
|
|
10970
|
+
return v;
|
|
10971
|
+
};
|
|
10772
10972
|
const handleResult = (resolvedValue) => {
|
|
10773
10973
|
if (resolvedValue !== void 0) {
|
|
10774
10974
|
const win = this.ownerDocument?.defaultView || window;
|
|
@@ -10848,31 +11048,73 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10848
11048
|
return resolvedValue;
|
|
10849
11049
|
};
|
|
10850
11050
|
if (res instanceof Promise) {
|
|
10851
|
-
return res.then(handleResult);
|
|
11051
|
+
return res.then((v) => handleResult(extractValue(v)));
|
|
10852
11052
|
} else {
|
|
10853
|
-
return handleResult(res);
|
|
11053
|
+
return handleResult(extractValue(res));
|
|
10854
11054
|
}
|
|
10855
11055
|
};
|
|
10856
11056
|
return descriptor;
|
|
10857
11057
|
};
|
|
10858
11058
|
};
|
|
10859
11059
|
}
|
|
10860
|
-
function applyClass(
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
11060
|
+
function applyClass(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
|
|
11061
|
+
if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
11062
|
+
return createClassDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
|
|
11063
|
+
}
|
|
11064
|
+
if (typeof selectorOrTarget === "string") {
|
|
11065
|
+
const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
|
|
11066
|
+
const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
|
|
11067
|
+
return createClassDecorator(action2)(selectorOrTarget, options2);
|
|
11068
|
+
}
|
|
11069
|
+
const action = typeof selectorOrTarget === "string" ? selectorOrTarget : "update";
|
|
11070
|
+
const options = typeof selectorOrTarget === "object" ? selectorOrTarget : actionOrPropertyKey;
|
|
10869
11071
|
return createClassDecorator(action)("$this", options);
|
|
10870
11072
|
}
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
11073
|
+
function setClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
11074
|
+
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
11075
|
+
return createClassDecorator("set")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11076
|
+
}
|
|
11077
|
+
if (typeof selectorOrTarget === "string") {
|
|
11078
|
+
return createClassDecorator("set")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11079
|
+
}
|
|
11080
|
+
return createClassDecorator("set")("$this", selectorOrTarget);
|
|
11081
|
+
}
|
|
11082
|
+
function updateClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
11083
|
+
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
11084
|
+
return createClassDecorator("update")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11085
|
+
}
|
|
11086
|
+
if (typeof selectorOrTarget === "string") {
|
|
11087
|
+
return createClassDecorator("update")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11088
|
+
}
|
|
11089
|
+
return createClassDecorator("update")("$this", selectorOrTarget);
|
|
11090
|
+
}
|
|
11091
|
+
function addClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
11092
|
+
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
11093
|
+
return createClassDecorator("add")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11094
|
+
}
|
|
11095
|
+
if (typeof selectorOrTarget === "string") {
|
|
11096
|
+
return createClassDecorator("add")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11097
|
+
}
|
|
11098
|
+
return createClassDecorator("add")("$this", selectorOrTarget);
|
|
11099
|
+
}
|
|
11100
|
+
function removeClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
11101
|
+
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
11102
|
+
return createClassDecorator("remove")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11103
|
+
}
|
|
11104
|
+
if (typeof selectorOrTarget === "string") {
|
|
11105
|
+
return createClassDecorator("remove")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11106
|
+
}
|
|
11107
|
+
return createClassDecorator("remove")("$this", selectorOrTarget);
|
|
11108
|
+
}
|
|
11109
|
+
function toggleClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
11110
|
+
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
11111
|
+
return createClassDecorator("toggle")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11112
|
+
}
|
|
11113
|
+
if (typeof selectorOrTarget === "string") {
|
|
11114
|
+
return createClassDecorator("toggle")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
11115
|
+
}
|
|
11116
|
+
return createClassDecorator("toggle")("$this", selectorOrTarget);
|
|
11117
|
+
}
|
|
10876
11118
|
var findAllClassMetadata = (target) => {
|
|
10877
11119
|
const result = /* @__PURE__ */ new Map();
|
|
10878
11120
|
const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
|
|
@@ -10900,6 +11142,13 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10900
11142
|
descriptor.value = function(...args) {
|
|
10901
11143
|
ensureInit(this);
|
|
10902
11144
|
const res = original.apply(this, args);
|
|
11145
|
+
const extractValue = (v) => {
|
|
11146
|
+
const keyToUse = options.valueKey ?? STYLE_METADATA_KEY;
|
|
11147
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
11148
|
+
return v[keyToUse];
|
|
11149
|
+
}
|
|
11150
|
+
return v;
|
|
11151
|
+
};
|
|
10903
11152
|
const handleResult = (resolvedValue) => {
|
|
10904
11153
|
if (resolvedValue !== void 0) {
|
|
10905
11154
|
const win = this.ownerDocument?.defaultView || window;
|
|
@@ -10965,27 +11214,55 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10965
11214
|
return resolvedValue;
|
|
10966
11215
|
};
|
|
10967
11216
|
if (res instanceof Promise) {
|
|
10968
|
-
return res.then(handleResult);
|
|
11217
|
+
return res.then((v) => handleResult(extractValue(v)));
|
|
10969
11218
|
} else {
|
|
10970
|
-
return handleResult(res);
|
|
11219
|
+
return handleResult(extractValue(res));
|
|
10971
11220
|
}
|
|
10972
11221
|
};
|
|
10973
11222
|
return descriptor;
|
|
10974
11223
|
};
|
|
10975
11224
|
};
|
|
10976
11225
|
}
|
|
10977
|
-
function applyStyle(
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
11226
|
+
function applyStyle(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
|
|
11227
|
+
if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
11228
|
+
return createStyleDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
|
|
11229
|
+
}
|
|
11230
|
+
if (typeof selectorOrTarget === "string") {
|
|
11231
|
+
const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
|
|
11232
|
+
const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
|
|
11233
|
+
return createStyleDecorator(action2)(selectorOrTarget, options2);
|
|
11234
|
+
}
|
|
11235
|
+
const action = typeof selectorOrTarget === "string" ? selectorOrTarget : "update";
|
|
11236
|
+
const options = typeof selectorOrTarget === "object" ? selectorOrTarget : actionOrPropertyKey;
|
|
10984
11237
|
return createStyleDecorator(action)("$this", options);
|
|
10985
11238
|
}
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
11239
|
+
function setStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
11240
|
+
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
11241
|
+
return createStyleDecorator("set")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
11242
|
+
}
|
|
11243
|
+
if (typeof selectorOrTarget === "string") {
|
|
11244
|
+
return createStyleDecorator("set")(selectorOrTarget, optionsOrPropertyKey);
|
|
11245
|
+
}
|
|
11246
|
+
return createStyleDecorator("set")("$this", selectorOrTarget);
|
|
11247
|
+
}
|
|
11248
|
+
function updateStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
11249
|
+
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
11250
|
+
return createStyleDecorator("update")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
11251
|
+
}
|
|
11252
|
+
if (typeof selectorOrTarget === "string") {
|
|
11253
|
+
return createStyleDecorator("update")(selectorOrTarget, optionsOrPropertyKey);
|
|
11254
|
+
}
|
|
11255
|
+
return createStyleDecorator("update")("$this", selectorOrTarget);
|
|
11256
|
+
}
|
|
11257
|
+
function removeStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
11258
|
+
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
11259
|
+
return createStyleDecorator("remove")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
11260
|
+
}
|
|
11261
|
+
if (typeof selectorOrTarget === "string") {
|
|
11262
|
+
return createStyleDecorator("remove")(selectorOrTarget, optionsOrPropertyKey);
|
|
11263
|
+
}
|
|
11264
|
+
return createStyleDecorator("remove")("$this", selectorOrTarget);
|
|
11265
|
+
}
|
|
10989
11266
|
var findAllStyleMetadata = (target) => {
|
|
10990
11267
|
const result = /* @__PURE__ */ new Map();
|
|
10991
11268
|
const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
|
|
@@ -11033,6 +11310,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11033
11310
|
}
|
|
11034
11311
|
return createSubscribeSwcAppRouteChangeWhileConnected(options);
|
|
11035
11312
|
}
|
|
11313
|
+
var changedRoute = subscribeSwcAppRouteChangeWhileConnected;
|
|
11036
11314
|
var getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
|
|
11037
11315
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
11038
11316
|
const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
@@ -11073,6 +11351,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11073
11351
|
}
|
|
11074
11352
|
return createSubscribeSwcAppMessageWhileConnected(options, messageType);
|
|
11075
11353
|
}
|
|
11354
|
+
var receiveMessage = subscribeSwcAppMessageWhileConnected;
|
|
11076
11355
|
var getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
|
|
11077
11356
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
11078
11357
|
return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
@@ -11080,7 +11359,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11080
11359
|
|
|
11081
11360
|
// src/decorators/publishSwcAppMessage.ts
|
|
11082
11361
|
var PUBLISH_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for("simple-web-component:publish-swc-app-message");
|
|
11083
|
-
function createPublishSwcAppMessage(messageType) {
|
|
11362
|
+
function createPublishSwcAppMessage(messageType, options) {
|
|
11084
11363
|
return (target, propertyKey, descriptor) => {
|
|
11085
11364
|
const constructor = target.constructor;
|
|
11086
11365
|
let list = ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
|
|
@@ -11095,45 +11374,58 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11095
11374
|
const originalMethod = descriptor.value;
|
|
11096
11375
|
descriptor.value = function(...args) {
|
|
11097
11376
|
const result = originalMethod.apply(this, args);
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
});
|
|
11107
|
-
}
|
|
11108
|
-
}).catch((err) => {
|
|
11109
|
-
console.warn("publishSwcAppMessage async error:", err);
|
|
11110
|
-
});
|
|
11111
|
-
} else {
|
|
11377
|
+
const extractValue = (v) => {
|
|
11378
|
+
const keyToUse = options?.valueKey ?? PUBLISH_SWC_APP_MESSAGE_METADATA_KEY;
|
|
11379
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
11380
|
+
return v[keyToUse];
|
|
11381
|
+
}
|
|
11382
|
+
return v;
|
|
11383
|
+
};
|
|
11384
|
+
const publishMessage2 = (data) => {
|
|
11112
11385
|
const appHost = SwcUtils.getAppHost(this);
|
|
11113
11386
|
if (appHost) {
|
|
11114
11387
|
appHost.publishMessage({
|
|
11115
11388
|
publisher: this,
|
|
11116
|
-
data
|
|
11389
|
+
data,
|
|
11117
11390
|
type: messageType
|
|
11118
11391
|
});
|
|
11119
11392
|
}
|
|
11393
|
+
};
|
|
11394
|
+
if (result instanceof Promise) {
|
|
11395
|
+
result.then((data) => {
|
|
11396
|
+
const extracted = extractValue(data);
|
|
11397
|
+
publishMessage2(extracted);
|
|
11398
|
+
}).catch((err) => {
|
|
11399
|
+
console.warn("publishSwcAppMessage async error:", err);
|
|
11400
|
+
});
|
|
11401
|
+
} else {
|
|
11402
|
+
const extracted = extractValue(result);
|
|
11403
|
+
publishMessage2(extracted);
|
|
11120
11404
|
}
|
|
11121
11405
|
return result;
|
|
11122
11406
|
};
|
|
11123
11407
|
return descriptor;
|
|
11124
11408
|
};
|
|
11125
11409
|
}
|
|
11126
|
-
function publishSwcAppMessage(
|
|
11127
|
-
if (
|
|
11128
|
-
const target =
|
|
11129
|
-
return createPublishSwcAppMessage()(target,
|
|
11410
|
+
function publishSwcAppMessage(targetOrMessageTypeOrOptions, propertyKeyOrOptions, descriptor) {
|
|
11411
|
+
if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object" && propertyKeyOrOptions && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") && descriptor) {
|
|
11412
|
+
const target = targetOrMessageTypeOrOptions;
|
|
11413
|
+
return createPublishSwcAppMessage()(target, propertyKeyOrOptions, descriptor);
|
|
11130
11414
|
}
|
|
11131
11415
|
let messageType;
|
|
11132
|
-
|
|
11133
|
-
|
|
11416
|
+
let options;
|
|
11417
|
+
if (typeof targetOrMessageTypeOrOptions === "string") {
|
|
11418
|
+
messageType = targetOrMessageTypeOrOptions;
|
|
11419
|
+
if (typeof propertyKeyOrOptions === "object" && propertyKeyOrOptions !== null) {
|
|
11420
|
+
options = propertyKeyOrOptions;
|
|
11421
|
+
}
|
|
11422
|
+
} else if (typeof targetOrMessageTypeOrOptions === "object" && targetOrMessageTypeOrOptions !== null) {
|
|
11423
|
+
options = targetOrMessageTypeOrOptions;
|
|
11424
|
+
messageType = options.messageType;
|
|
11134
11425
|
}
|
|
11135
|
-
return createPublishSwcAppMessage(messageType);
|
|
11426
|
+
return createPublishSwcAppMessage(messageType, options);
|
|
11136
11427
|
}
|
|
11428
|
+
var publishMessage = publishSwcAppMessage;
|
|
11137
11429
|
var getPublishSwcAppMessageMetadata = (target) => {
|
|
11138
11430
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
11139
11431
|
return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
|
|
@@ -11193,15 +11485,24 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11193
11485
|
fallbackNodes.push(...nodes);
|
|
11194
11486
|
applyToDom2(swcId, targetId, options.position, nodes);
|
|
11195
11487
|
}
|
|
11488
|
+
const extractValue = (v) => {
|
|
11489
|
+
const keyToUse = options.valueKey ?? APPLY_SLOT_METADATA_KEY;
|
|
11490
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
11491
|
+
return v[keyToUse];
|
|
11492
|
+
}
|
|
11493
|
+
return v;
|
|
11494
|
+
};
|
|
11196
11495
|
let res = original.apply(this, args);
|
|
11197
11496
|
if (res instanceof Promise) {
|
|
11198
11497
|
return res.then((asyncRes) => {
|
|
11199
|
-
const
|
|
11498
|
+
const extracted = extractValue(asyncRes);
|
|
11499
|
+
const nodes = resToNodes(extracted);
|
|
11200
11500
|
fallbackNodes.forEach((it) => it.remove());
|
|
11201
11501
|
applyToDom2(swcId, targetId, options.position, nodes);
|
|
11202
11502
|
});
|
|
11203
11503
|
} else {
|
|
11204
|
-
const
|
|
11504
|
+
const extracted = extractValue(res);
|
|
11505
|
+
const nodes = resToNodes(extracted);
|
|
11205
11506
|
applyToDom2(swcId, targetId, options.position, nodes);
|
|
11206
11507
|
}
|
|
11207
11508
|
};
|
|
@@ -13241,6 +13542,10 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
13241
13542
|
super(config);
|
|
13242
13543
|
__publicField(this, "_history", []);
|
|
13243
13544
|
__publicField(this, "_currentIndex", -1);
|
|
13545
|
+
if (config.firstUrl) {
|
|
13546
|
+
this._history.push({ url: config.firstUrl, data: null, title: void 0 });
|
|
13547
|
+
this._currentIndex = 0;
|
|
13548
|
+
}
|
|
13244
13549
|
}
|
|
13245
13550
|
// Override pushState to manage internal history
|
|
13246
13551
|
pushState(data, title, path, config) {
|
|
@@ -13412,7 +13717,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
13412
13717
|
if (this.router) otherInstanceSim.set(Router, this.router);
|
|
13413
13718
|
this.simpleApplication.run(otherInstanceSim);
|
|
13414
13719
|
if (this._config.onStartedLazyDefineComponent) {
|
|
13415
|
-
await Promise.all(this._config.onStartedLazyDefineComponent.map((it) =>
|
|
13720
|
+
await Promise.all(this._config.onStartedLazyDefineComponent.map((it) => {
|
|
13721
|
+
it(this._config.window);
|
|
13722
|
+
}));
|
|
13416
13723
|
}
|
|
13417
13724
|
if (this._config.onEngineStarted) {
|
|
13418
13725
|
await this._config.onEngineStarted(this.simpleApplication, this.host);
|
|
@@ -13489,6 +13796,13 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
13489
13796
|
const methodName = metadata.propertyKey;
|
|
13490
13797
|
let pathPattern = metadata.options?.path;
|
|
13491
13798
|
const filter = metadata.options?.filter;
|
|
13799
|
+
const extractValue = (v) => {
|
|
13800
|
+
const keyToUse = metadata.options?.valueKey ?? SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY;
|
|
13801
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
13802
|
+
return v[keyToUse];
|
|
13803
|
+
}
|
|
13804
|
+
return v;
|
|
13805
|
+
};
|
|
13492
13806
|
if (typeof pathPattern === "function") {
|
|
13493
13807
|
pathPattern = pathPattern(instance);
|
|
13494
13808
|
}
|
|
@@ -13513,7 +13827,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
13513
13827
|
const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
|
|
13514
13828
|
const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
|
|
13515
13829
|
if (pathMatched && filterPassed && instance[methodName]) {
|
|
13516
|
-
const result = await instance[methodName]({ ...re, pathData });
|
|
13830
|
+
const result = extractValue(await instance[methodName]({ ...re, pathData }));
|
|
13517
13831
|
if (result !== void 0 && result !== null) {
|
|
13518
13832
|
break;
|
|
13519
13833
|
}
|
|
@@ -13628,7 +13942,15 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
13628
13942
|
context: this,
|
|
13629
13943
|
args: SwcUtils.getHelperAndHostSet(win, this)
|
|
13630
13944
|
});
|
|
13631
|
-
|
|
13945
|
+
if (userConfig instanceof Promise) {
|
|
13946
|
+
userConfig.then((resolvedConfig) => {
|
|
13947
|
+
this.connect(resolvedConfig);
|
|
13948
|
+
}).catch((e) => {
|
|
13949
|
+
console.error("[SWC-MIXIN] Script execution failed:", e);
|
|
13950
|
+
});
|
|
13951
|
+
} else {
|
|
13952
|
+
this.connect(userConfig);
|
|
13953
|
+
}
|
|
13632
13954
|
} catch (e) {
|
|
13633
13955
|
console.error("[SWC-MIXIN] Script execution failed:", e);
|
|
13634
13956
|
}
|