Files

69 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

2024-12-15 18:57:03 +01:00
/**
* Copyright (c) 2024 The xterm.js authors. All rights reserved.
* @license MIT
*/
2025-01-09 05:32:36 -08:00
import { Terminal, ITerminalAddon, IDisposable, IEvent } from '@xterm/xterm';
2024-12-15 18:57:03 +01:00
declare module '@xterm/addon-progress' {
/**
* An xterm.js addon that provides an interface for ConEmu's progress
* sequence.
*/
2025-01-07 21:22:40 +01:00
export class ProgressAddon implements ITerminalAddon, IDisposable {
2025-01-09 05:32:36 -08:00
/**
* Creates a new progress addon
*/
2024-12-15 18:57:03 +01:00
constructor();
/**
* Activates the addon
* @param terminal The terminal the addon is being loaded in.
*/
2024-12-15 18:57:03 +01:00
public activate(terminal: Terminal): void;
2025-01-09 05:32:36 -08:00
/**
* Disposes the addon.
*/
2024-12-15 18:57:03 +01:00
public dispose(): void;
/**
* An event that fires when the tracked progress changes.
*/
2025-01-09 06:03:34 -08:00
public readonly onChange: IEvent<IProgressState>;
2024-12-15 18:57:03 +01:00
/**
2025-01-09 05:32:36 -08:00
* Gets or sets the current progress tracked by the addon. This can be used
* to reset a stuck progress indicator back to initial with
* `{ state: 0, value: 0 }` or to restore an indicator.
*/
2025-01-09 02:05:36 +01:00
public progress: IProgressState;
2024-12-15 18:57:03 +01:00
}
2025-01-09 05:32:36 -08:00
/**
2025-01-09 02:05:36 +01:00
* Progress state tracked by the addon.
*/
2025-01-09 02:05:36 +01:00
export interface IProgressState {
2025-01-09 05:32:36 -08:00
/**
* The progress state.
*
* - `0`: No progress. Setting this will resets progress value to 0
* regardless of the {@link value} used.
* - `1`: Normal percentage-based from 0 to 100.
* - `2`: Error with an optional progress value from 0 to 100.
* - `3`: Indeterminate progress, any progress value will be ignored. This
* is used to indicate work is happening but a percentage value cannot be
* determined.
* - `4`: Pause or warning state with an optional progress value.
*/
2025-01-09 02:05:36 +01:00
state: 0 | 1 | 2 | 3 | 4;
2025-01-09 05:32:36 -08:00
/**
* The percentage value of progress from 0 to 100. See {@link state} for
* whether this is relevant.
*/
2024-12-15 18:57:03 +01:00
value: number;
}
}