dsh-gufa-code 1.3.65 → 1.3.67

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/client.js CHANGED
@@ -16,7 +16,7 @@ const GUFA_NS = 'gufa-code'
16
16
  const G = {}
17
17
  G.NS = GUFA_NS
18
18
  /** 客户端构建标记(排查页面是否加载了新代码时看标题栏) */
19
- G.BUILD = '1.3.65'
19
+ G.BUILD = '1.3.67'
20
20
  G.PANEL_ID = 'gufa-code'
21
21
  /** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
22
22
  G.pendingEntryWorkspace = null
@@ -210,11 +210,12 @@ const DICT_ZH = {
210
210
  'search.preserveCase': '保留大小写(AB)',
211
211
  'search.replaceOne': '替换此匹配',
212
212
  'search.dismiss': '忽略此匹配',
213
+ 'search.dismissFile': '忽略该文件的所有匹配',
213
214
  'search.openInEditor': '在编辑器中打开',
214
215
  'search.stale': '匹配位置已变化,已重新搜索',
215
216
  'search.replacePlaceholder': '替换为…',
216
217
  'search.replaceAll': '全部替换',
217
- 'search.replaceThisFile': '替换此文件',
218
+ 'search.replaceThisFile': '替换该文件所有匹配',
218
219
  'search.replacing': '替换中…',
219
220
  'search.confirmReplace': '确定替换 {count} 处({files} 个文件)?直接写文件,编辑器撤销无效。',
220
221
  'search.confirmYes': '确定替换',
@@ -456,11 +457,12 @@ const DICT_EN = {
456
457
  'search.preserveCase': 'Preserve case (AB)',
457
458
  'search.replaceOne': 'Replace this match',
458
459
  'search.dismiss': 'Dismiss this match',
460
+ 'search.dismissFile': 'Dismiss all matches in this file',
459
461
  'search.openInEditor': 'Open in editor',
460
462
  'search.stale': 'Match moved; search refreshed',
461
463
  'search.replacePlaceholder': 'Replace with…',
462
464
  'search.replaceAll': 'Replace all',
463
- 'search.replaceThisFile': 'Replace in this file',
465
+ 'search.replaceThisFile': 'Replace all matches in this file',
464
466
  'search.replacing': 'Replacing…',
465
467
  'search.confirmReplace': 'Replace {count} occurrences in {files} files? This writes files directly; editor undo will not work.',
466
468
  'search.confirmYes': 'Replace',
@@ -1759,6 +1761,10 @@ html[data-platform=darwin][data-fullscreen] .gufa-titlebar{height:44px;padding-l
1759
1761
  .gufa-search-summarybar{display:flex;align-items:center;gap:8px}
1760
1762
  .gufa-search-summarybar .gufa-search-summary{flex:1 1 auto;margin-left:0}
1761
1763
  .gufa-search-summarybar .gufa-search-link{flex:0 0 auto}
1764
+ .gufa-tip{position:fixed;z-index:2147483600;max-width:320px;padding:4px 8px;border-radius:5px;background:#2c2f36;color:#f2f2f2;border:1px solid rgba(255,255,255,.18);font-size:11px;line-height:1.45;white-space:normal;pointer-events:none;box-shadow:0 4px 14px rgba(0,0,0,.4)}
1765
+ .gufa-search-file-dismiss{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-left:2px;border-radius:4px;color:var(--gufa-text-dim);cursor:pointer;opacity:0;transition:opacity .12s ease}
1766
+ .gufa-search-file-head:hover .gufa-search-file-dismiss,.gufa-search-file-head:focus-within .gufa-search-file-dismiss{opacity:1}
1767
+ .gufa-search-file-dismiss:hover{background:var(--gufa-active);color:var(--gufa-text)}
1762
1768
  .gufa-search-link{border:0;background:transparent;color:var(--gufa-accent);font-size:11px;cursor:pointer;padding:0}
1763
1769
  .gufa-search-link:hover{text-decoration:underline}
1764
1770
 
@@ -2197,6 +2203,11 @@ const ICON_PATHS = {
2197
2203
  ['path', { d: 'M12 2.8l1 2.6 2.7.7 2-1.8 2.2 2.2-1.8 2 .7 2.7 2.6 1v3l-2.6 1-.7 2.7 1.8 2-2.2 2.2-2-1.8-2.7.7-1 2.6h-3l-1-2.6-2.7-.7-2 1.8-2.2-2.2 1.8-2-.7-2.7-2.6-1v-3l2.6-1 .7-2.7-1.8-2 2.2-2.2 2 1.8 2.7-.7 1-2.6h3z' }],
2198
2204
  ],
2199
2205
  code: [['path', { d: 'M8.5 6L3 12l5.5 6M15.5 6L21 12l-5.5 6' }]],
2206
+ replace: [
2207
+ ['rect', { x: 7, y: 4.5, width: 12.5, height: 15, rx: 2 }],
2208
+ ['path', { d: 'M3 12h9' }],
2209
+ ['path', { d: 'M9.5 9.5L12 12l-2.5 2.5' }],
2210
+ ],
2200
2211
  search: [['circle', { cx: 11, cy: 11, r: 6.5 }], ['path', { d: 'M16 16l4.5 4.5' }]],
2201
2212
  message: [['path', { d: 'M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9l-5 4V6a1 1 0 0 1 1-1z' }]],
2202
2213
  'panel-right': [['rect', { x: 3, y: 4, width: 18, height: 16, rx: 2 }], ['path', { d: 'M14 4v16' }]],
@@ -7351,6 +7362,7 @@ G.SearchPanel = function SearchPanel(props) {
7351
7362
  const [confirming, setConfirming] = useState(null)
7352
7363
  const [replacing, setReplacing] = useState(false)
7353
7364
  const [replaceError, setReplaceError] = useState('')
7365
+ const [tip, setTip] = useState(null)
7354
7366
  const inputRef = useRef(null)
7355
7367
  const requestRef = useRef(0)
7356
7368
 
@@ -7535,6 +7547,34 @@ G.SearchPanel = function SearchPanel(props) {
7535
7547
  return next
7536
7548
  })
7537
7549
  }
7550
+ const dismissFile = (file) => {
7551
+ setIgnored((current) => {
7552
+ const next = new Set(current)
7553
+ for (const match of file.matches) next.add(matchKey(file.path, match))
7554
+ return next
7555
+ })
7556
+ }
7557
+ /* 悬停提示:鼠标进入时在图标下方显示一行说明(原生 title 在 WebView 里要等很久,体验差) */
7558
+ const tipProps = (text) => ({
7559
+ onMouseEnter: (event) => {
7560
+ try {
7561
+ const rect = event.currentTarget.getBoundingClientRect()
7562
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
7563
+ } catch {
7564
+ /* ignore */
7565
+ }
7566
+ },
7567
+ onMouseLeave: () => setTip(null),
7568
+ onFocus: (event) => {
7569
+ try {
7570
+ const rect = event.currentTarget.getBoundingClientRect()
7571
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
7572
+ } catch {
7573
+ /* ignore */
7574
+ }
7575
+ },
7576
+ onBlur: () => setTip(null),
7577
+ })
7538
7578
  const openFirst = () => {
7539
7579
  const file = view?.files?.[0]
7540
7580
  const match = file?.matches?.[0]
@@ -7589,15 +7629,31 @@ G.SearchPanel = function SearchPanel(props) {
7589
7629
  className: 'gufa-search-file-replace',
7590
7630
  title: t('search.replaceThisFile'),
7591
7631
  role: 'button',
7632
+ ...tipProps(t('search.replaceThisFile')),
7592
7633
  onClick: (event) => {
7593
7634
  event.stopPropagation()
7594
7635
  event.preventDefault()
7595
7636
  replaceFile(file)
7596
7637
  },
7597
7638
  },
7598
- h(G.Icon, { name: 'pencil', size: 11 }),
7639
+ h(G.Icon, { name: 'replace', size: 12 }),
7599
7640
  )
