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.
- package/README.md +65 -30
- package/lib/about/icons.d.ts +0 -5
- package/lib/about/icons.js +0 -5
- package/lib/about/index.d.ts +4 -8
- package/lib/about/index.js +6 -17
- package/lib/agentSessions.d.ts +9 -29
- package/lib/agentSessions.js +2 -7
- package/lib/askAgent/editorSelection.d.ts +20 -26
- package/lib/askAgent/editorSelection.js +11 -26
- package/lib/askAgent/icons.d.ts +2 -3
- package/lib/askAgent/icons.js +2 -3
- package/lib/askAgent/index.d.ts +4 -26
- package/lib/askAgent/index.js +54 -158
- package/lib/askAgent/popup.d.ts +12 -16
- package/lib/askAgent/popup.js +18 -37
- package/lib/askAgent/prompt.d.ts +3 -5
- package/lib/askAgent/prompt.js +6 -19
- package/lib/askAgent/queue.d.ts +11 -21
- package/lib/askAgent/queue.js +9 -19
- package/lib/askAgent/queuePanel.d.ts +13 -18
- package/lib/askAgent/queuePanel.js +15 -37
- package/lib/askAgent/targetPicker.d.ts +2 -9
- package/lib/askAgent/targetPicker.js +6 -11
- package/lib/askAgent/tokens.d.ts +32 -46
- package/lib/askAgent/tokens.js +4 -6
- package/lib/commandBar/index.d.ts +4 -13
- package/lib/commandBar/index.js +21 -39
- package/lib/customPanel/index.js +15 -0
- package/lib/editorBreadcrumbs/index.d.ts +3 -6
- package/lib/editorBreadcrumbs/index.js +10 -6
- package/lib/editorBreadcrumbs/widget.d.ts +17 -4
- package/lib/editorBreadcrumbs/widget.js +11 -17
- package/lib/editorIndent/index.d.ts +4 -12
- package/lib/editorIndent/index.js +8 -23
- package/lib/fileBrowser/commands.d.ts +29 -19
- package/lib/fileBrowser/commands.js +83 -97
- package/lib/fileBrowser/contents.d.ts +3 -0
- package/lib/fileBrowser/dragAndDrop.d.ts +17 -4
- package/lib/fileBrowser/dragAndDrop.js +2 -7
- package/lib/fileBrowser/fileBrowser.d.ts +19 -9
- package/lib/fileBrowser/fileBrowser.js +70 -222
- package/lib/fileBrowser/gitStatus.d.ts +16 -10
- package/lib/fileBrowser/gitStatus.js +31 -30
- package/lib/fileBrowser/gitignore.d.ts +4 -17
- package/lib/fileBrowser/gitignore.js +4 -25
- package/lib/fileBrowser/icons.d.ts +7 -17
- package/lib/fileBrowser/icons.js +25 -80
- package/lib/fileBrowser/index.js +2 -4
- package/lib/fileBrowser/widget.d.ts +141 -48
- package/lib/fileBrowser/widget.js +102 -4
- package/lib/fileTypeIcons/index.js +0 -10
- package/lib/git/api.d.ts +5 -13
- package/lib/git/api.js +10 -36
- package/lib/git/askRequest.d.ts +4 -8
- package/lib/git/askRequest.js +6 -20
- package/lib/git/commands.d.ts +45 -5
- package/lib/git/commands.js +20 -13
- package/lib/git/diffModel.js +4 -0
- package/lib/git/diffPreferences.d.ts +90 -0
- package/lib/git/diffPreferences.js +107 -0
- package/lib/git/diffProvider.js +10 -2
- package/lib/git/diffSurface.d.ts +64 -63
- package/lib/git/diffSurface.js +72 -213
- package/lib/git/diffTheme.d.ts +7 -0
- package/lib/git/diffTheme.js +23 -0
- package/lib/git/diffWidget.d.ts +70 -14
- package/lib/git/diffWidget.js +100 -94
- package/lib/git/imageDiff.d.ts +14 -6
- package/lib/git/imageDiff.js +19 -75
- package/lib/git/index.d.ts +0 -3
- package/lib/git/index.js +44 -10
- package/lib/git/notebookDiff.d.ts +110 -33
- package/lib/git/notebookDiff.js +55 -197
- package/lib/git/tokens.d.ts +73 -31
- package/lib/git/tokens.js +2 -3
- package/lib/highlight/index.d.ts +4 -10
- package/lib/highlight/index.js +10 -41
- package/lib/index.d.ts +0 -9
- package/lib/index.js +0 -9
- package/lib/launcher/agents.d.ts +55 -51
- package/lib/launcher/agents.js +15 -57
- package/lib/launcher/availability.d.ts +3 -9
- package/lib/launcher/availability.js +3 -9
- package/lib/launcher/commands.d.ts +7 -32
- package/lib/launcher/commands.js +14 -45
- package/lib/launcher/dashboard.d.ts +19 -24
- package/lib/launcher/dashboard.js +21 -67
- package/lib/launcher/editorRegistry.d.ts +10 -22
- package/lib/launcher/editorRegistry.js +14 -18
- package/lib/launcher/editors.d.ts +39 -45
- package/lib/launcher/editors.js +8 -34
- package/lib/launcher/icons.d.ts +0 -12
- package/lib/launcher/icons.js +5 -39
- package/lib/launcher/index.js +12 -55
- package/lib/launcher/invocation.d.ts +4 -10
- package/lib/launcher/invocation.js +7 -22
- package/lib/launcher/registry.d.ts +9 -7
- package/lib/launcher/registry.js +9 -7
- package/lib/launcher/tokens.d.ts +10 -22
- package/lib/launcher/tokens.js +5 -8
- package/lib/menuBar/index.d.ts +3 -10
- package/lib/menuBar/index.js +11 -28
- package/lib/menus/index.d.ts +3 -9
- package/lib/menus/index.js +14 -30
- package/lib/omnibox/files.d.ts +2 -4
- package/lib/omnibox/files.js +5 -11
- package/lib/omnibox/index.d.ts +4 -14
- package/lib/omnibox/index.js +9 -27
- package/lib/omnibox/model.d.ts +38 -10
- package/lib/omnibox/model.js +15 -33
- package/lib/omnibox/recents.d.ts +15 -17
- package/lib/omnibox/recents.js +12 -17
- package/lib/omnibox/tokens.d.ts +5 -10
- package/lib/omnibox/tokens.js +2 -6
- package/lib/omnibox/widget.d.ts +11 -7
- package/lib/omnibox/widget.js +8 -16
- package/lib/searchReplace/index.d.ts +4 -20
- package/lib/searchReplace/index.js +7 -27
- package/lib/showOutput/index.d.ts +3 -12
- package/lib/showOutput/index.js +6 -22
- package/lib/sidebar/index.d.ts +4 -7
- package/lib/sidebar/index.js +5 -12
- package/lib/terminalNotifications/index.d.ts +4 -10
- package/lib/terminalNotifications/index.js +6 -20
- package/lib/terminals/agentTerminals.d.ts +12 -5
- package/lib/terminals/agentTerminals.js +25 -44
- package/lib/terminals/detection.d.ts +4 -8
- package/lib/terminals/detection.js +4 -8
- package/lib/terminals/index.d.ts +0 -35
- package/lib/terminals/index.js +12 -101
- package/lib/terminals/model.d.ts +64 -139
- package/lib/terminals/model.js +80 -220
- package/lib/terminals/tokens.d.ts +11 -22
- package/lib/terminals/tokens.js +2 -2
- package/lib/terminals/widget.d.ts +43 -13
- package/lib/terminals/widget.js +33 -18
- package/lib/topBar/icons.d.ts +3 -8
- package/lib/topBar/icons.js +3 -8
- package/lib/topBar/index.d.ts +4 -11
- package/lib/topBar/index.js +10 -38
- package/lib/walkthrough/index.d.ts +4 -9
- package/lib/walkthrough/index.js +6 -20
- package/lib/walkthrough/panel.d.ts +40 -9
- package/lib/walkthrough/panel.js +4 -10
- package/package.json +5 -3
- package/schema/git-diff-preferences.json +42 -0
- package/src/about/icons.ts +0 -5
- package/src/about/index.tsx +6 -17
- package/src/agentSessions.ts +9 -29
- package/src/askAgent/editorSelection.ts +22 -29
- package/src/askAgent/icons.ts +2 -3
- package/src/askAgent/index.ts +54 -158
- package/src/askAgent/popup.tsx +23 -45
- package/src/askAgent/prompt.ts +6 -19
- package/src/askAgent/queue.ts +13 -24
- package/src/askAgent/queuePanel.tsx +21 -46
- package/src/askAgent/targetPicker.tsx +5 -15
- package/src/askAgent/tokens.ts +32 -46
- package/src/commandBar/index.ts +24 -39
- package/src/customPanel/index.ts +15 -0
- package/src/editorBreadcrumbs/index.ts +10 -6
- package/src/editorBreadcrumbs/widget.ts +23 -17
- package/src/editorIndent/index.ts +17 -23
- package/src/fileBrowser/commands.ts +119 -96
- package/src/fileBrowser/contents.ts +3 -0
- package/src/fileBrowser/dragAndDrop.ts +17 -7
- package/src/fileBrowser/fileBrowser.tsx +86 -230
- package/src/fileBrowser/gitStatus.ts +36 -33
- package/src/fileBrowser/gitignore.ts +4 -25
- package/src/fileBrowser/icons.ts +25 -80
- package/src/fileBrowser/index.ts +2 -4
- package/src/fileBrowser/widget.tsx +171 -50
- package/src/fileTypeIcons/index.ts +0 -10
- package/src/git/api.ts +10 -36
- package/src/git/askRequest.ts +6 -20
- package/src/git/commands.ts +83 -11
- package/src/git/diffModel.ts +25 -0
- package/src/git/diffPreferences.ts +192 -0
- package/src/git/diffProvider.tsx +11 -2
- package/src/git/diffSurface.tsx +165 -286
- package/src/git/diffTheme.ts +24 -0
- package/src/git/diffWidget.tsx +194 -134
- package/src/git/imageDiff.tsx +56 -84
- package/src/git/index.ts +54 -10
- package/src/git/notebookDiff.tsx +214 -240
- package/src/git/tokens.ts +73 -31
- package/src/highlight/index.ts +10 -41
- package/src/index.ts +0 -9
- package/src/launcher/agents.ts +64 -95
- package/src/launcher/availability.ts +3 -9
- package/src/launcher/commands.ts +14 -51
- package/src/launcher/dashboard.tsx +49 -88
- package/src/launcher/editorRegistry.ts +21 -29
- package/src/launcher/editors.ts +39 -58
- package/src/launcher/icons.ts +5 -39
- package/src/launcher/index.ts +12 -55
- package/src/launcher/invocation.ts +7 -22
- package/src/launcher/registry.ts +9 -7
- package/src/launcher/tokens.ts +10 -22
- package/src/menuBar/index.ts +11 -28
- package/src/menus/index.ts +14 -30
- package/src/omnibox/files.ts +10 -14
- package/src/omnibox/index.ts +9 -27
- package/src/omnibox/model.ts +50 -38
- package/src/omnibox/recents.ts +17 -22
- package/src/omnibox/tokens.ts +5 -10
- package/src/omnibox/widget.tsx +14 -19
- package/src/searchReplace/index.ts +7 -27
- package/src/showOutput/index.ts +6 -22
- package/src/sidebar/index.ts +20 -12
- package/src/terminalNotifications/index.ts +42 -25
- package/src/terminals/agentTerminals.ts +25 -49
- package/src/terminals/detection.ts +4 -8
- package/src/terminals/index.ts +12 -101
- package/src/terminals/model.ts +130 -246
- package/src/terminals/tokens.ts +11 -22
- package/src/terminals/widget.tsx +48 -31
- package/src/topBar/icons.ts +3 -8
- package/src/topBar/index.ts +21 -44
- package/src/walkthrough/index.ts +6 -20
- package/src/walkthrough/panel.ts +40 -10
- package/style/about.css +2 -7
- package/style/askAgent.css +8 -40
- package/style/base.css +9 -45
- package/style/chrome.css +108 -308
- package/style/commandBar.css +4 -20
- package/style/customPanel.css +1 -4
- package/style/git.css +26 -186
- package/style/highlight.css +1 -3
- package/style/launcher.css +6 -70
- package/style/omnibox.css +2 -14
- package/style/showOutput.css +0 -6
- package/style/sidebar.css +29 -9
- package/style/tabs.css +5 -13
- package/style/terminals.css +6 -53
- package/style/topBar.css +2 -22
- package/style/walkthrough.css +0 -8
package/lib/commandBar/index.js
CHANGED
|
@@ -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
|
|
23
|
-
*
|
|
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
|
-
//
|
|
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
|
-
//
|
|
52
|
-
//
|
|
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
|
|
85
|
-
*
|
|
86
|
-
*
|
|
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)
|
package/lib/customPanel/index.js
CHANGED
|
@@ -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
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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
|
|
22
|
-
*
|
|
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
|
-
*
|
|
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
|
-
//
|
|
30
|
-
//
|
|
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
|
|
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
|
|
98
|
-
//
|
|
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
|
|
106
|
-
*
|
|
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
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
-
*
|
|
9
|
-
*
|
|
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`
|
|
63
|
-
//
|
|
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
|
|
72
|
-
* `
|
|
73
|
-
*
|
|
74
|
-
*
|
|
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
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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
|
|
38
|
-
*
|
|
39
|
-
*
|
|
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
|
-
*
|
|
48
|
-
*
|
|
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
|
|
60
|
-
*
|
|
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;
|