tgui-core 4.0.3 → 4.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 (107) hide show
  1. package/README.md +7 -0
  2. package/dist/common/constants.d.ts +1 -1
  3. package/dist/common/constants.js +1 -1
  4. package/dist/common/events.js +1 -1
  5. package/dist/common/fuzzysearch.js +1 -1
  6. package/dist/common/hotkeys.js +1 -1
  7. package/dist/common/random.js +1 -1
  8. package/dist/common/ui.js +1 -1
  9. package/dist/common/uuid.js +1 -1
  10. package/dist/common/vector.js +1 -1
  11. package/dist/components/AnimatedNumber.d.ts +2 -42
  12. package/dist/components/AnimatedNumber.js +1 -1
  13. package/dist/components/Autofocus.js +1 -1
  14. package/dist/components/Blink.js +1 -1
  15. package/dist/components/BlockQuote.js +1 -1
  16. package/dist/components/Box.d.ts +2 -2
  17. package/dist/components/Box.js +1 -1
  18. package/dist/components/Button.d.ts +1 -1
  19. package/dist/components/Button.js +1 -1
  20. package/dist/components/ByondUi.js +1 -1
  21. package/dist/components/Chart.js +1 -1
  22. package/dist/components/Collapsible.js +1 -1
  23. package/dist/components/ColorBox.js +1 -1
  24. package/dist/components/Dialog.js +1 -1
  25. package/dist/components/Dimmer.js +1 -1
  26. package/dist/components/Divider.js +1 -1
  27. package/dist/components/DmIcon.js +1 -1
  28. package/dist/components/DraggableControl.d.ts +4 -1
  29. package/dist/components/DraggableControl.js +1 -1
  30. package/dist/components/Dropdown.d.ts +2 -0
  31. package/dist/components/Dropdown.js +1 -1
  32. package/dist/components/FitText.js +1 -1
  33. package/dist/components/Flex.d.ts +1 -1
  34. package/dist/components/Flex.js +1 -1
  35. package/dist/components/Floating.d.ts +2 -1
  36. package/dist/components/Floating.js +1 -1
  37. package/dist/components/Icon.d.ts +1 -1
  38. package/dist/components/Icon.js +1 -1
  39. package/dist/components/Image.d.ts +7 -1
  40. package/dist/components/Image.js +1 -1
  41. package/dist/components/ImageButton.d.ts +1 -1
  42. package/dist/components/ImageButton.js +1 -1
  43. package/dist/components/InfinitePlane.js +1 -1
  44. package/dist/components/Input.js +1 -1
  45. package/dist/components/KeyListener.d.ts +1 -1
  46. package/dist/components/KeyListener.js +1 -1
  47. package/dist/components/Knob.d.ts +5 -5
  48. package/dist/components/Knob.js +1 -1
  49. package/dist/components/LabeledControls.js +1 -1
  50. package/dist/components/LabeledList.d.ts +1 -1
  51. package/dist/components/LabeledList.js +1 -1
  52. package/dist/components/MenuBar.js +1 -1
  53. package/dist/components/Modal.d.ts +2 -3
  54. package/dist/components/Modal.js +1 -1
  55. package/dist/components/NoticeBox.js +1 -1
  56. package/dist/components/NumberInput.d.ts +3 -3
  57. package/dist/components/NumberInput.js +1 -1
  58. package/dist/components/Popper.js +1 -1
  59. package/dist/components/ProgressBar.js +1 -1
  60. package/dist/components/RestrictedInput.js +1 -1
  61. package/dist/components/RoundGauge.js +1 -1
  62. package/dist/components/Section.js +1 -1
  63. package/dist/components/Slider.d.ts +4 -4
  64. package/dist/components/Slider.js +1 -1
  65. package/dist/components/Stack.js +1 -1
  66. package/dist/components/StyleableSection.js +1 -1
  67. package/dist/components/Table.js +1 -1
  68. package/dist/components/Tabs.js +1 -1
  69. package/dist/components/TextArea.js +1 -1
  70. package/dist/components/TimeDisplay.js +1 -1
  71. package/dist/components/Tooltip.js +1 -1
  72. package/dist/components/TrackOutsideClicks.js +1 -1
  73. package/dist/components/VirtualList.js +1 -1
  74. package/dist/components/index.js +1 -1
  75. package/package.json +15 -20
  76. package/styles/atomic/candystripe.scss +8 -0
  77. package/styles/atomic/centered-image.scss +7 -0
  78. package/styles/atomic/color.scss +17 -0
  79. package/styles/atomic/debug-layout.scss +12 -0
  80. package/styles/atomic/fit-text.scss +15 -0
  81. package/styles/atomic/links.scss +21 -0
  82. package/styles/atomic/outline.scss +43 -0
  83. package/styles/atomic/text.scss +39 -0
  84. package/styles/atomic.scss +11 -0
  85. package/styles/components/BlockQuote.scss +0 -2
  86. package/styles/components/Button.scss +83 -84
  87. package/styles/components/Dimmer.scss +0 -2
  88. package/styles/components/Divider.scss +0 -5
  89. package/styles/components/Dropdown.scss +8 -0
  90. package/styles/components/ImageButton.scss +104 -102
  91. package/styles/components/Input.scss +4 -1
  92. package/styles/components/Knob.scss +5 -21
  93. package/styles/components/LabeledList.scss +0 -2
  94. package/styles/components/NoticeBox.scss +15 -21
  95. package/styles/components/NumberInput.scss +1 -9
  96. package/styles/components/ProgressBar.scss +27 -48
  97. package/styles/components/RestrictedInput.scss +3 -0
  98. package/styles/components/RoundGauge.scss +8 -13
  99. package/styles/components/Section.scss +0 -7
  100. package/styles/components/Slider.scss +49 -42
  101. package/styles/components/Tabs.scss +1 -12
  102. package/styles/components/TextArea.scss +3 -0
  103. package/styles/components/Tooltip.scss +0 -4
  104. package/styles/functions.scss +10 -0
  105. package/styles/main.scss +0 -1
  106. package/styles/reset.scss +1 -0
  107. package/styles/vars-components.scss +5 -2