7600
7641
  : null,
7642
+ h(
7643
+ 'span',
7644
+ {
7645
+ className: 'gufa-search-file-dismiss',
7646
+ title: t('search.dismissFile'),
7647
+ role: 'button',
7648
+ ...tipProps(t('search.dismissFile')),
7649
+ onClick: (event) => {
7650
+ event.stopPropagation()
7651
+ event.preventDefault()
7652
+ dismissFile(file)
7653
+ },
7654
+ },
7655
+ h(G.Icon, { name: 'close', size: 11 }),
7656
+ ),
7601
7657
  ),
7602
7658
  isCollapsed
7603
7659
  ? null
@@ -7629,13 +7685,14 @@ G.SearchPanel = function SearchPanel(props) {
7629
7685
  className: 'gufa-search-row-action',
7630
7686
  title: t('search.replaceOne'),
7631
7687
  role: 'button',
7688
+ ...tipProps(t('search.replaceOne')),
7632
7689
  onClick: (event) => {
7633
7690
  event.stopPropagation()
7634
7691
  event.preventDefault()
7635
7692
  replaceOne(file.path, match)
7636
7693
  },
7637
7694
  },
7638
- h(G.Icon, { name: 'pencil', size: 11 }),
7695
+ h(G.Icon, { name: 'replace', size: 12 }),
7639
7696
  )
