File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,15 +32,19 @@ export interface ISidebarContext {
3232 * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components
3333 * @see https://vuejs.org/guide/extras/web-components#building-custom-elements-with-vue
3434 */
35- export interface SidebarComponent extends HTMLElement , ISidebarContext {
35+ export interface SidebarTabComponent extends ISidebarContext {
3636 /**
37- * This method is called by the files app if the sidebar tab state changes.
38- *
39- * @param active - The new active state
37+ * The active state of the sidebar tab.
38+ * It will be set to true if this component is the currently active tab.
4039 */
41- setActive ( active : boolean ) : Promise < void >
40+ active : boolean
4241}
4342
43+ /**
44+ * The instance type of a sidebar tab web component.
45+ */
46+ export type SidebarTabComponentInstance = SidebarTabComponent & HTMLElement
47+
4448/**
4549 * Implementation of a custom sidebar tab within the files app.
4650 */
@@ -82,6 +86,15 @@ export interface ISidebarTab {
8286 * @param context - The current context of the files app
8387 */
8488 enabled : ( context : ISidebarContext ) => boolean
89+
90+ /**
91+ * Called when the sidebar tab is rendered the first time in the sidebar.
92+ * This should be used to register the web componen (`CustomElementRegistry.define()`).
93+ *
94+ * The sidebar itself will anyways wait for the component to be defined in the registry (`customElements.whenDefined()`).
95+ * But also will wait for the promise returned by this method to resolve before rendering the tab.
96+ */
97+ onInit ?: ( ) => Promise < void >
8598}
8699
87100/**
You can’t perform that action at this time.
0 commit comments