From ccecfd9421f4550a71134cd46e1388e486f8c564 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Tue, 28 Apr 2020 03:47:39 +0200 Subject: viewer: global formatting unification --- viewer/.eslintrc.js | 4 +- viewer/examples/config.json.example | 4 +- viewer/examples/manifest.json.example | 22 ++-- viewer/public/index.html | 2 +- viewer/src/@types/Operation.ts | 6 +- viewer/src/@types/gallery.d.ts | 102 +++++++++--------- viewer/src/@types/tag.d.ts | 38 +++---- viewer/src/@types/v-lazy-image.d.ts | 2 +- viewer/src/@types/vue-dragscroll.d.ts | 2 +- viewer/src/assets/scss/buefy.scss | 6 +- viewer/src/assets/scss/palette.scss | 20 ++-- viewer/src/components/index.ts | 30 +++--- viewer/src/locales/en.json | 2 +- viewer/src/main.ts | 2 +- viewer/src/plugins/buefy.ts | 16 +-- viewer/src/plugins/dragscroll.ts | 3 +- viewer/src/plugins/fontawesome.ts | 48 ++++----- viewer/src/services/indexfactory.ts | 6 +- viewer/src/services/indexsearch.ts | 2 +- viewer/src/services/ldzoom.ts | 10 +- viewer/src/shims-tsx.d.ts | 4 +- viewer/src/store/galleryStore.ts | 190 +++++++++++++++++----------------- viewer/src/store/index.ts | 10 +- viewer/src/store/uiStore.ts | 30 +++--- 24 files changed, 280 insertions(+), 281 deletions(-) diff --git a/viewer/.eslintrc.js b/viewer/.eslintrc.js index 113ff6a..a67de5e 100644 --- a/viewer/.eslintrc.js +++ b/viewer/.eslintrc.js @@ -15,9 +15,9 @@ module.exports = { "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", "eol-last": ["warn", "always"], "object-curly-spacing": ["warn", "always"], - "indent": ["warn", 2, { "SwitchCase": 1 }], "quote-props": ["warn", "as-needed"], - "quotes": ["warn", "double"], + indent: ["warn", 2, { SwitchCase: 1 }], + quotes: ["warn", "double"], "vue/attribute-hyphenation": "warn", "vue/html-closing-bracket-spacing": "warn", "vue/html-end-tags": "error", diff --git a/viewer/examples/config.json.example b/viewer/examples/config.json.example index 90c5f74..580da8c 100644 --- a/viewer/examples/config.json.example +++ b/viewer/examples/config.json.example @@ -1,3 +1,3 @@ { - "galleryRoot": "gallery/" -} \ No newline at end of file + "galleryRoot": "gallery/" +} diff --git a/viewer/examples/manifest.json.example b/viewer/examples/manifest.json.example index 8c43fbb..d07209f 100644 --- a/viewer/examples/manifest.json.example +++ b/viewer/examples/manifest.json.example @@ -1,13 +1,13 @@ { - "short_name": "LdGallery", - "name": "LdGallery", - "icons": [ - { - "src": "defaulticon.png", - "type": "image/png", - "sizes": "192x192" - } - ], - "display": "standalone", - "_comment": "https://developer.mozilla.org/en-US/docs/Web/Manifest" + "short_name": "LdGallery", + "name": "LdGallery", + "icons": [ + { + "src": "defaulticon.png", + "type": "image/png", + "sizes": "192x192" + } + ], + "display": "standalone", + "_comment": "https://developer.mozilla.org/en-US/docs/Web/Manifest" } diff --git a/viewer/public/index.html b/viewer/public/index.html index 4b7e26d..4f2767c 100644 --- a/viewer/public/index.html +++ b/viewer/public/index.html @@ -41,4 +41,4 @@ - \ No newline at end of file + diff --git a/viewer/src/@types/Operation.ts b/viewer/src/@types/Operation.ts index ba31bc0..e7aad27 100644 --- a/viewer/src/@types/Operation.ts +++ b/viewer/src/@types/Operation.ts @@ -18,7 +18,7 @@ */ export enum Operation { - INTERSECTION = '', - ADDITION = '+', - SUBSTRACTION = '-', + INTERSECTION = "", + ADDITION = "+", + SUBSTRACTION = "-", }; diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index 956ab6b..066aedf 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts @@ -18,57 +18,57 @@ */ declare namespace Gallery { - interface Config { - galleryRoot: string, - } + interface Config { + galleryRoot: string, + } - interface GalleryProperties { - galleryTitle: string, - tagCategories: RawTag[] - } - interface Index { - properties: GalleryProperties, - tree: Directory - } + interface GalleryProperties { + galleryTitle: string, + tagCategories: RawTag[] + } + interface Index { + properties: GalleryProperties, + tree: Directory + } - interface Other extends Item { - properties: OtherProperties, - } - interface Picture extends Item { - properties: PictureProperties, - } - interface Directory extends Item { - properties: DirectoryProperties, - } - interface Item { - title: string, - datetime: string, - description: string, - tags: RawTag[], - path: string, - thumbnail?: Thumbnail - properties: OtherProperties | PictureProperties | DirectoryProperties, - } - interface Resolution { - width: number, - height: number, - } - interface OtherProperties { - type: "other", - } - interface PictureProperties { - type: "picture", - resource: string, - resolution: Resolution - } - interface DirectoryProperties { - type: "directory", - items: Item[] - } - interface Thumbnail { - resource: string, - resolution: Resolution - } - type RawTag = string; - type ItemType = "other" | "picture" | "directory"; + interface Other extends Item { + properties: OtherProperties, + } + interface Picture extends Item { + properties: PictureProperties, + } + interface Directory extends Item { + properties: DirectoryProperties, + } + interface Item { + title: string, + datetime: string, + description: string, + tags: RawTag[], + path: string, + thumbnail?: Thumbnail + properties: OtherProperties | PictureProperties | DirectoryProperties, + } + interface Resolution { + width: number, + height: number, + } + interface OtherProperties { + type: "other", + } + interface PictureProperties { + type: "picture", + resource: string, + resolution: Resolution + } + interface DirectoryProperties { + type: "directory", + items: Item[] + } + interface Thumbnail { + resource: string, + resolution: Resolution + } + type RawTag = string; + type ItemType = "other" | "picture" | "directory"; } diff --git a/viewer/src/@types/tag.d.ts b/viewer/src/@types/tag.d.ts index 8f7e6a9..76f1207 100644 --- a/viewer/src/@types/tag.d.ts +++ b/viewer/src/@types/tag.d.ts @@ -18,24 +18,24 @@ */ declare namespace Tag { - interface Node { - tag: Gallery.RawTag; - tagfiltered: Gallery.RawTag; - rootPart: boolean; - childPart: boolean; - items: Gallery.Item[]; - children: Index; - } - interface Search extends Node { - parent?: Node; - operation: string; // Enum Operation - display: string; - } - type SearchByOperation = { [index: string]: Tag.Search[] }; - type Index = { [index: string]: Node }; + interface Node { + tag: Gallery.RawTag; + tagfiltered: Gallery.RawTag; + rootPart: boolean; + childPart: boolean; + items: Gallery.Item[]; + children: Index; + } + interface Search extends Node { + parent?: Node; + operation: string; // Enum Operation + display: string; + } + type SearchByOperation = { [index: string]: Tag.Search[] }; + type Index = { [index: string]: Node }; - interface Category { - tag: string; - index: Index; - } + interface Category { + tag: string; + index: Index; + } } diff --git a/viewer/src/@types/v-lazy-image.d.ts b/viewer/src/@types/v-lazy-image.d.ts index df29484..2777921 100644 --- a/viewer/src/@types/v-lazy-image.d.ts +++ b/viewer/src/@types/v-lazy-image.d.ts @@ -17,4 +17,4 @@ -- along with this program. If not, see . */ -declare module 'v-lazy-image'; +declare module "v-lazy-image"; diff --git a/viewer/src/@types/vue-dragscroll.d.ts b/viewer/src/@types/vue-dragscroll.d.ts index 052023d..c07c7d8 100644 --- a/viewer/src/@types/vue-dragscroll.d.ts +++ b/viewer/src/@types/vue-dragscroll.d.ts @@ -17,4 +17,4 @@ -- along with this program. If not, see . */ -declare module 'vue-dragscroll'; +declare module "vue-dragscroll"; diff --git a/viewer/src/assets/scss/buefy.scss b/viewer/src/assets/scss/buefy.scss index 735ce6a..2bc4985 100644 --- a/viewer/src/assets/scss/buefy.scss +++ b/viewer/src/assets/scss/buefy.scss @@ -32,12 +32,12 @@ $addColors: ( "green": ( $green, - $green-invert + $green-invert, ), "purple": ( $purple, - $purple-invert - ) + $purple-invert, + ), ); $colors: map-merge($colors, $addColors); diff --git a/viewer/src/assets/scss/palette.scss b/viewer/src/assets/scss/palette.scss index f7eab11..e70e8a1 100644 --- a/viewer/src/assets/scss/palette.scss +++ b/viewer/src/assets/scss/palette.scss @@ -18,14 +18,14 @@ */ // Material Design Blue Gray colour palette -$palette-000: #FFFFFF; -$palette-050: #ECEFF1; -$palette-100: #CFD8DC; -$palette-200: #B0BEC5; -$palette-300: #90A4AE; -$palette-400: #78909C; -$palette-500: #607D8B; -$palette-600: #546E7A; -$palette-700: #455A64; -$palette-800: #37474F; +$palette-000: #ffffff; +$palette-050: #eceff1; +$palette-100: #cfd8dc; +$palette-200: #b0bec5; +$palette-300: #90a4ae; +$palette-400: #78909c; +$palette-500: #607d8b; +$palette-600: #546e7a; +$palette-700: #455a64; +$palette-800: #37474f; $palette-900: #263238; diff --git a/viewer/src/components/index.ts b/viewer/src/components/index.ts index ef55489..559000e 100644 --- a/viewer/src/components/index.ts +++ b/viewer/src/components/index.ts @@ -17,25 +17,25 @@ -- along with this program. If not, see . */ -import Vue from 'vue' +import Vue from "vue" const requireComponent = require.context( - '@/components', - false, // Whether or not to look in subfolders - // The regular expression used to match base component filenames - /Ld[A-Z]\w+\.vue$/ + "@/components", + false, // Whether or not to look in subfolders + // The regular expression used to match base component filenames + /Ld[A-Z]\w+\.vue$/ ) requireComponent.keys().forEach(fileName => { - const componentConfig = requireComponent(fileName) - const componentName = fileName.split('/').pop()!.replace(/\.vue$/, ''); + const componentConfig = requireComponent(fileName) + const componentName = fileName.split("/").pop()!.replace(/\.vue$/, ""); - // Register component globally - Vue.component( - componentName, - // Look for the component options on `.default`, which will - // exist if the component was exported with `export default`, - // otherwise fall back to module's root. - componentConfig.default ?? componentConfig - ) + // Register component globally + Vue.component( + componentName, + // Look for the component options on `.default`, which will + // exist if the component was exported with `export default`, + // otherwise fall back to module's root. + componentConfig.default ?? componentConfig + ) }) diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json index 4209a67..9e0fd4b 100644 --- a/viewer/src/locales/en.json +++ b/viewer/src/locales/en.json @@ -16,4 +16,4 @@ "command.parent": "Go to parent directory", "directory.no-results": "Empty directory", "panelLeft.propositions.other": "other filters" -} \ No newline at end of file +} diff --git a/viewer/src/main.ts b/viewer/src/main.ts index 1f77875..847048f 100644 --- a/viewer/src/main.ts +++ b/viewer/src/main.ts @@ -19,7 +19,7 @@ import Vue from "vue"; import "@/assets/scss/global.scss"; -import store from '@/store' +import store from "@/store" import i18n from "@/plugins/i18n"; import router from "@/plugins/router"; Vue.config.productionTip = false; diff --git a/viewer/src/plugins/buefy.ts b/viewer/src/plugins/buefy.ts index ebdf64e..0f8e16b 100644 --- a/viewer/src/plugins/buefy.ts +++ b/viewer/src/plugins/buefy.ts @@ -20,13 +20,13 @@ import Vue from "vue"; // @ts-ignore -import Taginput from 'buefy/src/components/taginput'; +import Taginput from "buefy/src/components/taginput"; // @ts-ignore -import Loading from 'buefy/src/components/loading'; +import Loading from "buefy/src/components/loading"; // @ts-ignore -import Button from 'buefy/src/components/button'; +import Button from "buefy/src/components/button"; // @ts-ignore -import SnackBar from 'buefy/src/components/snackbar'; +import SnackBar from "buefy/src/components/snackbar"; import "@/assets/scss/buefy.scss"; @@ -35,8 +35,8 @@ Vue.use(Loading); Vue.use(Button); Vue.use(SnackBar); -declare module 'vue/types/vue' { - interface Vue { - $buefy: any; - } +declare module "vue/types/vue" { + interface Vue { + $buefy: any; + } } diff --git a/viewer/src/plugins/dragscroll.ts b/viewer/src/plugins/dragscroll.ts index f6d88bb..a10b0fd 100644 --- a/viewer/src/plugins/dragscroll.ts +++ b/viewer/src/plugins/dragscroll.ts @@ -18,7 +18,6 @@ */ import Vue from "vue"; -import VueDragscroll from 'vue-dragscroll'; +import VueDragscroll from "vue-dragscroll"; Vue.use(VueDragscroll); - diff --git a/viewer/src/plugins/fontawesome.ts b/viewer/src/plugins/fontawesome.ts index cc8b7ab..480e8e0 100644 --- a/viewer/src/plugins/fontawesome.ts +++ b/viewer/src/plugins/fontawesome.ts @@ -22,33 +22,33 @@ import Vue from "vue"; import { library, config } from "@fortawesome/fontawesome-svg-core"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { - faFolder, - faEraser, - faSearch, - faPlus, - faMinus, - faImage, - faHome, - faArrowLeft, - faLevelUpAlt, - faAngleRight, - faAngleDoubleLeft, - faFile, + faFolder, + faEraser, + faSearch, + faPlus, + faMinus, + faImage, + faHome, + faArrowLeft, + faLevelUpAlt, + faAngleRight, + faAngleDoubleLeft, + faFile, } from "@fortawesome/free-solid-svg-icons"; library.add( - faFolder, - faEraser, - faSearch, - faPlus, - faMinus, - faImage, - faHome, - faArrowLeft, - faLevelUpAlt, - faAngleRight, - faAngleDoubleLeft, - faFile, + faFolder, + faEraser, + faSearch, + faPlus, + faMinus, + faImage, + faHome, + faArrowLeft, + faLevelUpAlt, + faAngleRight, + faAngleDoubleLeft, + faFile, ); config.autoAddCss = false; diff --git a/viewer/src/services/indexfactory.ts b/viewer/src/services/indexfactory.ts index 18a2800..e402185 100644 --- a/viewer/src/services/indexfactory.ts +++ b/viewer/src/services/indexfactory.ts @@ -17,8 +17,8 @@ -- along with this program. If not, see . */ -import { Operation } from '@/@types/Operation'; -import Navigation from '@/services/navigation'; +import { Operation } from "@/@types/Operation"; +import Navigation from "@/services/navigation"; export default class IndexFactory { @@ -35,7 +35,7 @@ export default class IndexFactory { return; // Directories are not indexed } for (const tag of item.tags) { - const parts = tag.split(':'); + const parts = tag.split(":"); let lastPart: string | null = null; for (const part of parts) { tagsIndex[part] = IndexFactory.pushPartToIndex(tagsIndex[part], part, item, !Boolean(lastPart)); diff --git a/viewer/src/services/indexsearch.ts b/viewer/src/services/indexsearch.ts index cd3383a..a55a829 100644 --- a/viewer/src/services/indexsearch.ts +++ b/viewer/src/services/indexsearch.ts @@ -17,7 +17,7 @@ -- along with this program. If not, see . */ -import { Operation } from '@/@types/Operation'; +import { Operation } from "@/@types/Operation"; export default class IndexSearch { diff --git a/viewer/src/services/ldzoom.ts b/viewer/src/services/ldzoom.ts index c28c2c8..ddf57c0 100644 --- a/viewer/src/services/ldzoom.ts +++ b/viewer/src/services/ldzoom.ts @@ -18,7 +18,7 @@ */ // polyfill still required for IE and Safari, see https://caniuse.com/#feat=resizeobserver -import ResizeObserver from 'resize-observer-polyfill'; +import ResizeObserver from "resize-observer-polyfill"; import "hammerjs"; /** @@ -54,25 +54,25 @@ export default class LdZoom { this.updateImageScale(this.scaleFactor); }).observe(this.containerElement); - this.containerElement.addEventListener('wheel', wheelEvent => { + this.containerElement.addEventListener("wheel", wheelEvent => { wheelEvent.preventDefault(); const scaleFactor = this.scaleFactor - Math.sign(wheelEvent.deltaY) * this.scrollZoomSpeed; this.zoom(wheelEvent.offsetX, wheelEvent.offsetY, scaleFactor); }); const pinchListener = new Hammer(this.containerElement); - pinchListener.get('pinch').set({enable: true}); + pinchListener.get("pinch").set({ enable: true }); this.installPinchHandler(pinchListener); } private installPinchHandler(pinchListener: HammerManager) { let startScaleFactor = 0.0; - pinchListener.on('pinchstart', (pinchEvent: HammerInput) => { + pinchListener.on("pinchstart", (pinchEvent: HammerInput) => { startScaleFactor = this.scaleFactor; }); - pinchListener.on('pinchmove', (pinchEvent: HammerInput) => { + pinchListener.on("pinchmove", (pinchEvent: HammerInput) => { const focusX = pinchEvent.center.x + this.containerElement.scrollLeft; const focusY = pinchEvent.center.y + this.containerElement.scrollTop; const scaleFactor = pinchEvent.scale * startScaleFactor; diff --git a/viewer/src/shims-tsx.d.ts b/viewer/src/shims-tsx.d.ts index 2bcdf9f..036d206 100644 --- a/viewer/src/shims-tsx.d.ts +++ b/viewer/src/shims-tsx.d.ts @@ -3,9 +3,9 @@ import Vue, { VNode } from "vue"; declare global { namespace JSX { // tslint:disable no-empty-interface - interface Element extends VNode {} + interface Element extends VNode { } // tslint:disable no-empty-interface - interface ElementClass extends Vue {} + interface ElementClass extends Vue { } interface IntrinsicElements { [elem: string]: any; } diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts index 352a266..0cffdd9 100644 --- a/viewer/src/store/galleryStore.ts +++ b/viewer/src/store/galleryStore.ts @@ -18,105 +18,105 @@ */ import { createModule, mutation, action } from "vuex-class-component"; -import IndexFactory from '@/services/indexfactory'; -import Navigation from '@/services/navigation'; +import IndexFactory from "@/services/indexfactory"; +import Navigation from "@/services/navigation"; const VuexModule = createModule({ - namespaced: "galleryStore", - strict: true + namespaced: "galleryStore", + strict: true }) export default class GalleryStore extends VuexModule { - config: Gallery.Config | null = null; - galleryIndex: Gallery.Index | null = null; - tagsIndex: Tag.Index = {}; - tagsCategories: Tag.Category[] = []; - currentPath: string = "/"; - currentSearch: Tag.Search[] = []; - - // --- - - @mutation private setConfig(config: Gallery.Config) { - this.config = config; - } - - @mutation setGalleryIndex(galleryIndex: Gallery.Index) { - this.galleryIndex = Object.freeze(galleryIndex); - } - - @mutation private setTagsIndex(tagsIndex: Tag.Index) { - this.tagsIndex = Object.freeze(tagsIndex); - } - - @mutation private setTagsCategories(tagsCategories: Tag.Category[]) { - this.tagsCategories = tagsCategories; - } - - @mutation setCurrentPath(currentPath: string) { - this.currentPath = currentPath; - } - - @mutation setCurrentSearch(currentSearch: Tag.Search[]) { - this.currentSearch = currentSearch; - } - - // --- - - get currentItemPath(): Gallery.Item[] { - const root = this.galleryIndex?.tree; - if (root) - return Navigation.searchCurrentItemPath(root, this.currentPath); - return []; - } - - get currentItem(): Gallery.Item | null { - const path = this.currentItemPath; - return path.length > 0 ? path[path.length - 1] : null; - } - - get galleryTitle(): string { - return this.galleryIndex?.properties.galleryTitle ?? "ldgallery"; - } - - // --- - - // Fetches the gallery's JSON config - @action async fetchConfig() { - return fetch(`${process.env.VUE_APP_DATA_URL}config.json`, { cache: "no-cache" }) - .then(response => response.json()) - .then(this.setConfig); - } - - // Fetches the gallery's JSON metadata - @action async fetchGalleryItems() { - const root = this.config?.galleryRoot ?? ''; - return fetch(`${process.env.VUE_APP_DATA_URL}${root}index.json`, { cache: "no-cache" }) - .then(response => response.json()) - .then(this.setGalleryIndex) - .then(this.indexTags) - .then(this.indexTagCategories); - } - - // Indexes the gallery - @action async indexTags() { - const root = this.galleryIndex?.tree ?? null; - const index = IndexFactory.generateTags(root); - this.setTagsIndex(index); - return index; - } - - // Indexes the proposed categories - @action async indexTagCategories() { - const categories = IndexFactory.generateCategories(this.tagsIndex, this.galleryIndex?.properties.tagCategories); - this.setTagsCategories(categories); - return categories; - } - - // Searches for tags - @action async search(filters: string[]) { - const results = filters.flatMap(filter => IndexFactory.searchTags(this.tagsIndex, filter, true)); - this.setCurrentSearch(results); - return results; - } + config: Gallery.Config | null = null; + galleryIndex: Gallery.Index | null = null; + tagsIndex: Tag.Index = {}; + tagsCategories: Tag.Category[] = []; + currentPath: string = "/"; + currentSearch: Tag.Search[] = []; + + // --- + + @mutation private setConfig(config: Gallery.Config) { + this.config = config; + } + + @mutation setGalleryIndex(galleryIndex: Gallery.Index) { + this.galleryIndex = Object.freeze(galleryIndex); + } + + @mutation private setTagsIndex(tagsIndex: Tag.Index) { + this.tagsIndex = Object.freeze(tagsIndex); + } + + @mutation private setTagsCategories(tagsCategories: Tag.Category[]) { + this.tagsCategories = tagsCategories; + } + + @mutation setCurrentPath(currentPath: string) { + this.currentPath = currentPath; + } + + @mutation setCurrentSearch(currentSearch: Tag.Search[]) { + this.currentSearch = currentSearch; + } + + // --- + + get currentItemPath(): Gallery.Item[] { + const root = this.galleryIndex?.tree; + if (root) + return Navigation.searchCurrentItemPath(root, this.currentPath); + return []; + } + + get currentItem(): Gallery.Item | null { + const path = this.currentItemPath; + return path.length > 0 ? path[path.length - 1] : null; + } + + get galleryTitle(): string { + return this.galleryIndex?.properties.galleryTitle ?? "ldgallery"; + } + + // --- + + // Fetches the gallery's JSON config + @action async fetchConfig() { + return fetch(`${process.env.VUE_APP_DATA_URL}config.json`, { cache: "no-cache" }) + .then(response => response.json()) + .then(this.setConfig); + } + + // Fetches the gallery's JSON metadata + @action async fetchGalleryItems() { + const root = this.config?.galleryRoot ?? ""; + return fetch(`${process.env.VUE_APP_DATA_URL}${root}index.json`, { cache: "no-cache" }) + .then(response => response.json()) + .then(this.setGalleryIndex) + .then(this.indexTags) + .then(this.indexTagCategories); + } + + // Indexes the gallery + @action async indexTags() { + const root = this.galleryIndex?.tree ?? null; + const index = IndexFactory.generateTags(root); + this.setTagsIndex(index); + return index; + } + + // Indexes the proposed categories + @action async indexTagCategories() { + const categories = IndexFactory.generateCategories(this.tagsIndex, this.galleryIndex?.properties.tagCategories); + this.setTagsCategories(categories); + return categories; + } + + // Searches for tags + @action async search(filters: string[]) { + const results = filters.flatMap(filter => IndexFactory.searchTags(this.tagsIndex, filter, true)); + this.setCurrentSearch(results); + return results; + } } diff --git a/viewer/src/store/index.ts b/viewer/src/store/index.ts index 956d4fd..d5339e8 100644 --- a/viewer/src/store/index.ts +++ b/viewer/src/store/index.ts @@ -17,12 +17,12 @@ -- along with this program. If not, see . */ -import Vue from 'vue' -import Vuex from 'vuex' +import Vue from "vue" +import Vuex from "vuex" import { extractVuexModule } from "vuex-class-component"; import { createProxy } from "vuex-class-component"; -import UIStore from '@/store/uiStore'; -import GalleryStore from '@/store/galleryStore'; +import UIStore from "@/store/uiStore"; +import GalleryStore from "@/store/galleryStore"; Vue.use(Vuex) @@ -37,7 +37,7 @@ const store = new Vuex.Store({ Vue.use((vue) => vue.prototype.$uiStore = createProxy(store, UIStore)); Vue.use((vue) => vue.prototype.$galleryStore = createProxy(store, GalleryStore)); -declare module 'vue/types/vue' { +declare module "vue/types/vue" { interface Vue { $uiStore: UIStore, $galleryStore: GalleryStore diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts index 2bd315c..892d35e 100644 --- a/viewer/src/store/uiStore.ts +++ b/viewer/src/store/uiStore.ts @@ -20,27 +20,27 @@ import { createModule, mutation, action } from "vuex-class-component"; const VuexModule = createModule({ - namespaced: "uiStore", - strict: true + namespaced: "uiStore", + strict: true }) export default class UIStore extends VuexModule { - fullscreen: boolean = false; - fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); - searchMode: boolean = false; + fullscreen: boolean = false; + fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); + searchMode: boolean = false; - // --- + // --- - @mutation toggleFullscreen(value?: boolean) { - this.fullscreen = value ?? !this.fullscreen; - } + @mutation toggleFullscreen(value?: boolean) { + this.fullscreen = value ?? !this.fullscreen; + } - @mutation toggleFullWidth(value?: boolean) { - this.fullWidth = value ?? !this.fullWidth; - } + @mutation toggleFullWidth(value?: boolean) { + this.fullWidth = value ?? !this.fullWidth; + } - @mutation toggleSearchMode(value?: boolean) { - this.searchMode = value ?? !this.searchMode; - } + @mutation toggleSearchMode(value?: boolean) { + this.searchMode = value ?? !this.searchMode; + } } -- cgit v1.2.3