tgui-core 1.0.13 → 1.0.14
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/README.md +30 -30
- package/dist/{ProgressBar.module-Jzqlebbx.js → ProgressBar.module-BkAFfFy0.js} +4 -4
- package/dist/assets/Tooltip.css +1 -0
- package/dist/components/ProgressBar.js +15 -15
- package/dist/components/Section.d.ts +1 -1
- package/dist/components/Slider.js +24 -24
- package/dist/components/TextArea.d.ts +2 -1
- package/dist/components/Tooltip.js +10 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# tgui-core
|
|
2
|
-
|
|
3
|
-
A collection of utilities and components for the [tgui](https://github.com/tgstation/tgstation) framework.
|
|
4
|
-
|
|
5
|
-
This package was built to help the various downstream SS13 servers stay up to date with TGUI without having to keep a local version of each file.
|
|
6
|
-
|
|
7
|
-
You can view the code on [GitHub](https://github.com/jlsnow301/tgui-core).
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
yarn add tgui-core
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
import { Button } from 'tgui-core/components/Button';
|
|
19
|
-
import { render } from 'tgui-core/render';
|
|
20
|
-
|
|
21
|
-
<Button>Click</Button>;
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## License
|
|
25
|
-
|
|
26
|
-
MIT
|
|
27
|
-
|
|
28
|
-
## Contributing
|
|
29
|
-
|
|
30
|
-
Contributions are welcome. Please open an issue or a pull request. I am available on the tgstation [discord](https://discord.com/invite/EUvpBtU78X).
|
|
1
|
+
# tgui-core
|
|
2
|
+
|
|
3
|
+
A collection of utilities and components for the [tgui](https://github.com/tgstation/tgstation) framework.
|
|
4
|
+
|
|
5
|
+
This package was built to help the various downstream SS13 servers stay up to date with TGUI without having to keep a local version of each file.
|
|
6
|
+
|
|
7
|
+
You can view the code on [GitHub](https://github.com/jlsnow301/tgui-core).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
yarn add tgui-core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Button } from 'tgui-core/components/Button';
|
|
19
|
+
import { render } from 'tgui-core/render';
|
|
20
|
+
|
|
21
|
+
<Button>Click</Button>;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
MIT
|
|
27
|
+
|
|
28
|
+
## Contributing
|
|
29
|
+
|
|
30
|
+
Contributions are welcome. Please open an issue or a pull request. I am available on the tgstation [discord](https://discord.com/invite/EUvpBtU78X).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './assets/ProgressBar.css';const _ = "_progressBar_140lk_17", o = "_fill_140lk_29", l = "_fill__animated_140lk_36", r = "_content_140lk_40", c = "_color__default_140lk_47", e = "_color__black_140lk_54", t = "_color__white_140lk_61", n = "_color__red_140lk_68", a = "_color__orange_140lk_75", s = "_color__yellow_140lk_82", k = "_color__olive_140lk_89",
|
|
1
|
+
import './assets/ProgressBar.css';const _ = "_progressBar_140lk_17", o = "_fill_140lk_29", l = "_fill__animated_140lk_36", r = "_content_140lk_40", c = "_color__default_140lk_47", e = "_color__black_140lk_54", t = "_color__white_140lk_61", n = "_color__red_140lk_68", a = "_color__orange_140lk_75", s = "_color__yellow_140lk_82", k = "_color__olive_140lk_89", i = "_color__green_140lk_96", g = "_color__teal_140lk_103", b = "_color__blue_140lk_110", d = "_color__violet_140lk_117", p = "_color__purple_140lk_124", f = "_color__pink_140lk_131", u = "_color__brown_140lk_138", v = "_color__grey_140lk_145", w = "_color__good_140lk_159", y = "_color__average_140lk_166", h = "_color__bad_140lk_173", m = "_color__label_140lk_180", B = {
|
|
2
2
|
progressBar: _,
|
|
3
3
|
fill: o,
|
|
4
4
|
fill__animated: l,
|
|
@@ -10,8 +10,8 @@ import './assets/ProgressBar.css';const _ = "_progressBar_140lk_17", o = "_fill_
|
|
|
10
10
|
color__orange: a,
|
|
11
11
|
color__yellow: s,
|
|
12
12
|
color__olive: k,
|
|
13
|
-
color__green:
|
|
14
|
-
color__teal:
|
|
13
|
+
color__green: i,
|
|
14
|
+
color__teal: g,
|
|
15
15
|
color__blue: b,
|
|
16
16
|
color__violet: d,
|
|
17
17
|
color__purple: p,
|
|
@@ -25,5 +25,5 @@ import './assets/ProgressBar.css';const _ = "_progressBar_140lk_17", o = "_fill_
|
|
|
25
25
|
color__label: m
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
B as
|
|
28
|
+
B as s
|
|
29
29
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._tooltip_1pib4_13{z-index:2;padding:.5em .75em;pointer-events:none;text-align:left;transition:opacity .15s ease-out;background-color:#000;color:#fff;box-shadow:.1em .1em 1.25em -.1em #00000080;border-radius:.16em;max-width:20.8333333333em}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { keyOfMatchingRange as v, toFixed as y, scale as N, clamp01 as
|
|
1
|
+
import { jsxs as g, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { s as o } from "../ProgressBar.module-BkAFfFy0.js";
|
|
3
|
+
import { keyOfMatchingRange as v, toFixed as y, scale as N, clamp01 as _ } from "../common/math.js";
|
|
4
4
|
import { classes as n } from "../common/react.js";
|
|
5
|
-
import { CSS_COLORS as
|
|
6
|
-
import { computeBoxProps as
|
|
5
|
+
import { CSS_COLORS as B } from "../constants.js";
|
|
6
|
+
import { computeBoxProps as S, computeBoxClassName as O } from "./Box.js";
|
|
7
7
|
const w = (d) => {
|
|
8
8
|
const {
|
|
9
|
-
className:
|
|
9
|
+
className: f,
|
|
10
10
|
value: r,
|
|
11
|
-
minValue:
|
|
11
|
+
minValue: p = 0,
|
|
12
12
|
maxValue: u = 1,
|
|
13
13
|
color: C,
|
|
14
|
-
ranges:
|
|
14
|
+
ranges: h = {},
|
|
15
15
|
children: l,
|
|
16
16
|
...t
|
|
17
|
-
} = d, a = N(r,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
} = d, a = N(r, p, u), x = l !== void 0, s = C || v(r, h) || "default", e = S(t), c = [
|
|
18
|
+
o.progressBar,
|
|
19
|
+
f,
|
|
20
20
|
O(t)
|
|
21
21
|
], i = {
|
|
22
|
-
width:
|
|
22
|
+
width: _(a) * 100 + "%"
|
|
23
23
|
};
|
|
24
|
-
return
|
|
24
|
+
return B.includes(s) || s === "default" ? c.push(o["color__" + s]) : (e.style = { ...e.style, borderColor: s }, i.backgroundColor = s), /* @__PURE__ */ g("div", { className: n(c), ...e, children: [
|
|
25
25
|
/* @__PURE__ */ m(
|
|
26
26
|
"div",
|
|
27
27
|
{
|
|
28
|
-
className: n([
|
|
28
|
+
className: n([o.fill, o.fill__animated]),
|
|
29
29
|
style: i
|
|
30
30
|
}
|
|
31
31
|
),
|
|
32
|
-
/* @__PURE__ */ m("div", { className:
|
|
32
|
+
/* @__PURE__ */ m("div", { className: o.content, children: x ? l : y(a * 100) + "%" })
|
|
33
33
|
] });
|
|
34
34
|
};
|
|
35
35
|
export {
|
|
@@ -53,7 +53,7 @@ export declare const Section: import('react').ForwardRefExoticComponent<Partial<
|
|
|
53
53
|
onClick: import('react').MouseEventHandler<HTMLDivElement>;
|
|
54
54
|
onContextMenu: import('react').MouseEventHandler<HTMLDivElement>;
|
|
55
55
|
onDoubleClick: import('react').MouseEventHandler<HTMLDivElement>;
|
|
56
|
-
onKeyDown: import('react').KeyboardEventHandler<HTMLDivElement>;
|
|
56
|
+
onKeyDown: import('react').KeyboardEventHandler<HTMLDivElement>;
|
|
57
57
|
onKeyUp: import('react').KeyboardEventHandler<HTMLDivElement>;
|
|
58
58
|
onMouseDown: import('react').MouseEventHandler<HTMLDivElement>;
|
|
59
59
|
onMouseMove: import('react').MouseEventHandler<HTMLDivElement>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as s, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { s as e } from "../ProgressBar.module-BkAFfFy0.js";
|
|
3
3
|
import { keyOfMatchingRange as R, clamp01 as t, scale as f } from "../common/math.js";
|
|
4
4
|
import { classes as _ } from "../common/react.js";
|
|
5
|
-
import { computeBoxClassName as
|
|
6
|
-
import { DraggableControl as
|
|
7
|
-
import '../assets/Slider.css';const
|
|
8
|
-
slider:
|
|
9
|
-
cursorOffset:
|
|
10
|
-
cursor:
|
|
11
|
-
pointer:
|
|
12
|
-
popupValue:
|
|
5
|
+
import { computeBoxClassName as $, computeBoxProps as q } from "./Box.js";
|
|
6
|
+
import { DraggableControl as A } from "./DraggableControl.js";
|
|
7
|
+
import '../assets/Slider.css';const G = "_slider_1assx_9", H = "_cursorOffset_1assx_13", I = "_cursor_1assx_13", J = "_pointer_1assx_30", K = "_popupValue_1assx_41", a = {
|
|
8
|
+
slider: G,
|
|
9
|
+
cursorOffset: H,
|
|
10
|
+
cursor: I,
|
|
11
|
+
pointer: J,
|
|
12
|
+
popupValue: K
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function Y(h) {
|
|
15
15
|
const {
|
|
16
16
|
// Draggable props (passthrough)
|
|
17
|
-
animated:
|
|
18
|
-
format:
|
|
17
|
+
animated: v,
|
|
18
|
+
format: g,
|
|
19
19
|
maxValue: o,
|
|
20
20
|
minValue: r,
|
|
21
21
|
onChange: x,
|
|
@@ -29,16 +29,16 @@ function Z(h) {
|
|
|
29
29
|
className: w,
|
|
30
30
|
fillValue: l,
|
|
31
31
|
color: M,
|
|
32
|
-
ranges:
|
|
32
|
+
ranges: B = {},
|
|
33
33
|
children: i,
|
|
34
34
|
...c
|
|
35
|
-
} = h,
|
|
35
|
+
} = h, F = i !== void 0;
|
|
36
36
|
return /* @__PURE__ */ s(
|
|
37
|
-
|
|
37
|
+
A,
|
|
38
38
|
{
|
|
39
39
|
dragMatrix: [1, 0],
|
|
40
|
-
animated:
|
|
41
|
-
format:
|
|
40
|
+
animated: v,
|
|
41
|
+
format: g,
|
|
42
42
|
maxValue: o,
|
|
43
43
|
minValue: r,
|
|
44
44
|
onChange: x,
|
|
@@ -48,7 +48,7 @@ function Z(h) {
|
|
|
48
48
|
suppressFlicker: C,
|
|
49
49
|
unit: D,
|
|
50
50
|
value: O,
|
|
51
|
-
children: (
|
|
51
|
+
children: (S) => {
|
|
52
52
|
const {
|
|
53
53
|
displayElement: n,
|
|
54
54
|
displayValue: p,
|
|
@@ -56,11 +56,11 @@ function Z(h) {
|
|
|
56
56
|
handleDragStart: k,
|
|
57
57
|
inputElement: E,
|
|
58
58
|
value: P
|
|
59
|
-
} =
|
|
59
|
+
} = S, b = l != null, u = f(
|
|
60
60
|
l ?? p,
|
|
61
61
|
r,
|
|
62
62
|
o
|
|
63
|
-
), d = f(p, r, o), z = M || R(l ?? P,
|
|
63
|
+
), d = f(p, r, o), z = M || R(l ?? P, B) || "default";
|
|
64
64
|
return /* @__PURE__ */ m(
|
|
65
65
|
"div",
|
|
66
66
|
{
|
|
@@ -69,9 +69,9 @@ function Z(h) {
|
|
|
69
69
|
e.progressBar,
|
|
70
70
|
e["color__" + z],
|
|
71
71
|
w,
|
|
72
|
-
|
|
72
|
+
$(c)
|
|
73
73
|
]),
|
|
74
|
-
...
|
|
74
|
+
...q(c),
|
|
75
75
|
onMouseDown: k,
|
|
76
76
|
children: [
|
|
77
77
|
/* @__PURE__ */ s(
|
|
@@ -110,7 +110,7 @@ function Z(h) {
|
|
|
110
110
|
]
|
|
111
111
|
}
|
|
112
112
|
),
|
|
113
|
-
/* @__PURE__ */ s("div", { className: e.content, children:
|
|
113
|
+
/* @__PURE__ */ s("div", { className: e.content, children: F ? i : n }),
|
|
114
114
|
E
|
|
115
115
|
]
|
|
116
116
|
}
|
|
@@ -120,5 +120,5 @@ function Z(h) {
|
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
122
|
export {
|
|
123
|
-
|
|
123
|
+
Y as Slider
|
|
124
124
|
};
|
|
@@ -32,7 +32,8 @@ export declare const TextArea: import('react').ForwardRefExoticComponent<Partial
|
|
|
32
32
|
onKeyDown: import('react').KeyboardEventHandler<HTMLDivElement>;
|
|
33
33
|
onKeyUp: import('react').KeyboardEventHandler<HTMLDivElement>;
|
|
34
34
|
onMouseDown: import('react').MouseEventHandler<HTMLDivElement>;
|
|
35
|
-
onMouseMove: import('react').MouseEventHandler<HTMLDivElement>;
|
|
35
|
+
onMouseMove: import('react').MouseEventHandler<HTMLDivElement>;
|
|
36
|
+
/** Fires once the enter key is pressed */
|
|
36
37
|
onMouseOver: import('react').MouseEventHandler<HTMLDivElement>;
|
|
37
38
|
onMouseUp: import('react').MouseEventHandler<HTMLDivElement>;
|
|
38
39
|
onScroll: import('react').UIEventHandler<HTMLDivElement>;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
var s = Object.defineProperty;
|
|
2
|
-
var p = (
|
|
3
|
-
var
|
|
1
|
+
import '../assets/Tooltip.css';var s = Object.defineProperty;
|
|
2
|
+
var p = (o, e, t) => e in o ? s(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var r = (o, e, t) => (p(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import { jsx as l } from "react/jsx-runtime";
|
|
5
5
|
import { Component as c } from "react";
|
|
6
6
|
import { findDOMNode as m, render as a } from "react-dom";
|
|
7
7
|
import { c as u } from "../popper-Dm3m9eeZ.js";
|
|
8
|
-
const
|
|
8
|
+
const h = "_tooltip_1pib4_13", f = {
|
|
9
|
+
tooltip: h
|
|
10
|
+
}, i = {
|
|
9
11
|
modifiers: [
|
|
10
12
|
{
|
|
11
13
|
name: "eventListeners",
|
|
12
14
|
enabled: !1
|
|
13
15
|
}
|
|
14
16
|
]
|
|
15
|
-
},
|
|
17
|
+
}, v = {
|
|
16
18
|
width: 0,
|
|
17
19
|
height: 0,
|
|
18
20
|
top: 0,
|
|
@@ -30,7 +32,7 @@ const i = {
|
|
|
30
32
|
const e = this.getDOMNode();
|
|
31
33
|
e && (e.addEventListener("mouseenter", () => {
|
|
32
34
|
let t = n.renderedTooltip;
|
|
33
|
-
t === void 0 && (t = document.createElement("div"), t.className =
|
|
35
|
+
t === void 0 && (t = document.createElement("div"), t.className = f.tooltip, document.body.appendChild(t), n.renderedTooltip = t), n.currentHoveredElement = e, t.style.opacity = "1", this.renderPopperContent();
|
|
34
36
|
}), e.addEventListener("mouseleave", () => {
|
|
35
37
|
this.fadeOut();
|
|
36
38
|
}));
|
|
@@ -69,10 +71,10 @@ const i = {
|
|
|
69
71
|
// Thus, instead of using the Popper component, Tooltip creates ONE popper
|
|
70
72
|
// and stores every tooltip inside that.
|
|
71
73
|
// This means you can never have two tooltips at once, for instance.
|
|
72
|
-
|
|
74
|
+
r(n, "renderedTooltip"), r(n, "singletonPopper"), r(n, "currentHoveredElement"), r(n, "virtualElement", {
|
|
73
75
|
getBoundingClientRect: () => {
|
|
74
76
|
var e;
|
|
75
|
-
return ((e = n.currentHoveredElement) == null ? void 0 : e.getBoundingClientRect()) ??
|
|
77
|
+
return ((e = n.currentHoveredElement) == null ? void 0 : e.getBoundingClientRect()) ?? v;
|
|
76
78
|
}
|
|
77
79
|
});
|
|
78
80
|
let d = n;
|