diff options
author | Zero~Informatique | 2021-07-02 22:53:16 +0200 |
---|---|---|
committer | Zero~Informatique | 2021-07-03 00:05:22 +0200 |
commit | 9165cc1efcf7791f78b61b2c51a9de651b1b09aa (patch) | |
tree | 111cfdc74ddaf7b19ff27508f16ab84694b27670 /viewer | |
parent | 08ac32103fb5f8cca1861267dfd07a7c0d2faf62 (diff) | |
download | ldgallery-9165cc1efcf7791f78b61b2c51a9de651b1b09aa.tar.gz |
viewer: types normalization - gallery.d.ts
GitHub: closes #301
Diffstat (limited to 'viewer')
32 files changed, 204 insertions, 188 deletions
diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index e9b80e6..d9e7534 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts | |||
@@ -17,98 +17,99 @@ | |||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | 17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | declare namespace Gallery { | 20 | import { ItemType } from "./ItemType"; |
21 | type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; | ||
22 | 21 | ||
23 | interface Config { | 22 | export type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; |
24 | galleryRoot: string; | ||
25 | galleryIndex?: string; | ||
26 | initialItemSort?: ItemSortStr; | ||
27 | initialTagDisplayLimit?: number; | ||
28 | } | ||
29 | 23 | ||
30 | interface GalleryProperties { | 24 | export interface Config { |
31 | galleryTitle: string; | 25 | galleryRoot: string; |
32 | tagCategories: RawTag[]; | 26 | galleryIndex?: string; |
33 | } | 27 | initialItemSort?: ItemSortStr; |
34 | interface Index { | 28 | initialTagDisplayLimit?: number; |
35 | properties: GalleryProperties; | 29 | } |
36 | tree: Directory; | 30 | |
37 | } | 31 | export interface Properties { |
32 | galleryTitle: string; | ||
33 | tagCategories: RawTag[]; | ||
34 | } | ||
35 | export interface Index { | ||
36 | properties: Properties; | ||
37 | tree: DirectoryItem; | ||
38 | } | ||
39 | |||
40 | export interface OtherItem extends Item { | ||
41 | properties: OtherProperties; | ||
42 | } | ||
43 | export interface PictureItem extends Item { | ||
44 | properties: PictureProperties; | ||
45 | } | ||
46 | export interface PlainTextItem extends Item { | ||
47 | properties: PlainTextProperties; | ||
48 | } | ||
49 | export interface PDFItem extends Item { | ||
50 | properties: PDFProperties; | ||
51 | } | ||
52 | export interface VideoItem extends Item { | ||
53 | properties: VideoProperties; | ||
54 | } | ||
55 | export interface AudioItem extends Item { | ||
56 | properties: AudioProperties; | ||
57 | } | ||
58 | export interface DirectoryItem extends Item { | ||
59 | properties: DirectoryProperties; | ||
60 | } | ||
61 | export interface Item { | ||
62 | title: string; | ||
63 | datetime: string; | ||
64 | description: string; | ||
65 | tags: RawTag[]; | ||
66 | path: string; | ||
67 | thumbnail?: Thumbnail; | ||
68 | properties: | ||
69 | | OtherProperties | ||
70 | | PictureProperties | ||
71 | | PlainTextProperties | ||
72 | | PDFProperties | ||
73 | | VideoProperties | ||
74 | | AudioProperties | ||
75 | | DirectoryProperties; | ||
76 | } | ||
77 | export interface Resolution { | ||
78 | width: number; | ||
79 | height: number; | ||
80 | } | ||
81 | export interface OtherProperties { | ||
82 | type: ItemType.OTHER; | ||
83 | resource: string; | ||
84 | } | ||
85 | export interface PictureProperties { | ||
86 | type: ItemType.PICTURE; | ||
87 | resource: string; | ||
88 | resolution: Resolution; | ||
89 | } | ||
90 | export interface PlainTextProperties { | ||
91 | type: ItemType.PLAINTEXT; | ||
92 | resource: string; | ||
93 | } | ||
94 | export interface PDFProperties { | ||
95 | type: ItemType.PDF; | ||
96 | resource: string; | ||
97 | } | ||
98 | export interface VideoProperties { | ||
99 | type: ItemType.VIDEO; | ||
100 | resource: string; | ||
101 | } | ||
102 | export interface AudioProperties { | ||
103 | type: ItemType.AUDIO; | ||
104 | resource: string; | ||
105 | } | ||
106 | export interface DirectoryProperties { | ||
107 | type: ItemType.DIRECTORY; | ||
108 | items: Item[]; | ||
109 | } | ||
38 | 110 | ||
39 | interface Other extends Item { | 111 | export interface Thumbnail { |
40 | properties: OtherProperties; | 112 | resource: string; |
41 | } | 113 | resolution: Resolution; |
42 | interface Picture extends Item { | ||
43 | properties: PictureProperties; | ||
44 | } | ||
45 | interface PlainText extends Item { | ||
46 | properties: PlainTextProperties; | ||
47 | } | ||
48 | interface PDF extends Item { | ||
49 | properties: PDFProperties; | ||
50 | } | ||
51 | interface Video extends Item { | ||
52 | properties: VideoProperties; | ||
53 | } | ||
54 | interface Audio extends Item { | ||
55 | properties: AudioProperties; | ||
56 | } | ||
57 | interface Directory extends Item { | ||
58 | properties: DirectoryProperties; | ||
59 | } | ||
60 | interface Item { | ||
61 | title: string; | ||
62 | datetime: string; | ||
63 | description: string; | ||
64 | tags: RawTag[]; | ||
65 | path: string; | ||
66 | thumbnail?: Thumbnail; | ||
67 | properties: | ||
68 | | OtherProperties | ||
69 | | PictureProperties | ||
70 | | PlainTextProperties | ||
71 | | PDFProperties | ||
72 | | VideoProperties | ||
73 | | AudioProperties | ||
74 | | DirectoryProperties; | ||
75 | } | ||
76 | interface Resolution { | ||
77 | width: number; | ||
78 | height: number; | ||
79 | } | ||
80 | interface OtherProperties { | ||
81 | type: import("./ItemType").ItemType.OTHER; | ||
82 | resource: string; | ||
83 | } | ||
84 | interface PictureProperties { | ||
85 | type: import("./ItemType").ItemType.PICTURE; | ||
86 | resource: string; | ||
87 | resolution: Resolution; | ||
88 | } | ||
89 | interface PlainTextProperties { | ||
90 | type: import("./ItemType").ItemType.PLAINTEXT; | ||
91 | resource: string; | ||
92 | } | ||
93 | interface PDFProperties { | ||
94 | type: import("./ItemType").ItemType.PDF; | ||
95 | resource: string; | ||
96 | } | ||
97 | interface VideoProperties { | ||
98 | type: import("./ItemType").ItemType.VIDEO; | ||
99 | resource: string; | ||
100 | } | ||
101 | interface AudioProperties { | ||
102 | type: import("./ItemType").ItemType.AUDIO; | ||
103 | resource: string; | ||
104 | } | ||
105 | interface DirectoryProperties { | ||
106 | type: import("./ItemType").ItemType.DIRECTORY; | ||
107 | items: Item[]; | ||
108 | } | ||
109 | interface Thumbnail { |