forked from cmswalker/fullpage-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FullpageReact.js
3621 lines (3007 loc) · 116 KB
/
FullpageReact.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define("FullpageReact", ["react"], factory);
else if(typeof exports === 'object')
exports["FullpageReact"] = factory(require("react"));
else
root["FullpageReact"] = factory(root["react"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 10);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var HorizontalSlide = 'HorizontalSlide';
var VerticalSlide = 'VerticalSlide';
var Slide = function Slide(_ref) {
var id = _ref.id,
render = _ref.render,
className = _ref.className,
width = _ref.width,
height = _ref.height,
horizontal = _ref.horizontal,
horizontalSliderName = _ref.horizontalSliderName,
children = _ref.children,
style = _ref.style;
if (!render) {
return null;
}
var slideStyle = style || {};
var styles = Object.assign({
overflow: 'hidden', width: width + 'px', height: height + 'px', position: 'relative'
}, slideStyle);
var slideClassName = horizontal ? [HorizontalSlide] : [VerticalSlide];
if (className) {
slideClassName.push(className);
}
slideClassName = slideClassName.join(' ');
var attrs = {
'data-slide': horizontal ? HorizontalSlide : VerticalSlide,
'data-horizontal-slider': horizontalSliderName || null
};
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
_extends({ className: slideClassName, id: id }, attrs, { style: styles }),
children
);
};
/* harmony default export */ __webpack_exports__["a"] = (Slide);
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (process.env.NODE_ENV !== 'production') {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 6 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Slide__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(7);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var HorizontalSlider = function (_React$Component) {
_inherits(HorizontalSlider, _React$Component);
function HorizontalSlider(props) {
_classCallCheck(this, HorizontalSlider);
var _this = _possibleConstructorReturn(this, (HorizontalSlider.__proto__ || Object.getPrototypeOf(HorizontalSlider)).call(this, props));
_this.name = _this.props.name;
return _this;
}
_createClass(HorizontalSlider, [{
key: 'componentDidMount',
value: function componentDidMount() {
var _props = this.props,
activeSlide = _props.activeSlide,
document = _props.document,
name = _props.name,
cache = _props.cache;
cache(this);
var nodes = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils__["a" /* getNodes */])(document, 'data-horizontal-slider="' + name + '"');
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils__["b" /* hideAllButActive */])(activeSlide, nodes);
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
var p = this.props;
var name = p.name,
children = p.children,
height = p.height,
width = p.width;
if (!name) {
throw new Error('name is a required prop for HorizontalSlider');
}
var elements = p.slides.reduce(function (result, sl) {
if (!sl) {
return result;
}
if (typeof sl.type !== 'function') {
result.other.push(sl);
} else {
result.slides.push(sl);
}
return result;
}, { slides: [], other: [] });
var other = elements.other,
slides = elements.slides;
var attrs = {
'data-slide': 'HorizontalSlider',
'data-name': name
};
var className = (p.className || '') + 'HorizontalSlider';
var overflowX = p.hideScrollBars ? 'hidden' : 'auto';
var overflowY = overflowX;
var horizontalSliderStyle = Object.assign({}, p.style, { height: height + 'px', width: width + 'px', position: 'relative', overflowX: overflowX, overflowY: overflowY, whiteSpace: 'nowrap', padding: '0px', margin: '0' });
var horizontalSlideStyle = { overflow: 'hidden', whiteSpace: 'normal', display: 'inline-block' };
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
_extends({ ref: function ref(node) {
return _this2.node = node;
}, className: className, id: p.id }, attrs, { style: horizontalSliderStyle }),
other.map(function (o, i) {
var p = o.props || {};
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', _extends({ key: i }, p));
}),
slides.map(function (s, i) {
if (!s) {
return null;
}
var sStyle = Object.assign({}, horizontalSlideStyle, slideStyle);
var hSlideProps = s.props || {};
var slideStyle = hSlideProps.style || {};
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
__WEBPACK_IMPORTED_MODULE_1__Slide__["a" /* default */],
_extends({ render: true, key: i, horizontalSliderName: name, slide: s, id: hSlideProps.id, className: hSlideProps.className || '', height: height, width: width, horizontal: true, style: sStyle }, hSlideProps),
hSlideProps.children
);
}),
children
);
}
}]);
return HorizontalSlider;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
/* harmony default export */ __webpack_exports__["a"] = (HorizontalSlider);
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return composedPath; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return showAll; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hideAllButActive; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return INTENT_MAP; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getNodes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return detectBrowser; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__renderUtils__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scrollTo__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__detectOS_js__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__detectOS_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__detectOS_js__);
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_2__constants__; });
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__renderUtils__; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_1__scrollTo__["a"]; });
function composedPath(el) {
var paths = [];
while (el) {
paths.push(el);
if (el.tagName === 'HTML') {
paths.push(document);
paths.push(window);
return paths;
}
el = el.parentElement;
}
return paths;
}
function getNodes(document, sel) {
return document.querySelectorAll('[' + sel + ']');
}
function hideAllButActive(activeSlide, nodes) {
Array.prototype.forEach.call(nodes, function (n, i) {
if (i === activeSlide) {
n.style.display = 'inline-block';
} else {
n.style.display = 'none';
}
});
}
function showAll(nodes) {
Array.prototype.forEach.call(nodes, function (n) {
n.style.display = 'inline-block';
});
}
var INTENT_MAP = {
'VERTICAL': {
0: 'UP',
1: 'DOWN'
},
'HORIZONTAL': {
0: 'LEFT',
1: 'RIGHT'
}
};
function detectBrowser(userAgentString) {
if (!userAgentString) {
return null;
}
var browsers = [['edge', /Edge\/([0-9\._]+)/], ['yandexbrowser', /YaBrowser\/([0-9\._]+)/], ['vivaldi', /Vivaldi\/([0-9\.]+)/], ['kakaotalk', /KAKAOTALK\s([0-9\.]+)/], ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], ['phantomjs', /PhantomJS\/([0-9\.]+)(:?\s|$)/], ['crios', /CriOS\/([0-9\.]+)(:?\s|$)/], ['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/], ['fxios', /FxiOS\/([0-9\.]+)/], ['opera', /Opera\/([0-9\.]+)(?:\s|$)/], ['opera', /OPR\/([0-9\.]+)(:?\s|$)$/], ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/], ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], ['ie', /MSIE\s(7\.0)/], ['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/], ['android', /Android\s([0-9\.]+)/], ['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/], ['safari', /Version\/([0-9\._]+).*Safari/]];
return browsers.map(function (rule) {
if (rule[1].test(userAgentString)) {
var match = rule[1].exec(userAgentString);
var version = match && match[1].split(/[._]/).slice(0, 3);
if (version && version.length < 3) {
Array.prototype.push.apply(version, version.length == 1 ? [0, 0] : [0]);
}
return {
name: rule[0],
version: version.join('.'),
os: __WEBPACK_IMPORTED_MODULE_3__detectOS_js___default()(userAgentString)
};
}
}).filter(Boolean).shift();
}
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var emptyFunction = __webpack_require__(3);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
module.exports = warning;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_scroll_swipe__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_scroll_swipe___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_scroll_swipe__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_window_or_global__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_window_or_global___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_window_or_global__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_react_fns__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Slide__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HorizontalSlider__ = __webpack_require__(6);
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var noOp = __WEBPACK_IMPORTED_MODULE_4__utils__["c" /* constants */].noOp;
var KEY_IDX = __WEBPACK_IMPORTED_MODULE_4__utils__["d" /* renderUtils */].KEY_IDX;
var _fp = {};
var global = {};
var TIMEOUT = 200;
var documentStub = function documentStub() {
var style = {};
return {
querySelectorAll: function querySelectorAll() {
return [__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', null)];
},
documentElement: {
style: style
},
body: {
style: style
}
};
};
function generateState() {
var activeSlide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
return {
activeSlide: activeSlide,
lastActive: activeSlide - 1
};
}
var Fullpage = function (_React$Component) {
_inherits(Fullpage, _React$Component);
function Fullpage(props) {
_classCallCheck(this, Fullpage);
var _this = _possibleConstructorReturn(this, (Fullpage.__proto__ || Object.getPrototypeOf(Fullpage)).call(this, props));
var p = _this.props;
global.window = __WEBPACK_IMPORTED_MODULE_2_window_or_global___default.a;
global.document = global.window.document || documentStub();
if (p.infinite && p.resetSlides) {
throw new Error('Fullpage Component cannot have both infinite and resetSlides as truthy props');
}
var slides = p.slides;
if (!slides || !slides.length) {
throw new Error('Please provide slides for Fullpage');
}
var horizontalMap = {};
// generate state for horizontals;
var horizontals = slides.reduce(function (result, s, i) {
var name = s.props.name;
if (s.props.slides && name) {
result[name] = generateState(0);
horizontalMap[i] = name;
}
return result;
}, {});
horizontals.horizontalMap = horizontalMap;
var _p$activeSlide = p.activeSlide,
activeSlide = _p$activeSlide === undefined ? 0 : _p$activeSlide,
scrollSensitivity = p.scrollSensitivity,
touchSensitivity = p.touchSensitivity,
_p$scrollSpeed = p.scrollSpeed,
scrollSpeed = _p$scrollSpeed === undefined ? 500 : _p$scrollSpeed;
_this.name = 'Fullpage';
_this.scrollSensitivity = scrollSensitivity;
_this.touchSensitivity = touchSensitivity;
_this.scrollSpeed = scrollSpeed;
_this.node = null;
_this.ss = null;
_this.verticalRoot = determineVerticalRoot();
_this.onHorizontalChange = p.onHorizontalChange || noOp;
_this.onSlideChangeStart = p.onSlideChangeStart || noOp;
_this.onSlideChangeEnd = p.onSlideChangeEnd || noOp;
['onScrollAction', 'onVerticalScroll', 'onHorizontalScroll', 'lockScroll', 'handleScroll', 'checkKey'].forEach(function (f) {
return _this[f] = _this[f].bind(_this);
});
_this.isLocked = false;
_this.hSlideCache = {};
_this.cacheHslide = function (slide) {
_this.hSlideCache[slide.name] = slide;
};
_fp = _this;
_this.state = Object.assign({
scrollPending: false,
window: null,
document: null
}, horizontals, generateState(activeSlide));
return _this;
}
_createClass(Fullpage, [{
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
this.hideScrollBars();
this.window = global.window;
this.document = global.document;
this.setState({
window: global.window,
document: global.document
}, function () {
_this2.lockScroll();
});
}
}, {
key: 'hideScrollBars',
value: function hideScrollBars() {
var hideScrollBars = this.props.hideScrollBars;
if (!hideScrollBars) {
return;
}
var document = global.document;
document.documentElement.style.overflow = 'hidden';
document.body.style.overflow = 'hidden';
}
}, {
key: 'showScrollBars',
value: function showScrollBars() {
var document = global.document;
document.documentElement.style.overflow = 'auto';
document.body.style.overflow = 'auto';
}
}, {
key: 'lockScroll',
value: function lockScroll() {
var node = this.node,
checkKey = this.checkKey;
var enableArrowKeys = this.props.enableArrowKeys;
if (enableArrowKeys) {
window.addEventListener('keydown', checkKey.bind(this));
}
var ss = new __WEBPACK_IMPORTED_MODULE_1_scroll_swipe___default.a({
target: node,
scrollSensitivity: this.scrollSensitivity,
touchSensitivity: this.touchSensitivity,
scrollPreventDefault: true,
touchPreventDefault: true,
scrollCb: this.onScrollAction,
touchCb: this.onScrollAction
});
this.ss = ss;
this.isLocked = true;
}
}, {
key: 'onScrollAction',
value: function onScrollAction(_ref) {
var direction = _ref.direction,
intent = _ref.intent,
startEvent = _ref.startEvent;
var s = this.state;
var _ss = this.ss,
ss = _ss === undefined ? ssStub() : _ss;
if (s.scrollPending) {
ss.flush();
return ss.listen();
}
var dir = __WEBPACK_IMPORTED_MODULE_4__utils__["e" /* INTENT_MAP */][direction];
// at this point we are dedicating
if (direction === 'VERTICAL') {
return this.onVerticalScroll(dir[intent], startEvent);
}
var path = startEvent.path || startEvent.composedPath();
if (!path) {
var polyFillPath = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__utils__["f" /* composedPath */])(startEvent.target);
path = polyFillPath;
}
var isHorizontal = path.find(function (p) {
if (!p.dataset) {
return false;
}