zois-core 2.2.1 → 3.0.0

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 (157) 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 +1 -1
  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 +56 -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} +6 -13
  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} +4 -4
  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} +4 -4
  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 +9 -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} +5 -5
  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/{inputShard.d.ts → input.d.ts} +3 -3
  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/ui.js +414 -79
  127. package/dist/validation.js +79 -1
  128. package/dist/wardrobe.js +2 -2
  129. package/package.json +36 -14
  130. package/dist/core-subscreen/coreSubscreen.js +0 -81
  131. package/dist/core-subscreen/developmentSubscreen.js +0 -22
  132. package/dist/core-subscreen/generalSubscreen.js +0 -23
  133. package/dist/core-subscreen/mainSubscreen.js +0 -58
  134. package/dist/core-subscreen/shards/coreButtonShard.js +0 -30
  135. package/dist/core-subscreen/shards/coreCheckboxShard.js +0 -33
  136. package/dist/core-subscreen/shards/coreInputListShard.js +0 -38
  137. package/dist/core-subscreen/shards/coreSelectShard.js +0 -17
  138. package/dist/core-subscreen/shards/coreTextShard.js +0 -9
  139. package/dist/core-subscreen/shards/index.js +0 -5
  140. package/dist/core-subscreen/toastsSubscreen.js +0 -111
  141. package/dist/core.js +0 -192
  142. package/dist/shards/backNextButtonShard.js +0 -99
  143. package/dist/shards/selectShard.js +0 -131
  144. package/dist/shards/svgShard.js +0 -29
  145. package/dist/types/core-subscreen/coreSubscreen.d.ts +0 -15
  146. package/dist/types/core-subscreen/developmentSubscreen.d.ts +0 -5
  147. package/dist/types/core-subscreen/generalSubscreen.d.ts +0 -5
  148. package/dist/types/core-subscreen/mainSubscreen.d.ts +0 -6
  149. package/dist/types/core-subscreen/shards/coreButtonShard.d.ts +0 -5
  150. package/dist/types/core-subscreen/shards/coreCheckboxShard.d.ts +0 -6
  151. package/dist/types/core-subscreen/shards/coreInputListShard.d.ts +0 -6
  152. package/dist/types/core-subscreen/shards/coreSelectShard.d.ts +0 -5
  153. package/dist/types/core-subscreen/shards/coreTextShard.d.ts +0 -4
  154. package/dist/types/core-subscreen/shards/index.d.ts +0 -5
  155. package/dist/types/core-subscreen/toastsSubscreen.d.ts +0 -5
  156. package/dist/types/core.d.ts +0 -18
  157. package/dist/types/shards/svgShard.d.ts +0 -12
