@qodalis/cli-core 2.1.1 → 2.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli-core",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Core interfaces, types, and utilities for the @qodalis CLI ecosystem.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
package/public-api.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ITerminalOptions, ITerminalInitOnlyOptions, Terminal, ITheme } from '@xterm/xterm';
1
+ import { ITheme, ITerminalOptions, ITerminalInitOnlyOptions, Terminal } from '@xterm/xterm';
2
2
  import { Observable, Subscription, Subject } from 'rxjs';
3
3
 
4
4
  type CliProcessCommand = {
@@ -2151,6 +2151,13 @@ type CliOptions = Record<string, any> & {
2151
2151
  * log); defaults to Qodalis CLI's.
2152
2152
  */
2153
2153
  branding?: CliBranding;
2154
+ /**
2155
+ * Terminal colors set by the host: `'dark'`, `'light'`, `'auto'`, a terminal
2156
+ * theme name or a {@link CliPanelTheme} (its `terminal`). It is the default:
2157
+ * a theme the user applies with the `theme` command wins over it until
2158
+ * `theme reset`. In a panel, this is the panel's `theme`.
2159
+ */
2160
+ theme?: CliPanelThemeInput;
2154
2161
  /**
2155
2162
  * Custom terminal options
2156
2163
  */
@@ -2391,6 +2398,69 @@ interface CliPanelConfig {
2391
2398
  * @default false
2392
2399
  */
2393
2400
  syncTheme?: boolean;
2401
+ /**
2402
+ * The look of the panel and of every terminal in it:
2403
+ * - `'dark'` (default) or `'light'`: the built-in palettes
2404
+ * - `'auto'`: light or dark, following the system's `prefers-color-scheme`
2405
+ * - the name of a terminal theme (`'dracula'`, `'nord'`, ... see `theme list`):
2406
+ * the terminals use it and the panel's colors are derived from it
2407
+ * - a {@link CliPanelTheme}: a base palette with your own colors, font and corners
2408
+ *
2409
+ * Changing it while the panel is open restyles the panel and its terminals, so a
2410
+ * host can pass its own light/dark setting through. It is the default: a theme
2411
+ * the user applies with the `theme` command wins over it (and restyles the
2412
+ * panel) until `theme reset`.
2413
+ * @default 'dark'
2414
+ */
2415
+ theme?: CliPanelThemeInput;
2416
+ }
2417
+ /** The built-in panel palettes. */
2418
+ type CliPanelColorScheme = 'light' | 'dark';
2419
+ /** What {@link CliPanelConfig.theme} accepts. */
2420
+ type CliPanelThemeInput = CliPanelColorScheme | 'auto' | (string & {}) | CliPanelTheme;
2421
+ /** Colors of the panel's chrome (header, tabs, menus, hide tab). Any CSS color. */
2422
+ interface CliPanelColors {
2423
+ /** Panel background behind the terminals. */
2424
+ background: string;
2425
+ /** Header, tab bar and menus. */
2426
+ headerBackground: string;
2427
+ border: string;
2428
+ text: string;
2429
+ /** Labels, inactive tabs and icons. */
2430
+ textSecondary: string;
2431
+ /** Active tab, focus rings and highlights. */
2432
+ accent: string;
2433
+ /** Buttons and menu items under the pointer. */
2434
+ hoverBackground: string;
2435
+ /** Buttons while pressed, the selected menu item. */
2436
+ activeBackground: string;
2437
+ /** Destructive menu items and error states. */
2438
+ danger: string;
2439
+ /** Shadow of the panel, menus and the hide tab (a CSS box-shadow color). */
2440
+ shadow: string;
2441
+ }
2442
+ /** A custom panel theme. Every field is optional; unset ones come from `base`. */
2443
+ interface CliPanelTheme {
2444
+ /**
2445
+ * The palette this theme starts from. With a `terminal` theme and no base, it is
2446
+ * chosen from the terminal's background (light or dark).
2447
+ * @default 'dark'
2448
+ */
2449
+ base?: CliPanelColorScheme | 'auto';
2450
+ /**
2451
+ * Terminal colors: a terminal theme name (`'dracula'`) or xterm theme colors.
2452
+ * Defaults to the base palette's terminal theme.
2453
+ */
2454
+ terminal?: string | ITheme;
2455
+ /**
2456
+ * Panel colors. Unset colors come from the base palette, or are derived from
2457
+ * `terminal` when it is given.
2458
+ */
2459
+ colors?: Partial<CliPanelColors>;
2460
+ /** Font of the panel's chrome (the terminal font is `terminalOptions.fontFamily`). */
2461
+ fontFamily?: string;
2462
+ /** Corner radius of buttons, tabs and menus, e.g. `'4px'`; `'0'` for square corners. */
2463
+ radius?: string;
2394
2464
  }
2395
2465
 
2396
2466
  /**
@@ -2425,6 +2495,11 @@ interface ICliPanelRef<TEngine = unknown> {
2425
2495
  width?: number;
2426
2496
  }): void;
2427
2497
  setPosition(position: CliPanelPosition): void;
2498
+ /**
2499
+ * Restyle the panel and its terminals (see `CliPanelConfig.theme`), e.g. when
2500
+ * the host app switches between light and dark.
2501
+ */
2502
+ setTheme(theme: CliPanelThemeInput | undefined): void;
2428
2503
  /** Create a new tab. Returns the new tab's ID. Title defaults to "Terminal {id}". */
2429
2504
  addTab(title?: string): number;
2430
2505
  /** Close a tab by ID. No-op if the ID does not exist. */
@@ -3831,9 +3906,11 @@ declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undef
3831
3906
  declare function appendQueryParams(url: string, params: Record<string, string>): string;
3832
3907
 
3833
3908
  /**
3834
- * Derives CLI panel CSS custom property values from an xterm ITheme object.
3835
- * Used when `syncTheme` is enabled on the panel config.
3909
+ * Panel themes: the built-in light and dark palettes, panel colors derived from
3910
+ * a terminal theme, and the resolution of `CliPanelConfig.theme` into CSS custom
3911
+ * properties plus the terminal theme the panel's terminals use.
3836
3912
  */
3913
+
3837
3914
  interface ThemeLike {
3838
3915
  background?: string;
3839
3916
  foreground?: string;
@@ -3841,13 +3918,37 @@ interface ThemeLike {
3841
3918
  cyan?: string;
3842
3919
  blue?: string;
3843
3920
  magenta?: string;
3921
+ red?: string;
3844
3922
  selectionBackground?: string;
3845
3923
  }
3924
+ /** Light or dark, from a color's relative luminance; unknown formats count as dark. */
3925
+ declare function colorSchemeOf(color: string | undefined): CliPanelColorScheme;
3926
+ /** The built-in panel palettes, matching the `default` and `light` terminal themes. */
3927
+ declare const CliPanelPalettes: Readonly<Record<CliPanelColorScheme, Readonly<CliPanelColors>>>;
3928
+ /** Panel colors that match a terminal theme. */
3929
+ declare function derivePanelColors(theme: ThemeLike): CliPanelColors;
3930
+ /** CSS custom properties of the panel for a set of colors. */
3931
+ declare function panelColorStyles(colors: CliPanelColors): Record<string, string>;
3846
3932
  /**
3847
3933
  * Derive CSS custom properties for the CLI panel from the active xterm theme.
3848
3934
  * Returns a record of property name → value that can be applied as inline styles.
3849
3935
  */
3850
3936
  declare function derivePanelThemeStyles(theme: ThemeLike): Record<string, string>;
3937
+ /** A panel theme resolved for one moment (the system's color scheme). */
3938
+ interface CliResolvedPanelTheme {
3939
+ scheme: CliPanelColorScheme;
3940
+ /** CSS custom properties (and `color-scheme`) for the panel's elements. */
3941
+ styles: Record<string, string>;
3942
+ /** Theme of the panel's terminals. */
3943
+ terminal: ITheme;
3944
+ }
3945
+ /**
3946
+ * Resolve `CliPanelConfig.theme`. `prefersDark` decides `'auto'`;
3947
+ * `themes` are the terminal themes a name can refer to.
3948
+ */
3949
+ declare function resolvePanelTheme(input: CliPanelThemeInput | undefined, prefersDark: boolean, themes?: Record<string, ITheme>): CliResolvedPanelTheme;
3950
+ /** Whether the system prefers dark colors (true without a browser). */
3951
+ declare function prefersDarkScheme(): boolean;
3851
3952
 
3852
3953
  /**
3853
3954
  * Load the user's saved panel position from localStorage.
@@ -4114,6 +4215,7 @@ declare class CancellablePromise<T> {
4114
4215
  type CliTheme = ITheme;
4115
4216
  type DefaultThemesType = {
4116
4217
  default: CliTheme;
4218
+ light: CliTheme;
4117
4219
  classic: CliTheme;
4118
4220
  dracula: CliTheme;
4119
4221
  monokai: CliTheme;
@@ -4158,7 +4260,7 @@ interface CliThemeInfo {
4158
4260
 
4159
4261
  declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
4160
4262
 
4161
- declare const LIBRARY_VERSION = "2.1.1";
4263
+ declare const LIBRARY_VERSION = "2.3.0";
4162
4264
  declare const API_VERSION = 2;
4163
4265
 
4164
4266
  /**
@@ -4219,5 +4321,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
4219
4321
  private _pickFile;
4220
4322
  }
4221
4323
 
4222
- export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4223
- export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
4324
+ export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliPanelPalettes, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorSchemeOf, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelColors, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, panelColorStyles, prefersDarkScheme, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolvePanelTheme, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4325
+ export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelColorScheme, CliPanelColors, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPanelTheme, CliPanelThemeInput, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliResolvedPanelTheme, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
package/public-api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ITerminalOptions, ITerminalInitOnlyOptions, Terminal, ITheme } from '@xterm/xterm';
1
+ import { ITheme, ITerminalOptions, ITerminalInitOnlyOptions, Terminal } from '@xterm/xterm';
2
2
  import { Observable, Subscription, Subject } from 'rxjs';
3
3
 
4
4
  type CliProcessCommand = {
@@ -2151,6 +2151,13 @@ type CliOptions = Record<string, any> & {
2151
2151
  * log); defaults to Qodalis CLI's.
2152
2152
  */
2153
2153
  branding?: CliBranding;
2154
+ /**
2155
+ * Terminal colors set by the host: `'dark'`, `'light'`, `'auto'`, a terminal
2156
+ * theme name or a {@link CliPanelTheme} (its `terminal`). It is the default:
2157
+ * a theme the user applies with the `theme` command wins over it until
2158
+ * `theme reset`. In a panel, this is the panel's `theme`.
2159
+ */
2160
+ theme?: CliPanelThemeInput;
2154
2161
  /**
2155
2162
  * Custom terminal options
2156
2163
  */
@@ -2391,6 +2398,69 @@ interface CliPanelConfig {
2391
2398
  * @default false
2392
2399
  */
2393
2400
  syncTheme?: boolean;
2401
+ /**
2402
+ * The look of the panel and of every terminal in it:
2403
+ * - `'dark'` (default) or `'light'`: the built-in palettes
2404
+ * - `'auto'`: light or dark, following the system's `prefers-color-scheme`
2405
+ * - the name of a terminal theme (`'dracula'`, `'nord'`, ... see `theme list`):
2406
+ * the terminals use it and the panel's colors are derived from it
2407
+ * - a {@link CliPanelTheme}: a base palette with your own colors, font and corners
2408
+ *
2409
+ * Changing it while the panel is open restyles the panel and its terminals, so a
2410
+ * host can pass its own light/dark setting through. It is the default: a theme
2411
+ * the user applies with the `theme` command wins over it (and restyles the
2412
+ * panel) until `theme reset`.
2413
+ * @default 'dark'
2414
+ */
2415
+ theme?: CliPanelThemeInput;
2416
+ }
2417
+ /** The built-in panel palettes. */
2418
+ type CliPanelColorScheme = 'light' | 'dark';
2419
+ /** What {@link CliPanelConfig.theme} accepts. */
2420
+ type CliPanelThemeInput = CliPanelColorScheme | 'auto' | (string & {}) | CliPanelTheme;
2421
+ /** Colors of the panel's chrome (header, tabs, menus, hide tab). Any CSS color. */
2422
+ interface CliPanelColors {
2423
+ /** Panel background behind the terminals. */
2424
+ background: string;
2425
+ /** Header, tab bar and menus. */
2426
+ headerBackground: string;
2427
+ border: string;
2428
+ text: string;
2429
+ /** Labels, inactive tabs and icons. */
2430
+ textSecondary: string;
2431
+ /** Active tab, focus rings and highlights. */
2432
+ accent: string;
2433
+ /** Buttons and menu items under the pointer. */
2434
+ hoverBackground: string;
2435
+ /** Buttons while pressed, the selected menu item. */
2436
+ activeBackground: string;
2437
+ /** Destructive menu items and error states. */
2438
+ danger: string;
2439
+ /** Shadow of the panel, menus and the hide tab (a CSS box-shadow color). */
2440
+ shadow: string;
2441
+ }
2442
+ /** A custom panel theme. Every field is optional; unset ones come from `base`. */
2443
+ interface CliPanelTheme {
2444
+ /**
2445
+ * The palette this theme starts from. With a `terminal` theme and no base, it is
2446
+ * chosen from the terminal's background (light or dark).
2447
+ * @default 'dark'
2448
+ */
2449
+ base?: CliPanelColorScheme | 'auto';
2450
+ /**
2451
+ * Terminal colors: a terminal theme name (`'dracula'`) or xterm theme colors.
2452
+ * Defaults to the base palette's terminal theme.
2453
+ */
2454
+ terminal?: string | ITheme;
2455
+ /**
2456
+ * Panel colors. Unset colors come from the base palette, or are derived from
2457
+ * `terminal` when it is given.
2458
+ */
2459
+ colors?: Partial<CliPanelColors>;
2460
+ /** Font of the panel's chrome (the terminal font is `terminalOptions.fontFamily`). */
2461
+ fontFamily?: string;
2462
+ /** Corner radius of buttons, tabs and menus, e.g. `'4px'`; `'0'` for square corners. */
2463
+ radius?: string;
2394
2464
  }
2395
2465
 
2396
2466
  /**
@@ -2425,6 +2495,11 @@ interface ICliPanelRef<TEngine = unknown> {
2425
2495
  width?: number;
2426
2496
  }): void;
2427
2497
  setPosition(position: CliPanelPosition): void;
2498
+ /**
2499
+ * Restyle the panel and its terminals (see `CliPanelConfig.theme`), e.g. when
2500
+ * the host app switches between light and dark.
2501
+ */
2502
+ setTheme(theme: CliPanelThemeInput | undefined): void;
2428
2503
  /** Create a new tab. Returns the new tab's ID. Title defaults to "Terminal {id}". */
2429
2504
  addTab(title?: string): number;
2430
2505
  /** Close a tab by ID. No-op if the ID does not exist. */
@@ -3831,9 +3906,11 @@ declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undef
3831
3906
  declare function appendQueryParams(url: string, params: Record<string, string>): string;
3832
3907
 
3833
3908
  /**
3834
- * Derives CLI panel CSS custom property values from an xterm ITheme object.
3835
- * Used when `syncTheme` is enabled on the panel config.
3909
+ * Panel themes: the built-in light and dark palettes, panel colors derived from
3910
+ * a terminal theme, and the resolution of `CliPanelConfig.theme` into CSS custom
3911
+ * properties plus the terminal theme the panel's terminals use.
3836
3912
  */
3913
+
3837
3914
  interface ThemeLike {
3838
3915
  background?: string;
3839
3916
  foreground?: string;
@@ -3841,13 +3918,37 @@ interface ThemeLike {
3841
3918
  cyan?: string;
3842
3919
  blue?: string;
3843
3920
  magenta?: string;
3921
+ red?: string;
3844
3922
  selectionBackground?: string;
3845
3923
  }
3924
+ /** Light or dark, from a color's relative luminance; unknown formats count as dark. */
3925
+ declare function colorSchemeOf(color: string | undefined): CliPanelColorScheme;
3926
+ /** The built-in panel palettes, matching the `default` and `light` terminal themes. */
3927
+ declare const CliPanelPalettes: Readonly<Record<CliPanelColorScheme, Readonly<CliPanelColors>>>;
3928
+ /** Panel colors that match a terminal theme. */
3929
+ declare function derivePanelColors(theme: ThemeLike): CliPanelColors;
3930
+ /** CSS custom properties of the panel for a set of colors. */
3931
+ declare function panelColorStyles(colors: CliPanelColors): Record<string, string>;
3846
3932
  /**
3847
3933
  * Derive CSS custom properties for the CLI panel from the active xterm theme.
3848
3934
  * Returns a record of property name → value that can be applied as inline styles.
3849
3935
  */
3850
3936
  declare function derivePanelThemeStyles(theme: ThemeLike): Record<string, string>;
3937
+ /** A panel theme resolved for one moment (the system's color scheme). */
3938
+ interface CliResolvedPanelTheme {
3939
+ scheme: CliPanelColorScheme;
3940
+ /** CSS custom properties (and `color-scheme`) for the panel's elements. */
3941
+ styles: Record<string, string>;
3942
+ /** Theme of the panel's terminals. */
3943
+ terminal: ITheme;
3944
+ }
3945
+ /**
3946
+ * Resolve `CliPanelConfig.theme`. `prefersDark` decides `'auto'`;
3947
+ * `themes` are the terminal themes a name can refer to.
3948
+ */
3949
+ declare function resolvePanelTheme(input: CliPanelThemeInput | undefined, prefersDark: boolean, themes?: Record<string, ITheme>): CliResolvedPanelTheme;
3950
+ /** Whether the system prefers dark colors (true without a browser). */
3951
+ declare function prefersDarkScheme(): boolean;
3851
3952
 
3852
3953
  /**
3853
3954
  * Load the user's saved panel position from localStorage.
@@ -4114,6 +4215,7 @@ declare class CancellablePromise<T> {
4114
4215
  type CliTheme = ITheme;
4115
4216
  type DefaultThemesType = {
4116
4217
  default: CliTheme;
4218
+ light: CliTheme;
4117
4219
  classic: CliTheme;
4118
4220
  dracula: CliTheme;
4119
4221
  monokai: CliTheme;
@@ -4158,7 +4260,7 @@ interface CliThemeInfo {
4158
4260
 
4159
4261
  declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
4160
4262
 
4161
- declare const LIBRARY_VERSION = "2.1.1";
4263
+ declare const LIBRARY_VERSION = "2.3.0";
4162
4264
  declare const API_VERSION = 2;
4163
4265
 
4164
4266
  /**
@@ -4219,5 +4321,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
4219
4321
  private _pickFile;
4220
4322
  }
4221
4323
 
4222
- export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4223
- export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
4324
+ export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliPanelPalettes, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorSchemeOf, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelColors, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, panelColorStyles, prefersDarkScheme, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolvePanelTheme, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4325
+ export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelColorScheme, CliPanelColors, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPanelTheme, CliPanelThemeInput, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliResolvedPanelTheme, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };