@huaqiu/dsh-tool-plugin-update 0.6.12 → 0.6.13

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 CHANGED
@@ -618,6 +618,7 @@ window.__ModuleLoader__.load({
618
618
  checkFailed: "检查更新失败,请重试",
619
619
  installAll: (count) => `安装整套更新(${count} 项)`,
620
620
  installOne: "安装整套",
621
+ installOnePlugin: "安装此插件",
621
622
  installOneTip: "将安装整套 N 项更新并自动重启 DSH,而不仅是此插件",
622
623
  installing: "正在安装…(DSH 将自动重启)",
623
624
  retry: "重试",
@@ -770,7 +771,7 @@ window.__ModuleLoader__.load({
770
771
  changelogTitle: "更新内容:",
771
772
  footerCount: (n) => `准备安装 ${n} 项兼容插件`,
772
773
  footerSet: (v) => `版本集: v${v}`,
773
- installAllSet: (v) => `一键更新全套插件 (v${v})`,
774
+ installAllSet: (v) => `更新插件集 (v${v})`,
774
775
  ignoreBtn: "忽略",
775
776
  footnote: "更新将自动应用并重启 DSH 视图,不影响 EDA 图纸数据"
776
777
  }
@@ -797,6 +798,7 @@ window.__ModuleLoader__.load({
797
798
  checkFailed: "Failed to check for updates — please retry",
798
799
  installAll: (count) => `Install whole set (${count})`,
799
800
  installOne: "Install set",
801
+ installOnePlugin: "Install this plugin",
800
802
  installOneTip: "Installs the whole set of N updates and restarts DSH — not just this plugin",
801
803
  installing: "Installing… (DSH will restart)",
802
804
  retry: "Retry",
@@ -1062,13 +1064,30 @@ window.__ModuleLoader__.load({
1062
1064
  return src.replace(/^@/, "").slice(0, 2).toUpperCase();
1063
1065
  }
1064
1066
  /** Shared per-card changelog toggle drawer (the per-plugin changes[] list). */
1065
- function changelogDrawer(item, copy, open) {
1067
+ function changelogDrawer(item, copy, open, onInstall, onIgnore) {
1066
1068
  const drawer = el("div", "hqpu-changelog-drawer");
1067
1069
  drawer.style.display = open ? "" : "none";
1068
1070
  drawer.append(el("div", "hqpu-changelog-drawer-title", copy.ui.changelogTitle));
1069
1071
  const ul = el("ul");
1070
1072
  for (const change of item.changes ?? []) if (typeof change === "string" && change.length > 0) ul.append(el("li", "", change));
1071
- drawer.append(ul);
1073
+ if (ul.childElementCount > 0) drawer.append(ul);
1074
+ const actions = el("div", "hqpu-changelog-actions");
1075
+ if (item.state === "update" || item.state === "install") {
1076
+ const install = el("button", "hqpu-card-action hqpu-card-action--install", copy.installOnePlugin);
1077
+ install.type = "button";
1078
+ install.title = copy.installOneTip;
1079
+ install.addEventListener("click", onInstall);
1080
+ const ignore = el("button", "hqpu-card-action", copy.ignore);
1081
+ ignore.type = "button";
1082
+ ignore.addEventListener("click", onIgnore);
1083
+ actions.append(install, ignore);
1084
+ } else if (item.state === "ignored") {
1085
+ const show = el("button", "hqpu-card-action hqpu-card-action--install", copy.unignore);
1086
+ show.type = "button";
1087
+ show.addEventListener("click", onIgnore);
1088
+ actions.append(show);
1089
+ }
1090
+ if (actions.childElementCount > 0) drawer.append(actions);
1072
1091
  return drawer;
1073
1092
  }
1074
1093
  /** One package card per the mockup: avatar initials, display name + package
@@ -1096,22 +1115,8 @@ window.__ModuleLoader__.load({
1096
1115
  main.append(ver);
1097
1116
  left.append(avatar, main);
1098
1117
  const right = el("div", "hqpu-card-end");
1099
- if (item.state === "update" || item.state === "install") {
1100
- const install = el("button", "hqpu-log-toggle", copy.installOne);
1101
- install.type = "button";
1102
- install.title = copy.installOneTip;
1103
- install.addEventListener("click", onInstall);
1104
- const ignore = el("button", "hqpu-log-toggle", copy.ignore);
1105
- ignore.type = "button";
1106
- ignore.addEventListener("click", onIgnore);
1107
- right.append(install, ignore);
1108
- } else if (item.state === "ignored") {
1109
- const show = el("button", "hqpu-log-toggle", copy.unignore);
1110
- show.type = "button";
1111
- show.addEventListener("click", onIgnore);
1112
- right.append(show);
1113
- }
1114
- if (Array.isArray(item.changes) && item.changes.length > 0) {
1118
+ const hasDetails = Array.isArray(item.changes) && item.changes.length > 0 || item.state === "update" || item.state === "install" || item.state === "ignored";
1119
+ if (hasDetails) {
1115
1120
  const toggle = el("button", "hqpu-log-toggle");
1116
1121
  toggle.type = "button";
1117
1122
  toggle.dataset.open = open ? "true" : "false";
@@ -1121,7 +1126,7 @@ window.__ModuleLoader__.load({
1121
1126
  }
1122
1127
  head.append(left, right);
1123
1128
  card.append(head);
1124
- if (Array.isArray(item.changes) && item.changes.length > 0) card.append(changelogDrawer(item, copy, open));
1129
+ if (hasDetails) card.append(changelogDrawer(item, copy, open, onInstall, onIgnore));
1125
1130
  return card;
1126
1131
  }
1127
1132
  /** A section: head (title + count pill + expand-all toggle) then its cards. */
@@ -3414,6 +3419,7 @@ window.__ModuleLoader__.load({
3414
3419
  align-items: start;
3415
3420
  }
3416
3421
  .hqpu-card {
3422
+ position: relative;
3417
3423
  margin: 0;
3418
3424
  padding: 10px;
3419
3425
  border-radius: 8px;
@@ -3479,6 +3485,30 @@ window.__ModuleLoader__.load({
3479
3485
  .hqpu-log-toggle:hover { color: var(--hq-text); }
3480
3486
  .hqpu-log-toggle svg { width: 12px; height: 12px; transition: transform 0.15s ease; }
3481
3487
  .hqpu-log-toggle[data-open='true'] svg { transform: rotate(180deg); }
3488
+ .hqpu-changelog-actions {
3489
+ display: flex;
3490
+ gap: 8px;
3491
+ margin-top: 10px;
3492
+ padding-top: 8px;
3493
+ border-top: 0.5px solid var(--hq-border);
3494
+ }
3495
+ .hqpu-card-action {
3496
+ height: 28px;
3497
+ padding: 0 10px;
3498
+ border: 0.5px solid var(--hq-border-strong);
3499
+ border-radius: 6px;
3500
+ background: var(--hq-card);
3501
+ color: var(--hq-text);
3502
+ font-size: 10px;
3503
+ cursor: pointer;
3504
+ }
3505
+ .hqpu-card-action:hover { border-color: var(--hq-brand-soft); color: var(--hq-brand-soft); }
3506
+ .hqpu-card-action--install {
3507
+ border-color: var(--hq-brand);
3508
+ background: var(--hq-brand);
3509
+ color: var(--hq-brand-fg);
3510
+ }
3511
+ .hqpu-card-action--install:hover { border-color: var(--hq-brand-soft); background: var(--hq-brand-soft); color: var(--hq-brand-fg); }
3482
3512
  .hqpu-changelog-drawer {
3483
3513
  margin-top: 8px;
3484
3514
  padding: 8px;