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