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
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
2
|
-
|
|
3
|
-
import { formatTime } from '../common/format';
|
|
4
|
-
|
|
5
|
-
// AnimatedNumber Copypaste
|
|
6
|
-
function isSafeNumber(value) {
|
|
7
|
-
return (
|
|
8
|
-
typeof value === 'number' && Number.isFinite(value) && !Number.isNaN(value)
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class TimeDisplay extends Component {
|
|
13
|
-
constructor(props) {
|
|
14
|
-
super(props);
|
|
15
|
-
this.timer = null;
|
|
16
|
-
this.last_seen_value = undefined;
|
|
17
|
-
this.state = {
|
|
18
|
-
value: 0,
|
|
19
|
-
};
|
|
20
|
-
// Set initial state with value provided in props
|
|
21
|
-
if (isSafeNumber(props.value)) {
|
|
22
|
-
this.state.value = Number(props.value);
|
|
23
|
-
this.last_seen_value = Number(props.value);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
componentDidUpdate() {
|
|
28
|
-
if (this.props.auto !== undefined) {
|
|
29
|
-
clearInterval(this.timer);
|
|
30
|
-
this.timer = setInterval(() => this.tick(), 1000); // every 1 s
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
tick() {
|
|
35
|
-
let current = Number(this.state.value);
|
|
36
|
-
if (this.props.value !== this.last_seen_value) {
|
|
37
|
-
this.last_seen_value = this.props.value;
|
|
38
|
-
current = this.props.value;
|
|
39
|
-
}
|
|
40
|
-
const mod = this.props.auto === 'up' ? 10 : -10; // Time down by default.
|
|
41
|
-
const value = Math.max(0, current + mod); // one sec tick
|
|
42
|
-
this.setState({ value });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
componentDidMount() {
|
|
46
|
-
if (this.props.auto !== undefined) {
|
|
47
|
-
this.timer = setInterval(() => this.tick(), 1000); // every 1 s
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
componentWillUnmount() {
|
|
52
|
-
clearInterval(this.timer);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
const val = this.state.value;
|
|
57
|
-
// Directly display weird stuff
|
|
58
|
-
if (!isSafeNumber(val)) {
|
|
59
|
-
return this.state.value || null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return formatTime(val);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
// TODO: Rewrite as an FC, remove this lint disable
|
|
2
|
-
import { createPopper, Placement, VirtualElement } from '@popperjs/core';
|
|
3
|
-
import { Component, ReactNode } from 'react';
|
|
4
|
-
import { findDOMNode, render } from 'react-dom';
|
|
5
|
-
|
|
6
|
-
import styles from '../styles/components/Tooltip.module.scss';
|
|
7
|
-
|
|
8
|
-
type Props = {
|
|
9
|
-
/** The content to display in the tooltip */
|
|
10
|
-
content: ReactNode;
|
|
11
|
-
} & Partial<{
|
|
12
|
-
/** Hovering this element will show the tooltip */
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
/** Where to place the tooltip relative to the reference element */
|
|
15
|
-
position: Placement;
|
|
16
|
-
}>;
|
|
17
|
-
|
|
18
|
-
type State = {
|
|
19
|
-
hovered: boolean;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const DEFAULT_OPTIONS = {
|
|
23
|
-
modifiers: [
|
|
24
|
-
{
|
|
25
|
-
name: 'eventListeners',
|
|
26
|
-
enabled: false,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const NULL_RECT: DOMRect = {
|
|
32
|
-
width: 0,
|
|
33
|
-
height: 0,
|
|
34
|
-
top: 0,
|
|
35
|
-
right: 0,
|
|
36
|
-
bottom: 0,
|
|
37
|
-
left: 0,
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0,
|
|
40
|
-
toJSON: () => null,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export class Tooltip extends Component<Props, State> {
|
|
44
|
-
// Mounting poppers is really laggy because popper.js is very slow.
|
|
45
|
-
// Thus, instead of using the Popper component, Tooltip creates ONE popper
|
|
46
|
-
// and stores every tooltip inside that.
|
|
47
|
-
// This means you can never have two tooltips at once, for instance.
|
|
48
|
-
static renderedTooltip: HTMLDivElement | undefined;
|
|
49
|
-
static singletonPopper: ReturnType<typeof createPopper> | undefined;
|
|
50
|
-
static currentHoveredElement: Element | undefined;
|
|
51
|
-
static virtualElement: VirtualElement = {
|
|
52
|
-
getBoundingClientRect: () =>
|
|
53
|
-
Tooltip.currentHoveredElement?.getBoundingClientRect() ?? NULL_RECT,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
getDOMNode() {
|
|
57
|
-
// HACK: We don't want to create a wrapper, as it could break the layout
|
|
58
|
-
// of consumers, so we use findDOMNode.
|
|
59
|
-
// This is usually bad as refs are usually better, but refs did
|
|
60
|
-
// not work in this case, as they weren't propagating correctly.
|
|
61
|
-
// A previous attempt was made as a render prop that passed an ID,
|
|
62
|
-
// but this made consuming use too unwieldly.
|
|
63
|
-
// Because this component is written in TypeScript, we will know
|
|
64
|
-
// immediately if this internal variable is removed.
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
return findDOMNode(this) as Element;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
componentDidMount() {
|
|
71
|
-
const domNode = this.getDOMNode();
|
|
72
|
-
|
|
73
|
-
if (!domNode) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
domNode.addEventListener('mouseenter', () => {
|
|
78
|
-
let renderedTooltip = Tooltip.renderedTooltip;
|
|
79
|
-
if (renderedTooltip === undefined) {
|
|
80
|
-
renderedTooltip = document.createElement('div');
|
|
81
|
-
renderedTooltip.className = styles.tooltip;
|
|
82
|
-
document.body.appendChild(renderedTooltip);
|
|
83
|
-
Tooltip.renderedTooltip = renderedTooltip;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
Tooltip.currentHoveredElement = domNode;
|
|
87
|
-
|
|
88
|
-
renderedTooltip.style.opacity = '1';
|
|
89
|
-
|
|
90
|
-
this.renderPopperContent();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
domNode.addEventListener('mouseleave', () => {
|
|
94
|
-
this.fadeOut();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
fadeOut() {
|
|
99
|
-
if (Tooltip.currentHoveredElement !== this.getDOMNode()) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
Tooltip.currentHoveredElement = undefined;
|
|
104
|
-
Tooltip.renderedTooltip!.style.opacity = '0';
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
renderPopperContent() {
|
|
108
|
-
const renderedTooltip = Tooltip.renderedTooltip;
|
|
109
|
-
if (!renderedTooltip) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
render(<span>{this.props.content}</span>, renderedTooltip, () => {
|
|
114
|
-
let singletonPopper = Tooltip.singletonPopper;
|
|
115
|
-
if (singletonPopper === undefined) {
|
|
116
|
-
singletonPopper = createPopper(
|
|
117
|
-
Tooltip.virtualElement,
|
|
118
|
-
renderedTooltip!,
|
|
119
|
-
{
|
|
120
|
-
...DEFAULT_OPTIONS,
|
|
121
|
-
placement: this.props.position || 'auto',
|
|
122
|
-
},
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
Tooltip.singletonPopper = singletonPopper;
|
|
126
|
-
} else {
|
|
127
|
-
singletonPopper.setOptions({
|
|
128
|
-
...DEFAULT_OPTIONS,
|
|
129
|
-
placement: this.props.position || 'auto',
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
singletonPopper.update();
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
componentDidUpdate() {
|
|
138
|
-
if (Tooltip.currentHoveredElement !== this.getDOMNode()) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
this.renderPopperContent();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
componentWillUnmount() {
|
|
146
|
-
this.fadeOut();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
render() {
|
|
150
|
-
return this.props.children;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Component, createRef, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type Props = {
|
|
4
|
-
onOutsideClick: () => void;
|
|
5
|
-
} & PropsWithChildren;
|
|
6
|
-
|
|
7
|
-
export class TrackOutsideClicks extends Component<Props> {
|
|
8
|
-
ref = createRef<HTMLDivElement>();
|
|
9
|
-
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
|
|
13
|
-
this.handleOutsideClick = this.handleOutsideClick.bind(this);
|
|
14
|
-
|
|
15
|
-
document.addEventListener('click', this.handleOutsideClick);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
componentWillUnmount() {
|
|
19
|
-
document.removeEventListener('click', this.handleOutsideClick);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
handleOutsideClick(event: MouseEvent) {
|
|
23
|
-
if (!(event.target instanceof Node)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (this.ref.current && !this.ref.current.contains(event.target)) {
|
|
28
|
-
this.props.onOutsideClick();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
return <div ref={this.ref}>{this.props.children}</div>;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PropsWithChildren,
|
|
3
|
-
useCallback,
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A vertical list that renders items to fill space up to the extents of the
|
|
11
|
-
* current window, and then defers rendering of other items until they come
|
|
12
|
-
* into view.
|
|
13
|
-
*/
|
|
14
|
-
export function VirtualList(props: PropsWithChildren) {
|
|
15
|
-
const { children } = props;
|
|
16
|
-
const containerRef = useRef(null as HTMLDivElement | null);
|
|
17
|
-
const [visibleElements, setVisibleElements] = useState(1);
|
|
18
|
-
const [padding, setPadding] = useState(0);
|
|
19
|
-
|
|
20
|
-
const adjustExtents = useCallback(() => {
|
|
21
|
-
const { current } = containerRef;
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
!children ||
|
|
25
|
-
!Array.isArray(children) ||
|
|
26
|
-
!current ||
|
|
27
|
-
visibleElements >= children.length
|
|
28
|
-
) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const unusedArea =
|
|
33
|
-
document.body.offsetHeight - current.getBoundingClientRect().bottom;
|
|
34
|
-
|
|
35
|
-
const averageItemHeight = Math.ceil(current.offsetHeight / visibleElements);
|
|
36
|
-
|
|
37
|
-
if (unusedArea > 0) {
|
|
38
|
-
const newVisibleElements = Math.min(
|
|
39
|
-
children.length,
|
|
40
|
-
visibleElements +
|
|
41
|
-
Math.max(1, Math.ceil(unusedArea / averageItemHeight)),
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
setVisibleElements(newVisibleElements);
|
|
45
|
-
|
|
46
|
-
setPadding((children.length - newVisibleElements) * averageItemHeight);
|
|
47
|
-
}
|
|
48
|
-
}, [containerRef, visibleElements, children]);
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
adjustExtents();
|
|
52
|
-
|
|
53
|
-
const interval = setInterval(adjustExtents, 100);
|
|
54
|
-
|
|
55
|
-
return () => clearInterval(interval);
|
|
56
|
-
}, [adjustExtents]);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div className={'VirtualList'}>
|
|
60
|
-
<div className={'VirtualList__Container'} ref={containerRef}>
|
|
61
|
-
{Array.isArray(children) ? children.slice(0, visibleElements) : null}
|
|
62
|
-
</div>
|
|
63
|
-
<div
|
|
64
|
-
className={'VirtualList__Padding'}
|
|
65
|
-
style={{ paddingBottom: `${padding}px` }}
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Aleksej Komarov
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
@use '../colors.scss';
|
|
7
|
-
|
|
8
|
-
$fg-map: colors.$fg-map !default;
|
|
9
|
-
$bg-map: colors.$bg-map !default;
|
|
10
|
-
|
|
11
|
-
@each $color-name, $color-value in $fg-map {
|
|
12
|
-
.color-#{$color-name} {
|
|
13
|
-
color: $color-value !important;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@each $color-name, $color-value in $bg-map {
|
|
18
|
-
.color-bg-#{$color-name} {
|
|
19
|
-
background-color: $color-value !important;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Aleksej Komarov
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
.debug-layout,
|
|
7
|
-
.debug-layout *:not(g):not(path) {
|
|
8
|
-
color: rgba(255, 255, 255, 0.9) !important;
|
|
9
|
-
background: transparent !important;
|
|
10
|
-
outline: 1px solid rgba(255, 255, 255, 0.5) !important;
|
|
11
|
-
box-shadow: none !important;
|
|
12
|
-
filter: none !important;
|
|
13
|
-
|
|
14
|
-
&:hover {
|
|
15
|
-
outline-color: rgba(255, 255, 255, 0.8) !important;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Aleksej Komarov
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
@use '../colors.scss';
|
|
7
|
-
|
|
8
|
-
.outline-dotted {
|
|
9
|
-
outline-style: dotted !important;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.outline-dashed {
|
|
13
|
-
outline-style: dashed !important;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.outline-solid {
|
|
17
|
-
outline-style: solid !important;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.outline-double {
|
|
21
|
-
outline-style: double !important;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.outline-groove {
|
|
25
|
-
outline-style: groove !important;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.outline-ridge {
|
|
29
|
-
outline-style: ridge !important;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.outline-inset {
|
|
33
|
-
outline-style: inset !important;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.outline-outset {
|
|
37
|
-
outline-style: outset !important;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
$fg-map: colors.$fg-map !default;
|
|
41
|
-
$bg-map: colors.$bg-map !default;
|
|
42
|
-
|
|
43
|
-
@each $color-name, $color-value in $fg-map {
|
|
44
|
-
.outline-color-#{$color-name} {
|
|
45
|
-
outline: 0.167rem solid $color-value !important;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Aleksej Komarov
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
.text-left {
|
|
7
|
-
text-align: left;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.text-center {
|
|
11
|
-
text-align: center;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.text-right {
|
|
15
|
-
text-align: right;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.text-baseline {
|
|
19
|
-
text-align: baseline;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.text-justify {
|
|
23
|
-
text-align: justify;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.text-nowrap {
|
|
27
|
-
white-space: nowrap;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.text-pre {
|
|
31
|
-
white-space: pre;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.text-bold {
|
|
35
|
-
font-weight: bold;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.text-italic {
|
|
39
|
-
font-style: italic;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.text-underline {
|
|
43
|
-
text-decoration: underline;
|
|
44
|
-
}
|
package/lib/styles/base.scss
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Aleksej Komarov
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
@use 'sass:color';
|
|
7
|
-
@use 'sass:math';
|
|
8
|
-
|
|
9
|
-
$color-fg: #ffffff !default;
|
|
10
|
-
$color-bg: #252525 !default;
|
|
11
|
-
$color-bg-section: rgba(0, 0, 0, 0.33) !default;
|
|
12
|
-
$color-bg-grad-spread: 2% !default;
|
|
13
|
-
$color-bg-start: color.adjust(
|
|
14
|
-
$color-bg,
|
|
15
|
-
$lightness: $color-bg-grad-spread
|
|
16
|
-
) !default;
|
|
17
|
-
$color-bg-end: color.adjust(
|
|
18
|
-
$color-bg,
|
|
19
|
-
$lightness: -$color-bg-grad-spread
|
|
20
|
-
) !default;
|
|
21
|
-
|
|
22
|
-
$unit: 12px;
|
|
23
|
-
$font-size: 1 * $unit !default;
|
|
24
|
-
$border-radius: 0.16em !default;
|
|
25
|
-
|
|
26
|
-
@function em($px) {
|
|
27
|
-
@return 1em * math.div($px, $unit);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@function rem($px) {
|
|
31
|
-
@return 1rem * math.div($px, $unit);
|
|
32
|
-
}
|
package/lib/styles/colors.scss
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Aleksej Komarov
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
@use "sass:color";
|
|
7
|
-
@use "sass:map";
|
|
8
|
-
@use "sass:meta";
|
|
9
|
-
|
|
10
|
-
// Base colors
|
|
11
|
-
$black: #000000 !default;
|
|
12
|
-
$white: #ffffff !default;
|
|
13
|
-
$red: #db2828 !default;
|
|
14
|
-
$orange: #f2711c !default;
|
|
15
|
-
$yellow: #fbd608 !default;
|
|
16
|
-
$olive: #b5cc18 !default;
|
|
17
|
-
$green: #20b142 !default;
|
|
18
|
-
$teal: #00b5ad !default;
|
|
19
|
-
$blue: #2185d0 !default;
|
|
20
|
-
$violet: #6435c9 !default;
|
|
21
|
-
$purple: #a333c8 !default;
|
|
22
|
-
$pink: #e03997 !default;
|
|
23
|
-
$brown: #a5673f !default;
|
|
24
|
-
$grey: #767676 !default;
|
|
25
|
-
$light-grey: #aaa !default;
|
|
26
|
-
|
|
27
|
-
$primary: #4972a1 !default;
|
|
28
|
-
$good: #5baa27 !default;
|
|
29
|
-
$average: #f08f11 !default;
|
|
30
|
-
$bad: #db2828 !default;
|
|
31
|
-
$label: #7e90a7 !default;
|
|
32
|
-
|
|
33
|
-
// Background and foreground color lightness ratios
|
|
34
|
-
$bg-lightness: -15% !default;
|
|
35
|
-
$fg-lightness: 10% !default;
|
|
36
|
-
|
|
37
|
-
@function bg($color) {
|
|
38
|
-
@return color.scale($color, $lightness: $bg-lightness);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@function fg($color) {
|
|
42
|
-
@return color.scale($color, $lightness: $fg-lightness);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Mappings of color names
|
|
46
|
-
|
|
47
|
-
$_gen_map: (
|
|
48
|
-
"black": $black,
|
|
49
|
-
"white": $white,
|
|
50
|
-
"red": $red,
|
|
51
|
-
"orange": $orange,
|
|
52
|
-
"yellow": $yellow,
|
|
53
|
-
"olive": $olive,
|
|
54
|
-
"green": $green,
|
|
55
|
-
"teal": $teal,
|
|
56
|
-
"blue": $blue,
|
|
57
|
-
"violet": $violet,
|
|
58
|
-
"purple": $purple,
|
|
59
|
-
"pink": $pink,
|
|
60
|
-
"brown": $brown,
|
|
61
|
-
"grey": $grey,
|
|
62
|
-
"light-grey": $light-grey,
|
|
63
|
-
"good": $good,
|
|
64
|
-
"average": $average,
|
|
65
|
-
"bad": $bad,
|
|
66
|
-
"label": $label,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
// Foreground color names for which to generate a color map
|
|
70
|
-
$fg-map-keys: map.keys($_gen_map) !default;
|
|
71
|
-
// Background color names for which to generate a color map
|
|
72
|
-
$bg-map-keys: map.keys($_gen_map) !default;
|
|
73
|
-
|
|
74
|
-
$fg-map: ();
|
|
75
|
-
@each $color-name in $fg-map-keys {
|
|
76
|
-
$fg-map: map-merge(
|
|
77
|
-
$fg-map,
|
|
78
|
-
(
|
|
79
|
-
$color-name: fg(map.get($_gen_map, $color-name)),
|
|
80
|
-
)
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
$bg-map: ();
|
|
85
|
-
@each $color-name in $bg-map-keys {
|
|
86
|
-
$bg-map: map-merge(
|
|
87
|
-
$bg-map,
|
|
88
|
-
(
|
|
89
|
-
$color-name: bg(map.get($_gen_map, $color-name)),
|
|
90
|
-
)
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Aleksej Komarov
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
@use '../base.scss';
|
|
7
|
-
@use '../colors.scss';
|
|
8
|
-
|
|
9
|
-
$color-default: colors.fg(colors.$label) !default;
|
|
10
|
-
|
|
11
|
-
.blockQuote {
|
|
12
|
-
color: $color-default;
|
|
13
|
-
border-left: base.em(2px) solid $color-default;
|
|
14
|
-
padding-left: 0.5em;
|
|
15
|
-
margin-bottom: 0.5em;
|
|
16
|
-
|
|
17
|
-
&:last-child {
|
|
18
|
-
margin-bottom: 0;
|
|
19
|
-
}
|
|
20
|
-
}
|