@dooboostore/simple-web-component 1.0.41 → 1.0.43
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 +423 -68
- package/dist/cjs/decorators/addEventListener.js +10 -0
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +11 -2
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +9 -2
- package/dist/cjs/decorators/applyClass.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +11 -2
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +10 -2
- 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 +9 -2
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +9 -23
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/emitCustomEvent.js +2 -0
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +78 -21
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/publishSwcAppMessage.js +37 -23
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +3 -1
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +4 -9
- package/dist/cjs/elements/SwcAppMixin.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 +11 -2
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +9 -2
- package/dist/esm/decorators/applyClass.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +11 -2
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +10 -2
- 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 +9 -2
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +9 -23
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +2 -0
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +78 -21
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/publishSwcAppMessage.js +37 -23
- package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +3 -1
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +4 -9
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +216 -126
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
- package/dist/types/decorators/addEventListener.d.ts +5 -0
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +26 -0
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +6 -0
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +6 -0
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +26 -0
- 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 +6 -0
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +17 -0
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +25 -11
- package/dist/types/decorators/lifecycles.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/subscribeSwcAppRouteChangeWhileConnected.d.ts +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +216 -126
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
- package/package.json +1 -3
- package/src/decorators/addEventListener.ts +7 -0
- package/src/decorators/applyAttribute.ts +58 -2
- package/src/decorators/applyClass.ts +24 -2
- package/src/decorators/applyNode.ts +26 -2
- package/src/decorators/applyProperty.ts +57 -2
- package/src/decorators/applySlot.ts +24 -10
- package/src/decorators/applyStyle.ts +24 -2
- package/src/decorators/elementDefine.ts +9 -23
- package/src/decorators/emitCustomEvent.ts +19 -0
- package/src/decorators/lifecycles.ts +120 -26
- package/src/decorators/publishSwcAppMessage.ts +71 -27
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +6 -2
- package/src/elements/SwcAppMixin.ts +5 -11
|
@@ -6320,6 +6320,11 @@ function addEventListenerDelegateAllDom(selector, type, options) {
|
|
|
6320
6320
|
function addEventListenerDelegate(selector, type, options) {
|
|
6321
6321
|
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
6322
6322
|
}
|
|
6323
|
+
var event = addEventListener;
|
|
6324
|
+
var eventDelegateLightDom = addEventListenerDelegateLightDom;
|
|
6325
|
+
var eventDelegateShadowDom = addEventListenerDelegateShadowDom;
|
|
6326
|
+
var eventDelegateAllDom = addEventListenerDelegateAllDom;
|
|
6327
|
+
var eventDelegate = addEventListenerDelegate;
|
|
6323
6328
|
function addEventListenerThis(type, options) {
|
|
6324
6329
|
return addEventListener("$this", type, options);
|
|
6325
6330
|
}
|
|
@@ -6384,27 +6389,52 @@ function onConnectedAfter(arg1, arg2, arg3) {
|
|
|
6384
6389
|
decorator2(arg1 || {}, target, propertyKey);
|
|
6385
6390
|
};
|
|
6386
6391
|
}
|
|
6387
|
-
function
|
|
6388
|
-
return (
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
list
|
|
6393
|
-
|
|
6392
|
+
function createLifecycleDecoratorWithOptions(metadataKey) {
|
|
6393
|
+
return function(optionOrTarget, propertyKey) {
|
|
6394
|
+
if (propertyKey) {
|
|
6395
|
+
const constructor = optionOrTarget.constructor;
|
|
6396
|
+
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
6397
|
+
if (!list) {
|
|
6398
|
+
list = [];
|
|
6399
|
+
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
6400
|
+
}
|
|
6401
|
+
list.push({ propertyKey, order: 0 });
|
|
6402
|
+
return;
|
|
6394
6403
|
}
|
|
6395
|
-
|
|
6404
|
+
return (target, propertyKey2) => {
|
|
6405
|
+
const constructor = target.constructor;
|
|
6406
|
+
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
6407
|
+
if (!list) {
|
|
6408
|
+
list = [];
|
|
6409
|
+
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
6410
|
+
}
|
|
6411
|
+
list.push({ propertyKey: propertyKey2, order: optionOrTarget?.order ?? 0 });
|
|
6412
|
+
};
|
|
6396
6413
|
};
|
|
6397
6414
|
}
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6415
|
+
function onInitialize(optionOrTarget, propertyKey) {
|
|
6416
|
+
return createLifecycleDecoratorWithOptions(ON_INITIALIZE_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
6417
|
+
}
|
|
6418
|
+
function onDisconnectedBefore(optionOrTarget, propertyKey) {
|
|
6419
|
+
return createLifecycleDecoratorWithOptions(ON_BEFORE_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
6420
|
+
}
|
|
6421
|
+
function onDisconnectedAfter(optionOrTarget, propertyKey) {
|
|
6422
|
+
return createLifecycleDecoratorWithOptions(ON_AFTER_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
6423
|
+
}
|
|
6401
6424
|
var onDisconnected = onDisconnectedAfter;
|
|
6402
|
-
|
|
6403
|
-
|
|
6425
|
+
function onAdoptedBefore(optionOrTarget, propertyKey) {
|
|
6426
|
+
return createLifecycleDecoratorWithOptions(ON_BEFORE_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
6427
|
+
}
|
|
6428
|
+
function onAdoptedAfter(optionOrTarget, propertyKey) {
|
|
6429
|
+
return createLifecycleDecoratorWithOptions(ON_AFTER_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
6430
|
+
}
|
|
6404
6431
|
var onAdopted = onAdoptedAfter;
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6432
|
+
function onConnectedSwcApp(optionOrTarget, propertyKey) {
|
|
6433
|
+
return createLifecycleDecoratorWithOptions(ON_CONNECTED_SWC_APP_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
6434
|
+
}
|
|
6435
|
+
function onConnectedCompleted(optionOrTarget, propertyKey) {
|
|
6436
|
+
return createLifecycleDecoratorWithOptions(ON_CONNECTED_COMPLETED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
6437
|
+
}
|
|
6408
6438
|
var decorator = (options, target, propertyKey) => {
|
|
6409
6439
|
const constructor = target.constructor;
|
|
6410
6440
|
let list = ReflectUtils.getMetadata(ON_CONNECTED_METADATA_KEY, constructor);
|
|
@@ -6439,20 +6469,28 @@ function onConnected(optionOrTarget, propertyKey, arg3) {
|
|
|
6439
6469
|
};
|
|
6440
6470
|
}
|
|
6441
6471
|
var findAllLifecycleMetadata = (target, metadataKey) => {
|
|
6442
|
-
const
|
|
6443
|
-
|
|
6472
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
6473
|
+
const results = ReflectUtils.getOwnMetadata(metadataKey, constructor) ?? [];
|
|
6474
|
+
return [...results].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
6444
6475
|
};
|
|
6445
6476
|
var findAllOnConnectedMetadata = (target) => {
|
|
6446
6477
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6447
|
-
|
|
6478
|
+
const results = ReflectUtils.getMetadata(ON_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
6479
|
+
return [...results].sort((a, b) => {
|
|
6480
|
+
const orderA = a.options?.order ?? 0;
|
|
6481
|
+
const orderB = b.options?.order ?? 0;
|
|
6482
|
+
return orderA - orderB;
|
|
6483
|
+
});
|
|
6448
6484
|
};
|
|
6449
6485
|
var findAllOnConnectedBeforeMetadata = (target) => {
|
|
6450
6486
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6451
|
-
|
|
6487
|
+
const results = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
6488
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
6452
6489
|
};
|
|
6453
6490
|
var findAllOnConnectedAfterMetadata = (target) => {
|
|
6454
6491
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6455
|
-
|
|
6492
|
+
const results = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
6493
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
6456
6494
|
};
|
|
6457
6495
|
|
|
6458
6496
|
// ../core-web/dist/esm/element/CanvasUtils.js
|
|
@@ -7461,7 +7499,7 @@ var DocumentUtils;
|
|
|
7461
7499
|
};
|
|
7462
7500
|
DocumentUtils2.eventObservable = (document2, type, options) => {
|
|
7463
7501
|
return new Observable((subscriber) => {
|
|
7464
|
-
const handler = (
|
|
7502
|
+
const handler = (event2) => subscriber.next(event2);
|
|
7465
7503
|
window.addEventListener(type, handler, options);
|
|
7466
7504
|
return () => {
|
|
7467
7505
|
window.removeEventListener(type, handler, options);
|
|
@@ -7475,7 +7513,7 @@ var EventUtils;
|
|
|
7475
7513
|
((EventUtils2) => {
|
|
7476
7514
|
EventUtils2.htmlElementEventObservable = (element, type, options) => {
|
|
7477
7515
|
return new Observable((subscriber) => {
|
|
7478
|
-
const handler = (
|
|
7516
|
+
const handler = (event2) => subscriber.next(event2);
|
|
7479
7517
|
element.addEventListener(type, handler, options);
|
|
7480
7518
|
return () => {
|
|
7481
7519
|
element.removeEventListener(type, handler, options);
|
|
@@ -7489,7 +7527,7 @@ var WindowUtils;
|
|
|
7489
7527
|
((WindowUtils2) => {
|
|
7490
7528
|
WindowUtils2.eventObservable = (window2, type, options) => {
|
|
7491
7529
|
return new Observable((subscriber) => {
|
|
7492
|
-
const handler = (
|
|
7530
|
+
const handler = (event2) => subscriber.next(event2);
|
|
7493
7531
|
window2.addEventListener(type, handler, options);
|
|
7494
7532
|
return () => {
|
|
7495
7533
|
window2.removeEventListener(type, handler, options);
|
|
@@ -7866,7 +7904,7 @@ var Router = class {
|
|
|
7866
7904
|
routeData = { ...this.getRouteData(), triggerPoint: "first-end" };
|
|
7867
7905
|
this.behaviorSubject = new BehaviorSubject(routeData);
|
|
7868
7906
|
}
|
|
7869
|
-
this.config.window.addEventListener("popstate", (
|
|
7907
|
+
this.config.window.addEventListener("popstate", (event2) => {
|
|
7870
7908
|
const routeData2 = { ...this.getRouteData(), triggerPoint: "end" };
|
|
7871
7909
|
this.behaviorSubject.next(routeData2);
|
|
7872
7910
|
});
|
|
@@ -8258,7 +8296,7 @@ var AnimationFrameUtils;
|
|
|
8258
8296
|
divideSize
|
|
8259
8297
|
}) => {
|
|
8260
8298
|
return new Observable((subscriber) => {
|
|
8261
|
-
const handler = (
|
|
8299
|
+
const handler = (event2) => subscriber.next(event2);
|
|
8262
8300
|
let fps2 = 0;
|
|
8263
8301
|
const getDrawFpsGap = () => {
|
|
8264
8302
|
return Math.floor(fps2 / divideSize);
|
|
@@ -8779,7 +8817,7 @@ function emitCustomEvent(selectorOrTarget, type, options = {}) {
|
|
|
8779
8817
|
ensureInit(this);
|
|
8780
8818
|
const res = original.apply(this, args);
|
|
8781
8819
|
const handleResult = (detail) => {
|
|
8782
|
-
const
|
|
8820
|
+
const event2 = new CustomEvent(type, {
|
|
8783
8821
|
detail,
|
|
8784
8822
|
bubbles: fullOptions.bubbles,
|
|
8785
8823
|
composed: fullOptions.composed,
|
|
@@ -8829,7 +8867,7 @@ function emitCustomEvent(selectorOrTarget, type, options = {}) {
|
|
|
8829
8867
|
if (fullOptions.filter && !fullOptions.filter(t, detail, { currentThis: this, helper: hostSet })) {
|
|
8830
8868
|
return;
|
|
8831
8869
|
}
|
|
8832
|
-
t.dispatchEvent(
|
|
8870
|
+
t.dispatchEvent(event2);
|
|
8833
8871
|
});
|
|
8834
8872
|
return detail;
|
|
8835
8873
|
};
|
|
@@ -8845,6 +8883,7 @@ var getEmitCustomEventMetadataList = (target) => {
|
|
|
8845
8883
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
8846
8884
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
8847
8885
|
};
|
|
8886
|
+
var emit = emitCustomEvent;
|
|
8848
8887
|
function emitCustomEventThis(type, optionsOrAttributeaName) {
|
|
8849
8888
|
if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "string") {
|
|
8850
8889
|
return emitCustomEventThis(type, { attributeName: optionsOrAttributeaName });
|
|
@@ -9473,13 +9512,21 @@ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
|
|
|
9473
9512
|
descriptor.value = function(...args) {
|
|
9474
9513
|
ensureInit(this);
|
|
9475
9514
|
const res = original.apply(this, args);
|
|
9515
|
+
const extractValue = (v) => {
|
|
9516
|
+
if (v && typeof v === "object" && PROPERTY_METADATA_KEY in v) {
|
|
9517
|
+
return v[PROPERTY_METADATA_KEY];
|
|
9518
|
+
}
|
|
9519
|
+
return v;
|
|
9520
|
+
};
|
|
9476
9521
|
if (res instanceof Promise) {
|
|
9477
9522
|
return res.then((v) => {
|
|
9478
|
-
|
|
9523
|
+
const extracted = extractValue(v);
|
|
9524
|
+
applyValueToTargets(this, extracted);
|
|
9479
9525
|
return v;
|
|
9480
9526
|
});
|
|
9481
9527
|
} else {
|
|
9482
|
-
|
|
9528
|
+
const extracted = extractValue(res);
|
|
9529
|
+
applyValueToTargets(this, extracted);
|
|
9483
9530
|
return res;
|
|
9484
9531
|
}
|
|
9485
9532
|
};
|
|
@@ -9601,16 +9648,14 @@ var ensureInit = (inst) => {
|
|
|
9601
9648
|
const appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(inst);
|
|
9602
9649
|
inst._executeSwcScript?.("swc-on-constructor", hostSet);
|
|
9603
9650
|
const cMethods = findAllLifecycleMetadata(inst, ON_INITIALIZE_METADATA_KEY);
|
|
9604
|
-
|
|
9605
|
-
for (const m of cMethods) inst._invokeLifecycleMethod(m, hostSet);
|
|
9606
|
-
}
|
|
9651
|
+
for (const m of cMethods) inst._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
9607
9652
|
}
|
|
9608
9653
|
};
|
|
9609
9654
|
var globalDelegatedRoots = /* @__PURE__ */ new WeakSet();
|
|
9610
|
-
var handleGlobalSwcEvent = async (
|
|
9611
|
-
if (
|
|
9612
|
-
const path =
|
|
9613
|
-
const type =
|
|
9655
|
+
var handleGlobalSwcEvent = async (event2) => {
|
|
9656
|
+
if (event2.__swc_handled) return;
|
|
9657
|
+
const path = event2.composedPath();
|
|
9658
|
+
const type = event2.type;
|
|
9614
9659
|
const attrName = `swc-on-${type}`;
|
|
9615
9660
|
for (const node of path) {
|
|
9616
9661
|
if (!(node instanceof HTMLElement)) continue;
|
|
@@ -9618,8 +9663,8 @@ var handleGlobalSwcEvent = async (event) => {
|
|
|
9618
9663
|
if (script && !getElementConfig(node)) {
|
|
9619
9664
|
const host = SwcUtils.findNearestSwcHostIncludingSelf(node);
|
|
9620
9665
|
if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
|
|
9621
|
-
await host.__swc_executeAttributeEvent(node, attrName, script,
|
|
9622
|
-
|
|
9666
|
+
await host.__swc_executeAttributeEvent(node, attrName, script, event2);
|
|
9667
|
+
event2.__swc_handled = true;
|
|
9623
9668
|
break;
|
|
9624
9669
|
}
|
|
9625
9670
|
}
|
|
@@ -9708,14 +9753,14 @@ var setupPrototype = (proto, win) => {
|
|
|
9708
9753
|
}
|
|
9709
9754
|
const oldHandler = handlers.get(attrName);
|
|
9710
9755
|
if (oldHandler) el.removeEventListener(eventName, oldHandler);
|
|
9711
|
-
const handler = async (
|
|
9756
|
+
const handler = async (event2) => {
|
|
9712
9757
|
const hostSet = SwcUtils.getHostSet(el);
|
|
9713
9758
|
const conf = getElementConfig(this);
|
|
9714
9759
|
const currentWin = this._resolveWindow(conf);
|
|
9715
9760
|
const helpers = SwcUtils.getHelperSet(currentWin);
|
|
9716
9761
|
const args = {
|
|
9717
|
-
event,
|
|
9718
|
-
$data:
|
|
9762
|
+
event: event2,
|
|
9763
|
+
$data: event2.detail,
|
|
9719
9764
|
...hostSet,
|
|
9720
9765
|
...helpers,
|
|
9721
9766
|
$el: el,
|
|
@@ -9726,16 +9771,16 @@ var setupPrototype = (proto, win) => {
|
|
|
9726
9771
|
el.addEventListener(eventName, handler);
|
|
9727
9772
|
handlers.set(attrName, handler);
|
|
9728
9773
|
};
|
|
9729
|
-
proto.__swc_executeAttributeEvent = async function(el, attrName, script,
|
|
9774
|
+
proto.__swc_executeAttributeEvent = async function(el, attrName, script, event2) {
|
|
9730
9775
|
ensureInit(this);
|
|
9731
9776
|
const hostSet = SwcUtils.getHostSet(el);
|
|
9732
9777
|
const conf = getElementConfig(this);
|
|
9733
9778
|
const currentWin = this._resolveWindow(conf);
|
|
9734
9779
|
const currentHelpers = SwcUtils.getHelperSet(currentWin);
|
|
9735
|
-
const detail =
|
|
9780
|
+
const detail = event2.detail;
|
|
9736
9781
|
const args = {
|
|
9737
|
-
event,
|
|
9738
|
-
$event:
|
|
9782
|
+
event: event2,
|
|
9783
|
+
$event: event2,
|
|
9739
9784
|
$data: detail,
|
|
9740
9785
|
$detail: detail,
|
|
9741
9786
|
...hostSet,
|
|
@@ -9794,9 +9839,7 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
9794
9839
|
const conf = getElementConfig(this);
|
|
9795
9840
|
const currentWin = this._resolveWindow(conf);
|
|
9796
9841
|
const bMethods = findAllOnConnectedBeforeMetadata(this).filter((it) => useSsr ? !it.options.ssrFirst : true);
|
|
9797
|
-
|
|
9798
|
-
for (const m of bMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
9799
|
-
}
|
|
9842
|
+
for (const m of bMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
9800
9843
|
this._executeSwcScript("swc-on-before-connected", helperHostSet);
|
|
9801
9844
|
const targetConnectedList = findAllOnConnectedMetadata(constructor).filter((it) => useSsr ? !it.options.ssrFirst : true);
|
|
9802
9845
|
const shadowMode = conf?.useShadow || targetConnectedList.find((it) => it.options.useShadow)?.options.useShadow;
|
|
@@ -9888,24 +9931,24 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
9888
9931
|
const bStop = b.options.stopPropagation ? 1 : 0;
|
|
9889
9932
|
return bStop - aStop;
|
|
9890
9933
|
});
|
|
9891
|
-
const unifiedHandler = async (
|
|
9934
|
+
const unifiedHandler = async (event2) => {
|
|
9892
9935
|
for (const meta of sortedMetaList) {
|
|
9893
9936
|
const { selector, options } = meta;
|
|
9894
|
-
const matchedEl =
|
|
9937
|
+
const matchedEl = event2.target.closest(selector);
|
|
9895
9938
|
if (matchedEl && br.contains(matchedEl)) {
|
|
9896
9939
|
if (options.filter) {
|
|
9897
9940
|
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
9898
|
-
if (!options.filter(
|
|
9941
|
+
if (!options.filter(event2, helper)) {
|
|
9899
9942
|
continue;
|
|
9900
9943
|
}
|
|
9901
9944
|
}
|
|
9902
|
-
if (options.stopPropagation)
|
|
9903
|
-
if (options.stopImmediatePropagation)
|
|
9904
|
-
if (options.preventDefault)
|
|
9945
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
9946
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
9947
|
+
if (options.preventDefault) event2.preventDefault();
|
|
9905
9948
|
const currentHostSet = SwcUtils.getHostSet(this);
|
|
9906
|
-
const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
|
|
9907
|
-
await this[meta.propertyKey](
|
|
9908
|
-
if (
|
|
9949
|
+
const args = { event: event2, ...currentHostSet, $el: matchedEl, $root: br };
|
|
9950
|
+
await this[meta.propertyKey](event2, { ...currentHostSet, $matchedElement: matchedEl }, args);
|
|
9951
|
+
if (event2.cancelBubble) break;
|
|
9909
9952
|
}
|
|
9910
9953
|
}
|
|
9911
9954
|
};
|
|
@@ -9953,19 +9996,19 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
9953
9996
|
});
|
|
9954
9997
|
}
|
|
9955
9998
|
bindTargets.forEach((t) => {
|
|
9956
|
-
const handler = async (
|
|
9999
|
+
const handler = async (event2) => {
|
|
9957
10000
|
if (options.filter) {
|
|
9958
10001
|
const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
|
|
9959
|
-
if (!options.filter(
|
|
10002
|
+
if (!options.filter(event2, { currentThis: this, helper })) {
|
|
9960
10003
|
return;
|
|
9961
10004
|
}
|
|
9962
10005
|
}
|
|
9963
|
-
if (options.stopPropagation)
|
|
9964
|
-
if (options.stopImmediatePropagation)
|
|
9965
|
-
if (options.preventDefault)
|
|
10006
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
10007
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
10008
|
+
if (options.preventDefault) event2.preventDefault();
|
|
9966
10009
|
const currentHostSet = SwcUtils.getHostSet(this);
|
|
9967
|
-
const args = { event, ...currentHostSet, $el: t, $root: t };
|
|
9968
|
-
await this[meta.propertyKey](
|
|
10010
|
+
const args = { event: event2, ...currentHostSet, $el: t, $root: t };
|
|
10011
|
+
await this[meta.propertyKey](event2, { currentHostSet, $$matchedElement: event2.currentTarget }, args);
|
|
9969
10012
|
};
|
|
9970
10013
|
t.addEventListener(type, handler, opts);
|
|
9971
10014
|
this._boundListeners.push({ target: t, type, handler, options: opts });
|
|
@@ -9975,9 +10018,7 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
9975
10018
|
const aMethods = findAllOnConnectedAfterMetadata(this).filter((it) => {
|
|
9976
10019
|
return useSsr ? !it.options.ssrFirst : true;
|
|
9977
10020
|
});
|
|
9978
|
-
|
|
9979
|
-
for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
9980
|
-
}
|
|
10021
|
+
for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
9981
10022
|
this._executeSwcScript("swc-on-connected", helperHostSet);
|
|
9982
10023
|
this._executeSwcScript("swc-on-after-connected", helperHostSet);
|
|
9983
10024
|
this.__swc_connected = true;
|
|
@@ -9992,8 +10033,8 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
9992
10033
|
}
|
|
9993
10034
|
}
|
|
9994
10035
|
} finally {
|
|
9995
|
-
for (let
|
|
9996
|
-
await this._invokeLifecycleMethod(
|
|
10036
|
+
for (let m of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) {
|
|
10037
|
+
await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
9997
10038
|
}
|
|
9998
10039
|
if (appHost && typeof appHost._connectedDone === "function") {
|
|
9999
10040
|
await appHost._connectedDone(this);
|
|
@@ -10008,9 +10049,7 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
10008
10049
|
}
|
|
10009
10050
|
this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
|
|
10010
10051
|
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
10011
|
-
|
|
10012
|
-
for (const m of bMethods) this._invokeLifecycleMethod(m, helperHostSet);
|
|
10013
|
-
}
|
|
10052
|
+
for (const m of bMethods) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
10014
10053
|
if (this._boundListeners) {
|
|
10015
10054
|
this._boundListeners.forEach((l) => l.target.removeEventListener(l.type, l.handler, l.options));
|
|
10016
10055
|
this._boundListeners = [];
|
|
@@ -10018,9 +10057,7 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
10018
10057
|
new ElementApply(this, { id: this._swcId }).removeAllEventListener();
|
|
10019
10058
|
if (originalDisconnected) originalDisconnected.apply(this);
|
|
10020
10059
|
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);
|
|
10021
|
-
|
|
10022
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m, helperHostSet);
|
|
10023
|
-
}
|
|
10060
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
10024
10061
|
this._executeSwcScript("swc-on-disconnected", helperHostSet);
|
|
10025
10062
|
this._executeSwcScript("swc-on-after-disconnected", helperHostSet);
|
|
10026
10063
|
this.__swc_connected = false;
|
|
@@ -10030,14 +10067,10 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
10030
10067
|
const hostSet = SwcUtils.getHostSet(this);
|
|
10031
10068
|
this._executeSwcScript("swc-on-before-adopted", hostSet);
|
|
10032
10069
|
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_ADOPTED_METADATA_KEY);
|
|
10033
|
-
|
|
10034
|
-
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
10035
|
-
}
|
|
10070
|
+
for (const m of bMethods) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
10036
10071
|
if (originalAdopted) originalAdopted.apply(this);
|
|
10037
10072
|
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);
|
|
10038
|
-
|
|
10039
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
10040
|
-
}
|
|
10073
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
10041
10074
|
this._executeSwcScript("swc-on-adopted", hostSet);
|
|
10042
10075
|
this._executeSwcScript("swc-on-after-adopted", hostSet);
|
|
10043
10076
|
};
|
|
@@ -10230,13 +10263,22 @@ function applyAttribute(selector, targetAttributeNameOrOptions, options) {
|
|
|
10230
10263
|
descriptor.value = function(...args) {
|
|
10231
10264
|
ensureInit(this);
|
|
10232
10265
|
const res = original.apply(this, args);
|
|
10266
|
+
const extractValue = (v) => {
|
|
10267
|
+
const keyToUse = finalOptions.valueKey ?? ATTRIBUTE_METADATA_KEY;
|
|
10268
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10269
|
+
return v[keyToUse];
|
|
10270
|
+
}
|
|
10271
|
+
return v;
|
|
10272
|
+
};
|
|
10233
10273
|
if (res instanceof Promise) {
|
|
10234
10274
|
return res.then((v) => {
|
|
10235
|
-
|
|
10275
|
+
const extracted = extractValue(v);
|
|
10276
|
+
applyValueToTargets(this, extracted);
|
|
10236
10277
|
return v;
|
|
10237
10278
|
});
|
|
10238
10279
|
} else {
|
|
10239
|
-
|
|
10280
|
+
const extracted = extractValue(res);
|
|
10281
|
+
applyValueToTargets(this, extracted);
|
|
10240
10282
|
return res;
|
|
10241
10283
|
}
|
|
10242
10284
|
};
|
|
@@ -10380,6 +10422,13 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
|
|
|
10380
10422
|
};
|
|
10381
10423
|
const targetEl = getTarget();
|
|
10382
10424
|
const res = original.apply(this, args);
|
|
10425
|
+
const extractValue = (v) => {
|
|
10426
|
+
const keyToUse = options.valueKey ?? APPLY_NODE_METADATA_KEY;
|
|
10427
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10428
|
+
return v[keyToUse];
|
|
10429
|
+
}
|
|
10430
|
+
return v;
|
|
10431
|
+
};
|
|
10383
10432
|
const runApply = (target, val) => {
|
|
10384
10433
|
const pos = options.position || "beforeEnd";
|
|
10385
10434
|
const processedVal = val;
|
|
@@ -10394,12 +10443,14 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
|
|
|
10394
10443
|
}
|
|
10395
10444
|
if (res instanceof Promise) {
|
|
10396
10445
|
return res.then((finalRes) => {
|
|
10446
|
+
const extracted = extractValue(finalRes);
|
|
10397
10447
|
fallbackNodes.forEach((it) => it.remove());
|
|
10398
|
-
if (
|
|
10448
|
+
if (extracted !== void 0 && targetEl) runApply(targetEl, extracted);
|
|
10399
10449
|
return finalRes;
|
|
10400
10450
|
});
|
|
10401
10451
|
} else {
|
|
10402
|
-
|
|
10452
|
+
const extracted = extractValue(res);
|
|
10453
|
+
if (extracted !== void 0 && targetEl) runApply(targetEl, extracted);
|
|
10403
10454
|
return res;
|
|
10404
10455
|
}
|
|
10405
10456
|
};
|
|
@@ -10526,6 +10577,13 @@ function createClassDecorator(action) {
|
|
|
10526
10577
|
descriptor.value = function(...args) {
|
|
10527
10578
|
ensureInit(this);
|
|
10528
10579
|
const res = original.apply(this, args);
|
|
10580
|
+
const extractValue = (v) => {
|
|
10581
|
+
const keyToUse = finalOptions.valueKey ?? CLASS_METADATA_KEY;
|
|
10582
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10583
|
+
return v[keyToUse];
|
|
10584
|
+
}
|
|
10585
|
+
return v;
|
|
10586
|
+
};
|
|
10529
10587
|
const handleResult = (resolvedValue) => {
|
|
10530
10588
|
if (resolvedValue !== void 0) {
|
|
10531
10589
|
const win = this.ownerDocument?.defaultView || window;
|
|
@@ -10605,9 +10663,9 @@ function createClassDecorator(action) {
|
|
|
10605
10663
|
return resolvedValue;
|
|
10606
10664
|
};
|
|
10607
10665
|
if (res instanceof Promise) {
|
|
10608
|
-
return res.then(handleResult);
|
|
10666
|
+
return res.then((v) => handleResult(extractValue(v)));
|
|
10609
10667
|
} else {
|
|
10610
|
-
return handleResult(res);
|
|
10668
|
+
return handleResult(extractValue(res));
|
|
10611
10669
|
}
|
|
10612
10670
|
};
|
|
10613
10671
|
return descriptor;
|
|
@@ -10657,6 +10715,13 @@ function createStyleDecorator(action) {
|
|
|
10657
10715
|
descriptor.value = function(...args) {
|
|
10658
10716
|
ensureInit(this);
|
|
10659
10717
|
const res = original.apply(this, args);
|
|
10718
|
+
const extractValue = (v) => {
|
|
10719
|
+
const keyToUse = options.valueKey ?? STYLE_METADATA_KEY;
|
|
10720
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10721
|
+
return v[keyToUse];
|
|
10722
|
+
}
|
|
10723
|
+
return v;
|
|
10724
|
+
};
|
|
10660
10725
|
const handleResult = (resolvedValue) => {
|
|
10661
10726
|
if (resolvedValue !== void 0) {
|
|
10662
10727
|
const win = this.ownerDocument?.defaultView || window;
|
|
@@ -10722,9 +10787,9 @@ function createStyleDecorator(action) {
|
|
|
10722
10787
|
return resolvedValue;
|
|
10723
10788
|
};
|
|
10724
10789
|
if (res instanceof Promise) {
|
|
10725
|
-
return res.then(handleResult);
|
|
10790
|
+
return res.then((v) => handleResult(extractValue(v)));
|
|
10726
10791
|
} else {
|
|
10727
|
-
return handleResult(res);
|
|
10792
|
+
return handleResult(extractValue(res));
|
|
10728
10793
|
}
|
|
10729
10794
|
};
|
|
10730
10795
|
return descriptor;
|
|
@@ -10792,7 +10857,9 @@ function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKeyOr
|
|
|
10792
10857
|
}
|
|
10793
10858
|
var getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
|
|
10794
10859
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
10795
|
-
|
|
10860
|
+
const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
10861
|
+
if (!results) return [];
|
|
10862
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
10796
10863
|
};
|
|
10797
10864
|
|
|
10798
10865
|
// src/decorators/subscribeSwcAppMessageWhileConnected.ts
|
|
@@ -10835,7 +10902,7 @@ var getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
|
|
|
10835
10902
|
|
|
10836
10903
|
// src/decorators/publishSwcAppMessage.ts
|
|
10837
10904
|
var PUBLISH_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for("simple-web-component:publish-swc-app-message");
|
|
10838
|
-
function createPublishSwcAppMessage(messageType) {
|
|
10905
|
+
function createPublishSwcAppMessage(messageType, options) {
|
|
10839
10906
|
return (target, propertyKey, descriptor) => {
|
|
10840
10907
|
const constructor = target.constructor;
|
|
10841
10908
|
let list = ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
|
|
@@ -10850,45 +10917,58 @@ function createPublishSwcAppMessage(messageType) {
|
|
|
10850
10917
|
const originalMethod = descriptor.value;
|
|
10851
10918
|
descriptor.value = function(...args) {
|
|
10852
10919
|
const result = originalMethod.apply(this, args);
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
});
|
|
10862
|
-
}
|
|
10863
|
-
}).catch((err) => {
|
|
10864
|
-
console.warn("publishSwcAppMessage async error:", err);
|
|
10865
|
-
});
|
|
10866
|
-
} else {
|
|
10920
|
+
const extractValue = (v) => {
|
|
10921
|
+
const keyToUse = options?.valueKey ?? PUBLISH_SWC_APP_MESSAGE_METADATA_KEY;
|
|
10922
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
10923
|
+
return v[keyToUse];
|
|
10924
|
+
}
|
|
10925
|
+
return v;
|
|
10926
|
+
};
|
|
10927
|
+
const publishMessage = (data) => {
|
|
10867
10928
|
const appHost = SwcUtils.getAppHost(this);
|
|
10868
10929
|
if (appHost) {
|
|
10869
10930
|
appHost.publishMessage({
|
|
10870
10931
|
publisher: this,
|
|
10871
|
-
data
|
|
10932
|
+
data,
|
|
10872
10933
|
type: messageType
|
|
10873
10934
|
});
|
|
10874
10935
|
}
|
|
10936
|
+
};
|
|
10937
|
+
if (result instanceof Promise) {
|
|
10938
|
+
result.then((data) => {
|
|
10939
|
+
const extracted = extractValue(data);
|
|
10940
|
+
publishMessage(extracted);
|
|
10941
|
+
}).catch((err) => {
|
|
10942
|
+
console.warn("publishSwcAppMessage async error:", err);
|
|
10943
|
+
});
|
|
10944
|
+
} else {
|
|
10945
|
+
const extracted = extractValue(result);
|
|
10946
|
+
publishMessage(extracted);
|
|
10875
10947
|
}
|
|
10876
10948
|
return result;
|
|
10877
10949
|
};
|
|
10878
10950
|
return descriptor;
|
|
10879
10951
|
};
|
|
10880
10952
|
}
|
|
10881
|
-
function publishSwcAppMessage(
|
|
10882
|
-
if (
|
|
10883
|
-
const target =
|
|
10884
|
-
return createPublishSwcAppMessage()(target,
|
|
10953
|
+
function publishSwcAppMessage(targetOrMessageTypeOrOptions, propertyKeyOrOptions, descriptor) {
|
|
10954
|
+
if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object" && propertyKeyOrOptions && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") && descriptor) {
|
|
10955
|
+
const target = targetOrMessageTypeOrOptions;
|
|
10956
|
+
return createPublishSwcAppMessage()(target, propertyKeyOrOptions, descriptor);
|
|
10885
10957
|
}
|
|
10886
10958
|
let messageType;
|
|
10887
|
-
|
|
10888
|
-
|
|
10959
|
+
let options;
|
|
10960
|
+
if (typeof targetOrMessageTypeOrOptions === "string") {
|
|
10961
|
+
messageType = targetOrMessageTypeOrOptions;
|
|
10962
|
+
if (typeof propertyKeyOrOptions === "object" && propertyKeyOrOptions !== null) {
|
|
10963
|
+
options = propertyKeyOrOptions;
|
|
10964
|
+
}
|
|
10965
|
+
} else if (typeof targetOrMessageTypeOrOptions === "object" && targetOrMessageTypeOrOptions !== null) {
|
|
10966
|
+
options = targetOrMessageTypeOrOptions;
|
|
10967
|
+
messageType = options.messageType;
|
|
10889
10968
|
}
|
|
10890
|
-
return createPublishSwcAppMessage(messageType);
|
|
10969
|
+
return createPublishSwcAppMessage(messageType, options);
|
|
10891
10970
|
}
|
|
10971
|
+
var publish = publishSwcAppMessage;
|
|
10892
10972
|
var getPublishSwcAppMessageMetadata = (target) => {
|
|
10893
10973
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
10894
10974
|
return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
|
|
@@ -10948,15 +11028,24 @@ function applySlot(targetId, opt) {
|
|
|
10948
11028
|
fallbackNodes.push(...nodes);
|
|
10949
11029
|
applyToDom2(swcId, targetId, options.position, nodes);
|
|
10950
11030
|
}
|
|
11031
|
+
const extractValue = (v) => {
|
|
11032
|
+
const keyToUse = options.valueKey ?? APPLY_SLOT_METADATA_KEY;
|
|
11033
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
11034
|
+
return v[keyToUse];
|
|
11035
|
+
}
|
|
11036
|
+
return v;
|
|
11037
|
+
};
|
|
10951
11038
|
let res = original.apply(this, args);
|
|
10952
11039
|
if (res instanceof Promise) {
|
|
10953
11040
|
return res.then((asyncRes) => {
|
|
10954
|
-
const
|
|
11041
|
+
const extracted = extractValue(asyncRes);
|
|
11042
|
+
const nodes = resToNodes(extracted);
|
|
10955
11043
|
fallbackNodes.forEach((it) => it.remove());
|
|
10956
11044
|
applyToDom2(swcId, targetId, options.position, nodes);
|
|
10957
11045
|
});
|
|
10958
11046
|
} else {
|
|
10959
|
-
const
|
|
11047
|
+
const extracted = extractValue(res);
|
|
11048
|
+
const nodes = resToNodes(extracted);
|
|
10960
11049
|
applyToDom2(swcId, targetId, options.position, nodes);
|
|
10961
11050
|
}
|
|
10962
11051
|
};
|
|
@@ -13238,14 +13327,9 @@ function SwcAppMixin(Base) {
|
|
|
13238
13327
|
);
|
|
13239
13328
|
try {
|
|
13240
13329
|
const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
|
|
13241
|
-
if (routeChangeSubscribers
|
|
13330
|
+
if (routeChangeSubscribers.length > 0) {
|
|
13242
13331
|
console.log("[SWC-MIXIN] Route change subscribers found");
|
|
13243
|
-
const
|
|
13244
|
-
const orderA = a.options?.order ?? 0;
|
|
13245
|
-
const orderB = b.options?.order ?? 0;
|
|
13246
|
-
return orderA - orderB;
|
|
13247
|
-
});
|
|
13248
|
-
for (const metadata of sortedSubscribers) {
|
|
13332
|
+
for (const metadata of routeChangeSubscribers) {
|
|
13249
13333
|
const methodName = metadata.propertyKey;
|
|
13250
13334
|
let pathPattern = metadata.options?.path;
|
|
13251
13335
|
const filter = metadata.options?.filter;
|
|
@@ -13300,9 +13384,9 @@ function SwcAppMixin(Base) {
|
|
|
13300
13384
|
this._connectedInvocations++;
|
|
13301
13385
|
}
|
|
13302
13386
|
this._swc_connected_instance.add(instance);
|
|
13303
|
-
const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY)
|
|
13387
|
+
const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);
|
|
13304
13388
|
for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {
|
|
13305
|
-
await instance?._invokeLifecycleMethod?.(connectedSwcAppCallBack);
|
|
13389
|
+
await instance?._invokeLifecycleMethod?.(connectedSwcAppCallBack.propertyKey);
|
|
13306
13390
|
}
|
|
13307
13391
|
if (this._childrenConnectedDoneInterval) {
|
|
13308
13392
|
this.config.window.clearInterval(this._childrenConnectedDoneInterval);
|
|
@@ -13718,9 +13802,15 @@ export {
|
|
|
13718
13802
|
defineSwcAppNav,
|
|
13719
13803
|
defineSwcAppSection,
|
|
13720
13804
|
elementDefine,
|
|
13805
|
+
emit,
|
|
13721
13806
|
emitCustomEvent,
|
|
13722
13807
|
emitCustomEventThis,
|
|
13723
13808
|
ensureInit,
|
|
13809
|
+
event,
|
|
13810
|
+
eventDelegate,
|
|
13811
|
+
eventDelegateAllDom,
|
|
13812
|
+
eventDelegateLightDom,
|
|
13813
|
+
eventDelegateShadowDom,
|
|
13724
13814
|
findAllApplyNodeMetadata,
|
|
13725
13815
|
findAllApplySlotMetadata,
|
|
13726
13816
|
findAllAttributeApplyMetadata,
|
|
@@ -13767,7 +13857,6 @@ export {
|
|
|
13767
13857
|
innerTextNodeThis,
|
|
13768
13858
|
innerTextShadowNode,
|
|
13769
13859
|
isSSR,
|
|
13770
|
-
onAddEventListener,
|
|
13771
13860
|
onAdopted,
|
|
13772
13861
|
onAdoptedAfter,
|
|
13773
13862
|
onAdoptedBefore,
|
|
@@ -13787,6 +13876,7 @@ export {
|
|
|
13787
13876
|
prependTextSlot,
|
|
13788
13877
|
property,
|
|
13789
13878
|
propertyThis,
|
|
13879
|
+
publish,
|
|
13790
13880
|
publishSwcAppMessage,
|
|
13791
13881
|
query,
|
|
13792
13882
|
queryAll,
|