bootstrap-propshaft 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 (185) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +14 -0
  3. data/.github/workflows/ci.yml +61 -0
  4. data/.gitignore +19 -0
  5. data/CHANGELOG.md +25 -0
  6. data/Gemfile +12 -0
  7. data/LICENSE +21 -0
  8. data/README.md +138 -0
  9. data/Rakefile +89 -0
  10. data/assets/javascripts/bootstrap/alert.js +89 -0
  11. data/assets/javascripts/bootstrap/base-component.js +83 -0
  12. data/assets/javascripts/bootstrap/button.js +78 -0
  13. data/assets/javascripts/bootstrap/carousel.js +387 -0
  14. data/assets/javascripts/bootstrap/collapse.js +248 -0
  15. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  16. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  17. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  18. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  19. data/assets/javascripts/bootstrap/dropdown.js +401 -0
  20. data/assets/javascripts/bootstrap/modal.js +319 -0
  21. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  22. data/assets/javascripts/bootstrap/popover.js +95 -0
  23. data/assets/javascripts/bootstrap/scrollspy.js +274 -0
  24. data/assets/javascripts/bootstrap/tab.js +284 -0
  25. data/assets/javascripts/bootstrap/toast.js +198 -0
  26. data/assets/javascripts/bootstrap/tooltip.js +545 -0
  27. data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
  28. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  29. data/assets/javascripts/bootstrap/util/config.js +67 -0
  30. data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
  31. data/assets/javascripts/bootstrap/util/index.js +281 -0
  32. data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
  33. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  34. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  35. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  36. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  37. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  38. data/assets/javascripts/bootstrap-sprockets.js +28 -0
  39. data/assets/javascripts/bootstrap.js +4493 -0
  40. data/assets/javascripts/bootstrap.min.js +6 -0
  41. data/assets/stylesheets/_bootstrap-grid.scss +62 -0
  42. data/assets/stylesheets/_bootstrap-reboot.scss +10 -0
  43. data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
  44. data/assets/stylesheets/_bootstrap.scss +52 -0
  45. data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
  46. data/assets/stylesheets/bootstrap/_alert.scss +68 -0
  47. data/assets/stylesheets/bootstrap/_badge.scss +38 -0
  48. data/assets/stylesheets/bootstrap/_breadcrumb.scss +40 -0
  49. data/assets/stylesheets/bootstrap/_button-group.scss +142 -0
  50. data/assets/stylesheets/bootstrap/_buttons.scss +207 -0
  51. data/assets/stylesheets/bootstrap/_card.scss +239 -0
  52. data/assets/stylesheets/bootstrap/_carousel.scss +244 -0
  53. data/assets/stylesheets/bootstrap/_close.scss +63 -0
  54. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  55. data/assets/stylesheets/bootstrap/_dropdown.scss +250 -0
  56. data/assets/stylesheets/bootstrap/_forms.scss +9 -0
  57. data/assets/stylesheets/bootstrap/_functions.scss +302 -0
  58. data/assets/stylesheets/bootstrap/_grid.scss +39 -0
  59. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  60. data/assets/stylesheets/bootstrap/_images.scss +42 -0
  61. data/assets/stylesheets/bootstrap/_list-group.scss +197 -0
  62. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  63. data/assets/stylesheets/bootstrap/_mixins.scss +42 -0
  64. data/assets/stylesheets/bootstrap/_modal.scss +237 -0
  65. data/assets/stylesheets/bootstrap/_nav.scss +197 -0
  66. data/assets/stylesheets/bootstrap/_navbar.scss +289 -0
  67. data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
  68. data/assets/stylesheets/bootstrap/_pagination.scss +109 -0
  69. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  70. data/assets/stylesheets/bootstrap/_popover.scss +196 -0
  71. data/assets/stylesheets/bootstrap/_progress.scss +68 -0
  72. data/assets/stylesheets/bootstrap/_reboot.scss +611 -0
  73. data/assets/stylesheets/bootstrap/_root.scss +187 -0
  74. data/assets/stylesheets/bootstrap/_spinners.scss +85 -0
  75. data/assets/stylesheets/bootstrap/_tables.scss +171 -0
  76. data/assets/stylesheets/bootstrap/_toasts.scss +73 -0
  77. data/assets/stylesheets/bootstrap/_tooltip.scss +119 -0
  78. data/assets/stylesheets/bootstrap/_transitions.scss +27 -0
  79. data/assets/stylesheets/bootstrap/_type.scss +106 -0
  80. data/assets/stylesheets/bootstrap/_utilities.scss +806 -0
  81. data/assets/stylesheets/bootstrap/_variables-dark.scss +87 -0
  82. data/assets/stylesheets/bootstrap/_variables.scss +1747 -0
  83. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
  84. data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -0
  85. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  86. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  87. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  88. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  89. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  90. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  91. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  92. data/assets/stylesheets/bootstrap/helpers/_clearfix.scss +3 -0
  93. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  94. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  95. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  96. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  97. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  98. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  99. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  100. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  101. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  102. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  103. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  104. data/assets/stylesheets/bootstrap/mixins/_alert.scss +18 -0
  105. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  106. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  107. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +78 -0
  108. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +18 -0
  109. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +127 -0
  110. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +70 -0
  111. data/assets/stylesheets/bootstrap/mixins/_caret.scss +69 -0
  112. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +9 -0
  113. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  114. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  115. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  116. data/assets/stylesheets/bootstrap/mixins/_deprecate.scss +10 -0
  117. data/assets/stylesheets/bootstrap/mixins/_forms.scss +153 -0
  118. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +47 -0
  119. data/assets/stylesheets/bootstrap/mixins/_grid.scss +151 -0
  120. data/assets/stylesheets/bootstrap/mixins/_image.scss +16 -0
  121. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +26 -0
  122. data/assets/stylesheets/bootstrap/mixins/_lists.scss +7 -0
  123. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +10 -0
  124. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +17 -0
  125. data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  126. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  127. data/assets/stylesheets/bootstrap/mixins/_text-truncate.scss +8 -0
  128. data/assets/stylesheets/bootstrap/mixins/_transition.scss +26 -0
  129. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  130. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  131. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  132. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +348 -0
  133. data/bootstrap.gemspec +39 -0
  134. data/lib/bootstrap/engine.rb +22 -0
  135. data/lib/bootstrap/version.rb +6 -0
  136. data/lib/bootstrap.rb +75 -0
  137. data/tasks/updater/js.rb +92 -0
  138. data/tasks/updater/logger.rb +57 -0
  139. data/tasks/updater/network.rb +109 -0
  140. data/tasks/updater/scss.rb +26 -0
  141. data/tasks/updater.rb +67 -0
  142. data/test/dummy_rails/README.rdoc +3 -0
  143. data/test/dummy_rails/Rakefile +6 -0
  144. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  145. data/test/dummy_rails/app/assets/images/.keep +0 -0
  146. data/test/dummy_rails/app/assets/javascripts/application.js +8 -0
  147. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  148. data/test/dummy_rails/app/assets/stylesheets/application.sass +4 -0
  149. data/test/dummy_rails/app/controllers/application_controller.rb +5 -0
  150. data/test/dummy_rails/app/controllers/pages_controller.rb +4 -0
  151. data/test/dummy_rails/app/helpers/application_helper.rb +2 -0
  152. data/test/dummy_rails/app/views/layouts/application.html.erb +16 -0
  153. data/test/dummy_rails/app/views/pages/root.html +89 -0
  154. data/test/dummy_rails/config/application.rb +32 -0
  155. data/test/dummy_rails/config/boot.rb +5 -0
  156. data/test/dummy_rails/config/environment.rb +5 -0
  157. data/test/dummy_rails/config/environments/development.rb +23 -0
  158. data/test/dummy_rails/config/environments/production.rb +82 -0
  159. data/test/dummy_rails/config/environments/test.rb +38 -0
  160. data/test/dummy_rails/config/initializers/backtrace_silencers.rb +7 -0
  161. data/test/dummy_rails/config/initializers/filter_parameter_logging.rb +4 -0
  162. data/test/dummy_rails/config/initializers/inflections.rb +16 -0
  163. data/test/dummy_rails/config/initializers/mime_types.rb +5 -0
  164. data/test/dummy_rails/config/initializers/secret_token.rb +18 -0
  165. data/test/dummy_rails/config/initializers/session_store.rb +3 -0
  166. data/test/dummy_rails/config/initializers/wrap_parameters.rb +14 -0
  167. data/test/dummy_rails/config/locales/en.yml +3 -0
  168. data/test/dummy_rails/config/locales/es.yml +3 -0
  169. data/test/dummy_rails/config/routes.rb +3 -0
  170. data/test/dummy_rails/config.ru +4 -0
  171. data/test/dummy_rails/log/.keep +0 -0
  172. data/test/gemfiles/rails_4_2.gemfile +7 -0
  173. data/test/gemfiles/rails_5_0.gemfile +8 -0
  174. data/test/gemfiles/rails_5_1.gemfile +8 -0
  175. data/test/gemfiles/rails_5_2.gemfile +8 -0
  176. data/test/gemfiles/rails_6_0.gemfile +8 -0
  177. data/test/gemfiles/rails_6_1.gemfile +8 -0
  178. data/test/gemfiles/rails_7_0_dartsass.gemfile +8 -0
  179. data/test/gemfiles/rails_7_0_sassc.gemfile +8 -0
  180. data/test/rails_test.rb +24 -0
  181. data/test/support/dummy_rails_integration.rb +31 -0
  182. data/test/support/reporting.rb +27 -0
  183. data/test/test_helper.rb +42 -0
  184. data/test/test_helper_rails.rb +6 -0
  185. metadata +471 -0
