bootstrap 4.6.0 → 5.3.2

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 (184) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +61 -0
  3. data/Gemfile +1 -0
  4. data/README.md +33 -6
  5. data/Rakefile +10 -1
  6. data/assets/javascripts/bootstrap/alert.js +53 -155
  7. data/assets/javascripts/bootstrap/base-component.js +83 -0
  8. data/assets/javascripts/bootstrap/button.js +43 -198
  9. data/assets/javascripts/bootstrap/carousel.js +285 -550
  10. data/assets/javascripts/bootstrap/collapse.js +169 -323
  11. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  15. data/assets/javascripts/bootstrap/dropdown.js +300 -467
  16. data/assets/javascripts/bootstrap/modal.js +226 -575
  17. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  18. data/assets/javascripts/bootstrap/popover.js +61 -205
  19. data/assets/javascripts/bootstrap/scrollspy.js +216 -287
  20. data/assets/javascripts/bootstrap/tab.js +226 -203
  21. data/assets/javascripts/bootstrap/toast.js +136 -209
  22. data/assets/javascripts/bootstrap/tooltip.js +411 -757
  23. data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
  24. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  25. data/assets/javascripts/bootstrap/util/config.js +67 -0
  26. data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
  27. data/assets/javascripts/bootstrap/util/index.js +281 -0
  28. data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
  29. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  30. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  31. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  32. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  33. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  34. data/assets/javascripts/bootstrap-sprockets.js +23 -7
  35. data/assets/javascripts/bootstrap.js +3649 -3587
  36. data/assets/javascripts/bootstrap.min.js +3 -3
  37. data/assets/stylesheets/_bootstrap-grid.scss +53 -21
  38. data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
  39. data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
  40. data/assets/stylesheets/_bootstrap.scss +21 -13
  41. data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
  42. data/assets/stylesheets/bootstrap/_alert.scss +32 -16
  43. data/assets/stylesheets/bootstrap/_badge.scss +15 -31
  44. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
  45. data/assets/stylesheets/bootstrap/_button-group.scss +27 -48
  46. data/assets/stylesheets/bootstrap/_buttons.scss +136 -71
  47. data/assets/stylesheets/bootstrap/_card.scss +66 -113
  48. data/assets/stylesheets/bootstrap/_carousel.scss +83 -36
  49. data/assets/stylesheets/bootstrap/_close.scss +51 -28
  50. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  51. data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
  52. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  53. data/assets/stylesheets/bootstrap/_functions.scss +181 -23
  54. data/assets/stylesheets/bootstrap/_grid.scss +18 -52
  55. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  56. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  57. data/assets/stylesheets/bootstrap/_list-group.scss +77 -34
  58. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  59. data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
  60. data/assets/stylesheets/bootstrap/_modal.scss +107 -110
  61. data/assets/stylesheets/bootstrap/_nav.scss +102 -25
  62. data/assets/stylesheets/bootstrap/_navbar.scss +129 -172
  63. data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
  64. data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
  65. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  66. data/assets/stylesheets/bootstrap/_popover.scss +99 -73
  67. data/assets/stylesheets/bootstrap/_progress.scss +35 -14
  68. data/assets/stylesheets/bootstrap/_reboot.scss +319 -192
  69. data/assets/stylesheets/bootstrap/_root.scss +177 -9
  70. data/assets/stylesheets/bootstrap/_spinners.scss +44 -24
  71. data/assets/stylesheets/bootstrap/_tables.scss +101 -115
  72. data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
  73. data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
  74. data/assets/stylesheets/bootstrap/_transitions.scss +8 -1
  75. data/assets/stylesheets/bootstrap/_type.scss +40 -59
  76. data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
  77. data/assets/stylesheets/bootstrap/_variables-dark.scss +87 -0
  78. data/assets/stylesheets/bootstrap/_variables.scss +1216 -615
  79. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
  80. data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -0
  81. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  82. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  83. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  84. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  85. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  86. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  87. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  88. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  89. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  90. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  91. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  92. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  93. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  94. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  95. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  96. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  97. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  98. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  99. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
  100. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  101. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  102. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  103. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  104. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
  105. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
  106. data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
  107. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  108. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  109. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  110. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  111. data/assets/stylesheets/bootstrap/mixins/_forms.scss +53 -85
  112. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  113. data/assets/stylesheets/bootstrap/mixins/_grid.scss +119 -37
  114. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  115. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
  116. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  117. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
  118. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
  119. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  120. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  121. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  122. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  123. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  124. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +276 -132
  125. data/bootstrap.gemspec +6 -7
  126. data/lib/bootstrap/engine.rb +7 -1
  127. data/lib/bootstrap/version.rb +2 -2
  128. data/tasks/updater/js.rb +31 -7
  129. data/tasks/updater/network.rb +9 -3
  130. data/tasks/updater/scss.rb +2 -2
  131. data/tasks/updater.rb +2 -2
  132. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  133. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  134. data/test/dummy_rails/app/views/pages/root.html +89 -0
  135. data/test/dummy_rails/config/application.rb +0 -3
  136. data/test/gemfiles/rails_4_2.gemfile +1 -1
  137. data/test/gemfiles/rails_5_0.gemfile +1 -1
  138. data/test/gemfiles/rails_5_1.gemfile +1 -1
  139. data/test/gemfiles/rails_5_2.gemfile +8 -0
  140. data/test/gemfiles/rails_6_0.gemfile +1 -0
  141. data/test/gemfiles/rails_6_1.gemfile +8 -0
  142. data/test/gemfiles/rails_7_0_dartsass.gemfile +8 -0
  143. data/test/gemfiles/rails_7_0_sassc.gemfile +8 -0
  144. data/test/test_helper.rb +3 -2
  145. metadata +97 -85
  146. data/.travis.yml +0 -31
  147. data/assets/javascripts/bootstrap/util.js +0 -192
  148. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  149. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  150. data/assets/stylesheets/bootstrap/_input-group.scss +0 -208
  151. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  152. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  153. data/assets/stylesheets/bootstrap/_print.scss +0 -141
  154. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  155. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  156. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  157. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  158. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  159. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  160. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  161. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  162. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  163. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  164. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  165. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  166. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  167. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  168. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  169. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  170. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  171. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  172. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  173. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  174. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  175. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  176. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  177. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  178. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  179. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  180. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  181. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  182. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  183. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  184. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,31 +1,42 @@
