tgui-core 1.8.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/constants.d.ts +4 -0
- package/dist/common/constants.js +17 -0
- package/dist/common/hotkeys.js +48 -48
- package/dist/common/ui.d.ts +6 -0
- package/dist/common/ui.js +63 -59
- package/dist/components/AnimatedNumber.d.ts +1 -1
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/Button.js +21 -22
- package/dist/components/Chart.d.ts +3 -15
- package/dist/components/Chart.js +68 -86
- package/dist/components/ColorBox.js +3 -3
- package/dist/components/Dialog.d.ts +16 -0
- package/dist/components/Dialog.js +5 -5
- package/dist/components/DmIcon.d.ts +1 -1
- package/dist/components/DraggableControl.d.ts +56 -0
- package/dist/components/DraggableControl.js +126 -176
- package/dist/components/Dropdown.d.ts +8 -6
- package/dist/components/Dropdown.js +137 -129
- package/dist/components/FitText.d.ts +1 -1
- package/dist/components/Floating.d.ts +75 -0
- package/dist/components/Floating.js +2235 -0
- package/dist/components/ImageButton.d.ts +2 -3
- package/dist/components/ImageButton.js +88 -98
- package/dist/components/InfinitePlane.d.ts +35 -32
- package/dist/components/InfinitePlane.js +123 -133
- package/dist/components/Knob.d.ts +22 -6
- package/dist/components/Knob.js +45 -46
- package/dist/components/MenuBar.js +81 -97
- package/dist/components/Modal.js +12 -12
- package/dist/components/NumberInput.d.ts +1 -1
- package/dist/components/Popper.d.ts +5 -1
- package/dist/components/Popper.js +1026 -121
- package/dist/components/ProgressBar.js +3 -3
- package/dist/components/RoundGauge.js +30 -30
- package/dist/components/Section.js +7 -7
- package/dist/components/Slider.d.ts +22 -6
- package/dist/components/Slider.js +55 -56
- package/dist/components/Stack.js +3 -3
- package/dist/components/Table.js +7 -7
- package/dist/components/Tabs.js +7 -7
- package/dist/components/TextArea.d.ts +17 -0
- package/dist/components/TextArea.js +35 -33
- package/dist/components/Tooltip.d.ts +3 -34
- package/dist/components/Tooltip.js +14 -77
- package/dist/components/TrackOutsideClicks.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +64 -62
- package/package.json +26 -27
- package/styles/base.scss +13 -11
- package/styles/colors.scss +63 -67
- package/styles/components/BlockQuote.scss +5 -8
- package/styles/components/Button.scss +123 -99
- package/styles/components/Dialog.scss +23 -30
- package/styles/components/Dimmer.scss +3 -8
- package/styles/components/Divider.scss +6 -7
- package/styles/components/Dropdown.scss +103 -51
- package/styles/components/Flex.scss +0 -1
- package/styles/components/Floating.scss +60 -0
- package/styles/components/ImageButton.scss +136 -192
- package/styles/components/Input.scss +24 -26
- package/styles/components/Knob.scss +37 -41
- package/styles/components/LabeledList.scss +8 -6
- package/styles/components/MenuBar.scss +17 -21
- package/styles/components/Modal.scss +8 -7
- package/styles/components/NoticeBox.scss +22 -26
- package/styles/components/NumberInput.scss +30 -28
- package/styles/components/ProgressBar.scss +27 -19
- package/styles/components/RoundGauge.scss +46 -26
- package/styles/components/Section.scss +17 -32
- package/styles/components/Slider.scss +18 -15
- package/styles/components/Stack.scss +8 -48
- package/styles/components/Table.scss +2 -2
- package/styles/components/Tabs.scss +92 -66
- package/styles/components/TextArea.scss +32 -36
- package/styles/components/Tooltip.scss +10 -13
- package/styles/functions.scss +1 -62
- package/styles/main.scss +6 -1
- package/styles/reset.scss +7 -11
- package/styles/vars-colors.scss +108 -0
- package/styles/vars-components.scss +162 -0
- package/styles/vars-values.scss +110 -0
- package/dist/popper-CiqSDJTE.js +0 -906
package/dist/components/Knob.js
CHANGED
|
@@ -1,78 +1,77 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
-
import { keyOfMatchingRange as
|
|
3
|
-
import { classes as
|
|
4
|
-
import {
|
|
5
|
-
import { DraggableControl as
|
|
6
|
-
function
|
|
2
|
+
import { keyOfMatchingRange as S, scale as c } from "../common/math.js";
|
|
3
|
+
import { classes as $ } from "../common/react.js";
|
|
4
|
+
import { computeBoxProps as j, computeBoxClassName as E } from "../common/ui.js";
|
|
5
|
+
import { DraggableControl as T } from "./DraggableControl.js";
|
|
6
|
+
function G(m) {
|
|
7
7
|
const {
|
|
8
8
|
// Draggable props (passthrough)
|
|
9
|
-
animated:
|
|
10
|
-
format:
|
|
9
|
+
animated: d,
|
|
10
|
+
format: p,
|
|
11
11
|
maxValue: a,
|
|
12
12
|
minValue: l,
|
|
13
13
|
onChange: u,
|
|
14
|
-
onDrag:
|
|
15
|
-
step:
|
|
16
|
-
stepPixelSize:
|
|
17
|
-
suppressFlicker:
|
|
18
|
-
unclamped:
|
|
19
|
-
unit:
|
|
20
|
-
value:
|
|
14
|
+
onDrag: g,
|
|
15
|
+
step: _,
|
|
16
|
+
stepPixelSize: b,
|
|
17
|
+
suppressFlicker: f,
|
|
18
|
+
unclamped: h,
|
|
19
|
+
unit: x,
|
|
20
|
+
value: r,
|
|
21
21
|
// Own props
|
|
22
|
-
bipolar:
|
|
23
|
-
className:
|
|
24
|
-
color:
|
|
25
|
-
fillValue:
|
|
22
|
+
bipolar: s,
|
|
23
|
+
className: K,
|
|
24
|
+
color: v,
|
|
25
|
+
fillValue: n,
|
|
26
26
|
ranges: N = {},
|
|
27
27
|
size: y = 1,
|
|
28
28
|
style: V,
|
|
29
|
-
...
|
|
30
|
-
} =
|
|
29
|
+
...i
|
|
30
|
+
} = m;
|
|
31
31
|
return /* @__PURE__ */ e(
|
|
32
|
-
|
|
32
|
+
T,
|
|
33
33
|
{
|
|
34
34
|
dragMatrix: [0, -1],
|
|
35
|
-
animated:
|
|
36
|
-
format:
|
|
35
|
+
animated: d,
|
|
36
|
+
format: p,
|
|
37
37
|
maxValue: a,
|
|
38
38
|
minValue: l,
|
|
39
39
|
onChange: u,
|
|
40
|
-
onDrag:
|
|
41
|
-
step:
|
|
42
|
-
stepPixelSize:
|
|
43
|
-
suppressFlicker:
|
|
44
|
-
unclamped:
|
|
45
|
-
unit:
|
|
46
|
-
value:
|
|
40
|
+
onDrag: g,
|
|
41
|
+
step: _,
|
|
42
|
+
stepPixelSize: b,
|
|
43
|
+
suppressFlicker: f,
|
|
44
|
+
unclamped: h,
|
|
45
|
+
unit: x,
|
|
46
|
+
value: r,
|
|
47
47
|
children: (k) => {
|
|
48
48
|
const {
|
|
49
49
|
displayElement: D,
|
|
50
|
-
displayValue:
|
|
50
|
+
displayValue: t,
|
|
51
51
|
dragging: M,
|
|
52
52
|
handleDragStart: B,
|
|
53
|
-
inputElement: P
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
s ?? i,
|
|
53
|
+
inputElement: P
|
|
54
|
+
} = k, C = c(
|
|
55
|
+
n ?? t,
|
|
57
56
|
l,
|
|
58
57
|
a
|
|
59
|
-
),
|
|
58
|
+
), F = c(t, l, a), w = v || S(n ?? r, N) || "default", z = Math.min((F - 0.5) * 270, 225);
|
|
60
59
|
return /* @__PURE__ */ o(
|
|
61
60
|
"div",
|
|
62
61
|
{
|
|
63
|
-
className:
|
|
62
|
+
className: $([
|
|
64
63
|
"Knob",
|
|
65
|
-
`Knob--color--${
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
E(
|
|
64
|
+
`Knob--color--${w}`,
|
|
65
|
+
s && "Knob--bipolar",
|
|
66
|
+
K,
|
|
67
|
+
E(i)
|
|
69
68
|
]),
|
|
70
|
-
...
|
|
69
|
+
...j({
|
|
71
70
|
style: {
|
|
72
71
|
fontSize: `${y}em`,
|
|
73
72
|
...V
|
|
74
73
|
},
|
|
75
|
-
...
|
|
74
|
+
...i
|
|
76
75
|
}),
|
|
77
76
|
onMouseDown: B,
|
|
78
77
|
children: [
|
|
@@ -81,7 +80,7 @@ function H(c) {
|
|
|
81
80
|
{
|
|
82
81
|
className: "Knob__cursorBox",
|
|
83
82
|
style: {
|
|
84
|
-
transform: `rotate(${
|
|
83
|
+
transform: `rotate(${z}deg)`
|
|
85
84
|
},
|
|
86
85
|
children: /* @__PURE__ */ e("div", { className: "Knob__cursor" })
|
|
87
86
|
}
|
|
@@ -111,7 +110,7 @@ function H(c) {
|
|
|
111
110
|
className: "Knob__ringFill",
|
|
112
111
|
style: {
|
|
113
112
|
strokeDashoffset: Math.max(
|
|
114
|
-
((
|
|
113
|
+
((s ? 2.75 : 2) - C * 1.5) * Math.PI * 50,
|
|
115
114
|
0
|
|
116
115
|
)
|
|
117
116
|
},
|
|
@@ -132,5 +131,5 @@ function H(c) {
|
|
|
132
131
|
);
|
|
133
132
|
}
|
|
134
133
|
export {
|
|
135
|
-
|
|
134
|
+
G as Knob
|
|
136
135
|
};
|
|
@@ -1,149 +1,133 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as B, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as f } from "react";
|
|
3
|
-
import { classes as
|
|
4
|
-
import { Box as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
8
|
-
const { children: e, width: o } = n;
|
|
9
|
-
return /* @__PURE__ */ r(
|
|
10
|
-
"div",
|
|
11
|
-
{
|
|
12
|
-
className: "Menubar__menu",
|
|
13
|
-
style: {
|
|
14
|
-
width: o
|
|
15
|
-
},
|
|
16
|
-
children: e
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
function N(n) {
|
|
3
|
+
import { classes as d } from "../common/react.js";
|
|
4
|
+
import { Box as c } from "./Box.js";
|
|
5
|
+
import { Floating as h } from "./Floating.js";
|
|
6
|
+
import { Icon as v } from "./Icon.js";
|
|
7
|
+
function N(r) {
|
|
21
8
|
const {
|
|
22
9
|
children: e,
|
|
23
|
-
className:
|
|
24
|
-
disabled:
|
|
25
|
-
display:
|
|
10
|
+
className: a,
|
|
11
|
+
disabled: o,
|
|
12
|
+
display: t,
|
|
26
13
|
onClick: u,
|
|
27
14
|
onMouseOver: s,
|
|
28
|
-
open:
|
|
15
|
+
open: m,
|
|
29
16
|
openWidth: l,
|
|
30
|
-
onOutsideClick:
|
|
17
|
+
onOutsideClick: _,
|
|
31
18
|
...M
|
|
32
|
-
} =
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
)
|
|
66
|
-
] });
|
|
19
|
+
} = r, p = f(null);
|
|
20
|
+
return /* @__PURE__ */ n(
|
|
21
|
+
h,
|
|
22
|
+
{
|
|
23
|
+
allowedOutsideClasses: ".Menubar_inner",
|
|
24
|
+
content: /* @__PURE__ */ n(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: "MenuBar__menu",
|
|
28
|
+
style: {
|
|
29
|
+
width: l
|
|
30
|
+
},
|
|
31
|
+
children: e
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
children: /* @__PURE__ */ n("div", { ref: p, className: "Menubar_inner", children: /* @__PURE__ */ n(
|
|
35
|
+
c,
|
|
36
|
+
{
|
|
37
|
+
className: d([
|
|
38
|
+
"MenuBar__MenuBarButton",
|
|
39
|
+
"MenuBar__font",
|
|
40
|
+
"MenuBar__hover",
|
|
41
|
+
a
|
|
42
|
+
]),
|
|
43
|
+
...M,
|
|
44
|
+
onClick: o ? () => null : u,
|
|
45
|
+
onMouseOver: s,
|
|
46
|
+
children: /* @__PURE__ */ n("span", { className: "MenuBar__MenuBarButton-text", children: t })
|
|
47
|
+
}
|
|
48
|
+
) })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
67
51
|
}
|
|
68
|
-
function
|
|
52
|
+
function i(r) {
|
|
69
53
|
const {
|
|
70
54
|
entry: e,
|
|
71
|
-
children:
|
|
72
|
-
openWidth:
|
|
73
|
-
display:
|
|
55
|
+
children: a,
|
|
56
|
+
openWidth: o,
|
|
57
|
+
display: t,
|
|
74
58
|
setOpenMenuBar: u,
|
|
75
59
|
openMenuBar: s,
|
|
76
|
-
setOpenOnHover:
|
|
60
|
+
setOpenOnHover: m,
|
|
77
61
|
openOnHover: l,
|
|
78
|
-
disabled:
|
|
62
|
+
disabled: _,
|
|
79
63
|
className: M
|
|
80
|
-
} =
|
|
81
|
-
return /* @__PURE__ */
|
|
64
|
+
} = r;
|
|
65
|
+
return /* @__PURE__ */ n(
|
|
82
66
|
N,
|
|
83
67
|
{
|
|
84
|
-
openWidth:
|
|
85
|
-
display:
|
|
86
|
-
disabled:
|
|
68
|
+
openWidth: o,
|
|
69
|
+
display: t,
|
|
70
|
+
disabled: _,
|
|
87
71
|
open: s === e,
|
|
88
72
|
className: M,
|
|
89
73
|
onClick: () => {
|
|
90
|
-
u(s === e ? null : e),
|
|
74
|
+
u(s === e ? null : e), m(!l);
|
|
91
75
|
},
|
|
92
76
|
onOutsideClick: () => {
|
|
93
|
-
u(null),
|
|
77
|
+
u(null), m(!1);
|
|
94
78
|
},
|
|
95
79
|
onMouseOver: () => {
|
|
96
80
|
l && u(e);
|
|
97
81
|
},
|
|
98
|
-
children:
|
|
82
|
+
children: a
|
|
99
83
|
}
|
|
100
84
|
);
|
|
101
85
|
}
|
|
102
|
-
|
|
103
|
-
function
|
|
104
|
-
const { value: e, displayText:
|
|
86
|
+
O.Dropdown = i;
|
|
87
|
+
function k(r) {
|
|
88
|
+
const { value: e, displayText: a, onClick: o, checked: t } = r;
|
|
105
89
|
return /* @__PURE__ */ B(
|
|
106
|
-
|
|
90
|
+
c,
|
|
107
91
|
{
|
|
108
|
-
className:
|
|
92
|
+
className: d([
|
|
109
93
|
"MenuBar__font",
|
|
110
94
|
"MenuBar__MenuItem",
|
|
111
95
|
"MenuBar__MenuItemToggle",
|
|
112
96
|
"MenuBar__hover"
|
|
113
97
|
]),
|
|
114
|
-
onClick: () =>
|
|
98
|
+
onClick: () => o(e),
|
|
115
99
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
|
|
100
|
+
/* @__PURE__ */ n("div", { className: "MenuBar__MenuItemToggle__check", children: /* @__PURE__ */ n(v, { size: 1.3, name: t ? "check" : "" }) }),
|
|
101
|
+
a
|
|
118
102
|
]
|
|
119
103
|
}
|
|
120
104
|
);
|
|
121
105
|
}
|
|
122
|
-
|
|
123
|
-
function
|
|
124
|
-
const { value: e, displayText:
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
|
|
106
|
+
i.MenuItemToggle = k;
|
|
107
|
+
function g(r) {
|
|
108
|
+
const { value: e, displayText: a, onClick: o } = r;
|
|
109
|
+
return /* @__PURE__ */ n(
|
|
110
|
+
c,
|
|
127
111
|
{
|
|
128
|
-
className:
|
|
112
|
+
className: d([
|
|
129
113
|
"MenuBar__font",
|
|
130
114
|
"MenuBar__MenuItem",
|
|
131
115
|
"MenuBar__hover"
|
|
132
116
|
]),
|
|
133
|
-
onClick: () =>
|
|
134
|
-
children:
|
|
117
|
+
onClick: () => o == null ? void 0 : o(e),
|
|
118
|
+
children: a
|
|
135
119
|
}
|
|
136
120
|
);
|
|
137
121
|
}
|
|
138
|
-
|
|
139
|
-
function
|
|
140
|
-
return /* @__PURE__ */
|
|
122
|
+
i.MenuItem = g;
|
|
123
|
+
function I() {
|
|
124
|
+
return /* @__PURE__ */ n("div", { className: "MenuBar__Separator" });
|
|
141
125
|
}
|
|
142
|
-
|
|
143
|
-
function
|
|
144
|
-
const { children: e } =
|
|
145
|
-
return /* @__PURE__ */
|
|
126
|
+
i.Separator = I;
|
|
127
|
+
function O(r) {
|
|
128
|
+
const { children: e } = r;
|
|
129
|
+
return /* @__PURE__ */ n(c, { className: "MenuBar", children: e });
|
|
146
130
|
}
|
|
147
131
|
export {
|
|
148
|
-
|
|
132
|
+
O as MenuBar
|
|
149
133
|
};
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { KEY as
|
|
3
|
-
import { classes as
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { KEY as l, isEscape as n } from "../common/keys.js";
|
|
3
|
+
import { classes as f } from "../common/react.js";
|
|
4
|
+
import { computeBoxProps as p, computeBoxClassName as d } from "../common/ui.js";
|
|
5
5
|
import { Dimmer as u } from "./Dimmer.js";
|
|
6
|
-
function
|
|
7
|
-
const { className:
|
|
6
|
+
function K(i) {
|
|
7
|
+
const { className: a, children: t, onEnter: m, onEscape: r, ...e } = i;
|
|
8
8
|
function c(o) {
|
|
9
|
-
o.key ===
|
|
9
|
+
o.key === l.Enter && (m == null || m(o)), n(o.key) && (r == null || r(o));
|
|
10
10
|
}
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ s(u, { className: "Modal__dimmer", onKeyDown: c, children: /* @__PURE__ */ s(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
|
-
className:
|
|
15
|
-
...
|
|
16
|
-
children:
|
|
14
|
+
className: f(["Modal", a, d(e)]),
|
|
15
|
+
...p(e),
|
|
16
|
+
children: t
|
|
17
17
|
}
|
|
18
18
|
) });
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
K as Modal
|
|
22
22
|
};
|
|
@@ -51,7 +51,7 @@ type State = {
|
|
|
51
51
|
* to fine tune the value, or single click it to manually type a number.
|
|
52
52
|
*/
|
|
53
53
|
export declare class NumberInput extends Component<Props, State> {
|
|
54
|
-
inputRef: RefObject<HTMLInputElement>;
|
|
54
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
55
55
|
dragTimeout: NodeJS.Timeout;
|
|
56
56
|
dragInterval: NodeJS.Timeout;
|
|
57
57
|
state: State;
|
|
@@ -19,8 +19,12 @@ type OptionalProps = Partial<{
|
|
|
19
19
|
type Props = RequiredProps & OptionalProps;
|
|
20
20
|
/**
|
|
21
21
|
* ## Popper
|
|
22
|
-
*
|
|
22
|
+
* Popper lets you position elements so that they don't go out of the bounds of the window.
|
|
23
23
|
* @url https://popper.js.org/react-popper/ for more information.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated - Use
|
|
26
|
+
* [Floating](https://github.com/tgstation/tgui-core/tree/main/lib/components/Floating.tsx)
|
|
27
|
+
* instead.
|
|
24
28
|
*/
|
|
25
29
|
export declare function Popper(props: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
|
|
26
30
|
export {};
|