xtralab 0.15.0 → 0.15.2

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.
Files changed (237) hide show
  1. package/README.md +65 -30
  2. package/lib/about/icons.d.ts +0 -5
  3. package/lib/about/icons.js +0 -5
  4. package/lib/about/index.d.ts +4 -8
  5. package/lib/about/index.js +6 -17
  6. package/lib/agentSessions.d.ts +9 -29
  7. package/lib/agentSessions.js +2 -7
  8. package/lib/askAgent/editorSelection.d.ts +20 -26
  9. package/lib/askAgent/editorSelection.js +11 -26
  10. package/lib/askAgent/icons.d.ts +2 -3
  11. package/lib/askAgent/icons.js +2 -3
  12. package/lib/askAgent/index.d.ts +4 -26
  13. package/lib/askAgent/index.js +54 -158
  14. package/lib/askAgent/popup.d.ts +12 -16
  15. package/lib/askAgent/popup.js +18 -37
  16. package/lib/askAgent/prompt.d.ts +3 -5
  17. package/lib/askAgent/prompt.js +6 -19
  18. package/lib/askAgent/queue.d.ts +11 -21
  19. package/lib/askAgent/queue.js +9 -19
  20. package/lib/askAgent/queuePanel.d.ts +13 -18
  21. package/lib/askAgent/queuePanel.js +15 -37
  22. package/lib/askAgent/targetPicker.d.ts +2 -9
  23. package/lib/askAgent/targetPicker.js +6 -11
  24. package/lib/askAgent/tokens.d.ts +32 -46
  25. package/lib/askAgent/tokens.js +4 -6
  26. package/lib/commandBar/index.d.ts +4 -13
  27. package/lib/commandBar/index.js +21 -39
  28. package/lib/customPanel/index.js +15 -0
  29. package/lib/editorBreadcrumbs/index.d.ts +3 -6
  30. package/lib/editorBreadcrumbs/index.js +10 -6
  31. package/lib/editorBreadcrumbs/widget.d.ts +17 -4
  32. package/lib/editorBreadcrumbs/widget.js +11 -17
  33. package/lib/editorIndent/index.d.ts +4 -12
  34. package/lib/editorIndent/index.js +8 -23
  35. package/lib/fileBrowser/commands.d.ts +29 -19
  36. package/lib/fileBrowser/commands.js +83 -97
  37. package/lib/fileBrowser/contents.d.ts +3 -0
  38. package/lib/fileBrowser/dragAndDrop.d.ts +17 -4
  39. package/lib/fileBrowser/dragAndDrop.js +2 -7
  40. package/lib/fileBrowser/fileBrowser.d.ts +19 -9
  41. package/lib/fileBrowser/fileBrowser.js +70 -222
  42. package/lib/fileBrowser/gitStatus.d.ts +16 -10
  43. package/lib/fileBrowser/gitStatus.js +31 -30
  44. package/lib/fileBrowser/gitignore.d.ts +4 -17
  45. package/lib/fileBrowser/gitignore.js +4 -25
  46. package/lib/fileBrowser/icons.d.ts +7 -17
  47. package/lib/fileBrowser/icons.js +25 -80
  48. package/lib/fileBrowser/index.js +2 -4
  49. package/lib/fileBrowser/widget.d.ts +141 -48
  50. package/lib/fileBrowser/widget.js +102 -4
  51. package/lib/fileTypeIcons/index.js +0 -10
  52. package/lib/git/api.d.ts +5 -13
  53. package/lib/git/api.js +10 -36
  54. package/lib/git/askRequest.d.ts +4 -8
  55. package/lib/git/askRequest.js +6 -20
  56. package/lib/git/commands.d.ts +45 -5
  57. package/lib/git/commands.js +20 -13
  58. package/lib/git/diffModel.js +4 -0
  59. package/lib/git/diffPreferences.d.ts +90 -0
  60. package/lib/git/diffPreferences.js +107 -0
  61. package/lib/git/diffProvider.js +10 -2
  62. package/lib/git/diffSurface.d.ts +64 -63
  63. package/lib/git/diffSurface.js +72 -213
  64. package/lib/git/diffTheme.d.ts +7 -0
  65. package/lib/git/diffTheme.js +23 -0
  66. package/lib/git/diffWidget.d.ts +70 -14
  67. package/lib/git/diffWidget.js +100 -94
  68. package/lib/git/imageDiff.d.ts +14 -6
  69. package/lib/git/imageDiff.js +19 -75
  70. package/lib/git/index.d.ts +0 -3
  71. package/lib/git/index.js +44 -10
  72. package/lib/git/notebookDiff.d.ts +110 -33
  73. package/lib/git/notebookDiff.js +55 -197
  74. package/lib/git/tokens.d.ts +73 -31
  75. package/lib/git/tokens.js +2 -3
  76. package/lib/highlight/index.d.ts +4 -10
  77. package/lib/highlight/index.js +10 -41
  78. package/lib/index.d.ts +0 -9
  79. package/lib/index.js +0 -9
  80. package/lib/launcher/agents.d.ts +55 -51
  81. package/lib/launcher/agents.js +15 -57
  82. package/lib/launcher/availability.d.ts +3 -9
  83. package/lib/launcher/availability.js +3 -9
  84. package/lib/launcher/commands.d.ts +7 -32
  85. package/lib/launcher/commands.js +14 -45
  86. package/lib/launcher/dashboard.d.ts +19 -24
  87. package/lib/launcher/dashboard.js +21 -67
  88. package/lib/launcher/editorRegistry.d.ts +10 -22
  89. package/lib/launcher/editorRegistry.js +14 -18
  90. package/lib/launcher/editors.d.ts +39 -45
  91. package/lib/launcher/editors.js +8 -34
  92. package/lib/launcher/icons.d.ts +0 -12
  93. package/lib/launcher/icons.js +5 -39
  94. package/lib/launcher/index.js +12 -55
  95. package/lib/launcher/invocation.d.ts +4 -10
  96. package/lib/launcher/invocation.js +7 -22
  97. package/lib/launcher/registry.d.ts +9 -7
  98. package/lib/launcher/registry.js +9 -7
  99. package/lib/launcher/tokens.d.ts +10 -22
  100. package/lib/launcher/tokens.js +5 -8
  101. package/lib/menuBar/index.d.ts +3 -10
  102. package/lib/menuBar/index.js +11 -28
  103. package/lib/menus/index.d.ts +3 -9
  104. package/lib/menus/index.js +14 -30
  105. package/lib/omnibox/files.d.ts +2 -4
  106. package/lib/omnibox/files.js +5 -11
  107. package/lib/omnibox/index.d.ts +4 -14
  108. package/lib/omnibox/index.js +9 -27
  109. package/lib/omnibox/model.d.ts +38 -10
  110. package/lib/omnibox/model.js +15 -33
  111. package/lib/omnibox/recents.d.ts +15 -17
  112. package/lib/omnibox/recents.js +12 -17
  113. package/lib/omnibox/tokens.d.ts +5 -10
  114. package/lib/omnibox/tokens.js +2 -6
  115. package/lib/omnibox/widget.d.ts +11 -7
  116. package/lib/omnibox/widget.js +8 -16
  117. package/lib/searchReplace/index.d.ts +4 -20
  118. package/lib/searchReplace/index.js +7 -27
  119. package/lib/showOutput/index.d.ts +3 -12
  120. package/lib/showOutput/index.js +6 -22
  121. package/lib/sidebar/index.d.ts +4 -7
  122. package/lib/sidebar/index.js +5 -12
  123. package/lib/terminalNotifications/index.d.ts +4 -10
  124. package/lib/terminalNotifications/index.js +6 -20
  125. package/lib/terminals/agentTerminals.d.ts +12 -5
  126. package/lib/terminals/agentTerminals.js +25 -44
  127. package/lib/terminals/detection.d.ts +4 -8
  128. package/lib/terminals/detection.js +4 -8
  129. package/lib/terminals/index.d.ts +0 -35
  130. package/lib/terminals/index.js +12 -101
  131. package/lib/terminals/model.d.ts +64 -139
  132. package/lib/terminals/model.js +80 -220
  133. package/lib/terminals/tokens.d.ts +11 -22
  134. package/lib/terminals/tokens.js +2 -2
  135. package/lib/terminals/widget.d.ts +43 -13
  136. package/lib/terminals/widget.js +33 -18
  137. package/lib/topBar/icons.d.ts +3 -8
  138. package/lib/topBar/icons.js +3 -8
  139. package/lib/topBar/index.d.ts +4 -11
  140. package/lib/topBar/index.js +10 -38
  141. package/lib/walkthrough/index.d.ts +4 -9
  142. package/lib/walkthrough/index.js +6 -20
  143. package/lib/walkthrough/panel.d.ts +40 -9
  144. package/lib/walkthrough/panel.js +4 -10
  145. package/package.json +5 -3
  146. package/schema/git-diff-preferences.json +42 -0
  147. package/src/about/icons.ts +0 -5
  148. package/src/about/index.tsx +6 -17
  149. package/src/agentSessions.ts +9 -29
  150. package/src/askAgent/editorSelection.ts +22 -29
  151. package/src/askAgent/icons.ts +2 -3
  152. package/src/askAgent/index.ts +54 -158
  153. package/src/askAgent/popup.tsx +23 -45
  154. package/src/askAgent/prompt.ts +6 -19
  155. package/src/askAgent/queue.ts +13 -24
  156. package/src/askAgent/queuePanel.tsx +21 -46
  157. package/src/askAgent/targetPicker.tsx +5 -15
  158. package/src/askAgent/tokens.ts +32 -46
  159. package/src/commandBar/index.ts +24 -39
  160. package/src/customPanel/index.ts +15 -0
  161. package/src/editorBreadcrumbs/index.ts +10 -6
  162. package/src/editorBreadcrumbs/widget.ts +23 -17
  163. package/src/editorIndent/index.ts +17 -23
  164. package/src/fileBrowser/commands.ts +119 -96
  165. package/src/fileBrowser/contents.ts +3 -0
  166. package/src/fileBrowser/dragAndDrop.ts +17 -7
  167. package/src/fileBrowser/fileBrowser.tsx +86 -230
  168. package/src/fileBrowser/gitStatus.ts +36 -33
  169. package/src/fileBrowser/gitignore.ts +4 -25
  170. package/src/fileBrowser/icons.ts +25 -80
  171. package/src/fileBrowser/index.ts +2 -4
  172. package/src/fileBrowser/widget.tsx +171 -50
  173. package/src/fileTypeIcons/index.ts +0 -10
  174. package/src/git/api.ts +10 -36
  175. package/src/git/askRequest.ts +6 -20
  176. package/src/git/commands.ts +83 -11
  177. package/src/git/diffModel.ts +25 -0
  178. package/src/git/diffPreferences.ts +192 -0
  179. package/src/git/diffProvider.tsx +11 -2
  180. package/src/git/diffSurface.tsx +165 -286
  181. package/src/git/diffTheme.ts +24 -0
  182. package/src/git/diffWidget.tsx +194 -134
  183. package/src/git/imageDiff.tsx +56 -84
  184. package/src/git/index.ts +54 -10
  185. package/src/git/notebookDiff.tsx +214 -240
  186. package/src/git/tokens.ts +73 -31
  187. package/src/highlight/index.ts +10 -41
  188. package/src/index.ts +0 -9
  189. package/src/launcher/agents.ts +64 -95
  190. package/src/launcher/availability.ts +3 -9
  191. package/src/launcher/commands.ts +14 -51
  192. package/src/launcher/dashboard.tsx +49 -88
  193. package/src/launcher/editorRegistry.ts +21 -29
  194. package/src/launcher/editors.ts +39 -58
  195. package/src/launcher/icons.ts +5 -39
  196. package/src/launcher/index.ts +12 -55
  197. package/src/launcher/invocation.ts +7 -22
  198. package/src/launcher/registry.ts +9 -7
  199. package/src/launcher/tokens.ts +10 -22
  200. package/src/menuBar/index.ts +11 -28
  201. package/src/menus/index.ts +14 -30
  202. package/src/omnibox/files.ts +10 -14
  203. package/src/omnibox/index.ts +9 -27
  204. package/src/omnibox/model.ts +50 -38
  205. package/src/omnibox/recents.ts +17 -22
  206. package/src/omnibox/tokens.ts +5 -10
  207. package/src/omnibox/widget.tsx +14 -19
  208. package/src/searchReplace/index.ts +7 -27
  209. package/src/showOutput/index.ts +6 -22
  210. package/src/sidebar/index.ts +20 -12
  211. package/src/terminalNotifications/index.ts +42 -25
  212. package/src/terminals/agentTerminals.ts +25 -49
  213. package/src/terminals/detection.ts +4 -8
  214. package/src/terminals/index.ts +12 -101
  215. package/src/terminals/model.ts +130 -246
  216. package/src/terminals/tokens.ts +11 -22
  217. package/src/terminals/widget.tsx +48 -31
  218. package/src/topBar/icons.ts +3 -8
  219. package/src/topBar/index.ts +21 -44
  220. package/src/walkthrough/index.ts +6 -20
  221. package/src/walkthrough/panel.ts +40 -10
  222. package/style/about.css +2 -7
  223. package/style/askAgent.css +8 -40
  224. package/style/base.css +9 -45
  225. package/style/chrome.css +108 -308
  226. package/style/commandBar.css +4 -20
  227. package/style/customPanel.css +1 -4
  228. package/style/git.css +26 -186
  229. package/style/highlight.css +1 -3
  230. package/style/launcher.css +6 -70
  231. package/style/omnibox.css +2 -14
  232. package/style/showOutput.css +0 -6
  233. package/style/sidebar.css +29 -9
  234. package/style/tabs.css +5 -13
  235. package/style/terminals.css +6 -53
  236. package/style/topBar.css +2 -22
  237. package/style/walkthrough.css +0 -8
