@principal-ade/panel-layouts 0.2.2 → 0.2.4

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,6 +1,8 @@
1
+ import { AIFunctionDefinition } from '@principal-ade/panel-framework-core';
1
2
  import { default as default_2 } from 'react';
2
3
  import { EditableConfigurablePanelLayout } from '@principal-ade/panels';
3
4
  import { EditableConfigurablePanelLayoutProps } from '@principal-ade/panels';
5
+ import { JsonSchema } from '@principal-ade/panel-framework-core';
4
6
  import { mapThemeToPanelVars } from '@principal-ade/panels';
5
7
  import { mapThemeToTabVars } from '@principal-ade/panels';
6
8
  import { PanelActions } from '@principal-ade/panel-framework-core';
@@ -13,17 +15,36 @@ import { PanelFocusEventPayload } from '@principal-ade/panel-framework-core';
13
15
  import { PanelGroup } from '@principal-ade/panels';
14
16
  import { PanelLayout } from '@principal-ade/panels';
15
17
  import { PanelSlot } from '@principal-ade/panels';
18
+ import { PanelTool } from '@principal-ade/panel-framework-core';
19
+ import { PanelToolRegistry } from '@principal-ade/panel-framework-core';
20
+ import { RegisteredTool } from '@principal-ade/panel-framework-core';
16
21
  import { ResponsiveConfigurablePanelLayout } from '@principal-ade/panels';
17
22
  import { ResponsiveConfigurablePanelLayoutProps } from '@principal-ade/panels';
18
23
  import { TabsConfig } from '@principal-ade/panels';
19
24
  import { Theme } from '@principal-ade/panels';
20
25
  import { TilesConfig } from '@principal-ade/panels';
21
26
 
27
+ /**
28
+ * Anthropic tool definition format
29
+ */
30
+ export declare interface AnthropicTool {
31
+ name: string;
32
+ description: string;
33
+ input_schema: JsonSchema;
34
+ }
35
+
22
36
  /**
23
37
  * Built-in workspace IDs
24
38
  */
25
39
  export declare type BuiltInWorkspaceId = 'project-management' | 'code-review' | 'documentation' | 'agent-work' | 'quality-check' | 'drawing' | 'old-school' | 'principal-office';
26
40
 
41
+ /**
42
+ * Tool: Collapse All Panels
43
+ *
44
+ * Collapse both left and right panels to maximize the main content area.
45
+ */
46
+ export declare const collapseAllPanelsTool: PanelTool;
47
+
27
48
  /**
28
49
  * Command definition for the command palette
29
50
  */
@@ -259,6 +280,12 @@ export declare class CommandRegistryService {
259
280
  private notifyListeners;
260
281
  }
261
282
 
283
+ /**
284
+ * Creates a hook-like function that returns commands from a registry.
285
+ * Useful for dynamic command registration.
286
+ */
287
+ export declare function createToolCommandsProvider(registry: PanelToolRegistry, config?: ToolCommandBridgeConfig): () => Command[];
288
+
262
289
  /**
263
290
  * Options for creating a new workspace
264
291
  */
@@ -281,6 +308,13 @@ export { EditableConfigurablePanelLayout }
281
308
 
282
309
  export { EditableConfigurablePanelLayoutProps }
283
310
 