1
- // stylelint-disable property-blacklist, scss/dollar-variable-default
1
+ // stylelint-disable scss/dimension-no-non-numeric-values
2
2
 
3
3
  // SCSS RFS mixin
4
4
  //
5
- // Automated font-resizing
5
+ // Automated responsive values for font sizes, paddings, margins and much more
6
6
  //
7
- // See https://github.com/twbs/rfs
7
+ // Licensed under MIT (https://github.com/twbs/rfs/blob/main/LICENSE)
8
8
 
9
9
  // Configuration
10
10
 
11
- // Base font size
12
- $rfs-base-font-size: 1.25rem !default;
13
- $rfs-font-size-unit: rem !default;
11
+ // Base value
12
+ $rfs-base-value: 1.25rem !default;
13
+ $rfs-unit: rem !default;
14
14
 
15
- // Breakpoint at where font-size starts decreasing if screen width is smaller
15
+ @if $rfs-unit != rem and $rfs-unit != px {
16
+ @error "`#{$rfs-unit}` is not a valid unit for $rfs-unit. Use `px` or `rem`.";
17
+ }
18
+
19
+ // Breakpoint at where values start 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 values based on screen height and width
20
28
  $rfs-two-dimensional: false !default;
21
29
 
22
30
  // Factor of decrease
23
31
  $rfs-factor: 10 !default;
24
32
 
