@lynn123411/dsh-notify-user 0.5.1 → 0.5.3
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 +150 -18
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/preview.svg +38 -0
- package/docs/preview.zh.svg +38 -0
- package/lib/client.js +28 -2
- package/lib/client.js.map +2 -2
- package/lib/index.js +2 -0
- package/lib/index.js.map +2 -2
- package/locale/en.json +2 -1
- package/locale/zh.json +2 -1
- package/package.json +2 -2
- package/DETAILS.md +0 -136
package/lib/client.js
CHANGED
|
@@ -37,6 +37,7 @@ var DEFAULT_RESET_ON_PROSE = true;
|
|
|
37
37
|
var DEFAULT_COLLAPSIBLE = true;
|
|
38
38
|
var DEFAULT_SUMMARY_ONLY = false;
|
|
39
39
|
var DEFAULT_BODY_EXPANDED_BY_DEFAULT = false;
|
|
40
|
+
var DEFAULT_SHOW_TIME = false;
|
|
40
41
|
var SUMMARY_RENDERS = ["card", "prose"];
|
|
41
42
|
var DEFAULT_SUMMARY_RENDER = "card";
|
|
42
43
|
var CARD_PLACEMENTS = ["boundary", "inline"];
|
|
@@ -77,6 +78,7 @@ var DEFAULT_CLIENT_CONFIG = {
|
|
|
77
78
|
summaryOnly: DEFAULT_SUMMARY_ONLY,
|
|
78
79
|
summaryRender: DEFAULT_SUMMARY_RENDER,
|
|
79
80
|
bodyExpandedByDefault: DEFAULT_BODY_EXPANDED_BY_DEFAULT,
|
|
81
|
+
showTime: DEFAULT_SHOW_TIME,
|
|
80
82
|
cardPlacement: DEFAULT_CARD_PLACEMENT,
|
|
81
83
|
defaultEnabled: DEFAULT_ENABLED,
|
|
82
84
|
sessionOverrides: {}
|
|
@@ -105,12 +107,14 @@ function readConfig(form) {
|
|
|
105
107
|
const summaryRender = SUMMARY_RENDERS.find((render) => render === rawSummaryRender) ?? DEFAULT_CLIENT_CONFIG.summaryRender;
|
|
106
108
|
const rawBodyExpanded = value["bodyExpandedByDefault"];
|
|
107
109
|
const bodyExpandedByDefault = typeof rawBodyExpanded === "boolean" ? rawBodyExpanded : DEFAULT_CLIENT_CONFIG.bodyExpandedByDefault;
|
|
110
|
+
const rawShowTime = value["showTime"];
|
|
111
|
+
const showTime = typeof rawShowTime === "boolean" ? rawShowTime : DEFAULT_CLIENT_CONFIG.showTime;
|
|
108
112
|
const rawPlacement = value["cardPlacement"];
|
|
109
113
|
const cardPlacement = CARD_PLACEMENTS.find((placement) => placement === rawPlacement) ?? DEFAULT_CLIENT_CONFIG.cardPlacement;
|
|
110
114
|
const rawDefaultEnabled = value["defaultEnabled"];
|
|
111
115
|
const defaultEnabled = typeof rawDefaultEnabled === "boolean" ? rawDefaultEnabled : DEFAULT_CLIENT_CONFIG.defaultEnabled;
|
|
112
116
|
const sessionOverrides = readOverrides(value["sessionOverrides"]);
|
|
113
|
-
return { nudgeAfter, resetOnProse, collapsible, summaryOnly, summaryRender, bodyExpandedByDefault, cardPlacement, defaultEnabled, sessionOverrides };
|
|
117
|
+
return { nudgeAfter, resetOnProse, collapsible, summaryOnly, summaryRender, bodyExpandedByDefault, showTime, cardPlacement, defaultEnabled, sessionOverrides };
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
// src/client/ConfigCard.tsx
|
|
@@ -196,6 +200,7 @@ function ConfigCard(props) {
|
|
|
196
200
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-notify-config", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-notify-config-note", children: t("config.unavailable") }) });
|
|
197
201
|
}
|
|
198
202
|
const bodyMode = bodyModeOf(config);
|
|
203
|
+
const drawsCard = !(config.summaryOnly && config.summaryRender === "prose");
|
|
199
204
|
const write = (field, value) => {
|
|
200
205
|
enqueue([[field, value]]);
|
|
201
206
|
};
|
|
@@ -357,6 +362,23 @@ function ConfigCard(props) {
|
|
|
357
362
|
}
|
|
358
363
|
)
|
|
359
364
|
] }),
|
|
365
|
+
drawsCard ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-notify-config-row", children: [
|
|
366
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-notify-config-info", children: [
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-notify-config-label", children: t("config.showTime.label") }),
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-notify-config-hint", children: t("config.showTime.hint") })
|
|
369
|
+
] }),
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-notify-config-field", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
371
|
+
import_dsh_client_ui_primitives.Switch,
|
|
372
|
+
{
|
|
373
|
+
checked: config.showTime,
|
|
374
|
+
label: t("config.showTime.label"),
|
|
375
|
+
onChange: (next) => {
|
|
376
|
+
setConfig({ ...config, showTime: next });
|
|
377
|
+
write("showTime", next);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
) })
|
|
381
|
+
] }) : null,
|
|
360
382
|
error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-notify-config-error", role: "status", children: error })
|
|
361
383
|
] });
|
|
362
384
|
}
|
|
@@ -454,6 +476,8 @@ var en = {
|
|
|
454
476
|
"config.bodyMode.always": "Always expanded",
|
|
455
477
|
"config.bodyMode.collapsed": "Collapsed",
|
|
456
478
|
"config.bodyMode.expanded": "Expanded",
|
|
479
|
+
"config.showTime.label": "Show time",
|
|
480
|
+
"config.showTime.hint": "Shows when the update was sent at the right end of the title row; turn it off to keep just the dot and the title.",
|
|
457
481
|
"config.placement.label": "Card placement",
|
|
458
482
|
"config.placement.hint": "At the step-group boundary, tool calls between two updates fold into their own sub-folds; following the tool row, the card folds with the group.",
|
|
459
483
|
"config.placement.boundary": "Step-group boundary",
|
|
@@ -491,6 +515,8 @@ var zh = {
|
|
|
491
515
|
"config.bodyMode.always": "\u59CB\u7EC8\u5C55\u5F00",
|
|
492
516
|
"config.bodyMode.collapsed": "\u9ED8\u8BA4\u6536\u8D77",
|
|
493
517
|
"config.bodyMode.expanded": "\u9ED8\u8BA4\u5C55\u5F00",
|
|
518
|
+
"config.showTime.label": "\u663E\u793A\u65F6\u95F4",
|
|
519
|
+
"config.showTime.hint": "\u6807\u9898\u884C\u53F3\u4FA7\u663E\u793A\u8FD9\u6761\u6C47\u62A5\u7684\u65F6\u95F4\uFF1B\u5173\u6389\u540E\u6807\u9898\u884C\u53EA\u5269\u5706\u70B9\u4E0E\u6807\u9898\u3002",
|
|
494
520
|
"config.placement.label": "\u8FDB\u5EA6\u5361\u4F4D\u7F6E",
|
|
495
521
|
"config.placement.hint": "\u653E\u5728\u6B65\u9AA4\u7EC4\u8FB9\u754C\u65F6\uFF0C\u4E24\u6B21\u6C47\u62A5\u4E4B\u95F4\u7684\u5DE5\u5177\u8C03\u7528\u5404\u81EA\u6298\u6210\u4E00\u4E2A\u5B50\u6298\u53E0\uFF1B\u8DDF\u968F\u5DE5\u5177\u884C\u65F6\uFF0C\u5361\u7247\u968F\u5DE5\u5177\u884C\u4E00\u8D77\u6298\u8FDB\u7EC4\u91CC\u3002",
|
|
496
522
|
"config.placement.boundary": "\u6B65\u9AA4\u7EC4\u8FB9\u754C",
|
|
@@ -697,7 +723,7 @@ function NotifyCard({ data, form, openFile, t, seat }) {
|
|
|
697
723
|
const hasBody = !config.summaryOnly && data.message.trim().length > 0;
|
|
698
724
|
const collapsible = config.collapsible && hasBody;
|
|
699
725
|
const expanded = collapsible ? open ?? config.bodyExpandedByDefault : true;
|
|
700
|
-
const time = formatClock(data.time);
|
|
726
|
+
const time = config.showTime ? formatClock(data.time) : null;
|
|
701
727
|
const titleNode = data.settled ? title : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.TextShimmer, { active: true, children: title });
|
|
702
728
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
703
729
|
"div",
|