tgui-core 1.1.7 → 1.1.9

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 (291) hide show
  1. package/lib/common/assets.ts +38 -0
  2. package/lib/common/collections.ts +27 -0
  3. package/lib/common/color.ts +88 -0
  4. package/lib/common/constants.ts +349 -0
  5. package/lib/common/events.ts +262 -0
  6. package/{dist/common/exhaustive.d.ts → lib/common/exhaustive.ts} +3 -1
  7. package/lib/common/format.ts +167 -0
  8. package/{dist/common/fp.d.ts → lib/common/fp.ts} +16 -2
  9. package/lib/common/hotkeys.ts +207 -0
  10. package/lib/common/http.ts +16 -0
  11. package/lib/common/keycodes.ts +86 -0
  12. package/{dist/common/keys.d.ts → lib/common/keys.ts} +24 -21
  13. package/lib/common/math.ts +76 -0
  14. package/lib/common/perf.ts +72 -0
  15. package/lib/common/random.ts +32 -0
  16. package/lib/common/react.ts +59 -0
  17. package/lib/common/redux.ts +187 -0
  18. package/lib/common/storage.ts +207 -0
  19. package/lib/common/string.ts +169 -0
  20. package/lib/common/timer.ts +63 -0
  21. package/lib/common/type-utils.ts +41 -0
  22. package/lib/common/types.d.ts +12 -0
  23. package/lib/common/uuid.ts +18 -0
  24. package/lib/components/AnimatedNumber.tsx +180 -0
  25. package/lib/components/Autofocus.tsx +23 -0
  26. package/lib/components/Blink.tsx +91 -0
  27. package/lib/components/BlockQuote.tsx +9 -0
  28. package/lib/components/BodyZoneSelector.tsx +149 -0
  29. package/lib/components/Box.tsx +252 -0
  30. package/lib/components/Button.tsx +425 -0
  31. package/lib/components/ByondUi.jsx +110 -0
  32. package/lib/components/Chart.tsx +155 -0
  33. package/lib/components/Collapsible.tsx +43 -0
  34. package/lib/components/ColorBox.tsx +29 -0
  35. package/lib/components/Dialog.tsx +81 -0
  36. package/lib/components/Dimmer.tsx +13 -0
  37. package/lib/components/Divider.tsx +20 -0
  38. package/lib/components/DmIcon.tsx +86 -0
  39. package/lib/components/DraggableControl.jsx +276 -0
  40. package/lib/components/Dropdown.tsx +246 -0
  41. package/lib/components/FakeTerminal.jsx +52 -0
  42. package/lib/components/FitText.tsx +99 -0
  43. package/lib/components/Flex.tsx +159 -0
  44. package/lib/components/Icon.tsx +95 -0
  45. package/lib/components/Image.tsx +54 -0
  46. package/lib/components/InfinitePlane.jsx +192 -0
  47. package/lib/components/Input.tsx +176 -0
  48. package/lib/components/KeyListener.tsx +40 -0
  49. package/lib/components/Knob.tsx +178 -0
  50. package/lib/components/LabeledControls.tsx +44 -0
  51. package/lib/components/LabeledList.tsx +154 -0
  52. package/lib/components/MenuBar.tsx +228 -0
  53. package/lib/components/Modal.tsx +23 -0
  54. package/lib/components/NoticeBox.tsx +45 -0
  55. package/lib/components/NumberInput.tsx +328 -0
  56. package/lib/components/Popper.tsx +100 -0
  57. package/lib/components/ProgressBar.tsx +105 -0
  58. package/lib/components/RestrictedInput.jsx +301 -0
  59. package/lib/components/RoundGauge.tsx +180 -0
  60. package/lib/components/Section.tsx +120 -0
  61. package/lib/components/Slider.tsx +169 -0
  62. package/lib/components/Stack.tsx +96 -0
  63. package/lib/components/StyleableSection.tsx +33 -0
  64. package/lib/components/Table.tsx +84 -0
  65. package/lib/components/Tabs.tsx +89 -0
  66. package/lib/components/TextArea.tsx +182 -0
  67. package/lib/components/TimeDisplay.jsx +64 -0
  68. package/lib/components/Tooltip.tsx +152 -0
  69. package/lib/components/TrackOutsideClicks.tsx +35 -0
  70. package/lib/components/VirtualList.tsx +69 -0
  71. package/lib/styles/atomic/candystripe.scss +8 -0
  72. package/lib/styles/atomic/centered-image.scss +7 -0
  73. package/lib/styles/atomic/color.scss +21 -0
  74. package/lib/styles/atomic/debug-layout.scss +17 -0
  75. package/lib/styles/atomic/fit-text.scss +14 -0
  76. package/lib/styles/atomic/links.scss +12 -0
  77. package/lib/styles/atomic/outline.scss +47 -0
  78. package/lib/styles/atomic/text.scss +44 -0
  79. package/lib/styles/base.scss +32 -0
  80. package/lib/styles/colors.scss +92 -0
  81. package/lib/styles/components/BlockQuote.module.scss +20 -0
  82. package/lib/styles/components/BlockQuote.module.scss.d.ts +4 -0
  83. package/lib/styles/components/Button.module.scss +157 -0
  84. package/lib/styles/components/Button.module.scss.d.ts +46 -0
  85. package/lib/styles/components/ColorBox.module.scss +12 -0
  86. package/lib/styles/components/ColorBox.module.scss.d.ts +4 -0
  87. package/lib/styles/components/Dialog.module.scss +60 -0
  88. package/lib/styles/components/Dialog.module.scss.d.ts +10 -0
  89. package/lib/styles/components/Dimmer.module.scss +22 -0
  90. package/lib/styles/components/Dimmer.module.scss.d.ts +4 -0
  91. package/lib/styles/components/Divider.module.scss +27 -0
  92. package/lib/styles/components/Divider.module.scss.d.ts +6 -0
  93. package/lib/styles/components/Dropdown.scss +72 -0
  94. package/lib/styles/components/Flex.module.scss +13 -0
  95. package/lib/styles/components/Flex.module.scss.d.ts +5 -0
  96. package/lib/styles/components/Icon.module.scss +25 -0
  97. package/lib/styles/components/Icon.module.scss.d.ts +5 -0
  98. package/lib/styles/components/Input.module.scss +64 -0
  99. package/lib/styles/components/Input.module.scss.d.ts +8 -0
  100. package/lib/styles/components/Knob.module.scss +131 -0
  101. package/lib/styles/components/Knob.module.scss.d.ts +33 -0
  102. package/lib/styles/components/LabeledList.module.scss +49 -0
  103. package/lib/styles/components/LabeledList.module.scss.d.ts +8 -0
  104. package/lib/styles/components/MenuBar.module.scss +75 -0
  105. package/lib/styles/components/MenuBar.module.scss.d.ts +14 -0
  106. package/lib/styles/components/Modal.module.scss +14 -0
  107. package/lib/styles/components/Modal.module.scss.d.ts +4 -0
  108. package/lib/styles/components/NoticeBox.module.scss +65 -0
  109. package/lib/styles/components/NoticeBox.module.scss.d.ts +27 -0
  110. package/lib/styles/components/NumberInput.module.scss +71 -0
  111. package/lib/styles/components/NumberInput.module.scss.d.ts +9 -0
  112. package/lib/styles/components/ProgressBar.module.scss +63 -0
  113. package/lib/styles/components/ProgressBar.module.scss.d.ts +27 -0
  114. package/lib/styles/components/RoundGauge.module.scss +85 -0
  115. package/lib/styles/components/RoundGauge.module.scss.d.ts +49 -0
  116. package/lib/styles/components/Section.module.scss +130 -0
  117. package/lib/styles/components/Section.module.scss.d.ts +13 -0
  118. package/lib/styles/components/Slider.module.scss +54 -0
  119. package/lib/styles/components/Slider.module.scss.d.ts +8 -0
  120. package/lib/styles/components/Stack.module.scss +60 -0
  121. package/lib/styles/components/Stack.module.scss.d.ts +12 -0
  122. package/lib/styles/components/Table.module.scss +44 -0
  123. package/lib/styles/components/Table.module.scss.d.ts +10 -0
  124. package/lib/styles/components/Tabs.module.scss +144 -0
  125. package/lib/styles/components/Tabs.module.scss.d.ts +35 -0
  126. package/lib/styles/components/TextArea.module.scss +86 -0
  127. package/lib/styles/components/TextArea.module.scss.d.ts +11 -0
  128. package/lib/styles/components/Tooltip.module.scss +24 -0
  129. package/lib/styles/components/Tooltip.module.scss.d.ts +4 -0
  130. package/lib/styles/functions.scss +79 -0
  131. package/lib/styles/input.scss +9 -0
  132. package/lib/styles/main.scss +20 -0
  133. package/lib/styles/reset.scss +68 -0
  134. package/package.json +6 -6
  135. package/dist/ProgressBar.module-BkAFfFy0.js +0 -29
  136. package/dist/Section.module-CLVHJ4yA.js +0 -15
  137. package/dist/assets/BlockQuote.css +0 -1
  138. package/dist/assets/Button.css +0 -1
  139. package/dist/assets/ColorBox.css +0 -1
  140. package/dist/assets/Dialog.css +0 -1
  141. package/dist/assets/Dimmer.css +0 -1
  142. package/dist/assets/Divider.css +0 -1
  143. package/dist/assets/Flex.css +0 -1
  144. package/dist/assets/Icon.css +0 -6
  145. package/dist/assets/Input.css +0 -1
  146. package/dist/assets/Knob.css +0 -1
  147. package/dist/assets/LabeledList.css +0 -1
  148. package/dist/assets/MenuBar.css +0 -1
  149. package/dist/assets/Modal.css +0 -1
  150. package/dist/assets/NoticeBox.css +0 -1
  151. package/dist/assets/NumberInput.css +0 -1
  152. package/dist/assets/ProgressBar.css +0 -1
  153. package/dist/assets/RoundGauge.css +0 -1
  154. package/dist/assets/Section.css +0 -1
  155. package/dist/assets/Slider.css +0 -1
  156. package/dist/assets/Stack.css +0 -1
  157. package/dist/assets/Table.css +0 -1
  158. package/dist/assets/Tabs.css +0 -1
  159. package/dist/assets/TextArea.css +0 -1
  160. package/dist/assets/Tooltip.css +0 -1
  161. package/dist/common/assets.d.ts +0 -4
  162. package/dist/common/assets.js +0 -21
  163. package/dist/common/collections.d.ts +0 -10
  164. package/dist/common/collections.js +0 -15
  165. package/dist/common/color.d.ts +0 -25
  166. package/dist/common/color.js +0 -69
  167. package/dist/common/constants.d.ts +0 -102
  168. package/dist/common/constants.js +0 -312
  169. package/dist/common/events.d.ts +0 -33
  170. package/dist/common/events.js +0 -147
  171. package/dist/common/exhaustive.js +0 -6
  172. package/dist/common/format.d.ts +0 -11
  173. package/dist/common/format.js +0 -114
  174. package/dist/common/fp.js +0 -9
  175. package/dist/common/hotkeys.d.ts +0 -25
  176. package/dist/common/hotkeys.js +0 -112
  177. package/dist/common/http.d.ts +0 -4
  178. package/dist/common/http.js +0 -10
  179. package/dist/common/keycodes.d.ts +0 -85
  180. package/dist/common/keycodes.js +0 -88
  181. package/dist/common/keys.js +0 -8
  182. package/dist/common/math.d.ts +0 -39
  183. package/dist/common/math.js +0 -41
  184. package/dist/common/perf.d.ts +0 -24
  185. package/dist/common/perf.js +0 -33
  186. package/dist/common/random.d.ts +0 -16
  187. package/dist/common/random.js +0 -18
  188. package/dist/common/react.d.ts +0 -23
  189. package/dist/common/react.js +0 -30
  190. package/dist/common/redux.d.ts +0 -64
  191. package/dist/common/redux.js +0 -72
  192. package/dist/common/storage.js +0 -124
  193. package/dist/common/string.d.ts +0 -65
  194. package/dist/common/string.js +0 -83
  195. package/dist/common/timer.d.ts +0 -18
  196. package/dist/common/timer.js +0 -28
  197. package/dist/common/type-utils.d.ts +0 -9
  198. package/dist/common/type-utils.js +0 -25
  199. package/dist/common/uuid.d.ts +0 -9
  200. package/dist/common/uuid.js +0 -10
  201. package/dist/components/AnimatedNumber.d.ts +0 -60
  202. package/dist/components/AnimatedNumber.js +0 -76
  203. package/dist/components/Autofocus.d.ts +0 -4
  204. package/dist/components/Autofocus.js +0 -17
  205. package/dist/components/Blink.d.ts +0 -26
  206. package/dist/components/Blink.js +0 -56
  207. package/dist/components/BlockQuote.d.ts +0 -3
  208. package/dist/components/BlockQuote.js +0 -13
  209. package/dist/components/BodyZoneSelector.d.ts +0 -28
  210. package/dist/components/BodyZoneSelector.js +0 -115
  211. package/dist/components/Box.d.ts +0 -91
  212. package/dist/components/Box.js +0 -133
  213. package/dist/components/Button.d.ts +0 -93
  214. package/dist/components/Button.js +0 -298
  215. package/dist/components/ByondUi.js +0 -73
  216. package/dist/components/Chart.d.ts +0 -28
  217. package/dist/components/Chart.js +0 -95
  218. package/dist/components/Collapsible.d.ts +0 -15
  219. package/dist/components/Collapsible.js +0 -27
  220. package/dist/components/ColorBox.d.ts +0 -8
  221. package/dist/components/ColorBox.js +0 -24
  222. package/dist/components/Dialog.d.ts +0 -24
  223. package/dist/components/Dialog.js +0 -67
  224. package/dist/components/Dimmer.d.ts +0 -3
  225. package/dist/components/Dimmer.js +0 -13
  226. package/dist/components/Divider.d.ts +0 -6
  227. package/dist/components/Divider.js +0 -22
  228. package/dist/components/DmIcon.d.ts +0 -31
  229. package/dist/components/DmIcon.js +0 -31
  230. package/dist/components/DraggableControl.js +0 -176
  231. package/dist/components/Dropdown.d.ts +0 -48
  232. package/dist/components/Dropdown.js +0 -152
  233. package/dist/components/FakeTerminal.js +0 -38
  234. package/dist/components/FitText.d.ts +0 -22
  235. package/dist/components/FitText.js +0 -63
  236. package/dist/components/Flex.d.ts +0 -93
  237. package/dist/components/Flex.js +0 -72
  238. package/dist/components/Icon.d.ts +0 -30
  239. package/dist/components/Icon.js +0 -51
  240. package/dist/components/Image.d.ts +0 -14
  241. package/dist/components/Image.js +0 -35
  242. package/dist/components/InfinitePlane.js +0 -139
  243. package/dist/components/Input.d.ts +0 -61
  244. package/dist/components/Input.js +0 -89
  245. package/dist/components/KeyListener.d.ts +0 -15
  246. package/dist/components/KeyListener.js +0 -23
  247. package/dist/components/Knob.d.ts +0 -49
  248. package/dist/components/Knob.js +0 -162
  249. package/dist/components/LabeledControls.d.ts +0 -11
  250. package/dist/components/LabeledControls.js +0 -39
  251. package/dist/components/LabeledList.d.ts +0 -57
  252. package/dist/components/LabeledList.js +0 -94
  253. package/dist/components/MenuBar.d.ts +0 -28
  254. package/dist/components/MenuBar.js +0 -174
  255. package/dist/components/Modal.d.ts +0 -3
  256. package/dist/components/Modal.js +0 -25
  257. package/dist/components/NoticeBox.d.ts +0 -20
  258. package/dist/components/NoticeBox.js +0 -49
  259. package/dist/components/NumberInput.d.ts +0 -45
  260. package/dist/components/NumberInput.js +0 -221
  261. package/dist/components/Popper.d.ts +0 -27
  262. package/dist/components/Popper.js +0 -177
  263. package/dist/components/ProgressBar.d.ts +0 -46
  264. package/dist/components/ProgressBar.js +0 -37
  265. package/dist/components/RestrictedInput.js +0 -155
  266. package/dist/components/RoundGauge.d.ts +0 -53
  267. package/dist/components/RoundGauge.js +0 -147
  268. package/dist/components/Section.d.ts +0 -63
  269. package/dist/components/Section.js +0 -62
  270. package/dist/components/Slider.d.ts +0 -46
  271. package/dist/components/Slider.js +0 -124
  272. package/dist/components/Stack.d.ts +0 -27
  273. package/dist/components/Stack.js +0 -67
  274. package/dist/components/StyleableSection.d.ts +0 -11
  275. package/dist/components/StyleableSection.js +0 -16
  276. package/dist/components/Table.d.ts +0 -29
  277. package/dist/components/Table.js +0 -67
  278. package/dist/components/Tabs.d.ts +0 -23
  279. package/dist/components/Tabs.js +0 -89
  280. package/dist/components/TextArea.d.ts +0 -39
  281. package/dist/components/TextArea.js +0 -118
  282. package/dist/components/TimeDisplay.js +0 -34
  283. package/dist/components/Tooltip.d.ts +0 -29
  284. package/dist/components/Tooltip.js +0 -83
  285. package/dist/components/TrackOutsideClicks.d.ts +0 -13
  286. package/dist/components/TrackOutsideClicks.js +0 -24
  287. package/dist/components/VirtualList.d.ts +0 -8
  288. package/dist/components/VirtualList.js +0 -34
  289. package/dist/components/index.js +0 -92
  290. package/dist/popper-CiqSDJTE.js +0 -906
  291. /package/{dist/components/index.d.ts → lib/components/index.ts} +0 -0
