2025-05-01 18:21:10 +07:00
|
|
|
import { lookupModule } from '@revenge-mod/modules/finders'
|
|
|
|
|
import { byDependencies, byProps, looseDeps, moduleStateAware, relativeDep } from '@revenge-mod/modules/finders/filters'
|
2025-05-02 22:34:48 +07:00
|
|
|
|
2025-05-01 18:21:10 +07:00
|
|
|
import { ReactJsxRuntimeModuleId, ReactModuleId, ReactNativeModuleId } from '@revenge-mod/react'
|
2025-05-02 22:34:48 +07:00
|
|
|
|
2025-05-01 18:21:10 +07:00
|
|
|
import { proxify } from '@revenge-mod/utils/proxy'
|
|
|
|
|
|
|
|
|
|
import type { ComponentType, ReactNode } from 'react'
|
|
|
|
|
|
|
|
|
|
export let SettingListRenderer: SettingListRenderer = proxify(
|
|
|
|
|
() => {
|
|
|
|
|
const module = lookupModule(
|
|
|
|
|
moduleStateAware(
|
|
|
|
|
byProps('SettingsList'),
|
|
|
|
|
byDependencies(
|
|
|
|
|
looseDeps([
|
|
|
|
|
ReactModuleId,
|
|
|
|
|
ReactNativeModuleId,
|
|
|
|
|
relativeDep(1),
|
|
|
|
|
relativeDep(2),
|
2025-05-02 22:34:48 +07:00
|
|
|
undefined,
|
2025-05-01 18:21:10 +07:00
|
|
|
ReactJsxRuntimeModuleId,
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
{
|
|
|
|
|
includeUninitialized: true,
|
|
|
|
|
},
|
|
|
|
|
) as SettingListRenderer | undefined
|
|
|
|
|
|
|
|
|
|
if (module) {
|
|
|
|
|
// This allows the Proxy instance to be garbage collected
|
|
|
|
|
// after the module is initialized.
|
|
|
|
|
SettingListRenderer = module
|
|
|
|
|
gc()
|
|
|
|
|
return module
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hint: 'object',
|
|
|
|
|
},
|
|
|
|
|
)!
|
|
|
|
|
|
|
|
|
|
export interface SettingListRenderer {
|
|
|
|
|
SettingsList: ComponentType<{
|
2025-05-02 22:34:48 +07:00
|
|
|
ListHeaderComponent?: ComponentType
|
|
|
|
|
sections: Array<{ label?: string | ReactNode; settings: string[]; subLabel?: string | ReactNode }>
|
2025-05-01 18:21:10 +07:00
|
|
|
}>
|
|
|
|
|
}
|