tgui-core 4.0.4 → 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 (51) hide show
  1. package/dist/common/constants.d.ts +1 -1
  2. package/dist/common/constants.js +1 -1
  3. package/dist/common/events.js +1 -1
  4. package/dist/common/hotkeys.js +1 -1
  5. package/dist/common/uuid.js +1 -1
  6. package/dist/components/AnimatedNumber.d.ts +2 -42
  7. package/dist/components/AnimatedNumber.js +1 -1
  8. package/dist/components/Button.js +1 -1
  9. package/dist/components/DraggableControl.d.ts +4 -1
  10. package/dist/components/Flex.d.ts +1 -1
  11. package/dist/components/Flex.js +1 -1
  12. package/dist/components/Floating.d.ts +1 -0
  13. package/dist/components/Floating.js +1 -1
  14. package/dist/components/Input.js +1 -1
  15. package/dist/components/Knob.d.ts +4 -4
  16. package/dist/components/Modal.d.ts +2 -3
  17. package/dist/components/NumberInput.d.ts +2 -2
  18. package/dist/components/Slider.d.ts +4 -4
  19. package/dist/components/Slider.js +1 -1
  20. package/dist/components/Tabs.js +1 -1
  21. package/package.json +3 -3
  22. package/styles/atomic/candystripe.scss +8 -0
  23. package/styles/atomic/centered-image.scss +7 -0
  24. package/styles/atomic/color.scss +17 -0
  25. package/styles/atomic/debug-layout.scss +12 -0
  26. package/styles/atomic/fit-text.scss +15 -0
  27. package/styles/atomic/links.scss +21 -0
  28. package/styles/atomic/outline.scss +43 -0
  29. package/styles/atomic/text.scss +39 -0
  30. package/styles/atomic.scss +11 -0
  31. package/styles/components/BlockQuote.scss +0 -2
  32. package/styles/components/Button.scss +83 -85
  33. package/styles/components/Dimmer.scss +0 -2
  34. package/styles/components/Divider.scss +0 -5
  35. package/styles/components/Dropdown.scss +2 -0
  36. package/styles/components/ImageButton.scss +104 -102
  37. package/styles/components/Input.scss +3 -0
  38. package/styles/components/Knob.scss +5 -21
  39. package/styles/components/LabeledList.scss +0 -2
  40. package/styles/components/NoticeBox.scss +15 -21
  41. package/styles/components/NumberInput.scss +1 -9
  42. package/styles/components/ProgressBar.scss +27 -48
  43. package/styles/components/RestrictedInput.scss +3 -0
  44. package/styles/components/RoundGauge.scss +8 -13
  45. package/styles/components/Section.scss +0 -7
  46. package/styles/components/Slider.scss +49 -42
  47. package/styles/components/Tabs.scss +1 -12
  48. package/styles/components/TextArea.scss +3 -0
  49. package/styles/components/Tooltip.scss +0 -4
  50. package/styles/main.scss +0 -1
  51. package/styles/vars-components.scss +5 -2
@@ -1,60 +1,54 @@
1
1
  @use "../base";
2
2
  @use "../colors";
3
3
 
4
- $bg-map: colors.$color-map !default;
5
- $fg-map: colors.$color-map !default;
6
- $background-color: 0 !default;
7
- $color-stripes: 0 !default;
8
-
9
4
  .NoticeBox {
5
+ --noticebox-background: var(--notice-box-background);
10
6
  font-weight: bold;
11
7
  font-style: italic;
12
8
  padding: var(--space-sm) var(--space-m);
13
9
  margin-bottom: var(--space-m);
14
- color: var(--notice-box-color);
15
- background-color: var(--notice-box-background);
10
+ background-color: oklch(
11
+ from var(--noticebox-background) calc(l * 0.825) calc(c * 0.75) h
12
+ );
16
13
  background-image: repeating-linear-gradient(
17
14
  -45deg,
18
- transparent,
19
- transparent base.em(10px),
20
- var(--notice-box-stripes) base.em(10px),
21
- var(--notice-box-stripes) base.em(20px)
15
+ transparent 0 base.em(10px),
16
+ var(--notice-box-stripes) base.em(10px) base.em(20px)
22
17
  );
18
+ color: var(--notice-box-color);
23
19
  }
