bootstrap 4.3.1 → 4.6.2.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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +15 -1
  3. data/CHANGELOG.md +4 -12
  4. data/README.md +7 -1
  5. data/Rakefile +16 -4
  6. data/assets/javascripts/bootstrap/alert.js +43 -55
  7. data/assets/javascripts/bootstrap/button.js +112 -70
  8. data/assets/javascripts/bootstrap/carousel.js +164 -189
  9. data/assets/javascripts/bootstrap/collapse.js +98 -129
  10. data/assets/javascripts/bootstrap/dropdown.js +165 -200
  11. data/assets/javascripts/bootstrap/modal.js +218 -205
  12. data/assets/javascripts/bootstrap/popover.js +63 -79
  13. data/assets/javascripts/bootstrap/scrollspy.js +82 -119
  14. data/assets/javascripts/bootstrap/tab.js +79 -85
  15. data/assets/javascripts/bootstrap/toast.js +100 -115
  16. data/assets/javascripts/bootstrap/tooltip.js +207 -225
  17. data/assets/javascripts/bootstrap/util.js +41 -23
  18. data/assets/javascripts/bootstrap.js +1235 -1314
  19. data/assets/javascripts/bootstrap.min.js +4 -4
  20. data/assets/stylesheets/_bootstrap-grid.scss +5 -4
  21. data/assets/stylesheets/_bootstrap-reboot.scss +4 -4
  22. data/assets/stylesheets/_bootstrap.scss +4 -4
  23. data/assets/stylesheets/bootstrap/_alert.scss +1 -0
  24. data/assets/stylesheets/bootstrap/_badge.scss +1 -1
  25. data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -2
  26. data/assets/stylesheets/bootstrap/_button-group.scss +1 -1
  27. data/assets/stylesheets/bootstrap/_buttons.scss +13 -8
  28. data/assets/stylesheets/bootstrap/_card.scss +47 -50
  29. data/assets/stylesheets/bootstrap/_carousel.scss +12 -9
  30. data/assets/stylesheets/bootstrap/_close.scss +2 -3
  31. data/assets/stylesheets/bootstrap/_code.scss +1 -1
  32. data/assets/stylesheets/bootstrap/_custom-forms.scss +43 -24
  33. data/assets/stylesheets/bootstrap/_dropdown.scss +7 -6
  34. data/assets/stylesheets/bootstrap/_forms.scss +30 -13
  35. data/assets/stylesheets/bootstrap/_functions.scss +110 -6
  36. data/assets/stylesheets/bootstrap/_grid.scss +32 -11
  37. data/assets/stylesheets/bootstrap/_images.scss +3 -3
  38. data/assets/stylesheets/bootstrap/_input-group.scss +23 -5
  39. data/assets/stylesheets/bootstrap/_jumbotron.scss +1 -1
  40. data/assets/stylesheets/bootstrap/_list-group.scss +36 -31
  41. data/assets/stylesheets/bootstrap/_mixins.scss +3 -3
  42. data/assets/stylesheets/bootstrap/_modal.scss +26 -15
  43. data/assets/stylesheets/bootstrap/_nav.scss +12 -7
  44. data/assets/stylesheets/bootstrap/_navbar.scss +55 -17
  45. data/assets/stylesheets/bootstrap/_pagination.scss +5 -4
  46. data/assets/stylesheets/bootstrap/_popover.scss +17 -18
  47. data/assets/stylesheets/bootstrap/_print.scss +1 -10
  48. data/assets/stylesheets/bootstrap/_progress.scss +7 -3
  49. data/assets/stylesheets/bootstrap/_reboot.scss +39 -38
  50. data/assets/stylesheets/bootstrap/_spinners.scss +18 -8
  51. data/assets/stylesheets/bootstrap/_tables.scss +3 -3
  52. data/assets/stylesheets/bootstrap/_toasts.scss +4 -2
  53. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
  54. data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
  55. data/assets/stylesheets/bootstrap/_type.scss +3 -3
  56. data/assets/stylesheets/bootstrap/_utilities.scss +2 -1
  57. data/assets/stylesheets/bootstrap/_variables.scss +71 -45
  58. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +5 -3
  59. data/assets/stylesheets/bootstrap/mixins/_badge.scss +1 -1
  60. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +27 -14
  61. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +11 -8
  62. data/assets/stylesheets/bootstrap/mixins/_caret.scss +8 -8
  63. data/assets/stylesheets/bootstrap/mixins/_float.scss +3 -3
  64. data/assets/stylesheets/bootstrap/mixins/_forms.scss +52 -49
  65. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +31 -17
  66. data/assets/stylesheets/bootstrap/mixins/_grid.scss +32 -14
  67. data/assets/stylesheets/bootstrap/mixins/_hover.scss +4 -4
  68. data/assets/stylesheets/bootstrap/mixins/_image.scss +2 -2
  69. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +1 -1
  70. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  71. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +2 -1
  72. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  73. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +5 -4
  74. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +1 -1
  75. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +3 -2
  76. data/assets/stylesheets/bootstrap/mixins/_transition.scss +18 -8
  77. data/assets/stylesheets/bootstrap/utilities/_background.scss +2 -2
  78. data/assets/stylesheets/bootstrap/utilities/_borders.scss +1 -1
  79. data/assets/stylesheets/bootstrap/utilities/_embed.scss +1 -1
  80. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +5 -0
  81. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +1 -1
  82. data/assets/stylesheets/bootstrap/utilities/_text.scss +4 -4
  83. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +126 -102
  84. data/bootstrap.gemspec +2 -4
  85. data/lib/bootstrap/engine.rb +17 -1
  86. data/lib/bootstrap/version.rb +2 -2
  87. data/tasks/updater/js.rb +18 -6
  88. data/tasks/updater/network.rb +8 -2
  89. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  90. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  91. data/test/gemfiles/rails_6_0.gemfile +7 -0
  92. data/test/gemfiles/rails_7_0_dartsass.gemfile +8 -0
  93. data/test/gemfiles/rails_7_0_sassc.gemfile +8 -0
  94. data/test/support/dummy_rails_integration.rb +3 -1
  95. data/test/test_helper.rb +18 -13
  96. metadata +17 -21
