@difizen/mana-core
Version:
73 lines • 3.72 kB
TypeScript
import type { Event } from '@difizen/mana-common';
import { PauseableEmitter } from '@difizen/mana-common';
import type { CommandRegistry } from '../../command/index';
import type { CommandContribution } from '../../command/index';
import { IConfigurationService } from './configuration/configuration';
import type { IContext, IContextKeyChangeEvent, IContextKeyServiceTarget, ContextKeyExpression, IContextKey } from './contextkey';
import { IContextKeyService } from './contextkey';
export declare class Context implements IContext {
protected _parent: Context | null;
protected _value: Record<string, any>;
protected _id: number;
constructor(id: number, parent: Context | null);
setValue(key: string, value: any): boolean;
removeValue(key: string): boolean;
getValue<T>(key: string): T | undefined;
updateParent(parent: Context): void;
collectAllValues(): Record<string, any>;
}
export declare abstract class AbstractContextKeyService implements IContextKeyService {
_serviceBrand: undefined;
protected _isDisposed: boolean;
protected _myContextId: number;
protected _onDidChangeContext: PauseableEmitter<IContextKeyChangeEvent>;
readonly onDidChangeContext: Event<IContextKeyChangeEvent>;
constructor(myContextId: number);
get contextId(): number;
abstract dispose(): void;
createKey<T>(key: string, defaultValue: T | undefined): IContextKey<T>;
bufferChangeEvents(callback: () => void): void;
createScoped(domNode: IContextKeyServiceTarget): IContextKeyService;
createOverlay(overlay?: Iterable<[string, any]>): IContextKeyService;
contextMatchesRules(rules: ContextKeyExpression | undefined): boolean;
getContextKeyValue<T>(key: string): T | undefined;
setContext(key: string, value: any): void;
removeContext(key: string): void;
getContext(target: IContextKeyServiceTarget | null): IContext;
abstract getContextValuesContainer(contextId: number): Context;
abstract createChildContext(parentContextId?: number): number;
abstract disposeContext(contextId: number): void;
abstract updateParent(parentContextKeyService?: IContextKeyService): void;
}
export declare class VSContextKeyService extends AbstractContextKeyService implements IContextKeyService, CommandContribution {
private _lastContextId;
private readonly _contexts;
private readonly _toDispose;
configurationService: IConfigurationService;
constructor(configurationService: IConfigurationService);
registerCommands(commands: CommandRegistry): void;
dispose(): void;
getContextValuesContainer(contextId: number): Context;
createChildContext(parentContextId?: number): number;
disposeContext(contextId: number): void;
updateParent(_parentContextKeyService: IContextKeyService): void;
}
export declare class OverlayContextKeyService implements IContextKeyService {
_serviceBrand: undefined;
private overlay;
private parent;
get contextId(): number;
get onDidChangeContext(): Event<IContextKeyChangeEvent>;
constructor(parent: AbstractContextKeyService | OverlayContextKeyService, overlay: Iterable<[string, any]>);
bufferChangeEvents(callback: () => void): void;
createKey<T>(): IContextKey<T>;
getContext(target: IContextKeyServiceTarget | null): IContext;
getContextValuesContainer(contextId: number): IContext;
contextMatchesRules(rules: ContextKeyExpression | undefined): boolean;
getContextKeyValue<T>(key: string): T | undefined;
createScoped(): IContextKeyService;
createOverlay(overlay?: Iterable<[string, any]>): IContextKeyService;
updateParent(): void;
dispose(): void;
}
//# sourceMappingURL=contextKeyService.d.ts.map