24
20
 
25
21
  @mixin box-color($color) {
26
- background-color: oklch(from $color calc(l - 0.14) calc(c - 0.06) h);
27
- color: var(--color-text-fixed-white);
28
22
  }
29
23
 
30
- @each $color-name, $color-value in $bg-map {
24
+ @each $color-name, $color-value in colors.$color-map {
31
25
  .NoticeBox--color--#{$color-name} {
26
+ --noticebox-background: #{$color-value};
27
+
32
28
  @each $color in colors.$low-contrast-color-map {
33
29
  @if $color-name == $color {
34
- --color-text-fixed-white: var(--color-black);
30
+ --notice-box-color: var(--color-black);
35
31
  }
36
32
  }
37
33
 
38
34
  @if $color-name == "black" {
39
35
  --notice-box-stripes: hsla(0, 0%, 100%, 0.1);
40
36
  }
41
-
42
- @include box-color($color-value);
43
37
  }
44
38
  }
45
39
 
46
40
  .NoticeBox--type--info {
47
- @include box-color(var(--color-blue));
41
+ --noticebox-background: var(--color-blue);
48
42
  }
49
43
 
50
44
  .NoticeBox--type--success {
51
- @include box-color(var(--color-green));
45
+ --noticebox-background: var(--color-green);
52
46
  }
53
47
 
54
48
  .NoticeBox--type--warning {
55
- @include box-color(var(--color-orange));
49
+ --noticebox-background: var(--color-orange);
56
50
  }
57
51
 
58
52
  .NoticeBox--type--danger {
59
- @include box-color(var(--color-red));
53
+ --noticebox-background: var(--color-red);
60
54
  }
@@ -1,12 +1,4 @@
1
- @use "sass:color";
2
1
  @use "../base";
3
- @use "../functions" as *;
4
- @use "./Input";
5
-
6
- $text-color: 0 !default;
7
- $background-color: 0 !default;
8
- $border-color: 0 !default;
9
- $border-radius: 0 !default;
10
2
 
11
3
  .NumberInput {
12
4
  cursor: var(--cursor-n-resize);
@@ -67,7 +59,7 @@ $border-radius: 0 !default;
67
59
  height: base.em(17px);
68
60
  margin: 0;
69
61
  padding: 0 var(--space-m);
70
- font-family: Verdana, sans-serif;
62
+ font-family: var(--font-family);
71
63
  background-color: var(--number-input-background);
72
64
  color: var(--number-input-color);
73
65
  }
@@ -1,68 +1,47 @@
1
1
  @use "../base";
2
2
  @use "../colors";
3
3
 
4
- $bg-map: colors.$color-map !default;
5
- $fg-map: colors.$color-map !default;
6
- $color-default-fill: 0 !default;
7
- $background-color: 0 !default;
8
- $border-radius: 0 !default;
9
-
10
4
  .ProgressBar {
11
- display: inline-block;
12
5
  position: relative;
13
- width: 100%;
14
- min-height: 1.667em;
6
+ display: inline-block;
15
7
  align-content: center;
8
+ width: 100%;
9
+ min-height: var(--button-height);
16
10
  padding: 0 var(--space-m);
17
- border-width: var(--border-thickness-tiny) !important;
18
- border-style: solid !important;
19
- border-radius: var(--progress-bar-border-radius);
20
11
  background-color: var(--progress-bar-background);
12
+ border: var(--border-thickness-tiny) solid var(--progress-bar-color);
13
+ border-radius: var(--progress-bar-border-radius);
21
14
  transition: border-color var(--progress-bar-transition) ease-out;
22
- }
23
15
 
