feat(lib/discord/design)!: export FormSwitch, rename Components -> Design
This commit is contained in:
parent
3818ee1313
commit
96ff348fd8
9 changed files with 72 additions and 30 deletions
|
|
@ -1,18 +1,27 @@
|
|||
import { byDependencies, byProps, looseDeps, preferExports, relativeDep } from '@revenge-mod/modules/finders/filters'
|
||||
import {
|
||||
byDependencies,
|
||||
byProps,
|
||||
bySingleProp,
|
||||
looseDeps,
|
||||
preferExports,
|
||||
relativeDep,
|
||||
} from '@revenge-mod/modules/finders/filters'
|
||||
import { lookupModule } from '@revenge-mod/modules/finders/lookup'
|
||||
|
||||
import { ReactJsxRuntimeModuleId, ReactModuleId, ReactNativeModuleId } from '@revenge-mod/react'
|
||||
|
||||
import { proxify } from '@revenge-mod/utils/proxy'
|
||||
|
||||
import type { DiscordModules } from './types'
|
||||
|
||||
// design/native.tsx
|
||||
export let Components: Components = proxify(
|
||||
export let Design: Design = proxify(
|
||||
() => {
|
||||
// ID: 3236
|
||||
// [3237, 1366, 3238, 3239, 2, ...];
|
||||
const module = lookupModule(
|
||||
preferExports(
|
||||
byProps<Components>('TableRow', 'Button'),
|
||||
byProps<Design>('TableRow', 'Button'),
|
||||
byDependencies(looseDeps([relativeDep(1), undefined, relativeDep(2), relativeDep(3), 2])),
|
||||
),
|
||||
{
|
||||
|
|
@ -20,14 +29,51 @@ export let Components: Components = proxify(
|
|||
},
|
||||
)
|
||||
|
||||
if (module) return (Components = module)
|
||||
if (module) return (Design = module)
|
||||
},
|
||||
{
|
||||
hint: 'object',
|
||||
},
|
||||
)!
|
||||
|
||||
export interface Components {
|
||||
export let FormSwitch: DiscordModules.Components.FormSwitch = proxify(() => {
|
||||
// ID: 4655
|
||||
// Deps: [46, 175, 27, 180, 2822, 1311, 687, 3358, 1372, 3241, 3242, 4656, 4657, 2]
|
||||
|
||||
// ID: 46
|
||||
// Deps: [47, 48, 35, 49]
|
||||
|
||||
const module = lookupModule(
|
||||
preferExports(
|
||||
bySingleProp<{ FormSwitch: DiscordModules.Components.FormSwitch }>('FormSwitch'),
|
||||
byDependencies([
|
||||
[relativeDep(1), relativeDep(2), undefined, relativeDep(3)],
|
||||
ReactModuleId,
|
||||
ReactNativeModuleId,
|
||||
ReactJsxRuntimeModuleId,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
relativeDep(1),
|
||||
relativeDep(2),
|
||||
2,
|
||||
]),
|
||||
),
|
||||
{
|
||||
includeUninitialized: true,
|
||||
},
|
||||
)
|
||||
|
||||
if (module) return (FormSwitch = module.FormSwitch)
|
||||
})!
|
||||
|
||||
export interface Design {
|
||||
createStyles: DiscordModules.Styles.CreateStylesFunction
|
||||
|
||||
ActionSheet: DiscordModules.Components.ActionSheet
|
||||
ActionSheetRow: DiscordModules.Components.ActionSheetRow
|
||||
ActionSheetSwitchRow: DiscordModules.Components.ActionSheetSwitchRow
|
||||
|
|
@ -37,7 +83,6 @@ export interface Components {
|
|||
Card: DiscordModules.Components.Card
|
||||
ContextMenu: DiscordModules.Components.ContextMenu
|
||||
ContextMenuItem: DiscordModules.Components.ContextMenuItem
|
||||
FormSwitch: DiscordModules.Components.FormSwitch
|
||||
IconButton: DiscordModules.Components.IconButton
|
||||
ImageButton: DiscordModules.Components.ImageButton
|
||||
Stack: DiscordModules.Components.Stack
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ export namespace DiscordModules {
|
|||
| 'eyebrow'
|
||||
|
||||
export type TextStyleSheet = Record<TextVariant, RNTextProps>
|
||||
export type CreateStylesFn = <const S extends Record<string, TextStyle | ViewStyle | ImageStyle>>(
|
||||
export type CreateStylesFunction = <const S extends Record<string, TextStyle | ViewStyle | ImageStyle>>(
|
||||
styles: S,
|
||||
) => () => S
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { Components } from '@revenge-mod/discord/design'
|
||||
import { Design } from '@revenge-mod/discord/design'
|
||||
import type { DiscordModules } from '@revenge-mod/discord/types'
|
||||
import { ReactNative } from '@revenge-mod/react'
|
||||
|
||||
export default function Page(props: DiscordModules.Components.StackProps) {
|
||||
return (
|
||||
<Components.Stack style={styles.page} spacing={24} {...props}>
|
||||
<Design.Stack style={styles.page} spacing={24} {...props}>
|
||||
{props.children}
|
||||
</Components.Stack>
|
||||
</Design.Stack>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Components } from '@revenge-mod/discord/design'
|
||||
import { Design } from '@revenge-mod/discord/design'
|
||||
import { lookupGeneratedIconComponent } from '@revenge-mod/utils/discord'
|
||||
|
||||
import type { DiscordModules } from '@revenge-mod/discord/types'
|
||||
|
|
@ -7,7 +7,7 @@ const MagnifyingGlassIcon = lookupGeneratedIconComponent('MagnifyingGlassIcon')
|
|||
|
||||
export default function SearchInput(props: DiscordModules.Components.TextInputProps) {
|
||||
return (
|
||||
<Components.TextInput
|
||||
<Design.TextInput
|
||||
leadingIcon={MagnifyingGlassIcon}
|
||||
size="md"
|
||||
placeholder="Search"
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
import { getAssetByName, getAssetId } from '@revenge-mod/assets'
|
||||
import { Components } from '@revenge-mod/discord/design'
|
||||
import { Design } from '@revenge-mod/discord/design'
|
||||
|
||||
import type { DiscordModules } from '@revenge-mod/discord/types'
|
||||
|
||||
export default function TableRowAssetIcon(props: TableRowAssetIconProps) {
|
||||
return (
|
||||
<Components.TableRow.Icon
|
||||
source={props.name ? getAssetId(getAssetByName(props.name)!)! : props.id!}
|
||||
{...props}
|
||||
/>
|
||||
<Design.TableRow.Icon source={props.name ? getAssetId(getAssetByName(props.name)!)! : props.id!} {...props} />
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { React } from '@revenge-mod/react'
|
||||
|
||||
import { AlertActionCreators } from '@revenge-mod/discord/actions'
|
||||
import { Components } from '@revenge-mod/discord/design'
|
||||
import { Design } from '@revenge-mod/discord/design'
|
||||
|
||||
import { nodeUtil } from '@revenge-mod/externals/browserify'
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ const {
|
|||
TableSwitchRow,
|
||||
Text,
|
||||
TextArea,
|
||||
} = Components
|
||||
} = Design
|
||||
|
||||
function EvaluateJavaScriptAlert() {
|
||||
const code = React.useRef('')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { AlertActionCreators } from '@revenge-mod/discord/actions'
|
||||
import { Components } from '@revenge-mod/discord/design'
|
||||
import { Design } from '@revenge-mod/discord/design'
|
||||
import { Clipboard } from '@revenge-mod/externals/react-native-clipboard'
|
||||
import { FlashList } from '@revenge-mod/externals/shopify'
|
||||
import { React, ReactNative } from '@revenge-mod/react'
|
||||
|
|
@ -13,7 +13,7 @@ import { getAllAssets, getAssetId } from '@revenge-mod/assets'
|
|||
import type { Asset, AssetId } from '@revenge-mod/assets/types'
|
||||
|
||||
const { Image, StyleSheet, View } = ReactNative
|
||||
const { AlertModal, AlertActionButton, TableRow, Text, Stack } = Components
|
||||
const { AlertModal, AlertActionButton, TableRow, Text, Stack } = Design
|
||||
|
||||
const Displayable = new Set(['png', 'jpg', 'svg', 'webp'])
|
||||
const UndisplayableFallback = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Components } from '@revenge-mod/discord/design'
|
||||
import { Design } from '@revenge-mod/discord/design'
|
||||
import { SettingListRenderer } from '@revenge-mod/discord/modules/settings/renderer'
|
||||
import { React, ReactNative } from '@revenge-mod/react'
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ import { DevToolsContext } from '../devtools'
|
|||
// TODO(plugins/settings): debug bridge
|
||||
export default function RevengeDeveloperSettingScreen() {
|
||||
return (
|
||||
<Components.Stack spacing={0} style={{ flexGrow: 1 }}>
|
||||
<Design.Stack spacing={0} style={{ flexGrow: 1 }}>
|
||||
{globalThis.__REACT_DEVTOOLS__ && <ReactDevToolsAddressSetting />}
|
||||
<SettingListRenderer.SettingsList
|
||||
sections={[
|
||||
|
|
@ -28,14 +28,14 @@ export default function RevengeDeveloperSettingScreen() {
|
|||
},
|
||||
]}
|
||||
/>
|
||||
</Components.Stack>
|
||||
</Design.Stack>
|
||||
)
|
||||
}
|
||||
|
||||
export function ReactDevToolsAddressSetting() {
|
||||
return (
|
||||
<ReactNative.View style={{ paddingHorizontal: 16, paddingTop: 16 }}>
|
||||
<Components.TextInput
|
||||
<Design.TextInput
|
||||
editable={!DevToolsContext.open}
|
||||
isDisabled={DevToolsContext.open}
|
||||
leadingText="ws://"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Components } from '@revenge-mod/discord/design'
|
||||
import { Design } from '@revenge-mod/discord/design'
|
||||
import { SettingListRenderer } from '@revenge-mod/discord/modules/settings/renderer'
|
||||
import { MobileSetting } from '../constants'
|
||||
|
||||
|
|
@ -15,12 +15,12 @@ export default function RevengeSettingScreen() {
|
|||
],
|
||||
subLabel: (
|
||||
<>
|
||||
<Components.Text variant="text-xs/medium">
|
||||
<Design.Text variant="text-xs/medium">
|
||||
You are using the next version of Revenge!
|
||||
</Components.Text>
|
||||
<Components.Text variant="text-xs/semibold" color="text-danger">
|
||||
</Design.Text>
|
||||
<Design.Text variant="text-xs/semibold" color="text-danger">
|
||||
This version is experimental and may be unstable.
|
||||
</Components.Text>
|
||||
</Design.Text>
|
||||
</>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue