tgui-core 2.0.6 → 2.1.0

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 (120) hide show
  1. package/dist/common/collections.d.ts +1 -1
  2. package/dist/common/collections.js +1 -10
  3. package/dist/common/color.js +1 -70
  4. package/dist/common/constants.js +1 -329
  5. package/dist/common/events.js +1 -147
  6. package/dist/common/exhaustive.js +1 -6
  7. package/dist/common/format.js +1 -117
  8. package/dist/common/fp.js +1 -9
  9. package/dist/common/hotkeys.d.ts +1 -1
  10. package/dist/common/hotkeys.js +1 -112
  11. package/dist/common/http.js +1 -10
  12. package/dist/common/keycodes.js +1 -88
  13. package/dist/common/keys.js +1 -32
  14. package/dist/common/math.js +1 -45
  15. package/dist/common/random.js +1 -21
  16. package/dist/common/react.js +1 -30
  17. package/dist/common/string.js +1 -88
  18. package/dist/common/timer.js +1 -28
  19. package/dist/common/type-utils.js +1 -25
  20. package/dist/common/ui.d.ts +2 -2
  21. package/dist/common/ui.js +1 -141
  22. package/dist/common/uuid.js +1 -10
  23. package/dist/common/vector.js +1 -48
  24. package/dist/components/AnimatedNumber.d.ts +1 -1
  25. package/dist/components/AnimatedNumber.js +1 -73
  26. package/dist/components/Autofocus.d.ts +1 -1
  27. package/dist/components/Autofocus.js +1 -17
  28. package/dist/components/Blink.d.ts +1 -1
  29. package/dist/components/Blink.js +1 -56
  30. package/dist/components/BlockQuote.d.ts +1 -1
  31. package/dist/components/BlockQuote.js +1 -10
  32. package/dist/components/Box.d.ts +5 -5
  33. package/dist/components/Box.js +1 -19
  34. package/dist/components/Button.d.ts +4 -4
  35. package/dist/components/Button.js +1 -258
  36. package/dist/components/ByondUi.d.ts +1 -1
  37. package/dist/components/ByondUi.js +1 -61
  38. package/dist/components/Chart.d.ts +1 -1
  39. package/dist/components/Chart.js +1 -80
  40. package/dist/components/Collapsible.d.ts +2 -2
  41. package/dist/components/Collapsible.js +1 -36
  42. package/dist/components/ColorBox.d.ts +2 -2
  43. package/dist/components/ColorBox.js +1 -17
  44. package/dist/components/Dialog.d.ts +1 -1
  45. package/dist/components/Dialog.js +1 -42
  46. package/dist/components/Dimmer.d.ts +1 -1
  47. package/dist/components/Dimmer.js +1 -10
  48. package/dist/components/Divider.js +1 -18
  49. package/dist/components/DmIcon.d.ts +3 -3
  50. package/dist/components/DmIcon.js +1 -23
  51. package/dist/components/DraggableControl.d.ts +2 -2
  52. package/dist/components/DraggableControl.js +1 -111
  53. package/dist/components/Dropdown.d.ts +2 -2
  54. package/dist/components/Dropdown.js +1 -165
  55. package/dist/components/FitText.d.ts +2 -2
  56. package/dist/components/FitText.js +1 -63
  57. package/dist/components/Flex.d.ts +1 -1
  58. package/dist/components/Flex.js +1 -70
  59. package/dist/components/Floating.d.ts +3 -3
  60. package/dist/components/Floating.js +1 -2235
  61. package/dist/components/Icon.d.ts +2 -2
  62. package/dist/components/Icon.js +1 -45
  63. package/dist/components/Image.d.ts +1 -1
  64. package/dist/components/Image.js +1 -38
  65. package/dist/components/ImageButton.d.ts +10 -5
  66. package/dist/components/ImageButton.js +1 -154
  67. package/dist/components/InfinitePlane.d.ts +2 -2
  68. package/dist/components/InfinitePlane.js +1 -133
  69. package/dist/components/Input.d.ts +2 -2
  70. package/dist/components/Input.js +1 -96
  71. package/dist/components/KeyListener.d.ts +1 -1
  72. package/dist/components/KeyListener.js +1 -15
  73. package/dist/components/Knob.d.ts +2 -2
  74. package/dist/components/Knob.js +1 -133
  75. package/dist/components/LabeledControls.d.ts +1 -1
  76. package/dist/components/LabeledControls.js +1 -39
  77. package/dist/components/LabeledList.d.ts +2 -2
  78. package/dist/components/LabeledList.js +1 -89
  79. package/dist/components/MenuBar.d.ts +32 -0
  80. package/dist/components/MenuBar.js +1 -133
  81. package/dist/components/Modal.d.ts +2 -2
  82. package/dist/components/Modal.js +1 -22
  83. package/dist/components/NoticeBox.d.ts +1 -1
  84. package/dist/components/NoticeBox.js +1 -23
  85. package/dist/components/NumberInput.d.ts +9 -19
  86. package/dist/components/NumberInput.js +1 -213
  87. package/dist/components/Popper.d.ts +8 -9
  88. package/dist/components/Popper.js +1 -1082
  89. package/dist/components/ProgressBar.d.ts +2 -2
  90. package/dist/components/ProgressBar.js +1 -33
  91. package/dist/components/RestrictedInput.d.ts +29 -0
  92. package/dist/components/RestrictedInput.js +1 -161
  93. package/dist/components/RoundGauge.d.ts +2 -2
  94. package/dist/components/RoundGauge.js +1 -114
  95. package/dist/components/Section.d.ts +2 -2
  96. package/dist/components/Section.js +1 -65
  97. package/dist/components/Slider.d.ts +2 -2
  98. package/dist/components/Slider.js +1 -113
  99. package/dist/components/Stack.d.ts +2 -2
  100. package/dist/components/Stack.js +1 -58
  101. package/dist/components/StyleableSection.d.ts +1 -1
  102. package/dist/components/StyleableSection.js +1 -16
  103. package/dist/components/Table.d.ts +1 -1
  104. package/dist/components/Table.js +1 -57
  105. package/dist/components/Tabs.d.ts +2 -2
  106. package/dist/components/Tabs.js +1 -65
  107. package/dist/components/TextArea.d.ts +2 -2
  108. package/dist/components/TextArea.js +1 -126
  109. package/dist/components/TimeDisplay.js +1 -25
  110. package/dist/components/Tooltip.d.ts +2 -2
  111. package/dist/components/Tooltip.js +1 -18
  112. package/dist/components/TrackOutsideClicks.d.ts +2 -2
  113. package/dist/components/TrackOutsideClicks.js +1 -24
  114. package/dist/components/VirtualList.d.ts +1 -1
  115. package/dist/components/VirtualList.js +1 -34
  116. package/dist/components/index.js +1 -96
  117. package/license.txt +1 -1
  118. package/package.json +11 -17
  119. package/styles/components/Button.scss +1 -1
  120. package/dist/components/FakeTerminal.js +0 -38
