aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/@types
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/@types')
-rw-r--r--viewer/src/@types/ItemType.ts19
-rw-r--r--viewer/src/@types/gallery.d.ts183
-rw-r--r--viewer/src/@types/scrollposition.d.ts2
-rw-r--r--viewer/src/@types/tag.d.ts40
4 files changed, 131 insertions, 113 deletions
diff --git a/viewer/src/@types/ItemType.ts b/viewer/src/@types/ItemType.ts
index 31a395b..9974d4e 100644
--- a/viewer/src/@types/ItemType.ts
+++ b/viewer/src/@types/ItemType.ts
@@ -1,4 +1,21 @@
1// TODO: Convert all ambiant types related to LdGallery to modules 1/* ldgallery - A static generator which turns a collection of tagged
2-- pictures into a searchable web gallery.
3--
4-- Copyright (C) 2019-2021 Guillaume FOUET
5--
6-- This program is free software: you can redistribute it and/or modify
7-- it under the terms of the GNU Affero General Public License as
8-- published by the Free Software Foundation, either version 3 of the
9-- License, or (at your option) any later version.
10--
11-- This program is distributed in the hope that it will be useful,
12-- but WITHOUT ANY WARRANTY; without even the implied warranty of
13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-- GNU Affero General Public License for more details.
15--
16-- You should have received a copy of the GNU Affero General Public License
17-- along with this program. If not, see <https://www.gnu.org/licenses/>.
18*/
2 19
3export enum ItemType { 20export enum ItemType {
4 OTHER = "other", 21 OTHER = "other",
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
20declare namespace Gallery { 20import { ItemType } from "./ItemType";
21 type ItemSortStr = "title_asc" | "date_asc" | "date_desc";
22 21
23 interface Config { 22export 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 { 24export 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 } 31export interface Properties {
32 galleryTitle: string;
33 tagCategories: RawTag[];
34}
35export interface Index {
36 properties: Properties;
37 tree: DirectoryItem;
38}
39
40export interface OtherItem extends Item {
41 properties: OtherProperties;
42}
43export interface PictureItem extends Item {
44 properties: PictureProperties;
45}
46export interface PlainTextItem extends Item {
47 properties: PlainTextProperties;
48}
49export interface PDFItem extends Item {
50 properties: PDFProperties;
51}
52export interface VideoItem extends Item {
53 properties: VideoProperties;
54}
55export interface AudioItem extends Item {
56 properties: AudioProperties;
57}
58export interface DirectoryItem extends Item {
59 properties: DirectoryProperties;
60}
61export 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}
77export interface Resolution {
78 width: number;
79 height: number;
80}
81export interface OtherProperties {
82 type: ItemType.OTHER;
83 resource: string;
84}
85export interface PictureProperties {
86 type: ItemType.PICTURE;
87 resource: string;
88 resolution: Resolution;
89}
90export interface PlainTextProperties {
91 type: ItemType.PLAINTEXT;
92 resource: string;
93}
94export interface PDFProperties {
95 type: ItemType.PDF;
96 resource: string;
97}
98export interface VideoProperties {
99 type: ItemType.VIDEO;
100 resource: string;
101}
102export interface AudioProperties {
103 type: ItemType.AUDIO;
104 resource: string;
105}
106export interface DirectoryProperties {
107 type: ItemType.DIRECTORY;
108 items: Item[];
109}
38 110
39 interface Other extends Item { 111export 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 {
110 resource: string;
111 resolution: Resolution;
112 }
113 type RawTag = string;
114} 114}
115export type RawTag = string;
diff --git a/viewer/src/@types/scrollposition.d.ts b/viewer/src/@types/scrollposition.d.ts
index 2f17515..0102eab 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
20type ScrollPosition = Record<string, number>; 20export type ScrollPosition = Record<string, number>;
diff --git a/viewer/src/@types/tag.d.ts b/viewer/src/@types/tag.d.ts
index 59ae779..9ed2c04 100644
--- a/viewer/src/@types/tag.d.ts
+++ b/viewer/src/@types/tag.d.ts
@@ -17,25 +17,25 @@
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
20declare namespace Tag { 20import { Item, RawTag } from "./gallery";
21 interface Node {
22 tag: Gallery.RawTag;
23 tagfiltered: Gallery.RawTag;
24 rootPart: boolean;
25 childPart: boolean;
26 items: Gallery.Item[];