From d3813798bfdf5d93e2ada8360c09094f014537f3 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 16 Jan 2026 00:24:31 +0100 Subject: [PATCH] chore: update `@nextcloud/files` to v4.0.0-rc.0 - update library - adjust sidebar tab handling Signed-off-by: Ferdinand Thiessen --- apps/comments/src/files-sidebar.ts | 37 ++++++---------- apps/comments/src/views/FilesSidebarTab.vue | 14 ++---- .../FilesSidebar/FilesSidebarTab.vue | 43 ++++++++++++------- apps/files/src/store/sidebar.ts | 4 +- ...{files_sharing_tab.js => files-sidebar.ts} | 40 +++++++---------- .../src/views/FilesSidebarTab.vue | 3 ++ apps/files_versions/src/sidebar_tab.ts | 26 ++++------- .../src/views/FilesVersionsSidebarTab.vue | 24 ++++------- build/frontend-legacy/package-lock.json | 8 ++-- build/frontend-legacy/package.json | 2 +- build/frontend-legacy/webpack.modules.cjs | 2 +- cypress/e2e/files/files-sidebar.cy.ts | 12 +++++- package-lock.json | 8 ++-- package.json | 2 +- 14 files changed, 104 insertions(+), 121 deletions(-) rename apps/files_sharing/src/{files_sharing_tab.js => files-sidebar.ts} (60%) diff --git a/apps/comments/src/files-sidebar.ts b/apps/comments/src/files-sidebar.ts index 1eb4ae7519f..47ff8dfc1cb 100644 --- a/apps/comments/src/files-sidebar.ts +++ b/apps/comments/src/files-sidebar.ts @@ -11,7 +11,6 @@ import { t } from '@nextcloud/l10n' import wrap from '@vue/web-component-wrapper' import { createPinia, PiniaVuePlugin } from 'pinia' import Vue from 'vue' -import FilesSidebarTab from './views/FilesSidebarTab.vue' import { registerCommentsPlugins } from './comments-activity-tab.ts' __webpack_nonce__ = getCSPNonce() @@ -30,28 +29,20 @@ if (loadState('comments', 'activityEnabled', false) && OCA?.Activity?.registerSi iconSvgInline: MessageReplyText, order: 50, tagName, - enabled() { - if (!window.customElements.get(tagName)) { - setupSidebarTab() - } - return true + async onInit() { + const { default: FilesSidebarTab } = await import('./views/FilesSidebarTab.vue') + + Vue.use(PiniaVuePlugin) + Vue.mixin({ pinia: createPinia() }) + const webComponent = wrap(Vue, FilesSidebarTab) + // In Vue 2, wrap doesn't support disabling shadow. Disable with a hack + Object.defineProperty(webComponent.prototype, 'attachShadow', { + value() { return this }, + }) + Object.defineProperty(webComponent.prototype, 'shadowRoot', { + get() { return this }, + }) + window.customElements.define(tagName, webComponent) }, }) } - -/** - * Setup the sidebar tab as a web component - */ -function setupSidebarTab() { - Vue.use(PiniaVuePlugin) - Vue.mixin({ pinia: createPinia() }) - const webComponent = wrap(Vue, FilesSidebarTab) - // In Vue 2, wrap doesn't support disabling shadow. Disable with a hack - Object.defineProperty(webComponent.prototype, 'attachShadow', { - value() { return this }, - }) - Object.defineProperty(webComponent.prototype, 'shadowRoot', { - get() { return this }, - }) - window.customElements.define(tagName, webComponent) -} diff --git a/apps/comments/src/views/FilesSidebarTab.vue b/apps/comments/src/views/FilesSidebarTab.vue index 6c9e06ca254..ce9be4bf28b 100644 --- a/apps/comments/src/views/FilesSidebarTab.vue +++ b/apps/comments/src/views/FilesSidebarTab.vue @@ -11,24 +11,16 @@ import Comments from './Comments.vue' const props = defineProps<{ node?: INode + + // eslint-disable-next-line vue/no-unused-properties -- Required on the web component interface + active?: boolean // eslint-disable-next-line vue/no-unused-properties -- Required on the web component interface folder?: IFolder // eslint-disable-next-line vue/no-unused-properties -- Required on the web component interface view?: IView }>() -defineExpose({ setActive }) - const resourceId = computed(() => props.node?.fileid) - -/** - * Set this tab as active - * - * @param active - The active state - */ -function setActive(active: boolean) { - return active -}