From 6ad8c97926f6750ca53284880115da2066bd5337 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 10 Feb 2026 14:30:41 +0100 Subject: [PATCH] refactor: group all UI integrations in folder structure Signed-off-by: Ferdinand Thiessen --- lib/globalScope.ts | 7 +++---- lib/index.ts | 11 +---------- lib/{ => ui}/actions/fileAction.ts | 4 ++-- lib/{ => ui}/actions/fileListAction.ts | 4 ++-- lib/{ => ui}/actions/index.ts | 0 lib/{ => ui}/filters/functions.ts | 2 +- lib/{ => ui}/filters/index.ts | 0 lib/{ => ui}/filters/listFilters.ts | 2 +- lib/{ => ui}/headers/index.ts | 0 lib/{ => ui}/headers/listHeaders.ts | 6 +++--- lib/ui/index.ts | 15 +++++++++++++++ lib/{ => ui}/navigation/column.ts | 4 ++-- lib/{ => ui}/navigation/index.ts | 0 lib/{ => ui}/navigation/navigation.ts | 2 +- lib/{ => ui}/navigation/view.ts | 4 ++-- lib/{ => ui}/newMenu/NewMenu.ts | 4 ++-- lib/{ => ui}/newMenu/functions.ts | 4 ++-- lib/{ => ui}/newMenu/index.ts | 0 lib/{ => ui}/registry.ts | 2 +- lib/{ => ui}/sidebar/Sidebar.ts | 2 +- lib/{ => ui}/sidebar/SidebarAction.ts | 4 ++-- lib/{ => ui}/sidebar/SidebarTab.ts | 6 +++--- lib/{ => ui}/sidebar/index.ts | 0 lib/{ => ui}/types.ts | 4 ++-- 24 files changed, 46 insertions(+), 41 deletions(-) rename lib/{ => ui}/actions/fileAction.ts (98%) rename lib/{ => ui}/actions/fileListAction.ts (96%) rename lib/{ => ui}/actions/index.ts (100%) rename lib/{ => ui}/filters/functions.ts (96%) rename lib/{ => ui}/filters/index.ts (100%) rename lib/{ => ui}/filters/listFilters.ts (98%) rename lib/{ => ui}/headers/index.ts (100%) rename lib/{ => ui}/headers/listHeaders.ts (93%) create mode 100644 lib/ui/index.ts rename lib/{ => ui}/navigation/column.ts (93%) rename lib/{ => ui}/navigation/index.ts (100%) rename lib/{ => ui}/navigation/navigation.ts (98%) rename lib/{ => ui}/navigation/view.ts (97%) rename lib/{ => ui}/newMenu/NewMenu.ts (97%) rename lib/{ => ui}/newMenu/functions.ts (93%) rename lib/{ => ui}/newMenu/index.ts (100%) rename lib/{ => ui}/registry.ts (97%) rename lib/{ => ui}/sidebar/Sidebar.ts (98%) rename lib/{ => ui}/sidebar/SidebarAction.ts (97%) rename lib/{ => ui}/sidebar/SidebarTab.ts (97%) rename lib/{ => ui}/sidebar/index.ts (100%) rename lib/{ => ui}/types.ts (88%) diff --git a/lib/globalScope.ts b/lib/globalScope.ts index 9e26f7e08..30cb40cbf 100644 --- a/lib/globalScope.ts +++ b/lib/globalScope.ts @@ -3,7 +3,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { IFileAction, IFileListAction } from './actions/index.ts' import type { DavProperty } from './dav/index.ts' import type { IFileListFilter, @@ -11,9 +10,9 @@ import type { Navigation, NewMenu, } from './index.ts' -import type { FilesRegistry } from './registry.ts' -import type { ISidebarTab } from './sidebar/index.ts' -import type { ISidebarAction } from './sidebar/SidebarAction.ts' +import type { IFileAction, IFileListAction } from './ui/actions/index.ts' +import type { FilesRegistry } from './ui/registry.ts' +import type { ISidebarAction, ISidebarTab } from './ui/sidebar/index.ts' interface InternalGlobalScope { davNamespaces?: DavProperty diff --git a/lib/index.ts b/lib/index.ts index 6af9852c7..3c93b5669 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -3,16 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -export type * from './types.ts' - -export * from './actions/index.ts' -export * from './filters/index.ts' -export * from './headers/index.ts' -export * from './navigation/index.ts' -export * from './newMenu/index.ts' export * from './node/index.ts' export * from './permissions.ts' -export * from './sidebar/index.ts' +export * from './ui/index.ts' export * from './utils/index.ts' - -export { getFilesRegistry } from './registry.ts' diff --git a/lib/actions/fileAction.ts b/lib/ui/actions/fileAction.ts similarity index 98% rename from lib/actions/fileAction.ts rename to lib/ui/actions/fileAction.ts index 8b9753322..7668dcf48 100644 --- a/lib/actions/fileAction.ts +++ b/lib/ui/actions/fileAction.ts @@ -5,9 +5,9 @@ import type { ActionContext, ActionContextSingle } from '../types.ts' -import { scopedGlobals } from '../globalScope.ts' +import { scopedGlobals } from '../../globalScope.ts' +import logger from '../../utils/logger.ts' import { getRegistry } from '../registry.ts' -import logger from '../utils/logger.ts' export const DefaultType = Object.freeze({ DEFAULT: 'default', diff --git a/lib/actions/fileListAction.ts b/lib/ui/actions/fileListAction.ts similarity index 96% rename from lib/actions/fileListAction.ts rename to lib/ui/actions/fileListAction.ts index 8cfff0a32..c8b617eea 100644 --- a/lib/actions/fileListAction.ts +++ b/lib/ui/actions/fileListAction.ts @@ -5,9 +5,9 @@ import type { ViewActionContext } from '../types.ts' -import { scopedGlobals } from '../globalScope.ts' +import { scopedGlobals } from '../../globalScope.ts' +import logger from '../../utils/logger.ts' import { getRegistry } from '../registry.ts' -import logger from '../utils/logger.ts' export interface IFileListAction { /** Unique ID */ diff --git a/lib/actions/index.ts b/lib/ui/actions/index.ts similarity index 100% rename from lib/actions/index.ts rename to lib/ui/actions/index.ts diff --git a/lib/filters/functions.ts b/lib/ui/filters/functions.ts similarity index 96% rename from lib/filters/functions.ts rename to lib/ui/filters/functions.ts index 853907482..d7302bbf6 100644 --- a/lib/filters/functions.ts +++ b/lib/ui/filters/functions.ts @@ -5,7 +5,7 @@ import type { IFileListFilter } from './listFilters.ts' -import { scopedGlobals } from '../globalScope.ts' +import { scopedGlobals } from '../../globalScope.ts' import { getRegistry } from '../registry.ts' /** diff --git a/lib/filters/index.ts b/lib/ui/filters/index.ts similarity index 100% rename from lib/filters/index.ts rename to lib/ui/filters/index.ts diff --git a/lib/filters/listFilters.ts b/lib/ui/filters/listFilters.ts similarity index 98% rename from lib/filters/listFilters.ts rename to lib/ui/filters/listFilters.ts index f76106e19..55bdbf769 100644 --- a/lib/filters/listFilters.ts +++ b/lib/ui/filters/listFilters.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { INode } from '../node/index.ts' +import type { INode } from '../../node/index.ts' import { TypedEventTarget } from 'typescript-event-target' diff --git a/lib/headers/index.ts b/lib/ui/headers/index.ts similarity index 100% rename from lib/headers/index.ts rename to lib/ui/headers/index.ts diff --git a/lib/headers/listHeaders.ts b/lib/ui/headers/listHeaders.ts similarity index 93% rename from lib/headers/listHeaders.ts rename to lib/ui/headers/listHeaders.ts index 7727ce12a..2c091b244 100644 --- a/lib/headers/listHeaders.ts +++ b/lib/ui/headers/listHeaders.ts @@ -3,12 +3,12 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import type { IFolder } from '../../node/folder.ts' import type { IView } from '../navigation/view.ts' -import type { IFolder } from '../node/folder.ts' -import { scopedGlobals } from '../globalScope.ts' +import { scopedGlobals } from '../../globalScope.ts' +import logger from '../../utils/logger.ts' import { getRegistry } from '../registry.ts' -import logger from '../utils/logger.ts' export interface IFileListHeader { /** Unique ID */ diff --git a/lib/ui/index.ts b/lib/ui/index.ts new file mode 100644 index 000000000..918b866f7 --- /dev/null +++ b/lib/ui/index.ts @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +export type * from './types.ts' + +export * from './actions/index.ts' +export * from './filters/index.ts' +export * from './headers/index.ts' +export * from './navigation/index.ts' +export * from './newMenu/index.ts' +export * from './sidebar/index.ts' + +export { getFilesRegistry } from './registry.ts' diff --git a/lib/navigation/column.ts b/lib/ui/navigation/column.ts similarity index 93% rename from lib/navigation/column.ts rename to lib/ui/navigation/column.ts index 64a0103c3..076e1d807 100644 --- a/lib/navigation/column.ts +++ b/lib/ui/navigation/column.ts @@ -3,10 +3,10 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { INode } from '../node/node.ts' +import type { INode } from '../../node/node.ts' import type { IView } from './view.ts' -import { checkOptionalProperty } from '../utils/objectValidation.ts' +import { checkOptionalProperty } from '../../utils/objectValidation.ts' export interface IColumn { /** Unique column ID */ diff --git a/lib/navigation/index.ts b/lib/ui/navigation/index.ts similarity index 100% rename from lib/navigation/index.ts rename to lib/ui/navigation/index.ts diff --git a/lib/navigation/navigation.ts b/lib/ui/navigation/navigation.ts similarity index 98% rename from lib/navigation/navigation.ts rename to lib/ui/navigation/navigation.ts index c6cf05117..90d1cddcb 100644 --- a/lib/navigation/navigation.ts +++ b/lib/ui/navigation/navigation.ts @@ -6,7 +6,7 @@ import type { IView } from './view.ts' import { TypedEventTarget } from 'typescript-event-target' -import { scopedGlobals } from '../globalScope.ts' +import { scopedGlobals } from '../../globalScope.ts' import { validateView } from './view.ts' /** diff --git a/lib/navigation/view.ts b/lib/ui/navigation/view.ts similarity index 97% rename from lib/navigation/view.ts rename to lib/ui/navigation/view.ts index 55939c1a5..727d3cdb5 100644 --- a/lib/navigation/view.ts +++ b/lib/ui/navigation/view.ts @@ -3,11 +3,11 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { IFolder, INode } from '../node/index.ts' +import type { IFolder, INode } from '../../node/index.ts' import type { IColumn } from './column.ts' import isSvg from 'is-svg' -import { checkOptionalProperty } from '../utils/objectValidation.ts' +import { checkOptionalProperty } from '../../utils/objectValidation.ts' import { validateColumn } from './column.ts' export type ContentsWithRoot = { diff --git a/lib/newMenu/NewMenu.ts b/lib/ui/newMenu/NewMenu.ts similarity index 97% rename from lib/newMenu/NewMenu.ts rename to lib/ui/newMenu/NewMenu.ts index dd0f13891..5f239e860 100644 --- a/lib/newMenu/NewMenu.ts +++ b/lib/ui/newMenu/NewMenu.ts @@ -3,9 +3,9 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { IFolder, INode } from '../node/index.ts' +import type { IFolder, INode } from '../../node/index.ts' -import logger from '../utils/logger.ts' +import logger from '../../utils/logger.ts' export const NewMenuEntryCategory = Object.freeze({ /** diff --git a/lib/newMenu/functions.ts b/lib/ui/newMenu/functions.ts similarity index 93% rename from lib/newMenu/functions.ts rename to lib/ui/newMenu/functions.ts index 1ab5a9936..39e9c4cf8 100644 --- a/lib/newMenu/functions.ts +++ b/lib/ui/newMenu/functions.ts @@ -3,10 +3,10 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { IFolder } from '../node/index.ts' +import type { IFolder } from '../../node/index.ts' import type { NewMenuEntry } from './NewMenu.ts' -import { scopedGlobals } from '../globalScope.ts' +import { scopedGlobals } from '../../globalScope.ts' import { NewMenu } from './NewMenu.ts' /** diff --git a/lib/newMenu/index.ts b/lib/ui/newMenu/index.ts similarity index 100% rename from lib/newMenu/index.ts rename to lib/ui/newMenu/index.ts diff --git a/lib/registry.ts b/lib/ui/registry.ts similarity index 97% rename from lib/registry.ts rename to lib/ui/registry.ts index 984aa8afb..924268a41 100644 --- a/lib/registry.ts +++ b/lib/ui/registry.ts @@ -8,7 +8,7 @@ import type { IFileListFilter } from './filters/index.ts' import type { IFileListHeader } from './headers/index.ts' import { TypedEventTarget } from 'typescript-event-target' -import { scopedGlobals } from './globalScope.ts' +import { scopedGlobals } from '../globalScope.ts' interface FilesRegistryEvents { 'register:action': RegistrationEvent diff --git a/lib/sidebar/Sidebar.ts b/lib/ui/sidebar/Sidebar.ts similarity index 98% rename from lib/sidebar/Sidebar.ts rename to lib/ui/sidebar/Sidebar.ts index e5714bde2..173e742d3 100644 --- a/lib/sidebar/Sidebar.ts +++ b/lib/ui/sidebar/Sidebar.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { INode } from '../node/node.ts' +import type { INode } from '../../node/node.ts' import type { ISidebarAction } from './SidebarAction.ts' import type { ISidebarContext, ISidebarTab } from './SidebarTab.ts' diff --git a/lib/sidebar/SidebarAction.ts b/lib/ui/sidebar/SidebarAction.ts similarity index 97% rename from lib/sidebar/SidebarAction.ts rename to lib/ui/sidebar/SidebarAction.ts index 65fe9860e..121dbb68c 100644 --- a/lib/sidebar/SidebarAction.ts +++ b/lib/ui/sidebar/SidebarAction.ts @@ -5,8 +5,8 @@ import type { ISidebarContext } from './SidebarTab.ts' -import { scopedGlobals } from '../globalScope.ts' -import logger from '../utils/logger.ts' +import { scopedGlobals } from '../../globalScope.ts' +import logger from '../../utils/logger.ts' /** * Implementation of a custom sidebar tab within the files app. diff --git a/lib/sidebar/SidebarTab.ts b/lib/ui/sidebar/SidebarTab.ts similarity index 97% rename from lib/sidebar/SidebarTab.ts rename to lib/ui/sidebar/SidebarTab.ts index f7f313c7c..b216a5541 100644 --- a/lib/sidebar/SidebarTab.ts +++ b/lib/ui/sidebar/SidebarTab.ts @@ -3,12 +3,12 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import type { IFolder, INode } from '../../node/index.ts' import type { IView } from '../navigation/view.ts' -import type { IFolder, INode } from '../node/index.ts' import isSvg from 'is-svg' -import { scopedGlobals } from '../globalScope.ts' -import logger from '../utils/logger.ts' +import { scopedGlobals } from '../../globalScope.ts' +import logger from '../../utils/logger.ts' export interface ISidebarContext { /** diff --git a/lib/sidebar/index.ts b/lib/ui/sidebar/index.ts similarity index 100% rename from lib/sidebar/index.ts rename to lib/ui/sidebar/index.ts diff --git a/lib/types.ts b/lib/ui/types.ts similarity index 88% rename from lib/types.ts rename to lib/ui/types.ts index 8315a8c77..cb8069ed2 100644 --- a/lib/types.ts +++ b/lib/ui/types.ts @@ -1,10 +1,10 @@ -/** +/*! * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ +import type { IFolder, INode } from '../node/index.ts' import type { IView } from './navigation/index.ts' -import type { IFolder, INode } from './node/index.ts' export type ActionContextSingle = { nodes: [INode]