Skip to content

Commit 27e857f

Browse files
feat: add contribution names for remapping in downstream apps
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent fe35313 commit 27e857f

7 files changed

Lines changed: 79 additions & 11 deletions

File tree

packages/core/src/commands/global.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { registerAll } from "../core/commandregistry";
22
import { CommandContribution } from "../core/contributionregistry";
33
import { TOOLBAR_MAIN_RIGHT } from "../core/constants";
4+
import { TOOLBAR_FULLSCREEN, TOOLBAR_THEME_SWITCHER } from "../core/ui-ids";
45
import { EditorInput, editorRegistry } from "../core/editorregistry";
56
import { html } from "lit";
67
import { toastError, toastInfo } from "../core/toast";
@@ -74,6 +75,7 @@ registerAll({
7475
},
7576
contribution: {
7677
target: TOOLBAR_MAIN_RIGHT,
78+
name: TOOLBAR_THEME_SWITCHER,
7779
icon: "circle-half-stroke",
7880
label: "Theme Switcher",
7981
}
@@ -103,6 +105,7 @@ registerAll({
103105
},
104106
contribution: {
105107
target: TOOLBAR_MAIN_RIGHT,
108+
name: TOOLBAR_FULLSCREEN,
106109
icon: "expand",
107110
label: "Fullscreen",
108111
}

packages/core/src/components/part-name.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ import {DocksElement} from "../parts/element";
33
import {html} from "lit";
44
import {activePartSignal} from "../core/appstate";
55
import {getActivePartDisplayName} from "./document-title";
6-
import {contributionRegistry, HTMLContribution} from "../core/contributionregistry";
6+
import {contributionRegistry} from "../core/contributionregistry";
77
import {TOOLBAR_BOTTOM_CENTER} from "../core/constants";
8+
import {TOOLBAR_ACTIVE_PART_NAME} from "../core/ui-ids";
89
import { icon } from '../core/icon-utils';
910
import { i18n } from '../core/i18n';
1011

1112
const t = await i18n(import.meta.glob('./partname*.json'));
1213

1314
contributionRegistry.registerContribution(TOOLBAR_BOTTOM_CENTER, {
14-
component: "<docks-part-name></docks-part-name>"
15-
} as HTMLContribution)
15+
name: TOOLBAR_ACTIVE_PART_NAME,
16+
label: "Active part",
17+
component: "<docks-part-name></docks-part-name>",
18+
})
1619

1720
@customElement('docks-part-name')
1821
export class DocksPartName extends DocksElement {

packages/core/src/components/tasks.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import {contributionRegistry, HTMLContribution} from "../core/contributionregistry";
1+
import {contributionRegistry} from "../core/contributionregistry";
22
import {TOOLBAR_BOTTOM_CENTER} from "../core/constants";
3+
import {TOOLBAR_TASKS} from "../core/ui-ids";
34
import {customElement} from "lit/decorators.js";
45
import { DocksElement } from "../parts/element";
56
import {css, html, render} from "lit";
@@ -10,8 +11,10 @@ import {i18n} from "../core/i18n";
1011
const t = await i18n(import.meta.glob('./tasks*.json'));
1112

1213
contributionRegistry.registerContribution(TOOLBAR_BOTTOM_CENTER, {
13-
component: "<docks-tasks></docks-tasks>"
14-
} as HTMLContribution)
14+
name: TOOLBAR_TASKS,
15+
label: "Active Tasks",
16+
component: "<docks-tasks></docks-tasks>",
17+
})
1518

1619
// Singleton dialog container for progress dialog
1720
let progressDialogContainer: HTMLElement | null = null;

