zois-core 2.1.1 → 2.2.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.
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" id="hand"><path fill="#FFD7C2" d="M25.1562 7.26562C23.875 7.26562 23.2109 8.125 23.2109 8.125V6.20312C23.2109 5.16489 22.2101 4.23438 21.1719 4.23438C19.2188 4.23438 18.8906 5.39062 18.8906 5.39062C18.8906 5.39062 18.875 4.48438 18.7344 3.70312C18.5938 2.92188 17.6007 1.96875 16.5625 1.96875C14.6192 1.96875 13.8828 3.50781 14.0078 5.1875C14.0078 5.1875 13.3594 4.125 11.9531 4.125C10.9149 4.125 9.46094 5.10938 9.63281 7.02344L9.99219 14.5781C9.99219 14.5781 8.95545 13.0114 8.07804 12.5C7.20063 11.9886 5.88786 12.0115 5.17184 12.7812C4.33003 13.6861 4.17703 15.1042 4.78114 15.9688C6.59363 18.5625 9.16622 21.9511 9.65619 23.5312C10.9062 27.5625 14.5625 29.9821 17.9688 29.9821C22.0781 29.9821 26.3919 26.8841 26.7344 22.1094L27.4453 9.98438C27.5234 8.9375 26.7109 7.26562 25.1562 7.26562Z"></path><path fill="#F3C07B" d="M14.9797 4.67252C14.97 4.16039 14.9583 3.54618 15.088 3.00046 15.1665 2.67019 15.2863 2.42235 15.4463 2.26064 15.5118 2.19443 15.5912 2.1352 15.6917 2.09001 14.3982 2.48447 13.9036 3.78714 14.0078 5.18756 14.0078 5.18756 14.0016 5.17741 13.9891 5.15911L14.2973 12.8014C14.3084 13.0774 14.5411 13.292 14.817 13.2809 15.093 13.2698 15.3076 13.0371 15.2965 12.7612L14.9844 5.02107C14.9842 4.91233 14.982 4.79536 14.9797 4.67252ZM16.1719 2.00006C16.1425 2.00006 16.1141 2.00079 16.0867 2.00222 16.1148 1.99809 16.1432 1.99434 16.1719 1.99097V2.00006ZM18.8902 5.3695C18.8597 5.55531 18.8444 5.74233 18.8438 5.92602L18.563 12.2435C18.5507 12.5194 18.7644 12.7529 19.0403 12.7652 19.3162 12.7775 19.5498 12.5638 19.562 12.2879L19.8438 5.94867V5.93756C19.8438 5.47395 19.974 5.01162 20.2044 4.67982 20.3368 4.48923 20.498 4.34513 20.6908 4.25998 19.1633 4.42995 18.8906 5.39069 18.8906 5.39069L18.8902 5.3695ZM23.2628 8.06491C23.1412 8.48903 23.061 8.9973 23.0318 9.60094L23.0317 9.60415 22.8598 13.7135C22.8483 13.9894 23.0626 14.2224 23.3385 14.234 23.6144 14.2455 23.8474 14.0312 23.8589 13.7553L24.0308 9.64758C24.0831 8.56683 24.3107 7.96243 24.537 7.64192 24.7526 7.33647 24.9686 7.2813 25.0938 7.2813V7.26636C24.0573 7.28913 23.4383 7.87343 23.2628 8.06491ZM10.5571 16.5626C10.3772 16.5661 10.2015 16.4721 10.1088 16.3035 9.61261 15.4014 8.45401 13.3139 7.84583 12.3815 7.92596 12.4171 8.00359 12.4566 8.07807 12.5001 8.95419 13.0107 9.98916 14.5736 9.99222 14.5782L9.63284 7.02351C9.49487 5.48702 10.4046 4.54961 11.3059 4.23956 11.109 4.36388 10.9571 4.55567 10.8397 4.81303 10.6243 5.28525 10.5406 5.96098 10.5926 6.74838L10.5931 6.7561 11.0618 16.0374C11.0757 16.3131 10.8635 16.548 10.5877 16.5619 10.5774 16.5625 10.5672 16.5627 10.5571 16.5626Z"></path></svg>
@@ -1,6 +1,8 @@
1
+ import { createElement, Crown, Heart } from "lucide";
1
2
  import { MOD_DATA } from ".";
