this repo has no description
1import {
2 SettingsSection,
3 Settings as SettingsType
4} from "@moonlight-mod/types/coreExtensions";
5
6export const Settings: SettingsType = {
7 ourSections: [],
8 sectionNames: [],
9
10 addSection: (section, label, element, color = null, pos, notice) => {
11 const data: SettingsSection = {
12 section,
13 label,
14 color,
15 element,
16 pos: pos ?? -4,
17 notice: notice
18 };
19
20 Settings.ourSections.push(data);
21 Settings.sectionNames.push(label);
22 return data;
23 },
24
25 addDivider: (pos = null) => {
26 Settings.ourSections.push({
27 section: "DIVIDER",
28 pos: pos === null ? -4 : pos
29 });
30 },
31
32 addHeader: function (label, pos = null) {
33 Settings.ourSections.push({
34 section: "HEADER",
35 label: label,
36 pos: pos === null ? -4 : pos
37 });
38 },
39
40 _mutateSections: (sections) => {
41 for (const section of Settings.ourSections) {
42 sections.splice(
43 section.pos < 0 ? sections.length + section.pos : section.pos,
44 0,
45 section
46 );
47 }
48
49 return sections;
50 }
51};
52
53export default Settings;