@grafit/era-dependencies 1.0.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.
Files changed (72) hide show
  1. package/package.json +7 -0
  2. package/vendor/fonts/FontAwesome.otf +0 -0
  3. package/vendor/fonts/fontawesome-webfont.eot +0 -0
  4. package/vendor/fonts/fontawesome-webfont.svg +685 -0
  5. package/vendor/fonts/fontawesome-webfont.ttf +0 -0
  6. package/vendor/fonts/fontawesome-webfont.woff +0 -0
  7. package/vendor/fonts/fontawesome-webfont.woff2 +0 -0
  8. package/vendor/fonts/glyphicons-halflings-regular.eot +0 -0
  9. package/vendor/fonts/glyphicons-halflings-regular.svg +288 -0
  10. package/vendor/fonts/glyphicons-halflings-regular.ttf +0 -0
  11. package/vendor/fonts/glyphicons-halflings-regular.woff +0 -0
  12. package/vendor/fonts/glyphicons-halflings-regular.woff2 +0 -0
  13. package/vendor/scripts/angular/angular-cookies.js +322 -0
  14. package/vendor/scripts/angular/angular-file-upload.js +2087 -0
  15. package/vendor/scripts/angular/angular-filter.js +2287 -0
  16. package/vendor/scripts/angular/angular-locale_ru-ru.js +143 -0
  17. package/vendor/scripts/angular/angular-route.js +1069 -0
  18. package/vendor/scripts/angular/angular-sanitize.js +738 -0
  19. package/vendor/scripts/angular/angular-ui-router-0.2.18.js +4539 -0
  20. package/vendor/scripts/angular/angular.js +31768 -0
  21. package/vendor/scripts/angular/datetimepicker.js +578 -0
  22. package/vendor/scripts/angular/datetimepicker.templates.js +30 -0
  23. package/vendor/scripts/angular/mask.min.js +7 -0
  24. package/vendor/scripts/angular/ng-table.js +1518 -0
  25. package/vendor/scripts/angular/select.js +2356 -0
  26. package/vendor/scripts/angular/ui-bootstrap-tpls-2.1.3.js +7536 -0
  27. package/vendor/scripts/angular/uploader.js +3 -0
  28. package/vendor/scripts/bootbox.js +985 -0
  29. package/vendor/scripts/bootstrap.js +2377 -0
  30. package/vendor/scripts/es6-shim.js +3837 -0
  31. package/vendor/scripts/highchart/highcharts-more.src.js +3165 -0
  32. package/vendor/scripts/highchart/highstock.src.js +32008 -0
  33. package/vendor/scripts/highchart/modules/boost.src.js +2721 -0
  34. package/vendor/scripts/highchart/modules/exporting.src.js +951 -0
  35. package/vendor/scripts/jquery/jquery.js +11008 -0
  36. package/vendor/scripts/jquery.datetimepicker.full.js +2911 -0
  37. package/vendor/scripts/keycloak.js +2382 -0
  38. package/vendor/scripts/lodash.js +16733 -0
  39. package/vendor/scripts/moment-with-locales.js +12251 -0
  40. package/vendor/scripts/moment.js +4234 -0
  41. package/vendor/scripts/old/datepicker-ru.js +38 -0
  42. package/vendor/scripts/old/jquery-ui-1.11.1.js +16375 -0
  43. package/vendor/scripts/old/jquery.form.js +1278 -0
  44. package/vendor/scripts/perfect-scrollbar.js +1549 -0
  45. package/vendor/scripts/pickmeup/pickmeup-locales.js +11 -0
  46. package/vendor/scripts/pickmeup/pickmeup.js +1383 -0
  47. package/vendor/scripts/quill.js +9676 -0
  48. package/vendor/scripts/socket.io.min.js +3 -0
  49. package/vendor/scripts/textAngular/angular-spectrum-colorpicker.min.js +2 -0
  50. package/vendor/scripts/textAngular/spectrum.min.js +1 -0
  51. package/vendor/scripts/textAngular/textAngular-dropdownToggle.js +38 -0
  52. package/vendor/scripts/textAngular/textAngular-rangy.min.js +478 -0
  53. package/vendor/scripts/textAngular/textAngular-sanitize.min.js +322 -0
  54. package/vendor/scripts/textAngular/textAngular.min.js +1481 -0
  55. package/vendor/scripts/textAngular/textAngularSetup.js +1013 -0
  56. package/vendor/styles/bootstrap-theme.css +587 -0
  57. package/vendor/styles/bootstrap-theme.css.map +1 -0
  58. package/vendor/styles/bootstrap-theme.min.css +6 -0
  59. package/vendor/styles/bootstrap-theme.min.css.map +1 -0
  60. package/vendor/styles/bootstrap.css +6757 -0
  61. package/vendor/styles/bootstrap.css.map +1 -0
  62. package/vendor/styles/bootstrap.min.css +6 -0
  63. package/vendor/styles/bootstrap.min.css.map +1 -0
  64. package/vendor/styles/datetimepicker.css +115 -0
  65. package/vendor/styles/font-awesome.css +2199 -0
  66. package/vendor/styles/jquery.datetimepicker.min.css +1 -0
  67. package/vendor/styles/ng-table.css +136 -0
  68. package/vendor/styles/normalize.css +424 -0
  69. package/vendor/styles/perfect-scrollbar.css +165 -0
  70. package/vendor/styles/pickmeup.css +137 -0
  71. package/vendor/styles/spectrum.min.css +1 -0
  72. package/vendor/styles/textAngular.css +193 -0
