@dooboostore/simple-web-component 1.0.47 → 1.0.48
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 +109 -11
- package/dist/cjs/decorators/addEventListener.js +45 -7
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +225 -6
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/index.js +2 -0
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/mutationObserver.js +104 -0
- package/dist/cjs/decorators/mutationObserver.js.map +7 -0
- package/dist/cjs/decorators/query.js +13 -1
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/resizeObserver.js +104 -0
- package/dist/cjs/decorators/resizeObserver.js.map +7 -0
- package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/esm/decorators/addEventListener.js +45 -7
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +225 -6
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/index.js +2 -0
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/mutationObserver.js +85 -0
- package/dist/esm/decorators/mutationObserver.js.map +7 -0
- package/dist/esm/decorators/query.js +13 -1
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/resizeObserver.js +85 -0
- package/dist/esm/decorators/resizeObserver.js.map +7 -0
- package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
- package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +446 -13
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/addEventListener.d.ts +24 -5
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts +14 -0
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +2 -0
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/mutationObserver.d.ts +36 -0
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -0
- package/dist/types/decorators/query.d.ts +12 -0
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/resizeObserver.d.ts +37 -0
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -0
- package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +446 -13
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +4 -4
- package/src/decorators/addEventListener.ts +52 -9
- package/src/decorators/elementDefine.ts +330 -47
- package/src/decorators/index.ts +2 -0
- package/src/decorators/mutationObserver.ts +128 -0
- package/src/decorators/query.ts +23 -0
- package/src/decorators/resizeObserver.ts +129 -0
- package/src/examples/RxJSOperatorsExample.ts +279 -0
- package/dist/cjs/elements/tt/SwcAppMixin.js +0 -1
- package/dist/cjs/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsync.js +0 -1
- package/dist/cjs/elements/tt/SwcAsync.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChoose.js +0 -1
- package/dist/cjs/elements/tt/SwcChoose.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIf.js +0 -1
- package/dist/cjs/elements/tt/SwcIf.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoop.js +0 -1
- package/dist/cjs/elements/tt/SwcLoop.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/cjs/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/cjs/elements/tt/register.js +0 -1
- package/dist/cjs/elements/tt/register.js.map +0 -7
- package/dist/esm/elements/tt/SwcAppMixin.js +0 -1
- package/dist/esm/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsync.js +0 -1
- package/dist/esm/elements/tt/SwcAsync.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcChoose.js +0 -1
- package/dist/esm/elements/tt/SwcChoose.js.map +0 -7
- package/dist/esm/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcIf.js +0 -1
- package/dist/esm/elements/tt/SwcIf.js.map +0 -7
- package/dist/esm/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoop.js +0 -1
- package/dist/esm/elements/tt/SwcLoop.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/esm/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/esm/elements/tt/register.js +0 -1
- package/dist/esm/elements/tt/register.js.map +0 -7
- package/dist/types/elements/tt/SwcAppMixin.d.ts +0 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +0 -1
- package/dist/types/elements/tt/register.d.ts +0 -1
- package/dist/types/elements/tt/register.d.ts.map +0 -1
- package/src/elements/tt/SwcAppMixin.ts +0 -13
- package/src/elements/tt/SwcAsync.ts +0 -139
- package/src/elements/tt/SwcAsyncTemplate.ts +0 -126
- package/src/elements/tt/SwcChoose.ts +0 -182
- package/src/elements/tt/SwcChooseTemplate.ts +0 -229
- package/src/elements/tt/SwcIf.ts +0 -145
- package/src/elements/tt/SwcIfTemplate.ts +0 -158
- package/src/elements/tt/SwcLoop.ts +0 -222
- package/src/elements/tt/SwcLoopTemplate.ts +0 -255
- package/src/elements/tt/SwcSubTemplates.ts +0 -6
- package/src/elements/tt/register.ts +0 -720
|
@@ -1134,6 +1134,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1134
1134
|
EMIT_CUSTOM_EVENT_METADATA_KEY: () => EMIT_CUSTOM_EVENT_METADATA_KEY,
|
|
1135
1135
|
HTML_TAG_ENTRIES: () => HTML_TAG_ENTRIES,
|
|
1136
1136
|
InjectSituationType: () => InjectSituationType2,
|
|
1137
|
+
MUTATION_OBSERVER_METADATA_KEY: () => MUTATION_OBSERVER_METADATA_KEY,
|
|
1137
1138
|
ON_ADD_EVENT_LISTENER_METADATA_KEY: () => ON_ADD_EVENT_LISTENER_METADATA_KEY,
|
|
1138
1139
|
ON_AFTER_ADOPTED_METADATA_KEY: () => ON_AFTER_ADOPTED_METADATA_KEY,
|
|
1139
1140
|
ON_AFTER_CONNECTED_METADATA_KEY: () => ON_AFTER_CONNECTED_METADATA_KEY,
|
|
@@ -1150,6 +1151,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1150
1151
|
PUBLISH_SWC_APP_MESSAGE_METADATA_KEY: () => PUBLISH_SWC_APP_MESSAGE_METADATA_KEY,
|
|
1151
1152
|
QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
|
|
1152
1153
|
QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
|
|
1154
|
+
RESIZE_OBSERVER_METADATA_KEY: () => RESIZE_OBSERVER_METADATA_KEY,
|
|
1153
1155
|
STATE_METADATA_KEY: () => STATE_METADATA_KEY,
|
|
1154
1156
|
STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
|
|
1155
1157
|
SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY: () => SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY,
|
|
@@ -1171,12 +1173,15 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1171
1173
|
SwcUtils: () => SwcUtils,
|
|
1172
1174
|
addClass: () => addClass,
|
|
1173
1175
|
addEventListener: () => addEventListener,
|
|
1176
|
+
addEventListenerAllDom: () => addEventListenerAllDom,
|
|
1174
1177
|
addEventListenerAppHost: () => addEventListenerAppHost,
|
|
1175
1178
|
addEventListenerDelegate: () => addEventListenerDelegate,
|
|
1176
1179
|
addEventListenerDelegateAllDom: () => addEventListenerDelegateAllDom,
|
|
1177
1180
|
addEventListenerDelegateLightDom: () => addEventListenerDelegateLightDom,
|
|
1178
1181
|
addEventListenerDelegateShadowDom: () => addEventListenerDelegateShadowDom,
|
|
1179
1182
|
addEventListenerDocument: () => addEventListenerDocument,
|
|
1183
|
+
addEventListenerLightDom: () => addEventListenerLightDom,
|
|
1184
|
+
addEventListenerShadowDom: () => addEventListenerShadowDom,
|
|
1180
1185
|
addEventListenerThis: () => addEventListenerThis,
|
|
1181
1186
|
addEventListenerWindow: () => addEventListenerWindow,
|
|
1182
1187
|
appendHtmlSlot: () => appendHtmlSlot,
|
|
@@ -1215,10 +1220,17 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1215
1220
|
emitCustomEvent: () => emitCustomEvent,
|
|
1216
1221
|
ensureInit: () => ensureInit,
|
|
1217
1222
|
event: () => event,
|
|
1223
|
+
eventAllDom: () => eventAllDom,
|
|
1224
|
+
eventAppHost: () => eventAppHost,
|
|
1218
1225
|
eventDelegate: () => eventDelegate,
|
|
1219
1226
|
eventDelegateAllDom: () => eventDelegateAllDom,
|
|
1220
1227
|
eventDelegateLightDom: () => eventDelegateLightDom,
|
|
1221
1228
|
eventDelegateShadowDom: () => eventDelegateShadowDom,
|
|
1229
|
+
eventDocument: () => eventDocument,
|
|
1230
|
+
eventLightDom: () => eventLightDom,
|
|
1231
|
+
eventShadowDom: () => eventShadowDom,
|
|
1232
|
+
eventThis: () => eventThis,
|
|
1233
|
+
eventWindow: () => eventWindow,
|
|
1222
1234
|
findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
|
|
1223
1235
|
findAllApplySlotMetadata: () => findAllApplySlotMetadata,
|
|
1224
1236
|
findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
|
|
@@ -1238,9 +1250,11 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1238
1250
|
getChangedAttributeMetadata: () => getChangedAttributeMetadata,
|
|
1239
1251
|
getElementConfig: () => getElementConfig,
|
|
1240
1252
|
getEmitCustomEventMetadataList: () => getEmitCustomEventMetadataList,
|
|
1253
|
+
getMutationObserverMetadata: () => getMutationObserverMetadata,
|
|
1241
1254
|
getPublishSwcAppMessageMetadata: () => getPublishSwcAppMessageMetadata,
|
|
1242
1255
|
getQueryAllMetadata: () => getQueryAllMetadata,
|
|
1243
1256
|
getQueryMetadata: () => getQueryMetadata,
|
|
1257
|
+
getResizeObserverMetadata: () => getResizeObserverMetadata,
|
|
1244
1258
|
getSubscribeSwcAppMessageWhileConnectedMetadata: () => getSubscribeSwcAppMessageWhileConnectedMetadata,
|
|
1245
1259
|
getSubscribeSwcAppRouteChangeWhileConnectedMetadata: () => getSubscribeSwcAppRouteChangeWhileConnectedMetadata,
|
|
1246
1260
|
html: () => html,
|
|
@@ -1267,6 +1281,15 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1267
1281
|
insertBeforeEndLight: () => insertBeforeEndLight,
|
|
1268
1282
|
insertBeforeEndShadow: () => insertBeforeEndShadow,
|
|
1269
1283
|
isSSR: () => isSSR,
|
|
1284
|
+
mutationObserver: () => mutationObserver,
|
|
1285
|
+
mutationObserverAll: () => mutationObserverAll,
|
|
1286
|
+
mutationObserverDelegate: () => mutationObserverDelegate,
|
|
1287
|
+
mutationObserverDelegateAll: () => mutationObserverDelegateAll,
|
|
1288
|
+
mutationObserverDelegateLight: () => mutationObserverDelegateLight,
|
|
1289
|
+
mutationObserverDelegateShadow: () => mutationObserverDelegateShadow,
|
|
1290
|
+
mutationObserverLight: () => mutationObserverLight,
|
|
1291
|
+
mutationObserverShadow: () => mutationObserverShadow,
|
|
1292
|
+
mutationObserverThis: () => mutationObserverThis,
|
|
1270
1293
|
onAdopted: () => onAdopted,
|
|
1271
1294
|
onAdoptedAfter: () => onAdoptedAfter,
|
|
1272
1295
|
onAdoptedBefore: () => onAdoptedBefore,
|
|
@@ -1289,6 +1312,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1289
1312
|
publishSwcAppMessage: () => publishSwcAppMessage,
|
|
1290
1313
|
query: () => query,
|
|
1291
1314
|
queryAll: () => queryAll,
|
|
1315
|
+
queryAllRoots: () => queryAllRoots,
|
|
1316
|
+
queryLight: () => queryLight,
|
|
1317
|
+
queryShadow: () => queryShadow,
|
|
1292
1318
|
receiveMessage: () => receiveMessage,
|
|
1293
1319
|
removeClass: () => removeClass,
|
|
1294
1320
|
removeSSRAttribute: () => removeSSRAttribute,
|
|
@@ -1298,6 +1324,15 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1298
1324
|
replaceChildrenLight: () => replaceChildrenLight,
|
|
1299
1325
|
replaceChildrenSlot: () => replaceChildrenSlot,
|
|
1300
1326
|
replaceChildrenTextSlot: () => replaceChildrenTextSlot,
|
|
1327
|
+
resizeObserver: () => resizeObserver,
|
|
1328
|
+
resizeObserverAll: () => resizeObserverAll,
|
|
1329
|
+
resizeObserverDelegate: () => resizeObserverDelegate,
|
|
1330
|
+
resizeObserverDelegateAll: () => resizeObserverDelegateAll,
|
|
1331
|
+
resizeObserverDelegateLight: () => resizeObserverDelegateLight,
|
|
1332
|
+
resizeObserverDelegateShadow: () => resizeObserverDelegateShadow,
|
|
1333
|
+
resizeObserverLight: () => resizeObserverLight,
|
|
1334
|
+
resizeObserverShadow: () => resizeObserverShadow,
|
|
1335
|
+
resizeObserverThis: () => resizeObserverThis,
|
|
1301
1336
|
resolveAttributeTargets: () => resolveAttributeTargets,
|
|
1302
1337
|
resolvePropertyTargets: () => resolvePropertyTargets,
|
|
1303
1338
|
setAttribute: () => setAttribute,
|
|
@@ -10869,15 +10904,27 @@ ${indentStr}}`;
|
|
|
10869
10904
|
|
|
10870
10905
|
// src/decorators/addEventListener.ts
|
|
10871
10906
|
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
10872
|
-
function addEventListener(
|
|
10907
|
+
function addEventListener(selectorOrType, typeOrOptions, maybeOptions) {
|
|
10873
10908
|
return (targetObj, propertyKey, descriptor) => {
|
|
10909
|
+
let selector;
|
|
10910
|
+
let type;
|
|
10911
|
+
let opts = {};
|
|
10912
|
+
if (typeof typeOrOptions === "string") {
|
|
10913
|
+
selector = selectorOrType;
|
|
10914
|
+
type = typeOrOptions;
|
|
10915
|
+
opts = maybeOptions ?? {};
|
|
10916
|
+
} else {
|
|
10917
|
+
selector = "$this";
|
|
10918
|
+
type = selectorOrType;
|
|
10919
|
+
opts = typeOrOptions ?? {};
|
|
10920
|
+
}
|
|
10874
10921
|
const constructor = targetObj.constructor;
|
|
10875
10922
|
let listeners = ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
10876
10923
|
if (!listeners) {
|
|
10877
10924
|
listeners = [];
|
|
10878
10925
|
ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
10879
10926
|
}
|
|
10880
|
-
listeners.push({ propertyKey, selector
|
|
10927
|
+
listeners.push({ propertyKey, selector, type, options: opts });
|
|
10881
10928
|
};
|
|
10882
10929
|
}
|
|
10883
10930
|
function addEventListenerDelegateLightDom(selector, type, options) {
|
|
@@ -10892,11 +10939,15 @@ ${indentStr}}`;
|
|
|
10892
10939
|
function addEventListenerDelegate(selector, type, options) {
|
|
10893
10940
|
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
10894
10941
|
}
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10942
|
+
function addEventListenerLightDom(selector, type, options) {
|
|
10943
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light" });
|
|
10944
|
+
}
|
|
10945
|
+
function addEventListenerShadowDom(selector, type, options) {
|
|
10946
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow" });
|
|
10947
|
+
}
|
|
10948
|
+
function addEventListenerAllDom(selector, type, options) {
|
|
10949
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all" });
|
|
10950
|
+
}
|
|
10900
10951
|
function addEventListenerThis(type, options) {
|
|
10901
10952
|
return addEventListener("$this", type, options);
|
|
10902
10953
|
}
|
|
@@ -10909,11 +10960,167 @@ ${indentStr}}`;
|
|
|
10909
10960
|
function addEventListenerDocument(type, options) {
|
|
10910
10961
|
return addEventListener("$document", type, options);
|
|
10911
10962
|
}
|
|
10963
|
+
var event = addEventListener;
|
|
10964
|
+
var eventDelegateLightDom = addEventListenerDelegateLightDom;
|
|
10965
|
+
var eventDelegateShadowDom = addEventListenerDelegateShadowDom;
|
|
10966
|
+
var eventDelegateAllDom = addEventListenerDelegateAllDom;
|
|
10967
|
+
var eventDelegate = addEventListenerDelegate;
|
|
10968
|
+
var eventLightDom = addEventListenerLightDom;
|
|
10969
|
+
var eventShadowDom = addEventListenerShadowDom;
|
|
10970
|
+
var eventAllDom = addEventListenerAllDom;
|
|
10971
|
+
var eventAppHost = addEventListenerAppHost;
|
|
10972
|
+
var eventWindow = addEventListenerWindow;
|
|
10973
|
+
var eventDocument = addEventListenerDocument;
|
|
10974
|
+
var eventThis = addEventListenerThis;
|
|
10912
10975
|
var getAddEventListenerMetadata = (target) => {
|
|
10913
10976
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
10914
10977
|
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
10915
10978
|
};
|
|
10916
10979
|
|
|
10980
|
+
// src/decorators/mutationObserver.ts
|
|
10981
|
+
var MUTATION_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:mutation-observer");
|
|
10982
|
+
function mutationObserver(selectorOrOptions, maybeOptions) {
|
|
10983
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
10984
|
+
let selector = "$this";
|
|
10985
|
+
let options = {};
|
|
10986
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
10987
|
+
selector = selectorOrOptions;
|
|
10988
|
+
options = maybeOptions ?? {};
|
|
10989
|
+
} else {
|
|
10990
|
+
selector = "$this";
|
|
10991
|
+
options = selectorOrOptions ?? {};
|
|
10992
|
+
}
|
|
10993
|
+
const constructor = targetObj.constructor;
|
|
10994
|
+
let observers = ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
10995
|
+
if (!observers) {
|
|
10996
|
+
observers = [];
|
|
10997
|
+
ReflectUtils.defineMetadata(MUTATION_OBSERVER_METADATA_KEY, observers, constructor);
|
|
10998
|
+
}
|
|
10999
|
+
observers.push({ propertyKey, selector, options });
|
|
11000
|
+
};
|
|
11001
|
+
}
|
|
11002
|
+
function mutationObserverThis(options) {
|
|
11003
|
+
return mutationObserver("$this", options);
|
|
11004
|
+
}
|
|
11005
|
+
function mutationObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
11006
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11007
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
11008
|
+
}
|
|
11009
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
11010
|
+
}
|
|
11011
|
+
function mutationObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
11012
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11013
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
11014
|
+
}
|
|
11015
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
11016
|
+
}
|
|
11017
|
+
function mutationObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
11018
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11019
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
11020
|
+
}
|
|
11021
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
11022
|
+
}
|
|
11023
|
+
function mutationObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
11024
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11025
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
11026
|
+
}
|
|
11027
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
11028
|
+
}
|
|
11029
|
+
function mutationObserverLight(selectorOrOptions, maybeOptions) {
|
|
11030
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11031
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
11032
|
+
}
|
|
11033
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
11034
|
+
}
|
|
11035
|
+
function mutationObserverShadow(selectorOrOptions, maybeOptions) {
|
|
11036
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11037
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
11038
|
+
}
|
|
11039
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
11040
|
+
}
|
|
11041
|
+
function mutationObserverAll(selectorOrOptions, maybeOptions) {
|
|
11042
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11043
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
11044
|
+
}
|
|
11045
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
11046
|
+
}
|
|
11047
|
+
function getMutationObserverMetadata(target) {
|
|
11048
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
11049
|
+
return ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
11050
|
+
}
|
|
11051
|
+
|
|
11052
|
+
// src/decorators/resizeObserver.ts
|
|
11053
|
+
var RESIZE_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:resize-observer");
|
|
11054
|
+
function resizeObserver(selectorOrOptions, maybeOptions) {
|
|
11055
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
11056
|
+
let selector = "$this";
|
|
11057
|
+
let options = {};
|
|
11058
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11059
|
+
selector = selectorOrOptions;
|
|
11060
|
+
options = maybeOptions ?? {};
|
|
11061
|
+
} else {
|
|
11062
|
+
selector = "$this";
|
|
11063
|
+
options = selectorOrOptions ?? {};
|
|
11064
|
+
}
|
|
11065
|
+
const constructor = targetObj.constructor;
|
|
11066
|
+
let observers = ReflectUtils.getMetadata(RESIZE_OBSERVER_METADATA_KEY, constructor);
|
|
11067
|
+
if (!observers) {
|
|
11068
|
+
observers = [];
|
|
11069
|
+
ReflectUtils.defineMetadata(RESIZE_OBSERVER_METADATA_KEY, observers, constructor);
|
|
11070
|
+
}
|
|
11071
|
+
observers.push({ propertyKey, selector, options });
|
|
11072
|
+
};
|
|
11073
|
+
}
|
|
11074
|
+
function resizeObserverThis(options) {
|
|
11075
|
+
return resizeObserver("$this", options);
|
|
11076
|
+
}
|
|
11077
|
+
function resizeObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
11078
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11079
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
11080
|
+
}
|
|
11081
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
11082
|
+
}
|
|
11083
|
+
function resizeObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
11084
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11085
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
11086
|
+
}
|
|
11087
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
11088
|
+
}
|
|
11089
|
+
function resizeObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
11090
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11091
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
11092
|
+
}
|
|
11093
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
11094
|
+
}
|
|
11095
|
+
function resizeObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
11096
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11097
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
11098
|
+
}
|
|
11099
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
11100
|
+
}
|
|
11101
|
+
function resizeObserverLight(selectorOrOptions, maybeOptions) {
|
|
11102
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11103
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
11104
|
+
}
|
|
11105
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
11106
|
+
}
|
|
11107
|
+
function resizeObserverShadow(selectorOrOptions, maybeOptions) {
|
|
11108
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11109
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
11110
|
+
}
|
|
11111
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
11112
|
+
}
|
|
11113
|
+
function resizeObserverAll(selectorOrOptions, maybeOptions) {
|
|
11114
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
11115
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
11116
|
+
}
|
|
11117
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
11118
|
+
}
|
|
11119
|
+
function getResizeObserverMetadata(target) {
|
|
11120
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
11121
|
+
return ReflectUtils.getMetadata(RESIZE_OBSERVER_METADATA_KEY, constructor);
|
|
11122
|
+
}
|
|
11123
|
+
|
|
10917
11124
|
// ../core/dist/esm/message/operators/debounceTime.js
|
|
10918
11125
|
function debounceTime(duration, config) {
|
|
10919
11126
|
return (source) => {
|
|
@@ -14168,6 +14375,15 @@ ${indentStr}}`;
|
|
|
14168
14375
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
14169
14376
|
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];
|
|
14170
14377
|
};
|
|
14378
|
+
function queryShadow(selector, options) {
|
|
14379
|
+
return query(selector, { ...options ?? {}, root: "shadow" });
|
|
14380
|
+
}
|
|
14381
|
+
function queryLight(selector, options) {
|
|
14382
|
+
return query(selector, { ...options ?? {}, root: "light" });
|
|
14383
|
+
}
|
|
14384
|
+
function queryAllRoots(selector, options) {
|
|
14385
|
+
return query(selector, { ...options ?? {}, root: "all" });
|
|
14386
|
+
}
|
|
14171
14387
|
|
|
14172
14388
|
// src/decorators/queryAll.ts
|
|
14173
14389
|
var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
|
|
@@ -14743,7 +14959,6 @@ ${indentStr}}`;
|
|
|
14743
14959
|
if (!inst.__swc_initialized) {
|
|
14744
14960
|
inst._swcId = inst?.getAttribute?.("swc-use-ssr") ?? "s" + Math.random().toString(36).substring(2, 11).toLowerCase();
|
|
14745
14961
|
inst._emitHandlers = /* @__PURE__ */ new Map();
|
|
14746
|
-
inst._boundListeners = [];
|
|
14747
14962
|
inst.__swc_initialized = true;
|
|
14748
14963
|
const target = inst instanceof Function ? inst : inst.constructor;
|
|
14749
14964
|
const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
|
|
@@ -14945,6 +15160,8 @@ ${indentStr}}`;
|
|
|
14945
15160
|
const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
|
|
14946
15161
|
const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === "$this" || meta.selector === "");
|
|
14947
15162
|
const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
|
|
15163
|
+
const mutationObserverList = getMutationObserverMetadata(constructor) || [];
|
|
15164
|
+
const resizeObserverList = getResizeObserverMetadata(constructor) || [];
|
|
14948
15165
|
const attrChangeMap = findAllAttributeChangedMetadata(constructor);
|
|
14949
15166
|
const attributeList = findAllAttributeMetadata(constructor);
|
|
14950
15167
|
const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
|
|
@@ -14957,9 +15174,18 @@ ${indentStr}}`;
|
|
|
14957
15174
|
const proto = constructor.prototype;
|
|
14958
15175
|
setupPrototype(proto, win);
|
|
14959
15176
|
let helperHostSet = null;
|
|
15177
|
+
let boundListeners = [];
|
|
15178
|
+
let shadowMutationObserver = null;
|
|
15179
|
+
let lightMutationObserver = null;
|
|
15180
|
+
let resizeObserver2 = null;
|
|
15181
|
+
let resizeObservers = [];
|
|
15182
|
+
let removeObserverCallbacks = [];
|
|
14960
15183
|
const originalConnected = proto.connectedCallback;
|
|
14961
15184
|
proto.connectedCallback = async function() {
|
|
14962
15185
|
ensureInit(this);
|
|
15186
|
+
boundListeners = [];
|
|
15187
|
+
resizeObservers = [];
|
|
15188
|
+
removeObserverCallbacks = [];
|
|
14963
15189
|
helperHostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
14964
15190
|
const appHost = helperHostSet.$appHost;
|
|
14965
15191
|
const useSsr = isSSR(this);
|
|
@@ -15088,7 +15314,13 @@ ${indentStr}}`;
|
|
|
15088
15314
|
}
|
|
15089
15315
|
};
|
|
15090
15316
|
br.addEventListener(type, unifiedHandler, opts);
|
|
15091
|
-
|
|
15317
|
+
const onRemoves = [];
|
|
15318
|
+
for (const m of sortedMetaList) {
|
|
15319
|
+
if (m.options.removeListener) {
|
|
15320
|
+
onRemoves.push({ fn: m.options.removeListener, opts: m.options });
|
|
15321
|
+
}
|
|
15322
|
+
}
|
|
15323
|
+
boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts, onRemoves });
|
|
15092
15324
|
});
|
|
15093
15325
|
});
|
|
15094
15326
|
nonDelegateListeners.forEach((meta) => {
|
|
@@ -15188,9 +15420,181 @@ ${indentStr}}`;
|
|
|
15188
15420
|
eventSubject.next(event2);
|
|
15189
15421
|
};
|
|
15190
15422
|
t.addEventListener(type, wrappedHandler, opts);
|
|
15191
|
-
|
|
15423
|
+
const onRemoves = options.removeListener ? [{ fn: options.removeListener, opts }] : [];
|
|
15424
|
+
boundListeners.push({ target: t, type, handler: wrappedHandler, options: opts, subscription, onRemoves });
|
|
15192
15425
|
});
|
|
15193
15426
|
});
|
|
15427
|
+
shadowMutationObserver = null;
|
|
15428
|
+
lightMutationObserver = null;
|
|
15429
|
+
resizeObserver2 = null;
|
|
15430
|
+
if (resizeObserverList.length > 0) {
|
|
15431
|
+
const root2 = this.shadowRoot || this;
|
|
15432
|
+
resizeObserver2 = new ResizeObserver((entries, obs) => {
|
|
15433
|
+
for (const m of resizeObserverList) {
|
|
15434
|
+
let matchedEls = [];
|
|
15435
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
15436
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
15437
|
+
const matchesSel = (node) => {
|
|
15438
|
+
if (!node || node.nodeType !== 1) return false;
|
|
15439
|
+
if (isThis) return true;
|
|
15440
|
+
const el = node;
|
|
15441
|
+
return el.matches?.(m.selector) || !!el.closest?.(m.selector);
|
|
15442
|
+
};
|
|
15443
|
+
matchedEls = entries.map((e) => e.target).filter(matchesSel);
|
|
15444
|
+
} else {
|
|
15445
|
+
matchedEls = entries.map((e) => e.target).filter((t) => t && t.nodeType === 1);
|
|
15446
|
+
}
|
|
15447
|
+
if (matchedEls.length === 0) continue;
|
|
15448
|
+
if (m.options.filter) {
|
|
15449
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
15450
|
+
if (!m.options.filter(matchedEls, { currentThis: this, helper })) continue;
|
|
15451
|
+
}
|
|
15452
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
15453
|
+
this[m.propertyKey](matchedEls, entries, obs, { ...hostSet, $root: root2 });
|
|
15454
|
+
}
|
|
15455
|
+
});
|
|
15456
|
+
resizeObservers.push(resizeObserver2);
|
|
15457
|
+
for (const m of resizeObserverList) {
|
|
15458
|
+
if (m.options.removeObserver) {
|
|
15459
|
+
removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root2, opts: m.options });
|
|
15460
|
+
}
|
|
15461
|
+
}
|
|
15462
|
+
}
|
|
15463
|
+
const shadowMetas = mutationObserverList.filter((m) => {
|
|
15464
|
+
const r = m.options.root || "auto";
|
|
15465
|
+
return this.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
15466
|
+
});
|
|
15467
|
+
const lightMetas = mutationObserverList.filter((m) => {
|
|
15468
|
+
const r = m.options.root || "auto";
|
|
15469
|
+
return r === "light" || r === "all" || !this.shadowRoot && r === "auto";
|
|
15470
|
+
});
|
|
15471
|
+
const setupMutationObserver = (root2, metas, resizeDelegates = []) => {
|
|
15472
|
+
if (metas.length === 0) return null;
|
|
15473
|
+
const initFrom = (o) => {
|
|
15474
|
+
const init = {
|
|
15475
|
+
childList: o.childList,
|
|
15476
|
+
attributes: o.attributes,
|
|
15477
|
+
characterData: o.characterData,
|
|
15478
|
+
subtree: o.subtree,
|
|
15479
|
+
attributeFilter: o.attributeFilter,
|
|
15480
|
+
attributeOldValue: o.attributeOldValue,
|
|
15481
|
+
characterDataOldValue: o.characterDataOldValue
|
|
15482
|
+
};
|
|
15483
|
+
if (!init.childList && !init.attributes && !init.characterData) init.childList = true;
|
|
15484
|
+
return init;
|
|
15485
|
+
};
|
|
15486
|
+
const observer = new MutationObserver((mutations, obs) => {
|
|
15487
|
+
for (const meta of metas) {
|
|
15488
|
+
const { selector, options } = meta;
|
|
15489
|
+
let matchedEls = [];
|
|
15490
|
+
if (options.delegate && typeof selector === "string") {
|
|
15491
|
+
const isThis = selector === "$this" || selector === "";
|
|
15492
|
+
const matchesSel = (node) => {
|
|
15493
|
+
if (!node || node.nodeType !== 1) return false;
|
|
15494
|
+
if (isThis) return true;
|
|
15495
|
+
const el = node;
|
|
15496
|
+
return el.matches?.(selector) || !!el.closest?.(selector);
|
|
15497
|
+
};
|
|
15498
|
+
matchedEls = mutations.flatMap((m) => {
|
|
15499
|
+
const els = [];
|
|
15500
|
+
if (matchesSel(m.target)) els.push(m.target);
|
|
15501
|
+
Array.from(m.addedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
15502
|
+
Array.from(m.removedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
15503
|
+
return els;
|
|
15504
|
+
});
|
|
15505
|
+
} else if (typeof selector === "string") {
|
|
15506
|
+
const isThis = selector === "$this" || selector === "";
|
|
15507
|
+
const matchesSel = (node) => {
|
|
15508
|
+
if (!node || node.nodeType !== 1) return false;
|
|
15509
|
+
if (isThis) return true;
|
|
15510
|
+
return node.matches?.(selector);
|
|
15511
|
+
};
|
|
15512
|
+
matchedEls = mutations.flatMap((m) => {
|
|
15513
|
+
const els = [];
|
|
15514
|
+
if (matchesSel(m.target)) els.push(m.target);
|
|
15515
|
+
Array.from(m.addedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
15516
|
+
Array.from(m.removedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
15517
|
+
return els;
|
|
15518
|
+
});
|
|
15519
|
+
} else {
|
|
15520
|
+
matchedEls = mutations.map((m) => m.target).filter((t) => t && t.nodeType === 1);
|
|
15521
|
+
}
|
|
15522
|
+
if (matchedEls.length === 0) continue;
|
|
15523
|
+
if (options.filter) {
|
|
15524
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
15525
|
+
if (!options.filter(matchedEls, { currentThis: this, helper })) continue;
|
|
15526
|
+
}
|
|
15527
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
15528
|
+
this[meta.propertyKey](matchedEls, mutations, obs, { ...hostSet, $root: root2 });
|
|
15529
|
+
}
|
|
15530
|
+
if (resizeDelegates.length > 0 && resizeObserver2) {
|
|
15531
|
+
const handle = (n, observe) => {
|
|
15532
|
+
if (n.nodeType !== 1) return;
|
|
15533
|
+
const el = n;
|
|
15534
|
+
for (const m of resizeDelegates) {
|
|
15535
|
+
if (typeof m.selector !== "string") continue;
|
|
15536
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
15537
|
+
const matchesSel = (node) => {
|
|
15538
|
+
if (!node || node.nodeType !== 1) return false;
|
|
15539
|
+
if (isThis) return true;
|
|
15540
|
+
const e = node;
|
|
15541
|
+
return e.matches?.(m.selector) || !!e.closest?.(m.selector);
|
|
15542
|
+
};
|
|
15543
|
+
if (matchesSel(el)) {
|
|
15544
|
+
if (observe) resizeObserver2.observe(el, m.options.box ? { box: m.options.box } : void 0);
|
|
15545
|
+
else resizeObserver2.unobserve(el);
|
|
15546
|
+
} else if (!isThis) {
|
|
15547
|
+
el.querySelectorAll(m.selector).forEach((sub) => {
|
|
15548
|
+
if (observe) resizeObserver2.observe(sub, m.options.box ? { box: m.options.box } : void 0);
|
|
15549
|
+
else resizeObserver2.unobserve(sub);
|
|
15550
|
+
});
|
|
15551
|
+
}
|
|
15552
|
+
}
|
|
15553
|
+
};
|
|
15554
|
+
for (const m of mutations) {
|
|
15555
|
+
Array.from(m.addedNodes || []).forEach((n) => handle(n, true));
|
|
15556
|
+
Array.from(m.removedNodes || []).forEach((n) => handle(n, false));
|
|
15557
|
+
}
|
|
15558
|
+
}
|
|
15559
|
+
});
|
|
15560
|
+
const hasDelegate = metas.some((m) => m.options.delegate) || resizeDelegates.some((m) => m.options.delegate);
|
|
15561
|
+
if (hasDelegate) {
|
|
15562
|
+
observer.observe(root2, { childList: true, subtree: true });
|
|
15563
|
+
}
|
|
15564
|
+
const nonDelegateMetas = metas.filter((m) => !m.options.delegate);
|
|
15565
|
+
for (const m of nonDelegateMetas) {
|
|
15566
|
+
const { selector, options } = m;
|
|
15567
|
+
const mInit = initFrom(options);
|
|
15568
|
+
if (typeof selector === "string") {
|
|
15569
|
+
if (selector === "$this" || selector === "") {
|
|
15570
|
+
observer.observe(root2, mInit);
|
|
15571
|
+
} else {
|
|
15572
|
+
root2.querySelectorAll(selector).forEach((el) => observer.observe(el, mInit));
|
|
15573
|
+
}
|
|
15574
|
+
} else if (typeof selector === "function") {
|
|
15575
|
+
observer.observe(root2, mInit);
|
|
15576
|
+
}
|
|
15577
|
+
}
|
|
15578
|
+
return observer;
|
|
15579
|
+
};
|
|
15580
|
+
const shadowResizeDelegateMetas = resizeObserverList.filter((m) => {
|
|
15581
|
+
if (!m.options.delegate) return false;
|
|
15582
|
+
const r = m.options.root || "auto";
|
|
15583
|
+
return this.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
15584
|
+
});
|
|
15585
|
+
const lightResizeDelegateMetas = resizeObserverList.filter((m) => {
|
|
15586
|
+
if (!m.options.delegate) return false;
|
|
15587
|
+
const r = m.options.root || "auto";
|
|
15588
|
+
return r === "light" || r === "all" || !this.shadowRoot && r === "auto";
|
|
15589
|
+
});
|
|
15590
|
+
if (this.shadowRoot) shadowMutationObserver = setupMutationObserver(this.shadowRoot, shadowMetas, shadowResizeDelegateMetas);
|
|
15591
|
+
lightMutationObserver = setupMutationObserver(this, lightMetas, lightResizeDelegateMetas);
|
|
15592
|
+
for (const m of mutationObserverList) {
|
|
15593
|
+
if (m.options.removeObserver) {
|
|
15594
|
+
const rootForM = this.shadowRoot && (m.options.root === "shadow" || m.options.root === "all" || m.options.root === "auto" && this.shadowRoot) ? this.shadowRoot : this;
|
|
15595
|
+
removeObserverCallbacks.push({ fn: m.options.removeObserver, target: rootForM, opts: m.options });
|
|
15596
|
+
}
|
|
15597
|
+
}
|
|
15194
15598
|
if (originalConnected) await originalConnected.apply(this);
|
|
15195
15599
|
const aMethods = findAllOnConnectedAfterMetadata(this);
|
|
15196
15600
|
for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
@@ -15225,15 +15629,44 @@ ${indentStr}}`;
|
|
|
15225
15629
|
this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
|
|
15226
15630
|
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
15227
15631
|
for (const m of bMethods) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15228
|
-
if (
|
|
15229
|
-
|
|
15632
|
+
if (boundListeners.length > 0) {
|
|
15633
|
+
boundListeners.forEach((l) => {
|
|
15230
15634
|
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
15231
15635
|
if (l.subscription && typeof l.subscription.unsubscribe === "function") {
|
|
15232
15636
|
l.subscription.unsubscribe();
|
|
15233
15637
|
}
|
|
15638
|
+
if (Array.isArray(l.onRemoves)) {
|
|
15639
|
+
for (const r of l.onRemoves) {
|
|
15640
|
+
try {
|
|
15641
|
+
r.fn(l.target, r.opts);
|
|
15642
|
+
} catch (e) {
|
|
15643
|
+
console.error("[SWC] removeListener error:", e);
|
|
15644
|
+
}
|
|
15645
|
+
}
|
|
15646
|
+
}
|
|
15234
15647
|
});
|
|
15235
|
-
|
|
15648
|
+
boundListeners = [];
|
|
15649
|
+
}
|
|
15650
|
+
const _obs = [shadowMutationObserver, lightMutationObserver, resizeObserver2, ...resizeObservers];
|
|
15651
|
+
for (const o of _obs) {
|
|
15652
|
+
try {
|
|
15653
|
+
o?.disconnect?.();
|
|
15654
|
+
} catch (e) {
|
|
15655
|
+
console.error("[SWC] observer disconnect error:", e);
|
|
15656
|
+
}
|
|
15657
|
+
}
|
|
15658
|
+
shadowMutationObserver = null;
|
|
15659
|
+
lightMutationObserver = null;
|
|
15660
|
+
resizeObserver2 = null;
|
|
15661
|
+
resizeObservers = [];
|
|
15662
|
+
for (const cb of removeObserverCallbacks) {
|
|
15663
|
+
try {
|
|
15664
|
+
cb.fn(cb.target, cb.opts);
|
|
15665
|
+
} catch (e) {
|
|
15666
|
+
console.error("[SWC] removeObserver error:", e);
|
|
15667
|
+
}
|
|
15236
15668
|
}
|
|
15669
|
+
removeObserverCallbacks = [];
|
|
15237
15670
|
new ElementApply(this, { id: this._swcId }).removeAllEventListener();
|
|
15238
15671
|
if (originalDisconnected) originalDisconnected.apply(this);
|
|
15239
15672
|
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);
|