311
+ /**
312
+ * Tool: Expand All Panels
313
+ *
314
+ * Expand both left and right panels to show all content.
315
+ */
316
+ export declare const expandAllPanelsTool: PanelTool;
317
+
284
318
  /**
285
319
  * Visual indicator that highlights the focused panel
286
320
  *
@@ -297,6 +331,53 @@ export declare interface FocusIndicatorProps {
297
331
  style?: default_2.CSSProperties;
298
332
  }
299
333
 
334
+ /**
335
+ * Tool: Focus Panel
336
+ *
337
+ * Set keyboard/logical focus to a specific panel slot.
338
+ */
339
+ export declare const focusPanelTool: PanelTool;
340
+
341
+ /**
342
+ * Gemini function declaration format
343
+ */
344
+ export declare interface GeminiFunctionDeclaration {
345
+ name: string;
346
+ description: string;
347
+ parameters: {
348
+ type: string;
349
+ properties: Record<string, GeminiPropertySchema>;
350
+ required: string[];
351
+ };
352
+ }
353
+
354
+ /**
355
+ * Gemini property schema (simplified)
356
+ */
357
+ export declare interface GeminiPropertySchema {
358
+ type: string;
359
+ description?: string;
360
+ enum?: string[];
361
+ }
362
+
363
+ /**
364
+ * Gemini tools wrapper
365
+ */
366
+ export declare interface GeminiTools {
367
+ functionDeclarations: GeminiFunctionDeclaration[];
368
+ }
369
+
370
+ /**
371
+ * Generate a system prompt section describing available tools.
372
+ *
373
+ * @param tools - Array of tools to describe
374
+ * @param options - Formatting options
375
+ */
376
+ export declare function generateToolsSystemPrompt(tools: PanelTool[], options?: {
377
+ header?: string;
378
+ includeParameters?: boolean;
379
+ }): string;
380
+
300
381
  /**
301
382
  * Get the global command registry instance
302
383
  * @returns Global CommandRegistryService instance
@@ -309,6 +390,44 @@ export declare function getGlobalCommandRegistry(): CommandRegistryService;
309
390
  */
310
391
  export declare function getPanelCommands(): Command[];
311
392
 
393
+ /**
394
+ * Utility to extract parameter information for UI rendering.
395
+ */
396
+ export declare function getToolParameterInfo(tool: RegisteredTool): ToolParameterInfo[];
397
+
398
+ /**
399
+ * All layout tools exported as an array.
400
+ *
401
+ * Register these with PanelToolRegistry:
402
+ * ```typescript
403
+ * import { layoutTools } from '@principal-ade/panel-layouts';
404
+ * import { getGlobalToolRegistry } from '@principal-ade/panel-framework-core';
405
+ *
406
+ * const registry = getGlobalToolRegistry();
407
+ * registry.registerPanelTools({
408
+ * id: 'panel-layouts',
409
+ * name: 'Panel Layouts',
410
+ * tools: layoutTools,
411
+ * });
412
+ * ```
413
+ */
414
+ export declare const layoutTools: PanelTool[];
415
+
416
+ /**
417
+ * Layout tools metadata for registration.
418
+ *
419
+ * Use this with PanelToolRegistry.registerPanelTools():
420
+ * ```typescript
421
+ * registry.registerPanelTools(layoutToolsMetadata);
422
+ * ```
423
+ */
424
+ export declare const layoutToolsMetadata: {
425
+ id: string;
426
+ name: string;
427
+ description: string;
428
+ tools: PanelTool[];
429
+ };
430
+
312
431
  /**
313
432
  * Default localStorage-based persistence adapter for web applications
314
433
  */
@@ -349,8 +468,55 @@ export { mapThemeToPanelVars }
349
468
 
350
469
  export { mapThemeToTabVars }
351
470
 
471
+ /**
472
+ * OpenAI function definition format
473
+ */
474
+ export declare interface OpenAIFunction {
475
+ name: string;
476
+ description: string;
477
+ parameters: JsonSchema;
478
+ }
479
+
480
+ /**
481
+ * OpenAI tool wrapper
482
+ */
483
+ export declare interface OpenAITool {
484
+ type: 'function';
485
+ function: OpenAIFunction;
486
+ }
487
+
352
488
  export { PanelBlurEventPayload }
353
489
 
