tgui-core 1.2.0 → 1.3.1

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 (116) hide show
  1. package/README.md +3 -3
  2. package/dist/common/color.js +31 -30
  3. package/dist/common/events.js +5 -5
  4. package/dist/common/format.js +27 -27
  5. package/dist/common/hotkeys.d.ts +0 -1
  6. package/dist/common/hotkeys.js +2 -2
  7. package/dist/common/math.d.ts +4 -0
  8. package/dist/common/math.js +29 -25
  9. package/dist/common/random.js +14 -13
  10. package/dist/common/react.js +1 -1
  11. package/dist/common/string.js +9 -9
  12. package/dist/common/type-utils.d.ts +1 -1
  13. package/dist/components/AnimatedNumber.d.ts +6 -6
  14. package/dist/components/AnimatedNumber.js +14 -17
  15. package/dist/components/Autofocus.d.ts +0 -1
  16. package/dist/components/Blink.d.ts +0 -1
  17. package/dist/components/BlockQuote.d.ts +0 -1
  18. package/dist/components/BlockQuote.js +4 -7
  19. package/dist/components/Box.d.ts +0 -1
  20. package/dist/components/Box.js +4 -4
  21. package/dist/components/Button.d.ts +0 -1
  22. package/dist/components/Button.js +173 -211
  23. package/dist/components/ByondUi.js +3 -3
  24. package/dist/components/Chart.d.ts +0 -1
  25. package/dist/components/Chart.js +25 -22
  26. package/dist/components/Collapsible.d.ts +0 -1
  27. package/dist/components/ColorBox.d.ts +0 -1
  28. package/dist/components/ColorBox.js +7 -14
  29. package/dist/components/Dialog.js +31 -40
  30. package/dist/components/Dimmer.d.ts +0 -1
  31. package/dist/components/Dimmer.js +6 -9
  32. package/dist/components/Divider.js +10 -14
  33. package/dist/components/DmIcon.d.ts +0 -1
  34. package/dist/components/DraggableControl.js +57 -49
  35. package/dist/components/Dropdown.d.ts +0 -1
  36. package/dist/components/Dropdown.js +73 -67
  37. package/dist/components/FitText.d.ts +0 -1
  38. package/dist/components/Flex.d.ts +1 -1
  39. package/dist/components/Flex.js +39 -41
  40. package/dist/components/Icon.d.ts +0 -1
  41. package/dist/components/Icon.js +27 -34
  42. package/dist/components/Image.d.ts +0 -1
  43. package/dist/components/Image.js +7 -6
  44. package/dist/components/ImageButton.d.ts +0 -1
  45. package/dist/components/ImageButton.js +87 -170
  46. package/dist/components/InfinitePlane.js +1 -1
  47. package/dist/components/Input.d.ts +0 -1
  48. package/dist/components/Input.js +57 -64
  49. package/dist/components/KeyListener.d.ts +0 -1
  50. package/dist/components/Knob.d.ts +0 -1
  51. package/dist/components/Knob.js +91 -117
  52. package/dist/components/LabeledControls.d.ts +0 -1
  53. package/dist/components/LabeledList.d.ts +0 -1
  54. package/dist/components/LabeledList.js +48 -55
  55. package/dist/components/MenuBar.d.ts +0 -1
  56. package/dist/components/MenuBar.js +93 -102
  57. package/dist/components/Modal.d.ts +0 -1
  58. package/dist/components/Modal.js +11 -18
  59. package/dist/components/NoticeBox.d.ts +0 -1
  60. package/dist/components/NoticeBox.js +16 -43
  61. package/dist/components/NumberInput.d.ts +0 -2
  62. package/dist/components/NumberInput.js +99 -107
  63. package/dist/components/Popper.d.ts +0 -1
  64. package/dist/components/ProgressBar.d.ts +0 -1
  65. package/dist/components/ProgressBar.js +22 -27
  66. package/dist/components/RestrictedInput.js +64 -58
  67. package/dist/components/RoundGauge.d.ts +0 -1
  68. package/dist/components/RoundGauge.js +70 -104
  69. package/dist/components/Section.d.ts +1 -2
  70. package/dist/components/Section.js +50 -51
  71. package/dist/components/Slider.d.ts +0 -1
  72. package/dist/components/Slider.js +72 -80
  73. package/dist/components/Stack.d.ts +0 -1
  74. package/dist/components/Stack.js +37 -47
  75. package/dist/components/StyleableSection.d.ts +0 -1
  76. package/dist/components/StyleableSection.js +11 -11
  77. package/dist/components/Table.d.ts +0 -1
  78. package/dist/components/Table.js +38 -47
  79. package/dist/components/Tabs.d.ts +0 -1
  80. package/dist/components/Tabs.js +43 -75
  81. package/dist/components/TextArea.d.ts +0 -1
  82. package/dist/components/TextArea.js +74 -69
  83. package/dist/components/TimeDisplay.d.ts +7 -6
  84. package/dist/components/TimeDisplay.js +17 -17
  85. package/dist/components/Tooltip.d.ts +1 -2
  86. package/dist/components/Tooltip.js +8 -10
  87. package/dist/components/TrackOutsideClicks.d.ts +0 -1
  88. package/dist/components/VirtualList.d.ts +0 -1
  89. package/package.json +25 -25
  90. package/dist/ProgressBar.module-Jzqlebbx.js +0 -29
  91. package/dist/Section.module-qhQWhlUX.js +0 -18
  92. package/dist/assets/BlockQuote.css +0 -1
  93. package/dist/assets/Button.css +0 -1
  94. package/dist/assets/ColorBox.css +0 -1
  95. package/dist/assets/Dialog.css +0 -1
  96. package/dist/assets/Dimmer.css +0 -1
  97. package/dist/assets/Divider.css +0 -1
  98. package/dist/assets/Flex.css +0 -1
  99. package/dist/assets/Icon.css +0 -6
  100. package/dist/assets/ImageButton.css +0 -5
  101. package/dist/assets/Input.css +0 -1
  102. package/dist/assets/Knob.css +0 -1
  103. package/dist/assets/LabeledList.css +0 -1
  104. package/dist/assets/MenuBar.css +0 -1
  105. package/dist/assets/Modal.css +0 -1
  106. package/dist/assets/NoticeBox.css +0 -1
  107. package/dist/assets/NumberInput.css +0 -1
  108. package/dist/assets/ProgressBar.css +0 -1
  109. package/dist/assets/RoundGauge.css +0 -1
  110. package/dist/assets/Section.css +0 -1
  111. package/dist/assets/Slider.css +0 -1
  112. package/dist/assets/Stack.css +0 -1
  113. package/dist/assets/Table.css +0 -1
  114. package/dist/assets/Tabs.css +0 -1
  115. package/dist/assets/TextArea.css +0 -1
  116. package/dist/assets/Tooltip.css +0 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ yarn add tgui-core
