@principal-ade/panel-layouts 0.1.6 → 0.2.1
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 +356 -0
- package/dist/index.esm.js +1109 -244
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,13 @@ import { EditableConfigurablePanelLayout } from '@principal-ade/panels';
|
|
|
3
3
|
import { EditableConfigurablePanelLayoutProps } from '@principal-ade/panels';
|
|
4
4
|
import { mapThemeToPanelVars } from '@principal-ade/panels';
|
|
5
5
|
import { mapThemeToTabVars } from '@principal-ade/panels';
|
|
6
|
+
import { PanelActions } from '@principal-ade/panel-framework-core';
|
|
7
|
+
import { PanelBlurEventPayload } from '@principal-ade/panel-framework-core';
|
|
8
|
+
import { PanelContextValue } from '@principal-ade/panel-framework-core';
|
|
6
9
|
import { PanelDefinition } from '@principal-ade/panels';
|
|
7
10
|
import { PanelDefinitionWithContent } from '@principal-ade/panels';
|
|
11
|
+
import { PanelEventEmitter } from '@principal-ade/panel-framework-core';
|
|
12
|
+
import { PanelFocusEventPayload } from '@principal-ade/panel-framework-core';
|
|
8
13
|
import { PanelGroup } from '@principal-ade/panels';
|
|
9
14
|
import { PanelLayout } from '@principal-ade/panels';
|
|
10
15
|
import { PanelSlot } from '@principal-ade/panels';
|
|
@@ -19,6 +24,241 @@ import { TilesConfig } from '@principal-ade/panels';
|
|
|
19
24
|
*/
|
|
20
25
|
export declare type BuiltInWorkspaceId = 'project-management' | 'code-review' | 'documentation' | 'agent-work' | 'quality-check' | 'drawing' | 'old-school' | 'principal-office';
|
|
21
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Command definition for the command palette
|
|
29
|
+
*/
|
|
30
|
+
export declare interface Command {
|
|
31
|
+
/** Unique identifier for the command */
|
|
32
|
+
id: string;
|
|
33
|
+
/** Display label shown in the command list */
|
|
34
|
+
label: string;
|
|
35
|
+
/** Optional description shown below the label */
|
|
36
|
+
description?: string;
|
|
37
|
+
/** Optional icon (string or React element) */
|
|
38
|
+
icon?: string | React.ReactNode;
|
|
39
|
+
/** Keywords for fuzzy search matching */
|
|
40
|
+
keywords?: string[];
|
|
41
|
+
/** Category for grouping commands */
|
|
42
|
+
category?: string;
|
|
43
|
+
/** Optional keyboard shortcut hint (e.g., "Alt+1") */
|
|
44
|
+
shortcut?: string;
|
|
45
|
+
/** Command execution function */
|
|
46
|
+
execute: (context: CommandContext) => void | Promise<void>;
|
|
47
|
+
/** Optional function to determine if command is available */
|
|
48
|
+
isAvailable?: (context: CommandContext) => boolean;
|
|
49
|
+
/** Priority for ordering (higher = appears first) */
|
|
50
|
+
priority?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Command category definition
|
|
55
|
+
*/
|
|
56
|
+
export declare interface CommandCategory {
|
|
57
|
+
/** Category identifier */
|
|
58
|
+
id: string;
|
|
59
|
+
/** Display label */
|
|
60
|
+
label: string;
|
|
61
|
+
/** Display priority (higher = shown first) */
|
|
62
|
+
priority?: number;
|
|
63
|
+
/** Optional icon */
|
|
64
|
+
icon?: string | React.ReactNode;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Context provided to command execution functions
|
|
69
|
+
*/
|
|
70
|
+
export declare interface CommandContext {
|
|
71
|
+
/** Panel framework context */
|
|
72
|
+
panelContext: PanelContextValue;
|
|
73
|
+
/** Panel actions for navigation, file operations, etc. */
|
|
74
|
+
actions: PanelActions;
|
|
75
|
+
/** Event bus for inter-panel communication */
|
|
76
|
+
events: PanelEventEmitter;
|
|
77
|
+
/** Currently focused panel */
|
|
78
|
+
focusedPanel: PanelSlotId | null;
|
|
79
|
+
/** Function to set panel focus */
|
|
80
|
+
setFocus: (panel: PanelSlotId) => void;
|
|
81
|
+
/** Workspace management service */
|
|
82
|
+
workspaceService?: WorkspaceLayoutService;
|
|
83
|
+
/** Close the command palette */
|
|
84
|
+
closeCommandPalette: () => void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* CommandInput - Input field for the command palette
|
|
89
|
+
* Auto-focuses on mount and handles input changes
|
|
90
|
+
*/
|
|
91
|
+
export declare const CommandInput: default_2.FC<CommandInputProps>;
|
|
92
|
+
|
|
93
|
+
declare interface CommandInputProps {
|
|
94
|
+
value: string;
|
|
95
|
+
onChange: (value: string) => void;
|
|
96
|
+
placeholder?: string;
|
|
97
|
+
onClose: () => void;
|
|
98
|
+
onEnter?: () => void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* CommandItem - Individual command item in the list
|
|
103
|
+
* Displays command label, description, icon, and keyboard shortcut
|
|
104
|
+
*/
|
|
105
|
+
export declare const CommandItem: default_2.ForwardRefExoticComponent<CommandItemProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
106
|
+
|
|
107
|
+
declare interface CommandItemProps {
|
|
108
|
+
command: Command;
|
|
109
|
+
isSelected: boolean;
|
|
110
|
+
onClick: () => void;
|
|
111
|
+
onMouseEnter: () => void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* CommandList - List of filtered commands
|
|
116
|
+
* Displays commands grouped by category with keyboard navigation support
|
|
117
|
+
*/
|
|
118
|
+
export declare const CommandList: default_2.FC<CommandListProps>;
|
|
119
|
+
|
|
120
|
+
declare interface CommandListProps {
|
|
121
|
+
commands: Command[];
|
|
122
|
+
selectedIndex: number;
|
|
123
|
+
onSelect: (command: Command) => void;
|
|
124
|
+
onHover: (index: number) => void;
|
|
125
|
+
maxResults?: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* CommandPalette - Vim-style command palette component
|
|
130
|
+
* Displays at the bottom of the screen with an input field and command list
|
|
131
|
+
*/
|
|
132
|
+
export declare const CommandPalette: default_2.FC<CommandPaletteProps>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Configuration options for the command palette
|
|
136
|
+
*/
|
|
137
|
+
export declare interface CommandPaletteConfig {
|
|
138
|
+
/** Custom keyboard shortcut configuration */
|
|
139
|
+
keyboard?: CommandPaletteKeyboardConfig;
|
|
140
|
+
/** Maximum number of results to show */
|
|
141
|
+
maxResults?: number;
|
|
142
|
+
/** Placeholder text for the input field */
|
|
143
|
+
placeholder?: string;
|
|
144
|
+
/** Custom CSS class for the container */
|
|
145
|
+
className?: string;
|
|
146
|
+
/** Custom styles for the container */
|
|
147
|
+
style?: React.CSSProperties;
|
|
148
|
+
/** Maximum height of the results list */
|
|
149
|
+
maxHeight?: string;
|
|
150
|
+
/** Enable fuzzy search (default: true) */
|
|
151
|
+
fuzzySearch?: boolean;
|
|
152
|
+
/** Threshold for fuzzy search matching (0-1, default: 0.3) */
|
|
153
|
+
fuzzyThreshold?: number;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Keyboard shortcut configuration for triggering the command palette
|
|
158
|
+
*/
|
|
159
|
+
export declare interface CommandPaletteKeyboardConfig {
|
|
160
|
+
/** Key to trigger the command palette (default: ' ' for Space) */
|
|
161
|
+
key?: string;
|
|
162
|
+
/** Require Alt key (default: true) */
|
|
163
|
+
altKey?: boolean;
|
|
164
|
+
/** Require Ctrl key (default: false) */
|
|
165
|
+
ctrlKey?: boolean;
|
|
166
|
+
/** Require Meta/Cmd key (default: false) */
|
|
167
|
+
metaKey?: boolean;
|
|
168
|
+
/** Require Shift key (default: false) */
|
|
169
|
+
shiftKey?: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Props for the CommandPalette component
|
|
174
|
+
*/
|
|
175
|
+
export declare interface CommandPaletteProps {
|
|
176
|
+
/** Command palette hook return value */
|
|
177
|
+
commandPalette: UseCommandPaletteReturn;
|
|
178
|
+
/** Configuration options */
|
|
179
|
+
config?: CommandPaletteConfig;
|
|
180
|
+
/** Panel context for command execution */
|
|
181
|
+
context: CommandContext;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Service for managing command registration and execution
|
|
186
|
+
* Provides a centralized registry for commands that can be accessed via the command palette
|
|
187
|
+
*/
|
|
188
|
+
export declare class CommandRegistryService {
|
|
189
|
+
private commands;
|
|
190
|
+
private listeners;
|
|
191
|
+
/**
|
|
192
|
+
* Register one or more commands
|
|
193
|
+
* @param commands - Array of commands to register
|
|
194
|
+
*/
|
|
195
|
+
registerCommands(commands: Command[]): void;
|
|
196
|
+
/**
|
|
197
|
+
* Register a single command
|
|
198
|
+
* @param command - Command to register
|
|
199
|
+
*/
|
|
200
|
+
registerCommand(command: Command): void;
|
|
201
|
+
/**
|
|
202
|
+
* Unregister commands by ID
|
|
203
|
+
* @param commandIds - Array of command IDs to unregister
|
|
204
|
+
*/
|
|
205
|
+
unregisterCommands(commandIds: string[]): void;
|
|
206
|
+
/**
|
|
207
|
+
* Unregister a single command
|
|
208
|
+
* @param commandId - Command ID to unregister
|
|
209
|
+
*/
|
|
210
|
+
unregisterCommand(commandId: string): void;
|
|
211
|
+
/**
|
|
212
|
+
* Get all registered commands
|
|
213
|
+
* @param context - Command context for availability checks
|
|
214
|
+
* @returns Array of available commands
|
|
215
|
+
*/
|
|
216
|
+
getCommands(context?: CommandContext): Command[];
|
|
217
|
+
/**
|
|
218
|
+
* Get a command by ID
|
|
219
|
+
* @param commandId - Command ID
|
|
220
|
+
* @returns Command if found, undefined otherwise
|
|
221
|
+
*/
|
|
222
|
+
getCommand(commandId: string): Command | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Execute a command by ID
|
|
225
|
+
* @param commandId - Command ID to execute
|
|
226
|
+
* @param context - Command context
|
|
227
|
+
*/
|
|
228
|
+
executeCommand(commandId: string, context: CommandContext): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Search commands by query
|
|
231
|
+
* @param query - Search query
|
|
232
|
+
* @param context - Command context for availability checks
|
|
233
|
+
* @returns Filtered and sorted commands
|
|
234
|
+
*/
|
|
235
|
+
searchCommands(query: string, context?: CommandContext): Command[];
|
|
236
|
+
/**
|
|
237
|
+
* Sort commands by priority and label
|
|
238
|
+
* @param commands - Commands to sort
|
|
239
|
+
* @returns Sorted commands
|
|
240
|
+
*/
|
|
241
|
+
private sortCommands;
|
|
242
|
+
/**
|
|
243
|
+
* Subscribe to registry changes
|
|
244
|
+
* @param listener - Callback function called when registry changes
|
|
245
|
+
* @returns Unsubscribe function
|
|
246
|
+
*/
|
|
247
|
+
subscribe(listener: () => void): () => void;
|
|
248
|
+
/**
|
|
249
|
+
* Clear all commands
|
|
250
|
+
*/
|
|
251
|
+
clear(): void;
|
|
252
|
+
/**
|
|
253
|
+
* Get count of registered commands
|
|
254
|
+
*/
|
|
255
|
+
get size(): number;
|
|
256
|
+
/**
|
|
257
|
+
* Notify all listeners of registry changes
|
|
258
|
+
*/
|
|
259
|
+
private notifyListeners;
|
|
260
|
+
}
|
|
261
|
+
|
|
22
262
|
/**
|
|
23
263
|
* Options for creating a new workspace
|
|
24
264
|
*/
|
|
@@ -57,6 +297,18 @@ export declare interface FocusIndicatorProps {
|
|
|
57
297
|
style?: default_2.CSSProperties;
|
|
58
298
|
}
|
|
59
299
|
|
|
300
|
+
/**
|
|
301
|
+
* Get the global command registry instance
|
|
302
|
+
* @returns Global CommandRegistryService instance
|
|
303
|
+
*/
|
|
304
|
+
export declare function getGlobalCommandRegistry(): CommandRegistryService;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Get panel commands
|
|
308
|
+
* @returns Array of panel-related commands
|
|
309
|
+
*/
|
|
310
|
+
export declare function getPanelCommands(): Command[];
|
|
311
|
+
|
|
60
312
|
/**
|
|
61
313
|
* Default localStorage-based persistence adapter for web applications
|
|
62
314
|
*/
|
|
@@ -97,6 +349,8 @@ export { mapThemeToPanelVars }
|
|
|
97
349
|
|
|
98
350
|
export { mapThemeToTabVars }
|
|
99
351
|
|
|
352
|
+
export { PanelBlurEventPayload }
|
|
353
|
+
|
|
100
354
|
/**
|
|
101
355
|
* Collapsed state for panels
|
|
102
356
|
*/
|
|
@@ -105,6 +359,11 @@ export declare interface PanelCollapsed {
|
|
|
105
359
|
right?: boolean;
|
|
106
360
|
}
|
|
107
361
|
|
|
362
|
+
/**
|
|
363
|
+
* Built-in commands for panel navigation and control
|
|
364
|
+
*/
|
|
365
|
+
export declare const panelCommands: Command[];
|
|
366
|
+
|
|
108
367
|
export { PanelDefinition }
|
|
109
368
|
|
|
110
369
|
export { PanelDefinitionWithContent }
|
|
@@ -123,6 +382,8 @@ export declare interface PanelFocusActions {
|
|
|
123
382
|
focusPrevious: () => void;
|
|
124
383
|
}
|
|
125
384
|
|
|
385
|
+
export { PanelFocusEventPayload }
|
|
386
|
+
|
|
126
387
|
/**
|
|
127
388
|
* Focus state for the panel layout
|
|
128
389
|
*/
|
|
@@ -212,6 +473,11 @@ export declare interface RepositoryWorkspaceState {
|
|
|
212
473
|
};
|
|
213
474
|
}
|
|
214
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Reset the global command registry (useful for testing)
|
|
478
|
+
*/
|
|
479
|
+
export declare function resetGlobalCommandRegistry(): void;
|
|
480
|
+
|
|
215
481
|
export { ResponsiveConfigurablePanelLayout }
|
|
216
482
|
|
|
217
483
|
export { ResponsiveConfigurablePanelLayoutProps }
|
|
@@ -276,11 +542,97 @@ export declare interface UpdateWorkspaceOptions {
|
|
|
276
542
|
};
|
|
277
543
|
}
|
|
278
544
|
|
|
545
|
+
/**
|
|
546
|
+
* Hook for managing command palette state and behavior
|
|
547
|
+
* Handles command registration, filtering, keyboard navigation, and execution
|
|
548
|
+
*/
|
|
549
|
+
export declare function useCommandPalette({ context, commands: initialCommands, keyboard, config, registry: providedRegistry, }: UseCommandPaletteProps): UseCommandPaletteReturn;
|
|
550
|
+
|
|
551
|
+
declare interface UseCommandPaletteProps {
|
|
552
|
+
/** Command context */
|
|
553
|
+
context: CommandContext;
|
|
554
|
+
/** Initial commands to register */
|
|
555
|
+
commands?: Command[];
|
|
556
|
+
/** Keyboard configuration */
|
|
557
|
+
keyboard?: CommandPaletteKeyboardConfig;
|
|
558
|
+
/** Command palette configuration */
|
|
559
|
+
config?: CommandPaletteConfig;
|
|
560
|
+
/** Command registry service (optional, uses global if not provided) */
|
|
561
|
+
registry?: CommandRegistryService;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Command palette state and actions hook return type
|
|
566
|
+
*/
|
|
567
|
+
export declare interface UseCommandPaletteReturn {
|
|
568
|
+
/** Whether the command palette is open */
|
|
569
|
+
isOpen: boolean;
|
|
570
|
+
/** Open the command palette */
|
|
571
|
+
open: () => void;
|
|
572
|
+
/** Close the command palette */
|
|
573
|
+
close: () => void;
|
|
574
|
+
/** Toggle the command palette */
|
|
575
|
+
toggle: () => void;
|
|
576
|
+
/** Search query */
|
|
577
|
+
query: string;
|
|
578
|
+
/** Set search query */
|
|
579
|
+
setQuery: (query: string) => void;
|
|
580
|
+
/** Filtered and sorted commands */
|
|
581
|
+
filteredCommands: Command[];
|
|
582
|
+
/** Execute a command by ID */
|
|
583
|
+
executeCommand: (commandId: string) => Promise<void>;
|
|
584
|
+
/** Selected command index (for keyboard navigation) */
|
|
585
|
+
selectedIndex: number;
|
|
586
|
+
/** Set selected index */
|
|
587
|
+
setSelectedIndex: (index: number) => void;
|
|
588
|
+
/** Navigate to next command */
|
|
589
|
+
selectNext: () => void;
|
|
590
|
+
/** Navigate to previous command */
|
|
591
|
+
selectPrevious: () => void;
|
|
592
|
+
/** Execute the currently selected command */
|
|
593
|
+
executeSelected: () => Promise<void>;
|
|
594
|
+
/** All registered commands */
|
|
595
|
+
commands: Command[];
|
|
596
|
+
/** Register new commands */
|
|
597
|
+
registerCommands: (commands: Command[]) => void;
|
|
598
|
+
/** Unregister commands by ID */
|
|
599
|
+
unregisterCommands: (commandIds: string[]) => void;
|
|
600
|
+
}
|
|
601
|
+
|
|
279
602
|
/**
|
|
280
603
|
* Hook for managing panel focus state with keyboard shortcuts
|
|
281
604
|
*/
|
|
282
605
|
export declare function usePanelFocus(options?: UsePanelFocusOptions): UsePanelFocusReturn;
|
|
283
606
|
|
|
607
|
+
/**
|
|
608
|
+
* Hook for panels to listen to focus events from the framework
|
|
609
|
+
*
|
|
610
|
+
* This is a convenience hook that panels can use to respond to focus changes
|
|
611
|
+
* from keyboard shortcuts, mouse clicks, or programmatic navigation.
|
|
612
|
+
*
|
|
613
|
+
* @param panelId - The ID of this panel (from panel metadata)
|
|
614
|
+
* @param events - Event emitter from PanelComponentProps
|
|
615
|
+
* @param onFocus - Callback when this panel receives focus
|
|
616
|
+
* @param onBlur - Optional callback when this panel loses focus
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* function TerminalPanel({ context, actions, events }: PanelComponentProps) {
|
|
621
|
+
* const xtermRef = useRef<Terminal>();
|
|
622
|
+
*
|
|
623
|
+
* usePanelFocusListener(
|
|
624
|
+
* 'terminal',
|
|
625
|
+
* events,
|
|
626
|
+
* () => xtermRef.current?.focus(),
|
|
627
|
+
* () => xtermRef.current?.blur()
|
|
628
|
+
* );
|
|
629
|
+
*
|
|
630
|
+
* return <div id="xterm-container" />;
|
|
631
|
+
* }
|
|
632
|
+
* ```
|
|
633
|
+
*/
|
|
634
|
+
export declare function usePanelFocusListener(panelId: string, events: PanelEventEmitter, onFocus: () => void, onBlur?: () => void): void;
|
|
635
|
+
|
|
284
636
|
export declare interface UsePanelFocusOptions {
|
|
285
637
|
/** Initial focused panel (optional) */
|
|
286
638
|
initialFocus?: PanelSlotId | null;
|
|
@@ -290,6 +642,10 @@ export declare interface UsePanelFocusOptions {
|
|
|
290
642
|
panelType?: 'two-panel' | 'three-panel';
|
|
291
643
|
/** Callback when focus changes */
|
|
292
644
|
onFocusChange?: (panel: PanelSlotId | null) => void;
|
|
645
|
+
/** Event emitter from panel framework (optional, for focus events) */
|
|
646
|
+
events?: PanelEventEmitter;
|
|
647
|
+
/** Function to map panel slot to panel ID (optional, required for event emission) */
|
|
648
|
+
getPanelId?: (slot: PanelSlotId) => string | undefined;
|
|
293
649
|
}
|
|
294
650
|
|
|
295
651
|
export declare interface UsePanelFocusReturn extends PanelFocusState, PanelFocusActions {
|