mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-20 10:00:08 +02:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc78df918 | ||
|
|
c586afb97d | ||
|
|
d9150c2556 | ||
|
|
cd0635e94f | ||
|
|
443c7850d7 | ||
|
|
d24136ecb6 | ||
|
|
55507446cc | ||
|
|
925ea8c3ce | ||
|
|
14c5210931 | ||
|
|
cc29ddaf57 | ||
|
|
1e8979b641 | ||
|
|
7ba1229a4e | ||
|
|
4c2a715324 | ||
|
|
678ba216f1 | ||
|
|
07d15f5dca | ||
|
|
c84a091469 | ||
|
|
47fd13692f | ||
|
|
2ec9519b7d | ||
|
|
24606190e0 | ||
|
|
ed98d14b37 | ||
|
|
b882612dfa | ||
|
|
32291620b4 | ||
|
|
9b368c5f11 | ||
|
|
e167ef5a13 | ||
|
|
2f3df00967 | ||
|
|
215156d316 | ||
|
|
47d75db690 | ||
|
|
82768e0415 | ||
|
|
e44187fe4b | ||
|
|
72af32436e | ||
|
|
e1f64a38de | ||
|
|
82ed48761d | ||
|
|
a81c342d2a | ||
|
|
68d630262d | ||
|
|
9c72a55aff | ||
|
|
92ffc76075 | ||
|
|
ce3860f73b | ||
|
|
d8b10a2133 | ||
|
|
1581304dcb | ||
|
|
60ddf474e0 | ||
|
|
52ae328e2e | ||
|
|
aa0fad2ecf | ||
|
|
dab9071d1e | ||
|
|
189a90ba31 | ||
|
|
8509ae8f9a | ||
|
|
a6ebfdcd7d | ||
|
|
5f7655baaf | ||
|
|
bca2dcc9bd | ||
|
|
546a4da043 |
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@@ -1,6 +1,7 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
@@ -20,9 +21,12 @@ jobs:
|
||||
node-version: 16
|
||||
- name: Setup | Dependencies
|
||||
run: npm i -g pnpm && pnpm i --frozen-lockfile
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
- name: Test
|
||||
run: pnpm run test
|
||||
- name: Release
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
106
CHANGELOG.md
106
CHANGELOG.md
@@ -1,3 +1,109 @@
|
||||
# [3.17.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.16.2...v3.17.0) (2022-12-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **ControlsList:** Add ControlsList component ([#61](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/61)) ([c586afb](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/c586afb97d59928ecb703b5a254ed1b9405e2c7e))
|
||||
|
||||
## [3.16.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.16.1...v3.16.2) (2022-12-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Marquee:** replace default export with named export ([cd0635e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/cd0635e94f98499f9f5fc24a7fd4b93efe7dfc38))
|
||||
|
||||
## [3.16.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.16.0...v3.16.1) (2022-12-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **FooterLegend:** change description types to ReactNode ([#62](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/62)) ([d24136e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/d24136ecb6b0c5239b68723e8f92a4822aa7b590))
|
||||
|
||||
# [3.16.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.15.0...v3.16.0) (2022-12-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Marquee:** Add Marquee component ([#63](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/63)) ([925ea8c](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/925ea8c3ceaaf6ff2f79b8808908a9b144a4fcff))
|
||||
|
||||
# [3.15.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.14.0...v3.15.0) (2022-12-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Focusable:** add noFocusRing prop type ([#65](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/65)) ([cc29dda](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/cc29ddaf578e21ab2abe1cd266f1d15debee0637))
|
||||
|
||||
# [3.14.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.13.0...v3.14.0) (2022-12-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **toast:** add showToast/playSound to ToastData ([#64](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/64)) ([7ba1229](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7ba1229a4e24fea587b96dc8b078200faf45ddee))
|
||||
|
||||
# [3.13.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.12.0...v3.13.0) (2022-11-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Menu:** add more missing props ([#60](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/60)) [CI SKIP] ([678ba21](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/678ba216f1e194986b0c391398e6f73536cd0102))
|
||||
|
||||
# [3.12.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.11.1...v3.12.0) (2022-11-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **MenuItem:** add missing props ([#59](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/59)) ([c84a091](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/c84a09146935f0942265b7a1e4aadc40e8cf22dc))
|
||||
|
||||
## [3.11.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.11.0...v3.11.1) (2022-11-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Footer:** add types for ActionDescriptionMap ([2ec9519](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/2ec9519b7d6d1cc0d232853ce05a773953b37c5a))
|
||||
|
||||
# [3.11.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.10.0...v3.11.0) (2022-11-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **classes:** add "appDetailsClasses" ([#55](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/55)) ([ed98d14](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/ed98d14b37cf09500afd88e7c8e9c03749119b38))
|
||||
|
||||
# [3.10.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.9.0...v3.10.0) (2022-11-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **classes:** add appDetailsHeaderClasses ([#54](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/54)) ([3229162](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/32291620b403f8b65cf378343454a3f2668fb6ee))
|
||||
|
||||
# [3.9.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.8.0...v3.9.0) (2022-11-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Dialog:** add "focusable" button prop ([#51](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/51)) ([e167ef5](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/e167ef5a138a3edc004db2365334f8455c177132))
|
||||
|
||||
# [3.8.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.14...v3.8.0) (2022-11-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **routerhook:** add global components support ([215156d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/215156d31688faac9028627379e5a3ac4d64ec46))
|
||||
|
||||
## [3.7.14](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.13...v3.7.14) (2022-11-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Menu:** fix on Steam beta ([82768e0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/82768e0415d084deb2af39beb3f9273a83e819de))
|
||||
* **Modal:** fix on Steam beta ([e44187f](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/e44187fe4b9d3e3c9e94490669591599dc5246ba))
|
||||
|
||||
## [3.7.13](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.12...v3.7.13) (2022-11-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **useQuickAccessVisible:** make it work in beta ([#49](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/49)) ([e1f64a3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/e1f64a38de85073e5cea74ecea4b9cde9a783ecc))
|
||||
|
||||
## [3.7.12](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.11...v3.7.12) (2022-10-29)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "3.7.12",
|
||||
"version": "3.17.0",
|
||||
"description": "A library for building decky plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -10,7 +10,6 @@
|
||||
"build": "shx rm -rf dist && tsc -b",
|
||||
"dev": "tsc -b -w",
|
||||
"docs": "typedoc --tsconfig ./tsconfig.json src/**/*",
|
||||
"prepack": "npm run build",
|
||||
"test": "echo 'No tests for now!'",
|
||||
"prepare": "husky install",
|
||||
"commit": "git-cz"
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from './usequickaccessvisible';
|
||||
export * from './useQuickAccessVisible';
|
||||
|
||||
@@ -4,6 +4,16 @@ declare global {
|
||||
var FocusNavController: any;
|
||||
}
|
||||
|
||||
function getQuickAccessWindow(): Window | null {
|
||||
try {
|
||||
const navTrees = FocusNavController?.m_ActiveContext?.m_rgGamepadNavigationTrees || FocusNavController?.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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns state indicating the visibility of quick access menu.
|
||||
*
|
||||
@@ -42,12 +52,10 @@ declare global {
|
||||
* };
|
||||
*/
|
||||
export function useQuickAccessVisible(): boolean {
|
||||
// Assuming that the component is rendered in QAM already, so true by default...
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
const [isVisible, setIsVisible] = useState(getQuickAccessWindow()?.document.hasFocus() ?? true);
|
||||
|
||||
useEffect(() => {
|
||||
const quickAccessWindow: Window | null =
|
||||
FocusNavController?.GetGamepadNavTreeByID('QuickAccess-NA')?.m_Root?.m_element?.ownerDocument.defaultView ?? null;
|
||||
const quickAccessWindow = getQuickAccessWindow();
|
||||
if (quickAccessWindow === null) {
|
||||
console.error('Could not get window of QuickAccess menu!');
|
||||
return;
|
||||
17
src/deck-components/ControlsList.tsx
Normal file
17
src/deck-components/ControlsList.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { findModuleChild } from '../webpack';
|
||||
import { FC } from 'react';
|
||||
|
||||
export interface ControlsListProps {
|
||||
alignItems?: 'left' | 'right' | 'center';
|
||||
spacing?: 'standard' | 'extra';
|
||||
}
|
||||
|
||||
export const ControlsList: FC<ControlsListProps> = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return;
|
||||
for (const prop in m) {
|
||||
if (m[prop]?.toString && m[prop].toString().includes('().ControlsListChild') && m[prop].toString().includes('().ControlsListOuterPanel')) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
return;
|
||||
});
|
||||
@@ -9,8 +9,35 @@ 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.
|
||||
*/
|
||||
noFocusRing?: boolean;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* @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;
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface FocusableProps extends HTMLAttributes<HTMLDivElement>, FooterLe
|
||||
'flow-children'?: string;
|
||||
focusClassName?: string;
|
||||
focusWithinClassName?: string;
|
||||
noFocusRing?: boolean;
|
||||
onActivate?: (e: CustomEvent) => void;
|
||||
onCancel?: (e: CustomEvent) => void;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
export enum GamepadButton {
|
||||
INVALID,
|
||||
OK,
|
||||
@@ -29,30 +31,29 @@ export enum GamepadButton {
|
||||
STEAM_GUIDE,
|
||||
STEAM_QUICK_MENU,
|
||||
}
|
||||
|
||||
export enum NavEntryPositionPreferences {
|
||||
export declare enum NavEntryPositionPreferences {
|
||||
FIRST,
|
||||
LAST,
|
||||
MAINTAIN_X,
|
||||
MAINTAIN_Y,
|
||||
PREFERRED_CHILD,
|
||||
PREFERRED_CHILD
|
||||
}
|
||||
|
||||
export interface GamepadEventDetail {
|
||||
button: number;
|
||||
is_repeat?: boolean;
|
||||
source: number;
|
||||
}
|
||||
|
||||
export type GamepadEvent = CustomEvent<GamepadEventDetail>;
|
||||
|
||||
export declare type ActionDescriptionMap = {
|
||||
[key in GamepadButton]?: ReactNode
|
||||
}
|
||||
export declare type GamepadEvent = CustomEvent<GamepadEventDetail>;
|
||||
export interface FooterLegendProps {
|
||||
actionDescriptionMap?: unknown;
|
||||
onOKActionDescription?: string;
|
||||
onCancelActionDescription?: string;
|
||||
onSecondaryActionDescription?: string;
|
||||
onOptionsActionDescription?: string;
|
||||
onMenuActionDescription?: string;
|
||||
actionDescriptionMap?: ActionDescriptionMap;
|
||||
onOKActionDescription?: ReactNode;
|
||||
onCancelActionDescription?: ReactNode;
|
||||
onSecondaryActionDescription?: ReactNode;
|
||||
onOptionsActionDescription?: ReactNode;
|
||||
onMenuActionDescription?: ReactNode;
|
||||
onButtonDown?: (evt: GamepadEvent) => void;
|
||||
onButtonUp?: (evt: GamepadEvent) => void;
|
||||
onOKButton?: (evt: GamepadEvent) => void;
|
||||
|
||||
26
src/deck-components/Marquee.tsx
Normal file
26
src/deck-components/Marquee.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { CSSProperties, FC } from 'react';
|
||||
|
||||
import { findModuleChild } from '../webpack';
|
||||
|
||||
export interface MarqueeProps {
|
||||
play?: boolean;
|
||||
direction?: 'left' | 'right';
|
||||
speed?: number;
|
||||
delay?: number;
|
||||
fadeLength?: number;
|
||||
center?: boolean;
|
||||
resetOnPause?: boolean;
|
||||
style?: CSSProperties;
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export const Marquee: FC<MarqueeProps> = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return;
|
||||
for (const prop in m) {
|
||||
if (m[prop]?.toString && m[prop].toString().includes('.Marquee') && m[prop].toString().includes('--fade-length')) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
return;
|
||||
});
|
||||
@@ -1,6 +1,8 @@
|
||||
import { FC, ReactNode } from 'react';
|
||||
|
||||
import { fakeRenderComponent } from '../utils';
|
||||
import { findModuleChild } from '../webpack';
|
||||
import { FooterLegendProps } from './FooterLegend';
|
||||
|
||||
export const showContextMenu: (children: ReactNode, parent?: EventTarget) => void = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
@@ -11,7 +13,7 @@ export const showContextMenu: (children: ReactNode, parent?: EventTarget) => voi
|
||||
}
|
||||
});
|
||||
|
||||
export interface MenuProps {
|
||||
export interface MenuProps extends FooterLegendProps {
|
||||
label: string;
|
||||
onCancel?(): void;
|
||||
cancelText?: string;
|
||||
@@ -38,15 +40,26 @@ export const MenuGroup: FC<MenuGroupProps> = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.prototype?.RenderSubMenu && m[prop]?.prototype?.ShowSubMenu) {
|
||||
if (
|
||||
(m[prop]?.toString()?.includes('bInGamepadUI:') &&
|
||||
fakeRenderComponent(() => m[prop]())?.type?.prototype?.RenderSubMenu) ||
|
||||
(m[prop]?.prototype?.RenderSubMenu && m[prop]?.prototype?.ShowSubMenu)
|
||||
) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export interface MenuItemProps {
|
||||
onSelected?(): void;
|
||||
export interface MenuItemProps extends FooterLegendProps {
|
||||
bInteractableItem?: boolean;
|
||||
onClick?(evt: Event): void;
|
||||
onSelected?(evt: Event): void;
|
||||
onMouseEnter?(evt: MouseEvent): void;
|
||||
onMoveRight?(): void;
|
||||
selected?: boolean;
|
||||
disabled?: boolean;
|
||||
bPlayAudio?: boolean;
|
||||
tone?: 'positive' | 'emphasis' | 'destructive';
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
@@ -54,7 +67,10 @@ export const MenuItem: FC<MenuItemProps> = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.prototype?.OnOKButton && m[prop]?.prototype?.OnMouseEnter) {
|
||||
if (
|
||||
m[prop]?.render?.toString()?.includes('bPlayAudio:') ||
|
||||
(m[prop]?.prototype?.OnOKButton && m[prop]?.prototype?.OnMouseEnter)
|
||||
) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FC, ReactNode } from 'react';
|
||||
|
||||
import { findSP } from '../utils';
|
||||
import { findModuleChild } from '../webpack';
|
||||
import { findModule, findModuleChild } from '../webpack';
|
||||
|
||||
// All of the popout options + strTitle are related. Proper usage is not yet known...
|
||||
export interface ShowModalProps {
|
||||
@@ -29,18 +29,57 @@ export interface ShowModalResult {
|
||||
Update: (modal: ReactNode) => void;
|
||||
}
|
||||
|
||||
const showModalRaw: (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps) => Promise<ShowModalResult> =
|
||||
findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (typeof m[prop] === 'function' && m[prop].toString().includes('bHideMainWindowForPopouts:!0')) {
|
||||
return m[prop];
|
||||
}
|
||||
const showModalRaw:
|
||||
| ((
|
||||
modal: ReactNode,
|
||||
parent?: EventTarget,
|
||||
title?: string,
|
||||
props?: ShowModalProps,
|
||||
unknown1?: unknown,
|
||||
hideActions?: { bHideActions?: boolean },
|
||||
modalManager?: unknown,
|
||||
) => Promise<ShowModalResult>)
|
||||
| void = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (
|
||||
typeof m[prop] === 'function' &&
|
||||
m[prop].toString().includes('props.bDisableBackgroundDismiss') &&
|
||||
!m[prop]?.prototype?.Cancel
|
||||
) {
|
||||
return m[prop];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const showModal = (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps): Promise<ShowModalResult> => {
|
||||
return showModalRaw(modal, parent || findSP(), props);
|
||||
const oldShowModalRaw:
|
||||
| ((modal: ReactNode, parent?: EventTarget, props?: ShowModalProps) => Promise<ShowModalResult>)
|
||||
| void = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (typeof m[prop] === 'function' && m[prop].toString().includes('bHideMainWindowForPopouts:!0')) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export const showModal = (
|
||||
modal: ReactNode,
|
||||
parent?: EventTarget,
|
||||
props: ShowModalProps = {
|
||||
strTitle: 'Decky Dialog',
|
||||
bHideMainWindowForPopouts: false,
|
||||
},
|
||||
): Promise<ShowModalResult> => {
|
||||
if (showModalRaw) {
|
||||
return showModalRaw(modal, parent || findSP(), props.strTitle, props, undefined, {
|
||||
bHideActions: props.bHideActionIcons,
|
||||
});
|
||||
} else if (oldShowModalRaw) {
|
||||
return oldShowModalRaw(modal, parent || findSP(), props);
|
||||
} else {
|
||||
throw new Error('[DFL:Modals]: Cannot find showModal function');
|
||||
}
|
||||
};
|
||||
|
||||
export interface ModalRootProps {
|
||||
@@ -79,11 +118,26 @@ export const ConfirmModal = findModuleChild((m) => {
|
||||
}
|
||||
}) as FC<ConfirmModalProps>;
|
||||
|
||||
export const ModalRoot = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.prototype?.OK && m[prop]?.prototype?.Cancel && m[prop]?.prototype?.render) {
|
||||
return m[prop];
|
||||
// new
|
||||
export const ModalRoot = (Object.values(
|
||||
findModule((m: any) => {
|
||||
if (typeof m !== 'object') return false;
|
||||
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.toString()?.includes('"ModalManager","DialogWrapper"')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}) as FC<ModalRootProps>;
|
||||
|
||||
return false;
|
||||
}) || {},
|
||||
)?.find((x: any) => x?.type?.toString()?.includes('((function(){')) ||
|
||||
// old
|
||||
findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.prototype?.OK && m[prop]?.prototype?.Cancel && m[prop]?.prototype?.render) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
})) as FC<ModalRootProps>;
|
||||
|
||||
300
src/deck-components/SteamClient.ts
Normal file
300
src/deck-components/SteamClient.ts
Normal file
@@ -0,0 +1,300 @@
|
||||
export interface Apps {
|
||||
RegisterForAppOverviewChanges: any;
|
||||
RegisterForAppDetails: any;
|
||||
RegisterForLocalizationChanges: any;
|
||||
RegisterForWorkshopChanges: any;
|
||||
RegisterForWorkshopItemDownloads: any;
|
||||
GetLibraryBootstrapData: any;
|
||||
RegisterForAchievementChanges: any;
|
||||
GetFriendAchievementsForApp: any;
|
||||
GetMyAchievementsForApp: any;
|
||||
AddUserTagToApps: any;
|
||||
RemoveUserTagFromApps: any;
|
||||
ClearUserTagsOnApps: any;
|
||||
ClearAndSetUserTagsOnApp: any;
|
||||
SetAppHidden: any;
|
||||
ResetHiddenState: any;
|
||||
SetAppLaunchOptions: any;
|
||||
SetAppResolutionOverride: any;
|
||||
SetAppCurrentLanguage: any;
|
||||
SetAppAutoUpdateBehavior: any;
|
||||
SetAppBackgroundDownloadsBehavior: any;
|
||||
ToggleAppFamilyBlockedState: any;
|
||||
ToggleAppSteamCloudEnabled: any;
|
||||
ToggleAppSteamCloudSyncOnSuspendEnabled: any;
|
||||
ToggleOverrideResolutionForInternalDisplay: any;
|
||||
ToggleEnableSteamOverlayForApp: any;
|
||||
ToggleEnableDesktopTheatreForApp: any;
|
||||
BrowseLocalFilesForApp: any;
|
||||
BrowseScreenshotsForApp: any;
|
||||
BrowseScreenshotForApp: any;
|
||||
BackupFilesForApp: any;
|
||||
VerifyFilesForApp: any;
|
||||
CreateDesktopShortcutForApp: any;
|
||||
JoinAppContentBeta: any;
|
||||
JoinAppContentBetaByPassword: any;
|
||||
GetAchievementsInTimeRange: any;
|
||||
GetSubscribedWorkshopItems: any;
|
||||
SubscribeWorkshopItem: any;
|
||||
GetDownloadedWorkshopItems: any;
|
||||
DownloadWorkshopItem: any;
|
||||
SetLocalScreenshotCaption: any;
|
||||
SetLocalScreenshotSpoiler: any;
|
||||
GetDetailsForScreenshotUpload: any;
|
||||
UploadLocalScreenshot: any;
|
||||
DeleteLocalScreenshot: any;
|
||||
GetScreenshotsInTimeRange: any;
|
||||
GetFriendsWhoPlay: any;
|
||||
RequestLegacyCDKeysForApp: any;
|
||||
GetSoundtrackDetails: any;
|
||||
GetStoreTagLocalization: any;
|
||||
GetLaunchOptionsForApp: any;
|
||||
GetResolutionOverrideForApp: any;
|
||||
ScanForShortcuts: any;
|
||||
GetAllShortcuts: any;
|
||||
GetShortcutData: any;
|
||||
AddShortcut: any;
|
||||
RemoveShortcut: any;
|
||||
InstallFlatpakAppAndCreateShortcut: any;
|
||||
ListFlatpakApps: any;
|
||||
UninstallFlatpakApp: any;
|
||||
ShowControllerConfigurator: any;
|
||||
SetThirdPartyControllerConfiguration: any;
|
||||
ToggleAllowDesktopConfiguration: any;
|
||||
SetControllerRumblePreference: any;
|
||||
GetCachedAppDetails: any;
|
||||
SetCachedAppDetails: any;
|
||||
ReportLibraryAssetCacheMiss: any;
|
||||
SaveAchievementProgressCache: any;
|
||||
SetStreamingClientForApp: any;
|
||||
SetCustomArtworkForApp: any;
|
||||
ClearCustomArtworkForApp: any;
|
||||
SetCustomLogoPositionForApp: any;
|
||||
ClearCustomLogoPositionForApp: any;
|
||||
RequestIconDataForApp: any;
|
||||
SpecifyCompatTool: any;
|
||||
GetAvailableCompatTools: any;
|
||||
SetShortcutName: any;
|
||||
SetShortcutExe: any;
|
||||
SetShortcutStartDir: any;
|
||||
SetShortcutLaunchOptions: any;
|
||||
SetShortcutIsVR: any;
|
||||
PromptToChangeShortcut: any;
|
||||
PromptToSelectShortcutIcon: any;
|
||||
InstallApp: any;
|
||||
RunGame: any;
|
||||
VerifyApp: any;
|
||||
StreamGame: any;
|
||||
CancelLaunch: any;
|
||||
TerminateApp: any;
|
||||
UninstallApps: any;
|
||||
ShowStore: any;
|
||||
SetDLCEnabled: any;
|
||||
ContinueGameAction: any;
|
||||
CancelGameAction: any;
|
||||
GetActiveGameActions: any;
|
||||
GetGameActionDetails: any;
|
||||
GetGameActionForApp: any;
|
||||
SkipShaderProcessing: any;
|
||||
MarkEulaAccepted: any;
|
||||
MarkEulaRejected: any;
|
||||
LoadEula: any;
|
||||
GetConflictingFileTimestamps: any;
|
||||
GetCloudPendingRemoteOperations: any;
|
||||
ClearProton: any;
|
||||
RegisterForMarketingMessages: any;
|
||||
FetchMarketingMessages: any;
|
||||
MarkMarketingMessageSeen: any;
|
||||
ReportMarketingMessageSeen: any;
|
||||
RegisterForGameActionStart: any;
|
||||
RegisterForGameActionEnd: any;
|
||||
RegisterForGameActionTaskChange: any;
|
||||
RegisterForGameActionUserRequest: any;
|
||||
RegisterForGameActionShowError: any;
|
||||
RegisterForGameActionShowUI: any;
|
||||
OpenAppSettingsDialog: any;
|
||||
}
|
||||
|
||||
export interface Window {
|
||||
RegisterForExternalDisplayChanged: any;
|
||||
SetManualDisplayScaleFactor: any;
|
||||
SetAutoDisplayScale: any;
|
||||
Minimize: any;
|
||||
ProcessShuttingDown: any;
|
||||
ToggleMaximize: any;
|
||||
MoveTo: any;
|
||||
ResizeTo: any;
|
||||
SetMinSize: any;
|
||||
SetResizeGrip: any;
|
||||
SetComposition: any;
|
||||
GamescopeBlur: any;
|
||||
BringToFront: any;
|
||||
SetForegroundWindow: any;
|
||||
SetKeyFocus: any;
|
||||
FlashWindow: any;
|
||||
StopFlashWindow: any;
|
||||
ShowWindow: any;
|
||||
HideWindow: any;
|
||||
SetWindowIcon: any;
|
||||
GetWindowDimensions: any;
|
||||
GetWindowRestoreDetails: any;
|
||||
PositionWindowRelative: any;
|
||||
GetMousePositionDetails: any;
|
||||
IsWindowMinimized: any;
|
||||
GetBrowserID: any;
|
||||
}
|
||||
|
||||
export interface SteamClient {
|
||||
Apps: Apps;
|
||||
Browser: any;
|
||||
BrowserView: any;
|
||||
ClientNotifications: any;
|
||||
Cloud: any;
|
||||
Console: any;
|
||||
Downloads: any;
|
||||
FamilySharing: any;
|
||||
FriendSettings: any;
|
||||
Friends: any;
|
||||
GameSessions: any;
|
||||
Input: any;
|
||||
InstallFolder: any;
|
||||
Installs: any;
|
||||
MachineStorage: any;
|
||||
Messaging: any;
|
||||
Notifications: any;
|
||||
OpenVR: any;
|
||||
Overlay: any;
|
||||
Parental: any;
|
||||
RegisterIFrameNavigatedCallback: any;
|
||||
RemotePlay: any;
|
||||
RoamingStorage: any;
|
||||
Screenshots: any;
|
||||
Settings: any;
|
||||
SharedConnection: any;
|
||||
Stats: any;
|
||||
Storage: any;
|
||||
Streaming: any;
|
||||
System: any;
|
||||
UI: any;
|
||||
URL: any;
|
||||
Updates: any;
|
||||
User: any;
|
||||
WebChat: any;
|
||||
Window: Window;
|
||||
}
|
||||
|
||||
export interface SteamShortcut {
|
||||
appid: number;
|
||||
data: {
|
||||
bIsApplication: boolean;
|
||||
strAppName: string;
|
||||
strExePath: string;
|
||||
strArguments: string;
|
||||
strShortcutPath: string;
|
||||
strSortAs: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @prop unAppID is not properly set by Steam for non-steam game shortcuts, so it defaults to 0 for them
|
||||
*/
|
||||
export interface LifetimeNotification {
|
||||
unAppID: number;
|
||||
nInstanceID: number;
|
||||
bRunning: boolean;
|
||||
}
|
||||
|
||||
export type AppAchievements = {
|
||||
nAchieved: number;
|
||||
nTotal: number;
|
||||
vecAchievedHidden: any[];
|
||||
vecHighlight: any[];
|
||||
vecUnachieved: any[];
|
||||
};
|
||||
|
||||
export type AppLanguages = {
|
||||
strDisplayName: string;
|
||||
strShortName: string;
|
||||
};
|
||||
|
||||
export interface AppDetails {
|
||||
achievements: AppAchievements;
|
||||
bCanMoveInstallFolder: boolean;
|
||||
bCloudAvailable: boolean;
|
||||
bCloudEnabledForAccount: boolean;
|
||||
bCloudEnabledForApp: boolean;
|
||||
bCloudSyncOnSuspendAvailable: boolean;
|
||||
bCloudSyncOnSuspendEnabled: boolean;
|
||||
bCommunityMarketPresence: boolean;
|
||||
bEnableAllowDesktopConfiguration: boolean;
|
||||
bFreeRemovableLicense: boolean;
|
||||
bHasAllLegacyCDKeys: boolean;
|
||||
bHasAnyLocalContent: boolean;
|
||||
bHasLockedPrivateBetas: boolean;
|
||||
bIsExcludedFromSharing: boolean;
|
||||
bIsSubscribedTo: boolean;
|
||||
bOverlayEnabled: boolean;
|
||||
bOverrideInternalResolution: boolean;
|
||||
bRequiresLegacyCDKey: boolean;
|
||||
bShortcutIsVR: boolean;
|
||||
bShowCDKeyInMenus: boolean;
|
||||
bShowControllerConfig: boolean;
|
||||
bSupportsCDKeyCopyToClipboard: boolean;
|
||||
bVRGameTheatreEnabled: boolean;
|
||||
bWorkshopVisible: boolean;
|
||||
eAppOwnershipFlags: number;
|
||||
eAutoUpdateValue: number;
|
||||
eBackgroundDownloads: number;
|
||||
eCloudSync: number;
|
||||
eControllerRumblePreference: number;
|
||||
eDisplayStatus: number;
|
||||
eEnableThirdPartyControllerConfiguration: number;
|
||||
eSteamInputControllerMask: number;
|
||||
iInstallFolder: number;
|
||||
lDiskUsageBytes: number;
|
||||
lDlcUsageBytes: number;
|
||||
nBuildID: number;
|
||||
nCompatToolPriority: number;
|
||||
nPlaytimeForever: number;
|
||||
nScreenshots: number;
|
||||
rtLastTimePlayed: number;
|
||||
rtLastUpdated: number;
|
||||
rtPurchased: number;
|
||||
selectedLanguage: {
|
||||
strDisplayName: string;
|
||||
strShortName: string;
|
||||
};
|
||||
strCloudBytesAvailable: string;
|
||||
strCloudBytesUsed: string;
|
||||
strCompatToolDisplayName: string;
|
||||
strCompatToolName: string;
|
||||
strDeveloperName: string;
|
||||
strDeveloperURL: string;
|
||||
strDisplayName: string;
|
||||
strExternalSubscriptionURL: string;
|
||||
strFlatpakAppID: string;
|
||||
strHomepageURL: string;
|
||||
strLaunchOptions: string;
|
||||
strManualURL: string;
|
||||
strOwnerSteamID: string;
|
||||
strResolutionOverride: string;
|
||||
strSelectedBeta: string;
|
||||
strShortcutExe: string;
|
||||
strShortcutLaunchOptions: string;
|
||||
strShortcutStartDir: string;
|
||||
strSteamDeckBlogURL: string;
|
||||
unAppID: number;
|
||||
vecBetas: any[];
|
||||
vecDLC: any[];
|
||||
vecDeckCompatTestResults: any[];
|
||||
vecLanguages: AppLanguages[];
|
||||
vecLegacyCDKeys: any[];
|
||||
vecMusicAlbums: any[];
|
||||
vecPlatforms: string[];
|
||||
vecScreenShots: any[];
|
||||
}
|
||||
|
||||
export interface SteamAppOverview {
|
||||
display_name: string;
|
||||
gameid: string;
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
export * from './Button';
|
||||
export * from './ButtonItem';
|
||||
export * from './Carousel';
|
||||
export * from './ControlsList';
|
||||
export * from './Dialog';
|
||||
export * from './Dropdown';
|
||||
export * from './Field';
|
||||
export * from './Focusable';
|
||||
export * from './FocusRing';
|
||||
export * from './FooterLegend';
|
||||
export * from './Marquee';
|
||||
export * from './Menu';
|
||||
export * from './Modal';
|
||||
export * from './Panel';
|
||||
@@ -21,3 +23,10 @@ export * from './Tabs';
|
||||
export * from './TextField';
|
||||
export * from './Toggle';
|
||||
export * from './ToggleField';
|
||||
export * from './SteamClient';
|
||||
|
||||
import {SteamClient} from './SteamClient'
|
||||
|
||||
declare global {
|
||||
var SteamClient: SteamClient;
|
||||
}
|
||||
|
||||
@@ -349,6 +349,98 @@ type GamepadSliderClasses = Record<
|
||||
string
|
||||
>;
|
||||
|
||||
type AppDetailsHeaderClasses = Record<
|
||||
| 'AddBoxSizer'
|
||||
| 'Background'
|
||||
| 'Bottom'
|
||||
| 'BottomCenter'
|
||||
| 'BottomLeft'
|
||||
| 'BottomRight'
|
||||
| 'BoxSizer'
|
||||
| 'BoxSizerButtonContainer'
|
||||
| 'BoxSizerContainer'
|
||||
| 'BoxSizerDelete'
|
||||
| 'BoxSizerDragBox'
|
||||
| 'BoxSizerEdge'
|
||||
| 'BoxSizerGridBox'
|
||||
| 'BoxSizerInfo'
|
||||
| 'BoxSizerSettings'
|
||||
| 'BoxSizerValidRegion'
|
||||
| 'CenterCenter'
|
||||
| 'DialogButton'
|
||||
| 'EdgeDown'
|
||||
| 'FallbackArt'
|
||||
| 'Features'
|
||||
| 'FullscreenEnterActive'
|
||||
| 'FullscreenEnterDone'
|
||||
| 'FullscreenEnterStart'
|
||||
| 'FullscreenExitActive'
|
||||
| 'FullscreenExitDone'
|
||||
| 'FullscreenExitStart'
|
||||
| 'HeaderBackgroundImage'
|
||||
| 'ImgBlur'
|
||||
| 'ImgBlurBackdrop'
|
||||
| 'ImgContainer'
|
||||
| 'ImgSrc'
|
||||
| 'Left'
|
||||
| 'Loaded'
|
||||
| 'Middle'
|
||||
| 'NoArt'
|
||||
| 'PinBox'
|
||||
| 'Right'
|
||||
| 'SVGTitle'
|
||||
| 'SaveBoxSizer'
|
||||
| 'TextNameSpace'
|
||||
| 'TitleImageContainer'
|
||||
| 'TitleLogo'
|
||||
| 'TitleSection'
|
||||
| 'Top'
|
||||
| 'TopCapsule'
|
||||
| 'TopGradient'
|
||||
| 'TopLeft'
|
||||
| 'TopRight'
|
||||
| 'UpperCenter'
|
||||
| 'UpperLeft'
|
||||
| 'duration-app-launch',
|
||||
string
|
||||
>;
|
||||
|
||||
type AppDetailsClasses = Record<
|
||||
| 'BreakNarrow'
|
||||
| 'BreakShort'
|
||||
| 'BreakTall'
|
||||
| 'BreakUltraWide'
|
||||
| 'BreakWide'
|
||||
| 'Container'
|
||||
| 'GamepadUIBreakNarrow'
|
||||
| 'GamepadUIBreakShort'
|
||||
| 'GamepadUIBreakWide'
|
||||
| 'Glassy'
|
||||
| 'Header'
|
||||
| 'HeaderLoaded'
|
||||
| 'InnerContainer'
|
||||
| 'ItemFocusAnim-darkGrey'
|
||||
| 'ItemFocusAnim-darkerGrey'
|
||||
| 'ItemFocusAnim-darkerGrey-nocolor'
|
||||
| 'ItemFocusAnim-green'
|
||||
| 'ItemFocusAnim-grey'
|
||||
| 'ItemFocusAnimBorder-darkGrey'
|
||||
| 'PlayBar'
|
||||
| 'PreventScrolling'
|
||||
| 'RightBreakNarrow'
|
||||
| 'RightBreakUltraNarrow'
|
||||
| 'RightBreakUltraWide'
|
||||
| 'RightBreakWide'
|
||||
| 'ScrollContainer'
|
||||
| 'ShowPlayBar'
|
||||
| 'Throbber'
|
||||
| 'duration-app-launch'
|
||||
| 'fadein'
|
||||
| 'focusAnimation'
|
||||
| 'hoverAnimation',
|
||||
string
|
||||
>;
|
||||
|
||||
export const quickAccessMenuClasses: QuickAccessMenuClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.Title?.includes('quickaccessmenu'),
|
||||
);
|
||||
@@ -378,3 +470,9 @@ export const playSectionClasses: PlaySectionClasses = findModule(
|
||||
export const gamepadSliderClasses: GamepadSliderClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.SliderControlPanelGroup?.includes('gamepadslider'),
|
||||
);
|
||||
export const appDetailsHeaderClasses: AppDetailsHeaderClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.TopCapsule?.includes('sharedappdetailsheader'),
|
||||
);
|
||||
export const appDetailsClasses: AppDetailsClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.HeaderLoaded?.includes('appdetails_'),
|
||||
);
|
||||
|
||||
@@ -26,8 +26,10 @@ export type RoutePatch = (route: RouteProps) => RouteProps;
|
||||
export interface RouterHook {
|
||||
addRoute(path: string, component: ComponentType, props?: Omit<RouteProps, 'path' | 'children'>): void;
|
||||
addPatch(path: string, patch: RoutePatch): RoutePatch;
|
||||
removePatch(path: string, patch: RoutePatch): void;
|
||||
addGlobalComponent(name: string, component: ComponentType): void;
|
||||
removeRoute(path: string): void;
|
||||
removePatch(path: string, patch: RoutePatch): void;
|
||||
removeGlobalComponent(name: string): void;
|
||||
}
|
||||
|
||||
export interface ToastData {
|
||||
@@ -40,6 +42,10 @@ export interface ToastData {
|
||||
contentClassName?: string;
|
||||
duration?: number;
|
||||
critical?: boolean;
|
||||
eType?: number;
|
||||
sound?: number;
|
||||
playSound?: boolean;
|
||||
showToast?: boolean;
|
||||
}
|
||||
|
||||
export interface Toaster {
|
||||
|
||||
Reference in New Issue
Block a user