bootstrap 5.0.0.beta1 → 5.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/README.md +3 -3
  4. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  5. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  6. data/assets/javascripts/bootstrap-sprockets.js +3 -0
  7. data/assets/javascripts/bootstrap.js +429 -486
  8. data/assets/javascripts/bootstrap.min.js +3 -3
  9. data/assets/javascripts/bootstrap/alert.js +81 -80
  10. data/assets/javascripts/bootstrap/base-component.js +75 -0
  11. data/assets/javascripts/bootstrap/button.js +60 -72
  12. data/assets/javascripts/bootstrap/carousel.js +131 -110
  13. data/assets/javascripts/bootstrap/collapse.js +94 -77
  14. data/assets/javascripts/bootstrap/dom/data.js +3 -3
  15. data/assets/javascripts/bootstrap/dom/event-handler.js +6 -5
  16. data/assets/javascripts/bootstrap/dom/manipulator.js +3 -3
  17. data/assets/javascripts/bootstrap/dom/selector-engine.js +6 -11
  18. data/assets/javascripts/bootstrap/dropdown.js +159 -90
  19. data/assets/javascripts/bootstrap/modal.js +132 -125
  20. data/assets/javascripts/bootstrap/popover.js +73 -25
  21. data/assets/javascripts/bootstrap/scrollspy.js +93 -76
  22. data/assets/javascripts/bootstrap/tab.js +78 -82
  23. data/assets/javascripts/bootstrap/toast.js +79 -75
  24. data/assets/javascripts/bootstrap/tooltip.js +207 -185
  25. data/assets/stylesheets/_bootstrap-grid.scss +3 -3
  26. data/assets/stylesheets/_bootstrap-reboot.scss +3 -3
  27. data/assets/stylesheets/_bootstrap.scss +3 -3
  28. data/assets/stylesheets/bootstrap/_accordion.scss +1 -0
  29. data/assets/stylesheets/bootstrap/_alert.scss +6 -6
  30. data/assets/stylesheets/bootstrap/_carousel.scss +12 -6
  31. data/assets/stylesheets/bootstrap/_close.scss +1 -1
  32. data/assets/stylesheets/bootstrap/_dropdown.scss +29 -15
  33. data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
  34. data/assets/stylesheets/bootstrap/_nav.scss +5 -0
  35. data/assets/stylesheets/bootstrap/_navbar.scss +12 -1
  36. data/assets/stylesheets/bootstrap/_pagination.scss +2 -2
  37. data/assets/stylesheets/bootstrap/_popover.scss +0 -15
  38. data/assets/stylesheets/bootstrap/_reboot.scss +6 -6
  39. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  40. data/assets/stylesheets/bootstrap/_toasts.scss +1 -0
  41. data/assets/stylesheets/bootstrap/_utilities.scss +6 -0
  42. data/assets/stylesheets/bootstrap/_variables.scss +30 -7
  43. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +5 -5
  44. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -0
  45. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  46. data/assets/stylesheets/bootstrap/forms/_form-select.scss +1 -2
  47. data/assets/stylesheets/bootstrap/forms/_validation.scss +1 -1
  48. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
  49. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +1 -1
  50. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +4 -4
  51. data/assets/stylesheets/bootstrap/mixins/_forms.scss +13 -6
  52. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +4 -0
  53. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +3 -2
  54. data/assets/stylesheets/bootstrap/utilities/_api.scss +1 -1
  55. data/bootstrap.gemspec +1 -3
  56. data/lib/bootstrap/version.rb +2 -2
  57. data/tasks/updater/js.rb +15 -2
  58. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  59. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  60. data/test/dummy_rails/app/views/pages/root.html +89 -0
  61. data/test/dummy_rails/config/application.rb +0 -3
  62. data/test/gemfiles/rails_6_1.gemfile +7 -0
  63. metadata +13 -36
  64. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -5,6 +5,7 @@
5
5
 
6
6
  // Color system
7
7
 
8
+ // scss-docs-start gray-color-variables
8
9
  $white: #fff !default;
9
10
  $gray-100: #f8f9fa !default;
10
11
  $gray-200: #e9ecef !default;
@@ -16,8 +17,10 @@ $gray-700: #495057 !default;
16
17
  $gray-800: #343a40 !default;
17
18
  $gray-900: #212529 !default;
18
19
  $black: #000 !default;
20
+ // scss-docs-end gray-color-variables
19
21
 
20
22
  // fusv-disable