@@ -1,64 +0,0 @@
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 {};
@@ -1,72 +0,0 @@
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
- };
@@ -1,124 +0,0 @@
1
- /**
2
- * Browser-agnostic abstraction of key-value web storage.
3
- *
4
- * @file
5
- * @copyright 2020 Aleksej Komarov
6
- * @license MIT
7
- */
8
- const E = 0, h = 1, S = 2;
9
- const d = "tgui", c = "storage-v1", l = "readonly", a = "readwrite", i = (o) => () => {
10
- try {
11
- return !!o();
12
- } catch {
13
- return !1;
14
- }
15
- }, w = i(
16
- () => window.localStorage && window.localStorage.getItem
17
- ), D = i(
18
- () => (window.indexedDB || window.msIndexedDB) && (window.IDBTransaction || window.msIDBTransaction)
19
- );
20
- class g {
21
- constructor() {
22
- this.impl = 0, this.store = {};
23
- }
24
- get(e) {
25
- return this.store[e];
26
- }
27
- set(e, t) {
28
- this.store[e] = t;
29
- }
30
- remove(e) {
31
- this.store[e] = void 0;
32
- }
33
- clear() {
34
- this.store = {};
35
- }
36
- }
37
- class u {
38
- constructor() {
39
- this.impl = 1;
40
- }
41
- get(e) {
42
- const t = localStorage.getItem(e);
43
- if (typeof t == "string")
44
- return JSON.parse(t);
45
- }
46
- set(e, t) {
47
- localStorage.setItem(e, JSON.stringify(t));
48
- }
49
- remove(e) {
50
- localStorage.removeItem(e);
51
- }
52
- clear() {
53
- localStorage.clear();
54
- }
55
- }
56
- class m {
57
- constructor() {
58
- this.impl = 2, this.dbPromise = new Promise((e, t) => {
59
- const r = (window.indexedDB || window.msIndexedDB).open(d, 1);
60
- r.onupgradeneeded = () => {
61
- try {
62
- r.result.createObjectStore(c);
63
- } catch {
64
- t(new Error("Failed to upgrade IDB: " + r.error));
65
- }
66
- }, r.onsuccess = () => e(r.result), r.onerror = () => {
67
- t(new Error("Failed to open IDB: " + r.error));
68
- };
69
- });
70
- }
71
- getStore(e) {
72
- return this.dbPromise.then(
73
- (t) => t.transaction(c, e).objectStore(c)
74
- );
75
- }
76
- async get(e) {
77
- const t = await this.getStore(l);
78
- return new Promise((s, r) => {
79
- const n = t.get(e);
80
- n.onsuccess = () => s(n.result), n.onerror = () => r(n.error);
81
- });
82
- }
83
- async set(e, t) {
84
- t === null && (t = void 0), (await this.getStore(a)).put(t, e);
85
- }
86
- async remove(e) {
87
- (await this.getStore(a)).delete(e);
88
- }
89
- async clear() {
90
- (await this.getStore(a)).clear();
91
- }
92
- }
93
- class I {
94
- constructor() {
95
- this.backendPromise = (async () => {
96
- if (D())
97
- try {
98
- const e = new m();
99
- return await e.dbPromise, e;
100
- } catch {
101
- }
102
- return w() ? new u() : new g();
103
- })();
104
- }
105
- async get(e) {
106
- return (await this.backendPromise).get(e);
107
- }
108
- async set(e, t) {
109
- return (await this.backendPromise).set(e, t);
110
- }
111
- async remove(e) {
112
- return (await this.backendPromise).remove(e);
113
- }
114
- async clear() {
115
- return (await this.backendPromise).clear();
116
- }
117
- }
118
- const b = new I();
119
- export {
120
- S as IMPL_INDEXED_DB,
121
- h as IMPL_LOCAL_STORAGE,
122
- E as IMPL_MEMORY,
123
- b as storage
124
- };
@@ -1,65 +0,0 @@
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;
@@ -1,83 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
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>;
@@ -1,28 +0,0 @@
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
- };
@@ -1,9 +0,0 @@
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>;
@@ -1,25 +0,0 @@
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
- };
@@ -1,9 +0,0 @@
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;
@@ -1,10 +0,0 @@
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
- };
@@ -1,60 +0,0 @@
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 {};
@@ -1,76 +0,0 @@
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
- };
@@ -1,4 +0,0 @@
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;
@@ -1,17 +0,0 @@
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
- };