From 4de74e0af16b370c83f7cfa111c5298cee1e0d26 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sun, 29 Oct 2023 17:30:11 -0700 Subject: [PATCH] refactor: change types import strategy Signed-off-by: Varun Patil --- .gitignore | 1 + src/components/ClusterGrid.vue | 2 +- src/components/ClusterHList.vue | 2 +- src/components/ClusterView.vue | 2 +- src/components/Explore.vue | 2 +- src/components/FirstStart.vue | 2 +- src/components/Metadata.vue | 2 +- src/components/ScrollerManager.vue | 4 +- src/components/SelectionManager.vue | 4 +- src/components/Settings.vue | 2 +- src/components/Sidebar.vue | 2 +- src/components/Timeline.vue | 12 +- src/components/admin/AdminMain.vue | 2 +- src/components/admin/AdminMixin.ts | 2 +- src/components/admin/AdminTypes.ts | 2 +- src/components/frame/Cluster.vue | 2 +- src/components/frame/Folder.vue | 2 +- src/components/frame/Photo.vue | 2 +- src/components/frame/RowHead.vue | 2 +- src/components/modal/AddToAlbumModal.vue | 2 +- src/components/modal/AlbumPicker.vue | 2 +- src/components/modal/AlbumsList.vue | 2 +- src/components/modal/EditDate.vue | 2 +- src/components/modal/EditExif.vue | 2 +- src/components/modal/EditLocation.vue | 2 +- src/components/modal/EditMetadataModal.vue | 2 +- src/components/modal/EditTags.vue | 2 +- src/components/modal/FaceList.vue | 2 +- src/components/modal/FaceMergeModal.vue | 2 +- src/components/modal/FaceMoveModal.vue | 2 +- src/components/modal/MoveToFolderModal.vue | 2 +- src/components/modal/ShareModal.vue | 2 +- .../top-matter/FolderDynamicTopMatter.vue | 2 +- src/components/top-matter/FolderGrid.vue | 2 +- src/components/top-matter/MapSplitMatter.vue | 2 +- src/components/top-matter/OnThisDay.vue | 2 +- .../top-matter/PlacesDynamicTopMatter.vue | 2 +- src/components/viewer/ImageEditor.vue | 2 +- src/components/viewer/Viewer.vue | 2 +- src/components/viewer/types.ts | 2 +- src/globals.d.ts | 2 +- src/mixins/UserConfig.ts | 2 +- src/native/days.ts | 2 +- src/native/share.ts | 2 +- src/native/video.ts | 2 +- src/services/API.ts | 2 +- src/services/dav/albums.ts | 2 +- src/services/dav/base.ts | 2 +- src/services/dav/download.ts | 2 +- src/services/dav/face.ts | 2 +- src/services/dav/favorites.ts | 2 +- src/services/dav/onthisday.ts | 2 +- src/services/dav/other.ts | 2 +- src/services/dav/places.ts | 2 +- src/services/dav/single-item.ts | 2 +- src/services/dav/tags.ts | 2 +- src/services/static-config.ts | 2 +- src/services/utils/const.ts | 2 +- src/services/utils/event-bus.ts | 2 +- src/services/utils/helpers.ts | 2 +- src/types.ts | 312 ------------------ src/typings/cluster.d.ts | 53 +++ src/typings/config.d.ts | 41 +++ src/typings/data.d.ts | 161 +++++++++ src/typings/timeline.d.ts | 62 ++++ tsconfig.json | 4 +- webpack.config.ts | 1 - 67 files changed, 385 insertions(+), 382 deletions(-) delete mode 100644 src/types.ts create mode 100644 src/typings/cluster.d.ts create mode 100644 src/typings/config.d.ts create mode 100644 src/typings/data.d.ts create mode 100644 src/typings/timeline.d.ts diff --git a/.gitignore b/.gitignore index c190ae34..07b43c32 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ npm-debug.log* yarn-debug.log* yarn-error.log* js/ +*.tsbuildinfo # Editor directories and files .idea diff --git a/src/components/ClusterGrid.vue b/src/components/ClusterGrid.vue index 52fd8807..98bb99b8 100644 --- a/src/components/ClusterGrid.vue +++ b/src/components/ClusterGrid.vue @@ -30,7 +30,7 @@ import { defineComponent } from 'vue'; import Cluster from '@components/frame/Cluster.vue'; -import type { ICluster } from '@types'; +import type { ICluster } from '@typings'; import * as utils from '@services/utils'; export default defineComponent({ diff --git a/src/components/ClusterHList.vue b/src/components/ClusterHList.vue index c6ec8fb1..dde85f27 100644 --- a/src/components/ClusterHList.vue +++ b/src/components/ClusterHList.vue @@ -25,7 +25,7 @@ import { defineComponent, PropType } from 'vue'; import Cluster from './frame/Cluster.vue'; -import type { ICluster } from '@types'; +import type { ICluster } from '@typings'; export default defineComponent({ name: 'ClusterHList', diff --git a/src/components/ClusterView.vue b/src/components/ClusterView.vue index 36b005e6..fe2d89c9 100644 --- a/src/components/ClusterView.vue +++ b/src/components/ClusterView.vue @@ -30,7 +30,7 @@ import DynamicTopMatter from '@components/top-matter/DynamicTopMatter.vue'; import * as dav from '@services/dav'; import * as utils from '@services/utils'; -import type { ICluster } from '@types'; +import type { ICluster } from '@typings'; export default defineComponent({ name: 'ClusterView', diff --git a/src/components/Explore.vue b/src/components/Explore.vue index 21bfce1c..3b951c51 100644 --- a/src/components/Explore.vue +++ b/src/components/Explore.vue @@ -58,7 +58,7 @@ import { translate as t } from '@services/l10n'; import config from '@services/static-config'; import * as dav from '@services/dav'; -import type { ICluster, IConfig } from '@types'; +import type { ICluster, IConfig } from '@typings'; export default defineComponent({ name: 'Explore', diff --git a/src/components/FirstStart.vue b/src/components/FirstStart.vue index df58ef27..87e0cd49 100644 --- a/src/components/FirstStart.vue +++ b/src/components/FirstStart.vue @@ -59,7 +59,7 @@ import banner from '@assets/banner.svg'; import * as utils from '@services/utils'; import { API } from '@services/API'; -import type { IDay } from '@types'; +import type { IDay } from '@typings'; export default defineComponent({ name: 'FirstStart', diff --git a/src/components/Metadata.vue b/src/components/Metadata.vue index d1c4dec6..22454732 100644 --- a/src/components/Metadata.vue +++ b/src/components/Metadata.vue @@ -91,7 +91,7 @@ import * as utils from '@services/utils'; import * as dav from '@services/dav'; import { API } from '@services/API'; -import type { IAlbum, IFace, IImageInfo, IPhoto, IExif } from '@types'; +import type { IAlbum, IFace, IImageInfo, IPhoto, IExif } from '@typings'; interface TopField { id?: string; diff --git a/src/components/ScrollerManager.vue b/src/components/ScrollerManager.vue index a6d4646b..b3a57504 100644 --- a/src/components/ScrollerManager.vue +++ b/src/components/ScrollerManager.vue @@ -54,7 +54,7 @@ import { defineComponent, PropType } from 'vue'; import * as utils from '@services/utils'; -import { IRow, IRowType, ITick } from '@types'; +import type { IRow, ITick } from '@typings'; import ScrollUpIcon from 'vue-material-design-icons/MenuUp.vue'; import ScrollDownIcon from 'vue-material-design-icons/MenuDown.vue'; @@ -295,7 +295,7 @@ export default defineComponent({ // Iterate over rows for (const row of this.rows) { - if (row.type === IRowType.HEAD) { + if (row.type === 0) { // Make date string const dateTaken = utils.dayIdToDate(row.dayId); diff --git a/src/components/SelectionManager.vue b/src/components/SelectionManager.vue index 74915bee..b3365bcb 100644 --- a/src/components/SelectionManager.vue +++ b/src/components/SelectionManager.vue @@ -63,7 +63,7 @@ import AlbumsIcon from 'vue-material-design-icons/ImageAlbum.vue'; import AlbumRemoveIcon from 'vue-material-design-icons/BookRemove.vue'; import FolderMoveIcon from 'vue-material-design-icons/FolderMove.vue'; -import { IDay, IHeadRow, IPhoto, IRow, IRowType } from '@types'; +import type { IDay, IHeadRow, IPhoto, IRow } from '@typings'; /** * The distance for which the touch selection is clamped. @@ -630,7 +630,7 @@ export default defineComponent({ // Look behind for (let i = rowIdx; i > rowIdx - 100; i--) { if (i < 0) break; - if (rows[i].type !== IRowType.PHOTOS) continue; + if (rows[i].type !== 1) continue; if (!rows[i].photos?.length) break; const sj = i === rowIdx ? pIdx : rows[i].photos!.length - 1; diff --git a/src/components/Settings.vue b/src/components/Settings.vue index e34c0a4a..f9f68724 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -172,7 +172,7 @@ const NcCheckboxRadioSwitch = () => import('@nextcloud/vue/dist/Components/NcChe import MultiPathSelectionModal from '@components/modal/MultiPathSelectionModal.vue'; -import type { IConfig } from '@types'; +import type { IConfig } from '@typings'; export default defineComponent({ name: 'Settings', diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index 87c14a1f..cbd147d4 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -25,7 +25,7 @@ import Metadata from '@components/Metadata.vue'; import * as utils from '@services/utils'; -import { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; import CloseIcon from 'vue-material-design-icons/Close.vue'; import InfoSvg from '@assets/info.svg'; diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index b33f9989..64d3d2e0 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -114,7 +114,7 @@ import * as nativex from '@native'; import { API, DaysFilterType } from '@services/API'; -import { IDay, IHeadRow, IPhoto, IRow, IRowType } from '@types'; +import type { IDay, IHeadRow, IPhoto, IRow } from '@typings'; const SCROLL_LOAD_DELAY = 100; // Delay in loading data when scrolling const DESKTOP_ROW_HEIGHT = 200; // Height of row on desktop @@ -767,7 +767,7 @@ export default defineComponent({ id: `${day.dayid}-head`, num: -1, size: 40, - type: IRowType.HEAD, + type: 0, // head selected: false, dayId: day.dayid, day: day, @@ -1165,7 +1165,7 @@ export default defineComponent({ let dataIdx = 0; while (dataIdx < data.length) { // Check if we ran out of rows - if (rowIdx >= this.list.length || this.list[rowIdx].type === IRowType.HEAD) { + if (rowIdx >= this.list.length || this.list[rowIdx].type === 0) { const newRow = this.addRow(day); addedRows.push(newRow); this.list.splice(rowIdx, 0, newRow); @@ -1276,7 +1276,7 @@ export default defineComponent({ // Get rid of any extra rows let spliceCount = 0; - for (let i = rowIdx + 1; i < this.list.length && this.list[i].type !== IRowType.HEAD; i++) { + for (let i = rowIdx + 1; i < this.list.length && this.list[i].type !== 0; i++) { spliceCount++; } if (spliceCount > 0) { @@ -1320,11 +1320,11 @@ export default defineComponent({ day.rows ??= []; // Create new row - const row = { + const row: IRow = { id: `${day.dayid}-${day.rows.length}`, num: day.rows.length, photos: [], - type: IRowType.PHOTOS, + type: 1, // photos size: this.rowHeight, dayId: day.dayid, day: day, diff --git a/src/components/admin/AdminMain.vue b/src/components/admin/AdminMain.vue index 82f8b240..474010bb 100644 --- a/src/components/admin/AdminMain.vue +++ b/src/components/admin/AdminMain.vue @@ -43,7 +43,7 @@ import VideoTranscoder from './sections/VideoTranscoder.vue'; import VideoAccel from './sections/VideoAccel.vue'; import type { ISystemConfig, ISystemStatus } from './AdminTypes'; -import type { IConfig } from '@types'; +import type { IConfig } from '@typings'; export default defineComponent({ name: 'Admin', diff --git a/src/components/admin/AdminMixin.ts b/src/components/admin/AdminMixin.ts index 7de936be..d8556dc5 100644 --- a/src/components/admin/AdminMixin.ts +++ b/src/components/admin/AdminMixin.ts @@ -7,7 +7,7 @@ const NcTextField = () => import('@nextcloud/vue/dist/Components/NcTextField'); import NcButton from '@nextcloud/vue/dist/Components/NcButton'; import type { ISystemStatus, ISystemConfig, IBinaryStatus } from './AdminTypes'; -import type { IConfig } from '@types'; +import type { IConfig } from '@typings'; export default defineComponent({ name: 'AdminMixin', diff --git a/src/components/admin/AdminTypes.ts b/src/components/admin/AdminTypes.ts index a1270d08..4f54aeb6 100644 --- a/src/components/admin/AdminTypes.ts +++ b/src/components/admin/AdminTypes.ts @@ -1,4 +1,4 @@ -import type { IConfig } from '@types'; +import type { IConfig } from '@typings'; /** System configuration */ export type ISystemConfig = { diff --git a/src/components/frame/Cluster.vue b/src/components/frame/Cluster.vue index 7d8403df..23d7e620 100644 --- a/src/components/frame/Cluster.vue +++ b/src/components/frame/Cluster.vue @@ -37,7 +37,7 @@ import { defineComponent, PropType } from 'vue'; import NcCounterBubble from '@nextcloud/vue/dist/Components/NcCounterBubble'; -import type { IAlbum, ICluster, IFace, IPhoto } from '@types'; +import type { IAlbum, ICluster, IFace, IPhoto } from '@typings'; import { getPreviewUrl } from '@services/utils/helpers'; import errorsvg from '@assets/error.svg'; import plussvg from '@assets/plus.svg'; diff --git a/src/components/frame/Folder.vue b/src/components/frame/Folder.vue index a7791da9..75de757e 100644 --- a/src/components/frame/Folder.vue +++ b/src/components/frame/Folder.vue @@ -30,7 +30,7 @@ import UserConfig from '@mixins/UserConfig'; import * as utils from '@services/utils/helpers'; -import { IFolder, IPhoto } from '@types'; +import type { IFolder, IPhoto } from '@typings'; import FolderIcon from 'vue-material-design-icons/Folder.vue'; diff --git a/src/components/frame/Photo.vue b/src/components/frame/Photo.vue index f7c349c1..a5c08e19 100644 --- a/src/components/frame/Photo.vue +++ b/src/components/frame/Photo.vue @@ -82,7 +82,7 @@ import LivePhotoIcon from 'vue-material-design-icons/MotionPlayOutline.vue'; import LocalIcon from 'vue-material-design-icons/CloudOff.vue'; import RawIcon from 'vue-material-design-icons/Raw.vue'; -import type { IDay, IPhoto } from '@types'; +import type { IDay, IPhoto } from '@typings'; import type XImg from '@components/XImg.vue'; import errorsvg from '@assets/error.svg'; diff --git a/src/components/frame/RowHead.vue b/src/components/frame/RowHead.vue index b26206bd..848e1525 100644 --- a/src/components/frame/RowHead.vue +++ b/src/components/frame/RowHead.vue @@ -15,7 +15,7 @@ import { defineComponent, PropType } from 'vue'; import * as utils from '@services/utils'; -import type { IHeadRow } from '@types'; +import type { IHeadRow } from '@typings'; import CheckCircle from 'vue-material-design-icons/CheckCircle.vue'; diff --git a/src/components/modal/AddToAlbumModal.vue b/src/components/modal/AddToAlbumModal.vue index db8d1ddb..4c945d43 100644 --- a/src/components/modal/AddToAlbumModal.vue +++ b/src/components/modal/AddToAlbumModal.vue @@ -27,7 +27,7 @@ import AlbumPicker from './AlbumPicker.vue'; import * as dav from '@services/dav'; import * as utils from '@services/utils'; -import { IAlbum, IPhoto } from '@types'; +import type { IAlbum, IPhoto } from '@typings'; export default defineComponent({ name: 'AddToAlbumModal', diff --git a/src/components/modal/AlbumPicker.vue b/src/components/modal/AlbumPicker.vue index a56b4083..eccc6977 100644 --- a/src/components/modal/AlbumPicker.vue +++ b/src/components/modal/AlbumPicker.vue @@ -86,7 +86,7 @@ import AlbumsList from './AlbumsList.vue'; import * as dav from '@services/dav'; -import type { IAlbum, IPhoto } from '@types'; +import type { IAlbum, IPhoto } from '@typings'; import PlusIcon from 'vue-material-design-icons/Plus.vue'; import CheckIcon from 'vue-material-design-icons/Check.vue'; diff --git a/src/components/modal/AlbumsList.vue b/src/components/modal/AlbumsList.vue index 0652706d..6584c335 100644 --- a/src/components/modal/AlbumsList.vue +++ b/src/components/modal/AlbumsList.vue @@ -38,7 +38,7 @@ const NcListItem = () => import('@nextcloud/vue/dist/Components/NcListItem'); import * as utils from '@services/utils'; -import type { IAlbum, IPhoto } from '@types'; +import type { IAlbum, IPhoto } from '@typings'; import ImageMultipleIcon from 'vue-material-design-icons/ImageMultiple.vue'; diff --git a/src/components/modal/EditDate.vue b/src/components/modal/EditDate.vue index 9e852551..566a90c0 100644 --- a/src/components/modal/EditDate.vue +++ b/src/components/modal/EditDate.vue @@ -117,7 +117,7 @@ const NcTextField = () => import('@nextcloud/vue/dist/Components/NcTextField'); import * as utils from '@services/utils'; -import { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; export default defineComponent({ name: 'EditDate', diff --git a/src/components/modal/EditExif.vue b/src/components/modal/EditExif.vue index e3694ace..8c5dcbe7 100644 --- a/src/components/modal/EditExif.vue +++ b/src/components/modal/EditExif.vue @@ -28,7 +28,7 @@ const NcTextField = () => import('@nextcloud/vue/dist/Components/NcTextField'); import { translate as t } from '@services/l10n'; -import { IExif, IPhoto } from '@types'; +import type { IExif, IPhoto } from '@typings'; interface IField { field: keyof IExif; diff --git a/src/components/modal/EditLocation.vue b/src/components/modal/EditLocation.vue index c01b0c82..b1ecbe48 100644 --- a/src/components/modal/EditLocation.vue +++ b/src/components/modal/EditLocation.vue @@ -73,7 +73,7 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton'; const NcTextField = () => import('@nextcloud/vue/dist/Components/NcTextField'); const NcListItem = () => import('@nextcloud/vue/dist/Components/NcListItem'); -import { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; import MagnifyIcon from 'vue-material-design-icons/Magnify.vue'; import CloseIcon from 'vue-material-design-icons/Close.vue'; diff --git a/src/components/modal/EditMetadataModal.vue b/src/components/modal/EditMetadataModal.vue index ebead013..656c13c2 100644 --- a/src/components/modal/EditMetadataModal.vue +++ b/src/components/modal/EditMetadataModal.vue @@ -71,7 +71,7 @@ import * as dav from '@services/dav'; import * as utils from '@services/utils'; import { API } from '@services/API'; -import { IExif, IImageInfo, IPhoto } from '@types'; +import type { IExif, IImageInfo, IPhoto } from '@typings'; export default defineComponent({ components: { diff --git a/src/components/modal/EditTags.vue b/src/components/modal/EditTags.vue index 9e3f42bd..84905245 100644 --- a/src/components/modal/EditTags.vue +++ b/src/components/modal/EditTags.vue @@ -22,7 +22,7 @@ const NcSelectTags = () => import('@nextcloud/vue/dist/Components/NcSelectTags') import * as dav from '@services/dav'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; export default defineComponent({ name: 'EditTags', diff --git a/src/components/modal/FaceList.vue b/src/components/modal/FaceList.vue index 47acee7b..072ebb26 100644 --- a/src/components/modal/FaceList.vue +++ b/src/components/modal/FaceList.vue @@ -38,7 +38,7 @@ import ClusterGrid from '@components/ClusterGrid.vue'; import * as dav from '@services/dav'; -import type { ICluster, IFace } from '@types'; +import type { ICluster, IFace } from '@typings'; import MagnifyIcon from 'vue-material-design-icons/Magnify.vue'; diff --git a/src/components/modal/FaceMergeModal.vue b/src/components/modal/FaceMergeModal.vue index fe762bf9..653e3ec6 100644 --- a/src/components/modal/FaceMergeModal.vue +++ b/src/components/modal/FaceMergeModal.vue @@ -38,7 +38,7 @@ import client from '@services/dav/client'; import * as dav from '@services/dav'; import * as utils from '@services/utils'; -import { IFileInfo, IFace } from '@types'; +import type { IFileInfo, IFace } from '@typings'; export default defineComponent({ name: 'FaceMergeModal', diff --git a/src/components/modal/FaceMoveModal.vue b/src/components/modal/FaceMoveModal.vue index 9bbe5599..c498ac95 100644 --- a/src/components/modal/FaceMoveModal.vue +++ b/src/components/modal/FaceMoveModal.vue @@ -33,7 +33,7 @@ import ModalMixin from './ModalMixin'; import * as dav from '@services/dav'; import * as utils from '@services/utils'; -import type { IPhoto, IFace } from '@types'; +import type { IPhoto, IFace } from '@typings'; export default defineComponent({ name: 'FaceMoveModal', diff --git a/src/components/modal/MoveToFolderModal.vue b/src/components/modal/MoveToFolderModal.vue index d2e94609..26434a55 100644 --- a/src/components/modal/MoveToFolderModal.vue +++ b/src/components/modal/MoveToFolderModal.vue @@ -26,7 +26,7 @@ import ModalMixin from './ModalMixin'; import * as dav from '@services/dav'; import * as utils from '@services/utils'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; export default defineComponent({ name: 'MoveToFolderModal', diff --git a/src/components/modal/ShareModal.vue b/src/components/modal/ShareModal.vue index 136b2545..a597c9a9 100644 --- a/src/components/modal/ShareModal.vue +++ b/src/components/modal/ShareModal.vue @@ -89,7 +89,7 @@ import * as dav from '@services/dav'; import * as utils from '@services/utils'; import * as nativex from '@native'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; import PhotoIcon from 'vue-material-design-icons/Image.vue'; import LargePhotoIcon from 'vue-material-design-icons/ImageArea.vue'; diff --git a/src/components/top-matter/FolderDynamicTopMatter.vue b/src/components/top-matter/FolderDynamicTopMatter.vue index 06b95df3..87ce840b 100644 --- a/src/components/top-matter/FolderDynamicTopMatter.vue +++ b/src/components/top-matter/FolderDynamicTopMatter.vue @@ -14,7 +14,7 @@ import FolderGrid from './FolderGrid.vue'; import * as utils from '@services/utils'; import { API } from '@services/API'; -import type { IFolder } from '@types'; +import type { IFolder } from '@typings'; export default defineComponent({ name: 'FolderDynamicTopMatter', diff --git a/src/components/top-matter/FolderGrid.vue b/src/components/top-matter/FolderGrid.vue index efe9dd0b..c9944ae2 100644 --- a/src/components/top-matter/FolderGrid.vue +++ b/src/components/top-matter/FolderGrid.vue @@ -12,7 +12,7 @@ import { defineComponent } from 'vue'; import UserConfig from '@mixins/UserConfig'; import Folder from '@components/frame/Folder.vue'; -import type { IFolder } from '@types'; +import type { IFolder } from '@typings'; export default defineComponent({ name: 'ClusterGrid', diff --git a/src/components/top-matter/MapSplitMatter.vue b/src/components/top-matter/MapSplitMatter.vue index dc11753c..ddc8d4e2 100644 --- a/src/components/top-matter/MapSplitMatter.vue +++ b/src/components/top-matter/MapSplitMatter.vue @@ -44,7 +44,7 @@ import axios from '@nextcloud/axios'; import { API } from '@services/API'; import * as utils from '@services/utils'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; import 'leaflet/dist/leaflet.css'; import 'leaflet-edgebuffer'; diff --git a/src/components/top-matter/OnThisDay.vue b/src/components/top-matter/OnThisDay.vue index 5ac00313..375cd7bd 100644 --- a/src/components/top-matter/OnThisDay.vue +++ b/src/components/top-matter/OnThisDay.vue @@ -37,7 +37,7 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton'; import * as utils from '@services/utils'; import * as dav from '@services/dav'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; import LeftMoveIcon from 'vue-material-design-icons/ChevronLeft.vue'; import RightMoveIcon from 'vue-material-design-icons/ChevronRight.vue'; diff --git a/src/components/top-matter/PlacesDynamicTopMatter.vue b/src/components/top-matter/PlacesDynamicTopMatter.vue index 4eac98ac..436f7337 100644 --- a/src/components/top-matter/PlacesDynamicTopMatter.vue +++ b/src/components/top-matter/PlacesDynamicTopMatter.vue @@ -14,7 +14,7 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton'; import { API } from '@services/API'; -import type { ICluster } from '@types'; +import type { ICluster } from '@typings'; export default defineComponent({ name: 'PlacesDynamicTopMatter', diff --git a/src/components/viewer/ImageEditor.vue b/src/components/viewer/ImageEditor.vue index 9c4733fe..f197db45 100644 --- a/src/components/viewer/ImageEditor.vue +++ b/src/components/viewer/ImageEditor.vue @@ -23,7 +23,7 @@ import { fetchImage } from '@components/frame/XImgCache'; import { API } from '@services/API'; import * as utils from '@services/utils'; -import { IImageInfo, IPhoto } from '@types'; +import type { IImageInfo, IPhoto } from '@typings'; // Crop preset icons import LandscapeIcon from '@scaleflex/icons/landscape'; diff --git a/src/components/viewer/Viewer.vue b/src/components/viewer/Viewer.vue index 27dee442..3b216fd3 100644 --- a/src/components/viewer/Viewer.vue +++ b/src/components/viewer/Viewer.vue @@ -191,7 +191,7 @@ import PsImage from './PsImage'; import PsVideo from './PsVideo'; import PsLivePhoto from './PsLivePhoto'; -import { IImageInfo, IPhoto, TimelineState } from '@types'; +import type { IImageInfo, IPhoto, TimelineState } from '@typings'; import type { PsContent } from './types'; import ShareIcon from 'vue-material-design-icons/ShareVariant.vue'; diff --git a/src/components/viewer/types.ts b/src/components/viewer/types.ts index 29e48dec..95968b69 100644 --- a/src/components/viewer/types.ts +++ b/src/components/viewer/types.ts @@ -1,6 +1,6 @@ import Content from 'photoswipe/dist/types/slide/content'; import Slide, { _SlideData } from 'photoswipe/dist/types/slide/slide'; -import type { IPhoto, IConfig } from '@types'; +import type { IPhoto, IConfig } from '@typings'; type PsAugment = { data: _SlideData & { diff --git a/src/globals.d.ts b/src/globals.d.ts index 4bc1a6c4..aedc5571 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -4,7 +4,7 @@ import type { ComponentPublicInstance } from 'vue'; import type PlyrType from 'plyr'; import type videojsType from 'video.js'; -import type { IPhoto, TimelineState } from '@types'; +import type { IPhoto, TimelineState } from '@typings'; import type { constants, initstate } from '@services/utils'; import type { translate, translatePlural } from '@services/l10n'; import type { GlobalRouteCheckers, routes } from './router'; diff --git a/src/mixins/UserConfig.ts b/src/mixins/UserConfig.ts index 9494bbc6..5fc17e39 100644 --- a/src/mixins/UserConfig.ts +++ b/src/mixins/UserConfig.ts @@ -6,7 +6,7 @@ import { API } from '@services/API'; import * as utils from '@services/utils'; import staticConfig from '../services/static-config'; -import type { IConfig } from '@types'; +import type { IConfig } from '@typings'; const eventName: keyof utils.BusEvent = 'memories:user-config-changed'; diff --git a/src/native/days.ts b/src/native/days.ts index c10fbb94..ac65def4 100644 --- a/src/native/days.ts +++ b/src/native/days.ts @@ -4,7 +4,7 @@ import { has } from './basic'; import { API } from '@services/API'; import * as utils from '@services/utils'; -import type { IDay, IPhoto } from '@types'; +import type { IDay, IPhoto } from '@typings'; /** Memcache for */ const daysCache = new Map(); diff --git a/src/native/share.ts b/src/native/share.ts index 3e783a15..9701c02e 100644 --- a/src/native/share.ts +++ b/src/native/share.ts @@ -1,7 +1,7 @@ import axios from '@nextcloud/axios'; import { BASE_URL, NAPI, nativex } from './api'; import { addOrigin } from './basic'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; /** * Download a file from the given URL. diff --git a/src/native/video.ts b/src/native/video.ts index 9e284fb1..9f7fb152 100644 --- a/src/native/video.ts +++ b/src/native/video.ts @@ -1,6 +1,6 @@ import { nativex } from './api'; import { addOrigin } from './basic'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; /** * Play a video from the given URL. diff --git a/src/services/API.ts b/src/services/API.ts index 0c89ab16..eb6a36fb 100644 --- a/src/services/API.ts +++ b/src/services/API.ts @@ -1,5 +1,5 @@ import { generateUrl } from '@nextcloud/router'; -import { ClusterTypes } from '@types'; +import type { ClusterTypes } from '@typings'; const BASE = '/apps/memories/api'; diff --git a/src/services/dav/albums.ts b/src/services/dav/albums.ts index f5a93e07..39763216 100644 --- a/src/services/dav/albums.ts +++ b/src/services/dav/albums.ts @@ -9,7 +9,7 @@ import { API } from '@services/API'; import client from '@services/dav/client'; import * as utils from '@services/utils'; -import { IAlbum, IFileInfo, IPhoto } from '@types'; +import type { IAlbum, IFileInfo, IPhoto } from '@typings'; /** * Get DAV path for album diff --git a/src/services/dav/base.ts b/src/services/dav/base.ts index 1918ebcb..671b8f7d 100644 --- a/src/services/dav/base.ts +++ b/src/services/dav/base.ts @@ -9,7 +9,7 @@ import { translate as t } from '@services/l10n'; import * as utils from '@services/utils'; import * as nativex from '@native'; -import { IFileInfo, IPhoto } from '@types'; +import type { IFileInfo, IPhoto } from '@typings'; const GET_FILE_CHUNK_SIZE = 50; diff --git a/src/services/dav/download.ts b/src/services/dav/download.ts index 5fc679b5..0afb6ac4 100644 --- a/src/services/dav/download.ts +++ b/src/services/dav/download.ts @@ -5,7 +5,7 @@ import { translate as t } from '@services/l10n'; import { API } from '@services/API'; import * as nativex from '@native'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; /** * Download files diff --git a/src/services/dav/face.ts b/src/services/dav/face.ts index df32cd54..0d090e70 100644 --- a/src/services/dav/face.ts +++ b/src/services/dav/face.ts @@ -9,7 +9,7 @@ import { translate as t } from '@services/l10n'; import { constants as c } from '@services/utils'; import { API } from '@services/API'; -import { IFace, IPhoto } from '@types'; +import type { IFace, IPhoto } from '@typings'; /** * Get list of faces diff --git a/src/services/dav/favorites.ts b/src/services/dav/favorites.ts index 7257fe88..3493f16e 100644 --- a/src/services/dav/favorites.ts +++ b/src/services/dav/favorites.ts @@ -6,7 +6,7 @@ import * as base from './base'; import { translate as t } from '@services/l10n'; import { constants as c } from '@services/utils'; -import type { IFileInfo, IPhoto } from '@types'; +import type { IFileInfo, IPhoto } from '@typings'; /** * Favorite a file diff --git a/src/services/dav/onthisday.ts b/src/services/dav/onthisday.ts index 860d449e..0b6b2b93 100644 --- a/src/services/dav/onthisday.ts +++ b/src/services/dav/onthisday.ts @@ -3,7 +3,7 @@ import axios from '@nextcloud/axios'; import * as utils from '@services/utils'; import { API } from '@services/API'; -import { IDay, IPhoto } from '@types'; +import type { IDay, IPhoto } from '@typings'; /** * Get original onThisDay response. diff --git a/src/services/dav/other.ts b/src/services/dav/other.ts index 4bc7a92f..9424dcf5 100644 --- a/src/services/dav/other.ts +++ b/src/services/dav/other.ts @@ -3,7 +3,7 @@ import { generateUrl } from '@nextcloud/router'; import { API } from '@services/API'; -import { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; /** * Open the files app with the given photo diff --git a/src/services/dav/places.ts b/src/services/dav/places.ts index b4922c4c..b7e0d7c2 100644 --- a/src/services/dav/places.ts +++ b/src/services/dav/places.ts @@ -1,7 +1,7 @@ import axios from '@nextcloud/axios'; import { API } from '@services/API'; -import { ICluster } from '@types'; +import type { ICluster } from '@typings'; export async function getPlaces() { return (await axios.get(API.PLACE_LIST())).data; diff --git a/src/services/dav/single-item.ts b/src/services/dav/single-item.ts index 62364e7e..b9b39d60 100644 --- a/src/services/dav/single-item.ts +++ b/src/services/dav/single-item.ts @@ -1,5 +1,5 @@ import { initstate } from '@services/utils'; -import { IDay } from '@types'; +import type { IDay } from '@typings'; const { singleItem } = initstate; diff --git a/src/services/dav/tags.ts b/src/services/dav/tags.ts index 72c909b3..ced19d97 100644 --- a/src/services/dav/tags.ts +++ b/src/services/dav/tags.ts @@ -6,7 +6,7 @@ import client from './client'; import { API } from '@services/API'; import { translate as t } from '@services/l10n'; -import { ICluster } from '@types'; +import type { ICluster } from '@typings'; export interface ITag { id: number; diff --git a/src/services/static-config.ts b/src/services/static-config.ts index 3ff7a707..1c3029f1 100644 --- a/src/services/static-config.ts +++ b/src/services/static-config.ts @@ -7,7 +7,7 @@ import { translate as t } from '@services/l10n'; import * as utils from '@services/utils'; import type Storage from '@nextcloud/browser-storage/dist/storage'; -import type { IConfig } from '@types'; +import type { IConfig } from '@typings'; class StaticConfig { private config: IConfig | null = null; diff --git a/src/services/utils/const.ts b/src/services/utils/const.ts index 6e4769b3..0d913434 100644 --- a/src/services/utils/const.ts +++ b/src/services/utils/const.ts @@ -1,5 +1,5 @@ import { loadState } from '@nextcloud/initial-state'; -import type { IPhoto } from '@types'; +import type { IPhoto } from '@typings'; /** Global constants */ export const constants = Object.freeze({ diff --git a/src/services/utils/event-bus.ts b/src/services/utils/event-bus.ts index 55c075f7..73746b55 100644 --- a/src/services/utils/event-bus.ts +++ b/src/services/utils/event-bus.ts @@ -1,6 +1,6 @@ import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'; import type { FragmentName, Fragment } from './fragment'; -import type { IConfig, IPhoto } from '@types'; +import type { IConfig, IPhoto } from '@typings'; export type BusEvent = { /** Open/close the navigation drawer */ diff --git a/src/services/utils/helpers.ts b/src/services/utils/helpers.ts index fd6a6a8b..3b38fe7f 100644 --- a/src/services/utils/helpers.ts +++ b/src/services/utils/helpers.ts @@ -4,7 +4,7 @@ import { constants as c } from './const'; import { API } from '@services/API'; import * as nativex from '@native'; -import type { IImageInfo, IPhoto } from '@types'; +import type { IImageInfo, IPhoto } from '@typings'; /** * Get the current user UID diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index eec65f5b..00000000 --- a/src/types.ts +++ /dev/null @@ -1,312 +0,0 @@ -export type IFileInfo = { - /** Same as fileid */ - id: number; - /** Database file ID */ - fileid: number; - /** Full file name, e.g. /pi/test/Qx0dq7dvEXA.jpg */ - filename: string; - /** Original file name, e.g. /files/admin/pi/test/Qx0dq7dvEXA.jpg */ - originalFilename: string; - /** Base name of file e.g. Qx0dq7dvEXA.jpg */ - basename: string; -}; - -export type IDay = { - /** Day ID */ - dayid: number; - /** Number of photos in this day */ - count: number; - /** Rows in the day */ - rows?: IRow[]; - /** List of photos for this day */ - detail?: IPhoto[]; - /** This day has some local photos */ - haslocal?: boolean; -}; - -export type IPhoto = { - /** Nextcloud ID of file */ - fileid: number; - /** - * Vue key unique to this object. - * 1/ File ID by default. - * 2/ Indexed if duplicates present. - * 3/ Face ID for people views. - */ - key?: string; - /** Etag from server */ - etag?: string; - /** Base name of file */ - basename?: string; - /** Mime type of file */ - mimetype?: string; - /** Bit flags */ - flag: number; - /** DayID from server */ - dayid: number; - /** Width of full image */ - w?: number; - /** Height of full image */ - h?: number; - /** Live Photo identifier */ - liveid?: string; - - /** Grid display width px */ - dispW?: number; - /** Grid display height px */ - dispH?: number; - /** Grid display X px */ - dispX?: number; - /** Grid display Y px */ - dispY?: number; - /** Grid display row id (relative to head) */ - dispRowNum?: number; - - /** Reference to day object */ - d?: IDay; - /** Reference to exif object */ - imageInfo?: IImageInfo | null; - - /** Face detection ID */ - faceid?: number; - /** Face dimensions */ - facerect?: IFaceRect; - - /** Video flag from server */ - isvideo?: boolean; - /** Video duration from server */ - video_duration?: number; - /** Favorite flag from server */ - isfavorite?: boolean; - /** Local file from native */ - islocal?: boolean; - /** - * Photo is hidden from timeline; discard immediately. - * This field exists so that we can merge with locals. - */ - ishidden?: boolean; - - /** AUID of file (optional, NativeX) */ - auid?: string; - /** BUID of file (optional, NativeX) */ - buid?: string; - /** Epoch of file (optional, NativeX) */ - epoch?: number; - - /** Date taken UTC value (lazy fetched) */ - datetaken?: number; - - /** Stacked RAW photos */ - stackraw?: IPhoto[]; -}; - -export interface IImageInfo { - fileid: number; - etag: string; - h: number; - w: number; - datetaken: number; - - permissions: string; - basename: string; - mimetype: string; - size: number; - - filename?: string; - address?: string; - tags?: { [id: string]: string }; - - exif?: IExif; - - clusters?: { - albums?: IAlbum[]; - recognize?: IFace[]; - facerecognition?: IFace[]; - }; -} - -export interface IExif { - Rotation?: number; - Orientation?: number; - ImageWidth?: number; - ImageHeight?: number; - Megapixels?: number; - - Title?: string; - Description?: string; - Make?: string; - Model?: string; - - CreateDate?: string; - DateTimeOriginal?: string; - DateTimeEpoch?: number; - OffsetTimeOriginal?: string; - OffsetTime?: string; - LocationTZID?: string; - - ExposureTime?: number; - ShutterSpeed?: number; - ShutterSpeedValue?: number; - Aperture?: number; - ApertureValue?: number; - ISO?: number; - FNumber?: number; - FocalLength?: number; - - GPSAltitude?: number; - GPSLatitude?: number; - GPSLongitude?: number; -} - -export interface IFolder extends IPhoto { - /** Photos for preview images */ - previews?: IPhoto[]; - /** Name of folder */ - name: string; -} - -export type ClusterTypes = 'tags' | 'albums' | 'places' | 'recognize' | 'facerecognition' | 'plus'; - -export interface ICluster { - /** A unique identifier for the cluster */ - cluster_id: number | string; - /** Type of cluster */ - cluster_type: ClusterTypes; - /** Number of images in this cluster */ - count: number; - /** Name of cluster */ - name: string; - - /** Display name, e.g. translated */ - display_name?: string; - /** Preview loading failed */ - previewError?: boolean; -} - -export interface IAlbum extends ICluster { - /** ID of album */ - album_id: number; - /** Owner of album */ - user: string; - /** Display name of album owner */ - user_display?: string; - /** Created timestamp */ - created: number; - /** Location string */ - location: string; - /** File ID of last added photo */ - last_added_photo: number; -} - -export interface IFace extends ICluster { - /** User for face */ - user_id: string; -} - -export interface IFaceRect { - w: number; - h: number; - x: number; - y: number; -} - -export type IRow = { - /** Vue Recycler identifier */ - id?: string; - /** Row ID from head */ - num: number; - /** Day ID */ - dayId: number; - /** Refrence to day object */ - day: IDay; - /** Whether this is a head row */ - type: IRowType; - /** [Head only] Title of the header */ - name?: string; - /** [Head only] Boolean if the entire day is selected */ - selected?: boolean; - /** Main list of photo items */ - photos?: IPhoto[]; - - /** Height in px of the row */ - size: number; - /** Count of placeholders to create */ - pct?: number; - /** Don't remove dom element */ - virtualSticky?: boolean; -}; -export type IHeadRow = IRow & { - type: IRowType.HEAD; - selected: boolean; - super?: string; -}; -export enum IRowType { - HEAD = 0, - PHOTOS = 1, -} - -export type ITick = { - /** Day ID */ - dayId: number; - /** Display top position */ - topF: number; - /** Display top position (truncated to 1 decimal pt) */ - top: number; - /** Y coordinate on recycler */ - y: number; - /** Cumulative number of photos before this tick */ - count: number; - /** Is a new month */ - isMonth: boolean; - /** Text if any (e.g. year) */ - text?: string | number; - /** Whether this tick should be shown */ - s?: boolean; - /** Key for vue component */ - key?: number; -}; - -export type IConfig = { - // general stuff - version: string; - vod_disable: boolean; - video_default_quality: string; - places_gis: number; - - // enabled apps - systemtags_enabled: boolean; - albums_enabled: boolean; - recognize_installed: boolean; - recognize_enabled: boolean; - facerecognition_installed: boolean; - facerecognition_enabled: boolean; - preview_generator_enabled: boolean; - - // general settings - timeline_path: string; - enable_top_memories: boolean; - - // viewer settings - high_res_cond_default: 'always' | 'zoom' | 'never'; - livephoto_autoplay: boolean; - sidebar_filepath: boolean; - - // folder settings - folders_path: string; - show_hidden_folders: boolean; - sort_folder_month: boolean; - - // album settings - sort_album_month: boolean; - - // local settings - square_thumbs: boolean; - high_res_cond: IConfig['high_res_cond_default'] | null; - show_face_rect: boolean; - album_list_sort: 1 | 2; -}; - -export interface TimelineState { - list: IRow[]; - heads: Map; -} diff --git a/src/typings/cluster.d.ts b/src/typings/cluster.d.ts new file mode 100644 index 00000000..f5d18673 --- /dev/null +++ b/src/typings/cluster.d.ts @@ -0,0 +1,53 @@ +declare module '@typings' { + export interface IFolder extends IPhoto { + /** Photos for preview images */ + previews?: IPhoto[]; + /** Name of folder */ + name: string; + } + + export type ClusterTypes = 'tags' | 'albums' | 'places' | 'recognize' | 'facerecognition' | 'plus'; + + export interface ICluster { + /** A unique identifier for the cluster */ + cluster_id: number | string; + /** Type of cluster */ + cluster_type: ClusterTypes; + /** Number of images in this cluster */ + count: number; + /** Name of cluster */ + name: string; + + /** Display name, e.g. translated */ + display_name?: string; + /** Preview loading failed */ + previewError?: boolean; + } + + export interface IAlbum extends ICluster { + /** ID of album */ + album_id: number; + /** Owner of album */ + user: string; + /** Display name of album owner */ + user_display?: string; + /** Created timestamp */ + created: number; + /** Location string */ + location: string; + /** File ID of last added photo */ + last_added_photo: number; + } + + export interface IFace extends ICluster { + /** User for face */ + user_id: string; + } + + export interface IFaceRect { + w: number; + h: number; + x: number; + y: number; + } +} diff --git a/src/typings/config.d.ts b/src/typings/config.d.ts new file mode 100644 index 00000000..f0e55f82 --- /dev/null +++ b/src/typings/config.d.ts @@ -0,0 +1,41 @@ +declare module '@typings' { + export type IConfig = { + // general stuff + version: string; + vod_disable: boolean; + video_default_quality: string; + places_gis: number; + + // enabled apps + systemtags_enabled: boolean; + albums_enabled: boolean; + recognize_installed: boolean; + recognize_enabled: boolean; + facerecognition_installed: boolean; + facerecognition_enabled: boolean; + preview_generator_enabled: boolean; + + // general settings + timeline_path: string; + enable_top_memories: boolean; + + // viewer settings + high_res_cond_default: 'always' | 'zoom' | 'never'; + livephoto_autoplay: boolean; + sidebar_filepath: boolean; + + // folder settings + folders_path: string; + show_hidden_folders: boolean; + sort_folder_month: boolean; + + // album settings + sort_album_month: boolean; + + // local settings + square_thumbs: boolean; + high_res_cond: IConfig['high_res_cond_default'] | null; + show_face_rect: boolean; + album_list_sort: 1 | 2; + }; +} diff --git a/src/typings/data.d.ts b/src/typings/data.d.ts new file mode 100644 index 00000000..9519353d --- /dev/null +++ b/src/typings/data.d.ts @@ -0,0 +1,161 @@ +declare module '@typings' { + export type IFileInfo = { + /** Same as fileid */ + id: number; + /** Database file ID */ + fileid: number; + /** Full file name, e.g. /pi/test/Qx0dq7dvEXA.jpg */ + filename: string; + /** Original file name, e.g. /files/admin/pi/test/Qx0dq7dvEXA.jpg */ + originalFilename: string; + /** Base name of file e.g. Qx0dq7dvEXA.jpg */ + basename: string; + }; + + export type IDay = { + /** Day ID */ + dayid: number; + /** Number of photos in this day */ + count: number; + /** Rows in the day */ + rows?: IRow[]; + /** List of photos for this day */ + detail?: IPhoto[]; + /** This day has some local photos */ + haslocal?: boolean; + }; + + export type IPhoto = { + /** Nextcloud ID of file */ + fileid: number; + /** + * Vue key unique to this object. + * 1/ File ID by default. + * 2/ Indexed if duplicates present. + * 3/ Face ID for people views. + */ + key?: string; + /** Etag from server */ + etag?: string; + /** Base name of file */ + basename?: string; + /** Mime type of file */ + mimetype?: string; + /** Bit flags */ + flag: number; + /** DayID from server */ + dayid: number; + /** Width of full image */ + w?: number; + /** Height of full image */ + h?: number; + /** Live Photo identifier */ + liveid?: string; + + /** Grid display width px */ + dispW?: number; + /** Grid display height px */ + dispH?: number; + /** Grid display X px */ + dispX?: number; + /** Grid display Y px */ + dispY?: number; + /** Grid display row id (relative to head) */ + dispRowNum?: number; + + /** Reference to day object */ + d?: IDay; + /** Reference to exif object */ + imageInfo?: IImageInfo | null; + + /** Face detection ID */ + faceid?: number; + /** Face dimensions */ + facerect?: IFaceRect; + + /** Video flag from server */ + isvideo?: boolean; + /** Video duration from server */ + video_duration?: number; + /** Favorite flag from server */ + isfavorite?: boolean; + /** Local file from native */ + islocal?: boolean; + /** + * Photo is hidden from timeline; discard immediately. + * This field exists so that we can merge with locals. + */ + ishidden?: boolean; + + /** AUID of file (optional, NativeX) */ + auid?: string; + /** BUID of file (optional, NativeX) */ + buid?: string; + /** Epoch of file (optional, NativeX) */ + epoch?: number; + + /** Date taken UTC value (lazy fetched) */ + datetaken?: number; + + /** Stacked RAW photos */ + stackraw?: IPhoto[]; + }; + + export interface IImageInfo { + fileid: number; + etag: string; + h: number; + w: number; + datetaken: number; + + permissions: string; + basename: string; + mimetype: string; + size: number; + + filename?: string; + address?: string; + tags?: { [id: string]: string }; + + exif?: IExif; + + clusters?: { + albums?: IAlbum[]; + recognize?: IFace[]; + facerecognition?: IFace[]; + }; + } + + export interface IExif { + Rotation?: number; + Orientation?: number; + ImageWidth?: number; + ImageHeight?: number; + Megapixels?: number; + + Title?: string; + Description?: string; + Make?: string; + Model?: string; + + CreateDate?: string; + DateTimeOriginal?: string; + DateTimeEpoch?: number; + OffsetTimeOriginal?: string; + OffsetTime?: string; + LocationTZID?: string; + + ExposureTime?: number; + ShutterSpeed?: number; + ShutterSpeedValue?: number; + Aperture?: number; + ApertureValue?: number; + ISO?: number; + FNumber?: number; + FocalLength?: number; + + GPSAltitude?: number; + GPSLatitude?: number; + GPSLongitude?: number; + } +} diff --git a/src/typings/timeline.d.ts b/src/typings/timeline.d.ts new file mode 100644 index 00000000..8d2f7fec --- /dev/null +++ b/src/typings/timeline.d.ts @@ -0,0 +1,62 @@ +declare module '@typings' { + export type ITick = { + /** Day ID */ + dayId: number; + /** Display top position */ + topF: number; + /** Display top position (truncated to 1 decimal pt) */ + top: number; + /** Y coordinate on recycler */ + y: number; + /** Cumulative number of photos before this tick */ + count: number; + /** Is a new month */ + isMonth: boolean; + /** Text if any (e.g. year) */ + text?: string | number; + /** Whether this tick should be shown */ + s?: boolean; + /** Key for vue component */ + key?: number; + }; + + export interface TimelineState { + list: IRow[]; + heads: Map; + } + + /** Type of IRow (0 = head, 1 = photos) */ + export type IRowType = 0 | 1; + + export type IRow = { + /** Vue Recycler identifier */ + id?: string; + /** Row ID from head */ + num: number; + /** Day ID */ + dayId: number; + /** Refrence to day object */ + day: IDay; + /** Whether this is a head row */ + type: IRowType; + /** [Head only] Title of the header */ + name?: string; + /** [Head only] Boolean if the entire day is selected */ + selected?: boolean; + /** Main list of photo items */ + photos?: IPhoto[]; + + /** Height in px of the row */ + size: number; + /** Count of placeholders to create */ + pct?: number; + /** Don't remove dom element */ + virtualSticky?: boolean; + }; + + export type IHeadRow = IRow & { + type: 0; + selected: boolean; + super?: string; + }; +} diff --git a/tsconfig.json b/tsconfig.json index 3961c8e2..48433dfb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,7 @@ "noImplicitAny": true, "esModuleInterop": true, "strictNullChecks": true, + "incremental": true, "paths": { "@services/*": [ "./src/services/*" @@ -31,9 +32,6 @@ "@native": [ "./src/native", "./src/native/*" - ], - "@types": [ - "./src/types" ] } }, diff --git a/webpack.config.ts b/webpack.config.ts index ce46931c..bd4ef834 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -139,7 +139,6 @@ module.exports = { '@components': path.resolve(__dirname, 'src', 'components'), '@mixins': path.resolve(__dirname, 'src', 'mixins'), '@native': path.resolve(__dirname, 'src', 'native'), - '@types$': path.resolve(__dirname, 'src', 'types'), }, }, };