zois-core 2.0.5 → 2.0.6

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/dist/core.js CHANGED
@@ -38,10 +38,22 @@ function registerSubscreen() {
38
38
  });
39
39
  }
40
40
  let loginScreenElements = [];
41
- async function registerCore() {
41
+ function registerCore() {
42
42
  const style = document.createElement("style");
43
43
  style.innerHTML = styles;
44
44
  document.head.append(style);
45
+ window.ZOIS_CORE = Object.freeze({
46
+ version,
47
+ enableDevMode: () => {
48
+ if (typeof Player?.MemberNumber !== "number") return;
49
+ coreSettings.devMode = true;
50
+ syncSettings();
51
+ registerSubscreen();
52
+ },
53
+ getSettings: () => {
54
+ return JSON.parse(JSON.stringify(coreSettings));
55
+ }
56
+ });
45
57
  if (localStorage.getItem("autoConnectToDevServer") === "true") {
46
58
  hookFunction("CommonGetServer", HookPriority.OVERRIDE_BEHAVIOR, (args, next) => {
47
59
  return "https://bondage-club-server-test.herokuapp.com/";
@@ -82,22 +94,6 @@ async function registerCore() {
82
94
  ServerURL = CommonGetServer();
83
95
  ServerInit();
84
96
  }
85
- await waitFor(() => typeof Player?.MemberNumber === "number");
86
- if (typeof Player.ExtensionSettings.ZOIS_CORE === "string") {
87
- coreSettings = JSON.parse(LZString.decompressFromBase64(Player.ExtensionSettings.ZOIS_CORE) ?? "{}");
88
- }
89
- if (coreSettings.devMode) registerSubscreen();
90
- window.ZOIS_CORE = Object.freeze({
91
- version,
92
- enableDevMode: () => {
93
- coreSettings.devMode = true;
94
- syncSettings();
95
- registerSubscreen();
96
- },
97
- getSettings: () => {
98
- return JSON.parse(JSON.stringify(coreSettings));
99
- }
100
- });
101
97
  hookFunction("ChatRoomMessageCreateReplyMessageElement", HookPriority.OVERRIDE_BEHAVIOR, (args, next) => {
102
98
  const [msgId, displayMessage, data] = args;
103
99
  const r = formatString(displayMessage);
@@ -169,6 +165,12 @@ async function registerCore() {
169
165
  }
170
166
  }
171
167
  }, true);
168
+ waitFor(() => typeof Player?.MemberNumber === "number").then(() => {
169
+ if (typeof Player.ExtensionSettings.ZOIS_CORE === "string") {
170
+ coreSettings = JSON.parse(LZString.decompressFromBase64(Player.ExtensionSettings.ZOIS_CORE) ?? "{}");
171
+ }
172
+ if (coreSettings.devMode) registerSubscreen();
173
+ });
172
174
  }
173
175
  export {
174
176
  coreSettings,
package/dist/index.js CHANGED
@@ -6,9 +6,9 @@ import { getCurrentSubscreen, setSubscreen } from "./ui";
6
6
  import { version } from "../package.json";
7
7
  let MOD_DATA;
8
8
  function bootstrap(modData) {
9
- if (!window.ZOIS_CORE) registerCore();
10
9
  MOD_DATA = modData;
11
10
  createModSdk();
11
+ if (!window.ZOIS_CORE) registerCore();
12
12
  loadLocalization();
13
13
  hookFunction("GameKeyDown", HookPriority.ADD_BEHAVIOR, (args, next) => {
14
14
  const currentSubscreen = getCurrentSubscreen();
@@ -77,7 +77,7 @@ class ButtonShard extends Shard {
77
77
  };
78
78
  }
79
79
  generateBody() {
80
- const { text, variant, icon, iconAbsolutePosition = true, tooltip, href, onClick, isDisabled } = this.context;
80
+ const { height, text, variant, icon, iconAbsolutePosition = true, tooltip, href, onClick, isDisabled } = this.context;
81
81
  let iconElement;
82
82
  let textElement;
83
83
  const btn = document.createElement("button");
@@ -107,9 +107,12 @@ class ButtonShard extends Shard {
107
107
  if (text) {
108
108
  textElement = document.createElement("span");
109
109
  textElement.textContent = text;
110
- textElement.style.overflow = "auto";
111
- textElement.style.padding = "0.08em";
112
- textElement.style.maxHeight = "100%";
110
+ if (height) {
111
+ textElement.style.overflow = "hidden";
112
+ textElement.style.textOverflow = "ellipsis";
113
+ textElement.style.whiteSpace = "nowrap";
114
+ textElement.style.maxHeight = "100%";
115
+ }
113
116
  btn.append(textElement);
114
117
  }
115
118
  if (tooltip) {
@@ -10,7 +10,6 @@ class TextShard extends Shard {
10
10
  p.innerHTML = this.context.text ?? "";
11
11
  p.style.color = this.context.color ?? this.defaultColor;
12
12
  p.style.overflow = "auto";
13
- p.style.padding = "0.08em";
14
13
  if (this.context.withBackground) p.style.background = "var(--tmd-element,rgb(239, 239, 239))";
15
14
  if (this.context.withBorder) p.style.border = "2px solid var(--tmd-accent, rgb(236, 236, 236))";
16
15
  setFontFamily(p, MOD_DATA.fontFamily);
@@ -15,4 +15,4 @@ export interface CoreSettings {
15
15
  export declare let coreSettings: CoreSettings;
16
16
  export declare function syncSettings(): void;
17
17
  export declare function registerSubscreen(): void;
18
- export declare function registerCore(): Promise<void>;
18
+ export declare function registerCore(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zois-core",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "The core for the my mods, which contains a shared code reused in all my mods",
5
5
  "bin": {
6
6
  "zois-core": "scripts/zois-core.mjs"