bootstrap 4.6.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +7 -4
- data/assets/javascripts/bootstrap/alert.js +192 -112
- data/assets/javascripts/bootstrap/base-component.js +63 -0
- data/assets/javascripts/bootstrap/button.js +96 -176
- data/assets/javascripts/bootstrap/carousel.js +470 -355
- data/assets/javascripts/bootstrap/collapse.js +377 -221
- data/assets/javascripts/bootstrap/dom/data.js +68 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
- data/assets/javascripts/bootstrap/dropdown.js +470 -351
- data/assets/javascripts/bootstrap/modal.js +611 -435
- data/assets/javascripts/bootstrap/offcanvas.js +671 -0
- data/assets/javascripts/bootstrap/popover.js +137 -165
- data/assets/javascripts/bootstrap/scrollspy.js +249 -191
- data/assets/javascripts/bootstrap/tab.js +241 -141
- data/assets/javascripts/bootstrap/toast.js +221 -153
- data/assets/javascripts/bootstrap/tooltip.js +649 -483
- data/assets/javascripts/bootstrap-global-this-define.js +6 -0
- data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
- data/assets/javascripts/bootstrap-sprockets.js +14 -7
- data/assets/javascripts/bootstrap.js +3272 -2586
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/stylesheets/_bootstrap-grid.scss +51 -16
- data/assets/stylesheets/_bootstrap-reboot.scss +4 -1
- data/assets/stylesheets/_bootstrap.scss +16 -8
- data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
- data/assets/stylesheets/bootstrap/_alert.scss +15 -10
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
- data/assets/stylesheets/bootstrap/_buttons.scss +29 -60
- data/assets/stylesheets/bootstrap/_card.scss +20 -91
- data/assets/stylesheets/bootstrap/_carousel.scss +64 -35
- data/assets/stylesheets/bootstrap/_close.scss +30 -30
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +84 -36
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +84 -69
- data/assets/stylesheets/bootstrap/_grid.scss +3 -54
- data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +28 -8
- data/assets/stylesheets/bootstrap/_mixins.scss +8 -13
- data/assets/stylesheets/bootstrap/_modal.scss +45 -57
- data/assets/stylesheets/bootstrap/_nav.scss +23 -4
- data/assets/stylesheets/bootstrap/_navbar.scss +45 -71
- data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +10 -20
- data/assets/stylesheets/bootstrap/_popover.scss +24 -36
- data/assets/stylesheets/bootstrap/_progress.scss +5 -4
- data/assets/stylesheets/bootstrap/_reboot.scss +316 -179
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +9 -5
- data/assets/stylesheets/bootstrap/_tables.scss +79 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +20 -15
- data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
- data/assets/stylesheets/bootstrap/_transitions.scss +2 -1
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +594 -18
- data/assets/stylesheets/bootstrap/_variables.scss +801 -485
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +71 -48
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +39 -97
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +90 -34
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
- data/bootstrap.gemspec +1 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +20 -5
- data/tasks/updater/network.rb +7 -1
- data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
- data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +0 -3
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- metadata +45 -73
- data/assets/javascripts/bootstrap/util.js +0 -189
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -132
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
- data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
- data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
- data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
- data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
- data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Utility generator
|
|
2
|
+
// Used to generate utilities & print utilities
|
|
3
|
+
@mixin generate-utility($utility, $infix, $is-rfs-media-query: false) {
|
|
4
|
+
$values: map-get($utility, values);
|
|
5
|
+
|
|
6
|
+
// If the values are a list or string, convert it into a map
|
|
7
|
+
@if type-of($values) == "string" or type-of(nth($values, 1)) != "list" {
|
|
8
|
+
$values: zip($values, $values);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@each $key, $value in $values {
|
|
12
|
+
$properties: map-get($utility, property);
|
|
13
|
+
|
|
14
|
+
// Multiple properties are possible, for example with vertical or horizontal margins or paddings
|
|
15
|
+
@if type-of($properties) == "string" {
|
|
16
|
+
$properties: append((), $properties);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Use custom class if present
|
|
20
|
+
$property-class: if(map-has-key($utility, class), map-get($utility, class), nth($properties, 1));
|
|
21
|
+
$property-class: if($property-class == null, "", $property-class);
|
|
22
|
+
|
|
23
|
+
// State params to generate pseudo-classes
|
|
24
|
+
$state: if(map-has-key($utility, state), map-get($utility, state), ());
|
|
25
|
+
|
|
26
|
+
$infix: if($property-class == "" and str-slice($infix, 1, 1) == "-", str-slice($infix, 2), $infix);
|
|
27
|
+
|
|
28
|
+
// Don't prefix if value key is null (eg. with shadow class)
|
|
29
|
+
$property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");
|
|
30
|
+
|
|
31
|
+
@if map-get($utility, rfs) {
|
|
32
|
+
// Inside the media query
|
|
33
|
+
@if $is-rfs-media-query {
|
|
34
|
+
$val: rfs-value($value);
|
|
35
|
+
|
|
36
|
+
// Do not render anything if fluid and non fluid values are the same
|
|
37
|
+
$value: if($val == rfs-fluid-value($value), null, $val);
|
|
38
|
+
}
|
|
39
|
+
@else {
|
|
40
|
+
$value: rfs-fluid-value($value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
$is-rtl: map-get($utility, rtl);
|
|
45
|
+
|
|
46
|
+
@if $value != null {
|
|
47
|
+
@if $is-rtl == false {
|
|
48
|
+
/* rtl:begin:remove */
|
|
49
|
+
}
|
|
50
|
+
.#{$property-class + $infix + $property-class-modifier} {
|
|
51
|
+
@each $property in $properties {
|
|
52
|
+
#{$property}: $value if($enable-important-utilities, !important, null);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@each $pseudo in $state {
|
|
57
|
+
.#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
|
|
58
|
+
@each $property in $properties {
|
|
59
|
+
#{$property}: $value if($enable-important-utilities, !important, null);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
@if $is-rtl == false {
|
|
64
|
+
/* rtl:end:remove */
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// stylelint-disable declaration-no-important
|
|
2
|
+
|
|
3
|
+
// Hide content visually while keeping it accessible to assistive technologies
|
|
4
|
+
//
|
|
5
|
+
// See: https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/
|
|
6
|
+
// See: https://hugogiraudel.com/2016/10/13/css-hide-and-seek/
|
|
7
|
+
|
|
8
|
+
@mixin visually-hidden() {
|
|
9
|
+
position: absolute !important;
|
|
10
|
+
width: 1px !important;
|
|
11
|
+
height: 1px !important;
|
|
12
|
+
padding: 0 !important;
|
|
13
|
+
margin: -1px !important; // Fix for https://github.com/twbs/bootstrap/issues/25686
|
|
14
|
+
overflow: hidden !important;
|
|
15
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
16
|
+
white-space: nowrap !important;
|
|
17
|
+
border: 0 !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Use to only display content when it's focused, or one of its child elements is focused
|
|
21
|
+
// (i.e. when focus is within the element/container that the class was applied to)
|
|
22
|
+
//
|
|
23
|
+
// Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
|
|
24
|
+
|
|
25
|
+
@mixin visually-hidden-focusable() {
|
|
26
|
+
&:not(:focus):not(:focus-within) {
|
|
27
|
+
@include visually-hidden();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Loop over each breakpoint
|
|
2
|
+
@each $breakpoint in map-keys($grid-breakpoints) {
|
|
3
|
+
|
|
4
|
+
// Generate media query if needed
|
|
5
|
+
@include media-breakpoint-up($breakpoint) {
|
|
6
|
+
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
|
7
|
+
|
|
8
|
+
// Loop over each utility property
|
|
9
|
+
@each $key, $utility in $utilities {
|
|
10
|
+
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
11
|
+
// Only proceed if responsive media queries are enabled or if it's the base media query
|
|
12
|
+
@if type-of($utility) == "map" and (map-get($utility, responsive) or $infix == "") {
|
|
13
|
+
@include generate-utility($utility, $infix);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// RFS rescaling
|
|
20
|
+
@media (min-width: $rfs-mq-value) {
|
|
21
|
+
@each $breakpoint in map-keys($grid-breakpoints) {
|
|
22
|
+
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
|
23
|
+
|
|
24
|
+
@if (map-get($grid-breakpoints, $breakpoint) < $rfs-breakpoint) {
|
|
25
|
+
// Loop over each utility property
|
|
26
|
+
@each $key, $utility in $utilities {
|
|
27
|
+
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
28
|
+
// Only proceed if responsive media queries are enabled or if it's the base media query
|
|
29
|
+
@if type-of($utility) == "map" and map-get($utility, rfs) and (map-get($utility, responsive) or $infix == "") {
|
|
30
|
+
@include generate-utility($utility, $infix, true);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// Print utilities
|
|
39
|
+
@media print {
|
|
40
|
+
@each $key, $utility in $utilities {
|
|
41
|
+
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
42
|
+
// Then check if the utility needs print styles
|
|
43
|
+
@if type-of($utility) == "map" and map-get($utility, print) == true {
|
|
44
|
+
@include generate-utility($utility, "-print");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
// SCSS RFS mixin
|
|
4
4
|
//
|
|
5
|
-
// Automated responsive font sizes
|
|
5
|
+
// Automated responsive values for font sizes, paddings, margins and much more
|
|
6
6
|
//
|
|
7
|
-
// Licensed under MIT (https://github.com/twbs/rfs/blob/
|
|
7
|
+
// Licensed under MIT (https://github.com/twbs/rfs/blob/master/LICENSE)
|
|
8
8
|
|
|
9
9
|
// Configuration
|
|
10
10
|
|
|
11
|
-
// Base
|
|
12
|
-
$rfs-base-
|
|
13
|
-
$rfs-
|
|
11
|
+
// Base value
|
|
12
|
+
$rfs-base-value: 1.25rem !default;
|
|
13
|
+
$rfs-unit: rem !default;
|
|
14
14
|
|
|
15
|
-
@if $rfs-
|
|
16
|
-
@error "`#{$rfs-
|
|
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
17
|
}
|
|
18
18
|
|
|
19
|
-
// Breakpoint at where
|
|
19
|
+
// Breakpoint at where values start decreasing if screen width is smaller
|
|
20
20
|
$rfs-breakpoint: 1200px !default;
|
|
21
21
|
$rfs-breakpoint-unit: px !default;
|
|
22
22
|
|
|
@@ -24,16 +24,19 @@ $rfs-breakpoint-unit: px !default;
|
|
|
24
24
|
@error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// Resize
|
|
27
|
+
// Resize values based on screen height and width
|
|
28
28
|
$rfs-two-dimensional: false !default;
|
|
29
29
|
|
|
30
30
|
// Factor of decrease
|
|
31
31
|
$rfs-factor: 10 !default;
|
|
32
32
|
|
|
33
|
-
@if type-of($rfs-factor) !=
|
|
33
|
+
@if type-of($rfs-factor) != number or $rfs-factor <= 1 {
|
|
34
34
|
@error "`#{$rfs-factor}` is not a valid $rfs-factor, it must be greater than 1.";
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// Mode. Possibilities: "min-media-query", "max-media-query"
|
|
38
|
+
$rfs-mode: min-media-query !default;
|
|
39
|
+
|
|
37
40
|
// Generate enable or disable classes. Possibilities: false, "enable" or "disable"
|
|
38
41
|
$rfs-class: false !default;
|
|
39
42
|
|
|
@@ -43,93 +46,70 @@ $rfs-rem-value: 16 !default;
|
|
|
43
46
|
// Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
|
|
44
47
|
$rfs-safari-iframe-resize-bug-fix: false !default;
|
|
45
48
|
|
|
46
|
-
// Disable RFS by setting $enable-
|
|
47
|
-
$enable-
|
|
49
|
+
// Disable RFS by setting $enable-rfs to false
|
|
50
|
+
$enable-rfs: true !default;
|
|
48
51
|
|
|
49
|
-
// Cache $rfs-base-
|
|
50
|
-
$rfs-base-
|
|
52
|
+
// Cache $rfs-base-value unit
|
|
53
|
+
$rfs-base-value-unit: unit($rfs-base-value);
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
$
|
|
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);
|
|
55
|
+
// Remove px-unit from $rfs-base-value for calculations
|
|
56
|
+
@if $rfs-base-value-unit == px {
|
|
57
|
+
$rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1);
|
|
97
58
|
}
|
|
98
|
-
@else if $rfs-base-
|
|
99
|
-
$rfs-base-
|
|
59
|
+
@else if $rfs-base-value-unit == rem {
|
|
60
|
+
$rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1 / $rfs-rem-value);
|
|
100
61
|
}
|
|
101
62
|
|
|
102
63
|
// Cache $rfs-breakpoint unit to prevent multiple calls
|
|
103
64
|
$rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
|
|
104
65
|
|
|
105
66
|
// Remove unit from $rfs-breakpoint for calculations
|
|
106
|
-
@if $rfs-breakpoint-unit-cache ==
|
|
107
|
-
$rfs-breakpoint:
|
|
67
|
+
@if $rfs-breakpoint-unit-cache == px {
|
|
68
|
+
$rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1);
|
|
108
69
|
}
|
|
109
|
-
@else if $rfs-breakpoint-unit-cache ==
|
|
110
|
-
$rfs-breakpoint:
|
|
70
|
+
@else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" {
|
|
71
|
+
$rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1 / $rfs-rem-value);
|
|
111
72
|
}
|
|
112
73
|
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
74
|
+
// Calculate the media query value
|
|
75
|
+
$rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{$rfs-breakpoint / $rfs-rem-value}#{$rfs-breakpoint-unit});
|
|
76
|
+
$rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width);
|
|
77
|
+
$rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height);
|
|
78
|
+
|
|
79
|
+
// Internal mixin used to determine which media query needs to be used
|
|
80
|
+
@mixin _rfs-media-query {
|
|
81
|
+
@if $rfs-two-dimensional {
|
|
82
|
+
@if $rfs-mode == max-media-query {
|
|
83
|
+
@media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
|
|
84
|
+
@content;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
@else {
|
|
88
|
+
@media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
|
|
89
|
+
@content;
|
|
90
|
+
}
|
|
121
91
|
}
|
|
122
92
|
}
|
|
123
93
|
@else {
|
|
124
|
-
@
|
|
94
|
+
@media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
|
|
95
|
+
@content;
|
|
96
|
+
}
|
|
125
97
|
}
|
|
126
98
|
}
|
|
127
99
|
|
|
128
|
-
// Internal mixin that adds
|
|
129
|
-
@mixin _rfs-
|
|
130
|
-
@if $rfs-class ==
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
// Internal mixin that adds disable classes to the selector if needed.
|
|
101
|
+
@mixin _rfs-rule {
|
|
102
|
+
@if $rfs-class == disable and $rfs-mode == max-media-query {
|
|
103
|
+
// Adding an extra class increases specificity, which prevents the media query to override the property
|
|
104
|
+
&,
|
|
105
|
+
.disable-rfs &,
|
|
106
|
+
&.disable-rfs {
|
|
107
|
+
@content;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
@else if $rfs-class == enable and $rfs-mode == min-media-query {
|
|
111
|
+
.enable-rfs &,
|
|
112
|
+
&.enable-rfs {
|
|
133
113
|
@content;
|
|
134
114
|
}
|
|
135
115
|
}
|
|
@@ -138,91 +118,195 @@ $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
|
|
|
138
118
|
}
|
|
139
119
|
}
|
|
140
120
|
|
|
141
|
-
// Internal mixin
|
|
142
|
-
@mixin _rfs-media-query
|
|
143
|
-
|
|
144
|
-
|
|
121
|
+
// Internal mixin that adds enable classes to the selector if needed.
|
|
122
|
+
@mixin _rfs-media-query-rule {
|
|
123
|
+
|
|
124
|
+
@if $rfs-class == enable {
|
|
125
|
+
@if $rfs-mode == min-media-query {
|
|
145
126
|
@content;
|
|
146
127
|
}
|
|
128
|
+
|
|
129
|
+
@include _rfs-media-query {
|
|
130
|
+
.enable-rfs &,
|
|
131
|
+
&.enable-rfs {
|
|
132
|
+
@content;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
147
135
|
}
|
|
148
136
|
@else {
|
|
149
|
-
@
|
|
137
|
+
@if $rfs-class == disable and $rfs-mode == min-media-query {
|
|
138
|
+
.disable-rfs &,
|
|
139
|
+
&.disable-rfs {
|
|
140
|
+
@content;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
@include _rfs-media-query {
|
|
150
144
|
@content;
|
|
151
145
|
}
|
|
152
146
|
}
|
|
153
147
|
}
|
|
154
148
|
|
|
155
|
-
//
|
|
156
|
-
@
|
|
157
|
-
//
|
|
158
|
-
$
|
|
149
|
+
// Helper function to get the formatted non-responsive value
|
|
150
|
+
@function rfs-value($values) {
|
|
151
|
+
// Convert to list
|
|
152
|
+
$values: if(type-of($values) != list, ($values,), $values);
|
|
159
153
|
|
|
160
|
-
|
|
161
|
-
$rfs-suffix: if($important, " !important", "");
|
|
154
|
+
$val: '';
|
|
162
155
|
|
|
163
|
-
//
|
|
164
|
-
@
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
@else {
|
|
168
|
-
// Remove unit from $fs for calculations
|
|
169
|
-
@if $fs-unit == "px" {
|
|
170
|
-
$fs: divide($fs, $fs * 0 + 1);
|
|
156
|
+
// Loop over each value and calculate value
|
|
157
|
+
@each $value in $values {
|
|
158
|
+
@if $value == 0 {
|
|
159
|
+
$val: $val + ' 0';
|
|
171
160
|
}
|
|
172
|
-
@else
|
|
173
|
-
|
|
161
|
+
@else {
|
|
162
|
+
// Cache $value unit
|
|
163
|
+
$unit: if(type-of($value) == "number", unit($value), false);
|
|
164
|
+
|
|
165
|
+
@if $unit == px {
|
|
166
|
+
// Convert to rem if needed
|
|
167
|
+
$val: $val + ' ' + if($rfs-unit == rem, #{$value / ($value * 0 + $rfs-rem-value)}rem, $value);
|
|
168
|
+
}
|
|
169
|
+
@else if $unit == rem {
|
|
170
|
+
// Convert to px if needed
|
|
171
|
+
$val: $val + ' ' + if($rfs-unit == px, #{$value / ($value * 0 + 1) * $rfs-rem-value}px, $value);
|
|
172
|
+
}
|
|
173
|
+
@else {
|
|
174
|
+
// 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
|
|
175
|
+
$val: $val + ' ' + $value;
|
|
176
|
+
}
|
|
174
177
|
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Remove first space
|
|
181
|
+
@return unquote(str-slice($val, 2));
|
|
182
|
+
}
|
|
175
183
|
|
|
176
|
-
|
|
177
|
-
|
|
184
|
+
// Helper function to get the responsive value calculated by RFS
|
|
185
|
+
@function rfs-fluid-value($values) {
|
|
186
|
+
// Convert to list
|
|
187
|
+
$values: if(type-of($values) != list, ($values,), $values);
|
|
178
188
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
189
|
+
$val: '';
|
|
190
|
+
|
|
191
|
+
// Loop over each value and calculate value
|
|
192
|
+
@each $value in $values {
|
|
193
|
+
@if $value == 0 {
|
|
194
|
+
$val: $val + ' 0';
|
|
182
195
|
}
|
|
196
|
+
|
|
183
197
|
@else {
|
|
184
|
-
//
|
|
185
|
-
$
|
|
198
|
+
// Cache $value unit
|
|
199
|
+
$unit: if(type-of($value) == "number", unit($value), false);
|
|
186
200
|
|
|
187
|
-
//
|
|
188
|
-
$
|
|
201
|
+
// 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
|
|
202
|
+
@if not $unit or $unit != px and $unit != rem {
|
|
203
|
+
$val: $val + ' ' + $value;
|
|
204
|
+
}
|
|
189
205
|
|
|
190
|
-
|
|
191
|
-
|
|
206
|
+
@else {
|
|
207
|
+
// Remove unit from $value for calculations
|
|
208
|
+
$value: $value / ($value * 0 + if($unit == px, 1, 1 / $rfs-rem-value));
|
|
192
209
|
|
|
193
|
-
|
|
194
|
-
|
|
210
|
+
// Only add the media query if the value is greater than the minimum value
|
|
211
|
+
@if abs($value) <= $rfs-base-value or not $enable-rfs {
|
|
212
|
+
$val: $val + ' ' + if($rfs-unit == rem, #{$value / $rfs-rem-value}rem, #{$value}px);
|
|
213
|
+
}
|
|
214
|
+
@else {
|
|
215
|
+
// Calculate the minimum value
|
|
216
|
+
$value-min: $rfs-base-value + (abs($value) - $rfs-base-value) / $rfs-factor;
|
|
195
217
|
|
|
196
|
-
|
|
197
|
-
|
|
218
|
+
// Calculate difference between $value and the minimum value
|
|
219
|
+
$value-diff: abs($value) - $value-min;
|
|
198
220
|
|
|
199
|
-
|
|
200
|
-
|
|
221
|
+
// Base value formatting
|
|
222
|
+
$min-width: if($rfs-unit == rem, #{$value-min / $rfs-rem-value}rem, #{$value-min}px);
|
|
201
223
|
|
|
202
|
-
|
|
203
|
-
|
|
224
|
+
// Use negative value if needed
|
|
225
|
+
$min-width: if($value < 0, -$min-width, $min-width);
|
|
204
226
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
227
|
+
// Use `vmin` if two-dimensional is enabled
|
|
228
|
+
$variable-unit: if($rfs-two-dimensional, vmin, vw);
|
|
208
229
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
230
|
+
// Calculate the variable width between 0 and $rfs-breakpoint
|
|
231
|
+
$variable-width: #{$value-diff * 100 / $rfs-breakpoint}#{$variable-unit};
|
|
232
|
+
|
|
233
|
+
// Return the calculated value
|
|
234
|
+
$val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')';
|
|
212
235
|
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Remove first space
|
|
241
|
+
@return unquote(str-slice($val, 2));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// RFS mixin
|
|
245
|
+
@mixin rfs($values, $property: font-size) {
|
|
246
|
+
@if $values != null {
|
|
247
|
+
$val: rfs-value($values);
|
|
248
|
+
$fluidVal: rfs-fluid-value($values);
|
|
249
|
+
|
|
250
|
+
// Do not print the media query if responsive & non-responsive values are the same
|
|
251
|
+
@if $val == $fluidVal {
|
|
252
|
+
#{$property}: $val;
|
|
253
|
+
}
|
|
254
|
+
@else {
|
|
255
|
+
@include _rfs-rule {
|
|
256
|
+
#{$property}: if($rfs-mode == max-media-query, $val, $fluidVal);
|
|
213
257
|
|
|
214
258
|
// Include safari iframe resize fix if needed
|
|
215
259
|
min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
|
|
216
260
|
}
|
|
261
|
+
|
|
262
|
+
@include _rfs-media-query-rule {
|
|
263
|
+
#{$property}: if($rfs-mode == max-media-query, $fluidVal, $val);
|
|
264
|
+
}
|
|
217
265
|
}
|
|
218
266
|
}
|
|
219
267
|
}
|
|
220
268
|
|
|
221
|
-
//
|
|
222
|
-
@mixin font-size($
|
|
223
|
-
@include rfs($
|
|
269
|
+
// Shorthand helper mixins
|
|
270
|
+
@mixin font-size($value) {
|
|
271
|
+
@include rfs($value);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@mixin padding($value) {
|
|
275
|
+
@include rfs($value, padding);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@mixin padding-top($value) {
|
|
279
|
+
@include rfs($value, padding-top);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
@mixin padding-right($value) {
|
|
283
|
+
@include rfs($value, padding-right);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
@mixin padding-bottom($value) {
|
|
287
|
+
@include rfs($value, padding-bottom);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@mixin padding-left($value) {
|
|
291
|
+
@include rfs($value, padding-left);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
@mixin margin($value) {
|
|
295
|
+
@include rfs($value, margin);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
@mixin margin-top($value) {
|
|
299
|
+
@include rfs($value, margin-top);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@mixin margin-right($value) {
|
|
303
|
+
@include rfs($value, margin-right);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
@mixin margin-bottom($value) {
|
|
307
|
+
@include rfs($value, margin-bottom);
|
|
224
308
|
}
|
|
225
309
|
|
|
226
|
-
@mixin
|
|
227
|
-
@include rfs($
|
|
310
|
+
@mixin margin-left($value) {
|
|
311
|
+
@include rfs($value, margin-left);
|
|
228
312
|
}
|
data/bootstrap.gemspec
CHANGED
|
@@ -14,7 +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', '>=
|
|
17
|
+
s.add_runtime_dependency 'popper_js', '>= 2.9.2', '< 3'
|
|
18
18
|
|
|
19
19
|
s.add_runtime_dependency 'sassc-rails', '>= 2.0.0'
|
|
20
20
|
s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
|
|
@@ -31,8 +31,6 @@ Gem::Specification.new do |s|
|
|
|
31
31
|
s.add_development_dependency 'activesupport', '>= 4.1.5'
|
|
32
32
|
s.add_development_dependency 'json', '>= 1.8.1'
|
|
33
33
|
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
34
|
s.add_development_dependency 'uglifier'
|
|
37
35
|
|
|
38
36
|
s.files = `git ls-files`.split("\n")
|
data/lib/bootstrap/version.rb
CHANGED
data/tasks/updater/js.rb
CHANGED
|
@@ -2,6 +2,8 @@ require 'tsort'
|
|
|
2
2
|
|
|
3
3
|
class Updater
|
|
4
4
|
module Js
|
|
5
|
+
INLINED_SRCS = %w[util/index.js util/backdrop.js util/sanitizer.js util/scrollbar.js].freeze
|
|
6
|
+
|
|
5
7
|
def update_javascript_assets
|
|
6
8
|
log_status 'Updating javascripts...'
|
|
7
9
|
save_to = @save_to[:js]
|
|
@@ -11,13 +13,26 @@ class Updater
|
|
|
11
13
|
log_processed "#{bootstrap_js_files * ' '}"
|
|
12
14
|
|
|
13
15
|
log_status 'Updating javascript manifest'
|
|
14
|
-
manifest =
|
|
16
|
+
manifest = "//= require ./bootstrap-global-this-define\n"
|
|
15
17
|
bootstrap_js_files.each do |name|
|
|
16
18
|
name = name.gsub(/\.js$/, '')
|
|
17
19
|
manifest << "//= require ./bootstrap/#{name}\n"
|
|
18
20
|
end
|
|
21
|
+
manifest << "//= require ./bootstrap-global-this-undefine\n"
|
|
19
22
|
dist_js = read_files('dist/js', %w(bootstrap.js bootstrap.min.js))
|
|
20
23
|
{
|
|
24
|
+
'assets/javascripts/bootstrap-global-this-define.js' => <<~JS,
|
|
25
|
+
// Set a `globalThis` so that bootstrap components are defined on window.bootstrap instead of window.
|
|
26
|
+
window['bootstrap'] = {
|
|
27
|
+
Popper: window.Popper,
|
|
28
|
+
_originalGlobalThis: window['globalThis']
|
|
29
|
+
};
|
|
30
|
+
window['globalThis'] = window['bootstrap'];
|
|
31
|
+
JS
|
|
32
|
+
'assets/javascripts/bootstrap-global-this-undefine.js' => <<~JS,
|
|
33
|
+
window['globalThis'] = window['bootstrap']._originalGlobalThis;
|
|
34
|
+
window['bootstrap']._originalGlobalThis = null;
|
|
35
|
+
JS
|
|
21
36
|
'assets/javascripts/bootstrap-sprockets.js' => manifest,
|
|
22
37
|
'assets/javascripts/bootstrap.js' => dist_js['bootstrap.js'],
|
|
23
38
|
'assets/javascripts/bootstrap.min.js' => dist_js['bootstrap.min.js'],
|
|
@@ -29,13 +44,13 @@ class Updater
|
|
|
29
44
|
|
|
30
45
|
def bootstrap_js_files
|
|
31
46
|
@bootstrap_js_files ||= begin
|
|
32
|
-
src_files = get_paths_by_type('js/src', /\.js$/) -
|
|
47
|
+
src_files = get_paths_by_type('js/src', /\.js$/) - INLINED_SRCS
|
|
48
|
+
puts "src_files: #{src_files.inspect}"
|
|
33
49
|
imports = Deps.new
|
|
34
50
|
# Get the imports from the ES6 files to order requires correctly.
|
|
35
51
|
read_files('js/src', src_files).each do |name, content|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.flatten(1).map { |f| "#{f}.js" }
|
|
52
|
+
file_imports = content.scan(%r{import *(?:[a-zA-Z]*|\{[a-zA-Z ,]*\}) *from '\./([\w/-]+)}).flatten(1).map { |f| "#{f}.js" }.uniq
|
|
53
|
+
imports.add name, *(file_imports - INLINED_SRCS)
|
|
39
54
|
end
|
|
40
55
|
imports.tsort
|
|
41
56
|
end
|