bootstrap 5.0.1 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/assets/javascripts/bootstrap-sprockets.js +7 -7
- data/assets/javascripts/bootstrap.js +332 -311
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/javascripts/bootstrap/alert.js +18 -17
- data/assets/javascripts/bootstrap/base-component.js +34 -25
- data/assets/javascripts/bootstrap/button.js +18 -19
- data/assets/javascripts/bootstrap/carousel.js +67 -52
- data/assets/javascripts/bootstrap/collapse.js +15 -6
- data/assets/javascripts/bootstrap/dom/data.js +2 -2
- data/assets/javascripts/bootstrap/dom/event-handler.js +2 -2
- data/assets/javascripts/bootstrap/dom/manipulator.js +2 -2
- data/assets/javascripts/bootstrap/dom/selector-engine.js +2 -2
- data/assets/javascripts/bootstrap/dropdown.js +61 -44
- data/assets/javascripts/bootstrap/modal.js +171 -108
- data/assets/javascripts/bootstrap/offcanvas.js +144 -95
- data/assets/javascripts/bootstrap/popover.js +35 -20
- data/assets/javascripts/bootstrap/scrollspy.js +14 -5
- data/assets/javascripts/bootstrap/tab.js +18 -10
- data/assets/javascripts/bootstrap/toast.js +17 -15
- data/assets/javascripts/bootstrap/tooltip.js +20 -21
- data/assets/stylesheets/_bootstrap-grid.scss +1 -1
- data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
- data/assets/stylesheets/_bootstrap.scss +1 -1
- data/assets/stylesheets/bootstrap/_card.scss +5 -5
- data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
- data/assets/stylesheets/bootstrap/_dropdown.scss +4 -4
- data/assets/stylesheets/bootstrap/_functions.scss +61 -3
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_modal.scss +4 -4
- data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
- data/assets/stylesheets/bootstrap/_popover.scss +10 -10
- data/assets/stylesheets/bootstrap/_tables.scss +1 -1
- data/assets/stylesheets/bootstrap/_toasts.scss +1 -1
- data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
- data/assets/stylesheets/bootstrap/_variables.scss +22 -18
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +16 -9
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
- data/lib/bootstrap/version.rb +2 -2
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap scrollspy.js v5.0.
|
2
|
+
* Bootstrap scrollspy.js v5.0.2 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
5
|
*/
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
/**
|
20
20
|
* --------------------------------------------------------------------------
|
21
|
-
* Bootstrap (v5.0.
|
21
|
+
* Bootstrap (v5.0.2): util/index.js
|
22
22
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
23
23
|
* --------------------------------------------------------------------------
|
24
24
|
*/
|
@@ -117,9 +117,18 @@
|
|
117
117
|
return null;
|
118
118
|
};
|
119
119
|
|
120
|
+
const DOMContentLoadedCallbacks = [];
|
121
|
+
|
120
122
|
const onDOMContentLoaded = callback => {
|
121
123
|
if (document.readyState === 'loading') {
|
122
|
-
document
|
124
|
+
// add listener on the first call when the document is in loading state
|
125
|
+
if (!DOMContentLoadedCallbacks.length) {
|
126
|
+
document.addEventListener('DOMContentLoaded', () => {
|
127
|
+
DOMContentLoadedCallbacks.forEach(callback => callback());
|
128
|
+
});
|
129
|
+
}
|
130
|
+
|
131
|
+
DOMContentLoadedCallbacks.push(callback);
|
123
132
|
} else {
|
124
133
|
callback();
|
125
134
|
}
|
@@ -146,7 +155,7 @@
|
|
146
155
|
|
147
156
|
/**
|
148
157
|
* --------------------------------------------------------------------------
|
149
|
-
* Bootstrap (v5.0.
|
158
|
+
* Bootstrap (v5.0.2): scrollspy.js
|
150
159
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
151
160
|
* --------------------------------------------------------------------------
|
152
161
|
*/
|
@@ -361,7 +370,7 @@
|
|
361
370
|
|
362
371
|
static jQueryInterface(config) {
|
363
372
|
return this.each(function () {
|
364
|
-
const data = ScrollSpy.
|
373
|
+
const data = ScrollSpy.getOrCreateInstance(this, config);
|
365
374
|
|
366
375
|
if (typeof config !== 'string') {
|
367
376
|
return;
|
@@ -1,18 +1,17 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap tab.js v5.0.
|
2
|
+
* Bootstrap tab.js v5.0.2 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
(function (global, factory) {
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.SelectorEngine, global.
|
10
|
-
}(this, (function (SelectorEngine,
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './base-component'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.SelectorEngine, global.EventHandler, global.Base));
|
10
|
+
}(this, (function (SelectorEngine, EventHandler, BaseComponent) { 'use strict';
|
11
11
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
13
13
|
|
14
14
|
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
15
|
-
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
16
15
|
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
17
16
|
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
18
17
|
|
@@ -75,9 +74,18 @@
|
|
75
74
|
return null;
|
76
75
|
};
|
77
76
|
|
77
|
+
const DOMContentLoadedCallbacks = [];
|
78
|
+
|
78
79
|
const onDOMContentLoaded = callback => {
|
79
80
|
if (document.readyState === 'loading') {
|
80
|
-
document
|
81
|
+
// add listener on the first call when the document is in loading state
|
82
|
+
if (!DOMContentLoadedCallbacks.length) {
|
83
|
+
document.addEventListener('DOMContentLoaded', () => {
|
84
|
+
DOMContentLoadedCallbacks.forEach(callback => callback());
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
DOMContentLoadedCallbacks.push(callback);
|
81
89
|
} else {
|
82
90
|
callback();
|
83
91
|
}
|
@@ -104,7 +112,7 @@
|
|
104
112
|
|
105
113
|
/**
|
106
114
|
* --------------------------------------------------------------------------
|
107
|
-
* Bootstrap (v5.0.
|
115
|
+
* Bootstrap (v5.0.2): tab.js
|
108
116
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
109
117
|
* --------------------------------------------------------------------------
|
110
118
|
*/
|
@@ -259,7 +267,7 @@
|
|
259
267
|
|
260
268
|
static jQueryInterface(config) {
|
261
269
|
return this.each(function () {
|
262
|
-
const data =
|
270
|
+
const data = Tab.getOrCreateInstance(this);
|
263
271
|
|
264
272
|
if (typeof config === 'string') {
|
265
273
|
if (typeof data[config] === 'undefined') {
|
@@ -288,7 +296,7 @@
|
|
288
296
|
return;
|
289
297
|
}
|
290
298
|
|
291
|
-
const data =
|
299
|
+
const data = Tab.getOrCreateInstance(this);
|
292
300
|
data.show();
|
293
301
|
});
|
294
302
|
/**
|
@@ -1,17 +1,16 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap toast.js v5.0.
|
2
|
+
* Bootstrap toast.js v5.0.2 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
(function (global, factory) {
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.
|
10
|
-
}(this, (function (
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.EventHandler, global.Manipulator, global.Base));
|
10
|
+
}(this, (function (EventHandler, Manipulator, BaseComponent) { 'use strict';
|
11
11
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
13
13
|
|
14
|
-
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
15
14
|
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
15
|
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
17
16
|
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
@@ -62,9 +61,18 @@
|
|
62
61
|
return null;
|
63
62
|
};
|
64
63
|
|
64
|
+
const DOMContentLoadedCallbacks = [];
|
65
|
+
|
65
66
|
const onDOMContentLoaded = callback => {
|
66
67
|
if (document.readyState === 'loading') {
|
67
|
-
document
|
68
|
+
// add listener on the first call when the document is in loading state
|
69
|
+
if (!DOMContentLoadedCallbacks.length) {
|
70
|
+
document.addEventListener('DOMContentLoaded', () => {
|
71
|
+
DOMContentLoadedCallbacks.forEach(callback => callback());
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
DOMContentLoadedCallbacks.push(callback);
|
68
76
|
} else {
|
69
77
|
callback();
|
70
78
|
}
|
@@ -91,7 +99,7 @@
|
|
91
99
|
|
92
100
|
/**
|
93
101
|
* --------------------------------------------------------------------------
|
94
|
-
* Bootstrap (v5.0.
|
102
|
+
* Bootstrap (v5.0.2): toast.js
|
95
103
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
96
104
|
* --------------------------------------------------------------------------
|
97
105
|
*/
|
@@ -291,13 +299,7 @@
|
|
291
299
|
|
292
300
|
static jQueryInterface(config) {
|
293
301
|
return this.each(function () {
|
294
|
-
|
295
|
-
|
296
|
-
const _config = typeof config === 'object' && config;
|
297
|
-
|
298
|
-
if (!data) {
|
299
|
-
data = new Toast(this, _config);
|
300
|
-
}
|
302
|
+
const data = Toast.getOrCreateInstance(this, config);
|
301
303
|
|
302
304
|
if (typeof config === 'string') {
|
303
305
|
if (typeof data[config] === 'undefined') {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap tooltip.js v5.0.
|
2
|
+
* Bootstrap tooltip.js v5.0.2 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
5
|
*/
|
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
/**
|
42
42
|
* --------------------------------------------------------------------------
|
43
|
-
* Bootstrap (v5.0.
|
43
|
+
* Bootstrap (v5.0.2): util/index.js
|
44
44
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
45
45
|
* --------------------------------------------------------------------------
|
46
46
|
*/
|
@@ -143,9 +143,18 @@
|
|
143
143
|
return null;
|
144
144
|
};
|
145
145
|
|
146
|
+
const DOMContentLoadedCallbacks = [];
|
147
|
+
|
146
148
|
const onDOMContentLoaded = callback => {
|
147
149
|
if (document.readyState === 'loading') {
|
148
|
-
document
|
150
|
+
// add listener on the first call when the document is in loading state
|
151
|
+
if (!DOMContentLoadedCallbacks.length) {
|
152
|
+
document.addEventListener('DOMContentLoaded', () => {
|
153
|
+
DOMContentLoadedCallbacks.forEach(callback => callback());
|
154
|
+
});
|
155
|
+
}
|
156
|
+
|
157
|
+
DOMContentLoadedCallbacks.push(callback);
|
149
158
|
} else {
|
150
159
|
callback();
|
151
160
|
}
|
@@ -174,7 +183,7 @@
|
|
174
183
|
|
175
184
|
/**
|
176
185
|
* --------------------------------------------------------------------------
|
177
|
-
* Bootstrap (v5.0.
|
186
|
+
* Bootstrap (v5.0.2): util/sanitizer.js
|
178
187
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
179
188
|
* --------------------------------------------------------------------------
|
180
189
|
*/
|
@@ -269,7 +278,7 @@
|
|
269
278
|
const elName = el.nodeName.toLowerCase();
|
270
279
|
|
271
280
|
if (!allowlistKeys.includes(elName)) {
|
272
|
-
el.
|
281
|
+
el.remove();
|
273
282
|
continue;
|
274
283
|
}
|
275
284
|
|
@@ -287,7 +296,7 @@
|
|
287
296
|
|
288
297
|
/**
|
289
298
|
* --------------------------------------------------------------------------
|
290
|
-
* Bootstrap (v5.0.
|
299
|
+
* Bootstrap (v5.0.2): tooltip.js
|
291
300
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
292
301
|
* --------------------------------------------------------------------------
|
293
302
|
*/
|
@@ -456,8 +465,8 @@
|
|
456
465
|
clearTimeout(this._timeout);
|
457
466
|
EventHandler__default['default'].off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
|
458
467
|
|
459
|
-
if (this.tip
|
460
|
-
this.tip.
|
468
|
+
if (this.tip) {
|
469
|
+
this.tip.remove();
|
461
470
|
}
|
462
471
|
|
463
472
|
if (this._popper) {
|
@@ -562,8 +571,8 @@
|
|
562
571
|
return;
|
563
572
|
}
|
564
573
|
|
565
|
-
if (this._hoverState !== HOVER_STATE_SHOW
|
566
|
-
tip.
|
574
|
+
if (this._hoverState !== HOVER_STATE_SHOW) {
|
575
|
+
tip.remove();
|
567
576
|
}
|
568
577
|
|
569
578
|
this._cleanTipClass();
|
@@ -950,17 +959,7 @@
|
|
950
959
|
|
951
960
|
static jQueryInterface(config) {
|
952
961
|
return this.each(function () {
|
953
|
-
|
954
|
-
|
955
|
-
const _config = typeof config === 'object' && config;
|
956
|
-
|
957
|
-
if (!data && /dispose|hide/.test(config)) {
|
958
|
-
return;
|
959
|
-
}
|
960
|
-
|
961
|
-
if (!data) {
|
962
|
-
data = new Tooltip(this, _config);
|
963
|
-
}
|
962
|
+
const data = Tooltip.getOrCreateInstance(this, config);
|
964
963
|
|
965
964
|
if (typeof config === 'string') {
|
966
965
|
if (typeof data[config] === 'undefined') {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap Grid v5.0.
|
2
|
+
* Bootstrap Grid v5.0.2 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 The Bootstrap Authors
|
4
4
|
* Copyright 2011-2021 Twitter, Inc.
|
5
5
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap Reboot v5.0.
|
2
|
+
* Bootstrap Reboot v5.0.2 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 The Bootstrap Authors
|
4
4
|
* Copyright 2011-2021 Twitter, Inc.
|
5
5
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
@@ -55,7 +55,7 @@
|
|
55
55
|
}
|
56
56
|
|
57
57
|
.card-subtitle {
|
58
|
-
margin-top: -$card-title-spacer-y
|
58
|
+
margin-top: -$card-title-spacer-y * .5;
|
59
59
|
margin-bottom: 0;
|
60
60
|
}
|
61
61
|
|
@@ -106,9 +106,9 @@
|
|
106
106
|
//
|
107
107
|
|
108
108
|
.card-header-tabs {
|
109
|
-
margin-right: -$card-cap-padding-x
|
109
|
+
margin-right: -$card-cap-padding-x * .5;
|
110
110
|
margin-bottom: -$card-cap-padding-y;
|
111
|
-
margin-left: -$card-cap-padding-x
|
111
|
+
margin-left: -$card-cap-padding-x * .5;
|
112
112
|
border-bottom: 0;
|
113
113
|
|
114
114
|
@if $nav-tabs-link-active-bg != $card-bg {
|
@@ -120,8 +120,8 @@
|
|
120
120
|
}
|
121
121
|
|
122
122
|
.card-header-pills {
|
123
|
-
margin-right: -$card-cap-padding-x
|
124
|
-
margin-left: -$card-cap-padding-x
|
123
|
+
margin-right: -$card-cap-padding-x * .5;
|
124
|
+
margin-left: -$card-cap-padding-x * .5;
|
125
125
|
}
|
126
126
|
|
127
127
|
// Card image
|
@@ -202,9 +202,9 @@
|
|
202
202
|
|
203
203
|
.carousel-caption {
|
204
204
|
position: absolute;
|
205
|
-
right: (100% - $carousel-caption-width)
|
205
|
+
right: (100% - $carousel-caption-width) * .5;
|
206
206
|
bottom: $carousel-caption-spacer;
|
207
|
-
left: (100% - $carousel-caption-width)
|
207
|
+
left: (100% - $carousel-caption-width) * .5;
|
208
208
|
padding-top: $carousel-caption-padding-y;
|
209
209
|
padding-bottom: $carousel-caption-padding-y;
|
210
210
|
color: $carousel-caption-color;
|
@@ -50,8 +50,8 @@
|
|
50
50
|
--bs-position: start;
|
51
51
|
|
52
52
|
&[data-bs-popper] {
|
53
|
-
right: auto
|
54
|
-
left: 0
|
53
|
+
right: auto;
|
54
|
+
left: 0;
|
55
55
|
}
|
56
56
|
}
|
57
57
|
|
@@ -59,8 +59,8 @@
|
|
59
59
|
--bs-position: end;
|
60
60
|
|
61
61
|
&[data-bs-popper] {
|
62
|
-
right: 0
|
63
|
-
left: auto
|
62
|
+
right: 0;
|
63
|
+
left: auto;
|
64
64
|
}
|
65
65
|
}
|
66
66
|
}
|
@@ -95,7 +95,7 @@
|
|
95
95
|
// Color contrast
|
96
96
|
// See https://github.com/twbs/bootstrap/pull/30168
|
97
97
|
|
98
|
-
// A list of pre-calculated numbers of pow(($value
|
98
|
+
// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
|
99
99
|
// stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
|
100
100
|
$_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
|
101
101
|
|
@@ -123,7 +123,7 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
|
|
123
123
|
$l1: luminance($background);
|
124
124
|
$l2: luminance(opaque($background, $foreground));
|
125
125
|
|
126
|
-
@return if($l1 > $l2, ($l1 + .05
|
126
|
+
@return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
|
127
127
|
}
|
128
128
|
|
129
129
|
// Return WCAG2.0 relative luminance
|
@@ -137,7 +137,7 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
|
|
137
137
|
);
|
138
138
|
|
139
139
|
@each $name, $value in $rgb {
|
140
|
-
$value: if($value
|
140
|
+
$value: if(divide($value, 255) < .03928, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1));
|
141
141
|
$rgb: map-merge($rgb, ($name: $value));
|
142
142
|
}
|
143
143
|
|
@@ -181,6 +181,14 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
|
|
181
181
|
@return $value1 + $value2;
|
182
182
|
}
|
183
183
|
|
184
|
+
@if type-of($value1) != number {
|
185
|
+
$value1: unquote("(") + $value1 + unquote(")");
|
186
|
+
}
|
187
|
+
|
188
|
+
@if type-of($value2) != number {
|
189
|
+
$value2: unquote("(") + $value2 + unquote(")");
|
190
|
+
}
|
191
|
+
|
184
192
|
@return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
|
185
193
|
}
|
186
194
|
|
@@ -201,5 +209,55 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
|
|
201
209
|
@return $value1 - $value2;
|
202
210
|
}
|
203
211
|
|
212
|
+
@if type-of($value1) != number {
|
213
|
+
$value1: unquote("(") + $value1 + unquote(")");
|
214
|
+
}
|
215
|
+
|
216
|
+
@if type-of($value2) != number {
|
217
|
+
$value2: unquote("(") + $value2 + unquote(")");
|
218
|
+
}
|
219
|
+
|
204
220
|
@return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
|
205
221
|
}
|
222
|
+
|
223
|
+
@function divide($dividend, $divisor, $precision: 10) {
|
224
|
+
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
|
225
|
+
$dividend: abs($dividend);
|
226
|
+
$divisor: abs($divisor);
|
227
|
+
@if $dividend == 0 {
|
228
|
+
@return 0;
|
229
|
+
}
|
230
|
+
@if $divisor == 0 {
|
231
|
+
@error "Cannot divide by 0";
|
232
|
+
}
|
233
|
+
$remainder: $dividend;
|
234
|
+
$result: 0;
|
235
|
+
$factor: 10;
|
236
|
+
@while ($remainder > 0 and $precision >= 0) {
|
237
|
+
$quotient: 0;
|
238
|
+
@while ($remainder >= $divisor) {
|
239
|
+
$remainder: $remainder - $divisor;
|
240
|
+
$quotient: $quotient + 1;
|
241
|
+
}
|
242
|
+
$result: $result * 10 + $quotient;
|
243
|
+
$factor: $factor * .1;
|
244
|
+
$remainder: $remainder * 10;
|
245
|
+
$precision: $precision - 1;
|
246
|
+
@if ($precision < 0 and $remainder >= $divisor * 5) {
|
247
|
+
$result: $result + 1;
|
248
|
+
}
|
249
|
+
}
|
250
|
+
$result: $result * $factor * $sign;
|
251
|
+
$dividend-unit: unit($dividend);
|
252
|
+
$divisor-unit: unit($divisor);
|
253
|
+
$unit-map: (
|
254
|
+
"px": 1px,
|
255
|
+
"rem": 1rem,
|
256
|
+
"em": 1em,
|
257
|
+
"%": 1%
|
258
|
+
);
|
259
|
+
@if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
|
260
|
+
$result: $result * map-get($unit-map, $dividend-unit);
|
261
|
+
}
|
262
|
+
@return $result;
|
263
|
+
}
|