@@ -5,11 +5,6 @@ import { Contents } from '@jupyterlab/services';
5
5
 
6
6
  import type { GitStatusEntry } from '@pierre/trees';
7
7
 
8
- /**
9
- * The path of the workspace `.gitignore` file. Loaded relative to the
10
- * Jupyter contents root, which matches the directory the gitignore patterns
11
- * are evaluated against — patterns and tested paths share the same base.
12
- */
13
8
  const GITIGNORE_PATH = '.gitignore';
14
9
 
15
10
  /**
@@ -28,9 +23,6 @@ export async function loadGitignoreMatcher(
28
23
  type: 'file'
29
24
  });
30
25
  } catch {
31
- // The most common failure here is `.gitignore` simply not existing.
32
- // Other transient errors (permission denied, server unreachable) are
33
- // also treated as "no matcher" so the file browser still works.
34
26
  return null;
35
27
  }
36
28
  if (model.type !== 'file' || typeof model.content !== 'string') {
@@ -43,23 +35,10 @@ export async function loadGitignoreMatcher(
43
35
  }
44
36
 
45
37
  /**
46
- * Build `GitStatusEntry`s for the canonical paths that match the given
47
- * gitignore matcher.
48
- *
49
- * `@pierre/trees` propagates the `ignored` style from a directory entry
50
- * down to every descendant via its internal `ignoredDirectoryPaths` set, so
51
- * we only emit one entry per ignored subtree root: emitting descendants
52
- * would also pollute the library's `directoriesWithChanges` set, causing
53
- * parent directories of nested ignored items to render a "contains git
54
- * status items" dot.
55
- *
56
- * Paths are sorted lexicographically so a directory always precedes its
57
- * descendants, allowing a simple ancestor-suppression check via
58
- * `path.startsWith(dir)`. The trailing slash on canonical directory paths
59
- * (required by `@pierre/trees`, also recognized by `ignore` as the
60
- * "directory" indicator) keeps the prefix check from accidentally matching
61
- * sibling paths that happen to share a name prefix (e.g. `node_modules_old`
62
- * vs `node_modules/`).
38
+ * One `GitStatusEntry` per ignored subtree root: descendant entries would
39
+ * pollute the tree's `directoriesWithChanges` set (bogus dots on parents),
40
+ * and `ignored` already propagates downward. The trailing slash on directory
41
+ * paths keeps the sorted `startsWith` ancestor check off name-prefix siblings.
63
42
  */
