tgui-core 2.0.6 → 2.1.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.
Files changed (120) hide show
  1. package/dist/common/collections.d.ts +1 -1
  2. package/dist/common/collections.js +1 -10
  3. package/dist/common/color.js +1 -70
  4. package/dist/common/constants.js +1 -329
  5. package/dist/common/events.js +1 -147
  6. package/dist/common/exhaustive.js +1 -6
  7. package/dist/common/format.js +1 -117
  8. package/dist/common/fp.js +1 -9
  9. package/dist/common/hotkeys.d.ts +1 -1
  10. package/dist/common/hotkeys.js +1 -112
  11. package/dist/common/http.js +1 -10
  12. package/dist/common/keycodes.js +1 -88
  13. package/dist/common/keys.js +1 -32
  14. package/dist/common/math.js +1 -45
  15. package/dist/common/random.js +1 -21
  16. package/dist/common/react.js +1 -30
  17. package/dist/common/string.js +1 -88
  18. package/dist/common/timer.js +1 -28
  19. package/dist/common/type-utils.js +1 -25
  20. package/dist/common/ui.d.ts +2 -2
  21. package/dist/common/ui.js +1 -141
  22. package/dist/common/uuid.js +1 -10
  23. package/dist/common/vector.js +1 -48
  24. package/dist/components/AnimatedNumber.d.ts +1 -1
  25. package/dist/components/AnimatedNumber.js +1 -73
  26. package/dist/components/Autofocus.d.ts +1 -1
  27. package/dist/components/Autofocus.js +1 -17
  28. package/dist/components/Blink.d.ts +1 -1
  29. package/dist/components/Blink.js +1 -56
  30. package/dist/components/BlockQuote.d.ts +1 -1
  31. package/dist/components/BlockQuote.js +1 -10
  32. package/dist/components/Box.d.ts +5 -5
  33. package/dist/components/Box.js +1 -19
  34. package/dist/components/Button.d.ts +4 -4
  35. package/dist/components/Button.js +1 -258
  36. package/dist/components/ByondUi.d.ts +1 -1
  37. package/dist/components/ByondUi.js +1 -61
  38. package/dist/components/Chart.d.ts +1 -1
  39. package/dist/components/Chart.js +1 -80
  40. package/dist/components/Collapsible.d.ts +2 -2
  41. package/dist/components/Collapsible.js +1 -36
  42. package/dist/components/ColorBox.d.ts +2 -2
  43. package/dist/components/ColorBox.js +1 -17
  44. package/dist/components/Dialog.d.ts +1 -1
  45. package/dist/components/Dialog.js +1 -42
  46. package/dist/components/Dimmer.d.ts +1 -1
  47. package/dist/components/Dimmer.js +1 -10
  48. package/dist/components/Divider.js +1 -18
  49. package/dist/components/DmIcon.d.ts +3 -3
  50. package/dist/components/DmIcon.js +1 -23
  51. package/dist/components/DraggableControl.d.ts +2 -2
  52. package/dist/components/DraggableControl.js +1 -111
  53. package/dist/components/Dropdown.d.ts +2 -2
  54. package/dist/components/Dropdown.js +1 -165
  55. package/dist/components/FitText.d.ts +2 -2
  56. package/dist/components/FitText.js +1 -63
  57. package/dist/components/Flex.d.ts +1 -1
  58. package/dist/components/Flex.js +1 -70
  59. package/dist/components/Floating.d.ts +3 -3
  60. package/dist/components/Floating.js +1 -2235
  61. package/dist/components/Icon.d.ts +2 -2
  62. package/dist/components/Icon.js +1 -45
  63. package/dist/components/Image.d.ts +1 -1
  64. package/dist/components/Image.js +1 -38
  65. package/dist/components/ImageButton.d.ts +10 -5
  66. package/dist/components/ImageButton.js +1 -154
  67. package/dist/components/InfinitePlane.d.ts +2 -2
  68. package/dist/components/InfinitePlane.js +1 -133
  69. package/dist/components/Input.d.ts +2 -2
  70. package/dist/components/Input.js +1 -96
  71. package/dist/components/KeyListener.d.ts +1 -1
  72. package/dist/components/KeyListener.js +1 -15
  73. package/dist/components/Knob.d.ts +2 -2
  74. package/dist/components/Knob.js +1 -133
  75. package/dist/components/LabeledControls.d.ts +1 -1
  76. package/dist/components/LabeledControls.js +1 -39
  77. package/dist/components/LabeledList.d.ts +2 -2
  78. package/dist/components/LabeledList.js +1 -89
  79. package/dist/components/MenuBar.d.ts +32 -0
  80. package/dist/components/MenuBar.js +1 -133
  81. package/dist/components/Modal.d.ts +2 -2
  82. package/dist/components/Modal.js +1 -22
  83. package/dist/components/NoticeBox.d.ts +1 -1
  84. package/dist/components/NoticeBox.js +1 -23
  85. package/dist/components/NumberInput.d.ts +9 -19
  86. package/dist/components/NumberInput.js +1 -213
  87. package/dist/components/Popper.d.ts +8 -9
  88. package/dist/components/Popper.js +1 -1082
  89. package/dist/components/ProgressBar.d.ts +2 -2
  90. package/dist/components/ProgressBar.js +1 -33
  91. package/dist/components/RestrictedInput.d.ts +29 -0
  92. package/dist/components/RestrictedInput.js +1 -161
  93. package/dist/components/RoundGauge.d.ts +2 -2
  94. package/dist/components/RoundGauge.js +1 -114
  95. package/dist/components/Section.d.ts +2 -2
  96. package/dist/components/Section.js +1 -65
  97. package/dist/components/Slider.d.ts +2 -2
  98. package/dist/components/Slider.js +1 -113
  99. package/dist/components/Stack.d.ts +2 -2
  100. package/dist/components/Stack.js +1 -58
  101. package/dist/components/StyleableSection.d.ts +1 -1
  102. package/dist/components/StyleableSection.js +1 -16
  103. package/dist/components/Table.d.ts +1 -1
  104. package/dist/components/Table.js +1 -57
  105. package/dist/components/Tabs.d.ts +2 -2
  106. package/dist/components/Tabs.js +1 -65
  107. package/dist/components/TextArea.d.ts +2 -2
  108. package/dist/components/TextArea.js +1 -126
  109. package/dist/components/TimeDisplay.js +1 -25
  110. package/dist/components/Tooltip.d.ts +2 -2
  111. package/dist/components/Tooltip.js +1 -18
  112. package/dist/components/TrackOutsideClicks.d.ts +2 -2
  113. package/dist/components/TrackOutsideClicks.js +1 -24
  114. package/dist/components/VirtualList.d.ts +1 -1
  115. package/dist/components/VirtualList.js +1 -34
  116. package/dist/components/index.js +1 -96
  117. package/license.txt +1 -1
  118. package/package.json +11 -17
  119. package/styles/components/Button.scss +1 -1
  120. package/dist/components/FakeTerminal.js +0 -38
