@travelopia/web-components 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,3 +18,10 @@ Accessible web components for the modern web.
18
18
  ### Installation
19
19
 
20
20
  `npm i @travelopia/web-components`
21
+
22
+ ### Development
23
+
24
+ * Pull requests are welcome.
25
+ * Start the environment with a local server of your choice, for example: `php -S localhost:3000`.
26
+ * Run `npm run dev`.
27
+ * Then let's say you want to work on the slider component. Go to [http://localhost:3000/src/slider](http://localhost:3000/src/slider)
@@ -1,3 +1,129 @@
1
+ /**
2
+ * TP Modal Close.
3
+ */
4
+ export class TPModalCloseElement extends HTMLElement {
5
+ /**
6
+ * Connected callback.
7
+ */
8
+ connectedCallback(): void;
9
+ /**
10
+ * Close the modal.
11
+ */
12
+ closeModal(): void;
13
+ }
14
+
15
+ /**
16
+ * TP Modal.
17
+ */
18
+ export class TPModalElement extends HTMLElement {
19
+ /**
20
+ * Constructor.
21
+ */
22
+ constructor();
23
+ /**
24
+ * Connected callback.
25
+ */
26
+ connectedCallback(): void;
27
+ /**
28
+ * Open the modal.
29
+ */
30
+ open(): void;
31
+ /**
32
+ * Close the modal.
33
+ */
34
+ close(): void;
35
+ /**
36
+ * Handle when the component is clicked.
37
+ *
38
+ * @param {Event} e Event.
39
+ */
40
+ handleClick(e: Event): void;
41
+ }
42
+
43
+ /**
44
+ * TP Slider Arrow.
45
+ */
46
+ export class TPSliderArrowElement extends HTMLElement {
47
+ /**
48
+ * Connected callback.
49
+ */
50
+ connectedCallback(): void;
51
+ /**
52
+ * Handle when the button is clicked.
53
+ */
54
+ handleClick(): void;
55
+ }
56
+
57
+ /**
58
+ * TP Slider Count.
59
+ */
60
+ export class TPSliderCountElement extends HTMLElement {
61
+ /**
62
+ * Get observed attributes.
63
+ *
64
+ * @return {Array} Observed attributes.
65
+ */
66
+ static get observedAttributes(): string[];
67
+ /**
68
+ * Get format.
69
+ *
70
+ * @return {string} Format.
71
+ */
72
+ get format(): string;
73
+ /**
74
+ * Set format.
75
+ *
76
+ * @param {string} format Format.
77
+ */
78
+ set format(format: string);
79
+ /**
80
+ * Attribute changed callback.
81
+ */
82
+ attributeChangedCallback(): void;
83
+ /**
84
+ * Update component.
85
+ */
86
+ update(): void;
87
+ }
88
+
89
+ /**
90
+ * TP Slider Nav Item.
91
+ */
92
+ export class TPSliderNavItemElement extends HTMLElement {
93
+ /**
94
+ * Connected callback.
95
+ */
96
+ connectedCallback(): void;
97
+ /**
98
+ * Handle when the button is clicked.
99
+ */
100
+ handleClick(): void;
101
+ /**
102
+ * Get index of this item inside the navigation.
103
+ *
104
+ * @return {number} Index.
105
+ */
106
+ getIndex(): number;
107
+ }
108
+
109
+ /**
110
+ * TP Slider Nav.
111
+ */
112
+ export class TPSliderNavElement extends HTMLElement {
113
+ }
114
+
115
+ /**
116
+ * TP Slider Slide.
117
+ */
118
+ export class TPSliderSlideElement extends HTMLElement {
119
+ }
120
+
121
+ /**
122
+ * TP Slider Slides.
123
+ */
124
+ export class TPSliderSlidesElement extends HTMLElement {
125
+ }
126
+
1
127
  /**
2
128
  * TP Slider.
3
129
  */
@@ -101,129 +227,3 @@ export class TPSliderElement extends HTMLElement {
101
227
  protected handleTouchEnd(e: TouchEvent): void;
102
228
  }
103
229
 
