@foxglove/extension 2.44.0 → 2.46.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.44.0",
3
+ "version": "2.46.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Foxglove Technologies",
@@ -15,7 +15,7 @@
15
15
  "prepack": "tsc -b tsconfig.json"
16
16
  },
17
17
  "devDependencies": {
18
- "@foxglove/tsconfig": "3.1.0",
19
- "typescript": "5.9.2"
18
+ "@foxglove/tsconfig": "3.2.0",
19
+ "typescript": "5.9.3"
20
20
  }
21
- }
21
+ }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-namespace */
2
- import type { Immutable } from "./immutable";
2
+ import type { Immutable } from "./immutable.ts";
3
3
  import type {
4
4
  ExtensionContext as BaseExtensionContext,
5
5
  MessageEvent,
@@ -8,7 +8,7 @@ import type {
8
8
  SettingsTreeFields,
9
9
  SettingsTreeNode,
10
10
  Topic,
11
- } from "./stable";
11
+ } from "./stable.ts";
12
12
 
13
13
  /**
14
14
  * The experimental namespace contains experimental APIs that are not yet stable and WILL change or
@@ -210,11 +210,15 @@ export namespace Experimental {
210
210
  /**
211
211
  * This function will be called when your extension is loaded. In this function, you can register
212
212
  * your custom panels or other types of extension features.
213
+ *
214
+ * The function may return a Promise if async initialization is needed before registering
215
+ * extension features. The extension will not be considered fully activated until the Promise
216
+ * resolves.
213
217
  */
214
218
  activate: ExtensionActivate;
215
219
  }
216
220
 
217
- export type ExtensionActivate = (extensionContext: ExtensionContext) => void;
221
+ export type ExtensionActivate = (extensionContext: ExtensionContext) => void | Promise<void>;
218
222
 
219
223
  /**
220
224
  * A button in the panel toolbar.
@@ -291,7 +295,7 @@ export namespace Experimental {
291
295
  /** Queue of messages to be handled since last frame. Will be reassigned to new empty array each frame. */
292
296
  queue?: MessageEvent<T>[] | undefined;
293
297
  /** Optional callback to be called on `queue` to filter. Returns new queue. */
294
- filterQueue?: (queue: MessageEvent<T>[]) => MessageEvent<T>[];
298
+ filterQueue?: (queue: ReadonlyArray<MessageEvent<T>>) => ReadonlyArray<MessageEvent<T>>;
295
299
  };
296
300
 
297
301
  export type AnyPanelOverlaySubscription = Immutable<
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from "./stable";
2
- export type { Immutable } from "./immutable";
3
- export type { Experimental } from "./experimental";
2
+ export type { Immutable } from "./immutable.ts";
3
+ export type { Experimental } from "./experimental.ts";
package/src/stable.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Immutable } from "./immutable";
1
+ import type { Immutable } from "./immutable.ts";
2
2
 
3
3
  /** Valid types for parameter data (such as rosparams) */
4
4
  export type ParameterValue =
@@ -1214,7 +1214,7 @@ export interface ExtensionContext {
1214
1214
  * @inline
1215
1215
  * @hidden
1216
1216
  */
1217
- export type ExtensionActivate = (extensionContext: ExtensionContext) => void;
1217
+ export type ExtensionActivate = (extensionContext: ExtensionContext) => void | Promise<void>;
1218
1218
 
1219
1219
  /**
1220
1220
  * ExtensionModule describes the interface your extension module must export. This typically corresponds to your `index.ts` file.
@@ -1234,12 +1234,29 @@ export type ExtensionActivate = (extensionContext: ExtensionContext) => void;
1234
1234
  * export default { activate };
1235
1235
  * ```
1236
1236
  *
1237
+ * The `activate` function can also return a Promise to perform async initialization before
1238
+ * registering panels or converters:
1239
+ *
1240
+ * ```typescript
1241
+ * export async function activate(context: ExtensionContext) {
1242
+ * // Initialize WASM or other async resources
1243
+ * await initializeWasm();
1244
+ *
1245
+ * // Now register panels/converters that depend on the initialized resources
1246
+ * context.registerPanel({ ... });
1247
+ * }
1248
+ * ```
1249
+ *
1237
1250
  * @category Entry point
1238
1251
  */
1239
1252
  export interface ExtensionModule {
1240
1253
  /**
1241
1254
  * This function will be called when your extension is loaded. In this function, you can register
1242
1255
  * your custom panels or other types of extension features.
1256
+ *
1257
+ * The function may return a Promise if async initialization is needed before registering
1258
+ * extension features. The extension will not be considered fully activated until the Promise
1259
+ * resolves.
1243
1260
  */
1244
1261
  activate: ExtensionActivate;
1245
1262
  }
@@ -1578,6 +1595,13 @@ export type SettingsTreeNode = {
1578
1595
  */
1579
1596
  icon?: SettingsIcon;
1580
1597
 
1598
+ /**
1599
+ * Optional color for this node. When an icon is specified, the icon will be
1600
+ * rendered in this color. Otherwise, a small color swatch is displayed before
1601
+ * the label. Expects a valid CSS color string (e.g., "#ff0000", "rgb(255, 0, 0)", "red").
1602
+ */
1603
+ color?: string;
1604
+
1581
1605
  /**
1582
1606
  * An optional label shown at the top of this node.
1583
1607
  */