@@ -1,5 +1,5 @@
1
- import { PropsWithChildren } from 'react';
2
- import { BoxProps } from './Box';
1
+ import type { PropsWithChildren } from 'react';
2
+ import type { BoxProps } from './Box';
3
3
  type Props = {
4
4
  /**
5
5
  * Current progress as a floating point number between `minValue` (default: 0) and `maxValue` (default: 1).
@@ -1,33 +1 @@
1
- import { jsxs as C, jsx as i } from "react/jsx-runtime";
2
- import { CSS_COLORS as P } from "../common/constants.js";
3
- import { keyOfMatchingRange as h, toFixed as x, clamp01 as _, scale as v } from "../common/math.js";
4
- import { classes as y } from "../common/react.js";
5
- import { computeBoxProps as N, computeBoxClassName as S } from "../common/ui.js";
6
- function k(n) {
7
- const {
8
- className: m,
9
- value: o,
10
- minValue: d = 0,
11
- maxValue: f = 1,
12
- color: u,
13
- ranges: p = {},
14
- empty: g,
15
- children: r,
16
- ...l
17
- } = n, t = v(o, d, f), B = r !== void 0, s = u || h(o, p) || "default", e = N(l), a = ["ProgressBar", m, S(l)], c = {
18
- width: `${_(t) * 100}%`
19
- };
20
- return P.includes(s) || s === "default" ? a.push(`ProgressBar--color--${s}`) : (e.style = { ...e.style, borderColor: s }, c.backgroundColor = s), /* @__PURE__ */ C("div", { className: y(a), ...e, children: [
21
- /* @__PURE__ */ i(
22
- "div",
23
- {
24
- className: "ProgressBar__fill ProgressBar__fill--animated",
25
- style: c
26
- }
27
- ),
28
- /* @__PURE__ */ i("div", { className: "ProgressBar__content", children: B ? r : !g && `${x(t * 100)}%` })
29
- ] });
30
- }
31
- export {
32
- k as ProgressBar
33
- };
1
+ import*as s from"react/jsx-runtime";import*as o from"../common/constants.js";import*as r from"../common/math.js";import*as e from"../common/react.js";import*as a from"../common/ui.js";function m(m){let{className:t,value:c,minValue:l=0,maxValue:i=1,color:n,ranges:d={},empty:f,children:p,...u}=m,g=(0,r.scale)(c,l,i),j=void 0!==p,x=n||(0,r.keyOfMatchingRange)(c,d)||"default",B=(0,a.computeBoxProps)(u),P=["ProgressBar",t,(0,a.computeBoxClassName)(u)],_={width:`${100*(0,r.clamp01)(g)}%`};return o.CSS_COLORS.includes(x)||"default"===x?P.push(`ProgressBar--color--${x}`):(B.style={...B.style,borderColor:x},_.backgroundColor=x),(0,s.jsxs)("div",{className:(0,e.classes)(P),...B,children:[(0,s.jsx)("div",{className:"ProgressBar__fill ProgressBar__fill--animated",style:_}),(0,s.jsx)("div",{className:"ProgressBar__content",children:j?p:!f&&`${(0,r.toFixed)(100*g)}%`})]})}export{m as ProgressBar};
@@ -0,0 +1,29 @@
1
+ import type { BoxProps } from './Box';
2
+ type Props = {
3
+ value: number;
4
+ } & Partial<{
5
+ allowFloats: boolean;
6
+ autoFocus: boolean;
7
+ autoSelect: boolean;
8
+ disabled: boolean;
9
+ fluid: boolean;
10
+ maxValue: number | null;
11
+ minValue: number | null;
12
+ onBlur: (e: Event, value: number) => void;
13
+ onChange: (e: Event, value: number) => void;
14
+ onEnter: (e: Event, value: number) => void;
15
+ }> & BoxProps;
16
+ /**
17
+ * ## RestrictedInput
18
+ * Creates an input which rejects improper keys.
19
+ *
20
+ * @deprecated Use `NumberInput` instead.
21
+ *
22
+ * This will server as a wrapper for NumberInput until removal. This decision was
23
+ * made because it's poor UX. Users should be allowed to type in whatever they
24
+ * want, but have the UI notify them it's invalid after it's entered.
25
+ *
26
+ * It also gives a false sense of security. It's just an annoying input.
27
+ */
28
+ export declare function RestrictedInput(props: Props): import("react/jsx-runtime").JSX.Element;
29
+ export {};
@@ -1,161 +1 @@
1
- import { jsxs as E, jsx as h } from "react/jsx-runtime";
2
- import { Component as N, createRef as S } from "react";
3
- import { KEY_ENTER as I, KEY_ESCAPE as b } from "../common/keycodes.js";
4
- import { clamp as d } from "../common/math.js";
5
- import { classes as v } from "../common/react.js";
6
- import { Box as F } from "./Box.js";
7
- const g = 0, x = 1e4;
8
- function C(s, e, t, n) {
9
- const i = e || g, o = t || t === 0 ? t : x;
10
- let r = n ? s.replace(/[^\-\d.]/g, "") : s.replace(/[^\-\d]/g, "");
11
- return n && (r = V(r, i), r = m(".", r)), e < 0 ? (r = _(r), r = m("-", r)) : r = r.replaceAll("-", ""), i <= 1 && o >= 0 ? M(r, i, o, n) : r;
12
- }
13
- const M = (s, e, t, n) => {
14
- const i = n ? Number.parseFloat(s) : Number.parseInt(s, 10);
15
- if (!Number.isNaN(i) && (s.slice(-1) !== "." || i < Math.floor(e))) {
16
- const o = d(i, e, t);
17
- if (i !== o)
18
- return String(o);
19
- }
20
- return s;
21
- };
22
- function _(s) {
23
- let e = s;
24
- const t = s.indexOf("-");
25
- if (t > 0) {
26
- const n = s.replace("-", "");
27
- e = "-".concat(n);
28
- } else t === 0 && s.indexOf("-", t + 1) > 0 && (e = s.replaceAll("-", ""));
29
- return e;
30
- }
31
- function V(s, e) {
32
- let t = s;
33
- const n = Math.sign(e) * Math.floor(Math.abs(e));
34
- return s.indexOf(".") === 0 ? t = String(n).concat(s) : s.indexOf("-") === 0 && s.indexOf(".") === 1 && (t = n + ".".concat(s.slice(2))), t;
35
- }
36
- function m(s, e) {
37
- const t = e.indexOf(s), n = e.length;
38
- let i = e;
39
- if (t !== -1 && t < n - 1) {
40
- let o = e.slice(t + 1, n);
41
- o = o.replaceAll(s, ""), i = e.slice(0, t + 1).concat(o);
42
- }
43
- return i;
44
- }
45
- function f(s, e, t, n) {
46
- const i = e || g, o = t || t === 0 ? t : x;
47
- if (!s || !s.length)
48
- return String(i);
49
- const r = n ? Number.parseFloat(s.replace(/[^\-\d.]/g, "")) : Number.parseInt(s.replace(/[^\-\d]/g, ""), 10);
50
- return Number.isNaN(r) ? String(i) : String(d(r, i, o));
51
- }
52
- class B extends N {
53
- constructor(e) {
54
- super(e), this.inputRef = S(), this.state = {
55
- editing: !1
56
- }, this.handleBlur = (t) => {
57
- const { maxValue: n, minValue: i, onBlur: o, allowFloats: r } = this.props, { editing: l } = this.state;
58
- l && this.setEditing(!1);
59
- const a = f(
60
- t.target.value,
61
- i,
62
- n,
63
- r
64
- );
65
- o && o(t, +a);
66
- }, this.handleChange = (t) => {
67
- const { maxValue: n, minValue: i, onChange: o, allowFloats: r } = this.props;
68
- t.target.value = C(
69
- t.target.value,
70
- i,
71
- n,
72
- r
73
- ), o && o(t, +t.target.value);
74
- }, this.handleFocus = (t) => {
75
- const { editing: n } = this.state;
76
- n || this.setEditing(!0);
77
- }, this.handleInput = (t) => {
78
- const { editing: n } = this.state, { onInput: i } = this.props;
79
- n || this.setEditing(!0), i && i(t, +t.target.value);
80
- }, this.handleKeyDown = (t) => {
81
- const { maxValue: n, minValue: i, onChange: o, onEnter: r, allowFloats: l } = this.props;
82
- if (t.keyCode === I) {
83
- const a = f(
84
- t.target.value,
85
- i,
86
- n,
87
- l
88
- );
89
- this.setEditing(!1), o && o(t, +a), r && r(t, +a), t.target.blur();
90
- return;
91
- }
92
- if (t.keyCode === b) {
93
- if (this.props.onEscape) {
94
- this.props.onEscape(t);
95
- return;
96
- }
97
- this.setEditing(!1), t.target.value = this.props.value, t.target.blur();
98
- return;
99
- }
100
- };
101
- }
102
- componentDidMount() {
103
- var r;
104
- const { maxValue: e, minValue: t, allowFloats: n } = this.props, i = (r = this.props.value) == null ? void 0 : r.toString(), o = this.inputRef.current;
105
- o && (o.value = f(
106
- i,
107
- t,
108
- e,
109
- n
110
- )), (this.props.autoFocus || this.props.autoSelect) && setTimeout(() => {
111
- o.focus(), this.props.autoSelect && o.select();
112
- }, 1);
113
- }
114
- componentDidUpdate(e, t) {
115
- var c, p;
116
- const { maxValue: n, minValue: i, allowFloats: o } = this.props, { editing: r } = this.state, l = (c = e.value) == null ? void 0 : c.toString(), a = (p = this.props.value) == null ? void 0 : p.toString(), u = this.inputRef.current;
117
- u && !r && a !== l && a !== u.value && (u.value = f(
118
- a,
119
- i,
120
- n,
121
- o
122
- ));
123
- }
124
- setEditing(e) {
125
- this.setState({ editing: e });
126
- }
127
- render() {
128
- const { props: e } = this, { onChange: t, onEnter: n, onInput: i, onBlur: o, value: r, ...l } = e, { className: a, fluid: u, monospace: c, ...p } = l;
129
- return /* @__PURE__ */ E(
130
- F,
131
- {
132
- className: v([
133
- "Input",
134
- u && "Input--fluid",
135
- c && "Input--monospace",
136
- a
137
- ]),
138
- ...p,
139
- children: [
140
- /* @__PURE__ */ h("div", { className: "Input__baseline", children: "." }),
141
- /* @__PURE__ */ h(
142
- "input",
143
- {
144
- className: "Input__input",
145
- onChange: this.handleChange,
146
- onInput: this.handleInput,
147
- onFocus: this.handleFocus,
148
- onBlur: this.handleBlur,
149
- onKeyDown: this.handleKeyDown,
150
- ref: this.inputRef,
151
- type: "number | string"
152
- }
153
- )
154
- ]
155
- }
156
- );
157
- }
158
- }
159
- export {
160
- B as RestrictedInput
161
- };
1
+ import*as e from"react/jsx-runtime";import*as r from"../common/keys.js";import*as t from"./NumberInput.js";function m(m){let{minValue:n,maxValue:u,onChange:o,onEnter:a,onBlur:s,...p}=m;return(0,e.jsx)(t.NumberInput,{...p,minValue:n??0,maxValue:u??Number.POSITIVE_INFINITY,onChange:e=>{o?.({},e)},onKeyDown:e=>{e.key===r.KEY.Enter&&a?.({},Number(e.currentTarget.value))},step:1})}export{m as RestrictedInput};
@@ -1,5 +1,5 @@
1
- import { CSSProperties } from 'react';
2
- import { BoxProps } from './Box';
1
+ import type { CSSProperties } from 'react';
2
+ import type { BoxProps } from './Box';
3
3
  type Props = {
4
4
  /** The current value of the metric. */
5
5
  value: number;
@@ -1,114 +1 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import { scale as d, keyOfMatchingRange as M, clamp01 as v } from "../common/math.js";
3
- import { classes as p } from "../common/react.js";
4
- import { computeBoxProps as k, computeBoxClassName as $ } from "../common/ui.js";
5
- import { AnimatedNumber as B } from "./AnimatedNumber.js";
6
- function b(_) {
7
- const {
8
- alertAfter: a,
9
- alertBefore: t,
10
- className: h,
11
- format: R,
12
- maxValue: c = 1,
13
- minValue: u = 1,
14
- ranges: n,
15
- size: y = 1,
16
- style: G,
17
- value: r,
18
- ...g
19
- } = _, N = d(r, u, c), f = v(N), s = n ? {} : { primary: [0, 1] };
20
- if (n)
21
- for (const o in n) {
22
- const l = n[o];
23
- s[o] = [
24
- d(l[0], u, c),
25
- d(l[1], u, c)
26
- ];
27
- }
28
- function x() {
29
- return !!(a && t && r > a && r < t || a && r > a || t && r < t);
30
- }
31
- const C = x() && M(f, s);
32
- return /* @__PURE__ */ m("div", { className: "RoundGauge__wrapper", children: [
33
- /* @__PURE__ */ e(
34
- "div",
35
- {
36
- className: p([
37
- "RoundGauge",
38
- h,
39
- $(g)
40
- ]),
41
- ...k({
42
- style: {
43
- fontSize: `${y}em`,
44
- ...G
45
- },
46
- ...g
47
- }),
48
- children: /* @__PURE__ */ m("svg", { viewBox: "0 0 100 50", children: [
49
- (a || t) && /* @__PURE__ */ e(
50
- "g",
51
- {
52
- className: p([
53
- "RoundGauge__alert",
54
- C ? `active RoundGauge__alert--${C}` : ""
55
- ]),
56
- children: /* @__PURE__ */ e("path", { d: "M48.211,14.578C48.55,13.9 49.242,13.472 50,13.472C50.758,13.472 51.45,13.9 51.789,14.578C54.793,20.587 60.795,32.589 63.553,38.106C63.863,38.726 63.83,39.462 63.465,40.051C63.101,40.641 62.457,41 61.764,41C55.996,41 44.004,41 38.236,41C37.543,41 36.899,40.641 36.535,40.051C36.17,39.462 36.137,38.726 36.447,38.106C39.205,32.589 45.207,20.587 48.211,14.578ZM50,34.417C51.426,34.417 52.583,35.574 52.583,37C52.583,38.426 51.426,39.583 50,39.583C48.574,39.583 47.417,38.426 47.417,37C47.417,35.574 48.574,34.417 50,34.417ZM50,32.75C50,32.75 53,31.805 53,22.25C53,20.594 51.656,19.25 50,19.25C48.344,19.25 47,20.594 47,22.25C47,31.805 50,32.75 50,32.75Z" })
57
- }
58
- ),
59
- /* @__PURE__ */ e("g", { children: /* @__PURE__ */ e("circle", { className: "RoundGauge__ringTrack", cx: "50", cy: "50", r: "45" }) }),
60
- /* @__PURE__ */ e("g", { children: Object.keys(s).map((o, l) => {
61
- const i = s[o];
62
- return /* @__PURE__ */ e(
63
- "circle",
64
- {
65
- className: `RoundGauge__ringFill RoundGauge--color--${o}`,
66
- style: {
67
- strokeDashoffset: Math.max(
68
- (2 - (i[1] - i[0])) * Math.PI * 50,
69
- 0
70
- )
71
- },
72
- transform: `rotate(${180 + 180 * i[0]} 50 50)`,
73
- cx: "50",
74
- cy: "50",
75
- r: "45"
76
- },
77
- l
78
- );
79
- }) }),
80
- /* @__PURE__ */ m(
81
- "g",
82
- {
83
- className: "RoundGauge__needle",
84
- transform: `rotate(${f * 180 - 90} 50 50)`,
85
- children: [
86
- /* @__PURE__ */ e(
87
- "polygon",
88
- {
89
- className: "RoundGauge__needleLine",
90
- points: "46,50 50,0 54,50"
91
- }
92
- ),
93
- /* @__PURE__ */ e(
94
- "circle",
95
- {
96
- className: "RoundGauge__needleMiddle",
97
- cx: "50",
98
- cy: "50",
99
- r: "8"
100
- }
101
- )
102
- ]
103
- }
104
- ),
105
- /* @__PURE__ */ e("title", { children: "alert" })
106
- ] })
107
- }
108
- ),
109
- /* @__PURE__ */ e(B, { value: r, format: R })
110
- ] });
111
- }
112
- export {
113
- b as RoundGauge
114
- };
1
+ import*as e from"react/jsx-runtime";import*as a from"../common/math.js";import*as s from"../common/react.js";import*as r from"../common/ui.js";import*as o from"./AnimatedNumber.js";function c(c){let{alertAfter:l,alertBefore:t,className:n,format:m,maxValue:i=1,minValue:u=1,ranges:d,size:x=1,style:g,value:j,...C}=c,p=(0,a.scale)(j,u,i),_=(0,a.clamp01)(p),f=d?{}:{primary:[0,1]};if(d)for(let e in d){let s=d[e];f[e]=[(0,a.scale)(s[0],u,i),(0,a.scale)(s[1],u,i)]}let h=(!!l&&!!t&&!!(j>l)&&!!(j<t)||!!l&&!!(j>l)||!!t&&!!(j<t))&&(0,a.keyOfMatchingRange)(_,f);return(0,e.jsxs)("div",{className:"RoundGauge__wrapper",children:[(0,e.jsx)("div",{className:(0,s.classes)(["RoundGauge",n,(0,r.computeBoxClassName)(C)]),...(0,r.computeBoxProps)({style:{fontSize:`${x}em`,...g},...C}),children:(0,e.jsxs)("svg",{viewBox:"0 0 100 50",children:[(l||t)&&(0,e.jsx)("g",{className:(0,s.classes)(["RoundGauge__alert",h?`active RoundGauge__alert--${h}`:""]),children:(0,e.jsx)("path",{d:"M48.211,14.578C48.55,13.9 49.242,13.472 50,13.472C50.758,13.472 51.45,13.9 51.789,14.578C54.793,20.587 60.795,32.589 63.553,38.106C63.863,38.726 63.83,39.462 63.465,40.051C63.101,40.641 62.457,41 61.764,41C55.996,41 44.004,41 38.236,41C37.543,41 36.899,40.641 36.535,40.051C36.17,39.462 36.137,38.726 36.447,38.106C39.205,32.589 45.207,20.587 48.211,14.578ZM50,34.417C51.426,34.417 52.583,35.574 52.583,37C52.583,38.426 51.426,39.583 50,39.583C48.574,39.583 47.417,38.426 47.417,37C47.417,35.574 48.574,34.417 50,34.417ZM50,32.75C50,32.75 53,31.805 53,22.25C53,20.594 51.656,19.25 50,19.25C48.344,19.25 47,20.594 47,22.25C47,31.805 50,32.75 50,32.75Z"})}),(0,e.jsx)("g",{children:(0,e.jsx)("circle",{className:"RoundGauge__ringTrack",cx:"50",cy:"50",r:"45"})}),(0,e.jsx)("g",{children:Object.keys(f).map((a,s)=>{let r=f[a];return(0,e.jsx)("circle",{className:`RoundGauge__ringFill RoundGauge--color--${a}`,style:{strokeDashoffset:Math.max((2-(r[1]-r[0]))*Math.PI*50,0)},transform:`rotate(${180+180*r[0]} 50 50)`,cx:"50",cy:"50",r:"45"},s)})}),(0,e.jsxs)("g",{className:"RoundGauge__needle",transform:`rotate(${180*_-90} 50 50)`,children:[(0,e.jsx)("polygon",{className:"RoundGauge__needleLine",points:"46,50 50,0 54,50"}),(0,e.jsx)("circle",{className:"RoundGauge__needleMiddle",cx:"50",cy:"50",r:"8"})]}),(0,e.jsx)("title",{children:"alert"})]})}),(0,e.jsx)(o.AnimatedNumber,{value:j,format:m})]})}export{c as RoundGauge};
@@ -1,5 +1,5 @@
1
- import { ReactNode, RefObject } from 'react';
2
- import { BoxProps } from './Box';
1
+ import { type ReactNode, type RefObject } from 'react';
2
+ import type { BoxProps } from './Box';
3
3
  type Props = Partial<{
4
4
  /** Buttons to render aside the section title. */
5
5
  buttons: ReactNode;
@@ -1,65 +1 @@
1
- import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
- import { useRef as T, useEffect as C } from "react";
3
- import { addScrollableNode as P, removeScrollableNode as g } from "../common/events.js";
4
- import { canRender as a, classes as d } from "../common/react.js";
5
- import { computeBoxProps as j, computeBoxClassName as z } from "../common/ui.js";
6
- function k(m) {
7
- const {
8
- buttons: c,
9
- children: S,
10
- className: f,
11
- container_id: u = "",
12
- fill: _,
13
- fitted: p,
14
- flexGrow: N,
15
- noTopPadding: h,
16
- onScroll: b,
17
- ref: o,
18
- scrollable: n,
19
- scrollableHorizontal: i,
20
- stretchContents: x,
21
- title: l,
22
- ...r
23
- } = m, t = T((o == null ? void 0 : o.current) ?? null), v = a(l) || a(c);
24
- return C(() => (t != null && t.current && (n || i) && P(t.current), () => {
25
- t != null && t.current && g(t.current);
26
- }), []), /* @__PURE__ */ s(
27
- "div",
28
- {
29
- id: u,
30
- className: d([
31
- "Section",
32
- _ && "Section--fill",
33
- p && "Section--fitted",
34
- n && "Section--scrollable",
35
- i && "Section--scrollableHorizontal",
36
- N && "Section--flex",
37
- f,
38
- z(r)
39
- ]),
40
- ...j(r),
41
- children: [
42
- v && /* @__PURE__ */ s("div", { className: "Section__title", children: [
43
- /* @__PURE__ */ e("span", { className: "Section__titleText", children: l }),
44
- /* @__PURE__ */ e("div", { className: "Section__buttons", children: c })
45
- ] }),
46
- /* @__PURE__ */ e("div", { className: "Section__rest", children: /* @__PURE__ */ e(
47
- "div",
48
- {
49
- className: d([
50
- "Section__content",
51
- x && "Section__content--stretchContents",
52
- h && "Section__content--noTopPadding"
53
- ]),
54
- onScroll: b,
55
- ref: t,
56
- children: S
57
- }
58
- ) })
59
- ]
60
- }
61
- );
62
- }
63
- export {
64
- k as Section
65
- };
1
+ import*as e from"react/jsx-runtime";import*as t from"react";import*as o from"../common/events.js";import*as c from"../common/react.js";import*as n from"../common/ui.js";function s(s){let{buttons:r,children:i,className:l,container_id:a="",fill:m,fitted:d,flexGrow:S,noTopPadding:u,onScroll:_,ref:f,scrollable:x,scrollableHorizontal:p,stretchContents:j,title:N,...h}=s,v=(0,c.canRender)(N)||(0,c.canRender)(r),b=(0,t.useRef)(null),R=f??b;return(0,t.useEffect)(()=>(R.current&&(x||p)&&(0,o.addScrollableNode)(R.current),()=>{R.current&&(0,o.removeScrollableNode)(R.current)}),[]),(0,e.jsxs)("div",{id:a,className:(0,c.classes)(["Section",m&&"Section--fill",d&&"Section--fitted",x&&"Section--scrollable",p&&"Section--scrollableHorizontal",S&&"Section--flex",l,(0,n.computeBoxClassName)(h)]),...(0,n.computeBoxProps)(h),children:[v&&(0,e.jsxs)("div",{className:"Section__title",children:[(0,e.jsx)("span",{className:"Section__titleText",children:N}),(0,e.jsx)("div",{className:"Section__buttons",children:r})]}),(0,e.jsx)("div",{className:"Section__rest",children:(0,e.jsx)("div",{className:(0,c.classes)(["Section__content",j&&"Section__content--stretchContents",u&&"Section__content--noTopPadding"]),onScroll:_,ref:R,children:i})})]})}export{s as Section};
@@ -1,5 +1,5 @@
1
- import { PropsWithChildren } from 'react';
2
- import { BoxProps } from './Box';
1
+ import type { PropsWithChildren } from 'react';
2
+ import type { BoxProps } from './Box';
3
3
  type Props = {
4
4
  /** Highest possible value. */
5
5
  maxValue: number;
@@ -1,113 +1 @@
1
- import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
- import { keyOfMatchingRange as F, clamp01 as s, scale as p } from "../common/math.js";
3
- import { classes as g } from "../common/react.js";
4
- import { computeBoxProps as O, computeBoxClassName as b } from "../common/ui.js";
5
- import { DraggableControl as k } from "./DraggableControl.js";
6
- function H(f) {
7
- const {
8
- // Draggable props (passthrough)
9
- animated: _,
10
- format: h,
11
- maxValue: l,
12
- minValue: r,
13
- onChange: v,
14
- onDrag: N,
15
- step: x,
16
- stepPixelSize: y,
17
- unit: B,
18
- value: i,
19
- // Own props
20
- className: P,
21
- fillValue: a,
22
- color: S,
23
- ranges: V = {},
24
- children: o,
25
- ...t
26
- } = f, C = o !== void 0;
27
- return /* @__PURE__ */ e(
28
- k,
29
- {
30
- dragMatrix: [1, 0],
31
- animated: _,
32
- format: h,
33
- maxValue: l,
34
- minValue: r,
35
- onChange: v,
36
- onDrag: N,
37
- step: x,
38
- stepPixelSize: y,
39
- unit: B,
40
- value: i,
41
- children: (D) => {
42
- const {
43
- displayElement: n,
44
- displayValue: c,
45
- dragging: w,
46
- handleDragStart: M,
47
- inputElement: $
48
- } = D, j = a != null, d = p(
49
- a ?? c,
50
- r,
51
- l
52
- ), m = p(c, r, l), E = S || F(a ?? i, V) || "default";
53
- return /* @__PURE__ */ u(
54
- "div",
55
- {
56
- className: g([
57
- "Slider",
58
- "ProgressBar",
59
- `ProgressBar--color--${E}`,
60
- P,
61
- b(t)
62
- ]),
63
- ...O(t),
64
- onMouseDown: M,
65
- children: [
66
- /* @__PURE__ */ e(
67
- "div",
68
- {
69
- className: g([
70
- "ProgressBar__fill",
71
- j && "ProgressBar__fill--animated"
72
- ]),
73
- style: {
74
- width: `${s(d) * 100}%`,
75
- opacity: 0.4
76
- }
77
- }
78
- ),
79
- /* @__PURE__ */ e(
80
- "div",
81
- {
82
- className: "ProgressBar__fill",
83
- style: {
84
- width: `${s(Math.min(d, m)) * 100}%`
85
- }
86
- }
87
- ),
88
- /* @__PURE__ */ u(
89
- "div",
90
- {
91
- className: "Slider__cursorOffset",
92
- style: {
93
- width: `${s(m) * 100}%`
94
- },
95
- children: [
96
- /* @__PURE__ */ e("div", { className: "Slider__cursor" }),
97
- /* @__PURE__ */ e("div", { className: "Slider__pointer" }),
98
- w && /* @__PURE__ */ e("div", { className: "Slider__popupValue", children: n })
99
- ]
100
- }
101
- ),
102
- /* @__PURE__ */ e("div", { className: "ProgressBar__content", children: C ? o : n }),
103
- $
104
- ]
105
- }
106
- );
107
- }
108
- }
109
- );
110
- }
111
- export {
112
- H as Slider
113
- };
1
+ import*as s from"react/jsx-runtime";import*as r from"../common/math.js";import*as e from"../common/react.js";import*as a from"../common/ui.js";import*as l from"./DraggableControl.js";function o(o){let{animated:i,format:t,maxValue:c,minValue:m,onChange:d,onDrag:n,step:p,stepPixelSize:_,unit:j,value:u,className:x,fillValue:f,color:g,ranges:h={},children:v,...N}=o,B=void 0!==v;return(0,s.jsx)(l.DraggableControl,{dragMatrix:[1,0],animated:i,format:t,maxValue:c,minValue:m,onChange:d,onDrag:n,step:p,stepPixelSize:_,unit:j,value:u,children:l=>{let{displayElement:o,displayValue:i,dragging:t,handleDragStart:d,inputElement:n}=l,p=null!=f,_=(0,r.scale)(f??i,m,c),j=(0,r.scale)(i,m,c),P=g||(0,r.keyOfMatchingRange)(f??u,h)||"default";return(0,s.jsxs)("div",{className:(0,e.classes)(["Slider","ProgressBar",`ProgressBar--color--${P}`,x,(0,a.computeBoxClassName)(N)]),...(0,a.computeBoxProps)(N),onMouseDown:d,children:[(0,s.jsx)("div",{className:(0,e.classes)(["ProgressBar__fill",p&&"ProgressBar__fill--animated"]),style:{width:`${100*(0,r.clamp01)(_)}%`,opacity:.4}}),(0,s.jsx)("div",{className:"ProgressBar__fill",style:{width:`${100*(0,r.clamp01)(Math.min(_,j))}%`}}),(0,s.jsxs)("div",{className:"Slider__cursorOffset",style:{width:`${100*(0,r.clamp01)(j)}%`},children:[(0,s.jsx)("div",{className:"Slider__cursor"}),(0,s.jsx)("div",{className:"Slider__pointer"}),t&&(0,s.jsx)("div",{className:"Slider__popupValue",children:o})]}),(0,s.jsx)("div",{className:"ProgressBar__content",children:B?v:o}),n]})}})}export{o as Slider};
@@ -1,5 +1,5 @@
1
- import { RefObject } from 'react';
2
- import { FlexItemProps, FlexProps } from './Flex';
1
+ import { type RefObject } from 'react';
2
+ import { type FlexItemProps, type FlexProps } from './Flex';
3
3
  type Props = Partial<{
4
4
  /** Fills available space. */
5
5
  fill: boolean;
@@ -1,58 +1 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useRef as S } from "react";
3
- import { classes as s } from "../common/react.js";
4
- import { computeBoxClassName as o } from "../common/ui.js";
5
- import { computeFlexProps as k, computeFlexClassName as v, computeFlexItemProps as m } from "./Flex.js";
6
- function l(r) {
7
- const { className: c, vertical: e, fill: t, reverse: a, zebra: n, ...d } = r, u = e ? "column" : "row", f = a ? "-reverse" : "";
8
- return /* @__PURE__ */ i(
9
- "div",
10
- {
11
- className: s([
12
- "Stack",
13
- t && "Stack--fill",
14
- e ? "Stack--vertical" : "Stack--horizontal",
15
- n && "Stack--zebra",
16
- a && `Stack--reverse${e ? "--vertical" : ""}`,
17
- c,
18
- v(r)
19
- ]),
20
- ...k({
21
- direction: `${u}${f}`,
22
- ...d
23
- })
24
- }
25
- );
26
- }
27
- function p(r) {
28
- const { className: c, innerRef: e, ...t } = r, a = S((e == null ? void 0 : e.current) ?? null);
29
- return /* @__PURE__ */ i(
30
- "div",
31
- {
32
- className: s(["Stack__item", c, o(t)]),
33
- ref: a,
34
- ...m(t)
35
- }
36
- );
37
- }
38
- l.Item = p;
39
- function x(r) {
40
- const { className: c, hidden: e, ...t } = r;
41
- return /* @__PURE__ */ i(
42
- "div",
43
- {
44
- className: s([
45
- "Stack__item",
46
- "Stack__divider",
47
- e && "Stack__divider--hidden",
48
- c,
49
- o(t)
50
- ]),
51
- ...m(t)
52
- }
53
- );
54
- }
55
- l.Divider = x;
56
- export {
57
- l as Stack
58
- };
1
+ import*as e from"react/jsx-runtime";import*as t from"react";import*as r from"../common/react.js";import*as s from"../common/ui.js";import*as a from"./Flex.js";function c(t){let{className:s,vertical:c,fill:o,reverse:m,zebra:i,...l}=t,n=m?"-reverse":"";return(0,e.jsx)("div",{className:(0,r.classes)(["Stack",o&&"Stack--fill",c?"Stack--vertical":"Stack--horizontal",i&&"Stack--zebra",m&&`Stack--reverse${c?"--vertical":""}`,s,(0,a.computeFlexClassName)(t)]),...(0,a.computeFlexProps)({direction:`${c?"column":"row"}${n}`,...l})})}c.Item=function(c){let{className:o,innerRef:m,...i}=c,l=(0,t.useRef)(m?.current??null);return(0,e.jsx)("div",{className:(0,r.classes)(["Stack__item",o,(0,s.computeBoxClassName)(i)]),ref:l,...(0,a.computeFlexItemProps)(i)})},c.Divider=function(t){let{className:c,hidden:o,...m}=t;return(0,e.jsx)("div",{className:(0,r.classes)(["Stack__item","Stack__divider",o&&"Stack__divider--hidden",c,(0,s.computeBoxClassName)(m)]),...(0,a.computeFlexItemProps)(m)})};export{c as Stack};
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
1
+ import type { PropsWithChildren, ReactNode } from 'react';
2
2
  type Props = Partial<{
3
3
  style: Record<string, any>;
4
4
  textStyle: Record<string, any>;
@@ -1,16 +1 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import { Box as t } from "./Box.js";
3
- function m(i) {
4
- const { children: c, titleStyle: n, titleSubtext: s, title: o, textStyle: r, style: a } = i;
5
- return /* @__PURE__ */ l(t, { style: a, children: [
6
- /* @__PURE__ */ l(t, { className: "Section__title", style: n, children: [
7
- /* @__PURE__ */ e(t, { className: "Section__titleText", style: r, children: o }),
8
- /* @__PURE__ */ e("div", { className: "Section__buttons", children: s }),
9
- " "
10
- ] }),
11
- /* @__PURE__ */ e(t, { className: "Section__rest", children: /* @__PURE__ */ e(t, { className: "Section__content", children: c }) })
12
- ] });
13
- }
14
- export {
15
- m as StyleableSection
16
- };
1
+ import*as e from"react/jsx-runtime";import*as t from"./Box.js";function s(s){let{children:c,titleStyle:o,titleSubtext:i,title:l,textStyle:n,style:r}=s;return(0,e.jsxs)(t.Box,{style:r,children:[(0,e.jsxs)(t.Box,{className:"Section__title",style:o,children:[(0,e.jsx)(t.Box,{className:"Section__titleText",style:n,children:l}),(0,e.jsx)("div",{className:"Section__buttons",children:i})," "]}),(0,e.jsx)(t.Box,{className:"Section__rest",children:(0,e.jsx)(t.Box,{className:"Section__content",children:c})})]})}export{s as StyleableSection};
@@ -1,4 +1,4 @@
1
- import { BoxProps } from './Box';
1
+ import type { BoxProps } from './Box';
2
2
  type Props = Partial<{
3
3
  /** Collapses table to the smallest possible size. */
4
4
  collapsing: boolean;