tgui-core 1.7.4 → 1.7.5
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/keys.d.ts +62 -1
- package/dist/common/keys.js +29 -5
- package/dist/common/string.js +17 -18
- package/dist/components/Flex.d.ts +1 -1
- package/dist/components/Flex.js +1 -1
- package/dist/components/InfinitePlane.d.ts +35 -0
- package/dist/components/InfinitePlane.js +81 -77
- package/dist/components/Modal.d.ts +8 -1
- package/dist/components/Modal.js +15 -11
- package/package.json +1 -1
- package/styles/components/Dimmer.scss +2 -1
- package/styles/components/Tooltip.scss +2 -1
package/dist/common/keys.d.ts
CHANGED
|
@@ -21,11 +21,14 @@
|
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
23
|
export declare enum KEY {
|
|
24
|
+
A = "a",
|
|
24
25
|
Alt = "Alt",
|
|
25
26
|
Backspace = "Backspace",
|
|
26
27
|
Control = "Control",
|
|
28
|
+
D = "d",
|
|
27
29
|
Delete = "Delete",
|
|
28
30
|
Down = "ArrowDown",
|
|
31
|
+
E = "e",
|
|
29
32
|
End = "End",
|
|
30
33
|
Enter = "Enter",
|
|
31
34
|
Esc = "Esc",
|
|
@@ -33,13 +36,17 @@ export declare enum KEY {
|
|
|
33
36
|
Home = "Home",
|
|
34
37
|
Insert = "Insert",
|
|
35
38
|
Left = "ArrowLeft",
|
|
39
|
+
N = "n",
|
|
36
40
|
PageDown = "PageDown",
|
|
37
41
|
PageUp = "PageUp",
|
|
38
42
|
Right = "ArrowRight",
|
|
43
|
+
S = "s",
|
|
39
44
|
Shift = "Shift",
|
|
40
45
|
Space = " ",
|
|
41
46
|
Tab = "Tab",
|
|
42
|
-
Up = "ArrowUp"
|
|
47
|
+
Up = "ArrowUp",
|
|
48
|
+
W = "w",
|
|
49
|
+
Z = "z"
|
|
43
50
|
}
|
|
44
51
|
/**
|
|
45
52
|
* ### isEscape
|
|
@@ -53,3 +60,57 @@ export declare enum KEY {
|
|
|
53
60
|
* @returns true if key is Escape or Esc, false otherwise
|
|
54
61
|
*/
|
|
55
62
|
export declare function isEscape(key: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* ### isAlphabetic
|
|
65
|
+
*
|
|
66
|
+
* Checks if the user has hit any alphabetic key (a - z)
|
|
67
|
+
*
|
|
68
|
+
* @param key - the key to check, typically from event.key
|
|
69
|
+
* @returns true if key is in the range of a-z
|
|
70
|
+
*/
|
|
71
|
+
export declare function isAlphabetic(key: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* ### isNumeric
|
|
74
|
+
*
|
|
75
|
+
* Checks if the user has hit any numeric key (0 - 9)
|
|
76
|
+
*
|
|
77
|
+
* @param key - the key to check, typically from event.key
|
|
78
|
+
* @returns true if key is in the range of 0 - 9
|
|
79
|
+
*/
|
|
80
|
+
export declare function isNumeric(key: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* ### isCardinal
|
|
83
|
+
*
|
|
84
|
+
* Checks if the user has hit any cardinal key (n s w e)
|
|
85
|
+
*
|
|
86
|
+
* @param key - the key to check, typically from event.key
|
|
87
|
+
* @returns true if key matches any cardinal n s w e
|
|
88
|
+
*/
|
|
89
|
+
export declare function isCardinal(key: string): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* ### isArrow
|
|
92
|
+
*
|
|
93
|
+
* Checks if the user has hit any arrow key
|
|
94
|
+
*
|
|
95
|
+
* @param key - the key to check, typically from event.key
|
|
96
|
+
* @returns true if key matches any arrow keys
|
|
97
|
+
*/
|
|
98
|
+
export declare function isArrow(key: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* ### isWasd
|
|
101
|
+
*
|
|
102
|
+
* Checks if the user has hit any w a s d key
|
|
103
|
+
*
|
|
104
|
+
* @param key - the key to check, typically from event.key
|
|
105
|
+
* @returns true if key matches any w a s d
|
|
106
|
+
*/
|
|
107
|
+
export declare function isWasd(key: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* ### isMovement
|
|
110
|
+
*
|
|
111
|
+
* Checks if the user has hit any movement key (w a s d and arrow keys)
|
|
112
|
+
*
|
|
113
|
+
* @param key - the key to check, typically from event.key
|
|
114
|
+
* @returns true if key matches any movement key w a s d and arrow keys
|
|
115
|
+
*/
|
|
116
|
+
export declare function isMovement(key: string): boolean;
|
package/dist/common/keys.js
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
3
|
-
return
|
|
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);
|
|
4
22
|
}
|
|
5
23
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
8
32
|
};
|
package/dist/common/string.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function l(e, t = (r) => JSON.stringify(r)) {
|
|
2
2
|
const r = e.toLowerCase().trim();
|
|
3
3
|
return (n) => {
|
|
4
4
|
if (!r)
|
|
@@ -8,16 +8,16 @@ function p(e, t = (r) => JSON.stringify(r)) {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
const a = ["a", "e", "i", "o", "u"];
|
|
11
|
-
function
|
|
11
|
+
function f(e, t, r) {
|
|
12
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();
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function h(e) {
|
|
18
18
|
return e.replace(/(^\w{1})|(\s+\w{1})/g, (t) => t.toUpperCase());
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function g(e) {
|
|
21
21
|
return e.replace(/^\w/, (t) => t.toUpperCase());
|
|
22
22
|
}
|
|
23
23
|
const i = ["Id", "Tv"], u = [
|
|
@@ -43,7 +43,7 @@ const i = ["Id", "Tv"], u = [
|
|
|
43
43
|
"To",
|
|
44
44
|
"With"
|
|
45
45
|
];
|
|
46
|
-
function
|
|
46
|
+
function d(e) {
|
|
47
47
|
if (!e) return e;
|
|
48
48
|
let t = e.replace(/([^\W_]+[^\s-]*) */g, (r) => c(r));
|
|
49
49
|
for (const r of u) {
|
|
@@ -56,20 +56,19 @@ function g(e) {
|
|
|
56
56
|
}
|
|
57
57
|
return t;
|
|
58
58
|
}
|
|
59
|
-
const s = {
|
|
59
|
+
const s = /&(nbsp|amp|quot|lt|gt|apos|trade|copy);/g, p = {
|
|
60
60
|
amp: "&",
|
|
61
61
|
apos: "'",
|
|
62
62
|
gt: ">",
|
|
63
63
|
lt: "<",
|
|
64
64
|
nbsp: " ",
|
|
65
|
-
quot: '"'
|
|
65
|
+
quot: '"',
|
|
66
|
+
trade: "™",
|
|
67
|
+
cops: "©"
|
|
66
68
|
};
|
|
67
|
-
function
|
|
69
|
+
function m(e) {
|
|
68
70
|
return e && e.replace(/<br>/gi, `
|
|
69
|
-
`).replace(/<\/?[a-z0-9-_]+[^>]*>/gi, "").replace(
|
|
70
|
-
/&(nbsp|amp|quot|lt|gt|apos);/g,
|
|
71
|
-
(t, r) => s[r]
|
|
72
|
-
).replace(/&#?([0-9]+);/gi, (t, r) => {
|
|
71
|
+
`).replace(/<\/?[a-z0-9-_]+[^>]*>/gi, "").replace(s, (t, r) => p[r]).replace(/&#?([0-9]+);/gi, (t, r) => {
|
|
73
72
|
const n = Number.parseInt(r, 10);
|
|
74
73
|
return String.fromCharCode(n);
|
|
75
74
|
}).replace(/&#x?([0-9a-f]+);/gi, (t, r) => {
|
|
@@ -80,10 +79,10 @@ function d(e) {
|
|
|
80
79
|
export {
|
|
81
80
|
a as VOWELS,
|
|
82
81
|
c as capitalize,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
h as capitalizeAll,
|
|
83
|
+
g as capitalizeFirst,
|
|
84
|
+
l as createSearch,
|
|
85
|
+
m as decodeHtmlEntities,
|
|
86
|
+
f as pluralize,
|
|
87
|
+
d as toTitleCase
|
|
89
88
|
};
|
|
@@ -20,7 +20,7 @@ export type FlexProps = Partial<{
|
|
|
20
20
|
*/
|
|
21
21
|
direction: string;
|
|
22
22
|
/** Makes flexbox container inline, with similar behavior to an `inline` property on a `Box`. */
|
|
23
|
-
|
|
23
|
+
inlineFlex: boolean;
|
|
24
24
|
/**
|
|
25
25
|
* This defines the alignment along the main axis. It helps distribute extra free space leftover when either all the flex items on a line are
|
|
26
26
|
* inflexible, or are flexible but have reached their maximum size. It also exerts some control over the alignment of items when they overflow
|
package/dist/components/Flex.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Component, PropsWithChildren } from 'react';
|
|
2
|
+
import { BoxProps } from './Box';
|
|
3
|
+
export type InfinitePlaneProps = PropsWithChildren<{
|
|
4
|
+
onZoomChange?: (newZoomValue: number) => void;
|
|
5
|
+
onBackgroundMoved?: (newX: number, newY: number) => void;
|
|
6
|
+
initialLeft?: number;
|
|
7
|
+
initialTop?: number;
|
|
8
|
+
backgroundImage?: string;
|
|
9
|
+
imageWidth: number;
|
|
10
|
+
} & BoxProps>;
|
|
11
|
+
type InfinitePlaneState = {
|
|
12
|
+
mouseDown: boolean;
|
|
13
|
+
left: number;
|
|
14
|
+
top: number;
|
|
15
|
+
lastLeft: number;
|
|
16
|
+
lastTop: number;
|
|
17
|
+
zoom: number;
|
|
18
|
+
};
|
|
19
|
+
export type MouseEventExtension = {
|
|
20
|
+
screenZoomX: number;
|
|
21
|
+
screenZoomY: number;
|
|
22
|
+
};
|
|
23
|
+
export declare class InfinitePlane extends Component<InfinitePlaneProps, InfinitePlaneState> {
|
|
24
|
+
constructor(props: InfinitePlaneProps);
|
|
25
|
+
componentDidMount(): void;
|
|
26
|
+
componentWillUnmount(): void;
|
|
27
|
+
doOffsetMouse: (event: MouseEvent & MouseEventExtension) => void;
|
|
28
|
+
handleMouseDown: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
29
|
+
onMouseUp: () => void;
|
|
30
|
+
handleZoomIncrease: (_event: any) => void;
|
|
31
|
+
handleZoomDecrease: (_event: any) => void;
|
|
32
|
+
handleMouseMove: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
33
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -1,20 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var O = (a, s, o) => s in a ? x(a, s, { enumerable: !0, configurable: !0, writable: !0, value: o }) : a[s] = o;
|
|
3
|
+
var i = (a, s, o) => O(a, typeof s != "symbol" ? s + "" : s, o);
|
|
4
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { Component as Z } from "react";
|
|
6
|
+
import { computeBoxProps as D } from "../common/ui.js";
|
|
7
|
+
import { Button as w } from "./Button.js";
|
|
8
|
+
import { ProgressBar as E } from "./ProgressBar.js";
|
|
9
|
+
import { Stack as h } from "./Stack.js";
|
|
10
|
+
const M = 0.5, v = 1.5, g = 0.1;
|
|
11
|
+
class b extends Z {
|
|
12
|
+
constructor(o) {
|
|
13
|
+
super(o);
|
|
14
|
+
// This is really, REALLY cursed and basically overrides a built-in browser event via propagation rules
|
|
15
|
+
i(this, "doOffsetMouse", (o) => {
|
|
16
|
+
const { zoom: e } = this.state;
|
|
17
|
+
o.screenZoomX = o.screenX * e ** -1, o.screenZoomY = o.screenY * e ** -1;
|
|
18
|
+
});
|
|
19
|
+
i(this, "handleMouseDown", (o) => {
|
|
20
|
+
this.setState((e) => ({
|
|
21
|
+
mouseDown: !0,
|
|
22
|
+
lastLeft: o.clientX - e.left,
|
|
23
|
+
lastTop: o.clientY - e.top
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
i(this, "onMouseUp", () => {
|
|
27
|
+
this.setState({
|
|
28
|
+
mouseDown: !1
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
i(this, "handleZoomIncrease", (o) => {
|
|
32
|
+
const { onZoomChange: e } = this.props, { zoom: n } = this.state, t = Math.min(n + g, v);
|
|
33
|
+
this.setState({
|
|
34
|
+
zoom: t
|
|
35
|
+
}), e && e(t);
|
|
36
|
+
});
|
|
37
|
+
i(this, "handleZoomDecrease", (o) => {
|
|
38
|
+
const { onZoomChange: e } = this.props, { zoom: n } = this.state, t = Math.max(n - g, M);
|
|
39
|
+
this.setState({
|
|
40
|
+
zoom: t
|
|
41
|
+
}), e && e(t);
|
|
42
|
+
});
|
|
43
|
+
i(this, "handleMouseMove", (o) => {
|
|
44
|
+
const { onBackgroundMoved: e, initialLeft: n = 0, initialTop: t = 0 } = this.props;
|
|
45
|
+
if (this.state.mouseDown) {
|
|
46
|
+
let l, m;
|
|
47
|
+
this.setState((d) => (l = o.clientX - d.lastLeft, m = o.clientY - d.lastTop, e && e(l + n, m + t), {
|
|
48
|
+
left: l,
|
|
49
|
+
top: m
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.state = {
|
|
11
54
|
mouseDown: !1,
|
|
12
55
|
left: 0,
|
|
13
56
|
top: 0,
|
|
14
57
|
lastLeft: 0,
|
|
15
58
|
lastTop: 0,
|
|
16
59
|
zoom: 1
|
|
17
|
-
}
|
|
60
|
+
};
|
|
18
61
|
}
|
|
19
62
|
componentDidMount() {
|
|
20
63
|
window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("mousedown", this.doOffsetMouse), window.addEventListener("mousemove", this.doOffsetMouse), window.addEventListener("mouseup", this.doOffsetMouse);
|
|
@@ -22,67 +65,28 @@ class k extends v {
|
|
|
22
65
|
componentWillUnmount() {
|
|
23
66
|
window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousedown", this.doOffsetMouse), window.removeEventListener("mousemove", this.doOffsetMouse), window.removeEventListener("mouseup", this.doOffsetMouse);
|
|
24
67
|
}
|
|
25
|
-
doOffsetMouse(e) {
|
|
26
|
-
const { zoom: o } = this.state;
|
|
27
|
-
e.screenZoomX = e.screenX * o ** -1, e.screenZoomY = e.screenY * o ** -1;
|
|
28
|
-
}
|
|
29
|
-
handleMouseDown(e) {
|
|
30
|
-
this.setState((o) => ({
|
|
31
|
-
mouseDown: !0,
|
|
32
|
-
lastLeft: e.clientX - o.left,
|
|
33
|
-
lastTop: e.clientY - o.top
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
onMouseUp() {
|
|
37
|
-
this.setState({
|
|
38
|
-
mouseDown: !1
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
handleZoomIncrease(e) {
|
|
42
|
-
const { onZoomChange: o } = this.props, { zoom: s } = this.state, t = Math.min(s + M, f);
|
|
43
|
-
this.setState({
|
|
44
|
-
zoom: t
|
|
45
|
-
}), o && o(t);
|
|
46
|
-
}
|
|
47
|
-
handleZoomDecrease(e) {
|
|
48
|
-
const { onZoomChange: o } = this.props, { zoom: s } = this.state, t = Math.max(s - M, p);
|
|
49
|
-
this.setState({
|
|
50
|
-
zoom: t
|
|
51
|
-
}), o && o(t);
|
|
52
|
-
}
|
|
53
|
-
handleMouseMove(e) {
|
|
54
|
-
const { onBackgroundMoved: o, initialLeft: s = 0, initialTop: t = 0 } = this.props;
|
|
55
|
-
if (this.state.mouseDown) {
|
|
56
|
-
let a, i;
|
|
57
|
-
this.setState((h) => (a = e.clientX - h.lastLeft, i = e.clientY - h.lastTop, {
|
|
58
|
-
left: a,
|
|
59
|
-
top: i
|
|
60
|
-
})), o && o(a + s, i + t);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
68
|
render() {
|
|
64
69
|
const {
|
|
65
|
-
children:
|
|
66
|
-
backgroundImage:
|
|
67
|
-
imageWidth:
|
|
70
|
+
children: o,
|
|
71
|
+
backgroundImage: e,
|
|
72
|
+
imageWidth: n,
|
|
68
73
|
initialLeft: t = 0,
|
|
69
|
-
initialTop:
|
|
70
|
-
...
|
|
71
|
-
} = this.props, { left:
|
|
72
|
-
return /* @__PURE__ */
|
|
74
|
+
initialTop: l = 0,
|
|
75
|
+
...m
|
|
76
|
+
} = this.props, { left: d, top: L, zoom: u } = this.state, p = t + d, f = l + L;
|
|
77
|
+
return /* @__PURE__ */ c(
|
|
73
78
|
"div",
|
|
74
79
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...i,
|
|
80
|
+
...D({
|
|
81
|
+
...m,
|
|
78
82
|
style: {
|
|
79
|
-
...
|
|
83
|
+
...m.style,
|
|
80
84
|
overflow: "hidden",
|
|
81
85
|
position: "relative"
|
|
82
86
|
}
|
|
83
87
|
}),
|
|
84
88
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ r(
|
|
86
90
|
"div",
|
|
87
91
|
{
|
|
88
92
|
onMouseDown: this.handleMouseDown,
|
|
@@ -91,43 +95,43 @@ class k extends v {
|
|
|
91
95
|
position: "fixed",
|
|
92
96
|
height: "100%",
|
|
93
97
|
width: "100%",
|
|
94
|
-
backgroundImage: `url("${
|
|
95
|
-
backgroundPosition: `${
|
|
98
|
+
backgroundImage: `url("${e}")`,
|
|
99
|
+
backgroundPosition: `${p}px ${f}px`,
|
|
96
100
|
backgroundRepeat: "repeat",
|
|
97
|
-
backgroundSize: `${
|
|
101
|
+
backgroundSize: `${u * n}px`
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
),
|
|
101
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ r(
|
|
102
106
|
"div",
|
|
103
107
|
{
|
|
104
108
|
onMouseDown: this.handleMouseDown,
|
|
105
109
|
onMouseMove: this.handleMouseMove,
|
|
106
110
|
style: {
|
|
107
111
|
position: "fixed",
|
|
108
|
-
transform: `translate(${
|
|
112
|
+
transform: `translate(${p}px, ${f}px) scale(${u})`,
|
|
109
113
|
transformOrigin: "top left",
|
|
110
114
|
height: "100%",
|
|
111
115
|
width: "100%"
|
|
112
116
|
},
|
|
113
|
-
children:
|
|
117
|
+
children: o
|
|
114
118
|
}
|
|
115
119
|
),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
|
|
120
|
+
/* @__PURE__ */ c(h, { position: "absolute", width: "100%", children: [
|
|
121
|
+
/* @__PURE__ */ r(h.Item, { children: /* @__PURE__ */ r(w, { icon: "minus", onClick: this.handleZoomDecrease }) }),
|
|
122
|
+
/* @__PURE__ */ r(h.Item, { grow: 1, children: /* @__PURE__ */ c(
|
|
123
|
+
E,
|
|
120
124
|
{
|
|
121
|
-
minValue:
|
|
122
|
-
value:
|
|
123
|
-
maxValue:
|
|
125
|
+
minValue: M,
|
|
126
|
+
value: u,
|
|
127
|
+
maxValue: v,
|
|
124
128
|
children: [
|
|
125
|
-
|
|
129
|
+
u,
|
|
126
130
|
"x"
|
|
127
131
|
]
|
|
128
132
|
}
|
|
129
133
|
) }),
|
|
130
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ r(h.Item, { children: /* @__PURE__ */ r(w, { icon: "plus", onClick: this.handleZoomIncrease }) })
|
|
131
135
|
] })
|
|
132
136
|
]
|
|
133
137
|
}
|
|
@@ -135,5 +139,5 @@ class k extends v {
|
|
|
135
139
|
}
|
|
136
140
|
}
|
|
137
141
|
export {
|
|
138
|
-
|
|
142
|
+
b as InfinitePlane
|
|
139
143
|
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
1
2
|
import { BoxProps } from './Box';
|
|
3
|
+
export type ModalProps = BoxProps & Partial<{
|
|
4
|
+
/** Fires once the enter key is pressed */
|
|
5
|
+
onEnter: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
6
|
+
/** Fires once the escape key is pressed */
|
|
7
|
+
onEscape: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
8
|
+
}>;
|
|
2
9
|
/**
|
|
3
10
|
* ## Modal
|
|
4
11
|
* A modal window. Uses a [Dimmer](https://github.com/tgstation/tgui-core/tree/main/lib/components/Dimmer.tsx)
|
|
@@ -6,4 +13,4 @@ import { BoxProps } from './Box';
|
|
|
6
13
|
*
|
|
7
14
|
* Must be a direct child of a layout component (e.g. `Window`).
|
|
8
15
|
*/
|
|
9
|
-
export declare function Modal(props:
|
|
16
|
+
export declare function Modal(props: ModalProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { KEY as n, isEscape as f } from "../common/keys.js";
|
|
3
|
+
import { classes as l } from "../common/react.js";
|
|
4
|
+
import { computeBoxClassName as p, computeBoxProps as d } from "../common/ui.js";
|
|
5
|
+
import { Dimmer as u } from "./Dimmer.js";
|
|
6
|
+
function N(s) {
|
|
7
|
+
const { className: t, children: a, onEnter: r, onEscape: m, ...e } = s;
|
|
8
|
+
function c(o) {
|
|
9
|
+
o.key === n.Enter && (r == null || r(o)), f(o.key) && (m == null || m(o));
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ i(u, { onKeyDown: c, children: /* @__PURE__ */ i(
|
|
8
12
|
"div",
|
|
9
13
|
{
|
|
10
|
-
className:
|
|
11
|
-
...
|
|
12
|
-
children:
|
|
14
|
+
className: l(["Modal", t, p(e)]),
|
|
15
|
+
...d(e),
|
|
16
|
+
children: a
|
|
13
17
|
}
|
|
14
18
|
) });
|
|
15
19
|
}
|
|
16
20
|
export {
|
|
17
|
-
|
|
21
|
+
N as Modal
|
|
18
22
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ $background-color: hsl(0, 0%, 0%) !default;
|
|
|
6
6
|
$border-radius: base.$border-radius !default;
|
|
7
7
|
|
|
8
8
|
.Tooltip {
|
|
9
|
-
z-index: 2;
|
|
10
9
|
padding: 0.5em 0.75em;
|
|
11
10
|
pointer-events: none;
|
|
12
11
|
text-align: left;
|
|
@@ -16,4 +15,6 @@ $border-radius: base.$border-radius !default;
|
|
|
16
15
|
box-shadow: 0.1em 0.1em 1.25em -0.1em rgba(0, 0, 0, 0.5);
|
|
17
16
|
border-radius: $border-radius;
|
|
18
17
|
max-width: base.em(250px);
|
|
18
|
+
// Must be over everything
|
|
19
|
+
z-index: 999;
|
|
19
20
|
}
|