├── .gitignore
├── README.md
├── dist
├── deck3000.css
├── deck3000.es.js
├── deck3000.js
├── deck3000.min.css
└── deck3000.umd.js
├── docs
├── index.html
├── src.461479b2.js
└── style.499f78c8.css
├── package.json
└── src
├── Emitter.js
├── MouseWheel.js
├── Section.js
├── SetBrowserHistory.js
├── SetCurrentState.js
├── SetPosition.js
├── Slide.js
├── ToSlug.js
├── ToggleClass.js
├── TouchEvents.js
└── index.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_STORE
2 | .npmignore
3 | *.lock
4 | *.map
5 | node_modules
6 | *.log
7 | docs/deck3000.es.js
8 | docs/deck3000.js
9 | docs/src
10 | .cache
11 | dev
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | **A slider component for the new millennium.**
4 |
5 | ## What it is
6 | Simple! It's a slider component 😀 which can navigate (infinitely!) vertically ("sections") and horizontally ("slides", within a current section) in pure javascript.
7 |
8 | What this component provides is a way to handle the basic and essential interactions of the slider itself. This will not provide you with the UI or anything like that; all the fun and responsibility of implementing the UI and interaction around the slider is all up to you!
9 |
10 | 
11 |
12 | ## Features
13 | - Weighing in at a cute `~2kb` (js) `450b` (css)
14 | - Infinite slides (vertical / horizontal)
15 | - Scroll/Keyboard/Touch friendly
16 | - Super smooth
17 | - Super simple
18 | - Super cute
19 |
20 | ## Coming soon
21 | - [x] Navigation updates URL and history (replaceState)
22 |
23 |
24 | ## Getting Started
25 |
26 | Include the module via `npm i deck3000` or `yarn add deck3000` and import it into your project.
27 |
28 | ```js
29 | import Deck3000 from 'deck3000';
30 | ```
31 |
32 | **Very important** You must also include the [css](https://github.com/ezekielaquino/Deck3000/blob/master/dist/deck3000.css) that comes with the module!
33 |
34 | ```css
35 | // stylus, sass, etc.
36 | @import 'deck3000/dist/deck3000.css';
37 | ```
38 |
39 | ### DOM Structure
40 | **Deck3000** requires the following structure from your HTML (see below)
41 | - a parent container that includes the selector `js-deck3000`
42 | - sections must be a direct descendant of the parent container
43 | - slides must be a direct descendant of a section
44 |
45 | *Note*: if you plan on having elements that are siblings of a slide within a section (for example,some absolute positioned elements within a section) you *MUST* have a selector on each slide and declare that as a `slideSelector` option when instantiating **Deck3000**, otherwise *all* direct descendants of a section will be instantiated as a slide.
46 |
47 | After **Deck3000** successfully instantiated, a `is-init` selector will be attached to the parent `js-deck3000` element.
48 |
49 | Animation speed and easing are all done via [CSS](https://github.com/ezekielaquino/Deck3000/blob/5ac9c62b4b78e2b2ec27a05f45533c58dca27cb2/dist/deck3000.css#L21) in addition to all the essentials of making the component work so **don't forget to import the stylesheet!**
50 |
51 | ```html
52 |
53 |
54 |
55 |
56 | Slide one
57 |
58 |
59 | Slide two
60 |
61 |
62 | Slide three
63 |
64 |
65 |
66 |
67 |
68 |
69 | Section two - Slide one
70 |
71 |
72 | Section two - Slide two
73 |
74 |
75 | Section two - Slide three
76 |
77 |
78 |
79 | ```
80 |
81 | ```js
82 | const Slideshow = new Deck3000({
83 | slideSelector: '.slide', // (optional)
84 | resetSlides: true,
85 | keyboardEvents: true,
86 | updateURL: true,
87 | onInit: state => func,
88 | onSectionStart: state => onSectionStart,
89 | onSectionEnd: state => func,
90 | onSlideStart: state => func,
91 | onSlideEnd: state => func,
92 | });
93 |
94 | const onSectionStart = state => {
95 | console.log(state); // This logs the state object below
96 | };
97 | ```
98 |
99 | **Callbacks exposes `state`**
100 | ```js
101 | {
102 | currentSectionElem: DOMNode, // current section
103 | currentSlideElem: DOMNode, // currentSlide,
104 | section: {
105 | current: 1,
106 | direction: 'next',
107 | isAnimating: false,
108 | next: 2,
109 | prev: 0,
110 | sectionLength: 3, // This is actually length - 1
111 | },
112 | slide: {
113 | currentSlide: 0,
114 | next: 1,
115 | prev: 2,
116 | slideLength: 2, // This is actually length - 1
117 | }
118 | }
119 | ```
120 |
121 | After **Deck3000** instantiates, it will not mutate the structure of the DOM in any way aside from adding classes to `sections` and `slides`.
122 |
123 | ## URLs
124 |
125 | If you have set `updateURL` to `true` then you may attach a `data-title="Whatever"` to a `section`. This string will be converted into a slug e.g. `Fashion brand` -> `fashion-brand` and will be appended to the URL `/fashion-brand` when you navigate across sections. If you do set `updateURL` to `true` but do *not* attach a data-title attribute, then it will just use the index of the current section e.g. `/0`.
126 |
127 | ## API
128 |
129 | #### navigate('type', 'direction') | Navigate through sections/slides.
130 |
131 | a.k.a The ✨🥩 of **Deck3000**
132 |
133 | `[Deck3000Instance].navigate(['section'/'slide'], ['next'/'prev']);`
134 |
135 | ```js
136 | const nextSlideBtn = document.querySelector('.nextSlideBtn');
137 |
138 | nextSlideBtn.addEventListener('click', () => {
139 | Slideshow.navigate('slide', 'next');
140 | });
141 | ```
142 |
143 | #### disableEvents(bool) | Toggles all (scroll/keyboard/swipe) events.
144 |
145 | `[Deck3000Instance].disableEvents(bool);`
146 |
147 |
148 | ```js
149 | // One might want to disable scroll events
150 | // (for ultimate peace of mind)
151 | // during certain UI states of your site/application
152 | const toggleOverlay = bool => {
153 | if (bool) {
154 | overlay.classList.add('is-active');
155 | Slideshow.disableEvents(bool);
156 | return;
157 | }
158 |
159 | overlay.classList.remove('is-active');
160 | };
161 | ```
162 |
163 | #### Emitter
164 | **Deck3000** uses `mitt` for handling events. The Emitter is exposed so you can subscribe to `navigate` (section) and `navigateSlide` (slide) events if you wish.
165 |
166 | ```js
167 | [Deck3000Instance].Emitter.on('navigate', e => {
168 | // Do something when navigating sections
169 | console.log(e);
170 | });
171 |
172 | [Deck3000Instance].Emitter.on('navigateSlide', e=> {
173 | // Do something when navigating slides
174 | console.log(e);
175 | });
176 | ```
177 |
178 | ## Thanks
179 | - Built with [Microbundle](https://github.com/developit/microbundle) **It's awesome** 💃
180 | - Also built with [Parcel](https://parceljs.org/) 🕺
181 |
182 | ## License
183 | [MIT](https://oss.ninja/mit)
184 |
--------------------------------------------------------------------------------
/dist/deck3000.css:
--------------------------------------------------------------------------------
1 | .js-deck3000 {
2 | width: 100vw;
3 | height: 100%;
4 | position: fixed;
5 | top: 0;
6 | left: 0;
7 | overflow: hidden;
8 | }
9 |
10 | .js-deck3000__section,
11 | .js-deck3000__section-slide {
12 | width: 100%;
13 | height: 100%;
14 | position: absolute;
15 | overflow: hidden;
16 | }
17 |
18 | .is-init .js-deck3000__section,
19 | .is-init .js-deck3000__section-slide {
20 | transition-property: transform;
21 | transition-duration: 0.5s;
22 | }
23 |
24 | .js-deck3000__section-slide {
25 | top: 0;
26 | }
27 |
28 | .js-deck3000__section.is-current,
29 | .js-deck3000__section-slide.is-current {
30 | top: 0;
31 | left: 0;
32 | transform: translate3d(0, 0, 0);
33 | }
34 |
35 | .js-deck3000__section.is-next {
36 | transform: translate3d(0, 100%, 0);
37 | }
38 |
39 | .js-deck3000__section.is-prev {
40 | transform: translate3d(0, -100%, 0);
41 | }
42 |
43 | .js-deck3000__section.is-instant,
44 | .js-deck3000__section-slide.is-instant {
45 | transition: none;
46 | }
47 |
48 | .js-deck3000__section-slide.is-next {
49 | transform: translate3d(100%, 0, 0);
50 | }
51 |
52 | .js-deck3000__section-slide.is-prev {
53 | transform: translate3d(-100%, 0, 0);
54 | }
--------------------------------------------------------------------------------
/dist/deck3000.es.js:
--------------------------------------------------------------------------------
1 | var t,e=(t=t||Object.create(null),{on:function(e,i){(t[e]||(t[e]=[])).push(i)},off:function(e,i){t[e]&&t[e].splice(t[e].indexOf(i)>>>0,1)},emit:function(e,i){(t[e]||[]).slice().map(function(t){t(i)}),(t["*"]||[]).slice().map(function(t){t(e,i)})}}),i=function(t,e){var i;t.index===e.current?i="current":t.index===e.next?i="next":t.index===e.prev?i="prev":t.index>e.current?i="next":t.index0?"next":"prev",s=Math.sign(t.detail||t.deltaX)>0?"next":"prev";if(e.prevTime=e.currentTime,!e.state.isAnimating&&i>80){var a=2===t.axis||Math.abs(t.deltaY)&&Math.abs(t.deltaX)<=1,r=1===t.axis||Math.abs(t.deltaX)&&Math.abs(t.deltaY)<=1;if(a)return e.navigate("section",n);if(r)return e.navigate("slide",s)}},o=function(t){return void 0===t&&(t=""),t.split(" ").join("-").toLowerCase()},c=function(t){Object.assign(this,t),this.baseSelector="js-deck3000",this.element=document.querySelector("."+this.baseSelector),this.emitter=e,this.state={current:0,next:1},this.init(),this._onTransitionEnd=this._onTransitionEnd.bind(this)};c.prototype.init=function(){var t=this,i=this.state.current,n=Array.from(this.element.children).map(function(e,i,n){var r=window.location.pathname.split("/")[1];return t.state.sectionLength=t.state.prev=n.length-1,t.updateURL&&r&&(r!==o(e.dataset.title)&&r!==i.toString()||a({state:t.state,currentKey:"current",currentIndex:i,length:t.state.sectionLength,direction:i})),new s({slideshow:t,slideSelector:t.slideSelector,element:e,index:i})});this.sections=n,e.emit("navigate",this.state),e.emit("navigateSlide",{current:i}),setTimeout(function(){t.element.classList.add("is-init"),t.transitionDuration=1e3*parseFloat(getComputedStyle(t.sections[0].element).transitionDuration),t._attachEventHandlers(),t.onInit&&t.onInit(t._getCallbackState())},0)},c.prototype._attachEventHandlers=function(){var t,e,i,n,s,a=this;this.scrolls=[],this.prevTime=(new Date).getTime(),this.element.addEventListener("mousewheel",function(t){r(t,a)}),this.element.addEventListener("DOMMouseScroll",function(t){r(t,a)}),t=this,e=0,i=0,n=0,s=0,("ontouchstart"in window||navigator.msMaxTouchPoints>0||navigator.maxTouchPoints)&&(t.element.addEventListener("touchstart",function(t){e=t.changedTouches[0].screenX,i=t.changedTouches[0].screenY},!1),t.element.addEventListener("touchend",function(a){n=a.changedTouches[0].screenX,s=a.changedTouches[0].screenY;var r=Math.abs(n-e)>=100,o=Math.abs(s-i)>=100;return n<=e&&r?t.navigate("slide","next"):n>=e&&r?t.navigate("slide","prev"):s>=i&&o?t.navigate("section","prev"):s<=i&&o?t.navigate("section","next"):void 0},!1)),this.keyboardEvents&&window.addEventListener("keyup",function(t){if(!a.noEvents&&!a.state.isAnimating)switch(t.keyCode){case 38:a.navigate("section","prev");break;case 40:a.navigate("section","next");break;case 37:a.navigate("slide","prev");break;case 39:a.navigate("slide","next")}})},c.prototype.disableEvents=function(t){this.noEvents=t},c.prototype.navigate=function(t,i,n,s){var r=this;if(!this.noEvents&&!this.state.isAnimating){var c=this.state,l=c.current,h=c.sectionLength,d=this.sections[l],u="section"===t,v=u?d.element:d.slides[d.state.currentSlide].element,m=u?this.onSectionStart:this.onSlideStart,p=u?this.onSectionEnd:this.onSlideEnd;if(this.state.isAnimating=!n,this.state.direction=i,u)a({state:this.state,currentKey:"current",currentIndex:l,length:h,direction:i}),this.updateURL&&!n&&function(t,e){var i=o((e||t.current).toString());history.replaceState(t,e,i)}(this.state,this.sections[this.state.current].element.dataset.title),e.emit("navigate",this.state);else{var g=d,f=g.state,S=f.currentSlide,x=f.slideLength;n&&(g=this._getNextSection(s)),a({state:g.state,currentKey:"currentSlide",currentIndex:S,length:x,direction:i}),e.emit("navigateSlide",{current:l,direction:i,reset:n})}n||(m&&m(this._getCallbackState()),clearTimeout(this.timeout),this.timeout=setTimeout(function(){r._onTransitionEnd({element:v,onEnd:p,isSection:u,direction:i})},n?0:this.transitionDuration))}},c.prototype._getCallbackState=function(){var t=this.sections[this.state.current];return{section:this.state,slide:t.state,currentSectionElem:t.element,currentSlideElem:t.getCurrentSlide()}},c.prototype._getNextSection=function(t){var e=this.state;return"next"===t?this.sections[e.prev]:this.sections[e.next]},c.prototype._onTransitionEnd=function(t){var e=t.onEnd,i=t.isSection,n=t.direction;this.state.isAnimating=!1,i&&this.resetSlides&&this.navigate("slide",0,!0,n),e&&t.onEnd(this._getCallbackState())};export default c;
2 | //# sourceMappingURL=deck3000.es.js.map
3 |
--------------------------------------------------------------------------------
/dist/deck3000.js:
--------------------------------------------------------------------------------
1 | "use strict";var t,e=(t=t||Object.create(null),{on:function(e,i){(t[e]||(t[e]=[])).push(i)},off:function(e,i){t[e]&&t[e].splice(t[e].indexOf(i)>>>0,1)},emit:function(e,i){(t[e]||[]).slice().map(function(t){t(i)}),(t["*"]||[]).slice().map(function(t){t(e,i)})}}),i=function(t,e){var i;t.index===e.current?i="current":t.index===e.next?i="next":t.index===e.prev?i="prev":t.index>e.current?i="next":t.index0?"next":"prev",s=Math.sign(t.detail||t.deltaX)>0?"next":"prev";if(e.prevTime=e.currentTime,!e.state.isAnimating&&i>80){var a=2===t.axis||Math.abs(t.deltaY)&&Math.abs(t.deltaX)<=1,r=1===t.axis||Math.abs(t.deltaX)&&Math.abs(t.deltaY)<=1;if(a)return e.navigate("section",n);if(r)return e.navigate("slide",s)}},o=function(t){return void 0===t&&(t=""),t.split(" ").join("-").toLowerCase()},c=function(t){Object.assign(this,t),this.baseSelector="js-deck3000",this.element=document.querySelector("."+this.baseSelector),this.emitter=e,this.state={current:0,next:1},this.init(),this._onTransitionEnd=this._onTransitionEnd.bind(this)};c.prototype.init=function(){var t=this,i=this.state.current,n=Array.from(this.element.children).map(function(e,i,n){var r=window.location.pathname.split("/")[1];return t.state.sectionLength=t.state.prev=n.length-1,t.updateURL&&r&&(r!==o(e.dataset.title)&&r!==i.toString()||a({state:t.state,currentKey:"current",currentIndex:i,length:t.state.sectionLength,direction:i})),new s({slideshow:t,slideSelector:t.slideSelector,element:e,index:i})});this.sections=n,e.emit("navigate",this.state),e.emit("navigateSlide",{current:i}),setTimeout(function(){t.element.classList.add("is-init"),t.transitionDuration=1e3*parseFloat(getComputedStyle(t.sections[0].element).transitionDuration),t._attachEventHandlers(),t.onInit&&t.onInit(t._getCallbackState())},0)},c.prototype._attachEventHandlers=function(){var t,e,i,n,s,a=this;this.scrolls=[],this.prevTime=(new Date).getTime(),this.element.addEventListener("mousewheel",function(t){r(t,a)}),this.element.addEventListener("DOMMouseScroll",function(t){r(t,a)}),t=this,e=0,i=0,n=0,s=0,("ontouchstart"in window||navigator.msMaxTouchPoints>0||navigator.maxTouchPoints)&&(t.element.addEventListener("touchstart",function(t){e=t.changedTouches[0].screenX,i=t.changedTouches[0].screenY},!1),t.element.addEventListener("touchend",function(a){n=a.changedTouches[0].screenX,s=a.changedTouches[0].screenY;var r=Math.abs(n-e)>=100,o=Math.abs(s-i)>=100;return n<=e&&r?t.navigate("slide","next"):n>=e&&r?t.navigate("slide","prev"):s>=i&&o?t.navigate("section","prev"):s<=i&&o?t.navigate("section","next"):void 0},!1)),this.keyboardEvents&&window.addEventListener("keyup",function(t){if(!a.noEvents&&!a.state.isAnimating)switch(t.keyCode){case 38:a.navigate("section","prev");break;case 40:a.navigate("section","next");break;case 37:a.navigate("slide","prev");break;case 39:a.navigate("slide","next")}})},c.prototype.disableEvents=function(t){this.noEvents=t},c.prototype.navigate=function(t,i,n,s){var r=this;if(!this.noEvents&&!this.state.isAnimating){var c=this.state,l=c.current,h=c.sectionLength,d=this.sections[l],u="section"===t,v=u?d.element:d.slides[d.state.currentSlide].element,m=u?this.onSectionStart:this.onSlideStart,p=u?this.onSectionEnd:this.onSlideEnd;if(this.state.isAnimating=!n,this.state.direction=i,u)a({state:this.state,currentKey:"current",currentIndex:l,length:h,direction:i}),this.updateURL&&!n&&function(t,e){var i=o((e||t.current).toString());history.replaceState(t,e,i)}(this.state,this.sections[this.state.current].element.dataset.title),e.emit("navigate",this.state);else{var g=d,f=g.state,S=f.currentSlide,x=f.slideLength;n&&(g=this._getNextSection(s)),a({state:g.state,currentKey:"currentSlide",currentIndex:S,length:x,direction:i}),e.emit("navigateSlide",{current:l,direction:i,reset:n})}n||(m&&m(this._getCallbackState()),clearTimeout(this.timeout),this.timeout=setTimeout(function(){r._onTransitionEnd({element:v,onEnd:p,isSection:u,direction:i})},n?0:this.transitionDuration))}},c.prototype._getCallbackState=function(){var t=this.sections[this.state.current];return{section:this.state,slide:t.state,currentSectionElem:t.element,currentSlideElem:t.getCurrentSlide()}},c.prototype._getNextSection=function(t){var e=this.state;return"next"===t?this.sections[e.prev]:this.sections[e.next]},c.prototype._onTransitionEnd=function(t){var e=t.onEnd,i=t.isSection,n=t.direction;this.state.isAnimating=!1,i&&this.resetSlides&&this.navigate("slide",0,!0,n),e&&t.onEnd(this._getCallbackState())},module.exports=c;
2 | //# sourceMappingURL=deck3000.js.map
3 |
--------------------------------------------------------------------------------
/dist/deck3000.min.css:
--------------------------------------------------------------------------------
1 | .js-deck3000{width:100vw;height:100%;position:fixed;top:0;left:0;overflow:hidden}.js-deck3000__section,.js-deck3000__section-slide{width:100%;height:100%;position:absolute;overflow:hidden}.is-init .js-deck3000__section,.is-init .js-deck3000__section-slide{transition-property:transform;transition-duration:.35s}.js-deck3000__section-slide{top:0}.js-deck3000__section-slide.is-current,.js-deck3000__section.is-current{top:0;left:0;transform:translate3d(0,0,0)}.js-deck3000__section.is-next{transform:translate3d(0,100%,0)}.js-deck3000__section.is-prev{transform:translate3d(0,-100%,0)}.js-deck3000__section-slide.is-instant,.js-deck3000__section.is-instant{transition:none}.js-deck3000__section-slide.is-next{transform:translate3d(100%,0,0)}.js-deck3000__section-slide.is-prev{transform:translate3d(-100%,0,0)}
--------------------------------------------------------------------------------
/dist/deck3000.umd.js:
--------------------------------------------------------------------------------
1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Deck3000=e()}(this,function(){"use strict";var t,e=(t=t||Object.create(null),{on:function(e,i){(t[e]||(t[e]=[])).push(i)},off:function(e,i){t[e]&&t[e].splice(t[e].indexOf(i)>>>0,1)},emit:function(e,i){(t[e]||[]).slice().map(function(t){t(i)}),(t["*"]||[]).slice().map(function(t){t(e,i)})}}),i=function(t,e){var i;t.index===e.current?i="current":t.index===e.next?i="next":t.index===e.prev?i="prev":t.index>e.current?i="next":t.index0?"next":"prev",s=Math.sign(t.detail||t.deltaX)>0?"next":"prev";if(e.prevTime=e.currentTime,!e.state.isAnimating&&i>80){var a=2===t.axis||Math.abs(t.deltaY)&&Math.abs(t.deltaX)<=1,r=1===t.axis||Math.abs(t.deltaX)&&Math.abs(t.deltaY)<=1;if(a)return e.navigate("section",n);if(r)return e.navigate("slide",s)}},o=function(t){return void 0===t&&(t=""),t.split(" ").join("-").toLowerCase()},c=function(t){Object.assign(this,t),this.baseSelector="js-deck3000",this.element=document.querySelector("."+this.baseSelector),this.emitter=e,this.state={current:0,next:1},this.init(),this._onTransitionEnd=this._onTransitionEnd.bind(this)};return c.prototype.init=function(){var t=this,i=this.state.current,n=Array.from(this.element.children).map(function(e,i,n){var r=window.location.pathname.split("/")[1];return t.state.sectionLength=t.state.prev=n.length-1,t.updateURL&&r&&(r!==o(e.dataset.title)&&r!==i.toString()||a({state:t.state,currentKey:"current",currentIndex:i,length:t.state.sectionLength,direction:i})),new s({slideshow:t,slideSelector:t.slideSelector,element:e,index:i})});this.sections=n,e.emit("navigate",this.state),e.emit("navigateSlide",{current:i}),setTimeout(function(){t.element.classList.add("is-init"),t.transitionDuration=1e3*parseFloat(getComputedStyle(t.sections[0].element).transitionDuration),t._attachEventHandlers(),t.onInit&&t.onInit(t._getCallbackState())},0)},c.prototype._attachEventHandlers=function(){var t,e,i,n,s,a=this;this.scrolls=[],this.prevTime=(new Date).getTime(),this.element.addEventListener("mousewheel",function(t){r(t,a)}),this.element.addEventListener("DOMMouseScroll",function(t){r(t,a)}),t=this,e=0,i=0,n=0,s=0,("ontouchstart"in window||navigator.msMaxTouchPoints>0||navigator.maxTouchPoints)&&(t.element.addEventListener("touchstart",function(t){e=t.changedTouches[0].screenX,i=t.changedTouches[0].screenY},!1),t.element.addEventListener("touchend",function(a){n=a.changedTouches[0].screenX,s=a.changedTouches[0].screenY;var r=Math.abs(n-e)>=100,o=Math.abs(s-i)>=100;return n<=e&&r?t.navigate("slide","next"):n>=e&&r?t.navigate("slide","prev"):s>=i&&o?t.navigate("section","prev"):s<=i&&o?t.navigate("section","next"):void 0},!1)),this.keyboardEvents&&window.addEventListener("keyup",function(t){if(!a.noEvents&&!a.state.isAnimating)switch(t.keyCode){case 38:a.navigate("section","prev");break;case 40:a.navigate("section","next");break;case 37:a.navigate("slide","prev");break;case 39:a.navigate("slide","next")}})},c.prototype.disableEvents=function(t){this.noEvents=t},c.prototype.navigate=function(t,i,n,s){var r=this;if(!this.noEvents&&!this.state.isAnimating){var c=this.state,l=c.current,h=c.sectionLength,d=this.sections[l],u="section"===t,v=u?d.element:d.slides[d.state.currentSlide].element,m=u?this.onSectionStart:this.onSlideStart,p=u?this.onSectionEnd:this.onSlideEnd;if(this.state.isAnimating=!n,this.state.direction=i,u)a({state:this.state,currentKey:"current",currentIndex:l,length:h,direction:i}),this.updateURL&&!n&&function(t,e){var i=o((e||t.current).toString());history.replaceState(t,e,i)}(this.state,this.sections[this.state.current].element.dataset.title),e.emit("navigate",this.state);else{var g=d,f=g.state,S=f.currentSlide,x=f.slideLength;n&&(g=this._getNextSection(s)),a({state:g.state,currentKey:"currentSlide",currentIndex:S,length:x,direction:i}),e.emit("navigateSlide",{current:l,direction:i,reset:n})}n||(m&&m(this._getCallbackState()),clearTimeout(this.timeout),this.timeout=setTimeout(function(){r._onTransitionEnd({element:v,onEnd:p,isSection:u,direction:i})},n?0:this.transitionDuration))}},c.prototype._getCallbackState=function(){var t=this.sections[this.state.current];return{section:this.state,slide:t.state,currentSectionElem:t.element,currentSlideElem:t.getCurrentSlide()}},c.prototype._getNextSection=function(t){var e=this.state;return"next"===t?this.sections[e.prev]:this.sections[e.next]},c.prototype._onTransitionEnd=function(t){var e=t.onEnd,i=t.isSection,n=t.direction;this.state.isAnimating=!1,i&&this.resetSlides&&this.navigate("slide",0,!0,n),e&&t.onEnd(this._getCallbackState())},c});
2 | //# sourceMappingURL=deck3000.umd.js.map
3 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |