@foxglove/extension 2.35.0 → 2.37.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.35.0",
3
+ "version": "2.37.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 {
@@ -82,12 +118,15 @@ export namespace Experimental {
82
118
  type: "button";
83
119
  /** Unique identifier for the button. */
84
120
  id: string;
85
- /** Svg string to display in the button. Icon should be 16x16px and use the `currentColor` attribute for variants to work correctly. */
86
- icon: string;
121
+ /**
122
+ * The icon to display in the button. It can be a predefined icon name from {@link PanelToolbarPredefinedIcon} or a SVGElement.
123
+ * If passing a SVGElement, it should be 16x16px and use the `currentColor` attribute for variants to work correctly.
124
+ * */
125
+ icon: SVGElement;
87
126
  /** Tooltip text to display when hovering over the button. */
88
127
  tooltip?: string;
89
128
  /** Function to call when the button is clicked. */
90
- onClick?: (e: MouseEvent) => void;
129
+ onClick?: (event: MouseEvent) => void;
91
130
  /** Whether the button is disabled. */
92
131
  disabled?: boolean;
93
132
  /** Data test id to apply to the button, useful for testing. */
@@ -100,8 +139,11 @@ export namespace Experimental {
100
139
  type: "link";
101
140
  /** Unique identifier for the link. */
102
141
  id: string;
103
- /** Svg string to display in the button. Icon should be 16x16px and use the `currentColor` attribute for variants to work correctly. */
104
- icon: string;
142
+ /**
143
+ * The icon to display in the button. The SVGElement should be 16x16px and use the `currentColor`
144
+ * attribute for variants to work correctly.
145
+ * */
146
+ icon: SVGElement;
105
147
  /** Tooltip text to display when hovering over the button. */
106
148
  tooltip?: string;
107
149
  /** The URL to navigate to when the link is clicked. */
package/src/stable.ts CHANGED
@@ -1354,6 +1354,15 @@ export type SettingsTreeFieldValue =
1354
1354
  input: "string";
1355
1355
  value?: string;
1356
1356
 
1357
+ /**
1358
+ * Optional placeholder text displayed in the field input when value is undefined
1359
+ */
1360
+ placeholder?: string;
1361
+ }
1362
+ | {
1363
+ input: "multiline-string";
1364
+ value?: string;
1365
+
1357
1366
  /**
1358
1367
  * Optional placeholder text displayed in the field input when value is undefined
1359
1368
  */