chore(*): run prettier

This commit is contained in:
AAGaming
2024-05-12 15:48:13 -04:00
parent bffd530bda
commit a7635b6305
33 changed files with 318 additions and 302 deletions

View File

@@ -51,4 +51,4 @@ jobs:
ssh: true
directory: ./wiki
repository: SteamDeckHomebrew/wiki
branch: main
branch: main

View File

@@ -6,9 +6,9 @@
{
"preset": "angular",
"releaseRules": [
{"type": "chore", "scope": "classes", "release": "patch"},
{"type": "docs", "scope": "steamclient", "release": "patch"},
{"type": "*", "scope": "docs", "release": false}
{ "type": "chore", "scope": "classes", "release": "patch" },
{ "type": "docs", "scope": "steamclient", "release": "patch" },
{ "type": "*", "scope": "docs", "release": false }
]
}
],

26
.vscode/tasks.json vendored
View File

@@ -1,15 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "dev",
"problemMatcher": [
"$tsc-watch"
],
"label": "npm: dev",
"detail": "tsc -b -w",
"isBackground": true
}
]
}
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "dev",
"problemMatcher": ["$tsc-watch"],
"label": "npm: dev",
"detail": "tsc -b -w",
"isBackground": true
}
]
}

View File

@@ -20,7 +20,7 @@ This library can also theoretically be used to extend existing UI elements of th
### Getting Started (Developers)
If you would like a feature added to decky-frontend-lib, please request it via a Github issue.
If you would like a feature added to decky-frontend-lib, please request it via a Github issue.
If you want to start making a plugin with decky-frontend-lib, please direct your attention to the [decky-plugin-template](https://github.com/SteamDeckHomebrew/decky-plugin-template) repository.

View File

@@ -1,3 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript',],
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
};

8
globals.d.ts vendored
View File

@@ -1,5 +1,5 @@
declare global {
interface Window {
SP_REACT: typeof React;
}
}
interface Window {
SP_REACT: typeof React;
}
}

View File

@@ -1,34 +1,34 @@
import { Module, findAllModules } from "./webpack";
import { Module, findAllModules } from './webpack';
export interface ClassModule {
[name: string]: string
};
export const classMap: ClassModule[] = findAllModules((m: Module) => {
if (typeof m == "object" && !m.__esModule) {
const keys = Object.keys(m);
// special case some libraries
if (keys.length == 1 && m.version) return false;
// special case localization
if (keys.length > 1000 && m.AboutSettings) return false;
return keys.length > 0 && keys.every(k => !Object.getOwnPropertyDescriptor(m, k)?.get && typeof m[k] == "string")
}
return false;
});
export function findClass(name: string): string | void {
return classMap.find(m => m?.[name])?.[name];
[name: string]: string;
}
export function findClassModule(filter: (module: any) => boolean) : ClassModule | void {
return classMap.find(m => filter(m));
export const classMap: ClassModule[] = findAllModules((m: Module) => {
if (typeof m == 'object' && !m.__esModule) {
const keys = Object.keys(m);
// special case some libraries
if (keys.length == 1 && m.version) return false;
// special case localization
if (keys.length > 1000 && m.AboutSettings) return false;
return keys.length > 0 && keys.every((k) => !Object.getOwnPropertyDescriptor(m, k)?.get && typeof m[k] == 'string');
}
return false;
});
export function findClass(name: string): string | void {
return classMap.find((m) => m?.[name])?.[name];
}
export function findClassModule(filter: (module: any) => boolean): ClassModule | void {
return classMap.find((m) => filter(m));
}
export function unminifyClass(minifiedClass: string): string | void {
for (let m of classMap) {
for (let className of Object.keys(m)) {
if (m[className] == minifiedClass) return className;
}
for (let m of classMap) {
for (let className of Object.keys(m)) {
if (m[className] == minifiedClass) return className;
}
}
}
}

View File

@@ -7,9 +7,8 @@ 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 = Object.values(CommonUIModule).find(
(mod: any) =>
mod?.render?.toString()?.includes('"highlightOnFocus","childrenContainerWidth"') ||
mod?.render?.toString()?.includes('childrenContainerWidth:"min"'),
) as FC<ButtonItemProps>;

View File

@@ -20,4 +20,6 @@ export interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
scrollToAlignment?: 'center';
}
export const Carousel = findModuleExport((e: Export) => e.render?.toString().includes('setFocusedColumn:')) as VFC<CarouselProps & RefAttributes<HTMLDivElement>>;
export const Carousel = findModuleExport((e: Export) => e.render?.toString().includes('setFocusedColumn:')) as VFC<
CarouselProps & RefAttributes<HTMLDivElement>
>;

