bootstrap 4.0.0.beta3 → 4.6.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.
- checksums.yaml +5 -5
- data/.travis.yml +15 -1
- data/CHANGELOG.md +2 -2
- data/README.md +2 -2
- data/Rakefile +4 -2
- data/assets/javascripts/bootstrap/alert.js +79 -68
- data/assets/javascripts/bootstrap/button.js +140 -78
- data/assets/javascripts/bootstrap/carousel.js +294 -158
- data/assets/javascripts/bootstrap/collapse.js +157 -133
- data/assets/javascripts/bootstrap/dropdown.js +257 -167
- data/assets/javascripts/bootstrap/modal.js +285 -204
- data/assets/javascripts/bootstrap/popover.js +101 -60
- data/assets/javascripts/bootstrap/scrollspy.js +127 -106
- data/assets/javascripts/bootstrap/tab.js +113 -101
- data/assets/javascripts/bootstrap/toast.js +267 -0
- data/assets/javascripts/bootstrap/tooltip.js +406 -188
- data/assets/javascripts/bootstrap/util.js +106 -55
- data/assets/javascripts/bootstrap-sprockets.js +1 -0
- data/assets/javascripts/bootstrap.js +1946 -1482
- data/assets/javascripts/bootstrap.min.js +4 -4
- data/assets/stylesheets/_bootstrap-grid.scss +7 -12
- data/assets/stylesheets/_bootstrap-reboot.scss +4 -4
- data/assets/stylesheets/_bootstrap.scss +6 -4
- data/assets/stylesheets/bootstrap/_alert.scss +3 -2
- data/assets/stylesheets/bootstrap/_badge.scss +8 -1
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +10 -6
- data/assets/stylesheets/bootstrap/_button-group.scss +17 -20
- data/assets/stylesheets/bootstrap/_buttons.scss +23 -28
- data/assets/stylesheets/bootstrap/_card.scss +77 -61
- data/assets/stylesheets/bootstrap/_carousel.scss +72 -63
- data/assets/stylesheets/bootstrap/_close.scss +15 -9
- data/assets/stylesheets/bootstrap/_code.scss +6 -14
- data/assets/stylesheets/bootstrap/_custom-forms.scss +287 -43
- data/assets/stylesheets/bootstrap/_dropdown.scss +70 -9
- data/assets/stylesheets/bootstrap/_forms.scss +56 -42
- data/assets/stylesheets/bootstrap/_functions.scss +117 -13
- data/assets/stylesheets/bootstrap/_grid.scss +32 -11
- data/assets/stylesheets/bootstrap/_images.scss +4 -4
- data/assets/stylesheets/bootstrap/_input-group.scss +80 -25
- data/assets/stylesheets/bootstrap/_jumbotron.scss +2 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +63 -24
- data/assets/stylesheets/bootstrap/_mixins.scss +9 -4
- data/assets/stylesheets/bootstrap/_modal.scss +96 -24
- data/assets/stylesheets/bootstrap/_nav.scss +14 -7
- data/assets/stylesheets/bootstrap/_navbar.scss +66 -45
- data/assets/stylesheets/bootstrap/_pagination.scss +10 -8
- data/assets/stylesheets/bootstrap/_popover.scss +56 -69
- data/assets/stylesheets/bootstrap/_print.scss +41 -19
- data/assets/stylesheets/bootstrap/_progress.scss +20 -6
- data/assets/stylesheets/bootstrap/_reboot.scss +88 -109
- data/assets/stylesheets/bootstrap/_spinners.scss +65 -0
- data/assets/stylesheets/bootstrap/_tables.scss +19 -14
- data/assets/stylesheets/bootstrap/_toasts.scss +46 -0
- data/assets/stylesheets/bootstrap/_tooltip.scss +6 -6
- data/assets/stylesheets/bootstrap/_transitions.scss +10 -20
- data/assets/stylesheets/bootstrap/_type.scss +19 -19
- data/assets/stylesheets/bootstrap/_utilities.scss +4 -0
- data/assets/stylesheets/bootstrap/_variables.scss +492 -215
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +5 -3
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +8 -3
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +51 -10
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +16 -1
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +11 -9
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +35 -26
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +13 -16
- data/assets/stylesheets/bootstrap/mixins/_deprecate.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_float.scss +6 -3
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +102 -40
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +7 -7
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +36 -25
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +34 -17
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +27 -51
- data/assets/stylesheets/bootstrap/mixins/_image.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +10 -13
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +3 -2
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +5 -6
- data/assets/stylesheets/bootstrap/mixins/_size.scss +1 -0
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +11 -2
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +7 -4
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +3 -1
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +20 -3
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +1 -0
- data/assets/stylesheets/bootstrap/utilities/_background.scss +2 -2
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +23 -2
- data/assets/stylesheets/bootstrap/utilities/_display.scss +6 -36
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +7 -20
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +5 -0
- data/assets/stylesheets/bootstrap/utilities/_float.scss +5 -3
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +5 -0
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +5 -0
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -4
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +6 -0
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +8 -0
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +23 -1
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +19 -0
- data/assets/stylesheets/bootstrap/utilities/_text.scss +28 -8
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +4 -2
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +228 -0
- data/bootstrap.gemspec +7 -4
- data/lib/bootstrap/engine.rb +3 -0
- data/lib/bootstrap/version.rb +4 -2
- data/lib/bootstrap.rb +10 -7
- data/tasks/updater/js.rb +18 -6
- data/tasks/updater/network.rb +8 -2
- data/test/dummy_rails/app/assets/config/manifest.js +3 -0
- data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
- data/test/gemfiles/rails_6_0.gemfile +7 -0
- data/test/support/dummy_rails_integration.rb +3 -1
- data/test/test_helper.rb +21 -15
- metadata +29 -16
- data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +0 -10
|
@@ -8,15 +8,9 @@
|
|
|
8
8
|
@include media-breakpoint-up($breakpoint) {
|
|
9
9
|
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.d#{$infix}-block { display: block !important; }
|
|
15
|
-
.d#{$infix}-table { display: table !important; }
|
|
16
|
-
.d#{$infix}-table-row { display: table-row !important; }
|
|
17
|
-
.d#{$infix}-table-cell { display: table-cell !important; }
|
|
18
|
-
.d#{$infix}-flex { display: flex !important; }
|
|
19
|
-
.d#{$infix}-inline-flex { display: inline-flex !important; }
|
|
11
|
+
@each $value in $displays {
|
|
12
|
+
.d#{$infix}-#{$value} { display: $value !important; }
|
|
13
|
+
}
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
16
|
|
|
@@ -25,32 +19,8 @@
|
|
|
25
19
|
// Utilities for toggling `display` in print
|
|
26
20
|
//
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@media print {
|
|
32
|
-
display: block !important;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.d-print-inline {
|
|
37
|
-
display: none !important;
|
|
38
|
-
|
|
39
|
-
@media print {
|
|
40
|
-
display: inline !important;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.d-print-inline-block {
|
|
45
|
-
display: none !important;
|
|
46
|
-
|
|
47
|
-
@media print {
|
|
48
|
-
display: inline-block !important;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.d-print-none {
|
|
53
|
-
@media print {
|
|
54
|
-
display: none !important;
|
|
22
|
+
@media print {
|
|
23
|
+
@each $value in $displays {
|
|
24
|
+
.d-print-#{$value} { display: $value !important; }
|
|
55
25
|
}
|
|
56
26
|
}
|
|
@@ -27,26 +27,13 @@
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.embed-responsive-16by9 {
|
|
37
|
-
&::before {
|
|
38
|
-
padding-top: percentage(9 / 16);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.embed-responsive-4by3 {
|
|
43
|
-
&::before {
|
|
44
|
-
padding-top: percentage(3 / 4);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
30
|
+
@each $embed-responsive-aspect-ratio in $embed-responsive-aspect-ratios {
|
|
31
|
+
$embed-responsive-aspect-ratio-x: nth($embed-responsive-aspect-ratio, 1);
|
|
32
|
+
$embed-responsive-aspect-ratio-y: nth($embed-responsive-aspect-ratio, 2);
|
|
47
33
|
|
|
48
|
-
.embed-responsive-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
.embed-responsive-#{$embed-responsive-aspect-ratio-x}by#{$embed-responsive-aspect-ratio-y} {
|
|
35
|
+
&::before {
|
|
36
|
+
padding-top: percentage(divide($embed-responsive-aspect-ratio-y, $embed-responsive-aspect-ratio-x));
|
|
37
|
+
}
|
|
51
38
|
}
|
|
52
39
|
}
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
.flex#{$infix}-wrap { flex-wrap: wrap !important; }
|
|
17
17
|
.flex#{$infix}-nowrap { flex-wrap: nowrap !important; }
|
|
18
18
|
.flex#{$infix}-wrap-reverse { flex-wrap: wrap-reverse !important; }
|
|
19
|
+
.flex#{$infix}-fill { flex: 1 1 auto !important; }
|
|
20
|
+
.flex#{$infix}-grow-0 { flex-grow: 0 !important; }
|
|
21
|
+
.flex#{$infix}-grow-1 { flex-grow: 1 !important; }
|
|
22
|
+
.flex#{$infix}-shrink-0 { flex-shrink: 0 !important; }
|
|
23
|
+
.flex#{$infix}-shrink-1 { flex-shrink: 1 !important; }
|
|
19
24
|
|
|
20
25
|
.justify-content#{$infix}-start { justify-content: flex-start !important; }
|
|
21
26
|
.justify-content#{$infix}-end { justify-content: flex-end !important; }
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
// stylelint-disable declaration-no-important
|
|
2
|
+
|
|
1
3
|
@each $breakpoint in map-keys($grid-breakpoints) {
|
|
2
4
|
@include media-breakpoint-up($breakpoint) {
|
|
3
5
|
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
|
4
6
|
|
|
5
|
-
.float#{$infix}-left {
|
|
6
|
-
.float#{$infix}-right {
|
|
7
|
-
.float#{$infix}-none {
|
|
7
|
+
.float#{$infix}-left { float: left !important; }
|
|
8
|
+
.float#{$infix}-right { float: right !important; }
|
|
9
|
+
.float#{$infix}-none { float: none !important; }
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// stylelint-disable declaration-no-important
|
|
2
2
|
|
|
3
3
|
// Common values
|
|
4
|
-
|
|
5
|
-
// Sass list not in variables since it's not intended for customization.
|
|
6
|
-
$positions: static, relative, absolute, fixed, sticky;
|
|
7
|
-
|
|
8
4
|
@each $position in $positions {
|
|
9
5
|
.position-#{$position} { position: $position !important; }
|
|
10
6
|
}
|
|
@@ -10,3 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
.mw-100 { max-width: 100% !important; }
|
|
12
12
|
.mh-100 { max-height: 100% !important; }
|
|
13
|
+
|
|
14
|
+
// Viewport additional helpers
|
|
15
|
+
|
|
16
|
+
.min-vw-100 { min-width: 100vw !important; }
|
|
17
|
+
.min-vh-100 { min-height: 100vh !important; }
|
|
18
|
+
|
|
19
|
+
.vw-100 { width: 100vw !important; }
|
|
20
|
+
.vh-100 { height: 100vh !important; }
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
@each $prop, $abbrev in (margin: m, padding: p) {
|
|
10
10
|
@each $size, $length in $spacers {
|
|
11
|
-
|
|
12
11
|
.#{$abbrev}#{$infix}-#{$size} { #{$prop}: $length !important; }
|
|
13
12
|
.#{$abbrev}t#{$infix}-#{$size},
|
|
14
13
|
.#{$abbrev}y#{$infix}-#{$size} {
|
|
@@ -29,6 +28,29 @@
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
|
|
31
|
+
// Negative margins (e.g., where `.mb-n1` is negative version of `.mb-1`)
|
|
32
|
+
@each $size, $length in $spacers {
|
|
33
|
+
@if "#{$size}" != "0" {
|
|
34
|
+
.m#{$infix}-n#{$size} { margin: -$length !important; }
|
|
35
|
+
.mt#{$infix}-n#{$size},
|
|
36
|
+
.my#{$infix}-n#{$size} {
|
|
37
|
+
margin-top: -$length !important;
|
|
38
|
+
}
|
|
39
|
+
.mr#{$infix}-n#{$size},
|
|
40
|
+
.mx#{$infix}-n#{$size} {
|
|
41
|
+
margin-right: -$length !important;
|
|
42
|
+
}
|
|
43
|
+
.mb#{$infix}-n#{$size},
|
|
44
|
+
.my#{$infix}-n#{$size} {
|
|
45
|
+
margin-bottom: -$length !important;
|
|
46
|
+
}
|
|
47
|
+
.ml#{$infix}-n#{$size},
|
|
48
|
+
.mx#{$infix}-n#{$size} {
|
|
49
|
+
margin-left: -$length !important;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
32
54
|
// Some special margin utils
|
|
33
55
|
.m#{$infix}-auto { margin: auto !important; }
|
|
34
56
|
.mt#{$infix}-auto,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Stretched link
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
.stretched-link {
|
|
6
|
+
&::after {
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 0;
|
|
9
|
+
right: 0;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
z-index: 1;
|
|
13
|
+
// Just in case `pointer-events: none` is set on a parent
|
|
14
|
+
pointer-events: auto;
|
|
15
|
+
content: "";
|
|
16
|
+
// IE10 bugfix, see https://stackoverflow.com/questions/16947967/ie10-hover-pseudo-class-doesnt-work-without-background-color
|
|
17
|
+
background-color: rgba(0, 0, 0, 0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
// Text
|
|
5
5
|
//
|
|
6
6
|
|
|
7
|
+
.text-monospace { font-family: $font-family-monospace !important; }
|
|
8
|
+
|
|
7
9
|
// Alignment
|
|
8
10
|
|
|
9
11
|
.text-justify { text-align: justify !important; }
|
|
12
|
+
.text-wrap { white-space: normal !important; }
|
|
10
13
|
.text-nowrap { white-space: nowrap !important; }
|
|
11
|
-
.text-truncate { @include text-truncate; }
|
|
14
|
+
.text-truncate { @include text-truncate(); }
|
|
12
15
|
|
|
13
16
|
// Responsive alignment
|
|
14
17
|
|
|
@@ -30,23 +33,40 @@
|
|
|
30
33
|
|
|
31
34
|
// Weight and italics
|
|
32
35
|
|
|
33
|
-
.font-weight-light
|
|
34
|
-
.font-weight-
|
|
35
|
-
.font-weight-
|
|
36
|
-
.font-
|
|
36
|
+
.font-weight-light { font-weight: $font-weight-light !important; }
|
|
37
|
+
.font-weight-lighter { font-weight: $font-weight-lighter !important; }
|
|
38
|
+
.font-weight-normal { font-weight: $font-weight-normal !important; }
|
|
39
|
+
.font-weight-bold { font-weight: $font-weight-bold !important; }
|
|
40
|
+
.font-weight-bolder { font-weight: $font-weight-bolder !important; }
|
|
41
|
+
.font-italic { font-style: italic !important; }
|
|
37
42
|
|
|
38
43
|
// Contextual colors
|
|
39
44
|
|
|
40
|
-
.text-white { color:
|
|
45
|
+
.text-white { color: $white !important; }
|
|
41
46
|
|
|
42
47
|
@each $color, $value in $theme-colors {
|
|
43
|
-
@include text-emphasis-variant(".text-#{$color}", $value);
|
|
48
|
+
@include text-emphasis-variant(".text-#{$color}", $value, true);
|
|
44
49
|
}
|
|
45
50
|
|
|
51
|
+
.text-body { color: $body-color !important; }
|
|
46
52
|
.text-muted { color: $text-muted !important; }
|
|
47
53
|
|
|
54
|
+
.text-black-50 { color: rgba($black, .5) !important; }
|
|
55
|
+
.text-white-50 { color: rgba($white, .5) !important; }
|
|
56
|
+
|
|
48
57
|
// Misc
|
|
49
58
|
|
|
50
59
|
.text-hide {
|
|
51
|
-
@include text-hide();
|
|
60
|
+
@include text-hide($ignore-warning: true);
|
|
52
61
|
}
|
|
62
|
+
|
|
63
|
+
.text-decoration-none { text-decoration: none !important; }
|
|
64
|
+
|
|
65
|
+
.text-break {
|
|
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
|
+
}
|
|
69
|
+
|
|
70
|
+
// Reset
|
|
71
|
+
|
|
72
|
+
.text-reset { color: inherit !important; }
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
// stylelint-disable declaration-no-important
|
|
2
|
+
|
|
1
3
|
//
|
|
2
4
|
// Visibility utilities
|
|
3
5
|
//
|
|
4
6
|
|
|
5
7
|
.visible {
|
|
6
|
-
|
|
8
|
+
visibility: visible !important;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
.invisible {
|
|
10
|
-
|
|
12
|
+
visibility: hidden !important;
|
|
11
13
|
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// stylelint-disable property-blacklist, scss/dollar-variable-default
|
|
2
|
+
|
|
3
|
+
// SCSS RFS mixin
|
|
4
|
+
//
|
|
5
|
+
// Automated responsive font sizes
|
|
6
|
+
//
|
|
7
|
+
// Licensed under MIT (https://github.com/twbs/rfs/blob/v8.x/LICENSE)
|
|
8
|
+
|
|
9
|
+
// Configuration
|
|
10
|
+
|
|
11
|
+
// Base font size
|
|
12
|
+
$rfs-base-font-size: 1.25rem !default;
|
|
13
|
+
$rfs-font-size-unit: rem !default;
|
|
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
|
+
|
|
19
|
+
// Breakpoint at where font-size starts decreasing if screen width is smaller
|
|
20
|
+
$rfs-breakpoint: 1200px !default;
|
|
21
|
+
$rfs-breakpoint-unit: px !default;
|
|
22
|
+
|
|
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
|
|
28
|
+
$rfs-two-dimensional: false !default;
|
|
29
|
+
|
|
30
|
+
// Factor of decrease
|
|
31
|
+
$rfs-factor: 10 !default;
|
|
32
|
+
|
|
33
|
+
@if type-of($rfs-factor) != "number" or $rfs-factor <= 1 {
|
|
34
|
+
@error "`#{$rfs-factor}` is not a valid $rfs-factor, it must be greater than 1.";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Generate enable or disable classes. Possibilities: false, "enable" or "disable"
|
|
38
|
+
$rfs-class: false !default;
|
|
39
|
+
|
|
40
|
+
// 1 rem = $rfs-rem-value px
|
|
41
|
+
$rfs-rem-value: 16 !default;
|
|
42
|
+
|
|
43
|
+
// Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
|
|
44
|
+
$rfs-safari-iframe-resize-bug-fix: false !default;
|
|
45
|
+
|
|
46
|
+
// Disable RFS by setting $enable-responsive-font-sizes to false
|
|
47
|
+
$enable-responsive-font-sizes: true !default;
|
|
48
|
+
|
|
49
|
+
// Cache $rfs-base-font-size unit
|
|
50
|
+
$rfs-base-font-size-unit: unit($rfs-base-font-size);
|
|
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
|
+
|
|
94
|
+
// Remove px-unit from $rfs-base-font-size for calculations
|
|
95
|
+
@if $rfs-base-font-size-unit == "px" {
|
|
96
|
+
$rfs-base-font-size: divide($rfs-base-font-size, $rfs-base-font-size * 0 + 1);
|
|
97
|
+
}
|
|
98
|
+
@else if $rfs-base-font-size-unit == "rem" {
|
|
99
|
+
$rfs-base-font-size: divide($rfs-base-font-size, divide($rfs-base-font-size * 0 + 1, $rfs-rem-value));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Cache $rfs-breakpoint unit to prevent multiple calls
|
|
103
|
+
$rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
|
|
104
|
+
|
|
105
|
+
// Remove unit from $rfs-breakpoint for calculations
|
|
106
|
+
@if $rfs-breakpoint-unit-cache == "px" {
|
|
107
|
+
$rfs-breakpoint: divide($rfs-breakpoint, $rfs-breakpoint * 0 + 1);
|
|
108
|
+
}
|
|
109
|
+
@else if $rfs-breakpoint-unit-cache == "rem" or $rfs-breakpoint-unit-cache == "em" {
|
|
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
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
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
|
|
156
|
+
@mixin rfs($fs, $important: false) {
|
|
157
|
+
// Cache $fs unit
|
|
158
|
+
$fs-unit: if(type-of($fs) == "number", unit($fs), false);
|
|
159
|
+
|
|
160
|
+
// Add !important suffix if needed
|
|
161
|
+
$rfs-suffix: if($important, " !important", "");
|
|
162
|
+
|
|
163
|
+
// 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
|
|
164
|
+
@if not $fs-unit or $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0 {
|
|
165
|
+
font-size: #{$fs}#{$rfs-suffix};
|
|
166
|
+
}
|
|
167
|
+
@else {
|
|
168
|
+
// Remove unit from $fs for calculations
|
|
169
|
+
@if $fs-unit == "px" {
|
|
170
|
+
$fs: divide($fs, $fs * 0 + 1);
|
|
171
|
+
}
|
|
172
|
+
@else if $fs-unit == "rem" {
|
|
173
|
+
$fs: divide($fs, divide($fs * 0 + 1, $rfs-rem-value));
|
|
174
|
+
}
|
|
175
|
+
|
|
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};
|
|
182
|
+
}
|
|
183
|
+
@else {
|
|
184
|
+
// Calculate the minimum font size for $fs
|
|
185
|
+
$fs-min: $rfs-base-font-size + divide($fs - $rfs-base-font-size, $rfs-factor);
|
|
186
|
+
|
|
187
|
+
// Calculate difference between $fs and the minimum font size
|
|
188
|
+
$fs-diff: $fs - $fs-min;
|
|
189
|
+
|
|
190
|
+
// Base font-size formatting
|
|
191
|
+
$min-width: if($rfs-font-size-unit == rem, #{divide($fs-min, $rfs-rem-value)}rem, #{$fs-min}px);
|
|
192
|
+
|
|
193
|
+
// Use `vmin` if two-dimensional is enabled
|
|
194
|
+
$variable-unit: if($rfs-two-dimensional, vmin, vw);
|
|
195
|
+
|
|
196
|
+
// Calculate the variable width between 0 and $rfs-breakpoint
|
|
197
|
+
$variable-width: #{divide($fs-diff * 100, $rfs-breakpoint)}#{$variable-unit};
|
|
198
|
+
|
|
199
|
+
// Set the calculated font-size
|
|
200
|
+
$rfs-fluid: calc(#{$min-width} + #{$variable-width}) #{$rfs-suffix};
|
|
201
|
+
|
|
202
|
+
// Breakpoint formatting
|
|
203
|
+
$mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit});
|
|
204
|
+
|
|
205
|
+
@include _rfs-disable-class {
|
|
206
|
+
font-size: #{$rfs-static}#{$rfs-suffix};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@include _rfs-media-query($mq-value) {
|
|
210
|
+
@include _rfs-enable-class {
|
|
211
|
+
font-size: $rfs-fluid;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Include safari iframe resize fix if needed
|
|
215
|
+
min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// The font-size & responsive-font-size mixins use RFS to rescale the font size
|
|
222
|
+
@mixin font-size($fs, $important: false) {
|
|
223
|
+
@include rfs($fs, $important);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@mixin responsive-font-size($fs, $important: false) {
|
|
227
|
+
@include rfs($fs, $important);
|
|
228
|
+
}
|
data/bootstrap.gemspec
CHANGED
|
@@ -11,10 +11,13 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
s.homepage = 'https://github.com/twbs/bootstrap-rubygem'
|
|
12
12
|
s.license = 'MIT'
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# SassC requires Ruby 2.3.3. Also specify here to make it obvious.
|
|
15
|
+
s.required_ruby_version = '>= 2.3.3'
|
|
15
16
|
|
|
16
|
-
s.add_runtime_dependency '
|
|
17
|
-
|
|
17
|
+
s.add_runtime_dependency 'popper_js', '>= 1.16.1', '< 2'
|
|
18
|
+
|
|
19
|
+
s.add_runtime_dependency 'sassc-rails', '>= 2.0.0'
|
|
20
|
+
s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
|
|
18
21
|
|
|
19
22
|
# Testing dependencies
|
|
20
23
|
s.add_development_dependency 'minitest', '~> 5.8.0'
|
|
@@ -22,7 +25,7 @@ Gem::Specification.new do |s|
|
|
|
22
25
|
s.add_development_dependency 'term-ansicolor'
|
|
23
26
|
# Integration testing
|
|
24
27
|
s.add_development_dependency 'capybara', '>= 2.6.0'
|
|
25
|
-
s.add_development_dependency '
|
|
28
|
+
s.add_development_dependency 'cuprite'
|
|
26
29
|
# Dummy Rails app dependencies
|
|
27
30
|
s.add_development_dependency 'actionpack', '>= 4.1.5'
|
|
28
31
|
s.add_development_dependency 'activesupport', '>= 4.1.5'
|
data/lib/bootstrap/engine.rb
CHANGED
data/lib/bootstrap/version.rb
CHANGED
data/lib/bootstrap.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'bootstrap/version'
|
|
2
4
|
require 'popper_js'
|
|
3
5
|
|
|
@@ -11,9 +13,16 @@ module Bootstrap
|
|
|
11
13
|
register_hanami
|
|
12
14
|
elsif sprockets?
|
|
13
15
|
register_sprockets
|
|
16
|
+
elsif defined?(::Sass) && ::Sass.respond_to?(:load_paths)
|
|
17
|
+
# The deprecated `sass` gem:
|
|
18
|
+
::Sass.load_paths << stylesheets_path
|
|
14
19
|
end
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
if defined?(::Sass::Script::Value::Number)
|
|
22
|
+
# Set precision to 6 as per:
|
|
23
|
+
# https://github.com/twbs/bootstrap/blob/da717b03e6e72d7a61c007acb9223b9626ae5ee5/package.json#L28
|
|
24
|
+
::Sass::Script::Value::Number.precision = [6, ::Sass::Script::Value::Number.precision].max
|
|
25
|
+
end
|
|
17
26
|
end
|
|
18
27
|
|
|
19
28
|
# Paths
|
|
@@ -48,12 +57,6 @@ module Bootstrap
|
|
|
48
57
|
|
|
49
58
|
private
|
|
50
59
|
|
|
51
|
-
def configure_sass
|
|
52
|
-
require 'sass'
|
|
53
|
-
|
|
54
|
-
::Sass.load_paths << stylesheets_path
|
|
55
|
-
end
|
|
56
|
-
|
|
57
60
|
def register_rails_engine
|
|
58
61
|
require 'bootstrap/engine'
|
|
59
62
|
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$/) -
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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] ||= [])
|
|
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]
|
|
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)
|