@@ -1,12 +1,12 @@
1
1
  // stylelint-disable declaration-no-important
2
2
 
3
3
  @each $color, $value in $theme-colors {
4
- @include bg-variant(".bg-#{$color}", $value);
4
+ @include bg-variant(".bg-#{$color}", $value, true);
5
5
  }
6
6
 
7
7
  @if $enable-gradients {
8
8
  @each $color, $value in $theme-colors {
9
- @include bg-gradient-variant(".bg-gradient-#{$color}", $value);
9
+ @include bg-gradient-variant(".bg-gradient-#{$color}", $value, true);
10
10
  }
11
11
  }
12
12
 
@@ -1,4 +1,4 @@
1
- // stylelint-disable property-blacklist, declaration-no-important
1
+ // stylelint-disable property-disallowed-list, declaration-no-important
2
2
 
3
3
  //
4
4
  // Border
@@ -33,7 +33,7 @@
33
33
 
34
34
  .embed-responsive-#{$embed-responsive-aspect-ratio-x}by#{$embed-responsive-aspect-ratio-y} {
35
35
  &::before {
36
- padding-top: percentage($embed-responsive-aspect-ratio-y / $embed-responsive-aspect-ratio-x);
36
+ padding-top: percentage(divide($embed-responsive-aspect-ratio-y, $embed-responsive-aspect-ratio-x));
37
37
  }
38
38
  }
39
39
  }
@@ -0,0 +1,5 @@
1
+ // stylelint-disable declaration-no-important
2
+
3
+ @each $value in $user-selects {
4
+ .user-select-#{$value} { user-select: $value !important; }
5
+ }
@@ -30,7 +30,7 @@
30
30
 
