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,72 @@
1
+ function f(n, i) {
2
+ if (i)
3
+ return i(f)(n);
4
+ let t;
5
+ const r = [], e = () => t;
6
+ function c(s) {
7
+ r.push(s);
8
+ }
9
+ function a(s) {
10
+ t = n(t, s);
11
+ for (let o = 0; o < r.length; o++)
12
+ r[o]();
13
+ }
14
+ return a({ type: "@@INIT" }), {
15
+ dispatch: a,
16
+ subscribe: c,
17
+ getState: e
18
+ };
19
+ }
20
+ function l(...n) {
21
+ return (i) => (t, ...r) => {
22
+ const e = i(t, ...r);
23
+ let c = () => {
24
+ throw new Error(
25
+ "Dispatching while constructing your middleware is not allowed."
26
+ );
27
+ };
28
+ const a = {
29
+ getState: e.getState,
30
+ dispatch: (o, ...u) => c(o, ...u)
31
+ };
32
+ return c = n.map((o) => o(a)).reduceRight(
33
+ (o, u) => u(o),
34
+ e.dispatch
35
+ ), {
36
+ ...e,
37
+ dispatch: c
38
+ };
39
+ };
40
+ }
41
+ function d(n) {
42
+ const i = Object.keys(n);
43
+ return (t = {}, r) => {
44
+ const e = { ...t };
45
+ let c = !1;
46
+ for (const a of i) {
47
+ const s = n[a], o = t[a], u = s(o, r);
48
+ o !== u && (c = !0, e[a] = u);
49
+ }
50
+ return c ? e : t;
51
+ };
52
+ }
53
+ function h(n, i) {
54
+ function t(...r) {
55
+ let e = { type: n };
56
+ if (i) {
57
+ const c = i(...r);
58
+ if (!c)
59
+ throw new Error("prepare function did not return an object");
60
+ e = { ...e, ...c };
61
+ } else
62
+ e.payload = r[0];
63
+ return e;
64
+ }
65
+ return t.toString = () => n, t.type = n, t.match = (r) => r.type === n, t;
66
+ }
67
+ export {
68
+ l as applyMiddleware,
69
+ d as combineReducers,
70
+ h as createAction,
71
+ f as createStore
72
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Browser-agnostic abstraction of key-value web storage.
3
+ *
4
+ * @file
5
+ * @copyright 2020 Aleksej Komarov
6
+ * @license MIT
7
+ */
8
+ export declare const IMPL_MEMORY = 0;
9
+ export declare const IMPL_LOCAL_STORAGE = 1;
10
+ export declare const IMPL_INDEXED_DB = 2;
11
+ /**
12
+ * Web Storage Proxy object, which selects the best backend available
13
+ * depending on the environment.
14
+ */
15
+ declare class StorageProxy {
16
+ backendPromise: Promise<any>;
17
+ constructor();
18
+ get(key: any): Promise<any>;
19
+ set(key: any, value: any): Promise<any>;
20
+ remove(key: any): Promise<any>;
21
+ clear(): Promise<any>;
22
+ }
23
+ export declare const storage: StorageProxy;
24
+ export {};
@@ -0,0 +1,133 @@
1
+ var l = Object.defineProperty;
2
+ var D = (r, e, t) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var s = (r, e, t) => D(r, typeof e != "symbol" ? e + "" : e, t);
4
+ /**
5
+ * Browser-agnostic abstraction of key-value web storage.
6
+ *
7
+ * @file
8
+ * @copyright 2020 Aleksej Komarov
9
+ * @license MIT
10
+ */
11
+ const h = 0, P = 1, B = 2;
12
+ const w = "tgui", a = "storage-v1", m = "readonly", i = "readwrite", d = (r) => () => {
13
+ try {
14
+ return !!r();
15
+ } catch {
16
+ return !1;
17
+ }
18
+ }, I = d(
19
+ () => window.localStorage && window.localStorage.getItem
20
+ ), E = d(
21
+ () => (window.indexedDB || window.msIndexedDB) && (window.IDBTransaction || window.msIDBTransaction)
22
+ );
23
+ class g {
24
+ constructor() {
25
+ s(this, "impl", 0);
26
+ s(this, "store", {});
27
+ this.impl = 0, this.store = {};
28
+ }
29
+ get(e) {
30
+ return this.store[e];
31
+ }
32
+ set(e, t) {
33
+ this.store[e] = t;
34
+ }
35
+ remove(e) {
36
+ this.store[e] = void 0;
37
+ }
38
+ clear() {
39
+ this.store = {};
40
+ }
41
+ }
42
+ class u {
43
+ constructor() {
44
+ s(this, "impl", 1);
45
+ this.impl = 1;
46
+ }
47
+ get(e) {
48
+ const t = localStorage.getItem(e);
49
+ if (typeof t == "string")
50
+ return JSON.parse(t);
51
+ }
52
+ set(e, t) {
53
+ localStorage.setItem(e, JSON.stringify(t));
54
+ }
55
+ remove(e) {
56
+ localStorage.removeItem(e);
57
+ }
58
+ clear() {
59
+ localStorage.clear();
60
+ }
61
+ }
62
+ class _ {
63
+ constructor() {
64
+ s(this, "impl", 2);
65
+ s(this, "dbPromise");
66
+ this.impl = 2, this.dbPromise = new Promise((e, t) => {
67
+ const o = (window.indexedDB || window.msIndexedDB).open(w, 1);
68
+ o.onupgradeneeded = () => {
69
+ try {
70
+ o.result.createObjectStore(a);
71
+ } catch {
72
+ t(new Error("Failed to upgrade IDB: " + o.error));
73
+ }
74
+ }, o.onsuccess = () => e(o.result), o.onerror = () => {
75
+ t(new Error("Failed to open IDB: " + o.error));
76
+ };
77
+ });
78
+ }
79
+ getStore(e) {
80
+ return this.dbPromise.then(
81
+ (t) => t.transaction(a, e).objectStore(a)
82
+ );
83
+ }
84
+ async get(e) {
85
+ const t = await this.getStore(m);
86
+ return new Promise((c, o) => {
87
+ const n = t.get(e);
88
+ n.onsuccess = () => c(n.result), n.onerror = () => o(n.error);
89
+ });
90
+ }
91
+ async set(e, t) {
92
+ t === null && (t = void 0), (await this.getStore(i)).put(t, e);
93
+ }
94
+ async remove(e) {
95
+ (await this.getStore(i)).delete(e);
96
+ }
97
+ async clear() {
98
+ (await this.getStore(i)).clear();
99
+ }
100
+ }
101
+ class S {
102
+ constructor() {
103
+ s(this, "backendPromise");
104
+ this.backendPromise = (async () => {
105
+ if (E())
106
+ try {
107
+ const e = new _();
108
+ return await e.dbPromise, e;
109
+ } catch {
110
+ }
111
+ return I() ? new u() : new g();
112
+ })();
113
+ }
114
+ async get(e) {
115
+ return (await this.backendPromise).get(e);
116
+ }
117
+ async set(e, t) {
118
+ return (await this.backendPromise).set(e, t);
119
+ }
120
+ async remove(e) {
121
+ return (await this.backendPromise).remove(e);
122
+ }
123
+ async clear() {
124
+ return (await this.backendPromise).clear();
125
+ }
126
+ }
127
+ const k = new S();
128
+ export {
129
+ B as IMPL_INDEXED_DB,
130
+ P as IMPL_LOCAL_STORAGE,
131
+ h as IMPL_MEMORY,
132
+ k as storage
133
+ };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Creates a search terms matcher. Returns true if given string matches the search text.
3
+ *
4
+ * @example
5
+ * ```tsx
6
+ * type Thing = { id: string; name: string };
7
+ *
8
+ * const objects = [
9
+ * { id: '123', name: 'Test' },
10
+ * { id: '456', name: 'Test' },
11
+ * ];
12
+ *
13
+ * const search = createSearch('123', (obj: Thing) => obj.id);
14
+ *
15
+ * objects.filter(search); // returns [{ id: '123', name: 'Test' }]
16
+ * ```
17
+ */
18
+ export declare function createSearch<TObj>(searchText: string, stringifier?: (obj: TObj) => string): (obj: TObj) => boolean;
19
+ /**
20
+ * Capitalizes a word and lowercases the rest.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * capitalize('heLLo') // Hello
25
+ * ```
26
+ */
27
+ export declare function capitalize(str: string): string;
28
+ /**
29
+ * Similar to capitalize, this takes a string and replaces all first letters
30
+ * of any words.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * capitalizeAll('heLLo woRLd') // 'HeLLo WoRLd'
35
+ * ```
36
+ */
37
+ export declare function capitalizeAll(str: string): string;
38
+ /**
39
+ * Capitalizes only the first letter of the str, leaving others untouched.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * capitalizeFirst('heLLo woRLd') // 'HeLLo woRLd'
44
+ * ```
45
+ */
46
+ export declare function capitalizeFirst(str: string): string;
47
+ /**
48
+ * Converts a string to title case.
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * toTitleCase('a tale of two cities') // 'A Tale of Two Cities'
53
+ * ```
54
+ */
55
+ export declare function toTitleCase(str: string): string;
56
+ /**
57
+ * Decodes HTML entities and removes unnecessary HTML tags.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * decodeHtmlEntities('&amp;') // returns '&'
62
+ * decodeHtmlEntities('&lt;') // returns '<'
63
+ * ```
64
+ */
65
+ export declare function decodeHtmlEntities(str: string): string;
@@ -0,0 +1,83 @@
1
+ function p(e, t = (r) => JSON.stringify(r)) {
2
+ const r = e.toLowerCase().trim();
3
+ return (n) => {
4
+ if (!r)
5
+ return !0;
6
+ const o = t(n);
7
+ return o ? o.toLowerCase().includes(r) : !1;
8
+ };
9
+ }
10
+ function a(e) {
11
+ return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
12
+ }
13
+ function u(e) {
14
+ return e.replace(/(^\w{1})|(\s+\w{1})/g, (t) => t.toUpperCase());
15
+ }
16
+ function l(e) {
17
+ return e.replace(/^\w/, (t) => t.toUpperCase());
18
+ }
19
+ const c = ["Id", "Tv"], s = [
20
+ "A",
21
+ "An",
22
+ "And",
23
+ "As",
24
+ "At",
25
+ "But",
26
+ "By",
27
+ "For",
28
+ "For",
29
+ "From",
30
+ "In",
31
+ "Into",
32
+ "Near",
33
+ "Nor",
34
+ "Of",
35
+ "On",
36
+ "Onto",
37
+ "Or",
38
+ "The",
39
+ "To",
40
+ "With"
41
+ ];
42
+ function f(e) {
43
+ if (!e) return e;
44
+ let t = e.replace(/([^\W_]+[^\s-]*) */g, (r) => a(r));
45
+ for (const r of s) {
46
+ const n = new RegExp("\\s" + r + "\\s", "g");
47
+ t = t.replace(n, (o) => o.toLowerCase());
48
+ }
49
+ for (const r of c) {
50
+ const n = new RegExp("\\b" + r + "\\b", "g");
51
+ t = t.replace(n, (o) => o.toLowerCase());
52
+ }
53
+ return t;
54
+ }
55
+ const i = {
56
+ amp: "&",
57
+ apos: "'",
58
+ gt: ">",
59
+ lt: "<",
60
+ nbsp: " ",
61
+ quot: '"'
62
+ };
63
+ function g(e) {
64
+ return e && e.replace(/<br>/gi, `
65
+ `).replace(/<\/?[a-z0-9-_]+[^>]*>/gi, "").replace(
66
+ /&(nbsp|amp|quot|lt|gt|apos);/g,
67
+ (t, r) => i[r]
68
+ ).replace(/&#?([0-9]+);/gi, (t, r) => {
69
+ const n = parseInt(r, 10);
70
+ return String.fromCharCode(n);
71
+ }).replace(/&#x?([0-9a-f]+);/gi, (t, r) => {
72
+ const n = parseInt(r, 16);
73
+ return String.fromCharCode(n);
74
+ });
75
+ }
76
+ export {
77
+ a as capitalize,
78
+ u as capitalizeAll,
79
+ l as capitalizeFirst,
80
+ p as createSearch,
81
+ g as decodeHtmlEntities,
82
+ f as toTitleCase
83
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Returns a function, that, as long as it continues to be invoked, will
3
+ * not be triggered. The function will be called after it stops being
4
+ * called for N milliseconds. If `immediate` is passed, trigger the
5
+ * function on the leading edge, instead of the trailing.
6
+ */
7
+ export declare function debounce<F extends (...args: any[]) => any>(fn: F, time: number, immediate?: boolean): (...args: Parameters<F>) => void;
8
+ /**
9
+ * Returns a function, that, when invoked, will only be triggered at most once
10
+ * during a given window of time.
11
+ */
12
+ export declare function throttle<F extends (...args: any[]) => any>(fn: F, time: number): (...args: Parameters<F>) => void;
13
+ /**
14
+ * Suspends an asynchronous function for N milliseconds.
15
+ *
16
+ * @param {number} time
17
+ */
18
+ export declare function sleep(time: number): Promise<void>;
@@ -0,0 +1,28 @@
1
+ function c(n, o, t = !1) {
2
+ let e;
3
+ return (...i) => {
4
+ function l() {
5
+ e = null, t || n(...i);
6
+ }
7
+ const u = t && !e;
8
+ clearTimeout(e), e = setTimeout(l, o), u && n(...i);
9
+ };
10
+ }
11
+ function r(n, o) {
12
+ let t, e;
13
+ return function i(...l) {
14
+ const u = Date.now();
15
+ e && clearTimeout(e), !t || u - t >= o ? (n(...l), t = u) : e = setTimeout(
16
+ () => i(...l),
17
+ o - (u - (t ?? 0))
18
+ );
19
+ };
20
+ }
21
+ function f(n) {
22
+ return new Promise((o) => setTimeout(o, n));
23
+ }
24
+ export {
25
+ c as debounce,
26
+ f as sleep,
27
+ r as throttle
28
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Helps visualize highly complex ui data on the fly.
3
+ * @example
4
+ * ```tsx
5
+ * const { data } = useBackend<CargoData>();
6
+ * logger.log(getShallowTypes(data));
7
+ * ```
8
+ */
9
+ export declare function getShallowTypes(data: Record<string, any>): Record<string, any>;
@@ -0,0 +1,25 @@
1
+ function i(n) {
2
+ const o = {};
3
+ for (const e in n)
4
+ if (Array.isArray(n[e])) {
5
+ const r = n[e];
6
+ if (n[e].length > 0) {
7
+ o[e] = r[0];
8
+ continue;
9
+ }
10
+ o[e] = "emptyarray";
11
+ } else if (typeof n[e] == "object" && n[e] !== null)
12
+ o[e] = "object (inspect) || Record<string, any>";
13
+ else if (typeof n[e] == "number") {
14
+ const r = Number(n[e]);
15
+ if (r === 1 || r === 0) {
16
+ o[e] = `${r}, BooleanLike?`;
17
+ continue;
18
+ }
19
+ o[e] = n[e];
20
+ }
21
+ return o;
22
+ }
23
+ export {
24
+ i as getShallowTypes
25
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Creates a UUID v4 string
3
+ *
4
+ * @example
5
+ * ```tsx
6
+ * createUuid(); // 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
7
+ * ```
8
+ */
9
+ export declare function createUuid(): string;
@@ -0,0 +1,10 @@
1
+ function r() {
2
+ let x = (/* @__PURE__ */ new Date()).getTime();
3
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
4
+ const t = (x + Math.random() * 16) % 16 | 0;
5
+ return x = Math.floor(x / 16), (e === "x" ? t : t & 3 | 8).toString(16);
6
+ });
7
+ }
8
+ export {
9
+ r as createUuid
10
+ };
@@ -0,0 +1,60 @@
1
+ import { Component } from 'react';
2
+
3
+ type Props = {
4
+ /**
5
+ * If provided, a function that formats the inner string. By default,
6
+ * attempts to match the numeric precision of `value`.
7
+ */
8
+ format?: (value: number) => string;
9
+ /**
10
+ * If provided, the initial value displayed. By default, the same as `value`.
11
+ * If `initial` and `value` are different, the component immediately starts
12
+ * animating.
13
+ */
14
+ initial?: number;
15
+ /**
16
+ * The target value to approach.
17
+ */
18
+ value: number;
19
+ };
20
+ /**
21
+ * An animated number label. Shows a number, formatted with an optionally
22
+ * provided function, and animates it towards its target value.
23
+ */
24
+ export declare class AnimatedNumber extends Component<Props> {
25
+ /**
26
+ * The inner `<span/>` being updated sixty times per second.
27
+ */
28
+ ref: import('react').RefObject<HTMLSpanElement>;
29
+ /**
30
+ * The interval being used to update the inner span.
31
+ */
32
+ interval?: NodeJS.Timeout;
33
+ /**
34
+ * The current value. This values approaches the target value.
35
+ */
36
+ currentValue: number;
37
+ constructor(props: Props);
38
+ componentDidMount(): void;
39
+ componentWillUnmount(): void;
40
+ shouldComponentUpdate(newProps: Props): boolean;
41
+ /**
42
+ * Starts animating the inner span. If the inner span is already animating,
43
+ * this is a no-op.
44
+ */
45
+ startTicking(): void;
46
+ /**
47
+ * Stops animating the inner span.
48
+ */
49
+ stopTicking(): void;
50
+ /**
51
+ * Steps forward one frame.
52
+ */
53
+ tick(): void;
54
+ /**
55
+ * Gets the inner text of the span.
56
+ */
57
+ getText(): string;
58
+ render(): import("react/jsx-runtime").JSX.Element;
59
+ }
60
+ export {};
@@ -0,0 +1,76 @@
1
+ var f = Object.defineProperty;
2
+ var p = (i, r, t) => r in i ? f(i, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[r] = t;
3
+ var s = (i, r, t) => p(i, typeof r != "symbol" ? r + "" : r, t);
4
+ import { jsx as m } from "react/jsx-runtime";
5
+ import { Component as v, createRef as g } from "react";
6
+ import { toFixed as d, clamp as T } from "../common/math.js";
7
+ function o(i) {
8
+ return typeof i == "number" && Number.isFinite(i) && !Number.isNaN(i);
9
+ }
10
+ const V = 1e3 / 60, a = 0.8333, l = 1e-3;
11
+ class S extends v {
12
+ constructor(t) {
13
+ super(t);
14
+ /**
15
+ * The inner `<span/>` being updated sixty times per second.
16
+ */
17
+ s(this, "ref", g());
18
+ /**
19
+ * The interval being used to update the inner span.
20
+ */
21
+ s(this, "interval");
22
+ /**
23
+ * The current value. This values approaches the target value.
24
+ */
25
+ s(this, "currentValue", 0);
26
+ const { initial: e, value: n } = t;
27
+ e !== void 0 && o(e) ? this.currentValue = e : o(n) && (this.currentValue = n);
28
+ }
29
+ componentDidMount() {
30
+ this.currentValue !== this.props.value && this.startTicking();
31
+ }
32
+ componentWillUnmount() {
33
+ this.stopTicking();
34
+ }
35
+ shouldComponentUpdate(t) {
36
+ return t.value !== this.props.value && this.startTicking(), !1;
37
+ }
38
+ /**
39
+ * Starts animating the inner span. If the inner span is already animating,
40
+ * this is a no-op.
41
+ */
42
+ startTicking() {
43
+ this.interval === void 0 && (this.interval = setInterval(() => this.tick(), V));
44
+ }
45
+ /**
46
+ * Stops animating the inner span.
47
+ */
48
+ stopTicking() {
49
+ this.interval !== void 0 && (clearInterval(this.interval), this.interval = void 0);
50
+ }
51
+ /**
52
+ * Steps forward one frame.
53
+ */
54
+ tick() {
55
+ const { currentValue: t } = this, { value: e } = this.props;
56
+ o(e) ? this.currentValue = t * a + e * (1 - a) : this.stopTicking(), Math.abs(e - this.currentValue) < Math.max(l, l * e) && (this.currentValue = e, this.stopTicking()), this.ref.current && (this.ref.current.textContent = this.getText());
57
+ }
58
+ /**
59
+ * Gets the inner text of the span.
60
+ */
61
+ getText() {
62
+ const { props: t, currentValue: e } = this, { format: n, value: u } = t;
63
+ if (!o(u))
64
+ return String(u);
65
+ if (n)
66
+ return n(this.currentValue);
67
+ const c = String(u).split(".")[1], h = c ? c.length : 0;
68
+ return d(e, T(h, 0, 8));
69
+ }
70
+ render() {
71
+ return /* @__PURE__ */ m("span", { ref: this.ref, children: this.getText() });
72
+ }
73
+ }
74
+ export {
75
+ S as AnimatedNumber
76
+ };
@@ -0,0 +1,4 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ /** Used to force the window to steal focus on load. Children optional */
4
+ export declare function Autofocus(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useRef as c, useEffect as f } from "react";
3
+ function m(r) {
4
+ const { children: o } = r, t = c(null);
5
+ return f(() => {
6
+ const u = setTimeout(() => {
7
+ var e;
8
+ (e = t.current) == null || e.focus();
9
+ }, 1);
10
+ return () => {
11
+ clearTimeout(u);
12
+ };
13
+ }, []), /* @__PURE__ */ n("div", { ref: t, tabIndex: -1, children: o });
14
+ }
15
+ export {
16
+ m as Autofocus
17
+ };
@@ -0,0 +1,26 @@
1
+ import { Component, PropsWithChildren } from 'react';
2
+
3
+ type Props = Partial<{
4
+ /**
5
+ * The interval between blinks, in milliseconds.
6
+ */
7
+ interval: number;
8
+ /**
9
+ * The time to wait before blinking again, in milliseconds.
10
+ */
11
+ time: number;
12
+ }> & PropsWithChildren;
13
+ type State = {
14
+ hidden: boolean;
15
+ };
16
+ export declare class Blink extends Component<Props, State> {
17
+ interval: NodeJS.Timeout;
18
+ timer: NodeJS.Timeout;
19
+ constructor(props: any);
20
+ createTimer(): void;
21
+ componentDidMount(): void;
22
+ componentDidUpdate(prevProps: any): void;
23
+ componentWillUnmount(): void;
24
+ render(): import("react/jsx-runtime").JSX.Element;
25
+ }
26
+ export {};