20
20
  Now, you can use them like normal TGUI components.
21
21
 
22
22
  ```tsx
23
- import { Button } from 'tgui-core/components';
23
+ import { Button } from "tgui-core/components";
24
24
 
25
25
  <Button>Click</Button>;
26
26
  ```
@@ -28,8 +28,8 @@ import { Button } from 'tgui-core/components';
28
28
  You can even use it in tandem with your own in house TGUI components,
29
29
 
30
30
  ```tsx
31
- import { Button } from 'tgui-core/components';
32
- import { Box } from '../components';
31
+ import { Button } from "tgui-core/components";
32
+ import { Box } from "../components";
33
33
  ```
34
34
 
35
35
  ## License
@@ -1,24 +1,25 @@
1
- var b = Object.defineProperty;
2
- var l = (i, t, s) => t in i ? b(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
3
- var e = (i, t, s) => l(i, typeof t != "symbol" ? t + "" : t, s);
1
+ var g = Object.defineProperty;
2
+ var u = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var i = (e, t, r) => u(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  class n {
5
- constructor(t = 0, s = 0, r = 0, a = 1) {
6
- e(this, "r");
7
- e(this, "g");
8
- e(this, "b");
9
- e(this, "a");
10
- this.r = t, this.g = s, this.b = r, this.a = a;
5
+ constructor(t = 0, r = 0, s = 0, a = 1) {
6
+ i(this, "r");
7
+ i(this, "g");
8
+ i(this, "b");
9
+ i(this, "a");
10
+ this.r = t, this.g = r, this.b = s, this.a = a;
11
11
  }
12
12
  toString() {
13
13
  let t = this.a;
14
- return typeof t == "string" && (t = parseFloat(this.a)), isNaN(t) && (t = 1), `rgba(${this.r | 0}, ${this.g | 0}, ${this.b | 0}, ${t})`;
14
+ return typeof t == "string" && (t = Number.parseFloat(this.a)), Number.isNaN(t) && (t = 1), `rgba(${this.r | 0}, ${this.g | 0}, ${this.b | 0}, ${t})`;
15
15
  }
16
16
  /** Darkens a color by a given percent. Returns a color, which can have toString called to get it's rgba() css value. */
17
17
  darken(t) {
18
- return t /= 100, new n(
19
- this.r - this.r * t,
20
- this.g - this.g * t,
21
- this.b - this.b * t,
18
+ const r = t / 100;
19
+ return new n(
20
+ this.r - this.r * r,
21
+ this.g - this.g * r,
22
+ this.b - this.b * r,
22
23
  this.a
23
24
  );
24
25
  }
@@ -31,37 +32,37 @@ class n {
31
32
  */
32
33
  static fromHex(t) {
33
34
  return new n(
34
- parseInt(t.slice(1, 3), 16),
35
- parseInt(t.slice(3, 5), 16),
36
- parseInt(t.slice(5, 7), 16)
35
+ Number.parseInt(t.slice(1, 3), 16),
36
+ Number.parseInt(t.slice(3, 5), 16),
37
+ Number.parseInt(t.slice(5, 7), 16)
37
38
  );
38
39
  }
39
40
  /**
40
41
  * Linear interpolation of two colors.
41
42
  */
42
- static lerp(t, s, r) {
43
+ static lerp(t, r, s) {
43
44
  return new n(
44
- (s.r - t.r) * r + t.r,
45
- (s.g - t.g) * r + t.g,
46
- (s.b - t.b) * r + t.b,
47
- (s.a - t.a) * r + t.a
45
+ (r.r - t.r) * s + t.r,
46
+ (r.g - t.g) * s + t.g,
47
+ (r.b - t.b) * s + t.b,
48
+ (r.a - t.a) * s + t.a
48
49
  );
49
50
  }
50
51
  /**
51
52
  * Loops up the color in the provided list of colors
52
53
  * with linear interpolation.
53
54
  */
54
- static lookup(t, s) {
55
- const r = s.length;
56
- if (r < 2)
55
+ static lookup(t, r) {
56
+ const s = r.length;
57
+ if (s < 2)
57
58
  throw new Error("Needs at least two colors!");
58
- const a = t * (r - 1);
59
+ const a = t * (s - 1);
59
60
  if (t < 1e-4)
60
- return s[0];
61
+ return r[0];
61
62
  if (t >= 1 - 1e-4)
62
- return s[r - 1];
63
- const g = a % 1, h = a | 0;
64
- return this.lerp(s[h], s[h + 1], g);
63
+ return r[s - 1];
64
+ const b = a % 1, h = a | 0;
65
+ return n.lerp(r[h], r[h + 1], b);
65
66
  }
66
67
  }
67
68
  export {
@@ -58,10 +58,10 @@ function a() {
58
58
  }
59
59
  let w = null, c = null;
60
60
  const h = [];
61
- function A(t) {
61
+ function $(t) {
62
62
  h.push(t);
63
63
  }
64
- function B(t) {
64
+ function A(t) {
65
65
  const e = h.indexOf(t);
66
66
  e >= 0 && h.splice(e, 1);
67
67
  }
@@ -121,7 +121,7 @@ class p {
121
121
  return this.type === "keyup";
122
122
  }
123
123
  toString() {
124
- return this._str ? this._str : (this._str = "", this.ctrl && (this._str += "Ctrl+"), this.alt && (this._str += "Alt+"), this.shift && (this._str += "Shift+"), this.code >= 48 && this.code <= 90 ? this._str += String.fromCharCode(this.code) : this.code >= K && this.code <= S ? this._str += "F" + (this.code - 111) : this._str += "[" + this.code + "]", this._str);
124
+ return this._str ? this._str : (this._str = "", this.ctrl && (this._str += "Ctrl+"), this.alt && (this._str += "Alt+"), this.shift && (this._str += "Shift+"), this.code >= 48 && this.code <= 90 ? this._str += String.fromCharCode(this.code) : this.code >= K && this.code <= S ? this._str += `F${this.code - 111}` : this._str += `[${this.code}]`, this._str);
125
125
  }
126
126
  }
127
127
  document.addEventListener("keydown", (t) => {
@@ -139,9 +139,9 @@ document.addEventListener("keyup", (t) => {
139
139
  export {
140
140
  C as EventEmitter,
141
141
  p as KeyEvent,
142
- A as addScrollableNode,
142
+ $ as addScrollableNode,
143
143
  E as canStealFocus,
144
144
  o as globalEvents,
145
- B as removeScrollableNode,
145
+ A as removeScrollableNode,
146
146
  W as setupGlobalEvents
147
147
  };
@@ -38,21 +38,21 @@ const d = [
38
38
  "F",
39
39
  "N",
40
40
  "H"
41
- ], l = d.indexOf(" ");
42
- function u(t, n = -l, s = "") {
43
- if (!isFinite(t))
41
+ ], u = d.indexOf(" ");
42
+ function m(t, n = -u, s = "") {
43
+ if (!Number.isFinite(t))
44
44
  return t.toString();
45
- 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)];
46
- let a = (t / Math.pow(1e3, e)).toFixed(2);
47
- return a.endsWith(".00") ? a = a.slice(0, -3) : a.endsWith(".0") && (a = a.slice(0, -2)), `${a} ${i.trim()}${s}`.trim();
48
- }
49
- function S(t, n = 0) {
50
- return u(t, n, "W");
45
+ const o = Math.floor(Math.log10(Math.abs(t))), a = Math.max(n * 3, o), e = Math.floor(a / 3), i = d[Math.min(e + u, d.length - 1)];
46
+ let r = (t / 1e3 ** e).toFixed(2);
47
+ return r.endsWith(".00") ? r = r.slice(0, -3) : r.endsWith(".0") && (r = r.slice(0, -2)), `${r} ${i.trim()}${s}`.trim();
51
48
  }
52
- function $(t, n = 0) {
53
- return u(t, n, "J");
49
+ function M(t, n = 0) {
50
+ return m(t, n, "W");
54
51
  }
55
52
  function b(t, n = 0) {
53
+ return m(t, n, "J");
54
+ }
55
+ function $(t, n = 0) {
56
56
  if (!Number.isFinite(t))
57
57
  return String(t);
58
58
  const s = Number(t.toFixed(n)), o = s < 0, e = Math.abs(s).toString().split(".");
@@ -63,9 +63,9 @@ function b(t, n = 0) {
63
63
  function g(t) {
64
64
  const n = 20 * Math.log10(t), s = n >= 0 ? "+" : "-";
65
65
  let o = Math.abs(n);
66
- return o === 1 / 0 ? o = "Inf" : o = o.toFixed(2), `${s}${o} dB`;
66
+ return o === Number.POSITIVE_INFINITY ? o = "Inf" : o = o.toFixed(2), `${s}${o} dB`;
67
67
  }
68
- const M = [
68
+ const S = [
69
69
  "",
70
70
  "· 10³",
71
71
  // kilo
@@ -91,27 +91,27 @@ const M = [
91
91
  "· 10³⁶",
92
92
  "· 10³⁹"
93
93
  ];
94
- function p(t, n = 0, s = "") {
95
- if (!isFinite(t))
94
+ function N(t, n = 0, s = "") {
95
+ if (!Number.isFinite(t))
96
96
  return "NaN";
97
- 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);
98
- return `${c.toFixed(a)} ${i} ${s}`.trim();
97
+ const o = Math.floor(Math.log10(t)), a = Math.max(n * 3, o), e = Math.floor(a / 3), i = S[e], c = t / 1e3 ** e, r = Math.max(0, 2 - a % 3);
98
+ return `${c.toFixed(r)} ${i} ${s}`.trim();
99
99
  }
100
100
  function F(t, n = "default") {
101
- const s = Math.floor(t / 10), o = Math.floor(s / 3600), r = Math.floor(s % 3600 / 60), e = s % 60;
101
+ const s = Math.floor(t / 10), o = Math.floor(s / 3600), a = Math.floor(s % 3600 / 60), e = s % 60;
102
102
  if (n === "short") {
103
- const f = o > 0 ? `${o}h` : "", m = r > 0 ? `${r}m` : "", h = e > 0 ? `${e}s` : "";
104
- return `${f}${m}${h}`;
103
+ const f = o > 0 ? `${o}h` : "", l = a > 0 ? `${a}m` : "", h = e > 0 ? `${e}s` : "";
104
+ return `${f}${l}${h}`;
105
105
  }
106
- const i = String(o).padStart(2, "0"), c = String(r).padStart(2, "0"), a = String(e).padStart(2, "0");
107
- return `${i}:${c}:${a}`;
106
+ const i = String(o).padStart(2, "0"), c = String(a).padStart(2, "0"), r = String(e).padStart(2, "0");
107
+ return `${i}:${c}:${r}`;
108
108
  }
109
109
  export {
110
110
  g as formatDb,
111
- $ as formatEnergy,
112
- b as formatMoney,
113
- S as formatPower,
114
- p as formatSiBaseTenUnit,
115
- u as formatSiUnit,
111
+ b as formatEnergy,
112
+ $ as formatMoney,
113
+ M as formatPower,
114
+ N as formatSiBaseTenUnit,
115
+ m as formatSiUnit,
116
116
  F as formatTime
117
117
  };
@@ -1,5 +1,4 @@
1
1
  import { KeyEvent } from './events';
2
-
3
2
  /**
4
3
  * Acquires a lock on the hotkey, which prevents it from being
5
4
  * passed through to BYOND.
@@ -30,9 +30,9 @@ function w(t) {
30
30
  if (t >= 48 && t <= 57 || t >= 65 && t <= 90)
31
31
  return String.fromCharCode(t);
32
32
  if (t >= 96 && t <= 105)
33
- return "Numpad" + (t - 96);
33
+ return `Numpad${t - 96}`;
34
34
  if (t >= 112 && t <= 123)
35
- return "F" + (t - 111);
35
+ return `F${t - 111}`;
36
36
  if (t === 188) return ",";
37
37
  if (t === 189) return "-";
38
38
  if (t === 190) return ".";
@@ -37,3 +37,7 @@ export declare function keyOfMatchingRange(value: number, ranges: Record<string,
37
37
  * Get number of digits following the decimal point in a number
38
38
  */
39
39
  export declare function numberOfDecimalDigits(value: number): number;
40
+ /**
41
+ * Ensures the number is valid and not infinite/NaN.
42
+ */
43
+ export declare function isSafeNumber(value: number): boolean;
@@ -1,41 +1,45 @@
1
- function e(t, n, r) {
2
- return t < n ? n : t > r ? r : t;
1
+ function e(n, t, r) {
2
+ return n < t ? t : n > r ? r : n;
3
3
  }
4
- function c(t) {
5
- return t < 0 ? 0 : t > 1 ? 1 : t;
4
+ function u(n) {
5
+ return n < 0 ? 0 : n > 1 ? 1 : n;
6
6
  }
7
- function f(t, n = 0, r = 100) {
8
- return (t - n) / (r - n);
7
+ function f(n, t = 0, r = 100) {
8
+ return (n - t) / (r - t);
9
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)
10
+ function c(n, t) {
11
+ const r = n >= 0 ? 1 : -1;
12
+ return Number.parseFloat(
13
+ (Math.round(n * 10 ** t + r * 1e-4) / 10 ** t).toFixed(t)
14
14
  );
15
15
  }
16
- function s(t, n = 0) {
17
- return Number(t).toFixed(Math.max(n, 0));
16
+ function s(n, t = 0) {
17
+ return Number(n).toFixed(Math.max(t, 0));
18
18
  }
19
- function i(t, n) {
20
- return n && t >= n[0] && t <= n[1];
19
+ function o(n, t) {
20
+ return t && n >= t[0] && n <= t[1];
21
21
  }
22
- function a(t, n) {
23
- for (const r of Object.keys(n)) {
24
- const o = n[r];
25
- if (i(t, o))
22
+ function m(n, t) {
23
+ for (const r of Object.keys(t)) {
24
+ const i = t[r];
25
+ if (o(n, i))
26
26
  return r;
27
27
  }
28
28
  }
29
- function h(t) {
30
- return Math.floor(t) !== t && t.toString().split(".")[1].length || 0;
29
+ function b(n) {
30
+ return Math.floor(n) !== n && n.toString().split(".")[1].length || 0;
31
+ }
32
+ function N(n) {
33
+ return typeof n == "number" && Number.isFinite(n) && !Number.isNaN(n);
31
34
  }
32
35
  export {
33
36
  e as clamp,
34
- c as clamp01,
35
- i as inRange,
36
- a as keyOfMatchingRange,
37
- h as numberOfDecimalDigits,
38
- u as round,
37
+ u as clamp01,
38
+ o as inRange,
39
+ N as isSafeNumber,
40
+ m as keyOfMatchingRange,
41
+ b as numberOfDecimalDigits,
42
+ c as round,
39
43
  f as scale,
40
44
  s as toFixed
41
45
  };
@@ -1,20 +1,21 @@
1
- import { clamp as r } from "./math.js";
2
- function o(t, n) {
3
- return Math.random() * (n - t) + t;
1
+ import { clamp as a } from "./math.js";
2
+ function e(n, o) {
3
+ return Math.random() * (o - n) + n;
4
4
  }
5
- function m(t, n) {
6
- return t = Math.ceil(t), n = Math.floor(n), Math.floor(Math.random() * (n - t) + t);
5
+ function c(n, o) {
6
+ const r = Math.ceil(n), t = Math.floor(o);
7
+ return Math.floor(Math.random() * (t - r) + r);
7
8
  }
8
- function h(t) {
9
- return t[Math.floor(Math.random() * t.length)];
9
+ function h(n) {
10
+ return n[Math.floor(Math.random() * n.length)];
10
11
  }
11
- function c(t) {
12
- const n = r(t, 0, 100) / 100;
13
- return Math.random() <= n;
12
+ function u(n) {
13
+ const o = a(n, 0, 100) / 100;
14
+ return Math.random() <= o;
14
15
  }
15
16
  export {
16
- m as randomInteger,
17
- o as randomNumber,
17
+ c as randomInteger,
18
+ e as randomNumber,
18
19
  h as randomPick,
19
- c as randomProb
20
+ u as randomProb
20
21
  };
@@ -2,7 +2,7 @@ function f(r) {
2
2
  let n = "";
3
3
  for (let t = 0; t < r.length; t++) {
4
4
  const e = r[t];
5
- typeof e == "string" && (n += e + " ");
5
+ typeof e == "string" && (n += `${e} `);
6
6
  }
7
7
  return n;
8
8
  }
@@ -9,7 +9,7 @@ function p(e, t = (r) => JSON.stringify(r)) {
9
9
  }
10
10
  const a = ["a", "e", "i", "o", "u"];
11
11
  function l(e, t, r) {
12
- return t === 1 ? e : r ? e + r : e.endsWith("s") || e.endsWith("x") || e.endsWith("z") || e.endsWith("ch") || e.endsWith("sh") ? e + "es" : e.endsWith("y") && !a.includes(e.charAt(e.length - 2)) ? e.slice(0, -1) + "ies" : e + "s";
12
+ return t === 1 ? e : r ? e + r : e.endsWith("s") || e.endsWith("x") || e.endsWith("z") || e.endsWith("ch") || e.endsWith("sh") ? `${e}es` : e.endsWith("y") && !a.includes(e.charAt(e.length - 2)) ? `${e.slice(0, -1)}ies` : `${e}s`;
13
13
  }
14
14
  function c(e) {
15
15
  return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
@@ -20,7 +20,7 @@ function f(e) {
20
20
  function h(e) {
21
21
  return e.replace(/^\w/, (t) => t.toUpperCase());
22
22
  }
23
- const i = ["Id", "Tv"], s = [
23
+ const i = ["Id", "Tv"], u = [
24
24
  "A",
25
25
  "An",
26
26
  "And",
@@ -46,17 +46,17 @@ const i = ["Id", "Tv"], s = [
46
46
  function g(e) {
47
47
  if (!e) return e;
48
48
  let t = e.replace(/([^\W_]+[^\s-]*) */g, (r) => c(r));
49
- for (const r of s) {
50
- const n = new RegExp("\\s" + r + "\\s", "g");
49
+ for (const r of u) {
50
+ const n = new RegExp(`\\s${r}\\s`, "g");
51
51
  t = t.replace(n, (o) => o.toLowerCase());
52
52
  }
53
53
  for (const r of i) {
54
- const n = new RegExp("\\b" + r + "\\b", "g");
54
+ const n = new RegExp(`\\b${r}\\b`, "g");
55
55
  t = t.replace(n, (o) => o.toLowerCase());
56
56
  }
57
57
  return t;
58
58
  }
59
- const u = {
59
+ const s = {
60
60
  amp: "&",
61
61
  apos: "'",
62
62
  gt: ">",
@@ -68,12 +68,12 @@ function d(e) {
68
68
  return e && e.replace(/<br>/gi, `
69
69
  `).replace(/<\/?[a-z0-9-_]+[^>]*>/gi, "").replace(
70
70
  /&(nbsp|amp|quot|lt|gt|apos);/g,
71
- (t, r) => u[r]
71
+ (t, r) => s[r]
72
72
  ).replace(/&#?([0-9]+);/gi, (t, r) => {
73
- const n = parseInt(r, 10);
73
+ const n = Number.parseInt(r, 10);
74
74
  return String.fromCharCode(n);
75
75
  }).replace(/&#x?([0-9a-f]+);/gi, (t, r) => {
76
- const n = parseInt(r, 16);
76
+ const n = Number.parseInt(r, 16);
77
77
  return String.fromCharCode(n);
78
78
  });
79
79
  }
@@ -6,4 +6,4 @@
6
6
  * logger.log(getShallowTypes(data));
7
7
  * ```
8
8
  */
9
- export declare function getShallowTypes(data: Record<string, any>): Record<string, any>;
9
+ export declare function getShallowTypes(data: Record<string, unknown>): Record<string, unknown>;
@@ -1,6 +1,10 @@
1
1
  import { Component } from 'react';
2
-
3
2
  type Props = {
3
+ /**
4
+ * The target value to approach.
5
+ */
6
+ value: number;
7
+ } & Partial<{
4
8
  /**
5
9
  * If provided, a function that formats the inner string. By default,
6
10
  * attempts to match the numeric precision of `value`.
@@ -12,11 +16,7 @@ type Props = {
12
16
  * animating.
13
17
  */
14
18
  initial?: number;
15
- /**
16
- * The target value to approach.
17
- */
18
- value: number;
19
- };
19
+ }>;
20
20
  /**
21
21
  * An animated number label. Shows a number, formatted with an optionally
22
22
  * provided function, and animates it towards its target value.
@@ -1,14 +1,11 @@
1
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 {
2
+ var p = (r, i, t) => i in r ? f(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
3
+ var s = (r, i, t) => p(r, typeof i != "symbol" ? i + "" : i, t);
4
+ import { jsx as v } from "react/jsx-runtime";
5
+ import { Component as m, createRef as g } from "react";
6
+ import { isSafeNumber as o, toFixed as d, clamp as T } from "../common/math.js";
7
+ const V = 1e3 / 60, u = 0.8333, l = 1e-3;
8
+ class b extends m {
12
9
  constructor(t) {
13
10
  super(t);
14
11
  /**
@@ -53,24 +50,24 @@ class S extends v {
53
50
  */
54
51
  tick() {
55
52
  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());
53
+ o(e) ? this.currentValue = t * u + e * (1 - u) : 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
54
  }
58
55
  /**
59
56
  * Gets the inner text of the span.
60
57
  */
61
58
  getText() {
62
- const { props: t, currentValue: e } = this, { format: n, value: u } = t;
63
- if (!o(u))
64
- return String(u);
59
+ const { props: t, currentValue: e } = this, { format: n, value: a } = t;
60
+ if (!o(a))
61
+ return String(a);
65
62
  if (n)
66
63
  return n(this.currentValue);
67
- const c = String(u).split(".")[1], h = c ? c.length : 0;
64
+ const c = String(a).split(".")[1], h = c ? c.length : 0;
68
65
  return d(e, T(h, 0, 8));
69
66
  }
70
67
  render() {
71
- return /* @__PURE__ */ m("span", { ref: this.ref, children: this.getText() });
68
+ return /* @__PURE__ */ v("span", { ref: this.ref, children: this.getText() });
72
69
  }
73
70
  }
74
71
  export {
75
- S as AnimatedNumber
72
+ b as AnimatedNumber
76
73
  };
@@ -1,4 +1,3 @@
1
1
  import { PropsWithChildren } from 'react';
2
-
3
2
  /** Used to force the window to steal focus on load. Children optional */
4
3
  export declare function Autofocus(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import { Component, PropsWithChildren } from 'react';
2
-
3
2
  type Props = Partial<{
4
3
  /**
5
4
  * The interval between blinks, in milliseconds.
@@ -1,3 +1,2 @@
1
1
  import { BoxProps } from './Box';
2
-
3
2
  export declare function BlockQuote(props: BoxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,9 @@
1
- import { jsx as c } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
2
  import { classes as e } from "../common/react.js";
3
- import { Box as r } from "./Box.js";
4
- import '../assets/BlockQuote.css';const l = "_blockQuote_14fvy_13", m = {
5
- blockQuote: l
6
- };
3
+ import { Box as m } from "./Box.js";
7
4
  function f(o) {
8
- const { className: t, ...s } = o;
9
- return /* @__PURE__ */ c(r, { className: e([m.blockQuote, t]), ...s });
5
+ const { className: r, ...s } = o;
6
+ return /* @__PURE__ */ t(m, { className: e(["BlockQuote", r]), ...s });
10
7
  }
11
8
  export {
12
9
  f as BlockQuote
@@ -1,6 +1,5 @@
1
1
  import { CSSProperties, KeyboardEventHandler, MouseEventHandler, ReactNode, UIEventHandler } from 'react';
2
2
  import { BooleanLike } from '../common/react';
3
-
4
3
  type BooleanProps = Partial<Record<keyof typeof booleanStyleMap, boolean>>;
5
4
  type StringProps = Partial<Record<keyof typeof stringStyleMap, string | BooleanLike>>;
6
5
  export type EventHandlers = Partial<{
@@ -3,9 +3,9 @@ import { CSS_COLORS as b } from "../common/constants.js";
3
3
  import { classes as u } from "../common/react.js";
4
4
  function p(o) {
5
5
  if (typeof o == "string")
6
- return o.endsWith("px") ? parseFloat(o) / 12 + "rem" : o;
6
+ return o.endsWith("px") ? `${Number.parseFloat(o) / 12}rem` : o;
7
7
  if (typeof o == "number")
8
- return o + "rem";
8
+ return `${o}rem`;
9
9
  }
10
10
  function r(o) {
11
11
  if (typeof o == "string")
@@ -109,8 +109,8 @@ function S(o) {
109
109
  function d(o) {
110
110
  const t = o.textColor || o.color, i = o.backgroundColor;
111
111
  return u([
112
- a(t) && "color-" + t,
113
- a(i) && "color-bg-" + i
112
+ a(t) && `color-${t}`,
113
+ a(i) && `color-bg-${i}`
114
114
  ]);
115
115
  }
116
116
  function W(o) {
@@ -2,7 +2,6 @@ import { Placement } from '@popperjs/core';
2
2
  import { ReactNode } from 'react';
3
3
  import { BooleanLike } from '../common/react';
4
4
  import { BoxProps } from './Box';
5
-
6
5
  /**
7
6
  * Getting ellipses to work requires that you use:
8
7
  * 1. A string rather than a node