···11export type AppPanels = {
22+ /**
33+ * Registers a new panel to be displayed around the user/voice controls.
44+ * @param section A unique name for your section
55+ * @param element A React component
66+ */
27 addPanel: (section: string, element: React.FC<any>) => void;
88+99+ /**
1010+ * @private
1111+ */
312 getPanels: (el: React.FC<any>) => React.ReactNode;
413};
+7
packages/types/src/coreExtensions/contextMenu.ts
···1010} from "@moonlight-mod/mappings/discord/components/common/index";
11111212export type ContextMenu = {
1313+ /**
1414+ * Registers a new context menu item for a given context menu type.
1515+ * @param navId The navigation ID for the target context menu (e.g. "user-context", "message")
1616+ * @param item A React component
1717+ * @param anchorId An existing item's ID to anchor the new item to
1818+ * @param before Whether to insert the new item before the anchor item
1919+ */
1320 addItem: (navId: string, item: React.FC<any>, anchorId: string, before?: boolean) => void;
14211522 MenuCheckboxItem: MenuCheckboxItem;
+15
packages/types/src/coreExtensions/markdown.ts
···8282 slateDecorators: Record<string, string>;
8383 ruleBlacklists: Record<Ruleset, Record<string, boolean>>;
84848585+ /**
8686+ * Registers a new Markdown rule with simple-markdown.
8787+ * @param name The name of the rule
8888+ * @param markdown A function that returns simple-markdown rules
8989+ * @param slate A function that returns Slate rules
9090+ * @param decorator A decorator name for Slate
9191+ * @see https://www.npmjs.com/package/simple-markdown#adding-a-simple-extension
9292+ * @see https://docs.slatejs.org/
9393+ */
8594 addRule: (
8695 name: string,
8796 markdown: (rules: Record<string, MarkdownRule>) => MarkdownRule,
8897 slate: (rules: Record<string, SlateRule>) => SlateRule,
8998 decorator?: string | undefined
9099 ) => void;
100100+101101+ /**
102102+ * Blacklist a rule from a ruleset.
103103+ * @param ruleset The ruleset name
104104+ * @param name The rule name
105105+ */
91106 blacklistFromRuleset: (ruleset: Ruleset, name: string) => void;
92107};
+7
packages/types/src/coreExtensions/moonbase.ts
···44}>;
5566export type Moonbase = {
77+ /**
88+ * Registers a custom component for an extension setting.
99+ * The extension setting must be of type "custom".
1010+ * @param ext The extension ID
1111+ * @param option The setting ID
1212+ * @param component A React component
1313+ */
714 registerConfigComponent: (ext: string, option: string, component: CustomComponent) => void;
815};
+15
packages/types/src/coreExtensions/notices.ts
···1414};
15151616export type Notices = Store<any> & {
1717+ /**
1818+ * Adds a custom notice to the top of the screen.
1919+ */
1720 addNotice: (notice: Notice) => void;
2121+2222+ /**
2323+ * Removes the current notice from the top of the screen.
2424+ */
1825 popNotice: () => void;
2626+2727+ /**
2828+ * @private
2929+ */
1930 getCurrentNotice: () => Notice | null;
3131+3232+ /**
3333+ * @private
3434+ */
2035 shouldShowNotice: () => boolean;
2136};
+28
packages/types/src/coreExtensions/settings.ts
···2424 sectionNames: string[];
2525 sectionMenuItems: Record<string, ReactElement[]>;
26262727+ /**
2828+ * Registers a new section in the settings menu.
2929+ * @param section The section ID
3030+ * @param label The label for the section
3131+ * @param element The React component to render
3232+ * @param color A color to use for the section
3333+ * @param pos The position in the settings menu to place the section
3434+ * @param notice A notice to display when in the section
3535+ */
2736 addSection: (
2837 section: string,
2938 label: string,
···3241 pos?: number,
3342 notice?: NoticeProps
3443 ) => void;
4444+4545+ /**
4646+ * Adds new items to a section in the settings menu.
4747+ * @param section The section ID
4848+ * @param items The React components to render
4949+ */
3550 addSectionMenuItems: (section: string, ...items: ReactElement[]) => void;
36515252+ /**
5353+ * Places a divider in the settings menu.
5454+ * @param pos The position in the settings menu to place the divider
5555+ */
3756 addDivider: (pos: number | null) => void;
5757+5858+ /**
5959+ * Places a header in the settings menu.
6060+ * @param pos The position in the settings menu to place the header
6161+ */
3862 addHeader: (label: string, pos: number | null) => void;
6363+6464+ /**
6565+ * @private
6666+ */
3967 _mutateSections: (sections: SettingsSection[]) => SettingsSection[];
4068};
+57-5
packages/types/src/coreExtensions/spacepack.ts
···11import { WebpackModule, WebpackModuleFunc, WebpackRequireType } from "../discord";
2233-// Only bothered TSDoc'ing the hard-to-understand functions
44-53export type Spacepack = {
44+ /**
55+ * Given a Webpack module ID, returns the function for the Webpack module.
66+ * Can be double clicked to inspect in DevTools.
77+ * @param module The module ID
88+ * @returns The Webpack module, if found
99+ */
610 inspect: (module: number | string) => WebpackModuleFunc | null;
1111+1212+ /**
1313+ * Find Webpack modules based on matches in code.
1414+ * @param args A list of finds to match against
1515+ * @returns The Webpack modules, if found
1616+ */
717 findByCode: (...args: (string | RegExp)[]) => WebpackModule[];
1818+1919+ /**
2020+ * Find Webpack modules based on their exports.
2121+ * @param args A list of finds to match exports against
2222+ * @returns The Webpack modules, if found
2323+ */
824 findByExports: (...args: string[]) => WebpackModule[];
99- // re-export of require
2525+2626+ /**
2727+ * The Webpack require function.
2828+ */
1029 require: WebpackRequireType;
1111- // re-export of require.m
3030+3131+ /**
3232+ * The Webpack module list.
3333+ * Re-export of require.m.
3434+ */
1235 modules: Record<string, WebpackModuleFunc>;
1313- // re-export of require.c
3636+3737+ /**
3838+ * The Webpack module cache.
3939+ * Re-export of require.c.
4040+ */
1441 cache: Record<string, any>;
4242+4343+ /**
4444+ * Finds an object from a module's exports using the given key.
4545+ * @param exports Exports from a Webpack module
4646+ * @param key The key to find with
4747+ * @returns The object, if found
4848+ */
1549 findObjectFromKey: (exports: Record<string, any>, key: string) => any | null;
5050+5151+ /**
5252+ * Finds an object from a module's exports using the given value.
5353+ * @param exports Exports from a Webpack module
5454+ * @param value The value to find with
5555+ * @returns The object, if found
5656+ */
1657 findObjectFromValue: (exports: Record<string, any>, value: any) => any | null;
5858+5959+ /**
6060+ * Finds an object from a module's exports using the given key-value pair.
6161+ * @param exports Exports from a Webpack module
6262+ * @param key The key to find with
6363+ * @param value The value to find with
6464+ * @returns The object, if found
6565+ */
1766 findObjectFromKeyValuePair: (exports: Record<string, any>, key: string, value: any) => any | null;
6767+1868 /**
1969 * Finds a function from a module's exports using the given source find.
2070 * This behaves like findByCode but localized to the exported function.
···2777 ...strings: (string | RegExp)[]
2878 // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2979 ) => Function | null;
8080+3081 /**
3182 * Lazy load a Webpack module.
3283 * @param find A list of finds to discover a target module with
···3586 * @returns The target Webpack module
3687 */
3788 lazyLoad: (find: string | RegExp | (string | RegExp)[], chunk: RegExp, module: RegExp) => Promise<any>;
8989+3890 /**
3991 * Filter a list of Webpack modules to "real" ones from the Discord client.
4092 * @param modules A list of Webpack modules