intia-theme 0.1.0 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/hero.html +5 -3
  3. data/_includes/introduction.html +1 -1
  4. data/_includes/story-slider.html +1 -1
  5. data/_layouts/404.html +7 -0
  6. data/_sass/_layout.scss +40 -11
  7. data/_sass/_main.scss +32 -11
  8. data/assets/img/404.png +0 -0
  9. data/assets/img/arrow-down.png +0 -0
  10. data/assets/img/arrow-left.png +0 -0
  11. data/assets/js/main.js +4 -1
  12. data/favicon.png +0 -0
  13. data/node_modules/bulma/CHANGELOG.md +1558 -0
  14. data/node_modules/bulma/LICENSE +21 -0
  15. data/node_modules/bulma/README.md +134 -0
  16. data/node_modules/bulma/bulma.sass +10 -0
  17. data/node_modules/bulma/css/bulma-rtl.css +11811 -0
  18. data/node_modules/bulma/css/bulma-rtl.css.map +1 -0
  19. data/node_modules/bulma/css/bulma-rtl.min.css +1 -0
  20. data/node_modules/bulma/css/bulma.css +11811 -0
  21. data/node_modules/bulma/css/bulma.css.map +1 -0
  22. data/node_modules/bulma/css/bulma.min.css +1 -0
  23. data/node_modules/bulma/package.json +82 -0
  24. data/node_modules/bulma/sass/base/_all.sass +6 -0
  25. data/node_modules/bulma/sass/base/animations.sass +5 -0
  26. data/node_modules/bulma/sass/base/generic.sass +145 -0
  27. data/node_modules/bulma/sass/base/helpers.sass +1 -0
  28. data/node_modules/bulma/sass/base/minireset.sass +79 -0
  29. data/node_modules/bulma/sass/components/_all.sass +15 -0
  30. data/node_modules/bulma/sass/components/breadcrumb.sass +77 -0
  31. data/node_modules/bulma/sass/components/card.sass +103 -0
  32. data/node_modules/bulma/sass/components/dropdown.sass +83 -0
  33. data/node_modules/bulma/sass/components/level.sass +79 -0
  34. data/node_modules/bulma/sass/components/media.sass +59 -0
  35. data/node_modules/bulma/sass/components/menu.sass +59 -0
  36. data/node_modules/bulma/sass/components/message.sass +101 -0
  37. data/node_modules/bulma/sass/components/modal.sass +117 -0
  38. data/node_modules/bulma/sass/components/navbar.sass +446 -0
  39. data/node_modules/bulma/sass/components/pagination.sass +166 -0
  40. data/node_modules/bulma/sass/components/panel.sass +121 -0
  41. data/node_modules/bulma/sass/components/tabs.sass +176 -0
  42. data/node_modules/bulma/sass/elements/_all.sass +16 -0
  43. data/node_modules/bulma/sass/elements/box.sass +26 -0
  44. data/node_modules/bulma/sass/elements/button.sass +345 -0
  45. data/node_modules/bulma/sass/elements/container.sass +29 -0
  46. data/node_modules/bulma/sass/elements/content.sass +159 -0
  47. data/node_modules/bulma/sass/elements/form.sass +1 -0
  48. data/node_modules/bulma/sass/elements/icon.sass +46 -0
  49. data/node_modules/bulma/sass/elements/image.sass +73 -0
  50. data/node_modules/bulma/sass/elements/notification.sass +52 -0
  51. data/node_modules/bulma/sass/elements/other.sass +31 -0
  52. data/node_modules/bulma/sass/elements/progress.sass +73 -0
  53. data/node_modules/bulma/sass/elements/table.sass +133 -0
  54. data/node_modules/bulma/sass/elements/tag.sass +140 -0
  55. data/node_modules/bulma/sass/elements/title.sass +70 -0
  56. data/node_modules/bulma/sass/form/_all.sass +9 -0
  57. data/node_modules/bulma/sass/form/checkbox-radio.sass +22 -0
  58. data/node_modules/bulma/sass/form/file.sass +184 -0
  59. data/node_modules/bulma/sass/form/input-textarea.sass +66 -0
  60. data/node_modules/bulma/sass/form/select.sass +87 -0
  61. data/node_modules/bulma/sass/form/shared.sass +60 -0
  62. data/node_modules/bulma/sass/form/tools.sass +215 -0
  63. data/node_modules/bulma/sass/grid/_all.sass +5 -0
  64. data/node_modules/bulma/sass/grid/columns.sass +513 -0
  65. data/node_modules/bulma/sass/grid/tiles.sass +36 -0
  66. data/node_modules/bulma/sass/helpers/_all.sass +12 -0
  67. data/node_modules/bulma/sass/helpers/color.sass +39 -0
  68. data/node_modules/bulma/sass/helpers/flexbox.sass +35 -0
  69. data/node_modules/bulma/sass/helpers/float.sass +10 -0
  70. data/node_modules/bulma/sass/helpers/other.sass +14 -0
  71. data/node_modules/bulma/sass/helpers/overflow.sass +2 -0
  72. data/node_modules/bulma/sass/helpers/position.sass +7 -0
  73. data/node_modules/bulma/sass/helpers/spacing.sass +31 -0
  74. data/node_modules/bulma/sass/helpers/typography.sass +103 -0
  75. data/node_modules/bulma/sass/helpers/visibility.sass +122 -0
  76. data/node_modules/bulma/sass/layout/_all.sass +6 -0
  77. data/node_modules/bulma/sass/layout/footer.sass +11 -0
  78. data/node_modules/bulma/sass/layout/hero.sass +153 -0
  79. data/node_modules/bulma/sass/layout/section.sass +17 -0
  80. data/node_modules/bulma/sass/utilities/_all.sass +9 -0
  81. data/node_modules/bulma/sass/utilities/animations.sass +1 -0
  82. data/node_modules/bulma/sass/utilities/controls.sass +49 -0
  83. data/node_modules/bulma/sass/utilities/derived-variables.sass +114 -0
  84. data/node_modules/bulma/sass/utilities/extends.sass +25 -0
  85. data/node_modules/bulma/sass/utilities/functions.sass +136 -0
  86. data/node_modules/bulma/sass/utilities/initial-variables.sass +78 -0
  87. data/node_modules/bulma/sass/utilities/mixins.sass +280 -0
  88. data/node_modules/bulma-block-list/LICENSE.txt +21 -0
  89. data/node_modules/bulma-block-list/README.md +32 -0
  90. data/node_modules/bulma-block-list/node_modules/bulma/CHANGELOG.md +1390 -0
  91. data/node_modules/bulma-block-list/node_modules/bulma/LICENSE +21 -0
  92. data/node_modules/bulma-block-list/node_modules/bulma/README.md +130 -0
  93. data/node_modules/bulma-block-list/node_modules/bulma/bulma.sass +9 -0
  94. data/node_modules/bulma-block-list/node_modules/bulma/css/bulma.css +10855 -0
  95. data/node_modules/bulma-block-list/node_modules/bulma/css/bulma.css.map +1 -0
  96. data/node_modules/bulma-block-list/node_modules/bulma/css/bulma.min.css +1 -0
  97. data/node_modules/bulma-block-list/node_modules/bulma/package.json +80 -0
  98. data/node_modules/bulma-block-list/node_modules/bulma/sass/base/_all.sass +5 -0
  99. data/node_modules/bulma-block-list/node_modules/bulma/sass/base/generic.sass +142 -0
  100. data/node_modules/bulma-block-list/node_modules/bulma/sass/base/helpers.sass +281 -0
  101. data/node_modules/bulma-block-list/node_modules/bulma/sass/base/minireset.sass +79 -0
  102. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/_all.sass +15 -0
  103. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/breadcrumb.sass +75 -0
  104. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/card.sass +79 -0
  105. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/dropdown.sass +81 -0
  106. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/level.sass +77 -0
  107. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/list.sass +39 -0
  108. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/media.sass +50 -0
  109. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/menu.sass +57 -0
  110. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/message.sass +99 -0
  111. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/modal.sass +113 -0
  112. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/navbar.sass +441 -0
  113. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/pagination.sass +150 -0
  114. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/panel.sass +119 -0
  115. data/node_modules/bulma-block-list/node_modules/bulma/sass/components/tabs.sass +151 -0
  116. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/_all.sass +15 -0
  117. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/box.sass +24 -0
  118. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/button.sass +323 -0
  119. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/container.sass +24 -0
  120. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/content.sass +155 -0
  121. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/form.sass +1 -0
  122. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/icon.sass +21 -0
  123. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/image.sass +71 -0
  124. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/notification.sass +43 -0
  125. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/other.sass +39 -0
  126. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/progress.sass +67 -0
  127. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/table.sass +127 -0
  128. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/tag.sass +128 -0
  129. data/node_modules/bulma-block-list/node_modules/bulma/sass/elements/title.sass +70 -0
  130. data/node_modules/bulma-block-list/node_modules/bulma/sass/form/_all.sass +8 -0
  131. data/node_modules/bulma-block-list/node_modules/bulma/sass/form/checkbox-radio.sass +21 -0
  132. data/node_modules/bulma-block-list/node_modules/bulma/sass/form/file.sass +180 -0
  133. data/node_modules/bulma-block-list/node_modules/bulma/sass/form/input-textarea.sass +64 -0
  134. data/node_modules/bulma-block-list/node_modules/bulma/sass/form/select.sass +85 -0
  135. data/node_modules/bulma-block-list/node_modules/bulma/sass/form/shared.sass +55 -0
  136. data/node_modules/bulma-block-list/node_modules/bulma/sass/form/tools.sass +205 -0
  137. data/node_modules/bulma-block-list/node_modules/bulma/sass/grid/_all.sass +4 -0
  138. data/node_modules/bulma-block-list/node_modules/bulma/sass/grid/columns.sass +504 -0
  139. data/node_modules/bulma-block-list/node_modules/bulma/sass/grid/tiles.sass +34 -0
  140. data/node_modules/bulma-block-list/node_modules/bulma/sass/layout/_all.sass +5 -0
  141. data/node_modules/bulma-block-list/node_modules/bulma/sass/layout/footer.sass +9 -0
  142. data/node_modules/bulma-block-list/node_modules/bulma/sass/layout/hero.sass +145 -0
  143. data/node_modules/bulma-block-list/node_modules/bulma/sass/layout/section.sass +13 -0
  144. data/node_modules/bulma-block-list/node_modules/bulma/sass/utilities/_all.sass +8 -0
  145. data/node_modules/bulma-block-list/node_modules/bulma/sass/utilities/animations.sass +5 -0
  146. data/node_modules/bulma-block-list/node_modules/bulma/sass/utilities/controls.sass +50 -0
  147. data/node_modules/bulma-block-list/node_modules/bulma/sass/utilities/derived-variables.sass +106 -0
  148. data/node_modules/bulma-block-list/node_modules/bulma/sass/utilities/functions.sass +110 -0
  149. data/node_modules/bulma-block-list/node_modules/bulma/sass/utilities/initial-variables.sass +77 -0
  150. data/node_modules/bulma-block-list/node_modules/bulma/sass/utilities/mixins.sass +261 -0
  151. data/node_modules/bulma-block-list/package.json +59 -0
  152. data/node_modules/bulma-block-list/src/block-list.scss +109 -0
  153. data/node_modules/bulma-block-list/src/demo.scss +3 -0
  154. data/node_modules/bulma-carousel/CHANGELOG.md +307 -0
  155. data/node_modules/bulma-carousel/LICENSE +21 -0
  156. data/node_modules/bulma-carousel/README.md +13 -0
  157. data/node_modules/bulma-carousel/dist/css/bulma-carousel.min.css +1 -0
  158. data/node_modules/bulma-carousel/dist/js/bulma-carousel.js +2371 -0
  159. data/node_modules/bulma-carousel/package.json +108 -0
  160. data/node_modules/bulma-carousel/src/demo/_data/events.yml +15 -0
  161. data/node_modules/bulma-carousel/src/demo/_data/getters.yml +26 -0
  162. data/node_modules/bulma-carousel/src/demo/_data/menu.yml +26 -0
  163. data/node_modules/bulma-carousel/src/demo/_data/methods.yml +57 -0
  164. data/node_modules/bulma-carousel/src/demo/_data/options.yml +79 -0
  165. data/node_modules/bulma-carousel/src/demo/_data/setters.yml +0 -0
  166. data/node_modules/bulma-carousel/src/demo/_data/tree.yml +30 -0
  167. data/node_modules/bulma-carousel/src/demo/_includes/anchor.html +3 -0
  168. data/node_modules/bulma-carousel/src/demo/_includes/breadcrumb.html +5 -0
  169. data/node_modules/bulma-carousel/src/demo/_includes/events.html +33 -0
  170. data/node_modules/bulma-carousel/src/demo/_includes/getters.html +28 -0
  171. data/node_modules/bulma-carousel/src/demo/_includes/head.html +22 -0
  172. data/node_modules/bulma-carousel/src/demo/_includes/menu.html +22 -0
  173. data/node_modules/bulma-carousel/src/demo/_includes/methods.html +49 -0
  174. data/node_modules/bulma-carousel/src/demo/_includes/options.html +33 -0
  175. data/node_modules/bulma-carousel/src/demo/_includes/setters.html +28 -0
  176. data/node_modules/bulma-carousel/src/demo/_includes/tree.html +25 -0
  177. data/node_modules/bulma-carousel/src/demo/_includes/variables.html +28 -0
  178. data/node_modules/bulma-carousel/src/demo/_layouts/default.html +47 -0
  179. data/node_modules/bulma-carousel/src/demo/assets/css/bulma-carousel.min.css +1 -0
  180. data/node_modules/bulma-carousel/src/demo/assets/css/documentation.min.css +1 -0
  181. data/node_modules/bulma-carousel/src/demo/assets/css/highlight.css +78 -0
  182. data/node_modules/bulma-carousel/src/demo/assets/images/1.jpg +0 -0
  183. data/node_modules/bulma-carousel/src/demo/assets/images/2.jpg +0 -0
  184. data/node_modules/bulma-carousel/src/demo/assets/images/3.jpg +0 -0
  185. data/node_modules/bulma-carousel/src/demo/assets/images/4.jpg +0 -0
  186. data/node_modules/bulma-carousel/src/demo/assets/images/5.jpg +0 -0
  187. data/node_modules/bulma-carousel/src/demo/assets/images/6.jpg +0 -0
  188. data/node_modules/bulma-carousel/src/demo/assets/images/left.svg +3 -0
  189. data/node_modules/bulma-carousel/src/demo/assets/images/right.svg +3 -0
  190. data/node_modules/bulma-carousel/src/demo/assets/js/bulma-carousel.min.js +1 -0
  191. data/node_modules/bulma-carousel/src/demo/assets/js/doc.js +111 -0
  192. data/node_modules/bulma-carousel/src/demo/assets/js/main.js +23 -0
  193. data/node_modules/bulma-carousel/src/demo/changelog.html +17 -0
  194. data/node_modules/bulma-carousel/src/demo/customization.html +78 -0
  195. data/node_modules/bulma-carousel/src/demo/demonstration/index.html +402 -0
  196. data/node_modules/bulma-carousel/src/demo/index.html +396 -0
  197. data/node_modules/bulma-carousel/src/js/components/Media.js +129 -0
  198. data/node_modules/bulma-carousel/src/js/components/autoplay.js +111 -0
  199. data/node_modules/bulma-carousel/src/js/components/breakpoint.js +91 -0
  200. data/node_modules/bulma-carousel/src/js/components/infinite.js +60 -0
  201. data/node_modules/bulma-carousel/src/js/components/loop.js +35 -0
  202. data/node_modules/bulma-carousel/src/js/components/navigation.js +107 -0
  203. data/node_modules/bulma-carousel/src/js/components/pagination.js +103 -0
  204. data/node_modules/bulma-carousel/src/js/components/swipe.js +106 -0
  205. data/node_modules/bulma-carousel/src/js/components/transitioner.js +74 -0
  206. data/node_modules/bulma-carousel/src/js/components/transitions/fade.js +90 -0
  207. data/node_modules/bulma-carousel/src/js/components/transitions/translate.js +98 -0
  208. data/node_modules/bulma-carousel/src/js/defaultOptions.js +50 -0
  209. data/node_modules/bulma-carousel/src/js/index.js +428 -0
  210. data/node_modules/bulma-carousel/src/js/templates/index.js +5 -0
  211. data/node_modules/bulma-carousel/src/js/templates/item.js +3 -0
  212. data/node_modules/bulma-carousel/src/js/templates/navigation.js +4 -0
  213. data/node_modules/bulma-carousel/src/js/templates/pagination-page.js +3 -0
  214. data/node_modules/bulma-carousel/src/js/templates/pagination.js +3 -0
  215. data/node_modules/bulma-carousel/src/js/utils/coordinate.js +98 -0
  216. data/node_modules/bulma-carousel/src/js/utils/css.js +84 -0
  217. data/node_modules/bulma-carousel/src/js/utils/detect-prefixes.js +50 -0
  218. data/node_modules/bulma-carousel/src/js/utils/detect-supportsPassive.js +16 -0
  219. data/node_modules/bulma-carousel/src/js/utils/device.js +17 -0
  220. data/node_modules/bulma-carousel/src/js/utils/dom.js +10 -0
  221. data/node_modules/bulma-carousel/src/js/utils/eventEmitter.js +19 -0
  222. data/node_modules/bulma-carousel/src/js/utils/events.js +65 -0
  223. data/node_modules/bulma-carousel/src/js/utils/index.js +16 -0
  224. data/node_modules/bulma-carousel/src/js/utils/type.js +21 -0
  225. data/node_modules/bulma-carousel/src/sass/index.sass +145 -0
  226. data/package-lock.json +32 -0
  227. data/package.json +10 -0
  228. metadata +222 -4
  229. data/_config.yml +0 -72
  230. data/assets/img/arrow.png +0 -0
