zois-core 2.2.1 → 3.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.
Files changed (159) hide show
  1. package/dist/assets/icons/toast-themes/abdl/bottle.svg +10 -0
  2. package/dist/assets/icons/toast-themes/abdl/diaper.svg +11 -0
  3. package/dist/assets/icons/toast-themes/abdl/heart.svg +7 -0
  4. package/dist/assets/icons/toast-themes/abdl/sparkle.svg +5 -0
  5. package/dist/assets/icons/toast-themes/abdl/star.svg +5 -0
  6. package/dist/assets/icons/toast-themes/abdl/teddy.svg +18 -0
  7. package/dist/assets/icons/toast-themes/anime/error.svg +20 -0
  8. package/dist/assets/icons/toast-themes/anime/info.svg +20 -0
  9. package/dist/assets/icons/toast-themes/anime/success.svg +16 -0
  10. package/dist/assets/icons/toast-themes/anime/warning.svg +19 -0
  11. package/dist/changelogs.js +628 -295
  12. package/dist/cssVars.js +46 -0
  13. package/dist/dialogs.js +523 -83
  14. package/dist/events.js +28 -6
  15. package/dist/index.js +27 -70
  16. package/dist/localization.js +250 -40
  17. package/dist/messaging.js +6 -6
  18. package/dist/migration.js +37 -0
  19. package/dist/modules/baseModule.js +110 -0
  20. package/dist/modules/index.js +4 -0
  21. package/dist/modules/loadingStrategy.js +20 -0
  22. package/dist/modules/moduleContext.js +67 -0
  23. package/dist/modules/modulesManager.js +175 -0
  24. package/dist/{modSdk.js → patching.js} +33 -9
  25. package/dist/rpc.js +139 -0
  26. package/dist/scripts/zois-core.js +14 -14
  27. package/dist/settings.js +90 -0
  28. package/dist/settingsDialog.js +1361 -0
  29. package/dist/shard-modules/{attributesModule.js → attributes.js} +2 -2
  30. package/dist/shard-modules/{shardModule.js → base.js} +2 -2
  31. package/dist/shard-modules/{centerModule.js → center.js} +4 -2
  32. package/dist/shard-modules/{clickModule.js → click.js} +2 -2
  33. package/dist/shard-modules/{counterUpModule.js → counterUp.js} +2 -2
  34. package/dist/shard-modules/{dynamicClassModule.js → dynamicClass.js} +2 -2
  35. package/dist/shard-modules/index.js +9 -9
  36. package/dist/shard-modules/{multiClickModule.js → multiClick.js} +2 -2
  37. package/dist/shard-modules/{styleModule.js → style.js} +2 -2
  38. package/dist/shard-modules/{typeModule.js → type.js} +2 -2
  39. package/dist/shards/backNextButton.js +173 -0
  40. package/dist/shards/{shard.js → base.js} +15 -15
  41. package/dist/shards/{buttonShard.js → button.js} +30 -52
  42. package/dist/shards/{cardShard.js → card.js} +4 -4
  43. package/dist/shards/{checkboxShard.js → checkbox.js} +8 -15
  44. package/dist/shards/{containerShard.js → container.js} +2 -2
  45. package/dist/shards/extensionsStorageBar.js +377 -0
  46. package/dist/shards/fileInput.js +180 -0
  47. package/dist/shards/flexContainer.js +30 -0
  48. package/dist/shards/gridContainer.js +34 -0
  49. package/dist/shards/{imageShard.js → image.js} +8 -6
  50. package/dist/shards/index.js +17 -13
  51. package/dist/shards/{inputShard.js → input.js} +8 -8
  52. package/dist/shards/{inputListShard.js → inputList.js} +22 -4
  53. package/dist/shards/select.js +201 -0
  54. package/dist/shards/svg.js +28 -0
  55. package/dist/shards/{tabsShard.js → tabs.js} +18 -19
  56. package/dist/shards/{textShard.js → text.js} +10 -6
  57. package/dist/shared.js +215 -0
  58. package/dist/styles.css +0 -51
  59. package/dist/subscreens/customTranslations.js +239 -0
  60. package/dist/subscreens/languageDetails.js +194 -0
  61. package/dist/subscreens/localization.js +115 -0
  62. package/dist/toast-themes/abdl.js +419 -0
  63. package/dist/toast-themes/anime.js +483 -0
  64. package/dist/toast-themes/base.js +40 -0
  65. package/dist/toast-themes/cyber.js +538 -0
  66. package/dist/toast-themes/default.js +282 -0
  67. package/dist/toastThemesDialog.js +274 -0
  68. package/dist/toasts.js +195 -174
  69. package/dist/types/cssVars.d.ts +1 -0
  70. package/dist/types/dialogs.d.ts +46 -18
  71. package/dist/types/events.d.ts +11 -2
  72. package/dist/types/global.d.ts +4 -3
  73. package/dist/types/index.d.ts +12 -19
  74. package/dist/types/localization.d.ts +25 -3
  75. package/dist/types/migration.d.ts +6 -0
  76. package/dist/types/modules/baseModule.d.ts +108 -0
  77. package/dist/types/modules/index.d.ts +4 -0
  78. package/dist/types/modules/loadingStrategy.d.ts +7 -0
  79. package/dist/types/modules/moduleContext.d.ts +10 -0
  80. package/dist/types/modules/modulesManager.d.ts +23 -0
  81. package/dist/types/{modSdk.d.ts → patching.d.ts} +2 -3
  82. package/dist/types/rpc.d.ts +72 -0
  83. package/dist/types/settings.d.ts +19 -0
  84. package/dist/types/settingsDialog.d.ts +4 -0
  85. package/dist/types/shard-modules/{attributesModule.d.ts → attributes.d.ts} +2 -2
  86. package/dist/types/shard-modules/{shardModule.d.ts → base.d.ts} +2 -2
  87. package/dist/types/shard-modules/{centerModule.d.ts → center.d.ts} +2 -1
  88. package/dist/types/shard-modules/{clickModule.d.ts → click.d.ts} +2 -2
  89. package/dist/types/shard-modules/{counterUpModule.d.ts → counterUp.d.ts} +2 -2
  90. package/dist/types/shard-modules/{dynamicClassModule.d.ts → dynamicClass.d.ts} +2 -2
  91. package/dist/types/shard-modules/index.d.ts +9 -9
  92. package/dist/types/shard-modules/{multiClickModule.d.ts → multiClick.d.ts} +2 -2
  93. package/dist/types/shard-modules/{styleModule.d.ts → style.d.ts} +2 -2
  94. package/dist/types/shard-modules/{typeModule.d.ts → type.d.ts} +2 -2
  95. package/dist/types/shards/{backNextButtonShard.d.ts → backNextButton.d.ts} +4 -3
  96. package/dist/types/shards/{shard.d.ts → base.d.ts} +3 -2
  97. package/dist/types/shards/{buttonShard.d.ts → button.d.ts} +6 -6
  98. package/dist/types/shards/{cardShard.d.ts → card.d.ts} +3 -3
  99. package/dist/types/shards/{checkboxShard.d.ts → checkbox.d.ts} +6 -6
  100. package/dist/types/shards/{containerShard.d.ts → container.d.ts} +2 -2
  101. package/dist/types/shards/extensionsStorageBar.d.ts +28 -0
  102. package/dist/types/shards/fileInput.d.ts +10 -0
  103. package/dist/types/shards/flexContainer.d.ts +14 -0
  104. package/dist/types/shards/gridContainer.d.ts +18 -0
  105. package/dist/types/shards/{imageShard.d.ts → image.d.ts} +2 -2
  106. package/dist/types/shards/index.d.ts +17 -13
  107. package/dist/types/shards/input.d.ts +14 -0
  108. package/dist/types/shards/{inputListShard.d.ts → inputList.d.ts} +3 -2
  109. package/dist/types/shards/{selectShard.d.ts → select.d.ts} +6 -4
  110. package/dist/types/shards/svg.d.ts +11 -0
  111. package/dist/types/shards/{tabsShard.d.ts → tabs.d.ts} +3 -6
  112. package/dist/types/shards/{textShard.d.ts → text.d.ts} +3 -3
  113. package/dist/types/shared.d.ts +7 -0
  114. package/dist/types/subscreens/customTranslations.d.ts +10 -0
  115. package/dist/types/subscreens/languageDetails.d.ts +14 -0
  116. package/dist/types/subscreens/localization.d.ts +5 -0
  117. package/dist/types/toast-themes/abdl.d.ts +9 -0
  118. package/dist/types/toast-themes/anime.d.ts +9 -0
  119. package/dist/types/toast-themes/base.d.ts +39 -0
  120. package/dist/types/toast-themes/cyber.d.ts +10 -0
  121. package/dist/types/toast-themes/default.d.ts +9 -0
  122. package/dist/types/toastThemesDialog.d.ts +1 -0
  123. package/dist/types/toasts.d.ts +48 -36
  124. package/dist/types/ui.d.ts +128 -49
  125. package/dist/types/validation.d.ts +5 -0
  126. package/dist/types/wardrobe.d.ts +1 -1
  127. package/dist/ui.js +414 -79
  128. package/dist/validation.js +79 -1
  129. package/dist/wardrobe.js +4 -4
  130. package/package.json +36 -14
  131. package/dist/core-subscreen/coreSubscreen.js +0 -81
  132. package/dist/core-subscreen/developmentSubscreen.js +0 -22
  133. package/dist/core-subscreen/generalSubscreen.js +0 -23
  134. package/dist/core-subscreen/mainSubscreen.js +0 -58
  135. package/dist/core-subscreen/shards/coreButtonShard.js +0 -30
  136. package/dist/core-subscreen/shards/coreCheckboxShard.js +0 -33
  137. package/dist/core-subscreen/shards/coreInputListShard.js +0 -38
  138. package/dist/core-subscreen/shards/coreSelectShard.js +0 -17
  139. package/dist/core-subscreen/shards/coreTextShard.js +0 -9
  140. package/dist/core-subscreen/shards/index.js +0 -5
  141. package/dist/core-subscreen/toastsSubscreen.js +0 -111
  142. package/dist/core.js +0 -192
  143. package/dist/shards/backNextButtonShard.js +0 -99
  144. package/dist/shards/selectShard.js +0 -131
  145. package/dist/shards/svgShard.js +0 -29
  146. package/dist/types/core-subscreen/coreSubscreen.d.ts +0 -15
  147. package/dist/types/core-subscreen/developmentSubscreen.d.ts +0 -5
  148. package/dist/types/core-subscreen/generalSubscreen.d.ts +0 -5
  149. package/dist/types/core-subscreen/mainSubscreen.d.ts +0 -6
  150. package/dist/types/core-subscreen/shards/coreButtonShard.d.ts +0 -5
  151. package/dist/types/core-subscreen/shards/coreCheckboxShard.d.ts +0 -6
  152. package/dist/types/core-subscreen/shards/coreInputListShard.d.ts +0 -6
  153. package/dist/types/core-subscreen/shards/coreSelectShard.d.ts +0 -5
  154. package/dist/types/core-subscreen/shards/coreTextShard.d.ts +0 -4
  155. package/dist/types/core-subscreen/shards/index.d.ts +0 -5
  156. package/dist/types/core-subscreen/toastsSubscreen.d.ts +0 -5
  157. package/dist/types/core.d.ts +0 -18
  158. package/dist/types/shards/inputShard.d.ts +0 -14
  159. package/dist/types/shards/svgShard.d.ts +0 -12
