mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-19 01:20:20 +02:00
fix(*): prevent issues where toString may not be a function (what)
This commit is contained in:
@@ -78,11 +78,11 @@ export const DialogControlsSection = MappedDialogDivs.get('DialogControlsSection
|
||||
export const DialogControlsSectionHeader = MappedDialogDivs.get('DialogControlsSectionHeader') as FC<DialogCommonProps>;
|
||||
|
||||
export const DialogButtonPrimary = Object.values(CommonUIModule).find(
|
||||
(mod: any) => mod?.render?.toString()?.includes('"DialogButton","_DialogLayout","Primary"'),
|
||||
(mod: any) => mod?.render?.toString?.()?.includes('"DialogButton","_DialogLayout","Primary"'),
|
||||
) as FC<DialogButtonProps>;
|
||||
|
||||
export const DialogButtonSecondary = Object.values(CommonUIModule).find(
|
||||
(mod: any) => mod?.render?.toString()?.includes('"DialogButton","_DialogLayout","Secondary"')
|
||||
(mod: any) => mod?.render?.toString?.()?.includes('"DialogButton","_DialogLayout","Secondary"')
|
||||
) as FC<DialogButtonProps>;
|
||||
|
||||
// This is the "main" button. The Primary can act as a submit button,
|
||||
|
||||
@@ -11,5 +11,5 @@ export interface FocusRingProps {
|
||||
}
|
||||
|
||||
export const FocusRing = findModuleExport((e: Export) =>
|
||||
e?.toString()?.includes('.GetShowDebugFocusRing())'),
|
||||
e?.toString?.()?.includes('.GetShowDebugFocusRing())'),
|
||||
) as FC<FocusRingProps>;
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface MenuGroupProps {
|
||||
}
|
||||
|
||||
const MenuGoupModule = findModuleByExport(e => e?.prototype?.Focus && e?.prototype?.OnOKButton && e?.prototype?.render?.toString().includes?.(`"emphasis"==this.props.tone`));
|
||||
export const MenuGroup: FC<MenuGroupProps> = MenuGoupModule && Object.values(MenuGoupModule).find((e: Export) => typeof e == "function" && e?.toString()?.includes("bInGamepadUI:"));
|
||||
export const MenuGroup: FC<MenuGroupProps> = MenuGoupModule && Object.values(MenuGoupModule).find((e: Export) => typeof e == "function" && e?.toString?.()?.includes("bInGamepadUI:"));
|
||||
export interface MenuItemProps extends FooterLegendProps {
|
||||
bInteractableItem?: boolean;
|
||||
onClick?(evt: Event): void;
|
||||
@@ -42,7 +42,7 @@ export interface MenuItemProps extends FooterLegendProps {
|
||||
|
||||
export const MenuItem: FC<MenuItemProps> = findModuleExport(
|
||||
(e: Export) =>
|
||||
e?.render?.toString()?.includes('bPlayAudio:') || (e?.prototype?.OnOKButton && e?.prototype?.OnMouseEnter),
|
||||
e?.render?.toString?.()?.includes('bPlayAudio:') || (e?.prototype?.OnOKButton && e?.prototype?.OnMouseEnter),
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -98,7 +98,7 @@ export const ModalRoot = Object.values(
|
||||
|
||||
return false;
|
||||
}) || {},
|
||||
)?.find((x: any) => x?.type?.toString()?.includes('((function(){')) as FC<ModalRootProps>;
|
||||
)?.find((x: any) => x?.type?.toString?.()?.includes('((function(){')) as FC<ModalRootProps>;
|
||||
|
||||
interface SimpleModalProps {
|
||||
active?: boolean;
|
||||
|
||||
@@ -22,5 +22,5 @@ export interface PanelSectionRowProps {
|
||||
children?: ReactNode;
|
||||
}
|
||||
export const PanelSectionRow = Object.values(mod).filter(
|
||||
(exp: any) => !exp?.toString()?.includes('.PanelSection'),
|
||||
(exp: any) => !exp?.toString?.()?.includes('.PanelSection'),
|
||||
)[0] as FC<PanelSectionRowProps>;
|
||||
|
||||
@@ -24,11 +24,11 @@ export interface ProgressBarWithInfoProps extends ProgressBarItemProps {
|
||||
}
|
||||
|
||||
export const ProgressBar = findModuleExport((e: Export) =>
|
||||
e?.toString()?.includes('.ProgressBar,"standard"=='),
|
||||
e?.toString?.()?.includes('.ProgressBar,"standard"=='),
|
||||
) as FC<ProgressBarProps>;
|
||||
|
||||
export const ProgressBarWithInfo = findModuleExport((e: Export) =>
|
||||
e?.toString()?.includes('.ProgressBarFieldStatus},'),
|
||||
e?.toString?.()?.includes('.ProgressBarFieldStatus},'),
|
||||
) as FC<ProgressBarWithInfoProps>;
|
||||
|
||||
const progressBarItemRegex = createPropListRegex(["indeterminate", "nTransitionSec", "nProgress"]);
|
||||
|
||||
@@ -30,5 +30,5 @@ export interface SliderFieldProps extends ItemProps {
|
||||
|
||||
export const SliderField = Object.values(CommonUIModule).find((mod: any) =>
|
||||
// stable || beta as of oct 2 2024
|
||||
mod?.toString()?.includes('SliderField,fallback') || mod?.toString()?.includes("SliderField\",")
|
||||
mod?.toString?.()?.includes('SliderField,fallback') || mod?.toString?.()?.includes("SliderField\",")
|
||||
) as FC<SliderFieldProps>;
|
||||
|
||||
@@ -62,9 +62,9 @@ export interface TabsProps {
|
||||
autoFocusContents?: boolean;
|
||||
}
|
||||
|
||||
const tabsModule = findModuleByExport(e => e?.toString()?.includes(".TabRowTabs") && e?.toString()?.includes("activeTab:"));
|
||||
const tabsModule = findModuleByExport(e => e?.toString?.()?.includes(".TabRowTabs") && e?.toString?.()?.includes("activeTab:"));
|
||||
|
||||
/**
|
||||
* Tabs component as used in the library and media tabs. See {@link TabsProps}.
|
||||
*/
|
||||
export const Tabs = tabsModule && Object.values(tabsModule).find((e: any) => e?.type?.toString()?.includes("((function()")) as FC<TabsProps>;
|
||||
export const Tabs = tabsModule && Object.values(tabsModule).find((e: any) => e?.type?.toString?.()?.includes("((function()")) as FC<TabsProps>;
|
||||
|
||||
@@ -10,5 +10,5 @@ export interface ToggleProps {
|
||||
}
|
||||
|
||||
export const Toggle = Object.values(CommonUIModule).find((mod: any) =>
|
||||
mod?.render?.toString()?.includes('.ToggleOff)'),
|
||||
mod?.render?.toString?.()?.includes('.ToggleOff)'),
|
||||
) as FC<ToggleProps>;
|
||||
|
||||
@@ -12,5 +12,5 @@ export interface ToggleFieldProps extends ItemProps {
|
||||
|
||||
export const ToggleField = Object.values(CommonUIModule).find((mod: any) =>
|
||||
// stable || beta as of oct 2 2024
|
||||
mod?.render?.toString()?.includes('ToggleField,fallback') || mod?.render?.toString()?.includes("ToggleField\",")
|
||||
mod?.render?.toString?.()?.includes('ToggleField,fallback') || mod?.render?.toString?.()?.includes("ToggleField\",")
|
||||
) as FC<ToggleFieldProps>;
|
||||
|
||||
Reference in New Issue
Block a user