R: Remove redundant types and styles

This commit is contained in:
Ivan 2025-02-22 14:04:01 +03:00
parent d5a23e9362
commit 00a64e90f1
66 changed files with 130 additions and 191 deletions

View File

@ -1,7 +1,6 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { IconLibrary2, IconManuals, IconNewItem2 } from '@/components/Icons'; import { IconLibrary2, IconManuals, IconNewItem2 } from '@/components/Icons';
import { type EventMouse } from '@/components/props';
import { useWindowSize } from '@/hooks/useWindowSize'; import { useWindowSize } from '@/hooks/useWindowSize';
import { useAppLayoutStore } from '@/stores/appLayout'; import { useAppLayoutStore } from '@/stores/appLayout';
import { PARAMETER } from '@/utils/constants'; import { PARAMETER } from '@/utils/constants';
@ -19,10 +18,12 @@ export function Navigation() {
const size = useWindowSize(); const size = useWindowSize();
const noNavigationAnimation = useAppLayoutStore(state => state.noNavigationAnimation); const noNavigationAnimation = useAppLayoutStore(state => state.noNavigationAnimation);
const navigateHome = (event: EventMouse) => router.push(urls.home, event.ctrlKey || event.metaKey); const navigateHome = (event: React.MouseEvent<Element>) => router.push(urls.home, event.ctrlKey || event.metaKey);
const navigateLibrary = (event: EventMouse) => router.push(urls.library, event.ctrlKey || event.metaKey); const navigateLibrary = (event: React.MouseEvent<Element>) =>
const navigateHelp = (event: EventMouse) => router.push(urls.manuals, event.ctrlKey || event.metaKey); router.push(urls.library, event.ctrlKey || event.metaKey);
const navigateCreateNew = (event: EventMouse) => router.push(urls.create_schema, event.ctrlKey || event.metaKey); const navigateHelp = (event: React.MouseEvent<Element>) => router.push(urls.manuals, event.ctrlKey || event.metaKey);
const navigateCreateNew = (event: React.MouseEvent<Element>) =>
router.push(urls.create_schema, event.ctrlKey || event.metaKey);
return ( return (
<nav <nav

View File

@ -1,12 +1,12 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { type EventMouse, type Styling, type Titled } from '@/components/props'; import { type Styling, type Titled } from '@/components/props';
import { globalIDs } from '@/utils/constants'; import { globalIDs } from '@/utils/constants';
interface NavigationButtonProps extends Titled, Styling { interface NavigationButtonProps extends Titled, Styling {
text?: string; text?: string;
icon: React.ReactNode; icon: React.ReactNode;
onClick?: (event: EventMouse) => void; onClick?: (event: React.MouseEvent<Element>) => void;
} }
export function NavigationButton({ export function NavigationButton({

View File

@ -15,7 +15,6 @@ import {
IconRESTapi, IconRESTapi,
IconUser IconUser
} from '@/components/Icons'; } from '@/components/Icons';
import { type EventMouse } from '@/components/props';
import { usePreferencesStore } from '@/stores/preferences'; import { usePreferencesStore } from '@/stores/preferences';
import { urls } from '../urls'; import { urls } from '../urls';
@ -39,7 +38,7 @@ export function UserDropdown({ isOpen, hideDropdown }: UserDropdownProps) {
const adminMode = usePreferencesStore(state => state.adminMode); const adminMode = usePreferencesStore(state => state.adminMode);
const toggleAdminMode = usePreferencesStore(state => state.toggleAdminMode); const toggleAdminMode = usePreferencesStore(state => state.toggleAdminMode);
function navigateProfile(event: EventMouse) { function navigateProfile(event: React.MouseEvent<Element>) {
hideDropdown(); hideDropdown();
router.push(urls.profile, event.ctrlKey || event.metaKey); router.push(urls.profile, event.ctrlKey || event.metaKey);
} }
@ -54,7 +53,7 @@ export function UserDropdown({ isOpen, hideDropdown }: UserDropdownProps) {
void logout().then(() => router.push(urls.admin, true)); void logout().then(() => router.push(urls.admin, true));
} }
function gotoIcons(event: EventMouse) { function gotoIcons(event: React.MouseEvent<Element>) {
hideDropdown(); hideDropdown();
router.push(urls.icons, event.ctrlKey || event.metaKey); router.push(urls.icons, event.ctrlKey || event.metaKey);
} }
@ -64,7 +63,7 @@ export function UserDropdown({ isOpen, hideDropdown }: UserDropdownProps) {
router.push(urls.rest_api, true); router.push(urls.rest_api, true);
} }
function gotoDatabaseSchema(event: EventMouse) { function gotoDatabaseSchema(event: React.MouseEvent<Element>) {
hideDropdown(); hideDropdown();
router.push(urls.database_schema, event.ctrlKey || event.metaKey); router.push(urls.database_schema, event.ctrlKey || event.metaKey);
} }

View File

@ -2,8 +2,8 @@
* Module: generic API for backend REST communications using axios library. * Module: generic API for backend REST communications using axios library.
*/ */
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import axios, { AxiosError, type AxiosRequestConfig } from 'axios'; import axios, { type AxiosError, type AxiosRequestConfig } from 'axios';
import { z, ZodError } from 'zod'; import { type z, ZodError } from 'zod';
import { buildConstants } from '@/utils/buildConstants'; import { buildConstants } from '@/utils/buildConstants';
import { errorMsg } from '@/utils/labels'; import { errorMsg } from '@/utils/labels';

View File

@ -1,7 +1,7 @@
import { QueryClient } from '@tanstack/react-query'; import { QueryClient } from '@tanstack/react-query';
import { ZodError } from 'zod'; import { type ZodError } from 'zod';
import { AxiosError } from './apiTransport'; import { type AxiosError } from './apiTransport';
import { DELAYS } from './configuration'; import { DELAYS } from './configuration';
declare module '@tanstack/react-query' { declare module '@tanstack/react-query' {

View File

@ -1,12 +1,10 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { type Div } from '../props';
/** /**
* `flex` column container. * `flex` column container.
* This component is useful for creating vertical layouts with flexbox. * This component is useful for creating vertical layouts with flexbox.
*/ */
export function FlexColumn({ className, children, ...restProps }: Div) { export function FlexColumn({ className, children, ...restProps }: React.ComponentProps<'div'>) {
return ( return (
<div className={clsx('cc-column', className)} {...restProps}> <div className={clsx('cc-column', className)} {...restProps}>
{children} {children}

View File

@ -2,9 +2,9 @@ import clsx from 'clsx';
import { globalIDs } from '@/utils/constants'; import { globalIDs } from '@/utils/constants';
import { type Button as ButtonStyle, type Colors, type Control } from '../props'; import { type Button as ButtonStyle, type Control } from '../props';
interface ButtonProps extends Control, Colors, ButtonStyle { interface ButtonProps extends Control, ButtonStyle {
/** Icon to display first. */ /** Icon to display first. */
icon?: React.ReactNode; icon?: React.ReactNode;
@ -32,7 +32,6 @@ export function Button({
disabled, disabled,
noBorder, noBorder,
noOutline, noOutline,
colors = 'clr-btn-default',
className, className,
...restProps ...restProps
}: ButtonProps) { }: ButtonProps) {
@ -43,7 +42,7 @@ export function Button({
className={clsx( className={clsx(
'inline-flex gap-2 items-center justify-center', 'inline-flex gap-2 items-center justify-center',
'select-none disabled:cursor-auto', 'select-none disabled:cursor-auto',
'cc-animate-color', 'clr-btn-default cc-animate-color',
{ {
'border rounded-sm': !noBorder, 'border rounded-sm': !noBorder,
'px-1': dense, 'px-1': dense,
@ -53,8 +52,7 @@ export function Button({
'outline-hidden': noOutline, 'outline-hidden': noOutline,
'clr-outline': !noOutline 'clr-outline': !noOutline
}, },
className, className
colors
)} )}
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined} data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}
data-tooltip-html={titleHtml} data-tooltip-html={titleHtml}

View File

@ -11,9 +11,6 @@ interface SelectorButtonProps extends Button {
/** Icon to display in the button. */ /** Icon to display in the button. */
icon?: React.ReactNode; icon?: React.ReactNode;
/** Classnames for the colors of the button. */
colors?: string;
/** Indicates if button background should be transparent. */ /** Indicates if button background should be transparent. */
transparent?: boolean; transparent?: boolean;
} }
@ -26,7 +23,6 @@ export function SelectorButton({
icon, icon,
title, title,
titleHtml, titleHtml,
colors = 'clr-btn-default',
className, className,
transparent, transparent,
hideTitle, hideTitle,
@ -44,10 +40,9 @@ export function SelectorButton({
'cc-animate-color', 'cc-animate-color',
{ {
'clr-hover': transparent, 'clr-hover': transparent,
'border': !transparent 'clr-btn-default border': !transparent
}, },
className, className
!transparent && colors
)} )}
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined} data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}
data-tooltip-html={titleHtml} data-tooltip-html={titleHtml}

View File

@ -17,7 +17,7 @@ import {
type VisibilityState type VisibilityState
} from '@tanstack/react-table'; } from '@tanstack/react-table';
import { type EventMouse, type Styling } from '../props'; import { type Styling } from '../props';
import { DefaultNoData } from './DefaultNoData'; import { DefaultNoData } from './DefaultNoData';
import { PaginationTools } from './PaginationTools'; import { PaginationTools } from './PaginationTools';
@ -67,10 +67,10 @@ export interface DataTableProps<TData extends RowData>
noDataComponent?: React.ReactNode; noDataComponent?: React.ReactNode;
/** Callback to be called when a row is clicked. */ /** Callback to be called when a row is clicked. */
onRowClicked?: (rowData: TData, event: EventMouse) => void; onRowClicked?: (rowData: TData, event: React.MouseEvent<Element>) => void;
/** Callback to be called when a row is double clicked. */ /** Callback to be called when a row is double clicked. */
onRowDoubleClicked?: (rowData: TData, event: EventMouse) => void; onRowDoubleClicked?: (rowData: TData, event: React.MouseEvent<Element>) => void;
/** Enable row selection. */ /** Enable row selection. */
enableRowSelection?: boolean; enableRowSelection?: boolean;

View File

@ -3,8 +3,6 @@
import { type Cell, flexRender, type Row, type Table } from '@tanstack/react-table'; import { type Cell, flexRender, type Row, type Table } from '@tanstack/react-table';
import clsx from 'clsx'; import clsx from 'clsx';
import { type EventMouse } from '../props';
import { SelectRow } from './SelectRow'; import { SelectRow } from './SelectRow';
import { type IConditionalStyle } from '.'; import { type IConditionalStyle } from '.';
@ -18,8 +16,8 @@ interface TableBodyProps<TData> {
lastSelected: string | null; lastSelected: string | null;
onChangeLastSelected: (newValue: string | null) => void; onChangeLastSelected: (newValue: string | null) => void;
onRowClicked?: (rowData: TData, event: EventMouse) => void; onRowClicked?: (rowData: TData, event: React.MouseEvent<Element>) => void;
onRowDoubleClicked?: (rowData: TData, event: EventMouse) => void; onRowDoubleClicked?: (rowData: TData, event: React.MouseEvent<Element>) => void;
} }
export function TableBody<TData>({ export function TableBody<TData>({
@ -33,7 +31,7 @@ export function TableBody<TData>({
onRowClicked, onRowClicked,
onRowDoubleClicked onRowDoubleClicked
}: TableBodyProps<TData>) { }: TableBodyProps<TData>) {
function handleRowClicked(target: Row<TData>, event: EventMouse) { function handleRowClicked(target: Row<TData>, event: React.MouseEvent<Element>) {
onRowClicked?.(target.original, event); onRowClicked?.(target.original, event);
if (enableRowSelection && target.getCanSelect()) { if (enableRowSelection && target.getCanSelect()) {
if (event.shiftKey && !!lastSelected && lastSelected !== target.id) { if (event.shiftKey && !!lastSelected && lastSelected !== target.id) {

View File

@ -1,7 +1,7 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { ZodError } from 'zod'; import { ZodError } from 'zod';
import { AxiosError, isAxiosError } from '@/backend/apiTransport'; import { type AxiosError, isAxiosError } from '@/backend/apiTransport';
import { isResponseHtml } from '@/utils/utils'; import { isResponseHtml } from '@/utils/utils';
import { PrettyJson } from './View'; import { PrettyJson } from './View';

View File

@ -3,7 +3,7 @@ import clsx from 'clsx';
import { globalIDs } from '@/utils/constants'; import { globalIDs } from '@/utils/constants';
import { CheckboxChecked } from '../Icons'; import { CheckboxChecked } from '../Icons';
import { type Button, type EventMouse } from '../props'; import { type Button } from '../props';
export interface CheckboxProps extends Omit<Button, 'value' | 'onClick' | 'onChange'> { export interface CheckboxProps extends Omit<Button, 'value' | 'onClick' | 'onChange'> {
/** Label to display next to the checkbox. */ /** Label to display next to the checkbox. */
@ -35,7 +35,7 @@ export function Checkbox({
}: CheckboxProps) { }: CheckboxProps) {
const cursor = disabled ? 'cursor-arrow' : onChange ? 'cursor-pointer' : ''; const cursor = disabled ? 'cursor-arrow' : onChange ? 'cursor-pointer' : '';
function handleClick(event: EventMouse): void { function handleClick(event: React.MouseEvent<Element>): void {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
if (disabled || !onChange) { if (disabled || !onChange) {

View File

@ -3,7 +3,6 @@ import clsx from 'clsx';
import { globalIDs } from '@/utils/constants'; import { globalIDs } from '@/utils/constants';
import { CheckboxChecked, CheckboxNull } from '../Icons'; import { CheckboxChecked, CheckboxNull } from '../Icons';
import { type EventMouse } from '../props';
import { type CheckboxProps } from './Checkbox'; import { type CheckboxProps } from './Checkbox';
@ -31,7 +30,7 @@ export function CheckboxTristate({
}: CheckboxTristateProps) { }: CheckboxTristateProps) {
const cursor = disabled ? 'cursor-arrow' : onChange ? 'cursor-pointer' : ''; const cursor = disabled ? 'cursor-arrow' : onChange ? 'cursor-pointer' : '';
function handleClick(event: EventMouse): void { function handleClick(event: React.MouseEvent<Element>): void {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
if (disabled || !onChange) { if (disabled || !onChange) {

View File

@ -5,11 +5,11 @@ import clsx from 'clsx';
import { Button } from '../Control'; import { Button } from '../Control';
import { IconUpload } from '../Icons'; import { IconUpload } from '../Icons';
import { type Input } from '../props'; import { type Titled } from '../props';
import { Label } from './Label'; import { Label } from './Label';
interface FileInputProps extends Omit<Input, 'accept' | 'type'> { interface FileInputProps extends Titled, Omit<React.ComponentProps<'input'>, 'accept' | 'type'> {
/** Label to display in file upload button. */ /** Label to display in file upload button. */
label: string; label: string;

View File

@ -1,8 +1,6 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { type Label as LabelStyle } from '../props'; interface LabelProps extends Omit<React.ComponentProps<'label'>, 'children'> {
interface LabelProps extends LabelStyle {
/** Text to display. */ /** Text to display. */
text?: string; text?: string;
} }

View File

@ -48,10 +48,10 @@ export function SearchBar({
<TextInput <TextInput
id={id} id={id}
noOutline noOutline
transparent
placeholder={placeholder} placeholder={placeholder}
type='search' type='search'
colors='bg-transparent' className={clsx('bg-transparent', !noIcon && 'pl-10')}
className={clsx(!noIcon && 'pl-10')}
noBorder={noBorder} noBorder={noBorder}
value={query} value={query}
onChange={event => onChangeQuery?.(event.target.value)} onChange={event => onChangeQuery?.(event.target.value)}

View File

@ -6,7 +6,7 @@ import { globalIDs, PARAMETER } from '@/utils/constants';
import { Overlay } from '../Container'; import { Overlay } from '../Container';
import { MiniButton } from '../Control'; import { MiniButton } from '../Control';
import { IconDropArrow, IconPageRight } from '../Icons'; import { IconDropArrow, IconPageRight } from '../Icons';
import { type EventMouse, type Styling } from '../props'; import { type Styling } from '../props';
interface SelectTreeProps<ItemType> extends Styling { interface SelectTreeProps<ItemType> extends Styling {
/** Current value. */ /** Current value. */
@ -66,13 +66,13 @@ export function SelectTree<ItemType>({
); );
} }
function handleClickFold(event: EventMouse, target: ItemType, showChildren: boolean) { function handleClickFold(event: React.MouseEvent<Element>, target: ItemType, showChildren: boolean) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
onFoldItem(target, showChildren); onFoldItem(target, showChildren);
} }
function handleSetValue(event: EventMouse, target: ItemType) { function handleSetValue(event: React.MouseEvent<Element>, target: ItemType) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
onChange(target); onChange(target);

View File

@ -1,11 +1,14 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { Label } from '../Input/Label'; import { Label } from '../Input/Label';
import { type Colors, type Editor, type ErrorProcessing, type TextArea as TextAreaStyle } from '../props'; import { type Editor, type ErrorProcessing, type Titled } from '../props';
import { ErrorField } from './ErrorField'; import { ErrorField } from './ErrorField';
export interface TextAreaProps extends Editor, ErrorProcessing, Colors, TextAreaStyle { export interface TextAreaProps extends Editor, ErrorProcessing, Titled, React.ComponentProps<'textarea'> {
/** Indicates that the input should be transparent. */
transparent?: boolean;
/** Indicates that padding should be minimal. */ /** Indicates that padding should be minimal. */
dense?: boolean; dense?: boolean;
@ -23,6 +26,7 @@ export function TextArea({
id, id,
label, label,
required, required,
transparent,
rows, rows,
dense, dense,
noBorder, noBorder,
@ -31,7 +35,6 @@ export function TextArea({
className, className,
fitContent, fitContent,
error, error,
colors = 'clr-input',
...restProps ...restProps
}: TextAreaProps) { }: TextAreaProps) {
return ( return (
@ -53,14 +56,15 @@ export function TextArea({
'leading-tight', 'leading-tight',
'overflow-x-hidden overflow-y-auto', 'overflow-x-hidden overflow-y-auto',
{ {
'cc-fit-content': fitContent, 'field-sizing-content': fitContent,
'resize-none': noResize, 'resize-none': noResize,
'border': !noBorder, 'border': !noBorder,
'grow max-w-full': dense, 'grow max-w-full': dense,
'mt-2': !dense && !!label, 'mt-2': !dense && !!label,
'clr-outline': !noOutline 'clr-outline': !noOutline,
'bg-transparent': transparent,
'clr-input': !transparent
}, },
colors,
!dense && className !dense && className
)} )}
rows={rows} rows={rows}

View File

@ -1,11 +1,14 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { Label } from '../Input/Label'; import { Label } from '../Input/Label';
import { type Colors, type Editor, type ErrorProcessing, type Input } from '../props'; import { type Editor, type ErrorProcessing, type Titled } from '../props';
import { ErrorField } from './ErrorField'; import { ErrorField } from './ErrorField';
interface TextInputProps extends Editor, ErrorProcessing, Colors, Input { interface TextInputProps extends Editor, ErrorProcessing, Titled, React.ComponentProps<'input'> {
/** Indicates that the input should be transparent. */
transparent?: boolean;
/** Indicates that padding should be minimal. */ /** Indicates that padding should be minimal. */
dense?: boolean; dense?: boolean;
@ -30,8 +33,8 @@ export function TextInput({
noOutline, noOutline,
allowEnter, allowEnter,
disabled, disabled,
transparent,
className, className,
colors = 'clr-input',
onKeyDown, onKeyDown,
error, error,
...restProps ...restProps
@ -57,9 +60,10 @@ export function TextInput({
'grow max-w-full': dense, 'grow max-w-full': dense,
'mt-2': !dense && !!label, 'mt-2': !dense && !!label,
'border': !noBorder, 'border': !noBorder,
'clr-outline': !noOutline 'clr-outline': !noOutline,
'bg-transparent': transparent,
'clr-input': !transparent
}, },
colors,
!dense && className !dense && className
)} )}
onKeyDown={!allowEnter && !onKeyDown ? preventEnterCapture : onKeyDown} onKeyDown={!allowEnter && !onKeyDown ? preventEnterCapture : onKeyDown}

View File

@ -2,7 +2,7 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { BadgeHelp, HelpTopic } from '@/features/help'; import { BadgeHelp, type HelpTopic } from '@/features/help';
import { useEscapeKey } from '@/hooks/useEscapeKey'; import { useEscapeKey } from '@/hooks/useEscapeKey';
import { useDialogsStore } from '@/stores/dialogs'; import { useDialogsStore } from '@/stores/dialogs';

View File

@ -1,11 +1,9 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { type Div } from '@/components/props';
/** /**
* Wraps content in a div with a centered text. * Wraps content in a div with a centered text.
*/ */
export function NoData({ className, children, ...restProps }: Div) { export function NoData({ className, children, ...restProps }: React.ComponentProps<'div'>) {
return ( return (
<div className={clsx('p-3 flex flex-col items-center text-center select-none w-full', className)} {...restProps}> <div className={clsx('p-3 flex flex-col items-center text-center select-none w-full', className)} {...restProps}>
{children} {children}

View File

@ -3,7 +3,7 @@ import clsx from 'clsx';
import { globalIDs } from '@/utils/constants'; import { globalIDs } from '@/utils/constants';
import { MiniButton } from '../Control'; import { MiniButton } from '../Control';
import { type EventMouse, type Styling, type Titled } from '../props'; import { type Styling, type Titled } from '../props';
interface ValueIconProps extends Styling, Titled { interface ValueIconProps extends Styling, Titled {
/** Id of the component. */ /** Id of the component. */
@ -19,7 +19,7 @@ interface ValueIconProps extends Styling, Titled {
textClassName?: string; textClassName?: string;
/** Callback to be called when the component is clicked. */ /** Callback to be called when the component is clicked. */
onClick?: (event: EventMouse) => void; onClick?: (event: React.MouseEvent<Element>) => void;
/** Number of symbols to display in a small size. */ /** Number of symbols to display in a small size. */
smallThreshold?: number; smallThreshold?: number;

View File

@ -1,6 +1,6 @@
// =========== Module contains interfaces for common UI elements. ========== // =========== Module contains interfaces for common UI elements. ==========
import React from 'react'; import type React from 'react';
import { FieldError } from 'react-hook-form'; import { type FieldError } from 'react-hook-form';
/** /**
* Represents an object that can have inline styles and CSS class names for styling. * Represents an object that can have inline styles and CSS class names for styling.
@ -13,14 +13,6 @@ export interface Styling {
className?: string; className?: string;
} }
/**
* Represents an object that can have a color or set of colors.
*/
export interface Colors {
/** Optional color or set of colors applied via classNames. */
colors?: string;
}
/** /**
* Represents an object that can have a title with optional HTML rendering and a flag to hide the title. * Represents an object that can have a title with optional HTML rendering and a flag to hide the title.
*/ */
@ -70,32 +62,7 @@ export type Editor = Control & {
label?: string; label?: string;
}; };
/**
* Represents `div` component with all standard HTML attributes and React-specific properties.
*/
export type Div = React.ComponentProps<'div'>;
/** /**
* Represents `button` component with optional title and HTML attributes. * Represents `button` component with optional title and HTML attributes.
*/ */
export type Button = Titled & Omit<React.ComponentProps<'button'>, 'children' | 'type'>; export type Button = Titled & Omit<React.ComponentProps<'button'>, 'children' | 'type'>;
/**
* Represents `label` component with HTML attributes.
*/
export type Label = Omit<React.ComponentProps<'label'>, 'children'>;
/**
* Represents `textarea` component with optional title and HTML attributes.
*/
export type TextArea = Titled & React.ComponentProps<'textarea'>;
/**
* Represents `input` component with optional title and HTML attributes.
*/
export type Input = Titled & React.ComponentProps<'input'>;
/**
* Represents `mouse event` in React.
*/
export type EventMouse = React.MouseEvent<Element, MouseEvent>;

View File

@ -24,9 +24,6 @@ export function Component() {
const [newPassword, setNewPassword] = useState(''); const [newPassword, setNewPassword] = useState('');
const [newPasswordRepeat, setNewPasswordRepeat] = useState(''); const [newPasswordRepeat, setNewPasswordRepeat] = useState('');
const passwordColor =
!!newPassword && !!newPasswordRepeat && newPassword !== newPasswordRepeat ? 'bg-warn-100' : 'clr-input';
const canSubmit = !!newPassword && !!newPasswordRepeat && newPassword === newPasswordRepeat; const canSubmit = !!newPassword && !!newPasswordRepeat && newPassword === newPasswordRepeat;
function handleSubmit(event: React.FormEvent<HTMLFormElement>) { function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
@ -61,7 +58,6 @@ export function Component() {
label='Новый пароль' label='Новый пароль'
autoComplete='new-password' autoComplete='new-password'
allowEnter allowEnter
colors={passwordColor}
value={newPassword} value={newPassword}
onChange={event => { onChange={event => {
setNewPassword(event.target.value); setNewPassword(event.target.value);
@ -73,7 +69,6 @@ export function Component() {
label='Повторите новый' label='Повторите новый'
autoComplete='new-password' autoComplete='new-password'
allowEnter allowEnter
colors={passwordColor}
value={newPasswordRepeat} value={newPasswordRepeat}
onChange={event => { onChange={event => {
setNewPasswordRepeat(event.target.value); setNewPasswordRepeat(event.target.value);

View File

@ -7,7 +7,7 @@ import { Loader } from '@/components/Loader';
import { type Styling } from '@/components/props'; import { type Styling } from '@/components/props';
import { usePreferencesStore } from '@/stores/preferences'; import { usePreferencesStore } from '@/stores/preferences';
import { HelpTopic } from '../models/helpTopic'; import { type HelpTopic } from '../models/helpTopic';
const TopicPage = React.lazy(() => const TopicPage = React.lazy(() =>
import('@/features/help/pages/ManualsPage/TopicPage').then(module => ({ default: module.TopicPage })) import('@/features/help/pages/ManualsPage/TopicPage').then(module => ({ default: module.TopicPage }))

View File

@ -2,7 +2,7 @@ import { urls } from '@/app';
import { TextURL } from '@/components/Control'; import { TextURL } from '@/components/Control';
import { HelpTopic } from '../models/helpTopic'; import { type HelpTopic } from '../models/helpTopic';
interface TextURLProps { interface TextURLProps {
/** Text to display. */ /** Text to display. */

View File

@ -2,7 +2,7 @@ import { removeTags } from '@/utils/utils';
import { LinkTopic } from '../components/LinkTopic'; import { LinkTopic } from '../components/LinkTopic';
import { describeHelpTopic, labelHelpTopic } from '../labels'; import { describeHelpTopic, labelHelpTopic } from '../labels';
import { HelpTopic } from '../models/helpTopic'; import { type HelpTopic } from '../models/helpTopic';
interface TopicItemProps { interface TopicItemProps {
topic: HelpTopic; topic: HelpTopic;

View File

@ -2,7 +2,7 @@
import { useWindowSize } from '@/hooks/useWindowSize'; import { useWindowSize } from '@/hooks/useWindowSize';
import { HelpTopic } from '../../models/helpTopic'; import { type HelpTopic } from '../../models/helpTopic';
import { TopicsDropdown } from './TopicsDropdown'; import { TopicsDropdown } from './TopicsDropdown';
import { TopicsStatic } from './TopicsStatic'; import { TopicsStatic } from './TopicsStatic';

View File

@ -2,7 +2,7 @@
import { useMainHeight } from '@/stores/appLayout'; import { useMainHeight } from '@/stores/appLayout';
import { HelpTopic } from '../../models/helpTopic'; import { type HelpTopic } from '../../models/helpTopic';
import { TopicPage } from './TopicPage'; import { TopicPage } from './TopicPage';

View File

@ -12,7 +12,7 @@ import { DELAYS, KEYS } from '@/backend/configuration';
import { infoMsg } from '@/utils/labels'; import { infoMsg } from '@/utils/labels';
import { import {
AccessPolicy, type AccessPolicy,
type ICloneLibraryItemDTO, type ICloneLibraryItemDTO,
type ICreateLibraryItemDTO, type ICreateLibraryItemDTO,
type ILibraryItem, type ILibraryItem,

View File

@ -6,7 +6,7 @@ import { type IRSFormDTO } from '@/features/rsform/backend/types';
import { KEYS } from '@/backend/configuration'; import { KEYS } from '@/backend/configuration';
import { libraryApi } from './api'; import { libraryApi } from './api';
import { AccessPolicy, type ILibraryItem } from './types'; import { type AccessPolicy, type ILibraryItem } from './types';
export const useSetAccessPolicy = () => { export const useSetAccessPolicy = () => {
const client = useQueryClient(); const client = useQueryClient();

View File

@ -16,7 +16,6 @@ import {
IconOwner IconOwner
} from '@/components/Icons'; } from '@/components/Icons';
import { Loader } from '@/components/Loader'; import { Loader } from '@/components/Loader';
import { type EventMouse } from '@/components/props';
import { ValueIcon } from '@/components/View'; import { ValueIcon } from '@/components/View';
import { useDialogsStore } from '@/stores/dialogs'; import { useDialogsStore } from '@/stores/dialogs';
import { useModificationStore } from '@/stores/modification'; import { useModificationStore } from '@/stores/modification';
@ -62,7 +61,7 @@ export function EditorLibraryItem({ schema, isAttachedToOSS }: EditorLibraryItem
void setOwner({ itemID: schema.id, owner: newValue }); void setOwner({ itemID: schema.id, owner: newValue });
}; };
function handleOpenLibrary(event: EventMouse) { function handleOpenLibrary(event: React.MouseEvent<Element>) {
setGlobalLocation(schema.location); setGlobalLocation(schema.location);
router.push(urls.library, event.ctrlKey || event.metaKey); router.push(urls.library, event.ctrlKey || event.metaKey);
} }

View File

@ -6,20 +6,20 @@ import { MiniButton } from '@/components/Control';
import { Dropdown, DropdownButton, useDropdown } from '@/components/Dropdown'; import { Dropdown, DropdownButton, useDropdown } from '@/components/Dropdown';
import { IconOSS } from '@/components/Icons'; import { IconOSS } from '@/components/Icons';
import { Label } from '@/components/Input'; import { Label } from '@/components/Input';
import { type EventMouse, type Styling } from '@/components/props'; import { type Styling } from '@/components/props';
import { prefixes } from '@/utils/constants'; import { prefixes } from '@/utils/constants';
import { type ILibraryItemReference } from '../models/library'; import { type ILibraryItemReference } from '../models/library';
interface MiniSelectorOSSProps extends Styling { interface MiniSelectorOSSProps extends Styling {
items: ILibraryItemReference[]; items: ILibraryItemReference[];
onSelect: (event: EventMouse, newValue: ILibraryItemReference) => void; onSelect: (event: React.MouseEvent<Element>, newValue: ILibraryItemReference) => void;
} }
export function MiniSelectorOSS({ items, onSelect, className, ...restProps }: MiniSelectorOSSProps) { export function MiniSelectorOSS({ items, onSelect, className, ...restProps }: MiniSelectorOSSProps) {
const ossMenu = useDropdown(); const ossMenu = useDropdown();
function onToggle(event: EventMouse) { function onToggle(event: React.MouseEvent<Element>) {
if (items.length > 1) { if (items.length > 1) {
ossMenu.toggle(); ossMenu.toggle();
} else { } else {

View File

@ -8,11 +8,11 @@ import { createColumnHelper, DataTable, type IConditionalStyle } from '@/compone
import { Dropdown, useDropdown } from '@/components/Dropdown'; import { Dropdown, useDropdown } from '@/components/Dropdown';
import { IconClose, IconFolderTree } from '@/components/Icons'; import { IconClose, IconFolderTree } from '@/components/Icons';
import { SearchBar } from '@/components/Input'; import { SearchBar } from '@/components/Input';
import { type EventMouse, type Styling } from '@/components/props'; import { type Styling } from '@/components/props';
import { APP_COLORS } from '@/styling/colors'; import { APP_COLORS } from '@/styling/colors';
import { prefixes } from '@/utils/constants'; import { prefixes } from '@/utils/constants';
import { type ILibraryItem, LibraryItemType } from '../backend/types'; import { type ILibraryItem, type LibraryItemType } from '../backend/types';
import { matchLibraryItem } from '../models/libraryAPI'; import { matchLibraryItem } from '../models/libraryAPI';
import { SelectLocation } from './SelectLocation'; import { SelectLocation } from './SelectLocation';
@ -96,7 +96,7 @@ export function PickSchema({
} }
]; ];
function handleLocationClick(event: EventMouse, newValue: string) { function handleLocationClick(event: React.MouseEvent<Element>, newValue: string) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
locationMenu.hide(); locationMenu.hide();

View File

@ -5,15 +5,15 @@ import clsx from 'clsx';
import { MiniButton } from '@/components/Control'; import { MiniButton } from '@/components/Control';
import { IconFolder, IconFolderClosed, IconFolderEmpty, IconFolderOpened } from '@/components/Icons'; import { IconFolder, IconFolderClosed, IconFolderEmpty, IconFolderOpened } from '@/components/Icons';
import { type EventMouse, type Styling } from '@/components/props'; import { type Styling } from '@/components/props';
import { useFolders } from '../backend/useFolders'; import { useFolders } from '../backend/useFolders';
import { labelFolderNode } from '../labels'; import { labelFolderNode } from '../labels';
import { FolderNode } from '../models/FolderTree'; import { type FolderNode } from '../models/FolderTree';
interface SelectLocationProps extends Styling { interface SelectLocationProps extends Styling {
value: string; value: string;
onClick: (event: EventMouse, target: FolderNode) => void; onClick: (event: React.MouseEvent<Element>, target: FolderNode) => void;
prefix: string; prefix: string;
dense?: boolean; dense?: boolean;
@ -44,7 +44,7 @@ export function SelectLocation({ value, dense, prefix, onClick, className, style
); );
} }
function handleClickFold(event: EventMouse, target: FolderNode, showChildren: boolean) { function handleClickFold(event: React.MouseEvent<Element>, target: FolderNode, showChildren: boolean) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
onFoldItem(target, showChildren); onFoldItem(target, showChildren);

View File

@ -5,7 +5,7 @@ import clsx from 'clsx';
import { MiniButton } from '@/components/Control'; import { MiniButton } from '@/components/Control';
import { Dropdown, useDropdown } from '@/components/Dropdown'; import { Dropdown, useDropdown } from '@/components/Dropdown';
import { IconFolderTree } from '@/components/Icons'; import { IconFolderTree } from '@/components/Icons';
import { type EventMouse, type Styling } from '@/components/props'; import { type Styling } from '@/components/props';
import { prefixes } from '@/utils/constants'; import { prefixes } from '@/utils/constants';
import { SelectLocation } from './SelectLocation'; import { SelectLocation } from './SelectLocation';
@ -26,7 +26,7 @@ export function SelectLocationContext({
}: SelectLocationContextProps) { }: SelectLocationContextProps) {
const menu = useDropdown(); const menu = useDropdown();
function handleClick(event: EventMouse, newValue: string) { function handleClick(event: React.MouseEvent<Element>, newValue: string) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
menu.hide(); menu.hide();

View File

@ -8,7 +8,7 @@ import { IconImmutable, IconMutable } from '@/components/Icons';
import { Label } from '@/components/Input'; import { Label } from '@/components/Input';
import { PARAMETER } from '@/utils/constants'; import { PARAMETER } from '@/utils/constants';
import { AccessPolicy, type ILibraryItem } from '../backend/types'; import { type AccessPolicy, type ILibraryItem } from '../backend/types';
import { useMutatingLibrary } from '../backend/useMutatingLibrary'; import { useMutatingLibrary } from '../backend/useMutatingLibrary';
import { useSetAccessPolicy } from '../backend/useSetAccessPolicy'; import { useSetAccessPolicy } from '../backend/useSetAccessPolicy';

View File

@ -1,5 +1,5 @@
import { AccessPolicy, LibraryItemType } from './backend/types'; import { AccessPolicy, LibraryItemType } from './backend/types';
import { FolderNode } from './models/FolderTree'; import { type FolderNode } from './models/FolderTree';
import { LocationHead } from './models/library'; import { LocationHead } from './models/library';
import { validateLocation } from './models/libraryAPI'; import { validateLocation } from './models/libraryAPI';

View File

@ -11,7 +11,6 @@ import { FlexColumn } from '@/components/Container';
import { MiniButton, TextURL } from '@/components/Control'; import { MiniButton, TextURL } from '@/components/Control';
import { createColumnHelper, DataTable, type IConditionalStyle, type VisibilityState } from '@/components/DataTable'; import { createColumnHelper, DataTable, type IConditionalStyle, type VisibilityState } from '@/components/DataTable';
import { IconFolderTree } from '@/components/Icons'; import { IconFolderTree } from '@/components/Icons';
import { type EventMouse } from '@/components/props';
import { useWindowSize } from '@/hooks/useWindowSize'; import { useWindowSize } from '@/hooks/useWindowSize';
import { useFitHeight } from '@/stores/appLayout'; import { useFitHeight } from '@/stores/appLayout';
import { usePreferencesStore } from '@/stores/preferences'; import { usePreferencesStore } from '@/stores/preferences';
@ -39,7 +38,7 @@ export function TableLibraryItems({ items }: TableLibraryItemsProps) {
const itemsPerPage = usePreferencesStore(state => state.libraryPagination); const itemsPerPage = usePreferencesStore(state => state.libraryPagination);
const setItemsPerPage = usePreferencesStore(state => state.setLibraryPagination); const setItemsPerPage = usePreferencesStore(state => state.setLibraryPagination);
function handleOpenItem(item: ILibraryItem, event: EventMouse) { function handleOpenItem(item: ILibraryItem, event: React.MouseEvent<Element>) {
const selection = window.getSelection(); const selection = window.getSelection();
if (!!selection && selection.toString().length > 0) { if (!!selection && selection.toString().length > 0) {
return; return;
@ -61,7 +60,7 @@ export function TableLibraryItems({ items }: TableLibraryItemsProps) {
}); });
}, [windowSize]); }, [windowSize]);
function handleToggleFolder(event: EventMouse) { function handleToggleFolder(event: React.MouseEvent<Element>) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
toggleFolderMode(); toggleFolderMode();

View File

@ -17,7 +17,6 @@ import {
IconUserSearch IconUserSearch
} from '@/components/Icons'; } from '@/components/Icons';
import { SearchBar } from '@/components/Input'; import { SearchBar } from '@/components/Input';
import { type EventMouse } from '@/components/props';
import { prefixes } from '@/utils/constants'; import { prefixes } from '@/utils/constants';
import { tripleToggleColor } from '@/utils/utils'; import { tripleToggleColor } from '@/utils/utils';
@ -66,7 +65,7 @@ export function ToolbarSearch({ total, filtered }: ToolbarSearchProps) {
toggleFolderMode(); toggleFolderMode();
} }
function handleFolderClick(event: EventMouse) { function handleFolderClick(event: React.MouseEvent<Element>) {
if (event.ctrlKey || event.metaKey) { if (event.ctrlKey || event.metaKey) {
toggleFolderMode(); toggleFolderMode();
} else { } else {

View File

@ -7,7 +7,6 @@ import { BadgeHelp, HelpTopic } from '@/features/help';
import { MiniButton } from '@/components/Control'; import { MiniButton } from '@/components/Control';
import { SubfoldersIcon } from '@/components/DomainIcons'; import { SubfoldersIcon } from '@/components/DomainIcons';
import { IconFolderEdit, IconFolderTree } from '@/components/Icons'; import { IconFolderEdit, IconFolderTree } from '@/components/Icons';
import { type EventMouse } from '@/components/props';
import { useWindowSize } from '@/hooks/useWindowSize'; import { useWindowSize } from '@/hooks/useWindowSize';
import { useFitHeight } from '@/stores/appLayout'; import { useFitHeight } from '@/stores/appLayout';
import { PARAMETER, prefixes } from '@/utils/constants'; import { PARAMETER, prefixes } from '@/utils/constants';
@ -15,7 +14,7 @@ import { infoMsg } from '@/utils/labels';
import { useLibrary } from '../../backend/useLibrary'; import { useLibrary } from '../../backend/useLibrary';
import { SelectLocation } from '../../components/SelectLocation'; import { SelectLocation } from '../../components/SelectLocation';
import { FolderNode } from '../../models/FolderTree'; import { type FolderNode } from '../../models/FolderTree';
import { useLibrarySearchStore } from '../../stores/librarySearch'; import { useLibrarySearchStore } from '../../stores/librarySearch';
interface ViewSideLocationProps { interface ViewSideLocationProps {
@ -48,7 +47,7 @@ export function ViewSideLocation({ isVisible, onRenameLocation }: ViewSideLocati
const maxHeight = useFitHeight('4.5rem'); const maxHeight = useFitHeight('4.5rem');
function handleClickFolder(event: EventMouse, target: FolderNode) { function handleClickFolder(event: React.MouseEvent<Element>, target: FolderNode) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
if (event.ctrlKey || event.metaKey) { if (event.ctrlKey || event.metaKey) {

View File

@ -3,7 +3,7 @@ import { persist } from 'zustand/middleware';
import { toggleTristateFlag } from '@/utils/utils'; import { toggleTristateFlag } from '@/utils/utils';
import { type ILibraryFilter, LocationHead } from '../models/library'; import { type ILibraryFilter, type LocationHead } from '../models/library';
interface LibrarySearchStore { interface LibrarySearchStore {
folderMode: boolean; folderMode: boolean;

View File

@ -2,7 +2,7 @@
* Module: Schema of Synthesis Operations. * Module: Schema of Synthesis Operations.
*/ */
import { Graph } from '@/models/Graph'; import { type Graph } from '@/models/Graph';
import { type ICstSubstituteInfo, type IOperationDTO, type IOperationSchemaDTO } from '../backend/types'; import { type ICstSubstituteInfo, type IOperationDTO, type IOperationSchemaDTO } from '../backend/types';

View File

@ -19,7 +19,6 @@ import { urls, useConceptNavigation } from '@/app';
import { useLibrary } from '@/features/library'; import { useLibrary } from '@/features/library';
import { Overlay } from '@/components/Container'; import { Overlay } from '@/components/Container';
import { type EventMouse } from '@/components/props';
import { useMainHeight } from '@/stores/appLayout'; import { useMainHeight } from '@/stores/appLayout';
import { useTooltipsStore } from '@/stores/tooltips'; import { useTooltipsStore } from '@/stores/tooltips';
import { APP_COLORS } from '@/styling/colors'; import { APP_COLORS } from '@/styling/colors';
@ -236,7 +235,7 @@ export function OssFlow() {
}); });
} }
function handleContextMenu(event: EventMouse, node: OssNode) { function handleContextMenu(event: React.MouseEvent<Element>, node: OssNode) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
@ -257,7 +256,7 @@ export function OssFlow() {
handleContextMenuHide(); handleContextMenuHide();
} }
function handleNodeDoubleClick(event: EventMouse, node: OssNode) { function handleNodeDoubleClick(event: React.MouseEvent<Element>, node: OssNode) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
if (node.data.operation.result) { if (node.data.operation.result) {

View File

@ -1,13 +1,12 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { IconChild } from '@/components/Icons'; import { IconChild } from '@/components/Icons';
import { type Div } from '@/components/props';
import { labelCstTypification } from '../labels'; import { labelCstTypification } from '../labels';
import { type IConstituenta } from '../models/rsform'; import { type IConstituenta } from '../models/rsform';
import { isBasicConcept } from '../models/rsformAPI'; import { isBasicConcept } from '../models/rsformAPI';
interface InfoConstituentaProps extends Div { interface InfoConstituentaProps extends React.ComponentProps<'div'> {
data: IConstituenta; data: IConstituenta;
} }

View File

@ -1,5 +1,5 @@
import { syntaxTree } from '@codemirror/language'; import { syntaxTree } from '@codemirror/language';
import { EditorState } from '@uiw/react-codemirror'; import { type EditorState } from '@uiw/react-codemirror';
import { findEnvelopingNodes } from '@/utils/codemirror'; import { findEnvelopingNodes } from '@/utils/codemirror';

View File

@ -1,5 +1,5 @@
import { syntaxTree } from '@codemirror/language'; import { syntaxTree } from '@codemirror/language';
import { EditorState } from '@uiw/react-codemirror'; import { type EditorState } from '@uiw/react-codemirror';
import { findEnvelopingNodes } from '@/utils/codemirror'; import { findEnvelopingNodes } from '@/utils/codemirror';

View File

@ -13,7 +13,7 @@ import {
IconReset IconReset
} from '@/components/Icons'; } from '@/components/Icons';
import { type Styling } from '@/components/props'; import { type Styling } from '@/components/props';
import { Graph } from '@/models/Graph'; import { type Graph } from '@/models/Graph';
interface ToolbarGraphSelectionProps extends Styling { interface ToolbarGraphSelectionProps extends Styling {
value: number[]; value: number[];

View File

@ -18,7 +18,7 @@ import { useIsProcessingCctext } from '../../backend/cctext/useIsProcessingCctex
import { useParseText } from '../../backend/cctext/useParseText'; import { useParseText } from '../../backend/cctext/useParseText';
import { useCstUpdate } from '../../backend/useCstUpdate'; import { useCstUpdate } from '../../backend/useCstUpdate';
import { SelectMultiGrammeme } from '../../components/SelectMultiGrammeme'; import { SelectMultiGrammeme } from '../../components/SelectMultiGrammeme';
import { Grammeme, type IGrammemeOption, type IWordForm, supportedGrammemes } from '../../models/language'; import { type Grammeme, type IGrammemeOption, type IWordForm, supportedGrammemes } from '../../models/language';
import { parseGrammemes, supportedGrammeOptions, wordFormEquals } from '../../models/languageAPI'; import { parseGrammemes, supportedGrammeOptions, wordFormEquals } from '../../models/languageAPI';
import { type IConstituenta } from '../../models/rsform'; import { type IConstituenta } from '../../models/rsform';

View File

@ -10,7 +10,7 @@ import { TextInput } from '@/components/Input';
import { ModalForm } from '@/components/Modal'; import { ModalForm } from '@/components/Modal';
import { useDialogsStore } from '@/stores/dialogs'; import { useDialogsStore } from '@/stores/dialogs';
import { CstType, type ICstRenameDTO, schemaCstRename } from '../backend/types'; import { type CstType, type ICstRenameDTO, schemaCstRename } from '../backend/types';
import { useCstRename } from '../backend/useCstRename'; import { useCstRename } from '../backend/useCstRename';
import { SelectCstType } from '../components/SelectCstType'; import { SelectCstType } from '../components/SelectCstType';
import { type IConstituenta, type IRSForm } from '../models/rsform'; import { type IConstituenta, type IRSForm } from '../models/rsform';

View File

@ -3,7 +3,7 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { type Edge, ReactFlow, useEdgesState, useNodesState } from 'reactflow'; import { type Edge, ReactFlow, useEdgesState, useNodesState } from 'reactflow';
import { TMGraph } from '../../models/TMGraph'; import { type TMGraph } from '../../models/TMGraph';
import { TMGraphEdgeTypes } from './graph/MGraphEdgeTypes'; import { TMGraphEdgeTypes } from './graph/MGraphEdgeTypes';
import { applyLayout } from './graph/MGraphLayout'; import { applyLayout } from './graph/MGraphLayout';

View File

@ -5,9 +5,9 @@
import { type ILibraryItemData, type IVersionInfo } from '@/features/library/backend/types'; import { type ILibraryItemData, type IVersionInfo } from '@/features/library/backend/types';
import { type CurrentVersion, type ILibraryItemReference } from '@/features/library/models/library'; import { type CurrentVersion, type ILibraryItemReference } from '@/features/library/models/library';
import { Graph } from '@/models/Graph'; import { type Graph } from '@/models/Graph';
import { CstType, ParsingStatus, ValueClass } from '../backend/types'; import { CstType, type ParsingStatus, type ValueClass } from '../backend/types';
import { type IArgumentInfo } from './rslang'; import { type IArgumentInfo } from './rslang';

View File

@ -2,7 +2,7 @@
* Module: Models for RSLanguage. * Module: Models for RSLanguage.
*/ */
import { TokenID } from '../backend/types'; import { type TokenID } from '../backend/types';
/** /**
* Represents alias mapping. * Represents alias mapping.

View File

@ -2,12 +2,12 @@
* Module: API for RSLanguage. * Module: API for RSLanguage.
*/ */
import { Tree } from '@lezer/common'; import { type Tree } from '@lezer/common';
import { cursorNode } from '@/utils/codemirror'; import { cursorNode } from '@/utils/codemirror';
import { PARAMETER } from '@/utils/constants'; import { PARAMETER } from '@/utils/constants';
import { CstType, type IRSErrorDescription, RSErrorType } from '../backend/types'; import { CstType, type IRSErrorDescription, type RSErrorType } from '../backend/types';
import { type AliasMapping, type IArgumentValue, RSErrorClass, type SyntaxTree } from './rslang'; import { type AliasMapping, type IArgumentValue, RSErrorClass, type SyntaxTree } from './rslang';

View File

@ -10,7 +10,6 @@ import { Overlay } from '@/components/Container';
import { SubmitButton } from '@/components/Control'; import { SubmitButton } from '@/components/Control';
import { IconChild, IconPredecessor, IconSave } from '@/components/Icons'; import { IconChild, IconPredecessor, IconSave } from '@/components/Icons';
import { TextArea } from '@/components/Input'; import { TextArea } from '@/components/Input';
import { type EventMouse } from '@/components/props';
import { Indicator } from '@/components/View'; import { Indicator } from '@/components/View';
import { useDialogsStore } from '@/stores/dialogs'; import { useDialogsStore } from '@/stores/dialogs';
import { useModificationStore } from '@/stores/modification'; import { useModificationStore } from '@/stores/modification';
@ -106,7 +105,7 @@ export function FormConstituenta({ disabled, id, toggleReset, schema, activeCst,
return cstUpdate({ itemID: schema.id, data }).then(() => reset({ ...data })); return cstUpdate({ itemID: schema.id, data }).then(() => reset({ ...data }));
} }
function handleTypeGraph(event: EventMouse) { function handleTypeGraph(event: React.MouseEvent<Element>) {
if ((localParse && !localParse.parseResult) || activeCst.parse.status !== ParsingStatus.VERIFIED) { if ((localParse && !localParse.parseResult) || activeCst.parse.status !== ParsingStatus.VERIFIED) {
toast.error(errorMsg.typeStructureFailed); toast.error(errorMsg.typeStructureFailed);
return; return;
@ -145,11 +144,12 @@ export function FormConstituenta({ disabled, id, toggleReset, schema, activeCst,
dense dense
noResize noResize
noBorder noBorder
transparent
noOutline noOutline
readOnly readOnly
label='Типизация' label='Типизация'
value={typification} value={typification}
colors='bg-transparent clr-text-default cursor-default' className='clr-text-default cursor-default'
/> />
{!!activeCst.definition_formal || !isElementary ? ( {!!activeCst.definition_formal || !isElementary ? (

View File

@ -7,7 +7,6 @@ import { type ReactCodeMirrorRef } from '@uiw/react-codemirror';
import { BadgeHelp, HelpTopic } from '@/features/help'; import { BadgeHelp, HelpTopic } from '@/features/help';
import { Overlay } from '@/components/Container'; import { Overlay } from '@/components/Container';
import { type EventMouse } from '@/components/props';
import { useDialogsStore } from '@/stores/dialogs'; import { useDialogsStore } from '@/stores/dialogs';
import { usePreferencesStore } from '@/stores/preferences'; import { usePreferencesStore } from '@/stores/preferences';
import { errorMsg } from '@/utils/labels'; import { errorMsg } from '@/utils/labels';
@ -47,7 +46,7 @@ interface EditorRSExpressionProps {
onChangeLocalParse: (typification: IExpressionParseDTO) => void; onChangeLocalParse: (typification: IExpressionParseDTO) => void;
onOpenEdit: (cstID: number) => void; onOpenEdit: (cstID: number) => void;
onShowTypeGraph: (event: EventMouse) => void; onShowTypeGraph: (event: React.MouseEvent<Element>) => void;
} }
export function EditorRSExpression({ export function EditorRSExpression({
@ -141,7 +140,7 @@ export function EditorRSExpression({
setIsModified(true); setIsModified(true);
} }
function handleShowAST(event: EventMouse) { function handleShowAST(event: React.MouseEvent<Element>) {
if (event.ctrlKey) { if (event.ctrlKey) {
const tree = rslangParser.parse(value); const tree = rslangParser.parse(value);
const ast = transformAST(tree); const ast = transformAST(tree);

View File

@ -2,7 +2,7 @@ import clsx from 'clsx';
import { globalIDs } from '@/utils/constants'; import { globalIDs } from '@/utils/constants';
import { TokenID } from '../../../backend/types'; import { type TokenID } from '../../../backend/types';
import { describeToken, labelToken } from '../../../labels'; import { describeToken, labelToken } from '../../../labels';
interface RSTokenButtonProps { interface RSTokenButtonProps {

View File

@ -1,15 +1,14 @@
import { Overlay } from '@/components/Container'; import { Overlay } from '@/components/Container';
import { MiniButton } from '@/components/Control'; import { MiniButton } from '@/components/Control';
import { IconControls, IconTree, IconTypeGraph } from '@/components/Icons'; import { IconControls, IconTree, IconTypeGraph } from '@/components/Icons';
import { type EventMouse } from '@/components/props';
import { usePreferencesStore } from '@/stores/preferences'; import { usePreferencesStore } from '@/stores/preferences';
import { useMutatingRSForm } from '../../../backend/useMutatingRSForm'; import { useMutatingRSForm } from '../../../backend/useMutatingRSForm';
interface ToolbarRSExpressionProps { interface ToolbarRSExpressionProps {
disabled?: boolean; disabled?: boolean;
showAST: (event: EventMouse) => void; showAST: (event: React.MouseEvent<Element>) => void;
showTypeGraph: (event: EventMouse) => void; showTypeGraph: (event: React.MouseEvent<Element>) => void;
} }
export function ToolbarRSExpression({ disabled, showTypeGraph, showAST }: ToolbarRSExpressionProps) { export function ToolbarRSExpression({ disabled, showTypeGraph, showAST }: ToolbarRSExpressionProps) {

View File

@ -5,7 +5,6 @@ import clsx from 'clsx';
import { TextURL } from '@/components/Control'; import { TextURL } from '@/components/Control';
import { createColumnHelper, DataTable, type RowSelectionState, type VisibilityState } from '@/components/DataTable'; import { createColumnHelper, DataTable, type RowSelectionState, type VisibilityState } from '@/components/DataTable';
import { type EventMouse } from '@/components/props';
import { NoData, TextContent } from '@/components/View'; import { NoData, TextContent } from '@/components/View';
import { useWindowSize } from '@/hooks/useWindowSize'; import { useWindowSize } from '@/hooks/useWindowSize';
import { PARAMETER, prefixes } from '@/utils/constants'; import { PARAMETER, prefixes } from '@/utils/constants';
@ -57,14 +56,14 @@ export function TableRSList({
}); });
}, [windowSize]); }, [windowSize]);
function handleRowClicked(cst: IConstituenta, event: EventMouse) { function handleRowClicked(cst: IConstituenta, event: React.MouseEvent<Element>) {
if (event.altKey) { if (event.altKey) {
event.preventDefault(); event.preventDefault();
onEdit(cst.id); onEdit(cst.id);
} }
} }
function handleRowDoubleClicked(cst: IConstituenta, event: EventMouse) { function handleRowDoubleClicked(cst: IConstituenta, event: React.MouseEvent<Element>) {
event.preventDefault(); event.preventDefault();
onEdit(cst.id); onEdit(cst.id);
} }

View File

@ -20,7 +20,6 @@ import { toPng } from 'html-to-image';
import { useDebounce } from 'use-debounce'; import { useDebounce } from 'use-debounce';
import { Overlay } from '@/components/Container'; import { Overlay } from '@/components/Container';
import { type EventMouse } from '@/components/props';
import { useMainHeight } from '@/stores/appLayout'; import { useMainHeight } from '@/stores/appLayout';
import { useDialogsStore } from '@/stores/dialogs'; import { useDialogsStore } from '@/stores/dialogs';
import { APP_COLORS } from '@/styling/colors'; import { APP_COLORS } from '@/styling/colors';
@ -274,19 +273,19 @@ export function TGFlow() {
} }
} }
function handleNodeContextMenu(event: EventMouse, cstID: number) { function handleNodeContextMenu(event: React.MouseEvent, cstID: number) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
handleSetFocus(cstID); handleSetFocus(cstID);
} }
function handleNodeDoubleClick(event: EventMouse, cstID: number) { function handleNodeDoubleClick(event: React.MouseEvent, cstID: number) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
navigateCst(cstID); navigateCst(cstID);
} }
function handleNodeEnter(event: EventMouse, cstID: number) { function handleNodeEnter(event: React.MouseEvent, cstID: number) {
setHoverID(cstID); setHoverID(cstID);
setHoverLeft( setHoverLeft(
event.clientX / window.innerWidth >= PARAMETER.graphHoverXLimit || event.clientX / window.innerWidth >= PARAMETER.graphHoverXLimit ||

View File

@ -5,7 +5,6 @@ import clsx from 'clsx';
import { Overlay } from '@/components/Container'; import { Overlay } from '@/components/Container';
import { MiniButton } from '@/components/Control'; import { MiniButton } from '@/components/Control';
import { IconDropArrow, IconDropArrowUp } from '@/components/Icons'; import { IconDropArrow, IconDropArrowUp } from '@/components/Icons';
import { type EventMouse } from '@/components/props';
import { useWindowSize } from '@/hooks/useWindowSize'; import { useWindowSize } from '@/hooks/useWindowSize';
import { useFitHeight } from '@/stores/appLayout'; import { useFitHeight } from '@/stores/appLayout';
import { useTooltipsStore } from '@/stores/tooltips'; import { useTooltipsStore } from '@/stores/tooltips';
@ -37,7 +36,7 @@ export function ViewHidden({ items, selected, toggleSelection, setFocus, schema,
const setActiveCst = useTooltipsStore(state => state.setActiveCst); const setActiveCst = useTooltipsStore(state => state.setActiveCst);
const hiddenHeight = useFitHeight(windowSize.isSmall ? '10.4rem + 2px' : '12.5rem + 2px'); const hiddenHeight = useFitHeight(windowSize.isSmall ? '10.4rem + 2px' : '12.5rem + 2px');
function handleClick(cstID: number, event: EventMouse) { function handleClick(cstID: number, event: React.MouseEvent<Element>) {
if (event.ctrlKey || event.metaKey) { if (event.ctrlKey || event.metaKey) {
setFocus(cstID); setFocus(cstID);
} else { } else {

View File

@ -170,10 +170,6 @@
gap: 0.25rem; gap: 0.25rem;
} }
@utility cc-fit-content {
field-sizing: content;
}
@utility cc-scroll-row { @utility cc-scroll-row {
scroll-snap-align: start; scroll-snap-align: start;
scroll-snap-stop: always; scroll-snap-stop: always;
@ -229,4 +225,4 @@
transition-property: color, background-color; transition-property: color, background-color;
transition-timing-function: var(--transition-bezier); transition-timing-function: var(--transition-bezier);
transition-duration: var(--duration-select); transition-duration: var(--duration-select);
} }

View File

@ -2,8 +2,8 @@
* Module: CodeMirror customizations. * Module: CodeMirror customizations.
*/ */
import { syntaxTree } from '@codemirror/language'; import { syntaxTree } from '@codemirror/language';
import { NodeType, Tree, TreeCursor } from '@lezer/common'; import { type NodeType, type Tree, type TreeCursor } from '@lezer/common';
import { type ReactCodeMirrorRef, SelectionRange } from '@uiw/react-codemirror'; import { type ReactCodeMirrorRef, type SelectionRange } from '@uiw/react-codemirror';
/** /**
* Represents syntax tree node data. * Represents syntax tree node data.

View File

@ -3,7 +3,7 @@
*/ */
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import { AxiosError, type AxiosHeaderValue, type AxiosResponse, isAxiosError } from 'axios'; import { type AxiosError, type AxiosHeaderValue, type AxiosResponse, isAxiosError } from 'axios';
import { infoMsg, promptText } from './labels'; import { infoMsg, promptText } from './labels';

View File

@ -1,4 +1,4 @@
import { Page } from '@playwright/test'; import { type Page } from '@playwright/test';
import { BACKEND_URL } from '../constants'; import { BACKEND_URL } from '../constants';

View File

@ -2,7 +2,7 @@ import path from 'path';
import tailwindcss from '@tailwindcss/vite'; import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import { defineConfig, loadEnv, PluginOption } from 'vite'; import { defineConfig, loadEnv, type PluginOption } from 'vite';
import { dependencies } from './package.json'; import { dependencies } from './package.json';
@ -27,10 +27,10 @@ export default ({ mode }: { mode: string }) => {
}; };
return defineConfig({ return defineConfig({
appType: 'spa', appType: 'spa',
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
plugins: [ plugins: [
tailwindcss(), tailwindcss(),
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
react({ react({
babel: { babel: {
plugins: [['babel-plugin-react-compiler', reactCompilerConfig]] plugins: [['babel-plugin-react-compiler', reactCompilerConfig]]