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,23 +5,11 @@ import { CommandRegistry } from '@lumino/commands';
5
5
  import { Widget } from '@lumino/widgets';
6
6
  import { IOmnibox, OMNIBOX_OPEN_COMMAND } from '../omnibox/tokens';
7
7
  const PLUGIN_ID = 'xtralab:command-bar';
8
- /**
9
- * Factory name of JupyterLab's settings-driven top bar toolbar (`#jp-top-bar`,
10
- * built by `@jupyterlab/application-extension:top-bar`).
11
- */
12
8
  const TOPBAR_FACTORY = 'TopBar';
13
- /**
14
- * Name of the pill item within that toolbar. Its placement is declared under
15
- * `jupyter.lab.toolbars` in this plugin's settings schema
16
- * (schema/command-bar.json): the core toolbar ships a spacer at rank 50, so
17
- * the pill's higher rank lands it at the trailing end of the toolbar, next to
18
- * the right-sidebar toggle button.
19
- */
20
9
  const ITEM_NAME = 'omnibox';
21
10
  /**
22
- * A search-bar-styled launcher pill. It holds no text input of its own:
23
- * clicking it (or pressing Enter/Space while it is focused) runs `onActivate`,
24
- * which opens the omnibox.
11
+ * A search-bar-styled launcher pill with no input of its own: activating it
12
+ * runs `onActivate`, which opens the omnibox.
25
13
  */