64
43
  export function buildIgnoredEntries(
65
44
  matcher: Ignore,
@@ -6,37 +6,23 @@ import {
6
6
  import type { FileTreeIconConfig } from '@pierre/trees';
7
7
 
8
8
  /**
9
- * The glyph used as the xtralab file browser's sidebar tab icon. Defined as a
10
- * `LabIcon` (rather than the default `folderIcon` from
11
- * `@jupyterlab/ui-components`) so the xtralab browser is visually distinguishable
12
- * from JupyterLab's built-in file browser, which also lives in the left
13
- * sidebar.
14
- *
15
- * Source: `file-tree` from SVG Repo (https://www.svgrepo.com/svg/371275/file-tree).
16
- * The original `fill="#444"` is replaced with `fill="currentColor"` and the
17
- * root element is given the `jp-icon3` class so the icon picks up JupyterLab's
18
- * theme color and the sidebar's inverse-color painting automatically.
9
+ * Sidebar tab icon, distinct from the core `folderIcon` so the xtralab
10
+ * browser is distinguishable from the built-in one. `file-tree` from SVG Repo
11
+ * (https://www.svgrepo.com/svg/371275/file-tree), refit to follow the theme
12
+ * (`currentColor`, `jp-icon3`) and padded to the size of the stock glyphs.
19
13
  */
20
14
  export const xtralabFileBrowserIcon = new LabIcon({
21
15
  name: 'xtralab:file-browser',
22
- svgstr: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="jp-icon3" fill="currentColor">
16
+ svgstr: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 20 20" class="jp-icon3" fill="currentColor">
23
17
  <path d="M16 10v-4h-11v1h-2v-3h9v-4h-12v4h2v10h3v2h11v-4h-11v1h-2v-5h2v2z"/>
24
18
  </svg>`
25
19
  });
26
20
 
27
21
  /**
28
- * Sprite sheet injected into the `@pierre/trees` shadow DOM. Contains a single
29
- * `<symbol>` for the Jupyter notebook icon, drawn from the JupyterLab core
30
- * notebook icon (`@jupyterlab/ui-components/style/icons/filetype/notebook.svg`).
31
- *
32
- * `@pierre/trees` does not ship a Jupyter token, so `.ipynb` files would
33
- * otherwise fall through to the generic file icon. The symbol id below is
34
- * referenced from `byFileExtension` in {@link FILE_BROWSER_ICONS}.
35
- *
36
- * The orange `#EF6C00` fill is set as a presentation attribute on the inner
37
- * `<g>` so it survives the `fill: currentColor` rule the tree applies on the
38
- * icon container — the inherited color does not override a presentation
39
- * attribute set directly on a child.
22
+ * Sprite sheet injected into the tree's shadow DOM: the JupyterLab notebook
23
+ * glyph, since `@pierre/trees` ships no Jupyter token. The `#EF6C00` fill is
24
+ * a presentation attribute on the inner `<g>` so it survives the tree's
25
+ * `fill: currentColor` rule on the icon container.
40
26
  */
41
27
  const JUPYTER_NOTEBOOK_SPRITE_SHEET = `<svg data-icon-sprite aria-hidden="true" width="0" height="0">
42
28
  <symbol id="jupyter-notebook" viewBox="0 0 22 22">
@@ -48,13 +34,9 @@ const JUPYTER_NOTEBOOK_SPRITE_SHEET = `<svg data-icon-sprite aria-hidden="true"
48
34
  </svg>`;
49
35
 
50
36
  /**
51
- * Icon configuration for the xtralab file browser. Keeps the default `complete`
52
- * built-in icon set (the colored language icons) and layers a Jupyter notebook
53
- * symbol on top so `.ipynb` files render with the JupyterLab notebook glyph.
54
- *
55
- * `set` must be set explicitly: when a config object includes any custom
56
- * overrides without `set`, `@pierre/trees` defaults `set` to `'none'`, which
57
- * disables the built-in icons entirely.
37
+ * Icon config: the built-in `complete` set plus the Jupyter notebook symbol
38
+ * for `.ipynb`. `set` must be explicit — with any custom overrides present,
39
+ * `@pierre/trees` defaults it to `'none'`, disabling the built-in icons.
58
40
  */
59
41
  export const FILE_BROWSER_ICONS: FileTreeIconConfig = {
60
42
  set: 'complete',
@@ -65,43 +47,23 @@ export const FILE_BROWSER_ICONS: FileTreeIconConfig = {
65
47
  }
66
48
  };
67
49
 
68
- /**
69
- * Concatenated sprite-sheet text. Combines the built-in sheet for the active
70
- * icon set with our custom Jupyter notebook sheet so {@link extractSymbol}
71
- * can find the body of any symbol the tree itself can render.
72
- */
73
50
  const COMBINED_SPRITE_SHEETS = [
74
51
  getBuiltInSpriteSheet(FILE_BROWSER_ICONS.set ?? 'complete'),
75
52
  JUPYTER_NOTEBOOK_SPRITE_SHEET
76
53
  ].join('\n');
77
54
 
78
- /**
79
- * Resolver instance reused across calls to {@link getTreeIcon}. The resolver
80
- * is pure relative to the icon config, so building it once at module load
81
- * avoids re-walking the icon rules on every diff that opens.
82
- */
83
55
  const treeIconResolver = createFileTreeIconResolver(FILE_BROWSER_ICONS);
84
56
 
85
57
  /**
86
- * Cache of LabIcons keyed by the resolved sprite symbol id (e.g.
87
- * `file-tree-builtin-python`). All Python files share the same icon, so
88
- * caching by symbol id prevents repeated LabIcon registration warnings and
89
- * keeps the JupyterLab icon registry small.
58
+ * LabIcons keyed by resolved symbol id — re-registering a LabIcon under the
59
+ * same name logs warnings.
90
60
  */
91
61
  const TREE_ICON_CACHE = new Map<string, LabIcon>();
92
62
 
93
- /**
94
- * Extract the inner SVG markup and viewBox of the `<symbol>` with the given
95
- * id from {@link COMBINED_SPRITE_SHEETS}. Returns `null` if no matching
96
- * symbol exists, in which case the caller falls back to JupyterLab's default
97
- * file icon.
98
- */
99
63
  function extractSymbol(
100
64
  symbolId: string
101
65
  ): { viewBox: string; inner: string } | null {
102
- // Match a `<symbol>` whose `id` attribute equals `symbolId` (allowing other
103
- // attributes in any order). The `[\s\S]*?` body is non-greedy so we stop
104
- // at the first matching `</symbol>` even when multiple symbols sit
66
+ // Non-greedy body: stop at the first `</symbol>` when symbols sit
105
67
  // back-to-back in the sheet.
106
68
  const escaped = symbolId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
107
69
  const symbolRegex = new RegExp(
@@ -120,14 +82,10 @@ function extractSymbol(
120
82
  }
121
83
 
122
84
  /**
123
- * Fallback colors for the built-in file icons, keyed by the icon token
124
- * `@pierre/trees` resolves for a path (e.g. `python`, `typescript`).
125
- *
126
- * The tree only exposes these as `--trees-file-icon-color-<token>` CSS
127
- * variables scoped to its shadow host, so they resolve to nothing for the
128
- * standalone {@link LabIcon}s {@link getTreeIcon} builds for main-area tabs.
129
- * Mirroring them here lets {@link getBuiltInFileIconColor} bottom out in a
130
- * real color. Each is a `light-dark(…)` pair for dark themes.
85
+ * Fallback colors keyed by the tree's icon token. The tree exposes its colors
86
+ * only as `--trees-file-icon-color-*` vars scoped to its shadow host, so the
87
+ * standalone LabIcons built for main-area tabs need these literals;
88
+ * `light-dark(…)` covers dark themes.
131
89
  */
132
90
  const BUILT_IN_FILE_ICON_COLOR_FALLBACKS: Record<string, string> = {
133
91
  astro: 'light-dark(#a631be, #d568ea)',
@@ -183,11 +141,8 @@ const BUILT_IN_FILE_ICON_COLOR_FALLBACKS: Record<string, string> = {
183
141
  };
184
142
 
185
143
  /**
186
- * Color the file tree would paint for the built-in icon `token`, as a
187
- * self-contained CSS value usable outside the tree's shadow DOM: the tree's
188
- * `--trees-file-icon-color-*` properties when in scope, else the literal from
189
- * {@link BUILT_IN_FILE_ICON_COLOR_FALLBACKS}. Returns `undefined` for unknown
190
- * tokens.
144
+ * The tree's color for `token` as a self-contained CSS value: its CSS vars
145
+ * when in scope, else the mirrored literal. `undefined` for unknown tokens.
191
146
  */
192
147
  function getBuiltInFileIconColor(token: string): string | undefined {
193
148
  const fallback = BUILT_IN_FILE_ICON_COLOR_FALLBACKS[token];
@@ -197,9 +152,6 @@ function getBuiltInFileIconColor(token: string): string | undefined {
197
152
  return `var(--trees-file-icon-color-${token}, var(--trees-file-icon-color, ${fallback}))`;
198
153
  }
199
154
 
200
- /**
201
- * Resolve a tree glyph into a standalone `LabIcon`.
202
- */
203
155
  function resolveTreeIcon(filePath: string): {
204
156
  icon: LabIcon | null;
205
157
  specific: boolean;
@@ -219,23 +171,16 @@ function resolveTreeIcon(filePath: string): {
219
171
  if (symbol === null) {
220
172
  return { icon: null, specific };
221
173
  }
222
- // Built-in language icons paint with `fill="currentColor"` so the colored
223
- // tier of the tree can recolor them by setting `color` on the host
224
- // element. Reproduce that here by setting the same color value as an
225
- // inline `style="color: …"` on the outer `<svg>`. `getBuiltInFileIconColor`
226
- // returns a `var(--trees-…)` chain that bottoms out in `light-dark(…)`,
227
- // which respects the page's `color-scheme` declaration so dark themes pick
228
- // up the brighter variants automatically.
174
+ // Built-in glyphs paint with `fill="currentColor"`; an inline `color`
175
+ // style reproduces the tree's colored tier outside its shadow DOM.
229
176
  const colored = FILE_BROWSER_ICONS.colored === true;
230
177
  const color =
231
178
  colored && resolved.token !== undefined
232
179
  ? getBuiltInFileIconColor(resolved.token)
233
180
  : undefined;
234
181
  const styleAttr = color !== undefined ? ` style="color: ${color};"` : '';
235
- // Prefer a viewBox the resolver supplies (custom sprite overrides may set
236
- // one), then fall back to the symbol's own viewBox so 22x22 sprites like
237
- // the Jupyter notebook glyph render at the right scale rather than being
238
- // cropped to a 16x16 box.
182
+ // Prefer the resolver's viewBox, then the symbol's own, so 22x22 sprites
183
+ // like the notebook glyph aren't cropped to a 16x16 box.
239
184
  const viewBox = resolved.viewBox ?? symbol.viewBox;
240
185
  const svgstr = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}"${styleAttr}>${symbol.inner}</svg>`;
241
186
  const icon = new LabIcon({
@@ -51,10 +51,8 @@ const plugin: JupyterFrontEndPlugin<void> = {
51
51
  },
52
52
  translator: translator ?? undefined
53
53
  });
54
- // Ranks just under the Terminals panel in the left sidebar. The shipped
55
- // `layout` setting assigns the default ranks (rank only, no area pin),
56
- // so this browser stays movable via the "Move Widget" context menu; the
57
- // `rank` here is the in-code fallback for when that setting is absent.
54
+ // Rank-only fallback for when the shipped `layout` setting is absent;
55
+ // no area pin, so the browser stays movable via "Move Widget".
58
56
  app.shell.add(browser, 'left', { rank: 2 });
59
57
  if (restorer) {
60
58
  restorer.add(browser, browser.id);