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
@@ -0,0 +1,112 @@
1
+ import { globalEvents as l } from "./events.js";
2
+ import { KEY_ESCAPE as K, KEY_ENTER as E, KEY_SPACE as p, KEY_TAB as h, KEY_CTRL as d, KEY_SHIFT as g, KEY_UP as S, KEY_DOWN as Y, KEY_LEFT as _, KEY_RIGHT as b, KEY_F5 as B } from "./keycodes.js";
3
+ const m = {}, c = [
4
+ K,
5
+ E,
6
+ p,
7
+ h,
8
+ d,
9
+ g,
10
+ S,
11
+ Y,
12
+ _,
13
+ b,
14
+ B
15
+ ], o = {}, u = [];
16
+ function w(t) {
17
+ if (t === 16) return "Shift";
18
+ if (t === 17) return "Ctrl";
19
+ if (t === 18) return "Alt";
20
+ if (t === 33) return "Northeast";
21
+ if (t === 34) return "Southeast";
22
+ if (t === 35) return "Southwest";
23
+ if (t === 36) return "Northwest";
24
+ if (t === 37) return "West";
25
+ if (t === 38) return "North";
26
+ if (t === 39) return "East";
27
+ if (t === 40) return "South";
28
+ if (t === 45) return "Insert";
29
+ if (t === 46) return "Delete";
30
+ if (t >= 48 && t <= 57 || t >= 65 && t <= 90)
31
+ return String.fromCharCode(t);
32
+ if (t >= 96 && t <= 105)
33
+ return "Numpad" + (t - 96);
34
+ if (t >= 112 && t <= 123)
35
+ return "F" + (t - 111);
36
+ if (t === 188) return ",";
37
+ if (t === 189) return "-";
38
+ if (t === 190) return ".";
39
+ }
40
+ function F(t) {
41
+ const n = String(t);
42
+ if (n === "Ctrl+F5" || n === "Ctrl+R") {
43
+ location.reload();
44
+ return;
45
+ }
46
+ if (n === "Ctrl+F" || t.event.defaultPrevented || t.isModifierKey() || c.includes(t.code))
47
+ return;
48
+ const e = w(t.code);
49
+ if (!e)
50
+ return;
51
+ const f = m[e];
52
+ if (f)
53
+ return Byond.command(f);
54
+ if (t.isDown() && !o[e]) {
55
+ o[e] = !0;
56
+ const r = `KeyDown "${e}"`;
57
+ return Byond.command(r);
58
+ }
59
+ if (t.isUp() && o[e]) {
60
+ o[e] = !1;
61
+ const r = `KeyUp "${e}"`;
62
+ return Byond.command(r);
63
+ }
64
+ }
65
+ function O(t) {
66
+ c.push(t);
67
+ }
68
+ function P(t) {
69
+ const n = c.indexOf(t);
70
+ n >= 0 && c.splice(n, 1);
71
+ }
72
+ function N() {
73
+ for (const t of Object.keys(o))
74
+ o[t] && (o[t] = !1, Byond.command(`KeyUp "${t}"`));
75
+ }
76
+ function R() {
77
+ Byond.winget("default.*").then((t) => {
78
+ const n = {};
79
+ for (const r of Object.keys(t)) {
80
+ const s = r.split("."), i = s[1], a = s[2];
81
+ i && a && (n[i] || (n[i] = {}), n[i][a] = t[r]);
82
+ }
83
+ const e = /\\"/g;
84
+ function f(r) {
85
+ return r.substring(1, r.length - 1).replace(e, '"');
86
+ }
87
+ for (const r of Object.keys(n)) {
88
+ const s = n[r], i = f(s.name);
89
+ m[i] = f(s.command);
90
+ }
91
+ }), l.on("window-blur", () => {
92
+ N();
93
+ }), l.on("key", (t) => {
94
+ for (const n of u)
95
+ n(t);
96
+ F(t);
97
+ });
98
+ }
99
+ function v(t) {
100
+ u.push(t);
101
+ let n = !1;
102
+ return () => {
103
+ n || (n = !0, u.splice(u.indexOf(t), 1));
104
+ };
105
+ }
106
+ export {
107
+ O as acquireHotKey,
108
+ v as listenForKeyEvents,
109
+ N as releaseHeldKeys,
110
+ P as releaseHotKey,
111
+ R as setupHotKeys
112
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * An equivalent to `fetch`, except will automatically retry.
3
+ */
4
+ export declare function fetchRetry(url: string, options?: RequestInit, retryTimer?: number): Promise<Response>;
@@ -0,0 +1,10 @@
1
+ function h(e, t, c = 1e3) {
2
+ return fetch(e, t).catch(() => new Promise((n) => {
3
+ setTimeout(() => {
4
+ h(e, t, c).then(n);
5
+ }, c);
6
+ }));
7
+ }
8
+ export {
9
+ h as fetchRetry
10
+ };
@@ -0,0 +1,85 @@
1
+ /**
2
+ * All possible browser keycodes, in one file.
3
+ *
4
+ * @file
5
+ * @copyright 2020 Aleksej Komarov
6
+ * @license MIT
7
+ */
8
+ export declare const KEY_BACKSPACE = 8;
9
+ export declare const KEY_TAB = 9;
10
+ export declare const KEY_ENTER = 13;
11
+ export declare const KEY_SHIFT = 16;
12
+ export declare const KEY_CTRL = 17;
13
+ export declare const KEY_ALT = 18;
14
+ export declare const KEY_PAUSE = 19;
15
+ export declare const KEY_CAPSLOCK = 20;
16
+ export declare const KEY_ESCAPE = 27;
17
+ export declare const KEY_SPACE = 32;
18
+ export declare const KEY_PAGEUP = 33;
19
+ export declare const KEY_PAGEDOWN = 34;
20
+ export declare const KEY_END = 35;
21
+ export declare const KEY_HOME = 36;
22
+ export declare const KEY_LEFT = 37;
23
+ export declare const KEY_UP = 38;
24
+ export declare const KEY_RIGHT = 39;
25
+ export declare const KEY_DOWN = 40;
26
+ export declare const KEY_INSERT = 45;
27
+ export declare const KEY_DELETE = 46;
28
+ export declare const KEY_0 = 48;
29
+ export declare const KEY_1 = 49;
30
+ export declare const KEY_2 = 50;
31
+ export declare const KEY_3 = 51;
32
+ export declare const KEY_4 = 52;
33
+ export declare const KEY_5 = 53;
34
+ export declare const KEY_6 = 54;
35
+ export declare const KEY_7 = 55;
36
+ export declare const KEY_8 = 56;
37
+ export declare const KEY_9 = 57;
38
+ export declare const KEY_A = 65;
39
+ export declare const KEY_B = 66;
40
+ export declare const KEY_C = 67;
41
+ export declare const KEY_D = 68;
42
+ export declare const KEY_E = 69;
43
+ export declare const KEY_F = 70;
44
+ export declare const KEY_G = 71;
45
+ export declare const KEY_H = 72;
46
+ export declare const KEY_I = 73;
47
+ export declare const KEY_J = 74;
48
+ export declare const KEY_K = 75;
49
+ export declare const KEY_L = 76;
50
+ export declare const KEY_M = 77;
51
+ export declare const KEY_N = 78;
52
+ export declare const KEY_O = 79;
53
+ export declare const KEY_P = 80;
54
+ export declare const KEY_Q = 81;
55
+ export declare const KEY_R = 82;
56
+ export declare const KEY_S = 83;
57
+ export declare const KEY_T = 84;
58
+ export declare const KEY_U = 85;
59
+ export declare const KEY_V = 86;
60
+ export declare const KEY_W = 87;
61
+ export declare const KEY_X = 88;
62
+ export declare const KEY_Y = 89;
63
+ export declare const KEY_Z = 90;
64
+ export declare const KEY_F1 = 112;
65
+ export declare const KEY_F2 = 113;
66
+ export declare const KEY_F3 = 114;
67
+ export declare const KEY_F4 = 115;
68
+ export declare const KEY_F5 = 116;
69
+ export declare const KEY_F6 = 117;
70
+ export declare const KEY_F7 = 118;
71
+ export declare const KEY_F8 = 119;
72
+ export declare const KEY_F9 = 120;
73
+ export declare const KEY_F10 = 121;
74
+ export declare const KEY_F11 = 122;
75
+ export declare const KEY_F12 = 123;
76
+ export declare const KEY_SEMICOLON = 186;
77
+ export declare const KEY_EQUAL = 187;
78
+ export declare const KEY_COMMA = 188;
79
+ export declare const KEY_MINUS = 189;
80
+ export declare const KEY_PERIOD = 190;
81
+ export declare const KEY_SLASH = 191;
82
+ export declare const KEY_LEFT_BRACKET = 219;
83
+ export declare const KEY_BACKSLASH = 220;
84
+ export declare const KEY_RIGHT_BRACKET = 221;
85
+ export declare const KEY_QUOTE = 222;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * All possible browser keycodes, in one file.
3
+ *
4
+ * @file
5
+ * @copyright 2020 Aleksej Komarov
6
+ * @license MIT
7
+ */
8
+ const E = 8, K = 9, _ = 13, o = 16, t = 17, Y = 18, c = 19, n = 20, s = 27, A = 32, F = 33, T = 34, S = 35, C = 36, L = 37, P = 38, O = 39, R = 40, I = 45, N = 46, H = 48, U = 49, B = 50, D = 51, M = 52, G = 53, Q = 54, W = 55, e = 56, p = 57, r = 65, x = 66, J = 67, V = 68, X = 69, Z = 70, a = 71, b = 72, d = 73, f = 74, g = 75, h = 76, i = 77, j = 78, k = 79, l = 80, m = 81, q = 82, u = 83, v = 84, w = 85, y = 86, z = 87, $ = 88, EE = 89, KE = 90, _E = 112, oE = 113, tE = 114, YE = 115, cE = 116, nE = 117, sE = 118, AE = 119, FE = 120, TE = 121, SE = 122, CE = 123, LE = 186, PE = 187, OE = 188, RE = 189, IE = 190, NE = 191, HE = 219, UE = 220, BE = 221, DE = 222;
9
+ export {
10
+ H as KEY_0,
11
+ U as KEY_1,
12
+ B as KEY_2,
13
+ D as KEY_3,
14
+ M as KEY_4,
15
+ G as KEY_5,
16
+ Q as KEY_6,
17
+ W as KEY_7,
18
+ e as KEY_8,
19
+ p as KEY_9,
20
+ r as KEY_A,
21
+ Y as KEY_ALT,
22
+ x as KEY_B,
23
+ UE as KEY_BACKSLASH,
24
+ E as KEY_BACKSPACE,
25
+ J as KEY_C,
26
+ n as KEY_CAPSLOCK,
27
+ OE as KEY_COMMA,
28
+ t as KEY_CTRL,
29
+ V as KEY_D,
30
+ N as KEY_DELETE,
31
+ R as KEY_DOWN,
32
+ X as KEY_E,
33
+ S as KEY_END,
34
+ _ as KEY_ENTER,
35
+ PE as KEY_EQUAL,
36
+ s as KEY_ESCAPE,
37
+ Z as KEY_F,
38
+ _E as KEY_F1,
39
+ TE as KEY_F10,
40
+ SE as KEY_F11,
41
+ CE as KEY_F12,
42
+ oE as KEY_F2,
43
+ tE as KEY_F3,
44
+ YE as KEY_F4,
45
+ cE as KEY_F5,
46
+ nE as KEY_F6,
47
+ sE as KEY_F7,
48
+ AE as KEY_F8,
49
+ FE as KEY_F9,
50
+ a as KEY_G,
51
+ b as KEY_H,
52
+ C as KEY_HOME,
53
+ d as KEY_I,
54
+ I as KEY_INSERT,
55
+ f as KEY_J,
56
+ g as KEY_K,
57
+ h as KEY_L,
58
+ L as KEY_LEFT,
59
+ HE as KEY_LEFT_BRACKET,
60
+ i as KEY_M,
61
+ RE as KEY_MINUS,
62
+ j as KEY_N,
63
+ k as KEY_O,
64
+ l as KEY_P,
65
+ T as KEY_PAGEDOWN,
66
+ F as KEY_PAGEUP,
67
+ c as KEY_PAUSE,
68
+ IE as KEY_PERIOD,
69
+ m as KEY_Q,
70
+ DE as KEY_QUOTE,
71
+ q as KEY_R,
72
+ O as KEY_RIGHT,
73
+ BE as KEY_RIGHT_BRACKET,
74
+ u as KEY_S,
75
+ LE as KEY_SEMICOLON,
76
+ o as KEY_SHIFT,
77
+ NE as KEY_SLASH,
78
+ A as KEY_SPACE,
79
+ v as KEY_T,
80
+ K as KEY_TAB,
81
+ w as KEY_U,
82
+ P as KEY_UP,
83
+ y as KEY_V,
84
+ z as KEY_W,
85
+ $ as KEY_X,
86
+ EE as KEY_Y,
87
+ KE as KEY_Z
88
+ };
@@ -20,28 +20,27 @@
20
20
  *
21
21
  *
22
22
  */
23
- export enum KEY {
24
- Alt = 'Alt',
25
- Backspace = 'Backspace',
26
- Control = 'Control',
27
- Delete = 'Delete',
28
- Down = 'ArrowDown',
29
- End = 'End',
30
- Enter = 'Enter',
31
- Esc = 'Esc',
32
- Escape = 'Escape',
33
- Home = 'Home',
34
- Insert = 'Insert',
35
- Left = 'ArrowLeft',
36
- PageDown = 'PageDown',
37
- PageUp = 'PageUp',
38
- Right = 'ArrowRight',
39
- Shift = 'Shift',
40
- Space = ' ',
41
- Tab = 'Tab',
42
- Up = 'ArrowUp',
23
+ export declare enum KEY {
24
+ Alt = "Alt",
25
+ Backspace = "Backspace",
26
+ Control = "Control",
27
+ Delete = "Delete",
28
+ Down = "ArrowDown",
29
+ End = "End",
30
+ Enter = "Enter",
31
+ Esc = "Esc",
32
+ Escape = "Escape",
33
+ Home = "Home",
34
+ Insert = "Insert",
35
+ Left = "ArrowLeft",
36
+ PageDown = "PageDown",
37
+ PageUp = "PageUp",
38
+ Right = "ArrowRight",
39
+ Shift = "Shift",
40
+ Space = " ",
41
+ Tab = "Tab",
42
+ Up = "ArrowUp"
43
43
  }
44
-
45
44
  /**
46
45
  * ### isEscape
47
46
  *
@@ -53,6 +52,4 @@ export enum KEY {
53
52
  * @param key - the key to check, typically from event.key
54
53
  * @returns true if key is Escape or Esc, false otherwise
55
54
  */
56
- export function isEscape(key: string): boolean {
57
- return key === KEY.Esc || key === KEY.Escape;
58
- }
55
+ export declare function isEscape(key: string): boolean;
@@ -0,0 +1,8 @@
1
+ var r = /* @__PURE__ */ ((e) => (e.Alt = "Alt", e.Backspace = "Backspace", e.Control = "Control", e.Delete = "Delete", e.Down = "ArrowDown", e.End = "End", e.Enter = "Enter", e.Esc = "Esc", e.Escape = "Escape", e.Home = "Home", e.Insert = "Insert", e.Left = "ArrowLeft", e.PageDown = "PageDown", e.PageUp = "PageUp", e.Right = "ArrowRight", e.Shift = "Shift", e.Space = " ", e.Tab = "Tab", e.Up = "ArrowUp", e))(r || {});
2
+ function t(e) {
3
+ return e === "Esc" || e === "Escape";
4
+ }
5
+ export {
6
+ r as KEY,
7
+ t as isEscape
8
+ };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Limits a number to the range between 'min' and 'max'.
3
+ */
4
+ export declare function clamp(value: any, min: any, max: any): any;
5
+ /**
6
+ * Limits a number between 0 and 1.
7
+ */
8
+ export declare function clamp01(value: any): any;
9
+ /**
10
+ * Scales a number to fit into the range between min and max.
11
+ */
12
+ export declare function scale(value: any, min: any, max: any): number;
13
+ /**
14
+ * Robust number rounding, similar to PHP's round() function.
15
+ *
16
+ * @url https://stackoverflow.com/questions/53450248/how-to-round-in-javascript-like-php-do/54721202#54721202
17
+ */
18
+ export declare function round(num: any, dec: any): number;
19
+ /**
20
+ * Returns a string representing a number in fixed point notation.
21
+ */
22
+ export declare function toFixed(value: any, fractionDigits?: number): string;
23
+ /**
24
+ * Checks whether a value is within the provided range.
25
+ *
26
+ * Range is an array of two numbers, for example: [0, 15].
27
+ */
28
+ export declare function inRange(value: any, range: any): any;
29
+ /**
30
+ * Walks over the object with ranges, comparing value against every range,
31
+ * and returns the key of the first matching range.
32
+ *
33
+ * Range is an array of two numbers, for example: [0, 15].
34
+ */
35
+ export declare function keyOfMatchingRange(value: any, ranges: any): string | undefined;
36
+ /**
37
+ * Get number of digits following the decimal point in a number
38
+ */
39
+ export declare function numberOfDecimalDigits(value: any): any;
@@ -0,0 +1,41 @@
1
+ function e(t, n, r) {
2
+ return t < n ? n : t > r ? r : t;
3
+ }
4
+ function c(t) {
5
+ return t < 0 ? 0 : t > 1 ? 1 : t;
6
+ }
7
+ function f(t, n, r) {
8
+ return (t - n) / (r - n);
9
+ }
10
+ function u(t, n) {
11
+ const r = t >= 0 ? 1 : -1;
12
+ return parseFloat(
13
+ (Math.round(t * Math.pow(10, n) + r * 1e-4) / Math.pow(10, n)).toFixed(n)
14
+ );
15
+ }
16
+ function s(t, n = 0) {
17
+ return Number(t).toFixed(Math.max(n, 0));
18
+ }
19
+ function i(t, n) {
20
+ return n && t >= n[0] && t <= n[1];
21
+ }
22
+ function a(t, n) {
23
+ for (const r of Object.keys(n)) {
24
+ const o = n[r];
25
+ if (i(t, o))
26
+ return r;
27
+ }
28
+ }
29
+ function h(t) {
30
+ return Math.floor(t) !== t && t.toString().split(".")[1].length || 0;
31
+ }
32
+ export {
33
+ e as clamp,
34
+ c as clamp01,
35
+ i as inRange,
36
+ a as keyOfMatchingRange,
37
+ h as numberOfDecimalDigits,
38
+ u as round,
39
+ f as scale,
40
+ s as toFixed
41
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Ghetto performance measurement tools.
3
+ *
4
+ * Uses NODE_ENV to remove itself from production builds.
5
+ *
6
+ * @file
7
+ * @copyright 2020 Aleksej Komarov
8
+ * @license MIT
9
+ */
10
+ /**
11
+ * Marks a certain spot in the code for later measurements.
12
+ */
13
+ declare function mark(name: string, timestamp?: number): void;
14
+ /**
15
+ * Calculates and returns the difference between two markers as a string.
16
+ *
17
+ * Use logger.log() to print the measurement.
18
+ */
19
+ declare function measure(markerNameA: string, markerNameB: string): string | undefined;
20
+ export declare const perf: {
21
+ mark: typeof mark;
22
+ measure: typeof measure;
23
+ };
24
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Ghetto performance measurement tools.
3
+ *
4
+ * Uses NODE_ENV to remove itself from production builds.
5
+ *
6
+ * @file
7
+ * @copyright 2020 Aleksej Komarov
8
+ * @license MIT
9
+ */
10
+ const i = 16.666666666666668;
11
+ var c;
12
+ const a = !!((c = window.performance) != null && c.now), t = {}, s = {};
13
+ function p(o, n) {
14
+ process.env.NODE_ENV !== "production" && (a && !n && (t[o] = performance.now()), s[o] = n || Date.now());
15
+ }
16
+ function u(o, n) {
17
+ if (process.env.NODE_ENV === "production") return;
18
+ let r = t[o], e = t[n];
19
+ (!r || !e) && (r = s[o], e = s[n]);
20
+ const f = Math.abs(e - r);
21
+ return F(f);
22
+ }
23
+ function F(o) {
24
+ const n = o / i;
25
+ return o.toFixed(o < 10 ? 1 : 0) + "ms (" + n.toFixed(2) + " frames)";
26
+ }
27
+ const d = {
28
+ mark: p,
29
+ measure: u
30
+ };
31
+ export {
32
+ d as perf
33
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Returns random number between lowerBound exclusive and upperBound inclusive
3
+ */
4
+ export declare function randomNumber(lowerBound: number, upperBound: number): number;
5
+ /**
6
+ * Returns random integer between lowerBound exclusive and upperBound inclusive
7
+ */
8
+ export declare function randomInteger(lowerBound: number, upperBound: number): number;
9
+ /**
10
+ * Returns random array element
11
+ */
12
+ export declare const randomPick: <T>(array: T[]) => T;
13
+ /**
14
+ * Return 1 with probability P percent; otherwise 0
15
+ */
16
+ export declare function randomProb(probability: number): boolean;
@@ -0,0 +1,18 @@
1
+ import { clamp as n } from "./math.js";
2
+ function o(t, r) {
3
+ return Math.random() * (r - t) + t;
4
+ }
5
+ function m(t, r) {
6
+ return t = Math.ceil(t), r = Math.floor(r), Math.floor(Math.random() * (r - t) + t);
7
+ }
8
+ const h = (t) => t[Math.floor(Math.random() * t.length)];
9
+ function c(t) {
10
+ const r = n(t, 0, 100) / 100;
11
+ return Math.random() <= r;
12
+ }
13
+ export {
14
+ m as randomInteger,
15
+ o as randomNumber,
16
+ h as randomPick,
17
+ c as randomProb
18
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Helper for conditionally adding/removing classes in React
3
+ */
4
+ export declare function classes(classNames: (string | BooleanLike)[]): string;
5
+ /**
6
+ * Normalizes children prop, so that it is always an array of VDom
7
+ * elements.
8
+ */
9
+ export declare function normalizeChildren<T>(children: T | T[]): T[];
10
+ /**
11
+ * Shallowly checks if two objects are different.
12
+ * Credit: https://github.com/developit/preact-compat
13
+ */
14
+ export declare function shallowDiffers(a: object, b: object): boolean;
15
+ /**
16
+ * A common case in tgui, when you pass a value conditionally, these are
17
+ * the types that can fall through the condition.
18
+ */
19
+ export type BooleanLike = number | boolean | null | undefined;
20
+ /**
21
+ * A helper to determine whether the object is renderable by React.
22
+ */
23
+ export declare function canRender(value: unknown): boolean;
@@ -0,0 +1,30 @@
1
+ function f(r) {
2
+ let n = "";
3
+ for (let t = 0; t < r.length; t++) {
4
+ const e = r[t];
5
+ typeof e == "string" && (n += e + " ");
6
+ }
7
+ return n;
8
+ }
9
+ function i(r) {
10
+ return Array.isArray(r) ? r.flat().filter((n) => n) : typeof r == "object" ? [r] : [];
11
+ }
12
+ function o(r, n) {
13
+ let t;
14
+ for (t in r)
15
+ if (!(t in n))
16
+ return !0;
17
+ for (t in n)
18
+ if (r[t] !== n[t])
19
+ return !0;
20
+ return !1;
21
+ }
22
+ function u(r) {
23
+ return r != null && typeof r != "boolean";
24
+ }
25
+ export {
26
+ u as canRender,
27
+ f as classes,
28
+ i as normalizeChildren,
29
+ o as shallowDiffers
30
+ };
@@ -0,0 +1,64 @@
1
+ export type Reducer<State = any, ActionType extends Action = AnyAction> = (state: State | undefined, action: ActionType) => State;
2
+ export type Store<State = any, ActionType extends Action = AnyAction> = {
3
+ dispatch: Dispatch<ActionType>;
4
+ getState: () => State;
5
+ subscribe: (listener: () => void) => void;
6
+ };
7
+ type MiddlewareAPI<State = any, ActionType extends Action = AnyAction> = {
8
+ dispatch: Dispatch<ActionType>;
9
+ getState: () => State;
10
+ };
11
+ export type Middleware = <State = any, ActionType extends Action = AnyAction>(storeApi: MiddlewareAPI<State, ActionType>) => (next: Dispatch<ActionType>) => Dispatch<ActionType>;
12
+ export type Action<TType = any> = {
13
+ type: TType;
14
+ };
15
+ export type AnyAction = Action & {
16
+ [extraProps: string]: any;
17
+ };
18
+ export type Dispatch<ActionType extends Action = AnyAction> = (action: ActionType) => void;
19
+ type StoreEnhancer = (createStoreFunction: Function) => Function;
20
+ type PreparedAction = {
21
+ meta?: any;
22
+ payload?: any;
23
+ };
24
+ /**
25
+ * Creates a Redux store.
26
+ */
27
+ export declare function createStore<State, ActionType extends Action = AnyAction>(reducer: Reducer<State, ActionType>, enhancer?: StoreEnhancer): Store<State, ActionType>;
28
+ /**
29
+ * Creates a store enhancer which applies middleware to all dispatched
30
+ * actions.
31
+ */
32
+ export declare function applyMiddleware(...middlewares: Middleware[]): StoreEnhancer;
33
+ /**
34
+ * Combines reducers by running them in their own object namespaces as
35
+ * defined in reducersObj paramter.
36
+ *
37
+ * Main difference from redux/combineReducers is that it preserves keys
38
+ * in the state that are not present in the reducers object. This function
39
+ * is also more flexible than the redux counterpart.
40
+ */
41
+ export declare function combineReducers(reducersObj: Record<string, Reducer>): Reducer;
42
+ /**
43
+ * A utility function to create an action creator for the given action
44
+ * type string. The action creator accepts a single argument, which will
45
+ * be included in the action object as a field called payload. The action
46
+ * creator function will also have its toString() overriden so that it
47
+ * returns the action type, allowing it to be used in reducer logic that
48
+ * is looking for that action type.
49
+ *
50
+ * @param {string} type The action type to use for created actions.
51
+ * @param {any} prepare (optional) a method that takes any number of arguments
52
+ * and returns { payload } or { payload, meta }. If this is given, the
53
+ * resulting action creator will pass it's arguments to this method to
54
+ * calculate payload & meta.
55
+ *
56
+ * @public
57
+ */
58
+ export declare function createAction<TAction extends string>(type: TAction, prepare?: (...args: any[]) => PreparedAction): {
59
+ (...args: any[]): Action<TAction> & PreparedAction;
60
+ toString(): TAction;
61
+ type: TAction;
62
+ match(action: any): boolean;
63
+ };
64
+ export {};