@principal-ade/panel-layouts 0.1.6 → 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 CHANGED
@@ -3,8 +3,11 @@ 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 { PanelBlurEventPayload } from '@principal-ade/panel-framework-core';
6
7
  import { PanelDefinition } from '@principal-ade/panels';
7
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';
8
11
  import { PanelGroup } from '@principal-ade/panels';
9
12
  import { PanelLayout } from '@principal-ade/panels';
10
13
  import { PanelSlot } from '@principal-ade/panels';
@@ -97,6 +100,8 @@ export { mapThemeToPanelVars }
97
100
 
98
101
  export { mapThemeToTabVars }
99
102
 
103
+ export { PanelBlurEventPayload }
104
+
100
105
  /**
101
106
  * Collapsed state for panels
102
107
  */
@@ -123,6 +128,8 @@ export declare interface PanelFocusActions {
123
128
  focusPrevious: () => void;
124
129
  }
125
130
 
131
+ export { PanelFocusEventPayload }
132
+
126
133
  /**
127
134
  * Focus state for the panel layout
128
135
  */
@@ -281,6 +288,35 @@ export declare interface UpdateWorkspaceOptions {
281
288
  */
282
289
  export declare function usePanelFocus(options?: UsePanelFocusOptions): UsePanelFocusReturn;
283
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
+
284
320
  export declare interface UsePanelFocusOptions {
285
321
  /** Initial focused panel (optional) */
286
322
  initialFocus?: PanelSlotId | null;
@@ -290,6 +326,10 @@ export declare interface UsePanelFocusOptions {
290
326
  panelType?: 'two-panel' | 'three-panel';
291
327
  /** Callback when focus changes */
292
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;
293
333
  }
294
334
 
295
335
  export declare interface UsePanelFocusReturn extends PanelFocusState, PanelFocusActions {