490
+ /**
491
+ * A button component for collapsing/expanding side panels.
492
+ *
493
+ * Shows appropriate icon based on panel state and side:
494
+ * - Left panel collapsed: PanelLeft icon (show panel)
495
+ * - Left panel expanded: PanelLeftClose icon (hide panel)
496
+ * - Right panel collapsed: PanelRight icon (show panel)
497
+ * - Right panel expanded: PanelRightClose icon (hide panel)
498
+ */
499
+ export declare const PanelCollapseButton: default_2.FC<PanelCollapseButtonProps>;
500
+
501
+ export declare interface PanelCollapseButtonProps {
502
+ /** Whether the panel is currently collapsed */
503
+ isCollapsed: boolean;
504
+ /** Callback when the button is clicked */
505
+ onToggle: () => void;
506
+ /** Which side the panel is on */
507
+ side?: 'left' | 'right';
508
+ /** Icon size in pixels */
509
+ iconSize?: number;
510
+ /** Additional inline styles */
511
+ style?: default_2.CSSProperties;
512
+ /** Keyboard shortcut hint to show in tooltip */
513
+ shortcutHint?: string;
514
+ /** Custom title/tooltip */
515
+ title?: string;
516
+ /** Custom class name */
517
+ className?: string;
518
+ }
519
+
354
520
  /**
355
521
  * Collapsed state for panels
356
522
  */
