@dungsil/dsh-plugin-ui-setting-skills 0.3.0 → 0.3.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 +23 -16
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -267,9 +267,8 @@ function SkillsSettings({ ctx }) {
267
267
  const [error, setError] = (0, react.useState)(false);
268
268
  const [saveError, setSaveError] = (0, react.useState)(false);
269
269
  const [busy, setBusy] = (0, react.useState)(false);
270
- const [opening, setOpening] = (0, react.useState)();
271
- const [openError, setOpenError] = (0, react.useState)();
272
- const openingPending = (0, react.useRef)(false);
270
+ const [folderStatus, setFolderStatus] = (0, react.useState)({});
271
+ const openingPending = (0, react.useRef)(/* @__PURE__ */ new Set());
273
272
  const pending = (0, react.useRef)(false);
274
273
  const mounted = (0, react.useRef)(false);
275
274
  const [expanded, setExpanded] = (0, react.useState)({});
@@ -323,17 +322,25 @@ function SkillsSettings({ ctx }) {
323
322
  }
324
323
  }
325
324
  async function openFolder(path) {
326
- if (openingPending.current) return;
327
- openingPending.current = true;
328
- setOpening(path);
329
- setOpenError(void 0);
325
+ if (openingPending.current.has(path)) return;
326
+ openingPending.current.add(path);
327
+ setFolderStatus((current) => ({
328
+ ...current,
329
+ [path]: "opening"
330
+ }));
330
331
  try {
331
332
  if (!(await connection.rpc.call("/api", "dungsil-ui-setting-skills/open-folder", { path })).ok) throw new Error("Could not open skill folder");
333
+ if (mounted.current) setFolderStatus((current) => ({
334
+ ...current,
335
+ [path]: void 0
336
+ }));
332
337
  } catch {
333
- if (mounted.current) setOpenError(path);
338
+ if (mounted.current) setFolderStatus((current) => ({
339
+ ...current,
340
+ [path]: "error"
341
+ }));
334
342
  } finally {
335
- openingPending.current = false;
336
- if (mounted.current) setOpening(void 0);
343
+ openingPending.current.delete(path);
337
344
  }
338
345
  }
339
346
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
@@ -441,19 +448,19 @@ function SkillsSettings({ ctx }) {
441
448
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
442
449
  className: "dsh-skills-actions",
443
450
  children: [skill.path && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
444
- label: opening === skill.path ? text.openingFolder : text.openFolder,
451
+ label: folderStatus[skill.path] === "opening" ? text.openingFolder : text.openFolder,
445
452
  side: "top",
446
453
  portal: true,
447
454
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
448
455
  className: "dsh-skills-folder",
449
456
  variant: "ghost",
450
457
  size: "sm",
451
- "aria-label": `${opening === skill.path ? text.openingFolder : text.openFolder}: ${skill.name}`,
452
- "aria-busy": opening === skill.path,
453
- disabled: !view.folderOpenAvailable || opening !== void 0,
458
+ "aria-label": `${folderStatus[skill.path] === "opening" ? text.openingFolder : text.openFolder}: ${skill.name}`,
459
+ "aria-busy": folderStatus[skill.path] === "opening",
460
+ disabled: !view.folderOpenAvailable || folderStatus[skill.path] === "opening",
454
461
  "aria-description": view.folderOpenAvailable ? text.openFolderHint : text.openFolderUnavailable,
455
462
  onClick: () => void openFolder(skill.path),
456
- icon: opening === skill.path ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconLoadingOutlineRegular, {
463
+ icon: folderStatus[skill.path] === "opening" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconLoadingOutlineRegular, {
457
464
  size: 16,
458
465
  "aria-hidden": "true"
459
466
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenOutlineRegular, {
@@ -468,7 +475,7 @@ function SkillsSettings({ ctx }) {
468
475
  onChange: (enabled) => void save(skill.name, !enabled)
469
476
  })]
470
477
  }),
471
- skill.path && openError === skill.path && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
478
+ skill.path && folderStatus[skill.path] === "error" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
472
479
  className: "dsh-skills-open-error",
473
480
  role: "alert",
474
481
  children: text.openFolderError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dungsil/dsh-plugin-ui-setting-skills",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "View loaded user skills in DeepSeek Harness settings.",
5
5
  "license": "MIT",
6
6
  "repository": {