104
- /**
105
- * TP Slider Nav Item.
106
- */
107
- export class TPSliderNavItemElement extends HTMLElement {
108
- /**
109
- * Connected callback.
110
- */
111
- connectedCallback(): void;
112
- /**
113
- * Handle when the button is clicked.
114
- */
115
- handleClick(): void;
116
- /**
117
- * Get index of this item inside the navigation.
118
- *
119
- * @return {number} Index.
120
- */
121
- getIndex(): number;
122
- }
123
-
124
- /**
125
- * TP Slider Arrow.
126
- */
127
- export class TPSliderArrowElement extends HTMLElement {
128
- /**
129
- * Connected callback.
130
- */
131
- connectedCallback(): void;
132
- /**
133
- * Handle when the button is clicked.
134
- */
135
- handleClick(): void;
136
- }
137
-
138
- /**
139
- * TP Modal.
140
- */
141
- export class TPModalElement extends HTMLElement {
142
- /**
143
- * Constructor.
144
- */
145
- constructor();
146
- /**
147
- * Connected callback.
148
- */
149
- connectedCallback(): void;
150
- /**
151
- * Open the modal.
152
- */
153
- open(): void;
154
- /**
155
- * Close the modal.
156
- */
157
- close(): void;
158
- /**
159
- * Handle when the component is clicked.
160
- *
161
- * @param {Event} e Event.
162
- */
163
- handleClick(e: Event): void;
164
- }
165
-
166
- /**
167
- * TP Modal Close.
168
- */
169
- export class TPModalCloseElement extends HTMLElement {
170
- /**
171
- * Connected callback.
172
- */
173
- connectedCallback(): void;
174
- /**
175
- * Close the modal.
176
- */
177
- closeModal(): void;
178
- }
179
-
180
- /**
181
- * TP Slider Slides.
182
- */
183
- export class TPSliderSlidesElement extends HTMLElement {
184
- }
185
-
186
- /**
187
- * TP Slider Slide.
188
- */
189
- export class TPSliderSlideElement extends HTMLElement {
190
- }
191
-
192
- /**
193
- * TP Slider Nav.
194
- */
195
- export class TPSliderNavElement extends HTMLElement {
196
- }
197
-
198
- /**
199
- * TP Slider Count.
200
- */
201
- export class TPSliderCountElement extends HTMLElement {
202
- /**
203
- * Get observed attributes.
204
- *
205
- * @return {Array} Observed attributes.
206
- */
207
- static get observedAttributes(): string[];
208
- /**
209
- * Get format.
210
- *
211
- * @return {string} Format.
212
- */
213
- get format(): string;
214
- /**
215
- * Set format.
216
- *
217
- * @param {string} format Format.
218
- */
219
- set format(format: string);
220
- /**
221
- * Attribute changed callback.
222
- */
223
- attributeChangedCallback(): void;
224
- /**
225
- * Update component.
226
- */
227
- update(): void;
228
- }
229
-
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";class t extends HTMLElement{constructor(){super(),this.touchStartX=0,this.getAttribute("current-slide")||this.setAttribute("current-slide","1"),this.slide(),this.setAttribute("initialized","yes"),window.addEventListener("resize",this.handleResize.bind(this)),this.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.addEventListener("touchend",this.handleTouchEnd.bind(this))}static get observedAttributes(){return["current-slide","flexible-height","infinite"]}attributeChangedCallback(t="",e="",i=""){"current-slide"===t&&e!==i&&(this.slide(),this.dispatchEvent(new CustomEvent("slide-complete",{bubbles:!0}))),this.update()}get currentSlideIndex(){var t;return parseInt(null!==(t=this.getAttribute("current-slide"))&&void 0!==t?t:"1")}set currentSlideIndex(t){this.setCurrentSlide(t)}getTotalSlides(){const t=this.querySelectorAll("tp-slider-slide");return t?t.length:0}next(){const t=this.getTotalSlides();this.currentSlideIndex>=t?"yes"===this.getAttribute("infinite")&&this.setCurrentSlide(1):this.setCurrentSlide(this.currentSlideIndex+1)}previous(){this.currentSlideIndex<=1?"yes"===this.getAttribute("infinite")&&this.setCurrentSlide(this.getTotalSlides()):this.setCurrentSlide(this.currentSlideIndex-1)}getCurrentSlide(){return this.currentSlideIndex}setCurrentSlide(t){t>this.getTotalSlides()||t<=0||(this.dispatchEvent(new CustomEvent("slide-set",{bubbles:!0})),this.setAttribute("current-slide",t.toString()))}slide(){if("yes"===this.getAttribute("disabled"))return;const t=this.querySelector("tp-slider-slides"),e=this.querySelectorAll("tp-slider-slide");t&&e&&(this.updateHeight(),t.style.left=`-${this.offsetWidth*(this.currentSlideIndex-1)}px`)}update(){const t=this.querySelectorAll("tp-slider-nav-item"),e=this.querySelector("tp-slider-count"),i=this.querySelector('tp-slider-arrow[direction="previous"]'),s=this.querySelector('tp-slider-arrow[direction="next"]'),r=this.querySelectorAll("tp-slider-slide");null==r||r.forEach(((t,e)=>{this.currentSlideIndex-1===e?t.setAttribute("active","yes"):t.removeAttribute("active")})),t&&t.forEach(((t,e)=>{this.currentSlideIndex-1===e?t.setAttribute("current","yes"):t.removeAttribute("current")})),e&&(e.setAttribute("current",this.getCurrentSlide().toString()),e.setAttribute("total",this.getTotalSlides().toString())),"yes"!==this.getAttribute("infinite")?(this.getCurrentSlide()===this.getTotalSlides()?null==s||s.setAttribute("disabled","yes"):null==s||s.removeAttribute("disabled"),1===this.getCurrentSlide()?null==i||i.setAttribute("disabled","yes"):null==i||i.removeAttribute("disabled")):(null==s||s.removeAttribute("disabled"),null==i||i.removeAttribute("disabled"))}updateHeight(){const t=this.querySelector("tp-slider-slides");if(!t)return;if("yes"!==this.getAttribute("flexible-height"))return void t.style.removeProperty("height");const e=this.querySelectorAll("tp-slider-slide");if(!e)return;const i=e[this.currentSlideIndex-1].scrollHeight;t.style.height=`${i}px`}handleResize(){this.setAttribute("resizing","yes"),this.slide();const t=this;setTimeout((function(){t.removeAttribute("resizing")}),10)}handleTouchStart(t){"yes"===this.getAttribute("swipe")&&(this.touchStartX=t.touches[0].clientX)}handleTouchEnd(t){if("yes"!==this.getAttribute("swipe"))return;const e=t.changedTouches[0].clientX-this.touchStartX;e>0?this.previous():e<0&&this.next()}}class e extends HTMLElement{}class i extends HTMLElement{}class s extends HTMLElement{connectedCallback(){var t;null===(t=this.querySelector("button"))||void 0===t||t.addEventListener("click",this.handleClick.bind(this))}handleClick(){if("yes"===this.getAttribute("disabled"))return;const t=this.closest("tp-slider");t&&("previous"===this.getAttribute("direction")?t.previous():"next"===this.getAttribute("direction")&&t.next())}}class r extends HTMLElement{}class l extends HTMLElement{connectedCallback(){var t;null===(t=this.querySelector("button"))||void 0===t||t.addEventListener("click",this.handleClick.bind(this))}handleClick(){const t=this.closest("tp-slider");t&&t.setCurrentSlide(this.getIndex())}getIndex(){var t,e;if(this.getAttribute("index"))return parseInt(null!==(t=this.getAttribute("index"))&&void 0!==t?t:"0");const i=this.closest("tp-slider-nav");return Array.from(null!==(e=null==i?void 0:i.children)&&void 0!==e?e:[]).indexOf(this)+1}}class n extends HTMLElement{static get observedAttributes(){return["current","total","format"]}get format(){var t;return null!==(t=this.getAttribute("format"))&&void 0!==t?t:"$current / $total"}set format(t){this.setAttribute("format",t)}attributeChangedCallback(){this.update()}update(){var t,e;this.innerHTML=this.format.replace("$current",null!==(t=this.getAttribute("current"))&&void 0!==t?t:"").replace("$total",null!==(e=this.getAttribute("total"))&&void 0!==e?e:"")}}customElements.define("tp-slider",t),customElements.define("tp-slider-slides",e),customElements.define("tp-slider-slide",i),customElements.define("tp-slider-arrow",s),customElements.define("tp-slider-nav",r),customElements.define("tp-slider-nav-item",l),customElements.define("tp-slider-count",n)})();
1
+ (()=>{"use strict";class t extends HTMLElement{constructor(){super(),this.touchStartX=0,this.getAttribute("current-slide")||this.setAttribute("current-slide","1"),this.slide(),this.setAttribute("initialized","yes"),window.addEventListener("resize",this.handleResize.bind(this)),this.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.addEventListener("touchend",this.handleTouchEnd.bind(this))}static get observedAttributes(){return["current-slide","flexible-height","infinite","swipe"]}attributeChangedCallback(t="",e="",i=""){"current-slide"===t&&e!==i&&(this.slide(),this.dispatchEvent(new CustomEvent("slide-complete",{bubbles:!0}))),this.update()}get currentSlideIndex(){var t;return parseInt(null!==(t=this.getAttribute("current-slide"))&&void 0!==t?t:"1")}set currentSlideIndex(t){this.setCurrentSlide(t)}getTotalSlides(){const t=this.querySelectorAll("tp-slider-slide");return t?t.length:0}next(){const t=this.getTotalSlides();this.currentSlideIndex>=t?"yes"===this.getAttribute("infinite")&&this.setCurrentSlide(1):this.setCurrentSlide(this.currentSlideIndex+1)}previous(){this.currentSlideIndex<=1?"yes"===this.getAttribute("infinite")&&this.setCurrentSlide(this.getTotalSlides()):this.setCurrentSlide(this.currentSlideIndex-1)}getCurrentSlide(){return this.currentSlideIndex}setCurrentSlide(t){t>this.getTotalSlides()||t<=0||(this.dispatchEvent(new CustomEvent("slide-set",{bubbles:!0})),this.setAttribute("current-slide",t.toString()))}slide(){if("yes"===this.getAttribute("disabled"))return;const t=this.querySelector("tp-slider-slides"),e=this.querySelectorAll("tp-slider-slide");t&&e&&(this.updateHeight(),"fade"!==(this.getAttribute("behaviour")||"")&&(t.style.left=`-${this.offsetWidth*(this.currentSlideIndex-1)}px`))}update(){const t=this.querySelectorAll("tp-slider-nav-item"),e=this.querySelector("tp-slider-count"),i=this.querySelector('tp-slider-arrow[direction="previous"]'),s=this.querySelector('tp-slider-arrow[direction="next"]'),r=this.querySelectorAll("tp-slider-slide");null==r||r.forEach(((t,e)=>{this.currentSlideIndex-1===e?t.setAttribute("active","yes"):t.removeAttribute("active")})),t&&t.forEach(((t,e)=>{this.currentSlideIndex-1===e?t.setAttribute("current","yes"):t.removeAttribute("current")})),e&&(e.setAttribute("current",this.getCurrentSlide().toString()),e.setAttribute("total",this.getTotalSlides().toString())),"yes"!==this.getAttribute("infinite")?(this.getCurrentSlide()===this.getTotalSlides()?null==s||s.setAttribute("disabled","yes"):null==s||s.removeAttribute("disabled"),1===this.getCurrentSlide()?null==i||i.setAttribute("disabled","yes"):null==i||i.removeAttribute("disabled")):(null==s||s.removeAttribute("disabled"),null==i||i.removeAttribute("disabled"))}updateHeight(){const t=this.querySelector("tp-slider-slides");if(!t)return;if("yes"!==this.getAttribute("flexible-height"))return void t.style.removeProperty("height");const e=this.querySelectorAll("tp-slider-slide");if(!e)return;const i=e[this.currentSlideIndex-1].scrollHeight;t.style.height=`${i}px`}handleResize(){this.setAttribute("resizing","yes"),this.slide();const t=this;setTimeout((function(){t.removeAttribute("resizing")}),10)}handleTouchStart(t){"yes"===this.getAttribute("swipe")&&(this.touchStartX=t.touches[0].clientX)}handleTouchEnd(t){if("yes"!==this.getAttribute("swipe"))return;const e=t.changedTouches[0].clientX-this.touchStartX;e>0?this.previous():e<0&&this.next()}}class e extends HTMLElement{}class i extends HTMLElement{}class s extends HTMLElement{connectedCallback(){var t;null===(t=this.querySelector("button"))||void 0===t||t.addEventListener("click",this.handleClick.bind(this))}handleClick(){if("yes"===this.getAttribute("disabled"))return;const t=this.closest("tp-slider");t&&("previous"===this.getAttribute("direction")?t.previous():"next"===this.getAttribute("direction")&&t.next())}}class r extends HTMLElement{}class l extends HTMLElement{connectedCallback(){var t;null===(t=this.querySelector("button"))||void 0===t||t.addEventListener("click",this.handleClick.bind(this))}handleClick(){const t=this.closest("tp-slider");t&&t.setCurrentSlide(this.getIndex())}getIndex(){var t,e;if(this.getAttribute("index"))return parseInt(null!==(t=this.getAttribute("index"))&&void 0!==t?t:"0");const i=this.closest("tp-slider-nav");return Array.from(null!==(e=null==i?void 0:i.children)&&void 0!==e?e:[]).indexOf(this)+1}}class n extends HTMLElement{static get observedAttributes(){return["current","total","format"]}get format(){var t;return null!==(t=this.getAttribute("format"))&&void 0!==t?t:"$current / $total"}set format(t){this.setAttribute("format",t)}attributeChangedCallback(){this.update()}update(){var t,e;this.innerHTML=this.format.replace("$current",null!==(t=this.getAttribute("current"))&&void 0!==t?t:"").replace("$total",null!==(e=this.getAttribute("total"))&&void 0!==e?e:"")}}customElements.define("tp-slider",t),customElements.define("tp-slider-slides",e),customElements.define("tp-slider-slide",i),customElements.define("tp-slider-arrow",s),customElements.define("tp-slider-nav",r),customElements.define("tp-slider-nav-item",l),customElements.define("tp-slider-count",n)})();
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist/slider/index.js","mappings":"mBAYO,MAAMA,UAAwBC,YASpC,WAAAC,GACCC,QANS,KAAAC,YAAsB,EASxBC,KAAKC,aAAc,kBACzBD,KAAKE,aAAc,gBAAiB,KAIrCF,KAAKG,QACLH,KAAKE,aAAc,cAAe,OAGlCE,OAAOC,iBAAkB,SAAUL,KAAKM,aAAaC,KAAMP,OAC3DA,KAAKK,iBAAkB,aAAcL,KAAKQ,iBAAiBD,KAAMP,OACjEA,KAAKK,iBAAkB,WAAYL,KAAKS,eAAeF,KAAMP,MAC9D,CAOA,6BAAWU,GACV,MAAO,CAAE,gBAAiB,kBAAmB,WAC9C,CASA,wBAAAC,CAA0BC,EAAe,GAAIC,EAAmB,GAAIC,EAAmB,IACjF,kBAAoBF,GAAQC,IAAaC,IAC7Cd,KAAKG,QACLH,KAAKe,cAAe,IAAIC,YAAa,iBAAkB,CAAEC,SAAS,MAGnEjB,KAAKkB,QACN,CAOA,qBAAIC,G,MACH,OAAOC,SAA8C,QAApC,EAAApB,KAAKC,aAAc,w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KAAKwE,UACJxE,KAAKuE,OACHE,QAAS,WAA0C,QAA9B,EAAAzE,KAAKC,aAAc,kBAAW,QAAI,IACvDwE,QAAS,SAAsC,QAA5B,EAAAzE,KAAKC,aAAc,gBAAS,QAAI,GACvD,EC3BDyE,eAAeC,OAAQ,YAAahF,GACpC+E,eAAeC,OAAQ,mBAAoBpB,GAC3CmB,eAAeC,OAAQ,kBAAmBnB,GAC1CkB,eAAeC,OAAQ,kBAAmBlB,GAC1CiB,eAAeC,OAAQ,gBAAiBb,GACxCY,eAAeC,OAAQ,qBAAsBZ,GAC7CW,eAAeC,OAAQ,kBAAmBL,E","sources":["webpack://@travelopia/web-components/./src/slider/tp-slider.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-slides.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-slide.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-arrow.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-nav.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-nav-item.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-count.ts","webpack://@travelopia/web-components/./src/slider/index.ts"],"sourcesContent":["/**\n * Internal dependencies.\n */\nimport { TPSliderSlidesElement } from './tp-slider-slides';\nimport { TPSliderSlideElement } from './tp-slider-slide';\nimport { TPSliderCountElement } from './tp-slider-count';\nimport { TPSliderNavItemElement } from './tp-slider-nav-item';\nimport { TPSliderArrowElement } from './tp-slider-arrow';\n\n/**\n * TP Slider.\n */\nexport class TPSliderElement extends HTMLElement {\n\t/**\n\t * Properties.\n\t */\n\tprotected touchStartX: number = 0;\n\n\t/**\n\t * Constructor.\n\t */\n\tconstructor() {\n\t\tsuper();\n\n\t\t// Set current slide.\n\t\tif ( ! this.getAttribute( 'current-slide' ) ) {\n\t\t\tthis.setAttribute( 'current-slide', '1' );\n\t\t}\n\n\t\t// Initialize slider.\n\t\tthis.slide();\n\t\tthis.setAttribute( 'initialized', 'yes' );\n\n\t\t// Event listeners.\n\t\twindow.addEventListener( 'resize', this.handleResize.bind( this ) );\n\t\tthis.addEventListener( 'touchstart', this.handleTouchStart.bind( this ) );\n\t\tthis.addEventListener( 'touchend', this.handleTouchEnd.bind( this ) );\n\t}\n\n\t/**\n\t * Get observed attributes.\n\t *\n\t * @return {Array} List of observed attributes.\n\t */\n\tstatic get observedAttributes(): string[] {\n\t\treturn [ 'current-slide', 'flexible-height', 'infinite' ];\n\t}\n\n\t/**\n\t * Attribute changed callback.\n\t *\n\t * @param {string} name Attribute name.\n\t * @param {string} oldValue Old value.\n\t * @param {string} newValue New value.\n\t */\n\tattributeChangedCallback( name: string = '', oldValue: string = '', newValue: string = '' ): void {\n\t\tif ( 'current-slide' === name && oldValue !== newValue ) {\n\t\t\tthis.slide();\n\t\t\tthis.dispatchEvent( new CustomEvent( 'slide-complete', { bubbles: true } ) );\n\t\t}\n\n\t\tthis.update();\n\t}\n\n\t/**\n\t * Get current slide index.\n\t *\n\t * @return {number} Current slide index.\n\t */\n\tget currentSlideIndex(): number {\n\t\treturn parseInt( this.getAttribute( 'current-slide' ) ?? '1' );\n\t}\n\n\t/**\n\t * Set current slide index.\n\t *\n\t * @param {number} index Slide index.\n\t */\n\tset currentSlideIndex( index: number ) {\n\t\tthis.setCurrentSlide( index );\n\t}\n\n\t/**\n\t * Get total number of slides.\n\t *\n\t * @return {number} Total slides.\n\t */\n\tgetTotalSlides(): number {\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tif ( slides ) {\n\t\t\treturn slides.length;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Navigate to the next slide.\n\t */\n\tnext(): void {\n\t\tconst totalSlides: number = this.getTotalSlides();\n\n\t\tif ( this.currentSlideIndex >= totalSlides ) {\n\t\t\tif ( 'yes' === this.getAttribute( 'infinite' ) ) {\n\t\t\t\tthis.setCurrentSlide( 1 );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setCurrentSlide( this.currentSlideIndex + 1 );\n\t}\n\n\t/**\n\t * Navigate to the previous slide.\n\t */\n\tprevious(): void {\n\t\tif ( this.currentSlideIndex <= 1 ) {\n\t\t\tif ( 'yes' === this.getAttribute( 'infinite' ) ) {\n\t\t\t\tthis.setCurrentSlide( this.getTotalSlides() );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setCurrentSlide( this.currentSlideIndex - 1 );\n\t}\n\n\t/**\n\t * Get current slide index.\n\t *\n\t * @return {number} Current slide index.\n\t */\n\tgetCurrentSlide(): number {\n\t\treturn this.currentSlideIndex;\n\t}\n\n\t/**\n\t * Set the current slide index.\n\t *\n\t * @param {number} index Slide index.\n\t */\n\tsetCurrentSlide( index: number ): void {\n\t\tif ( index > this.getTotalSlides() || index <= 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.dispatchEvent( new CustomEvent( 'slide-set', { bubbles: true } ) );\n\t\tthis.setAttribute( 'current-slide', index.toString() );\n\t}\n\n\t/**\n\t * Slide to the current slide.\n\t *\n\t * @protected\n\t */\n\tprotected slide(): void {\n\t\t// Check if slider is disabled.\n\t\tif ( 'yes' === this.getAttribute( 'disabled' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get slides.\n\t\tconst slidesContainer: TPSliderSlidesElement | null = this.querySelector( 'tp-slider-slides' );\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tif ( ! slidesContainer || ! slides ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// First, update the height.\n\t\tthis.updateHeight();\n\n\t\t// Now lets slide!\n\t\tslidesContainer.style.left = `-${ this.offsetWidth * ( this.currentSlideIndex - 1 ) }px`;\n\t}\n\n\t/**\n\t * Update stuff when any attribute has changed.\n\t * Example: Update subcomponents.\n\t */\n\tupdate(): void {\n\t\t// Get subcomponents.\n\t\tconst sliderNavItems: NodeListOf<TPSliderNavItemElement> | null = this.querySelectorAll( 'tp-slider-nav-item' );\n\t\tconst sliderCount: TPSliderCountElement | null = this.querySelector( 'tp-slider-count' );\n\t\tconst leftArrow: TPSliderArrowElement | null = this.querySelector( 'tp-slider-arrow[direction=\"previous\"]' );\n\t\tconst rightArrow: TPSliderArrowElement | null = this.querySelector( 'tp-slider-arrow[direction=\"next\"]' );\n\n\t\t// Set active slide.\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tslides?.forEach( ( slide: TPSliderSlideElement, index: number ): void => {\n\t\t\tif ( this.currentSlideIndex - 1 === index ) {\n\t\t\t\tslide.setAttribute( 'active', 'yes' );\n\t\t\t} else {\n\t\t\t\tslide.removeAttribute( 'active' );\n\t\t\t}\n\t\t} );\n\n\t\t// Set current slider nav item.\n\t\tif ( sliderNavItems ) {\n\t\t\tsliderNavItems.forEach( ( navItem: TPSliderNavItemElement, index: number ): void => {\n\t\t\t\tif ( this.currentSlideIndex - 1 === index ) {\n\t\t\t\t\tnavItem.setAttribute( 'current', 'yes' );\n\t\t\t\t} else {\n\t\t\t\t\tnavItem.removeAttribute( 'current' );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Update slider count.\n\t\tif ( sliderCount ) {\n\t\t\tsliderCount.setAttribute( 'current', this.getCurrentSlide().toString() );\n\t\t\tsliderCount.setAttribute( 'total', this.getTotalSlides().toString() );\n\t\t}\n\n\t\t// Enable / disable arrows.\n\t\tif ( 'yes' !== this.getAttribute( 'infinite' ) ) {\n\t\t\tif ( this.getCurrentSlide() === this.getTotalSlides() ) {\n\t\t\t\trightArrow?.setAttribute( 'disabled', 'yes' );\n\t\t\t} else {\n\t\t\t\trightArrow?.removeAttribute( 'disabled' );\n\t\t\t}\n\n\t\t\tif ( 1 === this.getCurrentSlide() ) {\n\t\t\t\tleftArrow?.setAttribute( 'disabled', 'yes' );\n\t\t\t} else {\n\t\t\t\tleftArrow?.removeAttribute( 'disabled' );\n\t\t\t}\n\t\t} else {\n\t\t\trightArrow?.removeAttribute( 'disabled' );\n\t\t\tleftArrow?.removeAttribute( 'disabled' );\n\t\t}\n\t}\n\n\t/**\n\t * Update the height of the slider based on current slide.\n\t */\n\tupdateHeight(): void {\n\t\t// Get slides container to resize.\n\t\tconst slidesContainer: TPSliderSlidesElement | null = this.querySelector( 'tp-slider-slides' );\n\t\tif ( ! slidesContainer ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail early if we don't want it to be flexible height.\n\t\tif ( 'yes' !== this.getAttribute( 'flexible-height' ) ) {\n\t\t\t// Remove height property for good measure!\n\t\t\tslidesContainer.style.removeProperty( 'height' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Get slides.\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tif ( ! slides ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set the height of the container to be the height of the current slide.\n\t\tconst height: number = slides[ this.currentSlideIndex - 1 ].scrollHeight;\n\t\tslidesContainer.style.height = `${ height }px`;\n\t}\n\n\t/**\n\t * Resize the slider when the window is resized.\n\t *\n\t * @protected\n\t */\n\tprotected handleResize(): void {\n\t\t// First, lets flag this component as resizing.\n\t\tthis.setAttribute( 'resizing', 'yes' );\n\n\t\t// Run the slide (so height can be resized).\n\t\tthis.slide();\n\n\t\t// Done, let's remove the flag.\n\t\t// We need to do this on a timeout to avoid a race condition with transitions.\n\t\tconst _this = this;\n\t\tsetTimeout( function() {\n\t\t\t_this.removeAttribute( 'resizing' );\n\t\t}, 10 );\n\t}\n\n\t/**\n\t * Detect touch start event, and store the starting location.\n\t *\n\t * @param {Event} e Touch event.\n\t *\n\t * @protected\n\t */\n\tprotected handleTouchStart( e: TouchEvent ): void {\n\t\tif ( 'yes' === this.getAttribute( 'swipe' ) ) {\n\t\t\tthis.touchStartX = e.touches[ 0 ].clientX;\n\t\t}\n\t}\n\n\t/**\n\t * Detect touch end event, and check if it was a left or right swipe.\n\t *\n\t * @param {Event} e Touch event.\n\t *\n\t * @protected\n\t */\n\tprotected handleTouchEnd( e: TouchEvent ): void {\n\t\tif ( 'yes' !== this.getAttribute( 'swipe' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst touchEndX: number = e.changedTouches[ 0 ].clientX;\n\t\tconst swipeDistance: number = touchEndX - this.touchStartX;\n\n\t\tif ( swipeDistance > 0 ) {\n\t\t\tthis.previous();\n\t\t} else if ( swipeDistance < 0 ) {\n\t\t\tthis.next();\n\t\t}\n\t}\n}\n","/**\n * TP Slider Slides.\n */\nexport class TPSliderSlidesElement extends HTMLElement {\n}\n","/**\n * TP Slider Slide.\n */\nexport class TPSliderSlideElement extends HTMLElement {\n}\n","/**\n * Internal dependencies.\n */\nimport { TPSliderElement } from './tp-slider';\n\n/**\n * TP Slider Arrow.\n */\nexport class TPSliderArrowElement extends HTMLElement {\n\t/**\n\t * Connected callback.\n\t */\n\tconnectedCallback(): void {\n\t\tthis.querySelector( 'button' )?.addEventListener( 'click', this.handleClick.bind( this ) );\n\t}\n\n\t/**\n\t * Handle when the button is clicked.\n\t */\n\thandleClick(): void {\n\t\tif ( 'yes' === this.getAttribute( 'disabled' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst slider: TPSliderElement | null = this.closest( 'tp-slider' );\n\t\tif ( ! slider ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'previous' === this.getAttribute( 'direction' ) ) {\n\t\t\tslider.previous();\n\t\t} else if ( 'next' === this.getAttribute( 'direction' ) ) {\n\t\t\tslider.next();\n\t\t}\n\t}\n}\n","/**\n * TP Slider Nav.\n */\nexport class TPSliderNavElement extends HTMLElement {\n}\n","/**\n * Internal dependencies.\n */\nimport { TPSliderElement } from './tp-slider';\nimport { TPSliderNavElement } from './tp-slider-nav';\n\n/**\n * TP Slider Nav Item.\n */\nexport class TPSliderNavItemElement extends HTMLElement {\n\t/**\n\t * Connected callback.\n\t */\n\tconnectedCallback(): void {\n\t\tthis.querySelector( 'button' )?.addEventListener( 'click', this.handleClick.bind( this ) );\n\t}\n\n\t/**\n\t * Handle when the button is clicked.\n\t */\n\thandleClick(): void {\n\t\tconst slider: TPSliderElement | null = this.closest( 'tp-slider' );\n\t\tif ( ! slider ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslider.setCurrentSlide( this.getIndex() );\n\t}\n\n\t/**\n\t * Get index of this item inside the navigation.\n\t *\n\t * @return {number} Index.\n\t */\n\tgetIndex(): number {\n\t\tif ( this.getAttribute( 'index' ) ) {\n\t\t\treturn parseInt( this.getAttribute( 'index' ) ?? '0' );\n\t\t}\n\n\t\tconst slideNav: TPSliderNavElement | null = this.closest( 'tp-slider-nav' );\n\t\treturn Array.from( slideNav?.children ?? [] ).indexOf( this ) + 1;\n\t}\n}\n","/**\n * TP Slider Count.\n */\nexport class TPSliderCountElement extends HTMLElement {\n\t/**\n\t * Get observed attributes.\n\t *\n\t * @return {Array} Observed attributes.\n\t */\n\tstatic get observedAttributes(): string[] {\n\t\treturn [ 'current', 'total', 'format' ];\n\t}\n\n\t/**\n\t * Get format.\n\t *\n\t * @return {string} Format.\n\t */\n\tget format(): string {\n\t\treturn this.getAttribute( 'format' ) ?? '$current / $total';\n\t}\n\n\t/**\n\t * Set format.\n\t *\n\t * @param {string} format Format.\n\t */\n\tset format( format: string ) {\n\t\tthis.setAttribute( 'format', format );\n\t}\n\n\t/**\n\t * Attribute changed callback.\n\t */\n\tattributeChangedCallback(): void {\n\t\tthis.update();\n\t}\n\n\t/**\n\t * Update component.\n\t */\n\tupdate(): void {\n\t\tthis.innerHTML =\n\t\t\tthis.format\n\t\t\t\t.replace( '$current', this.getAttribute( 'current' ) ?? '' )\n\t\t\t\t.replace( '$total', this.getAttribute( 'total' ) ?? '' );\n\t}\n}\n","/**\n * Styles.\n */\nimport './style.scss';\n\n/**\n * Components.\n */\nimport { TPSliderElement } from './tp-slider';\nimport { TPSliderSlidesElement } from './tp-slider-slides';\nimport { TPSliderSlideElement } from './tp-slider-slide';\nimport { TPSliderArrowElement } from './tp-slider-arrow';\nimport { TPSliderNavElement } from './tp-slider-nav';\nimport { TPSliderNavItemElement } from './tp-slider-nav-item';\nimport { TPSliderCountElement } from './tp-slider-count';\n\n/**\n * Register Components.\n */\ncustomElements.define( 'tp-slider', TPSliderElement );\ncustomElements.define( 'tp-slider-slides', TPSliderSlidesElement );\ncustomElements.define( 'tp-slider-slide', TPSliderSlideElement );\ncustomElements.define( 'tp-slider-arrow', TPSliderArrowElement );\ncustomElements.define( 'tp-slider-nav', TPSliderNavElement );\ncustomElements.define( 'tp-slider-nav-item', TPSliderNavItemElement );\ncustomElements.define( 'tp-slider-count', TPSliderCountElement );\n"],"names":["TPSliderElement","HTMLElement","constructor","super","touchStartX","this","getAttribute","setAttribute","slide","window","addEventListener","handleResize","bind","handleTouchStart","handleTouchEnd","observedAttributes","attributeChangedCallback","name","oldValue","newValue","dispatchEvent","CustomEvent","bubbles","update","currentSlideIndex","parseInt","index","setCurrentSlide","getTotalSlides","slides","querySelectorAll","length","next","totalSlides","previous","getCurrentSlide","toString","slidesContainer","querySelector","updateHeight","style","left","offsetWidth","sliderNavItems","sliderCount","leftArrow","rightArrow","forEach","removeAttribute","navItem","removeProperty","height","scrollHeight","_this","setTimeout","e","touches","clientX","swipeDistance","changedTouches","TPSliderSlidesElement","TPSliderSlideElement","TPSliderArrowElement","connectedCallback","handleClick","slider","closest","TPSliderNavElement","TPSliderNavItemElement","getIndex","slideNav","Array","from","children","indexOf","TPSliderCountElement","format","innerHTML","replace","customElements","define"],"sourceRoot":""}
1
+ {"version":3,"file":"dist/slider/index.js","mappings":"mBAYO,MAAMA,UAAwBC,YASpC,WAAAC,GACCC,QANS,KAAAC,YAAsB,EASxBC,KAAKC,aAAc,kBACzBD,KAAKE,aAAc,gBAAiB,KAIrCF,KAAKG,QACLH,KAAKE,aAAc,cAAe,OAGlCE,OAAOC,iBAAkB,SAAUL,KAAKM,aAAaC,KAAMP,OAC3DA,KAAKK,iBAAkB,aAAcL,KAAKQ,iB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,KAGlD,MAAMgE,EAAsCjE,KAAK6D,QAAS,iBAC1D,OAAOK,MAAMC,KAAwB,QAAlB,EAAAF,aAAQ,EAARA,EAAUG,gBAAQ,QAAI,IAAKC,QAASrE,MAAS,CACjE,ECtCM,MAAMsE,UAA6B1E,YAMzC,6BAAWc,GACV,MAAO,CAAE,UAAW,QAAS,SAC9B,CAOA,UAAI6D,G,MACH,OAAoC,QAA7B,EAAAvE,KAAKC,aAAc,iBAAU,QAAI,mBACzC,CAOA,UAAIsE,CAAQA,GACXvE,KAAKE,aAAc,SAAUqE,EAC9B,CAKA,wBAAA5D,GACCX,KAAKkB,QACN,CAKA,MAAAA,G,QACClB,KAAKwE,UACJxE,KAAKuE,OACHE,QAAS,WAA0C,QAA9B,EAAAzE,KAAKC,aAAc,kBAAW,QAAI,IACvDwE,QAAS,SAAsC,QAA5B,EAAAzE,KAAKC,aAAc,gBAAS,QAAI,GACvD,EC3BDyE,eAAeC,OAAQ,YAAahF,GACpC+E,eAAeC,OAAQ,mBAAoBpB,GAC3CmB,eAAeC,OAAQ,kBAAmBnB,GAC1CkB,eAAeC,OAAQ,kBAAmBlB,GAC1CiB,eAAeC,OAAQ,gBAAiBb,GACxCY,eAAeC,OAAQ,qBAAsBZ,GAC7CW,eAAeC,OAAQ,kBAAmBL,E","sources":["webpack://@travelopia/web-components/./src/slider/tp-slider.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-slides.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-slide.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-arrow.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-nav.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-nav-item.ts","webpack://@travelopia/web-components/./src/slider/tp-slider-count.ts","webpack://@travelopia/web-components/./src/slider/index.ts"],"sourcesContent":["/**\n * Internal dependencies.\n */\nimport { TPSliderSlidesElement } from './tp-slider-slides';\nimport { TPSliderSlideElement } from './tp-slider-slide';\nimport { TPSliderCountElement } from './tp-slider-count';\nimport { TPSliderNavItemElement } from './tp-slider-nav-item';\nimport { TPSliderArrowElement } from './tp-slider-arrow';\n\n/**\n * TP Slider.\n */\nexport class TPSliderElement extends HTMLElement {\n\t/**\n\t * Properties.\n\t */\n\tprotected touchStartX: number = 0;\n\n\t/**\n\t * Constructor.\n\t */\n\tconstructor() {\n\t\tsuper();\n\n\t\t// Set current slide.\n\t\tif ( ! this.getAttribute( 'current-slide' ) ) {\n\t\t\tthis.setAttribute( 'current-slide', '1' );\n\t\t}\n\n\t\t// Initialize slider.\n\t\tthis.slide();\n\t\tthis.setAttribute( 'initialized', 'yes' );\n\n\t\t// Event listeners.\n\t\twindow.addEventListener( 'resize', this.handleResize.bind( this ) );\n\t\tthis.addEventListener( 'touchstart', this.handleTouchStart.bind( this ) );\n\t\tthis.addEventListener( 'touchend', this.handleTouchEnd.bind( this ) );\n\t}\n\n\t/**\n\t * Get observed attributes.\n\t *\n\t * @return {Array} List of observed attributes.\n\t */\n\tstatic get observedAttributes(): string[] {\n\t\treturn [ 'current-slide', 'flexible-height', 'infinite', 'swipe' ];\n\t}\n\n\t/**\n\t * Attribute changed callback.\n\t *\n\t * @param {string} name Attribute name.\n\t * @param {string} oldValue Old value.\n\t * @param {string} newValue New value.\n\t */\n\tattributeChangedCallback( name: string = '', oldValue: string = '', newValue: string = '' ): void {\n\t\tif ( 'current-slide' === name && oldValue !== newValue ) {\n\t\t\tthis.slide();\n\t\t\tthis.dispatchEvent( new CustomEvent( 'slide-complete', { bubbles: true } ) );\n\t\t}\n\n\t\tthis.update();\n\t}\n\n\t/**\n\t * Get current slide index.\n\t *\n\t * @return {number} Current slide index.\n\t */\n\tget currentSlideIndex(): number {\n\t\treturn parseInt( this.getAttribute( 'current-slide' ) ?? '1' );\n\t}\n\n\t/**\n\t * Set current slide index.\n\t *\n\t * @param {number} index Slide index.\n\t */\n\tset currentSlideIndex( index: number ) {\n\t\tthis.setCurrentSlide( index );\n\t}\n\n\t/**\n\t * Get total number of slides.\n\t *\n\t * @return {number} Total slides.\n\t */\n\tgetTotalSlides(): number {\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tif ( slides ) {\n\t\t\treturn slides.length;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Navigate to the next slide.\n\t */\n\tnext(): void {\n\t\tconst totalSlides: number = this.getTotalSlides();\n\n\t\tif ( this.currentSlideIndex >= totalSlides ) {\n\t\t\tif ( 'yes' === this.getAttribute( 'infinite' ) ) {\n\t\t\t\tthis.setCurrentSlide( 1 );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setCurrentSlide( this.currentSlideIndex + 1 );\n\t}\n\n\t/**\n\t * Navigate to the previous slide.\n\t */\n\tprevious(): void {\n\t\tif ( this.currentSlideIndex <= 1 ) {\n\t\t\tif ( 'yes' === this.getAttribute( 'infinite' ) ) {\n\t\t\t\tthis.setCurrentSlide( this.getTotalSlides() );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setCurrentSlide( this.currentSlideIndex - 1 );\n\t}\n\n\t/**\n\t * Get current slide index.\n\t *\n\t * @return {number} Current slide index.\n\t */\n\tgetCurrentSlide(): number {\n\t\treturn this.currentSlideIndex;\n\t}\n\n\t/**\n\t * Set the current slide index.\n\t *\n\t * @param {number} index Slide index.\n\t */\n\tsetCurrentSlide( index: number ): void {\n\t\tif ( index > this.getTotalSlides() || index <= 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.dispatchEvent( new CustomEvent( 'slide-set', { bubbles: true } ) );\n\t\tthis.setAttribute( 'current-slide', index.toString() );\n\t}\n\n\t/**\n\t * Slide to the current slide.\n\t *\n\t * @protected\n\t */\n\tprotected slide(): void {\n\t\t// Check if slider is disabled.\n\t\tif ( 'yes' === this.getAttribute( 'disabled' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get slides.\n\t\tconst slidesContainer: TPSliderSlidesElement | null = this.querySelector( 'tp-slider-slides' );\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tif ( ! slidesContainer || ! slides ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// First, update the height.\n\t\tthis.updateHeight();\n\n\t\t// Now lets slide!\n\t\tconst behaviour: string = this.getAttribute( 'behaviour' ) || '';\n\t\tif ( 'fade' !== behaviour ) {\n\t\t\tslidesContainer.style.left = `-${ this.offsetWidth * ( this.currentSlideIndex - 1 ) }px`;\n\t\t}\n\t}\n\n\t/**\n\t * Update stuff when any attribute has changed.\n\t * Example: Update subcomponents.\n\t */\n\tupdate(): void {\n\t\t// Get subcomponents.\n\t\tconst sliderNavItems: NodeListOf<TPSliderNavItemElement> | null = this.querySelectorAll( 'tp-slider-nav-item' );\n\t\tconst sliderCount: TPSliderCountElement | null = this.querySelector( 'tp-slider-count' );\n\t\tconst leftArrow: TPSliderArrowElement | null = this.querySelector( 'tp-slider-arrow[direction=\"previous\"]' );\n\t\tconst rightArrow: TPSliderArrowElement | null = this.querySelector( 'tp-slider-arrow[direction=\"next\"]' );\n\n\t\t// Set active slide.\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tslides?.forEach( ( slide: TPSliderSlideElement, index: number ): void => {\n\t\t\tif ( this.currentSlideIndex - 1 === index ) {\n\t\t\t\tslide.setAttribute( 'active', 'yes' );\n\t\t\t} else {\n\t\t\t\tslide.removeAttribute( 'active' );\n\t\t\t}\n\t\t} );\n\n\t\t// Set current slider nav item.\n\t\tif ( sliderNavItems ) {\n\t\t\tsliderNavItems.forEach( ( navItem: TPSliderNavItemElement, index: number ): void => {\n\t\t\t\tif ( this.currentSlideIndex - 1 === index ) {\n\t\t\t\t\tnavItem.setAttribute( 'current', 'yes' );\n\t\t\t\t} else {\n\t\t\t\t\tnavItem.removeAttribute( 'current' );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Update slider count.\n\t\tif ( sliderCount ) {\n\t\t\tsliderCount.setAttribute( 'current', this.getCurrentSlide().toString() );\n\t\t\tsliderCount.setAttribute( 'total', this.getTotalSlides().toString() );\n\t\t}\n\n\t\t// Enable / disable arrows.\n\t\tif ( 'yes' !== this.getAttribute( 'infinite' ) ) {\n\t\t\tif ( this.getCurrentSlide() === this.getTotalSlides() ) {\n\t\t\t\trightArrow?.setAttribute( 'disabled', 'yes' );\n\t\t\t} else {\n\t\t\t\trightArrow?.removeAttribute( 'disabled' );\n\t\t\t}\n\n\t\t\tif ( 1 === this.getCurrentSlide() ) {\n\t\t\t\tleftArrow?.setAttribute( 'disabled', 'yes' );\n\t\t\t} else {\n\t\t\t\tleftArrow?.removeAttribute( 'disabled' );\n\t\t\t}\n\t\t} else {\n\t\t\trightArrow?.removeAttribute( 'disabled' );\n\t\t\tleftArrow?.removeAttribute( 'disabled' );\n\t\t}\n\t}\n\n\t/**\n\t * Update the height of the slider based on current slide.\n\t */\n\tupdateHeight(): void {\n\t\t// Get slides container to resize.\n\t\tconst slidesContainer: TPSliderSlidesElement | null = this.querySelector( 'tp-slider-slides' );\n\t\tif ( ! slidesContainer ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail early if we don't want it to be flexible height.\n\t\tif ( 'yes' !== this.getAttribute( 'flexible-height' ) ) {\n\t\t\t// Remove height property for good measure!\n\t\t\tslidesContainer.style.removeProperty( 'height' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Get slides.\n\t\tconst slides: NodeListOf<TPSliderSlideElement> | null = this.querySelectorAll( 'tp-slider-slide' );\n\t\tif ( ! slides ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set the height of the container to be the height of the current slide.\n\t\tconst height: number = slides[ this.currentSlideIndex - 1 ].scrollHeight;\n\t\tslidesContainer.style.height = `${ height }px`;\n\t}\n\n\t/**\n\t * Resize the slider when the window is resized.\n\t *\n\t * @protected\n\t */\n\tprotected handleResize(): void {\n\t\t// First, lets flag this component as resizing.\n\t\tthis.setAttribute( 'resizing', 'yes' );\n\n\t\t// Run the slide (so height can be resized).\n\t\tthis.slide();\n\n\t\t// Done, let's remove the flag.\n\t\t// We need to do this on a timeout to avoid a race condition with transitions.\n\t\tconst _this = this;\n\t\tsetTimeout( function() {\n\t\t\t_this.removeAttribute( 'resizing' );\n\t\t}, 10 );\n\t}\n\n\t/**\n\t * Detect touch start event, and store the starting location.\n\t *\n\t * @param {Event} e Touch event.\n\t *\n\t * @protected\n\t */\n\tprotected handleTouchStart( e: TouchEvent ): void {\n\t\tif ( 'yes' === this.getAttribute( 'swipe' ) ) {\n\t\t\tthis.touchStartX = e.touches[ 0 ].clientX;\n\t\t}\n\t}\n\n\t/**\n\t * Detect touch end event, and check if it was a left or right swipe.\n\t *\n\t * @param {Event} e Touch event.\n\t *\n\t * @protected\n\t */\n\tprotected handleTouchEnd( e: TouchEvent ): void {\n\t\tif ( 'yes' !== this.getAttribute( 'swipe' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst touchEndX: number = e.changedTouches[ 0 ].clientX;\n\t\tconst swipeDistance: number = touchEndX - this.touchStartX;\n\n\t\tif ( swipeDistance > 0 ) {\n\t\t\tthis.previous();\n\t\t} else if ( swipeDistance < 0 ) {\n\t\t\tthis.next();\n\t\t}\n\t}\n}\n","/**\n * TP Slider Slides.\n */\nexport class TPSliderSlidesElement extends HTMLElement {\n}\n","/**\n * TP Slider Slide.\n */\nexport class TPSliderSlideElement extends HTMLElement {\n}\n","/**\n * Internal dependencies.\n */\nimport { TPSliderElement } from './tp-slider';\n\n/**\n * TP Slider Arrow.\n */\nexport class TPSliderArrowElement extends HTMLElement {\n\t/**\n\t * Connected callback.\n\t */\n\tconnectedCallback(): void {\n\t\tthis.querySelector( 'button' )?.addEventListener( 'click', this.handleClick.bind( this ) );\n\t}\n\n\t/**\n\t * Handle when the button is clicked.\n\t */\n\thandleClick(): void {\n\t\tif ( 'yes' === this.getAttribute( 'disabled' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst slider: TPSliderElement | null = this.closest( 'tp-slider' );\n\t\tif ( ! slider ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'previous' === this.getAttribute( 'direction' ) ) {\n\t\t\tslider.previous();\n\t\t} else if ( 'next' === this.getAttribute( 'direction' ) ) {\n\t\t\tslider.next();\n\t\t}\n\t}\n}\n","/**\n * TP Slider Nav.\n */\nexport class TPSliderNavElement extends HTMLElement {\n}\n","/**\n * Internal dependencies.\n */\nimport { TPSliderElement } from './tp-slider';\nimport { TPSliderNavElement } from './tp-slider-nav';\n\n/**\n * TP Slider Nav Item.\n */\nexport class TPSliderNavItemElement extends HTMLElement {\n\t/**\n\t * Connected callback.\n\t */\n\tconnectedCallback(): void {\n\t\tthis.querySelector( 'button' )?.addEventListener( 'click', this.handleClick.bind( this ) );\n\t}\n\n\t/**\n\t * Handle when the button is clicked.\n\t */\n\thandleClick(): void {\n\t\tconst slider: TPSliderElement | null = this.closest( 'tp-slider' );\n\t\tif ( ! slider ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslider.setCurrentSlide( this.getIndex() );\n\t}\n\n\t/**\n\t * Get index of this item inside the navigation.\n\t *\n\t * @return {number} Index.\n\t */\n\tgetIndex(): number {\n\t\tif ( this.getAttribute( 'index' ) ) {\n\t\t\treturn parseInt( this.getAttribute( 'index' ) ?? '0' );\n\t\t}\n\n\t\tconst slideNav: TPSliderNavElement | null = this.closest( 'tp-slider-nav' );\n\t\treturn Array.from( slideNav?.children ?? [] ).indexOf( this ) + 1;\n\t}\n}\n","/**\n * TP Slider Count.\n */\nexport class TPSliderCountElement extends HTMLElement {\n\t/**\n\t * Get observed attributes.\n\t *\n\t * @return {Array} Observed attributes.\n\t */\n\tstatic get observedAttributes(): string[] {\n\t\treturn [ 'current', 'total', 'format' ];\n\t}\n\n\t/**\n\t * Get format.\n\t *\n\t * @return {string} Format.\n\t */\n\tget format(): string {\n\t\treturn this.getAttribute( 'format' ) ?? '$current / $total';\n\t}\n\n\t/**\n\t * Set format.\n\t *\n\t * @param {string} format Format.\n\t */\n\tset format( format: string ) {\n\t\tthis.setAttribute( 'format', format );\n\t}\n\n\t/**\n\t * Attribute changed callback.\n\t */\n\tattributeChangedCallback(): void {\n\t\tthis.update();\n\t}\n\n\t/**\n\t * Update component.\n\t */\n\tupdate(): void {\n\t\tthis.innerHTML =\n\t\t\tthis.format\n\t\t\t\t.replace( '$current', this.getAttribute( 'current' ) ?? '' )\n\t\t\t\t.replace( '$total', this.getAttribute( 'total' ) ?? '' );\n\t}\n}\n","/**\n * Styles.\n */\nimport './style.scss';\n\n/**\n * Components.\n */\nimport { TPSliderElement } from './tp-slider';\nimport { TPSliderSlidesElement } from './tp-slider-slides';\nimport { TPSliderSlideElement } from './tp-slider-slide';\nimport { TPSliderArrowElement } from './tp-slider-arrow';\nimport { TPSliderNavElement } from './tp-slider-nav';\nimport { TPSliderNavItemElement } from './tp-slider-nav-item';\nimport { TPSliderCountElement } from './tp-slider-count';\n\n/**\n * Register Components.\n */\ncustomElements.define( 'tp-slider', TPSliderElement );\ncustomElements.define( 'tp-slider-slides', TPSliderSlidesElement );\ncustomElements.define( 'tp-slider-slide', TPSliderSlideElement );\ncustomElements.define( 'tp-slider-arrow', TPSliderArrowElement );\ncustomElements.define( 'tp-slider-nav', TPSliderNavElement );\ncustomElements.define( 'tp-slider-nav-item', TPSliderNavItemElement );\ncustomElements.define( 'tp-slider-count', TPSliderCountElement );\n"],"names":["TPSliderElement","HTMLElement","constructor","super","touchStartX","this","getAttribute","setAttribute","slide","window","addEventListener","handleResize","bind","handleTouchStart","handleTouchEnd","observedAttributes","attributeChangedCallback","name","oldValue","newValue","dispatchEvent","CustomEvent","bubbles","update","currentSlideIndex","parseInt","index","setCurrentSlide","getTotalSlides","slides","querySelectorAll","length","next","totalSlides","previous","getCurrentSlide","toString","slidesContainer","querySelector","updateHeight","style","left","offsetWidth","sliderNavItems","sliderCount","leftArrow","rightArrow","forEach","removeAttribute","navItem","removeProperty","height","scrollHeight","_this","setTimeout","e","touches","clientX","swipeDistance","changedTouches","TPSliderSlidesElement","TPSliderSlideElement","TPSliderArrowElement","connectedCallback","handleClick","slider","closest","TPSliderNavElement","TPSliderNavItemElement","getIndex","slideNav","Array","from","children","indexOf","TPSliderCountElement","format","innerHTML","replace","customElements","define"],"sourceRoot":""}
@@ -1 +1 @@
1
- tp-slider{display:block}tp-slider-track{display:block;overflow-y:visible;overflow-x:clip;position:relative}tp-slider-slides{position:relative;display:flex;align-items:flex-start}tp-slider:not([resizing=yes]) tp-slider-slides{transition-duration:.6s;transition-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}tp-slider-slide{flex:0 0 100%;scroll-snap-align:start}tp-slider[flexible-height=yes]:not([initialized]) tp-slider-slide:not(:first-child){display:none}tp-slider-nav{display:flex;gap:10px}
1
+ tp-slider{display:block}tp-slider-track{display:block;overflow-y:visible;overflow-x:clip;position:relative}tp-slider-slides{position:relative;display:flex;align-items:flex-start}tp-slider:not([resizing=yes]) tp-slider-slides{transition-duration:.6s;transition-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}tp-slider-slide{flex:0 0 100%;scroll-snap-align:start}tp-slider[flexible-height=yes]:not([initialized]) tp-slider-slide:not(:first-child){display:none}tp-slider-nav{display:flex;gap:10px}tp-slider[behaviour=fade] tp-slider-slides{display:block}tp-slider[behaviour=fade] tp-slider-slide{position:absolute;left:0;top:0;width:100%;height:auto;transition-property:opacity,visibility;transition-duration:.6s;transition-timing-function:ease;visibility:hidden;opacity:0}tp-slider[behaviour=fade] tp-slider-slide[active=yes]{visibility:visible;opacity:1}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travelopia/web-components",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Accessible web components for the modern web",
5
5
  "files": [
6
6
  "dist"