diff --git a/package.json b/package.json index dc080dd..ba540ed 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@types/react-window": "^1.8.5", "@types/uuid": "^9.0.2", "@types/webpack": "^5.28.1", - "decky-frontend-lib": "^3.21.8", + "decky-frontend-lib": "^3.24.5", "husky": "^8.0.3", "markdown-it": "^13.0.1", "rollup": "^2.79.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7481588..3b2e89b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,8 +61,8 @@ devDependencies: specifier: ^5.28.1 version: 5.28.1 decky-frontend-lib: - specifier: ^3.21.8 - version: 3.21.8 + specifier: ^3.24.5 + version: 3.24.5 husky: specifier: ^8.0.3 version: 8.0.3 @@ -960,8 +960,8 @@ packages: engines: {node: '>=0.10.0'} dev: true - /decky-frontend-lib@3.21.8: - resolution: {integrity: sha512-I45KWzoTSakUcsN7drHhiOc+rYKYygIsuYTHqc8DbpPDJvUx6xlU4t7D2TMrj9o/xS/V3WY9N/pX8eF6AcGT1g==} + /decky-frontend-lib@3.24.5: + resolution: {integrity: sha512-eYlbKDOOcIBPI0b76Rqvlryq2ym/QNiry4xf2pFrXmBa1f95dflqbQAb2gTq9uHEa5gFmeV4lUcMPGJ3M14Xqw==} dev: true /deepmerge@4.3.1: diff --git a/src/components/CustomTabContainer.tsx b/src/components/CustomTabContainer.tsx index 71e7d67..828695e 100644 --- a/src/components/CustomTabContainer.tsx +++ b/src/components/CustomTabContainer.tsx @@ -51,7 +51,9 @@ export class CustomTabContainer implements TabContainer { id: this.id }; - this.buildCollection(); + if (this.position > -1) { + this.buildCollection(); + } this.checkMicroSDeckDependency(); } @@ -79,33 +81,31 @@ export class CustomTabContainer implements TabContainer { * Builds the list of apps for this tab. */ buildCollection() { - if (this.position > -1) { - const {hidden, ...catsToIncludeObj} = getIncludedCategoriesFromBitField(this.categoriesToInclude); - const visibility = hidden ? "allApps" : "visibleApps"; - let listToFilter: SteamAppOverview[] = []; - - for (const key in catsToIncludeObj) { - const category = key as keyof typeof catsToIncludeObj; - if (catsToIncludeObj[category]) listToFilter = listToFilter.concat(collectionStore.appTypeCollectionMap.get(`type-${category}`)![visibility]); + const { hidden, ...catsToIncludeObj } = getIncludedCategoriesFromBitField(this.categoriesToInclude); + const visibility = hidden ? "allApps" : "visibleApps"; + let listToFilter: SteamAppOverview[] = []; + + for (const key in catsToIncludeObj) { + const category = key as keyof typeof catsToIncludeObj; + if (catsToIncludeObj[category]) listToFilter = listToFilter.concat(collectionStore.appTypeCollectionMap.get(`type-${category}`)![visibility]); + } + + const appsList = listToFilter.filter(appItem => { + if (this.filtersMode === 'and') { + return this.filters.every(filterSettings => Filter.run(filterSettings, appItem)); + } else { + return this.filters.some(filterSettings => Filter.run(filterSettings, appItem)); } - - const appsList = listToFilter.filter(appItem => { - if (this.filtersMode === 'and') { - return this.filters.every(filterSettings => Filter.run(filterSettings, appItem)); - } else { - return this.filters.some(filterSettings => Filter.run(filterSettings, appItem)); - } - }); + }); - this.collection.allApps = appsList; - this.collection.visibleApps = [...appsList]; + this.collection.allApps = appsList; + this.collection.visibleApps = [...appsList]; - const allAppsMap = collectionStore.allAppsCollection.apps; - const appMap = new Map(); - appsList.forEach((appItem: SteamAppOverview) => appMap.set(appItem.appid, allAppsMap.get(appItem.appid)!)); + const allAppsMap = collectionStore.allAppsCollection.apps; + const appMap = new Map(); + appsList.forEach((appItem: SteamAppOverview) => appMap.set(appItem.appid, allAppsMap.get(appItem.appid)!)); - this.collection.apps = appMap; - } + this.collection.apps = appMap; } /** diff --git a/src/components/QuickAccessContent.tsx b/src/components/QuickAccessContent.tsx index 49ab725..12d0838 100644 --- a/src/components/QuickAccessContent.tsx +++ b/src/components/QuickAccessContent.tsx @@ -107,20 +107,20 @@ export const QuickAccessContent: VFC<{}> = ({ }) => { - showModalNewTab(tabMasterManager)} onOKActionDescription={'Add Tab'}> + showModalNewTab(tabMasterManager)} onOKActionDescription={'Add Tab'}> Add Tab - {tabMasterManager.hasSettingsLoaded && - - showContextMenu()} - > - - - } + + showContextMenu()} + > + + + @@ -186,6 +186,7 @@ export const QuickAccessTitleView: VFC = ({ title, ta >
{title}
showContextMenu()} diff --git a/src/components/docs/DocsPage.tsx b/src/components/docs/DocsPage.tsx index 3fa4cac..4470f8d 100644 --- a/src/components/docs/DocsPage.tsx +++ b/src/components/docs/DocsPage.tsx @@ -1,8 +1,6 @@ import { VFC, Fragment } from "react"; - import MarkDownIt from "markdown-it"; -import { ModalPosition, Panel, ScrollPanelGroup } from "./Scrollable"; -import { gamepadDialogClasses } from "decky-frontend-lib"; +import { Focusable, gamepadDialogClasses, ModalPosition, ScrollPanelGroup } from "decky-frontend-lib"; const mdIt = new MarkDownIt({ html: true @@ -51,13 +49,18 @@ export const DocPage: VFC<{ content: string }> = ({ content }) => { `}
- - - + + + {}} noFocusRing={true} >
- + - +
diff --git a/src/components/docs/Scrollable.tsx b/src/components/docs/Scrollable.tsx deleted file mode 100644 index 3dba939..0000000 --- a/src/components/docs/Scrollable.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { findModuleChild } from "decky-frontend-lib"; -import { FC } from "react" - -interface SimpleModalProps{ - active?: boolean -} - -const ModalModule = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - if (mod.SimpleModal && mod.ModalPosition) return mod; -}) - -const ScrollingModule = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - if (mod.ScrollPanel) return mod; -}) - -export const ScrollPanelGroup = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - return mod.ScrollPanelGroup; -}) - -export const Panel = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - return mod.Panel; -}) - -export const ScrollPanel = ScrollingModule.ScrollPanel; -export const SimpleModal = ModalModule.SimpleModal as FC -export const ModalPosition = ModalModule.ModalPosition as FC diff --git a/src/components/generic/ScrollableWindow.tsx b/src/components/generic/ScrollableWindow.tsx index 87981c4..312b101 100644 --- a/src/components/generic/ScrollableWindow.tsx +++ b/src/components/generic/ScrollableWindow.tsx @@ -1,6 +1,5 @@ -import { GamepadButton, gamepadDialogClasses, scrollPanelClasses } from 'decky-frontend-lib'; +import { GamepadButton, gamepadDialogClasses, scrollPanelClasses, ModalPosition, ScrollPanelGroup, Focusable } from 'decky-frontend-lib'; import { FC, Fragment, useRef } from 'react'; -import { ModalPosition, Panel, ScrollPanelGroup } from '../docs/Scrollable'; import { useIsOverflowing } from '../../hooks/useIsOverflowing'; export interface ScrollableWindowProps { @@ -15,16 +14,23 @@ export const ScrollableWindow: FC = ({ height, fadeAmount const isOverflowing = useIsOverflowing(scrollPanelRef); const panel = ( - - + + }} + //@ts-ignore + focusable={isOverflowing} + > {children} - +
); diff --git a/src/lib/controllers/TabErrorController.tsx b/src/lib/controllers/TabErrorController.tsx index fb5585d..313c1f4 100644 --- a/src/lib/controllers/TabErrorController.tsx +++ b/src/lib/controllers/TabErrorController.tsx @@ -47,8 +47,11 @@ export class TabErrorController { onConfirm={(editedTabSettings: TabSettingsDictionary) => { for (const tab of Object.values(editedTabSettings)) { if (tabsToFix.has(tab.id)) { - if (tab.filters!.length === 0) tabMasterManager.deleteTab(tab.id); - else tabMasterManager.updateCustomTab(tab.id, tab as EditableTabSettings); + if (tab.filters!.length === 0) { + tabMasterManager.deleteTab(tab.id); + } else { + tabMasterManager.updateCustomTab(tab.id, tab as EditableTabSettings); + } } } @@ -70,8 +73,11 @@ export class TabErrorController { */ private static processQueue = (tabMasterManager: TabMasterManager) => { const validationSet = this.validationQueue.splice(0, this.validationQueue.length); - if (validationSet.length > 0) this.validateInternal(validationSet, tabMasterManager); - else this.validationLock = false; + if (validationSet.length > 0) { + this.validateInternal(validationSet, tabMasterManager); + } else { + this.validationLock = false; + } } /** @@ -131,7 +137,7 @@ export class TabErrorController { onConfirm={(editedTabSettings: TabSettingsDictionary) => { const tabsToDelete: string[] = []; for (const tab of Object.values(editedTabSettings)) { - if (tabsToFix.has(tab.id) && tab.filters!.length === 0) tabsToDelete.push(); + if (tabsToFix.has(tab.id) && tab.filters!.length === 0) tabsToDelete.push(tab.id); } finishLoading(editedTabSettings); diff --git a/src/state/TabProfileManager.tsx b/src/state/TabProfileManager.tsx index ac6b631..404a607 100644 --- a/src/state/TabProfileManager.tsx +++ b/src/state/TabProfileManager.tsx @@ -1,3 +1,4 @@ +import { CustomTabContainer } from '../components/CustomTabContainer'; import { PythonInterop } from '../lib/controllers/PythonInterop'; import { TabMasterManager } from './TabMasterManager'; @@ -32,7 +33,13 @@ export class TabProfileManager { * @param tabMasterManager The plugin manager. */ apply(tabProfileName: string, tabMasterManager: TabMasterManager) { - tabMasterManager.getTabs().tabsMap.forEach(tabContainer => tabContainer.position = -1); + const { visibleTabsList, hiddenTabsList } = tabMasterManager.getTabs(); + hiddenTabsList.forEach(tabContainer => { + if (tabContainer.filters && (tabContainer as CustomTabContainer).collection.allApps === undefined) { + (tabContainer as CustomTabContainer).buildCollection(); + } + }); + visibleTabsList.forEach(tabContainer => tabContainer.position = -1); tabMasterManager.reorderTabs(this.tabProfiles[tabProfileName]); }