@principal-ade/panel-layouts 0.1.5 → 0.2.0
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 +144 -0
- package/dist/index.esm.js +376 -189
- 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
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
1
2
|
import { EditableConfigurablePanelLayout } from '@principal-ade/panels';
|
|
2
3
|
import { EditableConfigurablePanelLayoutProps } from '@principal-ade/panels';
|
|
3
4
|
import { mapThemeToPanelVars } from '@principal-ade/panels';
|
|
4
5
|
import { mapThemeToTabVars } from '@principal-ade/panels';
|
|
6
|
+
import { PanelBlurEventPayload } from '@principal-ade/panel-framework-core';
|
|
5
7
|
import { PanelDefinition } from '@principal-ade/panels';
|
|
6
8
|
import { PanelDefinitionWithContent } from '@principal-ade/panels';
|
|
9
|
+
import { PanelEventEmitter } from '@principal-ade/panel-framework-core';
|
|
10
|
+
import { PanelFocusEventPayload } from '@principal-ade/panel-framework-core';
|
|
7
11
|
import { PanelGroup } from '@principal-ade/panels';
|
|
8
12
|
import { PanelLayout } from '@principal-ade/panels';
|
|
9
13
|
import { PanelSlot } from '@principal-ade/panels';
|
|
@@ -40,6 +44,22 @@ export { EditableConfigurablePanelLayout }
|
|
|
40
44
|
|
|
41
45
|
export { EditableConfigurablePanelLayoutProps }
|
|
42
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Visual indicator that highlights the focused panel
|
|
49
|
+
*
|
|
50
|
+
* Renders a subtle border/glow around the focused panel for keyboard navigation feedback
|
|
51
|
+
*/
|
|
52
|
+
export declare const FocusIndicator: default_2.FC<FocusIndicatorProps>;
|
|
53
|
+
|
|
54
|
+
export declare interface FocusIndicatorProps {
|
|
55
|
+
/** Whether this panel is currently focused */
|
|
56
|
+
isFocused: boolean;
|
|
57
|
+
/** Custom class name */
|
|
58
|
+
className?: string;
|
|
59
|
+
/** Custom styles */
|
|
60
|
+
style?: default_2.CSSProperties;
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
/**
|
|
44
64
|
* Default localStorage-based persistence adapter for web applications
|
|
45
65
|
*/
|
|
@@ -80,6 +100,8 @@ export { mapThemeToPanelVars }
|
|
|
80
100
|
|
|
81
101
|
export { mapThemeToTabVars }
|
|
82
102
|
|
|
103
|
+
export { PanelBlurEventPayload }
|
|
104
|
+
|
|
83
105
|
/**
|
|
84
106
|
* Collapsed state for panels
|
|
85
107
|
*/
|
|
@@ -92,6 +114,30 @@ export { PanelDefinition }
|
|
|
92
114
|
|
|
93
115
|
export { PanelDefinitionWithContent }
|
|
94
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Actions for managing panel focus
|
|
119
|
+
*/
|
|
120
|
+
export declare interface PanelFocusActions {
|
|
121
|
+
/** Set focus to a specific panel */
|
|
122
|
+
setFocus: (panel: PanelSlotId) => void;
|
|
123
|
+
/** Clear focus from all panels */
|
|
124
|
+
clearFocus: () => void;
|
|
125
|
+
/** Focus the next visible panel */
|
|
126
|
+
focusNext: () => void;
|
|
127
|
+
/** Focus the previous visible panel */
|
|
128
|
+
focusPrevious: () => void;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { PanelFocusEventPayload }
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Focus state for the panel layout
|
|
135
|
+
*/
|
|
136
|
+
export declare interface PanelFocusState {
|
|
137
|
+
/** Currently focused panel, or null if no panel is focused */
|
|
138
|
+
focusedPanel: PanelSlotId | null;
|
|
139
|
+
}
|
|
140
|
+
|
|
95
141
|
export { PanelGroup }
|
|
96
142
|
|
|
97
143
|
export { PanelLayout }
|
|
@@ -116,6 +162,14 @@ export declare interface PanelSizes {
|
|
|
116
162
|
|
|
117
163
|
export { PanelSlot }
|
|
118
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Focus management type definitions for keyboard shortcuts
|
|
167
|
+
*/
|
|
168
|
+
/**
|
|
169
|
+
* Panel identifier for focus tracking
|
|
170
|
+
*/
|
|
171
|
+
export declare type PanelSlotId = 'left' | 'middle' | 'right';
|
|
172
|
+
|
|
119
173
|
/**
|
|
120
174
|
* Storage adapter interface for persisting panel state
|
|
121
175
|
* Implementations can use localStorage, Electron IPC, or remote storage
|
|
@@ -229,6 +283,96 @@ export declare interface UpdateWorkspaceOptions {
|
|
|
229
283
|
};
|
|
230
284
|
}
|
|
231
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Hook for managing panel focus state with keyboard shortcuts
|
|
288
|
+
*/
|
|
289
|
+
export declare function usePanelFocus(options?: UsePanelFocusOptions): UsePanelFocusReturn;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Hook for panels to listen to focus events from the framework
|
|
293
|
+
*
|
|
294
|
+
* This is a convenience hook that panels can use to respond to focus changes
|
|
295
|
+
* from keyboard shortcuts, mouse clicks, or programmatic navigation.
|
|
296
|
+
*
|
|
297
|
+
* @param panelId - The ID of this panel (from panel metadata)
|
|
298
|
+
* @param events - Event emitter from PanelComponentProps
|
|
299
|
+
* @param onFocus - Callback when this panel receives focus
|
|
300
|
+
* @param onBlur - Optional callback when this panel loses focus
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* function TerminalPanel({ context, actions, events }: PanelComponentProps) {
|
|
305
|
+
* const xtermRef = useRef<Terminal>();
|
|
306
|
+
*
|
|
307
|
+
* usePanelFocusListener(
|
|
308
|
+
* 'terminal',
|
|
309
|
+
* events,
|
|
310
|
+
* () => xtermRef.current?.focus(),
|
|
311
|
+
* () => xtermRef.current?.blur()
|
|
312
|
+
* );
|
|
313
|
+
*
|
|
314
|
+
* return <div id="xterm-container" />;
|
|
315
|
+
* }
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
export declare function usePanelFocusListener(panelId: string, events: PanelEventEmitter, onFocus: () => void, onBlur?: () => void): void;
|
|
319
|
+
|
|
320
|
+
export declare interface UsePanelFocusOptions {
|
|
321
|
+
/** Initial focused panel (optional) */
|
|
322
|
+
initialFocus?: PanelSlotId | null;
|
|
323
|
+
/** Collapsed state to determine which panels are visible */
|
|
324
|
+
collapsed?: PanelCollapsed;
|
|
325
|
+
/** Whether this is a two-panel or three-panel layout */
|
|
326
|
+
panelType?: 'two-panel' | 'three-panel';
|
|
327
|
+
/** Callback when focus changes */
|
|
328
|
+
onFocusChange?: (panel: PanelSlotId | null) => void;
|
|
329
|
+
/** Event emitter from panel framework (optional, for focus events) */
|
|
330
|
+
events?: PanelEventEmitter;
|
|
331
|
+
/** Function to map panel slot to panel ID (optional, required for event emission) */
|
|
332
|
+
getPanelId?: (slot: PanelSlotId) => string | undefined;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export declare interface UsePanelFocusReturn extends PanelFocusState, PanelFocusActions {
|
|
336
|
+
/** Check if a specific panel is focused */
|
|
337
|
+
isFocused: (panel: PanelSlotId) => boolean;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Hook for handling Alt+1/2/3 keyboard shortcuts for panel toggle and focus
|
|
342
|
+
*
|
|
343
|
+
* Behavior:
|
|
344
|
+
* - Alt+1 (Left Panel):
|
|
345
|
+
* 1. If collapsed: expand (no focus change)
|
|
346
|
+
* 2. If expanded but not focused: focus it
|
|
347
|
+
* 3. If focused: collapse and focus middle
|
|
348
|
+
*
|
|
349
|
+
* - Alt+2 (Middle Panel):
|
|
350
|
+
* - Always focus middle (never collapses)
|
|
351
|
+
*
|
|
352
|
+
* - Alt+3 (Right Panel):
|
|
353
|
+
* 1. If collapsed: expand (no focus change)
|
|
354
|
+
* 2. If expanded but not focused: focus it
|
|
355
|
+
* 3. If focused: collapse and focus middle
|
|
356
|
+
*/
|
|
357
|
+
export declare function usePanelKeyboardShortcuts(options: UsePanelKeyboardShortcutsOptions): void;
|
|
358
|
+
|
|
359
|
+
export declare interface UsePanelKeyboardShortcutsOptions {
|
|
360
|
+
/** Whether keyboard shortcuts are enabled */
|
|
361
|
+
enabled?: boolean;
|
|
362
|
+
/** Current focused panel */
|
|
363
|
+
focusedPanel: PanelSlotId | null;
|
|
364
|
+
/** Current collapsed state */
|
|
365
|
+
collapsed: PanelCollapsed;
|
|
366
|
+
/** Panel type (two-panel or three-panel) */
|
|
367
|
+
panelType: 'two-panel' | 'three-panel';
|
|
368
|
+
/** Set focus to a specific panel */
|
|
369
|
+
setFocus: (panel: PanelSlotId) => void;
|
|
370
|
+
/** Callback to expand a panel */
|
|
371
|
+
onExpand: (panel: 'left' | 'right') => void | Promise<void>;
|
|
372
|
+
/** Callback to collapse a panel */
|
|
373
|
+
onCollapse: (panel: 'left' | 'right') => void | Promise<void>;
|
|
374
|
+
}
|
|
375
|
+
|
|
232
376
|
/**
|
|
233
377
|
* Hook for persisting panel layouts across sessions
|
|
234
378
|
*
|