dsh-remote-vs 0.19.1 → 0.20.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.
@@ -5,11 +5,17 @@
5
5
  * ships the same split, and the confirm dialogs are what guard destructive
6
6
  * remote git verbs).
7
7
  *
8
- * Icon sourcing: when dsh-better-sidebar is installed its service answers
9
- * `fileIcon` / `folderIcon`, which run the host's own classifier and any
10
- * user-registered icon theme — the remote tree then matches the user's local
11
- * sidebar glyph for glyph. Without that service the built-in SVG set below
12
- * takes over, so the native fallback surface still renders a real tree.
8
+ * Icon sourcing has two tiers. `FileIcon` / `FolderIcon` paint the plain glyphs
9
+ * below (search hits, SCM rows, commit panes, download rows — list chrome where
10
+ * one neutral outline reads best). `ExplorerFileIcon` / `ExplorerFolderIcon`
11
+ * paint the COLOURED type set ported from dsh-sidebar in `./file-icons.tsx`, so
12
+ * the remote directory tree looks like the local sidebar's tree: one sheet
13
+ * whose colour and mark carry the file type, and an amber folder that opens.
14
+ *
15
+ * Every tier still prefers the host service when one is published (the
16
+ * better-sidebar lineage's `fileIcon` / `folderIcon`: host classifier plus any
17
+ * registered icon theme). dsh-sidebar itself publishes none today, so in a
18
+ * dsh-sidebar profile the SVG sets above are what actually render.
13
19
  */
14
20
  import {
15
21
  createElement,
@@ -25,6 +31,7 @@ import {
25
31
  } from 'react'
26
32
  import { createPortal } from 'react-dom'
27
33
  import { detectLang, makeT } from '../i18n.ts'
34
+ import { FileTypeIcon, FolderGlyph } from './file-icons.tsx'
28
35
 
29
36
  // ------------------------------------------------------------------ icons
30
37
 
@@ -330,6 +337,28 @@ export function FolderIcon(props: { path: string; open: boolean; size?: number;
330
337
  return <IconFolder size={size} open={props.open} className={props.className} />
331
338
  }
332
339
 
340
+ // --------------------------------------------------- directory-tree icons
341
+ //
342
+ // The tree is the one surface that has to match the local sidebar, so it uses
343
+ // the coloured type set (see `./file-icons.tsx`) instead of the plain glyphs
344
+ // above. Host service still wins, so a user-registered icon theme keeps working.
345
+
346
+ /** Explorer file row: host glyph when available, else the coloured type icon. */
347
+ export function ExplorerFileIcon(props: { path: string; size?: number; className?: string }): ReactNode {
348
+ const size = props.size ?? 16
349
+ const fromHost = tryService(() => iconService?.fileIcon(props.path, size))
350
+ if (fromHost !== undefined) return fromHost
351
+ return <FileTypeIcon path={props.path} size={size} className={props.className} />
352
+ }
353
+
354
+ /** Explorer directory row: host glyph when available, else the amber folder. */
355
+ export function ExplorerFolderIcon(props: { path: string; open: boolean; size?: number; className?: string }): ReactNode {
356
+ const size = props.size ?? 16
357
+ const fromHost = tryService(() => iconService?.folderIcon(props.path, props.open, size))
358
+ if (fromHost !== undefined) return fromHost
359
+ return <FolderGlyph open={props.open} size={size} className={props.className} />
360
+ }
361
+
333
362
  // ------------------------------------------------------------- file kinds
334
363
 
335
364
  const IMAGE_EXTS = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'ico', 'avif'])