31
31
  // Negative margins (e.g., where `.mb-n1` is negative version of `.mb-1`)
32
32
  @each $size, $length in $spacers {
33
- @if $size != 0 {
33
+ @if "#{$size}" != "0" {
34
34
  .m#{$infix}-n#{$size} { margin: -$length !important; }
35
35
  .mt#{$infix}-n#{$size},
36
36
  .my#{$infix}-n#{$size} {
@@ -11,7 +11,7 @@
11
11
  .text-justify { text-align: justify !important; }
12
12
  .text-wrap { white-space: normal !important; }
13
13
  .text-nowrap { white-space: nowrap !important; }
14
- .text-truncate { @include text-truncate; }
14
+ .text-truncate { @include text-truncate(); }
15
15
 
16
16
  // Responsive alignment
17
17
 
@@ -45,7 +45,7 @@
45
45
  .text-white { color: $white !important; }
46
46
 
47
47
  @each $color, $value in $theme-colors {
48
- @include text-emphasis-variant(".text-#{$color}", $value);
48
+ @include text-emphasis-variant(".text-#{$color}", $value, true);
49
49
  }
50
50
 
51
51
  .text-body { color: $body-color !important; }
@@ -63,8 +63,8 @@
63
63
  .text-decoration-none { text-decoration: none !important; }
64
64
 
65
65
  .text-break {
66
- word-break: break-word !important; // IE & < Edge 18
67
- overflow-wrap: break-word !important;
66
+ word-break: break-word !important; // Deprecated, but avoids issues with flex containers
67
+ word-wrap: break-word !important; // Used instead of `overflow-wrap` for IE & Edge Legacy
68
68
  }
69
69
 
70
70
  // Reset
@@ -2,9 +2,9 @@
2
2
 
3
3
  // SCSS RFS mixin
4
4
  //
5
- // Automated font-resizing
5
+ // Automated responsive font sizes
6
6
  //
7
- // See https://github.com/twbs/rfs
7
+ // Licensed under MIT (https://github.com/twbs/rfs/blob/v8.x/LICENSE)
8
8
 
9
9
  // Configuration
10
10
 
@@ -12,11 +12,19 @@
12
12
  $rfs-base-font-size: 1.25rem !default;
13
13
  $rfs-font-size-unit: rem !default;
14
14
 
15
+ @if $rfs-font-size-unit != rem and $rfs-font-size-unit != px {
16
+ @error "`#{$rfs-font-size-unit}` is not a valid unit for $rfs-font-size-unit. Use `px` or `rem`.";
17
+ }
18
+
15
19
  // Breakpoint at where font-size starts decreasing if screen width is smaller
16
20
  $rfs-breakpoint: 1200px !default;
17
21
  $rfs-breakpoint-unit: px !default;
18
22
 
19
- // Resize font-size based on screen height and width
23
+ @if $rfs-breakpoint-unit != px and $rfs-breakpoint-unit != em and $rfs-breakpoint-unit != rem {
24
+ @error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
25
+ }
26
+
27
+ // Resize font size based on screen height and width
20
28
  $rfs-two-dimensional: false !default;
21
29
 
22
30
  // Factor of decrease
@@ -41,12 +49,54 @@ $enable-responsive-font-sizes: true !default;
41
49
  // Cache $rfs-base-font-size unit
42
50
  $rfs-base-font-size-unit: unit($rfs-base-font-size);
43
51
 
52
+ @function divide($dividend, $divisor, $precision: 10) {
53
+ $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
54
+ $dividend: abs($dividend);
55
+ $divisor: abs($divisor);
56
+ @if $dividend == 0 {
57
+ @return 0;
58
+ }
59
+ @if $divisor == 0 {
60
+ @error "Cannot divide by 0";
61
+ }
62
+ $remainder: $dividend;
63
+ $result: 0;
64
+ $factor: 10;
65
+ @while ($remainder > 0 and $precision >= 0) {
66
+ $quotient: 0;
67
+ @while ($remainder >= $divisor) {
68
+ $remainder: $remainder - $divisor;
69
+ $quotient: $quotient + 1;
70
+ }
71
+ $result: $result * 10 + $quotient;
72
+ $factor: $factor * .1;
73
+ $remainder: $remainder * 10;
74
+ $precision: $precision - 1;
75
+ @if ($precision < 0 and $remainder >= $divisor * 5) {
76
+ $result: $result + 1;
77
+ }
78
+ }
79
+ $result: $result * $factor * $sign;
80
+ $dividend-unit: unit($dividend);
81
+ $divisor-unit: unit($divisor);
82
+ $unit-map: (
83
+ "px": 1px,
84
+ "rem": 1rem,
85
+ "em": 1em,
86
+ "%": 1%
87
+ );
88
+ @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
89
+ $result: $result * map-get($unit-map, $dividend-unit);
90
+ }
91
+ @return $result;
92
+ }
93
+
44
94
  // Remove px-unit from $rfs-base-font-size for calculations
45
95
  @if $rfs-base-font-size-unit == "px" {
46
- $rfs-base-font-size: $rfs-base-font-size / ($rfs-base-font-size * 0 + 1);
96
+ $rfs-base-font-size: divide($rfs-base-font-size, $rfs-base-font-size * 0 + 1);
47
97
  }
48
98
  @else if $rfs-base-font-size-unit == "rem" {
49
- $rfs-base-font-size: $rfs-base-font-size / ($rfs-base-font-size * 0 + 1 / $rfs-rem-value);
99
+ $rfs-base-font-size: divide($rfs-base-font-size, divide($rfs-base-font-size * 0 + 1, $rfs-rem-value));
50
100
  }
51
101
 
52
102
  // Cache $rfs-breakpoint unit to prevent multiple calls
@@ -54,13 +104,55 @@ $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
54
104
 
55
105
  // Remove unit from $rfs-breakpoint for calculations
56
106
  @if $rfs-breakpoint-unit-cache == "px" {
57
- $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1);
107
+ $rfs-breakpoint: divide($rfs-breakpoint, $rfs-breakpoint * 0 + 1);
58
108
  }
59
109
  @else if $rfs-breakpoint-unit-cache == "rem" or $rfs-breakpoint-unit-cache == "em" {
60
- $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1 / $rfs-rem-value);
110
+ $rfs-breakpoint: divide($rfs-breakpoint, divide($rfs-breakpoint * 0 + 1, $rfs-rem-value));
111
+ }
112
+
113
+ // Internal mixin that adds disable classes to the selector if needed.
114
+ @mixin _rfs-disable-class {
115
+ @if $rfs-class == "disable" {
116
+ // Adding an extra class increases specificity, which prevents the media query to override the font size
117
+ &,
118
+ .disable-responsive-font-size &,
119
+ &.disable-responsive-font-size {
120
+ @content;
121
+ }
122
+ }
123
+ @else {
124
+ @content;
125
+ }
126
+ }
127
+
128
+ // Internal mixin that adds enable classes to the selector if needed.
129
+ @mixin _rfs-enable-class {
130
+ @if $rfs-class == "enable" {
131
+ .enable-responsive-font-size &,
132
+ &.enable-responsive-font-size {
133
+ @content;
134
+ }
135
+ }
136
+ @else {
137
+ @content;
138
+ }
61
139
  }