24
- .ProgressBar__fill {
25
- position: absolute;
26
- top: 0;
27
- bottom: 0;
28
- left: 0;
29
- }
16
+ &__fill {
17
+ position: absolute;
18
+ inset: 0;
19
+ background-color: var(--progress-bar-color);
30
20
 
31
- .ProgressBar__fill--animated {
32
- transition:
33
- background-color var(--progress-bar-transition) ease-out,
34
- width var(--progress-bar-transition) ease-out;
35
- }
21
+ &--animated {
22
+ transition-property: background-color, width;
23
+ transition-duration: var(--progress-bar-transition);
24
+ }
25
+ }
36
26
 
37
- .ProgressBar__content {
38
- position: relative;
39
- line-height: base.em(17px);
40
- width: 100%;
41
- text-align: right;
42
- user-select: none;
27
+ &__content {
28
+ user-select: none;
29
+ position: relative;
30
+ text-align: right;
31
+ width: 100%;
32
+ }
43
33
  }
44
34
 
45
35
  .ProgressBar--color--default {
46
- border: var(--border-thickness-tiny) solid
47
- hsl(from var(--progress-bar-fill) h s calc(l - var(--adjust-color)));
48
-
49
- .ProgressBar__fill {
50
- background-color: hsl(
51
- from var(--progress-bar-fill) h s calc(l - var(--adjust-color))
52
- );
53
- }
36
+ --progress-bar-color: hsl(
37
+ from var(--progress-bar-fill) h s calc(l - var(--adjust-color))
38
+ );
54
39
  }
55
40
 
56
- @each $color-name, $color-value in $bg-map {
41
+ @each $color-name, $color-value in colors.$color-map {
57
42
  .ProgressBar--color--#{$color-name} {
58
- border-color: hsl(
59
- from $color-value h s calc(l - var(--adjust-color))
60
- ) !important;
61
-
62
- .ProgressBar__fill {
63
- background-color: hsl(
64
- from $color-value h s calc(l - var(--adjust-color))
65
- );
66
- }
43
+ --progress-bar-color: hsl(
44
+ from #{$color-value} h s calc(l - var(--adjust-color))
45
+ );
67
46
  }
68
47
  }
