@dooboostore/simple-web-component 1.0.52 → 1.0.54
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 +7 -8
- package/dist/cjs/decorators/addEventListener.js +8 -3
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +15 -0
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/requestAnimationFrame.js +10 -2
- package/dist/cjs/decorators/requestAnimationFrame.js.map +2 -2
- package/dist/cjs/decorators/setInterval.js +4 -2
- package/dist/cjs/decorators/setInterval.js.map +2 -2
- package/dist/cjs/decorators/setTimeout.js +4 -2
- package/dist/cjs/decorators/setTimeout.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppMessage.js +14 -1
- package/dist/cjs/decorators/subscribeSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +8 -3
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +15 -0
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/requestAnimationFrame.js +10 -2
- package/dist/esm/decorators/requestAnimationFrame.js.map +2 -2
- package/dist/esm/decorators/setInterval.js +4 -2
- package/dist/esm/decorators/setInterval.js.map +2 -2
- package/dist/esm/decorators/setTimeout.js +4 -2
- package/dist/esm/decorators/setTimeout.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppMessage.js +14 -1
- package/dist/esm/decorators/subscribeSwcAppMessage.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +51 -6
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +12 -0
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/requestAnimationFrame.d.ts +7 -4
- package/dist/types/decorators/requestAnimationFrame.d.ts.map +1 -1
- package/dist/types/decorators/setInterval.d.ts +6 -4
- package/dist/types/decorators/setInterval.d.ts.map +1 -1
- package/dist/types/decorators/setTimeout.d.ts +6 -4
- package/dist/types/decorators/setTimeout.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts +12 -0
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +51 -6
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
- package/package.json +3 -3
- package/src/decorators/addEventListener.ts +10 -3
- package/src/decorators/applyNode.ts +30 -0
- package/src/decorators/requestAnimationFrame.ts +17 -5
- package/src/decorators/setInterval.ts +9 -5
- package/src/decorators/setTimeout.ts +9 -5
- package/src/decorators/subscribeSwcAppMessage.ts +27 -0
|
@@ -2318,6 +2318,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2318
2318
|
receiveMessage: () => receiveMessage,
|
|
2319
2319
|
removeAttribute: () => removeAttribute,
|
|
2320
2320
|
removeClass: () => removeClass,
|
|
2321
|
+
removeNode: () => removeNode,
|
|
2321
2322
|
removeSSRAttribute: () => removeSSRAttribute,
|
|
2322
2323
|
removeStyle: () => removeStyle,
|
|
2323
2324
|
replaceChildren: () => replaceChildren,
|
|
@@ -2326,6 +2327,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2326
2327
|
replaceChildrenSlot: () => replaceChildrenSlot,
|
|
2327
2328
|
replaceChildrenTextSlot: () => replaceChildrenTextSlot,
|
|
2328
2329
|
requestAnimationFrame: () => requestAnimationFrame,
|
|
2330
|
+
requestAnimationFrameReturnValue: () => requestAnimationFrameReturnValue,
|
|
2329
2331
|
resizeObserver: () => resizeObserver,
|
|
2330
2332
|
resizeObserverAll: () => resizeObserverAll,
|
|
2331
2333
|
resizeObserverBeforeReturn: () => resizeObserverBeforeReturn,
|
|
@@ -2342,10 +2344,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2342
2344
|
setClass: () => setClass,
|
|
2343
2345
|
setInterval: () => setInterval2,
|
|
2344
2346
|
setIntervalBeforeReturn: () => setIntervalBeforeReturn,
|
|
2347
|
+
setIntervalReturnValue: () => setIntervalReturnValue,
|
|
2345
2348
|
setSSRAttribute: () => setSSRAttribute,
|
|
2346
2349
|
setStyle: () => setStyle,
|
|
2347
2350
|
setTimeout: () => setTimeout2,
|
|
2348
2351
|
setTimeoutBeforeReturn: () => setTimeoutBeforeReturn,
|
|
2352
|
+
setTimeoutReturnValue: () => setTimeoutReturnValue,
|
|
2349
2353
|
skipIfEmpty: () => skipIfEmpty,
|
|
2350
2354
|
skipIfExists: () => skipIfExists,
|
|
2351
2355
|
skipIfSameTagPresent: () => skipIfSameTagPresent,
|
|
@@ -2356,6 +2360,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2356
2360
|
styleLight: () => styleLight,
|
|
2357
2361
|
styleShadow: () => styleShadow,
|
|
2358
2362
|
subscribeSwcAppMessage: () => subscribeSwcAppMessage,
|
|
2363
|
+
subscribeSwcAppMessageBehavior: () => subscribeSwcAppMessageBehavior,
|
|
2364
|
+
subscribeSwcAppMessageReplay: () => subscribeSwcAppMessageReplay,
|
|
2359
2365
|
subscribeSwcAppRouteChange: () => subscribeSwcAppRouteChange,
|
|
2360
2366
|
subscribeSwcAppRouteChangeConnectedDone: () => subscribeSwcAppRouteChangeConnectedDone,
|
|
2361
2367
|
swcAppArticleTagName: () => swcAppArticleTagName,
|
|
@@ -16104,7 +16110,9 @@ ${indentStr}}`;
|
|
|
16104
16110
|
const currentWin = helperHostSet2.$w;
|
|
16105
16111
|
const { type, options } = meta;
|
|
16106
16112
|
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
16113
|
+
const matchedTargets = /* @__PURE__ */ new WeakMap();
|
|
16107
16114
|
const handler = async (event2) => {
|
|
16115
|
+
const matchedElement2 = matchedTargets.get(event2) ?? event2.currentTarget;
|
|
16108
16116
|
const helper = options.filter || options.before || options.finally ? SwcUtils.getHelperAndHostSet(target, currentWin) : void 0;
|
|
16109
16117
|
if (options.filter) {
|
|
16110
16118
|
if (!await options.filter(event2, { currentThis: inst, helper })) return;
|
|
@@ -16113,12 +16121,12 @@ ${indentStr}}`;
|
|
|
16113
16121
|
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
16114
16122
|
if (options.preventDefault) event2.preventDefault();
|
|
16115
16123
|
const currentHostSet = SwcUtils.getHostSet(inst);
|
|
16116
|
-
const legacyArgs = [event2, { currentHostSet, $matchedElement:
|
|
16124
|
+
const legacyArgs = [event2, { currentHostSet, $matchedElement: matchedElement2 }, { event: event2, ...currentHostSet, $el: target, $root: target }];
|
|
16117
16125
|
const currentHelperSet = SwcUtils.getHelperSet(currentWin);
|
|
16118
16126
|
const currentHelperHostSet = { ...currentHelperSet, ...currentHostSet, $this: inst };
|
|
16119
16127
|
const buildArgs = (beforeReturn) => buildSwcParameterArgs(inst, meta.propertyKey, {
|
|
16120
16128
|
eventObject: event2,
|
|
16121
|
-
matchedElement:
|
|
16129
|
+
matchedElement: matchedElement2,
|
|
16122
16130
|
hostSet: currentHostSet,
|
|
16123
16131
|
helperHostSet: currentHelperHostSet,
|
|
16124
16132
|
helperSet: currentHelperSet,
|
|
@@ -16152,7 +16160,10 @@ ${indentStr}}`;
|
|
|
16152
16160
|
next: (e) => handler(e).catch((err) => console.error("Event handler error:", err)),
|
|
16153
16161
|
error: (err) => console.error("Event stream error:", err)
|
|
16154
16162
|
});
|
|
16155
|
-
const wrappedHandler = (event2) =>
|
|
16163
|
+
const wrappedHandler = (event2) => {
|
|
16164
|
+
matchedTargets.set(event2, event2.currentTarget);
|
|
16165
|
+
eventSubject.next(event2);
|
|
16166
|
+
};
|
|
16156
16167
|
target.addEventListener(type, wrappedHandler, opts);
|
|
16157
16168
|
const onRemoves = options.removeListener ? [{ fn: options.removeListener, opts: options }] : [];
|
|
16158
16169
|
this.getBoundListeners(inst).push({ target, type, handler: wrappedHandler, options: opts, subscription, onRemoves, meta });
|
|
@@ -18224,6 +18235,17 @@ ${indentStr}}`;
|
|
|
18224
18235
|
return createSubscribeSwcAppMessage(options, messageType);
|
|
18225
18236
|
}
|
|
18226
18237
|
var receiveMessage = subscribeSwcAppMessage;
|
|
18238
|
+
var withSubject = (subject, a, b, descriptor) => {
|
|
18239
|
+
if (descriptor) return createSubscribeSwcAppMessage({ subject })(a, b, descriptor);
|
|
18240
|
+
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject }, a);
|
|
18241
|
+
return createSubscribeSwcAppMessage({ ...a ?? {}, subject });
|
|
18242
|
+
};
|
|
18243
|
+
function subscribeSwcAppMessageBehavior(a, b, descriptor) {
|
|
18244
|
+
return withSubject("behavior", a, b, descriptor);
|
|
18245
|
+
}
|
|
18246
|
+
function subscribeSwcAppMessageReplay(a, b, descriptor) {
|
|
18247
|
+
return withSubject("replay", a, b, descriptor);
|
|
18248
|
+
}
|
|
18227
18249
|
var getSubscribeSwcAppMessageMetadata = (target) => {
|
|
18228
18250
|
const constructor = typeof target === "function" ? target : target.constructor;
|
|
18229
18251
|
return ReflectUtils.findAllMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor).flat();
|
|
@@ -18298,7 +18320,7 @@ ${indentStr}}`;
|
|
|
18298
18320
|
function setInterval2(interval2, options = {}) {
|
|
18299
18321
|
return (target, propertyKey, descriptor) => {
|
|
18300
18322
|
const constructor = target.constructor;
|
|
18301
|
-
const normalizedOptions = { ...options, type: options.type ?? "
|
|
18323
|
+
const normalizedOptions = { ...options, type: options.type ?? "onConnected" };
|
|
18302
18324
|
let metaList = ReflectUtils.getOwnMetadata(SET_INTERVAL_METADATA_KEY, constructor);
|
|
18303
18325
|
if (!metaList) {
|
|
18304
18326
|
metaList = [];
|
|
@@ -18388,6 +18410,7 @@ ${indentStr}}`;
|
|
|
18388
18410
|
inst.__swc_intervalIds = [];
|
|
18389
18411
|
}
|
|
18390
18412
|
};
|
|
18413
|
+
var setIntervalReturnValue = (interval2, options = {}) => setInterval2(interval2, { ...options, type: "returnValue" });
|
|
18391
18414
|
|
|
18392
18415
|
// src/decorators/setTimeout.ts
|
|
18393
18416
|
var SET_TIMEOUT_METADATA_KEY = Symbol.for("simple-web-component:set-timeout");
|
|
@@ -18395,7 +18418,7 @@ ${indentStr}}`;
|
|
|
18395
18418
|
function setTimeout2(delay, options = {}) {
|
|
18396
18419
|
return (target, propertyKey, descriptor) => {
|
|
18397
18420
|
const constructor = target.constructor;
|
|
18398
|
-
const normalizedOptions = { ...options, type: options.type ?? "
|
|
18421
|
+
const normalizedOptions = { ...options, type: options.type ?? "onConnected" };
|
|
18399
18422
|
let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor);
|
|
18400
18423
|
if (!metaList) {
|
|
18401
18424
|
metaList = [];
|
|
@@ -18488,6 +18511,7 @@ ${indentStr}}`;
|
|
|
18488
18511
|
inst.__swc_timeoutIds = [];
|
|
18489
18512
|
}
|
|
18490
18513
|
};
|
|
18514
|
+
var setTimeoutReturnValue = (delay, options = {}) => setTimeout2(delay, { ...options, type: "returnValue" });
|
|
18491
18515
|
|
|
18492
18516
|
// src/decorators/requestAnimationFrame.ts
|
|
18493
18517
|
var REQUEST_ANIMATION_FRAME_METADATA_KEY = Symbol.for("simple-web-component:request-animation-frame");
|
|
@@ -18514,7 +18538,7 @@ ${indentStr}}`;
|
|
|
18514
18538
|
};
|
|
18515
18539
|
var applyRequestAnimationFrame = (options, target, propertyKey, descriptor) => {
|
|
18516
18540
|
const constructor = target.constructor;
|
|
18517
|
-
const normalizedOptions = { ...options, type: options.type ?? "
|
|
18541
|
+
const normalizedOptions = { ...options, type: options.type ?? "onConnected" };
|
|
18518
18542
|
let metaList = ReflectUtils.getOwnMetadata(REQUEST_ANIMATION_FRAME_METADATA_KEY, constructor);
|
|
18519
18543
|
if (!metaList) {
|
|
18520
18544
|
metaList = [];
|
|
@@ -18576,6 +18600,13 @@ ${indentStr}}`;
|
|
|
18576
18600
|
inst.__swc_requestAnimationFrameIds = [];
|
|
18577
18601
|
}
|
|
18578
18602
|
};
|
|
18603
|
+
function requestAnimationFrameReturnValue(optionsOrTarget, propertyKey, descriptor) {
|
|
18604
|
+
if (propertyKey !== void 0) {
|
|
18605
|
+
applyRequestAnimationFrame({ type: "returnValue" }, optionsOrTarget, propertyKey, descriptor);
|
|
18606
|
+
return;
|
|
18607
|
+
}
|
|
18608
|
+
return (target, propertyKey2, descriptor2) => applyRequestAnimationFrame({ ...optionsOrTarget ?? {}, type: "returnValue" }, target, propertyKey2, descriptor2);
|
|
18609
|
+
}
|
|
18579
18610
|
|
|
18580
18611
|
// src/decorators/eventMedia.ts
|
|
18581
18612
|
var EVENT_MEDIA_METADATA_KEY = Symbol.for("simple-web-component:event-media");
|
|
@@ -19814,6 +19845,10 @@ ${indentStr}}`;
|
|
|
19814
19845
|
targetEl.replaceChildren();
|
|
19815
19846
|
return [];
|
|
19816
19847
|
}
|
|
19848
|
+
if (pos === "remove") {
|
|
19849
|
+
(targetEl instanceof win.ShadowRoot ? targetEl.host : targetEl).remove();
|
|
19850
|
+
return [];
|
|
19851
|
+
}
|
|
19817
19852
|
const doc = win.document;
|
|
19818
19853
|
const hostSet2 = SwcUtils.getHelperAndHostSet(currentThis);
|
|
19819
19854
|
const id = currentThis._swcId;
|
|
@@ -19913,6 +19948,7 @@ ${indentStr}}`;
|
|
|
19913
19948
|
};
|
|
19914
19949
|
const runApply = (target, val) => {
|
|
19915
19950
|
const pos = options.position || "beforeEnd";
|
|
19951
|
+
if (pos === "remove" && !val) return;
|
|
19916
19952
|
const processedVal = val;
|
|
19917
19953
|
if (!options.filter || options.filter(target, processedVal, { currentThis: this, helper: hostSet2 })) {
|
|
19918
19954
|
applyToDom(this, target, processedVal, pos, currentWin);
|
|
@@ -19957,6 +19993,15 @@ ${indentStr}}`;
|
|
|
19957
19993
|
return applyNode({ ...selectorOrOptions, position: "clearChildren" });
|
|
19958
19994
|
}
|
|
19959
19995
|
var clearNode = clearChildrenNode;
|
|
19996
|
+
function removeNode(selectorOrOptions, maybeOptions, descriptor) {
|
|
19997
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
19998
|
+
return applyNode({ position: "remove" })(selectorOrOptions, maybeOptions, descriptor);
|
|
19999
|
+
}
|
|
20000
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
20001
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "remove" });
|
|
20002
|
+
}
|
|
20003
|
+
return applyNode({ ...selectorOrOptions, position: "remove" });
|
|
20004
|
+
}
|
|
19960
20005
|
function innerHtml(selectorOrOptions, maybeOptions, descriptor) {
|
|
19961
20006
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
19962
20007
|
return applyNode({ position: "innerHtml" })(selectorOrOptions, maybeOptions, descriptor);
|