tgui-core 1.7.0 → 1.7.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.
@@ -0,0 +1,273 @@
1
+ /**
2
+ * @file
3
+ * @copyright 2024 Aylong (https://github.com/AyIong)
4
+ * @license MIT
5
+ */
6
+
7
+ @use "../base";
8
+ @use "../colors";
9
+ @use "../functions" as *;
10
+
11
+ $color-default: colors.bg(base.$color-bg-section) !default;
12
+ $color-disabled: hsl(0, 54.7%, 25.1%) !default;
13
+ $color-selected: colors.bg(colors.$green) !default;
14
+ $color-divider: rgba(255, 255, 255, 0.1) !default;
15
+ $divider-thickness: base.em(2px) !default;
16
+ $bg-map: colors.$bg-map !default;
17
+
18
+ @mixin button-style(
19
+ $color,
20
+ $border-color: rgba(lighten($color, 50%), 0.2),
21
+ $border-width: 1px 0 0 0,
22
+ $opacity: 0.2,
23
+ $hoverable: true,
24
+ $transition-duration: 0.2s
25
+ ) {
26
+ $luminance: luminance($color);
27
+ $text-color: if($luminance > 0.3, rgba(0, 0, 0, 1), rgba(255, 255, 255, 1));
28
+
29
+ background-color: rgba($color, $opacity);
30
+ color: $text-color;
31
+ border: solid $border-color;
32
+ border-width: $border-width;
33
+ transition:
34
+ background-color $transition-duration,
35
+ border-color $transition-duration;
36
+
37
+ @if $hoverable {
38
+ &:hover {
39
+ background-color: rgba(lighten($color, 50%), $opacity);
40
+ }
41
+ }
42
+ }
43
+
44
+ @each $color-name, $color-value in $bg-map {
45
+ .ImageButton--color__#{$color-name} {
46
+ @include button-style($color-value, $border-width: 1px);
47
+ }
48
+
49
+ .ImageButton--contentColor__#{$color-name} {
50
+ @include button-style(
51
+ $color-value,
52
+ $border-color: lighten($color-value, 25%),
53
+ $opacity: 1,
54
+ $hoverable: false
55
+ );
56
+ }
57
+
58
+ .ImageButton--buttonsContainerColor__#{$color-name} {
59
+ @include button-style(
60
+ $color-value,
61
+ $border-width: 1px 1px 1px 0,
62
+ $opacity: 0.33,
63
+ $hoverable: false,
64
+ $transition-duration: 0
65
+ );
66
+ }
67
+ }
68
+
69
+ .ImageButton--color__default {
70
+ @include button-style(lighten($color-default, 85%), $border-width: 1px);
71
+ }
72
+
73
+ .ImageButton--disabled {
74
+ background-color: rgba($color-disabled, 0.25) !important;
75
+ border-color: rgba($color-disabled, 0.25) !important;
76
+ }
77
+
78
+ .ImageButton--selected {
79
+ @include button-style(
80
+ $color-selected,
81
+ $border-color: rgba($color-selected, 0.25),
82
+ $border-width: 1px
83
+ );
84
+ }
85
+
86
+ .ImageButton--contentColor__default {
87
+ @include button-style(
88
+ lighten($color-default, 80%),
89
+ $border-color: lighten($color-default, 100%),
90
+ $opacity: 1,
91
+ $hoverable: false
92
+ );
93
+ }
94
+
95
+ .ImageButton--contentDisabled {
96
+ background-color: $color-disabled !important;
97
+ border-top: 1px solid lighten($color-disabled, 25%) !important;
98
+ }
99
+
100
+ .ImageButton--contentSelected {
101
+ @include button-style(
102
+ $color-selected,
103
+ $border-color: lighten($color-selected, 25%),
104
+ $opacity: 1,
105
+ $hoverable: false
106
+ );
107
+ }
108
+
109
+ .ImageButton--buttonsContainerColor__default {
110
+ @include button-style(
111
+ lighten($color-default, 85%),
112
+ $border-width: 1px 1px 1px 0,
113
+ $hoverable: false,
114
+ $transition-duration: 0
115
+ );
116
+ }
117
+
118
+ .ImageButton {
119
+ /* Better replace via inline-flex after Byond 516 will be stable */
120
+ display: inline-table;
121
+ position: relative;
122
+ text-align: center;
123
+ margin: 0.25em;
124
+ user-select: none;
125
+ -ms-user-select: none;
126
+
127
+ .noAction {
128
+ pointer-events: none;
129
+ }
130
+
131
+ .container {
132
+ display: flex;
133
+ flex-direction: column;
134
+ border-radius: 0.33em;
135
+ }
136
+
137
+ .image {
138
+ position: relative;
139
+ align-self: center;
140
+ pointer-events: none;
141
+ overflow: hidden;
142
+ line-height: 0;
143
+ padding: 0.25em;
144
+ border-radius: 0.33em;
145
+ }
146
+
147
+ .buttonsContainer {
148
+ display: flex;
149
+ position: absolute;
150
+ overflow: hidden;
151
+ left: 1px;
152
+ bottom: 1.8em;
153
+ max-width: 100%;
154
+ z-index: 1;
155
+
156
+ &.buttonsAltContainer {
157
+ overflow: visible;
158
+ flex-direction: column;
159
+ pointer-events: none;
160
+ top: 1px;
161
+ bottom: inherit !important;
162
+ }
163
+
164
+ &.buttonsEmpty {
165
+ bottom: 1px;
166
+ }
167
+
168
+ & > * {
169
+ /* I know !important is bad, but here's no other way */
170
+ margin: 0 !important;
171
+ padding: 0 0.2em !important;
172
+ border-radius: 0 !important;
173
+ }
174
+ }
175
+
176
+ .content {
177
+ -ms-user-select: none;
178
+ user-select: none;
179
+ overflow: hidden;
180
+ text-overflow: ellipsis;
181
+ white-space: nowrap;
182
+ padding: 0.25em 0.33em;
183
+ margin: -1px;
184
+ border-radius: 0 0 0.33em 0.33em;
185
+ z-index: 2;
186
+ }
187
+ }
188
+
189
+ .ImageButton--fluid {
190
+ display: flex;
191
+ flex-direction: row;
192
+ position: relative;
193
+ text-align: center;
194
+ margin: 0 0 0.33em 0;
195
+ user-select: none;
196
+ -ms-user-select: none;
197
+
198
+ &:last-child {
199
+ margin-bottom: 0;
200
+ }
201
+
202
+ .info {
203
+ display: flex;
204
+ flex-direction: column;
205
+ justify-content: center;
206
+ flex: 1;
207
+ }
208
+
209
+ .title {
210
+ font-weight: bold;
211
+ padding: 0.5em;
212
+
213
+ &.divider {
214
+ margin: 0 0.5em;
215
+ border-bottom: $divider-thickness solid $color-divider;
216
+ }
217
+ }
218
+
219
+ .contentFluid {
220
+ padding: 0.5em;
221
+ color: white;
222
+ }
223
+
224
+ .container {
225
+ flex-direction: row;
226
+ flex: 1;
227
+
228
+ &.hasButtons {
229
+ border-radius: 0.33em 0 0 0.33em;
230
+ border-width: 1px 0 1px 1px;
231
+ }
232
+ }
233
+
234
+ .image {
235
+ padding: 0;
236
+ }
237
+
238
+ .buttonsContainer {
239
+ position: relative;
240
+ left: inherit;
241
+ bottom: inherit;
242
+ border-radius: 0 0.33em 0.33em 0;
243
+
244
+ &.buttonsEmpty {
245
+ bottom: inherit;
246
+ }
247
+
248
+ &.buttonsAltContainer {
249
+ overflow: hidden;
250
+ pointer-events: auto;
251
+ top: inherit;
252
+
253
+ & > * {
254
+ border-top: 1px solid rgba(255, 255, 255, 0.075);
255
+
256
+ &:first-child {
257
+ border-top: 0;
258
+ }
259
+ }
260
+ }
261
+
262
+ & > * {
263
+ display: inline-flex;
264
+ flex-direction: column;
265
+ justify-content: center;
266
+ text-align: center;
267
+ white-space: pre-wrap;
268
+ line-height: base.em(14px);
269
+ height: 100%;
270
+ border-left: 1px solid rgba(255, 255, 255, 0.075);
271
+ }
272
+ }
273
+ }
@@ -0,0 +1,63 @@
1
+ @use "../base";
2
+ @use "../functions" as *;
3
+
4
+ $text-color: base.$color-fg !default;
5
+ $background-color: hsl(0, 0%, 3.9%) !default;
6
+ $border-color: hsl(212.3, 100%, 76.7%) !default;
7
+ $border-radius: base.$border-radius !default;
8
+
9
+ .Input {
10
+ position: relative;
11
+ display: inline-block;
12
+ width: base.em(120px);
13
+ border: base.em(1px) solid $border-color;
14
+ border: base.em(1px) solid rgba($border-color, 0.75);
15
+ border-radius: $border-radius;
16
+ color: $text-color;
17
+ background-color: $background-color;
18
+ padding: 0 base.em(4px);
19
+ margin-right: base.em(2px);
20
+ line-height: base.em(17px);
21
+ overflow: visible;
22
+ }
23
+
24
+ .Input--fluid {
25
+ display: block;
26
+ width: auto;
27
+ }
28
+
29
+ .Input__baseline {
30
+ display: inline-block;
31
+ color: transparent;
32
+ }
33
+
34
+ .Input__input {
35
+ display: block;
36
+ position: absolute;
37
+ top: 0;
38
+ bottom: 0;
39
+ left: 0;
40
+ right: 0;
41
+ border: 0;
42
+ outline: 0;
43
+ width: 100%;
44
+ font-size: base.em(12px);
45
+ line-height: base.em(17px);
46
+ height: base.em(17px);
47
+ margin: 0;
48
+ padding: 0 0.5em;
49
+ font-family: Verdana, sans-serif;
50
+ background-color: transparent;
51
+ color: $text-color;
52
+ color: inherit;
53
+
54
+ &:-ms-input-placeholder {
55
+ font-style: italic;
56
+ color: hsl(0, 0%, 46.7%);
57
+ color: hsla(0, 0%, 100%, 0.45);
58
+ }
59
+ }
60
+
61
+ .Input--monospace .Input__input {
62
+ font-family: "Consolas", monospace;
63
+ }
@@ -0,0 +1,126 @@
1
+ @use "../base";
2
+ @use "../colors";
3
+ @use "../functions" as *;
4
+
5
+ $bg-map: colors.$bg-map !default;
6
+ $fg-map: colors.$fg-map !default;
7
+ $ring-color: hsl(212.2, 46.8%, 60.2%) !default;
8
+ $knob-color: hsl(0, 0%, 20%) !default;
9
+ $popup-background-color: hsl(0, 0%, 0%) !default;
10
+ $popup-text-color: hsl(0, 0%, 100%) !default;
11
+
12
+ $inner-padding: 0.1em;
13
+
14
+ .Knob {
15
+ position: relative;
16
+ font-size: 1rem;
17
+ width: 2.6em;
18
+ height: 2.6em;
19
+ margin: 0 auto;
20
+ margin-bottom: -0.2em;
21
+ cursor: n-resize;
22
+
23
+ // Adjusts a baseline in a way, that makes knob middle-aligned
24
+ // when it flows with the text.
25
+ &:after {
26
+ content: ".";
27
+ color: transparent;
28
+ line-height: 2.5em;
29
+ }
30
+ }
31
+
32
+ .Knob__circle {
33
+ position: absolute;
34
+ top: $inner-padding;
35
+ bottom: $inner-padding;
36
+ left: $inner-padding;
37
+ right: $inner-padding;
38
+ margin: 0.3em;
39
+ background-color: $knob-color;
40
+ background-image: linear-gradient(
41
+ to bottom,
42
+ rgba(255, 255, 255, 0.15) 0%,
43
+ rgba(255, 255, 255, 0) 100%
44
+ );
45
+ border-radius: 50%;
46
+ box-shadow: 0 0.05em 0.5em 0 rgba(0, 0, 0, 0.5);
47
+ }
48
+
49
+ .Knob__cursorBox {
50
+ position: absolute;
51
+ top: 0;
52
+ bottom: 0;
53
+ left: 0;
54
+ right: 0;
55
+ }
56
+
57
+ .Knob__cursor {
58
+ position: relative;
59
+ top: 0.05em;
60
+ margin: 0 auto;
61
+ width: 0.2em;
62
+ height: 0.8em;
63
+ background-color: rgba(255, 255, 255, 0.9);
64
+ }
65
+
66
+ .Knob__popupValue {
67
+ position: absolute;
68
+ top: -2rem;
69
+ right: 50%;
70
+ font-size: 1rem;
71
+ text-align: center;
72
+ padding: 0.25rem 0.5rem;
73
+ color: $popup-text-color;
74
+ background-color: $popup-background-color;
75
+ transform: translateX(50%);
76
+ white-space: nowrap;
77
+ }
78
+
79
+ .Knob__ring {
80
+ position: absolute;
81
+ top: 0;
82
+ bottom: 0;
83
+ left: 0;
84
+ right: 0;
85
+ padding: $inner-padding;
86
+ }
87
+
88
+ $pi: 3.1416;
89
+
90
+ .Knob__ringTrackPivot {
91
+ transform: rotateZ(135deg);
92
+ }
93
+
94
+ .Knob__ringTrack {
95
+ // transform-origin: 50% 50%;
96
+ fill: transparent;
97
+ stroke: rgba(255, 255, 255, 0.1);
98
+ stroke-width: 8;
99
+ stroke-linecap: round;
100
+ stroke-dasharray: 75 * $pi;
101
+ }
102
+
103
+ .Knob__ringFillPivot {
104
+ transform: rotateZ(135deg);
105
+ }
106
+
107
+ .Knob--bipolar .Knob__ringFillPivot {
108
+ transform: rotateZ(270deg);
109
+ }
110
+
111
+ .Knob__ringFill {
112
+ fill: transparent;
113
+ stroke: $ring-color;
114
+ stroke-width: 8;
115
+ stroke-linecap: round;
116
+ stroke-dasharray: 100 * $pi;
117
+ transition: stroke 50ms ease-out;
118
+ }
119
+
120
+ @each $color-name, $color-value in $fg-map {
121
+ .Knob--color--#{$color-name} {
122
+ .Knob__ringFill {
123
+ stroke: $color-value;
124
+ }
125
+ }
126
+ }
@@ -0,0 +1,44 @@
1
+ @use "../base";
2
+
3
+ .LabeledList {
4
+ display: table;
5
+ // IE8: Does not support calc
6
+ width: 100%;
7
+ // Compensate for negative margin
8
+ width: calc(100% + 1em);
9
+ border-collapse: collapse;
10
+ border-spacing: 0;
11
+ margin: -0.25em -0.5em;
12
+ margin-bottom: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ .LabeledList__row {
17
+ display: table-row;
18
+ }
19
+
20
+ .LabeledList__row:last-child .LabeledList__cell {
21
+ padding-bottom: 0;
22
+ }
23
+
24
+ .LabeledList__cell {
25
+ display: table-cell;
26
+ margin: 0;
27
+ padding: 0.25em 0.5em;
28
+ border: 0;
29
+ text-align: left;
30
+ }
31
+
32
+ .LabeledList__label--nowrap {
33
+ width: 1%;
34
+ white-space: nowrap;
35
+ min-width: 5em;
36
+ }
37
+
38
+ .LabeledList__buttons {
39
+ width: 0.1%;
40
+ white-space: nowrap;
41
+ text-align: right;
42
+ padding-top: base.em(1px);
43
+ padding-bottom: 0;
44
+ }
@@ -0,0 +1,71 @@
1
+ @use "sass:color";
2
+ @use "../base";
3
+
4
+ $separator-color: base.$color-bg-section;
5
+ $background-color: base.$color-bg !default;
6
+ $dropdown-z-index: 5;
7
+
8
+ .MenuBar {
9
+ display: flex;
10
+ }
11
+
12
+ .MenuBar__font {
13
+ font-family: Verdana, sans-serif;
14
+ font-size: base.em(12px);
15
+ line-height: base.em(17px);
16
+ }
17
+
18
+ .MenuBar__hover {
19
+ &:hover {
20
+ background-color: color.adjust($background-color, $lightness: 30%);
21
+ transition: background-color 0ms;
22
+ }
23
+ }
24
+
25
+ .MenuBar__MenuBarButton {
26
+ padding: 0.2rem 0.5rem 0.2rem 0.5rem;
27
+ }
28
+
29
+ .MenuBar__menu {
30
+ position: absolute;
31
+ z-index: $dropdown-z-index;
32
+ background-color: $background-color;
33
+ padding: 0.3rem 0.3rem 0.3rem 0.3rem;
34
+ box-shadow: 4px 6px 5px -2px rgba(0, 0, 0, 0.55);
35
+ }
36
+
37
+ .MenuBar__MenuItem {
38
+ z-index: $dropdown-z-index;
39
+ transition: background-color 100ms ease-out;
40
+ background-color: $background-color;
41
+ white-space: nowrap;
42
+ padding: 0.3rem 2rem 0.3rem 3rem;
43
+ }
44
+
45
+ .MenuBar__MenuItemToggle {
46
+ padding: 0.3rem 2rem 0.3rem 0;
47
+ }
48
+
49
+ .MenuBar__MenuItemToggle__check {
50
+ display: inline-block;
51
+ vertical-align: middle;
52
+ min-width: 3rem;
53
+ margin-left: 0.3rem;
54
+ }
55
+
56
+ .MenuBar__over {
57
+ top: auto;
58
+ bottom: 100%;
59
+ }
60
+
61
+ .MenuBar__MenuBarButton-text {
62
+ text-overflow: clip;
63
+ white-space: nowrap;
64
+ height: base.em(17px);
65
+ }
66
+
67
+ .MenuBar__Separator {
68
+ display: block;
69
+ margin: 0.3rem 0.3rem 0.3rem 2.3rem;
70
+ border-top: 1px solid $separator-color;
71
+ }
@@ -0,0 +1,9 @@
1
+ @use "../base";
2
+
3
+ $background-color: base.$color-bg !default;
4
+
5
+ .Modal {
6
+ background-color: $background-color;
7
+ max-width: calc(100% - 1rem);
8
+ padding: 1rem;
9
+ }
@@ -0,0 +1,60 @@
1
+ @use "sass:color";
2
+ @use "../base";
3
+ @use "../colors";
4
+ @use "../functions" as *;
5
+
6
+ // NoticeBox
7
+ $background-color: hsl(36.9, 37.9%, 57.1%) !default;
8
+ $color-stripes: rgba(0, 0, 0, 0.1) !default;
9
+ $color-border: hsl(0, 0%, 15.3%) !default;
10
+ $bg-map: colors.$bg-map !default;
11
+
12
+ .NoticeBox {
13
+ // Adapt text color to background luminance to ensure high contast
14
+ $luminance: luminance($background-color);
15
+ $text-color: if($luminance > 0.35, rgba(0, 0, 0, 1), rgba(255, 255, 255, 1));
16
+
17
+ padding: 0.33em 0.5em;
18
+ margin-bottom: 0.5em;
19
+ box-shadow: none;
20
+ font-weight: bold;
21
+ font-style: italic;
22
+ color: $text-color;
23
+ background-color: $background-color;
24
+ background-image: repeating-linear-gradient(
25
+ -45deg,
26
+ transparent,
27
+ transparent base.em(10px),
28
+ $color-stripes base.em(10px),
29
+ $color-stripes base.em(20px)
30
+ );
31
+ }
32
+
33
+ @mixin box-color($color) {
34
+ $luminance: luminance($color);
35
+ $text-color: if($luminance > 0.35, rgba(0, 0, 0, 1), rgba(255, 255, 255, 1));
36
+ color: $text-color;
37
+ background-color: color.adjust($color, $saturation: -15%, $lightness: -15%);
38
+ }
39
+
40
+ @each $color-name, $color-value in $bg-map {
41
+ .NoticeBox--color--#{$color-name} {
42
+ @include box-color($color-value);
43
+ }
44
+ }
45
+
46
+ .NoticeBox--type--info {
47
+ @include box-color(colors.$blue);
48
+ }
49
+
50
+ .NoticeBox--type--success {
51
+ @include box-color(colors.$green);
52
+ }
53
+
54
+ .NoticeBox--type--warning {
55
+ @include box-color(colors.$orange);
56
+ }
57
+
58
+ .NoticeBox--type--danger {
59
+ @include box-color(colors.$red);
60
+ }
@@ -0,0 +1,71 @@
1
+ @use "sass:color";
2
+ @use "../base";
3
+ @use "../functions" as *;
4
+ @use "./Input";
5
+
6
+ $text-color: Input.$text-color !default;
7
+ $background-color: Input.$background-color !default;
8
+ $border-color: Input.$border-color !default;
9
+ $border-radius: Input.$border-radius !default;
10
+
11
+ .NumberInput {
12
+ position: relative;
13
+ display: inline-block;
14
+ border: base.em(1px) solid $border-color;
15
+ border: base.em(1px) solid rgba($border-color, 0.75);
16
+ border-radius: $border-radius;
17
+ color: $border-color;
18
+ background-color: $background-color;
19
+ padding: 0 base.em(4px);
20
+ margin-right: base.em(2px);
21
+ line-height: base.em(17px);
22
+ text-align: right;
23
+ overflow: visible;
24
+ cursor: n-resize;
25
+ }
26
+
27
+ .NumberInput--fluid {
28
+ display: block;
29
+ }
30
+
31
+ .NumberInput__content {
32
+ margin-left: 0.5em;
33
+ }
34
+
35
+ .NumberInput__barContainer {
36
+ position: absolute;
37
+ top: base.em(2px);
38
+ bottom: base.em(2px);
39
+ left: base.em(2px);
40
+ }
41
+
42
+ .NumberInput__bar {
43
+ position: absolute;
44
+ bottom: 0;
45
+ left: 0;
46
+ width: base.em(3px);
47
+ box-sizing: border-box;
48
+ border-bottom: base.em(1px) solid $border-color;
49
+ background-color: $border-color;
50
+ }
51
+
52
+ .NumberInput__input {
53
+ display: block;
54
+ position: absolute;
55
+ top: 0;
56
+ bottom: 0;
57
+ left: 0;
58
+ right: 0;
59
+ border: 0;
60
+ outline: 0;
61
+ width: 100%;
62
+ font-size: base.em(12px);
63
+ line-height: base.em(17px);
64
+ height: base.em(17px);
65
+ margin: 0;
66
+ padding: 0 0.5em;
67
+ font-family: Verdana, sans-serif;
68
+ background-color: $background-color;
69
+ color: $text-color;
70
+ text-align: right;
71
+ }