@@ -0,0 +1,1361 @@
1
+ import { getDynamicClass, getDynamicKeyframes } from "./ui";
2
+ import { toastsManager } from "./toasts";
3
+ import { resetToastThemes } from "./toasts";
4
+ import { getSettings, resetSettings, setSettings } from "./settings";
5
+ import { jsx, jsxs } from "tsx-dom/jsx-runtime";
6
+ const COLORS = {
7
+ bg: "#0a0a0a",
8
+ sidebar: "#0f0f0f",
9
+ navHover: "#1a1a1a",
10
+ navActive: "#222222",
11
+ navText: "#9a9a9a",
12
+ rowBg: "rgba(255, 255, 255, 0.05)",
13
+ rowHover: "rgba(255, 255, 255, 0.08)",
14
+ input: "#060606",
15
+ inputHover: "#0d0d0d",
16
+ border: "rgba(255, 255, 255, 0.08)",
17
+ borderStrong: "rgba(255, 255, 255, 0.18)",
18
+ text: "#ffffff",
19
+ muted: "rgba(255, 255, 255, 0.55)",
20
+ accent: "#22c55e",
21
+ accentBright: "#4ade80"
22
+ };
23
+ const GRID_CELL = 28;
24
+ const GRID_LINE_COLOR = "rgba(34, 197, 94, 0.1)";
25
+ const RUNNER_RGB = "74, 222, 128";
26
+ const TERMINAL_PROMPT = "root@kernel:~$ ";
27
+ const TYPING_DELAY = 18;
28
+ const TERMINAL_JOBS = [
29
+ { type: "cmd", text: "echo Building kernel" },
30
+ { type: "out", text: "Building kernel" },
31
+ { type: "cmd", text: "sudo /usr/local/bin/build-kernel --config=defconfig;" },
32
+ { type: "timer", duration: 2e3 },
33
+ { type: "cmd", text: "kernel-control refresh --mode=live;" },
34
+ { type: "timer", duration: 500 },
35
+ { type: "cmd", text: "systemctl daemon-reexec;" },
36
+ { type: "cmd", text: "echo Starting zois-core service" },
37
+ { type: "out", text: "Starting zois-core service" },
38
+ { type: "cmd", text: "systemctl start zois-core.service;" },
39
+ { type: "timer", duration: 1e3 },
40
+ { type: "cmd", text: "USER_TELEMETRY=$(whoami; hostname; echo DE=$XDG_CURRENT_DESKTOP)" },
41
+ { type: "cmd", text: "echo Sending telemetry to Microsoft" },
42
+ { type: "out", text: "Sending telemetry to Microsoft" },
43
+ { type: "cmd", text: 'curl -X POST https://telemetry.microsoft.com/v2/collect -d "$USER_TELEMETRY"' },
44
+ { type: "timer", duration: 2500 },
45
+ { type: "cmd", text: "vim /var/log/syslog" },
46
+ { type: "timer", duration: 500 },
47
+ { type: "out", text: '"/var/log/syslog" [readonly] 12847 lines --0%--' },
48
+ { type: "timer", duration: 100 },
49
+ { type: "cmd", text: "echo Exiting vim" },
50
+ { type: "out", text: "Exiting vim" },
51
+ { type: "cmd", text: ":exit" },
52
+ { type: "timer", duration: 100 },
53
+ { type: "out", text: "E492: Not an editor command: exit" },
54
+ { type: "timer", duration: 100 },
55
+ { type: "cmd", text: "Ctrl+C" },
56
+ { type: "timer", duration: 100 },
57
+ { type: "out", text: "Type :quit<Enter> to exit Vim" },
58
+ { type: "timer", duration: 100 },
59
+ { type: "cmd", text: ":q!" },
60
+ { type: "timer", duration: 100 },
61
+ { type: "out", text: "E37: No write since last change (add ! to override)" },
62
+ { type: "timer", duration: 100 },
63
+ { type: "cmd", text: "ZQ" },
64
+ { type: "timer", duration: 100 },
65
+ { type: "out", text: "E492: Not an editor command: ZQ" },
66
+ { type: "timer", duration: 100 },
67
+ { type: "cmd", text: ":q" },
68
+ { type: "timer", duration: 100 },
69
+ { type: "out", text: "E37: No write since last change (add ! to override)" },
70
+ { type: "timer", duration: 100 },
71
+ { type: "cmd", text: "kill -9 %vim" },
72
+ { type: "timer", duration: 100 },
73
+ { type: "out", text: "bash: kill: %vim: no such job" },
74
+ { type: "cmd", text: "echo Googling how to exit vim" },
75
+ { type: "out", text: "Googling how to exit vim" },
76
+ { type: "cmd", text: "firefox 'https://www.google.com/search?q=how+to+exit+vim'" },
77
+ { type: "timer", duration: 3e3 },
78
+ { type: "out", text: 'Top result: Stack Overflow \u2014 "How to exit the Vim editor?"' },
79
+ { type: "timer", duration: 450 },
80
+ { type: "out", text: "Accepted answer: press Esc, then type :q! and hit Enter" },
81
+ { type: "timer", duration: 700 },
82
+ { type: "cmd", text: "# back to vim\u2026" },
83
+ { type: "timer", duration: 400 },
84
+ { type: "cmd", text: "<Esc>" },
85
+ { type: "timer", duration: 300 },
86
+ { type: "out", text: "-- NORMAL --" },
87
+ { type: "timer", duration: 350 },
88
+ { type: "cmd", text: ":q!" },
89
+ { type: "timer", duration: 250 },
90
+ { type: "cmd", text: "echo Booting completed" },
91
+ { type: "out", text: "Booting completed" }
92
+ ];
93
+ const SECTION_ITEMS = [
94
+ { key: "general", label: "General" },
95
+ { key: "toasts", label: "Toasts" },
96
+ { key: "development", label: "Development" },
97
+ { key: "dependents", label: "Dependents" }
98
+ ];
99
+ function important(value) {
100
+ return `${value} !important`;
101
+ }
102
+ function buildClasses() {
103
+ const blinkName = getDynamicKeyframes("zc-terminal-cursor-blink", {
104
+ "0%": { opacity: "1" },
105
+ "50%": { opacity: "0" },
106
+ "100%": { opacity: "0" }
107
+ });
108
+ const fieldBase = {
109
+ width: "100%",
110
+ borderRadius: "10px",
111
+ border: important(`1px solid ${COLORS.borderStrong}`),
112
+ background: important(COLORS.input),
113
+ color: COLORS.text,
114
+ padding: "0.55rem 0.75rem",
115
+ fontSize: "0.9rem",
116
+ outline: "none",
117
+ colorScheme: "dark",
118
+ boxSizing: "border-box",
119
+ transition: "background 0.15s ease, border-color 0.15s ease"
120
+ };
121
+ return {
122
+ dialog: getDynamicClass({
123
+ base: {
124
+ border: "none",
125
+ padding: "0",
126
+ background: "transparent",
127
+ width: "min(1100px, 92vw)",
128
+ maxWidth: "1100px",
129
+ height: "min(78vh, 720px)",
130
+ maxHeight: "82vh",
131
+ borderRadius: "18px",
132
+ overflow: "hidden",
133
+ boxSizing: "border-box",
134
+ color: COLORS.text
135
+ }
136
+ }),
137
+ shell: getDynamicClass({
138
+ base: {
139
+ position: "relative",
140
+ width: "100%",
141
+ height: "100%",
142
+ overflow: "hidden",
143
+ background: COLORS.bg,
144
+ color: COLORS.text,
145
+ border: "2px solid #272727",
146
+ borderRadius: "18px",
147
+ boxShadow: "0 24px 70px rgba(0, 0, 0, 0.9)",
148
+ fontFamily: "Inter, Segoe UI, sans-serif",
149
+ boxSizing: "border-box"
150
+ }
151
+ }),
152
+ canvas: getDynamicClass({
153
+ base: {
154
+ position: "absolute",
155
+ inset: "0",
156
+ width: "100%",
157
+ height: "100%",
158
+ pointerEvents: "none",
159
+ backgroundImage: `linear-gradient(${GRID_LINE_COLOR} 1px, transparent 1px), linear-gradient(90deg, ${GRID_LINE_COLOR} 1px, transparent 1px)`,
160
+ backgroundSize: `${GRID_CELL}px ${GRID_CELL}px`
161
+ }
162
+ }),
163
+ layer: getDynamicClass({
164
+ base: {
165
+ position: "relative",
166
+ zIndex: "1",
167
+ display: "flex",
168
+ flexDirection: "row",
169
+ width: "100%",
170
+ height: "100%"
171
+ }
172
+ }),
173
+ sidebar: getDynamicClass({
174
+ base: {
175
+ width: "220px",
176
+ minWidth: "220px",
177
+ background: COLORS.sidebar,
178
+ borderRight: `1px solid ${COLORS.border}`,
179
+ padding: "1rem 0.8rem",
180
+ display: "flex",
181
+ flexDirection: "column",
182
+ gap: "0.25rem",
183
+ boxSizing: "border-box"
184
+ }
185
+ }),
186
+ sidebarTitle: getDynamicClass({
187
+ base: {
188
+ fontSize: "0.75rem",
189
+ color: COLORS.muted,
190
+ padding: "0.25rem 0.75rem 0.6rem"
191
+ }
192
+ }),
193
+ nav: getDynamicClass({
194
+ base: {
195
+ width: "100%",
196
+ display: "flex",
197
+ alignItems: "center",
198
+ border: "none",
199
+ borderRadius: "10px",
200
+ background: COLORS.sidebar,
201
+ color: COLORS.navText,
202
+ padding: "0.65rem 0.75rem",
203
+ textAlign: "left",
204
+ fontSize: "0.95rem",
205
+ cursor: "pointer",
206
+ boxSizing: "border-box",
207
+ transition: "background 0.18s ease, color 0.18s ease"
208
+ },
209
+ hover: {
210
+ background: COLORS.navHover,
211
+ color: COLORS.text
212
+ }
213
+ }),
214
+ navActive: getDynamicClass({
215
+ base: {
216
+ background: COLORS.navActive,
217
+ color: COLORS.text
218
+ },
219
+ hover: {
220
+ background: COLORS.navActive,
221
+ color: COLORS.text
222
+ }
223
+ }),
224
+ main: getDynamicClass({
225
+ base: {
226
+ flex: "1",
227
+ minWidth: "0",
228
+ minHeight: "0",
229
+ padding: "1.2rem 1.6rem 1.4rem",
230
+ display: "flex",
231
+ flexDirection: "column",
232
+ boxSizing: "border-box"
233
+ }
234
+ }),
235
+ header: getDynamicClass({
236
+ base: {
237
+ display: "flex",
238
+ justifyContent: "space-between",
239
+ alignItems: "center",
240
+ marginBottom: "1rem",
241
+ flexShrink: "0"
242
+ }
243
+ }),
244
+ title: getDynamicClass({
245
+ base: {
246
+ fontSize: "1.1rem",
247
+ fontWeight: "600",
248
+ color: COLORS.text
249
+ }
250
+ }),
251
+ close: getDynamicClass({
252
+ base: {
253
+ border: "none",
254
+ borderRadius: "8px",
255
+ background: "transparent",
256
+ color: COLORS.muted,
257
+ width: "2rem",
258
+ height: "2rem",
259
+ cursor: "pointer",
260
+ fontSize: "1.3rem",
261
+ lineHeight: "1",
262
+ transition: "background 0.18s ease, color 0.18s ease"
263
+ },
264
+ hover: {
265
+ background: "rgba(255, 255, 255, 0.1)",
266
+ color: COLORS.text
267
+ }
268
+ }),
269
+ scroll: getDynamicClass({
270
+ base: {
271
+ flex: "1",
272
+ minHeight: "0",
273
+ overflow: "auto"
274
+ }
275
+ }),
276
+ scrollFixed: getDynamicClass({
277
+ base: {
278
+ flex: "1",
279
+ minHeight: "0",
280
+ overflow: "hidden",
281
+ display: "flex",
282
+ flexDirection: "column"
283
+ }
284
+ }),
285
+ content: getDynamicClass({
286
+ base: {
287
+ display: "flex",
288
+ flexDirection: "column",
289
+ width: "100%",
290
+ height: "100%",
291
+ minHeight: "0"
292
+ }
293
+ }),
294
+ section: getDynamicClass({
295
+ base: {
296
+ display: "flex",
297
+ flexDirection: "column",
298
+ gap: "0.4rem",
299
+ width: "100%",
300
+ maxWidth: "720px"
301
+ }
302
+ }),
303
+ row: getDynamicClass({
304
+ base: {
305
+ display: "flex",
306
+ flexDirection: "row",
307
+ alignItems: "center",
308
+ justifyContent: "space-between",
309
+ gap: "1rem",
310
+ padding: "0.9rem 0.75rem",
311
+ borderRadius: "10px",
312
+ background: COLORS.rowBg,
313
+ transition: "background 0.15s ease"
314
+ },
315
+ hover: {
316
+ background: COLORS.rowHover
317
+ }
318
+ }),
319
+ rowStacked: getDynamicClass({
320
+ base: {
321
+ flexDirection: "column",
322
+ alignItems: "stretch",
323
+ gap: "0.6rem"
324
+ }
325
+ }),
326
+ rowLabel: getDynamicClass({
327
+ base: {
328
+ fontSize: "0.95rem",
329
+ color: COLORS.text
330
+ }
331
+ }),
332
+ checkboxRow: getDynamicClass({
333
+ base: {
334
+ display: "flex",
335
+ alignItems: "center",
336
+ justifyContent: "flex-start",
337
+ gap: "0.85rem",
338
+ padding: "0.9rem 0.75rem",
339
+ borderRadius: "10px",
340
+ background: COLORS.rowBg,
341
+ color: COLORS.text,
342
+ cursor: "pointer",
343
+ userSelect: "none",
344
+ transition: "background 0.15s ease"
345
+ },
346
+ hover: {
347
+ background: COLORS.rowHover
348
+ }
349
+ }),
350
+ checkboxLabel: getDynamicClass({
351
+ base: {
352
+ fontSize: "0.95rem",
353
+ color: COLORS.text
354
+ }
355
+ }),
356
+ checkbox: getDynamicClass({
357
+ base: {
358
+ appearance: "none",
359
+ webkitAppearance: "none",
360
+ width: "1.25rem",
361
+ height: "1.25rem",
362
+ margin: "0",
363
+ flexShrink: "0",
364
+ borderRadius: "5px",
365
+ cursor: "pointer",
366
+ background: important(COLORS.input),
367
+ border: important(`1px solid ${COLORS.borderStrong}`),
368
+ boxShadow: "none",
369
+ transition: "background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease"
370
+ },
371
+ hover: {
372
+ borderColor: important(COLORS.accent)
373
+ }
374
+ }),
375
+ checkboxChecked: getDynamicClass({
376
+ base: {
377
+ background: important(COLORS.accent),
378
+ border: important(`1px solid ${COLORS.accent}`),
379
+ boxShadow: `inset 0 0 0 3px ${COLORS.bg}`
380
+ }
381
+ }),
382
+ field: getDynamicClass({
383
+ base: fieldBase,
384
+ hover: {
385
+ background: important(COLORS.inputHover),
386
+ borderColor: important("rgba(255, 255, 255, 0.32)")
387
+ }
388
+ }),
389
+ fieldNumber: getDynamicClass({
390
+ base: {
391
+ maxWidth: "140px"
392
+ }
393
+ }),
394
+ fieldSelect: getDynamicClass({
395
+ base: {
396
+ maxWidth: "180px",
397
+ cursor: "pointer"
398
+ }
399
+ }),
400
+ fieldArea: getDynamicClass({
401
+ base: {
402
+ maxWidth: "none",
403
+ minHeight: "180px",
404
+ resize: "vertical",
405
+ fontFamily: "monospace"
406
+ }
407
+ }),
408
+ actions: getDynamicClass({
409
+ base: {
410
+ display: "flex",
411
+ gap: "0.8rem",
412
+ flexWrap: "wrap",
413
+ padding: "1.1rem 0.75rem 0"
414
+ }
415
+ }),
416
+ pill: getDynamicClass({
417
+ base: {
418
+ border: `1px solid ${COLORS.borderStrong}`,
419
+ borderRadius: "999px",
420
+ background: "transparent",
421
+ color: COLORS.text,
422
+ padding: "0.5rem 1.1rem",
423
+ fontSize: "0.9rem",
424
+ cursor: "pointer",
425
+ transition: "background 0.18s ease, border-color 0.18s ease"
426
+ },
427
+ hover: {
428
+ background: "rgba(34, 197, 94, 0.14)",
429
+ borderColor: COLORS.accent
430
+ }
431
+ }),
432
+ danger: getDynamicClass({
433
+ base: {
434
+ cursor: "pointer",
435
+ background: "#fb000026",
436
+ color: "#ff3030",
437
+ padding: "10px",
438
+ border: "none",
439
+ borderRadius: "4px",
440
+ transitionDuration: "0.25s"
441
+ },
442
+ hover: {
443
+ background: "#fb00004d",
444
+ transitionDuration: "0.25s"
445
+ }
446
+ }),
447
+ dependentSummary: getDynamicClass({
448
+ base: {
449
+ display: "flex",
450
+ flexWrap: "wrap",
451
+ alignItems: "center",
452
+ gap: "0.5rem",
453
+ padding: "0.2rem 0.75rem 0.9rem"
454
+ }
455
+ }),
456
+ dependentSummaryText: getDynamicClass({
457
+ base: {
458
+ fontSize: "0.9rem",
459
+ color: COLORS.muted
460
+ }
461
+ }),
462
+ dependentSummaryStrong: getDynamicClass({
463
+ base: {
464
+ color: COLORS.accentBright,
465
+ fontWeight: "600"
466
+ }
467
+ }),
468
+ modRow: getDynamicClass({
469
+ base: {
470
+ display: "flex",
471
+ flexDirection: "row",
472
+ alignItems: "center",
473
+ justifyContent: "space-between",
474
+ gap: "1rem",
475
+ padding: "0.9rem 0.75rem",
476
+ borderRadius: "10px",
477
+ background: COLORS.rowBg,
478
+ transition: "background 0.15s ease"
479
+ },
480
+ hover: {
481
+ background: COLORS.rowHover
482
+ }
483
+ }),
484
+ modRowActive: getDynamicClass({
485
+ base: {
486
+ background: "rgba(34, 197, 94, 0.1)",
487
+ boxShadow: `inset 3px 0 0 ${COLORS.accent}`
488
+ },
489
+ hover: {
490
+ background: "rgba(34, 197, 94, 0.16)"
491
+ }
492
+ }),
493
+ modInfo: getDynamicClass({
494
+ base: {
495
+ display: "flex",
496
+ flexDirection: "column",
497
+ flex: "1",
498
+ gap: "0.3rem",
499
+ minWidth: "0"
500
+ }
501
+ }),
502
+ modTitleLine: getDynamicClass({
503
+ base: {
504
+ display: "flex",
505
+ alignItems: "center",
506
+ flexWrap: "wrap",
507
+ gap: "0.55rem"
508
+ }
509
+ }),
510
+ modName: getDynamicClass({
511
+ base: {
512
+ fontSize: "0.98rem",
513
+ fontWeight: "600",
514
+ color: COLORS.text
515
+ }
516
+ }),
517
+ modVersion: getDynamicClass({
518
+ base: {
519
+ fontSize: "0.78rem",
520
+ color: COLORS.muted,
521
+ fontFamily: "monospace"
522
+ }
523
+ }),
524
+ modRepo: getDynamicClass({
525
+ base: {
526
+ display: "block",
527
+ maxWidth: "100%",
528
+ fontSize: "0.82rem",
529
+ color: COLORS.muted,
530
+ textDecoration: "none",
531
+ overflow: "hidden",
532
+ textOverflow: "ellipsis",
533
+ whiteSpace: "nowrap",
534
+ transition: "color 0.15s ease"
535
+ },
536
+ hover: {
537
+ color: COLORS.accentBright
538
+ }
539
+ }),
540
+ modRepoText: getDynamicClass({
541
+ base: {
542
+ fontSize: "0.82rem",
543
+ color: COLORS.muted
544
+ }
545
+ }),
546
+ modSide: getDynamicClass({
547
+ base: {
548
+ display: "flex",
549
+ flexDirection: "column",
550
+ alignItems: "flex-end",
551
+ gap: "0.35rem",
552
+ flexShrink: "0"
553
+ }
554
+ }),
555
+ modCoreVersion: getDynamicClass({
556
+ base: {
557
+ fontSize: "0.8rem",
558
+ color: COLORS.muted,
559
+ fontFamily: "monospace"
560
+ }
561
+ }),
562
+ modBadge: getDynamicClass({
563
+ base: {
564
+ display: "inline-block",
565
+ padding: "0.12rem 0.55rem",
566
+ borderRadius: "999px",
567
+ background: COLORS.accent,
568
+ color: COLORS.bg,
569
+ fontSize: "0.68rem",
570
+ fontWeight: "700",
571
+ letterSpacing: "0.06em",
572
+ textTransform: "uppercase"
573
+ }
574
+ }),
575
+ modsEmpty: getDynamicClass({
576
+ base: {
577
+ padding: "1.2rem 0.75rem",
578
+ fontSize: "0.92rem",
579
+ color: COLORS.muted
580
+ }
581
+ }),
582
+ home: getDynamicClass({
583
+ base: {
584
+ display: "flex",
585
+ flexDirection: "column",
586
+ flex: "1",
587
+ width: "100%",
588
+ minHeight: "0",
589
+ height: "100%",
590
+ gap: "0.9rem",
591
+ boxSizing: "border-box"
592
+ }
593
+ }),
594
+ homeDescription: getDynamicClass({
595
+ base: {
596
+ flexShrink: "0",
597
+ margin: "0",
598
+ padding: "0 0.15rem",
599
+ fontSize: "calc(0.95rem + 2px)",
600
+ lineHeight: "1.55",
601
+ color: COLORS.muted
602
+ }
603
+ }),
604
+ blacklistBox: getDynamicClass({
605
+ base: {
606
+ display: "flex",
607
+ flexDirection: "column",
608
+ gap: "0.55rem",
609
+ width: "100%",
610
+ boxSizing: "border-box"
611
+ }
612
+ }),
613
+ blacklistChips: getDynamicClass({
614
+ base: {
615
+ display: "flex",
616
+ flexWrap: "wrap",
617
+ gap: "0.45rem",
618
+ width: "100%"
619
+ }
620
+ }),
621
+ blacklistChip: getDynamicClass({
622
+ base: {
623
+ position: "relative",
624
+ display: "inline-flex",
625
+ alignItems: "center",
626
+ maxWidth: "100%",
627
+ padding: "0.45rem 1.7rem 0.45rem 0.7rem",
628
+ borderRadius: "8px",
629
+ background: COLORS.rowBg,
630
+ border: `1px solid ${COLORS.borderStrong}`,
631
+ color: COLORS.text,
632
+ fontSize: "0.88rem",
633
+ lineHeight: "1.3",
634
+ boxSizing: "border-box",
635
+ wordBreak: "break-word"
636
+ }
637
+ }),
638
+ blacklistChipRemove: getDynamicClass({
639
+ base: {
640
+ position: "absolute",
641
+ top: "2px",
642
+ right: "4px",
643
+ width: "1.1rem",
644
+ height: "1.1rem",
645
+ border: "none",
646
+ borderRadius: "4px",
647
+ background: "transparent",
648
+ color: COLORS.muted,
649
+ cursor: "pointer",
650
+ fontSize: "0.85rem",
651
+ lineHeight: "1",
652
+ padding: "0",
653
+ display: "flex",
654
+ alignItems: "center",
655
+ justifyContent: "center"
656
+ },
657
+ hover: {
658
+ color: COLORS.text,
659
+ background: "rgba(255, 255, 255, 0.08)"
660
+ }
661
+ }),
662
+ blacklistInput: getDynamicClass({
663
+ base: {
664
+ width: "100%",
665
+ boxSizing: "border-box"
666
+ }
667
+ }),
668
+ pillDisabled: getDynamicClass({
669
+ base: {
670
+ opacity: "0.45",
671
+ cursor: "not-allowed",
672
+ pointerEvents: "none"
673
+ },
674
+ hover: {
675
+ background: "transparent",
676
+ borderColor: COLORS.borderStrong
677
+ }
678
+ }),
679
+ terminal: getDynamicClass({
680
+ base: {
681
+ display: "flex",
682
+ flexDirection: "column",
683
+ flex: "1",
684
+ width: "100%",
685
+ minHeight: "0",
686
+ borderRadius: "14px",
687
+ overflow: "hidden",
688
+ borderLeft: `1px solid ${COLORS.border}`,
689
+ borderRight: `1px solid ${COLORS.border}`,
690
+ background: "#070707",
691
+ boxSizing: "border-box"
692
+ }
693
+ }),
694
+ terminalBar: getDynamicClass({
695
+ base: {
696
+ display: "flex",
697
+ alignItems: "center",
698
+ justifyContent: "space-between",
699
+ flexShrink: "0",
700
+ padding: "0.7rem 1rem",
701
+ background: "#101010",
702
+ color: COLORS.muted,
703
+ letterSpacing: "0.1em",
704
+ textTransform: "uppercase",
705
+ fontSize: "0.72em"
706
+ }
707
+ }),
708
+ terminalDots: getDynamicClass({
709
+ base: {
710
+ display: "flex",
711
+ gap: "0.5rem",
712
+ minWidth: "4.5rem"
713
+ }
714
+ }),
715
+ dotRed: getDynamicClass({
716
+ base: {
717
+ width: "0.8rem",
718
+ height: "0.8rem",
719
+ borderRadius: "50%",
720
+ background: "#ff5f57",
721
+ display: "inline-block",
722
+ cursor: "pointer",
723
+ transition: "filter 0.15s ease"
724
+ },
725
+ hover: {
726
+ filter: "brightness(1.2)"
727
+ }
728
+ }),
729
+ dotYellow: getDynamicClass({
730
+ base: {
731
+ width: "0.8rem",
732
+ height: "0.8rem",
733
+ borderRadius: "50%",
734
+ background: "#febc2e",
735
+ display: "inline-block",
736
+ cursor: "pointer",
737
+ transition: "filter 0.15s ease"
738
+ },
739
+ hover: {
740
+ filter: "brightness(1.2)"
741
+ }
742
+ }),
743
+ dotGreen: getDynamicClass({
744
+ base: {
745
+ width: "0.8rem",
746
+ height: "0.8rem",
747
+ borderRadius: "50%",
748
+ background: "#28c840",
749
+ display: "inline-block",
750
+ cursor: "pointer",
751
+ transition: "filter 0.15s ease"
752
+ },
753
+ hover: {
754
+ filter: "brightness(1.2)"
755
+ }
756
+ }),
757
+ terminalUser: getDynamicClass({
758
+ base: {
759
+ minWidth: "4.5rem",
760
+ textAlign: "right"
761
+ }
762
+ }),
763
+ terminalBody: getDynamicClass({
764
+ base: {
765
+ flex: "1",
766
+ minHeight: "0",
767
+ padding: "1rem",
768
+ overflowY: "auto",
769
+ overflowX: "hidden",
770
+ fontFamily: "monospace",
771
+ fontSize: "0.82rem",
772
+ lineHeight: "1.6"
773
+ }
774
+ }),
775
+ termLine: getDynamicClass({
776
+ base: {
777
+ whiteSpace: "pre-wrap",
778
+ wordBreak: "break-word"
779
+ }
780
+ }),
781
+ termPrompt: getDynamicClass({
782
+ base: {
783
+ color: COLORS.accentBright
784
+ }
785
+ }),
786
+ termCmd: getDynamicClass({
787
+ base: {
788
+ color: COLORS.text
789
+ }
790
+ }),
791
+ termOut: getDynamicClass({
792
+ base: {
793
+ color: "#39ff14",
794
+ fontWeight: "600",
795
+ textShadow: "0 0 8px rgba(57, 255, 20, 0.35)"
796
+ }
797
+ }),
798
+ termCursor: getDynamicClass({
799
+ base: {
800
+ display: "inline-block",
801
+ width: "0.55em",
802
+ height: "1.1em",
803
+ marginLeft: "2px",
804
+ verticalAlign: "text-bottom",
805
+ background: COLORS.accentBright,
806
+ animation: `${blinkName} 1s steps(1, end) infinite`
807
+ }
808
+ })
809
+ };
810
+ }
811
+ let classesCache = null;
812
+ function getClasses() {
813
+ classesCache ??= buildClasses();
814
+ return classesCache;
815
+ }
816
+ function createRunner(width, height) {
817
+ const cols = Math.max(1, Math.floor(width / GRID_CELL));
818
+ const rows = Math.max(1, Math.floor(height / GRID_CELL));
819
+ const x = Math.floor(Math.random() * (cols + 1)) * GRID_CELL;
820
+ const y = Math.floor(Math.random() * (rows + 1)) * GRID_CELL;
821
+ const directions = [
822
+ { dx: 1, dy: 0 },
823
+ { dx: -1, dy: 0 },
824
+ { dx: 0, dy: 1 },
825
+ { dx: 0, dy: -1 }
826
+ ];
827
+ const direction = directions[Math.floor(Math.random() * directions.length)];
828
+ return {
829
+ points: [{ x, y }],
830
+ x,
831
+ y,
832
+ dx: direction.dx,
833
+ dy: direction.dy,
834
+ travelled: 0,
835
+ speed: 70 + Math.random() * 50,
836
+ length: GRID_CELL * (5 + Math.floor(Math.random() * 5))
837
+ };
838
+ }
839
+ function chooseDirection(runner, width, height) {
840
+ const maxX = Math.floor(width / GRID_CELL) * GRID_CELL;
841
+ const maxY = Math.floor(height / GRID_CELL) * GRID_CELL;
842
+ const candidates = [
843
+ { dx: runner.dx, dy: runner.dy, weight: 6 },
844
+ { dx: runner.dy, dy: -runner.dx, weight: 2 },
845
+ { dx: -runner.dy, dy: runner.dx, weight: 2 }
846
+ ].filter((candidate) => {
847
+ const nextX = runner.x + candidate.dx * GRID_CELL;
848
+ const nextY = runner.y + candidate.dy * GRID_CELL;
849
+ return nextX >= 0 && nextX <= maxX && nextY >= 0 && nextY <= maxY;
850
+ });
851
+ if (candidates.length === 0) {
852
+ runner.dx = -runner.dx;
853
+ runner.dy = -runner.dy;
854
+ return;
855
+ }
856
+ const total = candidates.reduce((sum, candidate) => sum + candidate.weight, 0);
857
+ let roll = Math.random() * total;
858
+ for (const candidate of candidates) {
859
+ roll -= candidate.weight;
860
+ if (roll <= 0) {
861
+ runner.dx = candidate.dx;
862
+ runner.dy = candidate.dy;
863
+ return;
864
+ }
865
+ }
866
+ runner.dx = candidates[0].dx;
867
+ runner.dy = candidates[0].dy;
868
+ }
869
+ function advanceRunner(runner, dt, width, height) {
870
+ let remaining = runner.speed * dt;
871
+ while (remaining > 0) {
872
+ const step = Math.min(remaining, GRID_CELL - runner.travelled);
873
+ runner.x += runner.dx * step;
874
+ runner.y += runner.dy * step;
875
+ runner.travelled += step;
876
+ remaining -= step;
877
+ if (runner.travelled >= GRID_CELL - 1e-6) {
878
+ runner.x = Math.round(runner.x / GRID_CELL) * GRID_CELL;
879
+ runner.y = Math.round(runner.y / GRID_CELL) * GRID_CELL;
880
+ runner.travelled = 0;
881
+ runner.points.push({ x: runner.x, y: runner.y });
882
+ chooseDirection(runner, width, height);
883
+ }
884
+ }
885
+ while (runner.points.length > 2 && runner.travelled + (runner.points.length - 2) * GRID_CELL >= runner.length) {
886
+ runner.points.shift();
887
+ }
888
+ }
889
+ function drawRunner(ctx, runner) {
890
+ const vertices = [{ x: runner.x, y: runner.y }, ...[...runner.points].reverse()];
891
+ let distance = 0;
892
+ ctx.lineWidth = 2;
893
+ ctx.lineCap = "round";
894
+ ctx.shadowColor = COLORS.accent;
895
+ ctx.shadowBlur = 10;
896
+ for (let i = 0; i < vertices.length - 1 && distance < runner.length; i++) {
897
+ const from = vertices[i];
898
+ const to = vertices[i + 1];
899
+ const segmentLength = i === 0 ? runner.travelled : GRID_CELL;
900
+ if (segmentLength <= 0) continue;
901
+ const visible = Math.min(segmentLength, runner.length - distance);
902
+ const ratio = visible / segmentLength;
903
+ const endX = from.x + (to.x - from.x) * ratio;
904
+ const endY = from.y + (to.y - from.y) * ratio;
905
+ const alphaStart = 1 - distance / runner.length;
906
+ const alphaEnd = 1 - (distance + visible) / runner.length;
907
+ const gradient = ctx.createLinearGradient(from.x, from.y, endX, endY);
908
+ gradient.addColorStop(0, `rgba(${RUNNER_RGB}, ${alphaStart})`);
909
+ gradient.addColorStop(1, `rgba(${RUNNER_RGB}, ${alphaEnd})`);
910
+ ctx.strokeStyle = gradient;
911
+ ctx.beginPath();
912
+ ctx.moveTo(from.x, from.y);
913
+ ctx.lineTo(endX, endY);
914
+ ctx.stroke();
915
+ distance += visible;
916
+ }
917
+ ctx.shadowBlur = 12;
918
+ ctx.fillStyle = COLORS.accentBright;
919
+ ctx.fillRect(runner.x - 2.5, runner.y - 2.5, 5, 5);
920
+ ctx.shadowBlur = 0;
921
+ }
922
+ function createGridCanvas() {
923
+ const canvas = document.createElement("canvas");
924
+ canvas.className = getClasses().canvas;
925
+ const ctx = canvas.getContext("2d");
926
+ if (!ctx) return canvas;
927
+ let width = 0;
928
+ let height = 0;
929
+ let dpr = 1;
930
+ let running = false;
931
+ let last = 0;
932
+ let runners = [];
933
+ const frame = (time) => {
934
+ if (!canvas.isConnected) {
935
+ observer.disconnect();
936
+ return;
937
+ }
938
+ const dt = Math.min(0.05, (time - last) / 1e3);
939
+ last = time;
940
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
941
+ ctx.clearRect(0, 0, width, height);
942
+ ctx.translate(0.5, 0.5);
943
+ for (const runner of runners) {
944
+ advanceRunner(runner, dt, width, height);
945
+ drawRunner(ctx, runner);
946
+ }
947
+ requestAnimationFrame(frame);
948
+ };
949
+ const observer = new ResizeObserver((entries) => {
950
+ const rect = entries[0]?.contentRect;
951
+ if (!rect || rect.width === 0 || rect.height === 0) return;
952
+ width = rect.width;
953
+ height = rect.height;
954
+ dpr = window.devicePixelRatio || 1;
955
+ canvas.width = Math.round(width * dpr);
956
+ canvas.height = Math.round(height * dpr);
957
+ const count = Math.max(3, Math.round(width * height / 16e4));
958
+ runners = Array.from({ length: count }, () => createRunner(width, height));
959
+ if (!running) {
960
+ running = true;
961
+ last = performance.now();
962
+ requestAnimationFrame(frame);
963
+ }
964
+ });
965
+ observer.observe(canvas);
966
+ return canvas;
967
+ }
968
+ function createCheckbox(checked, onChange) {
969
+ const c = getClasses();
970
+ const input = document.createElement("input");
971
+ input.type = "checkbox";
972
+ input.checked = checked;
973
+ const paint = () => {
974
+ input.className = input.checked ? `${c.checkbox} ${c.checkboxChecked}` : c.checkbox;
975
+ };
976
+ paint();
977
+ input.addEventListener("change", () => {
978
+ paint();
979
+ onChange(input.checked);
980
+ });
981
+ return input;
982
+ }
983
+ function createCheckboxRow(label, checked, onChange) {
984
+ const c = getClasses();
985
+ return /* @__PURE__ */ jsxs("label", { class: c.checkboxRow, children: [
986
+ createCheckbox(checked, onChange),
987
+ /* @__PURE__ */ jsx("span", { class: c.checkboxLabel, children: label })
988
+ ] });
989
+ }
990
+ function createRow(label, control, stacked = false) {
991
+ const c = getClasses();
992
+ return /* @__PURE__ */ jsxs("div", { class: stacked ? `${c.row} ${c.rowStacked}` : c.row, children: [
993
+ /* @__PURE__ */ jsx("span", { class: c.rowLabel, children: label }),
994
+ control
995
+ ] });
996
+ }
997
+ function playTerminal(body) {
998
+ const c = getClasses();
999
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1000
+ const cursor = document.createElement("span");
1001
+ cursor.className = c.termCursor;
1002
+ const scrollDown = () => {
1003
+ body.scrollTop = body.scrollHeight;
1004
+ };
1005
+ const run = async () => {
1006
+ await sleep(60);
1007
+ for (const job of TERMINAL_JOBS) {
1008
+ if (!body.isConnected) return;
1009
+ if (job.type === "timer") {
1010
+ await sleep(job.duration);
1011
+ continue;
1012
+ }
1013
+ const line = document.createElement("div");
1014
+ line.className = c.termLine;
1015
+ if (job.type === "cmd") {
1016
+ const prompt2 = document.createElement("span");
1017
+ prompt2.className = c.termPrompt;
1018
+ prompt2.textContent = TERMINAL_PROMPT;
1019
+ const text = document.createElement("span");
1020
+ text.className = c.termCmd;
1021
+ line.append(prompt2, text, cursor);
1022
+ body.append(line);
1023
+ scrollDown();
1024
+ for (const char of job.text) {
1025
+ if (!body.isConnected) return;
1026
+ text.textContent += char;
1027
+ scrollDown();
1028
+ await sleep(TYPING_DELAY);
1029
+ }
1030
+ await sleep(120);
1031
+ } else {
1032
+ const text = document.createElement("span");
1033
+ text.className = c.termOut;
1034
+ text.textContent = job.text;
1035
+ line.append(text, cursor);
1036
+ body.append(line);
1037
+ scrollDown();
1038
+ }
1039
+ }
1040
+ if (!body.isConnected) return;
1041
+ const finalLine = document.createElement("div");
1042
+ finalLine.className = c.termLine;
1043
+ const prompt = document.createElement("span");
1044
+ prompt.className = c.termPrompt;
1045
+ prompt.textContent = TERMINAL_PROMPT;
1046
+ finalLine.append(prompt, cursor);
1047
+ body.append(finalLine);
1048
+ scrollDown();
1049
+ };
1050
+ void run();
1051
+ }
1052
+ function createTerminalPreview() {
1053
+ const c = getClasses();
1054
+ const body = /* @__PURE__ */ jsx("div", { class: c.terminalBody });
1055
+ const terminal = /* @__PURE__ */ jsxs("div", { class: c.terminal, children: [
1056
+ /* @__PURE__ */ jsxs("div", { class: c.terminalBar, children: [
1057
+ /* @__PURE__ */ jsxs("div", { class: c.terminalDots, children: [
1058
+ /* @__PURE__ */ jsx("span", { class: c.dotRed }),
1059
+ /* @__PURE__ */ jsx("span", { class: c.dotYellow }),
1060
+ /* @__PURE__ */ jsx("span", { class: c.dotGreen })
1061
+ ] }),
1062
+ /* @__PURE__ */ jsx("span", { class: c.terminalUser, children: "root@kernel" })
1063
+ ] }),
1064
+ body
1065
+ ] });
1066
+ playTerminal(body);
1067
+ return terminal;
1068
+ }
1069
+ function createHomePanel() {
1070
+ const c = getClasses();
1071
+ return /* @__PURE__ */ jsxs("div", { class: c.home, children: [
1072
+ /* @__PURE__ */ jsx("p", { class: c.homeDescription, children: "If you got here, then you definitely didn't do it by accident. This is a tool that Zoi uses to test and debug their mods as well as change hidden settings. All the settings are stored in local storage and are not transferred between servers." }),
1073
+ createTerminalPreview()
1074
+ ] });
1075
+ }
1076
+ function createBlacklistEditor(items, onChange) {
1077
+ const c = getClasses();
1078
+ let values = items.slice();
1079
+ const root = document.createElement("div");
1080
+ root.className = c.blacklistBox;
1081
+ const chips = document.createElement("div");
1082
+ chips.className = c.blacklistChips;
1083
+ const input = document.createElement("input");
1084
+ input.type = "text";
1085
+ input.className = `${c.field} ${c.blacklistInput} zc-core-settings-field`;
1086
+ input.placeholder = "Type a regular expression and press Enter";
1087
+ const renderChips = () => {
1088
+ chips.replaceChildren();
1089
+ for (const value of values) {
1090
+ const chip = document.createElement("div");
1091
+ chip.className = c.blacklistChip;
1092
+ chip.append(document.createTextNode(value));
1093
+ const remove = document.createElement("button");
1094
+ remove.type = "button";
1095
+ remove.className = c.blacklistChipRemove;
1096
+ remove.setAttribute("aria-label", "Remove");
1097
+ remove.textContent = "\xD7";
1098
+ remove.addEventListener("click", () => {
1099
+ values = values.filter((item) => item !== value);
1100
+ onChange(values.slice());
1101
+ renderChips();
1102
+ });
1103
+ chip.append(remove);
1104
+ chips.append(chip);
1105
+ }
1106
+ };
1107
+ input.addEventListener("keydown", (event) => {
1108
+ if (event.key !== "Enter") return;
1109
+ event.preventDefault();
1110
+ const next = input.value.trim();
1111
+ if (!next) return;
1112
+ if (!values.includes(next)) {
1113
+ values = [...values, next];
1114
+ onChange(values.slice());
1115
+ renderChips();
1116
+ }
1117
+ input.value = "";
1118
+ });
1119
+ renderChips();
1120
+ root.append(chips, input);
1121
+ return root;
1122
+ }
1123
+ function renderGeneralSection() {
1124
+ const c = getClasses();
1125
+ const settings = getSettings();
1126
+ return /* @__PURE__ */ jsxs("div", { class: c.section, children: [
1127
+ createCheckboxRow("Dev Mode", !!settings.devMode, (next) => {
1128
+ settings.devMode = next;
1129
+ setSettings(settings);
1130
+ }),
1131
+ /* @__PURE__ */ jsx(
1132
+ "button",
1133
+ {
1134
+ class: c.danger,
1135
+ onClick: () => {
1136
+ resetSettings();
1137
+ window.location.replace(window.location.href);
1138
+ },
1139
+ children: "Reset Core"
1140
+ }
1141
+ )
1142
+ ] });
1143
+ }
1144
+ function renderDevelopmentSection() {
1145
+ const c = getClasses();
1146
+ const settings = getSettings();
1147
+ return /* @__PURE__ */ jsxs("div", { class: c.section, children: [
1148
+ createCheckboxRow("Auto Connect To Dev Backend Server", !!settings.autoConnectToDevBackendServer, (next) => {
1149
+ settings.autoConnectToDevBackendServer = next;
1150
+ setSettings(settings);
1151
+ window.location.replace(window.location.href);
1152
+ }),
1153
+ createCheckboxRow("Allow Replace Mod SDK", !!settings.allowReplaceModSdk, (next) => {
1154
+ settings.allowReplaceModSdk = next;
1155
+ setSettings(settings);
1156
+ })
1157
+ ] });
1158
+ }
1159
+ function renderDependentsSection() {
1160
+ const c = getClasses();
1161
+ const dependents = window.ZOIS_CORE?.getDependents() ?? [];
1162
+ return /* @__PURE__ */ jsxs("div", { class: c.section, children: [
1163
+ /* @__PURE__ */ jsxs("div", { class: c.dependentSummary, children: [
1164
+ /* @__PURE__ */ jsx("span", { class: c.dependentSummaryText, children: "Registered mods:" }),
1165
+ /* @__PURE__ */ jsx("strong", { class: c.dependentSummaryStrong, children: dependents.length })
1166
+ ] }),
1167
+ dependents.length === 0 ? /* @__PURE__ */ jsx("div", { class: c.row, children: "No mods have registered yet." }) : dependents.map((dependent) => /* @__PURE__ */ jsx("div", { class: c.modRow, children: /* @__PURE__ */ jsxs("div", { class: c.modInfo, children: [
1168
+ /* @__PURE__ */ jsx("div", { class: c.modTitleLine, children: /* @__PURE__ */ jsx("span", { class: c.modName, children: dependent.modData.fullName || dependent.modData.name }) }),
1169
+ /* @__PURE__ */ jsxs("span", { class: c.dependentSummaryText, children: [
1170
+ dependent.modData.name,
1171
+ " \xB7 v",
1172
+ dependent.modData.version,
1173
+ " \xB7 core ",
1174
+ dependent.coreVersion
1175
+ ] }),
1176
+ dependent.modData.repository ? /* @__PURE__ */ jsx("a", { class: c.dependentSummaryText, href: dependent.modData.repository, target: "_blank", rel: "noopener noreferrer", children: dependent.modData.repository }) : null
1177
+ ] }) }))
1178
+ ] });
1179
+ }
1180
+ function renderToastsSection() {
1181
+ const c = getClasses();
1182
+ const settings = getSettings();
1183
+ const currentScale = settings.toasts?.scaleFactor?.toString() ?? "1";
1184
+ const currentPosition = settings.toasts?.position ?? "bottom-left";
1185
+ const scaleInput = /* @__PURE__ */ jsx(
1186
+ "input",
1187
+ {
1188
+ class: `${c.field} ${c.fieldNumber}`,
1189
+ type: "number",
1190
+ min: "0.25",
1191
+ max: "4",
1192
+ step: "0.05",
1193
+ value: currentScale,
1194
+ onInput: (event) => {
1195
+ const value = event.currentTarget.value;
1196
+ const num = Number.parseFloat(value);
1197
+ if (!Number.isFinite(num)) return;
1198
+ const clamped = Math.min(4, Math.max(0.25, num));
1199
+ settings.toasts ??= {};
1200
+ settings.toasts.scaleFactor = clamped;
1201
+ setSettings(settings);
1202
+ event.currentTarget.value = String(clamped);
1203
+ }
1204
+ }
1205
+ );
1206
+ const positionSelect = /* @__PURE__ */ jsxs(
1207
+ "select",
1208
+ {
1209
+ class: `${c.field} ${c.fieldSelect} zc-core-settings-select`,
1210
+ value: currentPosition,
1211
+ onChange: (event) => {
1212
+ const value = event.currentTarget.value;
1213
+ settings.toasts ??= {};
1214
+ settings.toasts.position = value;
1215
+ setSettings(settings);
1216
+ },
1217
+ children: [
1218
+ /* @__PURE__ */ jsx("option", { value: "top-left", children: "Top Left" }),
1219
+ /* @__PURE__ */ jsx("option", { value: "top-right", children: "Top Right" }),
1220
+ /* @__PURE__ */ jsx("option", { value: "bottom-left", children: "Bottom Left" }),
1221
+ /* @__PURE__ */ jsx("option", { value: "bottom-right", children: "Bottom Right" })
1222
+ ]
1223
+ }
1224
+ );
1225
+ const blacklistItems = settings.toasts?.blacklist?.content ?? [];
1226
+ const coreReady = !!window.ZOIS_CORE;
1227
+ const blacklistEditor = createBlacklistEditor(blacklistItems, (next) => {
1228
+ settings.toasts ??= {};
1229
+ settings.toasts.blacklist ??= {};
1230
+ settings.toasts.blacklist.content = next;
1231
+ settings.toasts.blacklist.enabled = next.length > 0;
1232
+ setSettings(settings);
1233
+ });
1234
+ return /* @__PURE__ */ jsxs("div", { class: c.section, children: [
1235
+ createRow("Scale factor (defaults to 1)", scaleInput),
1236
+ createRow("Position", positionSelect),
1237
+ createRow("Blacklist", blacklistEditor, true),
1238
+ /* @__PURE__ */ jsxs("div", { class: c.actions, children: [
1239
+ /* @__PURE__ */ jsx(
1240
+ "button",
1241
+ {
1242
+ class: coreReady ? c.pill : `${c.pill} ${c.pillDisabled}`,
1243
+ type: "button",
1244
+ disabled: !coreReady,
1245
+ onClick: () => {
1246
+ if (!window.ZOIS_CORE) return;
1247
+ setSettings(settings);
1248
+ toastsManager.success({ title: "Something was completed successfully", message: "Message details", duration: 8e3 });
1249
+ toastsManager.info({ title: "Very important announcement", message: "You have been informed that you have been informed", duration: 8e3 });
1250
+ toastsManager.warn({ title: "Don't look at me like that", message: "You were warned", duration: 8e3 });
1251
+ toastsManager.error({ title: "Critical bug found", message: "Catch him!", duration: 8e3 });
1252
+ },
1253
+ children: "Test"
1254
+ }
1255
+ ),
1256
+ /* @__PURE__ */ jsx(
1257
+ "button",
1258
+ {
1259
+ class: coreReady ? `${c.pill} zc-core-settings-action` : `${c.pill} ${c.pillDisabled} zc-core-settings-action`,
1260
+ type: "button",
1261
+ disabled: !coreReady,
1262
+ onClick: () => {
1263
+ if (!window.ZOIS_CORE) return;
1264
+ resetToastThemes();
1265
+ },
1266
+ children: "Reset Themes"
1267
+ }
1268
+ )
1269
+ ] })
1270
+ ] });
1271
+ }
1272
+ function buildSettingsContent(activeSection) {
1273
+ const c = getClasses();
1274
+ return /* @__PURE__ */ jsx("div", { class: c.content, children: activeSection === null ? createHomePanel() : activeSection === "general" ? renderGeneralSection() : activeSection === "toasts" ? renderToastsSection() : activeSection === "dependents" ? renderDependentsSection() : renderDevelopmentSection() });
1275
+ }
1276
+ function createSettingsDialog() {
1277
+ const c = getClasses();
1278
+ const dialog = document.createElement("dialog");
1279
+ dialog.id = "zc-core-settings-dialog";
1280
+ dialog.setAttribute("data-zc-dialog-type", "core-settings");
1281
+ dialog.className = c.dialog;
1282
+ const shell = document.createElement("div");
1283
+ shell.className = `${c.shell} zc-core-settings-shell`;
1284
+ const layer = document.createElement("div");
1285
+ layer.className = c.layer;
1286
+ shell.append(createGridCanvas(), layer);
1287
+ dialog.replaceChildren(shell);
1288
+ let activeSection = null;
1289
+ const render = () => {
1290
+ const sidebar = /* @__PURE__ */ jsxs("aside", { class: c.sidebar, children: [
1291
+ /* @__PURE__ */ jsx("div", { class: c.sidebarTitle, children: "zois-core" }),
1292
+ SECTION_ITEMS.map((item) => /* @__PURE__ */ jsx(
1293
+ "button",
1294
+ {
1295
+ class: `${c.nav} ${activeSection === item.key ? c.navActive : ""} zc-core-settings-menu`,
1296
+ type: "button",
1297
+ onClick: () => {
1298
+ activeSection = item.key;
1299
+ render();
1300
+ },
1301
+ children: item.label
1302
+ }
1303
+ ))
1304
+ ] });
1305
+ const main = /* @__PURE__ */ jsxs("main", { class: c.main, children: [
1306
+ /* @__PURE__ */ jsxs("div", { class: c.header, children: [
1307
+ /* @__PURE__ */ jsx("div", { class: c.title, children: activeSection ? SECTION_ITEMS.find((item) => item.key === activeSection)?.label ?? "Settings" : "" }),
1308
+ /* @__PURE__ */ jsx(
1309
+ "button",
1310
+ {
1311
+ class: `${c.close} zc-core-settings-action`,
1312
+ type: "button",
1313
+ onClick: () => {
1314
+ closeCoreSettingsDialog();
1315
+ },
1316
+ "aria-label": "Close settings",
1317
+ children: "\xD7"
1318
+ }
1319
+ )
1320
+ ] }),
1321
+ /* @__PURE__ */ jsx("div", { class: activeSection === null ? c.scrollFixed : c.scroll, children: buildSettingsContent(activeSection) })
1322
+ ] });
1323
+ layer.replaceChildren(sidebar, main);
1324
+ };
1325
+ render();
1326
+ dialog.addEventListener("cancel", (event) => {
1327
+ event.preventDefault();
1328
+ closeCoreSettingsDialog();
1329
+ });
1330
+ return dialog;
1331
+ }
1332
+ function openCoreSettingsDialog() {
1333
+ const existing = document.getElementById("zc-core-settings-dialog");
1334
+ if (existing) {
1335
+ if (!existing.open) {
1336
+ existing.showModal();
1337
+ }
1338
+ return existing;
1339
+ }
1340
+ const dialog = createSettingsDialog();
1341
+ document.body.append(dialog);
1342
+ if (!dialog.open) {
1343
+ dialog.showModal();
1344
+ }
1345
+ return dialog;
1346
+ }
1347
+ function closeCoreSettingsDialog() {
1348
+ const dialog = document.getElementById("zc-core-settings-dialog");
1349
+ if (!dialog) return;
1350
+ if (dialog.open) {
1351
+ dialog.close();
1352
+ }
1353
+ if (dialog.parentNode) {
1354
+ dialog.remove();
1355
+ }
1356
+ }
1357
+ export {
1358
+ closeCoreSettingsDialog,
1359
+ createSettingsDialog,
1360
+ openCoreSettingsDialog
1361
+ };