@@ -1,9 +1,11 @@
1
1
  .RestrictedInput {
2
2
  border-color: var(--restricted-input-border-color);
3
3
  text-align: right;
4
+
4
5
  &:focus-within {
5
6
  border-color: var(--restricted-input-border-color-focus);
6
7
  }
8
+
7
9
  &::-webkit-inner-spin-button,
8
10
  &::-webkit-outer-spin-button {
9
11
  -webkit-appearance: none;
@@ -13,6 +15,7 @@
13
15
 
14
16
  .RestrictedInput--invalid {
15
17
  border-color: var(--restricted-input-border-color-invalid);
18
+
16
19
  &:focus-within {
17
20
  border-color: var(--restricted-input-border-color-invalid);
18
21
  }
@@ -1,19 +1,15 @@
1
1
  @use "../colors";
2
2
 
3
3
  $pi: 3.1416;
4
- $fg-map: colors.$color-map !default;
5
- $ring-color: 0 !default;
6
4
 
7
5
  @keyframes RoundGauge__alertAnim {
8
- 0% {
6
+ 0%,
7
+ 100% {
9
8
  opacity: 0.1;
10
9
  }
11
10
  50% {
12
11
  opacity: 1;
13
12
  }
14
- 100% {
15
- opacity: 0.1;
16
- }
17
13
  }
18
14
 
19
15
  @keyframes RoundGauge__needleAlertAnim {
@@ -74,6 +70,9 @@ $ring-color: 0 !default;
74
70
  transform-origin: top;
75
71
 
76
72
  &.active {
73
+ animation: RoundGauge__alertAnim var(--round-gauge-alert-animation)
74
+ cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
75
+
77
76
  ~ .RoundGauge__needle .RoundGauge__needleLine {
78
77
  transform-origin: bottom;
79
78
  animation: RoundGauge__needleAlertAnim
@@ -83,21 +82,17 @@ $ring-color: 0 !default;
83
82
  }
84
83
 
85
84
  .RoundGauge__alert.max {
86
- fill: colors.$bad;
85
+ fill: var(--color-bad);
87
86
  }
88
87
 
89
- @each $color-name, $color-value in $fg-map {
88
+ @each $color-name, $color-value in colors.$color-map {
90
89
  .RoundGauge--color--#{$color-name}.RoundGauge__ringFill {
91
90
  stroke: $color-value;
92
91
  }
93
92
  }
94
93
 
95
- @each $color-name, $color-value in $fg-map {
94
+ @each $color-name, $color-value in colors.$color-map {
96
95
  .RoundGauge__alert--#{$color-name} {
97
96
  fill: $color-value;
98
- animation: RoundGauge__alertAnim
99
- var(--round-gauge-alert-animation)
100
- cubic-bezier(0.34, 1.56, 0.64, 1)
101
- infinite;
102
97
  }
103
98
  }
@@ -1,11 +1,4 @@
1
- @use "sass:color";
2
1
  @use "../base";
3
- @use "../colors";
4
- @use "../functions";
5
-
6
- $title-text-color: 0 !default;
7
- $background-color: 0 !default;
8
- $separator-color: 0 !default;
9
2
 
10
3
  .Section {
11
4
  position: relative;
@@ -1,52 +1,59 @@
1
1
  @use "../base";
2
2
 
3
- $cursor-color: 0 !default;
4
- $popup-background-color: 0 !default;
5
- $popup-text-color: 0 !default;
6
-
7
3
  .Slider {
8
4
  cursor: e-resize;
9
5
  user-select: none;
10
- }
11
6
 
12
- .Slider__cursorOffset {
13
- position: absolute;
14
- inset: 0;
15
- transition: none !important;
16
- }
7
+ &--editing {
8
+ .Slider__cursor:before {
9
+ display: none;
10
+ }
11
+ }
17
12
 
18
- .Slider__cursor {
19
- position: absolute;
20
- top: 0;
21
- right: calc(-1 * var(--space-xxs));
22
- bottom: 0;
23
- width: 0;
24
- border-left: var(--border-thickness-small) solid var(--slider-cursor-color);
25
- }
13
+ &__cursor {
14
+ position: absolute;
15
+ inset: 0 calc(-1 * var(--space-xxs));
16
+ left: unset;
17
+ border-left: var(--border-thickness-small) solid var(--slider-cursor-color);
18
+ border-radius: var(--border-radius-circular);
26
19
 
27
- .Slider__pointer {
28
- position: absolute;
29
- right: 0;
30
- bottom: 0;
31
- width: 0;
32
- height: 0;
33
- border-left: base.em(5px) solid transparent;
34
- border-right: base.em(5px) solid transparent;
35
- border-bottom: base.em(5px) solid var(--slider-cursor-color);
36
- transform: translate(50%, calc(100% - var(--border-thickness-tiny)));
37
- }
20
+ &Offset {
21
+ position: absolute;
22
+ inset: 0;
23
+ transition: none !important;
24
+ }
38
25
 
39
- .Slider__popupValue {
40
- user-select: none;
41
- white-space: nowrap;
42
- position: absolute;
43
- right: 0;
44
- top: -2rem;
45
- font-size: 1rem;
46
- padding: var(--space-s) var(--space-m);
47
- background-color: var(--slider-popup-background);
48
- color: var(--slider-popup-color);
49
- border-radius: var(--slider-popup-border-radius);
50
- transform: translateX(50%);
51
- backdrop-filter: var(--slider-popup-blur);
26
+ &:before {
27
+ content: "";
28
+ aspect-ratio: 1 / 1;
29
+ position: absolute;
30
+ right: 0;
31
+ bottom: 0;
32
+ border-left: inherit;
33
+ transform: scale(4) translateY(50%) rotate(45deg);
34
+ transform-origin: center;
35
+ mask-image: linear-gradient(135deg, black 50%, transparent 50%);
36
+ }
37
+ }
38
+
39
+ &__popupValue {
40
+ user-select: none;
41
+ white-space: nowrap;
42
+ position: absolute;
43
+ top: -2em;
44
+ right: 0;
45
+ font-size: 1em;
46
+ padding: var(--space-s) var(--space-m);
47
+ background-color: var(--slider-popup-background);
48
+ color: var(--slider-popup-color);
49
+ border-radius: var(--slider-popup-border-radius);
50
+ transform: translateX(50%);
51
+ backdrop-filter: var(--slider-popup-blur);
52
+ }
53
+
54
+ .NumberInput__input {
55
+ inset: 2px;
56
+ width: auto;
57
+ height: auto;
58
+ }
52
59
  }
@@ -1,16 +1,5 @@
1
1
  @use "../colors";
2
2
 
3
- $fg-map: colors.$color-map !default;
4
-
5
- $color-default: 0 !default;
6
- $text-color: 0 !default;
7
- $text-color-selected: 0 !default;
8
- $tab-color: 0 !default;
9
- $tab-color-hovered: 0 !default;
10
- $tab-color-selected: 0 !default;
11
- $transition-duration: 0 !default;
12
- $border-radius: 0 !default;
13
-
14
3
  @mixin indicator($position) {
15
4
  position: relative;
16
5
  padding-#{$position}: var(--tab-indicator-size);
@@ -145,7 +134,7 @@ $border-radius: 0 !default;
145
134
  }
146
135
  }
147
136
 
148
- @each $color-name, $color-value in $fg-map {
137
+ @each $color-name, $color-value in colors.$color-map {
149
138
  .Tab--selected.Tab--color--#{$color-name} {
150
139
  color: hsl(from $color-value h s calc(l + 17.5));
151
140
  }
@@ -1,3 +1,6 @@
1
1
  .TextArea {
2
2
  resize: none;
3
+ scrollbar-width: thin;
4
+ scrollbar-gutter: stable;
5
+ scrollbar-color: var(--color-scrollbar-thumb) transparent;
3
6
  }
@@ -1,9 +1,5 @@
1
1
  @use "../base";
2
2
 
3
- $color: 0 !default;
4
- $background-color: 0 !default;
5
- $border-radius: 0 !default;
6
-
7
3
  .Tooltip {
8
4
  backdrop-filter: var(--tooltip-blur);
9
5
  background-color: var(--tooltip-background);
package/styles/main.scss CHANGED
@@ -9,7 +9,6 @@
9
9
  @include meta.load-css("./reset.scss");
10
10
 
11
11
  // Components
12
-
13
12
  @include meta.load-css("./components/BlockQuote.scss");
14
13
  @include meta.load-css("./components/Button.scss");
15
14
  @include meta.load-css("./components/ColorBox.scss");
@@ -27,12 +27,15 @@
27
27
  --blockquote-border: var(--border-thickness-small) solid;
28
28
 
29
29
  /* Button */
30
+ --button-height: 1.667em;
30
31
  --button-color: var(--color-white);
31
32
  --button-color-transparent: var(--color-text-translucent);
32
33
  --button-background-default: var(--color-primary);
33
34
  --button-background-selected: var(--color-green);
34
35
  --button-background-caution: var(--color-yellow);
35
36
  --button-background-danger: var(--color-red);
37
+ --button-background-disabled: var(--undefined); // Used for theming
38
+ --button-disabled-opacity: 0.5;
36
39
  --button-border-radius: var(--border-radius-tiny);
37
40
  --button-transition: var(--transition-time-medium);
38
41
  --button-transition-timing: ease;
@@ -119,8 +122,8 @@
119
122
 
120
123
  /* Notice Box */
121
124
  --notice-box-stripes: hsla(0, 0%, 0%, 0.1);
122
- --notice-box-background: hsl(37.5, 40%, 57.5%);
123
- --notice-box-color: var(--color-text-fixed-black);
125
+ --notice-box-background: hsl(37.5, 55%, 57.5%);
126
+ --notice-box-color: var(--color-text-fixed-white);
124
127
 
125
128
  /* Number Input */
126
129
  --number-input-background: var(--input-background);