R: Remove unused symbols

This commit is contained in:
Ivan 2025-03-13 23:20:52 +03:00
parent 5f524e2e6b
commit 8bf829513f
28 changed files with 67 additions and 168 deletions

View File

@ -22,7 +22,7 @@ interface INavigationContext {
setRequireConfirmation: (value: boolean) => void; setRequireConfirmation: (value: boolean) => void;
} }
export const NavigationContext = createContext<INavigationContext | null>(null); const NavigationContext = createContext<INavigationContext | null>(null);
export const useConceptNavigation = () => { export const useConceptNavigation = () => {
const context = use(NavigationContext); const context = use(NavigationContext);
if (!context) { if (!context) {

View File

@ -33,19 +33,19 @@ axiosInstance.interceptors.request.use(config => {
}); });
// ================ Data transfer types ================ // ================ Data transfer types ================
export interface IFrontRequest<RequestData, ResponseData> { interface IFrontRequest<RequestData, ResponseData> {
data?: RequestData; data?: RequestData;
successMessage?: string | ((data: ResponseData) => string); successMessage?: string | ((data: ResponseData) => string);
} }
export interface IAxiosRequest<RequestData, ResponseData> { interface IAxiosRequest<RequestData, ResponseData> {
endpoint: string; endpoint: string;
request?: IFrontRequest<RequestData, ResponseData>; request?: IFrontRequest<RequestData, ResponseData>;
options?: AxiosRequestConfig; options?: AxiosRequestConfig;
schema?: z.ZodType; schema?: z.ZodType;
} }
export interface IAxiosGetRequest { interface IAxiosGetRequest {
endpoint: string; endpoint: string;
options?: AxiosRequestConfig; options?: AxiosRequestConfig;
signal?: AbortSignal; signal?: AbortSignal;

View File

@ -21,7 +21,7 @@ import { TableFooter } from './table-footer';
import { TableHeader } from './table-header'; import { TableHeader } from './table-header';
import { useDataTable } from './use-data-table'; import { useDataTable } from './use-data-table';
export { type ColumnSort, createColumnHelper, type RowSelectionState, type VisibilityState }; export { createColumnHelper, type RowSelectionState, type VisibilityState };
/** Style to conditionally apply to rows. */ /** Style to conditionally apply to rows. */
export interface IConditionalStyle<TData> { export interface IConditionalStyle<TData> {

View File

@ -3,7 +3,6 @@
import { useCallback, useState } from 'react'; import { useCallback, useState } from 'react';
import { import {
type ColumnSort, type ColumnSort,
createColumnHelper,
getCoreRowModel, getCoreRowModel,
getPaginationRowModel, getPaginationRowModel,
getSortedRowModel, getSortedRowModel,
@ -17,8 +16,6 @@ import {
type VisibilityState type VisibilityState
} from '@tanstack/react-table'; } from '@tanstack/react-table';
export { type ColumnSort, createColumnHelper, type RowSelectionState, type VisibilityState };
/** Style to conditionally apply to rows. */ /** Style to conditionally apply to rows. */
export interface IConditionalStyle<TData> { export interface IConditionalStyle<TData> {
/** Callback to determine if the style should be applied. */ /** Callback to determine if the style should be applied. */
@ -28,7 +25,7 @@ export interface IConditionalStyle<TData> {
style: React.CSSProperties; style: React.CSSProperties;
} }
export interface UseDataTableProps<TData extends RowData> interface UseDataTableProps<TData extends RowData>
extends Pick<TableOptions<TData>, 'data' | 'columns' | 'onRowSelectionChange' | 'onColumnVisibilityChange'> { extends Pick<TableOptions<TData>, 'data' | 'columns' | 'onRowSelectionChange' | 'onColumnVisibilityChange'> {
/** Enable row selection. */ /** Enable row selection. */
enableRowSelection?: boolean; enableRowSelection?: boolean;

View File

@ -1,19 +0,0 @@
import clsx from 'clsx';
import { Checkbox, type CheckboxProps } from '../input';
/** Animated {@link Checkbox} inside a {@link Dropdown} item. */
export function DropdownCheckbox({ onChange: setValue, disabled, ...restProps }: CheckboxProps) {
return (
<div
className={clsx(
'px-3 py-1',
'text-left text-ellipsis whitespace-nowrap',
'disabled:clr-text-controls cc-animate-color',
!!setValue && !disabled && 'clr-hover'
)}
>
<Checkbox tabIndex={-1} disabled={disabled} onChange={setValue} {...restProps} />
</div>
);
}

View File

@ -1,4 +1,3 @@
export { Dropdown } from './dropdown'; export { Dropdown } from './dropdown';
export { DropdownButton } from './dropdown-button'; export { DropdownButton } from './dropdown-button';
export { DropdownCheckbox } from './dropdown-checkbox';
export { useDropdown } from './use-dropdown'; export { useDropdown } from './use-dropdown';

View File

@ -6,7 +6,7 @@ import { CheckboxChecked, CheckboxNull } from '../icons';
import { type CheckboxProps } from './checkbox'; import { type CheckboxProps } from './checkbox';
export interface CheckboxTristateProps extends Omit<CheckboxProps, 'value' | 'onChange'> { interface CheckboxTristateProps extends Omit<CheckboxProps, 'value' | 'onChange'> {
/** Current value - `null`, `true` or `false`. */ /** Current value - `null`, `true` or `false`. */
value: boolean | null; value: boolean | null;

View File

@ -5,7 +5,7 @@ export { FileInput } from './file-input';
export { Label } from './label'; export { Label } from './label';
export { SearchBar } from './search-bar'; export { SearchBar } from './search-bar';
export { SelectMulti, type SelectMultiProps } from './select-multi'; export { SelectMulti, type SelectMultiProps } from './select-multi';
export { SelectSingle, type SelectSingleProps } from './select-single'; export { SelectSingle } from './select-single';
export { SelectTree } from './select-tree'; export { SelectTree } from './select-tree';
export { TextArea } from './text-area'; export { TextArea } from './text-area';
export { TextInput } from './text-input'; export { TextInput } from './text-input';

View File

@ -38,7 +38,7 @@ function ClearIndicator<Option, Group extends GroupBase<Option> = GroupBase<Opti
); );
} }
export interface SelectSingleProps<Option, Group extends GroupBase<Option> = GroupBase<Option>> interface SelectSingleProps<Option, Group extends GroupBase<Option> = GroupBase<Option>>
extends Omit<Props<Option, false, Group>, 'theme' | 'menuPortalTarget'> { extends Omit<Props<Option, false, Group>, 'theme' | 'menuPortalTarget'> {
noPortal?: boolean; noPortal?: boolean;
noBorder?: boolean; noBorder?: boolean;

View File

@ -5,7 +5,7 @@ import { type Editor, type ErrorProcessing, type Titled } from '../props';
import { ErrorField } from './error-field'; import { ErrorField } from './error-field';
import { Label } from './label'; import { Label } from './label';
export interface TextAreaProps extends Editor, ErrorProcessing, Titled, React.ComponentProps<'textarea'> { interface TextAreaProps extends Editor, ErrorProcessing, Titled, React.ComponentProps<'textarea'> {
/** Indicates that the input should be transparent. */ /** Indicates that the input should be transparent. */
transparent?: boolean; transparent?: boolean;

View File

@ -5,5 +5,4 @@ export { PDFViewer } from './pdf-viewer';
export { PrettyJson } from './pretty-json'; export { PrettyJson } from './pretty-json';
export { TextContent } from './text-content'; export { TextContent } from './text-content';
export { ValueIcon } from './value-icon'; export { ValueIcon } from './value-icon';
export { ValueLabeled } from './value-labeled';
export { ValueStats } from './value-stats'; export { ValueStats } from './value-stats';

View File

@ -5,7 +5,7 @@ import { truncateToLastWord } from '@/utils/utils';
import { type Styling } from '../props'; import { type Styling } from '../props';
export interface TextContentProps extends Styling { interface TextContentProps extends Styling {
/** Text to display. */ /** Text to display. */
text: string; text: string;

View File

@ -1,29 +0,0 @@
import clsx from 'clsx';
import { type Styling } from '@/components/props';
interface ValueLabeledProps extends Styling {
/** Id of the component. */
id?: string;
/** Label to display. */
label: string;
/** Value to display. */
text: string | number;
/** Tooltip for the component. */
title?: string;
}
/**
* Displays a labeled value.
*/
export function ValueLabeled({ id, label, text, title, className, ...restProps }: ValueLabeledProps) {
return (
<div className={clsx('flex justify-between gap-6', className)} {...restProps}>
<span title={title}>{label}</span>
<span id={id}>{text}</span>
</div>
);
}

View File

@ -1,53 +1,55 @@
/** /**
* Represents manuals topic. * Represents manuals topic.
*/ */
export enum HelpTopic { export const HelpTopic = {
MAIN = 'main', MAIN: 'main',
THESAURUS = 'thesaurus', THESAURUS: 'thesaurus',
INTERFACE = 'user-interface', INTERFACE: 'user-interface',
UI_LIBRARY = 'ui-library', UI_LIBRARY: 'ui-library',
UI_RS_MENU = 'ui-rsform-menu', UI_RS_MENU: 'ui-rsform-menu',
UI_RS_CARD = 'ui-rsform-card', UI_RS_CARD: 'ui-rsform-card',
UI_RS_LIST = 'ui-rsform-list', UI_RS_LIST: 'ui-rsform-list',
UI_RS_EDITOR = 'ui-rsform-editor', UI_RS_EDITOR: 'ui-rsform-editor',
UI_GRAPH_TERM = 'ui-graph-term', UI_GRAPH_TERM: 'ui-graph-term',
UI_FORMULA_TREE = 'ui-formula-tree', UI_FORMULA_TREE: 'ui-formula-tree',
UI_TYPE_GRAPH = 'ui-type-graph', UI_TYPE_GRAPH: 'ui-type-graph',
UI_CST_STATUS = 'ui-rsform-cst-status', UI_CST_STATUS: 'ui-rsform-cst-status',
UI_CST_CLASS = 'ui-rsform-cst-class', UI_CST_CLASS: 'ui-rsform-cst-class',
UI_OSS_GRAPH = 'ui-oss-graph', UI_OSS_GRAPH: 'ui-oss-graph',
UI_SUBSTITUTIONS = 'ui-substitutions', UI_SUBSTITUTIONS: 'ui-substitutions',
UI_RELOCATE_CST = 'ui-relocate-cst', UI_RELOCATE_CST: 'ui-relocate-cst',
CONCEPTUAL = 'concept', CONCEPTUAL: 'concept',
CC_SYSTEM = 'concept-rsform', CC_SYSTEM: 'concept-rsform',
CC_CONSTITUENTA = 'concept-constituenta', CC_CONSTITUENTA: 'concept-constituenta',
CC_RELATIONS = 'concept-relations', CC_RELATIONS: 'concept-relations',
CC_SYNTHESIS = 'concept-synthesis', CC_SYNTHESIS: 'concept-synthesis',
CC_OSS = 'concept-operations-schema', CC_OSS: 'concept-operations-schema',
CC_PROPAGATION = 'concept-change-propagation', CC_PROPAGATION: 'concept-change-propagation',
RSLANG = 'rslang', RSLANG: 'rslang',
RSL_TYPES = 'rslang-types', RSL_TYPES: 'rslang-types',
RSL_CORRECT = 'rslang-correctness', RSL_CORRECT: 'rslang-correctness',
RSL_INTERPRET = 'rslang-interpretation', RSL_INTERPRET: 'rslang-interpretation',
RSL_OPERATIONS = 'rslang-operations', RSL_OPERATIONS: 'rslang-operations',
RSL_TEMPLATES = 'rslang-templates', RSL_TEMPLATES: 'rslang-templates',
TERM_CONTROL = 'terminology-control', TERM_CONTROL: 'terminology-control',
ACCESS = 'access', ACCESS: 'access',
VERSIONS = 'versions', VERSIONS: 'versions',
INFO = 'documentation', INFO: 'documentation',
INFO_RULES = 'rules', INFO_RULES: 'rules',
INFO_CONTRIB = 'contributors', INFO_CONTRIB: 'contributors',
INFO_PRIVACY = 'privacy', INFO_PRIVACY: 'privacy',
INFO_API = 'api', INFO_API: 'api',
EXTEOR = 'exteor' EXTEOR: 'exteor'
} } as const;
export type HelpTopic = (typeof HelpTopic)[keyof typeof HelpTopic];
/** /**
* Manual topics hierarchy. * Manual topics hierarchy.
@ -99,8 +101,3 @@ export const topicParent = new Map<HelpTopic, HelpTopic>([
[HelpTopic.EXTEOR, HelpTopic.EXTEOR] [HelpTopic.EXTEOR, HelpTopic.EXTEOR]
]); ]);
/**
* Topics that can be folded.
*/
export const foldableTopics = [HelpTopic.INTERFACE, HelpTopic.RSLANG, HelpTopic.CONCEPTUAL, HelpTopic.INFO];

View File

@ -40,13 +40,6 @@ export function labelFolderNode(node: FolderNode): string {
} }
} }
/**
* Retrieves description for {@link FolderNode}.
*/
export function describeFolderNode(node: FolderNode): string {
return `${node.filesInside} | ${node.filesTotal}`;
}
/** /**
* Retrieves label for {@link AccessPolicy}. * Retrieves label for {@link AccessPolicy}.
*/ */

View File

@ -33,7 +33,7 @@ export interface DlgCreateOperationProps {
onCreate?: (newID: number) => void; onCreate?: (newID: number) => void;
} }
export enum TabID { enum TabID {
INPUT = 0, INPUT = 0,
SYNTHESIS = 1 SYNTHESIS = 1
} }

View File

@ -30,7 +30,7 @@ export interface DlgEditOperationProps {
positions: IOperationPosition[]; positions: IOperationPosition[];
} }
export enum TabID { enum TabID {
CARD = 0, CARD = 0,
ARGUMENTS = 1, ARGUMENTS = 1,
SUBSTITUTION = 2 SUBSTITUTION = 2

View File

@ -12,7 +12,7 @@ import { useRoleStore, UserRole } from '@/features/users';
import { usePreferencesStore } from '@/stores/preferences'; import { usePreferencesStore } from '@/stores/preferences';
import { promptText } from '@/utils/labels'; import { promptText } from '@/utils/labels';
import { type IOperationPosition, OperationType } from '../../backend/types'; import { OperationType } from '../../backend/types';
import { useOssSuspense } from '../../backend/use-oss'; import { useOssSuspense } from '../../backend/use-oss';
import { type IOperation, type IOperationSchema } from '../../models/oss'; import { type IOperation, type IOperationSchema } from '../../models/oss';
@ -21,14 +21,6 @@ export enum OssTabID {
GRAPH = 1 GRAPH = 1
} }
export interface ICreateOperationPrompt {
defaultX: number;
defaultY: number;
inputs: number[];
positions: IOperationPosition[];
callback: (newID: number) => void;
}
export interface IOssEditContext { export interface IOssEditContext {
schema: IOperationSchema; schema: IOperationSchema;
selected: number[]; selected: number[];
@ -44,7 +36,7 @@ export interface IOssEditContext {
setSelected: React.Dispatch<React.SetStateAction<number[]>>; setSelected: React.Dispatch<React.SetStateAction<number[]>>;
} }
export const OssEditContext = createContext<IOssEditContext | null>(null); const OssEditContext = createContext<IOssEditContext | null>(null);
export const useOssEdit = () => { export const useOssEdit = () => {
const context = use(OssEditContext); const context = use(OssEditContext);
if (context === null) { if (context === null) {

View File

@ -233,22 +233,6 @@ export function colorBgSchemas(schema_index: number): string {
return APP_COLORS.bgBlue; return APP_COLORS.bgBlue;
} }
/**
* Determines background color for {@link GramData}.
*/
export function colorBgGrammeme(gram: GramData): string {
if (PartOfSpeech.includes(gram as Grammeme)) {
return APP_COLORS.bgBlue;
}
if (NounGrams.includes(gram as Grammeme)) {
return APP_COLORS.bgGreen;
}
if (VerbGrams.includes(gram as Grammeme)) {
return APP_COLORS.bgTeal;
}
return APP_COLORS.bgInput;
}
/** /**
* Determines foreground color for {@link GramData}. * Determines foreground color for {@link GramData}.
*/ */

View File

@ -27,7 +27,7 @@ export interface DlgCstTemplateProps {
insertAfter?: number; insertAfter?: number;
} }
export enum TabID { enum TabID {
TEMPLATE = 0, TEMPLATE = 0,
ARGUMENTS = 1, ARGUMENTS = 1,
CONSTITUENTA = 2 CONSTITUENTA = 2

View File

@ -25,7 +25,7 @@ export interface ITemplateContext {
onChangeFilterCategory: (newFilterCategory: IConstituenta | null) => void; onChangeFilterCategory: (newFilterCategory: IConstituenta | null) => void;
} }
export const TemplateContext = createContext<ITemplateContext | null>(null); const TemplateContext = createContext<ITemplateContext | null>(null);
export const useTemplateContext = () => { export const useTemplateContext = () => {
const context = use(TemplateContext); const context = use(TemplateContext);
if (context === null) { if (context === null) {

View File

@ -56,7 +56,7 @@ export interface DlgEditReferenceProps {
onCancel: () => void; onCancel: () => void;
} }
export enum TabID { enum TabID {
ENTITY = 0, ENTITY = 0,
SYNTACTIC = 1 SYNTACTIC = 1
} }

View File

@ -22,7 +22,7 @@ export interface DlgInlineSynthesisProps {
onSynthesis: () => void; onSynthesis: () => void;
} }
export enum TabID { enum TabID {
SCHEMA = 0, SCHEMA = 0,
SELECTIONS = 1, SELECTIONS = 1,
SUBSTITUTIONS = 2 SUBSTITUTIONS = 2

View File

@ -260,14 +260,6 @@ export interface ISyntacticReference {
nominal: string; nominal: string;
} }
/**
* Represents text 0-indexed position inside another text.
*/
export interface ITextPosition {
start: number;
finish: number;
}
export const schemaReference = z.strictObject({ export const schemaReference = z.strictObject({
type: z.nativeEnum(ReferenceType), type: z.nativeEnum(ReferenceType),
data: z.union([ data: z.union([

View File

@ -32,8 +32,8 @@ import { ToolbarTermGraph } from './toolbar-term-graph';
import { useFilteredGraph } from './use-filtered-graph'; import { useFilteredGraph } from './use-filtered-graph';
import { ViewHidden } from './view-hidden'; import { ViewHidden } from './view-hidden';
export const ZOOM_MAX = 3; const ZOOM_MAX = 3;
export const ZOOM_MIN = 0.25; const ZOOM_MIN = 0.25;
export const VIEW_PADDING = 0.3; export const VIEW_PADDING = 0.3;
export function TGFlow() { export function TGFlow() {

View File

@ -66,7 +66,7 @@ export interface IRSEditContext {
promptTemplate: () => void; promptTemplate: () => void;
} }
export const RSEditContext = createContext<IRSEditContext | null>(null); const RSEditContext = createContext<IRSEditContext | null>(null);
export const useRSEdit = () => { export const useRSEdit = () => {
const context = use(RSEditContext); const context = use(RSEditContext);
if (context === null) { if (context === null) {

View File

@ -3,13 +3,7 @@ import { z } from 'zod';
import { patterns } from '@/utils/constants'; import { patterns } from '@/utils/constants';
import { errorMsg } from '@/utils/labels'; import { errorMsg } from '@/utils/labels';
/** /** Represents user profile for viewing and editing. */
* Represents user detailed information.
* Some information should only be accessible to authorized users
*/
export type IUser = z.infer<typeof schemaUser>;
/** Represents user profile for viewing and editing {@link IUser}. */
export type IUserProfile = z.infer<typeof schemaUserProfile>; export type IUserProfile = z.infer<typeof schemaUserProfile>;
/** Represents user reference information. */ /** Represents user reference information. */

View File

@ -52,7 +52,7 @@ export enum DialogType {
UPLOAD_RSFORM UPLOAD_RSFORM
} }
export interface GenericDialogProps { interface DialogProps {
onHide?: () => void; onHide?: () => void;
} }
@ -91,7 +91,7 @@ export const useDialogsStore = create<DialogsStore>()(set => ({
props: null, props: null,
hideDialog: () => { hideDialog: () => {
set(state => { set(state => {
(state.props as GenericDialogProps | null)?.onHide?.(); (state.props as DialogProps | null)?.onHide?.();
return { active: null, props: null }; return { active: null, props: null };
}); });
}, },