-
Notifications
You must be signed in to change notification settings - Fork 1
/
ThemeTypes.ts
102 lines (88 loc) · 2.04 KB
/
ThemeTypes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { Dispatch, SetStateAction } from "react";
export interface Theme {
id: string;
enabled: boolean; // used to be called checked
name: string;
display_name?: string;
author: string;
bundled: boolean; // deprecated
require: number;
version: string;
patches: Patch[];
dependencies: string[];
flags: Flags[];
created: number;
modified: number;
}
export interface ThemePatchComponent {
name: string;
on: string;
type: string;
value: string;
}
export interface Patch {
default: string;
name: string;
type: "dropdown" | "checkbox" | "slider" | "none";
value: string;
options: string[];
components: ThemePatchComponent[];
}
export enum Flags {
"isPreset" = "PRESET",
"dontDisableDeps" = "KEEP_DEPENDENCIES",
"optionalDeps" = "OPTIONAL_DEPENDENCIES",
}
// API TYPES
export interface UserInfo {
id: string;
username: string;
avatar: string;
}
export interface MinimalCSSThemeInfo {
id: string;
name: string;
version: string;
target: string;
manifestVersion: number;
specifiedAuthor: string;
type: "Css" | "Audio";
}
export type BlobType = "Zip" | "Jpg";
export interface APIBlob {
id: string;
blobType: BlobType;
uploaded: Date;
downloadCount: number;
}
export interface PartialCSSThemeInfo extends MinimalCSSThemeInfo {
images: APIBlob[];
download: APIBlob;
author: UserInfo;
submitted: Date;
updated: Date;
starCount: number;
}
export interface FullCSSThemeInfo extends PartialCSSThemeInfo {
dependencies: MinimalCSSThemeInfo[];
approved: boolean;
disabled: boolean;
description: string;
source?: string;
}
export enum Permissions {
"editAny" = "EditAnyPost",
"approveSubs" = "ApproveThemeSubmissions",
"viewSubs" = "ViewThemeSubmissions",
"admin" = "ManageApi",
}
export interface AccountData extends UserInfo {
permissions: Permissions[];
}
export interface StarredThemeList {
total: number;
items: PartialCSSThemeInfo[];
}
type ThemeErrorTitle = string;
type ThemeErrorDescription = string;
export type ThemeError = [ThemeErrorTitle, ThemeErrorDescription];