7640
7697
  : null,
7641
7698
  h(
@@ -7644,6 +7701,7 @@ G.SearchPanel = function SearchPanel(props) {
7644
7701
  className: 'gufa-search-row-action',
7645
7702
  title: t('search.dismiss'),
7646
7703
  role: 'button',
7704
+ ...tipProps(t('search.dismiss')),
7647
7705
  onClick: (event) => {
7648
7706
  event.stopPropagation()
7649
7707
  event.preventDefault()
@@ -7693,7 +7751,11 @@ G.SearchPanel = function SearchPanel(props) {
7693
7751
  query === ''
7694
7752
  ? null
7695
7753
  : h(G.IconButton, { title: t('search.clear'), onClick: () => { setQuery(''); focusInput() } }, h(G.Icon, { name: 'close', size: 11 })),
7696
- h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
7754
+ h(
7755
+ 'span',
7756
+ { style: { display: 'inline-flex' }, ...tipProps(t('search.replaceToggle')) },
7757
+ h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
7758
+ ),
7697
7759
  ),
7698
7760
  h(
7699
7761
  'div',
@@ -7739,6 +7801,7 @@ G.SearchPanel = function SearchPanel(props) {
7739
7801
  className: 'gufa-search-toggle',
7740
7802
  'data-active': preserveCase ? '' : undefined,
7741
7803
  title: t('search.preserveCase'),
7804
+ ...tipProps(t('search.preserveCase')),
7742
7805
  onClick: () => setPreserveCase((value) => !value),
7743
7806
  }, 'AB'),
7744
7807
  ),
@@ -7809,6 +7872,7 @@ G.SearchPanel = function SearchPanel(props) {
7809
7872
  replaceError !== '' ? h('div', { className: 'gufa-search-error' }, `${t('search.replaceError')}:${replaceError}`) : null,
7810
7873
  ),
7811
7874
  h('div', { className: 'gufa-panel-body gufa-scroll' }, body),
7875
+ tip !== null ? h('div', { className: 'gufa-tip', style: { left: `${tip.left}px`, top: `${tip.top}px` } }, tip.text) : null,
7812
7876
  )
7813
7877
  }
7814
7878
 
@@ -7,8 +7,8 @@
7
7
  <key>CFBundleDisplayName</key><string>古法编程悬浮层</string>
8
8
  <key>CFBundleExecutable</key><string>gufa-float</string>
9
9
  <key>CFBundlePackageType</key><string>APPL</string>
10
- <key>CFBundleShortVersionString</key><string>1.3.65</string>
11
- <key>CFBundleVersion</key><string>1.3.65</string>
10
+ <key>CFBundleShortVersionString</key><string>1.3.67</string>
11
+ <key>CFBundleVersion</key><string>1.3.67</string>
12
12
  <key>LSUIElement</key><true/>
13
13
  <key>NSHighResolutionCapable</key><true/>
14
14
  <key>NSPrincipalClass</key><string>NSApplication</string>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.3.65",
3
+ "version": "1.3.67",
4
4
  "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