@@ -0,0 +1,15 @@
1
+ $mqIterations: 19;
2
+ @mixin fontResize($iterations) {
3
+ $i: 1;
4
+ @while $i <= $iterations {
5
+ $minWidth: 100px * $i;
6
+ @media all and (min-width: $minWidth) {
7
+ .fit-text {
8
+ font-size: 0.1em * $i;
9
+ }
10
+ }
11
+ $i: $i + 1;
12
+ }
13
+ }
14
+
15
+ @include fontResize($mqIterations);
@@ -0,0 +1,21 @@
1
+ a {
2
+ cursor: var(--cursor-pointer);
3
+ color: var(--color-hyperlink);
4
+ transition: color var(--transition-time-medium);
5
+
6
+ &:hover,
7
+ &:active {
8
+ color: hsl(from var(--color-hyperlink) h s calc(l + var(--adjust-hover)));
9
+ }
10
+
11
+ &:visited {
12
+ color: var(--color-hyperlink-visited);
13
+
14
+ &:hover,
15
+ &:active {
16
+ color: hsl(
17
+ from var(--color-hyperlink-visited) h s calc(l + var(--adjust-hover))
18
+ );
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,43 @@
1
+ @use "../colors.scss";
2
+
3
+ .outline-dotted {
4
+ outline-style: dotted !important;
5
+ }
6
+
7
+ .outline-dashed {
8
+ outline-style: dashed !important;
9
+ }
10
+
11
+ .outline-solid {
12
+ outline-style: solid !important;
13
+ }
14
+
15
+ .outline-double {
16
+ outline-style: double !important;
17
+ }
18
+
19
+ .outline-groove {
20
+ outline-style: groove !important;
21
+ }
22
+
23
+ .outline-ridge {
24
+ outline-style: ridge !important;
25
+ }
26
+
27
+ .outline-inset {
28
+ outline-style: inset !important;
29
+ }
30
+
31
+ .outline-outset {
32
+ outline-style: outset !important;
33
+ }
34
+
35
+ $map-keys: colors.$color-map !default;
36
+
37
+ @each $color-name, $color-value in $map-keys {
38
+ .outline-color-#{$color-name} {
39
+ outline: var(--border-thickness-small)
40
+ solid
41
+ hsl(from $color-value h s calc(l + var(--adjust-color))) !important;
42
+ }
43
+ }
@@ -0,0 +1,39 @@
1
+ .text-left {
2
+ text-align: left;
3
+ }
4
+
5
+ .text-center {
6
+ text-align: center;
7
+ }
8
+
9
+ .text-right {
10
+ text-align: right;
11
+ }
12
+
13
+ .text-baseline {
14
+ text-align: baseline;
15
+ }
16
+
17
+ .text-justify {
18
+ text-align: justify;
19
+ }
20
+
21
+ .text-nowrap {
22
+ white-space: nowrap;
23
+ }
24
+
25
+ .text-pre {
26
+ white-space: pre;
27
+ }
28
+
29
+ .text-bold {
30
+ font-weight: bold;
31
+ }
32
+
33
+ .text-italic {
34
+ font-style: italic;
35
+ }
36
+
37
+ .text-underline {
38
+ text-decoration: underline;
39
+ }
@@ -0,0 +1,11 @@
1
+ @use "sass:meta";
2
+
3
+ // Loads in all atomic styles
4
+ @include meta.load-css("./atomic/candystripe.scss");
5
+ @include meta.load-css("./atomic/centered-image.scss");
6
+ @include meta.load-css("./atomic/color.scss");
7
+ @include meta.load-css("./atomic/debug-layout.scss");
8
+ @include meta.load-css("./atomic/fit-text.scss");
9
+ @include meta.load-css("./atomic/links.scss");
10
+ @include meta.load-css("./atomic/outline.scss");
11
+ @include meta.load-css("./atomic/text.scss");
@@ -1,5 +1,3 @@
1
- $color-default: 0 !default;
2
-
3
1
  .BlockQuote {
4
2
  color: var(--blockquote-color);
5
3
  border-left: var(--blockquote-border);
@@ -1,60 +1,69 @@
1
1
  @use "../base";
2
2
  @use "../colors";
3
3
 
4
- $bg-map: colors.$color-map !default;
5
- $fg-map: colors.$color-map !default;
4
+ @mixin button-color() {
5
+ --button-background: hsl(from var(--color) h s calc(l - var(--adjust-color)));
6
+ cursor: var(--cursor-pointer);
7
+ background-color: var(--button-background);
8
+ color: var(--button-color);
9
+ transition-property: background-color, color, opacity;
10
+ transition-duration: var(--button-transition);
11
+ transition-timing-function: var(--button-transition-timing);
12
+ // Disable selection in buttons
13
+ user-select: none;
6
14
 
7
- $color-default: 0 !default;
8
- $color-selected: 0 !default;
9
- $color-caution: 0 !default;
10
- $color-danger: 0 !default;
11
- $color-transparent-text: 0 !default;
12
- $border-radius: 0 !default;
15
+ &:hover {
16
+ background-color: hsl(
17
+ from var(--button-background) h s calc(l + var(--adjust-hover))
18
+ );
19
+ color: var(--button-color);
20
+ }
13
21
 
14
- @mixin button-color($color, $text-color: var(--color-text-fixed-white)) {
15
- cursor: var(--cursor-pointer);
16
- background-color: hsl(from $color h s calc(l - var(--adjust-color)));
17
- color: $text-color;
18
-
19
- &:not(.Button--disabled) {
20
- &:hover {
21
- background-color: hsl(
22
- from $color h s
23
- calc(calc(l - var(--adjust-color)) + var(--adjust-hover))
24
- );
25
- color: $text-color;
26
- }
22
+ &:active {
23
+ background-color: hsl(
24
+ from var(--button-background) h s calc(l - var(--adjust-active))
25
+ );
26
+ color: var(--button-color);
27
+ transition: none;
28
+ }
29
+ }
27
30
 
28
- &:active {
29
- background-color: hsl(
30
- from $color h s
31
- calc(calc(l - var(--adjust-color)) - var(--adjust-active))
32
- );
33
- color: $text-color;
34
- }
31
+ @mixin button-color-transparent() {
32
+ --button-background: hsl(from var(--button-color) h s l / 0.1);
33
+ --button-color: var(--button-color-transparent);
34
+ background-color: transparent;
35
+
36
+ &:hover {
37
+ --button-color: hsl(from var(--button-color-transparent) h s l / 1);
38
+ }
39
+
40
+ &:active {
41
+ opacity: 0.75;
42
+ }
43
+
44
+ &.Button--selected {
45
+ --button-color: hsl(from var(--color) h s calc(l + var(--adjust-color)));
46
+ }
47
+
48
+ &.Button--disabled {
49
+ --button-background: hsl(from var(--button-color) h s l / 0.2);
50
+ --button-color: var(--color-bad);
51
+ opacity: 1;
52
+ color: var(--button-color) !important;
35
53
  }
36
54
  }
37
55
 
38
56
  .Button {
39
- cursor: var(--cursor-pointer);
40
57
  position: relative;
41
58
  display: inline-block;
42
59
  white-space: nowrap;
43
- line-height: 1.667em;
60
+ line-height: var(--button-height);
44
61
  padding: 0 var(--space-m);
45
62
  margin-right: var(--space-xs);
46
63
  margin-bottom: var(--space-xs);
47
- outline: 0;
48
64
  border-radius: var(--button-border-radius);
49
- transition-property: background-color, color, opacity;
50
- transition-duration: var(--button-transition);
51
- transition-timing-function: var(--button-transition-timing);
52
- // Disable selection in buttons
53
- user-select: none;
54
-
55
- &:active {
56
- transition: none;
57
- }
65
+ outline: none;
66
+ @include button-color();
58
67
 
59
68
  &:last-child {
60
69
  margin-right: 0;
@@ -76,7 +85,7 @@ $border-radius: 0 !default;
76
85
  text-align: center;
77
86
  }
78
87
 
79
- &:has(.Button--icon) {
88
+ &.Button--hasIcon {
80
89
  padding-left: 0;
81
90
 
82
91
  .Button--icon {
@@ -84,7 +93,7 @@ $border-radius: 0 !default;
84
93
  }
85
94
  }
86
95
 
87
- &--icon-right:has(.Button--icon) {
96
+ &--icon-right.Button--hasIcon {
88
97
  padding-left: var(--space-m);
89
98
  padding-right: var(--space-s);
90
99
 
@@ -93,7 +102,7 @@ $border-radius: 0 !default;
93
102
  }
94
103
  }
95
104
 
96
- &--empty:has(.Button--icon) {
105
+ &--empty.Button--hasIcon {
97
106
  padding: 0;
98
107
  }
99
108
 
@@ -101,7 +110,7 @@ $border-radius: 0 !default;
101
110
  padding: 0 var(--space-s);
102
111
  line-height: 1.333em;
103
112
 
104
- &:has(.Button--icon) .Button--icon {
113
+ &.Button--hasIcon .Button--icon {
105
114
  margin: 0 var(--space-xxs);
106
115
  }
107
116
  }
@@ -118,74 +127,64 @@ $border-radius: 0 !default;
118
127
 
119
128
  &--ellipsis {
120
129
  display: block;
121
- text-overflow: ellipsis;
122
130
  overflow: hidden;
131
+ text-overflow: ellipsis;
123
132
  margin-right: calc(-1 * var(--space-s));
124
133
  }
125
134
 
126
135
  // We don't need additional margin if button inside stack
136
+ .Stack > &,
127
137
  .Stack__item > & {
128
138
  margin: 0;
129
139
  }
130
140
  }
131
141
 
132
- @each $color-name, $color-value in $bg-map {
142
+ @each $color-name, $color-value in colors.$color-map {
133
143
  .Button--color--#{$color-name} {
144
+ --color: #{$color-value};
145
+ --button-color: var(--color-white);
146
+
134
147
  @each $color in colors.$low-contrast-color-map {
135
148
  @if $color-name == $color {
136
- --color-text-fixed-white: var(--color-black);
149
+ --button-color: var(--color-black);
137
150
  }
138
151
  }
139
-
140
- @include button-color($color-value);
141
152
  }
142
153
  }
143
154
 
144
- /* Do not move it down, cause it will override selected by specificity */
145
- .Button--color--transparent {
146
- color: var(--button-color-transparent);
147
-
148
- &:not(.Button--disabled) {
149
- &:hover {
150
- background-color: var(--color-hover);
151
- color: hsl(from var(--button-color-transparent) h s l / 1);
152
- }
153
-
154
- &:active {
155
- background-color: var(--color-active);
156
- color: hsl(from var(--button-color-transparent) h s l / 1);
157
- }
158
- }
159
-
160
- &.Button--disabled {
161
- --button-color-transparent: var(--color-text-translucent-light);
162
- background-color: hsl(from var(--color-bad) h s l / 0.33) !important;
163
- }
155
+ .Button--selected {
156
+ --color: var(--button-background-selected);
164
157
  }
165
158
 
166
- .Button--color--default {
167
- @include button-color(var(--button-background-default), var(--button-color));
159
+ .Button--disabled {
160
+ cursor: var(--cursor-disabled) !important;
161
+ background-color: var(
162
+ --button-background-disabled,
163
+ var(--button-background)
164
+ ) !important;
165
+ opacity: var(--button-disabled-opacity);
168
166
  }
169
167
 
170
- .Button--color--caution {
171
- @include button-color(var(--button-background-caution));
172
- }
168
+ .Button--color-- {
169
+ &default {
170
+ --color: var(--button-background-default);
171
+ }
173
172
 
174
- .Button--color--danger {
175
- @include button-color(var(--button-background-danger));
176
- }
173
+ &caution {
174
+ --color: var(--button-background-caution);
175
+ }
177
176
 
178
- .Button--selected {
179
- @include button-color(var(--button-background-selected));
180
- }
177
+ &danger {
178
+ --color: var(--button-background-danger);
179
+ }
181
180
 
182
- .Button--disabled {
183
- cursor: var(--cursor-disabled);
184
- opacity: 0.5;
181
+ &transparent {
182
+ @include button-color-transparent();
183
+ }
185
184
  }
186
185
 
187
186
  .Button--flex {
188
- display: inline-flex; //Inline even for fluid
187
+ display: inline-flex; // Inline even for fluid
189
188
  flex-direction: column;
190
189
  }
191
190
 
@@ -1,5 +1,3 @@
1
- $background-dimness: 0 !default;
2
-
3
1
  .Dimmer {
4
2
  display: flex;
5
3
  justify-content: center;
@@ -1,8 +1,3 @@
1
- @use "../base";
2
-
3
- $thickness: 0 !default;
4
- $spacing: 0 !default;
5
-
6
1
  .Divider--horizontal {
7
2
  margin: var(--space-m) 0;
8
3
 
@@ -1,4 +1,5 @@
1
1
  @use "../base";
2
+ @use "./Button" as button;
2
3
 
3
4
  .Dropdown {
4
5
  display: flex;
@@ -18,6 +19,11 @@
18
19
  align-content: center;
19
20
  }
20
21
 
22
+ &--fluid {
23
+ flex: 1;
24
+ width: 100%;
25
+ }
26
+
21
27
  &__control {
22
28
  display: flex;
23
29
  overflow: hidden;
@@ -27,12 +33,14 @@
27
33
  line-height: base.em(16px);
28
34
  height: base.em(22px);
29
35
  border-radius: var(--button-border-radius);
36
+ @include button.button-color();
30
37
  }
31
38
 
32
39
  &__selected-text {
33
40
  flex: 1;
34
41
  display: inline-block;
35
42
  align-content: center;
43
+ overflow: hidden;
36
44
  text-overflow: ellipsis;
37
45
  white-space: nowrap;
38
46
  height: 100%;