@dungsil/dsh-plugin-ui-vcs 0.4.0 → 0.4.1

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/dist/client.js +60 -45
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -23,6 +23,10 @@ var git_pull_request_draft_default = "<svg xmlns=\"http://www.w3.org/2000/svg\"
23
23
  var git_pull_request_closed_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"5\" cy=\"5\" r=\"2\"/>\n <circle cx=\"5\" cy=\"19\" r=\"2\"/>\n <circle cx=\"19\" cy=\"19\" r=\"2\"/>\n <path d=\"M5 7v10M19 17v-5M16 3l6 6m0-6-6 6\"/>\n</svg>\n";
24
24
  // ../../tools/ui/src/icons/git-merge.svg
25
25
  var git_merge_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"5\" cy=\"5\" r=\"2\"/>\n <circle cx=\"5\" cy=\"19\" r=\"2\"/>\n <circle cx=\"19\" cy=\"19\" r=\"2\"/>\n <path d=\"M5 7v10M5 7a12 12 0 0 0 12 12\"/>\n</svg>\n";
26
+ // ../../tools/ui/src/icons/circle-x.svg
27
+ var circle_x_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"/>\n <path d=\"m9 9 6 6m0-6-6 6\"/>\n</svg>\n";
28
+ // ../../tools/ui/src/icons/circle-minus.svg
29
+ var circle_minus_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"/>\n <path d=\"M9 12h6\"/>\n</svg>\n";
26
30
  // ../../tools/ui/src/client.ts
27
31
  function useLocaleSnapshot(locale) {
28
32
  const subscribe = (0, react.useCallback)((listener) => locale.subscribe(listener), [locale]);
@@ -57,6 +61,37 @@ function SettingsRow({ label, children }) {
57
61
  }), children]
58
62
  });
59
63
  }
64
+ // ../../tools/ui/src/button-picker.tsx
65
+ function ButtonPicker({ label, value, items, onChange, disabled = false, menuClassName, compact, ...buttonProps }) {
66
+ const [open, setOpen] = (0, react.useState)(false);
67
+ (0, react.useEffect)(() => {
68
+ if (disabled) setOpen(false);
69
+ }, [disabled]);
70
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
71
+ open: open && !disabled,
72
+ portal: true,
73
+ compact,
74
+ className: menuClassName,
75
+ selectedId: value,
76
+ items,
77
+ onClose: () => setOpen(false),
78
+ onSelect: (id) => {
79
+ setOpen(false);
80
+ const item = items.find((item) => item.id === id && !item.disabled);
81
+ if (!disabled && item) onChange(item.id);
82
+ },
83
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
84
+ ...buttonProps,
85
+ type: "button",
86
+ "aria-label": label,
87
+ "aria-haspopup": "menu",
88
+ "aria-expanded": open && !disabled,
89
+ disabled,
90
+ onClick: () => setOpen((current) => !current),
91
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: items.find((item) => item.id === value)?.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { "aria-hidden": "true" })]
92
+ })
93
+ });
94
+ }
60
95
  // locale/en.json
