feat: Refactor utility and component exports, update dependencies, and add Knip for unused code detection.

This commit is contained in:
2025-12-04 11:58:04 +01:00
parent c3375b714d
commit 2ea74816fb
65 changed files with 624 additions and 707 deletions
-2
View File
@@ -41,5 +41,3 @@ export const useApi = (): ApiContextValue => {
}
return ctx;
};
export const getHttpClient = (): HttpClient => httpClient;
-2
View File
@@ -421,5 +421,3 @@ export const usePanelResizeBindings = (
isPanelResizing: resizingPanel === panel,
};
};
export default PanelManagerContext;
@@ -1,5 +1,5 @@
import React, { createContext, useContext } from 'react';
import type useWorkspaceSelection from './useWorkspaceSelection';
import type { useWorkspaceSelection } from './useWorkspaceSelection';
export type WorkspaceSelectionValue = ReturnType<typeof useWorkspaceSelection>;
@@ -23,5 +23,3 @@ export const useWorkspaceSelectionContext = () => {
}
return context;
};
export default WorkspaceSelectionContext;
+1 -3
View File
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef, useState } from 'react';
export interface DetailDocument {
interface DetailDocument {
id?: string;
[key: string]: unknown;
}
@@ -102,5 +102,3 @@ export const useDetailPanel = ({
setDetailPanelOpen,
};
};
export default useDetailPanel;
-2
View File
@@ -285,5 +285,3 @@ export const useDocumentSelection = ({
configureSelectionEnvironment,
};
};
export default useDocumentSelection;
-2
View File
@@ -231,5 +231,3 @@ export const useManagementModals = ({
activeModal,
};
};
export default useManagementModals;
@@ -115,5 +115,3 @@ export const useWorkspaceSelection = ({
inspectFolder,
};
};
export default useWorkspaceSelection;
+8 -8
View File
@@ -7,17 +7,17 @@ import { usePanelManager } from './PanelManagerContext';
import { FolderManagerProvider } from '../folders/FolderManagerContext';
import type { Identifier } from '../types/identifiers';
export type EnsureAssetUrl = (
type EnsureAssetUrl = (
docId: Identifier,
asset: unknown,
options?: Record<string, unknown>,
) => Promise<unknown> | void;
export type EnsurePreviewData = (docId: Identifier, options?: Record<string, unknown>) => Promise<unknown>;
export type GetDocumentAsset = (document: unknown, assetType: string) => unknown;
export type NotifyApiError = (error: unknown, fallbackMessage?: string) => void;
type EnsurePreviewData = (docId: Identifier, options?: Record<string, unknown>) => Promise<unknown>;
type GetDocumentAsset = (document: unknown, assetType: string) => unknown;
type NotifyApiError = (error: unknown, fallbackMessage?: string) => void;
export type DocumentsTableProps = ComponentProps<typeof DocumentsPanel> | null;
export type DetailPanelProps = (ComponentProps<typeof DocumentViewerPanel> & {
type DocumentsTableProps = ComponentProps<typeof DocumentsPanel> | null;
type DetailPanelProps = (ComponentProps<typeof DocumentViewerPanel> & {
onClose?: () => void;
onOpenPreview?: (args: { documentIds: Array<string> }) => void;
folderNodes?: Map<Identifier | 'root', unknown>;
@@ -27,7 +27,7 @@ export type DetailPanelProps = (ComponentProps<typeof DocumentViewerPanel> & {
) => Promise<void>;
}) | null;
export type WorkspaceSurface = { content: ReactNode; detail?: ReactNode | null; detailMode?: 'overlay' | 'inline' | null } | null;
type WorkspaceSurface = { content: ReactNode; detail?: ReactNode | null; detailMode?: 'overlay' | 'inline' | null } | null;
export interface UseWorkspaceSurfaceArgs {
sidebarHidden?: boolean;
@@ -44,7 +44,7 @@ export interface UseWorkspaceSurfaceArgs {
closeDocumentPreview?: () => void;
}
export interface UseWorkspaceSurfaceResult {
interface UseWorkspaceSurfaceResult {
surface: WorkspaceSurface;
}