@morehao/dsh-github-trending 0.8.14 → 0.8.15

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 (2) hide show
  1. package/client.js +73 -26
  2. package/package.json +2 -2
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;
@@ -5927,26 +5974,25 @@ function IdentityBar(props) {
5927
5974
  const [confirming, setConfirming] = import_react.default.useState(false);
5928
5975
  const [updateState, controller] = usePluginUpdate();
5929
5976
  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
5977
  const latestVersion = view === null ? "" : view.latestVersion ?? "";
5934
- const updateAvailable = view !== null && view.updateAvailable;
5935
- const actionable = updateAvailable && view !== null && view.canApply && !busy && !settled;
5936
5978
  const currentVersion = view === null ? plugin.version : view.currentVersion ?? plugin.version;
5979
+ const ui = deriveUpdateUiState(updateState);
5980
+ const label = updateStatusLabel(updateState);
5981
+ const busy = ui.busy;
5982
+ const actionable = ui.actionable;
5937
5983
  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();
5984
+ if (!actionable) setConfirming(false);
5985
+ }, [actionable]);
5986
+ const LABEL_COPY = {
5987
+ checking: t("shell.update.checking"),
5988
+ applying: t("shell.update.applying", { version: label.params.version ?? "" }),
5989
+ available: t("shell.update.available", { latest: label.params.latest ?? "" }),
5990
+ latest: t("shell.update.latest", { version: label.params.version ?? "" }),
5991
+ done: t("shell.update.done", { version: label.params.version ?? "" }),
5992
+ checkFailed: t("shell.update.checkFailed"),
5993
+ failed: t("shell.update.failed")
5994
+ };
5995
+ const st = { state: ui.visual, tip: LABEL_COPY[label.key] ?? t("shell.update.latest", { version: currentVersion }) };
5950
5996
  function onRefreshClick() {
5951
5997
  if (busy) return;
5952
5998
  if (actionable) {
@@ -5960,7 +6006,7 @@ function IdentityBar(props) {
5960
6006
  writePendingUpdate(currentVersion, latestVersion);
5961
6007
  void controller.apply();
5962
6008
  }
5963
- const showBadge = Boolean(updateAvailable && view?.canApply && !busy && !settled);
6009
+ const showBadge = ui.showBadge;
5964
6010
  const confirmOpen = confirming && actionable;
5965
6011
  return h(
5966
6012
  "div",
@@ -5973,13 +6019,10 @@ function IdentityBar(props) {
5973
6019
  { type: "button", className: "dshgt-id-pkg dshgt-mono", title: t("about.title"), onClick: () => props.onOpenAbout() },
5974
6020
  plugin.name
5975
6021
  ),
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
- ],
6022
+ // 更新入口:版本徽标 + 纯图标刷新,放在 GitHub 图标左侧、与之一组右对齐。
5980
6023
  h(
5981
6024
  "div",
5982
- { className: "dshgt-idbar-right" },
6025
+ { className: "dshgt-idbar-actions" },
5983
6026
  h(
5984
6027
  "div",
5985
6028
  { className: "dshgt-upd-unit" },
@@ -5998,7 +6041,7 @@ function IdentityBar(props) {
5998
6041
  "button",
5999
6042
  {
6000
6043
  type: "button",
6001
- className: "dshgt-id-gh dshgt-refresh",
6044
+ className: "dshgt-refresh",
6002
6045
  "data-state": st.state,
6003
6046
  disabled: busy,
6004
6047
  title: st.tip,
@@ -6009,6 +6052,10 @@ function IdentityBar(props) {
6009
6052
  refreshIcon()
6010
6053
  )
6011
6054
  ),
6055
+ plugin.repository === void 0 ? null : [
6056
+ h("span", { key: "gh-sep", className: "dshgt-id-sep dshgt-id-sep-gh" }),
6057
+ 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())
6058
+ ],
6012
6059
  confirmOpen ? h(
6013
6060
  "div",
6014
6061
  { className: "dshgt-confirm-pop", role: "dialog", "aria-label": t("shell.update.confirmHint") },
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.15",
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": {