@@ -364,6 +530,102 @@ export declare interface PanelCollapsed {
364
530
  */
365
531
  export declare const panelCommands: Command[];
366
532
 
533
+ /**
534
+ * A button component for opening panel configuration/layout settings.
535
+ */
536
+ export declare const PanelConfigureButton: default_2.FC<PanelConfigureButtonProps>;
537
+
538
+ export declare interface PanelConfigureButtonProps {
539
+ /** Callback when the button is clicked */
540
+ onConfigure: () => void;
541
+ /** Icon size in pixels */
542
+ iconSize?: number;
543
+ /** Additional inline styles */
544
+ style?: default_2.CSSProperties;
545
+ /** Custom title/tooltip */
546
+ title?: string;
547
+ /** Custom class name */
548
+ className?: string;
549
+ }
550
+
551
+ /**
552
+ * A unified panel controls component that provides buttons for:
553
+ * - Collapsing/expanding left and right sidebars
554
+ * - Switching/swapping panel positions
555
+ * - Opening panel configuration
556
+ *
557
+ * The buttons are rendered in order:
558
+ * 1. Left sidebar collapse button
559
+ * 2. Left-middle switch button
560
+ * 3. Configure panels button
561
+ * 4. Right-middle switch button
562
+ * 5. Right sidebar collapse button
563
+ *
564
+ * @example
565
+ * ```tsx
566
+ * <PanelControls
567
+ * leftSidebarCollapsed={leftCollapsed}
568
+ * onToggleLeftSidebar={() => setLeftCollapsed(!leftCollapsed)}
569
+ * showLeftSidebarControl
570
+ * rightSidebarCollapsed={rightCollapsed}
571
+ * onToggleRightSidebar={() => setRightCollapsed(!rightCollapsed)}
572
+ * showRightSidebarControl
573
+ * onSwitchLeftMiddlePanels={handleSwitchLeftMiddle}
574
+ * showSwitchLeftMiddle
575
+ * onSwitchRightMiddlePanels={handleSwitchRightMiddle}
576
+ * showSwitchRightMiddle
577
+ * onConfigurePanels={() => setShowConfigModal(true)}
578
+ * showConfigureButton
579
+ * />
580
+ * ```
581
+ */
582
+ export declare const PanelControls: default_2.FC<PanelControlsProps>;
583
+
584
+ export declare interface PanelControlsProps {
585
+ /** Left sidebar collapsed state */
586
+ leftSidebarCollapsed?: boolean;
587
+ /** Callback when left sidebar toggle is clicked */
588
+ onToggleLeftSidebar?: () => void;
589
+ /** Whether to show the left sidebar control */
590
+ showLeftSidebarControl?: boolean;
591
+ /** Right sidebar collapsed state */
592
+ rightSidebarCollapsed?: boolean;
593
+ /** Callback when right sidebar toggle is clicked */
594
+ onToggleRightSidebar?: () => void;
595
+ /** Whether to show the right sidebar control */
596
+ showRightSidebarControl?: boolean;
597
+ /** Callback when switch left-middle panels button is clicked */
598
+ onSwitchLeftMiddlePanels?: () => void;
599
+ /** Whether to show the switch left-middle button */
600
+ showSwitchLeftMiddle?: boolean;
601
+ /** Callback when switch right-middle panels button is clicked */
602
+ onSwitchRightMiddlePanels?: () => void;
603
+ /** Whether to show the switch right-middle button */
604
+ showSwitchRightMiddle?: boolean;
605
+ /** Callback when configure panels button is clicked */
606
+ onConfigurePanels?: () => void;
607
+ /** Whether to show the configure panels button */
608
+ showConfigureButton?: boolean;
609
+ /** Gap between buttons in pixels */
610
+ gap?: number;
611
+ /** Additional inline styles for the container */
612
+ style?: default_2.CSSProperties;
613
+ /** Custom class name for the container */
614
+ className?: string;
615
+ /** Icon size for all buttons */
616
+ iconSize?: number;
617
+ /** Props to pass to the left collapse button */
618
+ leftCollapseButtonProps?: Partial<Omit<PanelCollapseButtonProps, 'isCollapsed' | 'onToggle' | 'side'>>;
619
+ /** Props to pass to the right collapse button */
620
+ rightCollapseButtonProps?: Partial<Omit<PanelCollapseButtonProps, 'isCollapsed' | 'onToggle' | 'side'>>;
621
+ /** Props to pass to the left-middle switch button */
622
+ leftMiddleSwitchButtonProps?: Partial<Omit<PanelSwitchButtonProps, 'onSwitch' | 'variant'>>;
623
+ /** Props to pass to the right-middle switch button */
624
+ rightMiddleSwitchButtonProps?: Partial<Omit<PanelSwitchButtonProps, 'onSwitch' | 'variant'>>;
625
+ /** Props to pass to the configure button */
626
+ configureButtonProps?: Partial<Omit<PanelConfigureButtonProps, 'onConfigure'>>;
627
+ }
628
+
367
629
  export { PanelDefinition }
368
630
 
369
631
  export { PanelDefinitionWithContent }
@@ -424,6 +686,29 @@ export { PanelSlot }
424
686
  */
425
687
  export declare type PanelSlotId = 'left' | 'middle' | 'right';
426
688
 
689
+ /**
690
+ * A button component for switching/swapping panel positions.
691
+ *
692
+ * - left-middle: Shows ArrowLeftRight icon for swapping left and middle panels
693
+ * - right-middle: Shows ArrowRightLeft icon for swapping right and middle panels
694
+ */
695
+ export declare const PanelSwitchButton: default_2.FC<PanelSwitchButtonProps>;
696
+
697
+ export declare interface PanelSwitchButtonProps {
698
+ /** Callback when the button is clicked */
699
+ onSwitch: () => void;
700
+ /** Which panels are being switched */
701
+ variant?: 'left-middle' | 'right-middle';
702
+ /** Icon size in pixels */
703
+ iconSize?: number;
704
+ /** Additional inline styles */
705
+ style?: default_2.CSSProperties;
706
+ /** Custom title/tooltip */
707
+ title?: string;
708
+ /** Custom class name */
709
+ className?: string;
710
+ }
711
+
427
712
  /**
428
713
  * Storage adapter interface for persisting panel state
429
714
  * Implementations can use localStorage, Electron IPC, or remote storage
@@ -478,10 +763,25 @@ export declare interface RepositoryWorkspaceState {
478
763
  */
479
764
  export declare function resetGlobalCommandRegistry(): void;
480
765
 
766
+ /**
767
+ * Tool: Reset Layout
768
+ *
769
+ * Reset panel sizes to the default layout.
770
+ */
771
+ export declare const resetLayoutTool: PanelTool;
772
+
481
773
  export { ResponsiveConfigurablePanelLayout }
482
774
 
483
775
  export { ResponsiveConfigurablePanelLayoutProps }
484
776
 
777
+ /**
778
+ * Tool: Switch Panel
779
+ *
780
+ * Change which content is displayed in a panel slot.
781
+ * The available panels depend on the application.
782
+ */
783
+ export declare const switchPanelTool: PanelTool;
784
+
485
785
  export { TabsConfig }
486
786
 
487
787
  export { Theme }
@@ -502,6 +802,92 @@ export declare interface ThreePanelPersistence {
502
802
 
503
803
  export { TilesConfig }
504
804
 
805
+ /**
806
+ * Tool: Toggle Panel
807
+ *
808
+ * Collapse or expand a side panel (left or right).
809
+ */
810
+ export declare const togglePanelTool: PanelTool;
811
+
812
+ /**
813
+ * Configuration for the tool-to-command bridge
814
+ */
815
+ export declare interface ToolCommandBridgeConfig {
816
+ /** Category prefix for tool commands (default: 'Panel Tools') */
817
+ categoryPrefix?: string;
818
+ /** Priority offset for tool commands (default: 50) */
819
+ basePriority?: number;
820
+ /** Whether to include panel ID in category (default: true) */
821
+ includePanelInCategory?: boolean;
822
+ }
823
+
824
+ /**
825
+ * Parameter information for UI rendering
826
+ */
827
+ export declare interface ToolParameterInfo {
828
+ name: string;
829
+ type: string;
830
+ description: string;
831
+ required: boolean;
832
+ default?: unknown;
833
+ enum?: string[];
834
+ }
835
+
836
+ /**
837
+ * Convert an array of PanelTools to AIFunctionDefinition format.
838
+ */
839
+ export declare function toolsToAIFunctions(tools: PanelTool[]): AIFunctionDefinition[];
840
+
841
+ /**
842
+ * Convert an array of PanelTools to Anthropic tools format.
843
+ */
844
+ export declare function toolsToAnthropicFormat(tools: PanelTool[]): AnthropicTool[];
845
+
846
+ /**
847
+ * Converts all tools from a registry into commands.
848
+ */
849
+ export declare function toolsToCommands(registry: PanelToolRegistry, config?: ToolCommandBridgeConfig): Command[];
850
+
851
+ /**
852
+ * Convert an array of PanelTools to Gemini tools format.
853
+ */
854
+ export declare function toolsToGeminiFormat(tools: PanelTool[]): GeminiTools;
855
+
856
+ /**
857
+ * Convert an array of PanelTools to OpenAI tools format.
858
+ */
859
+ export declare function toolsToOpenAIFormat(tools: PanelTool[]): OpenAITool[];
860
+
861
+ /**
862
+ * Convert a PanelTool to the generic AIFunctionDefinition format.
863
+ * This is the format used by PanelToolRegistry.getToolsAsAIFunctions()
864
+ */
865
+ export declare function toolToAIFunction(tool: PanelTool): AIFunctionDefinition;
866
+
867
+ /**
868
+ * Convert a PanelTool to Anthropic tool format.
869
+ */
870
+ export declare function toolToAnthropicFormat(tool: PanelTool): AnthropicTool;
871
+
872
+ /**
873
+ * Converts a registered tool into a command palette command.
874
+ *
875
+ * For tools with no required parameters, the command executes immediately.
876
+ * For tools with required parameters, this is a placeholder - full
877
+ * implementation would need a parameter input UI.
878
+ */
879
+ export declare function toolToCommand(tool: RegisteredTool, registry: PanelToolRegistry, config?: ToolCommandBridgeConfig): Command;
880
+
881
+ /**
882
+ * Convert a PanelTool to Gemini function declaration format.
883
+ */
884
+ export declare function toolToGeminiFunction(tool: PanelTool): GeminiFunctionDeclaration;
885
+
886
+ /**
887
+ * Convert a PanelTool to OpenAI function format.
888
+ */
889
+ export declare function toolToOpenAIFunction(tool: PanelTool): OpenAITool;
890
+
505
891
  /**
506
892
  * Return type for the usePanelPersistence hook (two-panel variant)
507
893
  */
@@ -735,6 +1121,12 @@ export declare interface UsePanelPersistenceOptions {
735
1121
  adapter?: PersistenceAdapter;
736
1122
  }
737
1123
 
1124
+ /**
1125
+ * Hook to use tool commands in React components.
1126
+ * Subscribes to registry changes and updates commands accordingly.
1127
+ */
1128
+ export declare function useToolCommands(registry: PanelToolRegistry, config?: ToolCommandBridgeConfig): Command[];
1129
+
738
1130
  export declare function useWorkspace(options?: UseWorkspaceOptions): UseWorkspaceReturn;
739
1131
 
740
1132
  export declare interface UseWorkspaceOptions {