@lyhue1991/dsh-soup 0.4.4 → 0.4.5

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
@@ -137,7 +137,7 @@ window.__ModuleLoader__.load({
137
137
  // 文件标签页视图(conversation.view 'dsh-soup-files'):子 tab 条 + 预览区。
138
138
  // 纯预览(无编辑):markdown/html/json/csv 各有专属渲染器。
139
139
  var FILEVIEW_CSS =
140
- '.dfv-root{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--dsw-specific-sidebar-fill);color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);}' +
140
+ '.dfv-root{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--dsw-specific-sidebar-fill);color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);user-select:text;-webkit-user-select:text;}' +
141
141
  '.dfv-tabbar{display:flex;align-items:center;gap:2px;flex:none;overflow-x:auto;padding:6px 10px 0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none;}' +
142
142
  '.dfv-tabbar::-webkit-scrollbar{display:none;}' +
143
143
  '.dfv-tab{display:inline-flex;align-items:center;gap:5px;padding:5px 8px 5px 10px;border:none;border-radius:8px 8px 0 0;background:transparent;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.4;cursor:pointer;white-space:nowrap;max-width:220px;}' +
@@ -157,11 +157,22 @@ window.__ModuleLoader__.load({
157
157
  '.dfv-cap{padding:5px 14px;font-size:11px;color:var(--dsw-alias-label-caption);border-bottom:1px solid var(--dsw-alias-border-l1);flex:none;}' +
158
158
  '.dfv-code{flex:1;min-height:0;width:100%;box-sizing:border-box;margin:0;padding:10px 14px;overflow:auto;background:transparent;color:var(--dsw-alias-label-primary);font-family:var(--ds-font-family-code);font-size:12.5px;line-height:1.55;white-space:pre;tab-size:2;user-select:text;}' +
159
159
  '.dfv-code-wrap{flex:1;min-height:0;overflow:auto;padding:8px 10px;}' +
160
+ '.dfv-code-lines{flex:1;min-height:0;display:flex;overflow:auto;}' +
161
+ '.dfv-code-gutter{position:sticky;left:0;z-index:1;flex:none;padding:10px 8px 10px 12px;text-align:right;color:var(--dsw-alias-label-caption);font-family:var(--ds-font-family-code);font-size:12.5px;line-height:1.55;user-select:none;background:var(--dsw-alias-bg-layer-1);border-right:1px solid var(--dsw-alias-border-l1);}' +
162
+ '.dfv-code-main{flex:1;min-width:0;}' +
163
+ '.dfv-code-main .dfv-code{overflow:visible;width:auto;}' +
164
+ // CodeBlock(md-code-block)在行号布局内的适配:
165
+ // 隐藏 banner(js 标签 + 复制按钮),统一 padding/字体与 gutter 对齐。
166
+ '.dfv-code-main .md-code-block{margin:0;border-radius:0;background:transparent;}' +
167
+ '.dfv-code-main .md-code-block>div:first-child{display:none!important;}' +
168
+ '.dfv-code-main .md-code-block pre{padding:10px 14px!important;margin:0!important;font:12.5px/1.55 var(--ds-font-family-code)!important;background:transparent!important;border-radius:0!important;white-space:pre;word-break:normal;}' +
160
169
  '.dfv-nb{flex:1;min-height:0;overflow:auto;background:var(--dsw-alias-bg-base);}' +
161
170
  '.dfv-nb-cell{display:flex;border-bottom:1px solid var(--dsw-alias-border-l1);}' +
162
171
  '.dfv-nb-gutter{flex:none;width:44px;padding:8px 6px;text-align:right;font-family:var(--ds-font-family-code);font-size:11px;color:var(--dsw-alias-label-caption);border-right:1px solid var(--dsw-alias-border-l1);user-select:none;background:var(--dsw-specific-sidebar-fill);}' +
163
172
  '.dfv-nb-cellbody{flex:1;min-width:0;padding:4px 0;}' +
164
173
  '.dfv-nb-cellbody .md-code-block,.dfv-nb-cellbody .dfv-code{margin:4px 10px;border-radius:8px;overflow:hidden;}' +
174
+ '.dfv-nb-cellbody .dfv-code-lines{border-radius:8px;overflow:hidden;}' +
175
+ '.dfv-nb-cellbody .dfv-code-gutter{padding:8px 6px 8px 10px;font-size:12px;}' +
165
176
  '.dfv-nb-cell.dfv-nb-markdown .dfv-md-wrap{padding:2px 14px;}' +
166
177
  '.dfv-nb-raw{color:var(--dsw-alias-label-secondary);}' +
167
178
  '.dfv-nb-outputs{border-top:1px dashed var(--dsw-alias-border-l1);padding:6px 10px;display:flex;flex-direction:column;gap:8px;}' +
@@ -185,7 +196,7 @@ window.__ModuleLoader__.load({
185
196
  '.dfv-td{padding:4px 10px;border-bottom:1px solid var(--dsw-alias-border-l1);border-right:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-primary);white-space:pre-wrap;overflow-wrap:anywhere;max-width:360px;}' +
186
197
  // 兜底浮层:空会话时原生 tab 条不存在,预览以模态浮层展示
187
198
  '.dfv-overlay{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:var(--dsw-alias-bg-mask-1,rgba(0,0,0,.24));backdrop-filter:var(--dsw-mask-blur,blur(2px));}' +
188
- '.dfv-overlay-panel{display:flex;flex-direction:column;width:800px;height:min(800px,calc(100vh - 48px));max-width:calc(100vw - 48px);border-radius:24px;overflow:hidden;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-shadow-lv3);}' +
199
+ '.dfv-overlay-panel{display:flex;flex-direction:column;width:800px;height:min(800px,calc(100vh - 48px));max-width:calc(100vw - 48px);border-radius:24px;overflow:hidden;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-shadow-lv3);user-select:text;-webkit-user-select:text;}' +
189
200
  '.dfv-overlay-panel.dfv-overlay-max{width:100vw;height:100vh;max-width:none;border-radius:0;border:none;}' +
190
201
  '.dfv-overlay-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font-size:14px;line-height:1;cursor:pointer;padding:0;}' +
191
202
  '.dfv-overlay-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}' +
@@ -1988,9 +1999,10 @@ window.__ModuleLoader__.load({
1988
1999
  })
1989
2000
  var codeSrc = nbSource(cell.source)
1990
2001
  body = create('div', { className: 'dfv-nb-cellbody' },
1991
- CodeBlock
1992
- ? create(CodeBlock, { code: codeSrc, lang: codeLang })
1993
- : create('pre', { className: 'dfv-code' }, codeSrc),
2002
+ create(CodeWithLines, { text: codeSrc },
2003
+ CodeBlock
2004
+ ? create(CodeBlock, { code: codeSrc, lang: codeLang })
2005
+ : create('pre', { className: 'dfv-code' }, codeSrc)),
1994
2006
  outputs.length ? create('div', { className: 'dfv-nb-outputs' }, outputs) : null)
1995
2007
  } else if (ct === 'markdown') {
1996
2008
  body = MarkdownText
@@ -2068,6 +2080,18 @@ window.__ModuleLoader__.load({
2068
2080
  return (n / 1073741824).toFixed(1) + ' GB'
2069
2081
  }
2070
2082
 
2083
+ /** 代码内容 + 左侧行号列(源码文件 / notebook code cell 用)。 */
2084
+ function CodeWithLines(props) {
2085
+ var text = props.text || ''
2086
+ var lineCount = text.split('\n').length
2087
+ var nums = []
2088
+ for (var i = 1; i <= lineCount; i++) nums.push(create('div', { key: i }, String(i)))
2089
+ return create('div', { className: 'dfv-code-lines' },
2090
+ create('div', { className: 'dfv-code-gutter', 'aria-hidden': true }, nums),
2091
+ create('div', { className: 'dfv-code-main' }, props.children),
2092
+ )
2093
+ }
2094
+
2071
2095
  function FileContent(props) {
2072
2096
  var entry = props.entry
2073
2097
  if (entry.loading) {
@@ -2105,14 +2129,14 @@ window.__ModuleLoader__.load({
2105
2129
  else if (pk === 'csv' || pk === 'tsv') view = create(DelimitedPreview, { text: entry.content, delim: pk === 'tsv' ? '\t' : ',' })
2106
2130
  else {
2107
2131
  // 代码文件:DSH CodeBlock(Shiki 高亮,语法包懒加载);无高亮条件回退纯文本
2132
+ // 都包在 CodeWithLines 里加左侧行号
2108
2133
  var lang = Object.prototype.hasOwnProperty.call(CODE_LANG_BY_EXT, extOfName(entry.path))
2109
2134
  ? CODE_LANG_BY_EXT[extOfName(entry.path)]
2110
2135
  : undefined
2111
- if (CodeBlock && lang && entry.content.length <= CODE_HIGHLIGHT_MAX_CHARS) {
2112
- view = create('div', { className: 'dfv-code-wrap' }, create(CodeBlock, { code: entry.content, lang: lang }))
2113
- } else {
2114
- view = create('pre', { className: 'dfv-code' }, entry.content)
2115
- }
2136
+ var codeEl = (CodeBlock && lang && entry.content.length <= CODE_HIGHLIGHT_MAX_CHARS)
2137
+ ? create(CodeBlock, { code: entry.content, lang: lang })
2138
+ : create('pre', { className: 'dfv-code' }, entry.content)
2139
+ view = create(CodeWithLines, { text: entry.content }, codeEl)
2116
2140
  }
2117
2141
  return create(React.Fragment, null,
2118
2142
  entry.truncated ? create('div', { className: 'dfv-cap' },
package/lib/index.js CHANGED
@@ -627,6 +627,12 @@ export function apply(ctx) {
627
627
  if (typeof entry.size === 'number' && entry.size >= 0) item.size = entry.size
628
628
  return item
629
629
  })
630
+ // 目录在前、文件在后,各按名称排(与 VS Code / Finder 一致)。
631
+ out.sort((a, b) => {
632
+ const dirDiff = (a.type === 'directory' ? 0 : 1) - (b.type === 'directory' ? 0 : 1)
633
+ if (dirDiff !== 0) return dirDiff
634
+ return a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' })
635
+ })
630
636
  return { ok: true, root, path: basePath, entries: out }
631
637
  }
632
638
  case 'open': {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lyhue1991/dsh-soup",
3
3
  "description": "DSH 项目资源管理器:右侧 details 列文件树(并列网格、宽度与左侧工作区一致 264-420px),有 Session log 时在其右侧、空白新会话在输入框上方右端提供 📁 切换按钮;支持多选、双击展开/打开、右键菜单(打开/系统打开/重命名/废纸篓/新建/复制路径)、拖拽移动、上传。文件「打开」在会话区新增「文件」标签页(原生 conversation.view,与对话/轨迹同级):文本可编辑 ⌘S 保存、图片预览、二进制提示。附带模型吞吐徽标:输入框正上方显示「正在等待模型...」与彩色 t/s 徽标(数据来自 llm/stream 真实流)。附带 GoalBar 多行展示:把原生单行截断 GoalBar 放开为多行完整显示,编辑用 textarea,工具与数据仍走原生 goal。",
4
- "version": "0.4.4",
4
+ "version": "0.4.5",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {