dsh-sidebar-row-menu 1.7.0 → 1.8.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.0 — 2026-11-05
4
+
5
+ ### Added
6
+
7
+ - **Custom settings icon on DSH 0.2.2 and later.** The settings section now
8
+ registers a navigation icon through the host's `settings.section.icon` slot
9
+ instead of falling back to the default gear: three rows with a trailing
10
+ submenu chevron, drawn on the host's 16px grid with a 1.5px rounded stroke and
11
+ `currentColor`, so it follows the selected/unselected state on its own. On
12
+ hosts without the slot (0.2.1 and below) the registration is skipped and the
13
+ settings section keeps working with the host's own glyph.
14
+
3
15
  ## 1.7.0 — 2026-11-05
4
16
 
5
17
  ### Added
package/README.md CHANGED
@@ -441,6 +441,10 @@ DSH 宿主按该范围拒绝安装不兼容的宿主,插件市场也按它显
441
441
  - **0.2.1**:没有 `contextMenus` 服务,保持原来的自绘工作区菜单;会话右键仍由插件把
442
442
  行尾「…」菜单搬到指针。
443
443
 
444
+ 设置页的导航图标走宿主的 `settings.section.icon` slot(0.2.2 新增):图标只接收
445
+ `{ size, active }`,用 16px 网格、1.5 描边和 `currentColor` 跟宿主自绘图标保持同一套笔触。
446
+ 0.2.1 没有这个 slot,注册被跳过,设置页照常注册并保留宿主默认的齿轮图标。
447
+
444
448
  DSH 升级若改动行组件或菜单定位实现:
445
449
 
446
450
  - 工作区右键会退回自绘菜单(0.2.1 路径),或静默不弹(不会报错、不影响原界面);
package/lib/client.js CHANGED
@@ -1520,6 +1520,33 @@ window.__ModuleLoader__.load({
1520
1520
  ]],
1521
1521
  ];
1522
1522
 
1523
+ /**
1524
+ * 设置导航图标(DSH 0.2.2 的 `settings.section.icon`)。
1525
+ * 宿主只给 { size, active },颜色由导航按钮的 currentColor 决定;
1526
+ * 16px 网格、1.5 描边、圆头,跟宿主自绘图标同一套笔触。
1527
+ * 造型是三行条目 + 行尾子菜单箭头:一眼看出「行 → 弹出菜单」。
1528
+ */
1529
+ function SettingsNavIcon({ size = 16 } = {}) {
1530
+ return h('svg', {
1531
+ className: 'dsrm-settings-nav',
1532
+ width: size,
1533
+ height: size,
1534
+ viewBox: '0 0 16 16',
1535
+ fill: 'none',
1536
+ stroke: 'currentColor',
1537
+ strokeWidth: 1.5,
1538
+ strokeLinecap: 'round',
1539
+ strokeLinejoin: 'round',
1540
+ 'aria-hidden': 'true',
1541
+ focusable: 'false',
1542
+ }, [
1543
+ h('path', { d: 'M2.75 4.5h8.35' }),
1544
+ h('path', { d: 'M2.75 8h8.35' }),
1545
+ h('path', { d: 'M2.75 11.5h5.6' }),
1546
+ h('path', { d: 'M12.1 6.5 13.6 8l-1.5 1.5' }),
1547
+ ]);
1548
+ }
1549
+
1523
1550
  function SettingsSection({ t }) {
1524
1551
  const items = useItems();
1525
1552
  const ellipsis = useEllipsis();
@@ -2646,7 +2673,7 @@ window.__ModuleLoader__.load({
2646
2673
 
2647
2674
  /** 设置页:所有新增项都能在这里关掉。 */
2648
2675
  function registerSettings(ctx) {
2649
- return ctx.slots.inject('settings.section', function* () {
2676
+ const stopSection = ctx.slots.inject('settings.section', function* () {
2650
2677
  yield ctx.slots.register({
2651
2678
  name: 'settings.section',
2652
2679
  id: 'sidebar-row-menu',
@@ -2655,6 +2682,21 @@ window.__ModuleLoader__.load({
2655
2682
  locale: NS,
2656
2683
  }, SettingsSection);
2657
2684
  });
2685
+ // 0.2.2 起导航栏按 section id 取自定义图标(settings.section.icon,
2686
+ // owner 传 { size, active })。0.2.1 没有这个 slot,对未声明的 key
2687
+ // 调 inject 可能直接抛错,吞掉即可——两个版本共用同一份客户端代码。
2688
+ try {
2689
+ ctx.slots.inject('settings.section.icon', function* () {
2690
+ yield ctx.slots.register({
2691
+ name: 'settings.section.icon',
2692
+ id: 'sidebar-row-menu',
2693
+ order: 32,
2694
+ }, SettingsNavIcon);
2695
+ });
2696
+ } catch (error) {
2697
+ console.warn('[dsh-sidebar-row-menu] settings.section.icon is unavailable:', error);
2698
+ }
2699
+ return stopSection;
2658
2700
  }
2659
2701
 
2660
2702
  /* -------------------------------------------- 会话行:展开官方菜单 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-sidebar-row-menu",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "description": "Adds open-with and cleanup entries to the DSH sidebar context menus: interleaved with the built-in workspace menu and extending the session menu at the pointer on DSH 0.2.2+, with a self-drawn workspace menu on 0.2.1.",
6
6
  "keywords": [