61
96
  var en_default = {
62
97
  meta: {
@@ -13235,8 +13270,15 @@ const styles = `
13235
13270
  .dsh-pr-loading{display:inline-flex;flex-shrink:0;width:16px;height:16px;vertical-align:middle;color:var(--dsw-alias-label-secondary)}
13236
13271
  .dsh-pr-loading svg{width:100%;height:100%;animation:dsh-pr-spin .8s linear infinite}
13237
13272
  .dsh-pr-initial-loading{display:flex;justify-content:center;padding:24px 16px}
13273
+ .dsh-vcs-check-status{display:inline-flex;flex:none;width:14px;height:14px;align-items:center;justify-content:center;vertical-align:middle;color:var(--dsw-alias-label-tertiary)}
13274
+ .dsh-vcs-check-status>span{display:contents}
13275
+ .dsh-vcs-check-status svg{width:100%;height:100%}
13276
+ .dsh-vcs-check-status[data-state=done]{color:var(--dsw-alias-state-success-primary)}
13277
+ .dsh-vcs-check-status[data-state=error]{color:var(--dsw-alias-state-error-primary)}
13278
+ .dsh-vcs-check-status:is([data-state=ongoing],[data-state=warning]){color:var(--dsw-alias-state-warn-primary)}
13279
+ .dsh-vcs-check-status[data-state=ongoing] svg{animation:dsh-pr-spin 1.5s linear infinite}
13238
13280
  @keyframes dsh-pr-spin{to{transform:rotate(360deg)}}
13239
- @media(prefers-reduced-motion:reduce){.dsh-pr-loading svg{animation:none}}
13281
+ @media(prefers-reduced-motion:reduce){.dsh-pr-loading svg,.dsh-vcs-check-status[data-state=ongoing] svg{animation:none}}
13240
13282
  .dsh-pr-panel :is(a,textarea,summary,[role=tabpanel]):focus-visible{outline:2px solid var(--dsw-focus-ring-color);outline-offset:-2px}
13241
13283
  .dsh-pr-content{overflow:auto;flex:1;min-height:0}
13242
13284
  .dsh-pr-content>p{padding:20px 16px;color:var(--dsw-alias-label-secondary);line-height:1.6}
@@ -13356,6 +13398,7 @@ function bindPullRequestLinks(root, open) {
13356
13398
  }
13357
13399
  // src/pull-requests-client.tsx
13358
13400
  var pull_requests_client_exports = /* @__PURE__ */ __exportAll({
13401
+ CheckStatusIcon: () => CheckStatusIcon,
13359
13402
  apply: () => apply$2,
13360
13403
  checksState: () => checksState,
13361
13404
  inject: () => inject$1,
@@ -13398,6 +13441,14 @@ function checksState(item) {
13398
13441
  ].includes(state))) return "ongoing";
13399
13442
  return states.every((state) => ["success", "passed"].includes(state)) ? "done" : "idle";
13400
13443
  }
13444
+ function CheckStatusIcon({ state }) {
13445
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
13446
+ className: "dsh-vcs-check-status",
13447
+ "data-state": state,
13448
+ "aria-hidden": "true",
13449
+ children: state === "done" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckCircleOutlineRegular, {}) : state === "ongoing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconLoadingOutlineRegular, {}) : state === "warning" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQuestionOutlineRegular, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { dangerouslySetInnerHTML: { __html: state === "error" ? circle_x_default : circle_minus_default } })
13450
+ });
13451
+ }
13401
13452
  function Loading({ label }) {
13402
13453
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
13403
13454
  className: "dsh-pr-loading",
@@ -13430,37 +13481,6 @@ function Description({ text, labels }) {
13430
13481
  variant: "compact"
13431
13482
  }), render(sections)] });
13432
13483
  }
13433
- function Choice({ label, value, items, onChange, disabled }) {
13434
- const [open, setOpen] = (0, react.useState)(false);
13435
- (0, react.useEffect)(() => {
13436
- if (disabled) setOpen(false);
13437
- }, [disabled]);
13438
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
13439
- open,
13440
- portal: true,
13441
- compact: true,
13442
- className: "dsh-pr-choice",
13443
- selectedId: value,
13444
- items,
13445
- onClose: () => setOpen(false),
13446
- onSelect: (id) => {
13447
- const item = items.find((item) => item.id === id && !item.disabled);
13448
- if (item) onChange(item.id);
13449
- setOpen(false);
13450
- },
13451
- anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
13452
- type: "button",
13453
- size: "sm",
13454
- className: "dsh-pr-picker",
13455
- "aria-label": label,
13456
- "aria-haspopup": "menu",
13457
- "aria-expanded": open,
13458
- disabled,
13459
- onClick: () => setOpen(!open),
13460
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: items.find((item) => item.id === value)?.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { "aria-hidden": "true" })]
13461
- })
13462
- });
13463
- }
13464
13484
  function apply$2(ctx) {
13465
13485
  const connection = ctx.get("connection");
13466
13486
  const sessions = ctx.get("sessions");
@@ -13910,10 +13930,7 @@ function apply$2(ctx) {
13910
13930
  onClick: () => setChecksOpen(!checksOpen),
13911
13931
  "aria-busy": loading,
13912
13932
  children: [
13913
- loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Loading, { label: copy.loading }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
13914
- state,
13915
- appearance: "step"
13916
- }),
13933
+ loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Loading, { label: copy.loading }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckStatusIcon, { state }),
13917
13934
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.headSha ? checksSummary : copy.checks }),
13918
13935
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { "aria-hidden": "true" })
13919
13936
  ]
@@ -13929,10 +13946,7 @@ function apply$2(ctx) {
13929
13946
  className: "dsh-pr-checks",
13930
13947
  children: item.checks.map((check, index) => {
13931
13948
  const status = checkStatus(check.status);
13932
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
13933
- state: status.state,
13934
- appearance: "step"
13935
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
13949
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckStatusIcon, { state: status.state }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
13936
13950
  className: "dsh-pr-check-name",
13937
13951
  children: [check.url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
13938
13952
  href: check.url,
@@ -14090,7 +14104,11 @@ function apply$2(ctx) {
14090
14104
  })] }),
14091
14105
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14092
14106
  className: "dsh-pr-actions",
14093
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Choice, {
14107
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonPicker, {
14108
+ size: "sm",
14109
+ className: "dsh-pr-picker",
14110
+ menuClassName: "dsh-pr-choice",
14111
+ compact: true,
14094
14112
  label: copy.review,
14095
14113
  value: reviewAction,
14096
14114
  disabled: pending,
@@ -14823,10 +14841,7 @@ function apply(ctx) {
14823
14841
  className: "dsh-vcs-trigger",
14824
14842
  title: `${labels.checks}: ${ciLabel}`,
14825
14843
  onClick: () => ctx.sidebarRight.openTab("dungsil-vcs-pull-requests", { params: { section: "checks" } }),
14826
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
14827
- state: ciState,
14828
- appearance: "step"
14829
- }), `${labels.checks}: ${ciLabel}`]
14844
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckStatusIcon, { state: ciState }), `${labels.checks}: ${ciLabel}`]
14830
14845
  })]
14831
14846
  });
14832
14847
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dungsil/dsh-plugin-ui-vcs",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Git actions and PR/MR review for GitHub, GitLab, Gitea and Forgejo.",
5
5
  "license": "MIT",
6
6
  "repository": {