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
|
@@ -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
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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,
|
package/src/fileBrowser/icons.ts
CHANGED
|
@@ -6,37 +6,23 @@ import {
|
|
|
6
6
|
import type { FileTreeIconConfig } from '@pierre/trees';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
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="
|
|
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
|
|
29
|
-
*
|
|
30
|
-
*
|
|
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
|
|
52
|
-
*
|
|
53
|
-
*
|
|
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
|
-
*
|
|
87
|
-
*
|
|
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
|
-
//
|
|
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
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
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
|
-
*
|
|
187
|
-
*
|
|
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
|
|
223
|
-
//
|
|
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
|
|
236
|
-
//
|
|
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({
|
package/src/fileBrowser/index.ts
CHANGED
|
@@ -51,10 +51,8 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
51
51
|
},
|
|
52
52
|
translator: translator ?? undefined
|
|
53
53
|
});
|
|
54
|
-
//
|
|
55
|
-
//
|
|
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);
|