zois-core 1.2.1 → 2.0.1
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 +23 -2
- package/dist/assets/icons/exit.svg +17 -0
- package/dist/changelogs.js +153 -0
- package/dist/core-subscreen/coreSubscreen.js +81 -0
- package/dist/core-subscreen/developmentSubscreen.js +22 -0
- package/dist/core-subscreen/generalSubscreen.js +23 -0
- package/dist/core-subscreen/mainSubscreen.js +58 -0
- package/dist/core-subscreen/shards/coreButtonShard.js +30 -0
- package/dist/core-subscreen/shards/coreCheckboxShard.js +33 -0
- package/dist/core-subscreen/shards/coreInputListShard.js +38 -0
- package/dist/core-subscreen/shards/coreSelectShard.js +17 -0
- package/dist/core-subscreen/shards/coreTextShard.js +9 -0
- package/dist/core-subscreen/shards/index.js +5 -0
- package/dist/core-subscreen/toastsSubscreen.js +112 -0
- package/dist/core.js +178 -0
- package/dist/dialogs.js +110 -0
- package/dist/index.js +201 -1
- package/dist/localization.js +71 -0
- package/dist/logging.js +31 -0
- package/dist/messaging.js +234 -1
- package/dist/modSdk.js +63 -0
- package/dist/shard-modules/attributesModule.js +16 -0
- package/dist/shard-modules/centerModule.js +12 -0
- package/dist/shard-modules/clickModule.js +14 -0
- package/dist/shard-modules/counterUpModule.js +37 -0
- package/dist/shard-modules/dynamicClassModule.js +15 -0
- package/dist/shard-modules/index.js +9 -0
- package/dist/shard-modules/multiClickModule.js +41 -0
- package/dist/shard-modules/shardModule.js +12 -0
- package/dist/shard-modules/styleModule.js +20 -0
- package/dist/shard-modules/typeModule.js +37 -0
- package/dist/shards/backNextButtonShard.js +99 -0
- package/dist/shards/buttonShard.js +150 -0
- package/dist/shards/cardShard.js +35 -0
- package/dist/shards/checkboxShard.js +139 -0
- package/dist/shards/containerShard.js +16 -0
- package/dist/shards/imageShard.js +98 -0
- package/dist/shards/index.js +13 -0
- package/dist/shards/inputListShard.js +162 -0
- package/dist/shards/inputShard.js +33 -0
- package/dist/shards/selectShard.js +126 -0
- package/dist/shards/shard.js +79 -0
- package/dist/shards/svgShard.js +29 -0
- package/dist/shards/tabsShard.js +59 -0
- package/dist/shards/textShard.js +27 -0
- package/dist/styles.css +209 -1
- package/dist/toasts.js +189 -0
- package/dist/types/changelogs.d.ts +1 -0
- package/dist/types/core-subscreen/coreSubscreen.d.ts +15 -0
- package/dist/types/core-subscreen/developmentSubscreen.d.ts +5 -0
- package/dist/types/core-subscreen/generalSubscreen.d.ts +5 -0
- package/dist/types/core-subscreen/mainSubscreen.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreButtonShard.d.ts +5 -0
- package/dist/types/core-subscreen/shards/coreCheckboxShard.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreInputListShard.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreSelectShard.d.ts +5 -0
- package/dist/types/core-subscreen/shards/coreTextShard.d.ts +4 -0
- package/dist/types/core-subscreen/shards/index.d.ts +5 -0
- package/dist/types/core-subscreen/toastsSubscreen.d.ts +5 -0
- package/dist/types/core.d.ts +18 -0
- package/dist/types/dialogs.d.ts +29 -0
- package/dist/types/globals.d.ts +6 -0
- package/dist/types/index.d.ts +62 -6
- package/dist/types/localization.d.ts +4 -0
- package/dist/types/logging.d.ts +16 -0
- package/dist/types/messaging.d.ts +5 -3
- package/dist/types/{modsApi.d.ts → modSdk.d.ts} +2 -2
- package/dist/types/shard-modules/attributesModule.d.ts +7 -0
- package/dist/types/shard-modules/centerModule.d.ts +5 -0
- package/dist/types/shard-modules/clickModule.d.ts +7 -0
- package/dist/types/shard-modules/counterUpModule.d.ts +13 -0
- package/dist/types/shard-modules/dynamicClassModule.d.ts +8 -0
- package/dist/types/{ui-modules → shard-modules}/index.d.ts +2 -0
- package/dist/types/shard-modules/multiClickModule.d.ts +12 -0
- package/dist/types/shard-modules/shardModule.d.ts +7 -0
- package/dist/types/shard-modules/styleModule.d.ts +8 -0
- package/dist/types/shard-modules/typeModule.d.ts +11 -0
- package/dist/types/shards/backNextButtonShard.d.ts +14 -0
- package/dist/types/shards/buttonShard.d.ts +21 -0
- package/dist/types/shards/cardShard.d.ts +10 -0
- package/dist/types/shards/checkboxShard.d.ts +19 -0
- package/dist/types/shards/containerShard.d.ts +7 -0
- package/dist/types/shards/imageShard.d.ts +11 -0
- package/dist/types/shards/index.d.ts +13 -0
- package/dist/types/shards/inputListShard.d.ts +16 -0
- package/dist/types/shards/inputShard.d.ts +14 -0
- package/dist/types/shards/selectShard.d.ts +17 -0
- package/dist/types/shards/shard.d.ts +21 -0
- package/dist/types/shards/svgShard.d.ts +12 -0
- package/dist/types/shards/tabsShard.d.ts +17 -0
- package/dist/types/shards/textShard.d.ts +13 -0
- package/dist/types/toasts.d.ts +21 -0
- package/dist/types/ui.d.ts +35 -148
- package/dist/ui.js +375 -11
- package/dist/validation.js +31 -1
- package/dist/wardrobe.js +167 -1
- package/package.json +47 -26
- package/scripts/zois-core.mjs +126 -0
- package/dist/modsApi.js +0 -1
- package/dist/modules.js +0 -1
- package/dist/popups.js +0 -1
- package/dist/types/modules.d.ts +0 -18
- package/dist/types/popups.d.ts +0 -63
- package/dist/types/ui-modules/attributesModule.d.ts +0 -6
- package/dist/types/ui-modules/centerModule.d.ts +0 -4
- package/dist/types/ui-modules/clickModule.d.ts +0 -6
- package/dist/types/ui-modules/counterUpModule.d.ts +0 -12
- package/dist/types/ui-modules/dynamicClassModule.d.ts +0 -7
- package/dist/types/ui-modules/styleModule.d.ts +0 -7
- package/dist/types/ui-modules/typeModule.d.ts +0 -10
- package/dist/ui-modules/attributesModule.js +0 -1
- package/dist/ui-modules/centerModule.js +0 -1
- package/dist/ui-modules/clickModule.js +0 -1
- package/dist/ui-modules/counterUpModule.js +0 -1
- package/dist/ui-modules/dynamicClassModule.js +0 -1
- package/dist/ui-modules/index.js +0 -1
- package/dist/ui-modules/styleModule.js +0 -1
- package/dist/ui-modules/typeModule.js +0 -1
package/dist/toasts.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { CircleAlert, CircleCheck, CircleX, createElement, Info } from "lucide";
|
|
2
|
+
import { MOD_DATA } from "./index";
|
|
3
|
+
import { setPosition } from "./ui";
|
|
4
|
+
import { logger } from "./logging";
|
|
5
|
+
function createToastsContainer() {
|
|
6
|
+
const container = document.createElement("div");
|
|
7
|
+
container.classList.add("zcToastsContainer");
|
|
8
|
+
container.addEventListener("click", () => {
|
|
9
|
+
const pos = window.ZOIS_CORE.getSettings().toasts?.position ?? "bottom-left";
|
|
10
|
+
for (const toast of container.children) {
|
|
11
|
+
if (toast instanceof HTMLElement) {
|
|
12
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideOutToLeft" : "zcSlideOutToRight"} 0.3s ease-out forwards`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
setTimeout(() => container.innerHTML = "", 300);
|
|
16
|
+
});
|
|
17
|
+
const update = () => {
|
|
18
|
+
container.style.cssText = `font-family: ${CommonGetFontName()};`;
|
|
19
|
+
setPosition(container, 5, 5, window.ZOIS_CORE.getSettings().toasts?.position ?? "bottom-left");
|
|
20
|
+
};
|
|
21
|
+
window.addEventListener("resize", update);
|
|
22
|
+
document.body.append(container);
|
|
23
|
+
update();
|
|
24
|
+
document.addEventListener("zois-core:coresettingschanged", update);
|
|
25
|
+
return container;
|
|
26
|
+
}
|
|
27
|
+
function getToastIcon(type, theme) {
|
|
28
|
+
let icon;
|
|
29
|
+
switch (type) {
|
|
30
|
+
case "info":
|
|
31
|
+
icon = createElement(Info);
|
|
32
|
+
icon.style.fill = theme ? theme.iconFillColor : "rgb(68, 70, 202)";
|
|
33
|
+
icon.style.stroke = theme ? theme.iconStrokeColor : "rgb(148, 178, 217)";
|
|
34
|
+
break;
|
|
35
|
+
case "warning":
|
|
36
|
+
icon = createElement(CircleAlert);
|
|
37
|
+
icon.style.fill = theme ? theme.iconFillColor : "rgb(198, 146, 25)";
|
|
38
|
+
icon.style.stroke = theme ? theme.iconStrokeColor : "rgb(244, 220, 147)";
|
|
39
|
+
break;
|
|
40
|
+
case "error":
|
|
41
|
+
icon = createElement(CircleX);
|
|
42
|
+
icon.style.fill = theme ? theme.iconFillColor : "rgb(174, 1, 1)";
|
|
43
|
+
icon.style.stroke = theme ? theme.iconStrokeColor : "rgb(255, 163, 163)";
|
|
44
|
+
break;
|
|
45
|
+
case "success":
|
|
46
|
+
icon = createElement(CircleCheck);
|
|
47
|
+
icon.style.fill = theme ? theme.iconFillColor : "rgb(49, 142, 68)";
|
|
48
|
+
icon.style.stroke = theme ? theme.iconStrokeColor : "rgb(122, 213, 162)";
|
|
49
|
+
break;
|
|
50
|
+
case "spinner":
|
|
51
|
+
icon = document.createElement("div");
|
|
52
|
+
icon.style.cssText = `
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
border: 2px solid;
|
|
55
|
+
border-radius: 100%;
|
|
56
|
+
border-color: transparent ${theme ? theme.iconFillColor : "rgb(68, 70, 202)"};
|
|
57
|
+
animation: zcSpin 0.65s linear infinite;
|
|
58
|
+
`;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
icon.style.cssText += `flex-shink: 0; width: 1.65em; height: 1.65em;`;
|
|
62
|
+
return icon;
|
|
63
|
+
}
|
|
64
|
+
function createToast({ title, message, type, duration, theme, id }) {
|
|
65
|
+
const pos = window.ZOIS_CORE.getSettings().toasts?.position ?? "bottom-left";
|
|
66
|
+
const backgroundColor = theme ? theme.backgroundColor : type === "success" ? "rgb(122, 213, 162)" : type === "warning" ? "rgb(244, 220, 147)" : type === "error" ? "rgb(255, 163, 163)" : "rgb(148, 178, 217)";
|
|
67
|
+
const textColor = theme ? theme.titleColor : type === "info" || type === "spinner" ? "rgb(0, 2, 125)" : type === "success" ? "#244428" : type === "error" ? "rgb(128, 22, 22)" : "rgb(100, 74, 16)";
|
|
68
|
+
const progressBarColor = theme ? theme.progressBarColor : "#00000014";
|
|
69
|
+
const toastContainer = document.querySelector(".zcToastsContainer") ?? createToastsContainer();
|
|
70
|
+
const toast = document.createElement("div");
|
|
71
|
+
toast.classList.add("zcToast");
|
|
72
|
+
toast.setAttribute("data-zc-toast-type", type);
|
|
73
|
+
toast.setAttribute("data-zc-toast-id", id);
|
|
74
|
+
const update = () => {
|
|
75
|
+
const canvasWidth = MainCanvas.canvas.clientWidth;
|
|
76
|
+
const canvasHeight = MainCanvas.canvas.clientHeight;
|
|
77
|
+
const scaleFactor = Math.min(canvasWidth, canvasHeight) / 100;
|
|
78
|
+
toast.style.cssText = `width: 100%; font-size: ${2.85 * scaleFactor}px; padding: ${1 * scaleFactor}px; background: ${backgroundColor}; border: 1px solid #555;`;
|
|
79
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideInFromLeft" : "zcSlideInFromRight"} 0.3s ease-out forwards`;
|
|
80
|
+
};
|
|
81
|
+
if (type !== "spinner") {
|
|
82
|
+
const progressBar = document.createElement("div");
|
|
83
|
+
progressBar.classList.add("zcToast-ProgressBar");
|
|
84
|
+
progressBar.style.cssText = `animation: zcToast-progress ${duration}ms linear 0s 1 alternate none; position: absolute; top: 0; left: 0; height: 100%; border-radius: 4px; background: ${progressBarColor};`;
|
|
85
|
+
toast.append(progressBar);
|
|
86
|
+
}
|
|
87
|
+
const textContainer = document.createElement("div");
|
|
88
|
+
if (title) {
|
|
89
|
+
const _title = document.createElement("p");
|
|
90
|
+
_title.style.color = textColor;
|
|
91
|
+
_title.style.fontWeight = "bold";
|
|
92
|
+
_title.style.fontSize = "0.9em";
|
|
93
|
+
_title.textContent = title;
|
|
94
|
+
textContainer.append(_title);
|
|
95
|
+
}
|
|
96
|
+
const _message = document.createElement("p");
|
|
97
|
+
_message.style.color = textColor;
|
|
98
|
+
_message.style.fontSize = !!title ? "0.7em" : "0.9em";
|
|
99
|
+
_message.style.overflowWrap = "anywhere";
|
|
100
|
+
if (!title) {
|
|
101
|
+
_message.style.fontWeight = "bold";
|
|
102
|
+
} else {
|
|
103
|
+
_message.style.marginTop = "0.15em";
|
|
104
|
+
}
|
|
105
|
+
_message.textContent = message;
|
|
106
|
+
textContainer.append(_message);
|
|
107
|
+
toast.append(getToastIcon(type, theme), textContainer);
|
|
108
|
+
window.addEventListener("resize", update);
|
|
109
|
+
toastContainer.append(toast);
|
|
110
|
+
update();
|
|
111
|
+
void toast.offsetHeight;
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideOutToLeft" : "zcSlideOutToRight"} 0.3s ease-out forwards`;
|
|
114
|
+
}, duration);
|
|
115
|
+
setTimeout(() => toast.remove(), duration + 300);
|
|
116
|
+
}
|
|
117
|
+
class ToastsManager {
|
|
118
|
+
generateToastId() {
|
|
119
|
+
return crypto.randomUUID();
|
|
120
|
+
}
|
|
121
|
+
process({ title, message, duration, type, id, theme }) {
|
|
122
|
+
const coreSettings = window.ZOIS_CORE.getSettings();
|
|
123
|
+
if (coreSettings.toasts?.blacklist?.enabled && coreSettings.toasts.blacklist.content?.length !== 0) {
|
|
124
|
+
if (coreSettings.toasts.blacklist.content?.some((v) => {
|
|
125
|
+
const regexp = new RegExp(v);
|
|
126
|
+
return regexp.test(title ?? "") || regexp.test(message);
|
|
127
|
+
})) {
|
|
128
|
+
logger.log("Toast message blocked due to blacklist settings");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (coreSettings.toasts?.preventUsingSingleTheme) {
|
|
133
|
+
createToast({
|
|
134
|
+
id,
|
|
135
|
+
title,
|
|
136
|
+
message,
|
|
137
|
+
duration,
|
|
138
|
+
type
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
createToast({
|
|
142
|
+
id,
|
|
143
|
+
title,
|
|
144
|
+
message,
|
|
145
|
+
duration,
|
|
146
|
+
type,
|
|
147
|
+
theme
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
info({ title, message, duration }) {
|
|
152
|
+
const id = this.generateToastId();
|
|
153
|
+
const theme = MOD_DATA.singleToastsTheme;
|
|
154
|
+
this.process({ title, message, duration, type: "info", id, theme });
|
|
155
|
+
}
|
|
156
|
+
success({ title, message, duration }) {
|
|
157
|
+
const id = this.generateToastId();
|
|
158
|
+
const theme = MOD_DATA.singleToastsTheme;
|
|
159
|
+
this.process({ title, message, duration, type: "success", id, theme });
|
|
160
|
+
}
|
|
161
|
+
warn({ title, message, duration }) {
|
|
162
|
+
const id = this.generateToastId();
|
|
163
|
+
const theme = MOD_DATA.singleToastsTheme;
|
|
164
|
+
this.process({ title, message, duration, type: "warning", id, theme });
|
|
165
|
+
}
|
|
166
|
+
error({ title, message, duration }) {
|
|
167
|
+
const id = this.generateToastId();
|
|
168
|
+
const theme = MOD_DATA.singleToastsTheme;
|
|
169
|
+
this.process({ title, message, duration, type: "error", id, theme });
|
|
170
|
+
}
|
|
171
|
+
spinner({ title, message }) {
|
|
172
|
+
const id = this.generateToastId();
|
|
173
|
+
const theme = MOD_DATA.singleToastsTheme;
|
|
174
|
+
this.process({ title, message, duration: 1e6, type: "spinner", id, theme });
|
|
175
|
+
return id;
|
|
176
|
+
}
|
|
177
|
+
removeSpinner(id) {
|
|
178
|
+
const toast = document.querySelector(`div[data-zc-toast-id="${id}"]`);
|
|
179
|
+
if (!toast) return;
|
|
180
|
+
const pos = window.ZOIS_CORE.getSettings().toasts?.position ?? "bottom-left";
|
|
181
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideOutToLeft" : "zcSlideOutToRight"} 0.3s ease-out forwards`;
|
|
182
|
+
setTimeout(() => toast.remove(), 300);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const toastsManager = new ToastsManager();
|
|
186
|
+
export {
|
|
187
|
+
ToastsManager,
|
|
188
|
+
toastsManager
|
|
189
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function showChangelogModal(): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseSubscreen } from "../ui";
|
|
2
|
+
import { ButtonShardContext, CheckboxShardContext, InputListShardContext, SelectShardContext, TextShardContext } from "../shards";
|
|
3
|
+
export declare abstract class CoreSubscreen extends BaseSubscreen {
|
|
4
|
+
private g;
|
|
5
|
+
private h;
|
|
6
|
+
private interval;
|
|
7
|
+
run(): void;
|
|
8
|
+
load(): void;
|
|
9
|
+
createText(ctx: TextShardContext): HTMLParagraphElement;
|
|
10
|
+
createButton(ctx: ButtonShardContext): HTMLButtonElement;
|
|
11
|
+
createCheckbox(ctx: CheckboxShardContext): HTMLDivElement;
|
|
12
|
+
createInputList(ctx: InputListShardContext): HTMLDivElement;
|
|
13
|
+
createSelect(ctx: SelectShardContext): HTMLDivElement;
|
|
14
|
+
unload(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InputListShard } from "../../shards";
|
|
2
|
+
import { DynamicClassStyles } from "../../ui";
|
|
3
|
+
export declare class CoreInputListShard extends InputListShard {
|
|
4
|
+
get dynamicClassContainer(): DynamicClassStyles;
|
|
5
|
+
get dynamicClassToolsButton(): DynamicClassStyles;
|
|
6
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ModData } from "./index";
|
|
2
|
+
import { Anchor } from "./ui";
|
|
3
|
+
export interface CoreSettings {
|
|
4
|
+
devMode?: boolean;
|
|
5
|
+
toasts?: {
|
|
6
|
+
position?: Anchor;
|
|
7
|
+
preventUsingSingleTheme?: boolean;
|
|
8
|
+
singleTheme?: ModData["singleToastsTheme"];
|
|
9
|
+
blacklist?: {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
content?: string[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare let coreSettings: CoreSettings;
|
|
16
|
+
export declare function syncSettings(): void;
|
|
17
|
+
export declare function registerSubscreen(): void;
|
|
18
|
+
export declare function registerCore(): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface BaseDialogProps<T> {
|
|
2
|
+
type: "prompt" | "confirm" | "pick";
|
|
3
|
+
message: string;
|
|
4
|
+
promise: {
|
|
5
|
+
resolve: (data: T) => void;
|
|
6
|
+
reject: (data: T) => void;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
interface ConfirmDialogProps extends BaseDialogProps<boolean> {
|
|
10
|
+
type: "confirm";
|
|
11
|
+
}
|
|
12
|
+
interface PromptDialogProps extends BaseDialogProps<string | false> {
|
|
13
|
+
type: "prompt";
|
|
14
|
+
}
|
|
15
|
+
interface PickDialogProps<T> extends BaseDialogProps<T | false> {
|
|
16
|
+
type: "pick";
|
|
17
|
+
options: {
|
|
18
|
+
name: string;
|
|
19
|
+
value: T;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
export declare class DialogsManager {
|
|
23
|
+
private process;
|
|
24
|
+
prompt({ message }: Omit<PromptDialogProps, "type" | "promise">): Promise<string | false>;
|
|
25
|
+
confirm({ message }: Omit<ConfirmDialogProps, "type" | "promise">): Promise<boolean>;
|
|
26
|
+
pick<T>({ message, options }: Omit<PickDialogProps<T>, "type" | "promise">): Promise<T | false>;
|
|
27
|
+
}
|
|
28
|
+
export declare const dialogsManager: DialogsManager;
|
|
29
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseSubscreen } from "./ui";
|
|
1
|
+
import { BaseSubscreen, SubscreenConstructor } from "./ui";
|
|
2
2
|
export interface ModData {
|
|
3
3
|
name: string;
|
|
4
4
|
fullName: string;
|
|
@@ -16,7 +16,31 @@ export interface ModData {
|
|
|
16
16
|
iconFillColor: string;
|
|
17
17
|
iconStrokeColor: string;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
subscreens?: Record<string, SubscreenConstructor>;
|
|
20
|
+
localization?: {
|
|
21
|
+
locales: {
|
|
22
|
+
default: string;
|
|
23
|
+
supported: string[];
|
|
24
|
+
};
|
|
25
|
+
translationsFolderPath: string;
|
|
26
|
+
};
|
|
27
|
+
changelog?: {
|
|
28
|
+
data: {
|
|
29
|
+
generated_at: string;
|
|
30
|
+
changes: {
|
|
31
|
+
message: string;
|
|
32
|
+
sha: string;
|
|
33
|
+
author: {
|
|
34
|
+
name: string;
|
|
35
|
+
avatar_url: string;
|
|
36
|
+
};
|
|
37
|
+
date: string;
|
|
38
|
+
tags: ("feature" | "chore" | "fix")[];
|
|
39
|
+
commit_url: string;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
onReady?: () => void;
|
|
20
44
|
}
|
|
21
45
|
interface ThemedColorsModule {
|
|
22
46
|
base: {
|
|
@@ -43,16 +67,48 @@ interface ThemedColorsModule {
|
|
|
43
67
|
}
|
|
44
68
|
export { version } from "../package.json";
|
|
45
69
|
export declare let MOD_DATA: ModData;
|
|
46
|
-
export declare function
|
|
70
|
+
export declare function bootstrap(modData: ModData): void;
|
|
71
|
+
export declare function formatString(text: string): ({
|
|
72
|
+
html: string;
|
|
73
|
+
isBeatifulString: true;
|
|
74
|
+
} | {
|
|
75
|
+
isBeatifulString: false;
|
|
76
|
+
});
|
|
77
|
+
export declare class SetSubscreenEvent extends CustomEvent<{
|
|
78
|
+
target: string;
|
|
79
|
+
isTrusted: boolean;
|
|
80
|
+
}> {
|
|
81
|
+
constructor(detail: {
|
|
82
|
+
target: string;
|
|
83
|
+
isTrusted: boolean;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export declare class SubscreenLoadedEvent extends CustomEvent<{
|
|
87
|
+
subscreen: BaseSubscreen;
|
|
88
|
+
}> {
|
|
89
|
+
constructor(detail: {
|
|
90
|
+
subscreen: BaseSubscreen;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export declare class SubscreenUnloadedEvent extends CustomEvent<{
|
|
94
|
+
subscreen: BaseSubscreen;
|
|
95
|
+
}> {
|
|
96
|
+
constructor(detail: {
|
|
97
|
+
subscreen: BaseSubscreen;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export declare class CoreSettingsChangedEvent extends CustomEvent<never> {
|
|
101
|
+
constructor();
|
|
102
|
+
}
|
|
47
103
|
export declare function sleep(ms: number): Promise<() => {}>;
|
|
48
104
|
export declare function waitFor(func: () => boolean, cancelFunc?: () => boolean): Promise<boolean>;
|
|
49
105
|
export declare function getRandomNumber(min: number, max: number): number;
|
|
50
106
|
export declare function isVersionNewer(version1: string, version2: string): boolean;
|
|
51
107
|
export declare function colorsEqual(c1: string[] | string | null | undefined, c2: string[] | string | null | undefined): boolean;
|
|
52
108
|
export declare function getSizeInKbytes(b: any): number;
|
|
53
|
-
export declare function getPlayer(value: string | number): Character;
|
|
109
|
+
export declare function getPlayer(value: string | number): Character | null;
|
|
54
110
|
export declare function getNickname(target: Character): string;
|
|
55
111
|
export declare function getThemedColorsModule(): ThemedColorsModule | null;
|
|
56
112
|
export declare function injectStyles(stylesToInject: string): void;
|
|
57
|
-
export declare function
|
|
58
|
-
export declare function normalizeObject(obj:
|
|
113
|
+
export declare function normalizeObject<T>(obj: T[]): T[];
|
|
114
|
+
export declare function normalizeObject<T extends object>(obj: T): T;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function getText(tag: string, replacements?: Record<string, string | number>): string;
|
|
2
|
+
export declare function processReplacements(text: string, replacements: Record<string, string | number>): string;
|
|
3
|
+
export declare function loadLocalization(): Promise<void>;
|
|
4
|
+
export declare function fetchTranslationsForLocale(locale: string): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type LogLevel = "debug" | "log" | "warn" | "error";
|
|
2
|
+
interface LogEntry {
|
|
3
|
+
level: LogLevel;
|
|
4
|
+
message: unknown[];
|
|
5
|
+
timestamp: number;
|
|
6
|
+
}
|
|
7
|
+
declare class Logger {
|
|
8
|
+
get logs(): LogEntry[];
|
|
9
|
+
private pushLog;
|
|
10
|
+
debug(...message: unknown[]): void;
|
|
11
|
+
log(...message: unknown[]): void;
|
|
12
|
+
warn(...message: unknown[]): void;
|
|
13
|
+
error(...message: unknown[]): void;
|
|
14
|
+
}
|
|
15
|
+
export declare const logger: Logger;
|
|
16
|
+
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ClassConstructor } from "class-transformer";
|
|
2
|
-
|
|
2
|
+
type RequestResponse<T> = {
|
|
3
3
|
data?: T;
|
|
4
|
-
isError:
|
|
5
|
-
}
|
|
4
|
+
isError: false;
|
|
5
|
+
} | {
|
|
6
|
+
isError: true;
|
|
7
|
+
};
|
|
6
8
|
declare class MessagesManager {
|
|
7
9
|
sendBeep<T>(data: T, targetId: number): void;
|
|
8
10
|
sendPacket<T>(msg: string, _data?: T, targetNumber?: number): void;
|
|
@@ -7,9 +7,9 @@ export declare enum HookPriority {
|
|
|
7
7
|
TOP = 100
|
|
8
8
|
}
|
|
9
9
|
export declare let modSdk: ModSDKModAPI;
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function createModSdk(): void;
|
|
11
11
|
export declare function hookFunction<TFunctionName extends string>(functionName: TFunctionName, priority: HookPriority, hook: PatchHook<GetDotedPathType<typeof globalThis, TFunctionName>>): () => void;
|
|
12
12
|
export declare function patchFunction(functionName: string, patches: Record<string, string | null>): void;
|
|
13
|
-
export declare function callOriginal<TFunctionName extends string>(target: TFunctionName, args: [...Parameters<GetDotedPathType<typeof globalThis, TFunctionName>>], context?: any): ReturnType<GetDotedPathType<typeof globalThis, TFunctionName
|
|
13
|
+
export declare function callOriginal<TFunctionName extends string>(target: TFunctionName, args: [...Parameters<GetDotedPathType<typeof globalThis, TFunctionName>>], context?: any): ReturnType<GetDotedPathType<typeof globalThis, TFunctionName>> | undefined;
|
|
14
14
|
export declare function getLoadedMods(): ModSDKModInfo[];
|
|
15
15
|
export declare function findModByName(name: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ShardContext } from "../shards";
|
|
2
|
+
import { ShardModule, ShardModuleTarget } from "./shardModule";
|
|
3
|
+
export declare class AttributesModule extends ShardModule {
|
|
4
|
+
private attributes;
|
|
5
|
+
constructor(attributes: Record<string, string>);
|
|
6
|
+
layoutEffect(context: ShardContext, target: ShardModuleTarget): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ShardContext } from "../shards";
|
|
2
|
+
import { ShardModule, ShardModuleTarget } from "./shardModule";
|
|
3
|
+
export declare class ClickModule extends ShardModule {
|
|
4
|
+
private callback;
|
|
5
|
+
constructor(callback: (target: ShardModuleTarget) => void);
|
|
6
|
+
layoutEffect(context: ShardContext, target: ShardModuleTarget): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ShardContext } from "../shards";
|
|
2
|
+
import { ShardModule, ShardModuleTarget } from "./shardModule";
|
|
3
|
+
interface CounterUpModuleProps {
|
|
4
|
+
duration: number;
|
|
5
|
+
endValue: number;
|
|
6
|
+
formattingFunction?: (value: number) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare class CounterUpModule extends ShardModule {
|
|
9
|
+
private props;
|
|
10
|
+
constructor(props: CounterUpModuleProps);
|
|
11
|
+
effect(context: ShardContext, target: ShardModuleTarget): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DynamicClassStyles } from "../ui";
|
|
2
|
+
import { ShardModule, ShardModuleTarget } from "./shardModule";
|
|
3
|
+
import { ShardContext } from "../shards";
|
|
4
|
+
export declare class DynamicClassModule extends ShardModule {
|
|
5
|
+
private style;
|
|
6
|
+
constructor(style: DynamicClassStyles);
|
|
7
|
+
layoutEffect(context: ShardContext, target: ShardModuleTarget): void;
|
|
8
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./shardModule";
|
|
1
2
|
export * from "./centerModule";
|
|
2
3
|
export * from "./counterUpModule";
|
|
3
4
|
export * from "./typeModule";
|
|
@@ -5,3 +6,4 @@ export * from "./styleModule";
|
|
|
5
6
|
export * from "./dynamicClassModule";
|
|
6
7
|
export * from "./attributesModule";
|
|
7
8
|
export * from "./clickModule";
|
|
9
|
+
export * from "./multiClickModule";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ShardContext } from "../shards";
|
|
2
|
+
import { ShardModule, ShardModuleTarget } from "./shardModule";
|
|
3
|
+
interface MultiClickModuleProps {
|
|
4
|
+
n: number;
|
|
5
|
+
callback: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class MultiClickModule extends ShardModule<ShardContext> {
|
|
8
|
+
private readonly props;
|
|
9
|
+
constructor(props: MultiClickModuleProps);
|
|
10
|
+
effect(context: ShardContext<never>, target: ShardModuleTarget): void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ShardContext } from "../shards";
|
|
2
|
+
export type ShardModuleTarget = HTMLElement | SVGElement;
|
|
3
|
+
export declare abstract class ShardModule<Context extends ShardContext = ShardContext> {
|
|
4
|
+
overrideContext(context: Context, target: ShardModuleTarget): Context;
|
|
5
|
+
layoutEffect(context: Context, target: ShardModuleTarget): void;
|
|
6
|
+
effect(context: Context, target: ShardModuleTarget): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ShardContext } from "../shards";
|
|
2
|
+
import { ShardModule, ShardModuleTarget } from "./shardModule";
|
|
3
|
+
export declare class StyleModule extends ShardModule {
|
|
4
|
+
private style;
|
|
5
|
+
constructor(style: Partial<CSSStyleDeclaration>);
|
|
6
|
+
private applyStyle;
|
|
7
|
+
layoutEffect(context: ShardContext, target: ShardModuleTarget): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ShardContext } from "../shards";
|
|
2
|
+
import { ShardModule, ShardModuleTarget } from "./shardModule";
|
|
3
|
+
interface TypeModuleProps {
|
|
4
|
+
duration: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class TypeModule extends ShardModule {
|
|
7
|
+
private readonly props;
|
|
8
|
+
constructor(props: TypeModuleProps);
|
|
9
|
+
effect(context: ShardContext, target: ShardModuleTarget): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DynamicClassStyles } from "../ui";
|
|
2
|
+
import { Shard, ShardContext } from "./shard";
|
|
3
|
+
export interface BackNextButtonShardContext extends ShardContext<"backButton" | "nextButton" | "text"> {
|
|
4
|
+
items: [string, any?][];
|
|
5
|
+
currentIndex: number;
|
|
6
|
+
onChange?: (value: any) => void;
|
|
7
|
+
isDisabled?: (value: any) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class BackNextButtonShard extends Shard<BackNextButtonShardContext> {
|
|
10
|
+
protected get dynamicClassContainer(): DynamicClassStyles;
|
|
11
|
+
protected get dynamicClassButton(): DynamicClassStyles;
|
|
12
|
+
generateBody(): Record<keyof NonNullable<BackNextButtonShardContext["modules"]>, HTMLElement | SVGElement>;
|
|
13
|
+
update(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DynamicClassStyles } from "../ui";
|
|
2
|
+
import { Shard, ShardContext } from "./shard";
|
|
3
|
+
export interface ButtonShardContext extends ShardContext<"icon" | "text"> {
|
|
4
|
+
text?: string;
|
|
5
|
+
fontSize?: number | "auto";
|
|
6
|
+
variant?: "outlined" | "filled";
|
|
7
|
+
icon?: string | SVGElement;
|
|
8
|
+
iconAbsolutePosition?: boolean;
|
|
9
|
+
tooltip?: {
|
|
10
|
+
text: string;
|
|
11
|
+
position: "left" | "right";
|
|
12
|
+
};
|
|
13
|
+
href?: string;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
isDisabled?: () => boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class ButtonShard extends Shard<ButtonShardContext> {
|
|
18
|
+
protected get dynamicClassButton(): DynamicClassStyles;
|
|
19
|
+
generateBody(): Record<keyof NonNullable<ButtonShardContext["modules"]>, HTMLElement | SVGElement>;
|
|
20
|
+
update(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Shard, ShardContext } from "./shard";
|
|
2
|
+
export interface CardShardContext extends ShardContext<"base" | "name" | "value" | "icon"> {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
icon?: SVGElement;
|
|
6
|
+
}
|
|
7
|
+
export declare class CardShard extends Shard<CardShardContext> {
|
|
8
|
+
generateBody(): Record<keyof NonNullable<CardShardContext["modules"]>, HTMLElement | SVGElement>;
|
|
9
|
+
update(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DynamicClassStyles } from "../ui";
|
|
2
|
+
import { Shard, ShardContext } from "./shard";
|
|
3
|
+
export interface CheckboxShardContext extends ShardContext<"checkbox" | "label"> {
|
|
4
|
+
isChecked: boolean;
|
|
5
|
+
text: string;
|
|
6
|
+
tooltip?: {
|
|
7
|
+
position: "left" | "right";
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
onChange?: () => void;
|
|
11
|
+
isDisabled?: () => boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class CheckboxShard extends Shard<CheckboxShardContext> {
|
|
14
|
+
protected get dynamicClassInput(): DynamicClassStyles;
|
|
15
|
+
protected get dynamicClassCheckmark(): DynamicClassStyles;
|
|
16
|
+
protected get textColor(): string;
|
|
17
|
+
generateBody(): Record<keyof NonNullable<CheckboxShardContext["modules"]>, HTMLElement | SVGElement>;
|
|
18
|
+
update(): void;
|
|
19
|
+
}
|