mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-25 12:59:05 +02:00
Restore both grids , enable CSS grid by default, and update mixins (#41702)
* Restore both grids and update mixins * Bundlewatch
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
"files": [
|
||||
{
|
||||
"path": "./dist/css/bootstrap-grid.css",
|
||||
"maxSize": "6.5 kB"
|
||||
"maxSize": "7.5 kB"
|
||||
},
|
||||
{
|
||||
"path": "./dist/css/bootstrap-grid.min.css",
|
||||
"maxSize": "6.0 kB"
|
||||
"maxSize": "6.75 kB"
|
||||
},
|
||||
{
|
||||
"path": "./dist/css/bootstrap-reboot.css",
|
||||
@@ -26,7 +26,7 @@
|
||||
},
|
||||
{
|
||||
"path": "./dist/css/bootstrap.css",
|
||||
"maxSize": "34.0 kB"
|
||||
"maxSize": "35.75 kB"
|
||||
},
|
||||
{
|
||||
"path": "./dist/css/bootstrap.min.css",
|
||||
|
@@ -13,7 +13,7 @@ $enable-reduced-motion: true !default;
|
||||
$enable-smooth-scroll: true !default;
|
||||
$enable-grid-classes: true !default;
|
||||
$enable-container-classes: true !default;
|
||||
$enable-cssgrid: false !default;
|
||||
$enable-cssgrid: true !default;
|
||||
$enable-button-pointers: true !default;
|
||||
$enable-rfs: true !default;
|
||||
$enable-validation-icons: true !default;
|
||||
@@ -31,6 +31,18 @@ $color-contrast-dark: #000 !default;
|
||||
$color-contrast-light: #fff !default;
|
||||
$min-contrast-ratio: 4.5 !default;
|
||||
|
||||
// scss-docs-start spacer-variables-maps
|
||||
$spacer: 1rem !default;
|
||||
$spacers: (
|
||||
0: 0,
|
||||
1: $spacer * .25,
|
||||
2: $spacer * .5,
|
||||
3: $spacer,
|
||||
4: $spacer * 1.5,
|
||||
5: $spacer * 3,
|
||||
) !default;
|
||||
// scss-docs-end spacer-variables-maps
|
||||
|
||||
// Grid breakpoints
|
||||
//
|
||||
// Define the minimum dimensions at which your layout will change,
|
||||
@@ -55,6 +67,8 @@ $grid-columns: 12 !default;
|
||||
$grid-gutter-width: 1.5rem !default;
|
||||
$grid-row-columns: 6 !default;
|
||||
|
||||
$gutters: $spacers !default;
|
||||
|
||||
// Grid containers
|
||||
//
|
||||
// Define the maximum width of `.container` for different screen sizes.
|
||||
|
@@ -1,14 +1,11 @@
|
||||
@use "sass:map";
|
||||
@use "../config" as *;
|
||||
@use "../mixins/grid" as *;
|
||||
@use "breakpoints" as *;
|
||||
|
||||
// mdo-do
|
||||
// - check gap utilities as replacement for gutter classes from v5
|
||||
|
||||
// Row
|
||||
//
|
||||
// Rows contain your columns.
|
||||
|
||||
:root {
|
||||
@each $name, $value in $grid-breakpoints {
|
||||
--#{$prefix}breakpoint-#{$name}: #{$value};
|
||||
@@ -16,6 +13,19 @@
|
||||
}
|
||||
|
||||
@layer layout {
|
||||
@if $enable-grid-classes {
|
||||
.row {
|
||||
@include make-row();
|
||||
|
||||
> * {
|
||||
@include make-col-ready();
|
||||
}
|
||||
}
|
||||
|
||||
@include make-grid-columns();
|
||||
}
|
||||
|
||||
@if $enable-cssgrid {
|
||||
.grid {
|
||||
--#{$prefix}columns: #{$grid-columns};
|
||||
--#{$prefix}rows: 1;
|
||||
@@ -25,32 +35,10 @@
|
||||
grid-template-rows: repeat(var(--#{$prefix}rows), 1fr);
|
||||
grid-template-columns: repeat(var(--#{$prefix}columns), 1fr);
|
||||
gap: var(--#{$prefix}gap);
|
||||
|
||||
}
|
||||
|
||||
@each $breakpoint in map.keys($grid-breakpoints) {
|
||||
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
||||
|
||||
@include media-breakpoint-up($breakpoint, $grid-breakpoints) {
|
||||
@if $grid-columns > 0 {
|
||||
@for $i from 1 through $grid-columns {
|
||||
.col#{$infix}-#{$i} {
|
||||
grid-column: auto / span $i;
|
||||
}
|
||||
|
||||
.end#{$infix}-#{$i} {
|
||||
grid-column-end: $i;
|
||||
}
|
||||
}
|
||||
|
||||
// Start with `1` because `0` is an invalid value.
|
||||
// Ends with `$columns - 1` because offsetting by the width of an entire row isn't possible.
|
||||
@for $i from 1 through ($grid-columns - 1) {
|
||||
.col-start#{$infix}-#{$i} {
|
||||
grid-column-start: $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include make-cssgrid();
|
||||
}
|
||||
|
||||
// mdo-do: add to utilities?
|
||||
|
@@ -1,3 +1,9 @@
|
||||
@use "sass:map";
|
||||
@use "sass:math";
|
||||
@use "sass:meta";
|
||||
@use "../config" as *;
|
||||
@use "../layout/breakpoints" as *;
|
||||
|
||||
// Grid system
|
||||
//
|
||||
// Generate semantic grid columns with these mixins.
|
||||
@@ -15,7 +21,7 @@
|
||||
|
||||
@mixin make-col-ready() {
|
||||
// Add box sizing if only the grid is loaded
|
||||
box-sizing: if(variable-exists(include-column-box-sizing) and $include-column-box-sizing, border-box, null);
|
||||
box-sizing: if(meta.variable-exists(include-column-box-sizing) and $include-column-box-sizing, border-box, null);
|
||||
// Prevent columns from becoming too narrow when at smaller grid tiers by
|
||||
// always setting `width: 100%;`. This works because we set the width
|
||||
// later on to override this initial width.
|
||||
@@ -30,7 +36,7 @@
|
||||
@mixin make-col($size: false, $columns: $grid-columns) {
|
||||
@if $size {
|
||||
flex: 0 0 auto;
|
||||
width: percentage(divide($size, $columns));
|
||||
width: math.percentage(math.div($size, $columns));
|
||||
|
||||
} @else {
|
||||
flex: 1 1 0;
|
||||
@@ -44,8 +50,8 @@
|
||||
}
|
||||
|
||||
@mixin make-col-offset($size, $columns: $grid-columns) {
|
||||
$num: divide($size, $columns);
|
||||
margin-left: if($num == 0, 0, percentage($num));
|
||||
$num: math.div($size, $columns);
|
||||
margin-left: if($num == 0, 0, math.percentage($num));
|
||||
}
|
||||
|
||||
// Row columns
|
||||
@@ -56,7 +62,7 @@
|
||||
@mixin row-cols($count) {
|
||||
> * {
|
||||
flex: 0 0 auto;
|
||||
width: percentage(divide(1, $count));
|
||||
width: math.percentage(math.div(1, $count));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +72,7 @@
|
||||
// any value of `$grid-columns`.
|
||||
|
||||
@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
|
||||
@each $breakpoint in map-keys($breakpoints) {
|
||||
@each $breakpoint in map.keys($breakpoints) {
|
||||
$infix: breakpoint-infix($breakpoint, $breakpoints);
|
||||
|
||||
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
||||
@@ -127,7 +133,7 @@
|
||||
}
|
||||
|
||||
@mixin make-cssgrid($columns: $grid-columns, $breakpoints: $grid-breakpoints) {
|
||||
@each $breakpoint in map-keys($breakpoints) {
|
||||
@each $breakpoint in map.keys($breakpoints) {
|
||||
$infix: breakpoint-infix($breakpoint, $breakpoints);
|
||||
|
||||
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
||||
|
Reference in New Issue
Block a user