tgui-core 1.5.5 → 1.5.7
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/dist/common/color.d.ts +0 -52
- package/dist/common/color.js +31 -169
- package/dist/common/hotkeys.js +72 -72
- package/dist/components/AnimatedNumber.d.ts +2 -2
- package/dist/components/Button.d.ts +29 -12
- package/dist/components/Button.js +95 -97
- package/dist/components/DmIcon.d.ts +1 -1
- package/dist/components/DmIcon.js +19 -17
- package/dist/components/Icon.d.ts +17 -5
- package/dist/components/Icon.js +24 -22
- package/dist/components/ImageButton.d.ts +14 -5
- package/dist/components/ImageButton.js +97 -81
- package/dist/components/LabeledList.d.ts +34 -31
- package/dist/components/LabeledList.js +19 -18
- package/dist/components/Table.d.ts +28 -20
- package/dist/components/Table.js +7 -6
- package/dist/components/Tabs.d.ts +22 -16
- package/dist/components/Tabs.js +33 -30
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +56 -60
- package/package.json +1 -1
- package/dist/components/Interactive.d.ts +0 -23
- package/dist/components/Interactive.js +0 -75
- package/dist/components/Pointer.d.ts +0 -9
- package/dist/components/Pointer.js +0 -23
package/dist/common/color.d.ts
CHANGED
|
@@ -23,55 +23,3 @@ export declare class Color {
|
|
|
23
23
|
*/
|
|
24
24
|
static lookup(value: number, colors: Color[]): Color;
|
|
25
25
|
}
|
|
26
|
-
export interface RgbColor {
|
|
27
|
-
r: number;
|
|
28
|
-
g: number;
|
|
29
|
-
b: number;
|
|
30
|
-
}
|
|
31
|
-
export interface RgbaColor extends RgbColor {
|
|
32
|
-
a: number;
|
|
33
|
-
}
|
|
34
|
-
export interface HslColor {
|
|
35
|
-
h: number;
|
|
36
|
-
s: number;
|
|
37
|
-
l: number;
|
|
38
|
-
}
|
|
39
|
-
export interface HslaColor extends HslColor {
|
|
40
|
-
a: number;
|
|
41
|
-
}
|
|
42
|
-
export interface HsvColor {
|
|
43
|
-
h: number;
|
|
44
|
-
s: number;
|
|
45
|
-
v: number;
|
|
46
|
-
}
|
|
47
|
-
export interface HsvaColor extends HsvColor {
|
|
48
|
-
a: number;
|
|
49
|
-
}
|
|
50
|
-
export type ObjectColor = RgbColor | HslColor | HsvColor | RgbaColor | HslaColor | HsvaColor;
|
|
51
|
-
export type AnyColor = string | ObjectColor;
|
|
52
|
-
export declare const hexToHsva: (hex: string) => HsvaColor;
|
|
53
|
-
export declare const hexToRgba: (hex: string) => RgbaColor;
|
|
54
|
-
export declare const parseHue: (value: string, unit?: string) => number;
|
|
55
|
-
export declare const hslaStringToHsva: (hslString: string) => HsvaColor;
|
|
56
|
-
export declare const hslStringToHsva: (hslString: string) => HsvaColor;
|
|
57
|
-
export declare const hslaToHsva: ({ h, s, l, a }: HslaColor) => HsvaColor;
|
|
58
|
-
export declare const hsvaToHex: (hsva: HsvaColor) => string;
|
|
59
|
-
export declare const hsvaToHsla: ({ h, s, v, a }: HsvaColor) => HslaColor;
|
|
60
|
-
export declare const hsvaToHslString: (hsva: HsvaColor) => string;
|
|
61
|
-
export declare const hsvaToHsvString: (hsva: HsvaColor) => string;
|
|
62
|
-
export declare const hsvaToHsvaString: (hsva: HsvaColor) => string;
|
|
63
|
-
export declare const hsvaToHslaString: (hsva: HsvaColor) => string;
|
|
64
|
-
export declare const hsvaToRgba: ({ h, s, v, a }: HsvaColor) => RgbaColor;
|
|
65
|
-
export declare const hsvaToRgbString: (hsva: HsvaColor) => string;
|
|
66
|
-
export declare const hsvaToRgbaString: (hsva: HsvaColor) => string;
|
|
67
|
-
export declare const hsvaStringToHsva: (hsvString: string) => HsvaColor;
|
|
68
|
-
export declare const hsvStringToHsva: (hsvString: string) => HsvaColor;
|
|
69
|
-
export declare const rgbaStringToHsva: (rgbaString: string) => HsvaColor;
|
|
70
|
-
export declare const rgbStringToHsva: (rgbaString: string) => HsvaColor;
|
|
71
|
-
export declare const rgbaToHex: ({ r, g, b, a }: RgbaColor) => string;
|
|
72
|
-
export declare const rgbaToHsva: ({ r, g, b, a }: RgbaColor) => HsvaColor;
|
|
73
|
-
export declare const roundHsva: (hsva: HsvaColor) => HsvaColor;
|
|
74
|
-
export declare const rgbaToRgb: ({ r, g, b }: RgbaColor) => RgbColor;
|
|
75
|
-
export declare const hslaToHsl: ({ h, s, l }: HslaColor) => HslColor;
|
|
76
|
-
export declare const hsvaToHsv: (hsva: HsvaColor) => HsvColor;
|
|
77
|
-
export declare const validHex: (value: string, alpha?: boolean) => boolean;
|
package/dist/common/color.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
5
|
-
constructor(t = 0,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.r = t, this.g =
|
|
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
|
+
class n {
|
|
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;
|
|
@@ -15,11 +15,11 @@ class u {
|
|
|
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
|
-
const
|
|
19
|
-
return new
|
|
20
|
-
this.r - this.r *
|
|
21
|
-
this.g - this.g *
|
|
22
|
-
this.b - this.b *
|
|
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,
|
|
23
23
|
this.a
|
|
24
24
|
);
|
|
25
25
|
}
|
|
@@ -31,7 +31,7 @@ class u {
|
|
|
31
31
|
* Creates a color from the CSS hex color notation.
|
|
32
32
|
*/
|
|
33
33
|
static fromHex(t) {
|
|
34
|
-
return new
|
|
34
|
+
return new n(
|
|
35
35
|
Number.parseInt(t.slice(1, 3), 16),
|
|
36
36
|
Number.parseInt(t.slice(3, 5), 16),
|
|
37
37
|
Number.parseInt(t.slice(5, 7), 16)
|
|
@@ -40,169 +40,31 @@ class u {
|
|
|
40
40
|
/**
|
|
41
41
|
* Linear interpolation of two colors.
|
|
42
42
|
*/
|
|
43
|
-
static lerp(t,
|
|
44
|
-
return new
|
|
45
|
-
(
|
|
46
|
-
(
|
|
47
|
-
(
|
|
48
|
-
(
|
|
43
|
+
static lerp(t, r, s) {
|
|
44
|
+
return new n(
|
|
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
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Loops up the color in the provided list of colors
|
|
53
53
|
* with linear interpolation.
|
|
54
54
|
*/
|
|
55
|
-
static lookup(t,
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
55
|
+
static lookup(t, r) {
|
|
56
|
+
const s = r.length;
|
|
57
|
+
if (s < 2)
|
|
58
58
|
throw new Error("Needs at least two colors!");
|
|
59
|
-
const
|
|
59
|
+
const a = t * (s - 1);
|
|
60
60
|
if (t < 1e-4)
|
|
61
|
-
return
|
|
61
|
+
return r[0];
|
|
62
62
|
if (t >= 1 - 1e-4)
|
|
63
|
-
return s
|
|
64
|
-
const
|
|
65
|
-
return
|
|
63
|
+
return r[s - 1];
|
|
64
|
+
const b = a % 1, h = a | 0;
|
|
65
|
+
return n.lerp(r[h], r[h + 1], b);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
const a = (r, t = 0, s = 10 ** t) => Math.round(s * r) / s, T = {
|
|
69
|
-
grad: 360 / 400,
|
|
70
|
-
turn: 360,
|
|
71
|
-
rad: 360 / (Math.PI * 2)
|
|
72
|
-
}, E = (r) => N(p(r)), p = (r) => {
|
|
73
|
-
let t = r;
|
|
74
|
-
return t[0] === "#" && (t = t.substring(1)), t.length < 6 ? {
|
|
75
|
-
r: Number.parseInt(t[0] + t[0], 16),
|
|
76
|
-
g: Number.parseInt(t[1] + t[1], 16),
|
|
77
|
-
b: Number.parseInt(t[2] + t[2], 16),
|
|
78
|
-
a: t.length === 4 ? a(Number.parseInt(t[3] + t[3], 16) / 255, 2) : 1
|
|
79
|
-
} : {
|
|
80
|
-
r: Number.parseInt(t.substring(0, 2), 16),
|
|
81
|
-
g: Number.parseInt(t.substring(2, 4), 16),
|
|
82
|
-
b: Number.parseInt(t.substring(4, 6), 16),
|
|
83
|
-
a: t.length === 8 ? a(Number.parseInt(t.substring(6, 8), 16) / 255, 2) : 1
|
|
84
|
-
};
|
|
85
|
-
}, $ = (r, t = "deg") => Number(r) * (T[t] || 1), S = (r) => {
|
|
86
|
-
const s = /hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(r);
|
|
87
|
-
return s ? x({
|
|
88
|
-
h: $(s[1], s[2]),
|
|
89
|
-
s: Number(s[3]),
|
|
90
|
-
l: Number(s[4]),
|
|
91
|
-
a: s[5] === void 0 ? 1 : Number(s[5]) / (s[6] ? 100 : 1)
|
|
92
|
-
}) : { h: 0, s: 0, v: 0, a: 1 };
|
|
93
|
-
}, P = S, x = ({ h: r, s: t, l: s, a: n }) => (t *= (s < 50 ? s : 100 - s) / 100, {
|
|
94
|
-
h: r,
|
|
95
|
-
s: t > 0 ? 2 * t / (s + t) * 100 : 0,
|
|
96
|
-
v: s + t,
|
|
97
|
-
a: n
|
|
98
|
-
}), k = (r) => w(m(r)), l = ({ h: r, s: t, v: s, a: n }) => {
|
|
99
|
-
const e = (200 - t) * s / 100;
|
|
100
|
-
return {
|
|
101
|
-
h: a(r),
|
|
102
|
-
s: a(
|
|
103
|
-
e > 0 && e < 200 ? t * s / 100 / (e <= 100 ? e : 200 - e) * 100 : 0
|
|
104
|
-
),
|
|
105
|
-
l: a(e / 2),
|
|
106
|
-
a: a(n, 2)
|
|
107
|
-
};
|
|
108
|
-
}, L = (r) => {
|
|
109
|
-
const { h: t, s, l: n } = l(r);
|
|
110
|
-
return `hsl(${t}, ${s}%, ${n}%)`;
|
|
111
|
-
}, O = (r) => {
|
|
112
|
-
const { h: t, s, v: n } = g(r);
|
|
113
|
-
return `hsv(${t}, ${s}%, ${n}%)`;
|
|
114
|
-
}, F = (r) => {
|
|
115
|
-
const { h: t, s, v: n, a: e } = g(r);
|
|
116
|
-
return `hsva(${t}, ${s}%, ${n}%, ${e})`;
|
|
117
|
-
}, y = (r) => {
|
|
118
|
-
const { h: t, s, l: n, a: e } = l(r);
|
|
119
|
-
return `hsla(${t}, ${s}%, ${n}%, ${e})`;
|
|
120
|
-
}, m = ({ h: r, s: t, v: s, a: n }) => {
|
|
121
|
-
r = r / 360 * 6, t = t / 100, s = s / 100;
|
|
122
|
-
const e = Math.floor(r), o = s * (1 - t), h = s * (1 - (r - e) * t), b = s * (1 - (1 - r + e) * t), d = e % 6;
|
|
123
|
-
return {
|
|
124
|
-
r: [s, h, o, o, b, s][d] * 255,
|
|
125
|
-
g: [b, s, s, h, o, o][d] * 255,
|
|
126
|
-
b: [o, o, b, s, s, h][d] * 255,
|
|
127
|
-
a: a(n, 2)
|
|
128
|
-
};
|
|
129
|
-
}, A = (r) => {
|
|
130
|
-
const { r: t, g: s, b: n } = m(r);
|
|
131
|
-
return `rgb(${a(t)}, ${a(s)}, ${a(n)})`;
|
|
132
|
-
}, U = (r) => {
|
|
133
|
-
const { r: t, g: s, b: n, a: e } = m(r);
|
|
134
|
-
return `rgba(${a(t)}, ${a(s)}, ${a(n)}, ${a(e, 2)})`;
|
|
135
|
-
}, I = (r) => {
|
|
136
|
-
const s = /hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(r);
|
|
137
|
-
return s ? g({
|
|
138
|
-
h: $(s[1], s[2]),
|
|
139
|
-
s: Number(s[3]),
|
|
140
|
-
v: Number(s[4]),
|
|
141
|
-
a: s[5] === void 0 ? 1 : Number(s[5]) / (s[6] ? 100 : 1)
|
|
142
|
-
}) : { h: 0, s: 0, v: 0, a: 1 };
|
|
143
|
-
}, V = I, f = (r) => {
|
|
144
|
-
const s = /rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(r);
|
|
145
|
-
return s ? N({
|
|
146
|
-
r: Number(s[1]) / (s[2] ? 100 / 255 : 1),
|
|
147
|
-
g: Number(s[3]) / (s[4] ? 100 / 255 : 1),
|
|
148
|
-
b: Number(s[5]) / (s[6] ? 100 / 255 : 1),
|
|
149
|
-
a: s[7] === void 0 ? 1 : Number(s[7]) / (s[8] ? 100 : 1)
|
|
150
|
-
}) : { h: 0, s: 0, v: 0, a: 1 };
|
|
151
|
-
}, j = f, i = (r) => {
|
|
152
|
-
const t = r.toString(16);
|
|
153
|
-
return t.length < 2 ? `0${t}` : t;
|
|
154
|
-
}, w = ({ r, g: t, b: s, a: n }) => {
|
|
155
|
-
const e = n < 1 ? i(a(n * 255)) : "";
|
|
156
|
-
return `#${i(a(r))}${i(a(t))}${i(a(s))}${e}`;
|
|
157
|
-
}, N = ({ r, g: t, b: s, a: n }) => {
|
|
158
|
-
const e = Math.max(r, t, s), o = e - Math.min(r, t, s), h = o ? e === r ? (t - s) / o : e === t ? 2 + (s - r) / o : 4 + (r - t) / o : 0;
|
|
159
|
-
return {
|
|
160
|
-
h: 60 * (h < 0 ? h + 6 : h),
|
|
161
|
-
s: e ? o / e * 100 : 0,
|
|
162
|
-
v: e / 255 * 100,
|
|
163
|
-
a: n
|
|
164
|
-
};
|
|
165
|
-
}, g = (r) => ({
|
|
166
|
-
h: a(r.h),
|
|
167
|
-
s: a(r.s),
|
|
168
|
-
v: a(r.v),
|
|
169
|
-
a: a(r.a, 2)
|
|
170
|
-
}), q = ({ r, g: t, b: s }) => ({ r, g: t, b: s }), z = ({ h: r, s: t, l: s }) => ({ h: r, s: t, l: s }), B = (r) => {
|
|
171
|
-
const { h: t, s, v: n } = g(r);
|
|
172
|
-
return { h: t, s, v: n };
|
|
173
|
-
}, M = /^#?([0-9A-F]{3,8})$/i, D = (r, t) => {
|
|
174
|
-
const s = M.exec(r), n = s ? s[1].length : 0;
|
|
175
|
-
return n === 3 || // '#rgb' format
|
|
176
|
-
n === 6 || // '#rrggbb' format
|
|
177
|
-
!!t && n === 4 || // '#rgba' format
|
|
178
|
-
!!t && n === 8;
|
|
179
|
-
};
|
|
180
68
|
export {
|
|
181
|
-
|
|
182
|
-
E as hexToHsva,
|
|
183
|
-
p as hexToRgba,
|
|
184
|
-
P as hslStringToHsva,
|
|
185
|
-
S as hslaStringToHsva,
|
|
186
|
-
z as hslaToHsl,
|
|
187
|
-
x as hslaToHsva,
|
|
188
|
-
V as hsvStringToHsva,
|
|
189
|
-
I as hsvaStringToHsva,
|
|
190
|
-
k as hsvaToHex,
|
|
191
|
-
L as hsvaToHslString,
|
|
192
|
-
l as hsvaToHsla,
|
|
193
|
-
y as hsvaToHslaString,
|
|
194
|
-
B as hsvaToHsv,
|
|
195
|
-
O as hsvaToHsvString,
|
|
196
|
-
F as hsvaToHsvaString,
|
|
197
|
-
A as hsvaToRgbString,
|
|
198
|
-
m as hsvaToRgba,
|
|
199
|
-
U as hsvaToRgbaString,
|
|
200
|
-
$ as parseHue,
|
|
201
|
-
j as rgbStringToHsva,
|
|
202
|
-
f as rgbaStringToHsva,
|
|
203
|
-
w as rgbaToHex,
|
|
204
|
-
N as rgbaToHsva,
|
|
205
|
-
q as rgbaToRgb,
|
|
206
|
-
g as roundHsva,
|
|
207
|
-
D as validHex
|
|
69
|
+
n as Color
|
|
208
70
|
};
|
package/dist/common/hotkeys.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
|
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 w } from "./keycodes.js";
|
|
3
3
|
const m = {}, c = [
|
|
4
4
|
K,
|
|
5
5
|
E,
|
|
@@ -10,103 +10,103 @@ const m = {}, c = [
|
|
|
10
10
|
S,
|
|
11
11
|
Y,
|
|
12
12
|
_,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
B,
|
|
14
|
+
w
|
|
15
15
|
], o = {}, u = [];
|
|
16
|
-
function
|
|
17
|
-
if (
|
|
18
|
-
if (
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
if (
|
|
22
|
-
if (
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
30
|
-
if (
|
|
31
|
-
return String.fromCharCode(
|
|
32
|
-
if (
|
|
33
|
-
return `Numpad${
|
|
34
|
-
if (
|
|
35
|
-
return `F${
|
|
36
|
-
if (
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
16
|
+
function F(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
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
40
|
+
function N(n) {
|
|
41
|
+
const t = String(n);
|
|
42
|
+
if (t === "Ctrl+F5" || t === "Ctrl+R") {
|
|
43
43
|
location.reload();
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (t === "Ctrl+F" || n.event.defaultPrevented || n.isModifierKey() || c.includes(n.code))
|
|
47
47
|
return;
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
48
|
+
const i = F(n.code);
|
|
49
|
+
if (!i)
|
|
50
50
|
return;
|
|
51
|
-
const f = m[
|
|
51
|
+
const f = m[i];
|
|
52
52
|
if (f)
|
|
53
53
|
return Byond.command(f);
|
|
54
|
-
if (
|
|
55
|
-
o[
|
|
56
|
-
const r = `KeyDown "${
|
|
54
|
+
if (n.isDown() && !o[i]) {
|
|
55
|
+
o[i] = !0;
|
|
56
|
+
const r = `KeyDown "${i}"`;
|
|
57
57
|
return Byond.command(r);
|
|
58
58
|
}
|
|
59
|
-
if (
|
|
60
|
-
o[
|
|
61
|
-
const r = `KeyUp "${
|
|
59
|
+
if (n.isUp() && o[i]) {
|
|
60
|
+
o[i] = !1;
|
|
61
|
+
const r = `KeyUp "${i}"`;
|
|
62
62
|
return Byond.command(r);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
c.push(
|
|
65
|
+
function P(n) {
|
|
66
|
+
c.push(n);
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
|
|
68
|
+
function R(n) {
|
|
69
|
+
const t = c.indexOf(n);
|
|
70
|
+
t >= 0 && c.splice(t, 1);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
for (const
|
|
74
|
-
o[
|
|
72
|
+
function T() {
|
|
73
|
+
for (const n in o)
|
|
74
|
+
o[n] && (o[n] = !1, Byond.command(`KeyUp "${n}"`));
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
Byond.winget("default.*").then((
|
|
78
|
-
const
|
|
79
|
-
for (const r
|
|
80
|
-
const s = r.split("."),
|
|
81
|
-
|
|
76
|
+
function v() {
|
|
77
|
+
Byond.winget("default.*").then((n) => {
|
|
78
|
+
const t = {};
|
|
79
|
+
for (const r in n) {
|
|
80
|
+
const s = r.split("."), e = s[1], a = s[2];
|
|
81
|
+
e && a && (t[e] || (t[e] = {}), t[e][a] = n[r]);
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const i = /\\"/g;
|
|
84
84
|
function f(r) {
|
|
85
|
-
return r.substring(1, r.length - 1).replace(
|
|
85
|
+
return r.substring(1, r.length - 1).replace(i, '"');
|
|
86
86
|
}
|
|
87
|
-
for (const r
|
|
88
|
-
const s =
|
|
89
|
-
m[
|
|
87
|
+
for (const r in t) {
|
|
88
|
+
const s = t[r], e = f(s.name);
|
|
89
|
+
m[e] = f(s.command);
|
|
90
90
|
}
|
|
91
91
|
}), l.on("window-blur", () => {
|
|
92
|
-
|
|
93
|
-
}), l.on("key", (
|
|
94
|
-
for (const
|
|
95
|
-
n
|
|
96
|
-
|
|
92
|
+
T();
|
|
93
|
+
}), l.on("key", (n) => {
|
|
94
|
+
for (const t of u)
|
|
95
|
+
t(n);
|
|
96
|
+
N(n);
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
u.push(
|
|
101
|
-
let
|
|
99
|
+
function x(n) {
|
|
100
|
+
u.push(n);
|
|
101
|
+
let t = !1;
|
|
102
102
|
return () => {
|
|
103
|
-
|
|
103
|
+
t || (t = !0, u.splice(u.indexOf(n), 1));
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
P as acquireHotKey,
|
|
108
|
+
x as listenForKeyEvents,
|
|
109
|
+
T as releaseHeldKeys,
|
|
110
|
+
R as releaseHotKey,
|
|
111
|
+
v as setupHotKeys
|
|
112
112
|
};
|
|
@@ -9,13 +9,13 @@ type Props = {
|
|
|
9
9
|
* If provided, a function that formats the inner string. By default,
|
|
10
10
|
* attempts to match the numeric precision of `value`.
|
|
11
11
|
*/
|
|
12
|
-
format
|
|
12
|
+
format: (value: number) => string;
|
|
13
13
|
/**
|
|
14
14
|
* If provided, the initial value displayed. By default, the same as `value`.
|
|
15
15
|
* If `initial` and `value` are different, the component immediately starts
|
|
16
16
|
* animating.
|
|
17
17
|
*/
|
|
18
|
-
initial
|
|
18
|
+
initial: number;
|
|
19
19
|
}>;
|
|
20
20
|
/**
|
|
21
21
|
* ## AnimatedNumber
|
|
@@ -54,21 +54,11 @@ type Props = Partial<{
|
|
|
54
54
|
/** Align content vertically using flex. Use lineHeight if the height is static. */
|
|
55
55
|
verticalAlignContent: string;
|
|
56
56
|
}> & EllipsisUnion & BoxProps;
|
|
57
|
-
/**
|
|
58
|
-
* ## Button
|
|
59
|
-
* Buttons allow users to take actions, and make choices, with a single click.
|
|
60
|
-
*/
|
|
61
57
|
export declare function Button(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
62
|
-
export declare namespace Button {
|
|
63
|
-
var Checkbox: typeof ButtonCheckbox;
|
|
64
|
-
var Confirm: typeof ButtonConfirm;
|
|
65
|
-
var Input: typeof ButtonInput;
|
|
66
|
-
var File: typeof ButtonFile;
|
|
67
|
-
}
|
|
68
58
|
type CheckProps = Partial<{
|
|
69
59
|
checked: BooleanLike;
|
|
70
60
|
}> & Props;
|
|
71
|
-
|
|
61
|
+
declare function ButtonCheckbox(props: CheckProps): import("react/jsx-runtime").JSX.Element;
|
|
72
62
|
type ConfirmProps = Partial<{
|
|
73
63
|
confirmColor: string;
|
|
74
64
|
confirmContent: ReactNode;
|
|
@@ -78,7 +68,6 @@ declare function ButtonConfirm(props: ConfirmProps): import("react/jsx-runtime")
|
|
|
78
68
|
type InputProps = Partial<{
|
|
79
69
|
currentValue: string;
|
|
80
70
|
defaultValue: string;
|
|
81
|
-
fluid: boolean;
|
|
82
71
|
maxLength: number;
|
|
83
72
|
onCommit: (e: any, value: string) => void;
|
|
84
73
|
placeholder: string;
|
|
@@ -90,4 +79,32 @@ type FileProps = {
|
|
|
90
79
|
onSelectFiles: (files: string | string[]) => void;
|
|
91
80
|
} & Props;
|
|
92
81
|
declare function ButtonFile(props: FileProps): import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* ## Button
|
|
84
|
+
* Buttons allow users to take actions, and make choices, with a single click.
|
|
85
|
+
*/
|
|
86
|
+
export declare namespace Button {
|
|
87
|
+
/**
|
|
88
|
+
* ## Button.Checkbox
|
|
89
|
+
* A ghetto checkbox, made entirely using existing Button API.
|
|
90
|
+
*/
|
|
91
|
+
const Checkbox: typeof ButtonCheckbox;
|
|
92
|
+
/**
|
|
93
|
+
* ## Button.Confirm
|
|
94
|
+
* A button with an extra confirmation step, using native button component.
|
|
95
|
+
*/
|
|
96
|
+
const Confirm: typeof ButtonConfirm;
|
|
97
|
+
/**
|
|
98
|
+
* ## Button.Input
|
|
99
|
+
* A button that turns into an input box after the first click.
|
|
100
|
+
*
|
|
101
|
+
* Turns back into a button after the user hits enter, defocuses, or hits escape. Enter and defocus commit, while escape cancels.
|
|
102
|
+
*/
|
|
103
|
+
const Input: typeof ButtonInput;
|
|
104
|
+
/**
|
|
105
|
+
* ## Button.File
|
|
106
|
+
* Accepts file input, based on the native element.
|
|
107
|
+
*/
|
|
108
|
+
const File: typeof ButtonFile;
|
|
109
|
+
}
|
|
93
110
|
export {};
|