2021-01-14 18:07:05 +00:00
|
|
|
// Copyright 2018-2021 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-03-11 23:14:32 +00:00
|
|
|
import type { UUIDStringType } from './UUID';
|
|
|
|
|
2021-01-14 18:07:05 +00:00
|
|
|
export type BodyRangeType = {
|
2020-09-16 22:42:48 +00:00
|
|
|
start: number;
|
|
|
|
length: number;
|
2021-07-09 19:36:10 +00:00
|
|
|
mentionUuid?: string;
|
|
|
|
replacementText?: string;
|
2020-09-16 22:42:48 +00:00
|
|
|
conversationID?: string;
|
2021-01-14 18:07:05 +00:00
|
|
|
};
|
2020-11-03 01:19:52 +00:00
|
|
|
|
|
|
|
export type BodyRangesType = Array<BodyRangeType>;
|
2020-09-16 22:42:48 +00:00
|
|
|
|
2022-03-11 23:14:32 +00:00
|
|
|
export type StoryContextType = {
|
|
|
|
authorUuid?: UUIDStringType;
|
|
|
|
timestamp: number;
|
|
|
|
};
|
|
|
|
|
2020-01-08 17:44:54 +00:00
|
|
|
export type RenderTextCallbackType = (options: {
|
|
|
|
text: string;
|
|
|
|
key: number;
|
|
|
|
}) => JSX.Element | string;
|
2018-05-18 21:48:20 +00:00
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
export type ReplacementValuesType =
|
|
|
|
| Array<string>
|
|
|
|
| {
|
|
|
|
[key: string]: string | number | undefined;
|
|
|
|
};
|
2020-07-29 23:20:05 +00:00
|
|
|
|
2021-05-03 23:24:40 +00:00
|
|
|
export type LocalizerType = {
|
2022-06-13 21:39:35 +00:00
|
|
|
(key: string, values?: ReplacementValuesType): string;
|
2021-05-03 23:24:40 +00:00
|
|
|
getLocale(): string;
|
|
|
|
};
|
2021-02-12 01:50:11 +00:00
|
|
|
|
|
|
|
export enum ThemeType {
|
|
|
|
'light' = 'light',
|
|
|
|
'dark' = 'dark',
|
|
|
|
}
|
2021-04-02 22:32:55 +00:00
|
|
|
|
|
|
|
// These are strings so they can be interpolated into class names.
|
|
|
|
export enum ScrollBehavior {
|
|
|
|
Default = 'default',
|
|
|
|
Hard = 'hard',
|
|
|
|
}
|
2021-08-11 16:23:21 +00:00
|
|
|
|
|
|
|
type InternalAssertProps<
|
|
|
|
Result,
|
|
|
|
Value,
|
|
|
|
Missing = Omit<Result, keyof Value>
|
|
|
|
> = keyof Missing extends never
|
|
|
|
? Result
|
2021-11-11 22:43:05 +00:00
|
|
|
: Result & {
|
|
|
|
[key in keyof Required<Missing>]: [
|
|
|
|
never,
|
|
|
|
'AssertProps: missing property'
|
|
|
|
];
|
|
|
|
};
|
2021-08-11 16:23:21 +00:00
|
|
|
|
|
|
|
export type AssertProps<Result, Value> = InternalAssertProps<Result, Value>;
|
2021-08-18 20:08:14 +00:00
|
|
|
|
|
|
|
export type UnwrapPromise<Value> = Value extends Promise<infer T> ? T : Value;
|
2022-07-28 16:35:29 +00:00
|
|
|
|
|
|
|
export type BytesToStrings<Value> = Value extends Uint8Array
|
|
|
|
? string
|
|
|
|
: { [Key in keyof Value]: BytesToStrings<Value[Key]> };
|