23
+ // scss-docs-start gray-colors-map
21
24
  $grays: (
22
25
  "100": $gray-100,
23
26
  "200": $gray-200,
@@ -29,8 +32,10 @@ $grays: (
29
32
  "800": $gray-800,
30
33
  "900": $gray-900
31
34
  ) !default;
35
+ // scss-docs-end gray-colors-map
32
36
  // fusv-enable
33
37
 
38
+ // scss-docs-start color-variables
34
39
  $blue: #0d6efd !default;
35
40
  $indigo: #6610f2 !default;
36
41
  $purple: #6f42c1 !default;
@@ -41,6 +46,7 @@ $yellow: #ffc107 !default;
41
46
  $green: #198754 !default;
42
47
  $teal: #20c997 !default;
43
48
  $cyan: #0dcaf0 !default;
49
+ // scss-docs-end color-variables
44
50
 
45
51
  // scss-docs-start colors-map
46
52
  $colors: (
@@ -60,6 +66,7 @@ $colors: (
60
66
  ) !default;
61
67
  // scss-docs-end colors-map
62
68
 
69
+ // scss-docs-start theme-color-variables
63
70
  $primary: $blue !default;
64
71
  $secondary: $gray-600 !default;
65
72
  $success: $green !default;
@@ -68,6 +75,7 @@ $warning: $yellow !default;
68
75
  $danger: $red !default;
69
76
  $light: $gray-100 !default;
70
77
  $dark: $gray-900 !default;
78
+ // scss-docs-end theme-color-variables
71
79
 
72
80
  // scss-docs-start theme-colors-map
73
81
  $theme-colors: (
@@ -228,7 +236,9 @@ $variable-prefix: bs- !default;
228
236
  //
229
237
  // The gradient which is added to components if `$enable-gradients` is `true`
230
238
  // This gradient is also added to elements with `.bg-gradient`
239
+ // scss-docs-start variable-gradient
231
240
  $gradient: linear-gradient(180deg, rgba($white, .15), rgba($white, 0)) !default;
241
+ // scss-docs-end variable-gradient
232
242
 
233
243
  // Spacing
234
244
  //
@@ -612,6 +622,15 @@ $btn-border-radius-lg: $border-radius-lg !default;
612
622
 
613
623
  $btn-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default;
614
624
 
625
+ $btn-hover-bg-shade-amount: 15% !default;
626
+ $btn-hover-bg-tint-amount: 15% !default;
627
+ $btn-hover-border-shade-amount: 20% !default;
628
+ $btn-hover-border-tint-amount: 10% !default;
629
+ $btn-active-bg-shade-amount: 20% !default;
630
+ $btn-active-bg-tint-amount: 20% !default;
631
+ $btn-active-border-shade-amount: 25% !default;
632
+ $btn-active-border-tint-amount: 10% !default;
633
+
615
634
 
616
635
  // Forms
617
636
 
@@ -683,11 +702,11 @@ $form-check-padding-start: $form-check-input-width + .5em !defaul
683
702
  $form-check-margin-bottom: .125rem !default;
684
703
  $form-check-label-color: null !default;
685
704
  $form-check-label-cursor: null !default;
686
- $form-check-transition: background-color .15s ease-in-out, background-position .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default;
705
+ $form-check-transition: null !default;
687
706
 
688
707
  $form-check-input-active-filter: brightness(90%) !default;
689
708
 
690
- $form-check-input-bg: $body-bg !default;
709
+ $form-check-input-bg: $input-bg !default;
691
710
  $form-check-input-border: 1px solid rgba(0, 0, 0, .25) !default;
692
711
  $form-check-input-border-radius: .25em !default;
693
712
  $form-check-radio-border-radius: 50% !default;
@@ -714,6 +733,7 @@ $form-switch-width: 2em !default;
714
733
  $form-switch-padding-start: $form-switch-width + .5em !default;
715
734
  $form-switch-bg-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-color}'/></svg>") !default;
716
735
  $form-switch-border-radius: $form-switch-width !default;
736
+ $form-switch-transition: background-position .15s ease-in-out !default;
717
737
 
718
738
  $form-switch-focus-color: $input-focus-border-color !default;
719
739
  $form-switch-focus-bg-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-focus-color}'/></svg>") !default;
@@ -735,7 +755,7 @@ $form-select-padding-y: $input-padding-y !default;
735
755
  $form-select-padding-x: $input-padding-x !default;
736
756
  $form-select-font-family: $input-font-family !default;
737
757
  $form-select-font-size: $input-font-size !default;
738
- $form-select-indicator-padding: 1rem !default; // Extra padding to account for the presence of the background-image based indicator
758
+ $form-select-indicator-padding: $form-select-padding-x * 3 !default; // Extra padding for background-image
739
759
  $form-select-font-weight: $input-font-weight !default;
740
760
  $form-select-line-height: $input-line-height !default;
741
761
  $form-select-color: $input-color !default;
@@ -748,8 +768,8 @@ $form-select-bg-size: 16px 12px !default; // In pixels because ima
748
768
  $form-select-indicator-color: $gray-800 !default;
749
769
  $form-select-indicator: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/></svg>") !default;
750
770
 
751
- $form-select-feedback-icon-padding-end: add(1em * .75, (2 * $form-select-padding-y * .75) + $form-select-padding-x + $form-select-indicator-padding) !default;
752
- $form-select-feedback-icon-position: center right ($form-select-padding-x + $form-select-indicator-padding) !default;
771
+ $form-select-feedback-icon-padding-end: $form-select-padding-x * 2.5 + $form-select-indicator-padding !default;
772
+ $form-select-feedback-icon-position: center right $form-select-indicator-padding !default;
753
773
  $form-select-feedback-icon-size: $input-height-inner-half $input-height-inner-half !default;
754
774
 
755
775
  $form-select-border-width: $input-border-width !default;
@@ -929,12 +949,12 @@ $dropdown-box-shadow: $box-shadow !default;
929
949
 
930
950
  $dropdown-link-color: $gray-900 !default;
931
951
  $dropdown-link-hover-color: shade-color($gray-900, 10%) !default;
932
- $dropdown-link-hover-bg: $gray-100 !default;
952
+ $dropdown-link-hover-bg: $gray-200 !default;
933
953
 
934
954
  $dropdown-link-active-color: $component-active-color !default;
935
955
  $dropdown-link-active-bg: $component-active-bg !default;
936
956
 
937
- $dropdown-link-disabled-color: $gray-600 !default;
957
+ $dropdown-link-disabled-color: $gray-500 !default;
938
958
 
939
959
  $dropdown-item-padding-y: $spacer / 4 !default;
940
960
  $dropdown-item-padding-x: $spacer !default;
@@ -991,6 +1011,9 @@ $pagination-disabled-border-color: $gray-300 !default;
991
1011
 
992
1012
  $pagination-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default;
993
1013
 
1014
+ $pagination-border-radius-sm: $border-radius-sm !default;
1015
+ $pagination-border-radius-lg: $border-radius-lg !default;
1016
+
994
1017
  // Cards
995
1018
 
996
1019
  $card-spacer-y: $spacer !default;
@@ -1,18 +1,18 @@
1
1
  /*!
2
- * Bootstrap Utilities v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors
4
- * Copyright 2011-2020 Twitter, Inc.
2
+ * Bootstrap Utilities v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors
4
+ * Copyright 2011-2021 Twitter, Inc.
5
5
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
6
6
  */
7
7
 
8
8
  // Configuration
9
-
10
9
  @import "functions";
11
10
  @import "variables";
12
11
  @import "mixins";
13
12
  @import "utilities";
14
13
 
14
+ // Helpers
15
+ @import "helpers";
15
16
 
16
17
  // Utilities
17
-
18
18
  @import "utilities/api";
@@ -113,6 +113,7 @@
113
113
  background-image: escape-svg($form-switch-bg-image);
114
114
  background-position: left center;
115
115
  @include border-radius($form-switch-border-radius);
116
+ @include transition($form-switch-transition);
116
117
 
117
118
  &:focus {
118
119
  background-image: escape-svg($form-switch-focus-bg-image);
@@ -12,7 +12,7 @@
12
12
  appearance: none;
13
13
 
14
14
  &:focus {
15
- outline: none;
15
+ outline: 0;
16
16
 
17
17
  // Pseudo-elements must be split across multiple rulesets to have an effect.
18
18
  // No box-shadow() mixin for focus accessibility.
@@ -6,13 +6,12 @@
6
6
  .form-select {
7
7
  display: block;
8
8
  width: 100%;
9
- padding: $form-select-padding-y ($form-select-padding-x + $form-select-indicator-padding) $form-select-padding-y $form-select-padding-x;
9
+ padding: $form-select-padding-y $form-select-indicator-padding $form-select-padding-y $form-select-padding-x;
10
10
  font-family: $form-select-font-family;
11
11
  @include font-size($form-select-font-size);
12
12
  font-weight: $form-select-font-weight;
13
13
  line-height: $form-select-line-height;
14
14
  color: $form-select-color;
15
- vertical-align: middle;
16
15
  background-color: $form-select-bg;
17
16
  background-image: escape-svg($form-select-indicator);
18
17
  background-repeat: no-repeat;
@@ -7,6 +7,6 @@
7
7
 
8
8
  // scss-docs-start form-validation-states-loop
9
9
  @each $state, $data in $form-validation-states {
10
- @include form-validation-state($state, map-get($data, color), map-get($data, icon));
10
+ @include form-validation-state($state, $data...);
11
11
  }
12
12
  // scss-docs-end form-validation-states-loop
@@ -6,7 +6,7 @@
6
6
 
7
7
  &::before {
8
8
  display: block;
9
- padding-top: var(--aspect-ratio);
9
+ padding-top: var(--#{$variable-prefix}aspect-ratio);
10
10
  content: "";
11
11
  }
12
12
 
@@ -21,6 +21,6 @@
21
21
 
22
22
  @each $key, $ratio in $aspect-ratios {
23
23
  .ratio-#{$key} {
24
- --aspect-ratio: #{$ratio};
24
+ --#{$variable-prefix}aspect-ratio: #{$ratio};
25
25
  }
26
26
  }
@@ -3,6 +3,6 @@
3
3
  //
4
4
 
5
5
  .visually-hidden,
6
- .visually-hidden-focusable:not(:focus) {
6
+ .visually-hidden-focusable:not(:focus):not(:focus-within) {
7
7
  @include visually-hidden();
8
8
  }
@@ -7,11 +7,11 @@
7
7
  $background,
8
8
  $border,
9
9
  $color: color-contrast($background),
10
- $hover-background: if($color == $color-contrast-light, shade-color($background, 15%), tint-color($background, 15%)),
11
- $hover-border: if($color == $color-contrast-light, shade-color($border, 20%), tint-color($border, 10%)),
10
+ $hover-background: if($color == $color-contrast-light, shade-color($background, $btn-hover-bg-shade-amount), tint-color($background, $btn-hover-bg-tint-amount)),
11
+ $hover-border: if($color == $color-contrast-light, shade-color($border, $btn-hover-border-shade-amount), tint-color($border, $btn-hover-border-tint-amount)),
12
12
  $hover-color: color-contrast($hover-background),
13
- $active-background: if($color == $color-contrast-light, shade-color($background, 20%), tint-color($background, 20%)),
14
- $active-border: if($color == $color-contrast-light, shade-color($border, 25%), tint-color($border, 10%)),
13
+ $active-background: if($color == $color-contrast-light, shade-color($background,$btn-active-bg-shade-amount), tint-color($background, $btn-active-bg-tint-amount)),
14
+ $active-border: if($color == $color-contrast-light, shade-color($border, $btn-active-border-shade-amount), tint-color($border, $btn-active-border-tint-amount)),
15
15
  $active-color: color-contrast($active-background),
16
16
  $disabled-background: $background,
17
17
  $disabled-border: $border,
@@ -13,7 +13,14 @@
13
13
  }
14
14
  }
15
15
 
16
- @mixin form-validation-state($state, $color, $icon) {
16
+ @mixin form-validation-state(
17
+ $state,
18
+ $color,
19
+ $icon,
20
+ $tooltip-color: color-contrast($color),
21
+ $tooltip-bg-color: rgba($color, $form-feedback-tooltip-opacity),
22
+ $focus-box-shadow: 0 0 0 $input-focus-width rgba($color, $input-btn-focus-color-opacity)
23
+ ) {
17
24
  .#{$state}-feedback {
18
25
  display: none;
19
26
  width: 100%;
@@ -33,8 +40,8 @@
33
40
  margin-top: .1rem;
34
41
  @include font-size($form-feedback-tooltip-font-size);
35
42
  line-height: $form-feedback-tooltip-line-height;
36
- color: color-contrast($color);
37
- background-color: rgba($color, $form-feedback-tooltip-opacity);
43
+ color: $tooltip-color;
44
+ background-color: $tooltip-bg-color;
38
45
  @include border-radius($form-feedback-tooltip-border-radius);
39
46
  }
40
47
 
@@ -59,7 +66,7 @@
59
66
 
60
67
  &:focus {
61
68
  border-color: $color;
62
- box-shadow: 0 0 0 $input-focus-width rgba($color, $input-btn-focus-color-opacity);
69
+ box-shadow: $focus-box-shadow;
63
70
  }
64
71
  }
65
72
  }
@@ -87,7 +94,7 @@
87
94
 
88
95
  &:focus {
89
96
  border-color: $color;
90
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
97
+ box-shadow: $focus-box-shadow;
91
98
  }
92
99
  }
93
100
  }
