From 3170779c6b3d02ea17f7b6c1fbd57e00498ffe4f Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Sun, 25 Jun 2023 17:23:45 -0500 Subject: [PATCH 1/4] fix: add patch indicator to prevent crashes --- src/utils/react.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/utils/react.ts b/src/utils/react.ts index 2971364..0e3c2a8 100644 --- a/src/utils/react.ts +++ b/src/utils/react.ts @@ -46,13 +46,17 @@ export function fakeRenderComponent(fun: Function, customHooks: any = {}): any { } export function wrapReactType(node: any, prop: any = 'type') { - return (node[prop] = { ...node[prop] }); + return node[prop].__DECKY_WRAPPED ? node[prop] : (node[prop] = { ...node[prop], __DECKY_WRAPPED: true }); } export function wrapReactClass(node: any, prop: any = 'type') { - const cls = node[prop]; - const wrappedCls = class extends cls {}; - return (node[prop] = wrappedCls); + if (node[prop].__DECKY_WRAPPED) { + return node[prop]; + } else { + const cls = node[prop]; + const wrappedCls = class extends cls { __DECKY_WRAPPED = true; }; + return (node[prop] = wrappedCls); + } } export function getReactInstance(o: HTMLElement | Element | Node) { From a06650cf099d0e89be1172b80070b1abefed8126 Mon Sep 17 00:00:00 2001 From: Travis Lane <63308171+Tormak9970@users.noreply.github.com> Date: Mon, 26 Jun 2023 11:26:45 -0500 Subject: [PATCH 2/4] Update react.ts with requested changes --- src/utils/react.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/react.ts b/src/utils/react.ts index 0e3c2a8..04b2c6f 100644 --- a/src/utils/react.ts +++ b/src/utils/react.ts @@ -46,15 +46,19 @@ export function fakeRenderComponent(fun: Function, customHooks: any = {}): any { } export function wrapReactType(node: any, prop: any = 'type') { - return node[prop].__DECKY_WRAPPED ? node[prop] : (node[prop] = { ...node[prop], __DECKY_WRAPPED: true }); + if (node[prop]?.__DECKY_WRAPPED) { + return node[prop]; + } else { + return (node[prop] = { ...node[prop], __DECKY_WRAPPED: true }); + } } export function wrapReactClass(node: any, prop: any = 'type') { - if (node[prop].__DECKY_WRAPPED) { + if (node[prop]?.__DECKY_WRAPPED) { return node[prop]; } else { const cls = node[prop]; - const wrappedCls = class extends cls { __DECKY_WRAPPED = true; }; + const wrappedCls = class extends cls { static __DECKY_WRAPPED = true; }; return (node[prop] = wrappedCls); } } From fd0d011cbf05790c5a1078970b5be72f9267402c Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Mon, 10 Jul 2023 07:47:03 -0500 Subject: [PATCH 3/4] feat: add components found while working on tabmaster --- src/deck-components/Modal.tsx | 13 +++++++++++++ src/deck-components/Panel.tsx | 5 +++++ src/deck-components/Scroll.tsx | 14 ++++++++++++++ src/deck-components/index.ts | 1 + 4 files changed, 33 insertions(+) create mode 100644 src/deck-components/Scroll.tsx diff --git a/src/deck-components/Modal.tsx b/src/deck-components/Modal.tsx index e3d6329..ae2dcc5 100755 --- a/src/deck-components/Modal.tsx +++ b/src/deck-components/Modal.tsx @@ -154,3 +154,16 @@ export const ModalRoot = (Object.values( } } })) as FC; + +interface SimpleModalProps{ + active?: boolean, + children: ReactNode +} + +const ModalModule = findModuleChild((mod) => { + if (typeof mod !== 'object' || !mod.__esModule) return undefined; + if (mod.SimpleModal && mod.ModalPosition) return mod; +}) + +export const SimpleModal = ModalModule.SimpleModal as FC +export const ModalPosition = ModalModule.ModalPosition as FC \ No newline at end of file diff --git a/src/deck-components/Panel.tsx b/src/deck-components/Panel.tsx index 629d5d0..1efc002 100644 --- a/src/deck-components/Panel.tsx +++ b/src/deck-components/Panel.tsx @@ -2,6 +2,11 @@ import { FC, ReactNode } from 'react'; import { findModuleChild } from '../webpack'; +export const Panel: FC<{ children?: ReactNode; }> = findModuleChild((mod) => { + if (typeof mod !== 'object' || !mod.__esModule) return undefined; + return mod.Panel; +}) + export interface PanelSectionProps { title?: string; spinner?: boolean; diff --git a/src/deck-components/Scroll.tsx b/src/deck-components/Scroll.tsx new file mode 100644 index 0000000..377ac8f --- /dev/null +++ b/src/deck-components/Scroll.tsx @@ -0,0 +1,14 @@ +import { FC, ReactNode } from "react"; +import { findModuleChild } from "../webpack"; + +const ScrollingModule = findModuleChild((mod) => { + if (typeof mod !== 'object' || !mod.__esModule) return undefined; + if (mod.ScrollPanel) return mod; +}); + +export const ScrollPanel: FC<{ children?: ReactNode; }> = ScrollingModule.ScrollPanel; + +export const ScrollPanelGroup: FC<{ children?: ReactNode; }> = findModuleChild((mod) => { + if (typeof mod !== 'object' || !mod.__esModule) return undefined; + return mod.ScrollPanelGroup; +}) \ No newline at end of file diff --git a/src/deck-components/index.ts b/src/deck-components/index.ts index 11e45e5..65807d4 100755 --- a/src/deck-components/index.ts +++ b/src/deck-components/index.ts @@ -25,6 +25,7 @@ export * from './TextField'; export * from './Toggle'; export * from './ToggleField'; export * from './SteamClient'; +export * from './Scroll'; import { AppDetails, LogoPosition, SteamAppOverview, SteamClient } from './SteamClient'; From 8a352d288d657abfb12f7266b48dac997702e910 Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Wed, 9 Aug 2023 13:17:52 -0500 Subject: [PATCH 4/4] chore: adjusted per aa's request --- src/deck-components/Modal.tsx | 2 +- src/deck-components/Scroll.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/deck-components/Modal.tsx b/src/deck-components/Modal.tsx index ae2dcc5..f424007 100755 --- a/src/deck-components/Modal.tsx +++ b/src/deck-components/Modal.tsx @@ -160,7 +160,7 @@ interface SimpleModalProps{ children: ReactNode } -const ModalModule = findModuleChild((mod) => { +const ModalModule = findModule((mod) => { if (typeof mod !== 'object' || !mod.__esModule) return undefined; if (mod.SimpleModal && mod.ModalPosition) return mod; }) diff --git a/src/deck-components/Scroll.tsx b/src/deck-components/Scroll.tsx index 377ac8f..6c2e0e1 100644 --- a/src/deck-components/Scroll.tsx +++ b/src/deck-components/Scroll.tsx @@ -1,7 +1,7 @@ import { FC, ReactNode } from "react"; -import { findModuleChild } from "../webpack"; +import { findModuleChild, findModule } from "../webpack"; -const ScrollingModule = findModuleChild((mod) => { +const ScrollingModule = findModule((mod) => { if (typeof mod !== 'object' || !mod.__esModule) return undefined; if (mod.ScrollPanel) return mod; });