mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-19 17:40:08 +02:00
Merge branch 'main' of https://github.com/Tormak9970/decky-frontend-lib
This commit is contained in:
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,3 +1,24 @@
|
||||
## [3.19.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.19.1...v3.19.2) (2023-03-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Item:** add highlightOnFocus prop ([c53f87b](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/c53f87b4a9273b377853bfff1d27474ebd6e564a))
|
||||
|
||||
## [3.19.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.19.0...v3.19.1) (2023-02-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* refactoring to fix for feb 22 2023 beta ([0b6dc24](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/0b6dc24c0da2d7644e185425e975787657f8bba1))
|
||||
|
||||
# [3.19.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.11...v3.19.0) (2023-02-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added reorderable list and updated fieldProps ([#57](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/57)) ([5a074b5](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/5a074b5bb68c675c484a7b693f67a67488be9bcf))
|
||||
|
||||
## [3.18.11](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.10...v3.18.11) (2023-02-18)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "3.18.11",
|
||||
"version": "3.19.2",
|
||||
"description": "A library for building decky plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
3113
pnpm-lock.yaml
generated
3113
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,13 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
declare global {
|
||||
var FocusNavController: any;
|
||||
}
|
||||
import { getFocusNavController } from '../utils';
|
||||
|
||||
function getQuickAccessWindow(): Window | null {
|
||||
try {
|
||||
const context = FocusNavController?.m_ActiveContext || FocusNavController?.m_LastActiveContext;
|
||||
const navTrees = context?.m_rgGamepadNavigationTrees || FocusNavController?.m_rgGamepadNavigationTrees;
|
||||
return navTrees?.find((tree: any) => tree?.id === "QuickAccess-NA")?.m_Root?.m_element?.ownerDocument.defaultView ?? null;
|
||||
const navTrees = getFocusNavController()?.m_rgGamepadNavigationTrees;
|
||||
return (
|
||||
navTrees?.find((tree: any) => tree?.id === 'QuickAccess-NA')?.m_Root?.m_element?.ownerDocument.defaultView ?? null
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
|
||||
@@ -7,9 +7,10 @@ export interface ButtonItemProps extends ItemProps {
|
||||
onClick?(e: MouseEvent): void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export const ButtonItem = Object.values(CommonUIModule).find(
|
||||
(mod: any) =>
|
||||
mod?.render?.toString()?.includes('"highlightOnFocus","childrenContainerWidth"') ||
|
||||
mod?.render?.toString()?.includes('childrenContainerWidth:"min"'),
|
||||
) as FC<ButtonItemProps>;
|
||||
export const ButtonItem =
|
||||
CommonUIModule.ButtonField ||
|
||||
(Object.values(CommonUIModule).find(
|
||||
(mod: any) =>
|
||||
mod?.render?.toString()?.includes('"highlightOnFocus","childrenContainerWidth"') ||
|
||||
mod?.render?.toString()?.includes('childrenContainerWidth:"min"'),
|
||||
) as FC<ButtonItemProps>);
|
||||
|
||||
@@ -8,4 +8,5 @@ export interface ItemProps {
|
||||
bottomSeparator?: 'standard' | 'thick' | 'none';
|
||||
indentLevel?: number;
|
||||
tooltip?: string;
|
||||
highlightOnFocus?: boolean;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { findModuleChild } from '../webpack';
|
||||
export interface PanelSectionProps {
|
||||
title?: string;
|
||||
spinner?: boolean;
|
||||
children?: ReactNode
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
const [panelSection, mod] = findModuleChild((mod: any) => {
|
||||
@@ -20,9 +20,9 @@ const [panelSection, mod] = findModuleChild((mod: any) => {
|
||||
export const PanelSection = panelSection as FC<PanelSectionProps>;
|
||||
|
||||
export interface PanelSectionRowProps {
|
||||
children?: ReactNode
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export const PanelSectionRow = Object.values(mod).filter(
|
||||
(exp: any) => !exp?.toString()?.includes('.PanelSection'),
|
||||
)[0] as FC<PanelSectionRowProps>;
|
||||
// New as of Feb 22 2023 Beta || Old
|
||||
export const PanelSectionRow =
|
||||
mod.PanelSectionRow ||
|
||||
(Object.values(mod).filter((exp: any) => !exp?.toString()?.includes('.PanelSection'))[0] as FC<PanelSectionRowProps>);
|
||||
|
||||
@@ -77,7 +77,6 @@ export interface WindowRouter {
|
||||
NavigateToChat(): void;
|
||||
NavigateToSteamWeb(url: string): void;
|
||||
NavigateBack(): void;
|
||||
NavigateToWebRoute(unknown?: any, unknown2?: any): void;
|
||||
}
|
||||
|
||||
export interface WindowStore {
|
||||
@@ -118,7 +117,6 @@ export interface Navigation {
|
||||
NavigateToLibraryTab(): void;
|
||||
NavigateToLayoutPreview(e: unknown): void;
|
||||
NavigateToSteamWeb(url: string): void;
|
||||
NavigateToWebRoute(unknown?: any, unknown2?: any): void;
|
||||
OpenSideMenu(sideMenu: SideMenu): void;
|
||||
OpenQuickAccessMenu(quickAccessTab?: QuickAccessTab): void;
|
||||
OpenMainMenu(): void;
|
||||
@@ -154,33 +152,30 @@ try {
|
||||
}
|
||||
}
|
||||
const newNavigation = {
|
||||
Navigate: Router.Navigate.bind(Router),
|
||||
NavigateBack: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateBack.bind(
|
||||
Navigate: Router.Navigate?.bind(Router),
|
||||
NavigateBack: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateBack?.bind(
|
||||
Router.WindowStore.GamepadUIMainWindowInstance,
|
||||
),
|
||||
NavigateToAppProperties: InternalNavigators?.AppProperties || Router.NavigateToAppProperties.bind(Router),
|
||||
NavigateToExternalWeb: InternalNavigators?.ExternalWeb || 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(
|
||||
NavigateToAppProperties: InternalNavigators?.AppProperties || Router.NavigateToAppProperties?.bind(Router),
|
||||
NavigateToExternalWeb: InternalNavigators?.ExternalWeb || 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(
|
||||
OpenSideMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenSideMenu?.bind(
|
||||
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
|
||||
),
|
||||
OpenQuickAccessMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenQuickAccessMenu.bind(
|
||||
OpenQuickAccessMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenQuickAccessMenu?.bind(
|
||||
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
|
||||
),
|
||||
OpenMainMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenMainMenu.bind(
|
||||
OpenMainMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenMainMenu?.bind(
|
||||
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
|
||||
),
|
||||
CloseSideMenus: Router.CloseSideMenus.bind(Router),
|
||||
OpenPowerMenu: Router.OpenPowerMenu.bind(Router),
|
||||
CloseSideMenus: Router.CloseSideMenus?.bind(Router),
|
||||
OpenPowerMenu: Router.OpenPowerMenu?.bind(Router),
|
||||
} as Navigation;
|
||||
|
||||
Object.assign(Navigation, newNavigation);
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface SidebarNavigationPage {
|
||||
|
||||
export interface SidebarNavigationProps {
|
||||
title?: string;
|
||||
pages: SidebarNavigationPage[];
|
||||
pages: (SidebarNavigationPage | 'separator')[];
|
||||
showTitle?: boolean;
|
||||
disableRouteReporting?: boolean;
|
||||
page?: string;
|
||||
|
||||
@@ -26,55 +26,56 @@ export * from './Toggle';
|
||||
export * from './ToggleField';
|
||||
export * from './SteamClient';
|
||||
|
||||
import { SteamClient, SteamAppOverview, LogoPosition } from './SteamClient';
|
||||
import { AppDetails, LogoPosition, SteamAppOverview, SteamClient } from './SteamClient';
|
||||
|
||||
declare global {
|
||||
var SteamClient: SteamClient;
|
||||
var SteamClient: SteamClient;
|
||||
|
||||
interface Window {
|
||||
LocalizationManager: {
|
||||
m_mapTokens: Map<string, string>;
|
||||
m_mapFallbackTokens: Map<string, string>;
|
||||
m_rgLocalesToUse: string[];
|
||||
interface Window {
|
||||
LocalizationManager: {
|
||||
m_mapTokens: Map<string, string>;
|
||||
m_mapFallbackTokens: Map<string, string>;
|
||||
m_rgLocalesToUse: string[];
|
||||
};
|
||||
App: {
|
||||
m_CurrentUser: {
|
||||
bIsLimited: boolean;
|
||||
bIsOfflineMode: boolean;
|
||||
bSupportAlertActive: boolean;
|
||||
bCanInviteFriends: boolean;
|
||||
NotificationCounts: {
|
||||
comments: number;
|
||||
inventory_items: number;
|
||||
invites: number;
|
||||
gifts: number;
|
||||
offline_messages: number;
|
||||
trade_offers: number;
|
||||
async_game_updates: number;
|
||||
moderator_messages: number;
|
||||
help_request_replies: number;
|
||||
};
|
||||
App: {
|
||||
m_CurrentUser: {
|
||||
bIsLimited: boolean;
|
||||
bIsOfflineMode: boolean;
|
||||
bSupportAlertActive: boolean;
|
||||
bCanInviteFriends: boolean;
|
||||
NotificationCounts: {
|
||||
comments: number;
|
||||
inventory_items: number;
|
||||
invites: number;
|
||||
gifts: number;
|
||||
offline_messages: number;
|
||||
trade_offers: number;
|
||||
async_game_updates: number;
|
||||
moderator_messages: number;
|
||||
help_request_replies: number;
|
||||
};
|
||||
strAccountBalance: string;
|
||||
strAccountName: string;
|
||||
strSteamID: string;
|
||||
};
|
||||
};
|
||||
appStore: {
|
||||
GetAppOverviewByAppID: (appId: number) => SteamAppOverview | null;
|
||||
GetCustomVerticalCapsuleURLs: (app: SteamAppOverview) => string[];
|
||||
GetCustomLandcapeImageURLs: (app: SteamAppOverview) => string[];
|
||||
GetCustomHeroImageURLs: (app: SteamAppOverview) => string[];
|
||||
GetCustomLogoImageURLs: (app: SteamAppOverview) => string[];
|
||||
GetLandscapeImageURLForApp: (app: SteamAppOverview) => string;
|
||||
GetVerticalCapsuleURLForApp: (app: SteamAppOverview) => string;
|
||||
GetCachedLandscapeImageURLForApp: (app: SteamAppOverview) => string;
|
||||
GetCachedVerticalImageURLForApp: (app: SteamAppOverview) => string;
|
||||
GetPregeneratedVerticalCapsuleForApp: (app: SteamAppOverview) => string;
|
||||
GetIconURLForApp: (app: SteamAppOverview) => string;
|
||||
};
|
||||
appDetailsStore: {
|
||||
GetCustomLogoPosition: (app: SteamAppOverview) => LogoPosition | null;
|
||||
SaveCustomLogoPosition: (app: SteamAppOverview, logoPositions: LogoPosition) => any;
|
||||
}
|
||||
}
|
||||
strAccountBalance: string;
|
||||
strAccountName: string;
|
||||
strSteamID: string;
|
||||
};
|
||||
};
|
||||
appStore: {
|
||||
GetAppOverviewByAppID: (appId: number) => SteamAppOverview | null;
|
||||
GetCustomVerticalCapsuleURLs: (app: SteamAppOverview) => string[];
|
||||
GetCustomLandcapeImageURLs: (app: SteamAppOverview) => string[];
|
||||
GetCustomHeroImageURLs: (app: SteamAppOverview) => string[];
|
||||
GetCustomLogoImageURLs: (app: SteamAppOverview) => string[];
|
||||
GetLandscapeImageURLForApp: (app: SteamAppOverview) => string;
|
||||
GetVerticalCapsuleURLForApp: (app: SteamAppOverview) => string;
|
||||
GetCachedLandscapeImageURLForApp: (app: SteamAppOverview) => string;
|
||||
GetCachedVerticalImageURLForApp: (app: SteamAppOverview) => string;
|
||||
GetPregeneratedVerticalCapsuleForApp: (app: SteamAppOverview) => string;
|
||||
GetIconURLForApp: (app: SteamAppOverview) => string;
|
||||
};
|
||||
appDetailsStore: {
|
||||
GetAppDetails: (appId: number) => AppDetails | null;
|
||||
GetCustomLogoPosition: (app: SteamAppOverview) => LogoPosition | null;
|
||||
SaveCustomLogoPosition: (app: SteamAppOverview, logoPositions: LogoPosition) => any;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
export * from './patcher';
|
||||
export * from './react';
|
||||
|
||||
declare global {
|
||||
var FocusNavController: any;
|
||||
var GamepadNavTree: any;
|
||||
}
|
||||
|
||||
export function joinClassNames(...classes: string[]): string {
|
||||
return classes.join(' ');
|
||||
}
|
||||
@@ -16,7 +21,15 @@ export function findSP(): Window {
|
||||
// old (SP as host)
|
||||
if (document.title == 'SP') return window;
|
||||
// new (SP as popup)
|
||||
const context = FocusNavController.m_ActiveContext || FocusNavController.m_LastActiveContext;
|
||||
return context.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
|
||||
.Element.ownerDocument.defaultView;
|
||||
const focusNav = getFocusNavController();
|
||||
const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
|
||||
return context.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root.Element.ownerDocument
|
||||
.defaultView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the correct FocusNavController, as the Feb 22 2023 beta has two for some reason.
|
||||
*/
|
||||
export function getFocusNavController(): any {
|
||||
return window.GamepadNavTree?.m_context?.m_controller || window.FocusNavController;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user