mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-25 04:18:48 +02:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edcc43a6ee | ||
|
|
9723854ddc | ||
|
|
7501817b76 | ||
|
|
4affd4aaec | ||
|
|
6b3db72a14 | ||
|
|
58b69f0d6c | ||
|
|
c62102e993 | ||
|
|
2e66e5a555 |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,3 +1,31 @@
|
|||||||
|
## [3.18.10](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.9...v3.18.10) (2023-01-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **SuspensefulImage:** fix changing src ([9723854](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/9723854ddca53d7708e1effbddec9e5ead22d5de))
|
||||||
|
|
||||||
|
## [3.18.9](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.8...v3.18.9) (2023-01-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Navigation:** fix on stable ([4affd4a](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/4affd4aaec088f01d0f30af48cb4daa34acf26b1))
|
||||||
|
|
||||||
|
## [3.18.8](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.7...v3.18.8) (2023-01-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Navigation:** fix timing issue in decky-loader ([58b69f0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/58b69f0d6c43356c4f0ed183802d5bf7fb80e978))
|
||||||
|
|
||||||
|
## [3.18.7](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.6...v3.18.7) (2023-01-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* un-break navigation on stable ([2e66e5a](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/2e66e5a555f44009d24e332eca82453ba930baf7))
|
||||||
|
|
||||||
## [3.18.6](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.5...v3.18.6) (2023-01-13)
|
## [3.18.6](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.5...v3.18.6) (2023-01-13)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "decky-frontend-lib",
|
"name": "decky-frontend-lib",
|
||||||
"version": "3.18.6",
|
"version": "3.18.10",
|
||||||
"description": "A library for building decky plugins",
|
"description": "A library for building decky plugins",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ export const SuspensefulImage: FC<SuspensefulImageProps> = (props) => {
|
|||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setLoading(true);
|
||||||
|
setError(false);
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = props.src || '';
|
img.src = props.src || '';
|
||||||
img.addEventListener('load', () => {
|
img.addEventListener('load', () => {
|
||||||
@@ -21,7 +23,7 @@ export const SuspensefulImage: FC<SuspensefulImageProps> = (props) => {
|
|||||||
img.addEventListener('error', () => {
|
img.addEventListener('error', () => {
|
||||||
setError(true);
|
setError(true);
|
||||||
});
|
});
|
||||||
}, []);
|
}, [props.src]);
|
||||||
|
|
||||||
return loading ? (
|
return loading ? (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { sleep } from '../utils';
|
||||||
import { Module, findModuleChild } from '../webpack';
|
import { Module, findModuleChild } from '../webpack';
|
||||||
|
|
||||||
export enum SideMenu {
|
export enum SideMenu {
|
||||||
@@ -107,16 +108,6 @@ export const Router = findModuleChild((m: Module) => {
|
|||||||
}
|
}
|
||||||
}) as Router;
|
}) as Router;
|
||||||
|
|
||||||
// With how much Valve is changing these, you really shouldn't use them directly, instead see Navigation
|
|
||||||
export const InternalNavigators = findModuleChild((m: any) => {
|
|
||||||
if (typeof m !== 'object') return undefined;
|
|
||||||
for (let prop in m) {
|
|
||||||
if (m[prop]?.GetNavigator) {
|
|
||||||
return m[prop];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})?.GetNavigator()
|
|
||||||
|
|
||||||
export interface Navigation {
|
export interface Navigation {
|
||||||
Navigate(path: string): void;
|
Navigate(path: string): void;
|
||||||
NavigateBack(): void;
|
NavigateBack(): void;
|
||||||
@@ -138,35 +129,62 @@ export interface Navigation {
|
|||||||
export let Navigation = {} as Navigation;
|
export let Navigation = {} as Navigation;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Navigation = {
|
(async () => {
|
||||||
Navigate: Router.Navigate.bind(Router),
|
let InternalNavigators: any = {};
|
||||||
NavigateBack: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateBack.bind(
|
if (!Router.NavigateToAppProperties || (Router as unknown as any).deckyShim) {
|
||||||
Router.WindowStore.GamepadUIMainWindowInstance,
|
function initInternalNavigators() {
|
||||||
),
|
try {
|
||||||
NavigateToAppProperties: InternalNavigators.AppProperties || Router.NavigateToAppProperties.bind(Router),
|
InternalNavigators = findModuleChild((m: any) => {
|
||||||
NavigateToExternalWeb: Router.NavigateToExternalWeb.bind(Router),
|
if (typeof m !== 'object') return undefined;
|
||||||
NavigateToInvites: InternalNavigators.Invites || Router.NavigateToInvites.bind(Router),
|
for (let prop in m) {
|
||||||
NavigateToChat: Router.NavigateToChat.bind(Router),
|
if (m[prop]?.GetNavigator) {
|
||||||
NavigateToLibraryTab: InternalNavigators.LibraryTab || Router.NavigateToLibraryTab.bind(Router),
|
return m[prop];
|
||||||
NavigateToLayoutPreview: Router.NavigateToLayoutPreview.bind(Router),
|
}
|
||||||
NavigateToSteamWeb: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateToSteamWeb.bind(
|
}
|
||||||
Router.WindowStore.GamepadUIMainWindowInstance,
|
})?.GetNavigator();
|
||||||
),
|
} catch (e) {
|
||||||
NavigateToWebRoute: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateToWebRoute.bind(
|
console.error('[DFL:Router]: Failed to init internal navigators, trying again');
|
||||||
Router.WindowStore.GamepadUIMainWindowInstance,
|
}
|
||||||
),
|
}
|
||||||
OpenSideMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenSideMenu.bind(
|
initInternalNavigators();
|
||||||
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
|
while (!InternalNavigators?.AppProperties) {
|
||||||
),
|
console.log('[DFL:Router]: Trying to init internal navigators again');
|
||||||
OpenQuickAccessMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenQuickAccessMenu.bind(
|
await sleep(100);
|
||||||
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
|
initInternalNavigators();
|
||||||
),
|
}
|
||||||
OpenMainMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenMainMenu.bind(
|
}
|
||||||
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
|
const newNavigation = {
|
||||||
),
|
Navigate: Router.Navigate.bind(Router),
|
||||||
CloseSideMenus: Router.CloseSideMenus.bind(Router),
|
NavigateBack: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateBack.bind(
|
||||||
OpenPowerMenu: Router.OpenPowerMenu.bind(Router),
|
Router.WindowStore.GamepadUIMainWindowInstance,
|
||||||
} as Navigation;
|
),
|
||||||
|
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),
|
||||||
|
} as Navigation;
|
||||||
|
|
||||||
|
Object.assign(Navigation, newNavigation);
|
||||||
|
})();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("[DFL:Router]: Error initializing Navigation interface", e)
|
console.error('[DFL:Router]: Error initializing Navigation interface', e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user