mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-21 18:38:47 +02:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f101e23c1c | ||
|
|
5b3ea8f63f | ||
|
|
07ccceb990 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.6",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.6",
|
||||
"description": "A library for building decky plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
11
src/deck-components/Menu.tsx
Normal file → Executable file
11
src/deck-components/Menu.tsx
Normal file → Executable file
@@ -1,7 +1,16 @@
|
||||
import { FC } from 'react';
|
||||
import { FC, ReactNode } from 'react';
|
||||
|
||||
import { findModuleChild } from '../webpack';
|
||||
|
||||
export const showContextMenu: (children: ReactNode, parent?: EventTarget) => void = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (typeof m[prop] === 'function' && m[prop].toString().includes('stopPropagation))')) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
interface MenuProps {
|
||||
label: string;
|
||||
onCancel?(): void;
|
||||
|
||||
24
src/deck-components/Modal.tsx
Normal file → Executable file
24
src/deck-components/Modal.tsx
Normal file → Executable file
@@ -1,12 +1,28 @@
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { findModuleChild } from '../webpack';
|
||||
|
||||
export const showModal: (children: ReactNode, parent: EventTarget) => void = findModuleChild((m) => {
|
||||
// TODO: there is another argument, figure out what it does
|
||||
export const showModal: (children: ReactNode, parent?: EventTarget) => void = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (typeof m[prop] === 'function' && m[prop].toString().includes('stopPropagation))')) {
|
||||
if (typeof m[prop] === 'function' && m[prop].toString().includes('bHideMainWindowForPopouts:!0')) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
interface ModalRootProps {
|
||||
onMiddleButton?(): void,
|
||||
onCancel?(): void;
|
||||
onOK?(): void;
|
||||
bAllowFullSize?: boolean;
|
||||
}
|
||||
|
||||
export const ModalRoot = findModuleChild(m => {
|
||||
if (typeof m !== "object") return undefined;
|
||||
for (let prop in m) {
|
||||
if (!m[prop]?.prototype?.OK && m[prop]?.prototype?.Cancel && m[prop]?.prototype?.render) {
|
||||
return m[prop];
|
||||
}
|
||||
}
|
||||
}) as FC<ModalRootProps>;
|
||||
10
src/deck-components/Spinner.tsx
Normal file → Executable file
10
src/deck-components/Spinner.tsx
Normal file → Executable file
@@ -2,15 +2,7 @@ import { FC } from 'react';
|
||||
|
||||
import { IconsModule } from '../webpack';
|
||||
|
||||
// interface ButtonProps {
|
||||
// label?: string;
|
||||
// description?: string;
|
||||
// layout?: 'below';
|
||||
// onClick?(e: MouseEvent): void;
|
||||
// disabled?: boolean;
|
||||
// bottomSeparator?: boolean;
|
||||
// }
|
||||
|
||||
// TODO type this and other icons?
|
||||
export const Spinner = Object.values(IconsModule).find((mod: any) =>
|
||||
mod?.toString && /Spinner\)}\),.\.createElement\(\"path\",{d:\"M18 /.test(mod.toString())
|
||||
) as FC<{}>;
|
||||
9
src/deck-components/SteamSpinner.tsx
Executable file
9
src/deck-components/SteamSpinner.tsx
Executable file
@@ -0,0 +1,9 @@
|
||||
import { FC } from 'react';
|
||||
import { findModuleChild } from '../webpack';
|
||||
|
||||
export const SteamSpinner = findModuleChild((m) => {
|
||||
if (typeof m !== "object") return undefined;
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.toString()?.includes("Steam Spinner") && m[prop].toString().includes("PreloadThrobber")) return m[prop]
|
||||
}
|
||||
}) as FC<{}>;
|
||||
1
src/deck-components/index.ts
Normal file → Executable file
1
src/deck-components/index.ts
Normal file → Executable file
@@ -4,6 +4,7 @@ export * from './Menu';
|
||||
export * from './Modal';
|
||||
export * from './Panel';
|
||||
export * from './Slider';
|
||||
export * from './SteamSpinner';
|
||||
export * from './Spinner';
|
||||
export * from './static-classes';
|
||||
export * from './Toggle';
|
||||
|
||||
Reference in New Issue
Block a user