62
140
 
63
- // Responsive font-size mixin
141
+ // Internal mixin used to determine which media query needs to be used
142
+ @mixin _rfs-media-query($mq-value) {
143
+ @if $rfs-two-dimensional {
144
+ @media (max-width: #{$mq-value}), (max-height: #{$mq-value}) {
145
+ @content;
146
+ }
147
+ }
148
+ @else {
149
+ @media (max-width: #{$mq-value}) {
150
+ @content;
151
+ }
152
+ }
153
+ }
154
+
155
+ // Responsive font size mixin
64
156
  @mixin rfs($fs, $important: false) {
65
157
  // Cache $fs unit
66
158
  $fs-unit: if(type-of($fs) == "number", unit($fs), false);
@@ -73,128 +165,60 @@ $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
73
165
  font-size: #{$fs}#{$rfs-suffix};
74
166
  }
75
167
  @else {
76
- // Variables for storing static and fluid rescaling
77
- $rfs-static: null;
78
- $rfs-fluid: null;
79
-
80
- // Remove px-unit from $fs for calculations
168
+ // Remove unit from $fs for calculations
81
169
  @if $fs-unit == "px" {
82
- $fs: $fs / ($fs * 0 + 1);
170
+ $fs: divide($fs, $fs * 0 + 1);
83
171
  }
84
172
  @else if $fs-unit == "rem" {
85
- $fs: $fs / ($fs * 0 + 1 / $rfs-rem-value);
173
+ $fs: divide($fs, divide($fs * 0 + 1, $rfs-rem-value));
86
174
  }
87
175
 
88
- // Set default font-size
89
- @if $rfs-font-size-unit == rem {
90
- $rfs-static: #{$fs / $rfs-rem-value}rem#{$rfs-suffix};
91
- }
92
- @else if $rfs-font-size-unit == px {
93
- $rfs-static: #{$fs}px#{$rfs-suffix};
176
+ // Set default font size
177
+ $rfs-static: if($rfs-font-size-unit == rem, #{divide($fs, $rfs-rem-value)}rem, #{$fs}px);
178
+
179
+ // Only add the media query if the font size is bigger than the minimum font size
180
+ @if $fs <= $rfs-base-font-size or not $enable-responsive-font-sizes {
181
+ font-size: #{$rfs-static}#{$rfs-suffix};
94
182
  }
95
183
  @else {
96
- @error "`#{$rfs-font-size-unit}` is not a valid unit for $rfs-font-size-unit. Use `px` or `rem`.";
97
- }
98
-
99
- // Only add media query if font-size is bigger as the minimum font-size
100
- // If $rfs-factor == 1, no rescaling will take place
101
- @if $fs > $rfs-base-font-size and $enable-responsive-font-sizes {
102
- $min-width: null;
103
- $variable-unit: null;
184
+ // Calculate the minimum font size for $fs
185
+ $fs-min: $rfs-base-font-size + divide($fs - $rfs-base-font-size, $rfs-factor);
104
186
 
105
- // Calculate minimum font-size for given font-size
106
- $fs-min: $rfs-base-font-size + ($fs - $rfs-base-font-size) / $rfs-factor;
107
-
108
- // Calculate difference between given font-size and minimum font-size for given font-size
187
+ // Calculate difference between $fs and the minimum font size
109
188
  $fs-diff: $fs - $fs-min;
110
189
 
111
190
  // Base font-size formatting
112
- // No need to check if the unit is valid, because we did that before
113
- $min-width: if($rfs-font-size-unit == rem, #{$fs-min / $rfs-rem-value}rem, #{$fs-min}px);
191
+ $min-width: if($rfs-font-size-unit == rem, #{divide($fs-min, $rfs-rem-value)}rem, #{$fs-min}px);
114
192
 
115
- // If two-dimensional, use smallest of screen width and height
193
+ // Use `vmin` if two-dimensional is enabled
116
194
  $variable-unit: if($rfs-two-dimensional, vmin, vw);
117
195
 
118
196
  // Calculate the variable width between 0 and $rfs-breakpoint
119
- $variable-width: #{$fs-diff * 100 / $rfs-breakpoint}#{$variable-unit};
197
+ $variable-width: #{divide($fs-diff * 100, $rfs-breakpoint)}#{$variable-unit};
120
198
 
121
- // Set the calculated font-size.
199
+ // Set the calculated font-size
122
200
  $rfs-fluid: calc(#{$min-width} + #{$variable-width}) #{$rfs-suffix};
123
- }
124
201
 
125
- // Rendering
126
- @if $rfs-fluid == null {
127
- // Only render static font-size if no fluid font-size is available
128
- font-size: $rfs-static;
129
- }
130
- @else {
131
- $mq-value: null;
202
+ // Breakpoint formatting
203
+ $mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit});
132
204
 
133
- // RFS breakpoint formatting
134
- @if $rfs-breakpoint-unit == em or $rfs-breakpoint-unit == rem {
135
- $mq-value: #{$rfs-breakpoint / $rfs-rem-value}#{$rfs-breakpoint-unit};
136
- }
137
- @else if $rfs-breakpoint-unit == px {
138
- $mq-value: #{$rfs-breakpoint}px;
139
- }
140
- @else {
141
- @error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
205
+ @include _rfs-disable-class {
206
+ font-size: #{$rfs-static}#{$rfs-suffix};
142
207
  }
143
208
 
144
- @if $rfs-class == "disable" {
145
- // Adding an extra class increases specificity,
146
- // which prevents the media query to override the font size
147
- &,
148
- .disable-responsive-font-size &,
149
- &.disable-responsive-font-size {
150
- font-size: $rfs-static;
209
+ @include _rfs-media-query($mq-value) {
210
+ @include _rfs-enable-class {
211
+ font-size: $rfs-fluid;
151
212
  }
152
- }
153
- @else {
154
- font-size: $rfs-static;
155
- }
156
213
 
157
- @if $rfs-two-dimensional {
158
- @media (max-width: #{$mq-value}), (max-height: #{$mq-value}) {
159
- @if $rfs-class == "enable" {
160
- .enable-responsive-font-size &,
161
- &.enable-responsive-font-size {
162
- font-size: $rfs-fluid;
163
- }
164
- }
165
- @else {
166
- font-size: $rfs-fluid;
167
- }
168
-
169
- @if $rfs-safari-iframe-resize-bug-fix {
170
- // stylelint-disable-next-line length-zero-no-unit
171
- min-width: 0vw;
172
- }
173
- }
174
- }
175
- @else {
176
- @media (max-width: #{$mq-value}) {
177
- @if $rfs-class == "enable" {
178
- .enable-responsive-font-size &,
179
- &.enable-responsive-font-size {
180
- font-size: $rfs-fluid;
181
- }
182
- }
183
- @else {
184
- font-size: $rfs-fluid;
185
- }
186
-
187
- @if $rfs-safari-iframe-resize-bug-fix {
188
- // stylelint-disable-next-line length-zero-no-unit
189
- min-width: 0vw;
190
- }
191
- }
214
+ // Include safari iframe resize fix if needed
215
+ min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
192
216
  }
193
217
  }
194
218
  }
195
219
  }
196
220
 
197
- // The font-size & responsive-font-size mixin uses RFS to rescale font sizes
221
+ // The font-size & responsive-font-size mixins use RFS to rescale the font size
198
222
  @mixin font-size($fs, $important: false) {
199
223
  @include rfs($fs, $important);
200
224
  }
data/bootstrap.gemspec CHANGED
@@ -14,9 +14,7 @@ Gem::Specification.new do |s|
14
14
  # SassC requires Ruby 2.3.3. Also specify here to make it obvious.
15
15
  s.required_ruby_version = '>= 2.3.3'
16
16
 
17
- s.add_runtime_dependency 'popper_js', '>= 1.14.3', '< 2'
18
-
19
- s.add_runtime_dependency 'sassc-rails', '>= 2.0.0'
17
+ s.add_runtime_dependency 'popper_js', '>= 1.16.1', '< 2'
20
18
  s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
21
19
 
22
20
  # Testing dependencies
@@ -25,7 +23,7 @@ Gem::Specification.new do |s|
25
23
  s.add_development_dependency 'term-ansicolor'
26
24
  # Integration testing
27
25
  s.add_development_dependency 'capybara', '>= 2.6.0'
28
- s.add_development_dependency 'poltergeist'
26
+ s.add_development_dependency 'cuprite'
29
27
  # Dummy Rails app dependencies
30
28
  s.add_development_dependency 'actionpack', '>= 4.1.5'
31
29
  s.add_development_dependency 'activesupport', '>= 4.1.5'
@@ -1,7 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'autoprefixer-rails'
4
- require 'sassc-rails'
4
+ begin
5
+ require 'dartsass-sprockets'
6
+ rescue LoadError
7
+ begin
8
+ require 'sassc-rails'
9
+ rescue LoadError
10
+ begin
11
+ require 'dartsass-rails'
12
+ rescue LoadError
13
+ begin
14
+ require 'cssbundling-rails'
15
+ rescue LoadError
16
+ raise LoadError.new("bootstrap-rubygem requires a Sass engine. Please add dartsass-sprockets, sassc-rails, dartsass-rails or cssbundling-rails to your dependencies.")
17
+ end
18
+ end
19
+ end
20
+ end
5
21
 
6
22
  module Bootstrap
7
23
  module Rails
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootstrap
4
- VERSION = '4.3.1'
5
- BOOTSTRAP_SHA = '8fa0d3010112dca5dd6dd501173415856001ba8b'
4
+ VERSION = '4.6.2.1'
5
+ BOOTSTRAP_SHA = 'e5643aaa89eb67327a5b4abe7db976f0ea276b70'
6
6
  end
data/tasks/updater/js.rb CHANGED
@@ -1,7 +1,11 @@
1
+ require 'pathname'
1
2
  require 'tsort'
2
3
 
3
4
  class Updater
4
5
  module Js
6
+ INLINED_SRCS = %w[index.js tools/sanitizer.js].freeze
7
+ EXTERNAL_JS = %w[popper.js].freeze
8
+
5
9
  def update_javascript_assets
6
10
  log_status 'Updating javascripts...'
7
11
  save_to = @save_to[:js]
@@ -29,13 +33,15 @@ class Updater
29
33
 
30
34
  def bootstrap_js_files
31
35
  @bootstrap_js_files ||= begin
32
- src_files = get_paths_by_type('js/src', /\.js$/) - %w[index.js tools/sanitizer.js]
36
+ src_files = get_paths_by_type('js/src', /\.js$/) - INLINED_SRCS
37
+ puts "src_files: #{src_files.inspect}"
33
38
  imports = Deps.new
34
39
  # Get the imports from the ES6 files to order requires correctly.
35
40
  read_files('js/src', src_files).each do |name, content|
36
- imports.add name,
37
- *content.scan(%r{import [a-zA-Z]* from '\./(\w+)})
38
- .flatten(1).map { |f| "#{f}.js" }
41
+ file_imports = content.scan(%r{import *(?:[a-zA-Z]*|\{[a-zA-Z ,]*\}) *from '([\w/.-]+)}).flatten(1).map do |f|
42
+ Pathname.new(name).dirname.join(f.end_with?(".js") ? f : "#{f}.js").cleanpath.to_s
43
+ end.uniq
44
+ imports.add name, *(file_imports - INLINED_SRCS - EXTERNAL_JS)
39
45
  end
40
46
  imports.tsort
41
47
  end
@@ -53,11 +59,17 @@ class Updater
53
59
  end
54
60
 
55
61
  def add(from, *tos)
56
- (@imports[from] ||= []).push(*tos.sort)
62
+ imports = (@imports[from] ||= [])
63
+ imports.push(*tos)
64
+ imports.sort!
57
65
  end
58
66
 
59
67
  def tsort_each_child(node, &block)
60
- @imports[node].each(&block)
68
+ node_imports = @imports[node]
69
+ if node_imports.nil?
70
+ raise "No imports found for #{node.inspect}\nImports:\n#{@imports.inspect}"
71
+ end
72
+ node_imports.each(&block)
61
73
  end
62
74
 
63
75
  def tsort_each_node(&block)
@@ -25,7 +25,13 @@ class Updater
25
25
  log_http_get_files files, path_url, false
26
26
  files.map do |name|
27
27
  Thread.start {
28
- contents[name] = open("#{path_url}/#{name}").read
28
+ begin
29
+ url = "#{path_url}/#{name}"
30
+ contents[name] = URI.open(url).read
31
+ rescue Exception => e
32
+ log "Error downloading #{url}: #{e}"
33
+ exit 1
34
+ end
29
35
  WRITE_FILES_MUTEX.synchronize { write_cached_files path, name => contents[name] }
30
36
  }
31
37
  end.each(&:join)
@@ -62,7 +68,7 @@ class Updater
62
68
  File.read(cache_path, mode: 'rb')
63
69
  else
64
70
  log_http_get_file url, false
65
- content = open(url).read
71
+ content = URI.open(url).read
66
72
  File.open(cache_path, 'wb') { |f| f.write content }
67
73
  content
68
74
  end
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -0,0 +1 @@
1
+ Chrome >= 25
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'actionpack', '~> 6.0.3'
4
+ gem 'activesupport', '~> 6.0.3'
5
+ gem 'autoprefixer-rails', '>= 9.7.6'
6
+
7
+ gemspec path: '../../'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'actionpack', '~> 7.0.4'
4
+ gem 'activesupport', '~> 7.0.4'
5
+ gem 'autoprefixer-rails', '>= 9.7.6'
6
+ gem 'dartsass-sprockets', '~> 3.0'
7
+
8
+ gemspec path: '../../'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'actionpack', '~> 7.0.4'
4
+ gem 'activesupport', '~> 7.0.4'
5
+ gem 'autoprefixer-rails', '>= 9.7.6'
6
+ gem 'sassc-rails', '~> 2.0'
7
+
8
+ gemspec path: '../../'
@@ -17,7 +17,9 @@ module DummyRailsIntegration
17
17
 
18
18
  def screenshot!
19
19
  path = "tmp/#{name}.png"
20
- page.driver.render(File.join(GEM_PATH, path), full: true)
20
+ full_path = File.join(GEM_PATH, path)
21
+ FileUtils.mkdir_p(File.dirname(full_path))
22
+ page.driver.render(full_path, full: true)
21
23
  STDERR.puts "Screenshot saved to #{path}"
22
24
  end
23
25
 
data/test/test_helper.rb CHANGED
@@ -12,24 +12,29 @@ end
12
12
 
13
13
  GEM_PATH = File.expand_path('../', File.dirname(__FILE__))
14
14
 
15
- #= Capybara + Poltergeist
16
- require 'capybara/poltergeist'
17
-
18
- Capybara.register_driver :poltergeist do |app|
19
- Capybara::Poltergeist::Driver.new(
20
- app,
21
- # inspector: '/Applications/Chromium.app/Contents/MacOS/Chromium', # open in inspector: page.driver.debug
22
- window_size: [1280, 1024],
23
- timeout: 90,
24
- js_errors: true
25
- )
15
+ #= Capybara
16
+ require 'capybara/cuprite'
17
+
18
+ browser_path = ENV['CHROMIUM_BIN'] || %w[
19
+ /usr/bin/chromium-browser
20
+ /snap/bin/chromium
21
+ /Applications/Chromium.app/Contents/MacOS/Chromium
22
+ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
23
+ ].find { |path| File.executable?(path) }
24
+
25
+ Capybara.register_driver :cuprite do |app|
26
+ options = {
27
+ window_size: [1280, 1024]
28
+ }
29
+ options[:browser_path] = browser_path if browser_path
30
+ Capybara::Cuprite::Driver.new(app, options)
26
31
  end
27
32
 
28
33
  Capybara.configure do |config|
29
34
  config.server = :webrick
30
35
  config.app_host = 'http://localhost:7000'
31
- config.default_driver = :poltergeist
32
- config.javascript_driver = :poltergeist
36
+ config.default_driver = :cuprite
37
+ config.javascript_driver = :cuprite
33
38
  config.server_port = 7000
34
39
  config.default_max_wait_time = 10
35
40
  end