@norman-else/dsh-claude 0.1.10 → 0.1.11

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
@@ -3,7 +3,7 @@ window.__ModuleLoader__.load({
3
3
  factory: (require) => {
4
4
  var module = { exports: {} };
5
5
  module.exports;
6
- var { useCallback, useEffect, useMemo, useState } = require("react");
6
+ var { useCallback, useEffect, useId, useMemo, useRef, useState } = require("react");
7
7
  var { Fragment, jsx, jsxs } = require("react/jsx-runtime");
8
8
  var { DisclosureRow, IconApiOutline14, IconThinkOutline14, StateDot } = require("@deepseek-ai/dsh-client-ui-primitives");
9
9
  /** Claude's subagent dispatch tools; rendered as plugin-owned group cards
@@ -310,6 +310,91 @@ window.__ModuleLoader__.load({
310
310
  fontWeight: 500,
311
311
  overflowWrap: "anywhere"
312
312
  };
313
+ const settingSelect = {
314
+ position: "relative",
315
+ minWidth: 0
316
+ };
317
+ const settingSelectTrigger = {
318
+ width: "100%",
319
+ minHeight: 38,
320
+ display: "flex",
321
+ alignItems: "center",
322
+ justifyContent: "space-between",
323
+ gap: 12,
324
+ padding: "7px 11px 7px 13px",
325
+ border: "1px solid var(--dsw-alias-border-l2)",
326
+ borderRadius: 10,
327
+ background: "var(--dsw-alias-bg-layer-2)",
328
+ color: "var(--dsw-alias-label-primary)",
329
+ boxShadow: "0 1px 2px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent)",
330
+ font: "inherit",
331
+ fontSize: 13,
332
+ lineHeight: "20px",
333
+ textAlign: "left",
334
+ cursor: "pointer",
335
+ transition: "border-color 120ms ease, box-shadow 120ms ease, background 120ms ease"
336
+ };
337
+ const settingSelectTriggerOpen = {
338
+ borderColor: "var(--dsw-static-blue-450)",
339
+ boxShadow: "0 0 0 3px color-mix(in srgb, var(--dsw-static-blue-450) 15%, transparent)"
340
+ };
341
+ const settingSelectValue = {
342
+ minWidth: 0,
343
+ flex: 1,
344
+ overflow: "hidden",
345
+ textOverflow: "ellipsis",
346
+ whiteSpace: "nowrap",
347
+ fontWeight: 550
348
+ };
349
+ const settingSelectChevron = {
350
+ flex: "none",
351
+ color: "var(--dsw-alias-label-tertiary)",
352
+ fontSize: 16,
353
+ lineHeight: 1,
354
+ transform: "translateY(-1px)",
355
+ transition: "transform 120ms ease"
356
+ };
357
+ const settingSelectChevronOpen = { transform: "translateY(1px) rotate(180deg)" };
358
+ const settingSelectMenu = {
359
+ position: "absolute",
360
+ zIndex: 20,
361
+ top: "calc(100% + 6px)",
362
+ left: 0,
363
+ right: 0,
364
+ maxHeight: 240,
365
+ overflowY: "auto",
366
+ padding: 5,
367
+ border: "1px solid var(--dsw-alias-border-l2)",
368
+ borderRadius: 11,
369
+ background: "var(--dsw-alias-bg-layer-1)",
370
+ boxShadow: "0 12px 32px color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent), 0 2px 8px color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)"
371
+ };
372
+ const settingSelectOption = {
373
+ width: "100%",
374
+ minHeight: 34,
375
+ display: "flex",
376
+ alignItems: "center",
377
+ gap: 8,
378
+ padding: "6px 9px",
379
+ border: "none",
380
+ borderRadius: 7,
381
+ background: "transparent",
382
+ color: "var(--dsw-alias-label-primary)",
383
+ font: "inherit",
384
+ fontSize: 13,
385
+ lineHeight: "20px",
386
+ textAlign: "left",
387
+ cursor: "pointer"
388
+ };
389
+ const settingSelectOptionActive = { background: "var(--dsw-alias-bg-layer-2)" };
390
+ const settingSelectCheck = {
391
+ width: 14,
392
+ flex: "none",
393
+ color: "var(--dsw-static-blue-450)",
394
+ fontSize: 12,
395
+ fontWeight: 700,
396
+ textAlign: "center"
397
+ };
313
398
  const settingsActions = {
314
399
  display: "flex",
315
400
  flexWrap: "wrap",
@@ -1033,6 +1118,120 @@ window.__ModuleLoader__.load({
1033
1118
  function value(status, detail) {
1034
1119
  return detail === void 0 ? status : `${status} · ${detail}`;
1035
1120
  }
1121
+ function GlobalSettingSelect({ setting, disabled, onChange }) {
1122
+ const [open, setOpen] = useState(false);
1123
+ const [activeIndex, setActiveIndex] = useState(0);
1124
+ const rootRef = useRef(null);
1125
+ const triggerRef = useRef(null);
1126
+ const listboxId = useId();
1127
+ const selectedIndex = Math.max(0, setting.options.findIndex((option) => option.value === setting.value));
1128
+ const selectedOption = setting.options[selectedIndex];
1129
+ useEffect(() => {
1130
+ if (!open) return;
1131
+ const closeOnOutsidePointer = (event) => {
1132
+ if (!rootRef.current?.contains(event.target)) setOpen(false);
1133
+ };
1134
+ document.addEventListener("mousedown", closeOnOutsidePointer);
1135
+ return () => document.removeEventListener("mousedown", closeOnOutsidePointer);
1136
+ }, [open]);
1137
+ const openMenu = (index = selectedIndex) => {
1138
+ setActiveIndex(index);
1139
+ setOpen(true);
1140
+ };
1141
+ const choose = (index) => {
1142
+ const option = setting.options[index];
1143
+ if (option === void 0) return;
1144
+ setOpen(false);
1145
+ triggerRef.current?.focus();
1146
+ if (option.value !== setting.value) onChange(option.value);
1147
+ };
1148
+ const move = (offset) => {
1149
+ const count = setting.options.length;
1150
+ if (count === 0) return;
1151
+ setActiveIndex((current) => (current + offset + count) % count);
1152
+ };
1153
+ return /* @__PURE__ */ jsxs("div", {
1154
+ ref: rootRef,
1155
+ style: settingSelect,
1156
+ onBlur: (event) => {
1157
+ if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false);
1158
+ },
1159
+ children: [/* @__PURE__ */ jsxs("button", {
1160
+ ref: triggerRef,
1161
+ type: "button",
1162
+ "aria-haspopup": "listbox",
1163
+ "aria-expanded": open,
1164
+ "aria-controls": open ? listboxId : void 0,
1165
+ "aria-activedescendant": open ? `${listboxId}-${activeIndex}` : void 0,
1166
+ disabled: disabled || setting.options.length === 0,
1167
+ style: {
1168
+ ...settingSelectTrigger,
1169
+ ...open ? settingSelectTriggerOpen : {}
1170
+ },
1171
+ onClick: () => {
1172
+ if (open) setOpen(false);
1173
+ else openMenu();
1174
+ },
1175
+ onKeyDown: (event) => {
1176
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
1177
+ event.preventDefault();
1178
+ if (!open) openMenu(event.key === "ArrowDown" ? selectedIndex : Math.max(0, setting.options.length - 1));
1179
+ else move(event.key === "ArrowDown" ? 1 : -1);
1180
+ } else if (event.key === "Home" && open) {
1181
+ event.preventDefault();
1182
+ setActiveIndex(0);
1183
+ } else if (event.key === "End" && open) {
1184
+ event.preventDefault();
1185
+ setActiveIndex(Math.max(0, setting.options.length - 1));
1186
+ } else if ((event.key === "Enter" || event.key === " ") && open) {
1187
+ event.preventDefault();
1188
+ choose(activeIndex);
1189
+ } else if (event.key === "Escape" && open) {
1190
+ event.preventDefault();
1191
+ setOpen(false);
1192
+ }
1193
+ },
1194
+ children: [/* @__PURE__ */ jsx("span", {
1195
+ style: settingSelectValue,
1196
+ children: selectedOption?.label ?? setting.value
1197
+ }), /* @__PURE__ */ jsx("span", {
1198
+ "aria-hidden": "true",
1199
+ style: {
1200
+ ...settingSelectChevron,
1201
+ ...open ? settingSelectChevronOpen : {}
1202
+ },
1203
+ children: "⌄"
1204
+ })]
1205
+ }), open ? /* @__PURE__ */ jsx("div", {
1206
+ id: listboxId,
1207
+ role: "listbox",
1208
+ "aria-activedescendant": `${listboxId}-${activeIndex}`,
1209
+ style: settingSelectMenu,
1210
+ children: setting.options.map((option, index) => {
1211
+ const selected = option.value === setting.value;
1212
+ const active = index === activeIndex;
1213
+ return /* @__PURE__ */ jsxs("button", {
1214
+ id: `${listboxId}-${index}`,
1215
+ type: "button",
1216
+ role: "option",
1217
+ "aria-selected": selected,
1218
+ style: {
1219
+ ...settingSelectOption,
1220
+ ...active ? settingSelectOptionActive : {}
1221
+ },
1222
+ onMouseEnter: () => setActiveIndex(index),
1223
+ onMouseDown: (event) => event.preventDefault(),
1224
+ onClick: () => choose(index),
1225
+ children: [/* @__PURE__ */ jsx("span", {
1226
+ style: settingSelectCheck,
1227
+ "aria-hidden": "true",
1228
+ children: selected ? "✓" : ""
1229
+ }), /* @__PURE__ */ jsx("span", { children: option.label })]
1230
+ }, `${option.source}:${option.value}`);
1231
+ })
1232
+ }) : null]
1233
+ });
1234
+ }
1036
1235
  function ClaudeCodeSettings({ t }) {
1037
1236
  const [report, setReport] = useState();
1038
1237
  const [error, setError] = useState();
@@ -1207,22 +1406,17 @@ window.__ModuleLoader__.load({
1207
1406
  globalSettings === void 0 ? /* @__PURE__ */ jsx("p", {
1208
1407
  style: notice,
1209
1408
  children: t("globalSettingsLoading")
1210
- }) : globalSettings.settings.map((setting) => /* @__PURE__ */ jsxs("label", {
1409
+ }) : globalSettings.settings.map((setting) => /* @__PURE__ */ jsxs("div", {
1211
1410
  style: diagnosticGrid,
1212
1411
  children: [/* @__PURE__ */ jsx("span", {
1213
1412
  style: diagnosticLabel,
1214
1413
  children: setting.key === "outputStyle" ? t("outputStyle") : setting.key
1215
- }), /* @__PURE__ */ jsx("select", {
1216
- value: setting.value,
1414
+ }), /* @__PURE__ */ jsx(GlobalSettingSelect, {
1415
+ setting,
1217
1416
  disabled: globalSettingsBusy,
1218
- onChange: (event) => {
1219
- requestGlobalSettings({ [setting.key]: event.target.value });
1220
- },
1221
- style: diagnosticValue,
1222
- children: setting.options.map((option) => /* @__PURE__ */ jsx("option", {
1223
- value: option.value,
1224
- children: option.label
1225
- }, `${option.source}:${option.value}`))
1417
+ onChange: (nextValue) => {
1418
+ requestGlobalSettings({ [setting.key]: nextValue });
1419
+ }
1226
1420
  })]
1227
1421
  }, setting.key)),
1228
1422
  globalSettings?.settings.some((setting) => setting.effect === "new-session") === true ? /* @__PURE__ */ jsx("p", {