xtralab 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,184 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * xtralab's image diff, registered in place of `@jupyterlab/git:image-diff`.
4
+ *
5
+ * The git server base64-encodes binary content, so both diff hosts receive
6
+ * the two sides as base64 strings through the same `content()` getters used
7
+ * for text. This module turns those strings into `<img>` elements and
8
+ * offers the 2-up / swipe / onion-skin comparison modes; no diffing library
9
+ * is involved (`@pierre/diffs` is text-only).
10
+ */
11
+ /**
12
+ * Raster image extensions xtralab renders as an image diff, mapped to the
13
+ * MIME subtype used in the `data:image/<subtype>;base64,…` URL.
14
+ *
15
+ * `.svg` is intentionally absent: it is XML text, so the `@pierre/diffs`
16
+ * text diff (the fallback provider) is more useful for it than an image
17
+ * comparison.
18
+ */
19
+ const IMAGE_DATA_TYPES = {
20
+ '.png': 'png',
21
+ '.jpg': 'jpeg',
22
+ '.jpeg': 'jpeg',
23
+ '.gif': 'gif',
24
+ '.webp': 'webp',
25
+ '.bmp': 'bmp',
26
+ '.ico': 'x-icon'
27
+ };
28
+ /** The file extensions registered as the xtralab image diff provider. */
29
+ export const IMAGE_DIFF_EXTENSIONS = Object.keys(IMAGE_DATA_TYPES);
30
+ /**
31
+ * The `data:` MIME subtype for a path xtralab renders as an image, or
32
+ * `null` when the path is not a supported raster image.
33
+ */
34
+ export function imageDataType(path) {
35
+ var _a;
36
+ const lower = path.toLowerCase();
37
+ const dot = lower.lastIndexOf('.');
38
+ if (dot < 0) {
39
+ return null;
40
+ }
41
+ return (_a = IMAGE_DATA_TYPES[lower.slice(dot)]) !== null && _a !== void 0 ? _a : null;
42
+ }
43
+ const IMAGE_DIFF_VIEW_MODE_STORAGE_KEY = 'xtralab:image-diff-view-mode';
44
+ function readStoredImageViewMode() {
45
+ try {
46
+ const raw = window.localStorage.getItem(IMAGE_DIFF_VIEW_MODE_STORAGE_KEY);
47
+ if (raw === '2-up' || raw === 'swipe' || raw === 'onion') {
48
+ return raw;
49
+ }
50
+ }
51
+ catch (_a) {
52
+ // localStorage can throw in privacy/sandboxed contexts — 2-up is the
53
+ // sensible default anyway.
54
+ }
55
+ return '2-up';
56
+ }
57
+ function writeStoredImageViewMode(mode) {
58
+ try {
59
+ window.localStorage.setItem(IMAGE_DIFF_VIEW_MODE_STORAGE_KEY, mode);
60
+ }
61
+ catch (_a) {
62
+ // Best-effort.
63
+ }
64
+ }
65
+ /**
66
+ * Strip whitespace from a base64 payload. Python's `base64.encodebytes`
67
+ * (used by the git server) inserts a newline every 76 characters; most
68
+ * browsers tolerate that inside a `data:` URL but some are stricter, and
69
+ * the cleaned length also lets us size the file accurately.
70
+ */
71
+ function cleanBase64(value) {
72
+ return value.replace(/\s+/g, '');
73
+ }
74
+ /** Decoded byte length of a (whitespace-free) base64 string. */
75
+ function base64ByteLength(clean) {
76
+ if (clean.length === 0) {
77
+ return 0;
78
+ }
79
+ const padding = clean.endsWith('==') ? 2 : clean.endsWith('=') ? 1 : 0;
80
+ return Math.floor((clean.length * 3) / 4) - padding;
81
+ }
82
+ function formatBytes(bytes) {
83
+ if (bytes < 1024) {
84
+ return `${bytes} B`;
85
+ }
86
+ const units = ['KB', 'MB', 'GB'];
87
+ let value = bytes / 1024;
88
+ let unit = 0;
89
+ while (value >= 1024 && unit < units.length - 1) {
90
+ value /= 1024;
91
+ unit += 1;
92
+ }
93
+ return `${value.toFixed(value < 10 ? 1 : 0)} ${units[unit]}`;
94
+ }
95
+ function toSide(raw, fileType) {
96
+ const data = cleanBase64(raw);
97
+ const present = data.length > 0;
98
+ return {
99
+ data,
100
+ present,
101
+ uri: present ? `data:image/${fileType};base64,${data}` : null,
102
+ bytes: base64ByteLength(data)
103
+ };
104
+ }
105
+ /**
106
+ * The image comparison surface: a segmented mode selector (reusing the
107
+ * diff segmented-control styling so it matches the Notebook/JSON toggle)
108
+ * plus the selected 2-up / swipe / onion-skin view.
109
+ */
110
+ export function ImageDiffView(props) {
111
+ const { reference, challenger, fileType } = props;
112
+ const ref = React.useMemo(() => toSide(reference, fileType), [reference, fileType]);
113
+ const chall = React.useMemo(() => toSide(challenger, fileType), [challenger, fileType]);
114
+ const [mode, setMode] = React.useState(() => readStoredImageViewMode());
115
+ const changeMode = React.useCallback((next) => {
116
+ setMode(next);
117
+ writeStoredImageViewMode(next);
118
+ }, []);
119
+ return (React.createElement("div", { className: "jp-xtralab-ImageDiff" },
120
+ React.createElement("div", { className: "jp-xtralab-ImageDiff-header" },
121
+ React.createElement("div", { className: "jp-xtralab-DiffWidget-segmented", role: "tablist", "aria-label": "Image diff view mode" }, [
122
+ ['2-up', '2-up'],
123
+ ['swipe', 'Swipe'],
124
+ ['onion', 'Onion Skin']
125
+ ].map(([value, label]) => (React.createElement("button", { key: value, type: "button", role: "tab", "aria-selected": mode === value, "data-active": mode === value, className: "jp-xtralab-DiffWidget-segmentedButton", onClick: () => changeMode(value) }, label))))),
126
+ React.createElement("div", { className: "jp-xtralab-ImageDiff-body" }, mode === '2-up' ? (React.createElement(TwoUp, { reference: ref, challenger: chall })) : mode === 'swipe' ? (React.createElement(Swipe, { reference: ref, challenger: chall })) : (React.createElement(OnionSkin, { reference: ref, challenger: chall })))));
127
+ }
128
+ function useNaturalSize() {
129
+ const [size, setSize] = React.useState(null);
130
+ const onLoad = React.useCallback((event) => {
131
+ setSize([
132
+ event.currentTarget.naturalWidth,
133
+ event.currentTarget.naturalHeight
134
+ ]);
135
+ }, []);
136
+ return [size, onLoad];
137
+ }
138
+ function caption(side, size, emptyLabel) {
139
+ if (!side.present) {
140
+ return emptyLabel;
141
+ }
142
+ const dims = size !== null ? `${size[0]}×${size[1]} · ` : '';
143
+ return `${dims}${formatBytes(side.bytes)}`;
144
+ }
145
+ function TwoUp({ reference, challenger }) {
146
+ const [refSize, onRefLoad] = useNaturalSize();
147
+ const [challSize, onChallLoad] = useNaturalSize();
148
+ return (React.createElement("div", { className: "jp-xtralab-ImageDiff-twoUp" },
149
+ React.createElement("figure", { className: "jp-xtralab-ImageDiff-col" },
150
+ React.createElement("div", { className: "jp-xtralab-ImageDiff-frame", "data-side": "reference" }, reference.uri !== null ? (React.createElement("img", { className: "jp-xtralab-ImageDiff-img", src: reference.uri, alt: "Reference revision", onLoad: onRefLoad })) : (React.createElement("div", { className: "jp-xtralab-ImageDiff-empty" }, "No previous image"))),
151
+ React.createElement("figcaption", { className: "jp-xtralab-ImageDiff-caption" }, caption(reference, refSize, 'Added'))),
152
+ React.createElement("figure", { className: "jp-xtralab-ImageDiff-col" },
153
+ React.createElement("div", { className: "jp-xtralab-ImageDiff-frame", "data-side": "challenger" }, challenger.uri !== null ? (React.createElement("img", { className: "jp-xtralab-ImageDiff-img", src: challenger.uri, alt: "Challenger revision", onLoad: onChallLoad })) : (React.createElement("div", { className: "jp-xtralab-ImageDiff-empty" }, "Deleted"))),
154
+ React.createElement("figcaption", { className: "jp-xtralab-ImageDiff-caption" }, caption(challenger, challSize, 'Deleted')))));
155
+ }
156
+ /**
157
+ * Range slider shared by the swipe and onion-skin views. A native
158
+ * `<input type="range">` (styled via CSS) keeps the bundle free of a UI
159
+ * component dependency.
160
+ */
161
+ function RangeSlider(props) {
162
+ const { value, onChange, ariaLabel } = props;
163
+ return (React.createElement("input", { className: "jp-xtralab-ImageDiff-slider", type: "range", min: 0, max: 100, step: 1, value: value, "aria-label": ariaLabel, onChange: event => onChange(Number(event.target.value)) }));
164
+ }
165
+ function Swipe({ reference, challenger }) {
166
+ const [position, setPosition] = React.useState(50);
167
+ return (React.createElement("div", { className: "jp-xtralab-ImageDiff-interactive" },
168
+ React.createElement("div", { className: "jp-xtralab-ImageDiff-stack" },
169
+ reference.uri !== null ? (React.createElement("img", { className: "jp-xtralab-ImageDiff-stackImg", src: reference.uri, alt: "Reference revision", style: {
170
+ clipPath: `inset(0 ${100 - position}% 0 0)`
171
+ } })) : null,
172
+ challenger.uri !== null ? (React.createElement("img", { className: "jp-xtralab-ImageDiff-stackImg", src: challenger.uri, alt: "Challenger revision", style: {
173
+ clipPath: `inset(0 0 0 ${position}%)`
174
+ } })) : null),
175
+ React.createElement(RangeSlider, { value: position, onChange: setPosition, ariaLabel: "Swipe between reference and challenger" })));
176
+ }
177
+ function OnionSkin({ reference, challenger }) {
178
+ const [opacity, setOpacity] = React.useState(50);
179
+ return (React.createElement("div", { className: "jp-xtralab-ImageDiff-interactive" },
180
+ React.createElement("div", { className: "jp-xtralab-ImageDiff-stack" },
181
+ reference.uri !== null ? (React.createElement("img", { className: "jp-xtralab-ImageDiff-stackImg", src: reference.uri, alt: "Reference revision" })) : null,
182
+ challenger.uri !== null ? (React.createElement("img", { className: "jp-xtralab-ImageDiff-stackImg", src: challenger.uri, alt: "Challenger revision", style: { opacity: opacity / 100 } })) : null),
183
+ React.createElement(RangeSlider, { value: opacity, onChange: setOpacity, ariaLabel: "Fade between reference and challenger" })));
184
+ }
@@ -1,11 +1,13 @@
1
1
  import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+ import { CommandArguments, CommandIDs } from './commands';
