@spences10/pi-tui-modal 0.0.9 → 0.0.10

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/dist/index.d.ts CHANGED
@@ -1,79 +1,2 @@
1
- import { type ExtensionCommandContext } from '@earendil-works/pi-coding-agent';
2
- import { type Component, type OverlayOptions, type SelectItem, type SelectListLayoutOptions, type SettingItem, type TUI } from '@earendil-works/pi-tui';
3
- type ModalColor = 'accent' | 'muted' | 'dim' | 'warning' | 'success';
4
- export type ModalBorderStyle = 'rounded' | 'square' | 'line' | 'none';
5
- export interface ModalStyle {
6
- border?: ModalBorderStyle;
7
- border_color?: ModalColor;
8
- }
9
- type ModalTheme = {
10
- fg(color: ModalColor, text: string): string;
11
- bold(text: string): string;
12
- };
13
- export type ModalText = string | (() => string | string[]);
14
- export type ModalMetadata = string | string[] | ((item: SettingItem | undefined) => string | string[] | undefined);
15
- export interface ModalOptions {
16
- title: string;
17
- subtitle?: ModalText;
18
- footer?: ModalText;
19
- overlay_options?: OverlayOptions;
20
- style?: ModalStyle;
21
- }
22
- export interface ModalBody extends Component {
23
- handleInput?(data: string): void;
24
- dispose?(): void;
25
- }
26
- export interface ModalControls<T> {
27
- done: (result: T) => void;
28
- }
29
- export interface ModalLayout {
30
- get_max_body_lines(body_width?: number): number;
31
- }
32
- export interface PickerModalOptions {
33
- title: string;
34
- subtitle?: ModalText;
35
- footer?: ModalText;
36
- overlay_options?: OverlayOptions;
37
- style?: ModalStyle;
38
- items: SelectItem[];
39
- initial_index?: number;
40
- max_visible?: number;
41
- empty_message?: string;
42
- layout?: SelectListLayoutOptions;
43
- }
44
- export interface SettingsModalOptions {
45
- title: string;
46
- subtitle?: ModalText;
47
- footer?: ModalText;
48
- overlay_options?: OverlayOptions;
49
- style?: ModalStyle;
50
- items: SettingItem[];
51
- max_visible?: number;
52
- enable_search?: boolean;
53
- detail?: (item: SettingItem) => string | undefined;
54
- metadata?: ModalMetadata;
55
- on_change: (id: string, new_value: string) => boolean | void;
56
- on_cancel?: () => void;
57
- }
58
- export interface TextModalOptions extends ModalOptions {
59
- text: ModalText;
60
- max_visible_lines?: number;
61
- }
62
- export interface InputModalOptions extends ModalOptions {
63
- label?: string;
64
- initial_value?: string;
65
- trim?: boolean;
66
- allow_empty?: boolean;
67
- }
68
- export interface ConfirmModalOptions extends ModalOptions {
69
- message: ModalText;
70
- confirm_label?: string;
71
- cancel_label?: string;
72
- }
73
- export declare function show_modal<T>(ctx: ExtensionCommandContext, options: ModalOptions, create_body: (controls: ModalControls<T>, theme: ModalTheme, layout: ModalLayout, tui: TUI) => ModalBody): Promise<T>;
74
- export declare function show_picker_modal(ctx: ExtensionCommandContext, options: PickerModalOptions): Promise<string | undefined>;
75
- export declare function show_text_modal(ctx: ExtensionCommandContext, options: TextModalOptions): Promise<void>;
76
- export declare function show_input_modal(ctx: ExtensionCommandContext, options: InputModalOptions): Promise<string | undefined>;
77
- export declare function show_confirm_modal(ctx: ExtensionCommandContext, options: ConfirmModalOptions): Promise<boolean>;
78
- export declare function show_settings_modal(ctx: ExtensionCommandContext, options: SettingsModalOptions): Promise<void>;
79
- export {};
1
+ export { show_confirm_modal, show_input_modal, show_modal, show_picker_modal, show_settings_modal, show_text_modal, } from './modal/show.js';
2
+ export type { ConfirmModalOptions, InputModalOptions, ModalBody, ModalBorderStyle, ModalControls, ModalLayout, ModalMetadata, ModalOptions, ModalStyle, ModalText, PickerModalOptions, SettingsModalOptions, TextModalOptions, } from './modal/types.js';