bootstrap 4.6.2.1 → 5.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -4
- data/README.md +1 -7
- data/Rakefile +4 -16
- data/assets/javascripts/bootstrap/alert.js +148 -73
- data/assets/javascripts/bootstrap/button.js +71 -154
- data/assets/javascripts/bootstrap/carousel.js +315 -209
- data/assets/javascripts/bootstrap/collapse.js +307 -153
- data/assets/javascripts/bootstrap/dom/data.js +81 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +311 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +100 -0
- data/assets/javascripts/bootstrap/dom/polyfill.js +110 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +98 -0
- data/assets/javascripts/bootstrap/dropdown.js +257 -205
- data/assets/javascripts/bootstrap/modal.js +354 -250
- data/assets/javascripts/bootstrap/popover.js +85 -94
- data/assets/javascripts/bootstrap/scrollspy.js +179 -107
- data/assets/javascripts/bootstrap/tab.js +170 -99
- data/assets/javascripts/bootstrap/toast.js +181 -110
- data/assets/javascripts/bootstrap/tooltip.js +375 -226
- data/assets/javascripts/bootstrap-sprockets.js +5 -1
- data/assets/javascripts/bootstrap.js +2260 -1550
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -18
- data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
- data/assets/stylesheets/_bootstrap.scss +16 -10
- data/assets/stylesheets/bootstrap/_alert.scss +3 -4
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +16 -38
- data/assets/stylesheets/bootstrap/_buttons.scss +27 -45
- data/assets/stylesheets/bootstrap/_card.scss +22 -68
- data/assets/stylesheets/bootstrap/_carousel.scss +15 -20
- data/assets/stylesheets/bootstrap/_close.scss +9 -13
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +12 -9
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +82 -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 +7 -4
- data/assets/stylesheets/bootstrap/_mixins.scss +6 -12
- data/assets/stylesheets/bootstrap/_modal.scss +36 -41
- data/assets/stylesheets/bootstrap/_nav.scss +7 -9
- data/assets/stylesheets/bootstrap/_navbar.scss +42 -82
- data/assets/stylesheets/bootstrap/_pagination.scss +7 -20
- data/assets/stylesheets/bootstrap/_popover.scss +14 -14
- data/assets/stylesheets/bootstrap/_progress.scss +3 -5
- data/assets/stylesheets/bootstrap/_reboot.scss +304 -172
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +8 -17
- data/assets/stylesheets/bootstrap/_tables.scss +80 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +2 -4
- data/assets/stylesheets/bootstrap/_tooltip.scss +9 -9
- data/assets/stylesheets/bootstrap/_transitions.scss +0 -7
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +503 -18
- data/assets/stylesheets/bootstrap/_variables.scss +548 -437
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +142 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +116 -0
- data/assets/stylesheets/bootstrap/forms/_form-file.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +136 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +82 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +140 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_embed.scss +31 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_screenreaders.scss +8 -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/mixins/_alert.scss +0 -4
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +11 -8
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +62 -47
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +23 -85
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +9 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +86 -34
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +15 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +18 -24
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +49 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
- data/bootstrap.gemspec +3 -1
- data/lib/bootstrap/engine.rb +1 -17
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -18
- data/tasks/updater/network.rb +1 -7
- metadata +49 -47
- 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/_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/gemfiles/rails_7_0_dartsass.gemfile +0 -8
- data/test/gemfiles/rails_7_0_sassc.gemfile +0 -8
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da3029d47624ce88dca2ddb395d250b689f2bea68844f66718189fd25dff9b24
|
4
|
+
data.tar.gz: 99158148a82693decf171b07d999e45eeff3ab6fa157084b5b592ecda230426c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1790921eb6fefab26c74b036f316daec352870f6a9b2dfb795f0a51ae0fd65cd3c3b23f082d2de6b17bf59045bcf3db000f9ffc41c0ebfe809cabc370b79600
|
7
|
+
data.tar.gz: e2b21f142c4761d751d964b12fe4ed27b045f8df89ce87c6ad09a0d403e9e5d3ea9744f64d13a99bba76ce9058fe1e5f3f892804ff55a388dd630d2a1a60dfa0
|
data/CHANGELOG.md
CHANGED
@@ -6,10 +6,6 @@ The changelog only includes changes specific to the RubyGem.
|
|
6
6
|
The Bootstrap framework changes can be found in [the Releases section of twbs/bootstrap](https://github.com/twbs/bootstrap/releases).
|
7
7
|
Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release of Bootstrap.
|
8
8
|
|
9
|
-
# 4.6.2.1
|
10
|
-
|
11
|
-
* Adds support for other Sass compilers. [#278](https://github.com/twbs/bootstrap-rubygem/pull/278)
|
12
|
-
|
13
9
|
# 4.2.1
|
14
10
|
|
15
11
|
* Bootstrap rubygem now depends on SassC instead of Sass.
|
data/README.md
CHANGED
@@ -17,15 +17,9 @@ Please see the appropriate guide for your environment of choice:
|
|
17
17
|
Add `bootstrap` to your Gemfile:
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
gem 'bootstrap', '~>
|
20
|
+
gem 'bootstrap', '~> 5.0.0.alpha1'
|
21
21
|
```
|
22
22
|
|
23
|
-
This gem requires a Sass engine, so make sure you have **one** of these four gems in your Gemfile:
|
24
|
-
- [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets): Dart Sass engine, recommended but only works for Ruby 2.6+ and Rails 5+
|
25
|
-
- [`dartsass-rails`](https://github.com/rails/dartsass-rails): Dart Sass engine, recommended for Rails projects that use Propshaft
|
26
|
-
- [`cssbundling-rails`](https://github.com/rails/cssbundling-rails): External Sass engine
|
27
|
-
- [`sassc-rails`](https://github.com/sass/sassc-rails): SassC engine, deprecated but compatible with Ruby 2.3+ and Rails 4
|
28
|
-
|
29
23
|
Ensure that `sprockets-rails` is at least v2.3.2.
|
30
24
|
|
31
25
|
`bundle install` and restart your server to make the files available through the pipeline.
|
data/Rakefile
CHANGED
@@ -45,28 +45,16 @@ end
|
|
45
45
|
|
46
46
|
desc 'Dumps output to a CSS file for testing'
|
47
47
|
task :debug do
|
48
|
-
|
49
|
-
require 'sass-embedded'
|
50
|
-
rescue LoadError
|
51
|
-
begin
|
52
|
-
require 'sassc'
|
53
|
-
rescue LoadError
|
54
|
-
raise LoadError.new("bootstrap-rubygem requires a Sass engine. Please add dartsass-sprockets or sassc-rails to your dependencies.")
|
55
|
-
end
|
56
|
-
end
|
48
|
+
require 'sassc'
|
57
49
|
require './lib/bootstrap'
|
58
50
|
require 'term/ansicolor'
|
59
51
|
require 'autoprefixer-rails'
|
60
52
|
path = Bootstrap.stylesheets_path
|
61
53
|
%w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file|
|
62
|
-
|
63
|
-
css = if defined?(SassC::Engine)
|
64
|
-
SassC::Engine.new(File.read(filename), filename: filename, syntax: :scss).render
|
65
|
-
else
|
66
|
-
Sass.compile(filename).css
|
67
|
-
end
|
68
|
-
css = AutoprefixerRails.process(css)
|
54
|
+
engine = SassC::Engine.new(File.read("#{path}/#{file}.scss"), syntax: :scss, load_paths: [path])
|
69
55
|
out = File.join('tmp', "#{file[1..-1]}.css")
|
56
|
+
css = engine.render
|
57
|
+
css = AutoprefixerRails.process(css)
|
70
58
|
File.write(out, css)
|
71
59
|
$stderr.puts Term::ANSIColor.green "Compiled #{out}"
|
72
60
|
end
|
@@ -1,62 +1,132 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap alert.js
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap alert.js v5.0.0-alpha1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2020 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('
|
8
|
-
typeof define === 'function' && define.amd ? define(['
|
9
|
-
(global =
|
10
|
-
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js'], factory) :
|
9
|
+
(global = global || self, global.Alert = factory(global.Data, global.EventHandler));
|
10
|
+
}(this, (function (Data, EventHandler) { 'use strict';
|
11
|
+
|
12
|
+
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
|
13
|
+
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
* Bootstrap (v5.0.0-alpha1): util/index.js
|
18
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
19
|
+
* --------------------------------------------------------------------------
|
20
|
+
*/
|
21
|
+
var MILLISECONDS_MULTIPLIER = 1000;
|
22
|
+
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
23
|
+
|
24
|
+
var getSelector = function getSelector(element) {
|
25
|
+
var selector = element.getAttribute('data-target');
|
26
|
+
|
27
|
+
if (!selector || selector === '#') {
|
28
|
+
var hrefAttr = element.getAttribute('href');
|
29
|
+
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
24
30
|
}
|
25
|
-
}
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
return selector;
|
33
|
+
};
|
34
|
+
|
35
|
+
var getElementFromSelector = function getElementFromSelector(element) {
|
36
|
+
var selector = getSelector(element);
|
37
|
+
return selector ? document.querySelector(selector) : null;
|
38
|
+
};
|
39
|
+
|
40
|
+
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
41
|
+
if (!element) {
|
42
|
+
return 0;
|
43
|
+
} // Get transition-duration of the element
|
44
|
+
|
35
45
|
|
46
|
+
var _window$getComputedSt = window.getComputedStyle(element),
|
47
|
+
transitionDuration = _window$getComputedSt.transitionDuration,
|
48
|
+
transitionDelay = _window$getComputedSt.transitionDelay;
|
49
|
+
|
50
|
+
var floatTransitionDuration = parseFloat(transitionDuration);
|
51
|
+
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
52
|
+
|
53
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
54
|
+
return 0;
|
55
|
+
} // If multiple durations are defined, take the first
|
56
|
+
|
57
|
+
|
58
|
+
transitionDuration = transitionDuration.split(',')[0];
|
59
|
+
transitionDelay = transitionDelay.split(',')[0];
|
60
|
+
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
61
|
+
};
|
62
|
+
|
63
|
+
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
64
|
+
element.dispatchEvent(new Event(TRANSITION_END));
|
65
|
+
};
|
66
|
+
|
67
|
+
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
68
|
+
var called = false;
|
69
|
+
var durationPadding = 5;
|
70
|
+
var emulatedDuration = duration + durationPadding;
|
71
|
+
|
72
|
+
function listener() {
|
73
|
+
called = true;
|
74
|
+
element.removeEventListener(TRANSITION_END, listener);
|
75
|
+
}
|
76
|
+
|
77
|
+
element.addEventListener(TRANSITION_END, listener);
|
78
|
+
setTimeout(function () {
|
79
|
+
if (!called) {
|
80
|
+
triggerTransitionEnd(element);
|
81
|
+
}
|
82
|
+
}, emulatedDuration);
|
83
|
+
};
|
84
|
+
|
85
|
+
var getjQuery = function getjQuery() {
|
86
|
+
var _window = window,
|
87
|
+
jQuery = _window.jQuery;
|
88
|
+
|
89
|
+
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
90
|
+
return jQuery;
|
91
|
+
}
|
92
|
+
|
93
|
+
return null;
|
94
|
+
};
|
95
|
+
|
96
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
97
|
+
|
98
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
36
99
|
/**
|
100
|
+
* ------------------------------------------------------------------------
|
37
101
|
* Constants
|
102
|
+
* ------------------------------------------------------------------------
|
38
103
|
*/
|
39
104
|
|
40
105
|
var NAME = 'alert';
|
41
|
-
var VERSION = '
|
106
|
+
var VERSION = '5.0.0-alpha1';
|
42
107
|
var DATA_KEY = 'bs.alert';
|
43
108
|
var EVENT_KEY = "." + DATA_KEY;
|
44
109
|
var DATA_API_KEY = '.data-api';
|
45
|
-
var
|
46
|
-
var CLASS_NAME_ALERT = 'alert';
|
47
|
-
var CLASS_NAME_FADE = 'fade';
|
48
|
-
var CLASS_NAME_SHOW = 'show';
|
110
|
+
var SELECTOR_DISMISS = '[data-dismiss="alert"]';
|
49
111
|
var EVENT_CLOSE = "close" + EVENT_KEY;
|
50
112
|
var EVENT_CLOSED = "closed" + EVENT_KEY;
|
51
113
|
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
|
52
|
-
var
|
114
|
+
var CLASSNAME_ALERT = 'alert';
|
115
|
+
var CLASSNAME_FADE = 'fade';
|
116
|
+
var CLASSNAME_SHOW = 'show';
|
53
117
|
/**
|
54
|
-
*
|
118
|
+
* ------------------------------------------------------------------------
|
119
|
+
* Class Definition
|
120
|
+
* ------------------------------------------------------------------------
|
55
121
|
*/
|
56
122
|
|
57
123
|
var Alert = /*#__PURE__*/function () {
|
58
124
|
function Alert(element) {
|
59
125
|
this._element = element;
|
126
|
+
|
127
|
+
if (this._element) {
|
128
|
+
Data.setData(element, DATA_KEY, this);
|
129
|
+
}
|
60
130
|
} // Getters
|
61
131
|
|
62
132
|
|
@@ -72,7 +142,7 @@
|
|
72
142
|
|
73
143
|
var customEvent = this._triggerCloseEvent(rootElement);
|
74
144
|
|
75
|
-
if (customEvent.
|
145
|
+
if (customEvent === null || customEvent.defaultPrevented) {
|
76
146
|
return;
|
77
147
|
}
|
78
148
|
|
@@ -80,62 +150,52 @@
|
|
80
150
|
};
|
81
151
|
|
82
152
|
_proto.dispose = function dispose() {
|
83
|
-
|
153
|
+
Data.removeData(this._element, DATA_KEY);
|
84
154
|
this._element = null;
|
85
155
|
} // Private
|
86
156
|
;
|
87
157
|
|
88
158
|
_proto._getRootElement = function _getRootElement(element) {
|
89
|
-
|
90
|
-
var parent = false;
|
91
|
-
|
92
|
-
if (selector) {
|
93
|
-
parent = document.querySelector(selector);
|
94
|
-
}
|
95
|
-
|
96
|
-
if (!parent) {
|
97
|
-
parent = $__default["default"](element).closest("." + CLASS_NAME_ALERT)[0];
|
98
|
-
}
|
99
|
-
|
100
|
-
return parent;
|
159
|
+
return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
|
101
160
|
};
|
102
161
|
|
103
162
|
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
|
104
|
-
|
105
|
-
$__default["default"](element).trigger(closeEvent);
|
106
|
-
return closeEvent;
|
163
|
+
return EventHandler.trigger(element, EVENT_CLOSE);
|
107
164
|
};
|
108
165
|
|
109
166
|
_proto._removeElement = function _removeElement(element) {
|
110
167
|
var _this = this;
|
111
168
|
|
112
|
-
|
169
|
+
element.classList.remove(CLASSNAME_SHOW);
|
113
170
|
|
114
|
-
if (
|
171
|
+
if (!element.classList.contains(CLASSNAME_FADE)) {
|
115
172
|
this._destroyElement(element);
|
116
173
|
|
117
174
|
return;
|
118
175
|
}
|
119
176
|
|
120
|
-
var transitionDuration =
|
121
|
-
|
122
|
-
return _this._destroyElement(element
|
123
|
-
})
|
177
|
+
var transitionDuration = getTransitionDurationFromElement(element);
|
178
|
+
EventHandler.one(element, TRANSITION_END, function () {
|
179
|
+
return _this._destroyElement(element);
|
180
|
+
});
|
181
|
+
emulateTransitionEnd(element, transitionDuration);
|
124
182
|
};
|
125
183
|
|
126
184
|
_proto._destroyElement = function _destroyElement(element) {
|
127
|
-
|
185
|
+
if (element.parentNode) {
|
186
|
+
element.parentNode.removeChild(element);
|
187
|
+
}
|
188
|
+
|
189
|
+
EventHandler.trigger(element, EVENT_CLOSED);
|
128
190
|
} // Static
|
129
191
|
;
|
130
192
|
|
131
|
-
Alert.
|
193
|
+
Alert.jQueryInterface = function jQueryInterface(config) {
|
132
194
|
return this.each(function () {
|
133
|
-
var
|
134
|
-
var data = $element.data(DATA_KEY);
|
195
|
+
var data = Data.getData(this, DATA_KEY);
|
135
196
|
|
136
197
|
if (!data) {
|
137
198
|
data = new Alert(this);
|
138
|
-
$element.data(DATA_KEY, data);
|
139
199
|
}
|
140
200
|
|
141
201
|
if (config === 'close') {
|
@@ -144,7 +204,7 @@
|
|
144
204
|
});
|
145
205
|
};
|
146
206
|
|
147
|
-
Alert.
|
207
|
+
Alert.handleDismiss = function handleDismiss(alertInstance) {
|
148
208
|
return function (event) {
|
149
209
|
if (event) {
|
150
210
|
event.preventDefault();
|
@@ -154,6 +214,10 @@
|
|
154
214
|
};
|
155
215
|
};
|
156
216
|
|
217
|
+
Alert.getInstance = function getInstance(element) {
|
218
|
+
return Data.getData(element, DATA_KEY);
|
219
|
+
};
|
220
|
+
|
157
221
|
_createClass(Alert, null, [{
|
158
222
|
key: "VERSION",
|
159
223
|
get: function get() {
|
@@ -164,23 +228,34 @@
|
|
164
228
|
return Alert;
|
165
229
|
}();
|
166
230
|
/**
|
167
|
-
*
|
231
|
+
* ------------------------------------------------------------------------
|
232
|
+
* Data Api implementation
|
233
|
+
* ------------------------------------------------------------------------
|
168
234
|
*/
|
169
235
|
|
170
236
|
|
171
|
-
|
237
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
|
238
|
+
var $ = getjQuery();
|
172
239
|
/**
|
240
|
+
* ------------------------------------------------------------------------
|
173
241
|
* jQuery
|
242
|
+
* ------------------------------------------------------------------------
|
243
|
+
* add .alert to jQuery only if jQuery is present
|
174
244
|
*/
|
175
245
|
|
176
|
-
|
177
|
-
$__default["default"].fn[NAME].Constructor = Alert;
|
246
|
+
/* istanbul ignore if */
|
178
247
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
248
|
+
if ($) {
|
249
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
250
|
+
$.fn[NAME] = Alert.jQueryInterface;
|
251
|
+
$.fn[NAME].Constructor = Alert;
|
252
|
+
|
253
|
+
$.fn[NAME].noConflict = function () {
|
254
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
255
|
+
return Alert.jQueryInterface;
|
256
|
+
};
|
257
|
+
}
|
183
258
|
|
184
259
|
return Alert;
|
185
260
|
|
186
|
-
}));
|
261
|
+
})));
|