2
3
  import { logger } from "./logging";
3
4
  import { addDynamicClass } from "./ui";
5
+ import handIcon from "./assets/icons/hand.svg";
4
6
  const TAGS = {
5
7
  fix: {
6
8
  name: "Fix",
@@ -94,19 +96,124 @@ function showChangelogModal() {
94
96
  overflow-y: auto;
95
97
  flex: 1;
96
98
  `;
99
+ const contributorsTitle = document.createElement("p");
100
+ contributorsTitle.style.cssText = `
101
+ font-size: 22px;
102
+ margin: 0;
103
+ `;
104
+ contributorsTitle.textContent = "Contributors";
105
+ const contributorsList = document.createElement("div");
106
+ contributorsList.style.display = "flex";
107
+ contributorsList.style.justifyContent = "center";
108
+ contributorsList.style.flexWrap = "wrap";
109
+ contributorsList.style.gap = "16px";
110
+ contributorsList.style.padding = "16px";
111
+ for (const contributor of data.contributors) {
112
+ const container = document.createElement("div");
113
+ container.style.cssText = `
114
+ display: flex;
115
+ flex-direction: column;
116
+ align-items: center;
117
+ gap: 8px;
118
+ `;
119
+ const imageContainer = document.createElement("div");
120
+ imageContainer.style.cssText = `
121
+ position: relative;
122
+ width: 100px;
123
+ height: 100px;
124
+ border: 1px solid black;
125
+ border-radius: 50%;
126
+ overflow: hidden;
127
+ `;
128
+ const handGrabIcon = document.createElement("img");
129
+ handGrabIcon.src = handIcon;
130
+ handGrabIcon.style.cssText = `
131
+ position: absolute;
132
+ top: 0;
133
+ left: 35%;
134
+ width: 40px;
135
+ height: 40px;
136
+ line-height: 1;
137
+ pointer-events: none;
138
+ filter: drop-shadow(0 3px 4px rgba(0,0,0,0.45));
139
+ z-index: 10;
140
+ transform-origin: center bottom;
141
+ animation: zcStrokeUD 1.3s ease-in-out infinite;
142
+ `;
143
+ const hearts = [
144
+ { left: "18%", top: "35%", duration: "2.5s", size: "16px" },
145
+ { left: "25%", top: "10%", duration: "2s", size: "10px" },
146
+ { left: "40%", top: "40%", duration: "1.0s", size: "12px" },
147
+ { left: "55%", top: "28%", duration: "4.5s", size: "14px" },
148
+ { left: "35%", top: "48%", duration: "1.0s", size: "15px" },
149
+ { left: "65%", top: "42%", duration: "1.5s", size: "13px" }
150
+ ];
151
+ hearts.forEach((h) => {
152
+ const heart = createElement(Heart, { fill: "#ff4d6d", stroke: "#ff4d6d" });
153
+ heart.style.cssText = `
154
+ position: absolute;
155
+ pointer-events: none;
156
+ z-index: 5;
157
+ animation: zcFloatHeart ${h.duration} ease-out infinite;
158
+ left: ${h.left};
159
+ top: ${h.top};
160
+ width: ${h.size};
161
+ height: ${h.size};
162
+ `;
163
+ imageContainer.append(heart);
164
+ });
165
+ const image = document.createElement("img");
166
+ image.src = contributor.avatar_url;
167
+ image.style.cssText = `
168
+ width: 100%;
169
+ height: 100%;
170
+ border-radius: 50%;
171
+ `;
172
+ imageContainer.append(image, handGrabIcon);
173
+ const name = document.createElement("span");
174
+ name.textContent = contributor.name;
175
+ name.style.textAlign = "center";
176
+ container.append(imageContainer, name);
177
+ if (contributor.is_owner) {
178
+ const ownerLabelContainer = document.createElement("div");
179
+ ownerLabelContainer.style.cssText = `
180
+ display: flex;
181
+ align-items: center;
182
+ gap: 6px;
183
+ border-radius: 6px;
184
+ padding: 2px 4px;
185
+ font-size: 10px;
186
+ background: #fbfb142e;
187
+ border: 1px solid #60600a;
188
+ `;
189
+ const crown = createElement(Crown, { width: "10px", height: "10px", fill: "#ffe300" });
190
+ const label = document.createElement("span");
191
+ label.textContent = "Project owner";
192
+ ownerLabelContainer.append(crown, label);
193
+ container.append(ownerLabelContainer);
194
+ }
195
+ contributorsList.append(container);
196
+ }
197
+ const changesTitle = document.createElement("p");
198
+ changesTitle.style.cssText = `
199
+ font-size: 22px;
200
+ margin: 0;
201
+ `;
202
+ changesTitle.textContent = "Changes";
97
203
  const commitsList = document.createElement("div");
98
204
  commitsList.style.display = "flex";
99
205
  commitsList.style.flexDirection = "column";
100
206
  commitsList.style.gap = "16px";
207
+ commitsList.style.marginTop = "16px";
101
208
  for (const commitData of data.changes) {
102
- const commitElement = createCommitElement(commitData);
103
- if (commitElement) commitsList.appendChild(commitElement);
209
+ const commitElement = createCommitElement(data, commitData.sha);
210
+ if (commitElement) commitsList.append(commitElement);
104
211
  }
105
- content.appendChild(commitsList);
106
- modal.appendChild(header);
107
- modal.appendChild(content);
108
- overlay.appendChild(modal);
109
- document.body.appendChild(overlay);
212
+ content.append(contributorsTitle, contributorsList, changesTitle, commitsList);
213
+ modal.append(header);
214
+ modal.append(content);
215
+ overlay.append(modal);
216
+ document.body.append(overlay);
110
217
  const exitHandler = () => {
111
218
  document.removeEventListener("keydown", keyDownHandler, { capture: true });
112
219
  document.body.removeChild(overlay);
@@ -124,29 +231,46 @@ function showChangelogModal() {
124
231
  closeBtn.onclick = exitHandler;
125
232
  document.addEventListener("keydown", keyDownHandler, { capture: true });
126
233
  }
127
- function createCommitElement(changelogCommit) {
234
+ function createCommitElement(changelogData, commitSha) {
128
235
  try {
129
- const commitDiv = document.createElement("div");
130
- commitDiv.style.cssText = `
236
+ const commit = changelogData.changes.find((c) => c.sha === commitSha);
237
+ if (!commit) {
238
+ logger.warn(`Commit ${commitSha} is not exists in changelog bundle`);
239
+ return;
240
+ }
241
+ const author = changelogData.contributors.find((c) => c.name === commit?.author);
242
+ if (!author) {
243
+ logger.warn(`Author ${commit.author} is not exists in changelog bundle`);
244
+ return;
245
+ }
246
+ const commitWrapper = document.createElement("div");
247
+ commitWrapper.style.cssText = `
248
+ background: #e8e8f4;
249
+ border-radius: 8px;
250
+ `;
251
+ const commitContainer = document.createElement("div");
252
+ commitContainer.style.cssText = `
131
253
  display: flex;
132
254
  flex-direction: column;
133
255
  gap: 12px;
134
256
  padding: 12px;
135
257
  border: 1px solid #e5e7eb;
136
258
  border-radius: 8px;
259
+ background: white;
137
260
  transition: all 0.2s;
138
261
  `;
139
- commitDiv.onmouseover = () => commitDiv.style.borderColor = "#3b82f6";
140
- commitDiv.onmouseout = () => commitDiv.style.borderColor = "#e5e7eb";
262
+ commitWrapper.append(commitContainer);
263
+ commitContainer.onmouseover = () => commitContainer.style.borderColor = "#3b82f6";
264
+ commitContainer.onmouseout = () => commitContainer.style.borderColor = "#e5e7eb";
141
265
  const avatarAndInfo = document.createElement("div");
142
266
  avatarAndInfo.style.cssText = `
143
267
  display: flex;
144
268
  gap: 12px;
145
269
  align-items: center;
146
270
  `;
147
- commitDiv.append(avatarAndInfo);
271
+ commitContainer.append(avatarAndInfo);
148
272
  const avatar = document.createElement("img");
149
- avatar.src = changelogCommit.author.avatar_url;
273
+ avatar.src = author.avatar_url;
150
274
  avatar.style.cssText = `
151
275
  width: 48px;
152
276
  height: 48px;
@@ -158,25 +282,25 @@ function createCommitElement(changelogCommit) {
158
282
  info.style.flex = "1";
159
283
  info.style.position = "relative";
160
284
  avatarAndInfo.append(info);
161
- const author = document.createElement("div");
162
- author.textContent = changelogCommit.author.name;
163
- author.style.fontWeight = "600";
164
- author.style.marginBottom = "4px";
165
- info.append(author);
285
+ const authorName = document.createElement("div");
286
+ authorName.textContent = author.name;
287
+ authorName.style.fontWeight = "600";
288
+ authorName.style.marginBottom = "4px";
289
+ info.append(authorName);
166
290
  const message = document.createElement("div");
167
- message.textContent = changelogCommit.message;
291
+ message.textContent = commit.message;
168
292
  message.style.cssText = "color: #374151; line-height: 1.4;";
169
293
  info.append(message);
170
- if (changelogCommit.note) {
294
+ if (commit.note) {
171
295
  const note = document.createElement("div");
172
- note.textContent = changelogCommit.note ?? "";
173
- note.style.cssText = "color: #374151; line-height: 1; font-size: 0.8em;";
174
- commitDiv.append(note);
296
+ note.textContent = commit.note ?? "";
297
+ note.style.cssText = "color: rgb(69, 75, 83); line-height: 1; font-size: 0.8em; padding: 4px;";
298
+ commitWrapper.append(note);
175
299
  }
176
300
  const tags = document.createElement("div");
177
301
  tags.style.cssText = "display: flex; gap: 4px; position: absolute; right: 2px; top: 2px;";
178
302
  info.append(tags);
179
- for (const tag of changelogCommit.tags) {
303
+ for (const tag of commit.tags) {
180
304
  const tagEl = document.createElement("p");
181
305
  tagEl.textContent = TAGS[tag].name;
182
306
  addDynamicClass(tagEl, {
@@ -194,13 +318,13 @@ function createCommitElement(changelogCommit) {
194
318
  });
195
319
  tags.append(tagEl);
196
320
  }
197
- commitDiv.style.cursor = "pointer";
198
- commitDiv.onclick = () => {
199
- window.open(changelogCommit.commit_url, "_blank");
321
+ commitContainer.style.cursor = "pointer";
322
+ commitContainer.onclick = () => {
323
+ window.open(commit.commit_url, "_blank");
200
324
  };
201
- return commitDiv;
325
+ return commitWrapper;
202
326
  } catch (err) {
203
- logger.error(`Failed to load commit ${changelogCommit.sha}:`, err);
327
+ logger.error(`Failed to load commit ${commitSha}:`, err);
204
328
  return null;
205
329
  }
206
330
  }
package/dist/logging.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { MOD_DATA } from "./index";
2
2
  const logs = [];
3
3
  class Logger {
4
+ /**
5
+ * Returns the list of all recorded log entries.
6
+ */
4
7
  get logs() {
5
8
  return logs;
6
9
  }
@@ -12,15 +15,31 @@ class Logger {
12
15
  });
13
16
  console[level](`%c${MOD_DATA.key}:`, "color: #00ffe7;", ...message);
14
17
  }
18
+ /**
19
+ * Logs a debug-level message.
20
+ * @param message - The message arguments to log.
21
+ */
15
22
  debug(...message) {
16
23
  this.pushLog("debug", message);
17
24
  }
25
+ /**
26
+ * Logs a standard-level message.
27
+ * @param message - The message arguments to log.
28
+ */
18
29
  log(...message) {
19
30
  this.pushLog("log", message);
20
31
  }
32
+ /**
33
+ * Logs a warning-level message.
34
+ * @param message - The message arguments to log.
35
+ */
21
36
  warn(...message) {
22
37
  this.pushLog("warn", message);
23
38
  }
39
+ /**
40
+ * Logs an error-level message.
41
+ * @param message - The message arguments to log.
42
+ */
24
43
  error(...message) {
25
44
  this.pushLog("error", message);
26
45
  }
package/dist/messaging.js CHANGED
@@ -10,6 +10,11 @@ function isClassConstructor(c) {
10
10
  return typeof c === "function" && c.prototype?.constructor == c;
11
11
  }
12
12
  class MessagesManager {
13
+ /**
14
+ * Sends beep message to a specific player.
15
+ * @param data - The data to send in the beep.
16
+ * @param targetId - The member number of the target player.
17
+ */
13
18
  sendBeep(data, targetId) {
14
19
  const beep = {
15
20
  IsSecret: true,
@@ -21,6 +26,12 @@ class MessagesManager {
21
26
  };
22
27
  ServerSend("AccountBeep", beep);
23
28
  }
29
+ /**
30
+ * Sends hidden packet message to the chat room or a specific player.
31
+ * @param msg - The message identifier.
32
+ * @param _data - Optional data payload to include.
33
+ * @param targetNumber - Optional target player member number.
34
+ */
24
35
  sendPacket(msg, _data, targetNumber) {
25
36
  const data = {
26
37
  Content: MOD_DATA.key,
@@ -33,6 +44,14 @@ class MessagesManager {
33
44
  if (targetNumber) data.Target = targetNumber;
34
45
  ServerSend("ChatRoomChat", data);
35
46
  }
47
+ /**
48
+ * Sends a custom action message to the chat room with automatic pronoun replacement.
49
+ *
50
+ * Replaces placeholders such as `<Possessive>`, `<Intensive>`, `<SelfIntensive>`, and `<Pronoun>`.
51
+ * @param msg - The action message text.
52
+ * @param target - Optional target player member number.
53
+ * @param dictionary - Optional additional dictionary entries.
54
+ */
36
55
  sendAction(msg, target = void 0, dictionary = []) {
37
56
  if (!msg || !ServerPlayerIsInChatRoom()) return;
38
57
  const isFemale = CharacterPronounDescription(Player) === "She/Her";
@@ -42,20 +61,42 @@ class MessagesManager {
42
61
  const capPronoun = isFemale ? "She" : "He";
43
62
  msg = msg.replaceAll("<Possessive>", capPossessive).replaceAll("<possessive>", capPossessive.toLocaleLowerCase()).replaceAll("<Intensive>", capIntensive).replaceAll("<intensive>", capIntensive.toLocaleLowerCase()).replaceAll("<SelfIntensive>", capSelfIntensive).replaceAll("<selfIntensive>", capSelfIntensive.toLocaleLowerCase()).replaceAll("<Pronoun>", capPronoun).replaceAll("<pronoun>", capPronoun.toLocaleLowerCase());
44
63
  ServerSend("ChatRoomChat", {
45
- Content: "ZC_CUSTOM_ACTION",
64
+ Content: "Beep",
46
65
  Type: "Action",
47
66
  Target: target ?? void 0,
48
67
  Dictionary: [
49
- { Tag: 'MISSING TEXT IN "Interface.csv": ZC_CUSTOM_ACTION', Text: msg },
68
+ // EN
69
+ { Tag: "Beep", Text: "msg" },
70
+ // CN
71
+ { Tag: "\u53D1\u9001\u79C1\u804A", Text: "msg" },
72
+ // DE
73
+ { Tag: "Biep", Text: "msg" },
74
+ // FR
75
+ { Tag: "Sonner", Text: "msg" },
76
+ // RU
77
+ { Tag: "\u0417\u0432\u0443\u043A\u043E\u0432\u043E\u0439 \u0441\u0438\u0433\u043D\u0430\u043B", Text: "msg" },
78
+ { Tag: "msg", Text: msg },
50
79
  ...dictionary
51
80
  ]
52
81
  });
53
82
  }
83
+ /**
84
+ * Sends a request to a target player and waits for a response.
85
+ *
86
+ * Supports both packet and beep transport. Automatically times out after 6 seconds.
87
+ * @param options - Request configuration.
88
+ * @param options.message - The request message identifier.
89
+ * @param options.data - Optional data to send with the request.
90
+ * @param options.target - Target player member number.
91
+ * @param options.type - Transport type: `"packet"` or `"beep"`.
92
+ * @returns A promise that resolves with the response data or an error flag.
93
+ */
54
94
  sendRequest({
55
95
  message,
56
96
  data = {},
57
97
  target,
58
- type = "packet"
98
+ type = "packet",
99
+ responseDto
59
100
  }) {
60
101
  const requestId = crypto.randomUUID();
61
102
  return new Promise((resolve) => {
@@ -66,7 +107,7 @@ class MessagesManager {
66
107
  message,
67
108
  data
68
109
  }, target);
69
- deleteHook = hookFunction("ChatRoomMessage", HookPriority.ADD_BEHAVIOR, (args, next) => {
110
+ deleteHook = hookFunction("ChatRoomMessage", HookPriority.ADD_BEHAVIOR, async (args, next) => {
70
111
  const _message = args[0];
71
112
  const sender = getPlayer(_message.Sender);
72
113
  if (!sender) return next(args);
@@ -75,6 +116,15 @@ class MessagesManager {
75
116
  const data2 = _message.Dictionary.data;
76
117
  if (msg === "requestResponse" && data2.requestId === requestId) {
77
118
  deleteHook();
119
+ if (responseDto) {
120
+ const validationResult = await validateData(data2.data, responseDto);
121
+ if (!validationResult.isValid) {
122
+ logger.warn(`DTO Failure:`, validationResult);
123
+ resolve({
124
+ isError: true
125
+ });
126
+ }
127
+ }
78
128
  resolve({
79
129
  data: data2.data,
80
130
  isError: false
@@ -90,7 +140,7 @@ class MessagesManager {
90
140
  message,
91
141
  data
92
142
  }, target);
93
- deleteHook = hookFunction("ServerAccountBeep", HookPriority.ADD_BEHAVIOR, (args, next) => {
143
+ deleteHook = hookFunction("ServerAccountBeep", HookPriority.ADD_BEHAVIOR, async (args, next) => {
94
144
  const beep = args[0];
95
145
  if (beep.BeepType !== "Leash") return next(args);
96
146
  let data2;
@@ -101,6 +151,15 @@ class MessagesManager {
101
151
  }
102
152
  if (data2.type === `${MOD_DATA.key}_requestResponse` && data2.requestId === requestId) {
103
153
  deleteHook();
154
+ if (responseDto) {
155
+ const validationResult = await validateData(data2.data, responseDto);
156
+ if (!validationResult.isValid) {
157
+ logger.warn(`DTO Failure:`, validationResult);
158
+ resolve({
159
+ isError: true
160
+ });
161
+ }
162
+ }
104
163
  resolve({
105
164
  data: data2.data,
106
165
  isError: false
@@ -117,6 +176,10 @@ class MessagesManager {
117
176
  }, 6e3);
118
177
  });
119
178
  }
179
+ /**
180
+ * Displays a local message in the chat log (visible only to the current player).
181
+ * @param message - The message content as a string or DOM node.
182
+ */
120
183
  sendLocal(message) {
121
184
  if (!ServerPlayerIsInChatRoom()) return;
122
185
  const div = document.createElement("div");
@@ -132,6 +195,10 @@ class MessagesManager {
132
195
  document.querySelector("#TextAreaChatLog")?.appendChild(div);
133
196
  ElementScrollToEnd("TextAreaChatLog");
134
197
  }
198
+ /**
199
+ * Sends a regular chat message to the chat room.
200
+ * @param message - The chat message content.
201
+ */
135
202
  sendChat(message) {
136
203
  ServerSend("ChatRoomChat", { Type: "Chat", Content: message });
137
204
  }
@@ -153,10 +220,12 @@ class MessagesManager {
153
220
  const data = _message.Dictionary?.data;
154
221
  if (msg === "request" && data.message === message) {
155
222
  if (typeof data.requestId !== "string" || typeof data.message !== "string") return;
156
- const validationResult = await validateData(data.data, dto);
157
- if (dto && !validationResult.isValid) {
158
- logger.warn(`DTO Failure:`, validationResult);
159
- return next(args);
223
+ if (dto) {
224
+ const validationResult = await validateData(data.data, dto);
225
+ if (!validationResult.isValid) {
226
+ logger.warn(`DTO Failure:`, validationResult);
227
+ return;
228
+ }
160
229
  }
161
230
  const _data = _listener?.(data.data, sender);
162
231
  if (_data !== void 0) {
package/dist/modSdk.js CHANGED
@@ -36,7 +36,7 @@ function patchFunction(functionName, patches) {
36
36
  logger.error(e);
37
37
  }
38
38
  }
39
- function callOriginal(target, args, context) {
39
+ function callOriginal(target, args) {
40
40
  if (!modSdk) throw new Error("zois-core is not registered");
41
41
  try {
42
42
  return modSdk.callOriginal(target, args);
@@ -51,13 +51,23 @@ function getLoadedMods() {
51
51
  function findModByName(name) {
52
52
  return !!bcModSdk.getModsInfo().find((m) => m.name === name);
53
53
  }
54
+ function getOriginalHash(functionName) {
55
+ if (!modSdk) throw new Error("zois-core is not registered");
56
+ return modSdk.getOriginalHash(functionName);
57
+ }
58
+ function removePatches(functionName) {
59
+ if (!modSdk) throw new Error("zois-core is not registered");
60
+ modSdk.removePatches(functionName);
61
+ }
54
62
  export {
55
63
  HookPriority,
56
64
  callOriginal,
57
65
  createModSdk,
58
66
  findModByName,
59
67
  getLoadedMods,
68
+ getOriginalHash,
60
69
  hookFunction,
61
70
  modSdk,
62
- patchFunction
71
+ patchFunction,
72
+ removePatches
63
73
  };
@@ -118,7 +118,7 @@ class InputListShard extends Shard {
118
118
  items.splice(0, items.length);
119
119
  itemsElement.append(input);
120
120
  value?.forEach((v) => addItem(String(v)));
121
- if (typeof onChange === "function") onChange(numbersOnly ? items.map((i) => parseInt(i)) : items);
121
+ if (typeof onChange === "function") onChange(numbersOnly ? items.map((i) => parseInt(i, 10)) : items);
122
122
  });
123
123
  addButton(createElement(Trash2), () => {
124
124
  if (typeof isDisabled === "function" && isDisabled()) return div.classList.add("zcDisabled");
@@ -128,7 +128,7 @@ class InputListShard extends Shard {
128
128
  c.remove();
129
129
  }
130
130
  }
131
- if (typeof onChange === "function") onChange(numbersOnly ? items.map((i) => parseInt(i)) : items);
131
+ if (typeof onChange === "function") onChange(numbersOnly ? items.map((i) => parseInt(i, 10)) : items);
132
132
  });
133
133
  if (typeof isDisabled === "function" && isDisabled()) div.classList.add("zcDisabled");
134
134
  input.addEventListener("keypress", (e) => {
@@ -140,7 +140,7 @@ class InputListShard extends Shard {
140
140
  if (typeof isDisabled === "function" && isDisabled()) return div.classList.add("zcDisabled");
141
141
  addItem(input.value);
142
142
  input.value = "";
143
- if (typeof onChange === "function") onChange(numbersOnly ? items.map((i) => parseInt(i)) : items);
143
+ if (typeof onChange === "function") onChange(numbersOnly ? items.map((i) => parseInt(i, 10)) : items);
144
144
  break;
145
145
  }
146
146
  }
package/dist/styles.css CHANGED
@@ -199,6 +199,27 @@
199
199
  border-right-color: rgb(42, 42, 42);
200
200
  }
201
201
  }
202
+ @keyframes zcStrokeUD {
203
+ 0%, 100% {
204
+ transform: translateY(0) rotate(-25deg);
205
+ }
206
+ 50% {
207
+ transform: translateY(15px) rotate(-45deg);
208
+ }
209
+ }
210
+ @keyframes zcFloatHeart {
211
+ 0% {
212
+ transform: translateY(0) scale(0.5);
213
+ opacity: 0;
214
+ }
215
+ 15% {
216
+ opacity: 1;
217
+ }
218
+ 100% {
219
+ transform: translateY(-70px) scale(1.1);
220
+ opacity: 0;
221
+ }
222
+ }
202
223
  .zcCursor {
203
224
  border-right: 2px solid var(--tmd-text, rgb(42, 42, 42));
204
225
  width: fit-content;
package/dist/toasts.js CHANGED
@@ -149,32 +149,58 @@ class ToastsManager {
149
149
  });
150
150
  }
151
151
  }
152
+ /**
153
+ * Displays informational toast.
154
+ * @param options - Title, message and duration of toast.
155
+ */
152
156
  info({ title, message, duration }) {
153
157
  const id = this.generateToastId();
154
158
  const theme = MOD_DATA.singleToastsTheme;
155
159
  this.process({ title, message, duration, type: "info", id, theme });
156
160
  }
161
+ /**
162
+ * Displays success toast.
163
+ * @param options - Title, message and duration of toast.
164
+ */
157
165
  success({ title, message, duration }) {
158
166
  const id = this.generateToastId();
159
167
  const theme = MOD_DATA.singleToastsTheme;
160
168
  this.process({ title, message, duration, type: "success", id, theme });
161
169
  }
170
+ /**
171
+ * Displays warning toast.
172
+ * @param options - Title, message and duration of toast.
173
+ */
162
174
  warn({ title, message, duration }) {
163
175
  const id = this.generateToastId();
164
176
  const theme = MOD_DATA.singleToastsTheme;
165
177
  this.process({ title, message, duration, type: "warning", id, theme });
166
178
  }
179
+ /**
180
+ * Displays error toast.
181
+ * @param options - Title, message and duration of toast.
182
+ */
167
183
  error({ title, message, duration }) {
168
184
  const id = this.generateToastId();
169
185
  const theme = MOD_DATA.singleToastsTheme;
170
186
  this.process({ title, message, duration, type: "error", id, theme });
171
187
  }
188
+ /**
189
+ * Displays a long-running spinner toast and returns its ID.
190
+ * Toast can be deleted manually with `toastsManager.removeSpinner(ID)` or by the user by clicking.
191
+ * @param options - Title and message of toast.
192
+ * @returns The unique ID of the created spinner toast.
193
+ */
172
194
  spinner({ title, message }) {
173
195
  const id = this.generateToastId();
174
196
  const theme = MOD_DATA.singleToastsTheme;
175
197
  this.process({ title, message, duration: 1e6, type: "spinner", id, theme });
176
198
  return id;
177
199
  }
200
+ /**
201
+ * Removes a spinner toast by its ID.
202
+ * @param id - Unique ID of the spinner toast to remove.
203
+ */
178
204
  removeSpinner(id) {
179
205
  const toast = document.querySelector(`div[data-zc-toast-id="${id}"]`);
180
206
  if (!toast) return;
@@ -9,7 +9,7 @@ export declare abstract class CoreSubscreen extends BaseSubscreen {
9
9
  createText(ctx: TextShardContext): HTMLParagraphElement;
10
10
  createButton(ctx: ButtonShardContext): HTMLButtonElement;
11
11
  createCheckbox(ctx: CheckboxShardContext): HTMLDivElement;
12
- createInputList(ctx: InputListShardContext): HTMLDivElement;
12
+ createInputList<NumbersOnly extends boolean>(ctx: InputListShardContext<NumbersOnly>): HTMLDivElement;
13
13
  createSelect(ctx: SelectShardContext): HTMLDivElement;
14
14
  unload(): void;
15
15
  }
@@ -1,6 +1,6 @@
1
1
  import { InputListShard } from "../../shards";
2
2
  import { DynamicClassStyles } from "../../ui";
3
- export declare class CoreInputListShard extends InputListShard {
3
+ export declare class CoreInputListShard<NumbersOnly extends boolean> extends InputListShard<NumbersOnly> {
4
4
  get dynamicClassContainer(): DynamicClassStyles;
5
5
  get dynamicClassToolsButton(): DynamicClassStyles;
6
6
  }