25
- @if type-of($rfs-factor) != "number" or $rfs-factor <= 1 {
33
+ @if type-of($rfs-factor) != number or $rfs-factor <= 1 {
26
34
  @error "`#{$rfs-factor}` is not a valid $rfs-factor, it must be greater than 1.";
27
35
  }
28
36
 
37
+ // Mode. Possibilities: "min-media-query", "max-media-query"
38
+ $rfs-mode: min-media-query !default;
39
+
29
40
  // Generate enable or disable classes. Possibilities: false, "enable" or "disable"
30
41
  $rfs-class: false !default;
31
42
 
@@ -35,170 +46,303 @@ $rfs-rem-value: 16 !default;
35
46
  // Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
36
47
  $rfs-safari-iframe-resize-bug-fix: false !default;
37
48
 
38
- // Disable RFS by setting $enable-responsive-font-sizes to false
39
- $enable-responsive-font-sizes: true !default;
49
+ // Disable RFS by setting $enable-rfs to false
50
+ $enable-rfs: true !default;
40
51
 
41
- // Cache $rfs-base-font-size unit
42
- $rfs-base-font-size-unit: unit($rfs-base-font-size);
52
+ // Cache $rfs-base-value unit
53
+ $rfs-base-value-unit: unit($rfs-base-value);
54
+
55
+ @function divide($dividend, $divisor, $precision: 10) {
56
+ $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
57
+ $dividend: abs($dividend);
58
+ $divisor: abs($divisor);
59
+ @if $dividend == 0 {
60
+ @return 0;
61
+ }
62
+ @if $divisor == 0 {
63
+ @error "Cannot divide by 0";
64
+ }
65
+ $remainder: $dividend;
66
+ $result: 0;
67
+ $factor: 10;
68
+ @while ($remainder > 0 and $precision >= 0) {
69
+ $quotient: 0;
70
+ @while ($remainder >= $divisor) {
71
+ $remainder: $remainder - $divisor;
72
+ $quotient: $quotient + 1;
73
+ }
74
+ $result: $result * 10 + $quotient;
75
+ $factor: $factor * .1;
76
+ $remainder: $remainder * 10;
77
+ $precision: $precision - 1;
78
+ @if ($precision < 0 and $remainder >= $divisor * 5) {
79
+ $result: $result + 1;
80
+ }
81
+ }
82
+ $result: $result * $factor * $sign;
83
+ $dividend-unit: unit($dividend);
84
+ $divisor-unit: unit($divisor);
85
+ $unit-map: (
86
+ "px": 1px,
87
+ "rem": 1rem,
88
+ "em": 1em,
89
+ "%": 1%
90
+ );
91
+ @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
92
+ $result: $result * map-get($unit-map, $dividend-unit);
93
+ }
94
+ @return $result;
95
+ }
43
96
 
44
- // Remove px-unit from $rfs-base-font-size for calculations
45
- @if $rfs-base-font-size-unit == "px" {
46
- $rfs-base-font-size: $rfs-base-font-size / ($rfs-base-font-size * 0 + 1);
97
+ // Remove px-unit from $rfs-base-value for calculations
98
+ @if $rfs-base-value-unit == px {
99
+ $rfs-base-value: divide($rfs-base-value, $rfs-base-value * 0 + 1);
47
100
  }
48
- @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);
101
+ @else if $rfs-base-value-unit == rem {
102
+ $rfs-base-value: divide($rfs-base-value, divide($rfs-base-value * 0 + 1, $rfs-rem-value));
50
103
  }
51
104
 
52
105
  // Cache $rfs-breakpoint unit to prevent multiple calls
53
106
  $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
54
107
 
55
108
  // Remove unit from $rfs-breakpoint for calculations
56
- @if $rfs-breakpoint-unit-cache == "px" {
57
- $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1);
109
+ @if $rfs-breakpoint-unit-cache == px {
110
+ $rfs-breakpoint: divide($rfs-breakpoint, $rfs-breakpoint * 0 + 1);
58
111
  }
59
- @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);
112
+ @else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" {
113
+ $rfs-breakpoint: divide($rfs-breakpoint, divide($rfs-breakpoint * 0 + 1, $rfs-rem-value));
61
114
  }
62
115
 
63
- // Responsive font-size mixin
64
- @mixin rfs($fs, $important: false) {
65
- // Cache $fs unit
66
- $fs-unit: if(type-of($fs) == "number", unit($fs), false);
67
-
68
- // Add !important suffix if needed
69
- $rfs-suffix: if($important, " !important", "");
70
-
71
- // If $fs isn't a number (like inherit) or $fs has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
72
- @if not $fs-unit or $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0 {
73
- font-size: #{$fs}#{$rfs-suffix};
116
+ // Calculate the media query value
117
+ $rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit});
118
+ $rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width);
119
+ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height);
120
+
121
+ // Internal mixin used to determine which media query needs to be used
122
+ @mixin _rfs-media-query {
123
+ @if $rfs-two-dimensional {
124
+ @if $rfs-mode == max-media-query {
125
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
126
+ @content;
127
+ }
128
+ }
129
+ @else {
130
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
131
+ @content;
132
+ }
133
+ }
74
134
  }
