dsh-better-sidebar-left 0.1.1 → 0.1.6

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
@@ -10,7 +10,7 @@
10
10
  首个版本。把五个「会话管理类」插件合并成一个聚合包,插件列表里只出现一行。
11
11
 
12
12
  - 组件(全部从 **GitHub 仓库的本地检出** vendor,不从 npm 取):
13
- `dsh-delete-session` 0.5.0、`dsh-session-relocate` 0.3.1、`dsh-session-rename-dblclick` 0.1.4、
13
+ `dsh-delete-session` 0.5.0、`dsh-session-relocate` 0.3.1、`dsh-session-rename-dblclick` 0.2.0、
14
14
  `dsh-session-counts` 0.0.3、`dsh-declutter` 0.2.0。
15
15
  每个的上游 commit 钉在 `package.json` 的 `dsh.vendorSources`,`npm run verify:manifest` 离线核对。
16
16
  - 单一行身份:`cordis.patch.yml` 插 1 行裸包名 + 5 行 `dsh-better-sidebar-left/<后缀>`;
@@ -31,4 +31,4 @@
31
31
  `dsh-declutter` 的 npm 历史曾经和仓库不一致:`0.1.2` / `0.1.3` 只有**侧栏半部**
32
32
  (`src/index.js` 是 98 字节空壳)。`0.2.0`(两半合一 + 命名会话修复)已于 2026-11-21
33
33
  发布到 npm,`latest` 指向它;但本包的取源仍然按 GitHub commit 钉住,理由与另外四个一致:
34
- commit 是可复现的,dist-tag 不是。
34
+ commit 是可复现的,dist-tag 不是。
package/README.en.md CHANGED
@@ -11,7 +11,7 @@ Five session-management plugins in one install. **The plugin list grows by exact
11
11
  |---|---|
12
12
  | `dsh-delete-session` 0.5.0 | **Delete a session** from the sidebar row menu: a risk list (log, workspace files, quarantine folder) first, nothing touched until you confirm; plus a multi-select footer bar for batches |
13
13
  | `dsh-session-relocate` 0.3.1 | **Move across workspaces**: row menu, context menu, or drag the session row onto the target workspace - a crash-recoverable transaction, open-but-idle sessions included |
14
- | `dsh-session-rename-dblclick` 0.1.4 | **Rename in place**: one click on the header title, a double click on a sidebar row; the pill follows the shipped title (40px, 22px radius, outline on hover, brand ring while editing), Enter saves, Esc cancels |
14
+ | `dsh-session-rename-dblclick` 0.2.0 | **Rename in place**: one click on the header title, a double click on a sidebar row; the pill follows the shipped title (40px, 22px radius, outline on hover, brand ring while editing), Enter saves, Esc cancels |
15
15
  | `dsh-session-counts` 0.0.3 | **Per-workspace counts**: a badge at the end of each workspace row and a total next to the section label, following the archived filter |
16
16
  | `dsh-declutter` 0.2.0 | **Declutter**: failed/empty/synthesised turns fold away per a rule table (view attributes only, reversible, log untouched) + sidebar tidying (brand row, New session, More buttons, top gap, panel visibility and order) |
17
17
 
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  |---|---|
11
11
  | `dsh-delete-session` 0.5.0 | 侧栏会话行「…」菜单里的**删除会话**:先给风险清单(日志 / 工作区文件 / 隔离目录),确认后才动手;另有批量多选底栏 |
12
12
  | `dsh-session-relocate` 0.3.1 | **跨工作区移动**:会话行「…」菜单、右键菜单、直接把会话行拖到目标工作区;崩溃可恢复的事务,打开中但空闲的会话也能搬 |
13
- | `dsh-session-rename-dblclick` 0.1.4 | **就地改名**:顶栏标题单击、侧栏行双击;胶囊尺寸/配色照官方标题(40px、22px 圆角、悬停描边、聚焦品牌色),Enter 存 / Esc 取消 |
13
+ | `dsh-session-rename-dblclick` 0.2.0 | **就地改名**:顶栏标题单击、侧栏行双击;胶囊尺寸/配色照官方标题(40px、22px 圆角、悬停描边、聚焦品牌色),Enter 存 / Esc 取消 |
14
14
  | `dsh-session-counts` 0.0.3 | **工作区会话数**:每行行尾显示计数,表头显示总数,口径跟随「已归档」筛选 |
