mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-24 11:58:48 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cdcca0b5a | ||
|
|
f16e0b29f8 | ||
|
|
37a6658b95 | ||
|
|
ed0b92de2e | ||
|
|
dcba5c22f8 |
5
.github/workflows/docs.yaml
vendored
5
.github/workflows/docs.yaml
vendored
@@ -29,12 +29,13 @@ jobs:
|
|||||||
- name: Setup | Dependencies
|
- name: Setup | Dependencies
|
||||||
run: |
|
run: |
|
||||||
cd lib
|
cd lib
|
||||||
npm ci
|
npm i -g pnpm
|
||||||
|
pnpm i --frozen-lockfile
|
||||||
|
|
||||||
- name: Build Docs
|
- name: Build Docs
|
||||||
run: |
|
run: |
|
||||||
cd lib
|
cd lib
|
||||||
npm run docs -- --out ../wiki/api-docs/decky-frontend-lib
|
pnpm run docs --out ../wiki/api-docs/decky-frontend-lib
|
||||||
|
|
||||||
- name: Commit files
|
- name: Commit files
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
## [3.7.4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.3...v3.7.4) (2022-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **docs:** change arg format ([ed0b92d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/ed0b92de2ec13a585f6524b45eef0ab538d87448))
|
||||||
|
* **tabs:** fix on stable ([f16e0b2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/f16e0b29f8e1de500e8f436db659d1ad99d4eaa6))
|
||||||
|
|
||||||
## [3.7.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.2...v3.7.3) (2022-10-25)
|
## [3.7.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.2...v3.7.3) (2022-10-25)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "decky-frontend-lib",
|
"name": "decky-frontend-lib",
|
||||||
"version": "3.7.3",
|
"version": "3.7.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { createElement, FC, ReactNode, useEffect, useState } from 'react';
|
import { FC, ReactNode, createElement, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { fakeRenderComponent, findInReactTree, sleep } from '../utils';
|
import { fakeRenderComponent, findInReactTree, sleep } from '../utils';
|
||||||
|
import { findModule } from '../webpack';
|
||||||
import { FooterLegendProps } from './FooterLegend';
|
import { FooterLegendProps } from './FooterLegend';
|
||||||
import { SteamSpinner } from './SteamSpinner';
|
import { SteamSpinner } from './SteamSpinner';
|
||||||
|
|
||||||
@@ -73,47 +74,62 @@ declare global {
|
|||||||
let tabsComponent: any;
|
let tabsComponent: any;
|
||||||
|
|
||||||
const getTabs = async () => {
|
const getTabs = async () => {
|
||||||
if (tabsComponent) return tabsComponent
|
if (tabsComponent) return tabsComponent;
|
||||||
while (!window?.DeckyPluginLoader?.routerHook?.routes) {
|
while (!window?.DeckyPluginLoader?.routerHook?.routes) {
|
||||||
console.debug("[DFL:Tabs]: Waiting for Decky router...")
|
console.debug('[DFL:Tabs]: Waiting for Decky router...');
|
||||||
await sleep(500);
|
await sleep(500);
|
||||||
|
}
|
||||||
|
return (tabsComponent = fakeRenderComponent(
|
||||||
|
() => {
|
||||||
|
return findInReactTree(
|
||||||
|
findInReactTree(
|
||||||
|
window.DeckyPluginLoader.routerHook.routes
|
||||||
|
.find((x: any) => x.props.path == '/library/app/:appid/achievements')
|
||||||
|
.props.children.type(),
|
||||||
|
(x) => x?.props?.scrollTabsTop,
|
||||||
|
).type({ appid: 1 }),
|
||||||
|
(x) => x?.props?.tabs,
|
||||||
|
).type;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
useRef: () => ({ current: { reaction: { track: () => {} } } }),
|
||||||
|
useContext: () => ({ match: { params: { appid: 1 } } }),
|
||||||
|
useMemo: () => ({ data: {} }),
|
||||||
|
},
|
||||||
|
));
|
||||||
|
};
|
||||||
|
|
||||||
|
let oldTabs: any;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const oldTabsModule = findModule((m: any) => {
|
||||||
|
if (typeof m !== 'object') return false;
|
||||||
|
for (let prop in m) {
|
||||||
|
if (m[prop]?.Unbleed) return true;
|
||||||
}
|
}
|
||||||
return tabsComponent = fakeRenderComponent(
|
return false;
|
||||||
() => {
|
});
|
||||||
return findInReactTree(
|
if (oldTabsModule) oldTabs = Object.values(oldTabsModule).find((x: any) => x?.type?.toString()?.includes("((function(") && x?.type?.toString()?.includes("[\"tabs\""));
|
||||||
findInReactTree(
|
} catch (e) {
|
||||||
window.DeckyPluginLoader.routerHook.routes
|
console.error("Error finding oldTabs:", e)
|
||||||
.find((x: any) => x.props.path == '/library/app/:appid/achievements')
|
|
||||||
.props.children.type(),
|
|
||||||
(x) => x?.props?.scrollTabsTop,
|
|
||||||
).type({ appid: 1 }),
|
|
||||||
(x) => x?.props?.tabs,
|
|
||||||
).type;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
useRef: () => ({ current: { reaction: { track: () => {} } } }),
|
|
||||||
useContext: () => ({ match: { params: { appid: 1 } } }),
|
|
||||||
useMemo: () => ({ data: {} }),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tabs component as used in the library and media tabs. See {@link TabsProps}
|
* 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.
|
* Unlike other components in `decky-frontend-lib`, this requires Decky Loader to be running.
|
||||||
*/
|
*/
|
||||||
export const Tabs = ((props: TabsProps) => {
|
export const Tabs = oldTabs || ((props: TabsProps) => {
|
||||||
const found = tabsComponent;
|
const found = tabsComponent;
|
||||||
const [tc, setTC] = useState<FC<TabsProps>>(found);
|
const [tc, setTC] = useState<FC<TabsProps>>(found);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (found) return;
|
if (found) return;
|
||||||
(async()=> {
|
(async () => {
|
||||||
console.debug("[DFL:Tabs]: Finding component...")
|
console.debug('[DFL:Tabs]: Finding component...');
|
||||||
const t = await getTabs();
|
const t = await getTabs();
|
||||||
console.debug("[DFL:Tabs]: Found!")
|
console.debug('[DFL:Tabs]: Found!');
|
||||||
setTC(t);
|
setTC(t);
|
||||||
})();
|
})();
|
||||||
}, [])
|
}, []);
|
||||||
console.log("tc", tc);
|
console.log('tc', tc);
|
||||||
return tc ? createElement(tc, props) : <SteamSpinner/>;
|
return tc ? createElement(tc, props) : <SteamSpinner />;
|
||||||
}) as FC<TabsProps>;
|
}) as FC<TabsProps>;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function sleep(ms: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the SP window, since it is a render target as of {10-19-2022}'s beta
|
* Finds the SP window, since it is a render target as of 10-19-2022's beta
|
||||||
*/
|
*/
|
||||||
export function findSP(): Window {
|
export function findSP(): Window {
|
||||||
// old (SP as host)
|
// old (SP as host)
|
||||||
|
|||||||
Reference in New Issue
Block a user