zois-core 1.0.3 → 1.0.5

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 CHANGED
@@ -1,19 +1,19 @@
1
1
  ⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2
- ⠀⠀⠀⠀⠀⡟⠈⠛⢦⣄⠀⠀⠀⠀⠀⣀⡴⠚⠩⠘⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀
3
- ⠀⠀⠀⠀⠀⣧⠀⡀⠄⠈⠛⠛⠛⠛⢛⠁⠌⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀
4
- ⠀⠀⠀⠀⠀⣿⠞⠁⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀
5
- ⠀⠀⠀⠀⣼⠃⢠⠤⢤⠀⠀⠀⠀⢀⡤⢤⡀⠀⠀⠀⠘⣧⠀⠀⠀⠀⠀⠀⠀⠀
6
- ⠀⢀⣤⣤⣧⡄⠀⠀⠀⠀⣤⡀⠀⠀⠀⠀⠁⣤⣤⣤⣤⣼⣦⡄⠀⠀⠀⠀⠀⠀
7
- ⠀⢀⣠⡤⣷⠶⠀⠀⠀⠦⠜⠤⠄⠀⠀⠀⠰⠦⣤⣄⣀⣸⠃⠀⠀⠀⠀⠀⠀⠀
8
- ⠀⠀⠀⠀⠘⢧⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣽⣋⠁⠀⠀⠀⠀⠀
9
- ⠀⠀⠀⠀⠀⠀⠈⠙⢳⡶⠶⠶⠶⠶⠶⠶⠖⠛⠛⠍⠀⠉⠛⣷⣤⡀⠀⠀⠀⠀
10
- ⠀⠀⠀⠀⠀⠀⠀⢠⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣦⡀⠀⠀
11
- ⠀⠀⠀⠀⠀⠀⠀⣾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢷⡀⠀
12
- ⠀⠀⠀⠀⠀⠀⠀⣏⠀⠀⠀⠀⢠⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀
13
- ⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⠀⠀⣿⠀⠀⠀⠀⢠⡾⠋⠁⠀⠀⠀⠀⠀⠀⢸⡇⠀
14
- ⠀⠀⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⣿⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠃⠀
15
- ⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⣀⣠⣼⣧⣀⣀⣰⣟⡀⠀⠀⠀⠀⠀⢀⣀⣼⢿⡀⠀
16
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣟⠁⠀⠉⠉⠉⠉⠙⠛⠛⠛⠻⠿⠛⠛⠉⠁⣼⠁⠀
17
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⡴⠞⠁⠀⠀
2
+ ⠀⠀⠀⠀⠀⡟⠈⠛⢦⣄⠀⠀⠀⠀⠀⣀⡴⠚⠩⠘⡇⠀⠀
3
+ ⠀⠀⠀⠀⠀⣧⠀⡀⠄⠈⠛⠛⠛⠛⢛⠁⠌⠀⠀⠀⡇⠀⠀
4
+ ⠀⠀⠀⠀⠀⣿⠞⠁⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣧
5
+ ⠀⠀⠀⠀⣼⠃⢠⠤⢤⠀⠀⠀⠀⢀⡤⢤⡀⠀⠀⠀⠘⣧
6
+ ⠀⢀⣤⣤⣧⡄⠀⠀⠀⠀⣤⡀⠀⠀⠀⠀⠁⣤⣤⣤⣤⣼⣦⡄
7
+ ⠀⢀⣠⡤⣷⠶⠀⠀⠀⠦⠜⠤⠄⠀⠀⠀⠰⠦⣤⣄⣀⣸⠃
8
+ ⠀⠀⠀⠀⠘⢧⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣽⣋⠁
9
+ ⠀⠀⠀⠀⠀⠀⠈⠙⢳⡶⠶⠶⠶⠶⠶⠶⠖⠛⠛⠍⠀⠉⠛
10
+ ⠀⠀⠀⠀⠀⠀⠀⢠⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣦⡀
11
+ ⠀⠀⠀⠀⠀⠀⠀⣾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢷⡀
12
+ ⠀⠀⠀⠀⠀⠀⠀⣏⠀⠀⠀⠀⢠⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇
13
+ ⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⠀⠀⣿⠀⠀⠀⠀⢠⡾⠋⠁⠀⠀⠀⠀⠀⠀⢸⡇
14
+ ⠀⠀⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⣿⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠃
15
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⣀⣠⣼⣧⣀⣀⣰⣟⡀⠀⠀⠀⠀⠀⢀⣀⣼⢿⡀
16
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣟⠁⠀⠉⠉⠉⠉⠙⠛⠛⠛⠻⠿⠛⠛⠉⠁⣼⠁
17
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⡴⠞⠁
18
18
 
