- prompt/confirm/chmod dialogs (signals-driven via DialogsService) - FileActionsService: acts on selection or cursor row of the active panel - function bar + F2/F7/F8/Delete keys; delete confirms and recurses - verified provider ops + walkTree + removeRecursive on a scratch tree Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
41 lines
928 B
TypeScript
41 lines
928 B
TypeScript
import { Injectable, signal } from '@angular/core';
|
|
|
|
export interface PromptRequest {
|
|
title: string;
|
|
placeholder?: string;
|
|
initial?: string;
|
|
confirmLabel: string;
|
|
onConfirm: (value: string) => void;
|
|
}
|
|
|
|
export interface ConfirmRequest {
|
|
title: string;
|
|
body: string;
|
|
confirmLabel: string;
|
|
destructive?: boolean;
|
|
onConfirm: () => void;
|
|
}
|
|
|
|
export interface ChmodRequest {
|
|
targets: string[]; // display names
|
|
initialMode: number;
|
|
onConfirm: (mode: number) => void;
|
|
}
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class DialogsService {
|
|
readonly prompt = signal<PromptRequest | null>(null);
|
|
readonly confirm = signal<ConfirmRequest | null>(null);
|
|
readonly chmod = signal<ChmodRequest | null>(null);
|
|
|
|
get anyOpen(): boolean {
|
|
return !!(this.prompt() || this.confirm() || this.chmod());
|
|
}
|
|
|
|
closeAll(): void {
|
|
this.prompt.set(null);
|
|
this.confirm.set(null);
|
|
this.chmod.set(null);
|
|
}
|
|
}
|