2
3
  /**
3
- * The git plugin. Adds a VS Code-style "Source Control" panel to the
4
- * JupyterLab left sidebar and opens file diffs in the main area when the
5
- * user clicks an entry in the panel. Backed by the `jupyterlab_git` server
6
- * extension's REST API; the bundled `@jupyterlab/git` frontend is disabled
7
- * via `package.json`'s `jupyterlab.disabledExtensions` so the two panels do
8
- * not coexist.
4
+ * Every plugin contributed by xtralab's git integration:
5
+ *
6
+ * 1. {@link diffCommandPlugin} — the launcher's `xtralab:git:open-diff`.
7
+ * 2. `diffProviderPlugin` — registers the `@pierre/diffs` rendering as
8
+ * jupyterlab-git's diff providers (replacing its disabled
9
+ * notebook/text diff plugins).
9
10
  */
10
- declare const plugin: JupyterFrontEndPlugin<void>;
11
- export default plugin;
11
+ declare const plugins: JupyterFrontEndPlugin<unknown>[];
12
+ export { CommandArguments, CommandIDs };
13
+ export default plugins;
package/lib/git/index.js CHANGED
@@ -1,36 +1,29 @@
1
- import { ILayoutRestorer } from '@jupyterlab/application';
2
- import { Dialog, ICommandPalette, IThemeManager, WidgetTracker, showDialog, showErrorMessage } from '@jupyterlab/apputils';
1
+ import { IThemeManager, WidgetTracker } from '@jupyterlab/apputils';
3
2
  import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
