zois-core 1.0.4 → 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.
@@ -2,10 +2,10 @@ interface RequestResponse<T> {
2
2
  data?: T;
3
3
  isError: boolean;
4
4
  }
5
- export declare function chatSendLocal(message: string | Node): void;
5
+ export declare function chatSendLocalMessage(message: string | Node): void;
6
6
  export declare function chatSendActionMessage(msg: string, target?: undefined | number, dictionary?: ChatMessageDictionaryEntry[]): void;
7
7
  export declare function chatSendModMessage<T>(msg: string, _data?: T, targetNumber?: any): void;
8
- export declare function chatSendBeep(data: any, targetId: number): void;
8
+ export declare function chatSendBeepMessage(data: any, targetId: number): void;
9
9
  export declare function sendRequest<T>(message: string, data: any, target: number): Promise<RequestResponse<T>>;
10
10
  export declare function handleRequestResponse(requestId: number, data: any): void;
11
11
  export declare function handleRequest(requestId: number, message: string, _data: any, sender: Character): void;
package/dist/messaging.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { getRandomNumber, MOD_DATA } from "./index";
2
2
  const pendingRequests = /* @__PURE__ */ new Map();
3
3
  const requestListeners = /* @__PURE__ */ new Map();
4
- function chatSendLocal(message) {
4
+ function chatSendLocalMessage(message) {
5
5
  if (!ServerPlayerIsInChatRoom()) return;
6
6
  const div = document.createElement("div");
7
7
  div.setAttribute("class", "ChatMessage ChatMessageLocalMessage");
@@ -46,7 +46,7 @@ function chatSendModMessage(msg, _data = null, targetNumber = null) {
46
46
  if (targetNumber) data.Target = targetNumber;
47
47
  ServerSend("ChatRoomChat", data);
48
48
  }
49
- function chatSendBeep(data, targetId) {
49
+ function chatSendBeepMessage(data, targetId) {
50
50
  const beep = {
51
51
  IsSecret: true,
52
52
  BeepType: "Leash",
@@ -106,8 +106,8 @@ function addRequestListener(message, listener) {
106
106
  export {
107
107
  addRequestListener,
108
108
  chatSendActionMessage,
109
- chatSendBeep,
110
- chatSendLocal,
109
+ chatSendBeepMessage,
110
+ chatSendLocalMessage,
111
111
  chatSendModMessage,
112
112
  handleRequest,
113
113
  handleRequestResponse,
package/dist/modsApi.js CHANGED
@@ -29,7 +29,6 @@ function registerMod() {
29
29
  if (message.Content === MOD_DATA.key && !sender.IsPlayer()) {
30
30
  const msg = message.Dictionary.msg;
31
31
  const data = message.Dictionary.data;
32
- console.log("message.Dictionary.data", data);
33
32
  if (msg === "request") {
34
33
  if (typeof data.requestId !== "number" || typeof data.message !== "string") return;
35
34
  handleRequest(data.requestId, data.message, data.data, sender);
package/dist/ui.d.ts CHANGED
@@ -97,6 +97,7 @@ interface CreateBackNextButtonArgs {
97
97
  height: number;
98
98
  items: [string, any?][];
99
99
  currentIndex: number;
100
+ isBold?: boolean;
100
101
  anchor?: Anchor;
101
102
  onChange?: (value: any) => void;
102
103
  isDisabled?: () => boolean;
@@ -124,7 +125,7 @@ export declare abstract class BaseSubscreen {
124
125
  createScrollView({ scroll, x, y, width, height, anchor }: CreateScrollViewArgs): HTMLDivElement;
125
126
  createInputList({ x, y, width, height, title, value, anchor, place, numbersOnly, isDisabled, onChange }: CreateInputListArgs): HTMLDivElement;
126
127
  createImage({ x, y, width, src, }: CreateImageArgs): HTMLImageElement;
127
- createBackNextButton({ x, y, width, height, items, currentIndex, onChange, isDisabled }: CreateBackNextButtonArgs): HTMLDivElement;
128
+ createBackNextButton({ x, y, width, height, items, currentIndex, isBold, onChange, isDisabled }: CreateBackNextButtonArgs): HTMLDivElement;
128
129
  }
129
130
  export declare function hookSubscreen(subscreenName: string, hook: (subscreen: BaseSubscreen) => void): void;
130
131
  export {};
package/dist/ui.js CHANGED
@@ -210,7 +210,7 @@ class BaseSubscreen {
210
210
  p.innerHTML = text;
211
211
  p.style.color = color ?? "var(--tmd-text, black)";
212
212
  if (withBackground) p.style.background = "var(--tmd-element,rgb(239, 239, 239))";
213
- setFontFamily(p);
213
+ setFontFamily(p, MOD_DATA.fontFamily);
214
214
  const setProperties = () => {
215
215
  if (typeof x === "number" && typeof y === "number") setPosition(p, x, y, anchor);
216
216
  setSize(p, width, height);
@@ -256,16 +256,12 @@ class BaseSubscreen {
256
256
  setProperties();
257
257
  if (typeof isDisabled === "function" && isDisabled()) input.classList.add("zcDisabled");
258
258
  input.addEventListener("change", () => {
259
- if (typeof isDisabled === "function" && !isDisabled() && typeof onChange === "function") {
260
- onChange();
261
- }
262
- if (typeof isDisabled === "function" && isDisabled()) input.classList.add("zcDisabled");
259
+ if (typeof isDisabled === "function" && isDisabled()) return input.classList.add("zcDisabled");
260
+ if (typeof onChange === "function") onChange();
263
261
  });
264
262
  input.addEventListener("input", () => {
265
- if (typeof isDisabled === "function" && !isDisabled() && typeof onInput === "function") {
266
- onInput();
267
- }
268
- if (typeof isDisabled === "function" && isDisabled()) input.classList.add("zcDisabled");
263
+ if (typeof isDisabled === "function" && isDisabled()) return input.classList.add("zcDisabled");
264
+ if (typeof onInput === "function") onInput();
269
265
  });
270
266
  window.addEventListener("resize", setProperties);
271
267
  if (place) document.body.append(input);
@@ -291,7 +287,7 @@ class BaseSubscreen {
291
287
  const p = document.createElement("p");
292
288
  p.textContent = text;
293
289
  p.style.color = "var(--tmd-text, black)";
294
- setFontFamily(p);
290
+ setFontFamily(p, MOD_DATA.fontFamily);
295
291
  const setProperties = () => {
296
292
  if (typeof x === "number" && typeof y === "number") setPosition(checkbox, x, y, anchor);
297
293
  setPosition(p, x + 100, y, anchor);
@@ -302,10 +298,8 @@ class BaseSubscreen {
302
298
  setProperties();
303
299
  if (typeof isDisabled === "function" && isDisabled()) checkbox.classList.add("zcDisabled");
304
300
  checkbox.addEventListener("change", () => {
305
- if (typeof isDisabled === "function" && !isDisabled() && typeof onChange === "function") {
306
- onChange();
307
- }
308
- if (typeof isDisabled === "function" && isDisabled()) checkbox.classList.add("zcDisabled");
301
+ if (typeof isDisabled === "function" && isDisabled()) return checkbox.classList.add("zcDisabled");
302
+ if (typeof onChange === "function") onChange();
309
303
  });
310
304
  window.addEventListener("resize", setProperties);
311
305
  if (place) document.body.append(checkbox, p);
@@ -462,6 +456,7 @@ class BaseSubscreen {
462
456
  height,
463
457
  items,
464
458
  currentIndex,
459
+ isBold = false,
465
460
  onChange,
466
461
  isDisabled
467
462
  }) {
@@ -491,6 +486,7 @@ class BaseSubscreen {
491
486
  if (typeof onChange === "function") onChange(items[currentIndex][1]);
492
487
  });
493
488
  const text = document.createElement("p");
489
+ if (isBold) text.style.fontWeight = "bold";
494
490
  text.textContent = items[currentIndex][0];
495
491
  div.append(backBtn, text, nextBtn);
496
492
  const setProperties = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zois-core",
3
- "version": "1.0.4",
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",