mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-21 10:29:00 +02:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a728611f4 | ||
|
|
97997adfaf | ||
|
|
279069ee34 | ||
|
|
944a9024ff | ||
|
|
0a2220b4b4 | ||
|
|
aa567e9dd0 | ||
|
|
d9e4ff3ebd | ||
|
|
79d73dea2e | ||
|
|
602f93ae6a | ||
|
|
d86c86cd80 | ||
|
|
51c418d560 | ||
|
|
95de7346df | ||
|
|
58933f827c | ||
|
|
0ff3476987 | ||
|
|
2c7d266c81 | ||
|
|
9bd96227a0 | ||
|
|
ddafa5666d | ||
|
|
46977496fd | ||
|
|
71a6c79384 | ||
|
|
da4c79b5ae | ||
|
|
7b04bf5827 | ||
|
|
a87e1bb46f | ||
|
|
b6e2e7e4dc | ||
|
|
7d82a82e9c | ||
|
|
0cee60d122 | ||
|
|
7efc0347f7 | ||
|
|
d227858e62 | ||
|
|
db64f34725 | ||
|
|
b08aadb810 | ||
|
|
2afb7f16bb | ||
|
|
32d1303191 | ||
|
|
1ce15d261f | ||
|
|
bf52e0761c | ||
|
|
823a2745f9 | ||
|
|
21f7874cab | ||
|
|
077334e376 | ||
|
|
02f4c5c518 | ||
|
|
f1e20cd0b5 | ||
|
|
b5d9265705 | ||
|
|
734ce33e1b | ||
|
|
9beab5f7e9 | ||
|
|
33aaf56f96 | ||
|
|
dddb703a2e | ||
|
|
ea2e072085 | ||
|
|
6324282b48 | ||
|
|
ace3f95a33 | ||
|
|
4d30efc33b | ||
|
|
af2d3a29e2 | ||
|
|
e5e561edd6 |
@@ -9,7 +9,7 @@
|
|||||||
[
|
[
|
||||||
"@semantic-release/git",
|
"@semantic-release/git",
|
||||||
{
|
{
|
||||||
"assets": ["CHANGELOG.md", "package.json"],
|
"assets": ["CHANGELOG.md", "package.json", "package-lock.json"],
|
||||||
"message": "chore(release): ${nextRelease.version} [CI SKIP]"
|
"message": "chore(release): ${nextRelease.version} [CI SKIP]"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
166
CHANGELOG.md
166
CHANGELOG.md
@@ -1,3 +1,169 @@
|
|||||||
|
## [1.2.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.2.1...v1.2.2) (2022-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Modal:** add more props to typings ([97997ad](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/97997adfaf1a68ef436279e6e48f34f5eaa9531c))
|
||||||
|
|
||||||
|
## [1.2.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.2.0...v1.2.1) (2022-07-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **ProgressBar:** extend correct prop type ([944a902](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/944a9024ff20f0b596869564d014d7dd73e74254))
|
||||||
|
|
||||||
|
# [1.2.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.1.0...v1.2.0) (2022-07-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **ProgressBar:** add new progress bars ([d9e4ff3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/d9e4ff3ebd22a31306f564e7f8ad82879c8fb699))
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.0.2...v1.1.0) (2022-07-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **Router.tsx:** adds more methods to router ([#9](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/9)) ([602f93a](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/602f93ae6a5ceca5383b888cd4803638799558c5))
|
||||||
|
|
||||||
|
## [1.0.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.0.1...v1.0.2) (2022-07-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Plugin:** support non-ui plugins ([51c418d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/51c418d560247c917125cd5534a978256724e5f3))
|
||||||
|
|
||||||
|
## [1.0.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.0.0...v1.0.1) (2022-06-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **package:** enable tree shaking ([58933f8](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/58933f827ce2e2ae9b162da4e0061a7591c5759d))
|
||||||
|
|
||||||
|
# [1.0.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.3...v1.0.0) (2022-06-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Code Refactoring
|
||||||
|
|
||||||
|
* **components:** rename Field components ([9bd9622](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/9bd96227a0bb295dcc29abca71e37983307f0505))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* **components:** Toggle -> ToggleField Slider -> SliderField & add Toggle component
|
||||||
|
|
||||||
|
## [0.12.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.2...v0.12.3) (2022-06-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Field:** description is a string you idiot ([4697749](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/46977496fd4cbe266c370fcffe59a9d9b7543a92))
|
||||||
|
|
||||||
|
## [0.12.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.1...v0.12.2) (2022-06-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Field:** title -> label ([da4c79b](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/da4c79b5aeb3c589527e17ad29610a8e3f929b79))
|
||||||
|
|
||||||
|
## [0.12.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.0...v0.12.1) (2022-06-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **components:** export FIeld ([a87e1bb](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/a87e1bb46f749e10ea2b94a011df48f162834c25))
|
||||||
|
|
||||||
|
# [0.12.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.11.1...v0.12.0) (2022-06-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **components:** add Field ([7d82a82](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7d82a82e9c4db59832593cb6f0f78775b252dc69))
|
||||||
|
|
||||||
|
## [0.11.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.11.0...v0.11.1) (2022-06-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Router:** make specifying quick access tab not required ([7efc034](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7efc0347f7aa22773feccb0763280c4fd1c4a231))
|
||||||
|
|
||||||
|
# [0.11.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.5...v0.11.0) (2022-06-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **utils:** add sleep util ([db64f34](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/db64f3472542b080b1d470c6b8d7aa441db0bfe6))
|
||||||
|
|
||||||
|
## [0.10.5](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.4...v0.10.5) (2022-06-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **patcher:** why the hell did i do it that way ([2afb7f1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/2afb7f16bb219013d338bc4e002605d32235385c))
|
||||||
|
|
||||||
|
## [0.10.4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.3...v0.10.4) (2022-06-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **plugin:** correct return type on injectCssIntoTab ([1ce15d2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/1ce15d261f4726a2f8bdaff7c8a98497f2622969))
|
||||||
|
|
||||||
|
## [0.10.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.2...v0.10.3) (2022-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **ServerAPI:** add injectCssIntoTab to serverAPI typings ([823a274](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/823a2745f9717ed2d2a5d95e2ef25739bffc18c9))
|
||||||
|
|
||||||
|
## [0.10.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.1...v0.10.2) (2022-06-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Router:** add NavigateBackOrOpenMenu() ([077334e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/077334e376fb42283e094f0b57c818c580c6f7ba))
|
||||||
|
|
||||||
|
## [0.10.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.0...v0.10.1) (2022-06-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Focusable:** add ref prop, fix event types ([f1e20cd](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/f1e20cd0b54622d634202c85cca920323e4df336))
|
||||||
|
|
||||||
|
# [0.10.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.9.1...v0.10.0) (2022-06-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **components:** remove HorizontalFocus, add Focusable ([9beab5f](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/9beab5f7e913f2ef2a8a3047046a524d3007c3b8))
|
||||||
|
|
||||||
|
## [0.9.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.9.0...v0.9.1) (2022-06-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **SuspensefulImage:** fix export ([dddb703](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/dddb703a2e712bf2e9d7e172a414c63ffd6a1cc9))
|
||||||
|
|
||||||
|
# [0.9.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.8.0...v0.9.0) (2022-06-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **custom-components:** add SuspensefulImage ([6324282](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/6324282b480f358a3d5936ab6d08ab239d640997))
|
||||||
|
|
||||||
|
# [0.8.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.7.2...v0.8.0) (2022-06-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **components:** add HorizontalFocus ([4d30efc](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/4d30efc33b5398b91e756695fefa91cc37f83ff1))
|
||||||
|
|
||||||
|
## [0.7.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.7.1...v0.7.2) (2022-06-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **package:** fix pnpm peer dependencies errors ([e5e561e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/e5e561edd67994b8c55f99c1228e47d77b1c2ee2))
|
||||||
|
|
||||||
## [0.7.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.7.0...v0.7.1) (2022-06-08)
|
## [0.7.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.7.0...v0.7.1) (2022-06-08)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "decky-frontend-lib",
|
"name": "decky-frontend-lib",
|
||||||
"version": "0.0.6",
|
"version": "1.2.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "decky-frontend-lib",
|
"name": "decky-frontend-lib",
|
||||||
"version": "0.0.6",
|
"version": "1.2.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "decky-frontend-lib",
|
"name": "decky-frontend-lib",
|
||||||
"version": "0.7.1",
|
"version": "1.2.2",
|
||||||
"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",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
|
"sideEffects": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "shx rm -rf dist && tsc -b",
|
"build": "shx rm -rf dist && tsc -b",
|
||||||
"dev": "tsc -b -w",
|
"dev": "tsc -b -w",
|
||||||
@@ -58,6 +59,14 @@
|
|||||||
"ts-jest": "^27.1.4",
|
"ts-jest": "^27.1.4",
|
||||||
"typescript": "^4.6.3"
|
"typescript": "^4.6.3"
|
||||||
},
|
},
|
||||||
|
"pnpm": {
|
||||||
|
"peerDependencyRules": {
|
||||||
|
"ignoreMissing": [
|
||||||
|
"react",
|
||||||
|
"react-dom"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"importSort": {
|
"importSort": {
|
||||||
".js, .jsx, .ts, .tsx": {
|
".js, .jsx, .ts, .tsx": {
|
||||||
"style": "module",
|
"style": "module",
|
||||||
|
|||||||
41
src/custom-components/SuspensefulImage.tsx
Normal file
41
src/custom-components/SuspensefulImage.tsx
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { Spinner } from '../deck-components';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
import { FC, ImgHTMLAttributes, useState } from 'react';
|
||||||
|
|
||||||
|
interface SuspensefulImageProps extends ImgHTMLAttributes<HTMLImageElement> {
|
||||||
|
suspenseWidth?: string | number;
|
||||||
|
suspenseHeight?: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SuspensefulImage: FC<SuspensefulImageProps> = (props) => {
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [error, setError] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const img = new Image();
|
||||||
|
img.src = props.src || '';
|
||||||
|
img.addEventListener('load', () => {
|
||||||
|
setLoading(false);
|
||||||
|
});
|
||||||
|
img.addEventListener('error', () => {
|
||||||
|
setError(true);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return loading ? (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: props.suspenseWidth || props.style?.width,
|
||||||
|
height: props.suspenseHeight || props.style?.height,
|
||||||
|
background: 'rgba(255, 255, 255, 0.2)',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{error ? 'Missing image' : <Spinner style={{ height: '48px' }} />}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<img {...props} />
|
||||||
|
);
|
||||||
|
};
|
||||||
1
src/custom-components/index.ts
Normal file
1
src/custom-components/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './SuspensefulImage';
|
||||||
22
src/deck-components/Field.tsx
Normal file
22
src/deck-components/Field.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { FC, HTMLAttributes, ReactNode, RefAttributes } from 'react';
|
||||||
|
import { findModuleChild } from '../webpack';
|
||||||
|
|
||||||
|
export interface FieldProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
|
label?: string | ReactNode;
|
||||||
|
description?: string | ReactNode;
|
||||||
|
disabled?: boolean;
|
||||||
|
icon?: ReactNode;
|
||||||
|
childrenLayout?: string;
|
||||||
|
childrenContainerWidth?: string;
|
||||||
|
padding?: string;
|
||||||
|
highlightOnFocus?: boolean;
|
||||||
|
indentLevel?: number;
|
||||||
|
verticalAlignment?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Field = findModuleChild((m) => {
|
||||||
|
if (typeof m !== "object") return undefined;
|
||||||
|
for (let prop in m) {
|
||||||
|
if (m[prop]?.render?.toString().includes('"shift-children-below"')) return m[prop]
|
||||||
|
}
|
||||||
|
}) as FC<FieldProps & RefAttributes<HTMLDivElement>>;
|
||||||
19
src/deck-components/Focusable.tsx
Normal file
19
src/deck-components/Focusable.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { HTMLAttributes, ReactNode, RefAttributes, VFC } from "react";
|
||||||
|
import { findModuleChild } from "../webpack";
|
||||||
|
|
||||||
|
export interface FocusableProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
|
children: ReactNode;
|
||||||
|
"flow-children"?: string;
|
||||||
|
focusClassName?: string;
|
||||||
|
focusWithinClassName?: string;
|
||||||
|
onActivate?: (e: CustomEvent) => void;
|
||||||
|
onCancel?: (e: CustomEvent) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Focusable = findModuleChild((m) => {
|
||||||
|
if (typeof m !== 'object') return undefined;
|
||||||
|
for (let prop in m) {
|
||||||
|
if (m[prop]?.render?.toString()?.includes('["flow-children","onActivate","onCancel","focusClassName",'))
|
||||||
|
return m[prop];
|
||||||
|
}
|
||||||
|
}) as VFC<FocusableProps & RefAttributes<HTMLDivElement>>;
|
||||||
@@ -16,7 +16,13 @@ export interface ModalRootProps {
|
|||||||
onMiddleButton?(): void;
|
onMiddleButton?(): void;
|
||||||
onCancel?(): void;
|
onCancel?(): void;
|
||||||
onOK?(): void;
|
onOK?(): void;
|
||||||
|
onEscKeypress?(): void;
|
||||||
|
className?: string;
|
||||||
|
modalClassName?: string;
|
||||||
bAllowFullSize?: boolean;
|
bAllowFullSize?: boolean;
|
||||||
|
bDestructiveWarning?: boolean;
|
||||||
|
bDisableBackgroundDismiss?: boolean;
|
||||||
|
bHideCloseIcon?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ModalRoot = findModuleChild((m) => {
|
export const ModalRoot = findModuleChild((m) => {
|
||||||
|
|||||||
@@ -1,18 +1,44 @@
|
|||||||
import { VFC } from 'react';
|
import { VFC, ReactNode } from 'react';
|
||||||
|
|
||||||
import { findModuleChild } from '../webpack';
|
import { findModuleChild } from '../webpack';
|
||||||
import { ItemProps } from './Item';
|
import { ItemProps } from './Item';
|
||||||
|
|
||||||
export interface ProgressBarItem extends ItemProps {
|
export interface ProgressBarItemProps extends ItemProps {
|
||||||
indeterminate?: boolean;
|
indeterminate?: boolean;
|
||||||
nTransitionSec?: number;
|
nTransitionSec?: number;
|
||||||
nProgress?: number;
|
nProgress?: number;
|
||||||
focusable?: boolean;
|
focusable?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProgressBarProps {
|
||||||
|
indeterminate?: boolean;
|
||||||
|
nTransitionSec?: number;
|
||||||
|
nProgress?: number;
|
||||||
|
focusable?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProgressBarWithInfoProps extends ProgressBarItemProps {
|
||||||
|
sTimeRemaining?: ReactNode;
|
||||||
|
sOperationText?: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ProgressBar = findModuleChild((m) => {
|
||||||
|
if (typeof m !== 'object') return undefined;
|
||||||
|
for (let prop in m) {
|
||||||
|
if (m[prop]?.toString()?.includes('.ProgressBar,"standard"==')) return m[prop];
|
||||||
|
}
|
||||||
|
}) as VFC<ProgressBarProps>;
|
||||||
|
|
||||||
|
export const ProgressBarWithInfo = findModuleChild((m) => {
|
||||||
|
if (typeof m !== 'object') return undefined;
|
||||||
|
for (let prop in m) {
|
||||||
|
if (m[prop]?.toString()?.includes('.ProgressBarFieldStatus},')) return m[prop];
|
||||||
|
}
|
||||||
|
}) as VFC<ProgressBarWithInfoProps>;
|
||||||
|
|
||||||
export const ProgressBarItem = findModuleChild((m) => {
|
export const ProgressBarItem = findModuleChild((m) => {
|
||||||
if (typeof m !== 'object') return undefined;
|
if (typeof m !== 'object') return undefined;
|
||||||
for (let prop in m) {
|
for (let prop in m) {
|
||||||
if (m[prop]?.toString()?.includes('"indeterminate","nTransitionSec"')) return m[prop];
|
if (m[prop]?.toString()?.includes('"indeterminate","nTransitionSec"')) return m[prop];
|
||||||
}
|
}
|
||||||
}) as VFC<ProgressBarItem>;
|
}) as VFC<ProgressBarItemProps>;
|
||||||
|
|||||||
@@ -17,18 +17,67 @@ export enum QuickAccessTab {
|
|||||||
Decky,
|
Decky,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum DisplayStatus {
|
||||||
|
Invalid = 0,
|
||||||
|
Launching = 1,
|
||||||
|
Uninstalling = 2,
|
||||||
|
Installing = 3,
|
||||||
|
Running = 4,
|
||||||
|
Validating = 5,
|
||||||
|
Updating = 6,
|
||||||
|
Downloading = 7,
|
||||||
|
Synchronizing = 8,
|
||||||
|
ReadyToInstall = 9,
|
||||||
|
ReadyToPreload = 10,
|
||||||
|
ReadyToLaunch = 11,
|
||||||
|
RegionRestricted = 12,
|
||||||
|
PresaleOnly = 13,
|
||||||
|
InvalidPlatform = 14,
|
||||||
|
PreloadComplete = 16,
|
||||||
|
BorrowerLocked = 17,
|
||||||
|
UpdatePaused = 18,
|
||||||
|
UpdateQueued = 19,
|
||||||
|
UpdateRequired = 20,
|
||||||
|
UpdateDisabled = 21,
|
||||||
|
DownloadPaused = 22,
|
||||||
|
DownloadQueued = 23,
|
||||||
|
DownloadRequired = 24,
|
||||||
|
DownloadDisabled = 25,
|
||||||
|
LicensePending = 26,
|
||||||
|
LicenseExpired = 27,
|
||||||
|
AvailForFree = 28,
|
||||||
|
AvailToBorrow = 29,
|
||||||
|
AvailGuestPass = 30,
|
||||||
|
Purchase = 31,
|
||||||
|
Unavailable = 32,
|
||||||
|
NotLaunchable = 33,
|
||||||
|
CloudError = 34,
|
||||||
|
CloudOutOfDate = 35,
|
||||||
|
Terminating = 36,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AppOverview = {
|
||||||
|
appid: string
|
||||||
|
display_name: string
|
||||||
|
display_status: DisplayStatus
|
||||||
|
sort_as: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface Router {
|
export interface Router {
|
||||||
CloseSideMenus(): void;
|
CloseSideMenus(): void;
|
||||||
OpenQuickAccessMenu(quickAccessTab: QuickAccessTab): void;
|
OpenQuickAccessMenu(quickAccessTab?: QuickAccessTab): void;
|
||||||
GetQuickAccessTab(): QuickAccessTab;
|
GetQuickAccessTab(): QuickAccessTab;
|
||||||
Navigate(path: string): void;
|
Navigate(path: string): void;
|
||||||
|
NavigateBackOrOpenMenu(): void;
|
||||||
NavigateToExternalWeb(url: string): void;
|
NavigateToExternalWeb(url: string): void;
|
||||||
|
NavigateToRunningApp(replace?: boolean): void;
|
||||||
NavigateToStore(): void;
|
NavigateToStore(): void;
|
||||||
ToggleSideMenu(sideMenu: SideMenu): void;
|
ToggleSideMenu(sideMenu: SideMenu): void;
|
||||||
CloseSideMenus(): void;
|
CloseSideMenus(): void;
|
||||||
OpenSideMenu(sideMenu: SideMenu): void;
|
OpenSideMenu(sideMenu: SideMenu): void;
|
||||||
OpenPowerMenu(unknown?: any): void;
|
OpenPowerMenu(unknown?: any): void;
|
||||||
get RunningApps(): any;
|
get RunningApps(): any;
|
||||||
|
get MainRunningApp(): AppOverview | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Router = findModuleChild((m: Module) => {
|
export const Router = findModuleChild((m: Module) => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export interface NotchLabel {
|
|||||||
value?: number;
|
value?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SliderProps extends ItemProps {
|
export interface SliderFieldProps extends ItemProps {
|
||||||
value: number;
|
value: number;
|
||||||
min?: number;
|
min?: number;
|
||||||
max?: number;
|
max?: number;
|
||||||
@@ -27,6 +27,6 @@ export interface SliderProps extends ItemProps {
|
|||||||
onChange?(value: number): void;
|
onChange?(value: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Slider = Object.values(CommonUIModule).find((mod: any) =>
|
export const SliderField = Object.values(CommonUIModule).find((mod: any) =>
|
||||||
mod?.toString()?.includes('SliderField,fallback'),
|
mod?.toString()?.includes('SliderField,fallback'),
|
||||||
) as FC<SliderProps>;
|
) as FC<SliderFieldProps>;
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { FC } from 'react';
|
import { FC } from 'react';
|
||||||
|
|
||||||
import { CommonUIModule } from '../webpack';
|
import { CommonUIModule } from '../webpack';
|
||||||
import { ItemProps } from './Item';
|
|
||||||
|
|
||||||
export interface ToggleProps extends ItemProps {
|
export interface ToggleProps {
|
||||||
checked: boolean;
|
value: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onChange?(checked: boolean): void;
|
onChange?(checked: boolean): void;
|
||||||
|
navRef?: any; // TODO figure out what this is
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Toggle = Object.values(CommonUIModule).find((mod: any) =>
|
export const Toggle = Object.values(CommonUIModule).find((mod: any) =>
|
||||||
mod?.render?.toString()?.includes('ToggleField,fallback'),
|
mod?.render?.toString()?.includes('.ToggleOff)'),
|
||||||
) as FC<ToggleProps>;
|
) as FC<ToggleProps>;
|
||||||
|
|||||||
14
src/deck-components/ToggleField.tsx
Normal file
14
src/deck-components/ToggleField.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { FC } from 'react';
|
||||||
|
|
||||||
|
import { CommonUIModule } from '../webpack';
|
||||||
|
import { ItemProps } from './Item';
|
||||||
|
|
||||||
|
export interface ToggleFieldProps extends ItemProps {
|
||||||
|
checked: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
onChange?(checked: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ToggleField = Object.values(CommonUIModule).find((mod: any) =>
|
||||||
|
mod?.render?.toString()?.includes('ToggleField,fallback'),
|
||||||
|
) as FC<ToggleFieldProps>;
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
export * from './Button';
|
export * from './Button';
|
||||||
export * from './ButtonItem';
|
export * from './ButtonItem';
|
||||||
export * from './Dropdown';
|
export * from './Dropdown';
|
||||||
|
export * from './Field';
|
||||||
|
export * from './Focusable';
|
||||||
export * from './Menu';
|
export * from './Menu';
|
||||||
export * from './Modal';
|
export * from './Modal';
|
||||||
export * from './Panel';
|
export * from './Panel';
|
||||||
export * from './ProgressBar';
|
export * from './ProgressBar';
|
||||||
export * from './Router';
|
export * from './Router';
|
||||||
export * from './SidebarNavigation';
|
export * from './SidebarNavigation';
|
||||||
export * from './Slider';
|
export * from './SliderField';
|
||||||
export * from './Spinner';
|
export * from './Spinner';
|
||||||
export * from './static-classes';
|
export * from './static-classes';
|
||||||
export * from './SteamSpinner';
|
export * from './SteamSpinner';
|
||||||
export * from './TextField';
|
export * from './TextField';
|
||||||
export * from './Toggle';
|
export * from './Toggle';
|
||||||
|
export * from './ToggleField';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// export * from './deck-libs';
|
// export * from './deck-libs';
|
||||||
|
export * from './custom-components';
|
||||||
export * from './deck-components';
|
export * from './deck-components';
|
||||||
export * from './plugin';
|
export * from './plugin';
|
||||||
export * from './webpack';
|
export * from './webpack';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { RouteProps } from 'react-router';
|
|||||||
export interface Plugin {
|
export interface Plugin {
|
||||||
title: JSX.Element;
|
title: JSX.Element;
|
||||||
icon: JSX.Element;
|
icon: JSX.Element;
|
||||||
content: JSX.Element;
|
content?: JSX.Element;
|
||||||
onDismount?(): void;
|
onDismount?(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,8 +29,9 @@ export interface ServerAPI {
|
|||||||
routerHook: RouterHook;
|
routerHook: RouterHook;
|
||||||
callPluginMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
|
callPluginMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
|
||||||
callServerMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
|
callServerMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
|
||||||
fetchNoCors<TRes = {}>(url: string, request: RequestInfo): Promise<ServerResponse<TRes>>;
|
fetchNoCors<TRes = {}>(url: RequestInfo, request?: RequestInit): Promise<ServerResponse<TRes>>;
|
||||||
executeInTab(tab: string, runAsync: boolean, code: string): Promise<unknown>;
|
executeInTab(tab: string, runAsync: boolean, code: string): Promise<unknown>;
|
||||||
|
injectCssIntoTab<TRes = string>(tab: string, style: string): Promise<ServerResponse<TRes>>;
|
||||||
removeCssFromTab(tab: string, cssId: string): Promise<unknown>;
|
removeCssFromTab(tab: string, cssId: string): Promise<unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
src/utils.ts
10
src/utils.ts
@@ -42,7 +42,7 @@ export function fakeRenderComponent(fun: Function): any {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function beforePatch(obj: any, name: string, fnc: Function): void {
|
export function beforePatch(obj: any, name: string, fnc: (args: any[]) => any): void {
|
||||||
const orig = obj[name];
|
const orig = obj[name];
|
||||||
obj[name] = function (...args: any[]) {
|
obj[name] = function (...args: any[]) {
|
||||||
fnc.call(this, args);
|
fnc.call(this, args);
|
||||||
@@ -53,7 +53,7 @@ export function beforePatch(obj: any, name: string, fnc: Function): void {
|
|||||||
obj[name].__deckyOrig = orig;
|
obj[name].__deckyOrig = orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function afterPatch(obj: any, name: string, fnc: Function): void {
|
export function afterPatch(obj: any, name: string, fnc: (args: any[], ret: any) => any): void {
|
||||||
const orig = obj[name];
|
const orig = obj[name];
|
||||||
obj[name] = function (...args: any[]) {
|
obj[name] = function (...args: any[]) {
|
||||||
let ret = orig.call(this, ...args);
|
let ret = orig.call(this, ...args);
|
||||||
@@ -65,7 +65,7 @@ export function afterPatch(obj: any, name: string, fnc: Function): void {
|
|||||||
obj[name].__deckyOrig = orig;
|
obj[name].__deckyOrig = orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function replacePatch(obj: any, name: string, fnc: Function): void {
|
export function replacePatch(obj: any, name: string, fnc: (args: any[]) => any): void {
|
||||||
const orig = obj[name];
|
const orig = obj[name];
|
||||||
obj[name] = function (...args: any[]) {
|
obj[name] = function (...args: any[]) {
|
||||||
const ret = fnc.call(this, args);
|
const ret = fnc.call(this, args);
|
||||||
@@ -88,4 +88,8 @@ export function getReactInstance(o: HTMLElement | Element | Node) {
|
|||||||
|
|
||||||
export function joinClassNames(...classes: string[]): string {
|
export function joinClassNames(...classes: string[]): string {
|
||||||
return classes.join(" ");
|
return classes.join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sleep(ms: number) {
|
||||||
|
return new Promise(res => setTimeout(res, ms));
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user