dsh-linked-workspace 0.24.1 → 0.25.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/lib/client.js CHANGED
@@ -295,6 +295,150 @@ const EDITOR_THEMES = [
295
295
  punctuation: '#1f1f1f',
296
296
  plain: '#1f1f1f'
297
297
  }
298
+ },
299
+ {
300
+ id: 'tokyo-night',
301
+ label: { zh: 'Tokyo Night 深色', en: 'Tokyo Night' },
302
+ kind: 'dark',
303
+ colors: {
304
+ bg: '#1a1b26',
305
+ fg: '#c0caf5',
306
+ gutterBg: '#16161e',
307
+ gutterFg: '#4c5470',
308
+ border: '#232433',
309
+ selection: '#33467c',
310
+ lineHighlight: '#1f2030',
311
+ caret: '#c0caf5',
312
+ keyword: '#bb9af7',
313
+ string: '#9ece6a',
314
+ comment: '#646e9c',
315
+ number: '#ff9e64',
316
+ functionName: '#7aa2f7',
317
+ typeName: '#2ac3de',
318
+ operator: '#89ddff',
319
+ punctuation: '#a9b1d6',
320
+ plain: '#c0caf5'
321
+ }
322
+ },
323
+ {
324
+ id: 'tokyo-night-light',
325
+ label: { zh: 'Tokyo Night 浅色', en: 'Tokyo Night Light' },
326
+ kind: 'light',
327
+ colors: {
328
+ bg: '#e1e2e7',
329
+ fg: '#3760bf',
330
+ gutterBg: '#d6d8de',
331
+ gutterFg: '#848cb5',
332
+ border: '#c4c8da',
333
+ selection: '#b7c1e3',
334
+ lineHighlight: '#d9dbe4',
335
+ caret: '#3760bf',
336
+ keyword: '#9854f1',
337
+ string: '#587539',
338
+ comment: '#848cb5',
339
+ number: '#b15c00',
340
+ functionName: '#2e7de9',
341
+ typeName: '#007197',
342
+ operator: '#007197',
343
+ punctuation: '#6172b0',
344
+ plain: '#3760bf'
345
+ }
346
+ },
347
+ {
348
+ id: 'gruvbox-dark',
349
+ label: { zh: 'Gruvbox 深色', en: 'Gruvbox Dark' },
350
+ kind: 'dark',
351
+ colors: {
352
+ bg: '#282828',
353
+ fg: '#ebdbb2',
354
+ gutterBg: '#1d2021',
355
+ gutterFg: '#7c6f64',
356
+ border: '#3c3836',
357
+ selection: '#504945',
358
+ lineHighlight: '#32302f',
359
+ caret: '#ebdbb2',
360
+ keyword: '#fb4934',
361
+ string: '#b8bb26',
362
+ comment: '#928374',
363
+ number: '#d3869b',
364
+ functionName: '#fabd2f',
365
+ typeName: '#83a598',
366
+ operator: '#fe8019',
367
+ punctuation: '#a89984',
368
+ plain: '#ebdbb2'
369
+ }
370
+ },
371
+ {
372
+ id: 'gruvbox-light',
373
+ label: { zh: 'Gruvbox 浅色', en: 'Gruvbox Light' },
374
+ kind: 'light',
375
+ colors: {
376
+ bg: '#fbf1c7',
377
+ fg: '#3c3836',
378
+ gutterBg: '#f2e5bc',
379
+ gutterFg: '#a89984',
380
+ border: '#ebdbb2',
381
+ selection: '#d5c4a1',
382
+ lineHighlight: '#f2e5bc',
383
+ caret: '#3c3836',
384
+ keyword: '#9d0006',
385
+ string: '#79740e',
386
+ comment: '#928374',
387
+ number: '#8f3f71',
388
+ functionName: '#b57614',
389
+ typeName: '#076678',
390
+ operator: '#af3a03',
391
+ punctuation: '#7c6f64',
392
+ plain: '#3c3836'
393
+ }
394
+ },
395
+ {
396
+ id: 'ayu-dark',
397
+ label: { zh: 'Ayu 深色', en: 'Ayu Dark' },
398
+ kind: 'dark',
399
+ colors: {
400
+ bg: '#0b0e14',
401
+ fg: '#bfbdb6',
402
+ gutterBg: '#0d1017',
403
+ gutterFg: '#475266',
404
+ border: '#1b1f29',
405
+ selection: '#273747',
406
+ lineHighlight: '#131721',
407
+ caret: '#e6b450',
408
+ keyword: '#ff8f40',
409
+ string: '#aad94c',
410
+ comment: '#626a73',
411
+ number: '#d2a6ff',
412
+ functionName: '#ffb454',
413
+ typeName: '#39bae6',
414
+ operator: '#f29668',
415
+ punctuation: '#bfbdb6',
416
+ plain: '#bfbdb6'
417
+ }
418
+ },
419
+ {
420
+ id: 'ayu-light',
421
+ label: { zh: 'Ayu 浅色', en: 'Ayu Light' },
422
+ kind: 'light',
423
+ colors: {
424
+ bg: '#fafafa',
425
+ fg: '#5c6166',
426
+ gutterBg: '#f3f4f4',
427
+ gutterFg: '#a0a6ab',
428
+ border: '#e7e8e9',
429
+ selection: '#d1e4f4',
430
+ lineHighlight: '#f0f1f1',
431
+ caret: '#ff6a00',
432
+ keyword: '#fa8d3e',
433
+ string: '#86b300',
434
+ comment: '#787b80',
435
+ number: '#a37acc',
436
+ functionName: '#f2ae49',
437
+ typeName: '#55b4d4',
438
+ operator: '#ed9366',
439
+ punctuation: '#5c6166',
440
+ plain: '#5c6166'
441
+ }
298
442
  }
299
443
  ]
300
444
 
@@ -310,6 +454,9 @@ const EDITOR_THEME_FAMILIES = [
310
454
  { id: 'vscode', label: { zh: 'VS Code Dark+ / Light+', en: 'VS Code Dark+ / Light+' }, light: 'vs-light', dark: 'vs-dark' },
311
455
  { id: 'xcode', label: { zh: 'Xcode Light / Dark', en: 'Xcode Light / Dark' }, light: 'xcode-light', dark: 'xcode-dark' },
312
456
  { id: 'catppuccin', label: { zh: 'Catppuccin Latte / Mocha', en: 'Catppuccin Latte / Mocha' }, light: 'catppuccin-latte', dark: 'catppuccin-mocha' },
457
+ { id: 'tokyo', label: { zh: 'Tokyo Night', en: 'Tokyo Night' }, light: 'tokyo-night-light', dark: 'tokyo-night' },
458
+ { id: 'gruvbox', label: { zh: 'Gruvbox', en: 'Gruvbox' }, light: 'gruvbox-light', dark: 'gruvbox-dark' },
459
+ { id: 'ayu', label: { zh: 'Ayu', en: 'Ayu' }, light: 'ayu-light', dark: 'ayu-dark' },
313
460
  ]
314
461
 
315
462
  // 0.5.3: every family needs both a light and a dark variant. The extra