4
3
  import { CommandIDs, registerGitCommands } from './commands';
5
4
  import { PREVIEW_DIFF_WIDGET_ID, pinnedDiffWidgetId } from './diffWidget';
6
- import { GitPanel } from './panel';
7
- const GIT_PLUGIN_ID = 'xtralab:git';
5
+ import diffProviderPlugin from './diffProvider';
6
+ const GIT_DIFF_COMMAND_PLUGIN_ID = 'xtralab:git-diff-command';
8
7
  const GIT_DIFF_TRACKER_NAMESPACE = 'xtralab-git-diff';
9
8
  /**
10
- * The git plugin. Adds a VS Code-style "Source Control" panel to the
11
- * JupyterLab left sidebar and opens file diffs in the main area when the
12
- * user clicks an entry in the panel. Backed by the `jupyterlab_git` server
13
- * extension's REST API; the bundled `@jupyterlab/git` frontend is disabled
14
- * via `package.json`'s `jupyterlab.disabledExtensions` so the two panels do
15
- * not coexist.
9
+ * The launcher's git diff command plugin.
10
+ *
11
+ * The `@jupyterlab/git` frontend stays enabled (only its diff plugins are
12
+ * swapped — see `diffProvider.tsx`), so the upstream git panel is what the
13
+ * user sees in the sidebar. This plugin is the launcher dashboard's
14
+ * independent diff path: the `xtralab:git:open-diff` command the
15
+ * dashboard's "Changes" section calls, plus a tracker so reopening a diff
16
+ * reveals the existing tab and the preview/pin behavior keeps working.
16
17
  */
