@foxglove/extension 2.31.2 → 2.32.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 +67 -2
package/package.json
CHANGED
package/src/experimental.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
-
|
|
3
|
-
import type {
|
|
2
|
+
import type { Immutable } from "./immutable";
|
|
3
|
+
import type {
|
|
4
|
+
ExtensionContext as BaseExtensionContext,
|
|
5
|
+
PanelExtensionContext as BasePanelExtensionContext,
|
|
6
|
+
} from "./stable";
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* The experimental namespace contains experimental APIs that are not yet stable and WILL change or
|
|
@@ -59,4 +62,66 @@ export namespace Experimental {
|
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
export type ExtensionActivate = (extensionContext: ExtensionContext) => void;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A button in the panel toolbar.
|
|
68
|
+
*/
|
|
69
|
+
export type PanelToolbarButton = {
|
|
70
|
+
type: "button";
|
|
71
|
+
/** Unique identifier for the button. */
|
|
72
|
+
id: string;
|
|
73
|
+
/** Svg string to display in the button. Icon should be 16x16px and use the `currentColor` attribute for variants to work correctly. */
|
|
74
|
+
icon: string;
|
|
75
|
+
/** Tooltip text to display when hovering over the button. */
|
|
76
|
+
tooltip?: string;
|
|
77
|
+
/** Function to call when the button is clicked. */
|
|
78
|
+
onClick?: (e: MouseEvent) => void;
|
|
79
|
+
/** Whether the button is disabled. */
|
|
80
|
+
disabled?: boolean;
|
|
81
|
+
/** Data test id to apply to the button, useful for testing. */
|
|
82
|
+
dataTestId?: string;
|
|
83
|
+
/** Variant of the button. */
|
|
84
|
+
variant?: "regular" | "solid";
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type PanelToolbarLink = {
|
|
88
|
+
type: "link";
|
|
89
|
+
/** Unique identifier for the link. */
|
|
90
|
+
id: string;
|
|
91
|
+
/** Svg string to display in the button. Icon should be 16x16px and use the `currentColor` attribute for variants to work correctly. */
|
|
92
|
+
icon: string;
|
|
93
|
+
/** Tooltip text to display when hovering over the button. */
|
|
94
|
+
tooltip?: string;
|
|
95
|
+
/** The URL to navigate to when the link is clicked. */
|
|
96
|
+
href: string;
|
|
97
|
+
/** Whether the link is disabled. */
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
/** Data test id to apply to the button, useful for testing. */
|
|
100
|
+
dataTestId?: string;
|
|
101
|
+
/** Variant of the button. */
|
|
102
|
+
variant?: "regular" | "solid";
|
|
103
|
+
/** Target of the link. Defaults to `_blank`. */
|
|
104
|
+
target?: "_blank" | "_self";
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A vertical divider in the panel toolbar used to separate items.
|
|
109
|
+
*/
|
|
110
|
+
export type PanelToolbarDivider = {
|
|
111
|
+
type: "divider";
|
|
112
|
+
/** Unique identifier for the divider. */
|
|
113
|
+
id: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Items that can be displayed in the panel toolbar.
|
|
118
|
+
*/
|
|
119
|
+
export type PanelToolbarItem = PanelToolbarButton | PanelToolbarLink | PanelToolbarDivider;
|
|
120
|
+
|
|
121
|
+
export interface PanelExtensionContext extends BasePanelExtensionContext {
|
|
122
|
+
/**
|
|
123
|
+
* Set the items in the panel toolbar.
|
|
124
|
+
*/
|
|
125
|
+
setPanelToolbarItems: (items: Immutable<PanelToolbarItem[]>) => void;
|
|
126
|
+
}
|
|
62
127
|
}
|