@qodalis/cli-core 2.1.1 → 2.2.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.2.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`). When set, the theme
2157
+ * saved with the `theme` command is not restored on start; the command still
2158
+ * changes the theme for the session. 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,68 @@ 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. The host's theme wins over
2411
+ * one chosen with the `theme` command on the next start.
2412
+ * @default 'dark'
2413
+ */
2414
+ theme?: CliPanelThemeInput;
2415
+ }
2416
+ /** The built-in panel palettes. */
2417
+ type CliPanelColorScheme = 'light' | 'dark';
2418
+ /** What {@link CliPanelConfig.theme} accepts. */
2419
+ type CliPanelThemeInput = CliPanelColorScheme | 'auto' | (string & {}) | CliPanelTheme;
2420
+ /** Colors of the panel's chrome (header, tabs, menus, hide tab). Any CSS color. */
2421
+ interface CliPanelColors {
2422
+ /** Panel background behind the terminals. */
2423
+ background: string;
2424
+ /** Header, tab bar and menus. */
2425
+ headerBackground: string;
2426
+ border: string;
2427
+ text: string;
2428
+ /** Labels, inactive tabs and icons. */
2429
+ textSecondary: string;
2430
+ /** Active tab, focus rings and highlights. */
2431
+ accent: string;
2432
+ /** Buttons and menu items under the pointer. */
2433
+ hoverBackground: string;
2434
+ /** Buttons while pressed, the selected menu item. */
2435
+ activeBackground: string;
2436
+ /** Destructive menu items and error states. */
2437
+ danger: string;
2438
+ /** Shadow of the panel, menus and the hide tab (a CSS box-shadow color). */
2439
+ shadow: string;
2440
+ }
2441
+ /** A custom panel theme. Every field is optional; unset ones come from `base`. */
2442
+ interface CliPanelTheme {
2443
+ /**
2444
+ * The palette this theme starts from. With a `terminal` theme and no base, it is
2445
+ * chosen from the terminal's background (light or dark).
2446
+ * @default 'dark'
2447
+ */
2448
+ base?: CliPanelColorScheme | 'auto';
2449
+ /**
2450
+ * Terminal colors: a terminal theme name (`'dracula'`) or xterm theme colors.
2451
+ * Defaults to the base palette's terminal theme.
2452
+ */
2453
+ terminal?: string | ITheme;
2454
+ /**
2455
+ * Panel colors. Unset colors come from the base palette, or are derived from
2456
+ * `terminal` when it is given.
2457
+ */
2458
+ colors?: Partial<CliPanelColors>;
2459
+ /** Font of the panel's chrome (the terminal font is `terminalOptions.fontFamily`). */
2460
+ fontFamily?: string;
2461
+ /** Corner radius of buttons, tabs and menus, e.g. `'4px'`; `'0'` for square corners. */
2462
+ radius?: string;
2394
2463
  }
2395
2464
 
2396
2465
  /**
@@ -2425,6 +2494,11 @@ interface ICliPanelRef<TEngine = unknown> {
2425
2494
  width?: number;
2426
2495
  }): void;
2427
2496
  setPosition(position: CliPanelPosition): void;
2497
+ /**
2498
+ * Restyle the panel and its terminals (see `CliPanelConfig.theme`), e.g. when
2499
+ * the host app switches between light and dark.
2500
+ */
2501
+ setTheme(theme: CliPanelThemeInput | undefined): void;
2428
2502
  /** Create a new tab. Returns the new tab's ID. Title defaults to "Terminal {id}". */
2429
2503
  addTab(title?: string): number;
2430
2504
  /** Close a tab by ID. No-op if the ID does not exist. */
@@ -3831,9 +3905,11 @@ declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undef
3831
3905
  declare function appendQueryParams(url: string, params: Record<string, string>): string;
3832
3906
 
3833
3907
  /**
3834
- * Derives CLI panel CSS custom property values from an xterm ITheme object.
3835
- * Used when `syncTheme` is enabled on the panel config.
3908
+ * Panel themes: the built-in light and dark palettes, panel colors derived from
3909
+ * a terminal theme, and the resolution of `CliPanelConfig.theme` into CSS custom
3910
+ * properties plus the terminal theme the panel's terminals use.
3836
3911
  */
3912
+
3837
3913
  interface ThemeLike {
3838
3914
  background?: string;
3839
3915
  foreground?: string;
@@ -3841,13 +3917,37 @@ interface ThemeLike {
3841
3917
  cyan?: string;
3842
3918
  blue?: string;
3843
3919
  magenta?: string;
3920
+ red?: string;
3844
3921
  selectionBackground?: string;
3845
3922
  }
3923
+ /** Light or dark, from a color's relative luminance; unknown formats count as dark. */
3924
+ declare function colorSchemeOf(color: string | undefined): CliPanelColorScheme;
3925
+ /** The built-in panel palettes, matching the `default` and `light` terminal themes. */
3926
+ declare const CliPanelPalettes: Readonly<Record<CliPanelColorScheme, Readonly<CliPanelColors>>>;
3927
+ /** Panel colors that match a terminal theme. */
3928
+ declare function derivePanelColors(theme: ThemeLike): CliPanelColors;
3929
+ /** CSS custom properties of the panel for a set of colors. */
3930
+ declare function panelColorStyles(colors: CliPanelColors): Record<string, string>;
3846
3931
  /**
3847
3932
  * Derive CSS custom properties for the CLI panel from the active xterm theme.
3848
3933
  * Returns a record of property name → value that can be applied as inline styles.
3849
3934
  */
3850
3935
  declare function derivePanelThemeStyles(theme: ThemeLike): Record<string, string>;
3936
+ /** A panel theme resolved for one moment (the system's color scheme). */
3937
+ interface CliResolvedPanelTheme {
3938
+ scheme: CliPanelColorScheme;
3939
+ /** CSS custom properties (and `color-scheme`) for the panel's elements. */
3940
+ styles: Record<string, string>;
3941
+ /** Theme of the panel's terminals. */
3942
+ terminal: ITheme;
3943
+ }
3944
+ /**
3945
+ * Resolve `CliPanelConfig.theme`. `prefersDark` decides `'auto'`;
3946
+ * `themes` are the terminal themes a name can refer to.
3947
+ */
3948
+ declare function resolvePanelTheme(input: CliPanelThemeInput | undefined, prefersDark: boolean, themes?: Record<string, ITheme>): CliResolvedPanelTheme;
3949
+ /** Whether the system prefers dark colors (true without a browser). */
3950
+ declare function prefersDarkScheme(): boolean;
3851
3951
 
3852
3952
  /**
3853
3953
  * Load the user's saved panel position from localStorage.
@@ -4114,6 +4214,7 @@ declare class CancellablePromise<T> {
4114
4214
  type CliTheme = ITheme;
4115
4215
  type DefaultThemesType = {
4116
4216
  default: CliTheme;
4217
+ light: CliTheme;
4117
4218
  classic: CliTheme;
4118
4219
  dracula: CliTheme;
4119
4220
  monokai: CliTheme;
@@ -4158,7 +4259,7 @@ interface CliThemeInfo {
4158
4259
 
4159
4260
  declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
4160
4261
 
4161
- declare const LIBRARY_VERSION = "2.1.1";
4262
+ declare const LIBRARY_VERSION = "2.2.0";
4162
4263
  declare const API_VERSION = 2;
4163
4264
 
4164
4265
  /**
@@ -4219,5 +4320,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
4219
4320
  private _pickFile;
4220
4321
  }
4221
4322
 
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 };
4323
+ 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 };
4324
+ 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`). When set, the theme
2157
+ * saved with the `theme` command is not restored on start; the command still
2158
+ * changes the theme for the session. 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,68 @@ 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. The host's theme wins over
2411
+ * one chosen with the `theme` command on the next start.
2412
+ * @default 'dark'
2413
+ */
2414
+ theme?: CliPanelThemeInput;
2415
+ }
2416
+ /** The built-in panel palettes. */
2417
+ type CliPanelColorScheme = 'light' | 'dark';
2418
+ /** What {@link CliPanelConfig.theme} accepts. */
2419
+ type CliPanelThemeInput = CliPanelColorScheme | 'auto' | (string & {}) | CliPanelTheme;
2420
+ /** Colors of the panel's chrome (header, tabs, menus, hide tab). Any CSS color. */
2421
+ interface CliPanelColors {
2422
+ /** Panel background behind the terminals. */
2423
+ background: string;
2424
+ /** Header, tab bar and menus. */
2425
+ headerBackground: string;
2426
+ border: string;
2427
+ text: string;
2428
+ /** Labels, inactive tabs and icons. */
2429
+ textSecondary: string;
2430
+ /** Active tab, focus rings and highlights. */
2431
+ accent: string;
2432
+ /** Buttons and menu items under the pointer. */
2433
+ hoverBackground: string;
2434
+ /** Buttons while pressed, the selected menu item. */
2435
+ activeBackground: string;
2436
+ /** Destructive menu items and error states. */
2437
+ danger: string;
2438
+ /** Shadow of the panel, menus and the hide tab (a CSS box-shadow color). */
2439
+ shadow: string;
2440
+ }
2441
+ /** A custom panel theme. Every field is optional; unset ones come from `base`. */
2442
+ interface CliPanelTheme {
2443
+ /**
2444
+ * The palette this theme starts from. With a `terminal` theme and no base, it is
2445
+ * chosen from the terminal's background (light or dark).
2446
+ * @default 'dark'
2447
+ */
2448
+ base?: CliPanelColorScheme | 'auto';
2449
+ /**
2450
+ * Terminal colors: a terminal theme name (`'dracula'`) or xterm theme colors.
2451
+ * Defaults to the base palette's terminal theme.
2452
+ */
2453
+ terminal?: string | ITheme;
2454
+ /**
2455
+ * Panel colors. Unset colors come from the base palette, or are derived from
2456
+ * `terminal` when it is given.
2457
+ */
2458
+ colors?: Partial<CliPanelColors>;
2459
+ /** Font of the panel's chrome (the terminal font is `terminalOptions.fontFamily`). */
2460
+ fontFamily?: string;
2461
+ /** Corner radius of buttons, tabs and menus, e.g. `'4px'`; `'0'` for square corners. */
2462
+ radius?: string;
2394
2463
  }
