@peers-app/peers-ui 0.27.2 → 0.27.4
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/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -1
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/sync-recovery.js +103 -1
- package/dist/screens/variables/variable-details.js +2 -1
- package/dist/tabs-layout/network-status-indicator.js +26 -12
- package/dist/tabs-layout/use-network-status.d.ts +6 -1
- package/dist/tabs-layout/use-network-status.js +27 -4
- package/package.json +9 -3
- package/.claude/settings.local.json +0 -34
- package/.github/README.md +0 -52
- package/.github/workflows/delete-all-artifacts.yml +0 -49
- package/.github/workflows/publish.yml +0 -51
- package/babel.config.js +0 -7
- package/biome.json +0 -198
- package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
- package/dist/app-updates/app-updates-consumer.test.js +0 -56
- package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
- package/dist/app-updates/app-updates-settings.test.js +0 -93
- package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
- package/dist/app-updates/remote-app-update-panel.test.js +0 -165
- package/dist/components/access-level-field.test.d.ts +0 -1
- package/dist/components/access-level-field.test.js +0 -28
- package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
- package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
- package/dist/components/responsive-section-nav.test.d.ts +0 -1
- package/dist/components/responsive-section-nav.test.js +0 -45
- package/dist/globals-hash.test.d.ts +0 -1
- package/dist/globals-hash.test.js +0 -16
- package/dist/hooks/use-observable-state.test.d.ts +0 -1
- package/dist/hooks/use-observable-state.test.js +0 -64
- package/dist/hooks/use-observable.test.d.ts +0 -1
- package/dist/hooks/use-observable.test.js +0 -191
- package/dist/hooks/use-rows.test.d.ts +0 -1
- package/dist/hooks/use-rows.test.js +0 -175
- package/dist/hooks/use-tool.test.d.ts +0 -1
- package/dist/hooks/use-tool.test.js +0 -190
- package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
- package/dist/host-shell/host-shell-consumer.test.js +0 -28
- package/dist/root-layout/root-layout-host.test.d.ts +0 -1
- package/dist/root-layout/root-layout-host.test.js +0 -86
- package/dist/screens/account/account-screen.test.d.ts +0 -1
- package/dist/screens/account/account-screen.test.js +0 -51
- package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
- package/dist/screens/assistants/assistant-config.test.js +0 -57
- package/dist/screens/contacts/contact-list.test.d.ts +0 -1
- package/dist/screens/contacts/contact-list.test.js +0 -48
- package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
- package/dist/screens/device-pairing/device-pairing.test.js +0 -119
- package/dist/screens/devices/devices-list.test.d.ts +0 -1
- package/dist/screens/devices/devices-list.test.js +0 -53
- package/dist/screens/groups/group-list.test.d.ts +0 -1
- package/dist/screens/groups/group-list.test.js +0 -38
- package/dist/screens/identity/identity-routes.test.d.ts +0 -1
- package/dist/screens/identity/identity-routes.test.js +0 -51
- package/dist/screens/identity/identity-screen.test.d.ts +0 -1
- package/dist/screens/identity/identity-screen.test.js +0 -103
- package/dist/screens/invites/accept-invite.test.d.ts +0 -1
- package/dist/screens/invites/accept-invite.test.js +0 -103
- package/dist/screens/invites/activity-view.test.d.ts +0 -1
- package/dist/screens/invites/activity-view.test.js +0 -108
- package/dist/screens/invites/invite-classify.test.d.ts +0 -1
- package/dist/screens/invites/invite-classify.test.js +0 -115
- package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
- package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
- package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
- package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
- package/dist/screens/packages/package-helpers.test.d.ts +0 -1
- package/dist/screens/packages/package-helpers.test.js +0 -53
- package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
- package/dist/screens/packages/package-runtime-status.test.js +0 -50
- package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
- package/dist/screens/packages/packages-ipc.test.js +0 -43
- package/dist/screens/settings/settings-page.test.d.ts +0 -1
- package/dist/screens/settings/settings-page.test.js +0 -19
- package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-access-ipc.test.js +0 -40
- package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
- package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
- package/dist/tabs-layout/network-status-indicator.test.js +0 -665
- package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
- package/dist/tabs-layout/tabs-state.test.js +0 -110
- package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
- package/dist/tabs-layout/use-network-status.test.js +0 -45
- package/dist/ui-router/ui-loader.test.d.ts +0 -1
- package/dist/ui-router/ui-loader.test.js +0 -91
- package/jest.config.js +0 -25
- package/release-guard.js +0 -10
- package/src/app-updates/app-update-controls.tsx +0 -73
- package/src/app-updates/app-updates-consumer.test.ts +0 -83
- package/src/app-updates/app-updates-consumer.ts +0 -121
- package/src/app-updates/app-updates-settings.test.tsx +0 -109
- package/src/app-updates/app-updates-settings.tsx +0 -136
- package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
- package/src/app-updates/remote-app-update-panel.tsx +0 -210
- package/src/app-updates/use-app-update-status.ts +0 -16
- package/src/command-palette/command-palette-ui.tsx +0 -564
- package/src/command-palette/command-palette.ts +0 -242
- package/src/components/access-level-field.test.tsx +0 -32
- package/src/components/access-level-field.tsx +0 -68
- package/src/components/checkbox.tsx +0 -25
- package/src/components/group-switcher.tsx +0 -526
- package/src/components/input-date.tsx +0 -29
- package/src/components/input-number.tsx +0 -83
- package/src/components/input.tsx +0 -25
- package/src/components/inverse-lazy-list.tsx +0 -107
- package/src/components/io-schema-values.tsx +0 -103
- package/src/components/io-schema.tsx +0 -259
- package/src/components/lazy-list.tsx +0 -115
- package/src/components/list-screen.tsx +0 -126
- package/src/components/loading-indicator.tsx +0 -7
- package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
- package/src/components/markdown-editor/editor-inline.tsx +0 -9
- package/src/components/markdown-editor/editor.tsx +0 -158
- package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
- package/src/components/markdown-editor/mention-node.ts +0 -204
- package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
- package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
- package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
- package/src/components/markdown-editor/theme.ts +0 -46
- package/src/components/markdown-editor/toolbar.tsx +0 -269
- package/src/components/markdown-with-mentions.tsx +0 -198
- package/src/components/message-logs/message-logs.tsx +0 -523
- package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
- package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
- package/src/components/messages/avatar.tsx +0 -171
- package/src/components/messages/channel-message-list.tsx +0 -189
- package/src/components/messages/channel-view.tsx +0 -92
- package/src/components/messages/message-compose.tsx +0 -192
- package/src/components/messages/message-display.tsx +0 -231
- package/src/components/messages/thread-message-list.tsx +0 -135
- package/src/components/qr-scanner.tsx +0 -180
- package/src/components/responsive-section-nav.test.tsx +0 -88
- package/src/components/responsive-section-nav.tsx +0 -92
- package/src/components/router.tsx +0 -175
- package/src/components/save-button.tsx +0 -134
- package/src/components/sortable-list.tsx +0 -130
- package/src/components/tabs.tsx +0 -76
- package/src/components/tooltip.tsx +0 -43
- package/src/components/trust-level-badge.tsx +0 -44
- package/src/components/trust-level-dropdown.tsx +0 -136
- package/src/components/typeahead.tsx +0 -357
- package/src/globals-hash.test.ts +0 -19
- package/src/globals.tsx +0 -226
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-host-contract.ts +0 -75
- package/src/hooks/use-observable-state.test.tsx +0 -101
- package/src/hooks/use-observable-state.ts +0 -29
- package/src/hooks/use-observable.test.tsx +0 -258
- package/src/hooks/use-observable.ts +0 -67
- package/src/hooks/use-on-screen.ts +0 -24
- package/src/hooks/use-promise.ts +0 -34
- package/src/hooks/use-rows.test.tsx +0 -196
- package/src/hooks/use-rows.ts +0 -120
- package/src/hooks/use-subscription.ts +0 -24
- package/src/hooks/use-tool.test.tsx +0 -225
- package/src/hooks/use-tool.ts +0 -116
- package/src/host-shell/host-shell-consumer.test.ts +0 -32
- package/src/host-shell/host-shell-consumer.ts +0 -53
- package/src/index.tsx +0 -42
- package/src/mention-configs.ts +0 -185
- package/src/operator-console/operator-console-state.ts +0 -119
- package/src/operator-console/operator-console.tsx +0 -233
- package/src/peers-services-registration.ts +0 -6
- package/src/root-layout/global-overlays.ts +0 -50
- package/src/root-layout/layout-picker.tsx +0 -47
- package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
- package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
- package/src/root-layout/root-layout-host.test.tsx +0 -108
- package/src/root-layout/root-layout-host.tsx +0 -147
- package/src/root-layout/root-layout-registry.ts +0 -51
- package/src/root-layout/root-layout-state.ts +0 -55
- package/src/root-layout/root-layout.ts +0 -32
- package/src/screens/account/account-screen.test.tsx +0 -65
- package/src/screens/account/account-screen.tsx +0 -942
- package/src/screens/assistants/assistant-config.test.tsx +0 -54
- package/src/screens/assistants/assistant-config.tsx +0 -121
- package/src/screens/assistants/assistant-details.tsx +0 -89
- package/src/screens/assistants/assistant-info.tsx +0 -66
- package/src/screens/assistants/assistant-list.tsx +0 -145
- package/src/screens/assistants/assistant-tools.tsx +0 -82
- package/src/screens/console-logs/console-logs-list.tsx +0 -374
- package/src/screens/console-logs/log-display.tsx +0 -137
- package/src/screens/console-logs/log-filters.tsx +0 -64
- package/src/screens/console-logs/mobile-log-card.tsx +0 -161
- package/src/screens/console-logs/resizable-table-header.tsx +0 -110
- package/src/screens/contacts/contact-details.tsx +0 -123
- package/src/screens/contacts/contact-list.test.tsx +0 -59
- package/src/screens/contacts/contact-list.tsx +0 -286
- package/src/screens/contacts/index.ts +0 -2
- package/src/screens/data-explorer/data-explorer.tsx +0 -633
- package/src/screens/data-explorer/index.ts +0 -6
- package/src/screens/data-explorer/query-executor.tsx +0 -520
- package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
- package/src/screens/device-pairing/device-pairing.tsx +0 -461
- package/src/screens/device-pairing/identity-ipc.ts +0 -25
- package/src/screens/device-pairing/index.ts +0 -2
- package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
- package/src/screens/devices/devices-list.test.tsx +0 -68
- package/src/screens/devices/devices-list.tsx +0 -365
- package/src/screens/devices/index.ts +0 -1
- package/src/screens/groups/group-details.tsx +0 -160
- package/src/screens/groups/group-invite-panel.tsx +0 -311
- package/src/screens/groups/group-list.test.tsx +0 -44
- package/src/screens/groups/group-list.tsx +0 -317
- package/src/screens/groups/group-members.tsx +0 -343
- package/src/screens/groups/index.ts +0 -3
- package/src/screens/identity/identity-routes.test.ts +0 -70
- package/src/screens/identity/identity-routes.ts +0 -301
- package/src/screens/identity/identity-screen.test.tsx +0 -138
- package/src/screens/identity/identity-screen.tsx +0 -282
- package/src/screens/identity/index.ts +0 -2
- package/src/screens/identity/invite-contact-panel.tsx +0 -45
- package/src/screens/identity/profile-invite.tsx +0 -93
- package/src/screens/invites/accept-invite.test.tsx +0 -115
- package/src/screens/invites/accept-invite.tsx +0 -318
- package/src/screens/invites/activity-view.test.tsx +0 -127
- package/src/screens/invites/activity-view.tsx +0 -162
- package/src/screens/invites/index.ts +0 -6
- package/src/screens/invites/invite-capture.ts +0 -104
- package/src/screens/invites/invite-classify.test.ts +0 -129
- package/src/screens/invites/invite-share.tsx +0 -104
- package/src/screens/invites/invites-ipc.ts +0 -25
- package/src/screens/invites/pending-invites-list.tsx +0 -256
- package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
- package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
- package/src/screens/network-viewer/device-details-modal.tsx +0 -339
- package/src/screens/network-viewer/group-details-modal.tsx +0 -421
- package/src/screens/network-viewer/index.ts +0 -8
- package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
- package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
- package/src/screens/network-viewer/network-viewer-section.ts +0 -12
- package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
- package/src/screens/network-viewer/network-viewer.tsx +0 -708
- package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
- package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
- package/src/screens/network-viewer/sync-recovery.tsx +0 -461
- package/src/screens/network-viewer/usage-graph.tsx +0 -455
- package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
- package/src/screens/packages/local-folders-ipc.ts +0 -28
- package/src/screens/packages/package-details.tsx +0 -166
- package/src/screens/packages/package-helpers.test.ts +0 -57
- package/src/screens/packages/package-helpers.ts +0 -137
- package/src/screens/packages/package-info.tsx +0 -354
- package/src/screens/packages/package-list.tsx +0 -519
- package/src/screens/packages/package-network-panel.tsx +0 -82
- package/src/screens/packages/package-new-local.tsx +0 -100
- package/src/screens/packages/package-runtime-status.test.tsx +0 -58
- package/src/screens/packages/package-runtime-status.tsx +0 -68
- package/src/screens/packages/package-versions.tsx +0 -298
- package/src/screens/packages/packages-ipc.test.ts +0 -47
- package/src/screens/packages/packages-ipc.ts +0 -125
- package/src/screens/peer-types/peer-type-details.tsx +0 -172
- package/src/screens/peer-types/peer-type-list.tsx +0 -64
- package/src/screens/search/global-search.tsx +0 -406
- package/src/screens/settings/color-mode-dropdown.tsx +0 -82
- package/src/screens/settings/settings-page.test.tsx +0 -24
- package/src/screens/settings/settings-page.tsx +0 -426
- package/src/screens/setup-user.tsx +0 -355
- package/src/screens/tools/tool-access-ipc.test.ts +0 -55
- package/src/screens/tools/tool-access-ipc.ts +0 -27
- package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
- package/src/screens/tools/tool-catalog-ipc.ts +0 -51
- package/src/screens/tools/tool-details.tsx +0 -52
- package/src/screens/tools/tool-info.tsx +0 -45
- package/src/screens/tools/tool-list.tsx +0 -106
- package/src/screens/tools/tool-schema.tsx +0 -44
- package/src/screens/tools/tool-test-details.tsx +0 -89
- package/src/screens/tools/tool-test-list.tsx +0 -73
- package/src/screens/variables/variable-details.tsx +0 -289
- package/src/screens/variables/variable-list.tsx +0 -110
- package/src/screens/welcome-modal.tsx +0 -294
- package/src/screens/workflows/workflow-details.tsx +0 -115
- package/src/screens/workflows/workflow-info.tsx +0 -22
- package/src/screens/workflows/workflow-instructions.tsx +0 -134
- package/src/screens/workflows/workflow-list.tsx +0 -117
- package/src/setupTests.ts +0 -38
- package/src/system-apps/assistants.app.ts +0 -7
- package/src/system-apps/console-logs.app.ts +0 -7
- package/src/system-apps/data-explorer.app.ts +0 -8
- package/src/system-apps/identity.app.ts +0 -9
- package/src/system-apps/index.ts +0 -77
- package/src/system-apps/mobile-settings.app.ts +0 -7
- package/src/system-apps/network-viewer.app.ts +0 -8
- package/src/system-apps/packages.app.ts +0 -7
- package/src/system-apps/search.app.ts +0 -8
- package/src/system-apps/settings.app.ts +0 -7
- package/src/system-apps/threads.app.ts +0 -7
- package/src/system-apps/tools.app.ts +0 -7
- package/src/system-apps/types.app.ts +0 -7
- package/src/system-apps/variables.app.ts +0 -7
- package/src/system-apps/workflows.app.ts +0 -7
- package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
- package/src/tabs-layout/network-status-indicator.tsx +0 -756
- package/src/tabs-layout/tabs-layout.tsx +0 -857
- package/src/tabs-layout/tabs-state.test.ts +0 -152
- package/src/tabs-layout/tabs-state.ts +0 -587
- package/src/tabs-layout/use-network-status.test.tsx +0 -58
- package/src/tabs-layout/use-network-status.ts +0 -68
- package/src/ui-defaults/index.ts +0 -2
- package/src/ui-defaults/list-screen.tsx +0 -94
- package/src/ui-defaults/markdown-field.tsx +0 -87
- package/src/ui-router/routes-loader.ts +0 -193
- package/src/ui-router/ui-loader.test.tsx +0 -108
- package/src/ui-router/ui-loader.tsx +0 -606
- package/src/utils.ts +0 -95
- package/tsconfig.json +0 -18
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const mockTools = { open: jest.fn(), openInEditor: jest.fn() };
|
|
2
|
-
jest.mock("@peers-app/peers-sdk", () => ({
|
|
3
|
-
getHostShellContractDefinition: () => ({ contractId: "host-shell" }),
|
|
4
|
-
hostContractConsumer: () => ({ get: async () => ({ tools: mockTools }), dispose: () => {} }),
|
|
5
|
-
}));
|
|
6
|
-
|
|
7
|
-
import { openInEditorOnHost, openOnHost } from "./host-shell-consumer";
|
|
8
|
-
|
|
9
|
-
const alert = jest.fn();
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
Object.assign(window, { alert });
|
|
12
|
-
jest.spyOn(console, "error").mockImplementation(() => {});
|
|
13
|
-
mockTools.open.mockReset();
|
|
14
|
-
mockTools.openInEditor.mockReset();
|
|
15
|
-
alert.mockReset();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("opens links and folders on the host", async () => {
|
|
19
|
-
await openOnHost("https://peers.app");
|
|
20
|
-
expect(mockTools.open).toHaveBeenCalledWith({ target: "https://peers.app" });
|
|
21
|
-
await openInEditorOnHost("~/peers/packages/desk");
|
|
22
|
-
expect(mockTools.openInEditor).toHaveBeenCalledWith({ path: "~/peers/packages/desk" });
|
|
23
|
-
expect(alert).not.toHaveBeenCalled();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("shows why the host could not open something", async () => {
|
|
27
|
-
mockTools.open.mockRejectedValueOnce(new Error("open refuses git: links"));
|
|
28
|
-
await openOnHost("git@github.com:me/pkg.git");
|
|
29
|
-
expect(alert).toHaveBeenCalledWith(
|
|
30
|
-
"Could not open git@github.com:me/pkg.git: open refuses git: links",
|
|
31
|
-
);
|
|
32
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getHostShellContractDefinition,
|
|
3
|
-
hostContractConsumer,
|
|
4
|
-
type IHostShellConsumer,
|
|
5
|
-
} from "@peers-app/peers-sdk";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Shared handle for System Host Shell on the local host. Calls name no data context, so the
|
|
9
|
-
* host runs them in the personal context, where the signed-in user has Self access.
|
|
10
|
-
*/
|
|
11
|
-
export const hostShellContract = hostContractConsumer<IHostShellConsumer>(
|
|
12
|
-
getHostShellContractDefinition(),
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
/** Return the System Host Shell tools of the local host. */
|
|
16
|
-
export async function hostShellTools(): Promise<IHostShellConsumer["tools"]> {
|
|
17
|
-
return (await hostShellContract.get()).tools;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Open a web link in the browser, or a local file or folder with the OS. Failures (an
|
|
22
|
-
* unsupported host, a refused link scheme, a missing folder) are logged and shown.
|
|
23
|
-
*
|
|
24
|
-
* @param target - Link or local path (`~` allowed).
|
|
25
|
-
*/
|
|
26
|
-
export async function openOnHost(target: string): Promise<void> {
|
|
27
|
-
try {
|
|
28
|
-
await (await hostShellTools()).open({ target });
|
|
29
|
-
} catch (error) {
|
|
30
|
-
reportHostShellError(`Could not open ${target}`, error);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Open a folder in a code editor (VS Code when installed), else with the OS.
|
|
36
|
-
*
|
|
37
|
-
* @param path - Folder or file (`~` allowed).
|
|
38
|
-
*/
|
|
39
|
-
export async function openInEditorOnHost(path: string): Promise<void> {
|
|
40
|
-
try {
|
|
41
|
-
await (await hostShellTools()).openInEditor({ path });
|
|
42
|
-
} catch (error) {
|
|
43
|
-
reportHostShellError(`Could not open ${path}`, error);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function reportHostShellError(what: string, error: unknown): void {
|
|
48
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
49
|
-
console.error(`${what}:`, error);
|
|
50
|
-
if (typeof window !== "undefined" && typeof window.alert === "function") {
|
|
51
|
-
window.alert(`${what}: ${message}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/index.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export * from "./components/inverse-lazy-list";
|
|
2
|
-
export type { IEditorEffects, IMarkdownEditorProps } from "./components/markdown-editor/editor";
|
|
3
|
-
export { MarkdownEditor } from "./components/markdown-editor/editor";
|
|
4
|
-
export * from "./components/markdown-editor/editor-inline";
|
|
5
|
-
export * from "./components/markdown-with-mentions";
|
|
6
|
-
export * from "./components/responsive-section-nav";
|
|
7
|
-
export * from "./components/sortable-list";
|
|
8
|
-
export * from "./components/tabs";
|
|
9
|
-
export { Typeahead, type TypeaheadItem } from "./components/typeahead";
|
|
10
|
-
export { isDesktop, mainContentPath } from "./globals";
|
|
11
|
-
export * from "./hooks";
|
|
12
|
-
export * from "./operator-console/operator-console";
|
|
13
|
-
export * from "./operator-console/operator-console-state";
|
|
14
|
-
export {
|
|
15
|
-
type GlobalOverlay,
|
|
16
|
-
globalOverlays,
|
|
17
|
-
registerGlobalOverlay,
|
|
18
|
-
unregisterGlobalOverlay,
|
|
19
|
-
} from "./root-layout/global-overlays";
|
|
20
|
-
export { LayoutPicker } from "./root-layout/layout-picker";
|
|
21
|
-
export type { RootLayout } from "./root-layout/root-layout";
|
|
22
|
-
export {
|
|
23
|
-
RootLayoutHost,
|
|
24
|
-
// Compat alias: the desktop/PWA/RN clients historically mounted `TabsLayoutApp`.
|
|
25
|
-
// The host now owns bootstrapping; the tabs UI is just the default layout body.
|
|
26
|
-
RootLayoutHost as TabsLayoutApp,
|
|
27
|
-
} from "./root-layout/root-layout-host";
|
|
28
|
-
export {
|
|
29
|
-
DEFAULT_ROOT_LAYOUT_ID,
|
|
30
|
-
getRootLayout,
|
|
31
|
-
getRootLayouts,
|
|
32
|
-
} from "./root-layout/root-layout-registry";
|
|
33
|
-
export { selectedRootLayoutId, setRootLayout } from "./root-layout/root-layout-state";
|
|
34
|
-
export * from "./tabs-layout/tabs-layout";
|
|
35
|
-
export {
|
|
36
|
-
activeTabId,
|
|
37
|
-
activeTabs,
|
|
38
|
-
closeCurrentTab,
|
|
39
|
-
goToTabPath,
|
|
40
|
-
TabState,
|
|
41
|
-
updateActiveTabTitle,
|
|
42
|
-
} from "./tabs-layout/tabs-state";
|
package/src/mention-configs.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Assistants,
|
|
3
|
-
type IMentionData,
|
|
4
|
-
PeerTypes,
|
|
5
|
-
Tools,
|
|
6
|
-
Users,
|
|
7
|
-
Workflows,
|
|
8
|
-
} from "@peers-app/peers-sdk";
|
|
9
|
-
import { mainContentPath } from "./globals";
|
|
10
|
-
|
|
11
|
-
import { listWorkflowMentionTools } from "./screens/tools/tool-catalog-ipc";
|
|
12
|
-
|
|
13
|
-
const MENTIONS_MAX_RESULTS = 10;
|
|
14
|
-
|
|
15
|
-
/** Editor and renderer behavior for one persisted mention kind. */
|
|
16
|
-
export interface IMentionConfig {
|
|
17
|
-
iconClass: string;
|
|
18
|
-
styleClass?: string;
|
|
19
|
-
kind: string;
|
|
20
|
-
query: (text: string) => Promise<IMentionData[]>;
|
|
21
|
-
getById: (id: string) => Promise<IMentionData | undefined>;
|
|
22
|
-
picture?: (data: IMentionData) => JSX.Element;
|
|
23
|
-
onClick?: (data: IMentionData) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Discover workflow-invocable tools while keeping historical mention IDs readable. */
|
|
27
|
-
export const toolMentionConfig: IMentionConfig = {
|
|
28
|
-
kind: "tool",
|
|
29
|
-
iconClass: "bi bi-tools",
|
|
30
|
-
styleClass: "mention-tool",
|
|
31
|
-
query: async (search: string) => {
|
|
32
|
-
const results = await listWorkflowMentionTools(search, MENTIONS_MAX_RESULTS);
|
|
33
|
-
return results.map((p) => ({
|
|
34
|
-
kind: "tool",
|
|
35
|
-
id: p.toolId,
|
|
36
|
-
name: p.name,
|
|
37
|
-
}));
|
|
38
|
-
},
|
|
39
|
-
getById: (id) =>
|
|
40
|
-
Tools()
|
|
41
|
-
.get(id)
|
|
42
|
-
.then(
|
|
43
|
-
(item) =>
|
|
44
|
-
item && {
|
|
45
|
-
kind: "tool",
|
|
46
|
-
id: item.toolId,
|
|
47
|
-
name: item.name,
|
|
48
|
-
},
|
|
49
|
-
),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/** Discover users and resolve persisted user mentions. */
|
|
53
|
-
export const userMentionConfig: IMentionConfig = {
|
|
54
|
-
kind: "user",
|
|
55
|
-
iconClass: "bi-person-fill",
|
|
56
|
-
styleClass: "mention-user",
|
|
57
|
-
query: async (search: string) => {
|
|
58
|
-
return Users()
|
|
59
|
-
.list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
|
|
60
|
-
.then((users) =>
|
|
61
|
-
users.map((user) => ({
|
|
62
|
-
kind: "user",
|
|
63
|
-
id: user.userId,
|
|
64
|
-
name: user.name,
|
|
65
|
-
})),
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
getById: (id) =>
|
|
69
|
-
Users()
|
|
70
|
-
.get(id)
|
|
71
|
-
.then(
|
|
72
|
-
(item) =>
|
|
73
|
-
item && {
|
|
74
|
-
kind: "user",
|
|
75
|
-
id: item.userId,
|
|
76
|
-
name: item.name,
|
|
77
|
-
},
|
|
78
|
-
),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/** Discover assistants and resolve persisted assistant mentions. */
|
|
82
|
-
export const assistantMentionConfig: IMentionConfig = {
|
|
83
|
-
kind: "assistant",
|
|
84
|
-
iconClass: "bi bi-person-fill-gear",
|
|
85
|
-
styleClass: "mention-assistant",
|
|
86
|
-
query: async (search: string) => {
|
|
87
|
-
return Assistants()
|
|
88
|
-
.list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
|
|
89
|
-
.then((assistants) =>
|
|
90
|
-
assistants.map((assistant) => ({
|
|
91
|
-
kind: "assistant" as const,
|
|
92
|
-
id: assistant.assistantId,
|
|
93
|
-
name: assistant.name,
|
|
94
|
-
})),
|
|
95
|
-
);
|
|
96
|
-
},
|
|
97
|
-
getById: (id) =>
|
|
98
|
-
Assistants()
|
|
99
|
-
.get(id)
|
|
100
|
-
.then(
|
|
101
|
-
(item) =>
|
|
102
|
-
item && {
|
|
103
|
-
kind: "assistant",
|
|
104
|
-
id: item.assistantId,
|
|
105
|
-
name: item.name,
|
|
106
|
-
},
|
|
107
|
-
),
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/** Discover workflows and resolve persisted workflow mentions. */
|
|
111
|
-
export const workflowMentionConfig: IMentionConfig = {
|
|
112
|
-
kind: "workflow",
|
|
113
|
-
iconClass: "bi bi-database-fill-gear",
|
|
114
|
-
styleClass: "mention-workflow",
|
|
115
|
-
query: async (search: string) => {
|
|
116
|
-
return Workflows()
|
|
117
|
-
.list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
|
|
118
|
-
.then((workflows) =>
|
|
119
|
-
workflows.map((workflow) => ({
|
|
120
|
-
kind: "workflow" as const,
|
|
121
|
-
id: workflow.workflowId,
|
|
122
|
-
name: workflow.name,
|
|
123
|
-
})),
|
|
124
|
-
);
|
|
125
|
-
},
|
|
126
|
-
getById: (id) =>
|
|
127
|
-
Workflows()
|
|
128
|
-
.get(id)
|
|
129
|
-
.then(
|
|
130
|
-
(item) =>
|
|
131
|
-
item && {
|
|
132
|
-
kind: "workflow",
|
|
133
|
-
id: item.workflowId,
|
|
134
|
-
name: item.name,
|
|
135
|
-
},
|
|
136
|
-
),
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/** Discover data types and navigate to their definitions. */
|
|
140
|
-
export const valueTypeMentionConfig: IMentionConfig = {
|
|
141
|
-
kind: "type",
|
|
142
|
-
iconClass: "bi bi-code-square",
|
|
143
|
-
query: async (search: string) => {
|
|
144
|
-
const results = await PeerTypes().list(
|
|
145
|
-
{ name: { $matchWords: search } },
|
|
146
|
-
{ pageSize: MENTIONS_MAX_RESULTS },
|
|
147
|
-
);
|
|
148
|
-
return results.map((item) => ({
|
|
149
|
-
kind: "type",
|
|
150
|
-
id: item.peerTypeId,
|
|
151
|
-
name: item.name,
|
|
152
|
-
}));
|
|
153
|
-
},
|
|
154
|
-
getById: (id) =>
|
|
155
|
-
PeerTypes()
|
|
156
|
-
.get(id)
|
|
157
|
-
.then(
|
|
158
|
-
(item) =>
|
|
159
|
-
item && {
|
|
160
|
-
kind: "type",
|
|
161
|
-
id: item.peerTypeId,
|
|
162
|
-
name: item.name,
|
|
163
|
-
},
|
|
164
|
-
),
|
|
165
|
-
onClick(data) {
|
|
166
|
-
mainContentPath(`peer-types/${data.id}`);
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
// Tasks().list({ title: { $matchWords: mentionString }, completeDT: { $exists: searchCompletedTasks } }, { pageSize: MAX_RESULTS })
|
|
171
|
-
// .then((tasks) => tasks.map((task) => ({
|
|
172
|
-
// kind: 'task' as const,
|
|
173
|
-
// id: task.taskId,
|
|
174
|
-
// name: task.title,
|
|
175
|
-
// }))),
|
|
176
|
-
// picture = <i className="bi bi-list-task pe-1" />;
|
|
177
|
-
|
|
178
|
-
/** Shared mention definitions used by editors and rendered messages. */
|
|
179
|
-
export const mentionConfigs = [
|
|
180
|
-
toolMentionConfig,
|
|
181
|
-
userMentionConfig,
|
|
182
|
-
assistantMentionConfig,
|
|
183
|
-
workflowMentionConfig,
|
|
184
|
-
valueTypeMentionConfig,
|
|
185
|
-
];
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Operator Console — panel state
|
|
3
|
-
*
|
|
4
|
-
* Persistent, per-device state for the Operator Console shell plus the control
|
|
5
|
-
* helpers and the global keyboard shortcut that toggles it. The panel itself
|
|
6
|
-
* ({@link OperatorConsolePanel}) reads this state reactively via `useObservable`.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { deviceVar } from "@peers-app/peers-sdk";
|
|
10
|
-
import { closeCommandPalette, registerCommand } from "../command-palette/command-palette";
|
|
11
|
-
|
|
12
|
-
/** Edge the console panel is docked to. */
|
|
13
|
-
export type ConsoleDock = "bottom" | "left" | "right";
|
|
14
|
-
|
|
15
|
-
/** Persisted layout/visibility state for the Operator Console panel. */
|
|
16
|
-
export interface ConsolePanelState {
|
|
17
|
-
/** Whether the panel is expanded (open) or collapsed to its edge strip. */
|
|
18
|
-
expanded: boolean;
|
|
19
|
-
/** Which screen edge the panel is docked to. */
|
|
20
|
-
dock: ConsoleDock;
|
|
21
|
-
/** Panel height in pixels when docked to the bottom. */
|
|
22
|
-
bottomHeight: number;
|
|
23
|
-
/** Panel width in pixels when docked to the left or right. */
|
|
24
|
-
sideWidth: number;
|
|
25
|
-
/** Whether the panel is maximized to fill the layout body (hiding the tabs panel). */
|
|
26
|
-
maximized: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Default panel state: collapsed, docked to the bottom. */
|
|
30
|
-
export const DEFAULT_CONSOLE_PANEL_STATE: ConsolePanelState = {
|
|
31
|
-
expanded: false,
|
|
32
|
-
dock: "bottom",
|
|
33
|
-
bottomHeight: 300,
|
|
34
|
-
sideWidth: 420,
|
|
35
|
-
maximized: false,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Per-device persisted state for the Operator Console panel. Layout/visibility
|
|
40
|
-
* is a per-device preference, so this uses `deviceVar` (not synced across devices).
|
|
41
|
-
*/
|
|
42
|
-
export const operatorConsolePanel = deviceVar<ConsolePanelState>("operatorConsole:panel", {
|
|
43
|
-
defaultValue: DEFAULT_CONSOLE_PANEL_STATE,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
function update(patch: Partial<ConsolePanelState>): void {
|
|
47
|
-
const current = operatorConsolePanel() ?? DEFAULT_CONSOLE_PANEL_STATE;
|
|
48
|
-
operatorConsolePanel({ ...current, ...patch });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Toggle the console between expanded and collapsed. */
|
|
52
|
-
export function toggleConsole(): void {
|
|
53
|
-
const current = operatorConsolePanel() ?? DEFAULT_CONSOLE_PANEL_STATE;
|
|
54
|
-
update({ expanded: !current.expanded });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Expand (open) the console. */
|
|
58
|
-
export function openConsole(): void {
|
|
59
|
-
update({ expanded: true });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** Collapse (close) the console. */
|
|
63
|
-
export function closeConsole(): void {
|
|
64
|
-
update({ expanded: false });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** Dock the console to the given edge. */
|
|
68
|
-
export function setConsoleDock(dock: ConsoleDock): void {
|
|
69
|
-
update({ dock });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Set whether the console is maximized (fills the layout body, hiding the tabs panel). */
|
|
73
|
-
export function setConsoleMaximized(maximized: boolean): void {
|
|
74
|
-
update({ maximized });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Persist a new panel size. Use `bottomHeight` when docked to the bottom and
|
|
79
|
-
* `sideWidth` when docked to a side.
|
|
80
|
-
*/
|
|
81
|
-
export function setConsoleSize(size: { bottomHeight?: number; sideWidth?: number }): void {
|
|
82
|
-
update(size);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Global keyboard handler for the console toggle shortcut. Ctrl+` on all
|
|
87
|
-
* platforms (matching VS Code / Cursor). Intentionally not Cmd on macOS.
|
|
88
|
-
*/
|
|
89
|
-
function handleKeyDown(event: KeyboardEvent): void {
|
|
90
|
-
if (event.ctrlKey && !event.metaKey && !event.altKey && event.code === "Backquote") {
|
|
91
|
-
event.preventDefault();
|
|
92
|
-
toggleConsole();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
let initialized = false;
|
|
97
|
-
|
|
98
|
-
/** Install the global Ctrl+` listener and register the palette command (idempotent). */
|
|
99
|
-
export function initializeOperatorConsole(): void {
|
|
100
|
-
if (initialized || typeof window === "undefined") return;
|
|
101
|
-
initialized = true;
|
|
102
|
-
|
|
103
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
104
|
-
|
|
105
|
-
registerCommand({
|
|
106
|
-
id: "toggle-operator-console",
|
|
107
|
-
label: "Toggle Console",
|
|
108
|
-
description: "Show or hide the Operator Console panel",
|
|
109
|
-
shortcut: "Ctrl+`",
|
|
110
|
-
iconClassName: "bi-terminal",
|
|
111
|
-
category: "View",
|
|
112
|
-
action: () => {
|
|
113
|
-
closeCommandPalette();
|
|
114
|
-
toggleConsole();
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
initializeOperatorConsole();
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Operator Console — presentational panel
|
|
3
|
-
*
|
|
4
|
-
* The console's visual chrome only: a header toolbar (dock buttons, maximize/restore,
|
|
5
|
-
* collapse) plus the body region. It fills its container (`height/width: 100%`) and has
|
|
6
|
-
* no positioning of its own — the host layout (e.g. the `tabs-with-console` root layout)
|
|
7
|
-
* owns the split sizing, the resize handle, the collapsed edge strip, and where the panel
|
|
8
|
-
* is placed. Command input, output blocks, and the engine arrive later.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type React from "react";
|
|
12
|
-
import { useObservable } from "../hooks";
|
|
13
|
-
import { colorMode } from "../screens/settings/color-mode-dropdown";
|
|
14
|
-
import {
|
|
15
|
-
type ConsoleDock,
|
|
16
|
-
operatorConsolePanel,
|
|
17
|
-
setConsoleDock,
|
|
18
|
-
setConsoleMaximized,
|
|
19
|
-
toggleConsole,
|
|
20
|
-
} from "./operator-console-state";
|
|
21
|
-
|
|
22
|
-
/** Resolved color palette for the console chrome. */
|
|
23
|
-
export interface ConsoleTheme {
|
|
24
|
-
bg: string;
|
|
25
|
-
headerBg: string;
|
|
26
|
-
border: string;
|
|
27
|
-
text: string;
|
|
28
|
-
muted: string;
|
|
29
|
-
hover: string;
|
|
30
|
-
accent: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Resolve the console color palette for the active color mode. Shared by the panel and by
|
|
35
|
-
* the host layout (so its collapsed strip and resize divider match the panel chrome).
|
|
36
|
-
*/
|
|
37
|
-
export function getConsoleTheme(isDark: boolean): ConsoleTheme {
|
|
38
|
-
return {
|
|
39
|
-
bg: isDark ? "#1e1e1e" : "#ffffff",
|
|
40
|
-
headerBg: isDark ? "#252526" : "#f3f3f3",
|
|
41
|
-
border: isDark ? "#3c3c3c" : "#dee2e6",
|
|
42
|
-
text: isDark ? "#cccccc" : "#1e1e1e",
|
|
43
|
-
muted: isDark ? "#8c8c8c" : "#6c757d",
|
|
44
|
-
hover: isDark ? "#2a2d2e" : "#e8e8e8",
|
|
45
|
-
accent: "#0d6efd",
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The Operator Console panel chrome. Renders as an in-flow flex column that fills its
|
|
51
|
-
* container; the parent layout decides the panel's size and placement. Reads dock and
|
|
52
|
-
* maximized state from `operatorConsolePanel` to drive the header toolbar.
|
|
53
|
-
*/
|
|
54
|
-
export const OperatorConsolePanel: React.FC = () => {
|
|
55
|
-
const [state] = useObservable(operatorConsolePanel);
|
|
56
|
-
const [mode] = useObservable(colorMode);
|
|
57
|
-
|
|
58
|
-
const { dock, maximized } = state;
|
|
59
|
-
const theme = getConsoleTheme(mode === "dark");
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div
|
|
63
|
-
style={{
|
|
64
|
-
width: "100%",
|
|
65
|
-
height: "100%",
|
|
66
|
-
backgroundColor: theme.bg,
|
|
67
|
-
color: theme.text,
|
|
68
|
-
display: "flex",
|
|
69
|
-
flexDirection: "column",
|
|
70
|
-
overflow: "hidden",
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
{/* Header toolbar */}
|
|
74
|
-
<div
|
|
75
|
-
style={{
|
|
76
|
-
display: "flex",
|
|
77
|
-
alignItems: "center",
|
|
78
|
-
justifyContent: "space-between",
|
|
79
|
-
height: "34px",
|
|
80
|
-
flex: "0 0 auto",
|
|
81
|
-
padding: "0 8px",
|
|
82
|
-
backgroundColor: theme.headerBg,
|
|
83
|
-
borderBottom: `1px solid ${theme.border}`,
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<div style={{ display: "flex", alignItems: "center", gap: "6px", fontSize: "12px" }}>
|
|
87
|
-
<i className="bi-terminal" />
|
|
88
|
-
<span style={{ fontWeight: 500 }}>Console</span>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<div style={{ display: "flex", alignItems: "center", gap: "2px" }}>
|
|
92
|
-
<DockButton
|
|
93
|
-
dock="left"
|
|
94
|
-
active={dock === "left"}
|
|
95
|
-
disabled={maximized}
|
|
96
|
-
theme={theme}
|
|
97
|
-
icon="bi-arrow-bar-left"
|
|
98
|
-
label="Dock left"
|
|
99
|
-
/>
|
|
100
|
-
<DockButton
|
|
101
|
-
dock="bottom"
|
|
102
|
-
active={dock === "bottom"}
|
|
103
|
-
disabled={maximized}
|
|
104
|
-
theme={theme}
|
|
105
|
-
icon="bi-arrow-bar-down"
|
|
106
|
-
label="Dock bottom"
|
|
107
|
-
/>
|
|
108
|
-
<DockButton
|
|
109
|
-
dock="right"
|
|
110
|
-
active={dock === "right"}
|
|
111
|
-
disabled={maximized}
|
|
112
|
-
theme={theme}
|
|
113
|
-
icon="bi-arrow-bar-right"
|
|
114
|
-
label="Dock right"
|
|
115
|
-
/>
|
|
116
|
-
|
|
117
|
-
<span
|
|
118
|
-
style={{ width: "1px", height: "18px", backgroundColor: theme.border, margin: "0 4px" }}
|
|
119
|
-
/>
|
|
120
|
-
|
|
121
|
-
<ToolbarButton
|
|
122
|
-
theme={theme}
|
|
123
|
-
icon={maximized ? "bi-fullscreen-exit" : "bi-arrows-fullscreen"}
|
|
124
|
-
label={maximized ? "Restore" : "Maximize"}
|
|
125
|
-
onClick={() => setConsoleMaximized(!maximized)}
|
|
126
|
-
/>
|
|
127
|
-
<ToolbarButton
|
|
128
|
-
theme={theme}
|
|
129
|
-
icon="bi-chevron-down"
|
|
130
|
-
label="Collapse (Ctrl+`)"
|
|
131
|
-
onClick={toggleConsole}
|
|
132
|
-
/>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
|
|
136
|
-
{/* Body placeholder (content arrives in a later step) */}
|
|
137
|
-
<div
|
|
138
|
-
style={{
|
|
139
|
-
flex: "1 1 auto",
|
|
140
|
-
overflow: "auto",
|
|
141
|
-
display: "flex",
|
|
142
|
-
alignItems: "center",
|
|
143
|
-
justifyContent: "center",
|
|
144
|
-
color: theme.muted,
|
|
145
|
-
fontSize: "13px",
|
|
146
|
-
}}
|
|
147
|
-
>
|
|
148
|
-
<div style={{ textAlign: "center" }}>
|
|
149
|
-
<i
|
|
150
|
-
className="bi-terminal"
|
|
151
|
-
style={{ fontSize: "24px", display: "block", marginBottom: "6px" }}
|
|
152
|
-
/>
|
|
153
|
-
Operator Console
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
</div>
|
|
157
|
-
);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
interface ButtonTheme {
|
|
161
|
-
text: string;
|
|
162
|
-
muted: string;
|
|
163
|
-
hover: string;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
interface ToolbarButtonProps {
|
|
167
|
-
theme: ButtonTheme;
|
|
168
|
-
icon: string;
|
|
169
|
-
label: string;
|
|
170
|
-
onClick: () => void;
|
|
171
|
-
active?: boolean;
|
|
172
|
-
disabled?: boolean;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/** A small, icon-only button used in the console header toolbar. */
|
|
176
|
-
function ToolbarButton({ theme, icon, label, onClick, active, disabled }: ToolbarButtonProps) {
|
|
177
|
-
return (
|
|
178
|
-
<button
|
|
179
|
-
type="button"
|
|
180
|
-
title={label}
|
|
181
|
-
aria-label={label}
|
|
182
|
-
disabled={disabled}
|
|
183
|
-
onClick={onClick}
|
|
184
|
-
style={{
|
|
185
|
-
display: "flex",
|
|
186
|
-
alignItems: "center",
|
|
187
|
-
justifyContent: "center",
|
|
188
|
-
width: "28px",
|
|
189
|
-
height: "26px",
|
|
190
|
-
border: "none",
|
|
191
|
-
borderRadius: "4px",
|
|
192
|
-
background: active ? theme.hover : "transparent",
|
|
193
|
-
color: active ? theme.text : theme.muted,
|
|
194
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
195
|
-
opacity: disabled ? 0.4 : 1,
|
|
196
|
-
fontSize: "14px",
|
|
197
|
-
}}
|
|
198
|
-
onMouseEnter={(e) => {
|
|
199
|
-
if (!disabled) e.currentTarget.style.backgroundColor = theme.hover;
|
|
200
|
-
}}
|
|
201
|
-
onMouseLeave={(e) => {
|
|
202
|
-
e.currentTarget.style.backgroundColor = active ? theme.hover : "transparent";
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
<i className={icon} />
|
|
206
|
-
</button>
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
interface DockButtonProps {
|
|
211
|
-
dock: ConsoleDock;
|
|
212
|
-
active: boolean;
|
|
213
|
-
disabled: boolean;
|
|
214
|
-
theme: ButtonTheme;
|
|
215
|
-
icon: string;
|
|
216
|
-
label: string;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/** Header button that docks the console to a given edge. */
|
|
220
|
-
function DockButton({ dock, active, disabled, theme, icon, label }: DockButtonProps) {
|
|
221
|
-
return (
|
|
222
|
-
<ToolbarButton
|
|
223
|
-
theme={theme}
|
|
224
|
-
icon={icon}
|
|
225
|
-
label={label}
|
|
226
|
-
active={active}
|
|
227
|
-
disabled={disabled}
|
|
228
|
-
onClick={() => setConsoleDock(dock)}
|
|
229
|
-
/>
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export default OperatorConsolePanel;
|