@@ -0,0 +1,26 @@
1
+ // stylelint-disable property-disallowed-list
2
+ @mixin transition($transition...) {
3
+ @if length($transition) == 0 {
4
+ $transition: $transition-base;
5
+ }
6
+
7
+ @if length($transition) > 1 {
8
+ @each $value in $transition {
9
+ @if $value == null or $value == none {
10
+ @warn "The keyword 'none' or 'null' must be used as a single argument.";
11
+ }
12
+ }
13
+ }
14
+
15
+ @if $enable-transitions {
16
+ @if nth($transition, 1) != null {
17
+ transition: $transition;
18
+ }
19
+
20
+ @if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {
21
+ @media (prefers-reduced-motion: reduce) {
22
+ transition: none;
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,97 @@
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
+ // Use custom CSS variable name if present, otherwise default to `class`
24
+ $css-variable-name: if(map-has-key($utility, css-variable-name), map-get($utility, css-variable-name), map-get($utility, class));
25
+
26
+ // State params to generate pseudo-classes
27
+ $state: if(map-has-key($utility, state), map-get($utility, state), ());
28
+
29
+ $infix: if($property-class == "" and str-slice($infix, 1, 1) == "-", str-slice($infix, 2), $infix);
30
+
31
+ // Don't prefix if value key is null (e.g. with shadow class)
32
+ $property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");
33
+
34
+ @if map-get($utility, rfs) {
35
+ // Inside the media query
36
+ @if $is-rfs-media-query {
37
+ $val: rfs-value($value);
38
+
39
+ // Do not render anything if fluid and non fluid values are the same
40
+ $value: if($val == rfs-fluid-value($value), null, $val);
41
+ }
42
+ @else {
43
+ $value: rfs-fluid-value($value);
44
+ }
45
+ }
46
+
47
+ $is-css-var: map-get($utility, css-var);
48
+ $is-local-vars: map-get($utility, local-vars);
49
+ $is-rtl: map-get($utility, rtl);
50
+
51
+ @if $value != null {
52
+ @if $is-rtl == false {
53
+ /* rtl:begin:remove */
54
+ }
55
+
56
+ @if $is-css-var {
57
+ .#{$property-class + $infix + $property-class-modifier} {
58
+ --#{$prefix}#{$css-variable-name}: #{$value};
59
+ }
60
+
61
+ @each $pseudo in $state {
62
+ .#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
63
+ --#{$prefix}#{$css-variable-name}: #{$value};
64
+ }
65
+ }
66
+ } @else {
67
+ .#{$property-class + $infix + $property-class-modifier} {
68
+ @each $property in $properties {
69
+ @if $is-local-vars {
70
+ @each $local-var, $variable in $is-local-vars {
71
+ --#{$prefix}#{$local-var}: #{$variable};
72
+ }
73
+ }
74
+ #{$property}: $value if($enable-important-utilities, !important, null);
75
+ }
76
+ }
77
+
78
+ @each $pseudo in $state {
79
+ .#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
80
+ @each $property in $properties {
81
+ @if $is-local-vars {
82
+ @each $local-var, $variable in $is-local-vars {
83
+ --#{$prefix}#{$local-var}: #{$variable};
84
+ }
85
+ }
86
+ #{$property}: $value if($enable-important-utilities, !important, null);
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ @if $is-rtl == false {
93
+ /* rtl:end:remove */
94
+ }
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,33 @@
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://kittygiraudel.com/2016/10/13/css-hide-and-seek/
7
+
8
+ @mixin visually-hidden() {
9
+ width: 1px !important;
10
+ height: 1px !important;
11
+ padding: 0 !important;
12
+ margin: -1px !important; // Fix for https://github.com/twbs/bootstrap/issues/25686
13
+ overflow: hidden !important;
14
+ clip: rect(0, 0, 0, 0) !important;
15
+ white-space: nowrap !important;
16
+ border: 0 !important;
17
+
18
+ // Fix for positioned table caption that could become anonymous cells
19
+ &:not(caption) {
20
+ position: absolute !important;
21
+ }
22
+ }
23
+
24
+ // Use to only display content when it's focused, or one of its child elements is focused
25
+ // (i.e. when focus is within the element/container that the class was applied to)
26
+ //
27
+ // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
28
+
29
+ @mixin visually-hidden-focusable() {
30
+ &:not(:focus):not(:focus-within) {
31
+ @include visually-hidden();
32
+ }
33
+ }
@@ -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
+ }
@@ -0,0 +1,348 @@
1
+ // stylelint-disable scss/dimension-no-non-numeric-values
2
+
3
+ // SCSS RFS mixin
4
+ //
5
+ // Automated responsive values for font sizes, paddings, margins and much more
6
+ //
7
+ // Licensed under MIT (https://github.com/twbs/rfs/blob/main/LICENSE)
8
+
9
+ // Configuration
10
+
11
+ // Base value
12
+ $rfs-base-value: 1.25rem !default;
13
+ $rfs-unit: rem !default;
14
+
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
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 values 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
+ // Mode. Possibilities: "min-media-query", "max-media-query"
38
+ $rfs-mode: min-media-query !default;
39
+
40
+ // Generate enable or disable classes. Possibilities: false, "enable" or "disable"
41
+ $rfs-class: false !default;
42
+
43
+ // 1 rem = $rfs-rem-value px
44
+ $rfs-rem-value: 16 !default;
45
+
46
+ // Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
47
+ $rfs-safari-iframe-resize-bug-fix: false !default;
48
+
49
+ // Disable RFS by setting $enable-rfs to false
50
+ $enable-rfs: true !default;
51
+
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
+ }
96
+
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);
100
+ }
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));
103
+ }
104
+
105
+ // Cache $rfs-breakpoint unit to prevent multiple calls
106
+ $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
107
+
108
+ // Remove unit from $rfs-breakpoint for calculations
109
+ @if $rfs-breakpoint-unit-cache == px {
110
+ $rfs-breakpoint: divide($rfs-breakpoint, $rfs-breakpoint * 0 + 1);
111
+ }
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));
114
+ }
115
+
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
+ }
134
+ }
135
+ @else {
136
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
137
+ @content;
138
+ }
139
+ }
140
+ }
141
+
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;
156
+ }
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;
168
+ }
169
+
170
+ @include _rfs-media-query () {
171
+ .enable-rfs &,
172
+ &.enable-rfs {
173
+ @content;
174
+ }
175
+ }
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";
201
+ }
202
+ @else {
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
+ }
217
+ }
218
+ }
219
+
220
+ // Remove first space
221
+ @return unquote(str-slice($val, 2));
222
+ }
223
+
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);
253
+
254
+ // Calculate difference between $value and the minimum value
255
+ $value-diff: abs($value) - $value-min;
256
+
257
+ // Base value formatting
258
+ $min-width: if($rfs-unit == rem, #{divide($value-min, $rfs-rem-value)}rem, #{$value-min}px);
259
+
260
+ // Use negative value if needed
261
+ $min-width: if($value < 0, -$min-width, $min-width);
262
+
263
+ // Use `vmin` if two-dimensional is enabled
264
+ $variable-unit: if($rfs-two-dimensional, vmin, vw);
265
+
266
+ // Calculate the variable width between 0 and $rfs-breakpoint
267
+ $variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit};
268
+
269
+ // Return the calculated value
270
+ $val: $val + " calc(" + $min-width + if($value < 0, " - ", " + ") + $variable-width + ")";
271
+ }
272
+ }
273
+ }
274
+ }
275
+
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;
289
+ }
290
+ @else {
291
+ @include _rfs-rule () {
292
+ #{$property}: if($rfs-mode == max-media-query, $val, $fluid-val);
293
+
294
+ // Include safari iframe resize fix if needed
295
+ min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
296
+ }
297
+
298
+ @include _rfs-media-query-rule () {
299
+ #{$property}: if($rfs-mode == max-media-query, $fluid-val, $val);
300
+ }
301
+ }
302
+ }
303
+ }
304
+
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);
344
+ }
345
+
346
+ @mixin margin-left($value) {
347
+ @include rfs($value, margin-left);
348
+ }
data/bootstrap.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'bootstrap/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'bootstrap-propshaft'
7
+ s.version = Bootstrap::VERSION
8
+ s.authors = ['Twitter, Inc.']
9
+ s.email = 'thomas@hummel.link'
10
+ s.summary = 'A fork of bootstrap-rubygem: https://github.com/manuelmeurer/bootstrap-rubygem which is a fork of https://github.com/twbs/bootstrap-rubygem'
11
+ s.homepage = 'https://github.com/thooams/bootstrap-propshaft'
12
+ s.license = 'MIT'
13
+
14
+ # SassC requires Ruby 2.3.3. Also specify here to make it obvious.
15
+ s.required_ruby_version = '>= 2.3.3'
16
+
17
+ s.add_runtime_dependency 'popper_js', '>= 2.11.8', '< 3'
18
+ s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
19
+
20
+ s.add_development_dependency 'rake'
21
+
22
+ # Testing dependencies
23
+ s.add_development_dependency 'minitest', '~> 5.14.4'
24
+ s.add_development_dependency 'minitest-reporters', '~> 1.4.3'
25
+ s.add_development_dependency 'term-ansicolor'
26
+ # Integration testing
27
+ s.add_development_dependency 'capybara', '>= 2.6.0'
28
+ s.add_development_dependency 'cuprite'
29
+ # Dummy Rails app dependencies
30
+ s.add_development_dependency 'railties'
31
+ s.add_development_dependency 'actionpack', '>= 4.1.5'
32
+ s.add_development_dependency 'activesupport', '>= 4.1.5'
33
+ s.add_development_dependency 'json', '>= 1.8.1'
34
+ s.add_development_dependency 'sprockets-rails', '>= 2.3.2'
35
+ s.add_development_dependency 'uglifier'
36
+
37
+ s.files = `git ls-files`.split("\n")
38
+ s.test_files = `git ls-files -- test/*`.split("\n")
39
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'autoprefixer-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
11
+
12
+ module Bootstrap
13
+ module Rails
14
+ class Engine < ::Rails::Engine
15
+ initializer 'bootstrap.assets' do |app|
16
+ %w(stylesheets javascripts).each do |sub|
17
+ app.config.assets.paths << root.join('assets', sub).to_s
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bootstrap
4
+ VERSION = '5.3.2'
5
+ BOOTSTRAP_SHA = '344e912d04b5b6a04482113eff20ab416ff01048'
6
+ end
data/lib/bootstrap.rb ADDED
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bootstrap/version'
4
+ require 'popper_js'
5
+
6
+ module Bootstrap
7
+ class << self
8
+ # Inspired by Kaminari
9
+ def load!
10
+ if rails?
11
+ register_rails_engine
12
+ elsif hanami?
13
+ register_hanami
14
+ elsif sprockets?
15
+ register_sprockets
16
+ elsif defined?(::Sass) && ::Sass.respond_to?(:load_paths)
17
+ # The deprecated `sass` gem:
18
+ ::Sass.load_paths << stylesheets_path
19
+ end
20
+
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
26
+ end
27
+
28
+ # Paths
29
+ def gem_path
30
+ @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
31
+ end
32
+
33
+ def stylesheets_path
34
+ File.join assets_path, 'stylesheets'
35
+ end
36
+
37
+ def javascripts_path
38
+ File.join assets_path, 'javascripts'
39
+ end
40
+
41
+ def assets_path
42
+ @assets_path ||= File.join gem_path, 'assets'
43
+ end
44
+
45
+ # Environment detection helpers
46
+ def sprockets?
47
+ defined?(::Sprockets)
48
+ end
49
+
50
+ def rails?
51
+ defined?(::Rails)
52
+ end
53
+
54
+ def hanami?
55
+ defined?(::Hanami)
56
+ end
57
+
58
+ private
59
+
60
+ def register_rails_engine
61
+ require 'bootstrap/engine'
62
+ end
63
+
64
+ def register_sprockets
65
+ Sprockets.append_path(stylesheets_path)
66
+ Sprockets.append_path(javascripts_path)
67
+ end
68
+
69
+ def register_hanami
70
+ Hanami::Assets.sources << assets_path
71
+ end
72
+ end
73
+ end
74
+
75
+ Bootstrap.load!