19
19
  ## The core for the my mods, which contains a shared code reused in all my mods
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ interface ModData {
6
6
  repository?: string;
7
7
  chatMessageBackground?: string;
8
8
  chatMessageColor?: string;
9
+ fontFamily?: string;
9
10
  }
10
11
  export declare let MOD_DATA: ModData;
11
12
  export declare function registerCore(modData: ModData): void;
@@ -1,5 +1,13 @@
1
- export declare function chatSendLocal(message: string | Node): void;
1
+ interface RequestResponse<T> {
2
+ data?: T;
3
+ isError: boolean;
4
+ }
5
+ export declare function chatSendLocalMessage(message: string | Node): void;
2
6
  export declare function chatSendActionMessage(msg: string, target?: undefined | number, dictionary?: ChatMessageDictionaryEntry[]): void;
3
7
  export declare function chatSendModMessage<T>(msg: string, _data?: T, targetNumber?: any): void;
4
- export declare function chatSendBeep(data: any, targetId: number): void;
8
+ export declare function chatSendBeepMessage(data: any, targetId: number): void;
9
+ export declare function sendRequest<T>(message: string, data: any, target: number): Promise<RequestResponse<T>>;
5
10
  export declare function handleRequestResponse(requestId: number, data: any): void;
11
+ export declare function handleRequest(requestId: number, message: string, _data: any, sender: Character): void;
12
+ export declare function addRequestListener(message: string, listener: (data: any, sender: Character) => any): void;
13
+ export {};
package/dist/messaging.js CHANGED
@@ -1,6 +1,7 @@
1
- import { MOD_DATA } from "./index";
1
+ import { getRandomNumber, MOD_DATA } from "./index";
2
2
  const pendingRequests = /* @__PURE__ */ new Map();