17
- const plugin = {
18
- id: GIT_PLUGIN_ID,
19
- description: 'A VS Code-style git changes panel and diff viewer powered by jupyterlab-git and @pierre/diffs.',
18
+ const diffCommandPlugin = {
19
+ id: GIT_DIFF_COMMAND_PLUGIN_ID,
20
+ description: "The launcher dashboard's side-by-side git diff command, powered by @pierre/diffs.",
20
21
  autoStart: true,
21
- optional: [
22
- ILayoutRestorer,
23
- IThemeManager,
24
- ICommandPalette,
25
- IRenderMimeRegistry
26
- ],
27
- activate: (app, restorer, themeManager, commandPalette, rendermime) => {
28
- // Match the panel's repo path: empty string means "use the JupyterLab
29
- // server's root and let git resolve the enclosing repo".
30
- const repoPath = '';
31
- // Track open diff widgets so the layout restorer can recreate them on
32
- // reload, and so the openDiff handler can reveal an already-open diff
33
- // for the same file instead of creating a duplicate.
22
+ optional: [IThemeManager, IRenderMimeRegistry],
23
+ activate: (app, themeManager, rendermime) => {
24
+ // Track open diff widgets so the openDiff handler can reveal an
25
+ // already-open diff for the same file instead of creating a duplicate
26
+ // (and so a promoted preview can find its pinned twin).
34
27
  const tracker = new WidgetTracker({
35
28
  namespace: GIT_DIFF_TRACKER_NAMESPACE
36
29
  });
@@ -39,36 +32,15 @@ const plugin = {
39
32
  const existing = tracker.find(widget => !widget.isDisposed && widget.id === id);
40
33
  return existing !== null && existing !== void 0 ? existing : undefined;
41
34
  };
42
- const panel = new GitPanel({
43
- openDiff: (change, options) => {
44
- const args = { repoPath, change };
45
- if ((options === null || options === void 0 ? void 0 : options.pin) === true) {
46
- args.pin = true;
47
- }
48
- void app.commands.execute(CommandIDs.openDiff, args);
49
- },
50
- confirm: async (title, body, accept) => {
51
- const result = await showDialog({
52
- title,
53
- body,
54
- buttons: [Dialog.cancelButton(), Dialog.warnButton({ label: accept })]
55
- });
56
- return result.button.accept === true;
57
- },
58
- showError: showErrorMessage
59
- });
60
- app.shell.add(panel, 'left', { rank: 60 });
61
- if (restorer !== null) {
62
- restorer.add(panel, panel.id);
63
- }
64
35
  registerGitCommands({
65
36
  app,
66
- panel,
67
37
  themeManager,
68
- commandPalette,
69
38
  contentsManager: app.serviceManager.contents,
70
39
  rendermime,
71
- onChanged: () => panel.refresh(),
40
+ // The launcher polls git status on its own cadence and the
41
+ // jupyterlab-git panel auto-refreshes on the contents `fileChanged`
42
+ // signal a hunk-discard save emits, so no extra refresh is needed.
43
+ onChanged: () => undefined,
72
44
  trackDiff: widget => tracker.add(widget),
73
45
  onPinned: current => {
74
46
  const existing = findDiff(current.content.change, true);
@@ -87,4 +59,17 @@ const plugin = {
87
59
  });
88
60
  }
89
61
  };
90
- export default plugin;
62
+ /**
63
+ * Every plugin contributed by xtralab's git integration:
64
+ *
65
+ * 1. {@link diffCommandPlugin} — the launcher's `xtralab:git:open-diff`.
66
+ * 2. `diffProviderPlugin` — registers the `@pierre/diffs` rendering as
67
+ * jupyterlab-git's diff providers (replacing its disabled
68
+ * notebook/text diff plugins).
69
+ */
70
+ const plugins = [
71
+ diffCommandPlugin,
72
+ diffProviderPlugin
73
+ ];
74
+ export { CommandIDs };
75
+ export default plugins;
package/lib/index.d.ts CHANGED
@@ -2,9 +2,10 @@ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
2
  /**
3
3
  * Every plugin contributed by `xtralab`. The entry point of the
4
4
  * labextension is an array because the package bundles several independent
5
- * enhancements (file browser, git changes panel, …) — JupyterLab activates
5
+ * enhancements (file browser, git diff providers, …) — JupyterLab activates
6
6
  * each plugin individually and only the ones whose required tokens are
7
- * available end up running.
7
+ * available end up running. `gitPlugins` is itself an array (the launcher
8
+ * diff command + the jupyterlab-git diff providers), so it is spread in.
8
9
  */
9
10
  declare const plugins: JupyterFrontEndPlugin<unknown>[];
10
11
  export default plugins;
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import fileBrowserPlugin from './fileBrowser';
2
2
  import editorBreadcrumbsPlugin from './editorBreadcrumbs';
3
3
  import editorIndentPlugin from './editorIndent';
4
- import gitPlugin from './git';
4
+ import gitPlugins from './git';
5
5
  import launcherPlugin from './launcher';
6
6
  import menusPlugin from './menus';
7
7
  import sidebarPlugin from './sidebar';
@@ -9,15 +9,16 @@ import statusBarPlugin from './statusBar';
9
9
  /**
10
10
  * Every plugin contributed by `xtralab`. The entry point of the
11
11
  * labextension is an array because the package bundles several independent
12
- * enhancements (file browser, git changes panel, …) — JupyterLab activates
12
+ * enhancements (file browser, git diff providers, …) — JupyterLab activates
13
13
  * each plugin individually and only the ones whose required tokens are
14
- * available end up running.
14
+ * available end up running. `gitPlugins` is itself an array (the launcher
15
+ * diff command + the jupyterlab-git diff providers), so it is spread in.
15
16
  */
16
17
  const plugins = [
17
18
  editorBreadcrumbsPlugin,
18
19
  editorIndentPlugin,
19
20
  fileBrowserPlugin,
20
- gitPlugin,
21
+ ...gitPlugins,
21
22
  launcherPlugin,
22
23
  menusPlugin,
23
24
  sidebarPlugin,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xtralab",
3
- "version": "0.4.0",
4
- "description": "An opinionated JupyterLab meta-package that bundles a curated set of extensions, ships a path-first file browser and a VS Code-style git changes panel, and applies a quieter default workspace configuration.",
3
+ "version": "0.5.0",
4
+ "description": "An opinionated JupyterLab meta-package that bundles a curated set of extensions, ships a path-first file browser, renders jupyterlab-git's text, notebook and image diffs with its own viewers, and applies a quieter default workspace configuration.",
5
5
  "keywords": [
6
6
  "jupyter",
7
7
  "jupyterlab",
@@ -66,6 +66,7 @@
66
66
  "@jupyterlab/coreutils": "^6.6.0-alpha.5",
67
67
  "@jupyterlab/docmanager": "^4.6.0-alpha.5",
68
68
  "@jupyterlab/docregistry": "^4.6.0-alpha.5",
69
+ "@jupyterlab/git": "^0.54.0-a0",
69
70
  "@jupyterlab/launcher": "^4.6.0-alpha.5",
70
71
  "@jupyterlab/mainmenu": "^4.6.0-alpha.5",
71
72
  "@jupyterlab/nbformat": "^4.6.0-alpha.5",
@@ -131,8 +132,16 @@
131
132
  "extension": true,
132
133
  "outputDir": "xtralab/labextension",
133
134
  "schemaDir": "schema",
135
+ "sharedPackages": {
136
+ "@jupyterlab/git": {
137
+ "bundled": false,
138
+ "singleton": true
139
+ }
140
+ },
134
141
  "disabledExtensions": [
135
- "@jupyterlab/git",
142
+ "@jupyterlab/git:notebook-diff",
143
+ "@jupyterlab/git:plain-text-diff",
144
+ "@jupyterlab/git:image-diff",
136
145
  "@jupyterlab/launcher-extension"
137
146
  ]
138
147
  },
@@ -140,7 +149,12 @@
140
149
  "node_modules",
141
150
  "dist",
142
151
  "coverage",
143
- "**/*.d.ts"
152
+ "**/*.d.ts",
153
+ "desktop/out",
154
+ "desktop/dist",
155
+ "desktop/python/wheels",
156
+ "desktop/python/runtime",
157
+ "desktop/python/runtime.staging"
144
158
  ],
145
159
  "eslintConfig": {
146
160
  "extends": [
@@ -1,8 +1,7 @@
1
1
  import { JupyterFrontEnd } from '@jupyterlab/application';
2
- import { ICommandPalette, IThemeManager } from '@jupyterlab/apputils';
2
+ import { IThemeManager } from '@jupyterlab/apputils';
3
3
  import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
4
4
  import { Contents } from '@jupyterlab/services';
5
- import { refreshIcon } from '@jupyterlab/ui-components';
6
5
  import { ReadonlyPartialJSONObject } from '@lumino/coreutils';
7
6
 
8
7
  import {
@@ -10,16 +9,15 @@ import {
10
9
  diffWidgetId,
11
10
  updateGitDiffWidget
12
11
  } from './diffWidget';
13
- import { GitPanel } from './panel';
14
12
  import { IFileChange } from './tokens';
15
13
 
16
14
  /**
17
- * Command IDs exposed by the git plugin. Both are registered in
18
- * {@link registerGitCommands} so other extensions, the command palette and
19
- * keybindings can drive the panel without going through the React internals.
15
+ * Command IDs exposed by the launcher's git diff path. The launcher
16
+ * dashboard's "Changes" section drives {@link CommandIDs.openDiff} to open
17
+ * its own diff tab, independent of `jupyterlab-git` (whose panel reaches
18
+ * the same rendering via the providers in `diffProvider.tsx`).
20
19
  */
21
20
  export namespace CommandIDs {
22
- export const refresh = 'xtralab:git:refresh';
23
21
  export const openDiff = 'xtralab:git:open-diff';
24
22
  }
25
23
 
@@ -39,9 +37,7 @@ export namespace CommandArguments {
39
37
 
40
38
  export interface IRegisterGitCommandsOptions {
41
39
  app: JupyterFrontEnd;
42
- panel: GitPanel;
43
40
  themeManager: IThemeManager | null;
44
- commandPalette: ICommandPalette | null;
45
41
  /**
46
42
  * Contents manager used by the diff widget to write hunk-discard
47
43
  * results back to the working tree.
@@ -56,7 +52,10 @@ export interface IRegisterGitCommandsOptions {
56
52
  rendermime: IRenderMimeRegistry | null;
57
53
  /**
58
54
  * Called whenever the diff widget mutates the working tree (e.g. after
59
- * a hunk discard) so the plugin can refresh the changes panel.
55
+ * a hunk discard). The launcher dashboard polls git status on its own
56
+ * cadence and `jupyterlab-git`'s panel auto-refreshes on the contents
57
+ * `fileChanged` signal the save emits, so this is a hook for any extra
58
+ * bookkeeping rather than a required refresh.
60
59
  */
61
60
  onChanged: () => void;
62
61
  /**
@@ -77,18 +76,15 @@ export interface IRegisterGitCommandsOptions {
77
76
  }
78
77
 
79
78
  /**
80
- * Register the git commands on the application command registry. Returns
81
- * a disposer that clears the command palette items the registration created
82
- * (the commands themselves stay registered for the lifetime of the plugin).
79
+ * Register the launcher's git diff command on the application command
80
+ * registry.
83
81
  */
84
82
  export function registerGitCommands(
85
83
  options: IRegisterGitCommandsOptions
86
- ): () => void {
84
+ ): void {
87
85
  const {
88
86
  app,
89
- panel,
90
87
  themeManager,
91
- commandPalette,
92
88
  contentsManager,
93
89
  rendermime,
94
90
  onChanged,
@@ -98,15 +94,6 @@ export function registerGitCommands(
98
94
  } = options;
99
95
  const { commands } = app;
100
96
 
101
- commands.addCommand(CommandIDs.refresh, {
102
- label: 'Refresh Git Changes',
103
- caption: 'Refresh the git changes panel',
104
- icon: refreshIcon,
105
- execute: () => {
106
- panel.refresh();
107
- }
108
- });
109
-
110
97
  commands.addCommand(CommandIDs.openDiff, {
111
98
  label: 'Open Git Diff',
112
99
  caption: 'Open a side-by-side diff for a changed file',
@@ -139,19 +126,6 @@ export function registerGitCommands(
139
126
  app.shell.activateById(widget.id);
140
127
  }
141
128
  });
142
-
143
- const paletteItems = commandPalette
144
- ? [
145
- commandPalette.addItem({
146
- command: CommandIDs.refresh,
147
- category: 'Git'
148
- })
149
- ]
150
- : [];
151
-
152
- return () => {
153
- paletteItems.forEach(item => item.dispose());
154
- };
155
129
  }
156
130
 
157
131
  export { diffWidgetId };