@foxglove/extension 2.34.0 → 2.36.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxglove/extension",
3
- "version": "2.34.0",
3
+ "version": "2.36.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Foxglove Technologies",
@@ -34,6 +34,8 @@ export namespace Experimental {
34
34
  wasmUrl: string;
35
35
  /** The file extension that this data loader should be associated with. */
36
36
  supportedFileType: `.${string}`;
37
+ /** Whether the data loader supports being passed multiple files */
38
+ supportsMultiFile?: boolean;
37
39
  };
38
40
 
39
41
  /**
@@ -46,6 +48,30 @@ export namespace Experimental {
46
48
  */
47
49
  export type RegisterDataLoaderArgs = RegisterLocalFileDataLoaderArgs;
48
50
 
51
+ /**
52
+ * This type represents the arguments you pass to {@link ExtensionContext.registerPanel}.
53
+ *
54
+ * @category Custom panels
55
+ */
56
+ export type ExtensionPanelRegistration = {
57
+ /**
58
+ * Unique name of the panel within your extension
59
+ *
60
+ * NOTE: Panel names within your extension must be unique. The panel name identifies this panel
61
+ * within a layout. Changing the panel name will cause layouts using the old name unable to load
62
+ * your panel.
63
+ */
64
+ name: string;
65
+
66
+ /**
67
+ * This function is invoked when your panel is initialized
68
+ *
69
+ * @returns (optional) A function which will be called when the panel is removed or replaced.
70
+ * Perform any cleanup logic here to gracefully tear down your panel.
71
+ */
72
+ initPanel: (context: PanelExtensionContext) => void | (() => void);
73
+ };
74
+
49
75
  export interface ExtensionContext extends BaseExtensionContext {
50
76
  /**
51
77
  * Register a data loader to add support for additional file formats.
@@ -63,6 +89,16 @@ export namespace Experimental {
63
89
  * See: {@link PanelOverlayExtensionArgs}
64
90
  */
65
91
  registerPanelOverlay(args: PanelOverlayExtensionArgs): void;
92
+
93
+ /**
94
+ * `registerPanel` adds a new panel to the Foxglove interface. To register a panel you provide a
95
+ * `name` and an `initPanel` function.
96
+ *
97
+ * The `initPanel` function accepts a {@link PanelExtensionContext} argument, which contains
98
+ * properties and methods for accessing panel data and rendering UI updates. It also returns an
99
+ * optional cleanup function to run when the extension `panelElement` unmounts.
100
+ */
101
+ registerPanel(params: ExtensionPanelRegistration): void;
66
102
  }
67
103
 
68
104
  export interface ExtensionModule {
@@ -87,7 +123,7 @@ export namespace Experimental {
87
123
  /** Tooltip text to display when hovering over the button. */
88
124
  tooltip?: string;
89
125
  /** Function to call when the button is clicked. */
90
- onClick?: (e: MouseEvent) => void;
126
+ onClick?: (event: MouseEvent) => void;
91
127
  /** Whether the button is disabled. */
92
128
  disabled?: boolean;
93
129
  /** Data test id to apply to the button, useful for testing. */