@foxglove/extension 2.36.0 → 2.38.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 +56 -4
- package/src/stable.ts +9 -0
package/package.json
CHANGED
package/src/experimental.ts
CHANGED
|
@@ -72,6 +72,14 @@ export namespace Experimental {
|
|
|
72
72
|
initPanel: (context: PanelExtensionContext) => void | (() => void);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* See: {@link ExtensionContext.registerUserScriptUtility}
|
|
77
|
+
*/
|
|
78
|
+
export type RegisterUserScriptUtilityArgs = {
|
|
79
|
+
name: `${string}.ts`;
|
|
80
|
+
source: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
75
83
|
export interface ExtensionContext extends BaseExtensionContext {
|
|
76
84
|
/**
|
|
77
85
|
* Register a data loader to add support for additional file formats.
|
|
@@ -99,6 +107,44 @@ export namespace Experimental {
|
|
|
99
107
|
* optional cleanup function to run when the extension `panelElement` unmounts.
|
|
100
108
|
*/
|
|
101
109
|
registerPanel(params: ExtensionPanelRegistration): void;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Register a new user-script utility.
|
|
113
|
+
*
|
|
114
|
+
* This utility is available to all user-scripts and imported by its name.
|
|
115
|
+
*
|
|
116
|
+
* Example registration:
|
|
117
|
+
*
|
|
118
|
+
* ```
|
|
119
|
+
* registerUserScriptUtility({
|
|
120
|
+
* name: "my_add.ts",
|
|
121
|
+
* source: `
|
|
122
|
+
* export function add(a: number, b: number) {
|
|
123
|
+
* return a + b;
|
|
124
|
+
* }
|
|
125
|
+
* `);
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* You can also keep the source code in a file and import it like this:
|
|
129
|
+
*
|
|
130
|
+
* ```
|
|
131
|
+
* import my_add from "./my_add.ts?raw";
|
|
132
|
+
*
|
|
133
|
+
* registerUserScriptUtility({ name: "my_add.ts", source: my_add });
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* Example usage in a user-script:
|
|
137
|
+
*
|
|
138
|
+
* ```
|
|
139
|
+
* import { add } from "./my_add.ts";
|
|
140
|
+
*
|
|
141
|
+
* // ... call `add` in your script function or wherever needed
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @param name
|
|
145
|
+
* @param source
|
|
146
|
+
*/
|
|
147
|
+
registerUserScriptUtility(args: RegisterUserScriptUtilityArgs): void;
|
|
102
148
|
}
|
|
103
149
|
|
|
104
150
|
export interface ExtensionModule {
|
|
@@ -118,8 +164,11 @@ export namespace Experimental {
|
|
|
118
164
|
type: "button";
|
|
119
165
|
/** Unique identifier for the button. */
|
|
120
166
|
id: string;
|
|
121
|
-
/**
|
|
122
|
-
|
|
167
|
+
/**
|
|
168
|
+
* The icon to display in the button. It can be a predefined icon name from {@link PanelToolbarPredefinedIcon} or a SVGElement.
|
|
169
|
+
* If passing a SVGElement, it should be 16x16px and use the `currentColor` attribute for variants to work correctly.
|
|
170
|
+
* */
|
|
171
|
+
icon: SVGElement;
|
|
123
172
|
/** Tooltip text to display when hovering over the button. */
|
|
124
173
|
tooltip?: string;
|
|
125
174
|
/** Function to call when the button is clicked. */
|
|
@@ -136,8 +185,11 @@ export namespace Experimental {
|
|
|
136
185
|
type: "link";
|
|
137
186
|
/** Unique identifier for the link. */
|
|
138
187
|
id: string;
|
|
139
|
-
/**
|
|
140
|
-
|
|
188
|
+
/**
|
|
189
|
+
* The icon to display in the button. The SVGElement should be 16x16px and use the `currentColor`
|
|
190
|
+
* attribute for variants to work correctly.
|
|
191
|
+
* */
|
|
192
|
+
icon: SVGElement;
|
|
141
193
|
/** Tooltip text to display when hovering over the button. */
|
|
142
194
|
tooltip?: string;
|
|
143
195
|
/** 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
|
*/
|