tgui-core 1.1.8 → 1.1.10
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.
- package/lib/common/assets.ts +38 -0
- package/lib/common/collections.ts +27 -0
- package/lib/common/color.ts +88 -0
- package/lib/common/constants.ts +349 -0
- package/lib/common/events.ts +262 -0
- package/{dist/common/exhaustive.d.ts → lib/common/exhaustive.ts} +3 -1
- package/lib/common/format.ts +167 -0
- package/{dist/common/fp.d.ts → lib/common/fp.ts} +16 -2
- package/lib/common/hotkeys.ts +207 -0
- package/lib/common/http.ts +16 -0
- package/lib/common/keycodes.ts +86 -0
- package/{dist/common/keys.d.ts → lib/common/keys.ts} +24 -21
- package/lib/common/math.ts +76 -0
- package/lib/common/perf.ts +72 -0
- package/lib/common/random.ts +32 -0
- package/lib/common/react.ts +59 -0
- package/lib/common/redux.ts +187 -0
- package/lib/common/storage.ts +207 -0
- package/lib/common/string.ts +169 -0
- package/lib/common/timer.ts +63 -0
- package/lib/common/type-utils.ts +41 -0
- package/lib/common/types.d.ts +12 -0
- package/lib/common/uuid.ts +18 -0
- package/lib/components/AnimatedNumber.tsx +180 -0
- package/lib/components/Autofocus.tsx +23 -0
- package/lib/components/Blink.tsx +91 -0
- package/lib/components/BlockQuote.tsx +9 -0
- package/lib/components/BodyZoneSelector.tsx +149 -0
- package/lib/components/Box.tsx +252 -0
- package/lib/components/Button.tsx +425 -0
- package/lib/components/ByondUi.jsx +110 -0
- package/lib/components/Chart.tsx +155 -0
- package/lib/components/Collapsible.tsx +43 -0
- package/lib/components/ColorBox.tsx +29 -0
- package/lib/components/Dialog.tsx +81 -0
- package/lib/components/Dimmer.tsx +13 -0
- package/lib/components/Divider.tsx +20 -0
- package/lib/components/DmIcon.tsx +86 -0
- package/lib/components/DraggableControl.jsx +276 -0
- package/lib/components/Dropdown.tsx +246 -0
- package/lib/components/FakeTerminal.jsx +52 -0
- package/lib/components/FitText.tsx +99 -0
- package/lib/components/Flex.tsx +159 -0
- package/lib/components/Icon.tsx +95 -0
- package/lib/components/Image.tsx +54 -0
- package/lib/components/InfinitePlane.jsx +192 -0
- package/lib/components/Input.tsx +176 -0
- package/lib/components/KeyListener.tsx +40 -0
- package/lib/components/Knob.tsx +178 -0
- package/lib/components/LabeledControls.tsx +44 -0
- package/lib/components/LabeledList.tsx +154 -0
- package/lib/components/MenuBar.tsx +228 -0
- package/lib/components/Modal.tsx +23 -0
- package/lib/components/NoticeBox.tsx +45 -0
- package/lib/components/NumberInput.tsx +328 -0
- package/lib/components/Popper.tsx +100 -0
- package/lib/components/ProgressBar.tsx +105 -0
- package/lib/components/RestrictedInput.jsx +301 -0
- package/lib/components/RoundGauge.tsx +180 -0
- package/lib/components/Section.tsx +120 -0
- package/lib/components/Slider.tsx +169 -0
- package/lib/components/Stack.tsx +96 -0
- package/lib/components/StyleableSection.tsx +33 -0
- package/lib/components/Table.tsx +84 -0
- package/lib/components/Tabs.tsx +89 -0
- package/lib/components/TextArea.tsx +182 -0
- package/lib/components/TimeDisplay.jsx +64 -0
- package/lib/components/Tooltip.tsx +152 -0
- package/lib/components/TrackOutsideClicks.tsx +35 -0
- package/lib/components/VirtualList.tsx +69 -0
- package/lib/styles/atomic/candystripe.scss +8 -0
- package/lib/styles/atomic/centered-image.scss +7 -0
- package/lib/styles/atomic/color.scss +21 -0
- package/lib/styles/atomic/debug-layout.scss +17 -0
- package/lib/styles/atomic/fit-text.scss +14 -0
- package/lib/styles/atomic/links.scss +12 -0
- package/lib/styles/atomic/outline.scss +47 -0
- package/lib/styles/atomic/text.scss +44 -0
- package/lib/styles/base.scss +32 -0
- package/lib/styles/colors.scss +92 -0
- package/lib/styles/components/BlockQuote.module.scss +20 -0
- package/lib/styles/components/BlockQuote.module.scss.d.ts +4 -0
- package/lib/styles/components/Button.module.scss +157 -0
- package/lib/styles/components/Button.module.scss.d.ts +46 -0
- package/lib/styles/components/ColorBox.module.scss +12 -0
- package/lib/styles/components/ColorBox.module.scss.d.ts +4 -0
- package/lib/styles/components/Dialog.module.scss +60 -0
- package/lib/styles/components/Dialog.module.scss.d.ts +10 -0
- package/lib/styles/components/Dimmer.module.scss +22 -0
- package/lib/styles/components/Dimmer.module.scss.d.ts +4 -0
- package/lib/styles/components/Divider.module.scss +27 -0
- package/lib/styles/components/Divider.module.scss.d.ts +6 -0
- package/lib/styles/components/Dropdown.scss +72 -0
- package/lib/styles/components/Flex.module.scss +13 -0
- package/lib/styles/components/Flex.module.scss.d.ts +5 -0
- package/lib/styles/components/Icon.module.scss +25 -0
- package/lib/styles/components/Icon.module.scss.d.ts +5 -0
- package/lib/styles/components/Input.module.scss +64 -0
- package/lib/styles/components/Input.module.scss.d.ts +8 -0
- package/lib/styles/components/Knob.module.scss +131 -0
- package/lib/styles/components/Knob.module.scss.d.ts +33 -0
- package/lib/styles/components/LabeledList.module.scss +49 -0
- package/lib/styles/components/LabeledList.module.scss.d.ts +8 -0
- package/lib/styles/components/MenuBar.module.scss +75 -0
- package/lib/styles/components/MenuBar.module.scss.d.ts +14 -0
- package/lib/styles/components/Modal.module.scss +14 -0
- package/lib/styles/components/Modal.module.scss.d.ts +4 -0
- package/lib/styles/components/NoticeBox.module.scss +65 -0
- package/lib/styles/components/NoticeBox.module.scss.d.ts +27 -0
- package/lib/styles/components/NumberInput.module.scss +71 -0
- package/lib/styles/components/NumberInput.module.scss.d.ts +9 -0
- package/lib/styles/components/ProgressBar.module.scss +63 -0
- package/lib/styles/components/ProgressBar.module.scss.d.ts +27 -0
- package/lib/styles/components/RoundGauge.module.scss +85 -0
- package/lib/styles/components/RoundGauge.module.scss.d.ts +49 -0
- package/lib/styles/components/Section.module.scss +130 -0
- package/lib/styles/components/Section.module.scss.d.ts +13 -0
- package/lib/styles/components/Slider.module.scss +54 -0
- package/lib/styles/components/Slider.module.scss.d.ts +8 -0
- package/lib/styles/components/Stack.module.scss +60 -0
- package/lib/styles/components/Stack.module.scss.d.ts +12 -0
- package/lib/styles/components/Table.module.scss +44 -0
- package/lib/styles/components/Table.module.scss.d.ts +10 -0
- package/lib/styles/components/Tabs.module.scss +144 -0
- package/lib/styles/components/Tabs.module.scss.d.ts +35 -0
- package/lib/styles/components/TextArea.module.scss +86 -0
- package/lib/styles/components/TextArea.module.scss.d.ts +11 -0
- package/lib/styles/components/Tooltip.module.scss +24 -0
- package/lib/styles/components/Tooltip.module.scss.d.ts +4 -0
- package/lib/styles/functions.scss +79 -0
- package/lib/styles/input.scss +9 -0
- package/lib/styles/main.scss +20 -0
- package/lib/styles/reset.scss +68 -0
- package/package.json +7 -7
- package/dist/ProgressBar.module-BkAFfFy0.js +0 -29
- package/dist/Section.module-CLVHJ4yA.js +0 -15
- package/dist/assets/BlockQuote.css +0 -1
- package/dist/assets/Button.css +0 -1
- package/dist/assets/ColorBox.css +0 -1
- package/dist/assets/Dialog.css +0 -1
- package/dist/assets/Dimmer.css +0 -1
- package/dist/assets/Divider.css +0 -1
- package/dist/assets/Flex.css +0 -1
- package/dist/assets/Icon.css +0 -6
- package/dist/assets/Input.css +0 -1
- package/dist/assets/Knob.css +0 -1
- package/dist/assets/LabeledList.css +0 -1
- package/dist/assets/MenuBar.css +0 -1
- package/dist/assets/Modal.css +0 -1
- package/dist/assets/NoticeBox.css +0 -1
- package/dist/assets/NumberInput.css +0 -1
- package/dist/assets/ProgressBar.css +0 -1
- package/dist/assets/RoundGauge.css +0 -1
- package/dist/assets/Section.css +0 -1
- package/dist/assets/Slider.css +0 -1
- package/dist/assets/Stack.css +0 -1
- package/dist/assets/Table.css +0 -1
- package/dist/assets/Tabs.css +0 -1
- package/dist/assets/TextArea.css +0 -1
- package/dist/assets/Tooltip.css +0 -1
- package/dist/common/assets.d.ts +0 -4
- package/dist/common/assets.js +0 -25
- package/dist/common/collections.d.ts +0 -10
- package/dist/common/collections.js +0 -15
- package/dist/common/color.d.ts +0 -25
- package/dist/common/color.js +0 -69
- package/dist/common/constants.d.ts +0 -102
- package/dist/common/constants.js +0 -312
- package/dist/common/events.d.ts +0 -33
- package/dist/common/events.js +0 -147
- package/dist/common/exhaustive.js +0 -6
- package/dist/common/format.d.ts +0 -11
- package/dist/common/format.js +0 -114
- package/dist/common/fp.js +0 -9
- package/dist/common/hotkeys.d.ts +0 -25
- package/dist/common/hotkeys.js +0 -112
- package/dist/common/http.d.ts +0 -4
- package/dist/common/http.js +0 -10
- package/dist/common/keycodes.d.ts +0 -85
- package/dist/common/keycodes.js +0 -88
- package/dist/common/keys.js +0 -8
- package/dist/common/math.d.ts +0 -39
- package/dist/common/math.js +0 -41
- package/dist/common/perf.d.ts +0 -24
- package/dist/common/perf.js +0 -33
- package/dist/common/random.d.ts +0 -16
- package/dist/common/random.js +0 -18
- package/dist/common/react.d.ts +0 -23
- package/dist/common/react.js +0 -30
- package/dist/common/redux.d.ts +0 -64
- package/dist/common/redux.js +0 -72
- package/dist/common/storage.js +0 -124
- package/dist/common/string.d.ts +0 -65
- package/dist/common/string.js +0 -83
- package/dist/common/timer.d.ts +0 -18
- package/dist/common/timer.js +0 -28
- package/dist/common/type-utils.d.ts +0 -9
- package/dist/common/type-utils.js +0 -25
- package/dist/common/uuid.d.ts +0 -9
- package/dist/common/uuid.js +0 -10
- package/dist/components/AnimatedNumber.d.ts +0 -60
- package/dist/components/AnimatedNumber.js +0 -76
- package/dist/components/Autofocus.d.ts +0 -4
- package/dist/components/Autofocus.js +0 -17
- package/dist/components/Blink.d.ts +0 -26
- package/dist/components/Blink.js +0 -56
- package/dist/components/BlockQuote.d.ts +0 -3
- package/dist/components/BlockQuote.js +0 -13
- package/dist/components/BodyZoneSelector.d.ts +0 -28
- package/dist/components/BodyZoneSelector.js +0 -115
- package/dist/components/Box.d.ts +0 -91
- package/dist/components/Box.js +0 -133
- package/dist/components/Button.d.ts +0 -93
- package/dist/components/Button.js +0 -298
- package/dist/components/ByondUi.js +0 -73
- package/dist/components/Chart.d.ts +0 -28
- package/dist/components/Chart.js +0 -95
- package/dist/components/Collapsible.d.ts +0 -15
- package/dist/components/Collapsible.js +0 -27
- package/dist/components/ColorBox.d.ts +0 -8
- package/dist/components/ColorBox.js +0 -24
- package/dist/components/Dialog.d.ts +0 -24
- package/dist/components/Dialog.js +0 -67
- package/dist/components/Dimmer.d.ts +0 -3
- package/dist/components/Dimmer.js +0 -13
- package/dist/components/Divider.d.ts +0 -6
- package/dist/components/Divider.js +0 -22
- package/dist/components/DmIcon.d.ts +0 -31
- package/dist/components/DmIcon.js +0 -34
- package/dist/components/DraggableControl.js +0 -176
- package/dist/components/Dropdown.d.ts +0 -48
- package/dist/components/Dropdown.js +0 -152
- package/dist/components/FakeTerminal.js +0 -38
- package/dist/components/FitText.d.ts +0 -22
- package/dist/components/FitText.js +0 -63
- package/dist/components/Flex.d.ts +0 -93
- package/dist/components/Flex.js +0 -72
- package/dist/components/Icon.d.ts +0 -30
- package/dist/components/Icon.js +0 -51
- package/dist/components/Image.d.ts +0 -14
- package/dist/components/Image.js +0 -35
- package/dist/components/InfinitePlane.js +0 -139
- package/dist/components/Input.d.ts +0 -61
- package/dist/components/Input.js +0 -89
- package/dist/components/KeyListener.d.ts +0 -15
- package/dist/components/KeyListener.js +0 -23
- package/dist/components/Knob.d.ts +0 -49
- package/dist/components/Knob.js +0 -162
- package/dist/components/LabeledControls.d.ts +0 -11
- package/dist/components/LabeledControls.js +0 -39
- package/dist/components/LabeledList.d.ts +0 -57
- package/dist/components/LabeledList.js +0 -94
- package/dist/components/MenuBar.d.ts +0 -28
- package/dist/components/MenuBar.js +0 -174
- package/dist/components/Modal.d.ts +0 -3
- package/dist/components/Modal.js +0 -25
- package/dist/components/NoticeBox.d.ts +0 -20
- package/dist/components/NoticeBox.js +0 -49
- package/dist/components/NumberInput.d.ts +0 -45
- package/dist/components/NumberInput.js +0 -221
- package/dist/components/Popper.d.ts +0 -27
- package/dist/components/Popper.js +0 -177
- package/dist/components/ProgressBar.d.ts +0 -46
- package/dist/components/ProgressBar.js +0 -37
- package/dist/components/RestrictedInput.js +0 -155
- package/dist/components/RoundGauge.d.ts +0 -53
- package/dist/components/RoundGauge.js +0 -147
- package/dist/components/Section.d.ts +0 -63
- package/dist/components/Section.js +0 -62
- package/dist/components/Slider.d.ts +0 -46
- package/dist/components/Slider.js +0 -124
- package/dist/components/Stack.d.ts +0 -27
- package/dist/components/Stack.js +0 -67
- package/dist/components/StyleableSection.d.ts +0 -11
- package/dist/components/StyleableSection.js +0 -16
- package/dist/components/Table.d.ts +0 -29
- package/dist/components/Table.js +0 -67
- package/dist/components/Tabs.d.ts +0 -23
- package/dist/components/Tabs.js +0 -89
- package/dist/components/TextArea.d.ts +0 -39
- package/dist/components/TextArea.js +0 -118
- package/dist/components/TimeDisplay.js +0 -34
- package/dist/components/Tooltip.d.ts +0 -29
- package/dist/components/Tooltip.js +0 -83
- package/dist/components/TrackOutsideClicks.d.ts +0 -13
- package/dist/components/TrackOutsideClicks.js +0 -24
- package/dist/components/VirtualList.d.ts +0 -8
- package/dist/components/VirtualList.js +0 -34
- package/dist/components/index.js +0 -92
- package/dist/popper-CiqSDJTE.js +0 -906
- /package/{dist/components/index.d.ts → lib/components/index.ts} +0 -0
package/dist/common/format.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const d = [
|
|
2
|
-
"f",
|
|
3
|
-
// femto
|
|
4
|
-
"p",
|
|
5
|
-
// pico
|
|
6
|
-
"n",
|
|
7
|
-
// nano
|
|
8
|
-
"μ",
|
|
9
|
-
// micro
|
|
10
|
-
"m",
|
|
11
|
-
// milli
|
|
12
|
-
// NOTE: This is a space for a reason. When we right align si numbers,
|
|
13
|
-
// in monospace mode, we want to units and numbers stay in their respective
|
|
14
|
-
// columns. If rendering in HTML mode, this space will collapse into
|
|
15
|
-
// a single space anyway.
|
|
16
|
-
" ",
|
|
17
|
-
// base
|
|
18
|
-
"k",
|
|
19
|
-
// kilo
|
|
20
|
-
"M",
|
|
21
|
-
// mega
|
|
22
|
-
"G",
|
|
23
|
-
// giga
|
|
24
|
-
"T",
|
|
25
|
-
// tera
|
|
26
|
-
"P",
|
|
27
|
-
// peta
|
|
28
|
-
"E",
|
|
29
|
-
// exa
|
|
30
|
-
"Z",
|
|
31
|
-
// zetta
|
|
32
|
-
"Y",
|
|
33
|
-
// yotta
|
|
34
|
-
"R",
|
|
35
|
-
// ronna
|
|
36
|
-
"Q",
|
|
37
|
-
// quecca
|
|
38
|
-
"F",
|
|
39
|
-
"N",
|
|
40
|
-
"H"
|
|
41
|
-
], l = d.indexOf(" "), m = (t, n = -l, s = "") => {
|
|
42
|
-
if (!isFinite(t))
|
|
43
|
-
return t.toString();
|
|
44
|
-
const o = Math.floor(Math.log10(Math.abs(t))), r = Math.max(n * 3, o), e = Math.floor(r / 3), i = d[Math.min(e + l, d.length - 1)];
|
|
45
|
-
let a = (t / Math.pow(1e3, e)).toFixed(2);
|
|
46
|
-
return a.endsWith(".00") ? a = a.slice(0, -3) : a.endsWith(".0") && (a = a.slice(0, -2)), `${a} ${i.trim()}${s}`.trim();
|
|
47
|
-
};
|
|
48
|
-
function S(t, n = 0) {
|
|
49
|
-
return m(t, n, "W");
|
|
50
|
-
}
|
|
51
|
-
function $(t, n = 0) {
|
|
52
|
-
return m(t, n, "J");
|
|
53
|
-
}
|
|
54
|
-
function b(t, n = 0) {
|
|
55
|
-
if (!Number.isFinite(t))
|
|
56
|
-
return String(t);
|
|
57
|
-
const s = Number(t.toFixed(n)), o = s < 0, e = Math.abs(s).toString().split(".");
|
|
58
|
-
e[0] = e[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
|
59
|
-
const i = e.join(".");
|
|
60
|
-
return o ? `-${i}` : i;
|
|
61
|
-
}
|
|
62
|
-
function g(t) {
|
|
63
|
-
const n = 20 * Math.log10(t), s = n >= 0 ? "+" : "-";
|
|
64
|
-
let o = Math.abs(n);
|
|
65
|
-
return o === 1 / 0 ? o = "Inf" : o = o.toFixed(2), `${s}${o} dB`;
|
|
66
|
-
}
|
|
67
|
-
const M = [
|
|
68
|
-
"",
|
|
69
|
-
"· 10³",
|
|
70
|
-
// kilo
|
|
71
|
-
"· 10⁶",
|
|
72
|
-
// mega
|
|
73
|
-
"· 10⁹",
|
|
74
|
-
// giga
|
|
75
|
-
"· 10¹²",
|
|
76
|
-
// tera
|
|
77
|
-
"· 10¹⁵",
|
|
78
|
-
// peta
|
|
79
|
-
"· 10¹⁸",
|
|
80
|
-
// exa
|
|
81
|
-
"· 10²¹",
|
|
82
|
-
// zetta
|
|
83
|
-
"· 10²⁴",
|
|
84
|
-
// yotta
|
|
85
|
-
"· 10²⁷",
|
|
86
|
-
// ronna
|
|
87
|
-
"· 10³⁰",
|
|
88
|
-
// quecca
|
|
89
|
-
"· 10³³",
|
|
90
|
-
"· 10³⁶",
|
|
91
|
-
"· 10³⁹"
|
|
92
|
-
], p = (t, n = 0, s = "") => {
|
|
93
|
-
if (!isFinite(t))
|
|
94
|
-
return "NaN";
|
|
95
|
-
const o = Math.floor(Math.log10(t)), r = Math.max(n * 3, o), e = Math.floor(r / 3), i = M[e], c = t / Math.pow(1e3, e), a = Math.max(0, 2 - r % 3);
|
|
96
|
-
return `${c.toFixed(a)} ${i} ${s}`.trim();
|
|
97
|
-
}, F = (t, n = "default") => {
|
|
98
|
-
const s = Math.floor(t / 10), o = Math.floor(s / 3600), r = Math.floor(s % 3600 / 60), e = s % 60;
|
|
99
|
-
if (n === "short") {
|
|
100
|
-
const f = o > 0 ? `${o}h` : "", u = r > 0 ? `${r}m` : "", h = e > 0 ? `${e}s` : "";
|
|
101
|
-
return `${f}${u}${h}`;
|
|
102
|
-
}
|
|
103
|
-
const i = String(o).padStart(2, "0"), c = String(r).padStart(2, "0"), a = String(e).padStart(2, "0");
|
|
104
|
-
return `${i}:${c}:${a}`;
|
|
105
|
-
};
|
|
106
|
-
export {
|
|
107
|
-
g as formatDb,
|
|
108
|
-
$ as formatEnergy,
|
|
109
|
-
b as formatMoney,
|
|
110
|
-
S as formatPower,
|
|
111
|
-
p as formatSiBaseTenUnit,
|
|
112
|
-
m as formatSiUnit,
|
|
113
|
-
F as formatTime
|
|
114
|
-
};
|
package/dist/common/fp.js
DELETED
package/dist/common/hotkeys.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { KeyEvent } from './events';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Acquires a lock on the hotkey, which prevents it from being
|
|
5
|
-
* passed through to BYOND.
|
|
6
|
-
*/
|
|
7
|
-
export declare function acquireHotKey(keyCode: number): void;
|
|
8
|
-
/**
|
|
9
|
-
* Makes the hotkey available to BYOND again.
|
|
10
|
-
*/
|
|
11
|
-
export declare function releaseHotKey(keyCode: number): void;
|
|
12
|
-
export declare function releaseHeldKeys(): void;
|
|
13
|
-
export declare function setupHotKeys(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Registers for any key events, such as key down or key up.
|
|
16
|
-
* This should be preferred over directly connecting to keydown/keyup
|
|
17
|
-
* as it lets tgui prevent the key from reaching BYOND.
|
|
18
|
-
*
|
|
19
|
-
* If using in a component, prefer KeyListener, which automatically handles
|
|
20
|
-
* stopping listening when unmounting.
|
|
21
|
-
*
|
|
22
|
-
* @param callback The function to call whenever a key event occurs
|
|
23
|
-
* @returns A callback to stop listening
|
|
24
|
-
*/
|
|
25
|
-
export declare function listenForKeyEvents(callback: (key: KeyEvent) => void): () => void;
|
package/dist/common/hotkeys.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/common/http.d.ts
DELETED
package/dist/common/http.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
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;
|
package/dist/common/keycodes.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/common/keys.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/common/math.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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;
|
package/dist/common/math.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/common/perf.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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 {};
|
package/dist/common/perf.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/common/random.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
package/dist/common/random.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/common/react.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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;
|
package/dist/common/react.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
};
|