@@ -0,0 +1,1549 @@
1
+ /* perfect-scrollbar v0.6.12 */
2
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
3
+ 'use strict';
4
+
5
+ var ps = require('../main');
6
+
7
+ if (typeof define === 'function' && define.amd) {
8
+ // AMD
9
+ define(ps);
10
+ } else {
11
+ // Add to a global object.
12
+ window.PerfectScrollbar = ps;
13
+ if (typeof window.Ps === 'undefined') {
14
+ window.Ps = ps;
15
+ }
16
+ }
17
+
18
+ },{"../main":7}],2:[function(require,module,exports){
19
+ 'use strict';
20
+
21
+ function oldAdd(element, className) {
22
+ var classes = element.className.split(' ');
23
+ if (classes.indexOf(className) < 0) {
24
+ classes.push(className);
25
+ }
26
+ element.className = classes.join(' ');
27
+ }
28
+
29
+ function oldRemove(element, className) {
30
+ var classes = element.className.split(' ');
31
+ var idx = classes.indexOf(className);
32
+ if (idx >= 0) {
33
+ classes.splice(idx, 1);
34
+ }
35
+ element.className = classes.join(' ');
36
+ }
37
+
38
+ exports.add = function (element, className) {
39
+ if (element.classList) {
40
+ element.classList.add(className);
41
+ } else {
42
+ oldAdd(element, className);
43
+ }
44
+ };
45
+
46
+ exports.remove = function (element, className) {
47
+ if (element.classList) {
48
+ element.classList.remove(className);
49
+ } else {
50
+ oldRemove(element, className);
51
+ }
52
+ };
53
+
54
+ exports.list = function (element) {
55
+ if (element.classList) {
56
+ return Array.prototype.slice.apply(element.classList);
57
+ } else {
58
+ return element.className.split(' ');
59
+ }
60
+ };
61
+
62
+ },{}],3:[function(require,module,exports){
63
+ 'use strict';
64
+
65
+ var DOM = {};
66
+
67
+ DOM.e = function (tagName, className) {
68
+ var element = document.createElement(tagName);
69
+ element.className = className;
70
+ return element;
71
+ };
72
+
73
+ DOM.appendTo = function (child, parent) {
74
+ parent.appendChild(child);
75
+ return child;
76
+ };
77
+
78
+ function cssGet(element, styleName) {
79
+ return window.getComputedStyle(element)[styleName];
80
+ }
81
+
82
+ function cssSet(element, styleName, styleValue) {
83
+ if (typeof styleValue === 'number') {
84
+ styleValue = styleValue.toString() + 'px';
85
+ }
86
+ element.style[styleName] = styleValue;
87
+ return element;
88
+ }
89
+
90
+ function cssMultiSet(element, obj) {
91
+ for (var key in obj) {
92
+ var val = obj[key];
93
+ if (typeof val === 'number') {
94
+ val = val.toString() + 'px';
95
+ }
96
+ element.style[key] = val;
97
+ }
98
+ return element;
99
+ }
100
+
101
+ DOM.css = function (element, styleNameOrObject, styleValue) {
102
+ if (typeof styleNameOrObject === 'object') {
103
+ // multiple set with object
104
+ return cssMultiSet(element, styleNameOrObject);
105
+ } else {
106
+ if (typeof styleValue === 'undefined') {
107
+ return cssGet(element, styleNameOrObject);
108
+ } else {
109
+ return cssSet(element, styleNameOrObject, styleValue);
110
+ }
111
+ }
112
+ };
113
+
114
+ DOM.matches = function (element, query) {
115
+ if (typeof element.matches !== 'undefined') {
116
+ return element.matches(query);
117
+ } else {
118
+ if (typeof element.matchesSelector !== 'undefined') {
119
+ return element.matchesSelector(query);
120
+ } else if (typeof element.webkitMatchesSelector !== 'undefined') {
121
+ return element.webkitMatchesSelector(query);
122
+ } else if (typeof element.mozMatchesSelector !== 'undefined') {
123
+ return element.mozMatchesSelector(query);
124
+ } else if (typeof element.msMatchesSelector !== 'undefined') {
125
+ return element.msMatchesSelector(query);
126
+ }
127
+ }
128
+ };
129
+
130
+ DOM.remove = function (element) {
131
+ if (typeof element.remove !== 'undefined') {
132
+ element.remove();
133
+ } else {
134
+ if (element.parentNode) {
135
+ element.parentNode.removeChild(element);
136
+ }
137
+ }
138
+ };
139
+
140
+ DOM.queryChildren = function (element, selector) {
141
+ return Array.prototype.filter.call(element.childNodes, function (child) {
142
+ return DOM.matches(child, selector);
143
+ });
144
+ };
145
+
146
+ module.exports = DOM;
147
+
148
+ },{}],4:[function(require,module,exports){
149
+ 'use strict';
150
+
151
+ var EventElement = function (element) {
152
+ this.element = element;
153
+ this.events = {};
154
+ };
155
+
156
+ EventElement.prototype.bind = function (eventName, handler) {
157
+ if (typeof this.events[eventName] === 'undefined') {
158
+ this.events[eventName] = [];
159
+ }
160
+ this.events[eventName].push(handler);
161
+ this.element.addEventListener(eventName, handler, false);
162
+ };
163
+
164
+ EventElement.prototype.unbind = function (eventName, handler) {
165
+ var isHandlerProvided = (typeof handler !== 'undefined');
166
+ this.events[eventName] = this.events[eventName].filter(function (hdlr) {
167
+ if (isHandlerProvided && hdlr !== handler) {
168
+ return true;
169
+ }
170
+ this.element.removeEventListener(eventName, hdlr, false);
171
+ return false;
172
+ }, this);
173
+ };
174
+
175
+ EventElement.prototype.unbindAll = function () {
176
+ for (var name in this.events) {
177
+ this.unbind(name);
178
+ }
179
+ };
180
+
181
+ var EventManager = function () {
182
+ this.eventElements = [];
183
+ };
184
+
185
+ EventManager.prototype.eventElement = function (element) {
186
+ var ee = this.eventElements.filter(function (eventElement) {
187
+ return eventElement.element === element;
188
+ })[0];
189
+ if (typeof ee === 'undefined') {
190
+ ee = new EventElement(element);
191
+ this.eventElements.push(ee);
192
+ }
193
+ return ee;
194
+ };
195
+
196
+ EventManager.prototype.bind = function (element, eventName, handler) {
197
+ this.eventElement(element).bind(eventName, handler);
198
+ };
199
+
200
+ EventManager.prototype.unbind = function (element, eventName, handler) {
201
+ this.eventElement(element).unbind(eventName, handler);
202
+ };
203
+
204
+ EventManager.prototype.unbindAll = function () {
205
+ for (var i = 0; i < this.eventElements.length; i++) {
206
+ this.eventElements[i].unbindAll();
207
+ }
208
+ };
209
+
210
+ EventManager.prototype.once = function (element, eventName, handler) {
211
+ var ee = this.eventElement(element);
212
+ var onceHandler = function (e) {
213
+ ee.unbind(eventName, onceHandler);
214
+ handler(e);
215
+ };
216
+ ee.bind(eventName, onceHandler);
217
+ };
218
+
219
+ module.exports = EventManager;
220
+
221
+ },{}],5:[function(require,module,exports){
222
+ 'use strict';
223
+
224
+ module.exports = (function () {
225
+ function s4() {
226
+ return Math.floor((1 + Math.random()) * 0x10000)
227
+ .toString(16)
228
+ .substring(1);
229
+ }
230
+ return function () {
231
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
232
+ s4() + '-' + s4() + s4() + s4();
233
+ };
234
+ })();
235
+
236
+ },{}],6:[function(require,module,exports){
237
+ 'use strict';
238
+
239
+ var cls = require('./class');
240
+ var dom = require('./dom');
241
+
242
+ var toInt = exports.toInt = function (x) {
243
+ return parseInt(x, 10) || 0;
244
+ };
245
+
246
+ var clone = exports.clone = function (obj) {
247
+ if (obj === null) {
248
+ return null;
249
+ } else if (obj.constructor === Array) {
250
+ return obj.map(clone);
251
+ } else if (typeof obj === 'object') {
252
+ var result = {};
253
+ for (var key in obj) {
254
+ result[key] = clone(obj[key]);
255
+ }
256
+ return result;
257
+ } else {
258
+ return obj;
259
+ }
260
+ };
261
+
262
+ exports.extend = function (original, source) {
263
+ var result = clone(original);
264
+ for (var key in source) {
265
+ result[key] = clone(source[key]);
266
+ }
267
+ return result;
268
+ };
269
+
270
+ exports.isEditable = function (el) {
271
+ return dom.matches(el, "input,[contenteditable]") ||
272
+ dom.matches(el, "select,[contenteditable]") ||
273
+ dom.matches(el, "textarea,[contenteditable]") ||
274
+ dom.matches(el, "button,[contenteditable]");
275
+ };
276
+
277
+ exports.removePsClasses = function (element) {
278
+ var clsList = cls.list(element);
279
+ for (var i = 0; i < clsList.length; i++) {
280
+ var className = clsList[i];
281
+ if (className.indexOf('ps-') === 0) {
282
+ cls.remove(element, className);
283
+ }
284
+ }
285
+ };
286
+
287
+ exports.outerWidth = function (element) {
288
+ return toInt(dom.css(element, 'width')) +
289
+ toInt(dom.css(element, 'paddingLeft')) +
290
+ toInt(dom.css(element, 'paddingRight')) +
291
+ toInt(dom.css(element, 'borderLeftWidth')) +
292
+ toInt(dom.css(element, 'borderRightWidth'));
293
+ };
294
+
295
+ exports.startScrolling = function (element, axis) {
296
+ cls.add(element, 'ps-in-scrolling');
297
+ if (typeof axis !== 'undefined') {
298
+ cls.add(element, 'ps-' + axis);
299
+ } else {
300
+ cls.add(element, 'ps-x');
301
+ cls.add(element, 'ps-y');
302
+ }
303
+ };
304
+
305
+ exports.stopScrolling = function (element, axis) {
306
+ cls.remove(element, 'ps-in-scrolling');
307
+ if (typeof axis !== 'undefined') {
308
+ cls.remove(element, 'ps-' + axis);
309
+ } else {
310
+ cls.remove(element, 'ps-x');
311
+ cls.remove(element, 'ps-y');
312
+ }
313
+ };
314
+
315
+ exports.env = {
316
+ isWebKit: 'WebkitAppearance' in document.documentElement.style,
317
+ supportsTouch: (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch),
318
+ supportsIePointer: window.navigator.msMaxTouchPoints !== null
319
+ };
320
+
321
+ },{"./class":2,"./dom":3}],7:[function(require,module,exports){
322
+ 'use strict';
323
+
324
+ var destroy = require('./plugin/destroy');
325
+ var initialize = require('./plugin/initialize');
326
+ var update = require('./plugin/update');
327
+
328
+ module.exports = {
329
+ initialize: initialize,
330
+ update: update,
331
+ destroy: destroy
332
+ };
333
+
334
+ },{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":21}],8:[function(require,module,exports){
335
+ 'use strict';
336
+
337
+ module.exports = {
338
+ handlers: ['click-rail', 'drag-scrollbar', 'keyboard', 'wheel', 'touch'],
339
+ maxScrollbarLength: null,
340
+ minScrollbarLength: null,
341
+ scrollXMarginOffset: 0,
342
+ scrollYMarginOffset: 0,
343
+ stopPropagationOnClick: true,
344
+ suppressScrollX: false,
345
+ suppressScrollY: false,
346
+ swipePropagation: true,
347
+ useBothWheelAxes: false,
348
+ wheelPropagation: false,
349
+ wheelSpeed: 1,
350
+ theme: 'default'
351
+ };
352
+
353
+ },{}],9:[function(require,module,exports){
354
+ 'use strict';
355
+
356
+ var _ = require('../lib/helper');
357
+ var dom = require('../lib/dom');
358
+ var instances = require('./instances');
359
+
360
+ module.exports = function (element) {
361
+ var i = instances.get(element);
362
+
363
+ if (!i) {
364
+ return;
365
+ }
366
+
367
+ i.event.unbindAll();
368
+ dom.remove(i.scrollbarX);
369
+ dom.remove(i.scrollbarY);
370
+ dom.remove(i.scrollbarXRail);
371
+ dom.remove(i.scrollbarYRail);
372
+ _.removePsClasses(element);
373
+
374
+ instances.remove(element);
375
+ };
376
+
377
+ },{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){
378
+ 'use strict';
379
+
380
+ var _ = require('../../lib/helper');
381
+ var instances = require('../instances');
382
+ var updateGeometry = require('../update-geometry');
383
+ var updateScroll = require('../update-scroll');
384
+
385
+ function bindClickRailHandler(element, i) {
386
+ function pageOffset(el) {
387
+ return el.getBoundingClientRect();
388
+ }
389
+ var stopPropagation = function (e) { e.stopPropagation(); };
390
+
391
+ if (i.settings.stopPropagationOnClick) {
392
+ i.event.bind(i.scrollbarY, 'click', stopPropagation);
393
+ }
394
+ i.event.bind(i.scrollbarYRail, 'click', function (e) {
395
+ var halfOfScrollbarLength = _.toInt(i.scrollbarYHeight / 2);
396
+ var positionTop = i.railYRatio * (e.pageY - window.pageYOffset - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength);
397
+ var maxPositionTop = i.railYRatio * (i.railYHeight - i.scrollbarYHeight);
398
+ var positionRatio = positionTop / maxPositionTop;
399
+
400
+ if (positionRatio < 0) {
401
+ positionRatio = 0;
402
+ } else if (positionRatio > 1) {
403
+ positionRatio = 1;
404
+ }
405
+
406
+ updateScroll(element, 'top', (i.contentHeight - i.containerHeight) * positionRatio);
407
+ updateGeometry(element);
408
+
409
+ e.stopPropagation();
410
+ });
411
+
412
+ if (i.settings.stopPropagationOnClick) {
413
+ i.event.bind(i.scrollbarX, 'click', stopPropagation);
414
+ }
415
+ i.event.bind(i.scrollbarXRail, 'click', function (e) {
416
+ var halfOfScrollbarLength = _.toInt(i.scrollbarXWidth / 2);
417
+ var positionLeft = i.railXRatio * (e.pageX - window.pageXOffset - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength);
418
+ var maxPositionLeft = i.railXRatio * (i.railXWidth - i.scrollbarXWidth);
419
+ var positionRatio = positionLeft / maxPositionLeft;
420
+
421
+ if (positionRatio < 0) {
422
+ positionRatio = 0;
423
+ } else if (positionRatio > 1) {
424
+ positionRatio = 1;
425
+ }
426
+
427
+ updateScroll(element, 'left', ((i.contentWidth - i.containerWidth) * positionRatio) - i.negativeScrollAdjustment);
428
+ updateGeometry(element);
429
+
430
+ e.stopPropagation();
431
+ });
432
+ }
433
+
434
+ module.exports = function (element) {
435
+ var i = instances.get(element);
436
+ bindClickRailHandler(element, i);
437
+ };
438
+
439
+ },{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(require,module,exports){
440
+ 'use strict';
441
+
442
+ var _ = require('../../lib/helper');
443
+ var dom = require('../../lib/dom');
444
+ var instances = require('../instances');
445
+ var updateGeometry = require('../update-geometry');
446
+ var updateScroll = require('../update-scroll');
447
+
448
+ function bindMouseScrollXHandler(element, i) {
449
+ var currentLeft = null;
450
+ var currentPageX = null;
451
+
452
+ function updateScrollLeft(deltaX) {
453
+ var newLeft = currentLeft + (deltaX * i.railXRatio);
454
+ var maxLeft = Math.max(0, i.scrollbarXRail.getBoundingClientRect().left) + (i.railXRatio * (i.railXWidth - i.scrollbarXWidth));
455
+
456
+ if (newLeft < 0) {
457
+ i.scrollbarXLeft = 0;
458
+ } else if (newLeft > maxLeft) {
459
+ i.scrollbarXLeft = maxLeft;
460
+ } else {
461
+ i.scrollbarXLeft = newLeft;
462
+ }
463
+
464
+ var scrollLeft = _.toInt(i.scrollbarXLeft * (i.contentWidth - i.containerWidth) / (i.containerWidth - (i.railXRatio * i.scrollbarXWidth))) - i.negativeScrollAdjustment;
465
+ updateScroll(element, 'left', scrollLeft);
466
+ }
467
+
468
+ var mouseMoveHandler = function (e) {
469
+ updateScrollLeft(e.pageX - currentPageX);
470
+ updateGeometry(element);
471
+ e.stopPropagation();
472
+ e.preventDefault();
473
+ };
474
+
475
+ var mouseUpHandler = function () {
476
+ _.stopScrolling(element, 'x');
477
+ i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
478
+ };
479
+
480
+ i.event.bind(i.scrollbarX, 'mousedown', function (e) {
481
+ currentPageX = e.pageX;
482
+ currentLeft = _.toInt(dom.css(i.scrollbarX, 'left')) * i.railXRatio;
483
+ _.startScrolling(element, 'x');
484
+
485
+ i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
486
+ i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
487
+
488
+ e.stopPropagation();
489
+ e.preventDefault();
490
+ });
491
+ }
492
+
493
+ function bindMouseScrollYHandler(element, i) {
494
+ var currentTop = null;
495
+ var currentPageY = null;
496
+
497
+ function updateScrollTop(deltaY) {
498
+ var newTop = currentTop + (deltaY * i.railYRatio);
499
+ var maxTop = Math.max(0, i.scrollbarYRail.getBoundingClientRect().top) + (i.railYRatio * (i.railYHeight - i.scrollbarYHeight));
500
+
501
+ if (newTop < 0) {
502
+ i.scrollbarYTop = 0;
503
+ } else if (newTop > maxTop) {
504
+ i.scrollbarYTop = maxTop;
505
+ } else {
506
+ i.scrollbarYTop = newTop;
507
+ }
508
+
509
+ var scrollTop = _.toInt(i.scrollbarYTop * (i.contentHeight - i.containerHeight) / (i.containerHeight - (i.railYRatio * i.scrollbarYHeight)));
510
+ updateScroll(element, 'top', scrollTop);
511
+ }
512
+
513
+ var mouseMoveHandler = function (e) {
514
+ updateScrollTop(e.pageY - currentPageY);
515
+ updateGeometry(element);
516
+ e.stopPropagation();
517
+ e.preventDefault();
518
+ };
519
+
520
+ var mouseUpHandler = function () {
521
+ _.stopScrolling(element, 'y');
522
+ i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
523
+ };
524
+
525
+ i.event.bind(i.scrollbarY, 'mousedown', function (e) {
526
+ currentPageY = e.pageY;
527
+ currentTop = _.toInt(dom.css(i.scrollbarY, 'top')) * i.railYRatio;
528
+ _.startScrolling(element, 'y');
529
+
530
+ i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
531
+ i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
532
+
533
+ e.stopPropagation();
534
+ e.preventDefault();
535
+ });
536
+ }
537
+
538
+ module.exports = function (element) {
539
+ var i = instances.get(element);
540
+ bindMouseScrollXHandler(element, i);
541
+ bindMouseScrollYHandler(element, i);
542
+ };
543
+
544
+ },{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],12:[function(require,module,exports){
545
+ 'use strict';
546
+
547
+ var _ = require('../../lib/helper');
548
+ var dom = require('../../lib/dom');
549
+ var instances = require('../instances');
550
+ var updateGeometry = require('../update-geometry');
551
+ var updateScroll = require('../update-scroll');
552
+
553
+ function bindKeyboardHandler(element, i) {
554
+ var hovered = false;
555
+ i.event.bind(element, 'mouseenter', function () {
556
+ hovered = true;
557
+ });
558
+ i.event.bind(element, 'mouseleave', function () {
559
+ hovered = false;
560
+ });
561
+
562
+ var shouldPrevent = false;
563
+ function shouldPreventDefault(deltaX, deltaY) {
564
+ var scrollTop = element.scrollTop;
565
+ if (deltaX === 0) {
566
+ if (!i.scrollbarYActive) {
567
+ return false;
568
+ }
569
+ if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) {
570
+ return !i.settings.wheelPropagation;
571
+ }
572
+ }
573
+
574
+ var scrollLeft = element.scrollLeft;
575
+ if (deltaY === 0) {
576
+ if (!i.scrollbarXActive) {
577
+ return false;
578
+ }
579
+ if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) {
580
+ return !i.settings.wheelPropagation;
581
+ }
582
+ }
583
+ return true;
584
+ }
585
+
586
+ i.event.bind(i.ownerDocument, 'keydown', function (e) {
587
+ if ((e.isDefaultPrevented && e.isDefaultPrevented()) || e.defaultPrevented) {
588
+ return;
589
+ }
590
+
591
+ var focused = dom.matches(i.scrollbarX, ':focus') ||
592
+ dom.matches(i.scrollbarY, ':focus');
593
+
594
+ if (!hovered && !focused) {
595
+ return;
596
+ }
597
+
598
+ var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement;
599
+ if (activeElement) {
600
+ if (activeElement.tagName === 'IFRAME') {
601
+ activeElement = activeElement.contentDocument.activeElement;
602
+ } else {
603
+ // go deeper if element is a webcomponent
604
+ while (activeElement.shadowRoot) {
605
+ activeElement = activeElement.shadowRoot.activeElement;
606
+ }
607
+ }
608
+ if (_.isEditable(activeElement)) {
609
+ return;
610
+ }
611
+ }
612
+
613
+ var deltaX = 0;
614
+ var deltaY = 0;
615
+
616
+ switch (e.which) {
617
+ case 37: // left
618
+ deltaX = -30;
619
+ break;
620
+ case 38: // up
621
+ deltaY = 30;
622
+ break;
623
+ case 39: // right
624
+ deltaX = 30;
625
+ break;
626
+ case 40: // down
627
+ deltaY = -30;
628
+ break;
629
+ case 33: // page up
630
+ deltaY = 90;
631
+ break;
632
+ case 32: // space bar
633
+ if (e.shiftKey) {
634
+ deltaY = 90;
635
+ } else {
636
+ deltaY = -90;
637
+ }
638
+ break;
639
+ case 34: // page down
640
+ deltaY = -90;
641
+ break;
642
+ case 35: // end
643
+ if (e.ctrlKey) {
644
+ deltaY = -i.contentHeight;
645
+ } else {
646
+ deltaY = -i.containerHeight;
647
+ }
648
+ break;
649
+ case 36: // home
650
+ if (e.ctrlKey) {
651
+ deltaY = element.scrollTop;
652
+ } else {
653
+ deltaY = i.containerHeight;
654
+ }
655
+ break;
656
+ default:
657
+ return;
658
+ }
659
+
660
+ updateScroll(element, 'top', element.scrollTop - deltaY);
661
+ updateScroll(element, 'left', element.scrollLeft + deltaX);
662
+ updateGeometry(element);
663
+
664
+ shouldPrevent = shouldPreventDefault(deltaX, deltaY);
665
+ if (shouldPrevent) {
666
+ e.preventDefault();
667
+ }
668
+ });
669
+ }
670
+
671
+ module.exports = function (element) {
672
+ var i = instances.get(element);
673
+ bindKeyboardHandler(element, i);
674
+ };
675
+
676
+ },{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],13:[function(require,module,exports){
677
+ 'use strict';
678
+
679
+ var instances = require('../instances');
680
+ var updateGeometry = require('../update-geometry');
681
+ var updateScroll = require('../update-scroll');
682
+
683
+ function bindMouseWheelHandler(element, i) {
684
+ var shouldPrevent = false;
685
+
686
+ function shouldPreventDefault(deltaX, deltaY) {
687
+ var scrollTop = element.scrollTop;
688
+ if (deltaX === 0) {
689
+ if (!i.scrollbarYActive) {
690
+ return false;
691
+ }
692
+ if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) {
693
+ return !i.settings.wheelPropagation;
694
+ }
695
+ }
696
+
697
+ var scrollLeft = element.scrollLeft;
698
+ if (deltaY === 0) {
699
+ if (!i.scrollbarXActive) {
700
+ return false;
701
+ }
702
+ if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) {
703
+ return !i.settings.wheelPropagation;
704
+ }
705
+ }
706
+ return true;
707
+ }
708
+
709
+ function getDeltaFromEvent(e) {
710
+ var deltaX = e.deltaX;
711
+ var deltaY = -1 * e.deltaY;
712
+
713
+ if (typeof deltaX === "undefined" || typeof deltaY === "undefined") {
714
+ // OS X Safari
715
+ deltaX = -1 * e.wheelDeltaX / 6;
716
+ deltaY = e.wheelDeltaY / 6;
717
+ }
718
+
719
+ if (e.deltaMode && e.deltaMode === 1) {
720
+ // Firefox in deltaMode 1: Line scrolling
721
+ deltaX *= 10;
722
+ deltaY *= 10;
723
+ }
724
+
725
+ if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) {
726
+ // IE in some mouse drivers
727
+ deltaX = 0;
728
+ deltaY = e.wheelDelta;
729
+ }
730
+
731
+ return [deltaX, deltaY];
732
+ }
733
+
734
+ function shouldBeConsumedByChild(deltaX, deltaY) {
735
+ var child = element.querySelector('textarea:hover, select[multiple]:hover, .ps-child:hover');
736
+ if (child) {
737
+ if (child.tagName !== 'TEXTAREA' && !window.getComputedStyle(child).overflow.match(/(scroll|auto)/)) {
738
+ return false;
739
+ }
740
+
741
+ var maxScrollTop = child.scrollHeight - child.clientHeight;
742
+ if (maxScrollTop > 0) {
743
+ if (!(child.scrollTop === 0 && deltaY > 0) && !(child.scrollTop === maxScrollTop && deltaY < 0)) {
744
+ return true;
745
+ }
746
+ }
747
+ var maxScrollLeft = child.scrollLeft - child.clientWidth;
748
+ if (maxScrollLeft > 0) {
749
+ if (!(child.scrollLeft === 0 && deltaX < 0) && !(child.scrollLeft === maxScrollLeft && deltaX > 0)) {
750
+ return true;
751
+ }
752
+ }
753
+ }
754
+ return false;
755
+ }
756
+
757
+ function mousewheelHandler(e) {
758
+ var delta = getDeltaFromEvent(e);
759
+
760
+ var deltaX = delta[0];
761
+ var deltaY = delta[1];
762
+
763
+ if (shouldBeConsumedByChild(deltaX, deltaY)) {
764
+ return;
765
+ }
766
+
767
+ shouldPrevent = false;
768
+ if (!i.settings.useBothWheelAxes) {
769
+ // deltaX will only be used for horizontal scrolling and deltaY will
770
+ // only be used for vertical scrolling - this is the default
771
+ updateScroll(element, 'top', element.scrollTop - (deltaY * i.settings.wheelSpeed));
772
+ updateScroll(element, 'left', element.scrollLeft + (deltaX * i.settings.wheelSpeed));
773
+ } else if (i.scrollbarYActive && !i.scrollbarXActive) {
774
+ // only vertical scrollbar is active and useBothWheelAxes option is
775
+ // active, so let's scroll vertical bar using both mouse wheel axes
776
+ if (deltaY) {
777
+ updateScroll(element, 'top', element.scrollTop - (deltaY * i.settings.wheelSpeed));
778
+ } else {
779
+ updateScroll(element, 'top', element.scrollTop + (deltaX * i.settings.wheelSpeed));
780
+ }
781
+ shouldPrevent = true;
782
+ } else if (i.scrollbarXActive && !i.scrollbarYActive) {
783
+ // useBothWheelAxes and only horizontal bar is active, so use both
784
+ // wheel axes for horizontal bar
785
+ if (deltaX) {
786
+ updateScroll(element, 'left', element.scrollLeft + (deltaX * i.settings.wheelSpeed));
787
+ } else {
788
+ updateScroll(element, 'left', element.scrollLeft - (deltaY * i.settings.wheelSpeed));
789
+ }
790
+ shouldPrevent = true;
791
+ }
792
+
793
+ updateGeometry(element);
794
+
795
+ shouldPrevent = (shouldPrevent || shouldPreventDefault(deltaX, deltaY));
796
+ if (shouldPrevent) {
797
+ e.stopPropagation();
798
+ e.preventDefault();
799
+ }
800
+ }
801
+
802
+ if (typeof window.onwheel !== "undefined") {
803
+ i.event.bind(element, 'wheel', mousewheelHandler);
804
+ } else if (typeof window.onmousewheel !== "undefined") {
805
+ i.event.bind(element, 'mousewheel', mousewheelHandler);
806
+ }
807
+ }
808
+
809
+ module.exports = function (element) {
810
+ var i = instances.get(element);
811
+ bindMouseWheelHandler(element, i);
812
+ };
813
+
814
+ },{"../instances":18,"../update-geometry":19,"../update-scroll":20}],14:[function(require,module,exports){
815
+ 'use strict';
816
+
817
+ var instances = require('../instances');
818
+ var updateGeometry = require('../update-geometry');
819
+
820
+ function bindNativeScrollHandler(element, i) {
821
+ i.event.bind(element, 'scroll', function () {
822
+ updateGeometry(element);
823
+ });
824
+ }
825
+
826
+ module.exports = function (element) {
827
+ var i = instances.get(element);
828
+ bindNativeScrollHandler(element, i);
829
+ };
830
+
831
+ },{"../instances":18,"../update-geometry":19}],15:[function(require,module,exports){
832
+ 'use strict';
833
+
834
+ var _ = require('../../lib/helper');
835
+ var instances = require('../instances');
836
+ var updateGeometry = require('../update-geometry');
837
+ var updateScroll = require('../update-scroll');
838
+
839
+ function bindSelectionHandler(element, i) {
840
+ function getRangeNode() {
841
+ var selection = window.getSelection ? window.getSelection() :
842
+ document.getSelection ? document.getSelection() : '';
843
+ if (selection.toString().length === 0) {
844
+ return null;
845
+ } else {
846
+ return selection.getRangeAt(0).commonAncestorContainer;
847
+ }
848
+ }
849
+
850
+ var scrollingLoop = null;
851
+ var scrollDiff = {top: 0, left: 0};
852
+ function startScrolling() {
853
+ if (!scrollingLoop) {
854
+ scrollingLoop = setInterval(function () {
855
+ if (!instances.get(element)) {
856
+ clearInterval(scrollingLoop);
857
+ return;
858
+ }
859
+
860
+ updateScroll(element, 'top', element.scrollTop + scrollDiff.top);
861
+ updateScroll(element, 'left', element.scrollLeft + scrollDiff.left);
862
+ updateGeometry(element);
863
+ }, 50); // every .1 sec
864
+ }
865
+ }
866
+ function stopScrolling() {
867
+ if (scrollingLoop) {
868
+ clearInterval(scrollingLoop);
869
+ scrollingLoop = null;
870
+ }
871
+ _.stopScrolling(element);
872
+ }
873
+
874
+ var isSelected = false;
875
+ i.event.bind(i.ownerDocument, 'selectionchange', function () {
876
+ if (element.contains(getRangeNode())) {
877
+ isSelected = true;
878
+ } else {
879
+ isSelected = false;
880
+ stopScrolling();
881
+ }
882
+ });
883
+ i.event.bind(window, 'mouseup', function () {
884
+ if (isSelected) {
885
+ isSelected = false;
886
+ stopScrolling();
887
+ }
888
+ });
889
+
890
+ i.event.bind(window, 'mousemove', function (e) {
891
+ if (isSelected) {
892
+ var mousePosition = {x: e.pageX, y: e.pageY};
893
+ var containerGeometry = {
894
+ left: element.offsetLeft,
895
+ right: element.offsetLeft + element.offsetWidth,
896
+ top: element.offsetTop,
897
+ bottom: element.offsetTop + element.offsetHeight
898
+ };
899
+
900
+ if (mousePosition.x < containerGeometry.left + 3) {
901
+ scrollDiff.left = -5;
902
+ _.startScrolling(element, 'x');
903
+ } else if (mousePosition.x > containerGeometry.right - 3) {
904
+ scrollDiff.left = 5;
905
+ _.startScrolling(element, 'x');
906
+ } else {
907
+ scrollDiff.left = 0;
908
+ }
909
+
910
+ if (mousePosition.y < containerGeometry.top + 3) {
911
+ if (containerGeometry.top + 3 - mousePosition.y < 5) {
912
+ scrollDiff.top = -5;
913
+ } else {
914
+ scrollDiff.top = -20;
915
+ }
916
+ _.startScrolling(element, 'y');
917
+ } else if (mousePosition.y > containerGeometry.bottom - 3) {
918
+ if (mousePosition.y - containerGeometry.bottom + 3 < 5) {
919
+ scrollDiff.top = 5;
920
+ } else {
921
+ scrollDiff.top = 20;
922
+ }
923
+ _.startScrolling(element, 'y');
924
+ } else {
925
+ scrollDiff.top = 0;
926
+ }
927
+
928
+ if (scrollDiff.top === 0 && scrollDiff.left === 0) {
929
+ stopScrolling();
930
+ } else {
931
+ startScrolling();
932
+ }
933
+ }
934
+ });
935
+ }
936
+
937
+ module.exports = function (element) {
938
+ var i = instances.get(element);
939
+ bindSelectionHandler(element, i);
940
+ };
941
+
942
+ },{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],16:[function(require,module,exports){
943
+ 'use strict';
944
+
945
+ var _ = require('../../lib/helper');
946
+ var instances = require('../instances');
947
+ var updateGeometry = require('../update-geometry');
948
+ var updateScroll = require('../update-scroll');
949
+
950
+ function bindTouchHandler(element, i, supportsTouch, supportsIePointer) {
951
+ function shouldPreventDefault(deltaX, deltaY) {
952
+ var scrollTop = element.scrollTop;
953
+ var scrollLeft = element.scrollLeft;
954
+ var magnitudeX = Math.abs(deltaX);
955
+ var magnitudeY = Math.abs(deltaY);
956
+
957
+ if (magnitudeY > magnitudeX) {
958
+ // user is perhaps trying to swipe up/down the page
959
+
960
+ if (((deltaY < 0) && (scrollTop === i.contentHeight - i.containerHeight)) ||
961
+ ((deltaY > 0) && (scrollTop === 0))) {
962
+ return !i.settings.swipePropagation;
963
+ }
964
+ } else if (magnitudeX > magnitudeY) {
965
+ // user is perhaps trying to swipe left/right across the page
966
+
967
+ if (((deltaX < 0) && (scrollLeft === i.contentWidth - i.containerWidth)) ||
968
+ ((deltaX > 0) && (scrollLeft === 0))) {
969
+ return !i.settings.swipePropagation;
970
+ }
971
+ }
972
+
973
+ return true;
974
+ }
975
+
976
+ function applyTouchMove(differenceX, differenceY) {
977
+ updateScroll(element, 'top', element.scrollTop - differenceY);
978
+ updateScroll(element, 'left', element.scrollLeft - differenceX);
979
+
980
+ updateGeometry(element);
981
+ }
982
+
983
+ var startOffset = {};
984
+ var startTime = 0;
985
+ var speed = {};
986
+ var easingLoop = null;
987
+ var inGlobalTouch = false;
988
+ var inLocalTouch = false;
989
+
990
+ function globalTouchStart() {
991
+ inGlobalTouch = true;
992
+ }
993
+ function globalTouchEnd() {
994
+ inGlobalTouch = false;
995
+ }
996
+
997
+ function getTouch(e) {
998
+ if (e.targetTouches) {
999
+ return e.targetTouches[0];
1000
+ } else {
1001
+ // Maybe IE pointer
1002
+ return e;
1003
+ }
1004
+ }
1005
+ function shouldHandle(e) {
1006
+ if (e.targetTouches && e.targetTouches.length === 1) {
1007
+ return true;
1008
+ }
1009
+ if (e.pointerType && e.pointerType !== 'mouse' && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) {
1010
+ return true;
1011
+ }
1012
+ return false;
1013
+ }
1014
+ function touchStart(e) {
1015
+ if (shouldHandle(e)) {
1016
+ inLocalTouch = true;
1017
+
1018
+ var touch = getTouch(e);
1019
+
1020
+ startOffset.pageX = touch.pageX;
1021
+ startOffset.pageY = touch.pageY;
1022
+
1023
+ startTime = (new Date()).getTime();
1024
+
1025
+ if (easingLoop !== null) {
1026
+ clearInterval(easingLoop);
1027
+ }
1028
+
1029
+ e.stopPropagation();
1030
+ }
1031
+ }
1032
+ function touchMove(e) {
1033
+ if (!inLocalTouch && i.settings.swipePropagation) {
1034
+ touchStart(e);
1035
+ }
1036
+ if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) {
1037
+ var touch = getTouch(e);
1038
+
1039
+ var currentOffset = {pageX: touch.pageX, pageY: touch.pageY};
1040
+
1041
+ var differenceX = currentOffset.pageX - startOffset.pageX;
1042
+ var differenceY = currentOffset.pageY - startOffset.pageY;
1043
+
1044
+ applyTouchMove(differenceX, differenceY);
1045
+ startOffset = currentOffset;
1046
+
1047
+ var currentTime = (new Date()).getTime();
1048
+
1049
+ var timeGap = currentTime - startTime;
1050
+ if (timeGap > 0) {
1051
+ speed.x = differenceX / timeGap;
1052
+ speed.y = differenceY / timeGap;
1053
+ startTime = currentTime;
1054
+ }
1055
+
1056
+ if (shouldPreventDefault(differenceX, differenceY)) {
1057
+ e.stopPropagation();
1058
+ e.preventDefault();
1059
+ }
1060
+ }
1061
+ }
1062
+ function touchEnd() {
1063
+ if (!inGlobalTouch && inLocalTouch) {
1064
+ inLocalTouch = false;
1065
+
1066
+ clearInterval(easingLoop);
1067
+ easingLoop = setInterval(function () {
1068
+ if (!instances.get(element)) {
1069
+ clearInterval(easingLoop);
1070
+ return;
1071
+ }
1072
+
1073
+ if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
1074
+ clearInterval(easingLoop);
1075
+ return;
1076
+ }
1077
+
1078
+ applyTouchMove(speed.x * 30, speed.y * 30);
1079
+
1080
+ speed.x *= 0.8;
1081
+ speed.y *= 0.8;
1082
+ }, 10);
1083
+ }
1084
+ }
1085
+
1086
+ if (supportsTouch) {
1087
+ i.event.bind(window, 'touchstart', globalTouchStart);
1088
+ i.event.bind(window, 'touchend', globalTouchEnd);
1089
+ i.event.bind(element, 'touchstart', touchStart);
1090
+ i.event.bind(element, 'touchmove', touchMove);
1091
+ i.event.bind(element, 'touchend', touchEnd);
1092
+ }
1093
+
1094
+ if (supportsIePointer) {
1095
+ if (window.PointerEvent) {
1096
+ i.event.bind(window, 'pointerdown', globalTouchStart);
1097
+ i.event.bind(window, 'pointerup', globalTouchEnd);
1098
+ i.event.bind(element, 'pointerdown', touchStart);
1099
+ i.event.bind(element, 'pointermove', touchMove);
1100
+ i.event.bind(element, 'pointerup', touchEnd);
1101
+ } else if (window.MSPointerEvent) {
1102
+ i.event.bind(window, 'MSPointerDown', globalTouchStart);
1103
+ i.event.bind(window, 'MSPointerUp', globalTouchEnd);
1104
+ i.event.bind(element, 'MSPointerDown', touchStart);
1105
+ i.event.bind(element, 'MSPointerMove', touchMove);
1106
+ i.event.bind(element, 'MSPointerUp', touchEnd);
1107
+ }
1108
+ }
1109
+ }
1110
+
1111
+ module.exports = function (element) {
1112
+ if (!_.env.supportsTouch && !_.env.supportsIePointer) {
1113
+ return;
1114
+ }
1115
+
1116
+ var i = instances.get(element);
1117
+ bindTouchHandler(element, i, _.env.supportsTouch, _.env.supportsIePointer);
1118
+ };
1119
+
1120
+ },{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],17:[function(require,module,exports){
1121
+ 'use strict';
1122
+
1123
+ var _ = require('../lib/helper');
1124
+ var cls = require('../lib/class');
1125
+ var instances = require('./instances');
1126
+ var updateGeometry = require('./update-geometry');
1127
+
1128
+ // Handlers
1129
+ var handlers = {
1130
+ 'click-rail': require('./handler/click-rail'),
1131
+ 'drag-scrollbar': require('./handler/drag-scrollbar'),
1132
+ 'keyboard': require('./handler/keyboard'),
1133
+ 'wheel': require('./handler/mouse-wheel'),
1134
+ 'touch': require('./handler/touch'),
1135
+ 'selection': require('./handler/selection')
1136
+ };
1137
+ var nativeScrollHandler = require('./handler/native-scroll');
1138
+
1139
+ module.exports = function (element, userSettings) {
1140
+ userSettings = typeof userSettings === 'object' ? userSettings : {};
1141
+
1142
+ cls.add(element, 'ps-container');
1143
+
1144
+ // Create a plugin instance.
1145
+ var i = instances.add(element);
1146
+
1147
+ i.settings = _.extend(i.settings, userSettings);
1148
+ cls.add(element, 'ps-theme-' + i.settings.theme);
1149
+
1150
+ i.settings.handlers.forEach(function (handlerName) {
1151
+ handlers[handlerName](element);
1152
+ });
1153
+
1154
+ nativeScrollHandler(element);
1155
+
1156
+ updateGeometry(element);
1157
+ };
1158
+
1159
+ },{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(require,module,exports){
1160
+ 'use strict';
1161
+
1162
+ var _ = require('../lib/helper');
1163
+ var cls = require('../lib/class');
1164
+ var defaultSettings = require('./default-setting');
1165
+ var dom = require('../lib/dom');
1166
+ var EventManager = require('../lib/event-manager');
1167
+ var guid = require('../lib/guid');
1168
+
1169
+ var instances = {};
1170
+
1171
+ function Instance(element) {
1172
+ var i = this;
1173
+
1174
+ i.settings = _.clone(defaultSettings);
1175
+ i.containerWidth = null;
1176
+ i.containerHeight = null;
1177
+ i.contentWidth = null;
1178
+ i.contentHeight = null;
1179
+
1180
+ i.isRtl = dom.css(element, 'direction') === "rtl";
1181
+ i.isNegativeScroll = (function () {
1182
+ var originalScrollLeft = element.scrollLeft;
1183
+ var result = null;
1184
+ element.scrollLeft = -1;
1185
+ result = element.scrollLeft < 0;
1186
+ element.scrollLeft = originalScrollLeft;
1187
+ return result;
1188
+ })();
1189
+ i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0;
1190
+ i.event = new EventManager();
1191
+ i.ownerDocument = element.ownerDocument || document;
1192
+
1193
+ function focus() {
1194
+ cls.add(element, 'ps-focus');
1195
+ }
1196
+
1197
+ function blur() {
1198
+ cls.remove(element, 'ps-focus');
1199
+ }
1200
+
1201
+ i.scrollbarXRail = dom.appendTo(dom.e('div', 'ps-scrollbar-x-rail'), element);
1202
+ i.scrollbarX = dom.appendTo(dom.e('div', 'ps-scrollbar-x'), i.scrollbarXRail);
1203
+ i.scrollbarX.setAttribute('tabindex', 0);
1204
+ i.event.bind(i.scrollbarX, 'focus', focus);
1205
+ i.event.bind(i.scrollbarX, 'blur', blur);
1206
+ i.scrollbarXActive = null;
1207
+ i.scrollbarXWidth = null;
1208
+ i.scrollbarXLeft = null;
1209
+ i.scrollbarXBottom = _.toInt(dom.css(i.scrollbarXRail, 'bottom'));
1210
+ i.isScrollbarXUsingBottom = i.scrollbarXBottom === i.scrollbarXBottom; // !isNaN
1211
+ i.scrollbarXTop = i.isScrollbarXUsingBottom ? null : _.toInt(dom.css(i.scrollbarXRail, 'top'));
1212
+ i.railBorderXWidth = _.toInt(dom.css(i.scrollbarXRail, 'borderLeftWidth')) + _.toInt(dom.css(i.scrollbarXRail, 'borderRightWidth'));
1213
+ // Set rail to display:block to calculate margins
1214
+ dom.css(i.scrollbarXRail, 'display', 'block');
1215
+ i.railXMarginWidth = _.toInt(dom.css(i.scrollbarXRail, 'marginLeft')) + _.toInt(dom.css(i.scrollbarXRail, 'marginRight'));
1216
+ dom.css(i.scrollbarXRail, 'display', '');
1217
+ i.railXWidth = null;
1218
+ i.railXRatio = null;
1219
+
1220
+ i.scrollbarYRail = dom.appendTo(dom.e('div', 'ps-scrollbar-y-rail'), element);
1221
+ i.scrollbarY = dom.appendTo(dom.e('div', 'ps-scrollbar-y'), i.scrollbarYRail);
1222
+ i.scrollbarY.setAttribute('tabindex', 0);
1223
+ i.event.bind(i.scrollbarY, 'focus', focus);
1224
+ i.event.bind(i.scrollbarY, 'blur', blur);
1225
+ i.scrollbarYActive = null;
1226
+ i.scrollbarYHeight = null;
1227
+ i.scrollbarYTop = null;
1228
+ i.scrollbarYRight = _.toInt(dom.css(i.scrollbarYRail, 'right'));
1229
+ i.isScrollbarYUsingRight = i.scrollbarYRight === i.scrollbarYRight; // !isNaN
1230
+ i.scrollbarYLeft = i.isScrollbarYUsingRight ? null : _.toInt(dom.css(i.scrollbarYRail, 'left'));
1231
+ i.scrollbarYOuterWidth = i.isRtl ? _.outerWidth(i.scrollbarY) : null;
1232
+ i.railBorderYWidth = _.toInt(dom.css(i.scrollbarYRail, 'borderTopWidth')) + _.toInt(dom.css(i.scrollbarYRail, 'borderBottomWidth'));
1233
+ dom.css(i.scrollbarYRail, 'display', 'block');
1234
+ i.railYMarginHeight = _.toInt(dom.css(i.scrollbarYRail, 'marginTop')) + _.toInt(dom.css(i.scrollbarYRail, 'marginBottom'));
1235
+ dom.css(i.scrollbarYRail, 'display', '');
1236
+ i.railYHeight = null;
1237
+ i.railYRatio = null;
1238
+ }
1239
+
1240
+ function getId(element) {
1241
+ return element.getAttribute('data-ps-id');
1242
+ }
1243
+
1244
+ function setId(element, id) {
1245
+ element.setAttribute('data-ps-id', id);
1246
+ }
1247
+
1248
+ function removeId(element) {
1249
+ element.removeAttribute('data-ps-id');
1250
+ }
1251
+
1252
+ exports.add = function (element) {
1253
+ var newId = guid();
1254
+ setId(element, newId);
1255
+ instances[newId] = new Instance(element);
1256
+ return instances[newId];
1257
+ };
1258
+
1259
+ exports.remove = function (element) {
1260
+ delete instances[getId(element)];
1261
+ removeId(element);
1262
+ };
1263
+
1264
+ exports.get = function (element) {
1265
+ return instances[getId(element)];
1266
+ };
1267
+
1268
+ },{"../lib/class":2,"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){
1269
+ 'use strict';
1270
+
1271
+ var _ = require('../lib/helper');
1272
+ var cls = require('../lib/class');
1273
+ var dom = require('../lib/dom');
1274
+ var instances = require('./instances');
1275
+ var updateScroll = require('./update-scroll');
1276
+
1277
+ function getThumbSize(i, thumbSize) {
1278
+ if (i.settings.minScrollbarLength) {
1279
+ thumbSize = Math.max(thumbSize, i.settings.minScrollbarLength);
1280
+ }
1281
+ if (i.settings.maxScrollbarLength) {
1282
+ thumbSize = Math.min(thumbSize, i.settings.maxScrollbarLength);
1283
+ }
1284
+ return thumbSize;
1285
+ }
1286
+
1287
+ function updateCss(element, i) {
1288
+ var xRailOffset = {width: i.railXWidth};
1289
+ if (i.isRtl) {
1290
+ xRailOffset.left = i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth - i.contentWidth;
1291
+ } else {
1292
+ xRailOffset.left = element.scrollLeft;
1293
+ }
1294
+ if (i.isScrollbarXUsingBottom) {
1295
+ xRailOffset.bottom = i.scrollbarXBottom - element.scrollTop;
1296
+ } else {
1297
+ xRailOffset.top = i.scrollbarXTop + element.scrollTop;
1298
+ }
1299
+ dom.css(i.scrollbarXRail, xRailOffset);
1300
+
1301
+ var yRailOffset = {top: element.scrollTop, height: i.railYHeight};
1302
+ if (i.isScrollbarYUsingRight) {
1303
+ if (i.isRtl) {
1304
+ yRailOffset.right = i.contentWidth - (i.negativeScrollAdjustment + element.scrollLeft) - i.scrollbarYRight - i.scrollbarYOuterWidth;
1305
+ } else {
1306
+ yRailOffset.right = i.scrollbarYRight - element.scrollLeft;
1307
+ }
1308
+ } else {
1309
+ if (i.isRtl) {
1310
+ yRailOffset.left = i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth * 2 - i.contentWidth - i.scrollbarYLeft - i.scrollbarYOuterWidth;
1311
+ } else {
1312
+ yRailOffset.left = i.scrollbarYLeft + element.scrollLeft;
1313
+ }
1314
+ }
1315
+ dom.css(i.scrollbarYRail, yRailOffset);
1316
+
1317
+ dom.css(i.scrollbarX, {left: i.scrollbarXLeft, width: i.scrollbarXWidth - i.railBorderXWidth});
1318
+ dom.css(i.scrollbarY, {top: i.scrollbarYTop, height: i.scrollbarYHeight - i.railBorderYWidth});
1319
+ }
1320
+
1321
+ module.exports = function (element) {
1322
+ var i = instances.get(element);
1323
+
1324
+ i.containerWidth = element.clientWidth;
1325
+ i.containerHeight = element.clientHeight;
1326
+ i.contentWidth = element.scrollWidth;
1327
+ i.contentHeight = element.scrollHeight;
1328
+
1329
+ var existingRails;
1330
+ if (!element.contains(i.scrollbarXRail)) {
1331
+ existingRails = dom.queryChildren(element, '.ps-scrollbar-x-rail');
1332
+ if (existingRails.length > 0) {
1333
+ existingRails.forEach(function (rail) {
1334
+ dom.remove(rail);
1335
+ });
1336
+ }
1337
+ dom.appendTo(i.scrollbarXRail, element);
1338
+ }
1339
+ if (!element.contains(i.scrollbarYRail)) {
1340
+ existingRails = dom.queryChildren(element, '.ps-scrollbar-y-rail');
1341
+ if (existingRails.length > 0) {
1342
+ existingRails.forEach(function (rail) {
1343
+ dom.remove(rail);
1344
+ });
1345
+ }
1346
+ dom.appendTo(i.scrollbarYRail, element);
1347
+ }
1348
+
1349
+ if (!i.settings.suppressScrollX && i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth) {
1350
+ i.scrollbarXActive = true;
1351
+ i.railXWidth = i.containerWidth - i.railXMarginWidth;
1352
+ i.railXRatio = i.containerWidth / i.railXWidth;
1353
+ i.scrollbarXWidth = getThumbSize(i, _.toInt(i.railXWidth * i.containerWidth / i.contentWidth));
1354
+ i.scrollbarXLeft = _.toInt((i.negativeScrollAdjustment + element.scrollLeft) * (i.railXWidth - i.scrollbarXWidth) / (i.contentWidth - i.containerWidth));
1355
+ } else {
1356
+ i.scrollbarXActive = false;
1357
+ }
1358
+
1359
+ if (!i.settings.suppressScrollY && i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight) {
1360
+ i.scrollbarYActive = true;
1361
+ i.railYHeight = i.containerHeight - i.railYMarginHeight;
1362
+ i.railYRatio = i.containerHeight / i.railYHeight;
1363
+ i.scrollbarYHeight = getThumbSize(i, _.toInt(i.railYHeight * i.containerHeight / i.contentHeight));
1364
+ i.scrollbarYTop = _.toInt(element.scrollTop * (i.railYHeight - i.scrollbarYHeight) / (i.contentHeight - i.containerHeight));
1365
+ } else {
1366
+ i.scrollbarYActive = false;
1367
+ }
1368
+
1369
+ if (i.scrollbarXLeft >= i.railXWidth - i.scrollbarXWidth) {
1370
+ i.scrollbarXLeft = i.railXWidth - i.scrollbarXWidth;
1371
+ }
1372
+ if (i.scrollbarYTop >= i.railYHeight - i.scrollbarYHeight) {
1373
+ i.scrollbarYTop = i.railYHeight - i.scrollbarYHeight;
1374
+ }
1375
+
1376
+ updateCss(element, i);
1377
+
1378
+ if (i.scrollbarXActive) {
1379
+ cls.add(element, 'ps-active-x');
1380
+ } else {
1381
+ cls.remove(element, 'ps-active-x');
1382
+ i.scrollbarXWidth = 0;
1383
+ i.scrollbarXLeft = 0;
1384
+ updateScroll(element, 'left', 0);
1385
+ }
1386
+ if (i.scrollbarYActive) {
1387
+ cls.add(element, 'ps-active-y');
1388
+ } else {
1389
+ cls.remove(element, 'ps-active-y');
1390
+ i.scrollbarYHeight = 0;
1391
+ i.scrollbarYTop = 0;
1392
+ updateScroll(element, 'top', 0);
1393
+ }
1394
+ };
1395
+
1396
+ },{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-scroll":20}],20:[function(require,module,exports){
1397
+ 'use strict';
1398
+
1399
+ var instances = require('./instances');
1400
+
1401
+ var upEvent = document.createEvent('Event');
1402
+ var downEvent = document.createEvent('Event');
1403
+ var leftEvent = document.createEvent('Event');
1404
+ var rightEvent = document.createEvent('Event');
1405
+ var yEvent = document.createEvent('Event');
1406
+ var xEvent = document.createEvent('Event');
1407
+ var xStartEvent = document.createEvent('Event');
1408
+ var xEndEvent = document.createEvent('Event');
1409
+ var yStartEvent = document.createEvent('Event');
1410
+ var yEndEvent = document.createEvent('Event');
1411
+ var lastTop;
1412
+ var lastLeft;
1413
+
1414
+ upEvent.initEvent('ps-scroll-up', true, true);
1415
+ downEvent.initEvent('ps-scroll-down', true, true);
1416
+ leftEvent.initEvent('ps-scroll-left', true, true);
1417
+ rightEvent.initEvent('ps-scroll-right', true, true);
1418
+ yEvent.initEvent('ps-scroll-y', true, true);
1419
+ xEvent.initEvent('ps-scroll-x', true, true);
1420
+ xStartEvent.initEvent('ps-x-reach-start', true, true);
1421
+ xEndEvent.initEvent('ps-x-reach-end', true, true);
1422
+ yStartEvent.initEvent('ps-y-reach-start', true, true);
1423
+ yEndEvent.initEvent('ps-y-reach-end', true, true);
1424
+
1425
+ module.exports = function (element, axis, value) {
1426
+ if (typeof element === 'undefined') {
1427
+ throw 'You must provide an element to the update-scroll function';
1428
+ }
1429
+
1430
+ if (typeof axis === 'undefined') {
1431
+ throw 'You must provide an axis to the update-scroll function';
1432
+ }
1433
+
1434
+ if (typeof value === 'undefined') {
1435
+ throw 'You must provide a value to the update-scroll function';
1436
+ }
1437
+
1438
+ if (axis === 'top' && value <= 0) {
1439
+ element.scrollTop = value = 0; // don't allow negative scroll
1440
+ element.dispatchEvent(yStartEvent);
1441
+ }
1442
+
1443
+ if (axis === 'left' && value <= 0) {
1444
+ element.scrollLeft = value = 0; // don't allow negative scroll
1445
+ element.dispatchEvent(xStartEvent);
1446
+ }
1447
+
1448
+ var i = instances.get(element);
1449
+
1450
+ if (axis === 'top' && value >= i.contentHeight - i.containerHeight) {
1451
+ // don't allow scroll past container
1452
+ value = i.contentHeight - i.containerHeight;
1453
+ if (value - element.scrollTop <= 1) {
1454
+ // mitigates rounding errors on non-subpixel scroll values
1455
+ value = element.scrollTop;
1456
+ } else {
1457
+ element.scrollTop = value;
1458
+ }
1459
+ element.dispatchEvent(yEndEvent);
1460
+ }
1461
+
1462
+ if (axis === 'left' && value >= i.contentWidth - i.containerWidth) {
1463
+ // don't allow scroll past container
1464
+ value = i.contentWidth - i.containerWidth;
1465
+ if (value - element.scrollLeft <= 1) {
1466
+ // mitigates rounding errors on non-subpixel scroll values
1467
+ value = element.scrollLeft;
1468
+ } else {
1469
+ element.scrollLeft = value;
1470
+ }
1471
+ element.dispatchEvent(xEndEvent);
1472
+ }
1473
+
1474
+ if (!lastTop) {
1475
+ lastTop = element.scrollTop;
1476
+ }
1477
+
1478
+ if (!lastLeft) {
1479
+ lastLeft = element.scrollLeft;
1480
+ }
1481
+
1482
+ if (axis === 'top' && value < lastTop) {
1483
+ element.dispatchEvent(upEvent);
1484
+ }
1485
+
1486
+ if (axis === 'top' && value > lastTop) {
1487
+ element.dispatchEvent(downEvent);
1488
+ }
1489
+
1490
+ if (axis === 'left' && value < lastLeft) {
1491
+ element.dispatchEvent(leftEvent);
1492
+ }
1493
+
1494
+ if (axis === 'left' && value > lastLeft) {
1495
+ element.dispatchEvent(rightEvent);
1496
+ }
1497
+
1498
+ if (axis === 'top') {
1499
+ element.scrollTop = lastTop = value;
1500
+ element.dispatchEvent(yEvent);
1501
+ }
1502
+
1503
+ if (axis === 'left') {
1504
+ element.scrollLeft = lastLeft = value;
1505
+ element.dispatchEvent(xEvent);
1506
+ }
1507
+
1508
+ };
1509
+
1510
+ },{"./instances":18}],21:[function(require,module,exports){
1511
+ 'use strict';
1512
+
1513
+ var _ = require('../lib/helper');
1514
+ var dom = require('../lib/dom');
1515
+ var instances = require('./instances');
1516
+ var updateGeometry = require('./update-geometry');
1517
+ var updateScroll = require('./update-scroll');
1518
+
1519
+ module.exports = function (element) {
1520
+ var i = instances.get(element);
1521
+
1522
+ if (!i) {
1523
+ return;
1524
+ }
1525
+
1526
+ // Recalcuate negative scrollLeft adjustment
1527
+ i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0;
1528
+
1529
+ // Recalculate rail margins
1530
+ dom.css(i.scrollbarXRail, 'display', 'block');
1531
+ dom.css(i.scrollbarYRail, 'display', 'block');
1532
+ i.railXMarginWidth = _.toInt(dom.css(i.scrollbarXRail, 'marginLeft')) + _.toInt(dom.css(i.scrollbarXRail, 'marginRight'));
1533
+ i.railYMarginHeight = _.toInt(dom.css(i.scrollbarYRail, 'marginTop')) + _.toInt(dom.css(i.scrollbarYRail, 'marginBottom'));
1534
+
1535
+ // Hide scrollbars not to affect scrollWidth and scrollHeight
1536
+ dom.css(i.scrollbarXRail, 'display', 'none');
1537
+ dom.css(i.scrollbarYRail, 'display', 'none');
1538
+
1539
+ updateGeometry(element);
1540
+
1541
+ // Update top/left scroll to trigger events
1542
+ updateScroll(element, 'top', element.scrollTop);
1543
+ updateScroll(element, 'left', element.scrollLeft);
1544
+
1545
+ dom.css(i.scrollbarXRail, 'display', '');
1546
+ dom.css(i.scrollbarYRail, 'display', '');
1547
+ };
1548
+
1549
+ },{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19,"./update-scroll":20}]},{},[1]);