2395
2464
 
2396
2465
  /**
@@ -2425,6 +2494,11 @@ interface ICliPanelRef<TEngine = unknown> {
2425
2494
  width?: number;
2426
2495
  }): void;
2427
2496
  setPosition(position: CliPanelPosition): void;
2497
+ /**
2498
+ * Restyle the panel and its terminals (see `CliPanelConfig.theme`), e.g. when
2499
+ * the host app switches between light and dark.
2500
+ */
2501
+ setTheme(theme: CliPanelThemeInput | undefined): void;
2428
2502
  /** Create a new tab. Returns the new tab's ID. Title defaults to "Terminal {id}". */
2429
2503
  addTab(title?: string): number;
2430
2504
  /** Close a tab by ID. No-op if the ID does not exist. */
@@ -3831,9 +3905,11 @@ declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undef
3831
3905
  declare function appendQueryParams(url: string, params: Record<string, string>): string;
3832
3906
 
3833
3907
  /**
3834
- * Derives CLI panel CSS custom property values from an xterm ITheme object.
3835
- * Used when `syncTheme` is enabled on the panel config.
3908
+ * Panel themes: the built-in light and dark palettes, panel colors derived from
3909
+ * a terminal theme, and the resolution of `CliPanelConfig.theme` into CSS custom
3910
+ * properties plus the terminal theme the panel's terminals use.
3836
3911
  */
