zois-core 1.1.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/dist/changelogs.js +167 -0
- package/dist/core-subscreen/coreSubscreen.js +81 -0
- package/dist/core-subscreen/developmentSubscreen.js +22 -0
- package/dist/core-subscreen/generalSubscreen.js +23 -0
- package/dist/core-subscreen/mainSubscreen.js +58 -0
- package/dist/core-subscreen/shards/coreButtonShard.js +30 -0
- package/dist/core-subscreen/shards/coreCheckboxShard.js +33 -0
- package/dist/core-subscreen/shards/coreInputListShard.js +38 -0
- package/dist/core-subscreen/shards/coreSelectShard.js +17 -0
- package/dist/core-subscreen/shards/coreTextShard.js +9 -0
- package/dist/core-subscreen/shards/index.js +5 -0
- package/dist/core-subscreen/toastsSubscreen.js +112 -0
- package/dist/core.js +178 -0
- package/dist/dialogs.js +110 -0
- package/dist/index.js +202 -1
- package/dist/localization.js +71 -0
- package/dist/logging.js +31 -0
- package/dist/messaging.js +234 -1
- package/dist/modSdk.js +63 -0
- package/dist/shard-modules/attributesModule.js +16 -0
- package/dist/shard-modules/centerModule.js +12 -0
- package/dist/shard-modules/clickModule.js +14 -0
- package/dist/shard-modules/counterUpModule.js +37 -0
- package/dist/shard-modules/dynamicClassModule.js +15 -0
- package/dist/shard-modules/index.js +9 -0
- package/dist/shard-modules/multiClickModule.js +41 -0
- package/dist/shard-modules/shardModule.js +12 -0
- package/dist/shard-modules/styleModule.js +20 -0
- package/dist/shard-modules/typeModule.js +37 -0
- package/dist/shards/backNextButtonShard.js +99 -0
- package/dist/shards/buttonShard.js +118 -0
- package/dist/shards/cardShard.js +35 -0
- package/dist/shards/checkboxShard.js +139 -0
- package/dist/shards/containerShard.js +16 -0
- package/dist/shards/imageShard.js +98 -0
- package/dist/shards/index.js +13 -0
- package/dist/shards/inputListShard.js +162 -0
- package/dist/shards/inputShard.js +33 -0
- package/dist/shards/selectShard.js +126 -0
- package/dist/shards/shard.js +79 -0
- package/dist/shards/svgShard.js +47 -0
- package/dist/shards/tabsShard.js +59 -0
- package/dist/shards/textShard.js +27 -0
- package/dist/styles.css +209 -1
- package/dist/toasts.js +188 -0
- package/dist/types/changelogs.d.ts +1 -0
- package/dist/types/core-subscreen/coreSubscreen.d.ts +15 -0
- package/dist/types/core-subscreen/developmentSubscreen.d.ts +5 -0
- package/dist/types/core-subscreen/generalSubscreen.d.ts +5 -0
- package/dist/types/core-subscreen/mainSubscreen.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreButtonShard.d.ts +5 -0
- package/dist/types/core-subscreen/shards/coreCheckboxShard.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreInputListShard.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreSelectShard.d.ts +5 -0
- package/dist/types/core-subscreen/shards/coreTextShard.d.ts +4 -0
- package/dist/types/core-subscreen/shards/index.d.ts +5 -0
- package/dist/types/core-subscreen/toastsSubscreen.d.ts +5 -0
- package/dist/types/core.d.ts +18 -0
- package/dist/types/dialogs.d.ts +29 -0
- package/dist/types/index.d.ts +55 -3
- package/dist/types/localization.d.ts +4 -0
- package/dist/types/logging.d.ts +16 -0
- package/dist/types/messaging.d.ts +5 -3
- package/dist/types/{modsApi.d.ts → modSdk.d.ts} +2 -2
- package/dist/types/shard-modules/attributesModule.d.ts +7 -0
- package/dist/types/shard-modules/centerModule.d.ts +5 -0
- package/dist/types/shard-modules/clickModule.d.ts +7 -0
- package/dist/types/shard-modules/counterUpModule.d.ts +13 -0
- package/dist/types/shard-modules/dynamicClassModule.d.ts +8 -0
- package/dist/types/{ui-modules → shard-modules}/index.d.ts +2 -0
- package/dist/types/shard-modules/multiClickModule.d.ts +12 -0
- package/dist/types/shard-modules/shardModule.d.ts +7 -0
- package/dist/types/shard-modules/styleModule.d.ts +8 -0
- package/dist/types/shard-modules/typeModule.d.ts +11 -0
- package/dist/types/shards/backNextButtonShard.d.ts +14 -0
- package/dist/types/shards/buttonShard.d.ts +20 -0
- package/dist/types/shards/cardShard.d.ts +10 -0
- package/dist/types/shards/checkboxShard.d.ts +19 -0
- package/dist/types/shards/containerShard.d.ts +7 -0
- package/dist/types/shards/imageShard.d.ts +11 -0
- package/dist/types/shards/index.d.ts +13 -0
- package/dist/types/shards/inputListShard.d.ts +16 -0
- package/dist/types/shards/inputShard.d.ts +14 -0
- package/dist/types/shards/selectShard.d.ts +17 -0
- package/dist/types/shards/shard.d.ts +21 -0
- package/dist/types/shards/svgShard.d.ts +12 -0
- package/dist/types/shards/tabsShard.d.ts +17 -0
- package/dist/types/shards/textShard.d.ts +13 -0
- package/dist/types/toasts.d.ts +21 -0
- package/dist/types/ui.d.ts +30 -147
- package/dist/ui.js +351 -11
- package/dist/validation.js +31 -1
- package/dist/wardrobe.js +167 -1
- package/package.json +44 -26
- package/scripts/generateChangelog.mjs +80 -0
- package/dist/modsApi.js +0 -1
- package/dist/modules.js +0 -1
- package/dist/popups.js +0 -1
- package/dist/types/modules.d.ts +0 -18
- package/dist/types/popups.d.ts +0 -48
- package/dist/types/ui-modules/attributesModule.d.ts +0 -6
- package/dist/types/ui-modules/centerModule.d.ts +0 -4
- package/dist/types/ui-modules/clickModule.d.ts +0 -6
- package/dist/types/ui-modules/counterUpModule.d.ts +0 -12
- package/dist/types/ui-modules/dynamicClassModule.d.ts +0 -7
- package/dist/types/ui-modules/styleModule.d.ts +0 -7
- package/dist/types/ui-modules/typeModule.d.ts +0 -10
- package/dist/ui-modules/attributesModule.js +0 -1
- package/dist/ui-modules/centerModule.js +0 -1
- package/dist/ui-modules/clickModule.js +0 -1
- package/dist/ui-modules/counterUpModule.js +0 -1
- package/dist/ui-modules/dynamicClassModule.js +0 -1
- package/dist/ui-modules/index.js +0 -1
- package/dist/ui-modules/styleModule.js +0 -1
- package/dist/ui-modules/typeModule.js +0 -1
package/README.md
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
](https://github.com/FurryZoi/zois-core/blob/main/LICENSE)
|
|
3
|
+
[](https://badge.fury.io/js/zois-core)
|
|
4
|
+
[](https://www.npmjs.com/package/zois-core)
|
|
5
|
+
|
|
6
|
+
Library for developing mods for BC.\
|
|
7
|
+
It includes the tools that I consider necessary.\
|
|
8
|
+
The library is being developed mostly for personal use in my mods.
|
|
9
|
+
|
|
10
|
+
## Briefly on the library's features
|
|
11
|
+
|
|
12
|
+
* **Mod SDK wrapper**: Wrapper over **Jomshir98**'s [bondage-club-mod-sdk](https://www.npmjs.com/package/bondage-club-mod-sdk) with logging, error handling, flexible typing and other goodies.
|
|
13
|
+
* **Messaging**: Sending and listening hidden messages with clients including built-in validation support.
|
|
14
|
+
* **Logger**: Сentralized logging tool with different levels of importance and automatic formatting.
|
|
15
|
+
* **Changelog generation**: Simple tool for generating changelogs and showing changelog modal window to users.
|
|
16
|
+
* **Localization**: Adapting the mod to multiple languages.
|
|
17
|
+
* **Dialogs**: Modal dialogs for user interaction.
|
|
18
|
+
* **Toasts**: Pop-up notifications with animations that appear on the screen for a short time, there are flexible settings for their theme.
|
|
19
|
+
* **GUI**: Provides reusable and flexibly configurable elements called Shards. They can be modularly configured.
|
|
20
|
+
* **CSS-In-JS**: Creating css classes using JavaScript only.
|
|
21
|
+
* **Themed Support**: Whole UI support **dDeepLb**'s [Themed](https://github.com/dDeepLb/Themed-BC).
|
|
22
|
+
|
|
23
|
+
#### *Perhaps a small instruction with code examples will appear here soon.*
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { MOD_DATA } from ".";
|
|
2
|
+
import { logger } from "./logging";
|
|
3
|
+
import { toastsManager } from "./toasts";
|
|
4
|
+
const avatarsCache = /* @__PURE__ */ new Map();
|
|
5
|
+
class GitHubAPI {
|
|
6
|
+
static baseUrl = "https://api.github.com";
|
|
7
|
+
static getHeaders() {
|
|
8
|
+
const headers = {
|
|
9
|
+
"Accept": "application/vnd.github.v3+json",
|
|
10
|
+
"User-Agent": "GitHubAPI-Client"
|
|
11
|
+
};
|
|
12
|
+
return headers;
|
|
13
|
+
}
|
|
14
|
+
static async getCommit(sha) {
|
|
15
|
+
const effectiveOwner = MOD_DATA.changelog?.owner;
|
|
16
|
+
const effectiveRepo = MOD_DATA.changelog?.repo;
|
|
17
|
+
const url = `${GitHubAPI.baseUrl}/repos/${effectiveOwner}/${effectiveRepo}/commits/${sha}`;
|
|
18
|
+
const response = await fetch(url, {
|
|
19
|
+
method: "GET",
|
|
20
|
+
headers: this.getHeaders()
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
const error = await response.json().catch(() => ({}));
|
|
24
|
+
logger.error(`GitHub API error: ${response.status} ${error.message || response.statusText}`);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return await response.json();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function showChangelogModal() {
|
|
31
|
+
const changelog = MOD_DATA.changelog;
|
|
32
|
+
const id = toastsManager.spinner({
|
|
33
|
+
message: "Preparing changelog..."
|
|
34
|
+
});
|
|
35
|
+
const { data } = changelog;
|
|
36
|
+
const overlay = document.createElement("div");
|
|
37
|
+
overlay.style.cssText = `
|
|
38
|
+
position: fixed;
|
|
39
|
+
top: 0; left: 0; right: 0; bottom: 0;
|
|
40
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
z-index: 10000;
|
|
45
|
+
font-family: ${CommonGetFontName()};
|
|
46
|
+
`;
|
|
47
|
+
const modal = document.createElement("div");
|
|
48
|
+
modal.style.cssText = `
|
|
49
|
+
background: #ffffff;
|
|
50
|
+
color: #1f2937;
|
|
51
|
+
width: 90%;
|
|
52
|
+
max-width: 720px;
|
|
53
|
+
max-height: 85vh;
|
|
54
|
+
border-radius: 12px;
|
|
55
|
+
box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
`;
|
|
60
|
+
const header = document.createElement("div");
|
|
61
|
+
header.style.cssText = `
|
|
62
|
+
padding: 0.65em;
|
|
63
|
+
border-bottom: 1px solid #e5e7eb;
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
align-items: center;
|
|
67
|
+
`;
|
|
68
|
+
const title = document.createElement("h2");
|
|
69
|
+
title.textContent = `Changelog \xB7 ${MOD_DATA.name} v${MOD_DATA.version}`;
|
|
70
|
+
title.style.cssText = "margin: 0; font-size: 1.5rem; font-weight: 600;";
|
|
71
|
+
const closeBtn = document.createElement("button");
|
|
72
|
+
closeBtn.textContent = "\u2715";
|
|
73
|
+
closeBtn.style.cssText = `
|
|
74
|
+
background: none;
|
|
75
|
+
border: none;
|
|
76
|
+
font-size: 1.5rem;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
color: #6b7280;
|
|
79
|
+
padding: 4px 8px;
|
|
80
|
+
border-radius: 6px;
|
|
81
|
+
`;
|
|
82
|
+
closeBtn.onmouseover = () => closeBtn.style.color = "#1f2937";
|
|
83
|
+
closeBtn.onmouseout = () => closeBtn.style.color = "#6b7280";
|
|
84
|
+
header.appendChild(title);
|
|
85
|
+
header.appendChild(closeBtn);
|
|
86
|
+
const content = document.createElement("div");
|
|
87
|
+
content.style.cssText = `
|
|
88
|
+
padding: 16px 24px;
|
|
89
|
+
overflow-y: auto;
|
|
90
|
+
flex: 1;
|
|
91
|
+
`;
|
|
92
|
+
const commitsList = document.createElement("div");
|
|
93
|
+
commitsList.style.display = "flex";
|
|
94
|
+
commitsList.style.flexDirection = "column";
|
|
95
|
+
commitsList.style.gap = "16px";
|
|
96
|
+
for (const commitData of data) {
|
|
97
|
+
const commitElement = await createCommitElement(commitData);
|
|
98
|
+
if (commitElement) commitsList.appendChild(commitElement);
|
|
99
|
+
}
|
|
100
|
+
content.appendChild(commitsList);
|
|
101
|
+
modal.appendChild(header);
|
|
102
|
+
modal.appendChild(content);
|
|
103
|
+
overlay.appendChild(modal);
|
|
104
|
+
document.body.appendChild(overlay);
|
|
105
|
+
overlay.onclick = (e) => {
|
|
106
|
+
if (e.target === overlay) document.body.removeChild(overlay);
|
|
107
|
+
};
|
|
108
|
+
closeBtn.onclick = () => document.body.removeChild(overlay);
|
|
109
|
+
document.addEventListener("keydown", function handler(e) {
|
|
110
|
+
if (e.key === "Escape") {
|
|
111
|
+
document.body.removeChild(overlay);
|
|
112
|
+
document.removeEventListener("keydown", handler);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
toastsManager.removeSpinner(id);
|
|
116
|
+
}
|
|
117
|
+
async function createCommitElement(changelogCommit) {
|
|
118
|
+
try {
|
|
119
|
+
if (!avatarsCache.has(changelogCommit.author)) {
|
|
120
|
+
const githubCommit = await GitHubAPI.getCommit(changelogCommit.hash);
|
|
121
|
+
avatarsCache.set(changelogCommit.author, githubCommit?.author?.avatar_url || githubCommit?.committer?.avatar_url || "https://github.com/identicons/default.png");
|
|
122
|
+
}
|
|
123
|
+
const commitDiv = document.createElement("div");
|
|
124
|
+
commitDiv.style.cssText = `
|
|
125
|
+
display: flex;
|
|
126
|
+
gap: 12px;
|
|
127
|
+
align-items: center;
|
|
128
|
+
padding: 12px;
|
|
129
|
+
border: 1px solid #e5e7eb;
|
|
130
|
+
border-radius: 8px;
|
|
131
|
+
transition: all 0.2s;
|
|
132
|
+
`;
|
|
133
|
+
commitDiv.onmouseover = () => commitDiv.style.borderColor = "#3b82f6";
|
|
134
|
+
commitDiv.onmouseout = () => commitDiv.style.borderColor = "#e5e7eb";
|
|
135
|
+
const avatar = document.createElement("img");
|
|
136
|
+
avatar.src = avatarsCache.get(changelogCommit.author);
|
|
137
|
+
avatar.style.cssText = `
|
|
138
|
+
width: 48px;
|
|
139
|
+
height: 48px;
|
|
140
|
+
border-radius: 50%;
|
|
141
|
+
flex-shrink: 0;
|
|
142
|
+
`;
|
|
143
|
+
const info = document.createElement("div");
|
|
144
|
+
info.style.flex = "1";
|
|
145
|
+
const author = document.createElement("div");
|
|
146
|
+
author.textContent = changelogCommit.author;
|
|
147
|
+
author.style.fontWeight = "600";
|
|
148
|
+
author.style.marginBottom = "4px";
|
|
149
|
+
const message = document.createElement("div");
|
|
150
|
+
message.textContent = changelogCommit.message;
|
|
151
|
+
message.style.cssText = "color: #374151; line-height: 1.4;";
|
|
152
|
+
info.append(author, message);
|
|
153
|
+
commitDiv.style.cursor = "pointer";
|
|
154
|
+
commitDiv.onclick = () => {
|
|
155
|
+
window.open(`https://github.com/${MOD_DATA.changelog.owner}/${MOD_DATA.changelog.repo}/commit/${changelogCommit.hash}`, "_blank");
|
|
156
|
+
};
|
|
157
|
+
commitDiv.appendChild(avatar);
|
|
158
|
+
commitDiv.appendChild(info);
|
|
159
|
+
return commitDiv;
|
|
160
|
+
} catch (err) {
|
|
161
|
+
logger.error(`Failed to load commit ${changelogCommit.hash}:`, err);
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export {
|
|
166
|
+
showChangelogModal
|
|
167
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BaseSubscreen } from "../ui";
|
|
2
|
+
import { CoreButtonShard } from "./shards/coreButtonShard";
|
|
3
|
+
import { StyleModule } from "../shard-modules";
|
|
4
|
+
import { CoreCheckboxShard, CoreInputListShard, CoreSelectShard, CoreTextShard } from "./shards";
|
|
5
|
+
class CoreSubscreen extends BaseSubscreen {
|
|
6
|
+
g = 40;
|
|
7
|
+
h = 0.05;
|
|
8
|
+
interval = null;
|
|
9
|
+
run() {
|
|
10
|
+
DrawRect(0, 0, 2e3, 1e3, "#008600ff");
|
|
11
|
+
for (let x = 0; x <= 2e3; x += this.g) {
|
|
12
|
+
DrawRect(x, 0, 5, 1e3, "#17a117ff");
|
|
13
|
+
}
|
|
14
|
+
for (let y = 0; y <= 1e3; y += this.g) {
|
|
15
|
+
DrawRect(0, y, 2e3, 5, "#17a117ff");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
load() {
|
|
19
|
+
this.createText({
|
|
20
|
+
x: 60,
|
|
21
|
+
y: 40,
|
|
22
|
+
text: this.name,
|
|
23
|
+
fontSize: 6,
|
|
24
|
+
modules: {
|
|
25
|
+
base: [
|
|
26
|
+
new StyleModule({
|
|
27
|
+
fontWeight: "bold"
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
this.createButton({
|
|
33
|
+
anchor: "top-right",
|
|
34
|
+
x: 40,
|
|
35
|
+
y: 40,
|
|
36
|
+
width: 90,
|
|
37
|
+
height: 90,
|
|
38
|
+
icon: "Icons/Exit.png",
|
|
39
|
+
onClick: () => this.exit()
|
|
40
|
+
});
|
|
41
|
+
this.g = 40;
|
|
42
|
+
this.h = 0.05;
|
|
43
|
+
this.interval = setInterval(() => {
|
|
44
|
+
this.g += this.h;
|
|
45
|
+
if (this.g >= 60) this.h = -0.05;
|
|
46
|
+
if (this.g <= 40) this.h = 0.05;
|
|
47
|
+
}, 50);
|
|
48
|
+
}
|
|
49
|
+
createText(ctx) {
|
|
50
|
+
const shard = new CoreTextShard(ctx);
|
|
51
|
+
const htmlElement = shard.mount();
|
|
52
|
+
return htmlElement;
|
|
53
|
+
}
|
|
54
|
+
createButton(ctx) {
|
|
55
|
+
const shard = new CoreButtonShard(ctx);
|
|
56
|
+
const htmlElement = shard.mount();
|
|
57
|
+
return htmlElement;
|
|
58
|
+
}
|
|
59
|
+
createCheckbox(ctx) {
|
|
60
|
+
const shard = new CoreCheckboxShard(ctx);
|
|
61
|
+
const htmlElement = shard.mount();
|
|
62
|
+
return htmlElement;
|
|
63
|
+
}
|
|
64
|
+
createInputList(ctx) {
|
|
65
|
+
const shard = new CoreInputListShard(ctx);
|
|
66
|
+
const htmlElement = shard.mount();
|
|
67
|
+
return htmlElement;
|
|
68
|
+
}
|
|
69
|
+
createSelect(ctx) {
|
|
70
|
+
const shard = new CoreSelectShard(ctx);
|
|
71
|
+
const htmlElement = shard.mount();
|
|
72
|
+
return htmlElement;
|
|
73
|
+
}
|
|
74
|
+
unload() {
|
|
75
|
+
super.unload();
|
|
76
|
+
if (this.interval) clearInterval(this.interval);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
CoreSubscreen
|
|
81
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CoreSubscreen } from "./coreSubscreen";
|
|
2
|
+
class DevelopmentSubscreen extends CoreSubscreen {
|
|
3
|
+
get name() {
|
|
4
|
+
return "Development";
|
|
5
|
+
}
|
|
6
|
+
load() {
|
|
7
|
+
super.load();
|
|
8
|
+
this.createCheckbox({
|
|
9
|
+
x: 60,
|
|
10
|
+
y: 200,
|
|
11
|
+
text: "Auto Connect To Dev Server",
|
|
12
|
+
isChecked: localStorage.getItem("autoConnectToDevServer") === "true",
|
|
13
|
+
onChange: () => {
|
|
14
|
+
const prev = localStorage.getItem("autoConnectToDevServer");
|
|
15
|
+
localStorage.setItem("autoConnectToDevServer", prev === "true" ? "false" : "true");
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
DevelopmentSubscreen
|
|
22
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { coreSettings } from "../core";
|
|
2
|
+
import { CoreSubscreen } from "./coreSubscreen";
|
|
3
|
+
class GeneralSubscreen extends CoreSubscreen {
|
|
4
|
+
get name() {
|
|
5
|
+
return "General";
|
|
6
|
+
}
|
|
7
|
+
load() {
|
|
8
|
+
super.load();
|
|
9
|
+
this.createCheckbox({
|
|
10
|
+
x: 60,
|
|
11
|
+
y: 200,
|
|
12
|
+
text: "Dev Mode",
|
|
13
|
+
isChecked: !!coreSettings.devMode,
|
|
14
|
+
onChange: () => {
|
|
15
|
+
coreSettings.devMode = false;
|
|
16
|
+
delete PreferenceExtensionsSettings.ZOIS_CORE;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
GeneralSubscreen
|
|
23
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BookText, createElement } from "lucide";
|
|
2
|
+
import { GeneralSubscreen } from "./generalSubscreen";
|
|
3
|
+
import { CoreSubscreen } from "./coreSubscreen";
|
|
4
|
+
import { syncSettings } from "../core";
|
|
5
|
+
import { ToastsSubscreen } from "./toastsSubscreen";
|
|
6
|
+
import { DevelopmentSubscreen } from "./developmentSubscreen";
|
|
7
|
+
class MainSubscreen extends CoreSubscreen {
|
|
8
|
+
get name() {
|
|
9
|
+
return "Zoi's Modding Core";
|
|
10
|
+
}
|
|
11
|
+
load() {
|
|
12
|
+
super.load();
|
|
13
|
+
this.createText({
|
|
14
|
+
x: 60,
|
|
15
|
+
y: 120,
|
|
16
|
+
text: "Here are all the experimental settings and settings for developing and debugging my mods."
|
|
17
|
+
});
|
|
18
|
+
[new GeneralSubscreen(), new ToastsSubscreen(), new DevelopmentSubscreen()].forEach((s, i) => {
|
|
19
|
+
this.createButton({
|
|
20
|
+
x: 100,
|
|
21
|
+
y: 240 + 115 * i,
|
|
22
|
+
padding: 2,
|
|
23
|
+
text: s.name,
|
|
24
|
+
width: 600,
|
|
25
|
+
fontSize: 5,
|
|
26
|
+
onClick: () => {
|
|
27
|
+
this.setSubscreen(s);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
this.createButton({
|
|
32
|
+
anchor: "bottom-right",
|
|
33
|
+
x: 40,
|
|
34
|
+
y: 40,
|
|
35
|
+
width: 90,
|
|
36
|
+
height: 90,
|
|
37
|
+
icon: createElement(BookText),
|
|
38
|
+
onClick: () => {
|
|
39
|
+
window.open(`https://github.com/FurryZoi/zois-core`, "_blank");
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
this.createText({
|
|
43
|
+
text: "This place is in WIP stage",
|
|
44
|
+
x: 1e3,
|
|
45
|
+
y: 500,
|
|
46
|
+
fontSize: 6
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exit() {
|
|
50
|
+
super.exit();
|
|
51
|
+
this.setSubscreen(null);
|
|
52
|
+
PreferenceSubscreenExtensionsClear();
|
|
53
|
+
syncSettings();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
MainSubscreen
|
|
58
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ButtonShard } from "../../shards";
|
|
2
|
+
class CoreButtonShard extends ButtonShard {
|
|
3
|
+
get dynamicClassButton() {
|
|
4
|
+
return {
|
|
5
|
+
...super.dynamicClassButton,
|
|
6
|
+
base: {
|
|
7
|
+
...super.dynamicClassButton.base,
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
columnGap: "1.25vw",
|
|
12
|
+
border: "2px solid #33c633",
|
|
13
|
+
outline: "none",
|
|
14
|
+
cursor: "pointer",
|
|
15
|
+
background: "#20a214",
|
|
16
|
+
color: "#004800",
|
|
17
|
+
borderRadius: "0.1em"
|
|
18
|
+
},
|
|
19
|
+
hover: {
|
|
20
|
+
...super.dynamicClassButton.hover,
|
|
21
|
+
background: "#39bd2dff",
|
|
22
|
+
color: "#76ff76ff",
|
|
23
|
+
borderColor: "#76ff76ff"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
CoreButtonShard
|
|
30
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CheckboxShard } from "../../shards";
|
|
2
|
+
class CoreCheckboxShard extends CheckboxShard {
|
|
3
|
+
get dynamicClassInput() {
|
|
4
|
+
return {
|
|
5
|
+
...super.dynamicClassInput,
|
|
6
|
+
base: {
|
|
7
|
+
...super.dynamicClassInput.base,
|
|
8
|
+
border: "var(--border-width) solid #33c633 !important",
|
|
9
|
+
backgroundColor: "#20a214 !important",
|
|
10
|
+
color: "rgb(162, 255, 19) !important"
|
|
11
|
+
},
|
|
12
|
+
hover: {
|
|
13
|
+
...super.dynamicClassInput.hover,
|
|
14
|
+
backgroundColor: "#39bd2dff !important",
|
|
15
|
+
color: "#76ff76ff !important"
|
|
16
|
+
},
|
|
17
|
+
before: {
|
|
18
|
+
...super.dynamicClassInput.before,
|
|
19
|
+
backgroundColor: "rgb(162, 255, 19) !important"
|
|
20
|
+
},
|
|
21
|
+
".zcDisabled": {
|
|
22
|
+
...super.dynamicClassInput[".zcDisabled"],
|
|
23
|
+
backgroundColor: "var(--disabled-color)"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
get textColor() {
|
|
28
|
+
return "rgb(162, 255, 19)";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
CoreCheckboxShard
|
|
33
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { InputListShard } from "../../shards";
|
|
2
|
+
class CoreInputListShard extends InputListShard {
|
|
3
|
+
get dynamicClassContainer() {
|
|
4
|
+
return {
|
|
5
|
+
...super.dynamicClassContainer,
|
|
6
|
+
base: {
|
|
7
|
+
...super.dynamicClassContainer.base,
|
|
8
|
+
background: "#20a214 !important",
|
|
9
|
+
border: "2px solid #33c633"
|
|
10
|
+
},
|
|
11
|
+
"> div:first-child > b": {
|
|
12
|
+
...super.dynamicClassContainer["> div:first-child > b"],
|
|
13
|
+
color: "rgb(155, 255, 0)"
|
|
14
|
+
},
|
|
15
|
+
"> div:last-child > div": {
|
|
16
|
+
...super.dynamicClassContainer["> div:last-child > div"],
|
|
17
|
+
background: "rgb(112, 234, 68)",
|
|
18
|
+
color: "black"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
get dynamicClassToolsButton() {
|
|
23
|
+
return {
|
|
24
|
+
...super.dynamicClassToolsButton,
|
|
25
|
+
base: {
|
|
26
|
+
...super.dynamicClassToolsButton.base,
|
|
27
|
+
background: "rgb(112, 234, 68)",
|
|
28
|
+
color: "black"
|
|
29
|
+
},
|
|
30
|
+
hover: {
|
|
31
|
+
background: "rgb(77, 221, 65)"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
CoreInputListShard
|
|
38
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SelectShard } from "../../shards";
|
|
2
|
+
class CoreSelectShard extends SelectShard {
|
|
3
|
+
get dynamicClassContainer() {
|
|
4
|
+
return {
|
|
5
|
+
...super.dynamicClassContainer,
|
|
6
|
+
base: {
|
|
7
|
+
...super.dynamicClassContainer.base,
|
|
8
|
+
background: "#20a214",
|
|
9
|
+
color: "rgb(162, 255, 19)",
|
|
10
|
+
border: "2px solid #33c633"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
CoreSelectShard
|
|
17
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { CoreSettingsChangedEvent } from "../index";
|
|
2
|
+
import { coreSettings } from "../core";
|
|
3
|
+
import { CoreSubscreen } from "./coreSubscreen";
|
|
4
|
+
import { toastsManager } from "../toasts";
|
|
5
|
+
class ToastsSubscreen extends CoreSubscreen {
|
|
6
|
+
get name() {
|
|
7
|
+
return "Toasts";
|
|
8
|
+
}
|
|
9
|
+
load() {
|
|
10
|
+
super.load();
|
|
11
|
+
this.createCheckbox({
|
|
12
|
+
x: 60,
|
|
13
|
+
y: 200,
|
|
14
|
+
text: "Blacklist Enabled",
|
|
15
|
+
isChecked: !!coreSettings.toasts?.blacklist?.enabled,
|
|
16
|
+
onChange: () => {
|
|
17
|
+
coreSettings.toasts ??= {};
|
|
18
|
+
coreSettings.toasts.blacklist ??= {};
|
|
19
|
+
coreSettings.toasts.blacklist.enabled = !coreSettings.toasts.blacklist.enabled;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
this.createCheckbox({
|
|
23
|
+
x: 60,
|
|
24
|
+
y: 280,
|
|
25
|
+
text: "Prevent Using Single Theme",
|
|
26
|
+
isChecked: !!coreSettings.toasts?.preventUsingSingleTheme,
|
|
27
|
+
onChange: () => {
|
|
28
|
+
coreSettings.toasts ??= {};
|
|
29
|
+
coreSettings.toasts.preventUsingSingleTheme = !coreSettings.toasts.preventUsingSingleTheme;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
this.createText({
|
|
33
|
+
text: "Toasts Position:",
|
|
34
|
+
x: 60,
|
|
35
|
+
y: 380
|
|
36
|
+
});
|
|
37
|
+
this.createSelect({
|
|
38
|
+
x: 400,
|
|
39
|
+
y: 360,
|
|
40
|
+
width: 500,
|
|
41
|
+
options: [
|
|
42
|
+
{
|
|
43
|
+
name: "top-left",
|
|
44
|
+
text: "Top Left"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "top-right",
|
|
48
|
+
text: "Top Right"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "bottom-left",
|
|
52
|
+
text: "Bottom Left"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "bottom-right",
|
|
56
|
+
text: "Bottom Right"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
currentOption: coreSettings.toasts?.position ?? "bottom-left",
|
|
60
|
+
onChange: (pos) => {
|
|
61
|
+
coreSettings.toasts ??= {};
|
|
62
|
+
coreSettings.toasts.position = pos;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
this.createInputList({
|
|
66
|
+
title: "Blacklist",
|
|
67
|
+
x: 1100,
|
|
68
|
+
y: 200,
|
|
69
|
+
width: 800,
|
|
70
|
+
height: 600,
|
|
71
|
+
value: coreSettings.toasts?.blacklist?.content ?? [],
|
|
72
|
+
onChange: (value) => {
|
|
73
|
+
coreSettings.toasts ??= {};
|
|
74
|
+
coreSettings.toasts.blacklist ??= {};
|
|
75
|
+
coreSettings.toasts.blacklist.content = value;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
this.createButton({
|
|
79
|
+
text: "Test",
|
|
80
|
+
x: 60,
|
|
81
|
+
y: 850,
|
|
82
|
+
padding: 1,
|
|
83
|
+
width: 400,
|
|
84
|
+
onClick: () => {
|
|
85
|
+
document.dispatchEvent(new CoreSettingsChangedEvent());
|
|
86
|
+
toastsManager.success({
|
|
87
|
+
title: "Something was completed successfully",
|
|
88
|
+
message: "Message details",
|
|
89
|
+
duration: 8e3
|
|
90
|
+
});
|
|
91
|
+
toastsManager.info({
|
|
92
|
+
title: "Very important announcement",
|
|
93
|
+
message: "You have been informed that you have been informed",
|
|
94
|
+
duration: 8e3
|
|
95
|
+
});
|
|
96
|
+
toastsManager.warn({
|
|
97
|
+
title: "Don't look at me like that",
|
|
98
|
+
message: "You were warned",
|
|
99
|
+
duration: 8e3
|
|
100
|
+
});
|
|
101
|
+
toastsManager.error({
|
|
102
|
+
title: "Critical bug found",
|
|
103
|
+
message: "Catch him!",
|
|
104
|
+
duration: 8e3
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
ToastsSubscreen
|
|
112
|
+
};
|