hootstrap 0.1.0
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +54 -0
- data/Rakefile +33 -0
- data/assets/javascripts/hootstrap/modal.js +795 -0
- data/assets/javascripts/hootstrap/rails.js +28 -0
- data/assets/javascripts/hootstrap/toast.js +166 -0
- data/assets/javascripts/hootstrap/utils/dynamicListener.js +80 -0
- data/assets/javascripts/hootstrap.js +3 -0
- data/assets/stylesheets/hootstrap/base/_base.scss +5 -0
- data/assets/stylesheets/hootstrap/base/_variables.scss +868 -0
- data/assets/stylesheets/hootstrap/base/mixins/_background.scss +8 -0
- data/assets/stylesheets/hootstrap/base/mixins/_button.scss +42 -0
- data/assets/stylesheets/hootstrap/base/mixins/_toast.scss +16 -0
- data/assets/stylesheets/hootstrap/base/mixins/_tooltip.scss +29 -0
- data/assets/stylesheets/hootstrap/components/_alert.scss +7 -0
- data/assets/stylesheets/hootstrap/components/_badge.scss +3 -0
- data/assets/stylesheets/hootstrap/components/_base.scss +6 -0
- data/assets/stylesheets/hootstrap/components/_button.scss +9 -0
- data/assets/stylesheets/hootstrap/components/_forms.scss +64 -0
- data/assets/stylesheets/hootstrap/components/_loader.scss +27 -0
- data/assets/stylesheets/hootstrap/components/_tooltip.scss +274 -0
- data/assets/stylesheets/hootstrap/patterns/_base.scss +5 -0
- data/assets/stylesheets/hootstrap/patterns/_card.scss +8 -0
- data/assets/stylesheets/hootstrap/patterns/_list-group.scss +8 -0
- data/assets/stylesheets/hootstrap/patterns/_navbar.scss +3 -0
- data/assets/stylesheets/hootstrap/patterns/_search.scss +45 -0
- data/assets/stylesheets/hootstrap/patterns/_toast.scss +34 -0
- data/assets/stylesheets/hootstrap/reset/_base.scss +1 -0
- data/assets/stylesheets/hootstrap/reset/_html.scss +4 -0
- data/assets/stylesheets/hootstrap/utils/_background.scss +3 -0
- data/assets/stylesheets/hootstrap/utils/_base.scss +5 -0
- data/assets/stylesheets/hootstrap/utils/_flex.scss +3 -0
- data/assets/stylesheets/hootstrap/utils/_opacity.scss +3 -0
- data/assets/stylesheets/hootstrap/utils/_sizing.scss +16 -0
- data/assets/stylesheets/hootstrap/utils/_transition.scss +0 -0
- data/assets/stylesheets/hootstrap/utils/_typography.scss +49 -0
- data/assets/stylesheets/hootstrap.scss +9 -0
- data/lib/hootstrap/engine.rb +9 -0
- data/lib/hootstrap/railtie.rb +10 -0
- data/lib/hootstrap/version.rb +3 -0
- data/lib/hootstrap.rb +20 -0
- metadata +141 -0
@@ -0,0 +1,795 @@
|
|
1
|
+
// Copyright (c) 2016, Kane Cohen
|
2
|
+
// All rights reserved.
|
3
|
+
|
4
|
+
// Usage
|
5
|
+
//
|
6
|
+
// var myModal = new Modal({
|
7
|
+
// el: document.getElementById('my-modal')
|
8
|
+
// }).show();
|
9
|
+
//
|
10
|
+
// Options
|
11
|
+
// | el | node |
|
12
|
+
// | animate | boolean |
|
13
|
+
// | appendTo | string |
|
14
|
+
// | backdrop | boolean |
|
15
|
+
// | keyboard | boolean |
|
16
|
+
// | title | string |
|
17
|
+
// | header | boolean |
|
18
|
+
// | content | boolean |
|
19
|
+
// | footer | boolean |
|
20
|
+
// | headerClose | boolean |
|
21
|
+
// | construct | boolean |
|
22
|
+
// | transition | integer |
|
23
|
+
// | backdropTransition | integer |
|
24
|
+
|
25
|
+
var Modal = (function(e) {
|
26
|
+
function t(i) {
|
27
|
+
if (n[i]) return n[i].exports;
|
28
|
+
var s = (n[i] = { exports: {}, id: i, loaded: !1 });
|
29
|
+
return e[i].call(s.exports, s, s.exports, t), (s.loaded = !0), s.exports;
|
30
|
+
}
|
31
|
+
var n = {};
|
32
|
+
return (t.m = e), (t.c = n), (t.p = ''), t(0);
|
33
|
+
})([
|
34
|
+
function(e, t, n) {
|
35
|
+
'use strict';
|
36
|
+
function i(e) {
|
37
|
+
return e && e.__esModule ? e : { default: e };
|
38
|
+
}
|
39
|
+
function s(e, t) {
|
40
|
+
if (!(e instanceof t))
|
41
|
+
throw new TypeError('Cannot call a class as a function');
|
42
|
+
}
|
43
|
+
function o(e, t) {
|
44
|
+
if ('function' != typeof t && null !== t)
|
45
|
+
throw new TypeError(
|
46
|
+
'Super expression must either be null or a function, not ' + typeof t
|
47
|
+
);
|
48
|
+
(e.prototype = Object.create(t && t.prototype, {
|
49
|
+
constructor: {
|
50
|
+
value: e,
|
51
|
+
enumerable: !1,
|
52
|
+
writable: !0,
|
53
|
+
configurable: !0
|
54
|
+
}
|
55
|
+
})), t &&
|
56
|
+
(Object.setPrototypeOf
|
57
|
+
? Object.setPrototypeOf(e, t)
|
58
|
+
: (e.__proto__ = t));
|
59
|
+
}
|
60
|
+
function r(e) {
|
61
|
+
for (var t in e)
|
62
|
+
Array.isArray(e[t])
|
63
|
+
? e[t].forEach(function(e) {
|
64
|
+
r(e);
|
65
|
+
})
|
66
|
+
: null !== e[t] && 'object' == typeof e[t] && Object.freeze(e[t]);
|
67
|
+
return Object.freeze(e);
|
68
|
+
}
|
69
|
+
function a() {
|
70
|
+
return (
|
71
|
+
((65536 * (1 + Math.random())) | 0).toString(16) +
|
72
|
+
((65536 * (1 + Math.random())) | 0).toString(16)
|
73
|
+
);
|
74
|
+
}
|
75
|
+
function l(e, t, n) {
|
76
|
+
var i = 'data',
|
77
|
+
s = e[i] || {};
|
78
|
+
if ('undefined' == typeof n) {
|
79
|
+
if (e[i] && e[i][t]) return e[i][t];
|
80
|
+
var o = e.getAttribute(i + '-' + t);
|
81
|
+
return 'undefined' != typeof o ? o : null;
|
82
|
+
}
|
83
|
+
return (s[t] = n), (e[i] = s), e;
|
84
|
+
}
|
85
|
+
function d(e, t) {
|
86
|
+
return e.nodeName
|
87
|
+
? e
|
88
|
+
: (
|
89
|
+
(e = e.replace(/(\t|\n$)/g, '')),
|
90
|
+
(m.innerHTML = ''),
|
91
|
+
(m.innerHTML = e),
|
92
|
+
t === !0 ? m.childNodes : m.childNodes[0]
|
93
|
+
);
|
94
|
+
}
|
95
|
+
function h() {
|
96
|
+
var e = void 0,
|
97
|
+
t = void 0,
|
98
|
+
n = void 0,
|
99
|
+
i = document.createElement('div');
|
100
|
+
|
101
|
+
if (!document.body) return;
|
102
|
+
return Object.assign(i.style, {
|
103
|
+
visibility: 'hidden',
|
104
|
+
width: '100px'
|
105
|
+
}), document.body.appendChild(i), (n = i.offsetWidth), (i.style.overflow =
|
106
|
+
'scroll'), (e = document.createElement('div')), (e.style.width =
|
107
|
+
'100%'), i.appendChild(e), (t =
|
108
|
+
n - e.offsetWidth), document.body.removeChild(i), t;
|
109
|
+
}
|
110
|
+
function c(e) {
|
111
|
+
for (var t = [e]; e.parentNode; ) (e = e.parentNode), t.push(e);
|
112
|
+
return t;
|
113
|
+
}
|
114
|
+
Object.defineProperty(t, '__esModule', { value: !0 });
|
115
|
+
var u = (function() {
|
116
|
+
function e(e, t) {
|
117
|
+
for (var n = 0; n < t.length; n++) {
|
118
|
+
var i = t[n];
|
119
|
+
(i.enumerable =
|
120
|
+
i.enumerable || !1), (i.configurable = !0), 'value' in i &&
|
121
|
+
(i.writable = !0), Object.defineProperty(e, i.key, i);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
return function(t, n, i) {
|
125
|
+
return n && e(t.prototype, n), i && e(t, i), t;
|
126
|
+
};
|
127
|
+
})(),
|
128
|
+
v = function(e, t, n) {
|
129
|
+
for (var i = !0; i; ) {
|
130
|
+
var s = e,
|
131
|
+
o = t,
|
132
|
+
r = n;
|
133
|
+
(i = !1), null === s && (s = Function.prototype);
|
134
|
+
var a = Object.getOwnPropertyDescriptor(s, o);
|
135
|
+
if (void 0 !== a) {
|
136
|
+
if ('value' in a) return a.value;
|
137
|
+
var l = a.get;
|
138
|
+
if (void 0 === l) return;
|
139
|
+
return l.call(r);
|
140
|
+
}
|
141
|
+
var d = Object.getPrototypeOf(s);
|
142
|
+
if (null === d) return;
|
143
|
+
(e = d), (t = o), (n = r), (i = !0), (a = d = void 0);
|
144
|
+
}
|
145
|
+
},
|
146
|
+
f = n(1),
|
147
|
+
p = i(f),
|
148
|
+
m = document.createElement('div'),
|
149
|
+
_ = h(),
|
150
|
+
y = Object.freeze({
|
151
|
+
el: null,
|
152
|
+
animate: !0,
|
153
|
+
animateClass: 'fade',
|
154
|
+
appendTo: 'body',
|
155
|
+
backdrop: !0,
|
156
|
+
keyboard: !0,
|
157
|
+
title: !1,
|
158
|
+
header: !0,
|
159
|
+
content: !1,
|
160
|
+
footer: !0,
|
161
|
+
buttons: null,
|
162
|
+
headerClose: !0,
|
163
|
+
construct: !1,
|
164
|
+
transition: 300,
|
165
|
+
backdropTransition: 150
|
166
|
+
}),
|
167
|
+
b = r({
|
168
|
+
dialog: [
|
169
|
+
{
|
170
|
+
text: 'Cancel',
|
171
|
+
value: !1,
|
172
|
+
attr: { class: 'btn btn-default', 'data-dismiss': 'modal' }
|
173
|
+
},
|
174
|
+
{
|
175
|
+
text: 'OK',
|
176
|
+
value: !0,
|
177
|
+
attr: { class: 'btn btn-primary', 'data-dismiss': 'modal' }
|
178
|
+
}
|
179
|
+
],
|
180
|
+
alert: [
|
181
|
+
{
|
182
|
+
text: 'OK',
|
183
|
+
attr: { class: 'btn btn-primary', 'data-dismiss': 'modal' }
|
184
|
+
}
|
185
|
+
],
|
186
|
+
confirm: [
|
187
|
+
{
|
188
|
+
text: 'Cancel',
|
189
|
+
value: !1,
|
190
|
+
attr: { class: 'btn btn-default', 'data-dismiss': 'modal' }
|
191
|
+
},
|
192
|
+
{
|
193
|
+
text: 'OK',
|
194
|
+
value: !0,
|
195
|
+
attr: { class: 'btn btn-primary', 'data-dismiss': 'modal' }
|
196
|
+
}
|
197
|
+
]
|
198
|
+
}),
|
199
|
+
g = {
|
200
|
+
container: '<div class="modal"></div>',
|
201
|
+
dialog: '<div class="modal-dialog"></div>',
|
202
|
+
content: '<div class="modal-content"></div>',
|
203
|
+
header: '<div class="modal-header"></div>',
|
204
|
+
headerClose:
|
205
|
+
'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>',
|
206
|
+
body: '<div class="modal-body"></div>',
|
207
|
+
footer: '<div class="modal-footer"></div>',
|
208
|
+
backdrop: '<div class="modal-backdrop"></div>'
|
209
|
+
},
|
210
|
+
k = (function(e) {
|
211
|
+
function t() {
|
212
|
+
var e =
|
213
|
+
arguments.length <= 0 || void 0 === arguments[0]
|
214
|
+
? {}
|
215
|
+
: arguments[0];
|
216
|
+
if (
|
217
|
+
(
|
218
|
+
s(this, t),
|
219
|
+
v(Object.getPrototypeOf(t.prototype), 'constructor', this).call(
|
220
|
+
this
|
221
|
+
),
|
222
|
+
(this.id = a()),
|
223
|
+
(this.el = null),
|
224
|
+
(this._html = {}),
|
225
|
+
(this._events = {}),
|
226
|
+
(this._visible = !1),
|
227
|
+
(this._options = Object.assign({}, t.options, e)),
|
228
|
+
(this._templates = Object.assign(
|
229
|
+
{},
|
230
|
+
t.templates,
|
231
|
+
e.templates || {}
|
232
|
+
)),
|
233
|
+
(this._html.appendTo = document.querySelector(
|
234
|
+
this._options.appendTo
|
235
|
+
)),
|
236
|
+
null === this._options.buttons &&
|
237
|
+
(this._options.buttons = t.buttons.dialog),
|
238
|
+
this._options.el
|
239
|
+
)
|
240
|
+
) {
|
241
|
+
var n = this._options.el;
|
242
|
+
if (
|
243
|
+
'string' == typeof this._options.el &&
|
244
|
+
((n = document.querySelector(this._options.el)), !n)
|
245
|
+
)
|
246
|
+
throw new Error(
|
247
|
+
'Selector: DOM Element ' + this._options.el + ' not found.'
|
248
|
+
);
|
249
|
+
l(n, 'modal', this), (this.el = n);
|
250
|
+
} else this._options.construct = !0;
|
251
|
+
this._options.construct ? this._render() : this._mapDom();
|
252
|
+
}
|
253
|
+
return o(t, e), u(t, null, [
|
254
|
+
{
|
255
|
+
key: 'alert',
|
256
|
+
value: function(e) {
|
257
|
+
var n =
|
258
|
+
arguments.length <= 1 || void 0 === arguments[1]
|
259
|
+
? {}
|
260
|
+
: arguments[1],
|
261
|
+
i = Object.assign(
|
262
|
+
{},
|
263
|
+
y,
|
264
|
+
{
|
265
|
+
title: e,
|
266
|
+
content: !1,
|
267
|
+
construct: !0,
|
268
|
+
headerClose: !1,
|
269
|
+
buttons: t.buttons.alert
|
270
|
+
},
|
271
|
+
n
|
272
|
+
);
|
273
|
+
return new t(i);
|
274
|
+
}
|
275
|
+
},
|
276
|
+
{
|
277
|
+
key: 'confirm',
|
278
|
+
value: function(e) {
|
279
|
+
var n =
|
280
|
+
arguments.length <= 1 || void 0 === arguments[1]
|
281
|
+
? {}
|
282
|
+
: arguments[1],
|
283
|
+
i = Object.assign(
|
284
|
+
{},
|
285
|
+
y,
|
286
|
+
{
|
287
|
+
title: e,
|
288
|
+
content: !1,
|
289
|
+
construct: !0,
|
290
|
+
headerClose: !1,
|
291
|
+
buttons: t.buttons.confirm
|
292
|
+
},
|
293
|
+
n
|
294
|
+
);
|
295
|
+
return new t(i);
|
296
|
+
}
|
297
|
+
},
|
298
|
+
{
|
299
|
+
key: 'templates',
|
300
|
+
set: function(e) {
|
301
|
+
this._baseTemplates = e;
|
302
|
+
},
|
303
|
+
get: function() {
|
304
|
+
return Object.assign({}, g, t._baseTemplates);
|
305
|
+
}
|
306
|
+
},
|
307
|
+
{
|
308
|
+
key: 'buttons',
|
309
|
+
set: function(e) {
|
310
|
+
this._baseButtons = e;
|
311
|
+
},
|
312
|
+
get: function() {
|
313
|
+
return Object.assign({}, b, t._baseButtons);
|
314
|
+
}
|
315
|
+
},
|
316
|
+
{
|
317
|
+
key: 'options',
|
318
|
+
set: function(e) {
|
319
|
+
this._baseOptions = e;
|
320
|
+
},
|
321
|
+
get: function() {
|
322
|
+
return Object.assign({}, y, t._baseOptions);
|
323
|
+
}
|
324
|
+
},
|
325
|
+
{
|
326
|
+
key: 'version',
|
327
|
+
get: function() {
|
328
|
+
return '0.3.7';
|
329
|
+
}
|
330
|
+
}
|
331
|
+
]), u(t, [
|
332
|
+
{
|
333
|
+
key: '_render',
|
334
|
+
value: function() {
|
335
|
+
var e = this._html,
|
336
|
+
t = this._options,
|
337
|
+
n = this._templates,
|
338
|
+
i = !!t.animate && t.animateClass;
|
339
|
+
return (e.container = d(n.container)), (e.dialog = d(
|
340
|
+
n.dialog
|
341
|
+
)), (e.content = d(n.content)), (e.header = d(
|
342
|
+
n.header
|
343
|
+
)), (e.headerClose = d(n.headerClose)), (e.body = d(
|
344
|
+
n.body
|
345
|
+
)), (e.footer = d(n.footer)), i &&
|
346
|
+
e.container.classList.add(
|
347
|
+
i
|
348
|
+
), this._setHeader(), this._setContent(), this._setFooter(), (this.el =
|
349
|
+
e.container), e.dialog.appendChild(
|
350
|
+
e.content
|
351
|
+
), e.container.appendChild(e.dialog), this;
|
352
|
+
}
|
353
|
+
},
|
354
|
+
{
|
355
|
+
key: '_mapDom',
|
356
|
+
value: function() {
|
357
|
+
var e = this._html,
|
358
|
+
t = this._options;
|
359
|
+
return this.el.classList.contains(t.animateClass) &&
|
360
|
+
(t.animate = !0), (e.container = this.el), (e.dialog = this.el.querySelector(
|
361
|
+
'.modal-dialog'
|
362
|
+
)), (e.content = this.el.querySelector(
|
363
|
+
'.modal-content'
|
364
|
+
)), (e.header = this.el.querySelector(
|
365
|
+
'.modal-header'
|
366
|
+
)), (e.headerClose = this.el.querySelector(
|
367
|
+
'.modal-header .close'
|
368
|
+
)), (e.body = this.el.querySelector(
|
369
|
+
'.modal-body'
|
370
|
+
)), (e.footer = this.el.querySelector(
|
371
|
+
'.modal-footer'
|
372
|
+
)), this._setHeader(), this._setContent(), this._setFooter(), this;
|
373
|
+
}
|
374
|
+
},
|
375
|
+
{
|
376
|
+
key: '_setHeader',
|
377
|
+
value: function() {
|
378
|
+
var e = this._html,
|
379
|
+
t = this._options;
|
380
|
+
t.header &&
|
381
|
+
e.header &&
|
382
|
+
(
|
383
|
+
t.title.nodeName
|
384
|
+
? (e.header.innerHTML = t.title.outerHTML)
|
385
|
+
: 'string' == typeof t.title &&
|
386
|
+
(e.header.innerHTML =
|
387
|
+
'<h4 class="modal-title">' + t.title + '</h4>'),
|
388
|
+
null === this.el &&
|
389
|
+
e.headerClose &&
|
390
|
+
t.headerClose &&
|
391
|
+
e.header.insertBefore(e.headerClose, e.header.firstChild),
|
392
|
+
t.construct && e.content.appendChild(e.header)
|
393
|
+
);
|
394
|
+
}
|
395
|
+
},
|
396
|
+
{
|
397
|
+
key: '_setContent',
|
398
|
+
value: function() {
|
399
|
+
var e = this._html,
|
400
|
+
t = this._options;
|
401
|
+
t.content &&
|
402
|
+
e.body &&
|
403
|
+
(
|
404
|
+
'string' == typeof t.content
|
405
|
+
? (e.body.innerHTML = t.content)
|
406
|
+
: (e.body.innerHTML = t.content.outerHTML),
|
407
|
+
t.construct && e.content.appendChild(e.body)
|
408
|
+
);
|
409
|
+
}
|
410
|
+
},
|
411
|
+
{
|
412
|
+
key: '_setFooter',
|
413
|
+
value: function() {
|
414
|
+
var e = this._html,
|
415
|
+
t = this._options;
|
416
|
+
t.footer &&
|
417
|
+
e.footer &&
|
418
|
+
(
|
419
|
+
t.footer.nodeName
|
420
|
+
? (e.footer.ineerHTML = t.footer.outerHTML)
|
421
|
+
: 'string' == typeof t.footer
|
422
|
+
? (e.footer.innerHTML = t.footer)
|
423
|
+
: e.footer.children.length ||
|
424
|
+
t.buttons.forEach(function(t) {
|
425
|
+
var n = document.createElement('button');
|
426
|
+
l(n, 'button', t), (n.innerHTML = t.text);
|
427
|
+
var i = !0,
|
428
|
+
s = !1,
|
429
|
+
o = void 0;
|
430
|
+
try {
|
431
|
+
for (
|
432
|
+
var r, a = Object.keys(t.attr)[Symbol.iterator]();
|
433
|
+
!(i = (r = a.next()).done);
|
434
|
+
i = !0
|
435
|
+
) {
|
436
|
+
var d = r.value;
|
437
|
+
n.setAttribute(d, t.attr[d]);
|
438
|
+
}
|
439
|
+
} catch (h) {
|
440
|
+
(s = !0), (o = h);
|
441
|
+
} finally {
|
442
|
+
try {
|
443
|
+
!i && a['return'] && a['return']();
|
444
|
+
} finally {
|
445
|
+
if (s) throw o;
|
446
|
+
}
|
447
|
+
}
|
448
|
+
e.footer.appendChild(n);
|
449
|
+
}),
|
450
|
+
t.construct && e.content.appendChild(e.footer)
|
451
|
+
);
|
452
|
+
}
|
453
|
+
},
|
454
|
+
{
|
455
|
+
key: '_setEvents',
|
456
|
+
value: function() {
|
457
|
+
var e = this._options,
|
458
|
+
t = this._html;
|
459
|
+
e.backdrop === !0 &&
|
460
|
+
(
|
461
|
+
(this._events.keydownHandler = this._handleKeydownEvent.bind(
|
462
|
+
this
|
463
|
+
)),
|
464
|
+
document.body.addEventListener(
|
465
|
+
'keydown',
|
466
|
+
this._events.keydownHandler
|
467
|
+
)
|
468
|
+
), (this._events.clickHandler = this._handleClickEvent.bind(
|
469
|
+
this
|
470
|
+
)), t.container.addEventListener(
|
471
|
+
'click',
|
472
|
+
this._events.clickHandler
|
473
|
+
), (this._events.resizeHandler = this._handleResizeEvent.bind(
|
474
|
+
this
|
475
|
+
)), window.addEventListener('resize', this._events.resizeHandler);
|
476
|
+
}
|
477
|
+
},
|
478
|
+
{
|
479
|
+
key: '_handleClickEvent',
|
480
|
+
value: function(e) {
|
481
|
+
var t = this,
|
482
|
+
n = c(e.target);
|
483
|
+
n.every(function(n) {
|
484
|
+
return (
|
485
|
+
'HTML' !== n.tagName &&
|
486
|
+
(!n.classList.contains('modal-content') &&
|
487
|
+
('modal' === n.getAttribute('data-dismiss')
|
488
|
+
? (
|
489
|
+
t.emit('dismiss', t, e, l(e.target, 'button')),
|
490
|
+
t.hide(),
|
491
|
+
!1
|
492
|
+
)
|
493
|
+
: !n.classList.contains('modal') ||
|
494
|
+
(t.emit('dismiss', t, e, null), t.hide(), !1)))
|
495
|
+
);
|
496
|
+
});
|
497
|
+
}
|
498
|
+
},
|
499
|
+
{
|
500
|
+
key: '_handleKeydownEvent',
|
501
|
+
value: function(e) {
|
502
|
+
27 === e.which &&
|
503
|
+
(this.emit('dismiss', this, e, null), this.hide());
|
504
|
+
}
|
505
|
+
},
|
506
|
+
{
|
507
|
+
key: '_handleResizeEvent',
|
508
|
+
value: function(e) {
|
509
|
+
this._resize();
|
510
|
+
}
|
511
|
+
},
|
512
|
+
{
|
513
|
+
key: 'show',
|
514
|
+
value: function() {
|
515
|
+
var e = this,
|
516
|
+
t = this._options,
|
517
|
+
n = this._html;
|
518
|
+
return this.emit(
|
519
|
+
'show',
|
520
|
+
this
|
521
|
+
), this._checkScrollbar(), this._setScrollbar(), document.body.classList.add(
|
522
|
+
'modal-open'
|
523
|
+
), t.construct &&
|
524
|
+
n.appendTo.appendChild(
|
525
|
+
n.container
|
526
|
+
), (n.container.style.display =
|
527
|
+
'block'), (n.container.scrollTop = 0), this.once(
|
528
|
+
'showBackdrop',
|
529
|
+
function() {
|
530
|
+
e._setEvents(), t.animate &&
|
531
|
+
n.container.offsetWidth, n.container.classList.add(
|
532
|
+
'show'
|
533
|
+
), setTimeout(function() {
|
534
|
+
(e._visible = !0), e.emit('shown', e);
|
535
|
+
}, t.transition);
|
536
|
+
}
|
537
|
+
), this._backdrop(), this._resize(), this;
|
538
|
+
}
|
539
|
+
},
|
540
|
+
{
|
541
|
+
key: 'toggle',
|
542
|
+
value: function() {
|
543
|
+
this._visible ? this.hide() : this.show();
|
544
|
+
}
|
545
|
+
},
|
546
|
+
{
|
547
|
+
key: '_resize',
|
548
|
+
value: function() {
|
549
|
+
var e =
|
550
|
+
this._html.container.scrollHeight >
|
551
|
+
document.documentElement.clientHeight;
|
552
|
+
(this._html.container.style.paddingLeft =
|
553
|
+
!this.bodyIsOverflowing && e
|
554
|
+
? _ + 'px'
|
555
|
+
: ''), (this._html.container.style.paddingRight =
|
556
|
+
this.bodyIsOverflowing && !e ? _ + 'px' : '');
|
557
|
+
}
|
558
|
+
},
|
559
|
+
{
|
560
|
+
key: '_backdrop',
|
561
|
+
value: function() {
|
562
|
+
var e = this,
|
563
|
+
t = this._html,
|
564
|
+
n = this._templates,
|
565
|
+
i = this._options,
|
566
|
+
s = !!i.animate && i.animateClass;
|
567
|
+
(t.backdrop = d(n.backdrop)), s &&
|
568
|
+
t.backdrop.classList.add(s), t.appendTo.appendChild(
|
569
|
+
t.backdrop
|
570
|
+
), s && t.backdrop.offsetWidth, t.backdrop.classList.add(
|
571
|
+
'show'
|
572
|
+
), setTimeout(function() {
|
573
|
+
e.emit('showBackdrop', e);
|
574
|
+
}, this._options.backdropTransition);
|
575
|
+
}
|
576
|
+
},
|
577
|
+
{
|
578
|
+
key: 'hide',
|
579
|
+
value: function() {
|
580
|
+
var e = this,
|
581
|
+
t = this._html,
|
582
|
+
n = this._options,
|
583
|
+
i = t.backdrop.classList,
|
584
|
+
s = t.container.classList;
|
585
|
+
return this.emit('hide', this), i.remove('show'), s.remove(
|
586
|
+
'show'
|
587
|
+
), this._removeEvents(), setTimeout(function() {
|
588
|
+
document.body.classList.remove(
|
589
|
+
'modal-open'
|
590
|
+
), (document.body.style.paddingRight = e.originalBodyPad);
|
591
|
+
}, n.backdropTransition), setTimeout(function() {
|
592
|
+
t.backdrop.remove(), (t.container.style.display = 'none'), n.construct && t.container.remove(), (e._visible = !1), e.emit('hidden', e);
|
593
|
+
}, n.transition), this;
|
594
|
+
}
|
595
|
+
},
|
596
|
+
{
|
597
|
+
key: '_removeEvents',
|
598
|
+
value: function() {
|
599
|
+
this._events.keydownHandler &&
|
600
|
+
document.body.removeEventListener(
|
601
|
+
'keydown',
|
602
|
+
this._events.keydownHandler
|
603
|
+
), this._html.container.removeEventListener(
|
604
|
+
'click',
|
605
|
+
this._events.clickHandler
|
606
|
+
), window.removeEventListener(
|
607
|
+
'resize',
|
608
|
+
this._events.resizeHandler
|
609
|
+
);
|
610
|
+
}
|
611
|
+
},
|
612
|
+
{
|
613
|
+
key: '_checkScrollbar',
|
614
|
+
value: function() {
|
615
|
+
this.bodyIsOverflowing =
|
616
|
+
document.body.clientWidth < window.innerWidth;
|
617
|
+
}
|
618
|
+
},
|
619
|
+
{
|
620
|
+
key: '_setScrollbar',
|
621
|
+
value: function() {
|
622
|
+
if (
|
623
|
+
(
|
624
|
+
(this.originalBodyPad =
|
625
|
+
document.body.style.paddingRight || ''),
|
626
|
+
this.bodyIsOverflowing
|
627
|
+
)
|
628
|
+
) {
|
629
|
+
var e = parseInt(this.originalBodyPad || 0, 10);
|
630
|
+
document.body.style.paddingRight = e + _ + 'px';
|
631
|
+
}
|
632
|
+
}
|
633
|
+
}
|
634
|
+
]), t;
|
635
|
+
})(p['default']);
|
636
|
+
(t['default'] = k), (e.exports = t['default']);
|
637
|
+
},
|
638
|
+
function(e, t) {
|
639
|
+
function n() {
|
640
|
+
(this._events = this._events || {}), (this._maxListeners =
|
641
|
+
this._maxListeners || void 0);
|
642
|
+
}
|
643
|
+
function i(e) {
|
644
|
+
return 'function' == typeof e;
|
645
|
+
}
|
646
|
+
function s(e) {
|
647
|
+
return 'number' == typeof e;
|
648
|
+
}
|
649
|
+
function o(e) {
|
650
|
+
return 'object' == typeof e && null !== e;
|
651
|
+
}
|
652
|
+
function r(e) {
|
653
|
+
return void 0 === e;
|
654
|
+
}
|
655
|
+
(e.exports = n), (n.EventEmitter = n), (n.prototype._events = void 0), (n.prototype._maxListeners = void 0), (n.defaultMaxListeners = 10), (n.prototype.setMaxListeners = function(
|
656
|
+
e
|
657
|
+
) {
|
658
|
+
if (!s(e) || e < 0 || isNaN(e))
|
659
|
+
throw TypeError('n must be a positive number');
|
660
|
+
return (this._maxListeners = e), this;
|
661
|
+
}), (n.prototype.emit = function(e) {
|
662
|
+
var t, n, s, a, l, d;
|
663
|
+
if (
|
664
|
+
(
|
665
|
+
this._events || (this._events = {}),
|
666
|
+
'error' === e &&
|
667
|
+
(!this._events.error ||
|
668
|
+
(o(this._events.error) && !this._events.error.length))
|
669
|
+
)
|
670
|
+
) {
|
671
|
+
if (((t = arguments[1]), t instanceof Error)) throw t;
|
672
|
+
var h = new Error('Uncaught, unspecified "error" event. (' + t + ')');
|
673
|
+
throw ((h.context = t), h);
|
674
|
+
}
|
675
|
+
if (((n = this._events[e]), r(n))) return !1;
|
676
|
+
if (i(n))
|
677
|
+
switch (arguments.length) {
|
678
|
+
case 1:
|
679
|
+
n.call(this);
|
680
|
+
break;
|
681
|
+
case 2:
|
682
|
+
n.call(this, arguments[1]);
|
683
|
+
break;
|
684
|
+
case 3:
|
685
|
+
n.call(this, arguments[1], arguments[2]);
|
686
|
+
break;
|
687
|
+
default:
|
688
|
+
(a = Array.prototype.slice.call(arguments, 1)), n.apply(this, a);
|
689
|
+
}
|
690
|
+
else if (o(n))
|
691
|
+
for (
|
692
|
+
a = Array.prototype.slice.call(arguments, 1), d = n.slice(), s =
|
693
|
+
d.length, l = 0;
|
694
|
+
l < s;
|
695
|
+
l++
|
696
|
+
)
|
697
|
+
d[l].apply(this, a);
|
698
|
+
return !0;
|
699
|
+
}), (n.prototype.addListener = function(e, t) {
|
700
|
+
var s;
|
701
|
+
if (!i(t)) throw TypeError('listener must be a function');
|
702
|
+
return this._events || (this._events = {}), this._events.newListener &&
|
703
|
+
this.emit('newListener', e, i(t.listener) ? t.listener : t), this
|
704
|
+
._events[e]
|
705
|
+
? o(this._events[e])
|
706
|
+
? this._events[e].push(t)
|
707
|
+
: (this._events[e] = [this._events[e], t])
|
708
|
+
: (this._events[e] = t), o(this._events[e]) &&
|
709
|
+
!this._events[e].warned &&
|
710
|
+
(
|
711
|
+
(s = r(this._maxListeners)
|
712
|
+
? n.defaultMaxListeners
|
713
|
+
: this._maxListeners),
|
714
|
+
s &&
|
715
|
+
s > 0 &&
|
716
|
+
this._events[e].length > s &&
|
717
|
+
(
|
718
|
+
(this._events[e].warned = !0),
|
719
|
+
console.error(
|
720
|
+
'(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',
|
721
|
+
this._events[e].length
|
722
|
+
),
|
723
|
+
'function' == typeof console.trace && console.trace()
|
724
|
+
)
|
725
|
+
), this;
|
726
|
+
}), (n.prototype.on =
|
727
|
+
n.prototype.addListener), (n.prototype.once = function(e, t) {
|
728
|
+
function n() {
|
729
|
+
this.removeListener(e, n), s || ((s = !0), t.apply(this, arguments));
|
730
|
+
}
|
731
|
+
if (!i(t)) throw TypeError('listener must be a function');
|
732
|
+
var s = !1;
|
733
|
+
return (n.listener = t), this.on(e, n), this;
|
734
|
+
}), (n.prototype.removeListener = function(e, t) {
|
735
|
+
var n, s, r, a;
|
736
|
+
if (!i(t)) throw TypeError('listener must be a function');
|
737
|
+
if (!this._events || !this._events[e]) return this;
|
738
|
+
if (
|
739
|
+
(
|
740
|
+
(n = this._events[e]),
|
741
|
+
(r = n.length),
|
742
|
+
(s = -1),
|
743
|
+
n === t || (i(n.listener) && n.listener === t)
|
744
|
+
)
|
745
|
+
)
|
746
|
+
delete this._events[e], this._events.removeListener &&
|
747
|
+
this.emit('removeListener', e, t);
|
748
|
+
else if (o(n)) {
|
749
|
+
for (a = r; a-- > 0; )
|
750
|
+
if (n[a] === t || (n[a].listener && n[a].listener === t)) {
|
751
|
+
s = a;
|
752
|
+
break;
|
753
|
+
}
|
754
|
+
if (s < 0) return this;
|
755
|
+
1 === n.length
|
756
|
+
? ((n.length = 0), delete this._events[e])
|
757
|
+
: n.splice(s, 1), this._events.removeListener &&
|
758
|
+
this.emit('removeListener', e, t);
|
759
|
+
}
|
760
|
+
return this;
|
761
|
+
}), (n.prototype.removeAllListeners = function(e) {
|
762
|
+
var t, n;
|
763
|
+
if (!this._events) return this;
|
764
|
+
if (!this._events.removeListener)
|
765
|
+
return 0 === arguments.length
|
766
|
+
? (this._events = {})
|
767
|
+
: this._events[e] && delete this._events[e], this;
|
768
|
+
if (0 === arguments.length) {
|
769
|
+
for (t in this._events)
|
770
|
+
'removeListener' !== t && this.removeAllListeners(t);
|
771
|
+
return this.removeAllListeners(
|
772
|
+
'removeListener'
|
773
|
+
), (this._events = {}), this;
|
774
|
+
}
|
775
|
+
if (((n = this._events[e]), i(n))) this.removeListener(e, n);
|
776
|
+
else if (n) for (; n.length; ) this.removeListener(e, n[n.length - 1]);
|
777
|
+
return delete this._events[e], this;
|
778
|
+
}), (n.prototype.listeners = function(e) {
|
779
|
+
var t;
|
780
|
+
return (t =
|
781
|
+
this._events && this._events[e]
|
782
|
+
? i(this._events[e]) ? [this._events[e]] : this._events[e].slice()
|
783
|
+
: []);
|
784
|
+
}), (n.prototype.listenerCount = function(e) {
|
785
|
+
if (this._events) {
|
786
|
+
var t = this._events[e];
|
787
|
+
if (i(t)) return 1;
|
788
|
+
if (t) return t.length;
|
789
|
+
}
|
790
|
+
return 0;
|
791
|
+
}), (n.listenerCount = function(e, t) {
|
792
|
+
return e.listenerCount(t);
|
793
|
+
});
|
794
|
+
}
|
795
|
+
]);
|