mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-19 09:30:08 +02:00
export more stuff, replace button component with actual button and move the old one to ButtonItem
This commit is contained in:
@@ -3,14 +3,25 @@ import { FC } from 'react';
|
||||
import { CommonUIModule } from '../webpack';
|
||||
|
||||
interface ButtonProps {
|
||||
label?: string;
|
||||
description?: string;
|
||||
layout?: 'below';
|
||||
onClick?(e: MouseEvent): void;
|
||||
className?: string;
|
||||
noFocusRing?: boolean;
|
||||
disabled?: boolean;
|
||||
bottomSeparator?: boolean;
|
||||
onClick?(e: MouseEvent): void;
|
||||
onPointerDown?(e: PointerEvent): void;
|
||||
onPointerUp?(e: PointerEvent): void;
|
||||
onPointerCancel?(e: PointerEvent): void;
|
||||
onMouseDown?(e: PointerEvent): void;
|
||||
onMouseUp?(e: MouseEvent): void;
|
||||
onTouchStart?(e: TouchEvent): void;
|
||||
onTouchEnd?(e: TouchEvent): void;
|
||||
onTouchCancel?(e: TouchEvent): void;
|
||||
onSubmit?(e: SubmitEvent): void;
|
||||
}
|
||||
|
||||
export const Button = Object.values(CommonUIModule).find((mod: any) =>
|
||||
mod?.render?.toString()?.includes('childrenContainerWidth:"min"'),
|
||||
) as FC<ButtonProps>;
|
||||
const DialogButton = Object.values(CommonUIModule).find((mod: any) =>
|
||||
mod?.render?.toString()?.includes('Object.assign({type:"button"') && mod?.render?.toString()?.includes('DialogButton')
|
||||
) as any;
|
||||
|
||||
// Button isn't exported, so call DialogButton to grab it
|
||||
|
||||
export const Button = DialogButton!.render({}).type as FC<ButtonProps> // its actually a forwarded ref but that doesn't really matter in usage
|
||||
16
src/deck-components/ButtonItem.tsx
Normal file
16
src/deck-components/ButtonItem.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
import { CommonUIModule } from '../webpack';
|
||||
|
||||
interface ButtonItemProps {
|
||||
label?: string;
|
||||
description?: string;
|
||||
layout?: 'below';
|
||||
onClick?(e: MouseEvent): void;
|
||||
disabled?: boolean;
|
||||
bottomSeparator?: boolean;
|
||||
}
|
||||
|
||||
export const ButtonItem = Object.values(CommonUIModule).find((mod: any) =>
|
||||
mod?.render?.toString()?.includes('childrenContainerWidth:"min"'),
|
||||
) as FC<ButtonItemProps>;
|
||||
16
src/deck-components/Spinner.tsx
Normal file
16
src/deck-components/Spinner.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
import { IconsModule } from '../webpack';
|
||||
|
||||
// interface ButtonProps {
|
||||
// label?: string;
|
||||
// description?: string;
|
||||
// layout?: 'below';
|
||||
// onClick?(e: MouseEvent): void;
|
||||
// disabled?: boolean;
|
||||
// bottomSeparator?: boolean;
|
||||
// }
|
||||
|
||||
export const Spinner = Object.values(IconsModule).find((mod: any) =>
|
||||
mod?.toString()?.includes("Spinner)}),a.createElement(\"path\",{d:\"M18 "),
|
||||
) as FC<{}>;
|
||||
@@ -1,6 +1,8 @@
|
||||
export * from './Button';
|
||||
export * from './ButtonItem';
|
||||
export * from './Menu';
|
||||
export * from './Modal';
|
||||
export * from './Slider';
|
||||
export * from './Spinner';
|
||||
export * from './static-classes';
|
||||
export * from './Toggle';
|
||||
|
||||
@@ -58,7 +58,25 @@ export const CommonUIModule = allModules.find((m: Module) => {
|
||||
return false;
|
||||
});
|
||||
|
||||
export const IconsModule = allModules.find((m: Module) => {
|
||||
if (typeof m !== "object") return undefined;
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.toString()?.includes("Spinner)}),a.createElement(\"path\",{d:\"M18 ")) return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
export const Router = findModuleChild((m: Module) => {
|
||||
if (typeof m !== "object") return undefined;
|
||||
for (let prop in m) { if (m[prop]?.Navigate && m[prop]?.NavigationManager) return m[prop]}
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.Navigate && m[prop]?.NavigationManager) return m[prop]
|
||||
}
|
||||
})
|
||||
|
||||
export const ReactRouter = allModules.find((m: Module) => {
|
||||
if (typeof m !== "object") return undefined;
|
||||
for (let prop in m) {
|
||||
if (m[prop]?.computeRootMatch) return true
|
||||
}
|
||||
return false;
|
||||
})
|
||||
Reference in New Issue
Block a user