View File

@@ -1,9 +1,13 @@
import { Export, findModuleExport } from '../webpack';
import { FC } from 'react';
import { Export, findModuleExport } from '../webpack';
export interface ControlsListProps {
alignItems?: 'left' | 'right' | 'center';
spacing?: 'standard' | 'extra';
}
export const ControlsList: FC<ControlsListProps> = findModuleExport((e: Export) => e?.toString && e.toString().includes('().ControlsListChild') && e.toString().includes('().ControlsListOuterPanel'));
export const ControlsList: FC<ControlsListProps> = findModuleExport(
(e: Export) =>
e?.toString && e.toString().includes('().ControlsListChild') && e.toString().includes('().ControlsListOuterPanel'),
);

View File

@@ -11,7 +11,7 @@ export interface DialogCommonProps extends RefAttributes<HTMLDivElement> {
export interface DialogButtonProps extends DialogCommonProps, FooterLegendProps {
/**
* Enables/disables the focus around the button.
*
*
* @note
* Default value depends on context, so setting it to `false` will enable it.
*/
@@ -19,25 +19,25 @@ export interface DialogButtonProps extends DialogCommonProps, FooterLegendProps
/**
* Disables the button - assigned `on*` methods will not be invoked if clicked.
*
*
* @note
* Depending on where it is, it might still get focus. In such case it can be
* Depending on where it is, it might still get focus. In such case it can be
* partially disabled separately.
*
*
* @see focusable.
*/
disabled?: boolean;
/**
* Enables/disables the navigation based focus on button - you won't be able to navigate to
* it via the gamepad or keyboard.
*
* it via the gamepad or keyboard.
*
* @note
* If set to `false`, it still can be clicked and **WILL** become focused until navigated away.
* Depending on the context of where the button is, even a disabled button can focused.
*/
focusable?: boolean;
onClick?(e: MouseEvent): void;
onPointerDown?(e: PointerEvent): void;
onPointerUp?(e: PointerEvent): void;

View File

@@ -18,16 +18,19 @@ export interface DialogCheckboxProps extends DialogCommonProps, FooterLegendProp
onClick?(evt: Event): void;
}
export const DialogCheckbox = Object.values(findModule((m: any) => {
if (typeof m !== 'object') return false;
for (const prop in m) {
if (m[prop]?.prototype?.GetPanelElementProps) return true;
}
return false;
})).find((m: any) =>
m.contextType &&
m.prototype?.render.toString().includes('fallback:') &&
m?.prototype?.SetChecked &&
m?.prototype?.Toggle &&
m?.prototype?.GetPanelElementProps
export const DialogCheckbox = Object.values(
findModule((m: any) => {
if (typeof m !== 'object') return false;
for (const prop in m) {
if (m[prop]?.prototype?.GetPanelElementProps) return true;
}
return false;
}),
).find(
(m: any) =>
m.contextType &&
m.prototype?.render.toString().includes('fallback:') &&
m?.prototype?.SetChecked &&
m?.prototype?.Toggle &&
m?.prototype?.GetPanelElementProps,
) as FC<DialogCheckboxProps>;

View File

@@ -23,4 +23,6 @@ export interface FieldProps extends FooterLegendProps {
onClick?: (e: CustomEvent | MouseEvent) => void;
}
export const Field = findModuleExport((e: Export) => e?.render?.toString().includes('"shift-children-below"')) as FC<FieldProps & RefAttributes<HTMLDivElement>>;
export const Field = findModuleExport((e: Export) => e?.render?.toString().includes('"shift-children-below"')) as FC<
FieldProps & RefAttributes<HTMLDivElement>
>;

View File

@@ -10,4 +10,6 @@ export interface FocusRingProps {
NavigationManager?: any;
}
export const FocusRing = findModuleExport((e: Export) => e?.toString()?.includes('.GetShowDebugFocusRing())')) as FC<FocusRingProps>;
export const FocusRing = findModuleExport((e: Export) =>
e?.toString()?.includes('.GetShowDebugFocusRing())'),
) as FC<FocusRingProps>;

View File

@@ -13,4 +13,6 @@ export interface FocusableProps extends HTMLAttributes<HTMLDivElement>, FooterLe
onCancel?: (e: CustomEvent) => void;
}
export const Focusable = findModuleExport((e: Export) => e?.render?.toString()?.includes('["flow-children","onActivate","onCancel","focusClassName",')) as VFC<FocusableProps & RefAttributes<HTMLDivElement>>;
export const Focusable = findModuleExport((e: Export) =>
e?.render?.toString()?.includes('["flow-children","onActivate","onCancel","focusClassName",'),
) as VFC<FocusableProps & RefAttributes<HTMLDivElement>>;

View File

@@ -36,7 +36,7 @@ export declare enum NavEntryPositionPreferences {
LAST,
MAINTAIN_X,
MAINTAIN_Y,
PREFERRED_CHILD
PREFERRED_CHILD,
}
export interface GamepadEventDetail {
button: number;
@@ -44,8 +44,8 @@ export interface GamepadEventDetail {
source: number;
}
export declare type ActionDescriptionMap = {
[key in GamepadButton]?: ReactNode
}
[key in GamepadButton]?: ReactNode;
};
export declare type GamepadEvent = CustomEvent<GamepadEventDetail>;
export interface FooterLegendProps {
actionDescriptionMap?: ActionDescriptionMap;

View File

@@ -15,4 +15,6 @@ export interface MarqueeProps {
children: React.ReactNode;
}
export const Marquee: FC<MarqueeProps> = findModuleExport((e: Export) => e?.toString && e.toString().includes('.Marquee') && e.toString().includes('--fade-length'));
export const Marquee: FC<MarqueeProps> = findModuleExport(
(e: Export) => e?.toString && e.toString().includes('.Marquee') && e.toString().includes('--fade-length'),
);

View File

@@ -21,4 +21,6 @@ export const PanelSection = panelSection as FC<PanelSectionProps>;
export interface PanelSectionRowProps {
children?: ReactNode;
}
export const PanelSectionRow = Object.values(mod).filter((exp: any) => !exp?.toString()?.includes('.PanelSection'))[0] as FC<PanelSectionRowProps>;
export const PanelSectionRow = Object.values(mod).filter(
(exp: any) => !exp?.toString()?.includes('.PanelSection'),
)[0] as FC<PanelSectionRowProps>;

View File

@@ -22,8 +22,14 @@ export interface ProgressBarWithInfoProps extends ProgressBarItemProps {
sOperationText?: ReactNode;
}
export const ProgressBar = findModuleExport((e: Export) => e?.toString()?.includes('.ProgressBar,"standard"==')) as VFC<ProgressBarProps>;
export const ProgressBar = findModuleExport((e: Export) =>
e?.toString()?.includes('.ProgressBar,"standard"=='),
) as VFC<ProgressBarProps>;
export const ProgressBarWithInfo = findModuleExport((e: Export) => e?.toString()?.includes('.ProgressBarFieldStatus},')) as VFC<ProgressBarWithInfoProps>;
export const ProgressBarWithInfo = findModuleExport((e: Export) =>
e?.toString()?.includes('.ProgressBarFieldStatus},'),
) as VFC<ProgressBarWithInfoProps>;
export const ProgressBarItem = findModuleExport((e: Export) => e?.toString()?.includes('"indeterminate","nTransitionSec"')) as VFC<ProgressBarItemProps>;
export const ProgressBarItem = findModuleExport((e: Export) =>
e?.toString()?.includes('"indeterminate","nTransitionSec"'),
) as VFC<ProgressBarItemProps>;

View File

@@ -2,10 +2,14 @@ import { FC, ReactNode } from 'react';
import { Export, findModuleByExport, findModuleExport } from '../webpack';
const ScrollingModule = findModuleByExport((e: Export) => e?.render?.toString?.().includes("{case\"x\":"));
const ScrollingModule = findModuleByExport((e: Export) => e?.render?.toString?.().includes('{case"x":'));
const ScrollingModuleProps = ScrollingModule ? Object.values(ScrollingModule) : [];
export const ScrollPanel = ScrollingModuleProps.find((prop: any) => prop?.render?.toString?.().includes("{case\"x\":")) as FC<{ children?: ReactNode }>;
export const ScrollPanel = ScrollingModuleProps.find((prop: any) =>
prop?.render?.toString?.().includes('{case"x":'),
) as FC<{ children?: ReactNode }>;
export const ScrollPanelGroup: FC<{ children?: ReactNode }> = findModuleExport((e: Export) => e?.render?.toString().includes(".FocusVisibleChild()),[])"));
export const ScrollPanelGroup: FC<{ children?: ReactNode }> = findModuleExport((e: Export) =>
e?.render?.toString().includes('.FocusVisibleChild()),[])'),
);

View File

@@ -23,4 +23,6 @@ export interface SidebarNavigationProps {
onPageRequested?: (page: string) => void;
}
export const SidebarNavigation = findModuleExport((e: Export) => e?.toString()?.includes('"disableRouteReporting"')) as VFC<SidebarNavigationProps>;
export const SidebarNavigation = findModuleExport((e: Export) =>
e?.toString()?.includes('"disableRouteReporting"'),
) as VFC<SidebarNavigationProps>;

View File

@@ -2,4 +2,6 @@ import { FC, SVGAttributes } from 'react';
import { Export, findModuleExport } from '../webpack';
export const SteamSpinner = findModuleExport((e: Export) => e?.toString?.()?.includes('Steam Spinner') && e?.toString?.()?.includes('src')) as FC<SVGAttributes<SVGElement>>;
export const SteamSpinner = findModuleExport(
(e: Export) => e?.toString?.()?.includes('Steam Spinner') && e?.toString?.()?.includes('src'),
) as FC<SVGAttributes<SVGElement>>;

View File

@@ -109,8 +109,7 @@ try {
* Tabs component as used in the library and media tabs. See {@link TabsProps}.
* Unlike other components in `decky-frontend-lib`, this requires Decky Loader to be running.
*/
export const Tabs =
(oldTabs ||
export const Tabs = (oldTabs ||
((props: TabsProps) => {
const found = tabsComponent;
const [tc, setTC] = useState<FC<TabsProps>>(found);

View File

@@ -22,4 +22,4 @@ export * from './Tabs';
export * from './TextField';
export * from './Toggle';
export * from './ToggleField';
export * from './Scroll';
export * from './Scroll';

View File

@@ -1,9 +1,12 @@
import { useEffect, useState } from 'react';
import { getGamepadNavigationTrees } from '../utils';
function getQuickAccessWindow(): Window | null {
const navTrees = getGamepadNavigationTrees();
return navTrees.find((tree: any) => tree?.id === 'QuickAccess-NA')?.m_Root?.m_element?.ownerDocument.defaultView ?? null;
return (
navTrees.find((tree: any) => tree?.id === 'QuickAccess-NA')?.m_Root?.m_element?.ownerDocument.defaultView ?? null
);
}
/**

View File

@@ -227,7 +227,7 @@ export interface LogoPosition {
pinnedPosition: LogoPinPositions;
nWidthPct: number;
nHeightPct: number;
};
}
export interface AppDetails {
achievements: AppAchievements;

View File

@@ -1,2 +1,2 @@
export * from "./SteamClient";
export * from "./stores";
export * from './SteamClient';
export * from './stores';

View File

@@ -22,43 +22,26 @@ export const group = (name: string, ...args: any[]) => {
export const groupEnd = (name: string, ...args: any[]) => {
console.groupEnd();
if (args?.length > 0) console.log(
`^ %c @decky/ui %c ${name} %c`,
bgStyle1,
'background: #1abc9c; color: black;',
'background: transparent;',
...args,
);
if (args?.length > 0)
console.log(
`^ %c @decky/ui %c ${name} %c`,
bgStyle1,
'background: #1abc9c; color: black;',
'background: transparent;',
...args,
);
};
export const debug = (name: string, ...args: any[]) => {
console.debug(
`%c @decky/ui %c ${name} %c`,
bgStyle1,
'background: #1abc9c; color: black;',
'color: blue;',
...args,
);
console.debug(`%c @decky/ui %c ${name} %c`, bgStyle1, 'background: #1abc9c; color: black;', 'color: blue;', ...args);
};
export const warn = (name: string, ...args: any[]) => {
console.warn(
`%c @decky/ui %c ${name} %c`,
bgStyle1,
'background: #ffbb00; color: black;',
'color: blue;',
...args,
);
console.warn(`%c @decky/ui %c ${name} %c`, bgStyle1, 'background: #ffbb00; color: black;', 'color: blue;', ...args);
};
export const error = (name: string, ...args: any[]) => {
console.error(
`%c @decky/ui %c ${name} %c`,
bgStyle1,
'background: #FF0000;',
'background: transparent;',
...args,
);
console.error(`%c @decky/ui %c ${name} %c`, bgStyle1, 'background: #FF0000;', 'background: transparent;', ...args);
};
class Logger {
@@ -90,5 +73,5 @@ class Logger {
groupEnd(this.name, ...args);
}
}
export default Logger;
export default Logger;

View File

@@ -1 +1 @@
export * from './Router';
export * from './Router';

View File

@@ -68,14 +68,16 @@ export function wrapReactClass(node: any, prop: any = 'type') {
export function getReactRoot(o: HTMLElement | Element | Node) {
return (
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactContainer$')) as string] || o['_reactRootContainer']?._internalRoot?.current
o[Object.keys(o).find((k) => k.startsWith('__reactContainer$')) as string] ||
o['_reactRootContainer']?._internalRoot?.current
);
}
export function getReactInstance(o: HTMLElement | Element | Node) {
return (
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactFiber')) as string] || o[Object.keys(o).find((k) => k.startsWith('__reactInternalInstance')) as string]
o[Object.keys(o).find((k) => k.startsWith('__reactFiber')) as string] ||
o[Object.keys(o).find((k) => k.startsWith('__reactInternalInstance')) as string]
);
}

View File

@@ -543,153 +543,153 @@ type GamepadTabbedPageClasses = Record<
>;
type GamepadContextMenuClasses = Record<
| "duration-app-launch"
| "BasicContextMenuModal"
| "BasicContextMenuHeader"
| "BasicContextMenuHeaderShrinkableSpacing"
| "BasicContextMenuContainer"
| "slideInAnimation"
| "contextMenu"
| "contextMenuContents"
| "hasSubMenu"
| "contextMenuFade"
| "contextMenuItem"
| "active"
| "Selected"
| "Focused"
| "Positive"
| "Emphasis"
| "Destructive"
| "Capitalized"
| "MenuSectionHeader"
| "UpperCase"
| "SubMenu"
| "ContextMenuSeparator"
| "Label"
| "Arrow"
| "ItemFocusAnim-darkerGrey-nocolor"
| "ItemFocusAnim-darkerGrey"
| "ItemFocusAnim-darkGrey"
| "ItemFocusAnim-grey"
| "ItemFocusAnimBorder-darkGrey"
| "ItemFocusAnim-green"
| "focusAnimation"
| "hoverAnimation",
| 'duration-app-launch'
| 'BasicContextMenuModal'
| 'BasicContextMenuHeader'
| 'BasicContextMenuHeaderShrinkableSpacing'
| 'BasicContextMenuContainer'
| 'slideInAnimation'
| 'contextMenu'
| 'contextMenuContents'
| 'hasSubMenu'
| 'contextMenuFade'
| 'contextMenuItem'
| 'active'
| 'Selected'
| 'Focused'
| 'Positive'
| 'Emphasis'
| 'Destructive'
| 'Capitalized'
| 'MenuSectionHeader'
| 'UpperCase'
| 'SubMenu'
| 'ContextMenuSeparator'
| 'Label'
| 'Arrow'
| 'ItemFocusAnim-darkerGrey-nocolor'
| 'ItemFocusAnim-darkerGrey'
| 'ItemFocusAnim-darkGrey'
| 'ItemFocusAnim-grey'
| 'ItemFocusAnimBorder-darkGrey'
| 'ItemFocusAnim-green'
| 'focusAnimation'
| 'hoverAnimation',
string
>;
type AchievementClasses = Record<
| "nAchievementHeight"
| "nGlobalAchievementHeight"
| "nAchievementsListTitleHeight"
| "nAchievementGap"
| "AchievementList"
| "ListTitle"
| "AchievementListItemBase"
| "Container"
| "Content"
| "Right"
| "Footer"
| "AchievementTitle"
| "AchievementDescription"
| "AchievementGlobalPercentage"
| "InBody"
| "VerticalContent"
| "UnlockDate"
| "AlignEnd"
| "ProgressBar"
| "ProgressCount"
| "AchievementContent"
| "HiddenAchievementContent"
| "FriendAchievementFooter"
| "GlobalPercentage"
| "UserUnlockDateTime"
| "GlobalAchievementsListHeader"
| "SearchField"
| "Avatar"
| "HeaderText"
| "GlobalAchievementListItem"
| "UnlockContainer"
| "Info"
| "Title"
| "Description"
| "Percent"
| "ImageContainer"
| "ProgressFill"
| "SpoilerWarning"
| "Hidden"
| "ComparisonAchieverColumn"
| "ComparisonAchieverInfo"
| "ProgressContainer"
| "ProgressLabel"
| "Secondary"
| "AvatarContainer"
| "Unachieved",
| 'nAchievementHeight'
| 'nGlobalAchievementHeight'
| 'nAchievementsListTitleHeight'
| 'nAchievementGap'
| 'AchievementList'
| 'ListTitle'
| 'AchievementListItemBase'
| 'Container'
| 'Content'
| 'Right'
| 'Footer'
| 'AchievementTitle'
| 'AchievementDescription'
| 'AchievementGlobalPercentage'
| 'InBody'
| 'VerticalContent'
| 'UnlockDate'
| 'AlignEnd'
| 'ProgressBar'
| 'ProgressCount'
| 'AchievementContent'
| 'HiddenAchievementContent'
| 'FriendAchievementFooter'
| 'GlobalPercentage'
| 'UserUnlockDateTime'
| 'GlobalAchievementsListHeader'
| 'SearchField'
| 'Avatar'
| 'HeaderText'
| 'GlobalAchievementListItem'
| 'UnlockContainer'
| 'Info'
| 'Title'
| 'Description'
| 'Percent'
| 'ImageContainer'
| 'ProgressFill'
| 'SpoilerWarning'
| 'Hidden'
| 'ComparisonAchieverColumn'
| 'ComparisonAchieverInfo'
| 'ProgressContainer'
| 'ProgressLabel'
| 'Secondary'
| 'AvatarContainer'
| 'Unachieved',
string
>;
type MainMenuAppRunningClasses = Record<
| "duration-app-launch"
| "ScrollMask"
| "HideMask"
| "MainMenuAppRunning"
| "MenuOpen"
| "NavigationColumn"
| "ControllerColumnFocused"
| "NavColumnFocused"
| "NavigationBox"
| "NavigationMenuItem"
| "ItemFocusAnim-darkerGrey"
| "Active"
| "Disabled"
| "SwitchAppsTitle"
| "SelectableAppWindow"
| "ActiveDot"
| "NavigationMenuItemSeparator"
| "AppColumn"
| "FocusedColumn"
| "AppColumnContent"
| "ActiveContent"
| "CurrentGameBackground"
| "CurrentGameLogo"
| "OverlayAchievements"
| "Container"
| "OverlayGuides"
| "OverlayNotes"
| "OverlayInplaceBrowser"
| "ItemFocusAnim-darkerGrey-nocolor"
| "ItemFocusAnim-darkGrey"
| "ItemFocusAnim-grey"
| "ItemFocusAnimBorder-darkGrey"
| "ItemFocusAnim-green"
| "focusAnimation"
| "hoverAnimation",
| 'duration-app-launch'
| 'ScrollMask'
| 'HideMask'
| 'MainMenuAppRunning'
| 'MenuOpen'
| 'NavigationColumn'
| 'ControllerColumnFocused'
| 'NavColumnFocused'
| 'NavigationBox'
| 'NavigationMenuItem'
| 'ItemFocusAnim-darkerGrey'
| 'Active'
| 'Disabled'
| 'SwitchAppsTitle'
| 'SelectableAppWindow'
| 'ActiveDot'
| 'NavigationMenuItemSeparator'
| 'AppColumn'
| 'FocusedColumn'
| 'AppColumnContent'
| 'ActiveContent'
| 'CurrentGameBackground'
| 'CurrentGameLogo'
| 'OverlayAchievements'
| 'Container'
| 'OverlayGuides'
| 'OverlayNotes'
| 'OverlayInplaceBrowser'
| 'ItemFocusAnim-darkerGrey-nocolor'
| 'ItemFocusAnim-darkGrey'
| 'ItemFocusAnim-grey'
| 'ItemFocusAnimBorder-darkGrey'
| 'ItemFocusAnim-green'
| 'focusAnimation'
| 'hoverAnimation',
string
>;
type BasicAppDetailsSectionStylerClasses = Record<
| "duration-app-launch"
| "headerPadding"
| "Header"
| "AppDetailsContent"
| "AppDetailsContainer"
| "AppDetailsRoot"
| "GameInfoContainer"
| "GameInfoQuickLinks"
| "GameInfoCollections"
| "CollectionsHeader"
| "PlaySection"
| "ActionRow"
| "AppDetailSectionList"
| "AppActionButton"
| "ActionButtonAndStatusPanel"
| "AppButtons"
| "InvertFocusedIcon"
| "DeckVerifiedFeedbackContainer"
| "DeckVerifiedFeedbackConfirmationContainer"
| "DeckVerifiedFeedbackButton"
| "DeckVerifiedFeedbackQuestion"
| "DeckVerifiedFeedbackConfirmation",
| 'duration-app-launch'
| 'headerPadding'
| 'Header'
| 'AppDetailsContent'
| 'AppDetailsContainer'
| 'AppDetailsRoot'
| 'GameInfoContainer'
| 'GameInfoQuickLinks'
| 'GameInfoCollections'
| 'CollectionsHeader'
| 'PlaySection'
| 'ActionRow'
| 'AppDetailSectionList'
| 'AppActionButton'
| 'ActionButtonAndStatusPanel'
| 'AppButtons'
| 'InvertFocusedIcon'
| 'DeckVerifiedFeedbackContainer'
| 'DeckVerifiedFeedbackConfirmationContainer'
| 'DeckVerifiedFeedbackButton'
| 'DeckVerifiedFeedbackQuestion'
| 'DeckVerifiedFeedbackConfirmation',
string
>;
@@ -700,9 +700,7 @@ export const quickAccessMenuClasses: QuickAccessMenuClasses = findModule(
* @depreciated please use quickAccessMenuClasses instead
*/
export const staticClasses = quickAccessMenuClasses;
export const scrollPanelClasses: ScrollPanelClasses = findModule(
(mod) => typeof mod === 'object' && mod?.ScrollPanel,
);
export const scrollPanelClasses: ScrollPanelClasses = findModule((mod) => typeof mod === 'object' && mod?.ScrollPanel);
/**
* @depreciated please use scrollPanelClasses instead
*/
@@ -717,33 +715,27 @@ export const quickAccessControlsClasses: QuickAccessControlsClasses = findModule
export const updaterFieldClasses: UpdaterFieldClasses = findModule(
(mod) => typeof mod === 'object' && mod?.OOBEUpdateStatusContainer,
);
export const playSectionClasses: PlaySectionClasses = findModule(
(mod) => typeof mod === 'object' && mod?.Container,
);
export const playSectionClasses: PlaySectionClasses = findModule((mod) => typeof mod === 'object' && mod?.Container);
export const gamepadSliderClasses: GamepadSliderClasses = findModule(
(mod) => typeof mod === 'object' && mod?.SliderControlPanelGroup,
);
export const appDetailsHeaderClasses: AppDetailsHeaderClasses = findModule(
(mod) => typeof mod === 'object' && mod?.TopCapsule,
);
export const appDetailsClasses: AppDetailsClasses = findModule(
(mod) => typeof mod === 'object' && mod?.HeaderLoaded,
);
export const gamepadUIClasses: GamepadUIClasses = findModule(
(mod) => typeof mod === 'object' && mod?.BasicUiRoot,
);
export const appDetailsClasses: AppDetailsClasses = findModule((mod) => typeof mod === 'object' && mod?.HeaderLoaded);
export const gamepadUIClasses: GamepadUIClasses = findModule((mod) => typeof mod === 'object' && mod?.BasicUiRoot);
export const gamepadTabbedPageClasses: GamepadTabbedPageClasses = findModule(
(mod) => typeof mod === 'object' && mod?.GamepadTabbedPage
(mod) => typeof mod === 'object' && mod?.GamepadTabbedPage,
);
export const gamepadContextMenuClasses: GamepadContextMenuClasses = findModule(
(mod) => typeof mod === 'object' && mod?.BasicContextMenuModal
(mod) => typeof mod === 'object' && mod?.BasicContextMenuModal,
);
export const achievementClasses: AchievementClasses = findModule(
(mod) => typeof mod === 'object' && mod?.AchievementListItemBase
(mod) => typeof mod === 'object' && mod?.AchievementListItemBase,
);
export const mainMenuAppRunningClasses: MainMenuAppRunningClasses = findModule(
(mod) => typeof mod === 'object' && mod?.MainMenuAppRunning
(mod) => typeof mod === 'object' && mod?.MainMenuAppRunning,
);
export const basicAppDetailsSectionStylerClasses: BasicAppDetailsSectionStylerClasses = findModule(
(mod) => typeof mod === 'object' && mod?.AppDetailsRoot
(mod) => typeof mod === 'object' && mod?.AppDetailsRoot,
);

View File

@@ -1,4 +1,4 @@
import Logger from "./logger";
import Logger from './logger';
declare global {
interface Window {
@@ -6,7 +6,7 @@ declare global {
}
}
const logger = new Logger("Webpack");
const logger = new Logger('Webpack');
// In most case an object with getters for each property. Look for the first call to r.d in the module, usually near or at the top.
export type Module = any;
@@ -19,11 +19,11 @@ export let modules: any = [];
function initModuleCache() {
const startTime = performance.now();
logger.group("Webpack Module Init");
logger.group('Webpack Module Init');
// Webpack 5, currently on beta
// Generate a fake module ID
const id = Math.random(); // really should be an int and not a float but who cares
let webpackRequire!: ((id: any) => Module) & {m: object};
let webpackRequire!: ((id: any) => Module) & { m: object };
// Insert our module in a new chunk.
// The module will then be called with webpack's internal require function as its first argument
window.webpackChunksteamui.push([
@@ -34,7 +34,9 @@ function initModuleCache() {
},
]);
logger.log("Initializing all modules. Errors here likely do not matter, as they are usually just failing module side effects.");
logger.log(
'Initializing all modules. Errors here likely do not matter, as they are usually just failing module side effects.',
);
// Loop over every module ID
for (let i of Object.keys(webpackRequire.m)) {
@@ -44,7 +46,7 @@ function initModuleCache() {
modules.push(module);
}
} catch (e) {
logger.debug("Ignoring require error for module", i, e);
logger.debug('Ignoring require error for module', i, e);
}
}
@@ -60,7 +62,10 @@ export const findModule = (filter: FilterFn) => {
}
};
export const findModuleDetailsByExport = (filter: ExportFilterFn, minExports?: number): [module: Module | undefined, moduleExport: any, exportName: any] => {
export const findModuleDetailsByExport = (
filter: ExportFilterFn,
minExports?: number,
): [module: Module | undefined, moduleExport: any, exportName: any] => {
for (const m of modules) {
if (!m) continue;
for (const mod of [m.default, m]) {
@@ -79,15 +84,15 @@ export const findModuleDetailsByExport = (filter: ExportFilterFn, minExports?: n
}
}
return [undefined, undefined, undefined];
}
};
export const findModuleByExport = (filter: ExportFilterFn, minExports?: number) => {
return findModuleDetailsByExport(filter, minExports)?.[0];
}
};
export const findModuleExport = (filter: ExportFilterFn, minExports?: number) => {
return findModuleDetailsByExport(filter, minExports)?.[1];
}
};
/**
* @deprecated use findModuleExport instead
@@ -124,6 +129,8 @@ export const CommonUIModule = modules.find((m: Module) => {
return false;
});
export const IconsModule = findModuleByExport(e => e?.toString && /Spinner\)}\),.\.createElement\(\"path\",{d:\"M18 /.test(e.toString()));
export const IconsModule = findModuleByExport(
(e) => e?.toString && /Spinner\)}\),.\.createElement\(\"path\",{d:\"M18 /.test(e.toString()),
);
export const ReactRouter = findModuleByExport(e => e.computeRootMatch);
export const ReactRouter = findModuleByExport((e) => e.computeRootMatch);

View File

@@ -1,4 +1,4 @@
{
"categorizeByGroup": false,
"excludeExternals": true
}
"categorizeByGroup": false,
"excludeExternals": true
}