@@ -1954,7 +2101,10 @@ function attributeViolation(name, value, tagName) {
1954
2101
  // Remote workspaces get their own page kind: the two modes show different
1955
2102
  // trees (local ⇄ remote pair vs. a plain remote root), so a session must be
1956
2103
  // able to hold both, and each one filters its own workspace list.
1957
- var REMOTE_TREE_TAB_TYPE = 'dsh-remote-workspace';
2104
+ var REMOTE_TREE_TAB_TYPE = 'dsh-remote-workspace'
2105
+ // The DSH settings dialog only exists in the desktop shell, so the web build
2106
+ // had no way to reach these switches. This tab is our own surface for them.
2107
+ var SETTINGS_TAB_TYPE = 'dsh-linked-workspace:settings';
1958
2108
  // One tree page; a folder with 20k entries must not render 20k rows.
1959
2109
  var TREE_PAGE_SIZE = 500;
1960
2110
  var TREE_PAGE_MAX = 5000;
@@ -1978,7 +2128,8 @@ function attributeViolation(name, value, tagName) {
1978
2128
  var remotePlaceholderKeys = new Set();
1979
2129
  var remoteWorkspaceKeys = new Set();
1980
2130
  var linkedTabDisposer = null;
1981
- var remoteTabDisposer = null;
2131
+ var remoteTabDisposer = null
2132
+ var settingsTabDisposer = null;
1982
2133
  var syncDirectoryTabsRef = null;
1983
2134
  // Set by the sidebar registration block so the availability refresh can ask
1984
2135
  // the sidebar to rebuild its "+" entries after the workspace lists change.
@@ -2276,7 +2427,7 @@ function attributeViolation(name, value, tagName) {
2276
2427
  searchStop: '停止',
2277
2428
  searchStats: '扫描 {{files}} 个文件 · {{size}}',
2278
2429
  searchStatsSkipped: '跳过 {{count}} 个',
2279
- ctxCopyReference: '复制为 @ 引用',
2430
+ ctxCopyReference: '复制相对地址',
2280
2431
  referenceCopied: '已复制 {{reference}}',
2281
2432
  searchScopeLabel: '范围:{{scope}}',
2282
2433
  findPlaceholder: '查找…',
@@ -2384,6 +2535,9 @@ function attributeViolation(name, value, tagName) {
2384
2535
  themeDark: '深色',
2385
2536
  themeLight: '浅色',
2386
2537
  themeSaved: '主题已保存',
2538
+ themeActiveNow: '当前生效',
2539
+ settingsTabTitle: '联动工作区设置',
2540
+ settingsTabDesc: '主题、远端命令执行、SSH 信任、额外根目录与端口转发,浏览器里也能改。',
2387
2541
  themeModeTitle: '显示模式',
2388
2542
  themeModeHint: '系统模式跟随 DSH 当前的浅色/深色主题;浅色/深色模式强制使用对应配色。',
2389
2543
  themeModeSystem: '系统',
@@ -2521,7 +2675,7 @@ function attributeViolation(name, value, tagName) {
2521
2675
  syncPushing: '正在推送…',
2522
2676
  syncPushed: '已推送 {{pushed}} 个文件',
2523
2677
  syncConflictLeft: '{{count}} 个冲突未处理',
2524
- ctxPushThis: '把这个推送到远端',
2678
+ ctxPushThis: '推送到远端',
2525
2679
  ctxPushSelected: '推送所选的 {{count}} 项到远端',
2526
2680
  syncOnlyConflict: '只看冲突',
2527
2681
  syncLocalTime: '本地 {{when}}',
@@ -2544,6 +2698,9 @@ function attributeViolation(name, value, tagName) {
2544
2698
  autoPushOff: '已关闭:本工作区的改动不会自动推回远端',
2545
2699
  execWorkspacesShow: '展开(已选 {{count}} 个)',
2546
2700
  execWorkspacesHide: '收起',
2701
+ knownKeysShow: '展开({{count}} 条)',
2702
+ knownKeysHide: '收起',
2703
+ knownKeysCount: '{{count}} 条已知主机密钥',
2547
2704
  reconnect: '重新连接',
2548
2705
  reconnecting: '正在连接…',
2549
2706
  reconnectOk: '已重新连接',
@@ -2582,6 +2739,8 @@ function attributeViolation(name, value, tagName) {
2582
2739
  forwardAdd: '开一条隧道',
2583
2740
  forwardStop: '停止',
2584
2741
  forwardOpen: '打开',
2742
+ forwardStuck: '端口被占用,未监听',
2743
+ forwardStuckHint: '本机端口被占用,重启 Host 时没能恢复;点「停止」删掉它,再重新开一条即可。',
2585
2744
  forwardEmpty: '还没有隧道。',
2586
2745
  forwardAdded: '隧道已开启:{{url}}',
2587
2746
  forwardStopped: '隧道已停止',
@@ -2623,6 +2782,7 @@ function attributeViolation(name, value, tagName) {
2623
2782
  localTree: '本地目录',
2624
2783
  openFailed: '打开失败',
2625
2784
  copyPathDone: '已复制路径',
2785
+ addressCopied: '已复制:{{address}}',
2626
2786
  mirrorAutoHint: '开启后每 5 分钟自动检查远端与 .remote 的差异并修复。',
2627
2787
  ctxTransfer: '传输(下载到 .remote)',
2628
2788
  ctxTransferLocal: '传输(到远程目录)',
@@ -2632,7 +2792,10 @@ function attributeViolation(name, value, tagName) {
2632
2792
  ctxNotepad: '用记事本打开副本(不回写)',
2633
2793
  ctxCopy: '复制',
2634
2794
  ctxPaste: '粘贴',
2635
- ctxCopyPath: '复制路径',
2795
+ ctxCopyPath: '复制绝对地址',
2796
+ remoteRefSection: '远程工作区',
2797
+ addressRefSection: '按地址链接',
2798
+ addressLinkHint: '把这个地址变成引用',
2636
2799
  ctxRename: '重命名',
2637
2800
  ctxDelete: '删除',
2638
2801
  ctxChmod: '更改权限',
@@ -2853,7 +3016,7 @@ function attributeViolation(name, value, tagName) {
2853
3016
  searchStop: 'Stop',
2854
3017
  searchStats: 'Scanned {{files}} files · {{size}}',
2855
3018
  searchStatsSkipped: '{{count}} skipped',
2856
- ctxCopyReference: 'Copy as @ reference',
3019
+ ctxCopyReference: 'Copy relative address',
2857
3020
  referenceCopied: 'Copied {{reference}}',
2858
3021
  searchScopeLabel: 'Scope: {{scope}}',
2859
3022
  findPlaceholder: 'Find…',
@@ -2961,6 +3124,9 @@ function attributeViolation(name, value, tagName) {
2961
3124
  themeDark: 'Dark',
2962
3125
  themeLight: 'Light',
2963
3126
  themeSaved: 'Theme saved',
3127
+ themeActiveNow: 'Active now',
3128
+ settingsTabTitle: 'Linked workspace settings',
3129
+ settingsTabDesc: 'Themes, remote exec, SSH trust, extra roots and port forwarding — editable in the browser too.',
2964
3130
  themeModeTitle: 'Appearance',
2965
3131
  themeModeHint: 'System follows the current DSH light/dark theme; Light and Dark force the matching palette.',
2966
3132
  themeModeSystem: 'System',
@@ -3098,7 +3264,7 @@ function attributeViolation(name, value, tagName) {
3098
3264
  syncPushing: 'Pushing…',
3099
3265
  syncPushed: 'Pushed {{pushed}} file(s)',
3100
3266
  syncConflictLeft: '{{count}} conflict(s) left',
3101
- ctxPushThis: 'Push this to the remote side',
3267
+ ctxPushThis: 'Push to the remote',
3102
3268
  ctxPushSelected: 'Push the {{count}} selected to the remote',
3103
3269
  syncOnlyConflict: 'Conflicts only',
3104
3270
  syncLocalTime: 'local {{when}}',
@@ -3121,6 +3287,9 @@ function attributeViolation(name, value, tagName) {
3121
3287
  autoPushOff: 'off: local edits in this workspace stay local',
3122
3288
  execWorkspacesShow: 'Show ({{count}} ticked)',
3123
3289
  execWorkspacesHide: 'Hide',
3290
+ knownKeysShow: 'Show ({{count}})',
3291
+ knownKeysHide: 'Hide',
3292
+ knownKeysCount: '{{count}} known host keys',
3124
3293
  reconnect: 'Reconnect',
3125
3294
  reconnecting: 'Connecting…',
3126
3295
  reconnectOk: 'Reconnected',
@@ -3159,6 +3328,8 @@ function attributeViolation(name, value, tagName) {
3159
3328
  forwardAdd: 'Open a tunnel',
3160
3329
  forwardStop: 'Stop',
3161
3330
  forwardOpen: 'Open',
3331
+ forwardStuck: 'Port busy, not listening',
3332
+ forwardStuckHint: 'Another program held the local port when the Host restarted; stop this entry and open a new one.',
3162
3333
  forwardEmpty: 'No tunnels yet.',
3163
3334
  forwardAdded: 'Tunnel open: {{url}}',
3164
3335
  forwardStopped: 'Tunnel stopped',
@@ -3200,6 +3371,7 @@ function attributeViolation(name, value, tagName) {
3200
3371
  localTree: 'Local directory',
3201
3372
  openFailed: 'Could not open',
3202
3373
  copyPathDone: 'Path copied',
3374
+ addressCopied: 'Copied: {{address}}',
3203
3375
  mirrorAutoHint: 'When enabled, differences between the remote tree and .remote are checked and repaired every 5 minutes.',
3204
3376
  ctxTransfer: 'Transfer (download to .remote)',
3205
3377
  ctxTransferLocal: 'Transfer (to remote directory)',
@@ -3209,7 +3381,10 @@ function attributeViolation(name, value, tagName) {
3209
3381
  ctxNotepad: 'Open a copy in Notepad (edits are not written back)',
3210
3382
  ctxCopy: 'Copy',
3211
3383
  ctxPaste: 'Paste',
3212
- ctxCopyPath: 'Copy path',
3384
+ ctxCopyPath: 'Copy absolute address',
3385
+ remoteRefSection: 'Remote workspace',
3386
+ addressRefSection: 'Link an address',
3387
+ addressLinkHint: 'Turn this address into a reference',
3213
3388
  ctxRename: 'Rename',
3214
3389
  ctxDelete: 'Delete',
3215
3390
  ctxChmod: 'Change permissions',
@@ -3366,7 +3541,7 @@ function attributeViolation(name, value, tagName) {
3366
3541
  * Host methods the running DSH process does not have yet, the directory
3367
3542
  * pane says so instead of surfacing an unrelated error.
3368
3543
  */
3369
- var HOST_API_REVISION = 9;
3544
+ var HOST_API_REVISION = 10;
3370
3545
  var hostInfoProbe = null;
3371
3546
 
3372
3547
  function probeHostInfo() {
@@ -3687,7 +3862,7 @@ function attributeViolation(name, value, tagName) {
3687
3862
  '.rw-btn-danger{color:var(--dsw-alias-state-error-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 40%,transparent)}',
3688
3863
  '.rw-btn-sm{height:26px;padding:0 9px;font-size:12px;border-radius:7px}',
3689
3864
  '.rw-group{display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-layer-2)}',
3690
- '.rw-group-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}',
3865
+ '.rw-group-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}',
3691
3866
  '.rw-group-title{font-size:14px;line-height:22px;font-weight:600;color:var(--dsw-alias-label-primary)}',
3692
3867
  '.rw-group-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}',
3693
3868
  '.rw-list{display:flex;flex-direction:column;gap:10px}',
@@ -3764,6 +3939,8 @@ function attributeViolation(name, value, tagName) {
3764
3939
  '.rw-editor-pane{display:flex;flex-direction:column;flex:1 1 auto;min-width:0;min-height:0;border-left:1px solid var(--dsw-alias-border-l1)}',
3765
3940
  '.rw-tree-scroll{flex:1 1 auto;min-height:0;overflow:auto;padding:8px}',
3766
3941
  '.rw-tree-toolbar{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l1);min-width:0}',
3942
+ '.rw-settings-tab{height:100%;overflow:auto;padding:16px;box-sizing:border-box}',
3943
+ '.rw-settings-tab .rw-root{max-width:none}',
3767
3944
  '.rw-tree-toolbar-title{font-size:12px;line-height:18px;font-weight:600;color:var(--dsw-alias-label-secondary);flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
3768
3945
  '.rw-icon-btn{display:inline-flex;align-items:center;justify-content:center;flex:none;width:24px;height:24px;border-radius:6px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer}',
3769
3946
  '.rw-icon-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12));color:var(--dsw-alias-label-primary)}',
@@ -3826,7 +4003,14 @@ function attributeViolation(name, value, tagName) {
3826
4003
  '.rw-theme-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:10px}',
3827
4004
  '.rw-theme-card{display:flex;flex-direction:column;gap:6px;padding:8px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1);cursor:pointer;font:inherit;color:inherit;text-align:left}',
3828
4005
  '.rw-theme-card.is-on{border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 1px color-mix(in srgb,var(--dsw-alias-brand-primary) 45%,transparent)}',
3829
- '.rw-theme-preview{display:flex;align-items:center;justify-content:space-between;gap:6px;height:44px;padding:0 10px;border-radius:7px;font-family:ui-monospace,"Cascadia Code",Consolas,monospace;font-size:11px;overflow:hidden}',
4006
+ '.rw-theme-preview{display:flex;flex-direction:column;gap:3px;height:52px}',
4007
+ '.rw-theme-band{display:flex;align-items:center;gap:5px;flex:1;min-height:0;padding:0 8px;border:1px solid transparent;border-radius:6px;font-family:ui-monospace,"Cascadia Code",Consolas,monospace;font-size:11px;line-height:1;overflow:hidden}',
4008
+ '.rw-theme-aa{font-weight:600;margin-right:auto;letter-spacing:.02em}',
4009
+ '.rw-theme-dot{width:7px;height:7px;border-radius:50%;flex:none;opacity:.9}',
4010
+ '.rw-theme-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
4011
+ '.rw-theme-check{color:var(--dsw-alias-brand-primary);font-weight:700;flex:none}',
4012
+ '.rw-theme-card:hover{border-color:var(--dsw-alias-border-l3,rgba(127,127,127,.4));background:var(--dsw-alias-bg-layer-1)}',
4013
+ '.rw-theme-card.is-on:hover{border-color:var(--dsw-alias-brand-primary)}',
3830
4014
  '.rw-theme-label{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:12px;line-height:18px}',
3831
4015
  '.rw-theme-kind{font-size:10px;line-height:14px;padding:0 4px;border-radius:3px;border:1px solid currentColor;color:var(--dsw-alias-label-tertiary)}',
3832
4016
  '.rw-tabs{display:flex;gap:4px;padding:3px;border-radius:9px;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1)}',
@@ -3857,7 +4041,9 @@ function attributeViolation(name, value, tagName) {
3857
4041
  '.rw-sync-tag{flex:none;min-width:52px;color:rgb(150,150,152)}',
3858
4042
  '.rw-sync-path{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--dsw-font-mono,monospace)}',
3859
4043
  '.rw-autopush-list{width:100%;resize:vertical;font-family:var(--dsw-font-mono,monospace);font-size:12px}',
3860
- '.rw-autopush-card{margin-top:8px;padding-top:8px;border-top:1px solid var(--dsw-alias-separator,rgba(127,127,127,0.18))}',
4044
+ '.rw-setting-label{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#8b949e);flex:none;white-space:nowrap}',
4045
+ '.rw-autopush-card{margin-top:2px;padding-top:12px;border-top:1px solid var(--dsw-alias-separator,rgba(127,127,127,0.18))}',
4046
+ '.rw-autopush-head{display:flex;align-items:center;gap:8px;min-width:0}',
3861
4047
  '.rw-autopush-row{display:flex;align-items:center;gap:8px;margin-top:8px}',
3862
4048
  '.rw-known-keys{display:flex;flex-direction:column;gap:6px;margin-top:8px}',
3863
4049
  '.rw-known-key{display:flex;align-items:center;gap:10px}',
@@ -4005,9 +4191,10 @@ function attributeViolation(name, value, tagName) {
4005
4191
  '.rw-placeholder-hint{font-size:11.5px;line-height:17px}',
4006
4192
  '.rw-tree-toolbar-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
4007
4193
  '.rw-mode-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}',
4008
- '.rw-mode-card{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;text-align:left}',
4194
+ '.rw-mode-card{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:3px;min-height:58px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;text-align:left}',
4009
4195
  '.rw-mode-card:hover{border-color:var(--dsw-alias-border-l3,rgba(127,127,127,.4))}',
4010
4196
  '.rw-mode-card.is-on{border-color:var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 9%,transparent)}',
4197
+ '.rw-mode-card.is-on .rw-mode-name{color:var(--dsw-alias-brand-primary)}',
4011
4198
  '.rw-mode-name{font-size:12px;font-weight:600;line-height:17px}',
4012
4199
  '.rw-mode-desc{font-size:10.5px;line-height:14px;color:var(--dsw-alias-label-tertiary)}',
4013
4200
  '.rw-ctx-menu{position:fixed;min-width:214px;max-height:min(70vh,520px);overflow:auto;padding:4px 0;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-overlay);box-shadow:0 12px 36px rgba(0,0,0,.3);z-index:71;font-size:12px;user-select:none}',
@@ -4218,6 +4405,34 @@ function attributeViolation(name, value, tagName) {
4218
4405
  var HOVER_LINE_ATTR = 'data-lw-hover-line';
4219
4406
  var hoverCardObserver = null;
4220
4407
  var hoverCardState = typeof WeakMap === 'function' ? new WeakMap() : null;
4408
+ // Document panes unmount whenever another tab becomes active, so the view mode
4409
+ // (preview or edit) and the reading position have to live outside the component.
4410
+ var viewMemory = typeof Map === 'function' ? new Map() : null;
4411
+
4412
+ function recallView(key) {
4413
+ if (!viewMemory || !key) return null;
4414
+ return viewMemory.get(key) || null;
4415
+ }
4416
+
4417
+ function rememberView(key, next) {
4418
+ if (!viewMemory || !key || !next) return;
4419
+ viewMemory.set(key, Object.assign({}, viewMemory.get(key) || {}, next));
4420
+ }
4421
+
4422
+ // The directory tab is torn down whenever another session takes focus, so the
4423
+ // open file tabs and the two trees (expansion + already listed entries) are
4424
+ // kept per session here: switching sessions and coming back must look untouched.
4425
+ var panelMemory = typeof Map === 'function' ? new Map() : null;
4426
+
4427
+ function recallPanel(key) {
4428
+ if (!panelMemory || !key) return null;
4429
+ return panelMemory.get(key) || null;
4430
+ }
4431
+
4432
+ function rememberPanel(key, next) {
4433
+ if (!panelMemory || !key || !next) return;
4434
+ panelMemory.set(key, Object.assign({}, panelMemory.get(key) || {}, next));
4435
+ }
4221
4436
 
4222
4437
  function clearHoverLines(card) {
4223
4438
  var injected = card.querySelectorAll('[' + HOVER_LINE_ATTR + ']');
@@ -4746,15 +4961,25 @@ function attributeViolation(name, value, tagName) {
4746
4961
  props.text ? h('span', null, props.text) : null);
4747
4962
  }
4748
4963
 
4964
+ // Each card previews both halves of the pair, so a light theme and its dark
4965
+ // companion are recognisable without switching the app mode first.
4749
4966
  function ThemeSwatch(props) {
4750
- var theme = props.theme;
4751
- var c = theme.colors;
4752
- return h('div', {
4753
- className: 'rw-theme-preview',
4754
- style: { background: c.bg, color: c.fg, border: '1px solid ' + c.border },
4755
- },
4756
- h('span', { style: { color: c.comment } }, '// remote'),
4757
- h('span', { style: { color: c.keyword, fontWeight: 600 } }, '✓'));
4967
+ function band(theme, key) {
4968
+ var c = theme.colors;
4969
+ return h('span', {
4970
+ key: key,
4971
+ className: 'rw-theme-band',
4972
+ style: { background: c.bg, color: c.fg, borderColor: c.border },
4973
+ },
4974
+ h('span', { className: 'rw-theme-aa', style: { color: c.fg } }, 'Aa'),
4975
+ h('span', { className: 'rw-theme-dot', style: { background: c.keyword } }),
4976
+ h('span', { className: 'rw-theme-dot', style: { background: c.string } }),
4977
+ h('span', { className: 'rw-theme-dot', style: { background: c.functionName } }),
4978
+ h('span', { className: 'rw-theme-dot', style: { background: c.comment } }));
4979
+ }
4980
+ return h('span', { className: 'rw-theme-preview' },
4981
+ band(props.light, 'light'),
4982
+ band(props.dark, 'dark'));
4758
4983
  }
4759
4984
 
4760
4985
  // ── local / remote path pickers ────────────────────────────────────────
@@ -5969,16 +6194,35 @@ function attributeViolation(name, value, tagName) {
5969
6194
  var t = props.t;
5970
6195
  var locale = props.locale;
5971
6196
  var rootPath = props.rootPath;
6197
+ var rememberedTree = recallPanel(props.memoryKey);
5972
6198
  var expandedState = useState(function () {
5973
6199
  var set = new Set();
5974
6200
  set.add(rootPath);
6201
+ if (rememberedTree && Array.isArray(rememberedTree.expanded)) {
6202
+ rememberedTree.expanded.forEach(function (item) { if (item) set.add(item); });
6203
+ }
5975
6204
  return set;
5976
6205
  });
5977
6206
  var expanded = expandedState[0];
5978
6207
  var setExpanded = expandedState[1];
5979
- var cacheState = useState({ entries: new Map() });
6208
+ var cacheState = useState(function () {
6209
+ var entries = new Map();
6210
+ if (rememberedTree && Array.isArray(rememberedTree.entries)) {
6211
+ rememberedTree.entries.forEach(function (pair) {
6212
+ if (pair && pair.length === 2) entries.set(pair[0], pair[1]);
6213
+ });
6214
+ }
6215
+ return { entries: entries };
6216
+ });
5980
6217
  var cache = cacheState[0];
5981
6218
  var setCache = cacheState[1];
6219
+
6220
+ useEffect(function () {
6221
+ rememberPanel(props.memoryKey, {
6222
+ expanded: Array.from(expanded),
6223
+ entries: Array.from(cache.entries.entries()),
6224
+ });
6225
+ }, [expanded, cache]);
5982
6226
  var pending = useRef(new Set());
5983
6227
  var lastRefreshAt = useRef(new Map());
5984
6228
 
@@ -6180,6 +6424,22 @@ function attributeViolation(name, value, tagName) {
6180
6424
  props.on ? h('span', { style: { display: 'inline-flex' } }, IconCheck(12)) : null);
6181
6425
  }
6182
6426
 
6427
+ function openPluginSettings(ctx) {
6428
+ var sidebar = sidebarService(ctx);
6429
+ if (!sidebar || typeof sidebar.openTab !== 'function') return;
6430
+ sidebar.openTab({
6431
+ type: SETTINGS_TAB_TYPE,
6432
+ id: SETTINGS_TAB_TYPE,
6433
+ title: makeT(readLocale(ctx))('settingsTabTitle'),
6434
+ path: '/',
6435
+ meta: {},
6436
+ });
6437
+ }
6438
+
6439
+ function PluginSettingsTab(props) {
6440
+ return h('div', { className: 'rw-settings-tab' }, h(ConnectionsPage, { ctx: props.ctx }));
6441
+ }
6442
+
6183
6443
  function LinkedDirectoryToolbar(props) {
6184
6444
  var t = props.t;
6185
6445
  var menuState = useState(null);
@@ -6193,6 +6453,12 @@ function attributeViolation(name, value, tagName) {
6193
6453
  return h('div', { className: 'rw-linked-toolbar' },
6194
6454
  h('span', { className: 'rw-tree-toolbar-title' }, props.title || t('tabTitle')),
6195
6455
  h('div', { className: 'rw-actions', style: { marginLeft: 'auto', gap: 2 } },
6456
+ h('button', {
6457
+ type: 'button',
6458
+ className: 'rw-icon-btn',
6459
+ title: t('settingsTabTitle'),
6460
+ onClick: function () { if (props.onSettings) props.onSettings(); },
6461
+ }, IconSettingsNav(14)),
6196
6462
  h('div', { className: 'rw-menu-wrap' },
6197
6463
  h('button', {
6198
6464
  type: 'button',
@@ -6462,10 +6728,41 @@ function attributeViolation(name, value, tagName) {
6462
6728
  function ContextMenu(props) {
6463
6729
  var menu = props.menu;
6464
6730
  var items = props.items;
6465
- var style = {
6466
- left: Math.max(8, Math.min(menu.x, window.innerWidth - 260)),
6467
- top: Math.max(8, Math.min(menu.y, window.innerHeight - Math.min(420, items.length * 28 + 40))),
6468
- };
6731
+ // The old clamp guessed the height from the item count, so a long menu on a
6732
+ // short window ran past the bottom edge and lost its last entries. Measure
6733
+ // the real box instead: flip above the pointer when there is more room up
6734
+ // there, otherwise cap the height and scroll inside.
6735
+ var boxRef = useRef(null);
6736
+ var placedState = useState(null);
6737
+ var placed = placedState[0];
6738
+ var setPlaced = placedState[1];
6739
+ var style = placed
6740
+ ? { left: placed.left, top: placed.top, maxHeight: placed.maxHeight }
6741
+ : { left: Math.max(8, Math.min(menu.x, window.innerWidth - 260)), top: menu.y, visibility: 'hidden' };
6742
+ useEffect(function () {
6743
+ var node = boxRef.current;
6744
+ if (!node) return;
6745
+ var margin = 8;
6746
+ var width = node.offsetWidth;
6747
+ var height = node.offsetHeight;
6748
+ var vw = window.innerWidth;
6749
+ var vh = window.innerHeight;
6750
+ var left = Math.max(margin, Math.min(menu.x, vw - width - margin));
6751
+ var spaceBelow = vh - menu.y - margin;
6752
+ var spaceAbove = menu.y - margin;
6753
+ var top = menu.y;
6754
+ var maxHeight = height;
6755
+ if (height > spaceBelow) {
6756
+ if (spaceAbove > spaceBelow) {
6757
+ maxHeight = Math.min(height, spaceAbove);
6758
+ top = Math.max(margin, menu.y - maxHeight);
6759
+ } else {
6760
+ maxHeight = Math.max(160, spaceBelow);
6761
+ top = menu.y;
6762
+ }
6763
+ }
6764
+ setPlaced({ left: left, top: top, maxHeight: maxHeight });
6765
+ }, [menu.x, menu.y, items.length]);
6469
6766
  useEffect(function () {
6470
6767
  function onKey(event) { if (event.key === 'Escape') props.onClose(); }
6471
6768
  window.addEventListener('keydown', onKey);
@@ -6499,6 +6796,7 @@ function attributeViolation(name, value, tagName) {
6499
6796
  onContextMenu: function (event) { event.preventDefault(); props.onClose(); },
6500
6797
  }, h('div', {
6501
6798
  className: 'rw-ctx-menu',
6799
+ ref: boxRef,
6502
6800
  style: style,
6503
6801
  onMouseDown: function (event) { event.stopPropagation(); },
6504
6802
  }, items.map(renderItem)));
@@ -7212,15 +7510,23 @@ function rememberShowHidden(value) {
7212
7510
  var onSaved = props.onSaved;
7213
7511
  var settings = useRuntimeSettings();
7214
7512
  var kind = documentKindOf(path);
7513
+ var viewKey = (local ? 'local' : ((scope && scope.kind ? scope.kind : 'remote') + ':' + ((scope && scope.id) || ''))) + '|' + path;
7514
+ var rememberedView = recallView(viewKey);
7215
7515
  var stateRef = useState({
7216
7516
  loading: true, error: '', data: null, text: '', dirty: false, saving: false,
7217
- preview: false, html: '', previewLoading: false, page: 0, sheet: 0, slide: 0,
7517
+ preview: rememberedView ? rememberedView.preview === true : kind === 'markdown',
7518
+ html: '', previewLoading: false,
7519
+ page: rememberedView ? Number(rememberedView.page) || 0 : 0,
7520
+ sheet: rememberedView ? Number(rememberedView.sheet) || 0 : 0,
7521
+ slide: rememberedView ? Number(rememberedView.slide) || 0 : 0,
7218
7522
  updates: {}, pptxUpdates: {}, rotations: {}, deleted: {}, pdfLoading: false, notice: '',
7219
7523
  findOpen: false, findQuery: '', findIndex: 0,
7220
7524
  });
7221
7525
  var state = stateRef[0];
7222
7526
  var setState = stateRef[1];
7223
7527
  var docTextareaRef = useRef(null);
7528
+ var docBodyRef = useRef(null);
7529
+ var docPreviewRef = useRef(null);
7224
7530
 
7225
7531
  function patch(next) {
7226
7532
  setState(function (previous) { return Object.assign({}, previous, next); });
@@ -7234,10 +7540,15 @@ function rememberShowHidden(value) {
7234
7540
  function load() {
7235
7541
  patch({ loading: true, error: '', notice: '' });
7236
7542
  apiCall('docs.read', params()).then(function (result) {
7543
+ var remembered = recallView(viewKey);
7237
7544
  patch({
7238
7545
  loading: false, error: '', data: result,
7239
7546
  text: result.kind === 'markdown' ? String(result.text || '') : '',
7240
- preview: false, html: '', page: 0, sheet: 0, slide: 0,
7547
+ preview: remembered ? remembered.preview === true : kind === 'markdown',
7548
+ html: '', previewLoading: false,
7549
+ page: remembered ? Number(remembered.page) || 0 : 0,
7550
+ sheet: remembered ? Number(remembered.sheet) || 0 : 0,
7551
+ slide: remembered ? Number(remembered.slide) || 0 : 0,
7241
7552
  updates: {}, pptxUpdates: {}, rotations: {}, deleted: {}, pdfLoading: false, dirty: false,
7242
7553
  });
7243
7554
  }).catch(function (error) {
@@ -7247,6 +7558,39 @@ function rememberShowHidden(value) {
7247
7558
 
7248
7559
  useEffect(function () { load(); }, [path, local, scope && scope.kind, scope && scope.id]);
7249
7560
 
7561
+ useEffect(function () {
7562
+ if (state.loading) return;
7563
+ rememberView(viewKey, { preview: state.preview === true, page: state.page, sheet: state.sheet, slide: state.slide });
7564
+ }, [state.loading, state.preview, state.page, state.sheet, state.slide]);
7565
+
7566
+ useEffect(function () {
7567
+ if (state.loading) return;
7568
+ var remembered = recallView(viewKey);
7569
+ var top = remembered ? Number(remembered.scrollTop) || 0 : 0;
7570
+ var body = docBodyRef.current;
7571
+ if (body) body.scrollTop = top;
7572
+ var preview = docPreviewRef.current;
7573
+ if (preview) preview.scrollTop = top;
7574
+ var area = docTextareaRef.current;
7575
+ if (area) area.scrollTop = top;
7576
+ }, [state.loading, state.preview, state.html, state.previewLoading]);
7577
+
7578
+ function rememberScroll(event) {
7579
+ var node = event && event.currentTarget;
7580
+ if (!node) return;
7581
+ rememberView(viewKey, { scrollTop: node.scrollTop });
7582
+ }
7583
+
7584
+ useEffect(function () {
7585
+ if (state.loading || !state.preview || kind !== 'markdown' || state.html || state.previewLoading) return;
7586
+ patch({ previewLoading: true });
7587
+ apiCall('docs.mdPreview', params({ text: state.text })).then(function (result) {
7588
+ patch({ previewLoading: false, html: sanitizeDocumentHtml(result.html) });
7589
+ }).catch(function (error) {
7590
+ patch({ previewLoading: false, error: messageOf(error, t, locale) });
7591
+ });
7592
+ }, [state.loading, state.preview, state.html, state.previewLoading]);
7593
+
7250
7594
  useEffect(function () {
7251
7595
  if (typeof props.onDirtyChange === 'function') props.onDirtyChange(state.dirty);
7252
7596
  }, [state.dirty]);
@@ -7452,10 +7796,10 @@ function rememberShowHidden(value) {
7452
7796
  var body = null;
7453
7797
  if (kind === 'markdown') {
7454
7798
  body = state.preview
7455
- ? h('div', { className: 'rw-doc-body' },
7799
+ ? h('div', { className: 'rw-doc-body', ref: docBodyRef, onScroll: rememberScroll },
7456
7800
  state.previewLoading ? h('div', { className: 'rw-editor-message' }, Spinner(14), t('loading')) : null,
7457
- state.html ? h('div', { className: 'rw-doc-preview', dangerouslySetInnerHTML: { __html: state.html } }) : null)
7458
- : h('div', { className: 'rw-doc-body' },
7801
+ state.html ? h('div', { ref: docPreviewRef, className: 'rw-doc-preview', onScroll: rememberScroll, dangerouslySetInnerHTML: { __html: state.html } }) : null)
7802
+ : h('div', { className: 'rw-doc-body', ref: docBodyRef, onScroll: rememberScroll },
7459
7803
  state.findOpen ? h('div', { className: 'rw-find-bar rw-doc-find' },
7460
7804
  h('input', {
7461
7805
  className: 'rw-input',
@@ -7482,7 +7826,7 @@ function rememberShowHidden(value) {
7482
7826
  : null,
7483
7827
  h('textarea', {
7484
7828
  ref: docTextareaRef,
7485
- className: 'rw-doc-textarea', value: state.text, spellCheck: false,
7829
+ className: 'rw-doc-textarea', value: state.text, spellCheck: false, onScroll: rememberScroll,
7486
7830
  onChange: function (event) { patch({ text: event.currentTarget.value, dirty: true, html: '' }); },
7487
7831
  }));
7488
7832
  } else if (kind === 'pdf' && state.data) {
@@ -7825,12 +8169,24 @@ function rememberShowHidden(value) {
7825
8169
  return function () { alive = false; clearInterval(timer); };
7826
8170
  }, [selected && selected.key, selected && selected.autoPush]);
7827
8171
 
7828
- var openFilesState = useState([]);
8172
+ // Same idea as the trees: the tab strip outlives this component only if it
8173
+ // is remembered per session.
8174
+ var paneMemoryKey = [props.sessionId || '', remoteOnly ? 'remote' : 'linked', pinnedLinkedId, pinnedRemoteId].join('|');
8175
+ var rememberedPane = recallPanel(paneMemoryKey) || {};
8176
+ var openFilesState = useState(function () {
8177
+ return Array.isArray(rememberedPane.openFiles) ? rememberedPane.openFiles.slice() : [];
8178
+ });
7829
8179
  var openFiles = openFilesState[0];
7830
8180
  var setOpenFiles = openFilesState[1];
7831
- var activeFileKeyState = useState('');
8181
+ var activeFileKeyState = useState(function () {
8182
+ return typeof rememberedPane.activeFileKey === 'string' ? rememberedPane.activeFileKey : '';
8183
+ });
7832
8184
  var activeFileKey = activeFileKeyState[0];
7833
8185
  var setActiveFileKey = activeFileKeyState[1];
8186
+
8187
+ useEffect(function () {
8188
+ rememberPanel(paneMemoryKey, { openFiles: openFiles, activeFileKey: activeFileKey });
8189
+ }, [openFiles, activeFileKey]);
7834
8190
  var directoryOpenState = useState(true);
7835
8191
  var directoryOpen = directoryOpenState[0];
7836
8192
  var setDirectoryOpen = directoryOpenState[1];
@@ -8199,15 +8555,17 @@ function rememberShowHidden(value) {
8199
8555
  }
8200
8556
 
8201
8557
  function copyPathToClipboard(text) {
8558
+ var value = String(text == null ? '' : text);
8202
8559
  try {
8203
8560
  if (navigator.clipboard && navigator.clipboard.writeText) {
8204
- navigator.clipboard.writeText(text).then(function () { showNotice('success', t('copyPathDone')); }).catch(function () {});
8561
+ navigator.clipboard.writeText(value).then(function () {
8562
+ showNotice('success', t('addressCopied', { address: value }));
8563
+ }).catch(function () {});
8205
8564
  return;
8206
8565
  }
8207
8566
  } catch (error) { /* clipboard unavailable */ }
8208
8567
  }
8209
8568
 
8210
- /** Copy the `@relative/path` form the model understands for a workspace path. */
8211
8569
  /** Turn an absolute remote path into a workspace-relative one (for linked.plan). */
8212
8570
  function relativeToRemote(filePath) {
8213
8571
  var root = (selected && selected.remotePath) || '';
@@ -8216,24 +8574,27 @@ function rememberShowHidden(value) {
8216
8574
  return relative.replace(/^\/+/, '');
8217
8575
  }
8218
8576
 
8219
- function copyReference(filePath) {
8220
- var scope = sourceScopeOf(selected);
8221
- var root = selected && selected.kind === 'remote' ? selected.remotePath : (selected && selected.remotePath) || '';
8222
- var relative = String(filePath || '');
8223
- if (root && relative.indexOf(root) === 0) {
8224
- relative = relative.slice(root.length);
8225
- if (relative.charAt(0) !== '/') relative = '/' + relative;
8577
+ /**
8578
+ * The row's address relative to the root of the tree it lives in: the local
8579
+ * root for the left tree, the remote root for the right one.
8580
+ */
8581
+ function relativeAddressOf(side, filePath) {
8582
+ var record = selected || {};
8583
+ var root = side === 'local' ? record.localPath : record.remotePath;
8584
+ var text = String(filePath == null ? '' : filePath).replace(/\\/g, '/');
8585
+ var base = String(root == null ? '' : root).replace(/\\/g, '/').replace(/\/+$/, '');
8586
+ if (base !== '' && (text === base || text.indexOf(base + '/') === 0)) {
8587
+ return text.slice(base.length).replace(/^\/+/, '');
8226
8588
  }
8227
- var reference = '@' + relative.replace(/^\/+/, '');
8228
- try {
8229
- if (navigator.clipboard && navigator.clipboard.writeText) {
8230
- navigator.clipboard.writeText(reference).then(function () {
8231
- showNotice('success', t('referenceCopied', { reference: reference }));
8232
- }).catch(function () {});
8233
- return;
8234
- }
8235
- } catch (error) { /* clipboard unavailable */ }
8236
- void scope
8589
+ return text.replace(/^\/+/, '');
8590
+ }
8591
+
8592
+ function copyRelativeAddress(side, filePath) {
8593
+ copyPathToClipboard(relativeAddressOf(side, filePath));
8594
+ }
8595
+
8596
+ function copyAbsoluteAddress(filePath) {
8597
+ copyPathToClipboard(String(filePath == null ? '' : filePath));
8237
8598
  }
8238
8599
 
8239
8600
  /** Copy a ready-made ssh command that lands in the given remote directory. */
@@ -8918,18 +9279,18 @@ function rememberShowHidden(value) {
8918
9279
  } });
8919
9280
  items.push({ label: t('ctxPaste'), disabled: !canPaste, onSelect: function () { pasteEntry(menu); } });
8920
9281
  items.push({ separator: true });
8921
- items.push({ label: t('ctxCopyPath'), onSelect: function () { copyPathToClipboard(menu.path); } });
8922
- items.push({ label: t('ctxCopyReference'), onSelect: function () { copyReference(menu.path); } });
9282
+ items.push({ label: t('ctxCopyPath'), onSelect: function () { copyAbsoluteAddress(menu.path); } });
9283
+ items.push({ label: t('ctxCopyReference'), onSelect: function () { copyRelativeAddress(menu.side, menu.path); } });
8923
9284
  if (menu.side === 'remote' && menu.isDir) {
8924
9285
  items.push({ label: t('ctxCopySsh'), onSelect: function () { copySshCommand(menu.path); } });
8925
9286
  }
8926
- if (selected.kind === 'linked' && menu.side === 'remote') {
8927
- var remoteRoot = selected.remotePath;
8928
- var relativePath = menu.path.indexOf(remoteRoot) === 0
8929
- ? menu.path.slice(remoteRoot.length).replace(/^\/+/, '')
8930
- : '';
8931
- if (relativePath !== '') {
8932
- items.push({ label: t('ctxPushThis'), onSelect: function () { openSyncPlan([relativePath]); } });
9287
+ // Pushing walks the LOCAL tree (linked.plan reports paths relative to the
9288
+ // local root), so the entry belongs on the local side: a remote row would
9289
+ // have to strip the remote root just to rebuild the same string.
9290
+ if (selected.kind === 'linked' && menu.side === 'local') {
9291
+ var localRelative = relativeAddressOf('local', menu.path);
9292
+ if (localRelative !== '') {
9293
+ items.push({ label: t('ctxPushThis'), onSelect: function () { openSyncPlan([localRelative]); } });
8933
9294
  }
8934
9295
  }
8935
9296
  items.push({ separator: true });
@@ -9289,6 +9650,7 @@ function rememberShowHidden(value) {
9289
9650
  scope: scopeRef,
9290
9651
  rootPath: selected.remotePath,
9291
9652
  rootName: t('allFiles'),
9653
+ memoryKey: paneMemoryKey + ':remote',
9292
9654
  t: t,
9293
9655
  locale: locale,
9294
9656
  showHidden: showHidden,
@@ -9313,6 +9675,7 @@ function rememberShowHidden(value) {
9313
9675
  scope: null,
9314
9676
  rootPath: selected.localPath,
9315
9677
  rootName: t('allFiles'),
9678
+ memoryKey: paneMemoryKey + ':local',
9316
9679
  t: t,
9317
9680
  locale: locale,
9318
9681
  showHidden: showHidden,
@@ -9422,6 +9785,7 @@ function rememberShowHidden(value) {
9422
9785
  }
9423
9786
  transferSelection();
9424
9787
  },
9788
+ onSettings: function () { openPluginSettings(props.ctx); },
9425
9789
  onMode: function (next) { setMode(next); },
9426
9790
  onToggleSearch: function () { setSearchOpen(!searchOpen); },
9427
9791
  onOpenMode: updateOpenMode,
@@ -11184,20 +11548,23 @@ function rememberShowHidden(value) {
11184
11548
  })),
11185
11549
  h('div', { className: 'rw-group-head', style: { marginTop: 12 } },
11186
11550
  h('span', { className: 'rw-group-title' }, t('themeSpecific')),
11551
+ h('span', { className: 'rw-chip' }, String(EDITOR_THEME_FAMILIES.length)),
11187
11552
  h('span', { className: 'rw-group-hint' }, t('themeSpecificHint'))),
11188
11553
  h('div', { className: 'rw-theme-grid' },
11189
11554
  EDITOR_THEME_FAMILIES.map(function (family) {
11190
11555
  var active = (settings.editorThemeFamily || 'github') === family.id;
11191
- var variant = getTheme(mode === 'dark' ? family.dark : mode === 'light' ? family.light : (settings.appThemeDark ? family.dark : family.light));
11192
11556
  return h('button', {
11193
11557
  key: family.id,
11194
11558
  type: 'button',
11195
11559
  className: 'rw-theme-card' + (active ? ' is-on' : ''),
11196
11560
  onClick: function () { chooseFamily(family.id); },
11197
11561
  'aria-pressed': active,
11562
+ title: locale === 'zh' ? family.label.zh : family.label.en,
11198
11563
  },
11199
- h(ThemeSwatch, { theme: variant }),
11200
- h('span', { className: 'rw-theme-label' }, h('span', null, locale === 'zh' ? family.label.zh : family.label.en)));
11564
+ h(ThemeSwatch, { light: getTheme(family.light), dark: getTheme(family.dark) }),
11565
+ h('span', { className: 'rw-theme-label' },
11566
+ h('span', { className: 'rw-theme-name' }, locale === 'zh' ? family.label.zh : family.label.en),
11567
+ active ? h('span', { className: 'rw-theme-check', title: t('themeActiveNow') }, '✓') : null));
11201
11568
  })),
11202
11569
  local.message
11203
11570
  ? h(Banner, {
@@ -11530,21 +11897,22 @@ function rememberShowHidden(value) {
11530
11897
  }
11531
11898
 
11532
11899
  var children = [
11533
- h('div', { className: 'rw-meta' },
11534
- h('span', { className: 'rw-chip' }, t('autoPushTitle')),
11535
- h('span', { className: 'rw-hint', style: { flex: '1 1 auto', margin: 0 } }, config.enabled ? t('autoPushOn') : t('autoPushOff')),
11900
+ h('div', { className: 'rw-autopush-head' },
11901
+ h('span', { className: 'rw-setting-label' }, t('autoPushTitle')),
11536
11902
  local.saving ? Spinner(12) : null,
11537
- h(Switch, {
11538
- checked: config.enabled === true,
11539
- onChange: toggle,
11540
- label: t('autoPushLabel'),
11541
- text: t('autoPushLabel'),
11542
- })),
11903
+ h('div', { style: { marginLeft: 'auto', display: 'flex' } },
11904
+ h(Switch, {
11905
+ checked: config.enabled === true,
11906
+ onChange: toggle,
11907
+ label: t('autoPushLabel'),
11908
+ text: t('autoPushLabel'),
11909
+ }))),
11910
+ h('div', { className: 'rw-hint', style: { marginTop: 4 } }, config.enabled ? t('autoPushOn') : t('autoPushOff')),
11543
11911
  ];
11544
11912
 
11545
11913
  if (local.asking && config.enabled !== true) {
11546
11914
  children.push(h('div', { className: 'rw-hint', style: { color: 'rgb(210,153,34)' } }, t('autoPushWarn')));
11547
- children.push(h('div', { className: 'rw-actions', style: { marginTop: 6 } },
11915
+ children.push(h('div', { className: 'rw-actions', style: { marginTop: 6, justifyContent: 'flex-end' } },
11548
11916
  h('button', {
11549
11917
  type: 'button', className: 'rw-btn rw-btn-sm',
11550
11918
  onClick: function () { patchLocal({ asking: false }); },
@@ -11571,10 +11939,11 @@ function rememberShowHidden(value) {
11571
11939
  },
11572
11940
  onBlur: function () { save({ debounceMs: Math.round(Number(local.debounceMs) || 1500) }, t('autoPushSaved')); },
11573
11941
  })));
11574
- children.push(h('div', { className: 'rw-group-head', style: { marginTop: 8 } },
11942
+ children.push(h('div', { className: 'rw-autopush-row' },
11575
11943
  h('span', { className: 'rw-setting-label' }, t('autoPushIncludeLabel'))));
11576
11944
  children.push(h('textarea', {
11577
11945
  className: 'rw-input rw-input-mono rw-autopush-list',
11946
+ style: { marginTop: 6 },
11578
11947
  rows: 2,
11579
11948
  value: local.include,
11580
11949
  placeholder: 'src/**\ndocs/*.md',
@@ -11584,10 +11953,11 @@ function rememberShowHidden(value) {
11584
11953
  },
11585
11954
  onBlur: function () { save({ include: lines(local.include) }, t('autoPushSaved')); },
11586
11955
  }));
11587
- children.push(h('div', { className: 'rw-group-head', style: { marginTop: 8 } },
11956
+ children.push(h('div', { className: 'rw-autopush-row' },
11588
11957
  h('span', { className: 'rw-setting-label' }, t('autoPushExcludeLabel'))));
11589
11958
  children.push(h('textarea', {
11590
11959
  className: 'rw-input rw-input-mono rw-autopush-list',
11960
+ style: { marginTop: 6 },
11591
11961
  rows: 2,
11592
11962
  value: local.exclude,
11593
11963
  placeholder: '*.log\n.remote/**',
@@ -11627,6 +11997,10 @@ function rememberShowHidden(value) {
11627
11997
  var keysState = useState([]);
11628
11998
  var keys = keysState[0];
11629
11999
  var setKeys = keysState[1];
12000
+ // The list is long and rarely needed: keep it folded unless asked for.
12001
+ var keysOpenState = useState(false);
12002
+ var keysOpen = keysOpenState[0];
12003
+ var setKeysOpen = keysOpenState[1];
11630
12004
 
11631
12005
  function refreshKeys() {
11632
12006
  apiCall('hosts.hostKeys', {}).then(function (result) {
@@ -11712,10 +12086,19 @@ function rememberShowHidden(value) {
11712
12086
  h('option', { value: 'utf8' }, t('outputEncodingUtf8')),
11713
12087
  h('option', { value: 'gbk' }, t('outputEncodingGbk')))),
11714
12088
  h('div', { className: 'rw-group-head', style: { marginTop: 14 } },
11715
- h('span', { className: 'rw-group-title' }, t('knownKeysTitle'))),
12089
+ h('span', { className: 'rw-group-title' }, t('knownKeysTitle')),
12090
+ h('button', {
12091
+ type: 'button',
12092
+ className: 'rw-btn rw-btn-ghost rw-btn-sm',
12093
+ onClick: function () { setKeysOpen(function (open) { return !open; }); },
12094
+ }, t(keysOpen ? 'knownKeysHide' : 'knownKeysShow', { count: String(keys.length) }))),
11716
12095
  ];
11717
12096
 
11718
- if (keys.length === 0) {
12097
+ if (!keysOpen) {
12098
+ // Folded: one line that says how many are remembered.
12099
+ children.push(h('div', { className: 'rw-group-hint' },
12100
+ keys.length === 0 ? t('knownKeysEmpty') : t('knownKeysCount', { count: String(keys.length) })));
12101
+ } else if (keys.length === 0) {
11719
12102
  children.push(h('div', { className: 'rw-group-hint' }, t('knownKeysEmpty')));
11720
12103
  } else {
11721
12104
  children.push(h('div', { className: 'rw-known-keys' }, keys.map(function (entry) {
@@ -11913,12 +12296,18 @@ function rememberShowHidden(value) {
11913
12296
  children.push(h('div', { className: 'rw-group-hint', style: { marginTop: 10 } }, t('forwardEmpty')));
11914
12297
  } else {
11915
12298
  children.push(h('div', { className: 'rw-known-keys', style: { marginTop: 10 } }, forwards.map(function (entry) {
12299
+ // A tunnel restored after a Host restart whose port was taken has no
12300
+ // URL: say why instead of offering a dead link.
12301
+ var stuck = entry.url === '';
12302
+ var detail = stuck ? (entry.error || t('forwardStuck')) : entry.url;
11916
12303
  return h('div', { className: 'rw-known-key', key: entry.id },
11917
12304
  h('div', { className: 'rw-known-key-main' },
11918
12305
  h('span', { className: 'rw-known-key-host' }, entry.hostName + ' → ' + entry.remoteHost + ':' + entry.remotePort),
11919
- h('span', { className: 'rw-known-key-fp', title: entry.url }, entry.url)),
12306
+ h('span', { className: 'rw-known-key-fp', title: detail, style: stuck ? { color: 'var(--dsw-alias-state-error-primary, #ff7b72)' } : null }, detail)),
11920
12307
  h('div', { className: 'rw-actions' },
11921
- h('a', { className: 'rw-btn rw-btn-sm', href: entry.url, target: '_blank', rel: 'noreferrer' }, t('forwardOpen')),
12308
+ stuck
12309
+ ? h('span', { className: 'rw-group-hint' }, t('forwardStuckHint'))
12310
+ : h('a', { className: 'rw-btn rw-btn-sm', href: entry.url, target: '_blank', rel: 'noreferrer' }, t('forwardOpen')),
11922
12311
  h('button', { type: 'button', className: 'rw-btn rw-btn-sm', disabled: local.busy, onClick: function () { stop(entry); } }, t('forwardStop'))));
11923
12312
  })));
11924
12313
  }
@@ -12059,6 +12448,146 @@ function rememberShowHidden(value) {
12059
12448
  h('button', { type: 'button', className: 'rw-btn rw-btn-ghost rw-btn-sm', onClick: remote.reload }, IconRefresh(12), t('refresh'))));
12060
12449
  }
12061
12450
 
12451
+ // ── @ references ───────────────────────────────────────────────────────
12452
+
12453
+ // The composer's own @ menu can only list what the host's fileReferences
12454
+ // service knows about, and it has no provider seat. The client does expose
12455
+ // an input-trigger seat though, so this source widens the same menu: a
12456
+ // leading "@" in the query (the user typed "@@") lists the remote tree, and
12457
+ // a query that looks like a path is offered as a reference for that path.
12458
+ function sessionCwdOf(session) {
12459
+ if (!session) return '';
12460
+ if (typeof session.cwd === 'string') return session.cwd;
12461
+ if (session.snapshot && typeof session.snapshot.cwd === 'string') return session.snapshot.cwd;
12462
+ if (session.meta && typeof session.meta.cwd === 'string') return session.meta.cwd;
12463
+ return '';
12464
+ }
12465
+
12466
+ function sessionWorkspaceIdOf(session) {
12467
+ if (!session) return '';
12468
+ if (typeof session.workspaceId === 'string') return session.workspaceId;
12469
+ if (session.snapshot && typeof session.snapshot.workspaceId === 'string') return session.snapshot.workspaceId;
12470
+ if (session.meta && typeof session.meta.workspaceId === 'string') return session.meta.workspaceId;
12471
+ return '';
12472
+ }
12473
+
12474
+ function samePath(left, right) {
12475
+ function norm(value) {
12476
+ return String(value == null ? '' : value).replace(/\\/g, '/').replace(/\/+$/, '').toLowerCase();
12477
+ }
12478
+ var a = norm(left);
12479
+ var b = norm(right);
12480
+ return a !== '' && a === b;
12481
+ }
12482
+
12483
+ function referenceScopeFor(session) {
12484
+ var cwd = sessionCwdOf(session);
12485
+ var workspaceId = sessionWorkspaceIdOf(session);
12486
+ return apiCall('linked.list').catch(function () { return { links: [] }; }).then(function (linked) {
12487
+ var links = (linked && linked.links) || [];
12488
+ for (var index = 0; index < links.length; index += 1) {
12489
+ if (workspaceId && links[index].workspaceId === workspaceId) return { linkedId: links[index].id, root: links[index].remotePath || '' };
12490
+ if (cwd && links[index].localPath && samePath(cwd, links[index].localPath)) return { linkedId: links[index].id, root: links[index].remotePath || '' };
12491
+ }
12492
+ return apiCall('remote_workspaces.list').catch(function () { return { workspaces: [] }; }).then(function (remote) {
12493
+ var list = (remote && remote.workspaces) || [];
12494
+ for (var cursor = 0; cursor < list.length; cursor += 1) {
12495
+ if (workspaceId && list[cursor].workspaceId === workspaceId) return { remoteId: list[cursor].id, root: list[cursor].remotePath || '' };
12496
+ if (cwd && list[cursor].placeholderPath && samePath(cwd, list[cursor].placeholderPath)) return { remoteId: list[cursor].id, root: list[cursor].remotePath || '' };
12497
+ }
12498
+ return null;
12499
+ });
12500
+ });
12501
+ }
12502
+
12503
+ function mentionRefFor(path, isDir) {
12504
+ var text = String(path == null ? '' : path);
12505
+ if (isDir && text.slice(-1) !== '/') text += '/';
12506
+ if (/[\u0000-\u001f\u007f-\u009f"]/u.test(text)) return null;
12507
+ if (!/\s/u.test(text)) return '@' + text;
12508
+ return isDir ? '@"' + text : '@"' + text + '"';
12509
+ }
12510
+
12511
+ function installReferenceTriggers(ctx) {
12512
+ var service = null;
12513
+ try { service = ctx.get('inputTriggers'); } catch (error) { service = null; }
12514
+ if (!service || typeof service.registerSource !== 'function') return;
12515
+ var t = makeT(readLocale(ctx));
12516
+
12517
+ function candidates(session, request) {
12518
+ var query = String((request && request.query) || '');
12519
+ var remoteIntent = query.charAt(0) === '@';
12520
+ var wanted = remoteIntent ? query.slice(1) : query;
12521
+ // A single "@" keeps the stock menu untouched unless the query already
12522
+ // reads like a path, which is the "type an address, get a reference" case.
12523
+ var looksLikePath = wanted.indexOf('/') >= 0 || wanted.indexOf('\\') >= 0 || wanted.charAt(0) === '~';
12524
+ if (!remoteIntent && !looksLikePath) return Promise.resolve([]);
12525
+ if (wanted === '') {
12526
+ if (!remoteIntent) return Promise.resolve([]);
12527
+ }
12528
+ return referenceScopeFor(session).then(function (scope) {
12529
+ if (!scope) return [];
12530
+ var params = { query: wanted, limit: 30 };
12531
+ if (scope.linkedId) params.linkedId = scope.linkedId;
12532
+ if (scope.remoteId) params.remoteId = scope.remoteId;
12533
+ return apiCall('fs.references', params).catch(function () { return { candidates: [] }; }).then(function (result) {
12534
+ var items = (result && result.candidates) || [];
12535
+ return items.map(function (item) {
12536
+ var isDir = item.kind === 'directory';
12537
+ return {
12538
+ name: String(item.path || ''),
12539
+ label: (item.name || String(item.path || '').split('/').pop()) + (isDir ? '/' : ''),
12540
+ description: String(item.path || ''),
12541
+ icon: isDir ? 'folder' : 'file',
12542
+ section: remoteIntent ? t('remoteRefSection') : t('addressRefSection'),
12543
+ hint: remoteIntent ? undefined : t('addressLinkHint'),
12544
+ };
12545
+ }).filter(function (item) { return item.name !== ''; });
12546
+ });
12547
+ });
12548
+ }
12549
+
12550
+ function onPick(pick) {
12551
+ var candidate = (pick && pick.candidate) || {};
12552
+ var path = String(candidate.name || '');
12553
+ if (path === '') return undefined;
12554
+ var isDir = candidate.icon === 'folder';
12555
+ var ref = mentionRefFor(path, isDir);
12556
+ if (!ref) return undefined;
12557
+ var label = isDir ? String(path).replace(/\/+$/, '').split('/').pop() : String(path).split('/').pop();
12558
+ return {
12559
+ insert: {
12560
+ source: 'linked-workspace',
12561
+ ref: ref,
12562
+ label: label || ref,
12563
+ appearance: isDir ? 'folder' : 'file',
12564
+ clipboardText: path,
12565
+ },
12566
+ };
12567
+ }
12568
+
12569
+ var source = {
12570
+ trigger: '@',
12571
+ name: 'linked-workspace',
12572
+ order: 40,
12573
+ showGroupTitle: true,
12574
+ candidates: candidates,
12575
+ onPick: onPick,
12576
+ codec: {
12577
+ clipboardText: function (ref) { return String(ref == null ? '' : ref).replace(/^@/, ''); },
12578
+ serialize: function (ref) { return Promise.resolve(String(ref == null ? '' : ref).replace(/^@/, '')); },
12579
+ },
12580
+ };
12581
+
12582
+ ctx.effect(function () {
12583
+ try {
12584
+ return service.registerSource(source);
12585
+ } catch (error) {
12586
+ return undefined;
12587
+ }
12588
+ }, 'dsh-linked-workspace: @ reference source');
12589
+ }
12590
+
12062
12591
  // ── apply ──────────────────────────────────────────────────────────────
12063
12592
 
12064
12593
  // `sessions` is a core client service (the sidebar shell injects it too):
@@ -12068,6 +12597,7 @@ function rememberShowHidden(value) {
12068
12597
 
12069
12598
  function apply(ctx) {
12070
12599
  ctx.effect(installStyles, 'dsh-linked-workspace: styles');
12600
+ installReferenceTriggers(ctx);
12071
12601
  ctx.effect(function () {
12072
12602
  var lastDark = null;
12073
12603
  var sync = function () {
@@ -12312,6 +12842,29 @@ function rememberShowHidden(value) {
12312
12842
  remoteTabDisposer = null;
12313
12843
  }
12314
12844
 
12845
+ function installSettingsTab(track) {
12846
+ if (settingsTabDisposer !== null) return;
12847
+ settingsTabDisposer = sidebar.registerTab({
12848
+ id: SETTINGS_TAB_TYPE,
12849
+ title: function () { return makeT(readLocale(ctx))('settingsTabTitle'); },
12850
+ description: function () { return makeT(readLocale(ctx))('settingsTabDesc'); },
12851
+ icon: function (size) { return IconSettingsNav(size); },
12852
+ order: 60,
12853
+ single: true,
12854
+ available: function () { return true; },
12855
+ component: function (props) {
12856
+ return h(PluginSettingsTab, Object.assign({}, props, { ctx: ctx }));
12857
+ },
12858
+ });
12859
+ if (track !== false) tabDisposers.push(function () { disposeSettingsTab(); });
12860
+ }
12861
+
12862
+ function disposeSettingsTab() {
12863
+ if (settingsTabDisposer === null) return;
12864
+ try { settingsTabDisposer(); } catch (error) { /* ignore */ }
12865
+ settingsTabDisposer = null;
12866
+ }
12867
+
12315
12868
  // Both page kinds stay registered for the whole session: `available`
12316
12869
  // only greys out the "+" entry for a mismatched session, while
12317
12870
  // `openTab` refuses a kind it has never seen. Registering lazily per
@@ -12329,6 +12882,7 @@ function rememberShowHidden(value) {
12329
12882
  refreshTabVisibilityRef = syncTabVisibility;
12330
12883
  installLinkedTab();
12331
12884
  installRemoteTab();
12885
+ installSettingsTab();
12332
12886
  watchSessionScope();
12333
12887
  syncTabVisibility();
12334
12888
  try {