@morehao/dsh-github-trending 0.8.14 → 0.8.16

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.js +89 -26
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.8.16] - 2026-11-03
4
+
5
+ ### Fixes
6
+
7
+ - **update**: surface restart notice right after in-panel update (#109)
8
+
9
+ **Full Changelog**: https://github.com/morehao/dsh-github-trending/compare/v0.8.15...v0.8.16
10
+
3
11
  ## [v0.8.12] - 2026-11-02
4
12
 
5
13
  ### Refactors
package/client.js CHANGED
@@ -1358,8 +1358,14 @@ var CSS = `
1358
1358
  transition:background .12s ease,border-color .12s ease;}
1359
1359
  .dshgt-ver-badge:hover{background:color-mix(in srgb,var(--gt-warn) 12%,transparent);border-color:color-mix(in srgb,var(--gt-warn) 60%,transparent);}
1360
1360
  .dshgt-ver-badge:focus-visible{outline:2px solid var(--gt-accent);outline-offset:1px;}
1361
- /* 纯图标刷新:状态靠图标颜色 + 角标 + 旋转表达,文案走 title(tooltip) */
1362
- .dshgt-refresh{position:relative;}
1361
+ /* 纯图标刷新:与 dsh-skills-console 的 .dshsc-tool 逐项一致(尺寸/圆角/无边框/hover 层2底),
1362
+ 状态另由图标颜色 + 角标 + 旋转表达,文案走 title(tooltip)。独立成类,不再继承 .dshgt-id-gh。 */
1363
+ .dshgt-refresh{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;
1364
+ width:26px;height:26px;padding:0;border:0;border-radius:7px;background:transparent;color:var(--gt-muted);
1365
+ cursor:pointer;text-decoration:none;transition:background .12s ease,color .12s ease;flex:none;}
1366
+ .dshgt-refresh:hover{background:var(--dsw-alias-bg-layer-2);color:var(--gt-fg);}
1367
+ .dshgt-refresh:focus-visible{outline:2px solid var(--gt-accent);outline-offset:1px;}
1368
+ .dshgt-refresh[aria-expanded="true"]{background:var(--dsw-alias-bg-layer-2);color:var(--gt-fg);}
1363
1369
  .dshgt-refresh svg{display:block;transition:color .12s ease;}
1364
1370
  .dshgt-refresh[data-state="available"]{color:var(--gt-warn);}
1365
1371
  .dshgt-refresh[data-state="available"]::after{content:"";position:absolute;top:3px;right:3px;width:6px;height:6px;border-radius:50%;background:var(--gt-warn);box-shadow:0 0 0 1.5px var(--gt-bg);}
@@ -5686,6 +5692,47 @@ function AboutDialog(props) {
5686
5692
 
5687
5693
  // node_modules/@morehao/dsh-plugin-kit/dist/update-client.js
5688
5694
  var IDLE = { status: "idle", view: null, error: null };
5695
+ function deriveUpdateUiState(state) {
5696
+ const { status, view } = state;
5697
+ const busy = status === "checking" || status === "applying";
5698
+ const settled = status === "restart-required" || status === "applied";
5699
+ const updateAvailable = view !== null && view.updateAvailable;
5700
+ const canApply = view !== null && view.canApply;
5701
+ const latestVersion = view === null ? null : view.latestVersion ?? null;
5702
+ let visual;
5703
+ if (busy) visual = "checking";
5704
+ else if (settled) visual = "ok-flash";
5705
+ else if (status === "failed" || view !== null && view.checkFailed) visual = "error";
5706
+ else if (updateAvailable) visual = "available";
5707
+ else visual = "latest";
5708
+ const actionable = updateAvailable && canApply && !busy && !settled;
5709
+ const showBadge = visual === "available" && !busy && !settled && canApply && latestVersion !== null;
5710
+ return {
5711
+ visual,
5712
+ busy,
5713
+ settled,
5714
+ actionable,
5715
+ showBadge,
5716
+ badgeVersion: showBadge ? latestVersion : null,
5717
+ canApply
5718
+ };
5719
+ }
5720
+ function updateStatusLabel(state) {
5721
+ const { status, view } = state;
5722
+ const latest = view?.latestVersion ?? "";
5723
+ const current = view?.currentVersion ?? "";
5724
+ if (status === "checking" || view === null || status === "idle") {
5725
+ return { key: "checking", params: {} };
5726
+ }
5727
+ if (status === "applying") return { key: "applying", params: { version: latest } };
5728
+ if (status === "restart-required" || status === "applied") return { key: "done", params: { version: latest } };
5729
+ if (status === "failed") {
5730
+ return state.error?.code === "CHECK_FAILED" ? { key: "checkFailed", params: {} } : { key: "failed", params: {} };
5731
+ }
5732
+ if (view.checkFailed) return { key: "checkFailed", params: {} };
5733
+ if (view.updateAvailable) return { key: "available", params: { latest } };
5734
+ return { key: "latest", params: { version: current } };
5735
+ }
5689
5736
  function errorOf(error) {
5690
5737
  if (error !== null && typeof error === "object") {
5691
5738
  const value = error;
@@ -5791,6 +5838,17 @@ function usePluginUpdate() {
5791
5838
  }, [controller]);
5792
5839
  return [state, controller];
5793
5840
  }
5841
+ function isUpdateSettled(state) {
5842
+ return state.status === "applied" || state.status === "restart-required";
5843
+ }
5844
+ function deriveSettledNotice(state, stored, now = Date.now()) {
5845
+ if (!isUpdateSettled(state)) return null;
5846
+ if (stored !== null) return stored;
5847
+ const from = state.view?.currentVersion ?? "";
5848
+ const to = state.view?.latestVersion ?? from;
5849
+ if (to === "") return null;
5850
+ return { from, to, at: now };
5851
+ }
5794
5852
 
5795
5853
  // node_modules/@morehao/dsh-plugin-kit/dist/update-restore.js
5796
5854
  var PENDING_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -5927,26 +5985,25 @@ function IdentityBar(props) {
5927
5985
  const [confirming, setConfirming] = import_react.default.useState(false);
5928
5986
  const [updateState, controller] = usePluginUpdate();
5929
5987
  const view = updateState.view;
5930
- const status = updateState.status;
5931
- const busy = status === "checking" || status === "applying";
5932
- const settled = status === "restart-required" || status === "applied";
5933
5988
  const latestVersion = view === null ? "" : view.latestVersion ?? "";
5934
- const updateAvailable = view !== null && view.updateAvailable;
5935
- const actionable = updateAvailable && view !== null && view.canApply && !busy && !settled;
5936
5989
  const currentVersion = view === null ? plugin.version : view.currentVersion ?? plugin.version;
5990
+ const ui = deriveUpdateUiState(updateState);
5991
+ const label = updateStatusLabel(updateState);
5992
+ const busy = ui.busy;
5993
+ const actionable = ui.actionable;
5937
5994
  import_react.default.useEffect(() => {
5938
- if (!updateAvailable || busy || settled) setConfirming(false);
5939
- }, [updateAvailable, busy, settled]);
5940
- function stateAndTip() {
5941
- if (status === "checking" || view === null) return { state: "checking", tip: t("shell.update.checking") };
5942
- if (status === "applying") return { state: "checking", tip: t("shell.update.applying", { version: latestVersion }) };
5943
- if (status === "restart-required" || status === "applied") return { state: "ok-flash", tip: t("shell.update.done", { version: latestVersion }) };
5944
- if (status === "failed") return { state: "error", tip: updateState.error?.code === "CHECK_FAILED" ? t("shell.update.checkFailed") : t("shell.update.failed") };
5945
- if (view.checkFailed) return { state: "error", tip: t("shell.update.checkFailed") };
5946
- if (view.updateAvailable) return { state: "available", tip: t("shell.update.available", { latest: latestVersion }) };
5947
- return { state: "latest", tip: t("shell.update.latest", { version: currentVersion }) };
5948
- }
5949
- const st = stateAndTip();
5995
+ if (!actionable) setConfirming(false);
5996
+ }, [actionable]);
5997
+ const LABEL_COPY = {
5998
+ checking: t("shell.update.checking"),
5999
+ applying: t("shell.update.applying", { version: label.params.version ?? "" }),
6000
+ available: t("shell.update.available", { latest: label.params.latest ?? "" }),
6001
+ latest: t("shell.update.latest", { version: label.params.version ?? "" }),
6002
+ done: t("shell.update.done", { version: label.params.version ?? "" }),
6003
+ checkFailed: t("shell.update.checkFailed"),
6004
+ failed: t("shell.update.failed")
6005
+ };
6006
+ const st = { state: ui.visual, tip: LABEL_COPY[label.key] ?? t("shell.update.latest", { version: currentVersion }) };
5950
6007
  function onRefreshClick() {
5951
6008
  if (busy) return;
5952
6009
  if (actionable) {
@@ -5960,7 +6017,7 @@ function IdentityBar(props) {
5960
6017
  writePendingUpdate(currentVersion, latestVersion);
5961
6018
  void controller.apply();
5962
6019
  }
5963
- const showBadge = Boolean(updateAvailable && view?.canApply && !busy && !settled);
6020
+ const showBadge = ui.showBadge;
5964
6021
  const confirmOpen = confirming && actionable;
5965
6022
  return h(
5966
6023
  "div",
@@ -5973,13 +6030,10 @@ function IdentityBar(props) {
5973
6030
  { type: "button", className: "dshgt-id-pkg dshgt-mono", title: t("about.title"), onClick: () => props.onOpenAbout() },
5974
6031
  plugin.name
5975
6032
  ),
5976
- plugin.repository === void 0 ? null : [
5977
- h("span", { key: "gh-sep", className: "dshgt-id-sep dshgt-id-sep-gh" }),
5978
- h("a", { key: "gh", className: "dshgt-id-gh", href: plugin.repository, target: "_blank", rel: "noreferrer", title: t("about.repo"), "aria-label": t("about.repo") }, githubIcon())
5979
- ],
6033
+ // 更新入口:版本徽标 + 纯图标刷新,放在 GitHub 图标左侧、与之一组右对齐。
5980
6034
  h(
5981
6035
  "div",
5982
- { className: "dshgt-idbar-right" },
6036
+ { className: "dshgt-idbar-actions" },
5983
6037
  h(
5984
6038
  "div",
5985
6039
  { className: "dshgt-upd-unit" },
@@ -5998,7 +6052,7 @@ function IdentityBar(props) {
5998
6052
  "button",
5999
6053
  {
6000
6054
  type: "button",
6001
- className: "dshgt-id-gh dshgt-refresh",
6055
+ className: "dshgt-refresh",
6002
6056
  "data-state": st.state,
6003
6057
  disabled: busy,
6004
6058
  title: st.tip,
@@ -6009,6 +6063,10 @@ function IdentityBar(props) {
6009
6063
  refreshIcon()
6010
6064
  )
6011
6065
  ),
6066
+ plugin.repository === void 0 ? null : [
6067
+ h("span", { key: "gh-sep", className: "dshgt-id-sep dshgt-id-sep-gh" }),
6068
+ h("a", { key: "gh", className: "dshgt-id-gh", href: plugin.repository, target: "_blank", rel: "noreferrer", title: t("about.repo"), "aria-label": t("about.repo") }, githubIcon())
6069
+ ],
6012
6070
  confirmOpen ? h(
6013
6071
  "div",
6014
6072
  { className: "dshgt-confirm-pop", role: "dialog", "aria-label": t("shell.update.confirmHint") },
@@ -6233,6 +6291,11 @@ function apply(ctx) {
6233
6291
  import_react.default.useEffect(() => {
6234
6292
  setPendingUpdate(readPendingUpdate());
6235
6293
  }, []);
6294
+ const [updateState] = usePluginUpdate();
6295
+ import_react.default.useEffect(() => {
6296
+ if (!isUpdateSettled(updateState)) return;
6297
+ setPendingUpdate((current) => current ?? deriveSettledNotice(updateState, readPendingUpdate()));
6298
+ }, [updateState]);
6236
6299
  const openDigest = import_react.default.useCallback((target) => {
6237
6300
  if (target !== void 0) setDigestTarget(target);
6238
6301
  setView("digest");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morehao/dsh-github-trending",
3
- "version": "0.8.14",
3
+ "version": "0.8.16",
4
4
  "description": "GitHub 趋势日报的 DeepSeek Harness 插件:按日 / 周 / 月周期定时 spawn 本地 trendradar 核心,抓取 Trending、生成中文简介与周期总结,并可选把订阅仓库的新 Release 合成中文摘要,一起提交到你的仓库、自动开 PR 合并;内置概览 / 榜单 / 运行记录 / 订阅 / 设置工作台。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -51,7 +51,7 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@morehao/dsh-plugin-kit": "^0.4.0",
54
+ "@morehao/dsh-plugin-kit": "^0.4.1",
55
55
  "@morehao/trendradar-contract": "0.5.0"
56
56
  },
57
57
  "dsh": {