15
15
  | `dsh-declutter` 0.2.0 | **收纳与整理**:会话内失败轮/空轮/合成轮按规则表收起(只加视图属性,可逆,不改日志)+ 侧栏藏品牌行 /「新会话」/「更多」/顶部空隙,面板显隐与排序 |
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-better-sidebar-left",
3
- "version": "0.1.1",
3
+ "version": "0.1.6",
4
4
  "description": "Session management for DeepSeek Harness in one install: delete a session with a risk-checked confirmation, move one across workspaces (menu and drag), rename one by double-clicking its title, show per-workspace session counts, and declutter both the sidebar and the conversation's collapsed turns. Self-contained: the plugin list shows this one row, and the five components are vendored inside it - installing this plugin installs nothing else.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -80,8 +80,8 @@
80
80
  "dsh-session-rename-dblclick": {
81
81
  "repo": "https://github.com/DDDMUC/dsh-session-rename-dblclick",
82
82
  "ref": "main",
83
- "commit": "53bbae2fefc691bf0852696496aa96693b26ff9e",
84
- "version": "0.1.4"
83
+ "commit": "28a621aed02d63fdaf1ee406d1eaef260d0d741b",
84
+ "version": "0.2.0"
85
85
  },
86
86
  "dsh-session-counts": {
87
87
  "repo": "https://github.com/DDDMUC/dsh-session-counts",
package/src/client.js CHANGED
@@ -6217,16 +6217,10 @@ window.__ModuleLoader__.load({
6217
6217
  margin: 0; border: 1px solid transparent; background: transparent;
6218
6218
  box-shadow: none; transition: none;
6219
6219
  }
6220
- /* Editing: the same pill, now wearing the brand ring - that is how the
6221
- reference paints its focused field. The interior stays transparent so
6222
- no colour is invented on top of the host theme. */
6223
- .dsr-wrap[data-editing='true'] {
6224
- border-color: var(--dsw-alias-brand-primary, #4d6bfe);
6225
- /* The reference field is FILLED (it wears the input token), not a hole cut
6226
- in the header - that fill is most of why its edit state reads as a field. */
6227
- background: var(--dsw-specific-input-major, var(--dsw-alias-bg-overlay, #ffffff));
6228
- box-shadow: var(--dsw-shadow-lv2, 0 2px 8px 0 rgba(0, 0, 0, .04));
6229
- }
6220
+ /* Editing: the colours are set inline by openEditor from tokens resolved INSIDE
6221
+ the theme scope. They cannot live here - this overlay hangs off <body>, where
6222
+ the theme variables do not exist, so a var() would fall back to something
6223
+ invented (that is exactly how the ring once came out black). */
6230
6224
  /*
6231
6225
  * Idle affordance. It CANNOT be a pseudo-element on the title: the product's
6232
6226
  * crumb is display:inline-block with overflow hidden, so anything drawn outside
@@ -6387,16 +6381,6 @@ window.__ModuleLoader__.load({
6387
6381
  /** @type {null | { closed: boolean, targetEl: Element, sessionId: string }} */
6388
6382
  let editor = null
6389
6383
 
6390
- function copyFont(from, to) {
6391
- const cs = window.getComputedStyle(from)
6392
- to.style.fontFamily = cs.fontFamily
6393
- to.style.fontSize = cs.fontSize
6394
- to.style.fontWeight = cs.fontWeight
6395
- to.style.fontStyle = cs.fontStyle
6396
- to.style.letterSpacing = cs.letterSpacing
6397
- to.style.lineHeight = cs.lineHeight
6398
- to.style.textAlign = cs.textAlign
6399
- }
6400
6384
 
6401
6385
  /** Width of `text` in the title's own font, so the editor can hug the glyphs. */
6402
6386
  function measureText(el, text, font) {
@@ -6405,18 +6389,35 @@ window.__ModuleLoader__.load({
6405
6389
  const weight = font !== undefined && font !== null ? font.weight : cs.fontWeight
6406
6390
  const family = font !== undefined && font !== null ? font.family : cs.fontFamily
6407
6391
  const lineHeight = font !== undefined && font !== null ? font.lineHeight : parseFloat(cs.lineHeight) || Math.round(size * 1.35)
6392
+ const style = font !== undefined && font !== null ? font.style : cs.fontStyle
6393
+ const spacing = font !== undefined && font !== null ? font.letterSpacing : cs.letterSpacing
6394
+ // Measure with a REAL element, not canvas metrics.
6395
+ //
6396
+ // Canvas measureText and the layout engine disagree by a pixel or two per CJK
6397
+ // string, so a canvas-measured pill came out ~2px wider than the text it hugs.
6398
+ // The reference is `width: fit-content`, i.e. whatever layout says, so ask layout.
6408
6399
  let width = 0
6400
+ let probe = null
6409
6401
  try {
6410
- if (!measureText.canvas) measureText.canvas = document.createElement('canvas')
6411
- const context = measureText.canvas.getContext('2d')
6412
- context.font = `${cs.fontStyle} ${weight} ${size}px ${family}`
6413
- width = context.measureText(text).width
6414
- } catch {
6402
+ probe = document.createElement('span')
6403
+ probe.textContent = text
6404
+ probe.setAttribute('aria-hidden', 'true')
6405
+ probe.style.position = 'absolute'
6406
+ probe.style.visibility = 'hidden'
6407
+ probe.style.pointerEvents = 'none'
6408
+ probe.style.whiteSpace = 'pre'
6409
+ probe.style.font = `${style} ${weight} ${size}px ${family}`
6410
+ probe.style.lineHeight = `${lineHeight}px`
6411
+ probe.style.letterSpacing = spacing
6412
+ const host = el !== null && el !== undefined && el.parentElement !== null && el.parentElement !== undefined ? el.parentElement : document.body
6413
+ host.appendChild(probe)
6414
+ width = probe.getBoundingClientRect().width
6415
+ } catch (error) {
6415
6416
  width = 0
6417
+ } finally {
6418
+ if (probe !== null && typeof probe.remove === 'function') probe.remove()
6416
6419
  }
6417
6420
  if (!width) width = text.length * size * 0.62
6418
- const spacing = parseFloat(cs.letterSpacing)
6419
- if (Number.isFinite(spacing) && spacing !== 0) width += spacing * Math.max(text.length - 1, 0)
6420
6421
  return { width, height: lineHeight, padLeft: parseFloat(cs.paddingLeft) || 0, padTop: parseFloat(cs.paddingTop) || 0 }
6421
6422
  }
6422
6423
 
@@ -6462,6 +6463,22 @@ window.__ModuleLoader__.load({
6462
6463
 
6463
6464
  const BORDER = 1
6464
6465
  const PAD_X = 12
6466
+ // The live product draws its field with --dsl-input-height:44px and
6467
+ // --dsl-input-border-radius:22px, i.e. a 44px pill whose caps are TRUE semicircles
6468
+ // (radius = height / 2, nothing for the browser to clamp).
6469
+ //
6470
+ // A 40px pill with a 22px radius is not the same thing: CSS scales both radii by
6471
+ // 40/44, so the caps come out at 20px and read a touch tighter at both ends. That
6472
+ // is the difference one sees when the two are put side by side.
6473
+ const PILL_HEIGHT = 40
6474
+ const PILL_RADIUS = 22
6475
+ // The product EDIT state is a .ds-input with its own numbers (main.76bb554586.css):
6476
+ // .ds-input{border-radius:22px; padding:0 14px; height:var(--dsl-input-height);
6477
+ // background-color:var(--dsl-input-color); display:flex; border:none}
6478
+ // .ds-input--l{--dsl-input-height:var(--ds-control-height-l)} -> 40px
6479
+ // --dsl-input-color: var(--dsw-specific-selector) -> #f1f3f5
6480
+ const FIELD_PAD_X = 14
6481
+ const FIELD_BORDER = 0
6465
6482
 
6466
6483
  /**
6467
6484
  * The pill that the editor and the hover ring both draw.
@@ -6482,31 +6499,42 @@ window.__ModuleLoader__.load({
6482
6499
  */
6483
6500
  function pillFont(titleEl) {
6484
6501
  const cs = typeof window !== 'undefined' && typeof window.getComputedStyle === 'function' ? window.getComputedStyle(titleEl) : null
6485
- return { size: 14, weight: '600', lineHeight: 22, family: cs === null ? 'inherit' : cs.fontFamily }
6502
+ if (cs === null) return { size: 14, weight: '400', style: 'normal', lineHeight: 20, family: 'inherit', letterSpacing: 'normal' }
6503
+ return {
6504
+ size: parseFloat(cs.fontSize) || 14,
6505
+ weight: cs.fontWeight || '400',
6506
+ style: cs.fontStyle || 'normal',
6507
+ lineHeight: parseFloat(cs.lineHeight) || 20,
6508
+ family: cs.fontFamily || 'inherit',
6509
+ letterSpacing: cs.letterSpacing || 'normal',
6510
+ }
6486
6511
  }
6487
6512
 
6488
- function boxOf(titleEl, title, surface) {
6513
+ function boxOf(titleEl, title, surface, spec) {
6514
+ const padX = spec !== undefined && spec !== null && spec.padX !== undefined ? spec.padX : PAD_X
6515
+ const border = spec !== undefined && spec !== null && spec.border !== undefined ? spec.border : BORDER
6489
6516
  const rect = titleEl.getBoundingClientRect()
6490
6517
  const font = pillFont(titleEl)
6491
6518
  const metrics = measureText(titleEl, title, font)
6492
6519
  const contentHeight = Math.max(14, Math.round(font.lineHeight))
6493
- // The product pill is 40px tall over a 22px line with a 1px border, so the
6494
- // padding is (40 - 22) / 2 - 1 = 8. Counting the border is what makes it land
6495
- // on 40 instead of 42.
6496
- const target = surface === 'header' ? 40 : contentHeight + 8
6497
- const padY = Math.max(2, Math.min(12, Math.round((target - contentHeight) / 2) - BORDER))
6520
+ // Padding is computed from the BORDER as well, so the box lands on the target
6521
+ // height instead of target + 2.
6522
+ const target = surface === 'header' ? (spec !== undefined && spec !== null && spec.height !== undefined ? spec.height : PILL_HEIGHT) : contentHeight + 8
6523
+ const padY = Math.max(2, Math.min(12, Math.round((target - contentHeight) / 2) - border))
6498
6524
  const contentLeft = rect.left + metrics.padLeft
6499
6525
  const contentTop = rect.top + metrics.padTop
6500
- const room = typeof window === 'undefined' ? 0 : window.innerWidth - (contentLeft - (BORDER + PAD_X)) - 8
6526
+ const room = typeof window === 'undefined' ? 0 : window.innerWidth - (contentLeft - (border + padX)) - 8
6501
6527
  const wanted = Math.max(metrics.width + 2, 24)
6502
- const maxContent = Math.max(24, room - 2 * (BORDER + PAD_X))
6528
+ const maxContent = Math.max(24, room - 2 * (border + padX))
6503
6529
  const contentWidth = Math.round(Math.min(wanted, maxContent))
6504
6530
  return {
6505
- left: Math.round(contentLeft - (BORDER + PAD_X)),
6506
- top: Math.round(contentTop - (BORDER + padY)),
6507
- width: contentWidth + 2 * (BORDER + PAD_X),
6508
- height: contentHeight + 2 * (BORDER + padY),
6531
+ left: Math.round(contentLeft - (border + padX)),
6532
+ top: Math.round(contentTop - (border + padY)),
6533
+ width: contentWidth + 2 * (border + padX),
6534
+ height: contentHeight + 2 * (border + padY),
6509
6535
  padY,
6536
+ padX,
6537
+ border,
6510
6538
  contentHeight,
6511
6539
  }
6512
6540
  }
@@ -6529,7 +6557,7 @@ window.__ModuleLoader__.load({
6529
6557
  ringEl.style.top = `${box.top}px`
6530
6558
  ringEl.style.width = `${box.width}px`
6531
6559
  ringEl.style.height = `${box.height}px`
6532
- ringEl.style.borderRadius = box.height >= 40 ? '22px' : `${Math.round(Math.min(22, box.height / 2))}px`
6560
+ ringEl.style.borderRadius = `${Math.round(Math.min(PILL_RADIUS, box.height / 2))}px`
6533
6561
  ringEl.style.borderColor = resolveToken(titleEl, '--dsw-alias-border-l2', 'borderColor', 'rgba(0, 0, 0, 0.1)')
6534
6562
  ringEl.style.boxShadow = resolveToken(titleEl, '--dsw-shadow-lv2', 'boxShadow', 'none')
6535
6563
  if (typeof window !== 'undefined' && typeof window.getComputedStyle === 'function') {
@@ -6614,7 +6642,7 @@ window.__ModuleLoader__.load({
6614
6642
  hideRing()
6615
6643
  // The hover ring has just drawn this exact pill, so entering the editor is a
6616
6644
  // change of colour, not of geometry.
6617
- const box = boxOf(titleEl, title, target.surface)
6645
+ const box = boxOf(titleEl, title, target.surface, { padX: FIELD_PAD_X, border: FIELD_BORDER })
6618
6646
  // Declared before the log that prints it: the previous revision logged `brand`
6619
6647
  // while its const sat further down, which threw a temporal-dead-zone error inside
6620
6648
  // openEditor AFTER the click was already swallowed - so a click did nothing at all.
@@ -6654,14 +6682,17 @@ window.__ModuleLoader__.load({
6654
6682
  // paints `inset 0 0 0 1px var(--dsw-alias-brand-primary)`. Same here, so the ring
6655
6683
  // hugs the pill instead of growing it by a pixel.
6656
6684
  wrap.style.borderColor = 'transparent'
6657
- wrap.style.background = resolveToken(titleEl, '--dsw-specific-input-major', 'backgroundColor', 'transparent')
6685
+ wrap.style.background = resolveToken(titleEl, '--dsw-specific-selector', 'backgroundColor', '#f1f3f5')
6686
+ wrap.style.borderWidth = box.border + 'px'
6658
6687
  wrap.style.boxShadow = `inset 0 0 0 1px ${brand}`
6659
- wrap.style.borderRadius = box.height >= 40 ? '22px' : `${Math.round(Math.min(22, box.height / 2))}px`
6660
- wrap.style.padding = `${box.padY}px ${PAD_X}px`
6688
+ wrap.style.borderRadius = `${Math.round(Math.min(PILL_RADIUS, box.height / 2))}px`
6689
+ wrap.style.padding = `${box.padY}px ${box.padX}px`
6661
6690
  wrap.style.fontFamily = font.family
6662
6691
  wrap.style.fontSize = `${font.size}px`
6663
6692
  wrap.style.fontWeight = font.weight
6693
+ wrap.style.fontStyle = font.style
6664
6694
  wrap.style.lineHeight = `${font.lineHeight}px`
6695
+ wrap.style.letterSpacing = font.letterSpacing
6665
6696
 
6666
6697
  const input = document.createElement('input')
6667
6698
  input.className = 'dsr-input'
@@ -6704,7 +6735,11 @@ window.__ModuleLoader__.load({
6704
6735
  const focusNow = () => {
6705
6736
  if (state.closed) return
6706
6737
  input.focus({ preventScroll: true })
6707
- input.select()
6738
+ // The reference drops a caret after the last character; it does NOT select the
6739
+ // title. Selecting everything made the first keystroke replace the whole name,
6740
+ // and it repainted the text with a selection band that the reference never shows.
6741
+ const end = String(input.value).length
6742
+ if (typeof input.setSelectionRange === 'function') input.setSelectionRange(end, end)
6708
6743
  }
6709
6744
  // Next frame when there is one (some hosts without a window still run this code).
6710
6745
  if (typeof requestAnimationFrame === 'function') requestAnimationFrame(focusNow)
@@ -9388,7 +9423,7 @@ window.__ModuleLoader__.load({
9388
9423
  const NS = 'dsh-better-sidebar-left'
9389
9424
 
9390
9425
  /** Keep in sync with package.json and src/components.js. */
9391
- const PLUGIN_VERSION = '0.1.1'
9426
+ const PLUGIN_VERSION = '0.1.6'
9392
9427
 
9393
9428
  /** Presence marker the live verifier reads. */
9394
9429
  const DEBUG_KEY = '__DSH_BETTER_SIDEBAR_LEFT__'
package/src/components.js CHANGED
@@ -24,7 +24,7 @@
24
24
  export const PLUGIN_ID = 'dsh-better-sidebar-left'
25
25
 
26
26
  /** Keep in sync with package.json and src/sidebar.js. */
27
- export const PLUGIN_VERSION = '0.1.1'
27
+ export const PLUGIN_VERSION = '0.1.6'
28
28
 
29
29
  /**
30
30
  * The five components, in the order the user meets them in the sidebar.
@@ -1,6 +1,6 @@
1
1
  // dsh-session-rename-dblclick host half (dsh-session-rename-dblclick.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-better-sidebar-left-src/components/dsh-session-rename-dblclick/index.js (v0.1.4, sha256 9a1263e486e37b58)
3
+ // Source: ../dsh-better-sidebar-left-src/components/dsh-session-rename-dblclick/index.js (v0.2.0, sha256 9a1263e486e37b58)
4
4
  // Regenerate with npm run vendor; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js mounts the copy named after the component, which is why this
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dsh-delete-session": "0.5.0",
3
3
  "dsh-session-relocate": "0.3.1",
4
- "dsh-session-rename-dblclick": "0.1.4",
4
+ "dsh-session-rename-dblclick": "0.2.0",
5
5
  "dsh-session-counts": "0.0.3",
6
6
  "dsh-declutter": "0.2.0"
7
7
  }