packages/core/src/contributions/default-ui-contributions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import {
1010
import {
1111
VIEW_FILEBROWSER,
1212
VIEW_LOG_TERMINAL,
13-
TOOLBAR_APP_SWITCHER,
13+
TOOLBAR_LAYOUT_SWITCHER,
1414
TOOLBAR_FAST_VIEWS,
1515
TOOLBAR_INFO,
16-
TOOLBAR_LANGUAGE_SELECTOR
16+
TOOLBAR_LANGUAGE_SELECTOR,
17+
SIDEBAR_TOOLBAR_EXTENSIONS
1718
} from "../core/ui-ids";
1819

1920
contributionRegistry.registerContribution(SIDEBAR_MAIN, {
@@ -51,12 +52,13 @@ contributionRegistry.registerContribution(TOOLBAR_BOTTOM_END, {
5152
});
5253

5354
contributionRegistry.registerContribution(TOOLBAR_MAIN_RIGHT, {
54-
name: TOOLBAR_APP_SWITCHER,
55-
label: "App Switcher",
55+
name: TOOLBAR_LAYOUT_SWITCHER,
56+
label: "Layout Switcher",
5657
component: () => html`<docks-layout-switcher></docks-layout-switcher>`
5758
} as HTMLContribution);
5859

5960
contributionRegistry.registerContribution(SIDEBAR_MAIN_TOOLBAR, {
61+
name: SIDEBAR_TOOLBAR_EXTENSIONS,
6062
command: "open_extensions",
6163
icon: "docks extensions",
6264
label: "Extensions",

packages/core/src/core/ui-ids.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ export const VIEW_LOG_TERMINAL = "view.logTerminal";
44
export const TOOLBAR_INFO = "toolbar.info";
55
export const TOOLBAR_FAST_VIEWS = "toolbar.fastViews";
66
export const TOOLBAR_LANGUAGE_SELECTOR = "toolbar.languageSelector";
7-
export const TOOLBAR_APP_SWITCHER = "toolbar.appSwitcher";
7+
/** Main toolbar (right): layout picker (`docks-layout-switcher`). */
8+
export const TOOLBAR_LAYOUT_SWITCHER = "toolbar.layoutSwitcher";
9+
/** Main toolbar (right): dark/light theme toggle (`switch_theme`). */
10+
export const TOOLBAR_THEME_SWITCHER = "toolbar.themeSwitcher";
11+
/** Main toolbar (right): document fullscreen toggle (`fullscreen`). */
12+
export const TOOLBAR_FULLSCREEN = "toolbar.fullscreen";
13+
/** Bottom-center toolbar: focused part title / active part indicator (`docks-part-name`). */
14+
export const TOOLBAR_ACTIVE_PART_NAME = "toolbar.activePartName";
15+
/** Bottom-center toolbar: background tasks / progress (`docks-tasks`). */
16+
export const TOOLBAR_TASKS = "toolbar.tasks";
17+
18+
/** Main sidebar header toolbar: open extensions (`open_extensions` command). */
19+
export const SIDEBAR_TOOLBAR_EXTENSIONS = "sidebar.toolbar.extensions";
20+
21+
/** Default file-type → icon mappings on `system.icons`. */
22+
export const SYSTEM_DEFAULT_FILE_ICONS = "system.icons.default";
823

924
export const TOOLBAR_FILEBROWSER_RENAME = "toolbar.filebrowser.rename";
1025
export const TOOLBAR_FILEBROWSER_DELETE = "toolbar.filebrowser.delete";
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Dev + Chrome",
6+
"type": "node",
7+
"request": "launch",
8+
"runtimeExecutable": "npm",
9+
"runtimeArgs": ["run", "dev"],
10+
"cwd": "${workspaceFolder}",
11+
"console": "integratedTerminal",
12+
"internalConsoleOptions": "neverOpen",
13+
"webRoot": "${workspaceFolder}/packages/app",
14+
"serverReadyAction": {
15+
"pattern": "Local:.*(https?://[^\\s]+)",
16+
"uriFormat": "%s",
17+
"action": "debugWithChrome"
18+
}
19+
}
20+
]
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "dev",
6+
"type": "npm",
7+
"script": "dev",
8+
"isBackground": true,
9+
"problemMatcher": [],
10+
"options": {
11+
"cwd": "${workspaceFolder}"
12+
},
13+
"presentation": {
14+
"reveal": "always",
15+
"panel": "dedicated",
16+
"clear": true
17+
},
18+
"detail": "Run Vite dev server (use launch config for Chrome + debug)"
19+
}
20+
]
21+
}

0 commit comments

Comments
 (0)