mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-21 02:19:12 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00d27d1373 | ||
|
|
5f0470c351 | ||
|
|
c77d6edaae | ||
|
|
c44c66facd | ||
|
|
276e4eccd2 | ||
|
|
2fc2060a6c |
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,3 +1,24 @@
|
||||
# [3.7.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.6.1...v3.7.0) (2022-10-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **modal:** support for latest steamos preview ([5f0470c](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/5f0470c351dc4ecb24ea3e928ff0b0199c399fa4))
|
||||
|
||||
## [3.6.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.6.0...v3.6.1) (2022-10-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **plugin:** export RoutePatch ([#39](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/39)) ([c44c66f](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/c44c66facd4e158aa4fe0a69f62a2ca3add805c1))
|
||||
|
||||
# [3.6.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.5.6...v3.6.0) (2022-10-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **plugin:** add alwaysRender ([2fc2060](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/2fc2060a6c0d9414d1c36a1a022fdc6f2cd7f8bb))
|
||||
|
||||
## [3.5.6](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.5.5...v3.5.6) (2022-10-08)
|
||||
|
||||
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "3.5.6",
|
||||
"version": "3.7.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "3.5.6",
|
||||
"version": "3.7.0",
|
||||
"license": "LGPL-2.1",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.6"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "3.5.6",
|
||||
"version": "3.7.0",
|
||||
"description": "A library for building decky plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { findSP } from '../utils';
|
||||
import { findModuleChild } from '../webpack';
|
||||
|
||||
// All of the popout options + strTitle are related. Proper usage is not yet known...
|
||||
@@ -27,7 +28,7 @@ export interface ShowModalResult {
|
||||
Update: (modal: ReactNode) => void;
|
||||
}
|
||||
|
||||
export const showModal: (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps) => Promise<ShowModalResult> = findModuleChild((m) => {
|
||||
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')) {
|
||||
@@ -36,6 +37,10 @@ export const showModal: (modal: ReactNode, parent?: EventTarget, props?: ShowMod
|
||||
}
|
||||
});
|
||||
|
||||
export const showModal = (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps): Promise<ShowModalResult> => {
|
||||
return showModalRaw(modal, parent || findSP(), props)
|
||||
}
|
||||
|
||||
export interface ModalRootProps {
|
||||
children?: ReactNode;
|
||||
onCancel?(): void;
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface Plugin {
|
||||
icon: JSX.Element;
|
||||
content?: JSX.Element;
|
||||
onDismount?(): void;
|
||||
alwaysRender?: boolean;
|
||||
}
|
||||
|
||||
interface ServerResponseSuccess<TRes> {
|
||||
@@ -20,7 +21,7 @@ interface ServerResponseError {
|
||||
|
||||
export type ServerResponse<TRes> = ServerResponseSuccess<TRes> | ServerResponseError;
|
||||
|
||||
type RoutePatch = (route: RouteProps) => RouteProps;
|
||||
export type RoutePatch = (route: RouteProps) => RouteProps;
|
||||
|
||||
export interface RouterHook {
|
||||
addRoute(path: string, component: ComponentType, props?: Omit<RouteProps, 'path' | 'children'>): void;
|
||||
@@ -37,8 +38,8 @@ export interface ToastData {
|
||||
icon?: ReactNode;
|
||||
className?: string;
|
||||
contentClassName?: string;
|
||||
duration?: number
|
||||
critical?: boolean
|
||||
duration?: number;
|
||||
critical?: boolean;
|
||||
}
|
||||
|
||||
export interface Toaster {
|
||||
|
||||
@@ -7,4 +7,16 @@ export function joinClassNames(...classes: string[]): string {
|
||||
|
||||
export function sleep(ms: number) {
|
||||
return new Promise(res => setTimeout(res, ms));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the SP window, since it is a render target as of {10-19-2022}'s beta
|
||||
*/
|
||||
export function findSP(): Window {
|
||||
// old (SP as host)
|
||||
if (document.title == 'SP') return window;
|
||||
// new (SP as popup)
|
||||
return FocusNavController.m_ActiveContext.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
|
||||
.Element.ownerDocument.defaultView;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user