3912
+
3837
3913
  interface ThemeLike {
3838
3914
  background?: string;
3839
3915
  foreground?: string;
@@ -3841,13 +3917,37 @@ interface ThemeLike {
3841
3917
  cyan?: string;
3842
3918
  blue?: string;
3843
3919
  magenta?: string;
3920
+ red?: string;
3844
3921
  selectionBackground?: string;
3845
3922
  }
3923
+ /** Light or dark, from a color's relative luminance; unknown formats count as dark. */
3924
+ declare function colorSchemeOf(color: string | undefined): CliPanelColorScheme;
3925
+ /** The built-in panel palettes, matching the `default` and `light` terminal themes. */
3926
+ declare const CliPanelPalettes: Readonly<Record<CliPanelColorScheme, Readonly<CliPanelColors>>>;
3927
+ /** Panel colors that match a terminal theme. */
3928
+ declare function derivePanelColors(theme: ThemeLike): CliPanelColors;
3929
+ /** CSS custom properties of the panel for a set of colors. */
3930
+ declare function panelColorStyles(colors: CliPanelColors): Record<string, string>;
3846
3931
  /**
3847
3932
  * Derive CSS custom properties for the CLI panel from the active xterm theme.
3848
3933
  * Returns a record of property name → value that can be applied as inline styles.
3849
3934
  */
3850
3935
  declare function derivePanelThemeStyles(theme: ThemeLike): Record<string, string>;
3936
+ /** A panel theme resolved for one moment (the system's color scheme). */
3937
+ interface CliResolvedPanelTheme {
3938
+ scheme: CliPanelColorScheme;
3939
+ /** CSS custom properties (and `color-scheme`) for the panel's elements. */
3940
+ styles: Record<string, string>;
3941
+ /** Theme of the panel's terminals. */
3942
+ terminal: ITheme;
3943
+ }
3944
+ /**
3945
+ * Resolve `CliPanelConfig.theme`. `prefersDark` decides `'auto'`;
3946
+ * `themes` are the terminal themes a name can refer to.
3947
+ */
3948
+ declare function resolvePanelTheme(input: CliPanelThemeInput | undefined, prefersDark: boolean, themes?: Record<string, ITheme>): CliResolvedPanelTheme;
3949
+ /** Whether the system prefers dark colors (true without a browser). */
3950
+ declare function prefersDarkScheme(): boolean;
3851
3951
 
3852
3952
  /**
3853
3953
  * Load the user's saved panel position from localStorage.
@@ -4114,6 +4214,7 @@ declare class CancellablePromise<T> {
4114
4214
  type CliTheme = ITheme;
4115
4215
  type DefaultThemesType = {
4116
4216
  default: CliTheme;
4217
+ light: CliTheme;
4117
4218
  classic: CliTheme;
4118
4219
  dracula: CliTheme;
4119
4220
  monokai: CliTheme;
@@ -4158,7 +4259,7 @@ interface CliThemeInfo {
4158
4259
 
4159
4260
  declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
4160
4261
 
4161
- declare const LIBRARY_VERSION = "2.1.1";
4262
+ declare const LIBRARY_VERSION = "2.2.0";
4162
4263
  declare const API_VERSION = 2;
4163
4264
 
4164
4265
  /**
@@ -4219,5 +4320,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
4219
4320
  private _pickFile;
4220
4321
  }
4221
4322
 
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 };
4323
+ 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 };
4324
+ 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 };