diff options
Diffstat (limited to 'viewer/src')
48 files changed, 1077 insertions, 256 deletions
diff --git a/viewer/src/@types/ItemType.ts b/viewer/src/@types/ItemType.ts new file mode 100644 index 0000000..31a395b --- /dev/null +++ b/viewer/src/@types/ItemType.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | // TODO: Convert all ambiant types related to LdGallery to modules | ||
2 | |||
3 | export enum ItemType { | ||
4 | OTHER = "other", | ||
5 | PICTURE = "picture", | ||
6 | PLAINTEXT = "plaintext", | ||
7 | PDF = "pdf", | ||
8 | VIDEO = "video", | ||
9 | AUDIO = "audio", | ||
10 | DIRECTORY = "directory", | ||
11 | } | ||
diff --git a/viewer/src/@types/Operation.ts b/viewer/src/@types/Operation.ts index e7aad27..e566f4b 100644 --- a/viewer/src/@types/Operation.ts +++ b/viewer/src/@types/Operation.ts | |||
@@ -21,4 +21,4 @@ export enum Operation { | |||
21 | INTERSECTION = "", | 21 | INTERSECTION = "", |
22 | ADDITION = "+", | 22 | ADDITION = "+", |
23 | SUBSTRACTION = "-", | 23 | SUBSTRACTION = "-", |
24 | }; | 24 | } |
diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index 066aedf..e9b80e6 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts | |||
@@ -18,57 +18,97 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | declare namespace Gallery { | 20 | declare namespace Gallery { |
21 | type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; | ||
22 | |||
21 | interface Config { | 23 | interface Config { |
22 | galleryRoot: string, | 24 | galleryRoot: string; |
25 | galleryIndex?: string; | ||
26 | initialItemSort?: ItemSortStr; | ||
27 | initialTagDisplayLimit?: number; | ||
23 | } | 28 | } |
24 | 29 | ||
25 | interface GalleryProperties { | 30 | interface GalleryProperties { |
26 | galleryTitle: string, | 31 | galleryTitle: string; |
27 | tagCategories: RawTag[] | 32 | tagCategories: RawTag[]; |
28 | } | 33 | } |
29 | interface Index { | 34 | interface Index { |
30 | properties: GalleryProperties, | 35 | properties: GalleryProperties; |
31 | tree: Directory | 36 | tree: Directory; |
32 | } | 37 | } |
33 | 38 | ||
34 | interface Other extends Item { | 39 | interface Other extends Item { |
35 | properties: OtherProperties, | 40 | properties: OtherProperties; |
36 | } | 41 | } |
37 | interface Picture extends Item { | 42 | interface Picture extends Item { |
38 | properties: PictureProperties, | 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; | ||
39 | } | 56 | } |
40 | interface Directory extends Item { | 57 | interface Directory extends Item { |
41 | properties: DirectoryProperties, | 58 | properties: DirectoryProperties; |
42 | } | 59 | } |
43 | interface Item { | 60 | interface Item { |
44 | title: string, | 61 | title: string; |
45 | datetime: string, | 62 | datetime: string; |
46 | description: string, | 63 | description: string; |
47 | tags: RawTag[], | 64 | tags: RawTag[]; |
48 | path: string, | 65 | path: string; |
49 | thumbnail?: Thumbnail | 66 | thumbnail?: Thumbnail; |
50 | properties: OtherProperties | PictureProperties | DirectoryProperties, | 67 | properties: |
68 | | OtherProperties | ||
69 | | PictureProperties | ||
70 | | PlainTextProperties | ||
71 | | PDFProperties | ||
72 | | VideoProperties | ||
73 | | AudioProperties | ||
74 | | DirectoryProperties; | ||
51 | } | 75 | } |
52 | interface Resolution { | 76 | interface Resolution { |
53 | width: number, | 77 | width: number; |
54 | height: number, | 78 | height: number; |
55 | } | 79 | } |
56 | interface OtherProperties { | 80 | interface OtherProperties { |
57 | type: "other", | 81 | type: import("./ItemType").ItemType.OTHER; |
82 | resource: string; | ||
58 | } | 83 | } |
59 | interface PictureProperties { | 84 | interface PictureProperties { |
60 | type: "picture", | 85 | type: import("./ItemType").ItemType.PICTURE; |
61 | resource: string, | 86 | resource: string; |
62 | resolution: Resolution | 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; | ||
63 | } | 104 | } |
64 | interface DirectoryProperties { | 105 | interface DirectoryProperties { |
65 | type: "directory", | 106 | type: import("./ItemType").ItemType.DIRECTORY; |
66 | items: Item[] | 107 | items: Item[]; |
67 | } | 108 | } |
68 | interface Thumbnail { | 109 | interface Thumbnail { |
69 | resource: string, | 110 | resource: string; |
70 | resolution: Resolution | 111 | resolution: Resolution; |
71 | } | 112 | } |
72 | type RawTag = string; | 113 | type RawTag = string; |
73 | type ItemType = "other" | "picture" | "directory"; | ||
74 | } | 114 | } |
diff --git a/viewer/src/@types/scrollposition.d.ts b/viewer/src/@types/scrollposition.d.ts index b2147fa..2f17515 100644 --- a/viewer/src/@types/scrollposition.d.ts +++ b/viewer/src/@types/scrollposition.d.ts | |||
@@ -17,4 +17,4 @@ | |||
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 | type ScrollPosition = { [index: string]: number } | 20 | type ScrollPosition = Record<string, number>; |
diff --git a/viewer/src/@types/tag.d.ts b/viewer/src/@types/tag.d.ts index 76f1207..59ae779 100644 --- a/viewer/src/@types/tag.d.ts +++ b/viewer/src/@types/tag.d.ts | |||
@@ -31,8 +31,8 @@ declare namespace Tag { | |||
31 | operation: string; // Enum Operation | 31 | operation: string; // Enum Operation |
32 | display: string; | 32 | display: string; |
33 | } | 33 | } |
34 | type SearchByOperation = { [index: string]: Tag.Search[] }; | 34 | type SearchByOperation = Record<string, Tag.Search[]>; |
35 | type Index = { [index: string]: Node }; |