tgui-core 1.1.11 → 1.1.13

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 (292) hide show
  1. package/dist/ProgressBar.module-BkAFfFy0.js +29 -0
  2. package/dist/Section.module-CLVHJ4yA.js +15 -0
  3. package/dist/assets/BlockQuote.css +1 -0
  4. package/dist/assets/Button.css +1 -0
  5. package/dist/assets/ColorBox.css +1 -0
  6. package/dist/assets/Dialog.css +1 -0
  7. package/dist/assets/Dimmer.css +1 -0
  8. package/dist/assets/Divider.css +1 -0
  9. package/dist/assets/Flex.css +1 -0
  10. package/dist/assets/Icon.css +6 -0
  11. package/dist/assets/Input.css +1 -0
  12. package/dist/assets/Knob.css +1 -0
  13. package/dist/assets/LabeledList.css +1 -0
  14. package/dist/assets/MenuBar.css +1 -0
  15. package/dist/assets/Modal.css +1 -0
  16. package/dist/assets/NoticeBox.css +1 -0
  17. package/dist/assets/NumberInput.css +1 -0
  18. package/dist/assets/ProgressBar.css +1 -0
  19. package/dist/assets/RoundGauge.css +1 -0
  20. package/dist/assets/Section.css +1 -0
  21. package/dist/assets/Slider.css +1 -0
  22. package/dist/assets/Stack.css +1 -0
  23. package/dist/assets/Table.css +1 -0
  24. package/dist/assets/Tabs.css +1 -0
  25. package/dist/assets/TextArea.css +1 -0
  26. package/dist/assets/Tooltip.css +1 -0
  27. package/dist/common/assets.d.ts +4 -0
  28. package/dist/common/assets.js +25 -0
  29. package/dist/common/collections.d.ts +10 -0
  30. package/dist/common/collections.js +15 -0
  31. package/dist/common/color.d.ts +25 -0
  32. package/dist/common/color.js +69 -0
  33. package/dist/common/constants.d.ts +102 -0
  34. package/dist/common/constants.js +312 -0
  35. package/dist/common/events.d.ts +33 -0
  36. package/dist/common/events.js +147 -0
  37. package/{lib/common/exhaustive.ts → dist/common/exhaustive.d.ts} +1 -3
  38. package/dist/common/exhaustive.js +6 -0
  39. package/dist/common/format.d.ts +11 -0
  40. package/dist/common/format.js +114 -0
  41. package/{lib/common/fp.ts → dist/common/fp.d.ts} +2 -16
  42. package/dist/common/fp.js +9 -0
  43. package/dist/common/hotkeys.d.ts +25 -0
  44. package/dist/common/hotkeys.js +112 -0
  45. package/dist/common/http.d.ts +4 -0
  46. package/dist/common/http.js +10 -0
  47. package/dist/common/keycodes.d.ts +85 -0
  48. package/dist/common/keycodes.js +88 -0
  49. package/{lib/common/keys.ts → dist/common/keys.d.ts} +21 -24
  50. package/dist/common/keys.js +8 -0
  51. package/dist/common/math.d.ts +39 -0
  52. package/dist/common/math.js +41 -0
  53. package/dist/common/perf.d.ts +24 -0
  54. package/dist/common/perf.js +33 -0
  55. package/dist/common/random.d.ts +16 -0
  56. package/dist/common/random.js +18 -0
  57. package/dist/common/react.d.ts +23 -0
  58. package/dist/common/react.js +30 -0
  59. package/dist/common/redux.d.ts +64 -0
  60. package/dist/common/redux.js +72 -0
  61. package/dist/common/storage.d.ts +24 -0
  62. package/dist/common/storage.js +133 -0
  63. package/dist/common/string.d.ts +65 -0
  64. package/dist/common/string.js +83 -0
  65. package/dist/common/timer.d.ts +18 -0
  66. package/dist/common/timer.js +28 -0
  67. package/dist/common/type-utils.d.ts +9 -0
  68. package/dist/common/type-utils.js +25 -0
  69. package/dist/common/uuid.d.ts +9 -0
  70. package/dist/common/uuid.js +10 -0
  71. package/dist/components/AnimatedNumber.d.ts +60 -0
  72. package/dist/components/AnimatedNumber.js +76 -0
  73. package/dist/components/Autofocus.d.ts +4 -0
  74. package/dist/components/Autofocus.js +17 -0
  75. package/dist/components/Blink.d.ts +26 -0
  76. package/dist/components/Blink.js +56 -0
  77. package/dist/components/BlockQuote.d.ts +3 -0
  78. package/dist/components/BlockQuote.js +13 -0
  79. package/dist/components/BodyZoneSelector.d.ts +28 -0
  80. package/dist/components/BodyZoneSelector.js +115 -0
  81. package/dist/components/Box.d.ts +91 -0
  82. package/dist/components/Box.js +133 -0
  83. package/dist/components/Button.d.ts +93 -0
  84. package/dist/components/Button.js +298 -0
  85. package/dist/components/ByondUi.js +73 -0
  86. package/dist/components/Chart.d.ts +28 -0
  87. package/dist/components/Chart.js +95 -0
  88. package/dist/components/Collapsible.d.ts +15 -0
  89. package/dist/components/Collapsible.js +27 -0
  90. package/dist/components/ColorBox.d.ts +8 -0
  91. package/dist/components/ColorBox.js +24 -0
  92. package/dist/components/Dialog.d.ts +24 -0
  93. package/dist/components/Dialog.js +67 -0
  94. package/dist/components/Dimmer.d.ts +3 -0
  95. package/dist/components/Dimmer.js +13 -0
  96. package/dist/components/Divider.d.ts +6 -0
  97. package/dist/components/Divider.js +22 -0
  98. package/dist/components/DmIcon.d.ts +33 -0
  99. package/dist/components/DmIcon.js +29 -0
  100. package/dist/components/DraggableControl.js +176 -0
  101. package/dist/components/Dropdown.d.ts +48 -0
  102. package/dist/components/Dropdown.js +152 -0
  103. package/dist/components/FakeTerminal.js +38 -0
  104. package/dist/components/FitText.d.ts +22 -0
  105. package/dist/components/FitText.js +63 -0
  106. package/dist/components/Flex.d.ts +93 -0
  107. package/dist/components/Flex.js +72 -0
  108. package/dist/components/Icon.d.ts +30 -0
  109. package/dist/components/Icon.js +51 -0
  110. package/dist/components/Image.d.ts +14 -0
  111. package/dist/components/Image.js +35 -0
  112. package/dist/components/InfinitePlane.js +139 -0
  113. package/dist/components/Input.d.ts +61 -0
  114. package/dist/components/Input.js +89 -0
  115. package/dist/components/KeyListener.d.ts +15 -0
  116. package/dist/components/KeyListener.js +23 -0
  117. package/dist/components/Knob.d.ts +49 -0
  118. package/dist/components/Knob.js +162 -0
  119. package/dist/components/LabeledControls.d.ts +11 -0
  120. package/dist/components/LabeledControls.js +39 -0
  121. package/dist/components/LabeledList.d.ts +57 -0
  122. package/dist/components/LabeledList.js +94 -0
  123. package/dist/components/MenuBar.d.ts +28 -0
  124. package/dist/components/MenuBar.js +174 -0
  125. package/dist/components/Modal.d.ts +3 -0
  126. package/dist/components/Modal.js +25 -0
  127. package/dist/components/NoticeBox.d.ts +20 -0
  128. package/dist/components/NoticeBox.js +49 -0
  129. package/dist/components/NumberInput.d.ts +45 -0
  130. package/dist/components/NumberInput.js +221 -0
  131. package/dist/components/Popper.d.ts +27 -0
  132. package/dist/components/Popper.js +177 -0
  133. package/dist/components/ProgressBar.d.ts +46 -0
  134. package/dist/components/ProgressBar.js +37 -0
  135. package/dist/components/RestrictedInput.js +155 -0
  136. package/dist/components/RoundGauge.d.ts +53 -0
  137. package/dist/components/RoundGauge.js +147 -0
  138. package/dist/components/Section.d.ts +63 -0
  139. package/dist/components/Section.js +62 -0
  140. package/dist/components/Slider.d.ts +46 -0
  141. package/dist/components/Slider.js +124 -0
  142. package/dist/components/Stack.d.ts +27 -0
  143. package/dist/components/Stack.js +67 -0
  144. package/dist/components/StyleableSection.d.ts +11 -0
  145. package/dist/components/StyleableSection.js +16 -0
  146. package/dist/components/Table.d.ts +29 -0
  147. package/dist/components/Table.js +67 -0
  148. package/dist/components/Tabs.d.ts +23 -0
  149. package/dist/components/Tabs.js +89 -0
  150. package/dist/components/TextArea.d.ts +39 -0
  151. package/dist/components/TextArea.js +118 -0
  152. package/dist/components/TimeDisplay.js +34 -0
  153. package/dist/components/Tooltip.d.ts +29 -0
  154. package/dist/components/Tooltip.js +83 -0
  155. package/dist/components/TrackOutsideClicks.d.ts +13 -0
  156. package/dist/components/TrackOutsideClicks.js +24 -0
  157. package/dist/components/VirtualList.d.ts +8 -0
  158. package/dist/components/VirtualList.js +34 -0
  159. package/dist/components/index.js +92 -0
  160. package/dist/popper-CiqSDJTE.js +906 -0
  161. package/package.json +8 -10
  162. package/lib/common/assets.ts +0 -38
  163. package/lib/common/collections.ts +0 -27
  164. package/lib/common/color.ts +0 -88
  165. package/lib/common/constants.ts +0 -349
  166. package/lib/common/events.ts +0 -262
  167. package/lib/common/format.ts +0 -167
  168. package/lib/common/hotkeys.ts +0 -207
  169. package/lib/common/http.ts +0 -16
  170. package/lib/common/keycodes.ts +0 -86
  171. package/lib/common/math.ts +0 -76
  172. package/lib/common/perf.ts +0 -72
  173. package/lib/common/random.ts +0 -32
  174. package/lib/common/react.ts +0 -59
  175. package/lib/common/redux.ts +0 -187
  176. package/lib/common/storage.ts +0 -207
  177. package/lib/common/string.ts +0 -169
  178. package/lib/common/timer.ts +0 -63
  179. package/lib/common/type-utils.ts +0 -41
  180. package/lib/common/types.d.ts +0 -12
  181. package/lib/common/uuid.ts +0 -18
  182. package/lib/components/AnimatedNumber.tsx +0 -180
  183. package/lib/components/Autofocus.tsx +0 -23
  184. package/lib/components/Blink.tsx +0 -91
  185. package/lib/components/BlockQuote.tsx +0 -9
  186. package/lib/components/BodyZoneSelector.tsx +0 -149
  187. package/lib/components/Box.tsx +0 -252
  188. package/lib/components/Button.tsx +0 -425
  189. package/lib/components/ByondUi.jsx +0 -110
  190. package/lib/components/Chart.tsx +0 -155
  191. package/lib/components/Collapsible.tsx +0 -43
  192. package/lib/components/ColorBox.tsx +0 -29
  193. package/lib/components/Dialog.tsx +0 -81
  194. package/lib/components/Dimmer.tsx +0 -13
  195. package/lib/components/Divider.tsx +0 -20
  196. package/lib/components/DmIcon.tsx +0 -86
  197. package/lib/components/DraggableControl.jsx +0 -276
  198. package/lib/components/Dropdown.tsx +0 -246
  199. package/lib/components/FakeTerminal.jsx +0 -52
  200. package/lib/components/FitText.tsx +0 -99
  201. package/lib/components/Flex.tsx +0 -159
  202. package/lib/components/Icon.tsx +0 -95
  203. package/lib/components/Image.tsx +0 -54
  204. package/lib/components/InfinitePlane.jsx +0 -192
  205. package/lib/components/Input.tsx +0 -176
  206. package/lib/components/KeyListener.tsx +0 -40
  207. package/lib/components/Knob.tsx +0 -178
  208. package/lib/components/LabeledControls.tsx +0 -44
  209. package/lib/components/LabeledList.tsx +0 -154
  210. package/lib/components/MenuBar.tsx +0 -228
  211. package/lib/components/Modal.tsx +0 -23
  212. package/lib/components/NoticeBox.tsx +0 -45
  213. package/lib/components/NumberInput.tsx +0 -328
  214. package/lib/components/Popper.tsx +0 -100
  215. package/lib/components/ProgressBar.tsx +0 -105
  216. package/lib/components/RestrictedInput.jsx +0 -301
  217. package/lib/components/RoundGauge.tsx +0 -180
  218. package/lib/components/Section.tsx +0 -120
  219. package/lib/components/Slider.tsx +0 -169
  220. package/lib/components/Stack.tsx +0 -96
  221. package/lib/components/StyleableSection.tsx +0 -33
  222. package/lib/components/Table.tsx +0 -84
  223. package/lib/components/Tabs.tsx +0 -89
  224. package/lib/components/TextArea.tsx +0 -182
  225. package/lib/components/TimeDisplay.jsx +0 -64
  226. package/lib/components/Tooltip.tsx +0 -152
  227. package/lib/components/TrackOutsideClicks.tsx +0 -35
  228. package/lib/components/VirtualList.tsx +0 -69
  229. package/lib/styles/atomic/candystripe.scss +0 -8
  230. package/lib/styles/atomic/centered-image.scss +0 -7
  231. package/lib/styles/atomic/color.scss +0 -21
  232. package/lib/styles/atomic/debug-layout.scss +0 -17
  233. package/lib/styles/atomic/fit-text.scss +0 -14
  234. package/lib/styles/atomic/links.scss +0 -12
  235. package/lib/styles/atomic/outline.scss +0 -47
  236. package/lib/styles/atomic/text.scss +0 -44
  237. package/lib/styles/base.scss +0 -32
  238. package/lib/styles/colors.scss +0 -92
  239. package/lib/styles/components/BlockQuote.module.scss +0 -20
  240. package/lib/styles/components/BlockQuote.module.scss.d.ts +0 -4
  241. package/lib/styles/components/Button.module.scss +0 -157
  242. package/lib/styles/components/Button.module.scss.d.ts +0 -46
  243. package/lib/styles/components/ColorBox.module.scss +0 -12
  244. package/lib/styles/components/ColorBox.module.scss.d.ts +0 -4
  245. package/lib/styles/components/Dialog.module.scss +0 -60
  246. package/lib/styles/components/Dialog.module.scss.d.ts +0 -10
  247. package/lib/styles/components/Dimmer.module.scss +0 -22
  248. package/lib/styles/components/Dimmer.module.scss.d.ts +0 -4
  249. package/lib/styles/components/Divider.module.scss +0 -27
  250. package/lib/styles/components/Divider.module.scss.d.ts +0 -6
  251. package/lib/styles/components/Dropdown.scss +0 -72
  252. package/lib/styles/components/Flex.module.scss +0 -13
  253. package/lib/styles/components/Flex.module.scss.d.ts +0 -5
  254. package/lib/styles/components/Icon.module.scss +0 -25
  255. package/lib/styles/components/Icon.module.scss.d.ts +0 -5
  256. package/lib/styles/components/Input.module.scss +0 -64
  257. package/lib/styles/components/Input.module.scss.d.ts +0 -8
  258. package/lib/styles/components/Knob.module.scss +0 -131
  259. package/lib/styles/components/Knob.module.scss.d.ts +0 -33
  260. package/lib/styles/components/LabeledList.module.scss +0 -49
  261. package/lib/styles/components/LabeledList.module.scss.d.ts +0 -8
  262. package/lib/styles/components/MenuBar.module.scss +0 -75
  263. package/lib/styles/components/MenuBar.module.scss.d.ts +0 -14
  264. package/lib/styles/components/Modal.module.scss +0 -14
  265. package/lib/styles/components/Modal.module.scss.d.ts +0 -4
  266. package/lib/styles/components/NoticeBox.module.scss +0 -65
  267. package/lib/styles/components/NoticeBox.module.scss.d.ts +0 -27
  268. package/lib/styles/components/NumberInput.module.scss +0 -71
  269. package/lib/styles/components/NumberInput.module.scss.d.ts +0 -9
  270. package/lib/styles/components/ProgressBar.module.scss +0 -63
  271. package/lib/styles/components/ProgressBar.module.scss.d.ts +0 -27
  272. package/lib/styles/components/RoundGauge.module.scss +0 -85
  273. package/lib/styles/components/RoundGauge.module.scss.d.ts +0 -49
  274. package/lib/styles/components/Section.module.scss +0 -130
  275. package/lib/styles/components/Section.module.scss.d.ts +0 -13
  276. package/lib/styles/components/Slider.module.scss +0 -54
  277. package/lib/styles/components/Slider.module.scss.d.ts +0 -8
  278. package/lib/styles/components/Stack.module.scss +0 -60
  279. package/lib/styles/components/Stack.module.scss.d.ts +0 -12
  280. package/lib/styles/components/Table.module.scss +0 -44
  281. package/lib/styles/components/Table.module.scss.d.ts +0 -10
  282. package/lib/styles/components/Tabs.module.scss +0 -144
  283. package/lib/styles/components/Tabs.module.scss.d.ts +0 -35
  284. package/lib/styles/components/TextArea.module.scss +0 -86
  285. package/lib/styles/components/TextArea.module.scss.d.ts +0 -11
  286. package/lib/styles/components/Tooltip.module.scss +0 -24
  287. package/lib/styles/components/Tooltip.module.scss.d.ts +0 -4
  288. package/lib/styles/functions.scss +0 -79
  289. package/lib/styles/input.scss +0 -9
  290. package/lib/styles/main.scss +0 -20
  291. package/lib/styles/reset.scss +0 -68
  292. /package/{lib/components/index.ts → dist/components/index.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tgui-core",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "TGUI core component library",
5
5
  "keywords": [
6
6
  "TGUI",
@@ -8,16 +8,16 @@
8
8
  "typescript"
9
9
  ],
10
10
  "files": [
11
- "lib"
11
+ "dist"
12
12
  ],
13
13
  "exports": {
14
14
  "./components": {
15
- "import": "./lib/components/index.ts",
16
- "require": "./lib/components/index.ts"
15
+ "import": "./dist/components/index.js",
16
+ "require": "./dist/components/index.cjs"
17
17
  },
18
18
  "./*": {
19
- "import": "./lib/common/*.ts",
20
- "require": "./lib/common/*.ts"
19
+ "import": "./dist/common/*.js",
20
+ "require": "./dist/common/*.cjs"
21
21
  }
22
22
  },
23
23
  "repository": {
@@ -27,12 +27,9 @@
27
27
  "author": "jlsnow301",
28
28
  "license": "MIT",
29
29
  "type": "module",
30
- "dependencies": {
31
- "@popperjs/core": "^2.11.8",
32
- "react-popper": "^2.3.0"
33
- },
34
30
  "devDependencies": {
35
31
  "@eslint/js": "^9.6.0",
32
+ "@popperjs/core": "^2.11.8",
36
33
  "@types/eslint__js": "^8.42.3",
37
34
  "@types/node": "^20.14.10",
38
35
  "@types/react": "^18.3.3",
@@ -46,6 +43,7 @@
46
43
  "eslint-plugin-typescript-sort-keys": "^3.2.0",
47
44
  "eslint-plugin-unused-imports": "^4.0.0",
48
45
  "glob": "^10.4.3",
46
+ "react-popper": "^2.3.0",
49
47
  "sass": "^1.77.6",
50
48
  "typescript": "^5.5.3",
51
49
  "typescript-eslint": "^7.15.0",
@@ -1,38 +0,0 @@
1
- import { Action, AnyAction, Dispatch, Middleware } from './redux';
2
-
3
- const EXCLUDED_PATTERNS = [/v4shim/i];
4
- const loadedMappings: Record<string, string> = {};
5
-
6
- export function resolveAsset(name: string): string {
7
- return loadedMappings[name] || name;
8
- }
9
-
10
- export const assetMiddleware: Middleware =
11
- (_storeApi) =>
12
- <ActionType extends Action = AnyAction>(next: Dispatch<ActionType>) =>
13
- (action: ActionType) => {
14
- const { type, payload } = action as AnyAction;
15
- if (type === 'asset/stylesheet') {
16
- Byond.loadCss(payload);
17
- return;
18
- }
19
- if (type === 'asset/mappings') {
20
- for (const name of Object.keys(payload)) {
21
- // Skip anything that matches excluded patterns
22
- if (EXCLUDED_PATTERNS.some((regex) => regex.test(name))) {
23
- continue;
24
- }
25
- const url = payload[name];
26
- const ext = name.split('.').pop();
27
- loadedMappings[name] = url;
28
- if (ext === 'css') {
29
- Byond.loadCss(url);
30
- }
31
- if (ext === 'js') {
32
- Byond.loadJs(url);
33
- }
34
- }
35
- return;
36
- }
37
- next(action);
38
- };
@@ -1,27 +0,0 @@
1
- type Zip<T extends unknown[][]> = {
2
- [I in keyof T]: T[I] extends (infer U)[] ? U : never;
3
- }[];
4
-
5
- /**
6
- * Creates an array of grouped elements, the first of which contains
7
- * the first elements of the given arrays, the second of which contains
8
- * the second elements of the given arrays, and so on.
9
- */
10
- export function zip<T extends unknown[][]>(...arrays: T): Zip<T> {
11
- if (arrays.length === 0) {
12
- return [];
13
- }
14
- const numArrays = arrays.length;
15
- const numValues = arrays[0].length;
16
- const result: Zip<T> = [];
17
- for (let valueIndex = 0; valueIndex < numValues; valueIndex++) {
18
- const entry: unknown[] = [];
19
- for (let arrayIndex = 0; arrayIndex < numArrays; arrayIndex++) {
20
- entry.push(arrays[arrayIndex][valueIndex]);
21
- }
22
-
23
- // I tried everything to remove this any, and have no idea how to do it.
24
- result.push(entry as any);
25
- }
26
- return result;
27
- }
@@ -1,88 +0,0 @@
1
- const EPSILON = 0.0001;
2
-
3
- export class Color {
4
- r: number;
5
- g: number;
6
- b: number;
7
- a: number;
8
-
9
- constructor(r = 0, g = 0, b = 0, a = 1) {
10
- this.r = r;
11
- this.g = g;
12
- this.b = b;
13
- this.a = a;
14
- }
15
-
16
- toString(): string {
17
- // Alpha component needs to permit fractional values, so cannot use |
18
- let alpha = this.a;
19
- if (typeof alpha === 'string') {
20
- alpha = parseFloat(this.a as any);
21
- }
22
- if (isNaN(alpha)) {
23
- alpha = 1;
24
- }
25
- return `rgba(${this.r | 0}, ${this.g | 0}, ${this.b | 0}, ${alpha})`;
26
- }
27
-
28
- /** Darkens a color by a given percent. Returns a color, which can have toString called to get it's rgba() css value. */
29
- darken(percent: number): Color {
30
- percent /= 100;
31
- return new Color(
32
- this.r - this.r * percent,
33
- this.g - this.g * percent,
34
- this.b - this.b * percent,
35
- this.a,
36
- );
37
- }
38
-
39
- /** Brightens a color by a given percent. Returns a color, which can have toString called to get it's rgba() css value. */
40
- lighten(percent: number): Color {
41
- // No point in rewriting code we already have.
42
- return this.darken(-percent);
43
- }
44
-
45
- /**
46
- * Creates a color from the CSS hex color notation.
47
- */
48
- static fromHex(hex: string): Color {
49
- return new Color(
50
- parseInt(hex.slice(1, 3), 16),
51
- parseInt(hex.slice(3, 5), 16),
52
- parseInt(hex.slice(5, 7), 16),
53
- );
54
- }
55
-
56
- /**
57
- * Linear interpolation of two colors.
58
- */
59
- static lerp(c1: Color, c2: Color, n: number): Color {
60
- return new Color(
61
- (c2.r - c1.r) * n + c1.r,
62
- (c2.g - c1.g) * n + c1.g,
63
- (c2.b - c1.b) * n + c1.b,
64
- (c2.a - c1.a) * n + c1.a,
65
- );
66
- }
67
-
68
- /**
69
- * Loops up the color in the provided list of colors
70
- * with linear interpolation.
71
- */
72
- static lookup(value: number, colors: Color[]): Color {
73
- const len = colors.length;
74
- if (len < 2) {
75
- throw new Error('Needs at least two colors!');
76
- }
77
- const scaled = value * (len - 1);
78
- if (value < EPSILON) {
79
- return colors[0];
80
- }
81
- if (value >= 1 - EPSILON) {
82
- return colors[len - 1];
83
- }
84
- const ratio = scaled % 1;
85
- const index = scaled | 0;
86
- return this.lerp(colors[index], colors[index + 1], ratio);
87
- }
88
- }
@@ -1,349 +0,0 @@
1
- type Gas = {
2
- color: string;
3
- id: string;
4
- label: string;
5
- name: string;
6
- path: string;
7
- };
8
-
9
- // UI states, which are mirrored from the BYOND code.
10
- export const UI_INTERACTIVE = 2;
11
- export const UI_UPDATE = 1;
12
- export const UI_DISABLED = 0;
13
- export const UI_CLOSE = -1;
14
-
15
- // All game related colors are stored here
16
- export const COLORS = {
17
- // Department colors
18
- department: {
19
- captain: '#c06616',
20
- security: '#e74c3c',
21
- medbay: '#3498db',
22
- science: '#9b59b6',
23
- engineering: '#f1c40f',
24
- cargo: '#f39c12',
25
- service: '#7cc46a',
26
- centcom: '#00c100',
27
- other: '#c38312',
28
- },
29
- // Damage type colors
30
- damageType: {
31
- oxy: '#3498db',
32
- toxin: '#2ecc71',
33
- burn: '#e67e22',
34
- brute: '#e74c3c',
35
- },
36
- // reagent / chemistry related colours
37
- reagent: {
38
- acidicbuffer: '#fbc314',
39
- basicbuffer: '#3853a4',
40
- },
41
- } as const;
42
-
43
- // Colors defined in CSS
44
- export const CSS_COLORS = [
45
- 'average',
46
- 'bad',
47
- 'black',
48
- 'blue',
49
- 'brown',
50
- 'good',
51
- 'green',
52
- 'grey',
53
- 'label',
54
- 'olive',
55
- 'orange',
56
- 'pink',
57
- 'purple',
58
- 'red',
59
- 'teal',
60
- 'transparent',
61
- 'violet',
62
- 'white',
63
- 'yellow',
64
- ] as const;
65
-
66
- export type CssColor = (typeof CSS_COLORS)[number];
67
-
68
- /* IF YOU CHANGE THIS KEEP IT IN SYNC WITH CHAT CSS */
69
- export const RADIO_CHANNELS = [
70
- {
71
- name: 'Syndicate',
72
- freq: 1213,
73
- color: '#8f4a4b',
74
- },
75
- {
76
- name: 'Red Team',
77
- freq: 1215,
78
- color: '#ff4444',
79
- },
80
- {
81
- name: 'Blue Team',
82
- freq: 1217,
83
- color: '#3434fd',
84
- },
85
- {
86
- name: 'Green Team',
87
- freq: 1219,
88
- color: '#34fd34',
89
- },
90
- {
91
- name: 'Yellow Team',
92
- freq: 1221,
93
- color: '#fdfd34',
94
- },
95
- {
96
- name: 'CentCom',
97
- freq: 1337,
98
- color: '#2681a5',
99
- },
100
- {
101
- name: 'Supply',
102
- freq: 1347,
103
- color: '#b88646',
104
- },
105
- {
106
- name: 'Service',
107
- freq: 1349,
108
- color: '#6ca729',
109
- },
110
- {
111
- name: 'Science',
112
- freq: 1351,
113
- color: '#c68cfa',
114
- },
115
- {
116
- name: 'Command',
117
- freq: 1353,
118
- color: '#fcdf03',
119
- },
120
- {
121
- name: 'Medical',
122
- freq: 1355,
123
- color: '#57b8f0',
124
- },
125
- {
126
- name: 'Engineering',
127
- freq: 1357,
128
- color: '#f37746',
129
- },
130
- {
131
- name: 'Security',
132
- freq: 1359,
133
- color: '#dd3535',
134
- },
135
- {
136
- name: 'AI Private',
137
- freq: 1447,
138
- color: '#d65d95',
139
- },
140
- {
141
- name: 'Common',
142
- freq: 1459,
143
- color: '#1ecc43',
144
- },
145
- ] as const;
146
-
147
- const GASES = [
148
- {
149
- id: 'o2',
150
- path: '/datum/gas/oxygen',
151
- name: 'Oxygen',
152
- label: 'O₂',
153
- color: 'blue',
154
- },
155
- {
156
- id: 'n2',
157
- path: '/datum/gas/nitrogen',
158
- name: 'Nitrogen',
159
- label: 'N₂',
160
- color: 'yellow',
161
- },
162
- {
163
- id: 'co2',
164
- path: '/datum/gas/carbon_dioxide',
165
- name: 'Carbon Dioxide',
166
- label: 'CO₂',
167
- color: 'grey',
168
- },
169
- {
170
- id: 'plasma',
171
- path: '/datum/gas/plasma',
172
- name: 'Plasma',
173
- label: 'Plasma',
174
- color: 'pink',
175
- },
176
- {
177
- id: 'water_vapor',
178
- path: '/datum/gas/water_vapor',
179
- name: 'Water Vapor',
180
- label: 'H₂O',
181
- color: 'lightsteelblue',
182
- },
183
- {
184
- id: 'hypernoblium',
185
- path: '/datum/gas/hypernoblium',
186
- name: 'Hyper-noblium',
187
- label: 'Hyper-nob',
188
- color: 'teal',
189
- },
190
- {
191
- id: 'n2o',
192
- path: '/datum/gas/nitrous_oxide',
193
- name: 'Nitrous Oxide',
194
- label: 'N₂O',
195
- color: 'bisque',
196
- },
197
- {
198
- id: 'no2',
199
- path: '/datum/gas/nitrium',
200
- name: 'Nitrium',
201
- label: 'Nitrium',
202
- color: 'brown',
203
- },
204
- {
205
- id: 'tritium',
206
- path: '/datum/gas/tritium',
207
- name: 'Tritium',
208
- label: 'Tritium',
209
- color: 'limegreen',
210
- },
211
- {
212
- id: 'bz',
213
- path: '/datum/gas/bz',
214
- name: 'BZ',
215
- label: 'BZ',
216
- color: 'mediumpurple',
217
- },
218
- {
219
- id: 'pluoxium',
220
- path: '/datum/gas/pluoxium',
221
- name: 'Pluoxium',
222
- label: 'Pluoxium',
223
- color: 'mediumslateblue',
224
- },
225
- {
226
- id: 'miasma',
227
- path: '/datum/gas/miasma',
228
- name: 'Miasma',
229
- label: 'Miasma',
230
- color: 'olive',
231
- },
232
- {
233
- id: 'freon',
234
- path: '/datum/gas/freon',
235
- name: 'Freon',
236
- label: 'Freon',
237
- color: 'paleturquoise',
238
- },
239
- {
240
- id: 'hydrogen',
241
- path: '/datum/gas/hydrogen',
242
- name: 'Hydrogen',
243
- label: 'H₂',
244
- color: 'white',
245
- },
246
- {
247
- id: 'healium',
248
- path: '/datum/gas/healium',
249
- name: 'Healium',
250
- label: 'Healium',
251
- color: 'salmon',
252
- },
253
- {
254
- id: 'proto_nitrate',
255
- path: '/datum/gas/proto_nitrate',
256
- name: 'Proto Nitrate',
257
- label: 'Proto-Nitrate',
258
- color: 'greenyellow',
259
- },
260
- {
261
- id: 'zauker',
262
- path: '/datum/gas/zauker',
263
- name: 'Zauker',
264
- label: 'Zauker',
265
- color: 'darkgreen',
266
- },
267
- {
268
- id: 'halon',
269
- path: '/datum/gas/halon',
270
- name: 'Halon',
271
- label: 'Halon',
272
- color: 'purple',
273
- },
274
- {
275
- id: 'helium',
276
- path: '/datum/gas/helium',
277
- name: 'Helium',
278
- label: 'He',
279
- color: 'aliceblue',
280
- },
281
- {
282
- id: 'antinoblium',
283
- path: '/datum/gas/antinoblium',
284
- name: 'Antinoblium',
285
- label: 'Anti-Noblium',
286
- color: 'maroon',
287
- },
288
- {
289
- id: 'nitrium',
290
- path: '/datum/gas/nitrium',
291
- name: 'Nitrium',
292
- label: 'Nitrium',
293
- color: 'brown',
294
- },
295
- ] as const;
296
-
297
- // Returns gas label based on gasId
298
- export function getGasLabel(gasId: string, fallbackValue?: string) {
299
- if (!gasId) return fallbackValue || 'None';
300
-
301
- const gasSearchString = gasId.toLowerCase();
302
-
303
- for (let idx = 0; idx < GASES.length; idx++) {
304
- if (GASES[idx].id === gasSearchString) {
305
- return GASES[idx].label;
306
- }
307
- }
308
-
309
- return fallbackValue || 'None';
310
- }
311
-
312
- // Returns gas color based on gasId
313
- export function getGasColor(gasId: string) {
314
- if (!gasId) return 'black';
315
-
316
- const gasSearchString = gasId.toLowerCase();
317
-
318
- for (let idx = 0; idx < GASES.length; idx++) {
319
- if (GASES[idx].id === gasSearchString) {
320
- return GASES[idx].color;
321
- }
322
- }
323
-
324
- return 'black';
325
- }
326
-
327
- // Returns gas object based on gasId
328
- export const getGasFromId = (gasId: string): Gas | undefined => {
329
- if (!gasId) return;
330
-
331
- const gasSearchString = gasId.toLowerCase();
332
-
333
- for (let idx = 0; idx < GASES.length; idx++) {
334
- if (GASES[idx].id === gasSearchString) {
335
- return GASES[idx];
336
- }
337
- }
338
- };
339
-
340
- // Returns gas object based on gasPath
341
- export const getGasFromPath = (gasPath: string): Gas | undefined => {
342
- if (!gasPath) return;
343
-
344
- for (let idx = 0; idx < GASES.length; idx++) {
345
- if (GASES[idx].path === gasPath) {
346
- return GASES[idx];
347
- }
348
- }
349
- };