@foxglove/extension 2.50.0 → 2.51.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.50.0",
3
+ "version": "2.51.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Foxglove Technologies",
@@ -3,6 +3,7 @@ import type { Immutable } from "./immutable";
3
3
  import type {
4
4
  ExtensionContext as BaseExtensionContext,
5
5
  PanelExtensionContext as BasePanelExtensionContext,
6
+ RenderState as BaseRenderState,
6
7
  } from "./stable";
7
8
 
8
9
  /**
@@ -16,6 +17,17 @@ import type {
16
17
  * @hidden
17
18
  */
18
19
  export namespace Experimental {
20
+ export type DataSourceId = string & { __brand: "DataSourceId" };
21
+
22
+ export type DataSourceInfo = {
23
+ /** ID of the data source (e.g. "A", "B", "C", ...) used to identify the data source. */
24
+ id: DataSourceId;
25
+ /** The name of the data source e.g. the name of the file or URL. */
26
+ name: string;
27
+ };
28
+
29
+ export type DataSourceMap = ReadonlyMap<DataSourceId, Immutable<DataSourceInfo>>;
30
+
19
31
  /**
20
32
  * This type represents the arguments you pass to {@link ExtensionContext.registerDataLoader}
21
33
  * when you want to register a data loader.
@@ -269,7 +281,31 @@ export namespace Experimental {
269
281
  */
270
282
  export type PanelToolbarItem = PanelToolbarButton | PanelToolbarLink | PanelToolbarDivider;
271
283
 
284
+ export type RenderState = BaseRenderState & {
285
+ /**
286
+ * Map of available individual data sources, keyed by their ID.
287
+ */
288
+ dataSources?: DataSourceMap;
289
+ };
290
+
272
291
  export interface PanelExtensionContext extends BasePanelExtensionContext {
292
+ /**
293
+ * Subscribe to updates on this field within the render state. Render will only be invoked when
294
+ * this field changes.
295
+ *
296
+ * Use `context.watch` to indicate which fields in {@link RenderState} (e.g. `currentFrame`,
297
+ * `currentTime`, `previewTime`, `parameters`, `topics`) should trigger panel re-renders when
298
+ * their contained values change.
299
+ *
300
+ * ```ts
301
+ * context.watch("topics");
302
+ * context.watch("currentFrame");
303
+ * context.watch("parameters");
304
+ * context.watch("currentTime");
305
+ * ```
306
+ */
307
+ watch(field: keyof RenderState): void;
308
+
273
309
  /**
274
310
  * Set the items in the panel toolbar.
275
311
  */