tgui-core 1.1.24 → 1.3.0
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 +3 -3
- package/dist/common/color.js +31 -30
- package/dist/common/events.js +5 -5
- package/dist/common/format.js +27 -27
- package/dist/common/hotkeys.d.ts +0 -1
- package/dist/common/hotkeys.js +2 -2
- package/dist/common/math.d.ts +4 -0
- package/dist/common/math.js +29 -25
- package/dist/common/random.js +14 -13
- package/dist/common/react.js +1 -1
- package/dist/common/string.js +9 -9
- package/dist/common/type-utils.d.ts +1 -1
- package/dist/components/AnimatedNumber.d.ts +6 -6
- package/dist/components/AnimatedNumber.js +14 -17
- package/dist/components/Autofocus.d.ts +0 -1
- package/dist/components/Blink.d.ts +0 -1
- package/dist/components/BlockQuote.d.ts +0 -1
- package/dist/components/BlockQuote.js +4 -7
- package/dist/components/Box.d.ts +2 -1
- package/dist/components/Box.js +4 -4
- package/dist/components/Button.d.ts +0 -1
- package/dist/components/Button.js +173 -211
- package/dist/components/ByondUi.js +3 -3
- package/dist/components/Chart.d.ts +0 -1
- package/dist/components/Chart.js +25 -22
- package/dist/components/Collapsible.d.ts +0 -1
- package/dist/components/ColorBox.d.ts +0 -1
- package/dist/components/ColorBox.js +7 -14
- package/dist/components/Dialog.js +31 -40
- package/dist/components/Dimmer.d.ts +0 -1
- package/dist/components/Dimmer.js +6 -9
- package/dist/components/Divider.js +10 -14
- package/dist/components/DmIcon.d.ts +0 -1
- package/dist/components/DraggableControl.js +58 -52
- package/dist/components/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown.js +73 -67
- package/dist/components/FitText.d.ts +0 -1
- package/dist/components/Flex.d.ts +1 -1
- package/dist/components/Flex.js +39 -41
- package/dist/components/Icon.d.ts +0 -1
- package/dist/components/Icon.js +27 -34
- package/dist/components/Image.d.ts +0 -1
- package/dist/components/Image.js +7 -6
- package/dist/components/ImageButton.d.ts +60 -0
- package/dist/components/ImageButton.js +131 -0
- package/dist/components/InfinitePlane.js +1 -1
- package/dist/components/Input.d.ts +0 -1
- package/dist/components/Input.js +57 -64
- package/dist/components/KeyListener.d.ts +0 -1
- package/dist/components/Knob.d.ts +0 -1
- package/dist/components/Knob.js +91 -117
- package/dist/components/LabeledControls.d.ts +0 -1
- package/dist/components/LabeledList.d.ts +0 -1
- package/dist/components/LabeledList.js +48 -55
- package/dist/components/MenuBar.d.ts +0 -1
- package/dist/components/MenuBar.js +93 -102
- package/dist/components/Modal.d.ts +0 -1
- package/dist/components/Modal.js +11 -18
- package/dist/components/NoticeBox.d.ts +0 -1
- package/dist/components/NoticeBox.js +16 -43
- package/dist/components/NumberInput.d.ts +0 -2
- package/dist/components/NumberInput.js +112 -120
- package/dist/components/Popper.d.ts +0 -1
- package/dist/components/ProgressBar.d.ts +0 -1
- package/dist/components/ProgressBar.js +22 -27
- package/dist/components/RestrictedInput.js +64 -58
- package/dist/components/RoundGauge.d.ts +0 -1
- package/dist/components/RoundGauge.js +70 -104
- package/dist/components/Section.d.ts +1 -2
- package/dist/components/Section.js +50 -51
- package/dist/components/Slider.d.ts +2 -1
- package/dist/components/Slider.js +72 -80
- package/dist/components/Stack.d.ts +0 -1
- package/dist/components/Stack.js +37 -47
- package/dist/components/StyleableSection.d.ts +0 -1
- package/dist/components/StyleableSection.js +11 -11
- package/dist/components/Table.d.ts +0 -1
- package/dist/components/Table.js +38 -47
- package/dist/components/Tabs.d.ts +0 -1
- package/dist/components/Tabs.js +43 -75
- package/dist/components/TextArea.d.ts +2 -1
- package/dist/components/TextArea.js +74 -69
- package/dist/components/TimeDisplay.d.ts +7 -6
- package/dist/components/TimeDisplay.js +17 -17
- package/dist/components/Tooltip.d.ts +1 -2
- package/dist/components/Tooltip.js +8 -10
- package/dist/components/TrackOutsideClicks.d.ts +0 -1
- package/dist/components/VirtualList.d.ts +0 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +60 -58
- package/package.json +11 -25
- package/dist/ProgressBar.module-Jzqlebbx.js +0 -29
- package/dist/Section.module-qhQWhlUX.js +0 -18
- package/dist/assets/BlockQuote.css +0 -1
- package/dist/assets/Button.css +0 -1
- package/dist/assets/ColorBox.css +0 -1
- package/dist/assets/Dialog.css +0 -1
- package/dist/assets/Dimmer.css +0 -1
- package/dist/assets/Divider.css +0 -1
- package/dist/assets/Flex.css +0 -1
- package/dist/assets/Icon.css +0 -6
- package/dist/assets/Input.css +0 -1
- package/dist/assets/Knob.css +0 -1
- package/dist/assets/LabeledList.css +0 -1
- package/dist/assets/MenuBar.css +0 -1
- package/dist/assets/Modal.css +0 -1
- package/dist/assets/NoticeBox.css +0 -1
- package/dist/assets/NumberInput.css +0 -1
- package/dist/assets/ProgressBar.css +0 -1
- package/dist/assets/RoundGauge.css +0 -1
- package/dist/assets/Section.css +0 -1
- package/dist/assets/Slider.css +0 -1
- package/dist/assets/Stack.css +0 -1
- package/dist/assets/Table.css +0 -1
- package/dist/assets/Tabs.css +0 -1
- package/dist/assets/TextArea.css +0 -1
- package/dist/assets/Tooltip.css +0 -1
package/dist/components/Flex.js
CHANGED
|
@@ -1,72 +1,70 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { classes as
|
|
3
|
-
import { computeBoxClassName as m, computeBoxProps as a, unit as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function y(e) {
|
|
9
|
-
return l([
|
|
10
|
-
r.flex,
|
|
11
|
-
e.inline && r.inline,
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { classes as r } from "../common/react.js";
|
|
3
|
+
import { computeBoxClassName as m, computeBoxProps as a, unit as f } from "./Box.js";
|
|
4
|
+
function p(e) {
|
|
5
|
+
return r([
|
|
6
|
+
"Flex",
|
|
7
|
+
e.inline && "Flex--inline",
|
|
12
8
|
m(e)
|
|
13
9
|
]);
|
|
14
10
|
}
|
|
15
|
-
function
|
|
16
|
-
const { direction:
|
|
11
|
+
function d(e) {
|
|
12
|
+
const { direction: s, wrap: t, align: i, justify: n, ...o } = e;
|
|
17
13
|
return a({
|
|
18
14
|
style: {
|
|
19
|
-
...
|
|
20
|
-
flexDirection:
|
|
15
|
+
...o.style,
|
|
16
|
+
flexDirection: s,
|
|
21
17
|
flexWrap: t === !0 ? "wrap" : t,
|
|
22
|
-
alignItems:
|
|
23
|
-
justifyContent:
|
|
18
|
+
alignItems: i,
|
|
19
|
+
justifyContent: n
|
|
24
20
|
},
|
|
25
|
-
...
|
|
21
|
+
...o
|
|
26
22
|
});
|
|
27
23
|
}
|
|
28
|
-
function
|
|
29
|
-
const { className:
|
|
30
|
-
return /* @__PURE__ */
|
|
24
|
+
function F(e) {
|
|
25
|
+
const { className: s, ...t } = e;
|
|
26
|
+
return /* @__PURE__ */ l(
|
|
31
27
|
"div",
|
|
32
28
|
{
|
|
33
|
-
className:
|
|
34
|
-
...
|
|
29
|
+
className: r([s, p(t)]),
|
|
30
|
+
...d(t)
|
|
35
31
|
}
|
|
36
32
|
);
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
const N = (e) => r(["Flex__item", m(e)]);
|
|
35
|
+
function v(e) {
|
|
36
|
+
const { style: s, grow: t, order: i, shrink: n, basis: o, align: c, ...u } = e, x = o ?? // IE11: Set basis to specified width if it's known, which fixes certain
|
|
40
37
|
// bugs when rendering tables inside the flex.
|
|
41
38
|
e.width ?? // If grow is used, basis should be set to 0 to be consistent with
|
|
42
39
|
// flex css shorthand `flex: 1`.
|
|
43
40
|
(t !== void 0 ? 0 : void 0);
|
|
44
41
|
return a({
|
|
45
42
|
style: {
|
|
46
|
-
...
|
|
43
|
+
...s,
|
|
47
44
|
flexGrow: t !== void 0 && Number(t),
|
|
48
|
-
flexShrink:
|
|
49
|
-
flexBasis:
|
|
50
|
-
order:
|
|
51
|
-
alignSelf:
|
|
45
|
+
flexShrink: n !== void 0 && Number(n),
|
|
46
|
+
flexBasis: f(x),
|
|
47
|
+
order: i,
|
|
48
|
+
alignSelf: c
|
|
52
49
|
},
|
|
53
|
-
...
|
|
50
|
+
...u
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
|
-
function
|
|
57
|
-
const { className:
|
|
58
|
-
return /* @__PURE__ */
|
|
53
|
+
function y(e) {
|
|
54
|
+
const { className: s, ...t } = e;
|
|
55
|
+
return /* @__PURE__ */ l(
|
|
59
56
|
"div",
|
|
60
57
|
{
|
|
61
|
-
className:
|
|
62
|
-
...
|
|
58
|
+
className: r([s, N(e)]),
|
|
59
|
+
...v(t)
|
|
63
60
|
}
|
|
64
61
|
);
|
|
65
62
|
}
|
|
66
|
-
|
|
63
|
+
F.Item = y;
|
|
67
64
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
v as
|
|
65
|
+
F as Flex,
|
|
66
|
+
p as computeFlexClassName,
|
|
67
|
+
N as computeFlexItemClassName,
|
|
68
|
+
v as computeFlexItemProps,
|
|
69
|
+
d as computeFlexProps
|
|
72
70
|
};
|
package/dist/components/Icon.js
CHANGED
|
@@ -1,51 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { classes as
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { classes as l } from "../common/react.js";
|
|
3
3
|
import { computeBoxProps as p, computeBoxClassName as u } from "./Box.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let s = "";
|
|
13
|
-
if (t.startsWith("tg-"))
|
|
14
|
-
s = t;
|
|
4
|
+
const f = /-o$/;
|
|
5
|
+
function d(c) {
|
|
6
|
+
const { name: s, size: o, spin: a, className: N, rotation: r, ...e } = c, n = e.style || {};
|
|
7
|
+
o && (n.fontSize = `${o * 100}%`), r && (n.transform = `rotate(${r}deg)`), e.style = n;
|
|
8
|
+
const x = p(e);
|
|
9
|
+
let t = "";
|
|
10
|
+
if (s.startsWith("tg-"))
|
|
11
|
+
t = s;
|
|
15
12
|
else {
|
|
16
|
-
const
|
|
17
|
-
|
|
13
|
+
const I = f.test(s), i = s.replace(f, ""), S = !i.startsWith("fa-");
|
|
14
|
+
t = I ? "far " : "fas ", S && (t += "fa-"), t += i, a && (t += " fa-spin");
|
|
18
15
|
}
|
|
19
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ m(
|
|
20
17
|
"i",
|
|
21
18
|
{
|
|
22
|
-
className:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
u(
|
|
19
|
+
className: l([
|
|
20
|
+
"Icon",
|
|
21
|
+
t,
|
|
22
|
+
N,
|
|
23
|
+
u(e)
|
|
27
24
|
]),
|
|
28
|
-
...
|
|
25
|
+
...x
|
|
29
26
|
}
|
|
30
27
|
);
|
|
31
28
|
}
|
|
32
|
-
function
|
|
33
|
-
const { className:
|
|
34
|
-
return /* @__PURE__ */
|
|
29
|
+
function g(c) {
|
|
30
|
+
const { className: s, children: o, ...a } = c;
|
|
31
|
+
return /* @__PURE__ */ m(
|
|
35
32
|
"span",
|
|
36
33
|
{
|
|
37
|
-
className:
|
|
38
|
-
|
|
39
|
-
t,
|
|
40
|
-
u(c)
|
|
41
|
-
]),
|
|
42
|
-
...p(c),
|
|
34
|
+
className: l(["IconStack", s, u(a)]),
|
|
35
|
+
...p(a),
|
|
43
36
|
children: o
|
|
44
37
|
}
|
|
45
38
|
);
|
|
46
39
|
}
|
|
47
|
-
|
|
40
|
+
d.Stack = g;
|
|
48
41
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
d as Icon,
|
|
43
|
+
g as IconStack
|
|
51
44
|
};
|
package/dist/components/Image.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { computeBoxProps as
|
|
2
|
+
import { useRef as a } from "react";
|
|
3
|
+
import { computeBoxProps as f } from "./Box.js";
|
|
4
4
|
const l = 5;
|
|
5
|
-
function
|
|
5
|
+
function E(o) {
|
|
6
6
|
const {
|
|
7
7
|
fixBlur: s = !0,
|
|
8
8
|
fixErrors: m = !1,
|
|
9
9
|
objectFit: n = "fill",
|
|
10
10
|
src: e,
|
|
11
11
|
...c
|
|
12
|
-
} = o, t =
|
|
12
|
+
} = o, t = a(0), r = f(c);
|
|
13
13
|
return r.style = {
|
|
14
14
|
...r.style,
|
|
15
15
|
"-ms-interpolation-mode": s ? "nearest-neighbor" : "auto",
|
|
@@ -26,10 +26,11 @@ function b(o) {
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
src: e,
|
|
29
|
-
...r
|
|
29
|
+
...r,
|
|
30
|
+
alt: "dm icon"
|
|
30
31
|
}
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
34
|
export {
|
|
34
|
-
|
|
35
|
+
E as Image
|
|
35
36
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Placement } from '@popperjs/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BooleanLike } from '../common/react';
|
|
4
|
+
import { BoxProps } from './Box';
|
|
5
|
+
type Props = Partial<{
|
|
6
|
+
/** Asset cache. Example: `asset={['assetname32x32', thing.key]}` */
|
|
7
|
+
asset: string[];
|
|
8
|
+
/** Classic way to put images. Example: `base64={thing.image}` */
|
|
9
|
+
base64: string;
|
|
10
|
+
/**
|
|
11
|
+
* Special container for buttons.
|
|
12
|
+
* You can put any other component here.
|
|
13
|
+
* Has some special stylings!
|
|
14
|
+
* Example: `buttons={<Button>Send</Button>}`
|
|
15
|
+
*/
|
|
16
|
+
buttons: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Enables alternate layout for `buttons` container.
|
|
19
|
+
* Without fluid, buttons will be on top and with `pointer-events: none`, useful for text info.
|
|
20
|
+
* With fluid, buttons will be in "hamburger" style.
|
|
21
|
+
*/
|
|
22
|
+
buttonsAlt: boolean;
|
|
23
|
+
/** Content under image. Or on the right if fluid. */
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
/** Applies a CSS class to the element. */
|
|
26
|
+
className: string;
|
|
27
|
+
/** Color of the button. See [Button](#button) but without `transparent`. */
|
|
28
|
+
color: string;
|
|
29
|
+
/** Makes button disabled and dark red if true. Also disables onClick. */
|
|
30
|
+
disabled: BooleanLike;
|
|
31
|
+
/** Optional. Adds a "stub" when loading DmIcon. */
|
|
32
|
+
dmFallback: ReactNode;
|
|
33
|
+
/** Parameter `icon` of component `DmIcon`. */
|
|
34
|
+
dmIcon: string | null;
|
|
35
|
+
/** Parameter `icon_state` of component `DmIcon`. */
|
|
36
|
+
dmIconState: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Changes the layout of the button, making it fill the entire horizontally available space.
|
|
39
|
+
* Allows the use of `title`
|
|
40
|
+
*/
|
|
41
|
+
fluid: boolean;
|
|
42
|
+
/** Parameter responsible for the size of the image, component and standard "stubs". */
|
|
43
|
+
imageSize: number;
|
|
44
|
+
/** Prop `src` of Image component. Example: `imageSrc={resolveAsset(thing.image}` */
|
|
45
|
+
imageSrc: string;
|
|
46
|
+
/** Called when button is clicked with LMB. */
|
|
47
|
+
onClick: (e: any) => void;
|
|
48
|
+
/** Called when button is clicked with RMB. */
|
|
49
|
+
onRightClick: (e: any) => void;
|
|
50
|
+
/** Makes button selected and green if true. */
|
|
51
|
+
selected: BooleanLike;
|
|
52
|
+
/** Requires `fluid` for work. Bold text with divider betwen content. */
|
|
53
|
+
title: string;
|
|
54
|
+
/** A fancy, boxy tooltip, which appears when hovering over the button */
|
|
55
|
+
tooltip: ReactNode;
|
|
56
|
+
/** Position of the tooltip. See [`Popper`](#Popper) for valid options. */
|
|
57
|
+
tooltipPosition: Placement;
|
|
58
|
+
}> & BoxProps;
|
|
59
|
+
export declare function ImageButton(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { classes as l } from "../common/react.js";
|
|
3
|
+
import { computeBoxProps as B } from "./Box.js";
|
|
4
|
+
import { DmIcon as D } from "./DmIcon.js";
|
|
5
|
+
import { Icon as F } from "./Icon.js";
|
|
6
|
+
import { Image as j } from "./Image.js";
|
|
7
|
+
import { Stack as I } from "./Stack.js";
|
|
8
|
+
import { Tooltip as z } from "./Tooltip.js";
|
|
9
|
+
function H(k) {
|
|
10
|
+
const {
|
|
11
|
+
asset: h,
|
|
12
|
+
base64: r,
|
|
13
|
+
buttons: m,
|
|
14
|
+
buttonsAlt: g,
|
|
15
|
+
children: i,
|
|
16
|
+
className: w,
|
|
17
|
+
color: e,
|
|
18
|
+
disabled: a,
|
|
19
|
+
dmFallback: b,
|
|
20
|
+
dmIcon: x,
|
|
21
|
+
dmIconState: C,
|
|
22
|
+
fluid: c,
|
|
23
|
+
imageSize: o = 64,
|
|
24
|
+
imageSrc: d,
|
|
25
|
+
onClick: s,
|
|
26
|
+
onRightClick: p,
|
|
27
|
+
selected: _,
|
|
28
|
+
title: $,
|
|
29
|
+
tooltip: y,
|
|
30
|
+
tooltipPosition: v,
|
|
31
|
+
...S
|
|
32
|
+
} = k;
|
|
33
|
+
function N(n, A) {
|
|
34
|
+
return /* @__PURE__ */ t(I, { height: `${o}px`, width: `${o}px`, children: /* @__PURE__ */ t(I.Item, { grow: !0, textAlign: "center", align: "center", children: /* @__PURE__ */ t(
|
|
35
|
+
F,
|
|
36
|
+
{
|
|
37
|
+
spin: A,
|
|
38
|
+
name: n,
|
|
39
|
+
color: "gray",
|
|
40
|
+
style: { fontSize: `calc(${o}px * 0.75)` }
|
|
41
|
+
}
|
|
42
|
+
) }) });
|
|
43
|
+
}
|
|
44
|
+
let u = /* @__PURE__ */ f(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: l([
|
|
48
|
+
"container",
|
|
49
|
+
m && "hasButtons",
|
|
50
|
+
!s && !p && "noAction",
|
|
51
|
+
_ && "selected",
|
|
52
|
+
a && "disabled",
|
|
53
|
+
e && typeof e == "string" ? `color__${e}` : "color__default"
|
|
54
|
+
]),
|
|
55
|
+
tabIndex: a ? void 0 : 0,
|
|
56
|
+
onClick: (n) => {
|
|
57
|
+
!a && s && s(n);
|
|
58
|
+
},
|
|
59
|
+
onKeyDown: (n) => {
|
|
60
|
+
n.key === "Enter" && !a && s && s(n);
|
|
61
|
+
},
|
|
62
|
+
onContextMenu: (n) => {
|
|
63
|
+
n.preventDefault(), !a && p && p(n);
|
|
64
|
+
},
|
|
65
|
+
style: { width: c ? "auto" : `calc(${o}px + 0.5em + 2px)` },
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ t("div", { className: "image", children: r || h || d ? /* @__PURE__ */ t(
|
|
68
|
+
j,
|
|
69
|
+
{
|
|
70
|
+
className: l(!r && !d && h || []),
|
|
71
|
+
src: r ? `data:image/png;base64,${r}` : d,
|
|
72
|
+
height: `${o}px`,
|
|
73
|
+
width: `${o}px`
|
|
74
|
+
}
|
|
75
|
+
) : x && C ? /* @__PURE__ */ t(
|
|
76
|
+
D,
|
|
77
|
+
{
|
|
78
|
+
icon: x,
|
|
79
|
+
icon_state: C,
|
|
80
|
+
fallback: b || N("spinner", !0),
|
|
81
|
+
height: `${o}px`,
|
|
82
|
+
width: `${o}px`
|
|
83
|
+
}
|
|
84
|
+
) : N("question", !1) }),
|
|
85
|
+
c ? /* @__PURE__ */ f("div", { className: "info", children: [
|
|
86
|
+
$ && /* @__PURE__ */ t("span", { className: l(["title", i && "divider"]), children: $ }),
|
|
87
|
+
i && /* @__PURE__ */ t("span", { className: "contentFluid", children: i })
|
|
88
|
+
] }) : i && /* @__PURE__ */ t(
|
|
89
|
+
"span",
|
|
90
|
+
{
|
|
91
|
+
className: l([
|
|
92
|
+
"content",
|
|
93
|
+
_ && "contentSelected",
|
|
94
|
+
a && "contentDisabled",
|
|
95
|
+
e && typeof e == "string" ? `contentColor__${e}` : "contentColor__default"
|
|
96
|
+
]),
|
|
97
|
+
children: i
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
return y && (u = /* @__PURE__ */ t(z, { content: y, position: v, children: u })), /* @__PURE__ */ f(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: l(["ImageButton", c && "fluid", w]),
|
|
107
|
+
...B(S),
|
|
108
|
+
children: [
|
|
109
|
+
u,
|
|
110
|
+
m && /* @__PURE__ */ t(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
className: l([
|
|
114
|
+
"buttonsContainer",
|
|
115
|
+
g && "buttonsAltContainer",
|
|
116
|
+
!i && "buttonsEmpty",
|
|
117
|
+
c && e && typeof e == "string" ? `buttonsContainerColor__${e}` : c && "buttonsContainerColor__default"
|
|
118
|
+
]),
|
|
119
|
+
style: {
|
|
120
|
+
width: g ? `calc(${o}px + 0.5em)` : "auto"
|
|
121
|
+
},
|
|
122
|
+
children: m
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
H as ImageButton
|
|
131
|
+
};
|
|
@@ -24,7 +24,7 @@ class k extends v {
|
|
|
24
24
|
}
|
|
25
25
|
doOffsetMouse(e) {
|
|
26
26
|
const { zoom: o } = this.state;
|
|
27
|
-
e.screenZoomX = e.screenX *
|
|
27
|
+
e.screenZoomX = e.screenX * o ** -1, e.screenZoomY = e.screenY * o ** -1;
|
|
28
28
|
}
|
|
29
29
|
handleMouseDown(e) {
|
|
30
30
|
this.setState((o) => ({
|
package/dist/components/Input.js
CHANGED
|
@@ -1,88 +1,81 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { KEY as
|
|
4
|
-
import { classes as
|
|
5
|
-
import { debounce as
|
|
6
|
-
import { Box as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fluid: L,
|
|
10
|
-
baseline: Y,
|
|
11
|
-
inner: q,
|
|
12
|
-
monospace: v
|
|
13
|
-
};
|
|
14
|
-
function a(r) {
|
|
15
|
-
return typeof r != "number" && typeof r != "string" ? "" : String(r);
|
|
1
|
+
import { jsxs as E, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as K, useEffect as m } from "react";
|
|
3
|
+
import { KEY as V, isEscape as j } from "../common/keys.js";
|
|
4
|
+
import { classes as k } from "../common/react.js";
|
|
5
|
+
import { debounce as B } from "../common/timer.js";
|
|
6
|
+
import { Box as R } from "./Box.js";
|
|
7
|
+
function l(u) {
|
|
8
|
+
return typeof u != "number" && typeof u != "string" ? "" : String(u);
|
|
16
9
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
10
|
+
const S = B((u) => u(), 250);
|
|
11
|
+
function A(u) {
|
|
19
12
|
const {
|
|
20
|
-
autoFocus:
|
|
21
|
-
autoSelect:
|
|
22
|
-
className:
|
|
23
|
-
disabled:
|
|
13
|
+
autoFocus: d,
|
|
14
|
+
autoSelect: s,
|
|
15
|
+
className: g,
|
|
16
|
+
disabled: I,
|
|
24
17
|
expensive: T,
|
|
25
|
-
fluid:
|
|
18
|
+
fluid: b,
|
|
26
19
|
maxLength: x,
|
|
27
|
-
monospace:
|
|
20
|
+
monospace: y,
|
|
28
21
|
onChange: t,
|
|
29
|
-
onEnter:
|
|
22
|
+
onEnter: n,
|
|
30
23
|
onEscape: o,
|
|
31
|
-
onInput:
|
|
32
|
-
placeholder:
|
|
33
|
-
selfClear:
|
|
34
|
-
value:
|
|
24
|
+
onInput: i,
|
|
25
|
+
placeholder: h,
|
|
26
|
+
selfClear: w,
|
|
27
|
+
value: a,
|
|
35
28
|
...N
|
|
36
|
-
} =
|
|
37
|
-
function
|
|
38
|
-
var
|
|
39
|
-
if (!
|
|
40
|
-
const
|
|
41
|
-
T ?
|
|
29
|
+
} = u, c = K(null);
|
|
30
|
+
function _(e) {
|
|
31
|
+
var f;
|
|
32
|
+
if (!i) return;
|
|
33
|
+
const r = (f = e.currentTarget) == null ? void 0 : f.value;
|
|
34
|
+
T ? S(() => i(e, r)) : i(e, r);
|
|
42
35
|
}
|
|
43
|
-
function
|
|
44
|
-
if (e.key ===
|
|
45
|
-
|
|
36
|
+
function D(e) {
|
|
37
|
+
if (e.key === V.Enter) {
|
|
38
|
+
n == null || n(e, e.currentTarget.value), w ? e.currentTarget.value = "" : (e.currentTarget.blur(), t == null || t(e, e.currentTarget.value));
|
|
46
39
|
return;
|
|
47
40
|
}
|
|
48
|
-
|
|
41
|
+
j(e.key) && (o == null || o(e), e.currentTarget.value = l(a), e.currentTarget.blur());
|
|
49
42
|
}
|
|
50
|
-
return
|
|
51
|
-
const e =
|
|
43
|
+
return m(() => {
|
|
44
|
+
const e = c.current;
|
|
52
45
|
if (!e) return;
|
|
53
|
-
const
|
|
54
|
-
e.value !==
|
|
55
|
-
e.focus(),
|
|
46
|
+
const r = l(a);
|
|
47
|
+
e.value !== r && (e.value = r), !(!d && !s) && setTimeout(() => {
|
|
48
|
+
e.focus(), s && e.select();
|
|
56
49
|
}, 1);
|
|
57
|
-
}, []),
|
|
58
|
-
const e =
|
|
50
|
+
}, []), m(() => {
|
|
51
|
+
const e = c.current;
|
|
59
52
|
if (!e || document.activeElement === e)
|
|
60
53
|
return;
|
|
61
|
-
const
|
|
62
|
-
e.value !==
|
|
63
|
-
}), /* @__PURE__ */
|
|
64
|
-
|
|
54
|
+
const r = l(a);
|
|
55
|
+
e.value !== r && (e.value = r);
|
|
56
|
+
}), /* @__PURE__ */ E(
|
|
57
|
+
R,
|
|
65
58
|
{
|
|
66
|
-
className:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
className: k([
|
|
60
|
+
"Input",
|
|
61
|
+
b && "Input--fluid",
|
|
62
|
+
y && "Input--monospace",
|
|
63
|
+
g
|
|
71
64
|
]),
|
|
72
65
|
...N,
|
|
73
66
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ p("div", { className: "Input__baseline", children: "." }),
|
|
68
|
+
/* @__PURE__ */ p(
|
|
76
69
|
"input",
|
|
77
70
|
{
|
|
78
|
-
className:
|
|
79
|
-
disabled:
|
|
71
|
+
className: "Input__input",
|
|
72
|
+
disabled: I,
|
|
80
73
|
maxLength: x,
|
|
81
74
|
onBlur: (e) => t == null ? void 0 : t(e, e.target.value),
|
|
82
|
-
onChange:
|
|
83
|
-
onKeyDown:
|
|
84
|
-
placeholder:
|
|
85
|
-
ref:
|
|
75
|
+
onChange: _,
|
|
76
|
+
onKeyDown: D,
|
|
77
|
+
placeholder: h,
|
|
78
|
+
ref: c
|
|
86
79
|
}
|
|
87
80
|
)
|
|
88
81
|
]
|
|
@@ -90,6 +83,6 @@ function P(r) {
|
|
|
90
83
|
);
|
|
91
84
|
}
|
|
92
85
|
export {
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
A as Input,
|
|
87
|
+
l as toInputValue
|
|
95
88
|
};
|