tgui-core 1.5.5 → 1.5.6

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.
@@ -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;
@@ -1,13 +1,13 @@
1
- var v = Object.defineProperty;
2
- var H = (r, t, s) => t in r ? v(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
3
- var c = (r, t, s) => H(r, typeof t != "symbol" ? t + "" : t, s);
4
- class u {
5
- constructor(t = 0, s = 0, n = 0, e = 1) {
6
- c(this, "r");
7
- c(this, "g");
8
- c(this, "b");
9
- c(this, "a");
10
- this.r = t, this.g = s, this.b = n, this.a = e;
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 s = t / 100;
19
- return new u(
20
- this.r - this.r * s,
21
- this.g - this.g * s,
22
- this.b - this.b * s,
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 u(
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, s, n) {
44
- return new u(
45
- (s.r - t.r) * n + t.r,
46
- (s.g - t.g) * n + t.g,
47
- (s.b - t.b) * n + t.b,
48
- (s.a - t.a) * n + t.a
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, s) {
56
- const n = s.length;
57
- if (n < 2)
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 e = t * (n - 1);
59
+ const a = t * (s - 1);
60
60
  if (t < 1e-4)
61
- return s[0];
61
+ return r[0];
62
62
  if (t >= 1 - 1e-4)
63
- return s[n - 1];
64
- const o = e % 1, h = e | 0;
65
- return u.lerp(s[h], s[h + 1], o);
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
- u as Color,
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
  };
@@ -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 b, KEY_F5 as B } from "./keycodes.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 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
- b,
14
- B
13
+ B,
14
+ w
15
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 ".";
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 F(t) {
41
- const n = String(t);
42
- if (n === "Ctrl+F5" || n === "Ctrl+R") {
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 (n === "Ctrl+F" || t.event.defaultPrevented || t.isModifierKey() || c.includes(t.code))
46
+ if (t === "Ctrl+F" || n.event.defaultPrevented || n.isModifierKey() || c.includes(n.code))
47
47
  return;
48
- const e = w(t.code);
49
- if (!e)
48
+ const i = F(n.code);
49
+ if (!i)
50
50
  return;
51
- const f = m[e];
51
+ const f = m[i];
52
52
  if (f)
53
53
  return Byond.command(f);
54
- if (t.isDown() && !o[e]) {
55
- o[e] = !0;
56
- const r = `KeyDown "${e}"`;
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 (t.isUp() && o[e]) {
60
- o[e] = !1;
61
- const r = `KeyUp "${e}"`;
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 O(t) {
66
- c.push(t);
65
+ function P(n) {
66
+ c.push(n);
67
67
  }
68
- function P(t) {
69
- const n = c.indexOf(t);
70
- n >= 0 && c.splice(n, 1);
68
+ function R(n) {
69
+ const t = c.indexOf(n);
70
+ t >= 0 && c.splice(t, 1);
71
71
  }
72
- function N() {
73
- for (const t of Object.keys(o))
74
- o[t] && (o[t] = !1, Byond.command(`KeyUp "${t}"`));
72
+ function T() {
73
+ for (const n in o)
74
+ o[n] && (o[n] = !1, Byond.command(`KeyUp "${n}"`));
75
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]);
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 e = /\\"/g;
83
+ const i = /\\"/g;
84
84
  function f(r) {
85
- return r.substring(1, r.length - 1).replace(e, '"');
85
+ return r.substring(1, r.length - 1).replace(i, '"');
86
86
  }
87
- for (const r of Object.keys(n)) {
88
- const s = n[r], i = f(s.name);
89
- m[i] = f(s.command);
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
- N();
93
- }), l.on("key", (t) => {
94
- for (const n of u)
95
- n(t);
96
- F(t);
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 v(t) {
100
- u.push(t);
101
- let n = !1;
99
+ function x(n) {
100
+ u.push(n);
101
+ let t = !1;
102
102
  return () => {
103
- n || (n = !0, u.splice(u.indexOf(t), 1));
103
+ t || (t = !0, u.splice(u.indexOf(n), 1));
104
104
  };
105
105
  }
106
106
  export {
107
- O as acquireHotKey,
108
- v as listenForKeyEvents,
109
- N as releaseHeldKeys,
110
- P as releaseHotKey,
111
- R as setupHotKeys
107
+ P as acquireHotKey,
108
+ x as listenForKeyEvents,
109
+ T as releaseHeldKeys,
110
+ R as releaseHotKey,
111
+ v as setupHotKeys
112
112
  };
@@ -21,7 +21,6 @@ export { Image } from './Image';
21
21
  export { ImageButton } from './ImageButton';
22
22
  export { InfinitePlane } from './InfinitePlane';
23
23
  export { Input } from './Input';
24
- export { Interactive, type Interaction } from './Interactive';
25
24
  export { KeyListener } from './KeyListener';
26
25
  export { Knob } from './Knob';
27
26
  export { LabeledControls } from './LabeledControls';
@@ -30,7 +29,6 @@ export { MenuBar } from './MenuBar';
30
29
  export { Modal } from './Modal';
31
30
  export { NoticeBox } from './NoticeBox';
32
31
  export { NumberInput } from './NumberInput';
33
- export { Pointer } from './Pointer';
34
32
  export { Popper } from './Popper';
35
33
  export { ProgressBar } from './ProgressBar';
36
34
  export { RestrictedInput } from './RestrictedInput';
@@ -2,7 +2,7 @@ import { AnimatedNumber as e } from "./AnimatedNumber.js";
2
2
  import { Autofocus as m } from "./Autofocus.js";
3
3
  import { Blink as x } from "./Blink.js";
4
4
  import { BlockQuote as i } from "./BlockQuote.js";
5
- import { Box as n } from "./Box.js";
5
+ import { Box as l } from "./Box.js";
6
6
  import { Button as u } from "./Button.js";
7
7
  import { ByondUi as c } from "./ByondUi.js";
8
8
  import { Chart as b } from "./Chart.js";
@@ -11,47 +11,45 @@ import { ColorBox as D } from "./ColorBox.js";
11
11
  import { Dialog as C } from "./Dialog.js";
12
12
  import { Dimmer as L } from "./Dimmer.js";
13
13
  import { Divider as y } from "./Divider.js";
14
- import { DmIcon as A } from "./DmIcon.js";
15
- import { DraggableControl as v } from "./DraggableControl.js";
16
- import { Dropdown as K } from "./Dropdown.js";
17
- import { FitText as R } from "./FitText.js";
14
+ import { DmIcon as N } from "./DmIcon.js";
15
+ import { DraggableControl as F } from "./DraggableControl.js";
16
+ import { Dropdown as M } from "./Dropdown.js";
17
+ import { FitText as h } from "./FitText.js";
18
18
  import { Flex as w } from "./Flex.js";
19
19
  import { Icon as O } from "./Icon.js";
20
20
  import { Image as U } from "./Image.js";
21
21
  import { ImageButton as j } from "./ImageButton.js";
22
22
  import { InfinitePlane as z } from "./InfinitePlane.js";
23
23
  import { Input as H } from "./Input.js";
24
- import { Interactive as W } from "./Interactive.js";
25
- import { KeyListener as Y } from "./KeyListener.js";
26
- import { Knob as _ } from "./Knob.js";
27
- import { LabeledControls as oo } from "./LabeledControls.js";
28
- import { LabeledList as eo } from "./LabeledList.js";
29
- import { MenuBar as mo } from "./MenuBar.js";
30
- import { Modal as xo } from "./Modal.js";
31
- import { NoticeBox as io } from "./NoticeBox.js";
32
- import { NumberInput as no } from "./NumberInput.js";
33
- import { Pointer as uo } from "./Pointer.js";
34
- import { Popper as co } from "./Popper.js";
35
- import { ProgressBar as Bo } from "./ProgressBar.js";
36
- import { RestrictedInput as go } from "./RestrictedInput.js";
37
- import { RoundGauge as To } from "./RoundGauge.js";
38
- import { Section as ko } from "./Section.js";
39
- import { Slider as So } from "./Slider.js";
40
- import { Stack as Po } from "./Stack.js";
41
- import { StyleableSection as No } from "./StyleableSection.js";
42
- import { Table as Fo } from "./Table.js";
43
- import { Tabs as Mo } from "./Tabs.js";
44
- import { TextArea as ho } from "./TextArea.js";
45
- import { TimeDisplay as Go } from "./TimeDisplay.js";
46
- import { Tooltip as Qo } from "./Tooltip.js";
47
- import { TrackOutsideClicks as Vo } from "./TrackOutsideClicks.js";
48
- import { VirtualList as qo } from "./VirtualList.js";
24
+ import { KeyListener as W } from "./KeyListener.js";
25
+ import { Knob as Y } from "./Knob.js";
26
+ import { LabeledControls as _ } from "./LabeledControls.js";
27
+ import { LabeledList as oo } from "./LabeledList.js";
28
+ import { MenuBar as eo } from "./MenuBar.js";
29
+ import { Modal as mo } from "./Modal.js";
30
+ import { NoticeBox as xo } from "./NoticeBox.js";
31
+ import { NumberInput as io } from "./NumberInput.js";
32
+ import { Popper as lo } from "./Popper.js";
33
+ import { ProgressBar as uo } from "./ProgressBar.js";
34
+ import { RestrictedInput as co } from "./RestrictedInput.js";
35
+ import { RoundGauge as Bo } from "./RoundGauge.js";
36
+ import { Section as go } from "./Section.js";
37
+ import { Slider as To } from "./Slider.js";
38
+ import { Stack as ko } from "./Stack.js";
39
+ import { StyleableSection as So } from "./StyleableSection.js";
40
+ import { Table as Ao } from "./Table.js";
41
+ import { Tabs as Po } from "./Tabs.js";
42
+ import { TextArea as Ko } from "./TextArea.js";
43
+ import { TimeDisplay as Ro } from "./TimeDisplay.js";
44
+ import { Tooltip as vo } from "./Tooltip.js";
45
+ import { TrackOutsideClicks as Go } from "./TrackOutsideClicks.js";
46
+ import { VirtualList as Qo } from "./VirtualList.js";
49
47
  export {
50
48
  e as AnimatedNumber,
51
49
  m as Autofocus,
52
50
  x as Blink,
53
51
  i as BlockQuote,
54
- n as Box,
52
+ l as Box,
55
53
  u as Button,
56
54
  c as ByondUi,
57
55
  b as Chart,
@@ -60,39 +58,37 @@ export {
60
58
  C as Dialog,
61
59
  L as Dimmer,
62
60
  y as Divider,
63
- A as DmIcon,
64
- v as DraggableControl,
65
- K as Dropdown,
66
- R as FitText,
61
+ N as DmIcon,
62
+ F as DraggableControl,
63
+ M as Dropdown,
64
+ h as FitText,
67
65
  w as Flex,
68
66
  O as Icon,
69
67
  U as Image,
70
68
  j as ImageButton,
71
69
  z as InfinitePlane,
72
70
  H as Input,
73
- W as Interactive,
74
- Y as KeyListener,
75
- _ as Knob,
76
- oo as LabeledControls,
77
- eo as LabeledList,
78
- mo as MenuBar,
79
- xo as Modal,
80
- io as NoticeBox,
81
- no as NumberInput,
82
- uo as Pointer,
83
- co as Popper,
84
- Bo as ProgressBar,
85
- go as RestrictedInput,
86
- To as RoundGauge,
87
- ko as Section,
88
- So as Slider,
89
- Po as Stack,
90
- No as StyleableSection,
91
- Fo as Table,
92
- Mo as Tabs,
93
- ho as TextArea,
94
- Go as TimeDisplay,
95
- Qo as Tooltip,
96
- Vo as TrackOutsideClicks,
97
- qo as VirtualList
71
+ W as KeyListener,
72
+ Y as Knob,
73
+ _ as LabeledControls,
74
+ oo as LabeledList,
75
+ eo as MenuBar,
76
+ mo as Modal,
77
+ xo as NoticeBox,
78
+ io as NumberInput,
79
+ lo as Popper,
80
+ uo as ProgressBar,
81
+ co as RestrictedInput,
82
+ Bo as RoundGauge,
83
+ go as Section,
84
+ To as Slider,
85
+ ko as Stack,
86
+ So as StyleableSection,
87
+ Ao as Table,
88
+ Po as Tabs,
89
+ Ko as TextArea,
90
+ Ro as TimeDisplay,
91
+ vo as Tooltip,
92
+ Go as TrackOutsideClicks,
93
+ Qo as VirtualList
98
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tgui-core",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
4
4
  "description": "TGUI core component library",
5
5
  "keywords": ["TGUI", "library", "typescript"],
6
6
  "files": ["dist"],
@@ -1,23 +0,0 @@
1
- import { default as React, Component, KeyboardEvent, MouseEvent, RefObject } from 'react';
2
- export interface Interaction {
3
- left: number;
4
- top: number;
5
- }
6
- export interface InteractiveProps {
7
- onMove: (interaction: Interaction) => void;
8
- onKey: (offset: Interaction) => void;
9
- children: React.ReactNode;
10
- style?: React.CSSProperties;
11
- }
12
- export declare class Interactive extends Component<InteractiveProps> {
13
- containerRef: RefObject<HTMLDivElement>;
14
- constructor(props: InteractiveProps);
15
- handleMoveStart: (event: MouseEvent) => void;
16
- handleMove: (event: MouseEvent) => void;
17
- handleMoveEnd: () => void;
18
- handleKeyDown: (event: KeyboardEvent) => void;
19
- toggleDocumentEvents: (state: boolean) => void;
20
- componentDidMount(): void;
21
- componentWillUnmount(): void;
22
- render(): import("react/jsx-runtime").JSX.Element;
23
- }
@@ -1,75 +0,0 @@
1
- var h = Object.defineProperty;
2
- var u = (t, n, e) => n in t ? h(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var s = (t, n, e) => u(t, typeof n != "symbol" ? n + "" : n, e);
4
- import { jsx as p } from "react/jsx-runtime";
5
- import { Component as f, createRef as g } from "react";
6
- import { clamp as l } from "../common/math.js";
7
- const i = (t) => {
8
- var n;
9
- return ((n = t == null ? void 0 : t.ownerDocument) == null ? void 0 : n.defaultView) || self;
10
- }, a = (t, n) => {
11
- const e = t.getBoundingClientRect();
12
- return {
13
- left: l(
14
- (n.pageX - (e.left + i(t).pageXOffset)) / e.width,
15
- 0,
16
- 1
17
- ),
18
- top: l(
19
- (n.pageY - (e.top + i(t).pageYOffset)) / e.height,
20
- 0,
21
- 1
22
- )
23
- };
24
- };
25
- class w extends f {
26
- constructor(e) {
27
- super(e);
28
- s(this, "containerRef");
29
- s(this, "handleMoveStart", (e) => {
30
- const o = this.containerRef.current;
31
- o && (e.preventDefault(), o.focus(), this.props.onMove(a(o, e)), this.toggleDocumentEvents(!0));
32
- });
33
- s(this, "handleMove", (e) => {
34
- e.preventDefault(), e.buttons > 0 && this.containerRef.current ? this.props.onMove(a(this.containerRef.current, e)) : this.toggleDocumentEvents(!1);
35
- });
36
- s(this, "handleMoveEnd", () => {
37
- this.toggleDocumentEvents(!1);
38
- });
39
- s(this, "handleKeyDown", (e) => {
40
- const o = e.which || e.keyCode;
41
- o < 37 || o > 40 || (e.preventDefault(), this.props.onKey({
42
- left: o === 39 ? 0.05 : o === 37 ? -0.05 : 0,
43
- top: o === 40 ? 0.05 : o === 38 ? -0.05 : 0
44
- }));
45
- });
46
- s(this, "toggleDocumentEvents", (e) => {
47
- const o = this.containerRef.current, r = i(o), c = e ? r.addEventListener.bind(r) : r.removeEventListener.bind(r);
48
- c("mousemove", this.handleMove), c("mouseup", this.handleMoveEnd);
49
- });
50
- this.containerRef = g();
51
- }
52
- componentDidMount() {
53
- this.toggleDocumentEvents(!0);
54
- }
55
- componentWillUnmount() {
56
- this.toggleDocumentEvents(!1);
57
- }
58
- render() {
59
- return /* @__PURE__ */ p(
60
- "div",
61
- {
62
- ...this.props,
63
- style: this.props.style,
64
- ref: this.containerRef,
65
- onMouseDown: this.handleMoveStart,
66
- className: "react-colorful__interactive",
67
- onKeyDown: this.handleKeyDown,
68
- children: this.props.children
69
- }
70
- );
71
- }
72
- }
73
- export {
74
- w as Interactive
75
- };
@@ -1,9 +0,0 @@
1
- import { ReactNode } from 'react';
2
- interface PointerProps {
3
- className?: string;
4
- top?: number;
5
- left: number;
6
- color: string;
7
- }
8
- export declare const Pointer: ({ className, color, left, top, }: PointerProps) => ReactNode;
9
- export {};
@@ -1,23 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { classes as a } from "../common/react.js";
3
- const m = ({
4
- className: r,
5
- color: e,
6
- left: t,
7
- top: l = 0.5
8
- }) => {
9
- const s = a(["react-colorful__pointer", r]), c = {
10
- top: `${l * 100}%`,
11
- left: `${t * 100}%`
12
- };
13
- return /* @__PURE__ */ o("div", { className: s, style: c, children: /* @__PURE__ */ o(
14
- "div",
15
- {
16
- className: "react-colorful__pointer-fill",
17
- style: { backgroundColor: e }
18
- }
19
- ) });
20
- };
21
- export {
22
- m as Pointer
23
- };