75
135
  @else {
76
- // Variables for storing static and fluid rescaling
77
- $rfs-static: null;
78
- $rfs-fluid: null;
136
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
137
+ @content;
138
+ }
139
+ }
140
+ }
79
141
 
80
- // Remove px-unit from $fs for calculations
81
- @if $fs-unit == "px" {
82
- $fs: $fs / ($fs * 0 + 1);
142
+ // Internal mixin that adds disable classes to the selector if needed.
143
+ @mixin _rfs-rule {
144
+ @if $rfs-class == disable and $rfs-mode == max-media-query {
145
+ // Adding an extra class increases specificity, which prevents the media query to override the property
146
+ &,
147
+ .disable-rfs &,
148
+ &.disable-rfs {
149
+ @content;
150
+ }
151
+ }
152
+ @else if $rfs-class == enable and $rfs-mode == min-media-query {
153
+ .enable-rfs &,
154
+ &.enable-rfs {
155
+ @content;
83
156
  }
84
- @else if $fs-unit == "rem" {
85
- $fs: $fs / ($fs * 0 + 1 / $rfs-rem-value);
157
+ } @else {
158
+ @content;
159
+ }
160
+ }
161
+
162
+ // Internal mixin that adds enable classes to the selector if needed.
163
+ @mixin _rfs-media-query-rule {
164
+
165
+ @if $rfs-class == enable {
166
+ @if $rfs-mode == min-media-query {
167
+ @content;
86
168
  }
87
169
 
88
- // Set default font-size
89
- @if $rfs-font-size-unit == rem {
90
- $rfs-static: #{$fs / $rfs-rem-value}rem#{$rfs-suffix};
170
+ @include _rfs-media-query () {
171
+ .enable-rfs &,
172
+ &.enable-rfs {
173
+ @content;
174
+ }
91
175
  }
92
- @else if $rfs-font-size-unit == px {
93
- $rfs-static: #{$fs}px#{$rfs-suffix};
176
+ }
177
+ @else {
178
+ @if $rfs-class == disable and $rfs-mode == min-media-query {
179
+ .disable-rfs &,
180
+ &.disable-rfs {
181
+ @content;
182
+ }
183
+ }
184
+ @include _rfs-media-query () {
185
+ @content;
186
+ }
187
+ }
188
+ }
189
+
190
+ // Helper function to get the formatted non-responsive value
191
+ @function rfs-value($values) {
192
+ // Convert to list
193
+ $values: if(type-of($values) != list, ($values,), $values);
194
+
195
+ $val: "";
196
+
197
+ // Loop over each value and calculate value
198
+ @each $value in $values {
199
+ @if $value == 0 {
200
+ $val: $val + " 0";
94
201
  }
95
202
  @else {
96
- @error "`#{$rfs-font-size-unit}` is not a valid unit for $rfs-font-size-unit. Use `px` or `rem`.";
203
+ // Cache $value unit
204
+ $unit: if(type-of($value) == "number", unit($value), false);
205
+
206
+ @if $unit == px {
207
+ // Convert to rem if needed
208
+ $val: $val + " " + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value);
209
+ }
210
+ @else if $unit == rem {
211
+ // Convert to px if needed
212
+ $val: $val + " " + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value);
213
+ } @else {
214
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
215
+ $val: $val + " " + $value;
216
+ }
97
217
  }
218
+ }
219
+
220
+ // Remove first space
221
+ @return unquote(str-slice($val, 2));
222
+ }
98
223
 
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;
224
+ // Helper function to get the responsive value calculated by RFS
225
+ @function rfs-fluid-value($values) {
226
+ // Convert to list
227
+ $values: if(type-of($values) != list, ($values,), $values);
228
+
229
+ $val: "";
230
+
231
+ // Loop over each value and calculate value
232
+ @each $value in $values {
233
+ @if $value == 0 {
234
+ $val: $val + " 0";
235
+ } @else {
236
+ // Cache $value unit
237
+ $unit: if(type-of($value) == "number", unit($value), false);
238
+
239
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
240
+ @if not $unit or $unit != px and $unit != rem {
241
+ $val: $val + " " + $value;
242
+ } @else {
243
+ // Remove unit from $value for calculations
244
+ $value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value)));
245
+
246
+ // Only add the media query if the value is greater than the minimum value
247
+ @if abs($value) <= $rfs-base-value or not $enable-rfs {
248
+ $val: $val + " " + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px);
249
+ }
250
+ @else {
251
+ // Calculate the minimum value
252
+ $value-min: $rfs-base-value + divide(abs($value) - $rfs-base-value, $rfs-factor);
104
253
 
105
- // Calculate minimum font-size for given font-size
106
- $fs-min: $rfs-base-font-size + ($fs - $rfs-base-font-size) / $rfs-factor;
254
+ // Calculate difference between $value and the minimum value
255
+ $value-diff: abs($value) - $value-min;
107
256
 
108
- // Calculate difference between given font-size and minimum font-size for given font-size
109
- $fs-diff: $fs - $fs-min;
257
+ // Base value formatting
258
+ $min-width: if($rfs-unit == rem, #{divide($value-min, $rfs-rem-value)}rem, #{$value-min}px);
110
259
 
111
- // 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);
260
+ // Use negative value if needed
261
+ $min-width: if($value < 0, -$min-width, $min-width);
114
262
 
115
- // If two-dimensional, use smallest of screen width and height
116
- $variable-unit: if($rfs-two-dimensional, vmin, vw);
263
+ // Use `vmin` if two-dimensional is enabled
264
+ $variable-unit: if($rfs-two-dimensional, vmin, vw);
117
265
 
118
- // Calculate the variable width between 0 and $rfs-breakpoint
119
- $variable-width: #{$fs-diff * 100 / $rfs-breakpoint}#{$variable-unit};
266
+ // Calculate the variable width between 0 and $rfs-breakpoint
267
+ $variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit};
120
268
 
121
- // Set the calculated font-size.
122
- $rfs-fluid: calc(#{$min-width} + #{$variable-width}) #{$rfs-suffix};
269
+ // Return the calculated value
270
+ $val: $val + " calc(" + $min-width + if($value < 0, " - ", " + ") + $variable-width + ")";
271
+ }
272
+ }
123
273
  }
274
+ }
124
275
 
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;
276
+ // Remove first space
277
+ @return unquote(str-slice($val, 2));
278
+ }
279
+
280
+ // RFS mixin
281
+ @mixin rfs($values, $property: font-size) {
282
+ @if $values != null {
283
+ $val: rfs-value($values);
284
+ $fluid-val: rfs-fluid-value($values);
285
+
286
+ // Do not print the media query if responsive & non-responsive values are the same
287
+ @if $val == $fluid-val {
288
+ #{$property}: $val;
129
289
  }
130
290
  @else {
131
- $mq-value: null;
132
-
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`.";
142
- }
291
+ @include _rfs-rule () {
292
+ #{$property}: if($rfs-mode == max-media-query, $val, $fluid-val);
143
293
 
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;
151
- }
152
- }
153
- @else {
154
- font-size: $rfs-static;
294
+ // Include safari iframe resize fix if needed
295
+ min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
155
296
  }
156
297
 
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
- }
298
+ @include _rfs-media-query-rule () {
299
+ #{$property}: if($rfs-mode == max-media-query, $fluid-val, $val);
192
300
  }
193
301
  }
194
302
  }
195
303
  }
196
304
 
197
- // The font-size & responsive-font-size mixin uses RFS to rescale font sizes
198
- @mixin font-size($fs, $important: false) {
199
- @include rfs($fs, $important);
305
+ // Shorthand helper mixins
306
+ @mixin font-size($value) {
307
+ @include rfs($value);
308
+ }
309
+
310
+ @mixin padding($value) {
311
+ @include rfs($value, padding);
312
+ }
313
+
314
+ @mixin padding-top($value) {
315
+ @include rfs($value, padding-top);
316
+ }
317
+
318
+ @mixin padding-right($value) {
319
+ @include rfs($value, padding-right);
320
+ }
321
+
322
+ @mixin padding-bottom($value) {
323
+ @include rfs($value, padding-bottom);
324
+ }
325
+
326
+ @mixin padding-left($value) {
327
+ @include rfs($value, padding-left);
328
+ }
329
+
330
+ @mixin margin($value) {
331
+ @include rfs($value, margin);
332
+ }
333
+
334
+ @mixin margin-top($value) {
335
+ @include rfs($value, margin-top);
336
+ }
337
+
338
+ @mixin margin-right($value) {
339
+ @include rfs($value, margin-right);
340
+ }
341
+
342
+ @mixin margin-bottom($value) {
343
+ @include rfs($value, margin-bottom);
200
344
  }
201
345
 
202
- @mixin responsive-font-size($fs, $important: false) {
203
- @include rfs($fs, $important);
346
+ @mixin margin-left($value) {
347
+ @include rfs($value, margin-left);
204
348
  }
data/bootstrap.gemspec CHANGED
@@ -14,25 +14,24 @@ 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', '>= 2.11.8', '< 3'
20
18
  s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
21
19
 
20
+ s.add_development_dependency 'rake'
21
+
22
22
  # Testing dependencies
23
- s.add_development_dependency 'minitest', '~> 5.8.0'
24
- s.add_development_dependency 'minitest-reporters', '~> 1.0.5'
23
+ s.add_development_dependency 'minitest', '~> 5.14.4'
24
+ s.add_development_dependency 'minitest-reporters', '~> 1.4.3'
25
25
  s.add_development_dependency 'term-ansicolor'
26
26
  # Integration testing
27
27
  s.add_development_dependency 'capybara', '>= 2.6.0'
28
28
  s.add_development_dependency 'cuprite'
29
29
  # Dummy Rails app dependencies
30
+ s.add_development_dependency 'railties'
30
31
  s.add_development_dependency 'actionpack', '>= 4.1.5'
31
32
  s.add_development_dependency 'activesupport', '>= 4.1.5'
32
33
  s.add_development_dependency 'json', '>= 1.8.1'
33
34
  s.add_development_dependency 'sprockets-rails', '>= 2.3.2'
34
- s.add_development_dependency 'jquery-rails', '>= 3.1.0'
35
- s.add_development_dependency 'slim-rails'
36
35
  s.add_development_dependency 'uglifier'
37
36
 
38
37
  s.files = `git ls-files`.split("\n")
@@ -1,7 +1,13 @@
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
+ require 'sassc-rails'
8
+ rescue LoadError
9
+ raise LoadError.new("bootstrap-rubygem requires a Sass engine. Please add dartsass-sprockets or sassc-rails to your dependencies.")
10
+ end
5
11
 
6
12
  module Bootstrap
7
13
  module Rails
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootstrap
4
- VERSION = '4.6.0'
5
- BOOTSTRAP_SHA = '6ffb0b48e455430f8a5359ed689ad64c1143fac2'
4
+ VERSION = '5.3.2'
5
+ BOOTSTRAP_SHA = '344e912d04b5b6a04482113eff20ab416ff01048'
6
6
  end
data/tasks/updater/js.rb CHANGED
@@ -1,7 +1,10 @@
1
+ require 'pathname'
1
2
  require 'tsort'
2
3
 
3
4
  class Updater
4
5
  module Js
6
+ INLINED_SRCS = %w[].freeze
7
+
5
8
  def update_javascript_assets
6
9
  log_status 'Updating javascripts...'
7
10
  save_to = @save_to[:js]
@@ -11,13 +14,26 @@ class Updater
11
14
  log_processed "#{bootstrap_js_files * ' '}"
12
15
 
13
16
  log_status 'Updating javascript manifest'
14
- manifest = ''
17
+ manifest = "//= require ./bootstrap-global-this-define\n"
15
18
  bootstrap_js_files.each do |name|
16
19
  name = name.gsub(/\.js$/, '')
17
20
  manifest << "//= require ./bootstrap/#{name}\n"
18
21
  end
22
+ manifest << "//= require ./bootstrap-global-this-undefine\n"
19
23
  dist_js = read_files('dist/js', %w(bootstrap.js bootstrap.min.js))
20
24
  {
25
+ 'assets/javascripts/bootstrap-global-this-define.js' => <<~JS,
26
+ // Set a `globalThis` so that bootstrap components are defined on window.bootstrap instead of window.
27
+ window['bootstrap'] = {
28
+ "@popperjs/core": window.Popper,
29
+ _originalGlobalThis: window['globalThis']
30
+ };
31
+ window['globalThis'] = window['bootstrap'];
32
+ JS
33
+ 'assets/javascripts/bootstrap-global-this-undefine.js' => <<~JS,
34
+ window['globalThis'] = window['bootstrap']._originalGlobalThis;
35
+ window['bootstrap']._originalGlobalThis = null;
36
+ JS
21
37
  'assets/javascripts/bootstrap-sprockets.js' => manifest,
22
38
  'assets/javascripts/bootstrap.js' => dist_js['bootstrap.js'],
23
39
  'assets/javascripts/bootstrap.min.js' => dist_js['bootstrap.min.js'],
@@ -29,13 +45,15 @@ class Updater
29
45
 
30
46
  def bootstrap_js_files
31
47
  @bootstrap_js_files ||= begin
32
- src_files = get_paths_by_type('js/src', /\.js$/) - %w[index.js tools/sanitizer.js]
48
+ src_files = get_paths_by_type('js/src', /\.js$/) - INLINED_SRCS
49
+ puts "src_files: #{src_files.inspect}"
33
50
  imports = Deps.new
34
51
  # Get the imports from the ES6 files to order requires correctly.
35
52
  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" }
53
+ file_imports = content.scan(%r{import *(?:[a-zA-Z]*|\{[a-zA-Z ,]*\}) *from '([\w/.-]+)}).flatten(1).map do |f|
54
+ Pathname.new(name).dirname.join(f).cleanpath.to_s
55
+ end.uniq
56
+ imports.add name, *(file_imports - INLINED_SRCS)
39
57
  end
40
58
  imports.tsort
41
59
  end
@@ -53,11 +71,17 @@ class Updater
53
71
  end
54
72
 
55
73
  def add(from, *tos)
56
- (@imports[from] ||= []).push(*tos.sort)
74
+ imports = (@imports[from] ||= [])
75
+ imports.push(*tos)
76
+ imports.sort!
57
77
  end
58
78
 
59
79
  def tsort_each_child(node, &block)
60
- @imports[node].each(&block)
80
+ node_imports = @imports[node]
81
+ if node_imports.nil?
82
+ raise "No imports found for #{node.inspect}\nImports:\n#{@imports.inspect}"
83
+ end
84
+ node_imports.each(&block)
61
85
  end
62
86
 
63
87
  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] = URI.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)
@@ -38,7 +44,7 @@ class Updater
38
44
  if File.directory?(full_path)
39
45
  files.each do |name|
40
46
  path = "#{full_path}/#{name}"
41
- contents[name] = File.read(path, mode: 'rb') if File.exists?(path)
47
+ contents[name] = File.read(path, mode: 'rb') if File.exist?(path)
42
48
  end
43
49
  end
44
50
  contents
@@ -57,7 +63,7 @@ class Updater
57
63
  uri = URI(url)
58
64
  cache_path = "./#@cache_path#{uri.path}#{uri.query.tr('?&=', '-') if uri.query}"
59
65
  FileUtils.mkdir_p File.dirname(cache_path)
60
- if File.exists?(cache_path)
66
+ if File.exist?(cache_path)
61
67
  log_http_get_file url, true
62
68
  File.read(cache_path, mode: 'rb')
63
69
  else
@@ -4,7 +4,7 @@ class Updater
4
4
  log_status 'Updating scss...'
5
5
  save_to = @save_to[:scss]
6
6
  contents = {}
7
- bootstrap_scss_files = get_paths_by_type('scss', /\.scss$/)
7
+ bootstrap_scss_files = get_paths_by_type('scss', /\.scss$/).reject { |p| p.start_with?('tests/') }
8
8
  read_files('scss', bootstrap_scss_files).each do |name, file|
9
9
  contents[name] = file
10
10
  save_file("#{save_to}/#{name}", file)
@@ -12,7 +12,7 @@ class Updater
12
12
  log_processed "#{bootstrap_scss_files * ' '}"
13
13
 
14
14
  log_status 'Updating scss main files'
15
- %w(bootstrap bootstrap-grid bootstrap-reboot).each do |name|
15
+ %w(bootstrap bootstrap-grid bootstrap-reboot bootstrap-utilities).each do |name|
16
16
  # Compass treats non-partials as targets to copy into the main project, so make them partials.
17
17
  # Also move them up a level to clearly indicate entry points.
18
18
  from = "#{save_to}/#{name}.scss"