3
- function chatSendLocal(message) {
3
+ const requestListeners = /* @__PURE__ */ new Map();
4
+ function chatSendLocalMessage(message) {
4
5
  if (!ServerPlayerIsInChatRoom()) return;
5
6
  const div = document.createElement("div");
6
7
  div.setAttribute("class", "ChatMessage ChatMessageLocalMessage");
@@ -45,7 +46,7 @@ function chatSendModMessage(msg, _data = null, targetNumber = null) {
45
46
  if (targetNumber) data.Target = targetNumber;
46
47
  ServerSend("ChatRoomChat", data);
47
48
  }
48
- function chatSendBeep(data, targetId) {
49
+ function chatSendBeepMessage(data, targetId) {
49
50
  const beep = {
50
51
  IsSecret: true,
51
52
  BeepType: "Leash",
@@ -57,6 +58,29 @@ function chatSendBeep(data, targetId) {
57
58
  };
58
59
  ServerSend("AccountBeep", beep);
59
60
  }
61
+ function sendRequest(message, data, target) {
62
+ return new Promise((resolve, reject) => {
63
+ const requestId = parseInt(`${Date.now()}${getRandomNumber(1e3, 1e4)}`);
64
+ pendingRequests.set(requestId, {
65
+ message,
66
+ data,
67
+ target,
68
+ resolve,
69
+ reject
70
+ });
71
+ chatSendModMessage("request", {
72
+ requestId,
73
+ message,
74
+ data
75
+ }, target);
76
+ setTimeout(() => {
77
+ pendingRequests.delete(requestId);
78
+ resolve({
79
+ isError: true
80
+ });
81
+ }, 6e3);
82
+ });
83
+ }
60
84
  function handleRequestResponse(requestId, data) {
61
85
  const request = pendingRequests.get(requestId);
62
86
  if (!request) return;
@@ -64,10 +88,28 @@ function handleRequestResponse(requestId, data) {
64
88
  data
65
89
  });
66
90
  }
91
+ function handleRequest(requestId, message, _data, sender) {
92
+ const listener = requestListeners.get(message);
93
+ if (!listener) return;
94
+ const data = listener(_data, sender);
95
+ if (data !== void 0) {
96
+ chatSendModMessage("requestResponse", {
97
+ requestId,
98
+ message,
99
+ data
100
+ }, sender.MemberNumber);
101
+ }
102
+ }
103
+ function addRequestListener(message, listener) {
104
+ requestListeners.set(message, listener);
105
+ }
67
106
  export {
107
+ addRequestListener,
68
108
  chatSendActionMessage,
69
- chatSendBeep,
70
- chatSendLocal,
109
+ chatSendBeepMessage,
110
+ chatSendLocalMessage,
71
111
  chatSendModMessage,
72
- handleRequestResponse
112
+ handleRequest,
113
+ handleRequestResponse,
114
+ sendRequest
73
115
  };
package/dist/modsApi.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import bcModSdk from "bondage-club-mod-sdk";
2
- import { MOD_DATA } from "./index";
2
+ import { getPlayer, MOD_DATA } from "./index";
3
3
  import { getCurrentSubscreen } from "./ui";
4
+ import { handleRequest, handleRequestResponse } from "./messaging";
4
5
  var HookPriority = /* @__PURE__ */ ((HookPriority2) => {
5
6
  HookPriority2[HookPriority2["OBSERVE"] = 0] = "OBSERVE";
6
7
  HookPriority2[HookPriority2["ADD_BEHAVIOR"] = 1] = "ADD_BEHAVIOR";
@@ -21,6 +22,23 @@ function registerMod() {
21
22
  if (CommonKey.IsPressed(args[0], "Escape") && getCurrentSubscreen()) getCurrentSubscreen().exit();
22
23
  return next(args);
23
24
  });
25
+ hookFunction("ChatRoomMessage", 1 /* ADD_BEHAVIOR */, (args, next) => {
26
+ const message = args[0];
27
+ const sender = getPlayer(message.Sender);
28
+ if (!sender) return next(args);
29
+ if (message.Content === MOD_DATA.key && !sender.IsPlayer()) {
30
+ const msg = message.Dictionary.msg;
31
+ const data = message.Dictionary.data;
32
+ if (msg === "request") {
33
+ if (typeof data.requestId !== "number" || typeof data.message !== "string") return;
34
+ handleRequest(data.requestId, data.message, data.data, sender);
35
+ }
36
+ if (msg === "requestResponse") {
37
+ if (typeof data.requestId !== "number") return;
38
+ handleRequestResponse(data.requestId, data.data);
39
+ }
40
+ }
41
+ });
24
42
  }
25
43
  function hookFunction(functionName, priority, hook) {
26
44
  if (!modSdk) throw new Error("zois-core is not registered");
package/dist/styles.css CHANGED
@@ -1,4 +1,3 @@
1
- @import "https://fonts.googleapis.com/css2?family=Emilys+Candy&display=swap";
2
1
  * {
3
2
  margin: 0;
4
3
  padding: 0;
@@ -7,7 +6,6 @@
7
6
  .zcButton {
8
7
  cursor: pointer;
9
8
  background: var(--tmd-element, white);
10
- font-family: "Emilys Candy";
11
9
  color: var(--tmd-text, black);
12
10
  border: 2px solid var(--tmd-accent, black);
13
11
  border-radius: 4px;
@@ -17,6 +15,28 @@
17
15
  border-color: var(--tmd-accent-hover, #7dd3fc);
18
16
  color: var(--tmd-accent-hover, #015a8c);
19
17
  }
18
+ .zcButton .tooltip {
19
+ position: absolute;
20
+ color: black;
21
+ text-align: center;
22
+ padding: 4px;
23
+ border-radius: 4px;
24
+ background: #FFFF88;
25
+ border: 2px solid #e7e787;
26
+ width: max-content;
27
+ min-height: 100%;
28
+ visibility: hidden;
29
+ z-index: 10;
30
+ }
31
+ .zcButton .tooltip[position=left] {
32
+ right: calc(100% + 1vw);
33
+ }
34
+ .zcButton .tooltip[position=right] {
35
+ left: calc(100% + 1vw);
36
+ }
37
+ .zcButton:hover .tooltip {
38
+ visibility: visible;
39
+ }
20
40
  .zcButton[data-zc-style=green] {
21
41
  background: rgb(124, 255, 124);
22
42
  border-color: rgb(82, 204, 82);
@@ -36,7 +56,6 @@
36
56
  }
37
57
  .zcInput {
38
58
  background: var(--tmd-element, white);
39
- font-family: Emilys Candy;
40
59
  color: var(--tmd-text, black);
41
60
  padding: 2vw;
42
61
  border: 2px solid var(--tmd-accent, black);
@@ -51,7 +70,6 @@
51
70
  justify-content: center;
52
71
  align-items: center;
53
72
  background: var(--tmd-element, white);
54
- font-family: Emilys Candy;
55
73
  color: var(--tmd-text, black);
56
74
  border: 2px solid var(--tmd-accent, black);
57
75
  border-radius: 4px;
package/dist/ui.d.ts CHANGED
@@ -13,6 +13,10 @@ interface CreateButtonArgs {
13
13
  icon?: string;
14
14
  iconAbsolutePosition?: boolean;
15
15
  iconWidth?: string;
16
+ tooltip?: {
17
+ text: string;
18
+ position: "left" | "right";
19
+ };
16
20
  onClick?: () => void;
17
21
  isDisabled?: () => boolean;
18
22
  }
@@ -93,6 +97,7 @@ interface CreateBackNextButtonArgs {
93
97
  height: number;
94
98
  items: [string, any?][];
95
99
  currentIndex: number;
100
+ isBold?: boolean;
96
101
  anchor?: Anchor;
97
102
  onChange?: (value: any) => void;
98
103
  isDisabled?: () => boolean;
@@ -113,14 +118,14 @@ export declare abstract class BaseSubscreen {
113
118
  update?(): void;
114
119
  setPreviousSubscreen(): void;
115
120
  setSubscreen(subscreen: BaseSubscreen | null): void;
116
- createButton({ text, x, y, width, height, fontSize, anchor, padding, style, place, icon, iconAbsolutePosition, iconWidth, onClick, isDisabled }: CreateButtonArgs): HTMLButtonElement;
121
+ createButton({ text, x, y, width, height, fontSize, anchor, padding, style, place, icon, iconAbsolutePosition, iconWidth, tooltip, onClick, isDisabled }: CreateButtonArgs): HTMLButtonElement;
117
122
  createText({ text, color, x, y, width, height, withBackground, fontSize, anchor, padding, place }: CreateTextArgs): HTMLParagraphElement;
118
123
  createInput({ value, placeholder, x, y, width, height, textArea, fontSize, anchor, padding, place, onChange, onInput, isDisabled }: CreateInputArgs): HTMLInputElement | HTMLTextAreaElement;
119
124
  createCheckbox({ text, x, y, isChecked, width, anchor, place, isDisabled, onChange }: CreateCheckboxArgs): HTMLInputElement;
120
125
  createScrollView({ scroll, x, y, width, height, anchor }: CreateScrollViewArgs): HTMLDivElement;
121
126
  createInputList({ x, y, width, height, title, value, anchor, place, numbersOnly, isDisabled, onChange }: CreateInputListArgs): HTMLDivElement;
122
127
  createImage({ x, y, width, src, }: CreateImageArgs): HTMLImageElement;
123
- createBackNextButton({ x, y, width, height, items, currentIndex, onChange, isDisabled }: CreateBackNextButtonArgs): HTMLDivElement;
128
+ createBackNextButton({ x, y, width, height, items, currentIndex, isBold, onChange, isDisabled }: CreateBackNextButtonArgs): HTMLDivElement;
124
129
  }
125
130
  export declare function hookSubscreen(subscreenName: string, hook: (subscreen: BaseSubscreen) => void): void;
126
131
  export {};
package/dist/ui.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { MOD_DATA } from "./index";
1
2
  function getRelativeHeight(height) {
2
3
  return height * (MainCanvas.canvas.clientHeight / 1e3);
3
4
  }
@@ -38,6 +39,9 @@ function setFontSize(element, targetFontSize) {
38
39
  fontSize: fontSize + "px"
39
40
  });
40
41
  }
42
+ function setFontFamily(element, fontFamily) {
43
+ element.style.fontFamily = fontFamily ?? "sans-serif";
44
+ }
41
45
  function setPadding(element, targetPadding) {
42
46
  const canvasWidth = MainCanvas.canvas.clientWidth;
43
47
  const canvasHeight = MainCanvas.canvas.clientHeight;
@@ -128,6 +132,7 @@ class BaseSubscreen {
128
132
  icon,
129
133
  iconAbsolutePosition = true,
130
134
  iconWidth,
135
+ tooltip,
131
136
  onClick,
132
137
  isDisabled
133
138
  }) {
@@ -138,6 +143,7 @@ class BaseSubscreen {
138
143
  btn.style.alignItems = "center";
139
144
  btn.style.justifyContent = "center";
140
145
  btn.style.columnGap = "1.25vw";
146
+ setFontFamily(btn, MOD_DATA.fontFamily);
141
147
  if (icon) {
142
148
  const img = document.createElement("img");
143
149
  img.src = icon;
@@ -159,6 +165,13 @@ class BaseSubscreen {
159
165
  }
160
166
  btn.append(span);
161
167
  }
168
+ if (tooltip) {
169
+ const tooltipEl = document.createElement("span");
170
+ tooltipEl.classList.add("tooltip");
171
+ tooltipEl.setAttribute("position", tooltip.position);
172
+ tooltipEl.textContent = tooltip.text;
173
+ btn.append(tooltipEl);
174
+ }
162
175
  const setProperties = () => {
163
176
  if (typeof x === "number" && typeof y === "number") setPosition(btn, x, y, anchor);
164
177
  setSize(btn, width, height);
@@ -172,7 +185,7 @@ class BaseSubscreen {
172
185
  if (typeof isDisabled === "function" && !isDisabled() && typeof onClick === "function") {
173
186
  onClick();
174
187
  }
175
- if (isDisabled() && !btn.classList.contains("zcDisabled")) btn.classList.add("zcDisabled");
188
+ if (typeof isDisabled === "function" && isDisabled()) btn.classList.add("zcDisabled");
176
189
  });
177
190
  window.addEventListener("resize", setProperties);
178
191
  if (place) document.body.append(btn);
@@ -197,7 +210,7 @@ class BaseSubscreen {
197
210
  p.innerHTML = text;
198
211
  p.style.color = color ?? "var(--tmd-text, black)";
199
212
  if (withBackground) p.style.background = "var(--tmd-element,rgb(239, 239, 239))";
200
- p.style.fontFamily = "Emilys Candy";
213
+ setFontFamily(p, MOD_DATA.fontFamily);
201
214
  const setProperties = () => {
202
215
  if (typeof x === "number" && typeof y === "number") setPosition(p, x, y, anchor);
203
216
  setSize(p, width, height);
@@ -232,6 +245,7 @@ class BaseSubscreen {
232
245
  input.classList.add("zcInput");
233
246
  if (placeholder) input.placeholder = placeholder;
234
247
  if (value) input.value = value;
248
+ setFontFamily(input, MOD_DATA.fontFamily);
235
249
  const setProperties = () => {
236
250
  if (typeof x === "number" && typeof y === "number") setPosition(input, x, y, anchor);
237
251
  setSize(input, width, height);
@@ -242,16 +256,12 @@ class BaseSubscreen {
242
256
  setProperties();
243
257
  if (typeof isDisabled === "function" && isDisabled()) input.classList.add("zcDisabled");
244
258
  input.addEventListener("change", () => {
245
- if (typeof isDisabled === "function" && !isDisabled() && typeof onChange === "function") {
246
- onChange();
247
- }
248
- if (isDisabled() && !input.classList.contains("zcDisabled")) input.classList.add("zcDisabled");
259
+ if (typeof isDisabled === "function" && isDisabled()) return input.classList.add("zcDisabled");
260
+ if (typeof onChange === "function") onChange();
249
261
  });
250
262
  input.addEventListener("input", () => {
251
- if (typeof isDisabled === "function" && !isDisabled() && typeof onInput === "function") {
252
- onInput();
253
- }
254
- if (isDisabled() && !input.classList.contains("zcDisabled")) input.classList.add("zcDisabled");
263
+ if (typeof isDisabled === "function" && isDisabled()) return input.classList.add("zcDisabled");
264
+ if (typeof onInput === "function") onInput();
255
265
  });
256
266
  window.addEventListener("resize", setProperties);
257
267
  if (place) document.body.append(input);
@@ -277,7 +287,7 @@ class BaseSubscreen {
277
287
  const p = document.createElement("p");
278
288
  p.textContent = text;
279
289
  p.style.color = "var(--tmd-text, black)";
280
- p.style.fontFamily = "Emilys Candy";
290
+ setFontFamily(p, MOD_DATA.fontFamily);
281
291
  const setProperties = () => {
282
292
  if (typeof x === "number" && typeof y === "number") setPosition(checkbox, x, y, anchor);
283
293
  setPosition(p, x + 100, y, anchor);
@@ -288,10 +298,8 @@ class BaseSubscreen {
288
298
  setProperties();
289
299
  if (typeof isDisabled === "function" && isDisabled()) checkbox.classList.add("zcDisabled");
290
300
  checkbox.addEventListener("change", () => {
291
- if (typeof isDisabled === "function" && !isDisabled() && typeof onChange === "function") {
292
- onChange();
293
- }
294
- if (isDisabled() && !checkbox.classList.contains("zcDisabled")) checkbox.classList.add("zcDisabled");
301
+ if (typeof isDisabled === "function" && isDisabled()) return checkbox.classList.add("zcDisabled");
302
+ if (typeof onChange === "function") onChange();
295
303
  });
296
304
  window.addEventListener("resize", setProperties);
297
305
  if (place) document.body.append(checkbox, p);
@@ -339,8 +347,9 @@ class BaseSubscreen {
339
347
  const div = document.createElement("div");
340
348
  div.style.cssText = `
341
349
  display: flex; flex-direction: column; gap: 1vw; border: 2px solid var(--tmd-accent, black);
342
- font-family: Emilys Candy; border-radius: 4px; padding: 0.75vw;
350
+ border-radius: 4px; padding: 0.75vw;
343
351
  `;
352
+ setFontFamily(div, MOD_DATA.fontFamily);
344
353
  const buttonsElement = document.createElement("div");
345
354
  buttonsElement.style.cssText = "display: flex; justify-content: center; column-gap: 1vw; width: 100%;";
346
355
  const titleElement = document.createElement("b");
@@ -361,7 +370,7 @@ class BaseSubscreen {
361
370
  b.addEventListener("click", onClick);
362
371
  };
363
372
  const addItem = (text) => {
364
- if (isDisabled() && !input.classList.contains("zcDisabled")) return input.classList.add("zcDisabled");
373
+ if (typeof isDisabled === "function" && isDisabled()) return div.classList.add("zcDisabled");
365
374
  const item = document.createElement("div");
366
375
  item.style.cssText = "cursor: pointer; background: var(--tmd-element-hover, rgb(206, 206, 206)); color: var(--tmd-text, black); height: fit-content; padding: 0.8vw; border-radius: 0.8vw; font-size: clamp(8px, 2vw, 20px);";
367
376
  item.textContent = text;
@@ -379,14 +388,14 @@ class BaseSubscreen {
379
388
  setSize(div, width, height);
380
389
  };
381
390
  addButton("Icons/Cancel.png", () => {
382
- if (isDisabled() && !input.classList.contains("zcDisabled")) return input.classList.add("zcDisabled");
391
+ if (typeof isDisabled === "function" && isDisabled()) return div.classList.add("zcDisabled");
383
392
  itemsElement.innerHTML = "";
384
393
  items.splice(0, items.length);
385
394
  itemsElement.append(input);
386
395
  value.forEach((v) => addItem(String(v)));
387
396
  });
388
397
  addButton("Icons/Trash.png", () => {
389
- if (isDisabled() && !input.classList.contains("zcDisabled")) return input.classList.add("zcDisabled");
398
+ if (typeof isDisabled === "function" && isDisabled()) div.classList.add("zcDisabled");
390
399
  for (const c of [...itemsElement.children]) {
391
400
  if (c.getAttribute("style").includes("border: 2px solid red;")) {
392
401
  items.splice(items.indexOf(c.textContent), 1);
@@ -447,11 +456,13 @@ class BaseSubscreen {
447
456
  height,
448
457
  items,
449
458
  currentIndex,
459
+ isBold = false,
450
460
  onChange,
451
461
  isDisabled
452
462
  }) {
453
463
  const div = document.createElement("div");
454
464
  div.classList.add("zcBackNextButton");
465
+ setFontFamily(div, MOD_DATA.fontFamily);
455
466
  const backBtn = document.createElement("button");
456
467
  backBtn.style.cssText = "position: absolute; left: 1vw; font-size: 3.5vw; aspect-ratio: 1/1; height: 140%;";
457
468
  backBtn.classList.add("zcButton");
@@ -475,6 +486,7 @@ class BaseSubscreen {
475
486
  if (typeof onChange === "function") onChange(items[currentIndex][1]);
476
487
  });
477
488
  const text = document.createElement("p");
489
+ if (isBold) text.style.fontWeight = "bold";
478
490
  text.textContent = items[currentIndex][0];
479
491
  div.append(backBtn, text, nextBtn);
480
492
  const setProperties = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zois-core",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "The core for the my mods, which contains a shared code reused in all my mods",
5
5
  "author": "Zoi",
6
6
  "license": "MIT",