tgui-core 1.0.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 (152) hide show
  1. package/.editorconfig +10 -0
  2. package/.eslintrc.cjs +78 -0
  3. package/.gitattributes +4 -0
  4. package/.prettierrc.yml +1 -0
  5. package/.vscode/extensions.json +6 -0
  6. package/.vscode/settings.json +5 -0
  7. package/README.md +1 -0
  8. package/global.d.ts +173 -0
  9. package/package.json +25 -0
  10. package/src/assets.ts +43 -0
  11. package/src/backend.ts +369 -0
  12. package/src/common/collections.ts +349 -0
  13. package/src/common/color.ts +94 -0
  14. package/src/common/events.ts +45 -0
  15. package/src/common/exhaustive.ts +19 -0
  16. package/src/common/fp.ts +38 -0
  17. package/src/common/keycodes.ts +86 -0
  18. package/src/common/keys.ts +39 -0
  19. package/src/common/math.ts +98 -0
  20. package/src/common/perf.ts +72 -0
  21. package/src/common/random.ts +32 -0
  22. package/src/common/react.ts +65 -0
  23. package/src/common/redux.ts +196 -0
  24. package/src/common/storage.js +196 -0
  25. package/src/common/string.ts +173 -0
  26. package/src/common/timer.ts +68 -0
  27. package/src/common/type-utils.ts +41 -0
  28. package/src/common/types.ts +9 -0
  29. package/src/common/uuid.ts +24 -0
  30. package/src/common/vector.ts +51 -0
  31. package/src/components/AnimatedNumber.tsx +185 -0
  32. package/src/components/Autofocus.tsx +23 -0
  33. package/src/components/Blink.jsx +69 -0
  34. package/src/components/BlockQuote.tsx +15 -0
  35. package/src/components/BodyZoneSelector.tsx +149 -0
  36. package/src/components/Box.tsx +255 -0
  37. package/src/components/Button.tsx +415 -0
  38. package/src/components/ByondUi.jsx +121 -0
  39. package/src/components/Chart.tsx +160 -0
  40. package/src/components/Collapsible.tsx +45 -0
  41. package/src/components/ColorBox.tsx +30 -0
  42. package/src/components/Dialog.tsx +85 -0
  43. package/src/components/Dimmer.tsx +19 -0
  44. package/src/components/Divider.tsx +26 -0
  45. package/src/components/DmIcon.tsx +72 -0
  46. package/src/components/DraggableControl.jsx +282 -0
  47. package/src/components/Dropdown.tsx +246 -0
  48. package/src/components/FakeTerminal.jsx +52 -0
  49. package/src/components/FitText.tsx +99 -0
  50. package/src/components/Flex.tsx +105 -0
  51. package/src/components/Grid.tsx +44 -0
  52. package/src/components/Icon.tsx +91 -0
  53. package/src/components/Image.tsx +63 -0
  54. package/src/components/InfinitePlane.jsx +192 -0
  55. package/src/components/Input.tsx +181 -0
  56. package/src/components/KeyListener.tsx +40 -0
  57. package/src/components/Knob.tsx +185 -0
  58. package/src/components/LabeledControls.tsx +50 -0
  59. package/src/components/LabeledList.tsx +130 -0
  60. package/src/components/MenuBar.tsx +238 -0
  61. package/src/components/Modal.tsx +25 -0
  62. package/src/components/NoticeBox.tsx +48 -0
  63. package/src/components/NumberInput.tsx +328 -0
  64. package/src/components/Popper.tsx +100 -0
  65. package/src/components/ProgressBar.tsx +79 -0
  66. package/src/components/RestrictedInput.jsx +301 -0
  67. package/src/components/RoundGauge.tsx +189 -0
  68. package/src/components/Section.tsx +125 -0
  69. package/src/components/Slider.tsx +173 -0
  70. package/src/components/Stack.tsx +101 -0
  71. package/src/components/StyleableSection.tsx +30 -0
  72. package/src/components/Table.tsx +90 -0
  73. package/src/components/Tabs.tsx +90 -0
  74. package/src/components/TextArea.tsx +198 -0
  75. package/src/components/TimeDisplay.jsx +64 -0
  76. package/src/components/Tooltip.tsx +147 -0
  77. package/src/components/TrackOutsideClicks.tsx +35 -0
  78. package/src/components/VirtualList.tsx +69 -0
  79. package/src/constants.ts +355 -0
  80. package/src/debug/KitchenSink.jsx +56 -0
  81. package/src/debug/actions.js +11 -0
  82. package/src/debug/hooks.js +10 -0
  83. package/src/debug/index.ts +10 -0
  84. package/src/debug/middleware.js +86 -0
  85. package/src/debug/reducer.js +22 -0
  86. package/src/debug/selectors.js +7 -0
  87. package/src/drag.ts +280 -0
  88. package/src/events.ts +237 -0
  89. package/src/focus.ts +25 -0
  90. package/src/format.ts +173 -0
  91. package/src/hotkeys.ts +212 -0
  92. package/src/http.ts +16 -0
  93. package/src/layouts/Layout.tsx +75 -0
  94. package/src/layouts/NtosWindow.tsx +162 -0
  95. package/src/layouts/Pane.tsx +56 -0
  96. package/src/layouts/Window.tsx +227 -0
  97. package/src/renderer.ts +50 -0
  98. package/styles/base.scss +32 -0
  99. package/styles/colors.scss +92 -0
  100. package/styles/components/BlockQuote.scss +20 -0
  101. package/styles/components/Button.scss +175 -0
  102. package/styles/components/ColorBox.scss +12 -0
  103. package/styles/components/Dialog.scss +105 -0
  104. package/styles/components/Dimmer.scss +22 -0
  105. package/styles/components/Divider.scss +27 -0
  106. package/styles/components/Dropdown.scss +72 -0
  107. package/styles/components/Flex.scss +31 -0
  108. package/styles/components/Icon.scss +25 -0
  109. package/styles/components/Input.scss +68 -0
  110. package/styles/components/Knob.scss +131 -0
  111. package/styles/components/LabeledList.scss +49 -0
  112. package/styles/components/MenuBar.scss +75 -0
  113. package/styles/components/Modal.scss +14 -0
  114. package/styles/components/NoticeBox.scss +65 -0
  115. package/styles/components/NumberInput.scss +76 -0
  116. package/styles/components/ProgressBar.scss +63 -0
  117. package/styles/components/RoundGauge.scss +88 -0
  118. package/styles/components/Section.scss +143 -0
  119. package/styles/components/Slider.scss +54 -0
  120. package/styles/components/Stack.scss +59 -0
  121. package/styles/components/Table.scss +44 -0
  122. package/styles/components/Tabs.scss +144 -0
  123. package/styles/components/TextArea.scss +84 -0
  124. package/styles/components/Tooltip.scss +24 -0
  125. package/styles/functions.scss +79 -0
  126. package/styles/layouts/Layout.scss +57 -0
  127. package/styles/layouts/NtosHeader.scss +20 -0
  128. package/styles/layouts/NtosWindow.scss +26 -0
  129. package/styles/layouts/TitleBar.scss +111 -0
  130. package/styles/layouts/Window.scss +103 -0
  131. package/styles/main.scss +97 -0
  132. package/styles/reset.scss +68 -0
  133. package/styles/themes/abductor.scss +68 -0
  134. package/styles/themes/admin.scss +38 -0
  135. package/styles/themes/cardtable.scss +57 -0
  136. package/styles/themes/hackerman.scss +70 -0
  137. package/styles/themes/malfunction.scss +67 -0
  138. package/styles/themes/neutral.scss +50 -0
  139. package/styles/themes/ntOS95.scss +166 -0
  140. package/styles/themes/ntos.scss +44 -0
  141. package/styles/themes/ntos_cat.scss +148 -0
  142. package/styles/themes/ntos_darkmode.scss +44 -0
  143. package/styles/themes/ntos_lightmode.scss +67 -0
  144. package/styles/themes/ntos_spooky.scss +69 -0
  145. package/styles/themes/ntos_synth.scss +99 -0
  146. package/styles/themes/ntos_terminal.scss +112 -0
  147. package/styles/themes/paper.scss +184 -0
  148. package/styles/themes/retro.scss +72 -0
  149. package/styles/themes/spookyconsole.scss +73 -0
  150. package/styles/themes/syndicate.scss +67 -0
  151. package/styles/themes/wizard.scss +68 -0
  152. package/tsconfig.json +34 -0
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ @use '../base.scss';
7
+ @use '../colors.scss';
8
+ @use '../functions.scss' as *;
9
+
10
+ $color-default: colors.bg(colors.$primary) !default;
11
+ $color-disabled: #999999 !default;
12
+ $color-selected: colors.bg(colors.$green) !default;
13
+ $color-caution: colors.bg(colors.$yellow) !default;
14
+ $color-danger: colors.bg(colors.$red) !default;
15
+ $color-transparent-text: rgba(255, 255, 255, 0.5) !default;
16
+ $border-radius: base.$border-radius !default;
17
+ $bg-map: colors.$bg-map !default;
18
+
19
+ @mixin button-color($color) {
20
+ // Adapt text color to background luminance to ensure high contast
21
+ $luminance: luminance($color);
22
+ $text-color: if($luminance > 0.4, rgba(0, 0, 0, 1), rgba(255, 255, 255, 1));
23
+
24
+ transition:
25
+ color 50ms,
26
+ background-color 50ms;
27
+ background-color: $color;
28
+ color: $text-color;
29
+
30
+ &:focus {
31
+ transition:
32
+ color 100ms,
33
+ background-color 100ms;
34
+ }
35
+
36
+ &:hover {
37
+ background-color: lighten($color, 30%);
38
+ color: $text-color;
39
+ }
40
+ }
41
+
42
+ .Button {
43
+ position: relative;
44
+ display: inline-block;
45
+ line-height: 1.667em;
46
+ padding: 0 0.5em;
47
+ margin-right: base.em(2px);
48
+ white-space: nowrap;
49
+ outline: 0;
50
+ border-radius: $border-radius;
51
+ margin-bottom: base.em(2px);
52
+ // Disable selection in buttons
53
+ user-select: none;
54
+ -ms-user-select: none;
55
+
56
+ &:last-child {
57
+ margin-right: 0;
58
+ margin-bottom: 0;
59
+ }
60
+
61
+ .fa,
62
+ .fas,
63
+ .far {
64
+ margin-left: -0.25em;
65
+ margin-right: -0.25em;
66
+ min-width: 1.333em;
67
+ text-align: center;
68
+ }
69
+ }
70
+
71
+ .Button--dropdown {
72
+ line-height: base.em(16px);
73
+ height: base.em(22px);
74
+ padding: 0.2rem 0.5rem;
75
+ }
76
+
77
+ .Button--hasContent {
78
+ // Add a margin to the icon to keep it separate from the text
79
+ .fa,
80
+ .fas,
81
+ .far {
82
+ margin-right: 0.25em;
83
+ }
84
+ }
85
+
86
+ .Button--hasContent.Button--iconPosition--right {
87
+ .fa,
88
+ .fas,
89
+ .far {
90
+ margin-right: 0px;
91
+ margin-left: 3px;
92
+ }
93
+ }
94
+
95
+ .Button--ellipsis {
96
+ text-overflow: ellipsis;
97
+ overflow: hidden;
98
+ }
99
+
100
+ .Button--fluid {
101
+ display: block;
102
+ margin-left: 0;
103
+ margin-right: 0;
104
+ }
105
+
106
+ .Button--circular {
107
+ border-radius: 50%;
108
+ }
109
+
110
+ .Button--compact {
111
+ padding: 0 0.25em;
112
+ line-height: 1.333em;
113
+ }
114
+
115
+ @each $color-name, $color-value in $bg-map {
116
+ .Button--color--#{$color-name} {
117
+ @include button-color($color-value);
118
+ }
119
+ }
120
+
121
+ .Button--color--default {
122
+ @include button-color($color-default);
123
+ }
124
+
125
+ .Button--color--caution {
126
+ @include button-color($color-caution);
127
+ }
128
+
129
+ .Button--color--danger {
130
+ @include button-color($color-danger);
131
+ }
132
+
133
+ .Button--color--transparent {
134
+ @include button-color(base.$color-bg);
135
+ background-color: rgba(base.$color-bg, 0);
136
+ color: $color-transparent-text;
137
+ }
138
+
139
+ .Button--disabled {
140
+ background-color: $color-disabled !important;
141
+ }
142
+
143
+ .Button--selected {
144
+ @include button-color($color-selected);
145
+ }
146
+
147
+ .Button--flex {
148
+ display: inline-flex; //Inline even for fluid
149
+ flex-direction: column;
150
+ }
151
+
152
+ .Button--flex--fluid {
153
+ width: 100%;
154
+ }
155
+
156
+ .Button--verticalAlignContent--top {
157
+ justify-content: flex-start;
158
+ }
159
+
160
+ .Button--verticalAlignContent--middle {
161
+ justify-content: center;
162
+ }
163
+
164
+ .Button--verticalAlignContent--bottom {
165
+ justify-content: flex-end;
166
+ }
167
+
168
+ .Button__content {
169
+ display: block;
170
+ align-self: stretch;
171
+ }
172
+
173
+ .Button__textMargin {
174
+ margin-left: 0.4rem;
175
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .ColorBox {
7
+ display: inline-block;
8
+ width: 1em;
9
+ height: 1em;
10
+ line-height: 1em;
11
+ text-align: center;
12
+ }
@@ -0,0 +1,105 @@
1
+ @use '../base';
2
+
3
+ $background-color: base.$color-bg !default;
4
+
5
+ .Dialog {
6
+ position: fixed;
7
+ left: 0;
8
+ top: 0;
9
+ right: 0;
10
+ bottom: 0;
11
+ background-color: rgba(0, 0, 0, 0.5);
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ }
16
+
17
+ .Dialog__content {
18
+ background-color: $background-color;
19
+ font-family: Consolas, monospace;
20
+ font-size: base.em(14px);
21
+ display: flex;
22
+ flex-direction: column;
23
+ }
24
+
25
+ .Dialog__header {
26
+ display: flex;
27
+ height: 2em;
28
+ line-height: 1.928em;
29
+ background-color: rgba(0, 0, 0, 0.5);
30
+ user-select: none;
31
+ -ms-user-select: none;
32
+ }
33
+
34
+ .Dialog__title {
35
+ display: inline;
36
+ font-style: italic;
37
+ margin-left: 1rem;
38
+ margin-right: 2rem;
39
+ flex-grow: 1;
40
+ opacity: 0.33;
41
+ }
42
+
43
+ .Dialog__body {
44
+ margin: 2rem 1rem 2rem 1rem;
45
+ flex-grow: 1;
46
+ }
47
+
48
+ .Dialog__footer {
49
+ display: flex;
50
+ flex-direction: row;
51
+ justify-content: flex-end;
52
+ padding: 1rem;
53
+ background-color: rgba(0, 0, 0, 0.25);
54
+ }
55
+
56
+ .Dialog__button {
57
+ margin: 0 1rem 0 1rem;
58
+ height: 2rem;
59
+ min-width: 6rem;
60
+ text-align: center;
61
+ }
62
+
63
+ .SaveAsDialog__inputs {
64
+ display: flex;
65
+ flex-direction: row;
66
+ align-items: center;
67
+ padding-left: 3rem;
68
+ justify-content: flex-end;
69
+ margin-right: 1rem;
70
+ }
71
+
72
+ .SaveAsDialog__input {
73
+ margin-left: 1rem;
74
+ width: 80%;
75
+ }
76
+
77
+ .SaveAsDialog__label {
78
+ vertical-align: center;
79
+ }
80
+
81
+ .Dialog__FileList {
82
+ position: relative;
83
+ display: flex;
84
+ flex-wrap: wrap;
85
+ flex-grow: 1;
86
+ align-content: flex-start;
87
+ max-height: 20rem;
88
+ overflow: auto;
89
+ overflow-y: scroll;
90
+ }
91
+
92
+ .Dialog__FileEntry {
93
+ text-align: center;
94
+ margin: 1rem;
95
+ }
96
+
97
+ .Dialog__FileIcon {
98
+ display: inline-block;
99
+ margin: 0 0 1rem 0;
100
+ position: relative;
101
+ width: 6vh;
102
+ height: auto;
103
+ text-align: center;
104
+ cursor: default;
105
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ $background-dimness: 0.75 !default;
6
+
7
+ .Dimmer {
8
+ // Align everything in the middle.
9
+ // A fat middle finger for anything less than IE11.
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ // Fill positioned parent
14
+ position: absolute;
15
+ top: 0;
16
+ bottom: 0;
17
+ left: 0;
18
+ right: 0;
19
+ // Dim everything around it
20
+ background-color: rgba(0, 0, 0, $background-dimness);
21
+ z-index: 1;
22
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ @use '../base.scss';
7
+
8
+ $color: rgba(255, 255, 255, 0.1) !default;
9
+ $thickness: base.em(2px) !default;
10
+ $spacing: 0.5em;
11
+
12
+ .Divider--horizontal {
13
+ margin: $spacing 0;
14
+
15
+ &:not(.Divider--hidden) {
16
+ border-top: $thickness solid $color;
17
+ }
18
+ }
19
+
20
+ .Divider--vertical {
21
+ height: 100%;
22
+ margin: 0 $spacing;
23
+
24
+ &:not(.Divider--hidden) {
25
+ border-left: $thickness solid $color;
26
+ }
27
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ @use '../base.scss';
7
+
8
+ .Dropdown {
9
+ display: flex;
10
+ align-items: flex-start;
11
+ }
12
+
13
+ .Dropdown__control {
14
+ flex: 1;
15
+ font-family: Verdana, sans-serif;
16
+ font-size: base.em(12px);
17
+ overflow: hidden;
18
+ user-select: none;
19
+ width: base.em(100px);
20
+ }
21
+
22
+ .Dropdown__arrow-button {
23
+ float: right;
24
+ padding-left: 0.35em;
25
+ width: 1.2em;
26
+ border-left: base.em(1px) solid rgba(0, 0, 0, 0.25);
27
+ }
28
+
29
+ .Dropdown__menu {
30
+ overflow-y: auto;
31
+ align-items: center;
32
+ max-height: base.em(200px);
33
+ border-radius: 0 0 base.em(2px) base.em(2px);
34
+ color: #fff;
35
+ background-color: #000;
36
+ background-color: rgba(0, 0, 0, 0.75);
37
+ }
38
+
39
+ .Dropdown__menu-scroll {
40
+ overflow-y: scroll;
41
+ }
42
+
43
+ .Dropdown__menuentry {
44
+ padding: base.em(2px) base.em(4px);
45
+ font-family: Verdana, sans-serif;
46
+ font-size: base.em(12px);
47
+ line-height: base.em(17px);
48
+ transition: background-color 100ms ease-out;
49
+
50
+ &.selected {
51
+ background-color: rgba(255, 255, 255, 0.5) !important;
52
+ transition: background-color 0ms;
53
+ }
54
+
55
+ &:hover {
56
+ background-color: rgba(255, 255, 255, 0.2);
57
+ transition: background-color 0ms;
58
+ }
59
+ }
60
+
61
+ .Dropdown__over {
62
+ top: auto;
63
+ bottom: 100%;
64
+ }
65
+
66
+ .Dropdown__selected-text {
67
+ display: inline-block;
68
+ text-overflow: ellipsis;
69
+ white-space: nowrap;
70
+ height: base.em(17px);
71
+ width: calc(100% - 1.2em);
72
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .Flex {
7
+ display: -ms-flexbox;
8
+ display: flex;
9
+ }
10
+
11
+ .Flex--inline {
12
+ display: inline-flex;
13
+ }
14
+
15
+ .Flex--iefix {
16
+ display: block;
17
+ }
18
+
19
+ .Flex--iefix.Flex--inline {
20
+ display: inline-block;
21
+ }
22
+
23
+ .Flex__item--iefix {
24
+ display: inline-block;
25
+ }
26
+
27
+ .Flex--iefix--column {
28
+ & > .Flex__item--iefix {
29
+ display: block;
30
+ }
31
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @file
3
+ * @copyright 2020
4
+ * @author ThePotato97 (https://github.com/ThePotato97)
5
+ * @license ISC
6
+ */
7
+
8
+ .IconStack > .Icon {
9
+ position: absolute;
10
+ width: 100%;
11
+ text-align: center;
12
+ }
13
+
14
+ .IconStack {
15
+ position: relative;
16
+ display: inline-block;
17
+ height: 1.2em;
18
+ line-height: 2em;
19
+ vertical-align: middle;
20
+
21
+ &:after {
22
+ color: transparent;
23
+ content: '.';
24
+ }
25
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ @use '../base.scss';
7
+ @use '../functions.scss' as *;
8
+
9
+ $text-color: base.$color-fg !default;
10
+ $background-color: #0a0a0a !default;
11
+ $border-color: #88bfff !default;
12
+ $border-radius: base.$border-radius !default;
13
+
14
+ .Input {
15
+ position: relative;
16
+ display: inline-block;
17
+ width: base.em(120px);
18
+ border: base.em(1px) solid $border-color;
19
+ border: base.em(1px) solid rgba($border-color, 0.75);
20
+ border-radius: $border-radius;
21
+ color: $text-color;
22
+ background-color: $background-color;
23
+ padding: 0 base.em(4px);
24
+ margin-right: base.em(2px);
25
+ line-height: base.em(17px);
26
+ overflow: visible;
27
+ }
28
+
29
+ .Input--fluid {
30
+ display: block;
31
+ width: auto;
32
+ }
33
+
34
+ .Input__baseline {
35
+ display: inline-block;
36
+ color: transparent;
37
+ }
38
+
39
+ .Input__input {
40
+ display: block;
41
+ position: absolute;
42
+ top: 0;
43
+ bottom: 0;
44
+ left: 0;
45
+ right: 0;
46
+ border: 0;
47
+ outline: 0;
48
+ width: 100%;
49
+ font-size: base.em(12px);
50
+ line-height: base.em(17px);
51
+ height: base.em(17px);
52
+ margin: 0;
53
+ padding: 0 0.5em;
54
+ font-family: Verdana, sans-serif;
55
+ background-color: transparent;
56
+ color: $text-color;
57
+ color: inherit;
58
+
59
+ &:-ms-input-placeholder {
60
+ font-style: italic;
61
+ color: #777;
62
+ color: rgba(255, 255, 255, 0.45);
63
+ }
64
+ }
65
+
66
+ .Input--monospace .Input__input {
67
+ font-family: 'Consolas', monospace;
68
+ }
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ @use '../base.scss';
7
+ @use '../colors.scss';
8
+ @use '../functions.scss' as *;
9
+
10
+ $bg-map: colors.$bg-map !default;
11
+ $fg-map: colors.$fg-map !default;
12
+ $ring-color: #6a96c9 !default;
13
+ $knob-color: #333333 !default;
14
+ $popup-background-color: #000000 !default;
15
+ $popup-text-color: #ffffff !default;
16
+
17
+ $inner-padding: 0.1em;
18
+
19
+ .Knob {
20
+ position: relative;
21
+ font-size: 1rem;
22
+ width: 2.6em;
23
+ height: 2.6em;
24
+ margin: 0 auto;
25
+ margin-bottom: -0.2em;
26
+ cursor: n-resize;
27
+
28
+ // Adjusts a baseline in a way, that makes knob middle-aligned
29
+ // when it flows with the text.
30
+ &:after {
31
+ content: '.';
32
+ color: transparent;
33
+ line-height: 2.5em;
34
+ }
35
+ }
36
+
37
+ .Knob__circle {
38
+ position: absolute;
39
+ top: $inner-padding;
40
+ bottom: $inner-padding;
41
+ left: $inner-padding;
42
+ right: $inner-padding;
43
+ margin: 0.3em;
44
+ background-color: $knob-color;
45
+ background-image: linear-gradient(
46
+ to bottom,
47
+ rgba(255, 255, 255, 0.15) 0%,
48
+ rgba(255, 255, 255, 0) 100%
49
+ );
50
+ border-radius: 50%;
51
+ box-shadow: 0 0.05em 0.5em 0 rgba(0, 0, 0, 0.5);
52
+ }
53
+
54
+ .Knob__cursorBox {
55
+ position: absolute;
56
+ top: 0;
57
+ bottom: 0;
58
+ left: 0;
59
+ right: 0;
60
+ }
61
+
62
+ .Knob__cursor {
63
+ position: relative;
64
+ top: 0.05em;
65
+ margin: 0 auto;
66
+ width: 0.2em;
67
+ height: 0.8em;
68
+ background-color: rgba(255, 255, 255, 0.9);
69
+ }
70
+
71
+ .Knob__popupValue {
72
+ position: absolute;
73
+ top: -2rem;
74
+ right: 50%;
75
+ font-size: 1rem;
76
+ text-align: center;
77
+ padding: 0.25rem 0.5rem;
78
+ color: $popup-text-color;
79
+ background-color: $popup-background-color;
80
+ transform: translateX(50%);
81
+ white-space: nowrap;
82
+ }
83
+
84
+ .Knob__ring {
85
+ position: absolute;
86
+ top: 0;
87
+ bottom: 0;
88
+ left: 0;
89
+ right: 0;
90
+ padding: $inner-padding;
91
+ }
92
+
93
+ $pi: 3.1416;
94
+
95
+ .Knob__ringTrackPivot {
96
+ transform: rotateZ(135deg);
97
+ }
98
+
99
+ .Knob__ringTrack {
100
+ // transform-origin: 50% 50%;
101
+ fill: transparent;
102
+ stroke: rgba(255, 255, 255, 0.1);
103
+ stroke-width: 8;
104
+ stroke-linecap: round;
105
+ stroke-dasharray: 75 * $pi;
106
+ }
107
+
108
+ .Knob__ringFillPivot {
109
+ transform: rotateZ(135deg);
110
+ }
111
+
112
+ .Knob--bipolar .Knob__ringFillPivot {
113
+ transform: rotateZ(270deg);
114
+ }
115
+
116
+ .Knob__ringFill {
117
+ fill: transparent;
118
+ stroke: $ring-color;
119
+ stroke-width: 8;
120
+ stroke-linecap: round;
121
+ stroke-dasharray: 100 * $pi;
122
+ transition: stroke 50ms ease-out;
123
+ }
124
+
125
+ @each $color-name, $color-value in $fg-map {
126
+ .Knob--color--#{$color-name} {
127
+ .Knob__ringFill {
128
+ stroke: $color-value;
129
+ }
130
+ }
131
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright (c) 2020 Aleksej Komarov
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ @use '../base.scss';
7
+
8
+ .LabeledList {
9
+ display: table;
10
+ // IE8: Does not support calc
11
+ width: 100%;
12
+ // Compensate for negative margin
13
+ width: calc(100% + 1em);
14
+ border-collapse: collapse;
15
+ border-spacing: 0;
16
+ margin: -0.25em -0.5em;
17
+ margin-bottom: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ .LabeledList__row {
22
+ display: table-row;
23
+ }
24
+
25
+ .LabeledList__row:last-child .LabeledList__cell {
26
+ padding-bottom: 0;
27
+ }
28
+
29
+ .LabeledList__cell {
30
+ display: table-cell;
31
+ margin: 0;
32
+ padding: 0.25em 0.5em;
33
+ border: 0;
34
+ text-align: left;
35
+ }
36
+
37
+ .LabeledList__label--nowrap {
38
+ width: 1%;
39
+ white-space: nowrap;
40
+ min-width: 5em;
41
+ }
42
+
43
+ .LabeledList__buttons {
44
+ width: 0.1%;
45
+ white-space: nowrap;
46
+ text-align: right;
47
+ padding-top: base.em(1px);
48
+ padding-bottom: 0;
49
+ }