26
14
  class CommandBar extends Widget {
27
15
  constructor(options) {
@@ -31,27 +19,35 @@ class CommandBar extends Widget {
31
19
  this.addClass('jp-xtralab-CommandBar');
32
20
  this._onActivate = options.onActivate;
33
21
  }
22
+ /**
23
+ * Handle the DOM events for the command bar.
24
+ */
34
25
  handleEvent(event) {
35
26
  if (event.type === 'click') {
36
27
  this._onActivate();
37
28
  }
38
29
  }
30
+ /**
31
+ * A message handler invoked on an `'after-attach'` message.
32
+ */
39
33
  onAfterAttach() {
40
- // The click bubbles from the inner pill button up to the root node
41
- // listened on here; keyboard Enter/Space on the focused button raises the
42
- // same synthetic click.
34
+ // Keyboard Enter/Space on the focused button raises the same synthetic click.
43
35
  this.node.addEventListener('click', this);
44
36
  }
37
+ /**
38
+ * A message handler invoked on a `'before-detach'` message.
39
+ */
45
40
  onBeforeDetach() {
46
41
  this.node.removeEventListener('click', this);
47
42
  }
48
43
  }
49
44
  (function (CommandBar) {
45
+ /**
46
+ * Create the DOM node for a command bar.
47
+ */
50
48
  function createNode(label, caption, shortcut) {
51
- // The root is a plain wrapper: as a toolbar item it receives the core
52
- // `.jp-Toolbar > .jp-Toolbar-item` sizing (full height, centered flex),
53
- // which would otherwise stretch the pill itself; the button inside keeps
54
- // its own compact pill height.
49
+ // Plain wrapper: the core `.jp-Toolbar-item` sizing would otherwise
50
+ // stretch the pill itself.
55
51
  const wrapper = document.createElement('div');
56
52
  const button = document.createElement('button');
57
53
  button.type = 'button';
@@ -71,7 +67,6 @@ class CommandBar extends Widget {
71
67
  const hint = document.createElement('span');
72
68
  hint.className = 'jp-xtralab-CommandBar-shortcut';
73
69
  hint.textContent = shortcut;
74
- // Decorative: the button's aria-label already names the action.
75
70
  hint.setAttribute('aria-hidden', 'true');
76
71
  button.appendChild(hint);
77
72
  }
@@ -81,19 +76,10 @@ class CommandBar extends Widget {
81
76
  CommandBar.createNode = createNode;
82
77
  })(CommandBar || (CommandBar = {}));
83
78
  /**
84
- * Contribute a search-bar-styled command bar to JupyterLab's top bar toolbar.
85
- * Clicking it opens the omnibox — a launcher overlay that fuzzy-searches files
86
- * and commands and routes a typed prompt to an agent.
87
- *
88
- * The pill is a regular settings-driven toolbar item: this plugin registers a
89
- * widget factory for it on the `IToolbarWidgetRegistry` and declares its rank
90
- * in schema/command-bar.json, so users can move or disable it from the Top
91
- * Bar settings like any other toolbar item.
92
- *
93
- * The factory is only registered when the omnibox is available — the
94
- * `IOmnibox` token is provided by `xtralab:omnibox` — so the pill never
95
- * appears with nothing to open (without a factory, the toolbar item resolves
96
- * to an empty command button that renders nothing).
79
+ * Contribute a search-bar-styled pill to the top bar toolbar that opens the
80
+ * omnibox. It is a settings-driven toolbar item (factory here, rank in
81
+ * schema/command-bar.json) registered only when `IOmnibox` is provided —
82
+ * without a factory the item resolves to an empty button that renders nothing.
97
83
  */
98
84
  const plugin = {
99
85
  id: PLUGIN_ID,
@@ -107,10 +93,6 @@ const plugin = {
107
93
  }
108
94
  const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab');
109
95
  toolbarRegistry.addFactory(TOPBAR_FACTORY, ITEM_NAME, () => {
110
- // Show the omnibox's keyboard shortcut as a hint in the pill, derived
111
- // from the live binding (registered by xtralab:omnibox, which activates
112
- // first as the IOmnibox provider) so it stays correct and uses the
113
- // platform's modifier symbols. Empty when no binding is registered.
114
96
  const binding = app.commands.keyBindings.find(keyBinding => keyBinding.command === OMNIBOX_OPEN_COMMAND);
115
97
  const shortcut = binding
116
98
  ? CommandRegistry.formatKeystroke(binding.keys)
@@ -16,19 +16,34 @@ class CustomPanel extends SidePanel {
16
16
  this.title.caption = options.trans.__('Custom Panel');
17
17
  this.addClass('jp-xtralab-CustomPanel');
18
18
  }
19
+ /**
20
+ * The accordion panel hosting the sections.
21
+ */
19
22
  get accordionPanel() {
20
23
  return this.content;
21
24
  }
25
+ /**
26
+ * The section widgets currently hosted by the panel.
27
+ */
22
28
  get sections() {
23
29
  return this.content.widgets;
24
30
  }
31
+ /**
32
+ * A signal emitted with the new count when the number of sections changes.
33
+ */
25
34
  get sectionCountChanged() {
26
35
  return this._sectionCountChanged;
27
36
  }
37
+ /**
38
+ * Add a section widget to the panel.
39
+ */
28
40
  addSection(widget) {
29
41
  this.addWidget(widget);
30
42
  this._sectionCountChanged.emit(this.content.widgets.length);
31
43
  }
44
+ /**
45
+ * Remove a section widget from the panel, if it is hosted here.
46
+ */
32
47
  removeSectionWidget(widget) {
33
48
  if (widget.parent !== this.content) {
34
49
  return;
@@ -1,11 +1,8 @@
1
1
  import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
2
  /**
3
- * Adds a VS Code-style path breadcrumb to text editor toolbars. Each
4
- * segment is clickable: clicking dispatches `xtralab:reveal-path` so
5
- * any plugin that listens (today, the file browser) can surface the
6
- * underlying folder or file. The breadcrumbs plugin therefore does not
7
- * import the file browser at all — the JupyterLab command registry is
8
- * the only seam between them.
3
+ * Adds a clickable path breadcrumb to text editor toolbars. Clicks dispatch
4
+ * `xtralab:reveal-path`; the command registry is the only seam with the file
5
+ * browser.
9
6
  */
10
7
  declare const plugin: JupyterFrontEndPlugin<void>;
11
8
  export default plugin;
@@ -4,11 +4,18 @@ import { EditorBreadcrumbs } from './widget';
4
4
  const PLUGIN_ID = 'xtralab:editor-breadcrumbs';
5
5
  const EDITOR_FACTORY = 'Editor';
6
6
  const TOOLBAR_ITEM_NAME = 'xtralab-editor-breadcrumbs';
7
+ /**
8
+ * A widget extension that adds an `EditorBreadcrumbs` item to the toolbar of
9
+ * each new editor widget.
10
+ */
7
11
  class EditorBreadcrumbsExtension {
8
12
  constructor(commands, trans) {
9
13
  this._commands = commands;
10
14
  this._trans = trans;
11
15
  }
16
+ /**
17
+ * Create the breadcrumbs toolbar item for a new editor widget.
18
+ */
12
19
  createNew(widget, context) {
13
20
  const breadcrumbs = new EditorBreadcrumbs({
14
21
  context,
@@ -26,12 +33,9 @@ class EditorBreadcrumbsExtension {
26
33
  }
27
34
  }
28
35
  /**
29
- * Adds a VS Code-style path breadcrumb to text editor toolbars. Each
30
- * segment is clickable: clicking dispatches `xtralab:reveal-path` so
31
- * any plugin that listens (today, the file browser) can surface the
32
- * underlying folder or file. The breadcrumbs plugin therefore does not
33
- * import the file browser at all — the JupyterLab command registry is
34
- * the only seam between them.
36
+ * Adds a clickable path breadcrumb to text editor toolbars. Clicks dispatch
37
+ * `xtralab:reveal-path`; the command registry is the only seam with the file
38
+ * browser.
35
39
  */
36
40
  const plugin = {
37
41
  id: PLUGIN_ID,
@@ -2,9 +2,21 @@ import type { DocumentRegistry } from '@jupyterlab/docregistry';
2
2
  import type { TranslationBundle } from '@jupyterlab/translation';
3
3
  import type { CommandRegistry } from '@lumino/commands';
4
4
  import { Widget } from '@lumino/widgets';
5
+ /**
6
+ * The options used to create an `EditorBreadcrumbs` widget.
7
+ */
5
8
  interface IEditorBreadcrumbsOptions {
9
+ /**
10
+ * The document context whose path is rendered.
11
+ */
6
12
  context: DocumentRegistry.IContext<DocumentRegistry.IModel>;
13
+ /**
14
+ * The command registry used to dispatch the reveal command.
15
+ */
7
16
  commands: CommandRegistry;
17
+ /**
18
+ * The application translation bundle.
19
+ */
8
20
  trans: TranslationBundle;
9
21
  }
10
22
  /**
@@ -13,15 +25,16 @@ interface IEditorBreadcrumbsOptions {
13
25
  */
14
26
  export declare class EditorBreadcrumbs extends Widget {
15
27
  constructor(options: IEditorBreadcrumbsOptions);
28
+ /**
29
+ * Dispose of the resources held by the widget.
30
+ */
16
31
  dispose(): void;
17
32
  private _onPathChanged;
18
33
  private _render;
19
34
  private _createRootCrumb;
20
35
  /**
21
- * Bind click and keyboard activation on a crumb element to the
22
- * shared reveal command. Dispatch is best-effort: a failure to
23
- * resolve or execute the command is logged but never thrown into
24
- * the editor's toolbar.
36
+ * Bind click and keyboard activation on a crumb to the reveal command;
37
+ * dispatch failures are logged, never thrown into the toolbar.
25
38
  */
26
39
  private _attachReveal;
27
40
  private _createSeparator;
@@ -10,9 +10,7 @@ const ITEM_CLASS = 'jp-BreadCrumbs-item';
10
10
  const CURRENT_ITEM_CLASS = 'jp-mod-current';
11
11
  const SEPARATOR_CLASS = 'jp-BreadCrumbs-separator';
12
12
  /**
13
- * Command dispatched when the user clicks a breadcrumb segment.
14
- * Registered by the file browser plugin; the breadcrumbs only know
15
- * the name so they stay decoupled from the file browser internals.
13
+ * Registered by the file browser plugin; only the name is shared here.
16
14
  */
17
15
  const REVEAL_COMMAND = 'xtralab:reveal-path';
18
16
  /**
@@ -26,9 +24,8 @@ export class EditorBreadcrumbs extends Widget {
26
24
  this._commands = options.commands;
27
25
  this._trans = options.trans;
28
26
  this.addClass(EDITOR_BREADCRUMBS_CLASS);
29
- // The breadcrumbs stretch to fill the toolbar, so ReactiveToolbar's
30
- // overflow math must count them as a spacer (2px) — measured at their
31
- // stretched clientWidth they would evict every item into the popup.
27
+ // ReactiveToolbar must count the stretched breadcrumbs as a spacer (2px);
28
+ // measured at clientWidth they would evict every item into the popup.
32
29
  this.addClass(TOOLBAR_SPACER_CLASS);
33
30
  this.node.setAttribute('aria-label', this._trans.__('Editor file path'));
34
31
  this._container = document.createElement('span');
@@ -40,6 +37,9 @@ export class EditorBreadcrumbs extends Widget {
40
37
  this._context.pathChanged.connect(this._onPathChanged, this);
41
38
  this._render();
42
39
  }
40
+ /**
41
+ * Dispose of the resources held by the widget.
42
+ */
43
43
  dispose() {
44
44
  if (this.isDisposed) {
45
45
  return;
@@ -62,9 +62,7 @@ export class EditorBreadcrumbs extends Widget {
62
62
  parts.forEach((part, index) => {
63
63
  const isLast = index === parts.length - 1;
64
64
  const subPath = parts.slice(0, index + 1).join('/');
65
- // Canonical `@pierre/trees` paths: directories carry a trailing
66
- // slash, files do not. Every part except the last names a folder
67
- // along the way to the open file.
65
+ // Canonical @pierre/trees paths: directories carry a trailing slash.
68
66
  const canonical = isLast ? subPath : `${subPath}/`;
69
67
  const item = document.createElement('span');
70
68
  item.className = ITEM_CLASS;
@@ -94,18 +92,14 @@ export class EditorBreadcrumbs extends Widget {
94
92
  item.dataset.path = '/';
95
93
  item.tabIndex = 0;
96
94
  item.setAttribute('role', 'button');
97
- // Empty canonical path: the reveal command treats this as the
98
- // workspace-root gesture — surface the file browser, clear its
99
- // selection, and scroll back to the top. The tree has no row for
100
- // the workspace root itself.
95
+ // Empty path is the workspace-root gesture; the tree has no row for
96
+ // the root itself.
101
97
  this._attachReveal(item, '');
102
98
  return item;
103
99
  }
104
100
  /**
105
- * Bind click and keyboard activation on a crumb element to the
106
- * shared reveal command. Dispatch is best-effort: a failure to
107
- * resolve or execute the command is logged but never thrown into
108
- * the editor's toolbar.
101
+ * Bind click and keyboard activation on a crumb to the reveal command;
102
+ * dispatch failures are logged, never thrown into the toolbar.
109
103
  */
110
104
  _attachReveal(element, canonicalPath) {
111
105
  const fire = (event) => {
@@ -1,17 +1,9 @@
1
1
  import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
2
  /**
3
- * Sniff each opened document's leading whitespace and configure CodeMirror's
4
- * `indentUnit` / `tabSize` to match. JupyterLab only exposes a single global
5
- * indent setting, which means TypeScript files written with 4-space indent and
6
- * Python files written with 2-space indent both look wrong in the same editor;
7
- * detecting from the file's own content sidesteps that without forcing every
8
- * project to share the same convention.
9
- *
10
- * Detection runs at editor-construction time and again on the first content
11
- * change — that second pass exists because JupyterLab's collaborative document
12
- * loader can settle the file body into the shared model after the editor view
13
- * already exists, in which case the factory would otherwise have only seen an
14
- * empty string.
3
+ * Sniff each document's indentation and configure CodeMirror's `indentUnit` /
4
+ * `tabSize` to match, since JupyterLab only has one global indent setting.
5
+ * Detection reruns on the first content change: the collaborative loader can
6
+ * settle the file body after the editor view exists, so the factory may see ''.
15
7
  */
16
8
  declare const plugin: JupyterFrontEndPlugin<void>;
17
9
  export default plugin;
@@ -5,10 +5,8 @@ import { ViewPlugin } from '@codemirror/view';
5
5
  import detectIndent from 'detect-indent';
6
6
  const PLUGIN_ID = 'xtralab:editor-indent';
7
7
  /**
8
- * Mime types whose newly-created (or too-short-to-detect) files should default
9
- * to a 2-space indent. Matches Prettier's defaults for web languages; mime
10
- * types not listed here inherit whatever the user has set in JupyterLab.
11
- * Covers .ts/.tsx/.jsx/.js variants registered by `@jupyterlab/codemirror`.
8
+ * 2-space fallback for new or undetectable files, matching Prettier's
9
+ * web-language defaults; unlisted mime types keep the user's setting.
12
10
  */
13
11
  const FALLBACK_INDENT_BY_MIME = {
14
12
  'application/ecmascript': 2,
@@ -28,10 +26,6 @@ const FALLBACK_INDENT_BY_MIME = {
28
26
  'text/x-yaml': 2,
29
27
  'text/yaml': 2
30
28
  };
31
- /**
32
- * Run `detect-indent` against the file's content and convert its result into
33
- * something we can hand to CodeMirror.
34
- */
35
29
  function detectFromContent(text) {
36
30
  if (text.length === 0) {
37
31
  return null;
@@ -59,27 +53,18 @@ function resolveIndent(text, mimeType) {
59
53
  return { unit: ' '.repeat(fallback), width: fallback };
60
54
  }
61
55
  function buildExtension(resolved) {
62
- // `Prec.highest` keeps these values first in their respective facets so
63
- // they beat both `defaultConfig` and per-editor `editorConfig.indentUnit`,
64
- // both of which JupyterLab registers at default precedence.
56
+ // `Prec.highest` beats both `defaultConfig` and per-editor
57
+ // `editorConfig.indentUnit`, which JupyterLab registers at default precedence.
65
58
  return Prec.highest([
66
59
  indentUnit.of(resolved.unit),
67
60
  EditorState.tabSize.of(resolved.width)
68
61
  ]);
69
62
  }
70
63
  /**
71
- * Sniff each opened document's leading whitespace and configure CodeMirror's
72
- * `indentUnit` / `tabSize` to match. JupyterLab only exposes a single global
73
- * indent setting, which means TypeScript files written with 4-space indent and
74
- * Python files written with 2-space indent both look wrong in the same editor;
75
- * detecting from the file's own content sidesteps that without forcing every
76
- * project to share the same convention.
77
- *
78
- * Detection runs at editor-construction time and again on the first content
79
- * change — that second pass exists because JupyterLab's collaborative document
80
- * loader can settle the file body into the shared model after the editor view
81
- * already exists, in which case the factory would otherwise have only seen an
82
- * empty string.
64
+ * Sniff each document's indentation and configure CodeMirror's `indentUnit` /
65
+ * `tabSize` to match, since JupyterLab only has one global indent setting.
66
+ * Detection reruns on the first content change: the collaborative loader can
67
+ * settle the file body after the editor view exists, so the factory may see ''.
83
68
  */
84
69
  const plugin = {
85
70
  id: PLUGIN_ID,
@@ -4,15 +4,14 @@ import { IDocumentManager } from '@jupyterlab/docmanager';
4
4
  import { ITranslator } from '@jupyterlab/translation';
5
5
  import { IXtralabFileBrowser } from './widget';
6
6
  /**
7
- * Command identifiers exposed by the xtralab browser. We deliberately namespace
8
- * these under `xtralab:` rather than reusing the `filebrowser:` ids
9
- * because the core `filebrowser:*` commands look up a `FileBrowser` instance
10
- * via `IFileBrowserFactory.tracker` — our widget is not a `FileBrowser`, so
11
- * those handlers would never see it.
7
+ * Command ids for the xtralab browser. Namespaced `xtralab:` rather than
8
+ * reusing the `filebrowser:` ids: the core handlers resolve their target via
9
+ * `IFileBrowserFactory.tracker`, which never sees this widget.
12
10
  */
13
11
  export declare namespace CommandIDs {
14
12
  const open = "xtralab:open";
15
13
  const openBrowserTab = "xtralab:open-browser-tab";
14
+ const openGitDiff = "xtralab:open-git-diff";
16
15
  const rename = "xtralab:rename";
17
16
  const del = "xtralab:delete";
18
17
  const duplicate = "xtralab:duplicate";
@@ -26,27 +25,40 @@ export declare namespace CommandIDs {
26
25
  const revealPath = "xtralab:reveal-path";
27
26
  const revealInFileTree = "xtralab:reveal-in-file-tree";
28
27
  }
28
+ /**
29
+ * Options for registering the xtralab file browser commands.
30
+ */
29
31
  interface IRegisterCommandsOptions {
32
+ /**
33
+ * The JupyterLab application the commands are registered on.
34
+ */
30
35
  app: JupyterFrontEnd;
36
+ /**
37
+ * The file browser widget the commands act on.
38
+ */
31
39
  browser: IXtralabFileBrowser;
40
+ /**
41
+ * The document manager used to resolve the current widget's file path.
42
+ */
32
43
  docManager: IDocumentManager;
44
+ /**
45
+ * The command palette the commands are added to, or `null` when unavailable.
46
+ */
33
47
  palette: ICommandPalette | null;
48
+ /**
49
+ * The translator for user-facing strings; `null` falls back to English.
50
+ */
34
51
  translator: ITranslator | null;
35
52
  }
36
53
  /**
37
- * Register every xtralab command on the application command registry, attach
38
- * the items to the application context menu, and wire up the dynamic
39
- * "Open With" submenu populator.
40
- *
41
- * @returns A function that detaches the menu items and signal listener.
42
- * The commands themselves are owned by the registry for the lifetime of
43
- * the plugin.
54
+ * Register the xtralab commands, context-menu wiring, and the dynamic
55
+ * "Open With" populator. Returns a detach function; the commands themselves
56
+ * stay owned by the registry.
44
57
  */
45
58
  export declare function registerCommands(opts: IRegisterCommandsOptions): () => void;
46
59
  /**
47
- * The names we register with the toolbar. Kept distinct from
48
- * {@link CommandIDs} because the toolbar API uses opaque names rather
49
- * than commands.
60
+ * Toolbar item names, distinct from {@link CommandIDs}: the toolbar API
61
+ * uses opaque names rather than commands.
50
62
  */
51
63
  export declare namespace ToolbarNames {
52
64
  const newLauncher = "new-launcher";
@@ -56,10 +68,8 @@ export declare namespace ToolbarNames {
56
68
  const toggleFileFilter = "toggle-file-filter";
57
69
  }
58
70
  /**
59
- * Populate the file browser's toolbar with the buttons that mirror the
60
- * default JupyterLab file browser: a "+" launcher button, a new-folder
61
- * button, a refresh button, a collapse-all button, and the file filter
62
- * toggle.
71
+ * Populate the toolbar with the buttons that mirror the default JupyterLab
72
+ * file browser.
63
73
  */
64
74
  export declare function populateToolbar(opts: {
65
75
  app: JupyterFrontEnd;