@nextcloud/files 4.0.0-beta.9 → 4.0.0-rc.1

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.
@@ -20,14 +20,17 @@ export interface ISidebarContext {
20
20
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components
21
21
  * @see https://vuejs.org/guide/extras/web-components#building-custom-elements-with-vue
22
22
  */
23
- export interface SidebarComponent extends HTMLElement, ISidebarContext {
23
+ export interface SidebarTabComponent extends ISidebarContext {
24
24
  /**
25
- * This method is called by the files app if the sidebar tab state changes.
26
- *
27
- * @param active - The new active state
25
+ * The active state of the sidebar tab.
26
+ * It will be set to true if this component is the currently active tab.
28
27
  */
29
- setActive(active: boolean): Promise<void>;
28
+ active: boolean;
30
29
  }
30
+ /**
31
+ * The instance type of a sidebar tab web component.
32
+ */
33
+ export type SidebarTabComponentInstance = SidebarTabComponent & HTMLElement;
31
34
  /**
32
35
  * Implementation of a custom sidebar tab within the files app.
33
36
  */
@@ -52,7 +55,10 @@ export interface ISidebarTab {
52
55
  order: number;
53
56
  /**
54
57
  * The tag name of the web component.
55
- * The web component must already be registered under that tag name with `CustomElementRegistry.define()`.
58
+ *
59
+ * The web component must be defined using this name with `CustomElementRegistry.define()`,
60
+ * either on initialization or within the `onInit` callback (preferred).
61
+ * When rendering the sidebar tab, the files app will wait for the component to be defined in the registry (`customElements.whenDefined()`).
56
62
  *
57
63
  * To avoid name clashes the name has to start with your appid (e.g. `your_app`).
58
64
  * So in addition with the web component naming rules a good name would be `your_app-files-sidebar-tab`.
@@ -61,9 +67,19 @@ export interface ISidebarTab {
61
67
  /**
62
68
  * Callback to check if the sidebar tab should be shown for the selected node.
63
69
  *
70
+ * If not provided, the tab will always be shown.
71
+ *
64
72
  * @param context - The current context of the files app
65
73
  */
66
- enabled: (context: ISidebarContext) => boolean;
74
+ enabled?: (context: ISidebarContext) => boolean;
75
+ /**
76
+ * Called when the sidebar tab is active and rendered the first time in the sidebar.
77
+ * This should be used to register the web componen (`CustomElementRegistry.define()`).
78
+ *
79
+ * The sidebar itself will anyways wait for the component to be defined in the registry (`customElements.whenDefined()`).
80
+ * But also will wait for the promise returned by this method to resolve before rendering the tab.
81
+ */
82
+ onInit?: () => Promise<void>;
67
83
  }
68
84
  /**
69
85
  * Register a new sidebar tab for the files app.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextcloud/files",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0-rc.1",
4
4
  "description": "Nextcloud files utils",
5
5
  "keywords": [
6
6
  "nextcloud",
@@ -62,17 +62,16 @@
62
62
  },
63
63
  "devDependencies": {
64
64
  "@codecov/vite-plugin": "^1.9.1",
65
- "@nextcloud/eslint-config": "^9.0.0-rc.5",
66
- "@nextcloud/event-bus": "^3.3.3",
65
+ "@nextcloud/eslint-config": "^9.0.0-rc.8",
67
66
  "@nextcloud/typings": "^1.10.0",
68
67
  "@nextcloud/vite-config": "^2.5.2",
69
- "@types/node": "^25.0.5",
70
- "@vitest/coverage-istanbul": "^4.0.16",
68
+ "@types/node": "^25.1.0",
69
+ "@vitest/coverage-istanbul": "^4.0.18",
71
70
  "css.escape": "^1.5.1",
72
71
  "fast-xml-parser": "^5.3.3",
73
72
  "jsdom": "^27.4.0",
74
73
  "tslib": "^2.8.1",
75
- "typedoc": "^0.28.15",
74
+ "typedoc": "^0.28.16",
76
75
  "typedoc-plugin-missing-exports": "^4.1.2",
77
76
  "typescript": "^5.9.3",
78
77
  "vite": "^7.3.1",