From 9165cc1efcf7791f78b61b2c51a9de651b1b09aa Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 2 Jul 2021 22:53:16 +0200 Subject: viewer: types normalization - gallery.d.ts GitHub: closes #301 --- viewer/src/@types/gallery.d.ts | 183 +++++++++++++++++++++-------------------- viewer/src/@types/tag.d.ts | 6 +- 2 files changed, 95 insertions(+), 94 deletions(-) (limited to 'viewer/src/@types') 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 @@ -- along with this program. If not, see . */ -declare namespace Gallery { - type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; +import { ItemType } from "./ItemType"; - interface Config { - galleryRoot: string; - galleryIndex?: string; - initialItemSort?: ItemSortStr; - initialTagDisplayLimit?: number; - } +export type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; - interface GalleryProperties { - galleryTitle: string; - tagCategories: RawTag[]; - } - interface Index { - properties: GalleryProperties; - tree: Directory; - } +export interface Config { + galleryRoot: string; + galleryIndex?: string; + initialItemSort?: ItemSortStr; + initialTagDisplayLimit?: number; +} + +export interface Properties { + galleryTitle: string; + tagCategories: RawTag[]; +} +export interface Index { + properties: Properties; + tree: DirectoryItem; +} + +export interface OtherItem extends Item { + properties: OtherProperties; +} +export interface PictureItem extends Item { + properties: PictureProperties; +} +export interface PlainTextItem extends Item { + properties: PlainTextProperties; +} +export interface PDFItem extends Item { + properties: PDFProperties; +} +export interface VideoItem extends Item { + properties: VideoProperties; +} +export interface AudioItem extends Item { + properties: AudioProperties; +} +export interface DirectoryItem extends Item { + properties: DirectoryProperties; +} +export interface Item { + title: string; + datetime: string; + description: string; + tags: RawTag[]; + path: string; + thumbnail?: Thumbnail; + properties: + | OtherProperties + | PictureProperties + | PlainTextProperties + | PDFProperties + | VideoProperties + | AudioProperties + | DirectoryProperties; +} +export interface Resolution { + width: number; + height: number; +} +export interface OtherProperties { + type: ItemType.OTHER; + resource: string; +} +export interface PictureProperties { + type: ItemType.PICTURE; + resource: string; + resolution: Resolution; +} +export interface PlainTextProperties { + type: ItemType.PLAINTEXT; + resource: string; +} +export interface PDFProperties { + type: ItemType.PDF; + resource: string; +} +export interface VideoProperties { + type: ItemType.VIDEO; + resource: string; +} +export interface AudioProperties { + type: ItemType.AUDIO; + resource: string; +} +export interface DirectoryProperties { + type: ItemType.DIRECTORY; + items: Item[]; +} - interface Other extends Item { - properties: OtherProperties; - } - interface Picture extends Item { - properties: PictureProperties; - } - interface PlainText extends Item { - properties: PlainTextProperties; - } - interface PDF extends Item { - properties: PDFProperties; - } - interface Video extends Item { - properties: VideoProperties; - } - interface Audio extends Item { - properties: AudioProperties; - } - interface Directory extends Item { - properties: DirectoryProperties; - } - interface Item { - title: string; - datetime: string; - description: string; - tags: RawTag[]; - path: string; - thumbnail?: Thumbnail; - properties: - | OtherProperties - | PictureProperties - | PlainTextProperties - | PDFProperties - | VideoProperties - | AudioProperties - | DirectoryProperties; - } - interface Resolution { - width: number; - height: number; - } - interface OtherProperties { - type: import("./ItemType").ItemType.OTHER; - resource: string; - } - interface PictureProperties { - type: import("./ItemType").ItemType.PICTURE; - resource: string; - resolution: Resolution; - } - interface PlainTextProperties { - type: import("./ItemType").ItemType.PLAINTEXT; - resource: string; - } - interface PDFProperties { - type: import("./ItemType").ItemType.PDF; - resource: string; - } - interface VideoProperties { - type: import("./ItemType").ItemType.VIDEO; - resource: string; - } - interface AudioProperties { - type: import("./ItemType").ItemType.AUDIO; - resource: string; - } - interface DirectoryProperties { - type: import("./ItemType").ItemType.DIRECTORY; - items: Item[]; - } - interface Thumbnail { - resource: string; - resolution: Resolution; - } - type RawTag = string; +export interface Thumbnail { + resource: string; + resolution: Resolution; } +export type RawTag = string; diff --git a/viewer/src/@types/tag.d.ts b/viewer/src/@types/tag.d.ts index 59ae779..bb908d3 100644 --- a/viewer/src/@types/tag.d.ts +++ b/viewer/src/@types/tag.d.ts @@ -19,11 +19,11 @@ declare namespace Tag { interface Node { - tag: Gallery.RawTag; - tagfiltered: Gallery.RawTag; + tag: RawTag; + tagfiltered: RawTag; rootPart: boolean; childPart: boolean; - items: Gallery.Item[]; + items: Item[]; children: Index; } interface Search extends Node { -- cgit v1.2.3 From 92cb34b719b481faf417760f307241e8f6d777a9 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 2 Jul 2021 22:59:56 +0200 Subject: viewer: types normalization - tag.d.ts GitHub: closes #301 --- viewer/src/@types/tag.d.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'viewer/src/@types') diff --git a/viewer/src/@types/tag.d.ts b/viewer/src/@types/tag.d.ts index bb908d3..9ed2c04 100644 --- a/viewer/src/@types/tag.d.ts +++ b/viewer/src/@types/tag.d.ts @@ -17,25 +17,25 @@ -- along with this program. If not, see . */ -declare namespace Tag { - interface Node { - tag: RawTag; - tagfiltered: RawTag; - rootPart: boolean; - childPart: boolean; - items: Item[]; - children: Index; - } - interface Search extends Node { - parent?: Node; - operation: string; // Enum Operation - display: string; - } - type SearchByOperation = Record; - type Index = Record; +import { Item, RawTag } from "./gallery"; - interface Category { - tag: string; - index: Index; - } +export interface TagNode { + tag: RawTag; + tagfiltered: RawTag; + rootPart: boolean; + childPart: boolean; + items: Item[]; + children: TagIndex; +} +export interface TagSearch extends TagNode { + parent?: TagNode; + operation: string; // Enum Operation + display: string; +} +export type TagSearchByOperation = Record; +export type TagIndex = Record; + +export interface TagCategory { + tag: string; + index: TagIndex; } -- cgit v1.2.3 From 4fa86b565c2055f11e87991b61ba3844c3da8894 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 2 Jul 2021 23:04:32 +0200 Subject: viewer: types normalization - ItemType.ts GitHub: closes #301 --- viewer/src/@types/ItemType.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'viewer/src/@types') 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 @@ -// TODO: Convert all ambiant types related to LdGallery to modules +/* ldgallery - A static generator which turns a collection of tagged +-- pictures into a searchable web gallery. +-- +-- Copyright (C) 2019-2021 Guillaume FOUET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Affero General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see . +*/ export enum ItemType { OTHER = "other", -- cgit v1.2.3 From 1f0377c1b4c2959c73fe4e368673f057ef369917 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 2 Jul 2021 23:04:52 +0200 Subject: viewer: types normalization - scrollposition.d.ts GitHub: closes #301 --- viewer/src/@types/scrollposition.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'viewer/src/@types') 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 @@ -- along with this program. If not, see . */ -type ScrollPosition = Record; +export type ScrollPosition = Record; -- cgit v1.2.3