@ottttto/dsh-scheduled-send 0.3.1 → 0.3.2
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/lib/client.js +16 -6
- package/package.json +1 -1
- package/src/client-view.js +16 -6
package/lib/client.js
CHANGED
|
@@ -499,6 +499,7 @@ function createClientPluginBody(React) {
|
|
|
499
499
|
const core = props.panelCore;
|
|
500
500
|
const [open, setOpen] = React.useState(false);
|
|
501
501
|
const [tick, setTick] = React.useState(0);
|
|
502
|
+
const [hover, setHover] = React.useState(false);
|
|
502
503
|
const mobile = isMobile();
|
|
503
504
|
|
|
504
505
|
// keep the badge alive even while the panel is closed: poll the FULL
|
|
@@ -524,11 +525,13 @@ function createClientPluginBody(React) {
|
|
|
524
525
|
|
|
525
526
|
const isDark = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
526
527
|
const entryBtn = {
|
|
527
|
-
cursor: "pointer", display: "
|
|
528
|
-
|
|
529
|
-
|
|
528
|
+
cursor: "pointer", display: "flex", alignItems: "center", gap: 8,
|
|
529
|
+
width: "100%", boxSizing: "border-box", textAlign: "left",
|
|
530
|
+
border: "none", background: hover ? "rgba(128,128,128,.16)" : "transparent", color: "inherit",
|
|
531
|
+
fontSize: 12, fontWeight: 600, padding: "6px 10px", borderRadius: 8, whiteSpace: "nowrap",
|
|
530
532
|
...(mobile ? { minHeight: TOUCH_MIN } : {}),
|
|
531
533
|
};
|
|
534
|
+
const iconBox = { display: "inline-flex", width: 16, justifyContent: "center", flexShrink: 0 };
|
|
532
535
|
const badge = (n) => h("span", {
|
|
533
536
|
key: "b", "data-badge": n,
|
|
534
537
|
style: {
|
|
@@ -623,14 +626,18 @@ function createClientPluginBody(React) {
|
|
|
623
626
|
])
|
|
624
627
|
: null;
|
|
625
628
|
|
|
626
|
-
return h("div", { "data-plugin": "dsh-scheduled-send-sidebar", style: {
|
|
629
|
+
return h("div", { "data-plugin": "dsh-scheduled-send-sidebar", style: { width: "100%" } }, [
|
|
630
|
+
null,
|
|
627
631
|
h("button", {
|
|
628
632
|
key: "btn", type: "button",
|
|
633
|
+
onMouseEnter: () => setHover(true),
|
|
634
|
+
onMouseLeave: () => setHover(false),
|
|
629
635
|
onClick: () => { setOpen(!open); setTick((n) => n + 1); },
|
|
630
636
|
title: "定时任务", "aria-label": "定时任务", style: entryBtn,
|
|
631
637
|
}, [
|
|
632
|
-
h("span", { key: "
|
|
633
|
-
|
|
638
|
+
h("span", { key: "i", style: iconBox }, "⏰"),
|
|
639
|
+
h("span", { key: "l" }, "定时任务"),
|
|
640
|
+
all.length ? h("span", { key: "bs", style: { marginLeft: "auto", display: "inline-flex" } }, badge(all.length)) : null,
|
|
634
641
|
]),
|
|
635
642
|
footer,
|
|
636
643
|
]);
|
|
@@ -690,6 +697,9 @@ function createClientPluginBody(React) {
|
|
|
690
697
|
|
|
691
698
|
const inject = ["slots", "sessions"]; // sessions: sidebar panel jump (0.3.0)
|
|
692
699
|
function apply(ctx) {
|
|
700
|
+
// due-time delivery: refresh the sidebar panel the moment a task fires
|
|
701
|
+
ctx.on?.('guard/scheduled-due', () => { void panelCore.refresh(); });
|
|
702
|
+
ctx.on?.('guard/scheduled-dropped', () => { void panelCore.refresh(); });
|
|
693
703
|
ctx.inject(inject, (scope) => {
|
|
694
704
|
// 0.3.0 session navigation, sourced from the sessions service:
|
|
695
705
|
// - open(id) selects a session as current (unknown ids throw → false)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottttto/dsh-scheduled-send",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "DSH plugin: scheduled sending (⏰ composer button, dock list of pending tasks, sidebar 定时任务 panel with cross-session cancel, due-time delivery as a normal user bubble)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/client-view.js
CHANGED
|
@@ -235,6 +235,7 @@ function createClientPluginBody(React) {
|
|
|
235
235
|
const core = props.panelCore;
|
|
236
236
|
const [open, setOpen] = React.useState(false);
|
|
237
237
|
const [tick, setTick] = React.useState(0);
|
|
238
|
+
const [hover, setHover] = React.useState(false);
|
|
238
239
|
const mobile = isMobile();
|
|
239
240
|
|
|
240
241
|
// keep the badge alive even while the panel is closed: poll the FULL
|
|
@@ -260,11 +261,13 @@ function createClientPluginBody(React) {
|
|
|
260
261
|
|
|
261
262
|
const isDark = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
262
263
|
const entryBtn = {
|
|
263
|
-
cursor: "pointer", display: "
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
cursor: "pointer", display: "flex", alignItems: "center", gap: 8,
|
|
265
|
+
width: "100%", boxSizing: "border-box", textAlign: "left",
|
|
266
|
+
border: "none", background: hover ? "rgba(128,128,128,.16)" : "transparent", color: "inherit",
|
|
267
|
+
fontSize: 12, fontWeight: 600, padding: "6px 10px", borderRadius: 8, whiteSpace: "nowrap",
|
|
266
268
|
...(mobile ? { minHeight: TOUCH_MIN } : {}),
|
|
267
269
|
};
|
|
270
|
+
const iconBox = { display: "inline-flex", width: 16, justifyContent: "center", flexShrink: 0 };
|
|
268
271
|
const badge = (n) => h("span", {
|
|
269
272
|
key: "b", "data-badge": n,
|
|
270
273
|
style: {
|
|
@@ -359,14 +362,18 @@ function createClientPluginBody(React) {
|
|
|
359
362
|
])
|
|
360
363
|
: null;
|
|
361
364
|
|
|
362
|
-
return h("div", { "data-plugin": "dsh-scheduled-send-sidebar", style: {
|
|
365
|
+
return h("div", { "data-plugin": "dsh-scheduled-send-sidebar", style: { width: "100%" } }, [
|
|
366
|
+
null,
|
|
363
367
|
h("button", {
|
|
364
368
|
key: "btn", type: "button",
|
|
369
|
+
onMouseEnter: () => setHover(true),
|
|
370
|
+
onMouseLeave: () => setHover(false),
|
|
365
371
|
onClick: () => { setOpen(!open); setTick((n) => n + 1); },
|
|
366
372
|
title: "定时任务", "aria-label": "定时任务", style: entryBtn,
|
|
367
373
|
}, [
|
|
368
|
-
h("span", { key: "
|
|
369
|
-
|
|
374
|
+
h("span", { key: "i", style: iconBox }, "⏰"),
|
|
375
|
+
h("span", { key: "l" }, "定时任务"),
|
|
376
|
+
all.length ? h("span", { key: "bs", style: { marginLeft: "auto", display: "inline-flex" } }, badge(all.length)) : null,
|
|
370
377
|
]),
|
|
371
378
|
footer,
|
|
372
379
|
]);
|
|
@@ -426,6 +433,9 @@ function createClientPluginBody(React) {
|
|
|
426
433
|
|
|
427
434
|
const inject = ["slots", "sessions"]; // sessions: sidebar panel jump (0.3.0)
|
|
428
435
|
function apply(ctx) {
|
|
436
|
+
// due-time delivery: refresh the sidebar panel the moment a task fires
|
|
437
|
+
ctx.on?.('guard/scheduled-due', () => { void panelCore.refresh(); });
|
|
438
|
+
ctx.on?.('guard/scheduled-dropped', () => { void panelCore.refresh(); });
|
|
429
439
|
ctx.inject(inject, (scope) => {
|
|
430
440
|
// 0.3.0 session navigation, sourced from the sessions service:
|
|
431
441
|
// - open(id) selects a session as current (unknown ids throw → false)
|