@@ -101,7 +108,7 @@
101
108
  }
102
109
 
103
110
  &:focus {
104
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
111
+ box-shadow: $focus-box-shadow;
105
112
  }
106
113
 
107
114
  ~ .form-check-label {
@@ -1,5 +1,6 @@
1
1
  // Gradients
2
2
 
3
+ // scss-docs-start gradient-bg-mixin
3
4
  @mixin gradient-bg($color: null) {
4
5
  background-color: $color;
5
6
 
@@ -7,7 +8,9 @@
7
8
  background-image: var(--#{$variable-prefix}gradient);
8
9
  }
9
10
  }
11
+ // scss-docs-end gradient-bg-mixin
10
12
 
13
+ // scss-docs-start gradient-mixins
11
14
  // Horizontal gradient, from left to right
12
15
  //
13
16
  // Creates two color stops, start and end, by specifying a color and position for each color stop.
@@ -41,3 +44,4 @@
41
44
  @mixin gradient-striped($color: rgba($white, .15), $angle: 45deg) {
42
45
  background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
43
46
  }
47
+ // scss-docs-end gradient-mixins
@@ -17,12 +17,13 @@
17
17
  border: 0 !important;
18
18
  }
19
19
 
20
- // Use to only display content when it's focused.
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)
21
22
  //