@@ -1,117 +1 @@
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
- ], u = d.indexOf(" ");
42
- function m(t, n = -u, s = "") {
43
- if (!Number.isFinite(t))
44
- return t.toString();
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();
48
- }
49
- function M(t, n = 0) {
50
- return m(t, n, "W");
51
- }
52
- function b(t, n = 0) {
53
- return m(t, n, "J");
54
- }
55
- function $(t, n = 0) {
56
- if (!Number.isFinite(t))
57
- return String(t);
58
- const s = Number(t.toFixed(n)), o = s < 0, e = Math.abs(s).toString().split(".");
59
- e[0] = e[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
60
- const i = e.join(".");
61
- return o ? `-${i}` : i;
62
- }
63
- function g(t) {
64
- const n = 20 * Math.log10(t), s = n >= 0 ? "+" : "-";
65
- let o = Math.abs(n);
66
- return o === Number.POSITIVE_INFINITY ? o = "Inf" : o = o.toFixed(2), `${s}${o} dB`;
67
- }
68
- const S = [
69
- "",
70
- "· 10³",
71
- // kilo
72
- "· 10⁶",
73
- // mega
74
- "· 10⁹",
75
- // giga
76
- "· 10¹²",
77
- // tera
78
- "· 10¹⁵",
79
- // peta
80
- "· 10¹⁸",
81
- // exa
82
- "· 10²¹",
83
- // zetta
84
- "· 10²⁴",
85
- // yotta
86
- "· 10²⁷",
87
- // ronna
88
- "· 10³⁰",
89
- // quecca
90
- "· 10³³",
91
- "· 10³⁶",
92
- "· 10³⁹"
93
- ];
94
- function N(t, n = 0, s = "") {
95
- if (!Number.isFinite(t))
96
- return "NaN";
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
- }
100
- function F(t, n = "default") {
101
- const s = Math.floor(t / 10), o = Math.floor(s / 3600), a = Math.floor(s % 3600 / 60), e = s % 60;
102
- if (n === "short") {
103
- const f = o > 0 ? `${o}h` : "", l = a > 0 ? `${a}m` : "", h = e > 0 ? `${e}s` : "";
104
- return `${f}${l}${h}`;
105
- }
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
- }
109
- export {
110
- g as formatDb,
111
- b as formatEnergy,
112
- $ as formatMoney,
113
- M as formatPower,
114
- N as formatSiBaseTenUnit,
115
- m as formatSiUnit,
116
- F as formatTime
117
- };
1
+ let t=["f","p","n","μ","m"," ","k","M","G","T","P","E","Z","Y","R","Q","F","N","H"],r=t.indexOf(" ");function e(n,i=-r,o=""){if(!Number.isFinite(n))return n.toString();let a=Math.floor(Math.max(3*i,Math.floor(Math.log10(Math.abs(n))))/3),f=t[Math.min(a+r,t.length-1)],l=(n/1e3**a).toFixed(2);return l.endsWith(".00")?l=l.slice(0,-3):l.endsWith(".0")&&(l=l.slice(0,-2)),`${l} ${f.trim()}${o}`.trim()}function n(t,r=0){return e(t,r,"W")}function i(t,r=0){return e(t,r,"J")}function o(t,r=0){if(!Number.isFinite(t))return String(t);let e=Number(t.toFixed(r)),n=Math.abs(e).toString().split(".");n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g," ");let i=n.join(".");return e<0?`-${i}`:i}function a(t){let r=20*Math.log10(t),e=Math.abs(r);return e=e===Number.POSITIVE_INFINITY?"Inf":e.toFixed(2),`${r>=0?"+":"-"}${e} dB`}let f=["","\xb7 10\xb3","\xb7 10⁶","\xb7 10⁹","\xb7 10\xb9\xb2","\xb7 10\xb9⁵","\xb7 10\xb9⁸","\xb7 10\xb2\xb9","\xb7 10\xb2⁴","\xb7 10\xb2⁷","\xb7 10\xb3⁰","\xb7 10\xb3\xb3","\xb7 10\xb3⁶","\xb7 10\xb3⁹"];function l(t,r=0,e=""){if(!Number.isFinite(t))return"NaN";let n=Math.max(3*r,Math.floor(Math.log10(t))),i=Math.floor(n/3),o=f[i],a=Math.max(0,2-n%3),u=(t/1e3**i).toFixed(a);return`${u} ${o} ${e}`.trim()}function u(t,r="default"){let e=Math.floor(t/10),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;if("short"===r){let t=n>0?`${n}h`:"",r=i>0?`${i}m`:"",e=o>0?`${o}s`:"";return`${t}${r}${e}`}let a=String(n).padStart(2,"0"),f=String(i).padStart(2,"0"),l=String(o).padStart(2,"0");return`${a}:${f}:${l}`}export{a as formatDb,i as formatEnergy,o as formatMoney,n as formatPower,l as formatSiBaseTenUnit,e as formatSiUnit,u as formatTime};
package/dist/common/fp.js CHANGED
@@ -1,9 +1 @@
1
- const n = (...t) => (e, ...f) => {
2
- let o = e;
3
- for (const r of t)
4
- Array.isArray(r) ? o = n(...r)(o, ...f) : r && (o = r(o, ...f));
5
- return o;
6
- };
7
- export {
8
- n as flow
9
- };
1
+ let r=(...e)=>(t,...l)=>{let o=t;for(let t of e)Array.isArray(t)?o=r(...t)(o,...l):t&&(o=t(o,...l));return o};export{r as flow};
@@ -1,4 +1,4 @@
1
- import { KeyEvent } from './events';
1
+ import { type KeyEvent } from './events';
2
2
  /**
3
3
  * Acquires a lock on the hotkey, which prevents it from being
4
4
  * passed through to BYOND.
@@ -1,112 +1 @@
1
- import { globalEvents as a } from "./events.js";
2
- import { KEY_ESCAPE as m, KEY_ENTER as h, KEY_SPACE as p, KEY_TAB as E, KEY_CTRL as d, KEY_SHIFT as g, KEY_UP as B, KEY_DOWN as T, KEY_LEFT as b, KEY_RIGHT as S, KEY_F5 as Y } from "./keycodes.js";
3
- const K = {}, c = [
4
- m,
5
- h,
6
- p,
7
- E,
8
- d,
9
- g,
10
- B,
11
- T,
12
- b,
13
- S,
14
- Y
15
- ], i = {}, u = [];
16
- function _(n) {
17
- if (n === 16) return "Shift";
18
- if (n === 17) return "Ctrl";
19
- if (n === 18) return "Alt";
20
- if (n === 33) return "Northeast";
21
- if (n === 34) return "Southeast";
22
- if (n === 35) return "Southwest";
23
- if (n === 36) return "Northwest";
24
- if (n === 37) return "West";
25
- if (n === 38) return "North";
26
- if (n === 39) return "East";
27
- if (n === 40) return "South";
28
- if (n === 45) return "Insert";
29
- if (n === 46) return "Delete";
30
- if (n >= 48 && n <= 57 || n >= 65 && n <= 90)
31
- return String.fromCharCode(n);
32
- if (n >= 96 && n <= 105)
33
- return `Numpad${n - 96}`;
34
- if (n >= 112 && n <= 123)
35
- return `F${n - 111}`;
36
- if (n === 188) return ",";
37
- if (n === 189) return "-";
38
- if (n === 190) return ".";
39
- }
40
- function y(n) {
41
- const t = String(n);
42
- if (t === "Ctrl+F5" || t === "Ctrl+R") {
43
- location.reload();
44
- return;
45
- }
46
- if (t === "Ctrl+F" || n.event.defaultPrevented || n.isModifierKey() || c.includes(n.code))
47
- return;
48
- const o = _(n.code);
49
- if (!o)
50
- return;
51
- const s = K[o];
52
- if (s)
53
- return Byond.command(s);
54
- if (n.isDown() && !i[o]) {
55
- i[o] = !0;
56
- const r = `${globalThis.ByondKeyDown} "${o}"`;
57
- return Byond.command(r);
58
- }
59
- if (n.isUp() && i[o]) {
60
- i[o] = !1;
61
- const r = `${globalThis.ByondKeyUp} "${o}"`;
62
- return Byond.command(r);
63
- }
64
- }
65
- function N(n) {
66
- c.push(n);
67
- }
68
- function U(n) {
69
- const t = c.indexOf(n);
70
- t >= 0 && c.splice(t, 1);
71
- }
72
- function w() {
73
- for (const n in i)
74
- i[n] && (i[n] = !1, Byond.command(`${globalThis.ByondKeyUp} "${n}"`));
75
- }
76
- function D() {
77
- globalThis.ByondKeyUp || (globalThis.ByondKeyUp = "KeyUp", globalThis.ByondKeyDown = "KeyDown"), Byond.winget("default.*").then((n) => {
78
- const t = {};
79
- for (const r in n) {
80
- const f = r.split("."), e = f[1], l = f[2];
81
- e && l && (t[e] || (t[e] = {}), t[e][l] = n[r]);
82
- }
83
- const o = /\\"/g;
84
- function s(r) {
85
- return r.substring(1, r.length - 1).replace(o, '"');
86
- }
87
- for (const r in t) {
88
- const f = t[r], e = s(f.name);
89
- K[e] = s(f.command);
90
- }
91
- }), a.on("window-blur", () => {
92
- w();
93
- }), a.on("key", (n) => {
94
- for (const t of u)
95
- t(n);
96
- y(n);
97
- });
98
- }
99
- function H(n) {
100
- u.push(n);
101
- let t = !1;
102
- return () => {
103
- t || (t = !0, u.splice(u.indexOf(n), 1));
104
- };
105
- }
106
- export {
107
- N as acquireHotKey,
108
- H as listenForKeyEvents,
109
- w as releaseHeldKeys,
110
- U as releaseHotKey,
111
- D as setupHotKeys
112
- };
1
+ import*as e from"./events.js";import*as t from"./keycodes.js";let o={},n=[t.KEY_ESCAPE,t.KEY_ENTER,t.KEY_SPACE,t.KEY_TAB,t.KEY_CTRL,t.KEY_SHIFT,t.KEY_UP,t.KEY_DOWN,t.KEY_LEFT,t.KEY_RIGHT,t.KEY_F5],l={},r=[];function i(e){n.push(e)}function s(e){let t=n.indexOf(e);t>=0&&n.splice(t,1)}function d(){for(let e in l)l[e]&&(l[e]=!1,Byond.command(`${globalThis.ByondKeyUp} "${e}"`))}function a(){globalThis.ByondKeyUp||(globalThis.ByondKeyUp="KeyUp",globalThis.ByondKeyDown="KeyDown"),Byond.winget("default.*").then(e=>{let t={};for(let o in e){let n=o.split("."),l=n[1],r=n[2];l&&r&&(t[l]||(t[l]={}),t[l][r]=e[o])}let n=/\\"/g;function l(e){return e.substring(1,e.length-1).replace(n,'"')}for(let e in t){let n=t[e];o[l(n.name)]=l(n.command)}}),e.globalEvents.on("window-blur",()=>{d()}),e.globalEvents.on("key",e=>{for(let t of r)t(e);!function(e){var t;let r=String(e);if("Ctrl+F5"===r||"Ctrl+R"===r)return location.reload();if("Ctrl+F"===r||e.event.defaultPrevented||e.isModifierKey()||n.includes(e.code))return;let i=16===(t=e.code)?"Shift":17===t?"Ctrl":18===t?"Alt":33===t?"Northeast":34===t?"Southeast":35===t?"Southwest":36===t?"Northwest":37===t?"West":38===t?"North":39===t?"East":40===t?"South":45===t?"Insert":46===t?"Delete":t>=48&&t<=57||t>=65&&t<=90?String.fromCharCode(t):t>=96&&t<=105?`Numpad${t-96}`:t>=112&&t<=123?`F${t-111}`:188===t?",":189===t?"-":190===t?".":void 0;if(!i)return;let s=o[i];if(s)return Byond.command(s);if(e.isDown()&&!l[i]){l[i]=!0;let e=`${globalThis.ByondKeyDown} "${i}"`;return Byond.command(e)}if(e.isUp()&&l[i]){l[i]=!1;let e=`${globalThis.ByondKeyUp} "${i}"`;Byond.command(e)}}(e)})}function f(e){r.push(e);let t=!1;return()=>{t||(t=!0,r.splice(r.indexOf(e),1))}}export{i as acquireHotKey,f as listenForKeyEvents,d as releaseHeldKeys,s as releaseHotKey,a as setupHotKeys};
@@ -1,10 +1 @@
1
- function h(e, t, c = 1e3) {
2
- return fetch(e, t).catch(() => new Promise((n) => {
3
- setTimeout(() => {
4
- h(e, t, c).then(n);
5
- }, c);
6
- }));
7
- }
8
- export {
9
- h as fetchRetry
10
- };
1
+ function e(t,c,n=1e3){return fetch(t,c).catch(()=>new Promise(r=>{setTimeout(()=>{e(t,c,n).then(r)},n)}))}export{e as fetchRetry};
@@ -1,88 +1 @@
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
- };
1
+ let E=8,K=9,_=13,Y=16,A=17,F=18,T=19,S=20,C=27,L=32,P=33,O=34,R=35,I=36,N=37,H=38,U=39,B=40,D=45,M=46,G=48,Q=49,W=50,e=51,t=52,l=53,o=54,p=55,r=56,x=57,J=65,V=66,X=67,Z=68,a=69,b=70,c=71,d=72,f=73,g=74,h=75,i=76,j=77,k=78,m=79,n=80,q=81,s=82,u=83,v=84,w=85,y=86,z=87,$=88,EE=89,EK=90,E_=112,EY=113,EA=114,EF=115,ET=116,ES=117,EC=118,EL=119,EP=120,EO=121,ER=122,EI=123,EN=186,EH=187,EU=188,EB=189,ED=190,EM=191,EG=219,EQ=220,EW=221,Ee=222;export{G as KEY_0,Q as KEY_1,W as KEY_2,e as KEY_3,t as KEY_4,l as KEY_5,o as KEY_6,p as KEY_7,r as KEY_8,x as KEY_9,J as KEY_A,F as KEY_ALT,V as KEY_B,EQ as KEY_BACKSLASH,E as KEY_BACKSPACE,X as KEY_C,S as KEY_CAPSLOCK,EU as KEY_COMMA,A as KEY_CTRL,Z as KEY_D,M as KEY_DELETE,B as KEY_DOWN,a as KEY_E,R as KEY_END,_ as KEY_ENTER,EH as KEY_EQUAL,C as KEY_ESCAPE,b as KEY_F,E_ as KEY_F1,EO as KEY_F10,ER as KEY_F11,EI as KEY_F12,EY as KEY_F2,EA as KEY_F3,EF as KEY_F4,ET as KEY_F5,ES as KEY_F6,EC as KEY_F7,EL as KEY_F8,EP as KEY_F9,c as KEY_G,d as KEY_H,I as KEY_HOME,f as KEY_I,D as KEY_INSERT,g as KEY_J,h as KEY_K,i as KEY_L,N as KEY_LEFT,EG as KEY_LEFT_BRACKET,j as KEY_M,EB as KEY_MINUS,k as KEY_N,m as KEY_O,n as KEY_P,O as KEY_PAGEDOWN,P as KEY_PAGEUP,T as KEY_PAUSE,ED as KEY_PERIOD,q as KEY_Q,Ee as KEY_QUOTE,s as KEY_R,U as KEY_RIGHT,EW as KEY_RIGHT_BRACKET,u as KEY_S,EN as KEY_SEMICOLON,Y as KEY_SHIFT,EM as KEY_SLASH,L as KEY_SPACE,v as KEY_T,K as KEY_TAB,w as KEY_U,H as KEY_UP,y as KEY_V,z as KEY_W,$ as KEY_X,EE as KEY_Y,EK as KEY_Z};
@@ -1,32 +1 @@
1
- var n = /* @__PURE__ */ ((r) => (r.A = "a", r.Alt = "Alt", r.Backspace = "Backspace", r.Control = "Control", r.D = "d", r.Delete = "Delete", r.Down = "ArrowDown", r.E = "e", r.End = "End", r.Enter = "Enter", r.Esc = "Esc", r.Escape = "Escape", r.Home = "Home", r.Insert = "Insert", r.Left = "ArrowLeft", r.N = "n", r.PageDown = "PageDown", r.PageUp = "PageUp", r.Right = "ArrowRight", r.S = "s", r.Shift = "Shift", r.Space = " ", r.Tab = "Tab", r.Up = "ArrowUp", r.W = "w", r.Z = "z", r))(n || {});
2
- function e(r) {
3
- return r === "Esc" || r === "Escape";
4
- }
5
- function a(r) {
6
- return r >= "a" && r <= "z";
7
- }
8
- function i(r) {
9
- return r >= "0" && r <= "9";
10
- }
11
- function s(r) {
12
- return r === "n" || r === "s" || r === "w" || r === "e";
13
- }
14
- function t(r) {
15
- return r === "ArrowUp" || r === "ArrowDown" || r === "ArrowLeft" || r === "ArrowRight";
16
- }
17
- function o(r) {
18
- return r === "w" || r === "a" || r === "s" || r === "d";
19
- }
20
- function c(r) {
21
- return o(r) || t(r);
22
- }
23
- export {
24
- n as KEY,
25
- a as isAlphabetic,
26
- t as isArrow,
27
- s as isCardinal,
28
- e as isEscape,
29
- c as isMovement,
30
- i as isNumeric,
31
- o as isWasd
32
- };
1
+ var r,e=((r={}).A="a",r.Alt="Alt",r.Backspace="Backspace",r.Control="Control",r.D="d",r.Delete="Delete",r.Down="ArrowDown",r.E="e",r.End="End",r.Enter="Enter",r.Esc="Esc",r.Escape="Escape",r.Home="Home",r.Insert="Insert",r.Left="ArrowLeft",r.N="n",r.PageDown="PageDown",r.PageUp="PageUp",r.Right="ArrowRight",r.S="s",r.Shift="Shift",r.Space=" ",r.Tab="Tab",r.Up="ArrowUp",r.W="w",r.Z="z",r);function n(r){return"Esc"===r||"Escape"===r}function t(r){return r>="a"&&r<="z"}function o(r){return r>="0"&&r<="9"}function a(r){return"n"===r||"s"===r||"w"===r||"e"===r}function s(r){return"ArrowUp"===r||"ArrowDown"===r||"ArrowLeft"===r||"ArrowRight"===r}function i(r){return"w"===r||"a"===r||"s"===r||"d"===r}function c(r){return i(r)||s(r)}export{e as KEY,t as isAlphabetic,s as isArrow,a as isCardinal,n as isEscape,c as isMovement,o as isNumeric,i as isWasd};
@@ -1,45 +1 @@
1
- function e(n, t, r) {
2
- return n < t ? t : n > r ? r : n;
3
- }
4
- function u(n) {
5
- return n < 0 ? 0 : n > 1 ? 1 : n;
6
- }
7
- function f(n, t = 0, r = 100) {
8
- return (n - t) / (r - t);
9
- }
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
- );
15
- }
16
- function s(n, t = 0) {
17
- return Number(n).toFixed(Math.max(t, 0));
18
- }
19
- function o(n, t) {
20
- return t && n >= t[0] && n <= t[1];
21
- }
22
- function m(n, t) {
23
- for (const r of Object.keys(t)) {
24
- const i = t[r];
25
- if (o(n, i))
26
- return r;
27
- }
28
- }
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);
34
- }
35
- export {
36
- e as clamp,
37
- u as clamp01,
38
- o as inRange,
39
- N as isSafeNumber,
40
- m as keyOfMatchingRange,
41
- b as numberOfDecimalDigits,
42
- c as round,
43
- f as scale,
44
- s as toFixed
45
- };
1
+ function n(n,t,e){return n<t?t:n>e?e:n}function t(n){return n<0?0:n>1?1:n}function e(n,t=0,r=100){return(n-t)/(r-t)}function r(n,t){return Number.parseFloat((Math.round(n*10**t+1e-4*(n>=0?1:-1))/10**t).toFixed(t))}function u(n,t=0){return Number(n).toFixed(Math.max(t,0))}function i(n,t){return t&&n>=t[0]&&n<=t[1]}function o(n,t){for(let e of Object.keys(t))if(i(n,t[e]))return e}function f(n){return Math.floor(n)!==n&&n.toString().split(".")[1].length||0}function a(n){return"number"==typeof n&&Number.isFinite(n)&&!Number.isNaN(n)}export{n as clamp,t as clamp01,i as inRange,a as isSafeNumber,o as keyOfMatchingRange,f as numberOfDecimalDigits,r as round,e as scale,u as toFixed};
@@ -1,21 +1 @@
1
- import { clamp as a } from "./math.js";
2
- function e(n, o) {
3
- return Math.random() * (o - n) + n;
4
- }
5
- function c(n, o) {
6
- const r = Math.ceil(n), t = Math.floor(o);
7
- return Math.floor(Math.random() * (t - r) + r);
8
- }
9
- function h(n) {
10
- return n[Math.floor(Math.random() * n.length)];
11
- }
12
- function u(n) {
13
- const o = a(n, 0, 100) / 100;
14
- return Math.random() <= o;
15
- }
16
- export {
17
- c as randomInteger,
18
- e as randomNumber,
19
- h as randomPick,
20
- u as randomProb
21
- };
1
+ import*as r from"./math.js";function n(r,n){return Math.random()*(n-r)+r}function o(r,n){let o=Math.ceil(r);return Math.floor(Math.random()*(Math.floor(n)-o)+o)}function t(r){return r[Math.floor(Math.random()*r.length)]}function a(n){return Math.random()<=(0,r.clamp)(n,0,100)/100}export{o as randomInteger,n as randomNumber,t as randomPick,a as randomProb};
@@ -1,30 +1 @@
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
- };
1
+ function r(r){let n="";for(let e=0;e<r.length;e++){let t=r[e];"string"==typeof t&&(n+=`${t} `)}return n}function n(r){return Array.isArray(r)?r.flat().filter(r=>r):"object"==typeof r?[r]:[]}function e(r,n){let e;for(e in r)if(!(e in n))return!0;for(e in n)if(r[e]!==n[e])return!0;return!1}function t(r){return null!=r&&"boolean"!=typeof r}export{t as canRender,r as classes,n as normalizeChildren,e as shallowDiffers};
@@ -1,88 +1 @@
1
- function l(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
- const a = ["a", "e", "i", "o", "u"];
11
- function f(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`;
13
- }
14
- function c(e) {
15
- return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
16
- }
17
- function h(e) {
18
- return e.replace(/(^\w{1})|(\s+\w{1})/g, (t) => t.toUpperCase());
19
- }
20
- function g(e) {
21
- return e.replace(/^\w/, (t) => t.toUpperCase());
22
- }
23
- const i = ["Id", "Tv"], u = [
24
- "A",
25
- "An",
26
- "And",
27
- "As",
28
- "At",
29
- "But",
30
- "By",
31
- "For",
32
- "For",
33
- "From",
34
- "In",
35
- "Into",
36
- "Near",
37
- "Nor",
38
- "Of",
39
- "On",
40
- "Onto",
41
- "Or",
42
- "The",
43
- "To",
44
- "With"
45
- ];
46
- function d(e) {
47
- if (!e) return e;
48
- let t = e.replace(/([^\W_]+[^\s-]*) */g, (r) => c(r));
49
- for (const r of u) {
50
- const n = new RegExp(`\\s${r}\\s`, "g");
51
- t = t.replace(n, (o) => o.toLowerCase());
52
- }
53
- for (const r of i) {
54
- const n = new RegExp(`\\b${r}\\b`, "g");
55
- t = t.replace(n, (o) => o.toLowerCase());
56
- }
57
- return t;
58
- }
59
- const s = /&(nbsp|amp|quot|lt|gt|apos|trade|copy);/g, p = {
60
- amp: "&",
61
- apos: "'",
62
- gt: ">",
63
- lt: "<",
64
- nbsp: " ",
65
- quot: '"',
66
- trade: "™",
67
- cops: "©"
68
- };
69
- function m(e) {
70
- return e && e.replace(/<br>/gi, `
71
- `).replace(/<\/?[a-z0-9-_]+[^>]*>/gi, "").replace(s, (t, r) => p[r]).replace(/&#?([0-9]+);/gi, (t, r) => {
72
- const n = Number.parseInt(r, 10);
73
- return String.fromCharCode(n);
74
- }).replace(/&#x?([0-9a-f]+);/gi, (t, r) => {
75
- const n = Number.parseInt(r, 16);
76
- return String.fromCharCode(n);
77
- });
78
- }
79
- export {
80
- a as VOWELS,
81
- c as capitalize,
82
- h as capitalizeAll,
83
- g as capitalizeFirst,
84
- l as createSearch,
85
- m as decodeHtmlEntities,
86
- f as pluralize,
87
- d as toTitleCase
88
- };
1
+ function e(t,r=e=>JSON.stringify(e)){let n=t.toLowerCase().trim();return e=>{if(!n)return!0;let t=r(e);return!!t&&t.toLowerCase().includes(n)}}let t=["a","e","i","o","u"];function r(e,r,n){return 1===r?e:n?e+n:e.endsWith("s")||e.endsWith("x")||e.endsWith("z")||e.endsWith("ch")||e.endsWith("sh")?`${e}es`:e.endsWith("y")&&!t.includes(e.charAt(e.length-2))?`${e.slice(0,-1)}ies`:`${e}s`}function n(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function o(e){return e.replace(/(^\w{1})|(\s+\w{1})/g,e=>e.toUpperCase())}function a(e){return e.replace(/^\w/,e=>e.toUpperCase())}let i=["Id","Tv"],s=["A","An","And","As","At","But","By","For","For","From","In","Into","Near","Nor","Of","On","Onto","Or","The","To","With"];function l(e){if(!e)return e;let t=e.replace(/([^\W_]+[^\s-]*) */g,e=>n(e));for(let e of s){let r=RegExp(`\\s${e}\\s`,"g");t=t.replace(r,e=>e.toLowerCase())}for(let e of i){let r=RegExp(`\\b${e}\\b`,"g");t=t.replace(r,e=>e.toLowerCase())}return t}let p=/&(nbsp|amp|quot|lt|gt|apos|trade|copy);/g,c={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"',trade:"™",cops:"\xa9"};function u(e){return e?e.replace(/<br>/gi,"\n").replace(/<\/?[a-z0-9-_]+[^>]*>/gi,"").replace(p,(e,t)=>c[t]).replace(/&#?([0-9]+);/gi,(e,t)=>String.fromCharCode(Number.parseInt(t,10))).replace(/&#x?([0-9a-f]+);/gi,(e,t)=>String.fromCharCode(Number.parseInt(t,16))):e}export{t as VOWELS,n as capitalize,o as capitalizeAll,a as capitalizeFirst,e as createSearch,u as decodeHtmlEntities,r as pluralize,l as toTitleCase};
@@ -1,28 +1 @@
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
+ function e(t,n,o=!1){let u;return(...e)=>{let i=o&&!u;clearTimeout(u),u=setTimeout(function(){u=null,o||t(...e)},n),i&&t(...e)}}function t(e,t){let n,o;return function u(...i){let r=Date.now();o&&clearTimeout(o),!n||r-n>=t?(e(...i),n=r):o=setTimeout(()=>u(...i),t-(r-(n??0)))}}function n(e){return new Promise(t=>setTimeout(t,e))}export{e as debounce,n as sleep,t as throttle};
@@ -1,25 +1 @@
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
+ function e(e){let t={};for(let n in e)if(Array.isArray(e[n])){let r=e[n];if(e[n].length>0){t[n]=r[0];continue}t[n]="emptyarray"}else if("object"==typeof e[n]&&null!==e[n])t[n]="object (inspect) || Record<string, any>";else if("number"==typeof e[n]){let r=Number(e[n]);if(1===r||0===r){t[n]=`${r}, BooleanLike?`;continue}t[n]=e[n]}return t}export{e as getShallowTypes};
@@ -1,5 +1,5 @@
1
- import { BoxProps } from '../components/Box';
2
- import { BooleanLike } from './react';
1
+ import type { BoxProps } from '../components/Box';
2
+ import { type BooleanLike } from './react';
3
3
  type UnitMapper = (value: unknown) => string | undefined;
4
4
  /**
5
5
  * Coverts our rem-like spacing unit into a CSS unit.