Move "core" folder out of "features" into "base"

This commit is contained in:
schroda
2025-08-16 02:48:46 +02:00
parent f4c06d474d
commit 9e5af57a5f
311 changed files with 712 additions and 727 deletions

76
src/base/Base.types.ts Normal file
View File

@@ -0,0 +1,76 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { ReactNode } from 'react';
import { ParseKeys } from 'i18next';
export enum GridLayout {
Compact = 0,
Comfortable = 1,
List = 2,
}
export enum DirectionOffset {
PREVIOUS = -1,
NEXT = 1,
}
export type NullAndUndefined<T> = T | null | undefined;
export type TranslationKey = ParseKeys;
interface DisplayDataTranslationKey {
isTitleString?: never;
title: TranslationKey;
icon: ReactNode;
}
interface DisplayDataString {
isTitleString: true;
title: string;
icon: ReactNode;
}
type DisplayData = DisplayDataTranslationKey | DisplayDataString;
export type ValueToDisplayData<Value extends string | number> = Record<Value, DisplayData>;
export interface MultiValueButtonBaseProps<Value extends string | number> {
tooltip?: string;
value: Value;
defaultValue?: Value;
values: Value[];
setValue: (value: Value) => void;
valueToDisplayData: ValueToDisplayData<Value>;
}
export interface MultiValueButtonDefaultableProps<Value extends string | number>
extends OptionalProperty<MultiValueButtonBaseProps<Value>, 'value'> {
isDefaultable?: boolean;
onDefault?: () => void;
}
export type MultiValueButtonProps<Value extends string | number> =
| (MultiValueButtonBaseProps<Value> & PropertiesNever<MultiValueButtonDefaultableProps<Value>>)
| MultiValueButtonDefaultableProps<Value>;
export enum ScrollOffset {
BACKWARD,
FORWARD,
}
export enum ScrollDirection {
X,
Y,
XY,
}
export enum SearchParam {
TAB = 'tab',
QUERY = 'query',
}