package/dist/core.js DELETED
@@ -1,192 +0,0 @@
1
- import styles from "./styles.css";
2
- import { formatString, version, waitFor } from "./index";
3
- import { hookFunction, HookPriority } from "./modSdk";
4
- import { getCurrentSubscreen, setSubscreen } from "./ui";
5
- import { MainSubscreen } from "./core-subscreen/mainSubscreen";
6
- import { createElement, Terminal } from "lucide";
7
- import { ButtonShard, ContainerShard } from "./shards";
8
- import { StyleModule } from "./shard-modules";
9
- import { dialogsManager } from "./dialogs";
10
- import { getEventBus } from "./events";
11
- let coreSettings = {};
12
- let coreEventBus = null;
13
- function syncSettings() {
14
- if (typeof coreSettings !== "object") return;
15
- Player.ExtensionSettings.ZOIS_CORE = LZString.compressToBase64(JSON.stringify(coreSettings));
16
- ServerPlayerExtensionSettingsSync("ZOIS_CORE");
17
- coreEventBus?.emit("coreSettingsChanged", {
18
- settings: structuredClone(coreSettings)
19
- });
20
- }
21
- function registerSubscreen() {
22
- PreferenceRegisterExtensionSetting({
23
- Identifier: "ZOIS_CORE",
24
- Image: () => {
25
- const serializer = new XMLSerializer();
26
- const svgString = serializer.serializeToString(createElement(Terminal));
27
- return "data:image/svg+xml," + svgString;
28
- },
29
- ButtonText: () => "Zoi's Modding Core",
30
- load: () => {
31
- setSubscreen(new MainSubscreen());
32
- },
33
- run: () => {
34
- getCurrentSubscreen()?.run();
35
- },
36
- resize: () => {
37
- getCurrentSubscreen()?.resize();
38
- },
39
- click: () => {
40
- getCurrentSubscreen()?.click();
41
- },
42
- exit: () => {
43
- getCurrentSubscreen()?.exit();
44
- }
45
- });
46
- }
47
- let loginScreenElements = [];
48
- function registerCore() {
49
- const style = document.createElement("style");
50
- style.innerHTML = styles;
51
- document.head.append(style);
52
- coreEventBus = getEventBus("zois-core");
53
- window.ZOIS_CORE = Object.freeze({
54
- version,
55
- enableDevMode: () => {
56
- if (typeof Player?.MemberNumber !== "number") return;
57
- coreSettings.devMode = true;
58
- syncSettings();
59
- registerSubscreen();
60
- },
61
- getSettings: () => {
62
- return JSON.parse(JSON.stringify(coreSettings));
63
- },
64
- getEventBus
65
- });
66
- if (localStorage.getItem("autoConnectToDevServer") === "true") {
67
- hookFunction("CommonGetServer", HookPriority.OVERRIDE_BEHAVIOR, (args, next) => {
68
- return "https://bondage-club-server-test.herokuapp.com/";
69
- });
70
- const containerShard = new ContainerShard({
71
- x: 1250,
72
- y: 900,
73
- modules: {
74
- base: [
75
- new StyleModule({
76
- display: "flex"
77
- })
78
- ]
79
- }
80
- });
81
- const container = containerShard.mount();
82
- new ButtonShard({
83
- padding: 1,
84
- parent: container,
85
- text: "You connected to dev server"
86
- }).mount();
87
- new ButtonShard({
88
- width: 90,
89
- height: 90,
90
- padding: 1,
91
- icon: "Icons/Cancel.png",
92
- parent: container,
93
- onClick: () => {
94
- localStorage.removeItem("autoConnectToDevServer");
95
- location.reload();
96
- }
97
- }).mount();
98
- loginScreenElements.push(container);
99
- hookFunction("LoginUnload", HookPriority.OVERRIDE_BEHAVIOR, (args, next) => {
100
- loginScreenElements.forEach((e) => e.remove());
101
- return next(args);
102
- });
103
- ServerURL = CommonGetServer();
104
- ServerInit();
105
- }
106
- hookFunction("ChatRoomMessageCreateReplyMessageElement", HookPriority.OVERRIDE_BEHAVIOR, (args, next) => {
107
- const [msgId, displayMessage, data] = args;
108
- const r = formatString(displayMessage);
109
- if (!r.isBeatifulString) return next(args);
110
- if (!msgId) {
111
- return [displayMessage];
112
- }
113
- const metadata = ChatRoomGetMetadataElem(data.time, data.sender);
114
- metadata.setAttribute("aria-hidden", "true");
115
- return [
116
- ElementCreate({
117
- tag: "span",
118
- classList: ["chat-room-message-content"],
119
- attributes: { "msgid": msgId },
120
- innerHTML: r.html
121
- }),
122
- ElementMenu.Create(
123
- ElementGenerateID(),
124
- [
125
- metadata,
126
- ElementButton.Create(
127
- null,
128
- () => ChatRoomMessageSetReply(msgId),
129
- { noStyling: true, tooltip: "Reply" },
130
- { button: { attributes: { name: "reply" } } }
131
- )
132
- ],
133
- { direction: "rtl", role: "menu" },
134
- { menu: { classList: ["chat-room-message-popup"], attributes: { "aria-direction": "horizontal" } } }
135
- )
136
- ];
137
- });
138
- document.addEventListener("click", async (event) => {
139
- const link = event.target.closest("a");
140
- if (link && link.href) {
141
- try {
142
- const url = new URL(link.href);
143
- if (url.protocol === "zc:") {
144
- event.preventDefault();
145
- if (link.href.startsWith("zc://open")) {
146
- const target = url.pathname.split("/").filter(Boolean)[1];
147
- if (target === void 0) return;
148
- switch (target) {
149
- case "Admin": {
150
- if (await dialogsManager.confirm({ message: "This deep link wants to redirect you to Admin subscreen. Confirm the redirecting." })) {
151
- ChatRoomOpenAdminScreen();
152
- }
153
- break;
154
- }
155
- case "Wardrobe": {
156
- if (await dialogsManager.confirm({ message: "This deep link wants to redirect you to Wardrobe subscreen. Confirm the redirecting." })) {
157
- ChatRoomOpenWardrobeScreen();
158
- }
159
- break;
160
- }
161
- case "Information": {
162
- if (await dialogsManager.confirm({ message: "This deep link wants to redirect you to Information subscreen. Confirm the redirecting." })) {
163
- ChatRoomOpenInformationScreen();
164
- }
165
- break;
166
- }
167
- default: {
168
- coreEventBus?.emit("setSubscreen", {
169
- target,
170
- isTrusted: false
171
- });
172
- }
173
- }
174
- }
175
- }
176
- } catch (e) {
177
- }
178
- }
179
- }, true);
180
- waitFor(() => typeof Player?.MemberNumber === "number").then(() => {
181
- if (typeof Player.ExtensionSettings.ZOIS_CORE === "string") {
182
- coreSettings = JSON.parse(LZString.decompressFromBase64(Player.ExtensionSettings.ZOIS_CORE) ?? "{}");
183
- }
184
- if (coreSettings.devMode) registerSubscreen();
185
- });
186
- }
187
- export {
188
- coreSettings,
189
- registerCore,
190
- registerSubscreen,
191
- syncSettings
192
- };
@@ -1,99 +0,0 @@
1
- import { MOD_DATA } from "..";
2
- import { addDynamicClass, autosetFontSize, setFontFamily } from "../ui";
3
- import { Shard } from "./shard";
4
- class BackNextButtonShard extends Shard {
5
- get dynamicClassContainer() {
6
- return {
7
- base: {
8
- display: "flex",
9
- columnGap: "2vw",
10
- justifyContent: "center",
11
- alignItems: "center",
12
- background: "var(--tmd- element, white)",
13
- color: "var(--tmd-text, black)",
14
- border: "2px solid var(--tmd-accent, black)",
15
- borderRadius: "4px"
16
- }
17
- };
18
- }
19
- get dynamicClassButton() {
20
- return {
21
- base: {
22
- cursor: "pointer",
23
- background: "var(--tmd-element, white)",
24
- color: "var(--tmd-text, black)",
25
- border: "2px solid var(--tmd-accent, rgb(34, 34, 34))",
26
- borderRadius: "6px"
27
- },
28
- hover: {
29
- background: "var(--tmd-element-hover, #ebf7fe)",
30
- borderColor: "var(--tmd-accent-hover, #7dd3fc)",
31
- color: "var(--tmd-accent-hover, #015a8c)"
32
- },
33
- disabled: {
34
- background: "var(--tmd-element-disabled, #ffa590)",
35
- pointerEvents: "none"
36
- }
37
- };
38
- }
39
- generateBody() {
40
- const { onChange, isDisabled } = this.context;
41
- const div = document.createElement("div");
42
- addDynamicClass(div, this.dynamicClassContainer);
43
- setFontFamily(div, MOD_DATA.fontFamily);
44
- let currentIndex = this.context.currentIndex;
45
- let items = this.context.items;
46
- const updateClasses = () => {
47
- if (currentIndex === 0 || typeof isDisabled === "function" && isDisabled(items[currentIndex - 1][1])) backBtn.disabled = true;
48
- else backBtn.disabled = false;
49
- if (currentIndex === items.length - 1 || typeof isDisabled === "function" && isDisabled(items[currentIndex + 1][1])) nextBtn.disabled = true;
50
- else nextBtn.disabled = false;
51
- ;
52
- };
53
- const backBtn = document.createElement("button");
54
- backBtn.style.cssText = `
55
- position: absolute; left: 1vw; font-size: 3.5vw; aspect-ratio: 1/1;
56
- height: 140%; background-image: url("Icons/Prev.png"); background-size: 100%;
57
- `;
58
- addDynamicClass(backBtn, this.dynamicClassButton);
59
- backBtn.addEventListener("click", () => {
60
- if (currentIndex === 0) return backBtn.classList.add("zcDisabled");
61
- if (typeof isDisabled === "function" && isDisabled(items[currentIndex - 1][1])) return backBtn.classList.add("zcDisabled");
62
- currentIndex--;
63
- text.textContent = items[currentIndex][0];
64
- if (typeof onChange === "function") onChange(items[currentIndex][1]);
65
- updateClasses();
66
- });
67
- const nextBtn = document.createElement("button");
68
- nextBtn.style.cssText = `
69
- position: absolute; right: 1vw; font-size: 3.5vw; aspect-ratio: 1/1;
70
- height: 140%; background-image: url("Icons/Next.png"); background-size: 100%;
71
- `;
72
- addDynamicClass(nextBtn, this.dynamicClassButton);
73
- nextBtn.addEventListener("click", () => {
74
- if (currentIndex === items.length - 1) return nextBtn.classList.add("zcDisabled");
75
- if (typeof isDisabled === "function" && isDisabled(items[currentIndex + 1][1])) return nextBtn.classList.add("zcDisabled");
76
- currentIndex++;
77
- text.textContent = items[currentIndex][0];
78
- if (typeof onChange === "function") onChange(items[currentIndex][1]);
79
- updateClasses();
80
- });
81
- updateClasses();
82
- const text = document.createElement("b");
83
- text.textContent = items[currentIndex][0];
84
- div.append(backBtn, text, nextBtn);
85
- return {
86
- base: div,
87
- backButton: backBtn,
88
- nextButton: nextBtn,
89
- text
90
- };
91
- }
92
- update() {
93
- super.update();
94
- autosetFontSize(this.body.base);
95
- }
96
- }
97
- export {
98
- BackNextButtonShard
99
- };
@@ -1,131 +0,0 @@
1
- import { MOD_DATA } from "../index";
2
- import { addDynamicClass, autosetFontSize, setFontFamily } from "../ui";
3
- import { Shard } from "./shard";
4
- import { Check, ChevronDown, createElement } from "lucide";
5
- class SelectShard extends Shard {
6
- get dynamicClassContainer() {
7
- return {
8
- base: {
9
- cursor: "pointer",
10
- background: "var(--tmd-element, white)",
11
- color: "var(--tmd-text, black)",
12
- border: "2px solid var(--tmd-accent, rgb(195, 195, 195))",
13
- borderRadius: "0.4em",
14
- padding: "0.25em",
15
- boxSizing: "border-box",
16
- zIndex: "10"
17
- },
18
- "[opened=true]": {
19
- borderColor: "var(--tmd-accent-hover, rgb(0, 96, 223))"
20
- },
21
- "[opened=false]:hover": {
22
- borderColor: "var(--tmd-accent-hover, rgb(170, 170, 170))"
23
- },
24
- "> p": {
25
- margin: "0"
26
- },
27
- ">svg": {
28
- position: "absolute",
29
- right: "0.45em",
30
- top: "50%",
31
- transform: "translateY(-50%)",
32
- width: "1.5em",
33
- height: "1.5em",
34
- color: "var(--tmd-accent, rgb(0, 96, 223))"
35
- },
36
- ">div[data-zc-position='bottom']": {
37
- position: "absolute",
38
- top: "calc(100% + 0.45em)",
39
- left: "0",
40
- width: "100%",
41
- background: "var(--tmd-element, #f6f6f6)",
42
- border: "2px solid var(--tmd-element-hover, rgb(235 235 235))",
43
- borderRadius: "0.4em"
44
- },
45
- ">div[data-zc-position='top']": {
46
- position: "absolute",
47
- bottom: "calc(100% + 0.45em)",
48
- left: "0",
49
- width: "100%",
50
- background: "var(--tmd-element, #f6f6f6)",
51
- border: "2px solid var(--tmd-element-hover, rgb(235 235 235))",
52
- borderRadius: "0.4em"
53
- },
54
- ">div>div": {
55
- color: "var(--tmd-text, black)",
56
- width: "100%",
57
- padding: "0.25em",
58
- boxSizing: "border-box",
59
- borderRadius: "0.25em"
60
- },
61
- ">div>div>svg": {
62
- width: "1.25em",
63
- height: "1.25em",
64
- color: "var(--tmd-accent, rgb(0, 96, 223))"
65
- },
66
- ">div>div:hover": {
67
- background: "var(--tmd-element-hover, #ededed)"
68
- }
69
- };
70
- }
71
- generateBody() {
72
- let { options, currentOption, x, y } = CommonCloneDeep(this.context);
73
- let isOpened = false;
74
- let optionsContainer;
75
- const select = document.createElement("div");
76
- addDynamicClass(select, this.dynamicClassContainer);
77
- setFontFamily(select, MOD_DATA.fontFamily);
78
- select.setAttribute("opened", false);
79
- select.addEventListener("click", () => {
80
- if (this.context.isDisabled && this.context.isDisabled()) return select.classList.add("zcDisabled");
81
- if (isOpened) {
82
- isOpened = false;
83
- optionsContainer.remove();
84
- } else {
85
- isOpened = true;
86
- optionsContainer = document.createElement("div");
87
- optionsContainer.setAttribute(
88
- "data-zc-position",
89
- typeof y === "number" && y > 500 - select.offsetHeight / 2 ? "top" : "bottom"
90
- );
91
- options.forEach((option) => {
92
- const e = document.createElement("div");
93
- e.style.cssText = "display: flex; align-items: center; column-gap: 0.5em;";
94
- if (option.icon) {
95
- option.icon.style.cssText = "color: #bcbcbc;";
96
- e.append(option.icon);
97
- }
98
- e.append(option.text);
99
- if (option.name === currentOption) {
100
- e.append(checkmark);
101
- }
102
- e.addEventListener("click", () => {
103
- currentOption = option.name;
104
- p.textContent = option.text;
105
- optionsContainer.remove();
106
- if (this.context.onChange) this.context.onChange(option.name);
107
- });
108
- optionsContainer.append(e);
109
- });
110
- select.append(optionsContainer);
111
- }
112
- });
113
- const p = document.createElement("p");
114
- p.textContent = options.find((option) => option.name === currentOption)?.text ?? "";
115
- const arrow = createElement(ChevronDown);
116
- const checkmark = createElement(Check);
117
- checkmark.style.cssText = "position: absolute; right: 0.25em;";
118
- select.append(p, arrow);
119
- if (this.context.isDisabled && this.context.isDisabled()) select.classList.add("zcDisabled");
120
- return {
121
- base: select
122
- };
123
- }
124
- update() {
125
- super.update();
126
- autosetFontSize(this.body.base);
127
- }
128
- }
129
- export {
130
- SelectShard
131
- };
@@ -1,29 +0,0 @@
1
- import { recolorSVG, setSize } from "../ui";
2
- import { Shard } from "./shard";
3
- class SvgShard extends Shard {
4
- generateBody() {
5
- const { dataurl, size, fill = "var(--tmd-accent, black)", stroke = "var(--tmd-accent-hover, black)", strokeWidth = "2px" } = this.context;
6
- function dataURLToSVGElement(dataURL) {
7
- const svgEncoded = dataURL.replace("data:image/svg+xml,", "");
8
- const svgString = decodeURIComponent(svgEncoded);
9
- const div = document.createElement("div");
10
- div.innerHTML = svgString;
11
- return div.firstElementChild;
12
- }
13
- const svg = dataURLToSVGElement(dataurl);
14
- if (svg) {
15
- recolorSVG(svg, { fill, stroke });
16
- svg.setAttribute("stroke-width", strokeWidth);
17
- }
18
- return {
19
- base: svg
20
- };
21
- }
22
- update() {
23
- super.update();
24
- setSize(this.body.base, this.context.size, this.context.size);
25
- }
26
- }
27
- export {
28
- SvgShard
29
- };
@@ -1,15 +0,0 @@
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<NumbersOnly extends boolean>(ctx: InputListShardContext<NumbersOnly>): HTMLDivElement;
13
- createSelect(ctx: SelectShardContext): HTMLDivElement;
14
- unload(): void;
15
- }
@@ -1,5 +0,0 @@
1
- import { CoreSubscreen } from "./coreSubscreen";
2
- export declare class DevelopmentSubscreen extends CoreSubscreen {
3
- get name(): string;
4
- load(): void;
5
- }
@@ -1,5 +0,0 @@
1
- import { CoreSubscreen } from "./coreSubscreen";
2
- export declare class GeneralSubscreen extends CoreSubscreen {
3
- get name(): string;
4
- load(): void;
5
- }
@@ -1,6 +0,0 @@
1
- import { CoreSubscreen } from "./coreSubscreen";
2
- export declare class MainSubscreen extends CoreSubscreen {
3
- get name(): string;
4
- load(): void;
5
- exit(): void;
6
- }
@@ -1,5 +0,0 @@
1
- import { DynamicClassStyles } from "../../ui";
2
- import { ButtonShard } from "../../shards";
3
- export declare class CoreButtonShard extends ButtonShard {
4
- protected get dynamicClassButton(): DynamicClassStyles;
5
- }
@@ -1,6 +0,0 @@
1
- import { CheckboxShard } from "../../shards";
2
- import { DynamicClassStyles } from "../../ui";
3
- export declare class CoreCheckboxShard extends CheckboxShard {
4
- protected get dynamicClassInput(): DynamicClassStyles;
5
- protected get textColor(): string;
6
- }
@@ -1,6 +0,0 @@
1
- import { InputListShard } from "../../shards";
2
- import { DynamicClassStyles } from "../../ui";
3
- export declare class CoreInputListShard<NumbersOnly extends boolean> extends InputListShard<NumbersOnly> {
4
- get dynamicClassContainer(): DynamicClassStyles;
5
- get dynamicClassToolsButton(): DynamicClassStyles;
6
- }
@@ -1,5 +0,0 @@
1
- import { SelectShard } from "../../shards";
2
- import { DynamicClassStyles } from "../../ui";
3
- export declare class CoreSelectShard extends SelectShard {
4
- get dynamicClassContainer(): DynamicClassStyles;
5
- }
@@ -1,4 +0,0 @@
1
- import { TextShard } from "../../shards";
2
- export declare class CoreTextShard extends TextShard {
3
- get defaultColor(): string;
4
- }
@@ -1,5 +0,0 @@
1
- export * from "./coreButtonShard";
2
- export * from "./coreTextShard";
3
- export * from "./coreSelectShard";
4
- export * from "./coreCheckboxShard";
5
- export * from "./coreInputListShard";
@@ -1,5 +0,0 @@
1
- import { CoreSubscreen } from "./coreSubscreen";
2
- export declare class ToastsSubscreen extends CoreSubscreen {
3
- get name(): string;
4
- load(): void;
5
- }
@@ -1,18 +0,0 @@
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(): void;
@@ -1,14 +0,0 @@
1
- import { Shard, ShardContext } from "./shard";
2
- export interface InputShardContext extends ShardContext {
3
- value?: string;
4
- placeholder?: string;
5
- textArea?: boolean;
6
- fontSize?: number | "auto";
7
- onChange?: () => void;
8
- onInput?: () => void;
9
- isDisabled?: () => boolean;
10
- }
11
- export declare class InputShard extends Shard<InputShardContext> {
12
- protected generateBody(): Record<keyof NonNullable<InputShardContext["modules"]>, HTMLElement | SVGElement>;
13
- protected update(): void;
14
- }
@@ -1,12 +0,0 @@
1
- import { Shard, ShardContext } from "./shard";
2
- export interface SvgShardContext extends ShardContext {
3
- dataurl: string;
4
- size: number;
5
- fill?: string;
6
- stroke?: string;
7
- strokeWidth?: string;
8
- }
9
- export declare class SvgShard extends Shard<SvgShardContext> {
10
- protected generateBody(): Record<keyof NonNullable<SvgShardContext["modules"]>, SVGElement>;
11
- protected update(): void;
12
- }