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 +- viewer/src/components/LdBreadcrumb.vue | 7 +- viewer/src/components/LdCommand.vue | 5 +- viewer/src/components/LdCommandSort.vue | 2 +- viewer/src/components/LdGallery.vue | 6 +- viewer/src/components/LdInformation.vue | 5 +- viewer/src/components/LdKeyPress.vue | 2 +- viewer/src/components/LdProposition.vue | 9 +- viewer/src/components/LdTagInput.vue | 4 +- viewer/src/components/LdThumbnail.vue | 5 +- viewer/src/components/LdTitle.vue | 5 +- .../src/components/item_handlers/LdAudioViewer.vue | 5 +- .../src/components/item_handlers/LdDirectory.vue | 42 ----- .../components/item_handlers/LdDirectoryViewer.vue | 43 +++++ viewer/src/components/item_handlers/LdDownload.vue | 57 ------- .../components/item_handlers/LdDownloadViewer.vue | 58 +++++++ .../src/components/item_handlers/LdPdfViewer.vue | 3 +- viewer/src/components/item_handlers/LdPicture.vue | 127 -------------- .../components/item_handlers/LdPictureViewer.vue | 128 ++++++++++++++ .../components/item_handlers/LdPlainTextViewer.vue | 3 +- .../src/components/item_handlers/LdVideoViewer.vue | 3 +- viewer/src/main.ts | 4 +- viewer/src/services/indexfactory.ts | 13 +- viewer/src/services/indexsearch.ts | 17 +- viewer/src/services/itemComparators.ts | 13 +- viewer/src/services/ldzoom.ts | 7 +- viewer/src/services/navigation.ts | 15 +- viewer/src/store/galleryStore.ts | 15 +- viewer/src/store/index.ts | 7 +- viewer/src/store/uiStore.ts | 5 +- viewer/src/views/GalleryNavigation.vue | 8 +- viewer/src/views/GallerySearch.vue | 3 +- viewer/src/views/MainLayout.vue | 4 +- viewer/src/views/PanelLeft.vue | 5 +- 35 files changed, 420 insertions(+), 404 deletions(-) delete mode 100644 viewer/src/components/item_handlers/LdDirectory.vue create mode 100644 viewer/src/components/item_handlers/LdDirectoryViewer.vue delete mode 100644 viewer/src/components/item_handlers/LdDownload.vue create mode 100644 viewer/src/components/item_handlers/LdDownloadViewer.vue delete mode 100644 viewer/src/components/item_handlers/LdPicture.vue create mode 100644 viewer/src/components/item_handlers/LdPictureViewer.vue 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 { diff --git a/viewer/src/components/LdBreadcrumb.vue b/viewer/src/components/LdBreadcrumb.vue index 618b15a..2c17554 100644 --- a/viewer/src/components/LdBreadcrumb.vue +++ b/viewer/src/components/LdBreadcrumb.vue @@ -47,13 +47,14 @@ - - diff --git a/viewer/src/components/item_handlers/LdDirectoryViewer.vue b/viewer/src/components/item_handlers/LdDirectoryViewer.vue new file mode 100644 index 0000000..7440f54 --- /dev/null +++ b/viewer/src/components/item_handlers/LdDirectoryViewer.vue @@ -0,0 +1,43 @@ + + + + + + + diff --git a/viewer/src/components/item_handlers/LdDownload.vue b/viewer/src/components/item_handlers/LdDownload.vue deleted file mode 100644 index 7b09dab..0000000 --- a/viewer/src/components/item_handlers/LdDownload.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - diff --git a/viewer/src/components/item_handlers/LdDownloadViewer.vue b/viewer/src/components/item_handlers/LdDownloadViewer.vue new file mode 100644 index 0000000..60c7c49 --- /dev/null +++ b/viewer/src/components/item_handlers/LdDownloadViewer.vue @@ -0,0 +1,58 @@ + + + + + + + diff --git a/viewer/src/components/item_handlers/LdPdfViewer.vue b/viewer/src/components/item_handlers/LdPdfViewer.vue index 462c463..e55989a 100644 --- a/viewer/src/components/item_handlers/LdPdfViewer.vue +++ b/viewer/src/components/item_handlers/LdPdfViewer.vue @@ -30,11 +30,12 @@ - - diff --git a/viewer/src/components/item_handlers/LdPictureViewer.vue b/viewer/src/components/item_handlers/LdPictureViewer.vue new file mode 100644 index 0000000..003ffe9 --- /dev/null +++ b/viewer/src/components/item_handlers/LdPictureViewer.vue @@ -0,0 +1,128 @@ + + + + + + + diff --git a/viewer/src/components/item_handlers/LdPlainTextViewer.vue b/viewer/src/components/item_handlers/LdPlainTextViewer.vue index cd26d9d..79465d5 100644 --- a/viewer/src/components/item_handlers/LdPlainTextViewer.vue +++ b/viewer/src/components/item_handlers/LdPlainTextViewer.vue @@ -27,11 +27,12 @@