tgui-core 1.1.11 → 1.1.13
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/ProgressBar.module-BkAFfFy0.js +29 -0
- package/dist/Section.module-CLVHJ4yA.js +15 -0
- package/dist/assets/BlockQuote.css +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/ColorBox.css +1 -0
- package/dist/assets/Dialog.css +1 -0
- package/dist/assets/Dimmer.css +1 -0
- package/dist/assets/Divider.css +1 -0
- package/dist/assets/Flex.css +1 -0
- package/dist/assets/Icon.css +6 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/Knob.css +1 -0
- package/dist/assets/LabeledList.css +1 -0
- package/dist/assets/MenuBar.css +1 -0
- package/dist/assets/Modal.css +1 -0
- package/dist/assets/NoticeBox.css +1 -0
- package/dist/assets/NumberInput.css +1 -0
- package/dist/assets/ProgressBar.css +1 -0
- package/dist/assets/RoundGauge.css +1 -0
- package/dist/assets/Section.css +1 -0
- package/dist/assets/Slider.css +1 -0
- package/dist/assets/Stack.css +1 -0
- package/dist/assets/Table.css +1 -0
- package/dist/assets/Tabs.css +1 -0
- package/dist/assets/TextArea.css +1 -0
- package/dist/assets/Tooltip.css +1 -0
- package/dist/common/assets.d.ts +4 -0
- package/dist/common/assets.js +25 -0
- package/dist/common/collections.d.ts +10 -0
- package/dist/common/collections.js +15 -0
- package/dist/common/color.d.ts +25 -0
- package/dist/common/color.js +69 -0
- package/dist/common/constants.d.ts +102 -0
- package/dist/common/constants.js +312 -0
- package/dist/common/events.d.ts +33 -0
- package/dist/common/events.js +147 -0
- package/{lib/common/exhaustive.ts → dist/common/exhaustive.d.ts} +1 -3
- package/dist/common/exhaustive.js +6 -0
- package/dist/common/format.d.ts +11 -0
- package/dist/common/format.js +114 -0
- package/{lib/common/fp.ts → dist/common/fp.d.ts} +2 -16
- package/dist/common/fp.js +9 -0
- package/dist/common/hotkeys.d.ts +25 -0
- package/dist/common/hotkeys.js +112 -0
- package/dist/common/http.d.ts +4 -0
- package/dist/common/http.js +10 -0
- package/dist/common/keycodes.d.ts +85 -0
- package/dist/common/keycodes.js +88 -0
- package/{lib/common/keys.ts → dist/common/keys.d.ts} +21 -24
- package/dist/common/keys.js +8 -0
- package/dist/common/math.d.ts +39 -0
- package/dist/common/math.js +41 -0
- package/dist/common/perf.d.ts +24 -0
- package/dist/common/perf.js +33 -0
- package/dist/common/random.d.ts +16 -0
- package/dist/common/random.js +18 -0
- package/dist/common/react.d.ts +23 -0
- package/dist/common/react.js +30 -0
- package/dist/common/redux.d.ts +64 -0
- package/dist/common/redux.js +72 -0
- package/dist/common/storage.d.ts +24 -0
- package/dist/common/storage.js +133 -0
- package/dist/common/string.d.ts +65 -0
- package/dist/common/string.js +83 -0
- package/dist/common/timer.d.ts +18 -0
- package/dist/common/timer.js +28 -0
- package/dist/common/type-utils.d.ts +9 -0
- package/dist/common/type-utils.js +25 -0
- package/dist/common/uuid.d.ts +9 -0
- package/dist/common/uuid.js +10 -0
- package/dist/components/AnimatedNumber.d.ts +60 -0
- package/dist/components/AnimatedNumber.js +76 -0
- package/dist/components/Autofocus.d.ts +4 -0
- package/dist/components/Autofocus.js +17 -0
- package/dist/components/Blink.d.ts +26 -0
- package/dist/components/Blink.js +56 -0
- package/dist/components/BlockQuote.d.ts +3 -0
- package/dist/components/BlockQuote.js +13 -0
- package/dist/components/BodyZoneSelector.d.ts +28 -0
- package/dist/components/BodyZoneSelector.js +115 -0
- package/dist/components/Box.d.ts +91 -0
- package/dist/components/Box.js +133 -0
- package/dist/components/Button.d.ts +93 -0
- package/dist/components/Button.js +298 -0
- package/dist/components/ByondUi.js +73 -0
- package/dist/components/Chart.d.ts +28 -0
- package/dist/components/Chart.js +95 -0
- package/dist/components/Collapsible.d.ts +15 -0
- package/dist/components/Collapsible.js +27 -0
- package/dist/components/ColorBox.d.ts +8 -0
- package/dist/components/ColorBox.js +24 -0
- package/dist/components/Dialog.d.ts +24 -0
- package/dist/components/Dialog.js +67 -0
- package/dist/components/Dimmer.d.ts +3 -0
- package/dist/components/Dimmer.js +13 -0
- package/dist/components/Divider.d.ts +6 -0
- package/dist/components/Divider.js +22 -0
- package/dist/components/DmIcon.d.ts +33 -0
- package/dist/components/DmIcon.js +29 -0
- package/dist/components/DraggableControl.js +176 -0
- package/dist/components/Dropdown.d.ts +48 -0
- package/dist/components/Dropdown.js +152 -0
- package/dist/components/FakeTerminal.js +38 -0
- package/dist/components/FitText.d.ts +22 -0
- package/dist/components/FitText.js +63 -0
- package/dist/components/Flex.d.ts +93 -0
- package/dist/components/Flex.js +72 -0
- package/dist/components/Icon.d.ts +30 -0
- package/dist/components/Icon.js +51 -0
- package/dist/components/Image.d.ts +14 -0
- package/dist/components/Image.js +35 -0
- package/dist/components/InfinitePlane.js +139 -0
- package/dist/components/Input.d.ts +61 -0
- package/dist/components/Input.js +89 -0
- package/dist/components/KeyListener.d.ts +15 -0
- package/dist/components/KeyListener.js +23 -0
- package/dist/components/Knob.d.ts +49 -0
- package/dist/components/Knob.js +162 -0
- package/dist/components/LabeledControls.d.ts +11 -0
- package/dist/components/LabeledControls.js +39 -0
- package/dist/components/LabeledList.d.ts +57 -0
- package/dist/components/LabeledList.js +94 -0
- package/dist/components/MenuBar.d.ts +28 -0
- package/dist/components/MenuBar.js +174 -0
- package/dist/components/Modal.d.ts +3 -0
- package/dist/components/Modal.js +25 -0
- package/dist/components/NoticeBox.d.ts +20 -0
- package/dist/components/NoticeBox.js +49 -0
- package/dist/components/NumberInput.d.ts +45 -0
- package/dist/components/NumberInput.js +221 -0
- package/dist/components/Popper.d.ts +27 -0
- package/dist/components/Popper.js +177 -0
- package/dist/components/ProgressBar.d.ts +46 -0
- package/dist/components/ProgressBar.js +37 -0
- package/dist/components/RestrictedInput.js +155 -0
- package/dist/components/RoundGauge.d.ts +53 -0
- package/dist/components/RoundGauge.js +147 -0
- package/dist/components/Section.d.ts +63 -0
- package/dist/components/Section.js +62 -0
- package/dist/components/Slider.d.ts +46 -0
- package/dist/components/Slider.js +124 -0
- package/dist/components/Stack.d.ts +27 -0
- package/dist/components/Stack.js +67 -0
- package/dist/components/StyleableSection.d.ts +11 -0
- package/dist/components/StyleableSection.js +16 -0
- package/dist/components/Table.d.ts +29 -0
- package/dist/components/Table.js +67 -0
- package/dist/components/Tabs.d.ts +23 -0
- package/dist/components/Tabs.js +89 -0
- package/dist/components/TextArea.d.ts +39 -0
- package/dist/components/TextArea.js +118 -0
- package/dist/components/TimeDisplay.js +34 -0
- package/dist/components/Tooltip.d.ts +29 -0
- package/dist/components/Tooltip.js +83 -0
- package/dist/components/TrackOutsideClicks.d.ts +13 -0
- package/dist/components/TrackOutsideClicks.js +24 -0
- package/dist/components/VirtualList.d.ts +8 -0
- package/dist/components/VirtualList.js +34 -0
- package/dist/components/index.js +92 -0
- package/dist/popper-CiqSDJTE.js +906 -0
- package/package.json +8 -10
- package/lib/common/assets.ts +0 -38
- package/lib/common/collections.ts +0 -27
- package/lib/common/color.ts +0 -88
- package/lib/common/constants.ts +0 -349
- package/lib/common/events.ts +0 -262
- package/lib/common/format.ts +0 -167
- package/lib/common/hotkeys.ts +0 -207
- package/lib/common/http.ts +0 -16
- package/lib/common/keycodes.ts +0 -86
- package/lib/common/math.ts +0 -76
- package/lib/common/perf.ts +0 -72
- package/lib/common/random.ts +0 -32
- package/lib/common/react.ts +0 -59
- package/lib/common/redux.ts +0 -187
- package/lib/common/storage.ts +0 -207
- package/lib/common/string.ts +0 -169
- package/lib/common/timer.ts +0 -63
- package/lib/common/type-utils.ts +0 -41
- package/lib/common/types.d.ts +0 -12
- package/lib/common/uuid.ts +0 -18
- package/lib/components/AnimatedNumber.tsx +0 -180
- package/lib/components/Autofocus.tsx +0 -23
- package/lib/components/Blink.tsx +0 -91
- package/lib/components/BlockQuote.tsx +0 -9
- package/lib/components/BodyZoneSelector.tsx +0 -149
- package/lib/components/Box.tsx +0 -252
- package/lib/components/Button.tsx +0 -425
- package/lib/components/ByondUi.jsx +0 -110
- package/lib/components/Chart.tsx +0 -155
- package/lib/components/Collapsible.tsx +0 -43
- package/lib/components/ColorBox.tsx +0 -29
- package/lib/components/Dialog.tsx +0 -81
- package/lib/components/Dimmer.tsx +0 -13
- package/lib/components/Divider.tsx +0 -20
- package/lib/components/DmIcon.tsx +0 -86
- package/lib/components/DraggableControl.jsx +0 -276
- package/lib/components/Dropdown.tsx +0 -246
- package/lib/components/FakeTerminal.jsx +0 -52
- package/lib/components/FitText.tsx +0 -99
- package/lib/components/Flex.tsx +0 -159
- package/lib/components/Icon.tsx +0 -95
- package/lib/components/Image.tsx +0 -54
- package/lib/components/InfinitePlane.jsx +0 -192
- package/lib/components/Input.tsx +0 -176
- package/lib/components/KeyListener.tsx +0 -40
- package/lib/components/Knob.tsx +0 -178
- package/lib/components/LabeledControls.tsx +0 -44
- package/lib/components/LabeledList.tsx +0 -154
- package/lib/components/MenuBar.tsx +0 -228
- package/lib/components/Modal.tsx +0 -23
- package/lib/components/NoticeBox.tsx +0 -45
- package/lib/components/NumberInput.tsx +0 -328
- package/lib/components/Popper.tsx +0 -100
- package/lib/components/ProgressBar.tsx +0 -105
- package/lib/components/RestrictedInput.jsx +0 -301
- package/lib/components/RoundGauge.tsx +0 -180
- package/lib/components/Section.tsx +0 -120
- package/lib/components/Slider.tsx +0 -169
- package/lib/components/Stack.tsx +0 -96
- package/lib/components/StyleableSection.tsx +0 -33
- package/lib/components/Table.tsx +0 -84
- package/lib/components/Tabs.tsx +0 -89
- package/lib/components/TextArea.tsx +0 -182
- package/lib/components/TimeDisplay.jsx +0 -64
- package/lib/components/Tooltip.tsx +0 -152
- package/lib/components/TrackOutsideClicks.tsx +0 -35
- package/lib/components/VirtualList.tsx +0 -69
- package/lib/styles/atomic/candystripe.scss +0 -8
- package/lib/styles/atomic/centered-image.scss +0 -7
- package/lib/styles/atomic/color.scss +0 -21
- package/lib/styles/atomic/debug-layout.scss +0 -17
- package/lib/styles/atomic/fit-text.scss +0 -14
- package/lib/styles/atomic/links.scss +0 -12
- package/lib/styles/atomic/outline.scss +0 -47
- package/lib/styles/atomic/text.scss +0 -44
- package/lib/styles/base.scss +0 -32
- package/lib/styles/colors.scss +0 -92
- package/lib/styles/components/BlockQuote.module.scss +0 -20
- package/lib/styles/components/BlockQuote.module.scss.d.ts +0 -4
- package/lib/styles/components/Button.module.scss +0 -157
- package/lib/styles/components/Button.module.scss.d.ts +0 -46
- package/lib/styles/components/ColorBox.module.scss +0 -12
- package/lib/styles/components/ColorBox.module.scss.d.ts +0 -4
- package/lib/styles/components/Dialog.module.scss +0 -60
- package/lib/styles/components/Dialog.module.scss.d.ts +0 -10
- package/lib/styles/components/Dimmer.module.scss +0 -22
- package/lib/styles/components/Dimmer.module.scss.d.ts +0 -4
- package/lib/styles/components/Divider.module.scss +0 -27
- package/lib/styles/components/Divider.module.scss.d.ts +0 -6
- package/lib/styles/components/Dropdown.scss +0 -72
- package/lib/styles/components/Flex.module.scss +0 -13
- package/lib/styles/components/Flex.module.scss.d.ts +0 -5
- package/lib/styles/components/Icon.module.scss +0 -25
- package/lib/styles/components/Icon.module.scss.d.ts +0 -5
- package/lib/styles/components/Input.module.scss +0 -64
- package/lib/styles/components/Input.module.scss.d.ts +0 -8
- package/lib/styles/components/Knob.module.scss +0 -131
- package/lib/styles/components/Knob.module.scss.d.ts +0 -33
- package/lib/styles/components/LabeledList.module.scss +0 -49
- package/lib/styles/components/LabeledList.module.scss.d.ts +0 -8
- package/lib/styles/components/MenuBar.module.scss +0 -75
- package/lib/styles/components/MenuBar.module.scss.d.ts +0 -14
- package/lib/styles/components/Modal.module.scss +0 -14
- package/lib/styles/components/Modal.module.scss.d.ts +0 -4
- package/lib/styles/components/NoticeBox.module.scss +0 -65
- package/lib/styles/components/NoticeBox.module.scss.d.ts +0 -27
- package/lib/styles/components/NumberInput.module.scss +0 -71
- package/lib/styles/components/NumberInput.module.scss.d.ts +0 -9
- package/lib/styles/components/ProgressBar.module.scss +0 -63
- package/lib/styles/components/ProgressBar.module.scss.d.ts +0 -27
- package/lib/styles/components/RoundGauge.module.scss +0 -85
- package/lib/styles/components/RoundGauge.module.scss.d.ts +0 -49
- package/lib/styles/components/Section.module.scss +0 -130
- package/lib/styles/components/Section.module.scss.d.ts +0 -13
- package/lib/styles/components/Slider.module.scss +0 -54
- package/lib/styles/components/Slider.module.scss.d.ts +0 -8
- package/lib/styles/components/Stack.module.scss +0 -60
- package/lib/styles/components/Stack.module.scss.d.ts +0 -12
- package/lib/styles/components/Table.module.scss +0 -44
- package/lib/styles/components/Table.module.scss.d.ts +0 -10
- package/lib/styles/components/Tabs.module.scss +0 -144
- package/lib/styles/components/Tabs.module.scss.d.ts +0 -35
- package/lib/styles/components/TextArea.module.scss +0 -86
- package/lib/styles/components/TextArea.module.scss.d.ts +0 -11
- package/lib/styles/components/Tooltip.module.scss +0 -24
- package/lib/styles/components/Tooltip.module.scss.d.ts +0 -4
- package/lib/styles/functions.scss +0 -79
- package/lib/styles/input.scss +0 -9
- package/lib/styles/main.scss +0 -20
- package/lib/styles/reset.scss +0 -68
- /package/{lib/components/index.ts → dist/components/index.d.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { classes as l } from "../common/react.js";
|
|
3
|
+
import { computeBoxClassName as m, computeBoxProps as a, unit as d } from "./Box.js";
|
|
4
|
+
import '../assets/Flex.css';const p = "_flex_djoni_5", N = "_inline_djoni_10", r = {
|
|
5
|
+
flex: p,
|
|
6
|
+
inline: N
|
|
7
|
+
};
|
|
8
|
+
function y(e) {
|
|
9
|
+
return l([
|
|
10
|
+
r.flex,
|
|
11
|
+
e.inline && r.inline,
|
|
12
|
+
m(e)
|
|
13
|
+
]);
|
|
14
|
+
}
|
|
15
|
+
function v(e) {
|
|
16
|
+
const { direction: n, wrap: t, align: o, justify: s, ...i } = e;
|
|
17
|
+
return a({
|
|
18
|
+
style: {
|
|
19
|
+
...i.style,
|
|
20
|
+
flexDirection: n,
|
|
21
|
+
flexWrap: t === !0 ? "wrap" : t,
|
|
22
|
+
alignItems: o,
|
|
23
|
+
justifyContent: s
|
|
24
|
+
},
|
|
25
|
+
...i
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function _(e) {
|
|
29
|
+
const { className: n, ...t } = e;
|
|
30
|
+
return /* @__PURE__ */ c(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: l([n, y(t)]),
|
|
34
|
+
...v(t)
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function g(e) {
|
|
39
|
+
const { style: n, grow: t, order: o, shrink: s, basis: i, align: u, ...f } = e, x = i ?? // IE11: Set basis to specified width if it's known, which fixes certain
|
|
40
|
+
// bugs when rendering tables inside the flex.
|
|
41
|
+
e.width ?? // If grow is used, basis should be set to 0 to be consistent with
|
|
42
|
+
// flex css shorthand `flex: 1`.
|
|
43
|
+
(t !== void 0 ? 0 : void 0);
|
|
44
|
+
return a({
|
|
45
|
+
style: {
|
|
46
|
+
...n,
|
|
47
|
+
flexGrow: t !== void 0 && Number(t),
|
|
48
|
+
flexShrink: s !== void 0 && Number(s),
|
|
49
|
+
flexBasis: d(x),
|
|
50
|
+
order: o,
|
|
51
|
+
alignSelf: u
|
|
52
|
+
},
|
|
53
|
+
...f
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function j(e) {
|
|
57
|
+
const { className: n, ...t } = e;
|
|
58
|
+
return /* @__PURE__ */ c(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: l([n, m(e)]),
|
|
62
|
+
...g(t)
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
_.Item = j;
|
|
67
|
+
export {
|
|
68
|
+
_ as Flex,
|
|
69
|
+
y as computeFlexClassName,
|
|
70
|
+
g as computeFlexItemProps,
|
|
71
|
+
v as computeFlexProps
|
|
72
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { BooleanLike } from '../common/react';
|
|
3
|
+
import { BoxProps } from './Box';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
/** Icon name. See [icon list](https://fontawesome.com/v5/search?o=r&m=free) */
|
|
7
|
+
name: string;
|
|
8
|
+
} & Partial<{
|
|
9
|
+
/** Custom CSS class. */
|
|
10
|
+
className: string;
|
|
11
|
+
/** Icon rotation, in degrees. */
|
|
12
|
+
rotation: number;
|
|
13
|
+
/** Icon size. `1` is normal size, `2` is two times bigger. Fractional numbers are supported. */
|
|
14
|
+
size: number;
|
|
15
|
+
/** Whether an icon should be spinning. Good for load indicators. */
|
|
16
|
+
spin: BooleanLike;
|
|
17
|
+
/** Custom CSS. */
|
|
18
|
+
style: CSSProperties;
|
|
19
|
+
}> & BoxProps;
|
|
20
|
+
export declare function Icon(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare namespace Icon {
|
|
22
|
+
var Stack: typeof IconStack;
|
|
23
|
+
}
|
|
24
|
+
type IconStackUnique = {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
export type IconStackProps = IconStackUnique & BoxProps;
|
|
29
|
+
export declare function IconStack(props: IconStackProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { classes as m } from "../common/react.js";
|
|
3
|
+
import { computeBoxProps as p, computeBoxClassName as u } from "./Box.js";
|
|
4
|
+
import '../assets/Icon.css';const x = "_iconStack_bg05l_7", y = "_icon_bg05l_7", S = {
|
|
5
|
+
iconStack: x,
|
|
6
|
+
icon: y
|
|
7
|
+
}, f = /-o$/;
|
|
8
|
+
function b(a) {
|
|
9
|
+
const { name: t, size: o, spin: c, className: _, rotation: i, ...n } = a, e = n.style || {};
|
|
10
|
+
o && (e.fontSize = o * 100 + "%"), i && (e.transform = `rotate(${i}deg)`), n.style = e;
|
|
11
|
+
const N = p(n);
|
|
12
|
+
let s = "";
|
|
13
|
+
if (t.startsWith("tg-"))
|
|
14
|
+
s = t;
|
|
15
|
+
else {
|
|
16
|
+
const k = f.test(t), r = t.replace(f, ""), g = !r.startsWith("fa-");
|
|
17
|
+
s = k ? "far " : "fas ", g && (s += "fa-"), s += r, c && (s += " fa-spin");
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ l(
|
|
20
|
+
"i",
|
|
21
|
+
{
|
|
22
|
+
className: m([
|
|
23
|
+
S.icon,
|
|
24
|
+
s,
|
|
25
|
+
_,
|
|
26
|
+
u(n)
|
|
27
|
+
]),
|
|
28
|
+
...N
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function d(a) {
|
|
33
|
+
const { className: t, children: o, ...c } = a;
|
|
34
|
+
return /* @__PURE__ */ l(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
className: m([
|
|
38
|
+
S.iconStack,
|
|
39
|
+
t,
|
|
40
|
+
u(c)
|
|
41
|
+
]),
|
|
42
|
+
...p(c),
|
|
43
|
+
children: o
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
b.Stack = d;
|
|
48
|
+
export {
|
|
49
|
+
b as Icon,
|
|
50
|
+
d as IconStack
|
|
51
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BoxProps } from './Box';
|
|
2
|
+
|
|
3
|
+
type Props = Partial<{
|
|
4
|
+
className: string;
|
|
5
|
+
/** True is default, this fixes an ie thing */
|
|
6
|
+
fixBlur: boolean;
|
|
7
|
+
/** False by default. Good if you're fetching images on UIs that do not auto update. This will attempt to fix the 'x' icon 5 times. */
|
|
8
|
+
fixErrors: boolean;
|
|
9
|
+
/** Fill is default. */
|
|
10
|
+
objectFit: 'contain' | 'cover';
|
|
11
|
+
src: string;
|
|
12
|
+
}> & BoxProps;
|
|
13
|
+
export declare function Image(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f } from "react";
|
|
3
|
+
import { computeBoxProps as a } from "./Box.js";
|
|
4
|
+
const l = 5;
|
|
5
|
+
function b(o) {
|
|
6
|
+
const {
|
|
7
|
+
fixBlur: s = !0,
|
|
8
|
+
fixErrors: m = !1,
|
|
9
|
+
objectFit: n = "fill",
|
|
10
|
+
src: e,
|
|
11
|
+
...c
|
|
12
|
+
} = o, t = f(0), r = a(c);
|
|
13
|
+
return r.style = {
|
|
14
|
+
...r.style,
|
|
15
|
+
"-ms-interpolation-mode": s ? "nearest-neighbor" : "auto",
|
|
16
|
+
objectFit: n
|
|
17
|
+
}, /* @__PURE__ */ p(
|
|
18
|
+
"img",
|
|
19
|
+
{
|
|
20
|
+
onError: (i) => {
|
|
21
|
+
if (m && t.current < l) {
|
|
22
|
+
const u = i.currentTarget;
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
u.src = `${e}?attempt=${t.current}`, t.current++;
|
|
25
|
+
}, 1e3);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
src: e,
|
|
29
|
+
...r
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
b as Image
|
|
35
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsxs as l, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Component as v } from "react";
|
|
3
|
+
import { computeBoxProps as Z } from "./Box.js";
|
|
4
|
+
import { Button as c } from "./Button.js";
|
|
5
|
+
import { ProgressBar as g } from "./ProgressBar.js";
|
|
6
|
+
import { Stack as d } from "./Stack.js";
|
|
7
|
+
const p = 0.5, f = 1.5, M = 0.1;
|
|
8
|
+
class k extends v {
|
|
9
|
+
constructor(e) {
|
|
10
|
+
super(e), this.state = {
|
|
11
|
+
mouseDown: !1,
|
|
12
|
+
left: 0,
|
|
13
|
+
top: 0,
|
|
14
|
+
lastLeft: 0,
|
|
15
|
+
lastTop: 0,
|
|
16
|
+
zoom: 1
|
|
17
|
+
}, this.handleMouseDown = this.handleMouseDown.bind(this), this.handleMouseMove = this.handleMouseMove.bind(this), this.handleZoomIncrease = this.handleZoomIncrease.bind(this), this.handleZoomDecrease = this.handleZoomDecrease.bind(this), this.onMouseUp = this.onMouseUp.bind(this), this.doOffsetMouse = this.doOffsetMouse.bind(this);
|
|
18
|
+
}
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("mousedown", this.doOffsetMouse), window.addEventListener("mousemove", this.doOffsetMouse), window.addEventListener("mouseup", this.doOffsetMouse);
|
|
21
|
+
}
|
|
22
|
+
componentWillUnmount() {
|
|
23
|
+
window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousedown", this.doOffsetMouse), window.removeEventListener("mousemove", this.doOffsetMouse), window.removeEventListener("mouseup", this.doOffsetMouse);
|
|
24
|
+
}
|
|
25
|
+
doOffsetMouse(e) {
|
|
26
|
+
const { zoom: o } = this.state;
|
|
27
|
+
e.screenZoomX = e.screenX * Math.pow(o, -1), e.screenZoomY = e.screenY * Math.pow(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
|
+
render() {
|
|
64
|
+
const {
|
|
65
|
+
children: e,
|
|
66
|
+
backgroundImage: o,
|
|
67
|
+
imageWidth: s,
|
|
68
|
+
initialLeft: t = 0,
|
|
69
|
+
initialTop: a = 0,
|
|
70
|
+
...i
|
|
71
|
+
} = this.props, { left: h, top: w, zoom: r } = this.state, m = t + h, u = a + w;
|
|
72
|
+
return /* @__PURE__ */ l(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
ref: this.ref,
|
|
76
|
+
...Z({
|
|
77
|
+
...i,
|
|
78
|
+
style: {
|
|
79
|
+
...i.style,
|
|
80
|
+
overflow: "hidden",
|
|
81
|
+
position: "relative"
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ n(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
onMouseDown: this.handleMouseDown,
|
|
89
|
+
onMouseMove: this.handleMouseMove,
|
|
90
|
+
style: {
|
|
91
|
+
position: "fixed",
|
|
92
|
+
height: "100%",
|
|
93
|
+
width: "100%",
|
|
94
|
+
backgroundImage: `url("${o}")`,
|
|
95
|
+
backgroundPosition: `${m}px ${u}px`,
|
|
96
|
+
backgroundRepeat: "repeat",
|
|
97
|
+
backgroundSize: `${r * s}px`
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ n(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
onMouseDown: this.handleMouseDown,
|
|
105
|
+
onMouseMove: this.handleMouseMove,
|
|
106
|
+
style: {
|
|
107
|
+
position: "fixed",
|
|
108
|
+
transform: `translate(${m}px, ${u}px) scale(${r})`,
|
|
109
|
+
transformOrigin: "top left",
|
|
110
|
+
height: "100%",
|
|
111
|
+
width: "100%"
|
|
112
|
+
},
|
|
113
|
+
children: e
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ l(d, { position: "absolute", width: "100%", children: [
|
|
117
|
+
/* @__PURE__ */ n(d.Item, { children: /* @__PURE__ */ n(c, { icon: "minus", onClick: this.handleZoomDecrease }) }),
|
|
118
|
+
/* @__PURE__ */ n(d.Item, { grow: 1, children: /* @__PURE__ */ l(
|
|
119
|
+
g,
|
|
120
|
+
{
|
|
121
|
+
minValue: p,
|
|
122
|
+
value: r,
|
|
123
|
+
maxValue: f,
|
|
124
|
+
children: [
|
|
125
|
+
r,
|
|
126
|
+
"x"
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
) }),
|
|
130
|
+
/* @__PURE__ */ n(d.Item, { children: /* @__PURE__ */ n(c, { icon: "plus", onClick: this.handleZoomIncrease }) })
|
|
131
|
+
] })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
k as InfinitePlane
|
|
139
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { SyntheticEvent } from 'react';
|
|
2
|
+
import { BoxProps } from './Box';
|
|
3
|
+
|
|
4
|
+
type ConditionalProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Mark this if you want to debounce onInput.
|
|
7
|
+
*
|
|
8
|
+
* This is useful for expensive filters, large lists etc.
|
|
9
|
+
*
|
|
10
|
+
* Requires `onInput` to be set.
|
|
11
|
+
*/
|
|
12
|
+
expensive?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Fires on each key press / value change. Used for searching.
|
|
15
|
+
*
|
|
16
|
+
* If it's a large list, consider using `expensive` prop.
|
|
17
|
+
*/
|
|
18
|
+
onInput: (event: SyntheticEvent<HTMLInputElement>, value: string) => void;
|
|
19
|
+
} | {
|
|
20
|
+
/** This prop requires onInput to be set */
|
|
21
|
+
expensive?: never;
|
|
22
|
+
onInput?: never;
|
|
23
|
+
};
|
|
24
|
+
type OptionalProps = Partial<{
|
|
25
|
+
/** Automatically focuses the input on mount */
|
|
26
|
+
autoFocus: boolean;
|
|
27
|
+
/** Automatically selects the input value on focus */
|
|
28
|
+
autoSelect: boolean;
|
|
29
|
+
/** The class name of the input */
|
|
30
|
+
className: string;
|
|
31
|
+
/** Disables the input */
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
/** Mark this if you want the input to be as wide as possible */
|
|
34
|
+
fluid: boolean;
|
|
35
|
+
/** The maximum length of the input value */
|
|
36
|
+
maxLength: number;
|
|
37
|
+
/** Mark this if you want to use a monospace font */
|
|
38
|
+
monospace: boolean;
|
|
39
|
+
/** Fires when user is 'done typing': Clicked out, blur, enter key */
|
|
40
|
+
onChange: (event: SyntheticEvent<HTMLInputElement>, value: string) => void;
|
|
41
|
+
/** Fires once the enter key is pressed */
|
|
42
|
+
onEnter?: (event: SyntheticEvent<HTMLInputElement>, value: string) => void;
|
|
43
|
+
/** Fires once the escape key is pressed */
|
|
44
|
+
onEscape: (event: SyntheticEvent<HTMLInputElement>) => void;
|
|
45
|
+
/** The placeholder text when everything is cleared */
|
|
46
|
+
placeholder: string;
|
|
47
|
+
/** Clears the input value on enter */
|
|
48
|
+
selfClear: boolean;
|
|
49
|
+
/** The state variable of the input. */
|
|
50
|
+
value: string | number;
|
|
51
|
+
}>;
|
|
52
|
+
type Props = OptionalProps & ConditionalProps & BoxProps;
|
|
53
|
+
export declare function toInputValue(value: string | number | undefined): string;
|
|
54
|
+
/**
|
|
55
|
+
* ### Input
|
|
56
|
+
* A basic text input which allow users to enter text into a UI.
|
|
57
|
+
* > Input does not support custom font size and height due to the way
|
|
58
|
+
* > it's implemented in CSS. Eventually, this needs to be fixed.
|
|
59
|
+
*/
|
|
60
|
+
export declare function Input(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs as j, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as k, useEffect as B } from "react";
|
|
3
|
+
import { KEY as m } from "../common/keys.js";
|
|
4
|
+
import { classes as E } from "../common/react.js";
|
|
5
|
+
import { debounce as R } from "../common/timer.js";
|
|
6
|
+
import { Box as S } from "./Box.js";
|
|
7
|
+
import '../assets/Input.css';const V = "_input_17i79_20", F = "_fluid_17i79_35", L = "_baseline_17i79_40", Y = "_inner_17i79_45", q = "_monospace_17i79_71", u = {
|
|
8
|
+
input: V,
|
|
9
|
+
fluid: F,
|
|
10
|
+
baseline: L,
|
|
11
|
+
inner: Y,
|
|
12
|
+
monospace: q
|
|
13
|
+
};
|
|
14
|
+
function _(r) {
|
|
15
|
+
return typeof r != "number" && typeof r != "string" ? "" : String(r);
|
|
16
|
+
}
|
|
17
|
+
const z = R((r) => r(), 250);
|
|
18
|
+
function P(r) {
|
|
19
|
+
const {
|
|
20
|
+
autoFocus: d,
|
|
21
|
+
autoSelect: c,
|
|
22
|
+
className: b,
|
|
23
|
+
disabled: g,
|
|
24
|
+
expensive: T,
|
|
25
|
+
fluid: y,
|
|
26
|
+
maxLength: x,
|
|
27
|
+
monospace: h,
|
|
28
|
+
onChange: n,
|
|
29
|
+
onEnter: i,
|
|
30
|
+
onEscape: o,
|
|
31
|
+
onInput: s,
|
|
32
|
+
placeholder: I,
|
|
33
|
+
selfClear: N,
|
|
34
|
+
value: l,
|
|
35
|
+
...w
|
|
36
|
+
} = r, a = k(null);
|
|
37
|
+
function D(e) {
|
|
38
|
+
var f;
|
|
39
|
+
if (!s) return;
|
|
40
|
+
const t = (f = e.currentTarget) == null ? void 0 : f.value;
|
|
41
|
+
T ? z(() => s(e, t)) : s(e, t);
|
|
42
|
+
}
|
|
43
|
+
function K(e) {
|
|
44
|
+
if (e.key === m.Enter) {
|
|
45
|
+
i == null || i(e, e.currentTarget.value), N ? e.currentTarget.value = "" : (e.currentTarget.blur(), n == null || n(e, e.currentTarget.value));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
e.key === m.Escape && (o == null || o(e), e.currentTarget.value = _(l), e.currentTarget.blur());
|
|
49
|
+
}
|
|
50
|
+
return B(() => {
|
|
51
|
+
const e = a.current;
|
|
52
|
+
if (!e) return;
|
|
53
|
+
const t = _(l);
|
|
54
|
+
e.value !== t && (e.value = t), !(!d && !c) && setTimeout(() => {
|
|
55
|
+
e.focus(), c && e.select();
|
|
56
|
+
}, 1);
|
|
57
|
+
}, []), /* @__PURE__ */ j(
|
|
58
|
+
S,
|
|
59
|
+
{
|
|
60
|
+
className: E([
|
|
61
|
+
u.input,
|
|
62
|
+
y && u.fluid,
|
|
63
|
+
h && u.monospace,
|
|
64
|
+
b
|
|
65
|
+
]),
|
|
66
|
+
...w,
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ p("div", { className: u.baseline, children: "." }),
|
|
69
|
+
/* @__PURE__ */ p(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
className: u.inner,
|
|
73
|
+
disabled: g,
|
|
74
|
+
maxLength: x,
|
|
75
|
+
onBlur: (e) => n == null ? void 0 : n(e, e.target.value),
|
|
76
|
+
onChange: D,
|
|
77
|
+
onKeyDown: K,
|
|
78
|
+
placeholder: I,
|
|
79
|
+
ref: a
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
P as Input,
|
|
88
|
+
_ as toInputValue
|
|
89
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { KeyEvent } from '../common/events';
|
|
3
|
+
|
|
4
|
+
type KeyListenerProps = Partial<{
|
|
5
|
+
onKey: (key: KeyEvent) => void;
|
|
6
|
+
onKeyDown: (key: KeyEvent) => void;
|
|
7
|
+
onKeyUp: (key: KeyEvent) => void;
|
|
8
|
+
}>;
|
|
9
|
+
export declare class KeyListener extends Component<KeyListenerProps> {
|
|
10
|
+
dispose: () => void;
|
|
11
|
+
constructor(props: any);
|
|
12
|
+
componentWillUnmount(): void;
|
|
13
|
+
render(): null;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var t = Object.defineProperty;
|
|
2
|
+
var e = (s, o, p) => o in s ? t(s, o, { enumerable: !0, configurable: !0, writable: !0, value: p }) : s[o] = p;
|
|
3
|
+
var i = (s, o, p) => e(s, typeof o != "symbol" ? o + "" : o, p);
|
|
4
|
+
import { Component as r } from "react";
|
|
5
|
+
import { listenForKeyEvents as h } from "../common/hotkeys.js";
|
|
6
|
+
class d extends r {
|
|
7
|
+
constructor(p) {
|
|
8
|
+
super(p);
|
|
9
|
+
i(this, "dispose");
|
|
10
|
+
this.dispose = h((n) => {
|
|
11
|
+
this.props.onKey && this.props.onKey(n), n.isDown() && this.props.onKeyDown && this.props.onKeyDown(n), n.isUp() && this.props.onKeyUp && this.props.onKeyUp(n);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
componentWillUnmount() {
|
|
15
|
+
this.dispose();
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
d as KeyListener
|
|
23
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BooleanLike } from '../common/react';
|
|
2
|
+
import { BoxProps } from './Box';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
/** Value itself, controls the position of the cursor. */
|
|
6
|
+
value: number;
|
|
7
|
+
} & Partial<{
|
|
8
|
+
/** Animates the value if it was changed externally. */
|
|
9
|
+
animated: boolean;
|
|
10
|
+
/** Knob can be bipolar or unipolar. */
|
|
11
|
+
bipolar: boolean;
|
|
12
|
+
/** Color of the outer ring around the knob. */
|
|
13
|
+
color: string | BooleanLike;
|
|
14
|
+
/** If set, this value will be used to set the fill percentage of the outer ring independently of the main value. */
|
|
15
|
+
fillValue: number;
|
|
16
|
+
/** Format value using this function before displaying it. */
|
|
17
|
+
format: (value: number) => string;
|
|
18
|
+
/** Highest possible value. */
|
|
19
|
+
maxValue: number;
|
|
20
|
+
/** Lowest possible value. */
|
|
21
|
+
minValue: number;
|
|
22
|
+
/** Adjust value by this amount when dragging the input. */
|
|
23
|
+
onChange: (event: Event, value: number) => void;
|
|
24
|
+
/** An event, which fires about every 500ms when you drag the input up and down, on release and on manual editing. */
|
|
25
|
+
onDrag: (event: Event, value: number) => void;
|
|
26
|
+
/** Applies a `color` to the outer ring around the knob based on whether the value lands in the range between `from` and `to`. */
|
|
27
|
+
ranges: Record<string, [number, number]>;
|
|
28
|
+
/** Relative size of the knob. `1` is normal size, `2` is two times bigger. Fractional numbers are supported. */
|
|
29
|
+
size: number;
|
|
30
|
+
/** Adjust value by this amount when dragging the input. */
|
|
31
|
+
step: number;
|
|
32
|
+
/** Screen distance mouse needs to travel to adjust value by one `step`. */
|
|
33
|
+
stepPixelSize: number;
|
|
34
|
+
/** A number in milliseconds, for which the input will hold off from updating while events propagate through the backend. Default is about 250ms, increase it if you still see flickering. */
|
|
35
|
+
suppressFlicker: boolean;
|
|
36
|
+
/** Whether to clamp the value to the range. */
|
|
37
|
+
unclamped: boolean;
|
|
38
|
+
/** Unit to display to the right of value. */
|
|
39
|
+
unit: string;
|
|
40
|
+
}> & BoxProps;
|
|
41
|
+
/**
|
|
42
|
+
* ## Knob
|
|
43
|
+
* A radial control which allows dialing in precise values by dragging it
|
|
44
|
+
* up and down.
|
|
45
|
+
*
|
|
46
|
+
* Single click opens an input box to manually type in a number.
|
|
47
|
+
*/
|
|
48
|
+
export declare function Knob(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export {};
|