zois-core 2.0.4 → 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/changelogs.js +32 -11
- package/dist/core.js +19 -17
- package/dist/index.js +1 -1
- package/dist/shards/buttonShard.js +7 -5
- package/dist/shards/checkboxShard.js +52 -25
- package/dist/shards/textShard.js +1 -1
- package/dist/types/core.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/shards/checkboxShard.d.ts +2 -0
- package/package.json +1 -1
package/dist/changelogs.js
CHANGED
|
@@ -107,24 +107,30 @@ function showChangelogModal() {
|
|
|
107
107
|
modal.appendChild(content);
|
|
108
108
|
overlay.appendChild(modal);
|
|
109
109
|
document.body.appendChild(overlay);
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const exitHandler = () => {
|
|
111
|
+
document.removeEventListener("keydown", keyDownHandler, { capture: true });
|
|
112
|
+
document.body.removeChild(overlay);
|
|
112
113
|
};
|
|
113
|
-
|
|
114
|
-
document.addEventListener("keydown", function handler(e) {
|
|
114
|
+
const keyDownHandler = (e) => {
|
|
115
115
|
if (e.key === "Escape") {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
exitHandler();
|
|
118
119
|
}
|
|
119
|
-
}
|
|
120
|
+
};
|
|
121
|
+
overlay.onclick = (e) => {
|
|
122
|
+
if (e.target === overlay) exitHandler();
|
|
123
|
+
};
|
|
124
|
+
closeBtn.onclick = exitHandler;
|
|
125
|
+
document.addEventListener("keydown", keyDownHandler, { capture: true });
|
|
120
126
|
}
|
|
121
127
|
function createCommitElement(changelogCommit) {
|
|
122
128
|
try {
|
|
123
129
|
const commitDiv = document.createElement("div");
|
|
124
130
|
commitDiv.style.cssText = `
|
|
125
131
|
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
126
133
|
gap: 12px;
|
|
127
|
-
align-items: center;
|
|
128
134
|
padding: 12px;
|
|
129
135
|
border: 1px solid #e5e7eb;
|
|
130
136
|
border-radius: 8px;
|
|
@@ -132,6 +138,13 @@ function createCommitElement(changelogCommit) {
|
|
|
132
138
|
`;
|
|
133
139
|
commitDiv.onmouseover = () => commitDiv.style.borderColor = "#3b82f6";
|
|
134
140
|
commitDiv.onmouseout = () => commitDiv.style.borderColor = "#e5e7eb";
|
|
141
|
+
const avatarAndInfo = document.createElement("div");
|
|
142
|
+
avatarAndInfo.style.cssText = `
|
|
143
|
+
display: flex;
|
|
144
|
+
gap: 12px;
|
|
145
|
+
align-items: center;
|
|
146
|
+
`;
|
|
147
|
+
commitDiv.append(avatarAndInfo);
|
|
135
148
|
const avatar = document.createElement("img");
|
|
136
149
|
avatar.src = changelogCommit.author.avatar_url;
|
|
137
150
|
avatar.style.cssText = `
|
|
@@ -140,18 +153,29 @@ function createCommitElement(changelogCommit) {
|
|
|
140
153
|
border-radius: 50%;
|
|
141
154
|
flex-shrink: 0;
|
|
142
155
|
`;
|
|
156
|
+
avatarAndInfo.append(avatar);
|
|
143
157
|
const info = document.createElement("div");
|
|
144
158
|
info.style.flex = "1";
|
|
145
159
|
info.style.position = "relative";
|
|
160
|
+
avatarAndInfo.append(info);
|
|
146
161
|
const author = document.createElement("div");
|
|
147
162
|
author.textContent = changelogCommit.author.name;
|
|
148
163
|
author.style.fontWeight = "600";
|
|
149
164
|
author.style.marginBottom = "4px";
|
|
165
|
+
info.append(author);
|
|
150
166
|
const message = document.createElement("div");
|
|
151
167
|
message.textContent = changelogCommit.message;
|
|
152
168
|
message.style.cssText = "color: #374151; line-height: 1.4;";
|
|
169
|
+
info.append(message);
|
|
170
|
+
if (changelogCommit.note) {
|
|
171
|
+
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);
|
|
175
|
+
}
|
|
153
176
|
const tags = document.createElement("div");
|
|
154
177
|
tags.style.cssText = "display: flex; gap: 4px; position: absolute; right: 2px; top: 2px;";
|
|
178
|
+
info.append(tags);
|
|
155
179
|
for (const tag of changelogCommit.tags) {
|
|
156
180
|
const tagEl = document.createElement("p");
|
|
157
181
|
tagEl.textContent = TAGS[tag].name;
|
|
@@ -169,13 +193,10 @@ function createCommitElement(changelogCommit) {
|
|
|
169
193
|
});
|
|
170
194
|
tags.append(tagEl);
|
|
171
195
|
}
|
|
172
|
-
info.append(author, message, tags);
|
|
173
196
|
commitDiv.style.cursor = "pointer";
|
|
174
197
|
commitDiv.onclick = () => {
|
|
175
198
|
window.open(changelogCommit.commit_url, "_blank");
|
|
176
199
|
};
|
|
177
|
-
commitDiv.appendChild(avatar);
|
|
178
|
-
commitDiv.appendChild(info);
|
|
179
200
|
return commitDiv;
|
|
180
201
|
} catch (err) {
|
|
181
202
|
logger.error(`Failed to load commit ${changelogCommit.sha}:`, err);
|
package/dist/core.js
CHANGED
|
@@ -38,10 +38,22 @@ function registerSubscreen() {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
let loginScreenElements = [];
|
|
41
|
-
|
|
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,10 +107,12 @@ class ButtonShard extends Shard {
|
|
|
107
107
|
if (text) {
|
|
108
108
|
textElement = document.createElement("span");
|
|
109
109
|
textElement.textContent = text;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (height) {
|
|
111
|
+
textElement.style.overflow = "hidden";
|
|
112
|
+
textElement.style.textOverflow = "ellipsis";
|
|
113
|
+
textElement.style.whiteSpace = "nowrap";
|
|
114
|
+
textElement.style.maxHeight = "100%";
|
|
115
|
+
}
|
|
114
116
|
btn.append(textElement);
|
|
115
117
|
}
|
|
116
118
|
if (tooltip) {
|
|
@@ -23,7 +23,7 @@ class CheckboxShard extends Shard {
|
|
|
23
23
|
backgroundColor: "var(--tmd-accent, black)",
|
|
24
24
|
borderColor: "var(--tmd-accent, black)"
|
|
25
25
|
},
|
|
26
|
-
":checked
|
|
26
|
+
":checked + svg": {
|
|
27
27
|
strokeDashoffset: "0"
|
|
28
28
|
},
|
|
29
29
|
":checked:hover": {
|
|
@@ -36,8 +36,33 @@ class CheckboxShard extends Shard {
|
|
|
36
36
|
},
|
|
37
37
|
".pop": {
|
|
38
38
|
animation: "pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards"
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
get dynamicClassCheckmark() {
|
|
43
|
+
return {
|
|
44
|
+
base: {
|
|
45
|
+
position: "absolute",
|
|
46
|
+
top: "50%",
|
|
47
|
+
left: "50%",
|
|
48
|
+
transform: "translate(-50%, -50%)",
|
|
49
|
+
width: "70%",
|
|
50
|
+
height: "70%",
|
|
51
|
+
pointerEvents: "none",
|
|
52
|
+
stroke: "var(--tmd-text, white)",
|
|
53
|
+
strokeWidth: "3.5",
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round",
|
|
56
|
+
fill: "none",
|
|
57
|
+
strokeDasharray: "24",
|
|
58
|
+
strokeDashoffset: "24",
|
|
59
|
+
transition: "stroke-dashoffset 0.45s cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
get dynamicClassTooltip() {
|
|
64
|
+
return {
|
|
65
|
+
base: {
|
|
41
66
|
position: "absolute",
|
|
42
67
|
color: "var(--tmd-text, black)",
|
|
43
68
|
fontSize: "0.65em",
|
|
@@ -47,32 +72,29 @@ class CheckboxShard extends Shard {
|
|
|
47
72
|
background: "var(--tmd-element-hint, #e6e6e6)",
|
|
48
73
|
width: "max-content",
|
|
49
74
|
visibility: "hidden",
|
|
50
|
-
zIndex: "10"
|
|
75
|
+
zIndex: "10",
|
|
76
|
+
pointerEvents: "none",
|
|
77
|
+
whiteSpace: "nowrap"
|
|
51
78
|
},
|
|
52
|
-
"
|
|
79
|
+
"[position=left]": {
|
|
53
80
|
right: "calc(100% + 1vw)"
|
|
54
81
|
},
|
|
55
|
-
"
|
|
82
|
+
"[position=right]": {
|
|
56
83
|
left: "calc(100% + 1vw)"
|
|
57
|
-
},
|
|
58
|
-
":hover .tooltip": {
|
|
59
|
-
visibility: "visible"
|
|
60
84
|
}
|
|
61
85
|
};
|
|
62
86
|
}
|
|
63
|
-
get
|
|
87
|
+
get dynamicClassBox() {
|
|
64
88
|
return {
|
|
65
89
|
base: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
strokeDashoffset: "24",
|
|
75
|
-
transition: "stroke-dashoffset 0.45s cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
90
|
+
position: "relative",
|
|
91
|
+
display: "inline-flex",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
justifyContent: "center",
|
|
94
|
+
flexShrink: "0"
|
|
95
|
+
},
|
|
96
|
+
":hover .tooltip": {
|
|
97
|
+
visibility: "visible"
|
|
76
98
|
}
|
|
77
99
|
};
|
|
78
100
|
}
|
|
@@ -86,6 +108,9 @@ class CheckboxShard extends Shard {
|
|
|
86
108
|
wrapper.style.alignItems = "center";
|
|
87
109
|
wrapper.style.columnGap = "1vw";
|
|
88
110
|
wrapper.style.padding = "0.25em";
|
|
111
|
+
setFontFamily(wrapper, MOD_DATA.fontFamily);
|
|
112
|
+
const box = document.createElement("div");
|
|
113
|
+
addDynamicClass(box, this.dynamicClassBox);
|
|
89
114
|
const input = document.createElement("input");
|
|
90
115
|
input.type = "checkbox";
|
|
91
116
|
input.checked = isChecked;
|
|
@@ -94,12 +119,14 @@ class CheckboxShard extends Shard {
|
|
|
94
119
|
const checkmark = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
95
120
|
checkmark.setAttribute("viewBox", "0 0 24 24");
|
|
96
121
|
checkmark.setAttribute("class", "checkmark");
|
|
97
|
-
|
|
122
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
123
|
+
path.setAttribute("d", "M5 13L9 17L19 7");
|
|
124
|
+
checkmark.appendChild(path);
|
|
98
125
|
addDynamicClass(checkmark, this.dynamicClassCheckmark);
|
|
126
|
+
box.append(input, checkmark);
|
|
99
127
|
const label = document.createElement("p");
|
|
100
128
|
label.textContent = text;
|
|
101
129
|
label.style.color = this.textColor;
|
|
102
|
-
setFontFamily(label, MOD_DATA.fontFamily);
|
|
103
130
|
if (typeof isDisabled === "function" && isDisabled()) {
|
|
104
131
|
input.disabled = true;
|
|
105
132
|
wrapper.classList.add("zcDisabled");
|
|
@@ -113,14 +140,14 @@ class CheckboxShard extends Shard {
|
|
|
113
140
|
if (input.checked) {
|
|
114
141
|
}
|
|
115
142
|
});
|
|
116
|
-
|
|
117
|
-
wrapper.append(input, label);
|
|
143
|
+
wrapper.append(box, label);
|
|
118
144
|
if (tooltip) {
|
|
119
145
|
const tooltipEl = document.createElement("span");
|
|
120
146
|
tooltipEl.classList.add("tooltip");
|
|
121
147
|
tooltipEl.setAttribute("position", tooltip.position);
|
|
122
148
|
tooltipEl.textContent = tooltip.text;
|
|
123
|
-
|
|
149
|
+
addDynamicClass(tooltipEl, this.dynamicClassTooltip);
|
|
150
|
+
box.appendChild(tooltipEl);
|
|
124
151
|
}
|
|
125
152
|
return {
|
|
126
153
|
base: wrapper,
|
package/dist/shards/textShard.js
CHANGED
|
@@ -9,7 +9,7 @@ class TextShard extends Shard {
|
|
|
9
9
|
const p = document.createElement("p");
|
|
10
10
|
p.innerHTML = this.context.text ?? "";
|
|
11
11
|
p.style.color = this.context.color ?? this.defaultColor;
|
|
12
|
-
p.style.overflow = "
|
|
12
|
+
p.style.overflow = "auto";
|
|
13
13
|
if (this.context.withBackground) p.style.background = "var(--tmd-element,rgb(239, 239, 239))";
|
|
14
14
|
if (this.context.withBorder) p.style.border = "2px solid var(--tmd-accent, rgb(236, 236, 236))";
|
|
15
15
|
setFontFamily(p, MOD_DATA.fontFamily);
|
package/dist/types/core.d.ts
CHANGED
|
@@ -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():
|
|
18
|
+
export declare function registerCore(): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface CheckboxShardContext extends ShardContext<"checkbox" | "label">
|
|
|
13
13
|
export declare class CheckboxShard extends Shard<CheckboxShardContext> {
|
|
14
14
|
protected get dynamicClassInput(): DynamicClassStyles;
|
|
15
15
|
protected get dynamicClassCheckmark(): DynamicClassStyles;
|
|
16
|
+
protected get dynamicClassTooltip(): DynamicClassStyles;
|
|
17
|
+
protected get dynamicClassBox(): DynamicClassStyles;
|
|
16
18
|
protected get textColor(): string;
|
|
17
19
|
generateBody(): Record<keyof NonNullable<CheckboxShardContext["modules"]>, HTMLElement | SVGElement>;
|
|
18
20
|
update(): void;
|