22
23
  // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
23
24
 
24
25
  @mixin visually-hidden-focusable() {
25
- &:not(:focus) {
26
+ &:not(:focus):not(:focus-within) {
26
27
  @include visually-hidden();
27
28
  }
28
29
  }
@@ -26,7 +26,7 @@
26
26
  @each $key, $utility in $utilities {
27
27
  // The utility can be disabled with `false`, thus check if the utility is a map first
28
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) {
29
+ @if type-of($utility) == "map" and map-get($utility, rfs) and (map-get($utility, responsive) or $infix == "") {
30
30
  @include generate-utility($utility, $infix, true);
31
31
  }
32
32
  }
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', '>= 1.14.3', '< 2'
17
+ s.add_runtime_dependency 'popper_js', '>= 2.8.6', '< 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")
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootstrap
4
- VERSION = '5.0.0.beta1'
5
- BOOTSTRAP_SHA = '63f3d939eaceeb84dcc77a7392953bcc8c5bc0a3'
4
+ VERSION = '5.0.0.beta2'
5
+ BOOTSTRAP_SHA = 'e50c11b8c6434b6d68ea5897771e4d35fe12f5c3'
6
6
  end
data/tasks/updater/js.rb CHANGED
@@ -2,7 +2,7 @@ require 'tsort'
2
2
 
3
3
  class Updater
4
4
  module Js
5
- INLINED_SRCS = %w[base-component.js util/index.js util/sanitizer.js].freeze
5
+ INLINED_SRCS = %w[util/index.js util/sanitizer.js].freeze
6
6
 
7
7
  def update_javascript_assets
8
8
  log_status 'Updating javascripts...'
@@ -13,13 +13,26 @@ class Updater
13
13
  log_processed "#{bootstrap_js_files * ' '}"
14
14
 
15
15
  log_status 'Updating javascript manifest'
16
- manifest = ''
16
+ manifest = "//= require ./bootstrap-global-this-define\n"
17
17
  bootstrap_js_files.each do |name|
18
18
  name = name.gsub(/\.js$/, '')
19
19
  manifest << "//= require ./bootstrap/#{name}\n"
20
20
  end
21
+ manifest << "//= require ./bootstrap-global-this-undefine\n"
21
22
  dist_js = read_files('dist/js', %w(bootstrap.js bootstrap.min.js))
22
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
23
36
  'assets/javascripts/bootstrap-sprockets.js' => manifest,
24
37
  'assets/javascripts/bootstrap.js' => dist_js['bootstrap.js'],
25
38
  'assets/javascripts/bootstrap.min.js' => dist_js['bootstrap.min.js'],
@@ -1,7 +1,8 @@
1
- //= require jquery
2
1
  //= require popper.js
3
2
  //= require bootstrap-sprockets
4
3
 
5
- jQuery(function ($) {
6
- $('[data-toggle="tooltip"]').tooltip()
4
+ document.addEventListener('DOMContentLoaded', () => {
5
+ for (const tooltipTriggerEl of document.querySelectorAll('[data-bs-toggle="tooltip"]')) {
6
+ new bootstrap.Tooltip(tooltipTriggerEl)
7
+ }
7
8
  });
@@ -1,14 +1,16 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>bootstrap Dummy App</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
7
  <%= stylesheet_link_tag 'application', media: "all", 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
8
  <%= csrf_meta_tags %>
8
9
  </head>
9
10
 
10
11
  <body>
11
12
  <%= yield %>
13
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
12
14
  </body>
13
15
 
14
16
  </html>