mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-23 19:38:50 +02:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88b50bbc1e | ||
|
|
75f35882f2 | ||
|
|
23af4c0bb4 | ||
|
|
a074277bb5 | ||
|
|
fb49d64fd3 | ||
|
|
cfef1dc320 | ||
|
|
f6b4d6b254 | ||
|
|
0010a1fcee | ||
|
|
28cbc1cfe1 | ||
|
|
fe75dfb5f4 |
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,3 +1,38 @@
|
|||||||
|
## [3.7.10](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.9...v3.7.10) (2022-10-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **tabs:** shut up typescript ([75f3588](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/75f35882f27252e1255208953a6e801c68d5dcec))
|
||||||
|
|
||||||
|
## [3.7.9](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.8...v3.7.9) (2022-10-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **tabs:** fix on stable for real this time i think ([a074277](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/a074277bb58428a64295154ebf96aceb96e654a7))
|
||||||
|
|
||||||
|
## [3.7.8](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.7...v3.7.8) (2022-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Field:** fix this time for real ([#44](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/44)) ([cfef1dc](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/cfef1dc320a5f649d66c3af365cd6aa2d88e46ea))
|
||||||
|
|
||||||
|
## [3.7.7](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.6...v3.7.7) (2022-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Field:** remove incompatible properties ([#42](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/42)) ([0010a1f](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/0010a1fceedc417aa25b709d066341da97d42444))
|
||||||
|
|
||||||
|
## [3.7.6](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.5...v3.7.6) (2022-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Field:** add override for onClick type ([#43](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/43)) ([fe75dfb](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/fe75dfb5f4fb1ec9417cc07dc714c71820945748))
|
||||||
|
|
||||||
## [3.7.5](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.4...v3.7.5) (2022-10-26)
|
## [3.7.5](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.7.4...v3.7.5) (2022-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "decky-frontend-lib",
|
"name": "decky-frontend-lib",
|
||||||
"version": "3.7.5",
|
"version": "3.7.10",
|
||||||
"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,9 +1,9 @@
|
|||||||
import { FC, HTMLAttributes, ReactNode, RefAttributes } from 'react';
|
import { FC, ReactNode, RefAttributes } from 'react';
|
||||||
|
|
||||||
import { findModuleChild } from '../webpack';
|
import { findModuleChild } from '../webpack';
|
||||||
import { FooterLegendProps } from './FooterLegend';
|
import { FooterLegendProps } from './FooterLegend';
|
||||||
|
|
||||||
export interface FieldProps extends HTMLAttributes<HTMLDivElement>, FooterLegendProps {
|
export interface FieldProps extends FooterLegendProps {
|
||||||
label?: ReactNode;
|
label?: ReactNode;
|
||||||
bottomSeparator?: 'standard' | 'thick' | 'none';
|
bottomSeparator?: 'standard' | 'thick' | 'none';
|
||||||
description?: ReactNode;
|
description?: ReactNode;
|
||||||
|
|||||||
@@ -65,16 +65,11 @@ export interface TabsProps {
|
|||||||
autoFocusContents?: boolean;
|
autoFocusContents?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
|
||||||
interface Window {
|
|
||||||
DeckyPluginLoader: any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let tabsComponent: any;
|
let tabsComponent: any;
|
||||||
|
|
||||||
const getTabs = async () => {
|
const getTabs = async () => {
|
||||||
if (tabsComponent) return tabsComponent;
|
if (tabsComponent) return tabsComponent;
|
||||||
|
// @ts-ignore
|
||||||
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);
|
||||||
@@ -83,6 +78,7 @@ const getTabs = async () => {
|
|||||||
() => {
|
() => {
|
||||||
return findInReactTree(
|
return findInReactTree(
|
||||||
findInReactTree(
|
findInReactTree(
|
||||||
|
// @ts-ignore
|
||||||
window.DeckyPluginLoader.routerHook.routes
|
window.DeckyPluginLoader.routerHook.routes
|
||||||
.find((x: any) => x.props.path == '/library/app/:appid/achievements')
|
.find((x: any) => x.props.path == '/library/app/:appid/achievements')
|
||||||
.props.children.type(),
|
.props.children.type(),
|
||||||
@@ -109,27 +105,30 @@ try {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
if (oldTabsModule) oldTabs = Object.values(oldTabsModule).find((x: any) => x?.type?.toString()?.includes("((function(") && x?.type?.toString()?.includes("[\"tabs\""));
|
if (oldTabsModule)
|
||||||
|
oldTabs = Object.values(oldTabsModule).find((x: any) => x?.type?.toString()?.includes('((function(){'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Error finding oldTabs:", e)
|
console.error('Error finding oldTabs:', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 = oldTabs || ((props: TabsProps) => {
|
export const Tabs =
|
||||||
const found = tabsComponent;
|
oldTabs ||
|
||||||
const [tc, setTC] = useState<FC<TabsProps>>(found);
|
(((props: TabsProps) => {
|
||||||
useEffect(() => {
|
const found = tabsComponent;
|
||||||
if (found) return;
|
const [tc, setTC] = useState<FC<TabsProps>>(found);
|
||||||
(async () => {
|
useEffect(() => {
|
||||||
console.debug('[DFL:Tabs]: Finding component...');
|
if (found) return;
|
||||||
const t = await getTabs();
|
(async () => {
|
||||||
console.debug('[DFL:Tabs]: Found!');
|
console.debug('[DFL:Tabs]: Finding component...');
|
||||||
setTC(t);
|
const t = await getTabs();
|
||||||
})();
|
console.debug('[DFL:Tabs]: Found!');
|
||||||
}, []);
|
setTC(t);
|
||||||
console.log('tc', tc);
|
})();
|
||||||
return tc ? createElement(tc, props) : <SteamSpinner />;
|
}, []);
|
||||||
}) as FC<TabsProps>;
|
console.log('tc', tc);
|
||||||
|
return tc ? createElement(tc, props) : <SteamSpinner />;
|
||||||
|
}) as FC<TabsProps>);
|
||||||
|
|||||||
Reference in New Issue
Block a user