decky-frontend-lib
Advanced tools
Comparing version 3.18.7 to 3.18.8
@@ -94,3 +94,2 @@ export declare enum SideMenu { | ||
export declare const Router: Router; | ||
export declare const InternalNavigators: any; | ||
export interface Navigation { | ||
@@ -97,0 +96,0 @@ Navigate(path: string): void; |
@@ -0,1 +1,2 @@ | ||
import { sleep } from '../utils'; | ||
import { findModuleChild } from '../webpack'; | ||
@@ -66,34 +67,52 @@ export var SideMenu; | ||
}); | ||
// With how much Valve is changing these, you really shouldn't use them directly, instead see Navigation | ||
export const InternalNavigators = findModuleChild((m) => { | ||
if (typeof m !== 'object') | ||
return undefined; | ||
for (let prop in m) { | ||
if (m[prop]?.GetNavigator) { | ||
return m[prop]; | ||
} | ||
} | ||
})?.GetNavigator(); | ||
export let Navigation = {}; | ||
try { | ||
Navigation = { | ||
Navigate: Router.Navigate.bind(Router), | ||
NavigateBack: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateBack.bind(Router.WindowStore.GamepadUIMainWindowInstance), | ||
NavigateToAppProperties: InternalNavigators?.AppProperties || Router.NavigateToAppProperties.bind(Router), | ||
NavigateToExternalWeb: Router.NavigateToExternalWeb.bind(Router), | ||
NavigateToInvites: InternalNavigators?.Invites || Router.NavigateToInvites.bind(Router), | ||
NavigateToChat: Router.NavigateToChat.bind(Router), | ||
NavigateToLibraryTab: InternalNavigators?.LibraryTab || Router.NavigateToLibraryTab.bind(Router), | ||
NavigateToLayoutPreview: Router.NavigateToLayoutPreview.bind(Router), | ||
NavigateToSteamWeb: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateToSteamWeb.bind(Router.WindowStore.GamepadUIMainWindowInstance), | ||
NavigateToWebRoute: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateToWebRoute.bind(Router.WindowStore.GamepadUIMainWindowInstance), | ||
OpenSideMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenSideMenu.bind(Router.WindowStore.GamepadUIMainWindowInstance.MenuStore), | ||
OpenQuickAccessMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenQuickAccessMenu.bind(Router.WindowStore.GamepadUIMainWindowInstance.MenuStore), | ||
OpenMainMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenMainMenu.bind(Router.WindowStore.GamepadUIMainWindowInstance.MenuStore), | ||
CloseSideMenus: Router.CloseSideMenus.bind(Router), | ||
OpenPowerMenu: Router.OpenPowerMenu.bind(Router), | ||
}; | ||
(async () => { | ||
// With how much Valve is changing these, you really shouldn't use them directly, instead see Navigation | ||
let InternalNavigators; | ||
function initInternalNavigators() { | ||
try { | ||
InternalNavigators = findModuleChild((m) => { | ||
if (typeof m !== 'object') | ||
return undefined; | ||
for (let prop in m) { | ||
if (m[prop]?.GetNavigator) { | ||
return m[prop]; | ||
} | ||
} | ||
})?.GetNavigator(); | ||
} | ||
catch (e) { | ||
console.error('[DFL:Router]: Failed to init internal navigators, trying again'); | ||
} | ||
} | ||
initInternalNavigators(); | ||
while (!InternalNavigators?.AppProperties) { | ||
console.log('[DFL:Router]: Trying to init internal navigators again'); | ||
await sleep(100); | ||
initInternalNavigators(); | ||
} | ||
console.log("got navigators", InternalNavigators); | ||
const newNavigation = { | ||
Navigate: Router.Navigate.bind(Router), | ||
NavigateBack: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateBack.bind(Router.WindowStore.GamepadUIMainWindowInstance), | ||
NavigateToAppProperties: InternalNavigators?.AppProperties || Router.NavigateToAppProperties.bind(Router), | ||
NavigateToExternalWeb: Router.NavigateToExternalWeb.bind(Router), | ||
NavigateToInvites: InternalNavigators?.Invites || Router.NavigateToInvites.bind(Router), | ||
NavigateToChat: Router.NavigateToChat.bind(Router), | ||
NavigateToLibraryTab: InternalNavigators?.LibraryTab || Router.NavigateToLibraryTab.bind(Router), | ||
NavigateToLayoutPreview: Router.NavigateToLayoutPreview.bind(Router), | ||
NavigateToSteamWeb: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateToSteamWeb.bind(Router.WindowStore.GamepadUIMainWindowInstance), | ||
NavigateToWebRoute: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateToWebRoute.bind(Router.WindowStore.GamepadUIMainWindowInstance), | ||
OpenSideMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenSideMenu.bind(Router.WindowStore.GamepadUIMainWindowInstance.MenuStore), | ||
OpenQuickAccessMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenQuickAccessMenu.bind(Router.WindowStore.GamepadUIMainWindowInstance.MenuStore), | ||
OpenMainMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenMainMenu.bind(Router.WindowStore.GamepadUIMainWindowInstance.MenuStore), | ||
CloseSideMenus: Router.CloseSideMenus.bind(Router), | ||
OpenPowerMenu: Router.OpenPowerMenu.bind(Router), | ||
}; | ||
Object.assign(Navigation, newNavigation); | ||
})(); | ||
} | ||
catch (e) { | ||
console.error("[DFL:Router]: Error initializing Navigation interface", e); | ||
console.error('[DFL:Router]: Error initializing Navigation interface', e); | ||
} |
{ | ||
"name": "decky-frontend-lib", | ||
"version": "3.18.7", | ||
"version": "3.18.8", | ||
"description": "A library for building decky plugins", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
199520
4765