mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-24 03:48:48 +02:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52305987c5 | ||
|
|
6f14da152a | ||
|
|
bb291b211c | ||
|
|
88f245d476 | ||
|
|
5bc78df918 | ||
|
|
c586afb97d | ||
|
|
d9150c2556 | ||
|
|
cd0635e94f |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,3 +1,31 @@
|
|||||||
|
## [3.18.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.18.0...v3.18.1) (2022-12-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **findSP:** fallback to last active context ([#53](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/53)) ([6f14da1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/6f14da152acc4757b814844f1b77bf83dd98d77e))
|
||||||
|
|
||||||
|
# [3.18.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.17.0...v3.18.0) (2022-12-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **DialogCheckbox:** Add DialogCheckbox component ([#58](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/58)) ([88f245d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/88f245d476a6477e9fc0cd35e9b675961ecbc26c))
|
||||||
|
|
||||||
|
# [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)
|
## [3.16.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.16.0...v3.16.1) (2022-12-11)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "decky-frontend-lib",
|
"name": "decky-frontend-lib",
|
||||||
"version": "3.16.1",
|
"version": "3.18.1",
|
||||||
"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",
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ declare global {
|
|||||||
|
|
||||||
function getQuickAccessWindow(): Window | null {
|
function getQuickAccessWindow(): Window | null {
|
||||||
try {
|
try {
|
||||||
const navTrees = FocusNavController?.m_ActiveContext?.m_rgGamepadNavigationTrees || FocusNavController?.m_rgGamepadNavigationTrees;
|
const context = FocusNavController?.m_ActiveContext || FocusNavController?.m_LastActiveContext;
|
||||||
|
const navTrees = context?.m_ActiveContext?.m_rgGamepadNavigationTrees || FocusNavController?.m_rgGamepadNavigationTrees;
|
||||||
return navTrees?.find((tree: any) => tree?.id === "QuickAccess-NA")?.m_Root?.m_element?.ownerDocument.defaultView ?? null;
|
return navTrees?.find((tree: any) => tree?.id === "QuickAccess-NA")?.m_Root?.m_element?.ownerDocument.defaultView ?? null;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
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;
|
||||||
|
});
|
||||||
33
src/deck-components/DialogCheckbox.tsx
Normal file
33
src/deck-components/DialogCheckbox.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { FC, ReactNode } from 'react';
|
||||||
|
|
||||||
|
import { findModule } from '../webpack';
|
||||||
|
import { DialogCommonProps } from './Dialog';
|
||||||
|
import { FooterLegendProps } from './FooterLegend';
|
||||||
|
|
||||||
|
export interface DialogCheckboxProps extends DialogCommonProps, FooterLegendProps {
|
||||||
|
onChange?(checked: boolean): void;
|
||||||
|
label?: ReactNode;
|
||||||
|
description?: ReactNode;
|
||||||
|
disabled?: boolean;
|
||||||
|
tooltip?: string;
|
||||||
|
color?: string;
|
||||||
|
highlightColor?: string;
|
||||||
|
bottomSeparator?: 'standard' | 'thick' | 'none';
|
||||||
|
controlled?: boolean;
|
||||||
|
checked?: boolean;
|
||||||
|
onClick?(evt: Event): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DialogCheckbox = Object.values(findModule((m: any) => {
|
||||||
|
if (typeof m !== 'object') return false;
|
||||||
|
for (const prop in m) {
|
||||||
|
if (m[prop]?.prototype?.GetPanelElementProps) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})).find((m: any) =>
|
||||||
|
m.contextType &&
|
||||||
|
m.prototype?.render.toString().includes('fallback:') &&
|
||||||
|
m?.prototype?.SetChecked &&
|
||||||
|
m?.prototype?.Toggle &&
|
||||||
|
m?.prototype?.GetPanelElementProps
|
||||||
|
) as FC<DialogCheckboxProps>;
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { FC, CSSProperties } from 'react';
|
import { CSSProperties, FC } from 'react';
|
||||||
|
|
||||||
import { findModuleChild } from '../webpack';
|
import { findModuleChild } from '../webpack';
|
||||||
|
|
||||||
export interface MarqueeProps {
|
export interface MarqueeProps {
|
||||||
@@ -14,7 +15,7 @@ export interface MarqueeProps {
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Marquee: FC<MarqueeProps> = findModuleChild((m) => {
|
export const Marquee: FC<MarqueeProps> = findModuleChild((m) => {
|
||||||
if (typeof m !== 'object') return;
|
if (typeof m !== 'object') return;
|
||||||
for (const prop in m) {
|
for (const prop in m) {
|
||||||
if (m[prop]?.toString && m[prop].toString().includes('.Marquee') && m[prop].toString().includes('--fade-length')) {
|
if (m[prop]?.toString && m[prop].toString().includes('.Marquee') && m[prop].toString().includes('--fade-length')) {
|
||||||
@@ -23,5 +24,3 @@ const Marquee: FC<MarqueeProps> = findModuleChild((m) => {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Marquee;
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
export * from './Button';
|
export * from './Button';
|
||||||
export * from './ButtonItem';
|
export * from './ButtonItem';
|
||||||
export * from './Carousel';
|
export * from './Carousel';
|
||||||
|
export * from './ControlsList';
|
||||||
export * from './Dialog';
|
export * from './Dialog';
|
||||||
|
export * from './DialogCheckbox';
|
||||||
export * from './Dropdown';
|
export * from './Dropdown';
|
||||||
export * from './Field';
|
export * from './Field';
|
||||||
export * from './Focusable';
|
export * from './Focusable';
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export function findSP(): Window {
|
|||||||
// old (SP as host)
|
// old (SP as host)
|
||||||
if (document.title == 'SP') return window;
|
if (document.title == 'SP') return window;
|
||||||
// new (SP as popup)
|
// new (SP as popup)
|
||||||
return FocusNavController.m_ActiveContext.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
|
const context = FocusNavController.m_ActiveContext || FocusNavController.m_LastActiveContext;
|
||||||
|
return context.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
|
||||||
.Element.ownerDocument.defaultView;
|
.Element.ownerDocument.defaultView;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user