@@ -0,0 +1,91 @@
1
+ const onResize = Symbol('onResize');
2
+
3
+ export default class Breakpoints {
4
+ constructor(slider) {
5
+ this.slider = slider;
6
+ this.options = slider.options;
7
+
8
+ this[onResize] = this[onResize].bind(this);
9
+
10
+ this._bindEvents();
11
+ }
12
+
13
+ init() {
14
+ this._defaultBreakpoint = {
15
+ slidesToShow: this.options.slidesToShow,
16
+ slidesToScroll: this.options.slidesToScroll
17
+ };
18
+ this.options.breakpoints.sort(function (a, b) {
19
+ return parseInt(a.changePoint, 10) > parseInt(b.changePoint, 10);
20
+ });
21
+ this._currentBreakpoint = this._getActiveBreakpoint();
22
+
23
+ return this;
24
+ }
25
+
26
+ destroy() {
27
+ this._unbindEvents();
28
+ }
29
+
30
+ _bindEvents() {
31
+ window.addEventListener('resize', this[onResize]);
32
+ window.addEventListener('orientationchange', this[onResize]);
33
+ }
34
+
35
+ _unbindEvents() {
36
+ window.removeEventListener('resize', this[onResize]);
37
+ window.removeEventListener('orientationchange', this[onResize]);
38
+ }
39
+
40
+ _getActiveBreakpoint() {
41
+ //Get breakpoint for window width
42
+ for (let point of this.options.breakpoints) {
43
+ if (point.changePoint >= window.innerWidth) {
44
+ return point;
45
+ }
46
+ }
47
+ return this._defaultBreakpoint;
48
+ }
49
+
50
+ getSlidesToShow() {
51
+ return this._currentBreakpoint ? this._currentBreakpoint.slidesToShow : this._defaultBreakpoint.slidesToShow;
52
+ }
53
+
54
+ getSlidesToScroll() {
55
+ return this._currentBreakpoint ? this._currentBreakpoint.slidesToScroll : this._defaultBreakpoint.slidesToScroll;
56
+ }
57
+
58
+ apply() {
59
+ if (this.slider.state.index >= this.slider.state.length && this.slider.state.index !== 0) {
60
+ this.slider.state.index = this.slider.state.index - this._currentBreakpoint.slidesToScroll;
61
+ }
62
+ if (this.slider.state.length <= this._currentBreakpoint.slidesToShow) {
63
+ this.slider.state.index = 0;
64
+ }
65
+
66
+ if (this.options.loop) {
67
+ this.slider._loop.init().apply();
68
+ }
69
+
70
+ if (this.options.infinite) {
71
+ this.slider._infinite.init().apply();
72
+ }
73
+
74
+ this.slider._setDimensions();
75
+ this.slider._transitioner.init().apply(true, this.slider._setHeight.bind(this.slider));
76
+ this.slider._setClasses();
77
+
78
+ this.slider._navigation.refresh();
79
+ this.slider._pagination.refresh();
80
+ }
81
+
82
+ [onResize](e) {
83
+ let newBreakPoint = this._getActiveBreakpoint();
84
+ if (newBreakPoint.slidesToShow !== this._currentBreakpoint.slidesToShow) {
85
+ this._currentBreakpoint = newBreakPoint;
86
+ this.apply();
87
+ } else {
88
+ this.slider._setDimensions();
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,60 @@
1
+ export default class Infinite {
2
+ constructor(slider) {
3
+ this.slider = slider;
4
+ }
5
+
6
+ init() {
7
+ if (this.slider.options.infinite && this.slider.options.effect === 'translate') {
8
+ if (this.slider.options.centerMode) {
9
+ this._infiniteCount = Math.ceil(this.slider.slidesToShow + (this.slider.slidesToShow / 2));
10
+ } else {
11
+ this._infiniteCount = this.slider.slidesToShow;
12
+ }
13
+
14
+ let frontClones = [];
15
+ let slideIndex = 0;
16
+ for (let i = this.slider.state.length; i > (this.slider.state.length - 1 - this._infiniteCount); i -= 1) {
17
+ slideIndex = (this.slider.state.length * Math.floor(this._infiniteCount / this.slider.state.length) + i - 1) % this.slider.state.length;
18
+ frontClones.unshift(this._cloneSlide(this.slider.slides[slideIndex], slideIndex - this.slider.state.length));
19
+ }
20
+
21
+ let backClones = [];
22
+ for (let i = 0; i < this._infiniteCount + this.slider.state.length; i += 1) {
23
+ backClones.push(this._cloneSlide(this.slider.slides[i % this.slider.state.length], i + this.slider.state.length));
24
+ }
25
+
26
+ this.slider.slides = [
27
+ ...frontClones,
28
+ ...this.slider.slides,
29
+ ...backClones
30
+ ];
31
+ }
32
+ return this;
33
+ }
34
+
35
+ apply() {
36
+ }
37
+
38
+ onTransitionEnd(e) {
39
+ if (this.slider.options.infinite) {
40
+ if (this.slider.state.next >= this.slider.state.length) {
41
+ this.slider.state.index = this.slider.state.next = this.slider.state.next - this.slider.state.length;
42
+ this.slider.transitioner.apply(true);
43
+ } else if (this.slider.state.next < 0) {
44
+ this.slider.state.index = this.slider.state.next = this.slider.state.length + this.slider.state.next;
45
+ this.slider.transitioner.apply(true);
46
+ }
47
+ }
48
+ }
49
+
50
+ _cloneSlide(slide, index) {
51
+ const newSlide = slide.cloneNode(true);
52
+ newSlide.dataset.sliderIndex = index;
53
+ newSlide.dataset.cloned = true;
54
+ const ids = newSlide.querySelectorAll('[id]') || [];
55
+ ids.forEach(id => {
56
+ id.setAttribute('id', '');
57
+ });
58
+ return newSlide;
59
+ }
60
+ }
@@ -0,0 +1,35 @@
1
+ import {
2
+ isInViewport
3
+ } from "../utils/dom";
4
+
5
+ export default class Loop {
6
+ constructor(slider) {
7
+ this.slider = slider;
8
+ }
9
+
10
+ init() {
11
+ return this;
12
+ }
13
+
14
+ apply() {
15
+ if (this.slider.options.loop) {
16
+ if (this.slider.state.next > 0) {
17
+ if (this.slider.state.next < this.slider.state.length) {
18
+ if (this.slider.state.next > this.slider.state.length - this.slider.slidesToShow && isInViewport(this.slider._slides[this.slider.state.length - 1], this.slider.wrapper)) {
19
+ this.slider.state.next = 0;
20
+ } else {
21
+ this.slider.state.next = Math.min(Math.max(this.slider.state.next, 0), this.slider.state.length - this.slider.slidesToShow);
22
+ }
23
+ } else {
24
+ this.slider.state.next = 0;
25
+ }
26
+ } else {
27
+ if (this.slider.state.next <= 0 - (this.slider.slidesToScroll)) {
28
+ this.slider.state.next = this.slider.state.length - this.slider.slidesToShow;
29
+ } else {
30
+ this.slider.state.next = 0;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,107 @@
1
+ import template from '../templates/navigation';
2
+ import detectSupportsPassive from '../utils/detect-supportsPassive';
3
+
4
+ export default class Navigation {
5
+ constructor(slider) {
6
+ this.slider = slider;
7
+
8
+ this._clickEvents = ['click', 'touch'];
9
+ this._supportsPassive = detectSupportsPassive();
10
+
11
+ this.onPreviousClick = this.onPreviousClick.bind(this);
12
+ this.onNextClick = this.onNextClick.bind(this);
13
+ this.onKeyUp = this.onKeyUp.bind(this);
14
+ }
15
+
16
+ init() {
17
+ this.node = document.createRange().createContextualFragment(template(this.slider.options.icons));
18
+ this._ui = {
19
+ previous: this.node.querySelector('.slider-navigation-previous'),
20
+ next: this.node.querySelector('.slider-navigation-next')
21
+ };
22
+
23
+ this._unbindEvents();
24
+ this._bindEvents();
25
+
26
+ this.refresh();
27
+
28
+ return this;
29
+ }
30
+
31
+ destroy() {
32
+ this._unbindEvents();
33
+ }
34
+
35
+ _bindEvents() {
36
+ this.slider.wrapper.addEventListener('keyup', this.onKeyUp);
37
+ this._clickEvents.forEach(clickEvent => {
38
+ this._ui.previous.addEventListener(clickEvent, this.onPreviousClick);
39
+ this._ui.next.addEventListener(clickEvent, this.onNextClick);
40
+ });
41
+ }
42
+
43
+ _unbindEvents() {
44
+ this.slider.wrapper.removeEventListener('keyup', this.onKeyUp);
45
+ this._clickEvents.forEach(clickEvent => {
46
+ this._ui.previous.removeEventListener(clickEvent, this.onPreviousClick);
47
+ this._ui.next.removeEventListener(clickEvent, this.onNextClick);
48
+ });
49
+ }
50
+
51
+ onNextClick(e) {
52
+ if (!this._supportsPassive) {
53
+ e.preventDefault();
54
+ }
55
+
56
+ if (this.slider.options.navigation) {
57
+ this.slider.next();
58
+ }
59
+ }
60
+
61
+ onPreviousClick(e) {
62
+ if (!this._supportsPassive) {
63
+ e.preventDefault();
64
+ }
65
+
66
+ if (this.slider.options.navigation) {
67
+ this.slider.previous();
68
+ }
69
+ }
70
+
71
+ onKeyUp(e) {
72
+ if (this.slider.options.keyNavigation) {
73
+ if (e.key === 'ArrowRight' || e.key === 'Right') {
74
+ this.slider.next();
75
+ } else if (e.key === 'ArrowLeft' || e.key === 'Left') {
76
+ this.slider.previous();
77
+ }
78
+ }
79
+ }
80
+
81
+ refresh() {
82
+ // let centerOffset = Math.floor(this.options.slidesToShow / 2);
83
+ if (!this.slider.options.loop && !this.slider.options.infinite) {
84
+ if (this.slider.options.navigation && this.slider.state.length > this.slider.slidesToShow) {
85
+ this._ui.previous.classList.remove('is-hidden');
86
+ this._ui.next.classList.remove('is-hidden');
87
+ if (this.slider.state.next === 0) {
88
+ this._ui.previous.classList.add('is-hidden');
89
+ this._ui.next.classList.remove('is-hidden');
90
+ } else if (this.slider.state.next >= this.slider.state.length - this.slider.slidesToShow && !this.slider.options.centerMode) {
91
+ this._ui.previous.classList.remove('is-hidden');
92
+ this._ui.next.classList.add('is-hidden');
93
+ } else if (this.slider.state.next >= this.slider.state.length - 1 && this.slider.options.centerMode) {
94
+ this._ui.previous.classList.remove('is-hidden');
95
+ this._ui.next.classList.add('is-hidden');
96
+ }
97
+ } else {
98
+ this._ui.previous.classList.add('is-hidden');
99
+ this._ui.next.classList.add('is-hidden');
100
+ }
101
+ }
102
+ }
103
+
104
+ render() {
105
+ return this.node;
106
+ }
107
+ }
@@ -0,0 +1,103 @@
1
+ import template from '../templates/pagination';
2
+ import templatePage from '../templates/pagination-page';
3
+ import detectSupportsPassive from '../utils/detect-supportsPassive';
4
+
5
+ export default class Pagination {
6
+ constructor(slider) {
7
+ this.slider = slider;
8
+
9
+ this._clickEvents = ['click', 'touch'];
10
+ this._supportsPassive = detectSupportsPassive();
11
+
12
+ this.onPageClick = this.onPageClick.bind(this);
13
+ this.onResize = this.onResize.bind(this);
14
+ }
15
+
16
+ init() {
17
+ this._pages = [];
18
+ this.node = document.createRange().createContextualFragment(template());
19
+ this._ui = {
20
+ container: this.node.firstChild
21
+ };
22
+
23
+ this._count = Math.ceil((this.slider.state.length - this.slider.slidesToShow) / this.slider.slidesToScroll);
24
+
25
+ this._draw();
26
+ this.refresh();
27
+
28
+ return this;
29
+ }
30
+
31
+ destroy() {
32
+ this._unbindEvents();
33
+ }
34
+
35
+ _bindEvents() {
36
+ window.addEventListener('resize', this.onResize);
37
+ window.addEventListener('orientationchange', this.onResize);
38
+
39
+ this._clickEvents.forEach(clickEvent => {
40
+ this._pages.forEach(page => page.addEventListener(clickEvent, this.onPageClick));
41
+ });
42
+ }
43
+
44
+ _unbindEvents() {
45
+ window.removeEventListener('resize', this.onResize);
46
+ window.removeEventListener('orientationchange', this.onResize);
47
+
48
+ this._clickEvents.forEach(clickEvent => {
49
+ this._pages.forEach(page => page.removeEventListener(clickEvent, this.onPageClick));
50
+ });
51
+ }
52
+
53
+ _draw() {
54
+ this._ui.container.innerHTML = '';
55
+ if (this.slider.options.pagination && this.slider.state.length > this.slider.slidesToShow) {
56
+ for (let i = 0; i <= this._count; i++) {
57
+ const newPageNode = document.createRange().createContextualFragment(templatePage()).firstChild;
58
+ newPageNode.dataset.index = i * this.slider.slidesToScroll;
59
+ this._pages.push(newPageNode);
60
+ this._ui.container.appendChild(newPageNode);
61
+ }
62
+ this._bindEvents();
63
+ }
64
+ }
65
+
66
+ onPageClick(e) {
67
+ if (!this._supportsPassive) {
68
+ e.preventDefault();
69
+ }
70
+
71
+ this.slider.state.next = e.currentTarget.dataset.index;
72
+ this.slider.show();
73
+ }
74
+
75
+ onResize() {
76
+ this._draw();
77
+ }
78
+
79
+ refresh() {
80
+ let newCount;
81
+
82
+ if (this.slider.options.infinite) {
83
+ newCount = Math.ceil(this.slider.state.length - 1 / this.slider.slidesToScroll);
84
+ } else {
85
+ newCount = Math.ceil((this.slider.state.length - this.slider.slidesToShow) / this.slider.slidesToScroll);
86
+ }
87
+ if (newCount !== this._count) {
88
+ this._count = newCount;
89
+ this._draw();
90
+ }
91
+
92
+ this._pages.forEach(page => {
93
+ page.classList.remove('is-active');
94
+ if (parseInt(page.dataset.index, 10) === this.slider.state.next % this.slider.state.length) {
95
+ page.classList.add('is-active');
96
+ }
97
+ });
98
+ }
99
+
100
+ render() {
101
+ return this.node;
102
+ }
103
+ }
@@ -0,0 +1,106 @@
1
+ import Coordinate from '../utils/coordinate';
2
+ import detectSupportsPassive from '../utils/detect-supportsPassive';
3
+
4
+ export default class Swipe {
5
+ constructor(slider) {
6
+ this.slider = slider;
7
+
8
+ this._supportsPassive = detectSupportsPassive();
9
+
10
+ this.onStartDrag = this.onStartDrag.bind(this);
11
+ this.onMoveDrag = this.onMoveDrag.bind(this);
12
+ this.onStopDrag = this.onStopDrag.bind(this);
13
+
14
+ this._init();
15
+ }
16
+
17
+ _init() {}
18
+
19
+ bindEvents() {
20
+ this.slider.container.addEventListener('dragstart', e => {
21
+ if (!this._supportsPassive) {
22
+ e.preventDefault();
23
+ }
24
+ });
25
+ this.slider.container.addEventListener('mousedown', this.onStartDrag);
26
+ this.slider.container.addEventListener('touchstart', this.onStartDrag);
27
+
28
+ window.addEventListener('mousemove', this.onMoveDrag);
29
+ window.addEventListener('touchmove', this.onMoveDrag);
30
+
31
+ window.addEventListener('mouseup', this.onStopDrag);
32
+ window.addEventListener('touchend', this.onStopDrag);
33
+ window.addEventListener('touchcancel', this.onStopDrag);
34
+ }
35
+
36
+ unbindEvents() {
37
+ this.slider.container.removeEventListener('dragstart', e => {
38
+ if (!this._supportsPassive) {
39
+ e.preventDefault();
40
+ }
41
+ });
42
+ this.slider.container.removeEventListener('mousedown', this.onStartDrag);
43
+ this.slider.container.removeEventListener('touchstart', this.onStartDrag);
44
+
45
+ window.removeEventListener('mousemove', this.onMoveDrag);
46
+ window.removeEventListener('touchmove', this.onMoveDrag);
47
+
48
+ window.removeEventListener('mouseup', this.onStopDrag);
49
+ window.removeEventListener('mouseup', this.onStopDrag);
50
+ window.removeEventListener('touchcancel', this.onStopDrag);
51
+ }
52
+
53
+ /**
54
+ * @param {MouseEvent|TouchEvent}
55
+ */
56
+ onStartDrag(e) {
57
+ if (e.touches) {
58
+ if (e.touches.length > 1) {
59
+ return;
60
+ } else {
61
+ e = e.touches[0];
62
+ }
63
+ }
64
+
65
+ this._origin = new Coordinate(e.screenX, e.screenY);
66
+ this.width = this.slider.wrapperWidth;
67
+ this.slider.transitioner.disable();
68
+ }
69
+
70
+ /**
71
+ * @param {MouseEvent|TouchEvent}
72
+ */
73
+ onMoveDrag(e) {
74
+ if (this._origin) {
75
+ let point = e.touches ? e.touches[0] : e;
76
+ this._lastTranslate = new Coordinate(point.screenX - this._origin.x, point.screenY - this._origin.y);
77
+ if (e.touches) {
78
+ if (Math.abs(this._lastTranslate.x) > Math.abs(this._lastTranslate.y)) {
79
+ if (!this._supportsPassive) {
80
+ e.preventDefault();
81
+ }
82
+ e.stopPropagation();
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ /**
89
+ * @param {MouseEvent|TouchEvent}
90
+ */
91
+ onStopDrag(e) {
92
+ if (this._origin && this._lastTranslate) {
93
+ if (Math.abs(this._lastTranslate.x) > 0.2 * this.width) {
94
+ if (this._lastTranslate.x < 0) {
95
+ this.slider.next();
96
+ } else {
97
+ this.slider.previous();
98
+ }
99
+ } else {
100
+ this.slider.show(true);
101
+ }
102
+ }
103
+ this._origin = null;
104
+ this._lastTranslate = null;
105
+ }
106
+ }
@@ -0,0 +1,74 @@
1
+ import Fade from './transitions/fade';
2
+ import Translate from './transitions/translate';
3
+
4
+ export default class Transitioner {
5
+ constructor(slider) {
6
+ this.slider = slider;
7
+ this.options = slider.options;
8
+
9
+ this._animating = false;
10
+ this._animation = undefined;
11
+
12
+ this._translate = new Translate(this, slider, slider.options);
13
+ this._fade = new Fade(this, slider, slider.options);
14
+ }
15
+
16
+ init() {
17
+ this._fade.init();
18
+ this._translate.init();
19
+ return this;
20
+ }
21
+
22
+ isAnimating() {
23
+ return this._animating;
24
+ }
25
+
26
+ enable() {
27
+ this._animation && this._animation.enable();
28
+ }
29
+
30
+ disable() {
31
+ this._animation && this._animation.disable();
32
+ }
33
+
34
+ apply(force, callback) {
35
+ // If we don't force refresh and animation in progress then return
36
+ if (this._animating && !force) {
37
+ return;
38
+ }
39
+
40
+ switch (this.options.effect) {
41
+ case 'fade':
42
+ this._animation = this._fade;
43
+ break;
44
+ case 'translate':
45
+ default:
46
+ this._animation = this._translate;
47
+ break;
48
+ }
49
+
50
+ this._animationCallback = callback;
51
+
52
+ if (force) {
53
+ this._animation && this._animation.disable();
54
+ } else {
55
+ this._animation && this._animation.enable();
56
+ this._animating = true;
57
+ }
58
+
59
+ this._animation && this._animation.apply();
60
+
61
+ if (force) {
62
+ this.end();
63
+ }
64
+ }
65
+
66
+ end() {
67
+ this._animating = false;
68
+ this._animation = undefined;
69
+ this.slider.state.index = this.slider.state.next;
70
+ if (this._animationCallback) {
71
+ this._animationCallback();
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,90 @@
1
+ import {
2
+ css
3
+ } from '../../utils/css';
4
+
5
+ export default class Fade {
6
+ constructor(transitioner, slider, options = {}) {
7
+ this.transitioner = transitioner;
8
+ this.slider = slider;
9
+ this.options = {
10
+ ...options
11
+ };
12
+ }
13
+
14
+ init() {
15
+ if (this.options.effect === 'fade') {
16
+ this.slider.slides.forEach((slide, index) => {
17
+ css(slide, {
18
+ position: 'absolute',
19
+ left: 0,
20
+ top: 0,
21
+ bottom: 0,
22
+ 'z-index': slide.dataset.sliderIndex == this.slider.state.index ? 0 : -2,
23
+ opacity: slide.dataset.sliderIndex == this.slider.state.index ? 1 : 0
24
+ });
25
+ });
26
+ }
27
+ return this;
28
+ }
29
+
30
+ enable() {
31
+ this._oldSlide = this.slider.slides.filter(slide => slide.dataset.sliderIndex == this.slider.state.index)[0];
32
+ this._newSlide = this.slider.slides.filter(slide => slide.dataset.sliderIndex == this.slider.state.next)[0];
33
+ if (this._newSlide) {
34
+ this._newSlide.addEventListener('transitionend', this.onTransitionEnd.bind(this));
35
+ this._newSlide.style.transition = `${this.options.duration}ms ${this.options.timing}`;
36
+ if (this._oldSlide) {
37
+ this._oldSlide.addEventListener('transitionend', this.onTransitionEnd.bind(this));
38
+ this._oldSlide.style.transition = `${this.options.duration}ms ${this.options.timing}`;
39
+ }
40
+ }
41
+ }
42
+
43
+ disable() {
44
+ this._oldSlide = this.slider.slides.filter(slide => slide.dataset.sliderIndex == this.slider.state.index)[0];
45
+ this._newSlide = this.slider.slides.filter(slide => slide.dataset.sliderIndex == this.slider.state.next)[0];
46
+ if (this._newSlide) {
47
+ this._newSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this));
48
+ this._newSlide.style.transition = `none`;
49
+ if (this._oldSlide) {
50
+ this._oldSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this));
51
+ this._oldSlide.style.transition = `none`;
52
+ }
53
+ }
54
+ }
55
+
56
+ apply(force) {
57
+ this._oldSlide = this.slider.slides.filter(slide => slide.dataset.sliderIndex == this.slider.state.index)[0];
58
+ this._newSlide = this.slider.slides.filter(slide => slide.dataset.sliderIndex == this.slider.state.next)[0];
59
+
60
+ if (this._oldSlide && this._newSlide) {
61
+ css(this._oldSlide, {
62
+ opacity: 0
63
+ });
64
+ css(this._newSlide, {
65
+ opacity: 1,
66
+ 'z-index': force ? 0 : -1
67
+ });
68
+ }
69
+ }
70
+
71
+ onTransitionEnd(e) {
72
+ if (this.options.effect === 'fade') {
73
+ if (this.transitioner.isAnimating() && e.target == this._newSlide) {
74
+ if (this._newSlide) {
75
+ css(this._newSlide, {
76
+ 'z-index': 0
77
+ });
78
+ this._newSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this));
79
+ }
80
+ if (this._oldSlide) {
81
+ css(this._oldSlide, {
82
+ 'z-index': -2
83
+ });
84
+ this._oldSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this));
85
+ }
86
+ }
87
+ this.transitioner.end();
88
+ }
89
+ }
90
+ }