@@ -202,11 +202,12 @@ const DICT_ZH = {
202
202
  'search.preserveCase': '保留大小写(AB)',
203
203
  'search.replaceOne': '替换此匹配',
204
204
  'search.dismiss': '忽略此匹配',
205
+ 'search.dismissFile': '忽略该文件的所有匹配',
205
206
  'search.openInEditor': '在编辑器中打开',
206
207
  'search.stale': '匹配位置已变化,已重新搜索',
207
208
  'search.replacePlaceholder': '替换为…',
208
209
  'search.replaceAll': '全部替换',
209
- 'search.replaceThisFile': '替换此文件',
210
+ 'search.replaceThisFile': '替换该文件所有匹配',
210
211
  'search.replacing': '替换中…',
211
212
  'search.confirmReplace': '确定替换 {count} 处({files} 个文件)?直接写文件,编辑器撤销无效。',
212
213
  'search.confirmYes': '确定替换',
@@ -448,11 +449,12 @@ const DICT_EN = {
448
449
  'search.preserveCase': 'Preserve case (AB)',
449
450
  'search.replaceOne': 'Replace this match',
450
451
  'search.dismiss': 'Dismiss this match',
452
+ 'search.dismissFile': 'Dismiss all matches in this file',
451
453
  'search.openInEditor': 'Open in editor',
452
454
  'search.stale': 'Match moved; search refreshed',
453
455
  'search.replacePlaceholder': 'Replace with…',
454
456
  'search.replaceAll': 'Replace all',
455
- 'search.replaceThisFile': 'Replace in this file',
457
+ 'search.replaceThisFile': 'Replace all matches in this file',
456
458
  'search.replacing': 'Replacing…',
457
459
  'search.confirmReplace': 'Replace {count} occurrences in {files} files? This writes files directly; editor undo will not work.',
458
460
  'search.confirmYes': 'Replace',
@@ -1751,6 +1753,10 @@ html[data-platform=darwin][data-fullscreen] .gufa-titlebar{height:44px;padding-l
1751
1753
  .gufa-search-summarybar{display:flex;align-items:center;gap:8px}
1752
1754
  .gufa-search-summarybar .gufa-search-summary{flex:1 1 auto;margin-left:0}
1753
1755
  .gufa-search-summarybar .gufa-search-link{flex:0 0 auto}
1756
+ .gufa-tip{position:fixed;z-index:2147483600;max-width:320px;padding:4px 8px;border-radius:5px;background:#2c2f36;color:#f2f2f2;border:1px solid rgba(255,255,255,.18);font-size:11px;line-height:1.45;white-space:normal;pointer-events:none;box-shadow:0 4px 14px rgba(0,0,0,.4)}
1757
+ .gufa-search-file-dismiss{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-left:2px;border-radius:4px;color:var(--gufa-text-dim);cursor:pointer;opacity:0;transition:opacity .12s ease}
1758
+ .gufa-search-file-head:hover .gufa-search-file-dismiss,.gufa-search-file-head:focus-within .gufa-search-file-dismiss{opacity:1}
1759
+ .gufa-search-file-dismiss:hover{background:var(--gufa-active);color:var(--gufa-text)}
1754
1760
  .gufa-search-link{border:0;background:transparent;color:var(--gufa-accent);font-size:11px;cursor:pointer;padding:0}
1755
1761
  .gufa-search-link:hover{text-decoration:underline}
1756
1762
 
@@ -74,6 +74,11 @@ const ICON_PATHS = {
74
74
  ['path', { d: 'M12 2.8l1 2.6 2.7.7 2-1.8 2.2 2.2-1.8 2 .7 2.7 2.6 1v3l-2.6 1-.7 2.7 1.8 2-2.2 2.2-2-1.8-2.7.7-1 2.6h-3l-1-2.6-2.7-.7-2 1.8-2.2-2.2 1.8-2-.7-2.7-2.6-1v-3l2.6-1 .7-2.7-1.8-2 2.2-2.2 2 1.8 2.7-.7 1-2.6h3z' }],
75
75
  ],
76
76
  code: [['path', { d: 'M8.5 6L3 12l5.5 6M15.5 6L21 12l-5.5 6' }]],
77
+ replace: [
78
+ ['rect', { x: 7, y: 4.5, width: 12.5, height: 15, rx: 2 }],
79
+ ['path', { d: 'M3 12h9' }],
80
+ ['path', { d: 'M9.5 9.5L12 12l-2.5 2.5' }],
81
+ ],
77
82
  search: [['circle', { cx: 11, cy: 11, r: 6.5 }], ['path', { d: 'M16 16l4.5 4.5' }]],
78
83
  message: [['path', { d: 'M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9l-5 4V6a1 1 0 0 1 1-1z' }]],
79
84
  'panel-right': [['rect', { x: 3, y: 4, width: 18, height: 16, rx: 2 }], ['path', { d: 'M14 4v16' }]],
@@ -529,6 +529,7 @@ G.SearchPanel = function SearchPanel(props) {
529
529
  const [confirming, setConfirming] = useState(null)
530
530
  const [replacing, setReplacing] = useState(false)
531
531
  const [replaceError, setReplaceError] = useState('')
532
+ const [tip, setTip] = useState(null)
532
533
  const inputRef = useRef(null)
533
534
  const requestRef = useRef(0)
534
535
 
@@ -713,6 +714,34 @@ G.SearchPanel = function SearchPanel(props) {
713
714
  return next
714
715
  })
715
716
  }
717
+ const dismissFile = (file) => {
718
+ setIgnored((current) => {
719
+ const next = new Set(current)
720
+ for (const match of file.matches) next.add(matchKey(file.path, match))
721
+ return next
722
+ })
723
+ }
724
+ /* 悬停提示:鼠标进入时在图标下方显示一行说明(原生 title 在 WebView 里要等很久,体验差) */
725
+ const tipProps = (text) => ({
726
+ onMouseEnter: (event) => {
727
+ try {
728
+ const rect = event.currentTarget.getBoundingClientRect()
729
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
730
+ } catch {
731
+ /* ignore */
732
+ }
733
+ },
734
+ onMouseLeave: () => setTip(null),
735
+ onFocus: (event) => {
736
+ try {
737
+ const rect = event.currentTarget.getBoundingClientRect()
738
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
739
+ } catch {
740
+ /* ignore */
741
+ }
742
+ },
743
+ onBlur: () => setTip(null),
744
+ })
716
745
  const openFirst = () => {
717
746
  const file = view?.files?.[0]
718
747
  const match = file?.matches?.[0]
@@ -767,15 +796,31 @@ G.SearchPanel = function SearchPanel(props) {
767
796
  className: 'gufa-search-file-replace',
768
797
  title: t('search.replaceThisFile'),
769
798
  role: 'button',
799
+ ...tipProps(t('search.replaceThisFile')),
770
800
  onClick: (event) => {
771
801
  event.stopPropagation()
772
802
  event.preventDefault()
773
803
  replaceFile(file)
774
804
  },
775
805
  },
776
- h(G.Icon, { name: 'pencil', size: 11 }),
806
+ h(G.Icon, { name: 'replace', size: 12 }),
777
807
  )
778
808
  : null,
809
+ h(
810
+ 'span',
811
+ {
812
+ className: 'gufa-search-file-dismiss',
813
+ title: t('search.dismissFile'),
814
+ role: 'button',
815
+ ...tipProps(t('search.dismissFile')),
816
+ onClick: (event) => {
817
+ event.stopPropagation()
818
+ event.preventDefault()
819
+ dismissFile(file)
820
+ },
821
+ },
822
+ h(G.Icon, { name: 'close', size: 11 }),
823
+ ),
779
824
  ),
780
825
  isCollapsed
781
826
  ? null
@@ -807,13 +852,14 @@ G.SearchPanel = function SearchPanel(props) {
807
852
  className: 'gufa-search-row-action',
808
853
  title: t('search.replaceOne'),
809
854
  role: 'button',
855
+ ...tipProps(t('search.replaceOne')),
810
856
  onClick: (event) => {
811
857
  event.stopPropagation()
812
858
  event.preventDefault()
813
859
  replaceOne(file.path, match)
814
860
  },
815
861
  },
816
- h(G.Icon, { name: 'pencil', size: 11 }),
862
+ h(G.Icon, { name: 'replace', size: 12 }),
817
863
  )
818
864
  : null,
819
865
  h(
@@ -822,6 +868,7 @@ G.SearchPanel = function SearchPanel(props) {
822
868
  className: 'gufa-search-row-action',
823
869
  title: t('search.dismiss'),
824
870
  role: 'button',
871
+ ...tipProps(t('search.dismiss')),
825
872
  onClick: (event) => {
826
873
  event.stopPropagation()
827
874
  event.preventDefault()
@@ -871,7 +918,11 @@ G.SearchPanel = function SearchPanel(props) {
871
918
  query === ''
872
919
  ? null
873
920
  : h(G.IconButton, { title: t('search.clear'), onClick: () => { setQuery(''); focusInput() } }, h(G.Icon, { name: 'close', size: 11 })),
874
- h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
921
+ h(
922
+ 'span',
923
+ { style: { display: 'inline-flex' }, ...tipProps(t('search.replaceToggle')) },
924
+ h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
925
+ ),
875
926
  ),
876
927
  h(
877
928
  'div',
@@ -917,6 +968,7 @@ G.SearchPanel = function SearchPanel(props) {
917
968
  className: 'gufa-search-toggle',
918
969
  'data-active': preserveCase ? '' : undefined,
919
970
  title: t('search.preserveCase'),
971
+ ...tipProps(t('search.preserveCase')),
920
972
  onClick: () => setPreserveCase((value) => !value),
921
973
  }, 'AB'),
922
974
  ),
@@ -987,6 +1039,7 @@ G.SearchPanel = function SearchPanel(props) {
987
1039
  replaceError !== '' ? h('div', { className: 'gufa-search-error' }, `${t('search.replaceError')}:${replaceError}`) : null,
988
1040
  ),
989
1041
  h('div', { className: 'gufa-panel-body gufa-scroll' }, body),
1042
+ tip !== null ? h('div', { className: 'gufa-tip', style: { left: `${tip.left}px`, top: `${tip.top}px` } }, tip.text) : null,
990
1043
  )
991
1044
  }
992
1045