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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Placement } from '@
|
|
1
|
+
import { Placement } from '@floating-ui/react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { BooleanLike } from '../common/react';
|
|
4
4
|
import { BoxProps } from './Box';
|
|
@@ -66,14 +66,13 @@ type Props = Partial<{
|
|
|
66
66
|
title: string;
|
|
67
67
|
/** A fancy, boxy tooltip, which appears when hovering over the button */
|
|
68
68
|
tooltip: ReactNode;
|
|
69
|
-
/** Position of the tooltip.
|
|
69
|
+
/** Position of the tooltip. Does not guarantee the position is respected. */
|
|
70
70
|
tooltipPosition: Placement;
|
|
71
71
|
}> & BoxProps;
|
|
72
72
|
/**
|
|
73
73
|
* Stylized button, with the ability to easily and simply insert any picture into it.
|
|
74
74
|
* - Without image, will be default question icon.
|
|
75
75
|
* - If an image is specified but for some reason cannot be displayed, there will be a spinner fallback until it is loaded.
|
|
76
|
-
* - Component has no **hover** effects, if `onClick` or `onRightClick` is not specified.
|
|
77
76
|
*/
|
|
78
77
|
export declare function ImageButton(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
79
78
|
export {};
|
|
@@ -1,161 +1,151 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { classes as c } from "../common/react.js";
|
|
3
|
-
import { computeBoxProps as
|
|
4
|
-
import { DmIcon as
|
|
5
|
-
import { Icon as
|
|
3
|
+
import { computeBoxProps as D } from "../common/ui.js";
|
|
4
|
+
import { DmIcon as j } from "./DmIcon.js";
|
|
5
|
+
import { Icon as A } from "./Icon.js";
|
|
6
6
|
import { Image as y } from "./Image.js";
|
|
7
7
|
import { Stack as N } from "./Stack.js";
|
|
8
8
|
import { Tooltip as F } from "./Tooltip.js";
|
|
9
|
-
function W(
|
|
9
|
+
function W(r) {
|
|
10
10
|
const {
|
|
11
|
-
asset:
|
|
11
|
+
asset: l,
|
|
12
12
|
assetSize: u = 32,
|
|
13
|
-
base64:
|
|
14
|
-
buttons:
|
|
15
|
-
buttonsAlt:
|
|
16
|
-
children:
|
|
13
|
+
base64: o,
|
|
14
|
+
buttons: _,
|
|
15
|
+
buttonsAlt: h,
|
|
16
|
+
children: n,
|
|
17
17
|
className: k,
|
|
18
|
-
color:
|
|
19
|
-
disabled:
|
|
18
|
+
color: d,
|
|
19
|
+
disabled: a,
|
|
20
20
|
dmFallback: v,
|
|
21
|
-
dmIcon:
|
|
22
|
-
dmIconState:
|
|
23
|
-
fluid:
|
|
24
|
-
imageSize:
|
|
25
|
-
imageSrc:
|
|
26
|
-
onClick:
|
|
27
|
-
onRightClick:
|
|
28
|
-
selected:
|
|
29
|
-
title:
|
|
30
|
-
tooltip:
|
|
21
|
+
dmIcon: I,
|
|
22
|
+
dmIconState: f,
|
|
23
|
+
fluid: s,
|
|
24
|
+
imageSize: e = 64,
|
|
25
|
+
imageSrc: x,
|
|
26
|
+
onClick: m,
|
|
27
|
+
onRightClick: B,
|
|
28
|
+
selected: z,
|
|
29
|
+
title: b,
|
|
30
|
+
tooltip: $,
|
|
31
31
|
tooltipPosition: S,
|
|
32
|
-
...
|
|
33
|
-
} =
|
|
34
|
-
let
|
|
32
|
+
...C
|
|
33
|
+
} = r;
|
|
34
|
+
let p = /* @__PURE__ */ g(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
|
-
className:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
!
|
|
41
|
-
$ && "ImageButton--selected",
|
|
42
|
-
i && "ImageButton--disabled",
|
|
43
|
-
e && typeof e == "string" ? `ImageButton--color__${e}` : "ImageButton--color__default"
|
|
44
|
-
]),
|
|
45
|
-
tabIndex: i ? void 0 : 0,
|
|
46
|
-
onClick: (l) => {
|
|
47
|
-
!i && r && r(l);
|
|
37
|
+
className: "ImageButton__container",
|
|
38
|
+
tabIndex: a ? void 0 : 0,
|
|
39
|
+
onClick: (i) => {
|
|
40
|
+
!a && m && m(i);
|
|
48
41
|
},
|
|
49
|
-
onKeyDown: (
|
|
50
|
-
|
|
42
|
+
onKeyDown: (i) => {
|
|
43
|
+
i.key === "Enter" && !a && m && m(i);
|
|
51
44
|
},
|
|
52
|
-
onContextMenu: (
|
|
53
|
-
|
|
45
|
+
onContextMenu: (i) => {
|
|
46
|
+
i.preventDefault(), !a && B && B(i);
|
|
54
47
|
},
|
|
55
|
-
style: { width:
|
|
48
|
+
style: { width: s ? "auto" : `calc(${e}px + 0.5em + 2px)` },
|
|
56
49
|
children: [
|
|
57
|
-
/* @__PURE__ */ t("div", { className: "
|
|
50
|
+
/* @__PURE__ */ t("div", { className: "ImageButton__image", children: o || x ? /* @__PURE__ */ t(
|
|
58
51
|
y,
|
|
59
52
|
{
|
|
60
|
-
src:
|
|
61
|
-
height: `${
|
|
62
|
-
width: `${
|
|
53
|
+
src: o ? `data:image/png;base64,${o}` : x,
|
|
54
|
+
height: `${e}px`,
|
|
55
|
+
width: `${e}px`
|
|
63
56
|
}
|
|
64
|
-
) :
|
|
65
|
-
|
|
57
|
+
) : I && f ? /* @__PURE__ */ t(
|
|
58
|
+
j,
|
|
66
59
|
{
|
|
67
|
-
icon:
|
|
68
|
-
icon_state:
|
|
69
|
-
fallback: v || /* @__PURE__ */ t(w, { icon: "spinner", spin: !0, size:
|
|
70
|
-
height: `${
|
|
71
|
-
width: `${
|
|
60
|
+
icon: I,
|
|
61
|
+
icon_state: f,
|
|
62
|
+
fallback: v || /* @__PURE__ */ t(w, { icon: "spinner", spin: !0, size: e }),
|
|
63
|
+
height: `${e}px`,
|
|
64
|
+
width: `${e}px`
|
|
72
65
|
}
|
|
73
|
-
) :
|
|
66
|
+
) : l ? /* @__PURE__ */ t(
|
|
74
67
|
y,
|
|
75
68
|
{
|
|
76
|
-
className: c(
|
|
77
|
-
height: `${
|
|
78
|
-
width: `${
|
|
69
|
+
className: c(l || []),
|
|
70
|
+
height: `${e}px`,
|
|
71
|
+
width: `${e}px`,
|
|
79
72
|
style: {
|
|
80
|
-
transform: `scale(${
|
|
73
|
+
transform: `scale(${e / u})`,
|
|
81
74
|
transformOrigin: "top left"
|
|
82
75
|
}
|
|
83
76
|
}
|
|
84
|
-
) : /* @__PURE__ */ t(w, { icon: "question", size:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
)
|
|
77
|
+
) : /* @__PURE__ */ t(w, { icon: "question", size: e }) }),
|
|
78
|
+
s ? /* @__PURE__ */ g("div", { className: "ImageButton__content", children: [
|
|
79
|
+
b && /* @__PURE__ */ t(
|
|
80
|
+
"span",
|
|
81
|
+
{
|
|
82
|
+
className: c([
|
|
83
|
+
"ImageButton__content--title",
|
|
84
|
+
!!n && "ImageButton__content--divider"
|
|
85
|
+
]),
|
|
86
|
+
children: b
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
n && /* @__PURE__ */ t("span", { className: "ImageButton__content--text", children: n })
|
|
90
|
+
] }) : !!n && /* @__PURE__ */ t("span", { className: "ImageButton__content", children: n })
|
|
100
91
|
]
|
|
101
92
|
}
|
|
102
93
|
);
|
|
103
|
-
return
|
|
94
|
+
return $ && (p = /* @__PURE__ */ t(F, { content: $, position: S, children: p })), /* @__PURE__ */ g(
|
|
104
95
|
"div",
|
|
105
96
|
{
|
|
106
97
|
className: c([
|
|
107
98
|
"ImageButton",
|
|
108
|
-
|
|
99
|
+
s && "ImageButton--fluid",
|
|
100
|
+
z && "ImageButton--selected",
|
|
101
|
+
a && "ImageButton--disabled",
|
|
102
|
+
d && typeof d == "string" ? `ImageButton__color--${d}` : "ImageButton__color--default",
|
|
109
103
|
k
|
|
110
104
|
]),
|
|
111
|
-
...
|
|
105
|
+
...D(C),
|
|
112
106
|
children: [
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
p,
|
|
108
|
+
_ && /* @__PURE__ */ t(
|
|
115
109
|
"div",
|
|
116
110
|
{
|
|
117
111
|
className: c([
|
|
118
|
-
"
|
|
119
|
-
!
|
|
120
|
-
o && i && "ImageButton--disabled",
|
|
121
|
-
o && e && typeof e == "string" ? `ImageButton--buttonsContainerColor__${e}` : o && "ImageButton--buttonsContainerColor__default"
|
|
112
|
+
"ImageButton__buttons",
|
|
113
|
+
!n && "ImageButton__buttons--empty"
|
|
122
114
|
]),
|
|
123
115
|
style: {
|
|
124
116
|
width: "auto"
|
|
125
117
|
},
|
|
126
|
-
children:
|
|
118
|
+
children: _
|
|
127
119
|
}
|
|
128
120
|
),
|
|
129
|
-
|
|
121
|
+
h && /* @__PURE__ */ t(
|
|
130
122
|
"div",
|
|
131
123
|
{
|
|
132
124
|
className: c([
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
!
|
|
136
|
-
o && i && "ImageButton--disabled",
|
|
137
|
-
o && e && typeof e == "string" ? `ImageButton--buttonsContainerColor__${e}` : o && "ImageButton--buttonsContainerColor__default"
|
|
125
|
+
"ImageButton__buttons",
|
|
126
|
+
"ImageButton__buttons--alt",
|
|
127
|
+
!n && "ImageButton__buttons--empty"
|
|
138
128
|
]),
|
|
139
129
|
style: {
|
|
140
|
-
width: `calc(${
|
|
141
|
-
maxWidth:
|
|
130
|
+
width: `calc(${e}px + ${s ? 0 : 0.5}em)`,
|
|
131
|
+
maxWidth: s ? "auto" : `calc(${e}px + 0.5em)`
|
|
142
132
|
},
|
|
143
|
-
children:
|
|
133
|
+
children: h
|
|
144
134
|
}
|
|
145
135
|
)
|
|
146
136
|
]
|
|
147
137
|
}
|
|
148
138
|
);
|
|
149
139
|
}
|
|
150
|
-
function w(
|
|
151
|
-
const { icon:
|
|
152
|
-
return /* @__PURE__ */ t(N, { height: `${
|
|
153
|
-
|
|
140
|
+
function w(r) {
|
|
141
|
+
const { icon: l, spin: u = !1, size: o = 64 } = r;
|
|
142
|
+
return /* @__PURE__ */ t(N, { height: `${o}px`, width: `${o}px`, children: /* @__PURE__ */ t(N.Item, { grow: !0, textAlign: "center", align: "center", children: /* @__PURE__ */ t(
|
|
143
|
+
A,
|
|
154
144
|
{
|
|
155
145
|
spin: u,
|
|
156
|
-
name:
|
|
146
|
+
name: l,
|
|
157
147
|
color: "gray",
|
|
158
|
-
style: { fontSize: `calc(${
|
|
148
|
+
style: { fontSize: `calc(${o}px * 0.75)` }
|
|
159
149
|
}
|
|
160
150
|
) }) });
|
|
161
151
|
}
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { BoxProps } from './Box';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
onBackgroundMoved?: (newX: number, newY: number) => void;
|
|
6
|
-
initialLeft?: number;
|
|
7
|
-
initialTop?: number;
|
|
8
|
-
backgroundImage?: string;
|
|
3
|
+
type Props = {
|
|
4
|
+
/** The width of the image to display. */
|
|
9
5
|
imageWidth: number;
|
|
10
|
-
} &
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
left
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
} & Partial<{
|
|
7
|
+
/** The background image to display. */
|
|
8
|
+
backgroundImage: string;
|
|
9
|
+
/** The initial left position of the image. */
|
|
10
|
+
initialLeft: number;
|
|
11
|
+
/** The initial top position of the image. */
|
|
12
|
+
initialTop: number;
|
|
13
|
+
/** A callback function that is called when the background image is moved. */
|
|
14
|
+
onBackgroundMoved: (newX: number, newY: number) => void;
|
|
15
|
+
/** A callback function that is called when the zoom value changes. */
|
|
16
|
+
onZoomChange: (newZoomValue: number) => void;
|
|
17
|
+
}> & BoxProps & PropsWithChildren;
|
|
18
|
+
/**
|
|
19
|
+
* ## InfinitePlane
|
|
20
|
+
* Creates a scrolling infinite plane using a background image.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <InfinitePlane imageWidth={100} backgroundImage="https://example.com/image.png">
|
|
25
|
+
* <Box position="absolute" top={0} left={0}>
|
|
26
|
+
* Hello, world!
|
|
27
|
+
* </Box>
|
|
28
|
+
* <Box position="absolute" top={0} left={100}>
|
|
29
|
+
* Hello, world!
|
|
30
|
+
* </Box>
|
|
31
|
+
* <Box position="absolute" top={0} left={200}>
|
|
32
|
+
* Hello, world!
|
|
33
|
+
* </Box>
|
|
34
|
+
* </InfinitePlane>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function InfinitePlane(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
35
38
|
export {};
|
|
@@ -1,143 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 = {
|
|
54
|
-
mouseDown: !1,
|
|
55
|
-
left: 0,
|
|
56
|
-
top: 0,
|
|
57
|
-
lastLeft: 0,
|
|
58
|
-
lastTop: 0,
|
|
59
|
-
zoom: 1
|
|
60
|
-
};
|
|
1
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useEffect as z } from "react";
|
|
3
|
+
import { computeBoxProps as A } from "../common/ui.js";
|
|
4
|
+
import { Button as O } from "./Button.js";
|
|
5
|
+
import { ProgressBar as N } from "./ProgressBar.js";
|
|
6
|
+
import { Stack as c } from "./Stack.js";
|
|
7
|
+
const f = 0.5, p = 1.5, S = 0.1;
|
|
8
|
+
function F(l) {
|
|
9
|
+
const {
|
|
10
|
+
backgroundImage: t,
|
|
11
|
+
children: r,
|
|
12
|
+
imageWidth: $,
|
|
13
|
+
initialLeft: h = 0,
|
|
14
|
+
initialTop: w = 0,
|
|
15
|
+
onBackgroundMoved: a,
|
|
16
|
+
onZoomChange: u,
|
|
17
|
+
...M
|
|
18
|
+
} = l, [E, T] = i(0), [y, C] = i(0), [g, D] = i(0), [_, v] = i(!1), [x, P] = i(0), [n, V] = i(1);
|
|
19
|
+
function L(e) {
|
|
20
|
+
T(e.clientX - g), C(e.clientY - x), v(!0);
|
|
61
21
|
}
|
|
62
|
-
|
|
63
|
-
|
|
22
|
+
function b(e) {
|
|
23
|
+
if (!_) return;
|
|
24
|
+
const m = e.clientX - E, s = e.clientY - y;
|
|
25
|
+
a == null || a(m + h, s + w), D(m), P(s);
|
|
64
26
|
}
|
|
65
|
-
|
|
66
|
-
|
|
27
|
+
function k() {
|
|
28
|
+
v(!1);
|
|
67
29
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
30
|
+
function X(e) {
|
|
31
|
+
if (e === "increase" && n >= p || e === "decrease" && n <= f) return;
|
|
32
|
+
const s = Math.round((n + (e === "increase" ? S : -0.1)) * 10) / 10;
|
|
33
|
+
V(s), u == null || u(s);
|
|
34
|
+
}
|
|
35
|
+
z(() => (window.addEventListener("mouseup", k), () => {
|
|
36
|
+
window.removeEventListener("mouseup", k);
|
|
37
|
+
}), []);
|
|
38
|
+
const I = h + g, Z = w + x;
|
|
39
|
+
return /* @__PURE__ */ d(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
...A({
|
|
43
|
+
...M,
|
|
44
|
+
style: {
|
|
45
|
+
...M.style,
|
|
46
|
+
height: "100%",
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
position: "relative",
|
|
49
|
+
width: "100%"
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ o(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
onMouseDown: L,
|
|
57
|
+
onMouseMove: b,
|
|
58
|
+
style: {
|
|
59
|
+
backgroundImage: `url("${t}")`,
|
|
60
|
+
backgroundPosition: `${I}px ${Z}px`,
|
|
61
|
+
backgroundRepeat: "repeat",
|
|
62
|
+
backgroundSize: `${n * $}px`,
|
|
63
|
+
height: "100%",
|
|
64
|
+
inset: 0,
|
|
65
|
+
position: "absolute",
|
|
66
|
+
width: "100%"
|
|
67
|
+
}
|
|
86
68
|
}
|
|
87
|
-
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ o(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
onMouseDown: L,
|
|
74
|
+
onMouseMove: b,
|
|
75
|
+
style: {
|
|
76
|
+
height: "100%",
|
|
77
|
+
inset: 0,
|
|
78
|
+
pointerEvents: "none",
|
|
79
|
+
position: "absolute",
|
|
80
|
+
transform: `translate(${I}px, ${Z}px) scale(${n})`,
|
|
81
|
+
transformOrigin: "top left",
|
|
82
|
+
width: "100%"
|
|
83
|
+
},
|
|
84
|
+
children: r
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ o(Y, { zoom: n, onZoomClick: X })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function Y(l) {
|
|
93
|
+
const { zoom: t, onZoomClick: r } = l;
|
|
94
|
+
return /* @__PURE__ */ o("div", { style: { position: "absolute", top: 5, left: 5, right: 5 }, children: /* @__PURE__ */ d(c, { children: [
|
|
95
|
+
/* @__PURE__ */ o(c.Item, { children: /* @__PURE__ */ o(
|
|
96
|
+
O,
|
|
97
|
+
{
|
|
98
|
+
icon: "minus",
|
|
99
|
+
disabled: t <= f,
|
|
100
|
+
onClick: () => r(
|
|
101
|
+
"decrease"
|
|
102
|
+
/* Decrease */
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
) }),
|
|
106
|
+
/* @__PURE__ */ o(c.Item, { grow: !0, children: /* @__PURE__ */ d(
|
|
107
|
+
N,
|
|
108
|
+
{
|
|
109
|
+
minValue: f,
|
|
110
|
+
value: t,
|
|
111
|
+
maxValue: p,
|
|
88
112
|
children: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
onMouseDown: this.handleMouseDown,
|
|
93
|
-
onMouseMove: this.handleMouseMove,
|
|
94
|
-
style: {
|
|
95
|
-
position: "fixed",
|
|
96
|
-
height: "100%",
|
|
97
|
-
width: "100%",
|
|
98
|
-
backgroundImage: `url("${e}")`,
|
|
99
|
-
backgroundPosition: `${p}px ${f}px`,
|
|
100
|
-
backgroundRepeat: "repeat",
|
|
101
|
-
backgroundSize: `${u * n}px`
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
/* @__PURE__ */ r(
|
|
106
|
-
"div",
|
|
107
|
-
{
|
|
108
|
-
onMouseDown: this.handleMouseDown,
|
|
109
|
-
onMouseMove: this.handleMouseMove,
|
|
110
|
-
style: {
|
|
111
|
-
position: "fixed",
|
|
112
|
-
transform: `translate(${p}px, ${f}px) scale(${u})`,
|
|
113
|
-
transformOrigin: "top left",
|
|
114
|
-
height: "100%",
|
|
115
|
-
width: "100%"
|
|
116
|
-
},
|
|
117
|
-
children: o
|
|
118
|
-
}
|
|
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,
|
|
124
|
-
{
|
|
125
|
-
minValue: M,
|
|
126
|
-
value: u,
|
|
127
|
-
maxValue: v,
|
|
128
|
-
children: [
|
|
129
|
-
u,
|
|
130
|
-
"x"
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
) }),
|
|
134
|
-
/* @__PURE__ */ r(h.Item, { children: /* @__PURE__ */ r(w, { icon: "plus", onClick: this.handleZoomIncrease }) })
|
|
135
|
-
] })
|
|
113
|
+
t,
|
|
114
|
+
"x"
|
|
136
115
|
]
|
|
137
116
|
}
|
|
138
|
-
)
|
|
139
|
-
|
|
117
|
+
) }),
|
|
118
|
+
/* @__PURE__ */ o(c.Item, { children: /* @__PURE__ */ o(
|
|
119
|
+
O,
|
|
120
|
+
{
|
|
121
|
+
icon: "plus",
|
|
122
|
+
disabled: t >= p,
|
|
123
|
+
onClick: () => r(
|
|
124
|
+
"increase"
|
|
125
|
+
/* Increase */
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
) })
|
|
129
|
+
] }) });
|
|
140
130
|
}
|
|
141
131
|
export {
|
|
142
|
-
|
|
132
|
+
F as InfinitePlane
|
|
143
133
|
};
|
|
@@ -10,7 +10,10 @@ type Props = {
|
|
|
10
10
|
bipolar: boolean;
|
|
11
11
|
/** Color of the outer ring around the knob. */
|
|
12
12
|
color: string | BooleanLike;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* If set, this value will be used to set the fill percentage of the outer
|
|
15
|
+
* ring independently of the main value.
|
|
16
|
+
*/
|
|
14
17
|
fillValue: number;
|
|
15
18
|
/** Format value using this function before displaying it. */
|
|
16
19
|
format: (value: number) => string;
|
|
@@ -20,18 +23,31 @@ type Props = {
|
|
|
20
23
|
minValue: number;
|
|
21
24
|
/** Adjust value by this amount when dragging the input. */
|
|
22
25
|
onChange: (event: Event, value: number) => void;
|
|
23
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* An event, which fires about every 500ms when you drag the input up and
|
|
28
|
+
* down, on release and on manual editing.
|
|
29
|
+
*/
|
|
24
30
|
onDrag: (event: Event, value: number) => void;
|
|
25
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Applies a `color` to the outer ring around the knob based on whether the
|
|
33
|
+
* value lands in the range between `from` and `to`.
|
|
34
|
+
*/
|
|
26
35
|
ranges: Record<string, [number, number]>;
|
|
27
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Relative size of the knob. `1` is normal size, `2` is two times bigger.
|
|
38
|
+
* Fractional numbers are supported.
|
|
39
|
+
*/
|
|
28
40
|
size: number;
|
|
29
41
|
/** Adjust value by this amount when dragging the input. */
|
|
30
42
|
step: number;
|
|
31
43
|
/** Screen distance mouse needs to travel to adjust value by one `step`. */
|
|
32
44
|
stepPixelSize: number;
|
|
33
|
-
/**
|
|
34
|
-
|
|
45
|
+
/**
|
|
46
|
+
* A number in milliseconds, for which the input will hold off from updating
|
|
47
|
+
* while events propagate through the backend. Default is about 250ms,
|
|
48
|
+
* increase it if you still see flickering.
|
|
49
|
+
*/
|
|
50
|
+
suppressFlicker: number;
|
|
35
51
|
/** Whether to clamp the value to the range. */
|
|
36
52
|
unclamped: boolean;
|
|
37
53
|
/** Unit to display to the right of value. */
|