this repo has no description

Nuke commmon even more

Changed files
+188 -622
packages
core
src
util
core-extensions
src
common
webpackModules
moonbase
settings
webpackModules
spacepack
webpackModules
types
web-preload
+1
build.mjs
···
"module",
"events",
"original-fs", // wtf asar?
+
"discord", // mappings
// Silence an esbuild warning
"./node-preload.js"
-8
packages/core-extensions/src/common/index.ts
···
import { ExtensionWebExports } from "@moonlight-mod/types";
export const webpackModules: ExtensionWebExports["webpackModules"] = {
-
components: {
-
dependencies: [
-
{ ext: "spacepack", id: "spacepack" },
-
"MasonryList:",
-
".flexGutterSmall,"
-
]
-
},
-
stores: {
dependencies: [
{
-41
packages/core-extensions/src/common/webpackModules/components.ts
···
-
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
-
-
const Components = spacepack.findByCode("MasonryList:function")[0].exports;
-
const MarkdownParser = spacepack.findByCode(
-
"parseAutoModerationSystemMessage:"
-
)[0].exports.Z;
-
const LegacyText = spacepack.findByCode(".selectable", ".colorStandard")[0]
-
.exports.default;
-
const Flex = Object.values(
-
spacepack.findByCode(".flex" + "GutterSmall,")[0].exports
-
)[0];
-
-
const CardClasses = {};
-
spacepack
-
.lazyLoad(
-
"renderArtisanalHack",
-
/\[(?:.\.e\("\d+?"\),?)+\][^}]+?webpackId:\d+,name:"ChannelSettings"/,
-
/webpackId:(\d+),name:"ChannelSettings"/
-
)
-
.then(() =>
-
Object.assign(
-
CardClasses,
-
spacepack.findByExports("card", "cardHeader", "inModal")[0].exports
-
)
-
);
-
-
const ControlClasses = spacepack.findByCode(
-
"title",
-
"titleDefault",
-
"dividerDefault"
-
)[0].exports;
-
-
// We use CJS export here because merging the exports from Components is annoying as shit
-
module.exports = {
-
...Components,
-
MarkdownParser,
-
LegacyText,
-
Flex,
-
CardClasses,
-
ControlClasses
-
};
+1 -1
packages/core-extensions/src/moonbase/index.tsx
···
dependencies: [
{ ext: "spacepack", id: "spacepack" },
{ id: "discord/packages/react" },
-
{ ext: "common", id: "components" },
+
{ id: "discord/components/common/index" },
{ ext: "moonbase", id: "stores" },
"Masks.PANEL_BUTTON",
"renderArtisanalHack(){",
+1 -1
packages/core-extensions/src/moonbase/webpackModules/moonbase.tsx
···
import { Moonbase, pages } from "@moonlight-mod/wp/moonbase_ui";
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
-
import { MenuItem } from "@moonlight-mod/wp/common_components";
+
import { MenuItem } from "@moonlight-mod/wp/discord/components/common/index";
const { open } = spacepack.findByExports("setSection", "clearSubsection")[0]
.exports.Z;
+4 -4
packages/core-extensions/src/moonbase/webpackModules/ui/config/index.tsx
···
FormText,
FormSwitch,
TextInput,
-
Flex,
Button,
SingleSelect,
Tooltip,
Clickable
-
} from "@moonlight-mod/wp/common_components";
-
import CommonComponents from "@moonlight-mod/wp/common_components";
+
} from "@moonlight-mod/wp/discord/components/common/index";
+
import { Flex } from "@moonlight-mod/wp/discord/uikit/Flex";
+
import * as Components from "@moonlight-mod/wp/discord/components/common/index";
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
···
.exports)
);
-
const { CircleXIcon } = CommonComponents;
+
const { CircleXIcon } = Components;
function RemoveEntryButton({ onClick }: { onClick: () => void }) {
return (
<div className={RemoveButtonClasses.removeButtonContainer}>
+22 -17
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/card.tsx
···
import { ExtensionLoadSource } from "@moonlight-mod/types";
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
-
import CommonComponents from "@moonlight-mod/wp/common_components";
+
import * as Components from "@moonlight-mod/wp/discord/components/common/index";
import React from "@moonlight-mod/wp/discord/packages/react";
import Flux from "@moonlight-mod/wp/discord/packages/flux";
+
import { Flex } from "@moonlight-mod/wp/discord/uikit/Flex";
import ExtensionInfo from "./info";
import Settings from "./settings";
···
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
-
const { DownloadIcon, TrashIcon, CircleWarningIcon } = CommonComponents;
+
const { DownloadIcon, TrashIcon, CircleWarningIcon } = Components;
const PanelButton = spacepack.findByCode("Masks.PANEL_BUTTON")[0].exports.Z;
const TabBarClasses = spacepack.findByExports(
···
"headerContentWrapper"
)[0].exports;
+
const CardClasses: Record<string, string> = {};
+
spacepack
+
.lazyLoad(
+
"renderArtisanalHack",
+
/\[(?:.\.e\("\d+?"\),?)+\][^}]+?webpackId:\d+,name:"ChannelSettings"/,
+
/webpackId:(\d+),name:"ChannelSettings"/
+
)
+
.then(() =>
+
Object.assign(
+
CardClasses,
+
spacepack.findByExports("card", "cardHeader", "inModal")[0].exports
+
)
+
);
+
export default function ExtensionCard({ uniqueId }: { uniqueId: number }) {
const [tab, setTab] = React.useState(ExtensionPage.Info);
const [restartNeeded, setRestartNeeded] = React.useState(false);
···
// Why it work like that :sob:
if (ext == null) return <></>;
-
const {
-
Card,
-
CardClasses,
-
Flex,
-
Text,
-
MarkdownParser,
-
Switch,
-
TabBar,
-
Button
-
} = CommonComponents;
+
const { Card, Text, Switch, TabBar, Button } = Components;
+
const { MarkupUtils } = require("discord/modules/markup/MarkupUtils");
const tagline = ext.manifest?.meta?.tagline;
const settings = ext.manifest?.settings;
···
</Flex>
{tagline != null && (
-
<Text variant="text-sm/normal">
-
{MarkdownParser.parse(tagline)}
-
</Text>
+
<Text variant="text-sm/normal">{MarkupUtils.parse(tagline)}</Text>
)}
</Flex>
···
<PanelButton
icon={() => (
<CircleWarningIcon
-
color={CommonComponents.tokens.colors.STATUS_DANGER}
+
color={Components.tokens.colors.STATUS_DANGER}
/>
)}
onClick={() => window.location.reload()}
···
{tab === ExtensionPage.Info && <ExtensionInfo ext={ext} />}
{tab === ExtensionPage.Description && (
<Text variant="text-md/normal">
-
{MarkdownParser.parse(description ?? "*No description*")}
+
{MarkupUtils.parse(description ?? "*No description*")}
</Text>
)}
{tab === ExtensionPage.Settings && <Settings ext={ext} />}
+3 -3
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/filterBar.tsx
···
MenuGroup,
MenuCheckboxItem,
MenuItem
-
} from "@moonlight-mod/wp/common_components";
-
import CommonComponents from "@moonlight-mod/wp/common_components";
+
} from "@moonlight-mod/wp/discord/components/common/index";
+
import * as Components from "@moonlight-mod/wp/discord/components/common/index";
export enum Filter {
Core = 1 << 0,
···
.Z;
const { ChevronSmallDownIcon, ChevronSmallUpIcon, ArrowsUpDownIcon } =
-
CommonComponents;
+
Components;
function toggleTag(
selectedTags: Set<string>,
+4 -6
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/info.tsx
···
import { MoonbaseExtension } from "../../../types";
import React from "@moonlight-mod/wp/discord/packages/react";
-
import CommonComponents from "@moonlight-mod/wp/common_components";
+
import * as Components from "@moonlight-mod/wp/discord/components/common/index";
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
type Dependency = {
···
marginRight: "1em"
}}
>
-
<CommonComponents.Text
+
<Components.Text
variant="eyebrow"
className={UserInfoClasses.userInfoSectionHeader}
>
{title}
-
</CommonComponents.Text>
+
</Components.Text>
-
<CommonComponents.Text variant="text-sm/normal">
-
{children}
-
</CommonComponents.Text>
+
<Components.Text variant="text-sm/normal">{children}</Components.Text>
</div>
);
}
+13 -12
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/settings.tsx
···
import { ExtensionState, MoonbaseExtension } from "../../../types";
import React from "@moonlight-mod/wp/discord/packages/react";
-
import CommonComponents from "@moonlight-mod/wp/common_components";
+
import * as Components from "@moonlight-mod/wp/discord/components/common/index";
import Flux from "@moonlight-mod/wp/discord/packages/flux";
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
+
import { Flex } from "@moonlight-mod/wp/discord/uikit/Flex";
type SettingsProps = {
ext: MoonbaseExtension;
···
}
function Boolean({ ext, name, setting, disabled }: SettingsProps) {
-
const { FormSwitch } = CommonComponents;
+
const { FormSwitch } = Components;
const { value, displayName, description } = useConfigEntry<boolean>(
ext.uniqueId,
name
···
}
function Number({ ext, name, setting, disabled }: SettingsProps) {
-
const { FormItem, FormText, Slider } = CommonComponents;
+
const { FormItem, FormText, Slider } = Components;
const { value, displayName, description } = useConfigEntry<number>(
ext.uniqueId,
name
···
}
function String({ ext, name, setting, disabled }: SettingsProps) {
-
const { FormItem, FormText, TextInput } = CommonComponents;
+
const { FormItem, FormText, TextInput } = Components;
const { value, displayName, description } = useConfigEntry<string>(
ext.uniqueId,
name
···
}
function MultilineString({ ext, name, setting, disabled }: SettingsProps) {
-
const { FormItem, FormText, TextArea } = CommonComponents;
+
const { FormItem, FormText, TextArea } = Components;
const { value, displayName, description } = useConfigEntry<string>(
ext.uniqueId,
name
···
}
function Select({ ext, name, setting, disabled }: SettingsProps) {
-
const { FormItem, FormText, SingleSelect } = CommonComponents;
+
const { FormItem, FormText, SingleSelect } = Components;
const { value, displayName, description } = useConfigEntry<string>(
ext.uniqueId,
name
···
function MultiSelect({ ext, name, setting, disabled }: SettingsProps) {
const { FormItem, FormText, Select, useVariableSelect, multiSelect } =
-
CommonComponents;
+
Components;
const { value, displayName, description } = useConfigEntry<string | string[]>(
ext.uniqueId,
name
···
const RemoveButtonClasses = spacepack.findByCode("removeButtonContainer")[0]
.exports;
-
const CircleXIcon = CommonComponents.CircleXIcon;
+
const CircleXIcon = Components.CircleXIcon;
function RemoveEntryButton({
onClick,
disabled
···
onClick: () => void;
disabled: boolean;
}) {
-
const { Tooltip, Clickable } = CommonComponents;
+
const { Tooltip, Clickable } = Components;
return (
<div className={RemoveButtonClasses.removeButtonContainer}>
<Tooltip text="Remove entry" position="top">
···
}
function List({ ext, name, setting, disabled }: SettingsProps) {
-
const { FormItem, FormText, TextInput, Button, Flex } = CommonComponents;
+
const { FormItem, FormText, TextInput, Button } = Components;
const { value, displayName, description } = useConfigEntry<string[]>(
ext.uniqueId,
name
···
}
function Dictionary({ ext, name, setting, disabled }: SettingsProps) {
-
const { FormItem, FormText, TextInput, Button, Flex } = CommonComponents;
+
const { FormItem, FormText, TextInput, Button, Flex } = Components;
const { value, displayName, description } = useConfigEntry<
Record<string, string>
>(ext.uniqueId, name);
···
}
export default function Settings({ ext }: { ext: MoonbaseExtension }) {
-
const { Flex } = CommonComponents;
+
const { Flex } = Components;
return (
<Flex className="moonbase-settings" direction={Flex.Direction.VERTICAL}>
{Object.entries(ext.manifest.settings!).map(([name, setting]) => (
+4 -1
packages/core-extensions/src/moonbase/webpackModules/ui/index.tsx
···
import React from "@moonlight-mod/wp/discord/packages/react";
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
-
import { Text, TabBar } from "@moonlight-mod/wp/common_components";
+
import {
+
Text,
+
TabBar
+
} from "@moonlight-mod/wp/discord/components/common/index";
import Flux from "@moonlight-mod/wp/discord/packages/flux";
import { UserSettingsModalStore } from "@moonlight-mod/wp/common_stores";
+1 -1
packages/core-extensions/src/settings/webpackModules/settings.ts
···
import {
SettingsSection,
Settings as SettingsType
-
} from "@moonlight-mod/types/coreExtensions";
+
} from "@moonlight-mod/types/coreExtensions/settings";
export const Settings: SettingsType = {
ourSections: [],
+1 -1
packages/core-extensions/src/spacepack/index.ts
···
import { ExtensionWebExports } from "@moonlight-mod/types";
-
import { Spacepack } from "@moonlight-mod/types/coreExtensions";
+
import { Spacepack } from "@moonlight-mod/types/coreExtensions/spacepack";
declare global {
interface Window {
+1 -1
packages/core-extensions/src/spacepack/webpackModules/spacepack.ts
···
WebpackModuleFunc,
WebpackRequireType
} from "@moonlight-mod/types";
-
import { Spacepack } from "@moonlight-mod/types/coreExtensions";
+
import { Spacepack } from "@moonlight-mod/types/coreExtensions/spacepack";
const webpackRequire = require as unknown as WebpackRequireType;
const cache = webpackRequire.c;
packages/core/src/util/clone.ts

This is a binary file and will not be displayed.

+1 -1
packages/types/package.json
···
},
"dependencies": {
"@moonlight-mod/lunast": "git+https://github.com/moonlight-mod/lunast.git",
+
"@moonlight-mod/mappings": "github:moonlight-mod/mappings",
"@moonlight-mod/moonmap": "git+https://github.com/moonlight-mod/moonmap.git",
-
"@moonlight-mod/mappings": "git+https://github.com/moonlight-mod/mappings.git",
"@types/react": "^18.3.10",
"csstype": "^3.1.2",
"standalone-electron-types": "^1.0.0"
+2 -76
packages/types/src/coreExtensions.ts
···
-
import { CommonComponents as CommonComponents_ } from "./coreExtensions/components";
-
import React, { ReactElement } from "react";
-
import {
-
WebpackModule,
-
WebpackModuleFunc,
-
WebpackRequireType
-
} from "./discord";
-
import type { Store } from "@moonlight-mod/mappings/discord/packages/flux";
-
-
export type Spacepack = {
-
inspect: (module: number | string) => WebpackModuleFunc | null;
-
findByCode: (...args: (string | RegExp)[]) => any[];
-
findByExports: (...args: string[]) => any[];
-
require: WebpackRequireType;
-
modules: Record<string, WebpackModuleFunc>;
-
cache: Record<string, any>;
-
findObjectFromKey: (exports: Record<string, any>, key: string) => any | null;
-
findObjectFromValue: (exports: Record<string, any>, value: any) => any | null;
-
findObjectFromKeyValuePair: (
-
exports: Record<string, any>,
-
key: string,
-
value: any
-
) => any | null;
-
findFunctionByStrings: (
-
exports: Record<string, any>,
-
...strings: (string | RegExp)[]
-
// eslint-disable-next-line @typescript-eslint/ban-types
-
) => Function | null;
-
lazyLoad: (
-
find: string | RegExp | (string | RegExp)[],
-
chunk: RegExp,
-
module: RegExp
-
) => Promise<any>;
-
filterReal: (modules: WebpackModule[]) => WebpackModule[];
-
};
-
-
export type NoticeProps = {
-
stores: Store<any>[];
-
element: React.FunctionComponent;
-
};
-
-
export type SettingsSection =
-
| { section: "DIVIDER"; pos: number }
-
| { section: "HEADER"; label: string; pos: number }
-
| {
-
section: string;
-
label: string;
-
color: string | null;
-
element: React.FunctionComponent;
-
pos: number;
-
notice?: NoticeProps;
-
_moonlight_submenu?: () => ReactElement | ReactElement[];
-
};
-
-
export type Settings = {
-
ourSections: SettingsSection[];
-
sectionNames: string[];
-
sectionMenuItems: Record<string, ReactElement[]>;
-
-
addSection: (
-
section: string,
-
label: string,
-
element: React.FunctionComponent,
-
color?: string | null,
-
pos?: number,
-
notice?: NoticeProps
-
) => void;
-
addSectionMenuItems: (section: string, ...items: ReactElement[]) => void;
-
-
addDivider: (pos: number | null) => void;
-
addHeader: (label: string, pos: number | null) => void;
-
_mutateSections: (sections: SettingsSection[]) => SettingsSection[];
-
};
-
-
export type CommonComponents = CommonComponents_; // lol
-
+
export * as Spacepack from "./coreExtensions/spacepack";
+
export * as Settings from "./coreExtensions/settings";
export * as Markdown from "./coreExtensions/markdown";
export * as ContextMenu from "./coreExtensions/contextMenu";
-409
packages/types/src/coreExtensions/components.ts
···
-
import type {
-
Component,
-
Ref,
-
PropsWithChildren,
-
PropsWithoutRef,
-
CSSProperties,
-
ReactNode,
-
ReactElement,
-
ComponentClass,
-
ComponentType,
-
MouseEventHandler,
-
KeyboardEventHandler
-
} from "react";
-
import * as CSS from "csstype";
-
-
export enum TextInputSizes {
-
DEFAULT = "inputDefault",
-
MINI = "inputMini"
-
}
-
-
interface TextInput
-
extends ComponentClass<
-
PropsWithoutRef<{
-
value?: string;
-
name?: string;
-
className?: string;
-
inputClassName?: string;
-
inputPrefix?: string;
-
disabled?: boolean;
-
size?: TextInputSizes;
-
editable?: boolean;
-
inputRef?: Ref<any>;
-
prefixElement?: Component;
-
focusProps?: PropsWithoutRef<any>;
-
error?: string;
-
minLength?: number;
-
maxLength?: number;
-
onChange?: (value: string, name: string) => void;
-
onFocus?: (event: any, name: string) => void;
-
onBlur?: (event: any, name: string) => void;
-
}>
-
> {
-
Sizes: typeof TextInputSizes;
-
}
-
-
export enum TextAreaAutoComplete {
-
ON = "on",
-
OFF = "off"
-
}
-
-
export enum TextAreaWrap {
-
HARD = "hard",
-
SOFT = "soft",
-
OFF = "off"
-
}
-
-
interface TextArea
-
extends ComponentClass<
-
PropsWithoutRef<{
-
value?: string;
-
defaultValue?: string;
-
autoComplete?: TextAreaAutoComplete;
-
autoFocus?: boolean;
-
cols?: number;
-
disabled?: boolean;
-
form?: string;
-
maxLength?: number;
-
minLength?: number;
-
name?: string;
-
onChange?: (value: string, name: string) => void;
-
onChangeCapture?: (value: string, name: string) => void;
-
onInput?: (value: string, name: string) => void;
-
onInputCapture?: (value: string, name: string) => void;
-
onInvalid?: (value: string, name: string) => void;
-
onInvalidCapture?: (value: string, name: string) => void;
-
onSelect?: (value: string, name: string) => void;
-
onSelectCapture?: (value: string, name: string) => void;
-
placeholder?: string;
-
readOnly?: boolean;
-
required?: boolean;
-
rows?: number;
-
wrap?: TextAreaWrap;
-
className?: string;
-
}>
-
> {
-
AutoCompletes: typeof TextAreaAutoComplete;
-
Wraps: typeof TextAreaWrap;
-
}
-
-
export enum FormTextTypes {
-
DEFAULT = "default",
-
DESCRIPTION = "description",
-
ERROR = "error",
-
INPUT_PLACEHOLDER = "placeholder",
-
LABEL_BOLD = "labelBold",
-
LABEL_DESCRIPTOR = "labelDescriptor",
-
LABEL_SELECTED = "labelSelected",
-
SUCCESS = "success"
-
}
-
-
interface FormText
-
extends ComponentClass<
-
PropsWithChildren<{
-
type?: FormTextTypes;
-
className?: string;
-
disabled?: boolean;
-
selectable?: boolean;
-
style?: CSSProperties;
-
}>
-
> {
-
Types: FormTextTypes;
-
}
-
-
declare enum SliderMarkerPosition {
-
ABOVE,
-
BELOW
-
}
-
-
declare enum ButtonLooks {
-
FILLED = "lookFilled",
-
INVERTED = "lookInverted",
-
OUTLINED = "lookOutlined",
-
LINK = "lookLink",
-
BLANK = "lookBlank"
-
}
-
declare enum ButtonColors {
-
BRAND = "colorBrand",
-
RED = "colorRed",
-
GREEN = "colorGreen",
-
YELLOW = "colorYellow",
-
PRIMARY = "colorPrimary",
-
LINK = "colorLink",
-
WHITE = "colorWhite",
-
BLACK = "colorBlack",
-
TRANSPARENT = "colorTransparent",
-
BRAND_NEW = "colorBrandNew",
-
CUSTOM = ""
-
}
-
declare enum ButtonBorderColors {
-
BRAND = "borderBrand",
-
RED = "borderRed",
-
GREEN = "borderGreen",
-
YELLOW = "borderYellow",
-
PRIMARY = "borderPrimary",
-
LINK = "borderLink",
-
WHITE = "borderWhite",
-
BLACK = "borderBlack",
-
TRANSPARENT = "borderTransparent",
-
BRAND_NEW = "borderBrandNew"
-
}
-
declare enum ButtonHovers {
-
DEFAULT = "",
-
BRAND = "hoverBrand",
-
RED = "hoverRed",
-
GREEN = "hoverGreen",
-
YELLOW = "hoverYellow",
-
PRIMARY = "hoverPrimary",
-
LINK = "hoverLink",
-
WHITE = "hoverWhite",
-
BLACK = "hoverBlack",
-
TRANSPARENT = "hoverTransparent"
-
}
-
declare enum ButtonSizes {
-
NONE = "",
-
TINY = "sizeTiny",
-
SMALL = "sizeSmall",
-
MEDIUM = "sizeMedium",
-
LARGE = "sizeLarge",
-
XLARGE = "sizeXlarge",
-
MIN = "sizeMin",
-
MAX = "sizeMax",
-
ICON = "sizeIcon"
-
}
-
-
type Button = ComponentType<
-
PropsWithChildren<{
-
look?: ButtonLooks;
-
color?: ButtonColors;
-
borderColor?: ButtonBorderColors;
-
hover?: ButtonHovers;
-
size?: ButtonSizes;
-
fullWidth?: boolean;
-
grow?: boolean;
-
disabled?: boolean;
-
submitting?: boolean;
-
type?: string;
-
style?: CSSProperties;
-
wrapperClassName?: string;
-
className?: string;
-
innerClassName?: string;
-
onClick?: MouseEventHandler;
-
onDoubleClick?: MouseEventHandler;
-
onMouseDown?: MouseEventHandler;
-
onMouseUp?: MouseEventHandler;
-
onMouseEnter?: MouseEventHandler;
-
onMouseLeave?: MouseEventHandler;
-
onKeyDown?: KeyboardEventHandler;
-
rel?: any;
-
buttonRef?: Ref<any>;
-
focusProps?: PropsWithChildren<any>;
-
"aria-label"?: string;
-
submittingStartedLabel?: string;
-
submittingFinishedLabel?: string;
-
}>
-
> & {
-
Looks: typeof ButtonLooks;
-
Colors: typeof ButtonColors;
-
BorderColors: typeof ButtonBorderColors;
-
Hovers: typeof ButtonHovers;
-
Sizes: typeof ButtonSizes;
-
};
-
-
export enum FlexDirection {
-
VERTICAL = "vertical",
-
HORIZONTAL = "horizontal",
-
HORIZONTAL_REVERSE = "horizontalReverse"
-
}
-
-
declare enum FlexAlign {
-
START = "alignStart",
-
END = "alignEnd",
-
CENTER = "alignCenter",
-
STRETCH = "alignStretch",
-
BASELINE = "alignBaseline"
-
}
-
declare enum FlexJustify {
-
START = "justifyStart",
-
END = "justifyEnd",
-
CENTER = "justifyCenter",
-
BETWEEN = "justifyBetween",
-
AROUND = "justifyAround"
-
}
-
declare enum FlexWrap {
-
NO_WRAP = "noWrap",
-
WRAP = "wrap",
-
WRAP_REVERSE = "wrapReverse"
-
}
-
interface Flex
-
extends ComponentClass<
-
PropsWithChildren<{
-
className?: string;
-
direction?: FlexDirection;
-
justify?: FlexJustify;
-
align?: FlexAlign;
-
wrap?: FlexWrap;
-
shrink?: CSS.Property.FlexShrink;
-
grow?: CSS.Property.FlexGrow;
-
basis?: CSS.Property.FlexBasis;
-
style?: CSSProperties;
-
}>
-
> {
-
Direction: typeof FlexDirection;
-
Align: typeof FlexAlign;
-
Justify: typeof FlexJustify;
-
Wrap: typeof FlexWrap;
-
Child: Component<
-
PropsWithChildren<{
-
className?: string;
-
shrink?: CSS.Property.FlexShrink;
-
grow?: CSS.Property.FlexGrow;
-
basis?: CSS.Property.FlexBasis;
-
style?: CSSProperties;
-
wrap?: boolean;
-
}>
-
>;
-
}
-
-
// TODO: wtaf is up with react types not working in jsx
-
export type CommonComponents = {
-
[index: string]: any;
-
Clickable: ComponentClass<
-
PropsWithChildren<{
-
onClick?: () => void;
-
href?: any;
-
onKeyPress?: () => void;
-
ignoreKeyPress?: boolean;
-
innerRef?: Ref<any>;
-
focusProps?: any;
-
tag?: string | Component;
-
role?: any;
-
tabIndex?: any;
-
className?: string;
-
}>
-
>;
-
TextInput: TextInput;
-
TextArea: TextArea;
-
FormDivider: ComponentClass<any>;
-
FormSection: ComponentClass<
-
PropsWithChildren<{
-
className?: string;
-
titleClassName?: string;
-
title?: ReactNode;
-
icon?: ReactNode;
-
disabled?: boolean;
-
htmlFor?: any;
-
tag?: string;
-
}>
-
>;
-
FormText: FormText;
-
FormTitle: ComponentClass<
-
PropsWithChildren<{
-
tag?: string;
-
className?: string;
-
faded?: boolean;
-
disabled?: boolean;
-
required?: boolean;
-
error?: string;
-
}>
-
>;
-
FormSwitch: ComponentClass<PropsWithChildren<any>>;
-
FormItem: ComponentClass<PropsWithChildren<any>>;
-
Slider: ComponentClass<
-
PropsWithChildren<{
-
disabled?: boolean;
-
stickToMarkers?: boolean;
-
className?: string;
-
barStyles?: CSSProperties;
-
fillStyles?: CSSProperties;
-
mini?: boolean;
-
hideBubble?: boolean;
-
initialValue?: number;
-
orientation?: "horizontal" | "vertical";
-
onValueRender?: (value: number) => string;
-
renderMarker?: (marker: number) => ReactNode;
-
getAriaValueText?: (value: number) => string;
-
barClassName?: string;
-
grabberClassName?: string;
-
grabberStyles?: CSSProperties;
-
markerPosition?: SliderMarkerPosition;
-
"aria-hidden"?: "true" | "false";
-
"aria-label"?: string;
-
"aria-labelledby"?: string;
-
"aria-describedby"?: string;
-
minValue?: number;
-
maxValue?: number;
-
asValueChanges?: (value: number) => void;
-
onValueChange?: (value: number) => void;
-
keyboardStep?: number;
-
}>
-
>;
-
Switch: ComponentClass<PropsWithChildren<any>>;
-
Button: Button;
-
Tooltip: ComponentClass<PropsWithChildren<any>>;
-
SmallSlider: Component;
-
Avatar: Component;
-
Scroller: Component;
-
Text: ComponentClass<PropsWithChildren<any>>;
-
Heading: ComponentClass<PropsWithChildren<any>>;
-
LegacyText: Component;
-
Flex: Flex;
-
Card: ComponentClass<PropsWithChildren<any>>;
-
Popout: ComponentClass<PropsWithChildren<any>>;
-
Dialog: ComponentClass<PropsWithChildren<any>>;
-
Menu: ComponentClass<PropsWithChildren<any>>;
-
MenuItem: ComponentClass<PropsWithChildren<any>>;
-
MenuGroup: ComponentClass<PropsWithChildren<any>>;
-
MenuCheckboxItem: ComponentClass<PropsWithChildren<any>>;
-
CardClasses: {
-
card: string;
-
cardHeader: string;
-
};
-
ControlClasses: {
-
container: string;
-
control: string;
-
disabled: string;
-
dividerDefault: string;
-
labelRow: string;
-
note: string;
-
title: string;
-
titleDefault: string;
-
titleMini: string;
-
};
-
MarkdownParser: {
-
parse: (text: string) => ReactElement;
-
};
-
SettingsNotice: React.ComponentType<{
-
submitting: boolean;
-
onReset: () => void;
-
onSave: () => void;
-
}>;
-
TabBar: React.ComponentType<any> & {
-
Item: React.ComponentType<any>;
-
};
-
SingleSelect: React.ComponentType<{
-
autofocus?: boolean;
-
clearable?: boolean;
-
value?: string;
-
options?: {
-
value: string;
-
label: string;
-
}[];
-
onChange?: (value: string) => void;
-
}>;
-
Select: React.ComponentType<{
-
autofocus?: boolean;
-
clearable?: boolean;
-
value?: string[];
-
options?: {
-
value: string;
-
label: string;
-
}[];
-
onChange?: (value: string[]) => void;
-
}>;
-
-
// TODO
-
useVariableSelect: any;
-
multiSelect: any;
-
tokens: any;
-
};
+40
packages/types/src/coreExtensions/settings.ts
···
+
import React, { ReactElement } from "react";
+
import type { Store } from "@moonlight-mod/mappings/discord/packages/flux";
+
+
export type NoticeProps = {
+
stores: Store<any>[];
+
element: React.FunctionComponent;
+
};
+
+
export type SettingsSection =
+
| { section: "DIVIDER"; pos: number }
+
| { section: "HEADER"; label: string; pos: number }
+
| {
+
section: string;
+
label: string;
+
color: string | null;
+
element: React.FunctionComponent;
+
pos: number;
+
notice?: NoticeProps;
+
_moonlight_submenu?: () => ReactElement | ReactElement[];
+
};
+
+
export type Settings = {
+
ourSections: SettingsSection[];
+
sectionNames: string[];
+
sectionMenuItems: Record<string, ReactElement[]>;
+
+
addSection: (
+
section: string,
+
label: string,
+
element: React.FunctionComponent,
+
color?: string | null,
+
pos?: number,
+
notice?: NoticeProps
+
) => void;
+
addSectionMenuItems: (section: string, ...items: ReactElement[]) => void;
+
+
addDivider: (pos: number | null) => void;
+
addHeader: (label: string, pos: number | null) => void;
+
_mutateSections: (sections: SettingsSection[]) => SettingsSection[];
+
};
+32
packages/types/src/coreExtensions/spacepack.ts
···
+
import {
+
WebpackModule,
+
WebpackModuleFunc,
+
WebpackRequireType
+
} from "../discord";
+
+
export type Spacepack = {
+
inspect: (module: number | string) => WebpackModuleFunc | null;
+
findByCode: (...args: (string | RegExp)[]) => any[];
+
findByExports: (...args: string[]) => any[];
+
require: WebpackRequireType;
+
modules: Record<string, WebpackModuleFunc>;
+
cache: Record<string, any>;
+
findObjectFromKey: (exports: Record<string, any>, key: string) => any | null;
+
findObjectFromValue: (exports: Record<string, any>, value: any) => any | null;
+
findObjectFromKeyValuePair: (
+
exports: Record<string, any>,
+
key: string,
+
value: any
+
) => any | null;
+
findFunctionByStrings: (
+
exports: Record<string, any>,
+
...strings: (string | RegExp)[]
+
// eslint-disable-next-line @typescript-eslint/ban-types
+
) => Function | null;
+
lazyLoad: (
+
find: string | RegExp | (string | RegExp)[],
+
chunk: RegExp,
+
module: RegExp
+
) => Promise<any>;
+
filterReal: (modules: WebpackModule[]) => WebpackModule[];
+
};
+10 -10
packages/types/src/discord/require.ts
···
-
import { Spacepack, Settings, CommonComponents } from "../coreExtensions";
import { ContextMenu, EvilItemParser } from "../coreExtensions/contextMenu";
import { Markdown } from "../coreExtensions/markdown";
+
import { Settings } from "../coreExtensions/settings";
+
import { Spacepack } from "../coreExtensions/spacepack";
declare function WebpackRequire(id: string): any;
-
declare function WebpackRequire(id: "spacepack_spacepack"): {
-
default: Spacepack;
-
spacepack: Spacepack;
-
};
-
declare function WebpackRequire(id: "common_components"): CommonComponents;
+
declare function WebpackRequire(id: "contextMenu_evilMenu"): EvilItemParser;
+
declare function WebpackRequire(id: "contextMenu_contextMenu"): ContextMenu;
+
+
declare function WebpackRequire(id: "markdown_markdown"): Markdown;
declare function WebpackRequire(id: "settings_settings"): {
Settings: Settings;
default: Settings;
};
-
declare function WebpackRequire(id: "markdown_markdown"): Markdown;
-
-
declare function WebpackRequire(id: "contextMenu_evilMenu"): EvilItemParser;
-
declare function WebpackRequire(id: "contextMenu_contextMenu"): ContextMenu;
+
declare function WebpackRequire(id: "spacepack_spacepack"): {
+
default: Spacepack;
+
spacepack: Spacepack;
+
};
export default WebpackRequire;
+13 -20
packages/types/src/import.d.ts
···
-
declare module "@moonlight-mod/wp/spacepack_spacepack" {
-
import { CoreExtensions } from "@moonlight-mod/types";
-
export const spacepack: CoreExtensions.Spacepack;
-
export default spacepack;
-
}
+
declare module "@moonlight-mod/wp/common_stores";
-
declare module "@moonlight-mod/wp/common_components" {
+
declare module "@moonlight-mod/wp/contextMenu_evilMenu" {
import { CoreExtensions } from "@moonlight-mod/types";
-
const CommonComponent: CoreExtensions.CommonComponents;
-
export = CommonComponent;
+
const EvilParser: CoreExtensions.ContextMenu.EvilItemParser;
+
export = EvilParser;
}
-
-
declare module "@moonlight-mod/wp/common_stores";
-
-
declare module "@moonlight-mod/wp/settings_settings" {
+
declare module "@moonlight-mod/wp/contextMenu_contextMenu" {
import { CoreExtensions } from "@moonlight-mod/types";
-
export const Settings: CoreExtensions.Settings;
-
export default Settings;
+
const ContextMenu: CoreExtensions.ContextMenu.ContextMenu;
+
export = ContextMenu;
}
declare module "@moonlight-mod/wp/markdown_markdown" {
···
export = Markdown;
}
-
declare module "@moonlight-mod/wp/contextMenu_evilMenu" {
+
declare module "@moonlight-mod/wp/settings_settings" {
import { CoreExtensions } from "@moonlight-mod/types";
-
const EvilParser: CoreExtensions.ContextMenu.EvilItemParser;
-
export = EvilParser;
+
export const Settings: CoreExtensions.Settings.Settings;
+
export default Settings;
}
-
declare module "@moonlight-mod/wp/contextMenu_contextMenu" {
+
declare module "@moonlight-mod/wp/spacepack_spacepack" {
import { CoreExtensions } from "@moonlight-mod/types";
-
const ContextMenu: CoreExtensions.ContextMenu.ContextMenu;
-
export = ContextMenu;
+
export const spacepack: CoreExtensions.Spacepack.Spacepack;
+
export default spacepack;
}
+24
packages/types/src/mappings.d.ts
···
export = _;
}
+
declare module "@moonlight-mod/wp/discord/components/common/index" {
+
import { MappedModules } from "@moonlight-mod/mappings";
+
const _: MappedModules["discord/components/common/index"];
+
export = _;
+
}
+
+
declare module "@moonlight-mod/wp/discord/modules/guild_settings/IntegrationCard.css" {
+
import { MappedModules } from "@moonlight-mod/mappings";
+
const _: MappedModules["discord/modules/guild_settings/IntegrationCard.css"];
+
export = _;
+
}
+
+
declare module "@moonlight-mod/wp/discord/modules/markup/MarkupUtils" {
+
import { MappedModules } from "@moonlight-mod/mappings";
+
const _: MappedModules["discord/modules/markup/MarkupUtils"];
+
export = _;
+
}
+
declare module "@moonlight-mod/wp/discord/packages/flux" {
import { MappedModules } from "@moonlight-mod/mappings";
const _: MappedModules["discord/packages/flux"];
···
const _: MappedModules["discord/packages/react"];
export = _;
}
+
+
declare module "@moonlight-mod/wp/discord/uikit/Flex" {
+
import { MappedModules } from "@moonlight-mod/mappings";
+
const _: MappedModules["discord/uikit/Flex"];
+
export = _;
+
}
+2 -2
packages/web-preload/package.json
···
"private": true,
"dependencies": {
"@moonlight-mod/core": "workspace:*",
-
"@moonlight-mod/types": "workspace:*",
"@moonlight-mod/lunast": "git+https://github.com/moonlight-mod/lunast.git",
+
"@moonlight-mod/mappings": "github:moonlight-mod/mappings",
"@moonlight-mod/moonmap": "git+https://github.com/moonlight-mod/moonmap.git",
-
"@moonlight-mod/mappings": "git+https://github.com/moonlight-mod/mappings.git"
+
"@moonlight-mod/types": "workspace:*"
}
}
+8 -7
pnpm-lock.yaml
···
specifier: git+https://github.com/moonlight-mod/lunast.git
version: https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a
'@moonlight-mod/mappings':
-
specifier: git+https://github.com/moonlight-mod/mappings.git
-
version: https://codeload.github.com/moonlight-mod/mappings/tar.gz/338ef75187c279cdfc5fde117009af8f547e3f12(@moonlight-mod/lunast@https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a)(@moonlight-mod/moonmap@https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d)
+
specifier: github:moonlight-mod/mappings
+
version: https://codeload.github.com/moonlight-mod/mappings/tar.gz/960733f54e9ede10fed567e2d5380defc8dc14cd(@moonlight-mod/lunast@https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a)(@moonlight-mod/moonmap@https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d)
'@moonlight-mod/moonmap':
specifier: git+https://github.com/moonlight-mod/moonmap.git
version: https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d
···
specifier: git+https://github.com/moonlight-mod/lunast.git
version: https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a
'@moonlight-mod/mappings':
-
specifier: git+https://github.com/moonlight-mod/mappings.git
-
version: https://codeload.github.com/moonlight-mod/mappings/tar.gz/338ef75187c279cdfc5fde117009af8f547e3f12(@moonlight-mod/lunast@https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a)(@moonlight-mod/moonmap@https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d)
+
specifier: github:moonlight-mod/mappings
+
version: https://codeload.github.com/moonlight-mod/mappings/tar.gz/960733f54e9ede10fed567e2d5380defc8dc14cd(@moonlight-mod/lunast@https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a)(@moonlight-mod/moonmap@https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d)
'@moonlight-mod/moonmap':
specifier: git+https://github.com/moonlight-mod/moonmap.git
version: https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d
···
resolution: {tarball: https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a}
version: 1.0.0
-
'@moonlight-mod/mappings@https://codeload.github.com/moonlight-mod/mappings/tar.gz/338ef75187c279cdfc5fde117009af8f547e3f12':
-
resolution: {tarball: https://codeload.github.com/moonlight-mod/mappings/tar.gz/338ef75187c279cdfc5fde117009af8f547e3f12}
+
'@moonlight-mod/mappings@https://codeload.github.com/moonlight-mod/mappings/tar.gz/960733f54e9ede10fed567e2d5380defc8dc14cd':
+
resolution: {tarball: https://codeload.github.com/moonlight-mod/mappings/tar.gz/960733f54e9ede10fed567e2d5380defc8dc14cd}
version: 1.0.0
peerDependencies:
'@moonlight-mod/lunast': git+https://github.com/moonlight-mod/lunast.git
···
estree-toolkit: 1.7.8
meriyah: 6.0.1
-
'@moonlight-mod/mappings@https://codeload.github.com/moonlight-mod/mappings/tar.gz/338ef75187c279cdfc5fde117009af8f547e3f12(@moonlight-mod/lunast@https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a)(@moonlight-mod/moonmap@https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d)':
+
'@moonlight-mod/mappings@https://codeload.github.com/moonlight-mod/mappings/tar.gz/960733f54e9ede10fed567e2d5380defc8dc14cd(@moonlight-mod/lunast@https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a)(@moonlight-mod/moonmap@https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d)':
dependencies:
'@moonlight-mod/lunast': https://codeload.github.com/moonlight-mod/lunast/tar.gz/af98b963bf8b6d00301229b094811a55f96eca0a
'@moonlight-mod/moonmap': https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d
'@types/flux': 3.1.14
'@types/react': 18.3.10
+
csstype: 3.1.3
'@moonlight-mod/moonmap@https://codeload.github.com/moonlight-mod/moonmap/tar.gz/ad6ee2686333058e5547b0de3f541549a15e964d': {}