@everymatrix/general-slider-navigation 1.44.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/carousel-component_2.cjs.entry.js +392 -419
  3. package/dist/cjs/general-slider-navigation.cjs.js +17 -11
  4. package/dist/cjs/index-88d9137e.js +1269 -0
  5. package/dist/cjs/loader.cjs.js +7 -13
  6. package/dist/collection/collection-manifest.json +4 -4
  7. package/dist/collection/components/carousel-component/carousel-component.css +0 -2
  8. package/dist/collection/components/carousel-component/carousel-component.js +360 -400
  9. package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +293 -310
  10. package/dist/collection/components/general-slider-navigation/index.js +1 -0
  11. package/dist/collection/utils/locale.utils.js +56 -56
  12. package/dist/collection/utils/utils.js +39 -39
  13. package/dist/esm/app-globals-0f993ce5.js +3 -0
  14. package/dist/esm/carousel-component_2.entry.js +392 -419
  15. package/dist/esm/general-slider-navigation.js +14 -11
  16. package/dist/esm/index-c749968b.js +1242 -0
  17. package/dist/esm/loader.js +7 -13
  18. package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -1
  19. package/dist/general-slider-navigation/p-8c0cd4b3.js +2 -0
  20. package/dist/general-slider-navigation/p-c1626bea.entry.js +1 -0
  21. package/dist/general-slider-navigation/p-e1255160.js +1 -0
  22. package/dist/stencil.config.dev.js +17 -0
  23. package/dist/stencil.config.js +14 -19
  24. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.d.ts +2 -0
  25. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.dev.d.ts +2 -0
  26. package/dist/types/components/carousel-component/carousel-component.d.ts +70 -77
  27. package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +54 -54
  28. package/dist/types/components/general-slider-navigation/index.d.ts +1 -0
  29. package/dist/types/components.d.ts +0 -16
  30. package/dist/types/stencil-public-runtime.d.ts +142 -33
  31. package/loader/cdn.js +1 -3
  32. package/loader/index.cjs.js +1 -3
  33. package/loader/index.d.ts +13 -1
  34. package/loader/index.es2017.js +1 -3
  35. package/loader/index.js +1 -3
  36. package/loader/package.json +1 -0
  37. package/package.json +8 -1
  38. package/dist/cjs/index-d69ac031.js +0 -1269
  39. package/dist/components/carousel-component.d.ts +0 -11
  40. package/dist/components/carousel-component.js +0 -6
  41. package/dist/components/carousel-component2.js +0 -386
  42. package/dist/components/general-slider-navigation.d.ts +0 -11
  43. package/dist/components/general-slider-navigation.js +0 -144
  44. package/dist/components/index.d.ts +0 -26
  45. package/dist/components/index.js +0 -1
  46. package/dist/esm/index-a33109c0.js +0 -1243
  47. package/dist/esm/polyfills/core-js.js +0 -11
  48. package/dist/esm/polyfills/css-shim.js +0 -1
  49. package/dist/esm/polyfills/dom.js +0 -79
  50. package/dist/esm/polyfills/es5-html-element.js +0 -1
  51. package/dist/esm/polyfills/index.js +0 -34
  52. package/dist/esm/polyfills/system.js +0 -6
  53. package/dist/general-slider-navigation/p-6da4364f.entry.js +0 -1
  54. package/dist/general-slider-navigation/p-734ecc50.js +0 -1
  55. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-slider-navigation/.stencil/packages/general-slider-navigation/stencil.config.d.ts +0 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d69ac031.js');
5
+ const index = require('./index-88d9137e.js');
6
6
 
7
7
  /**
8
8
  * @name isMobile
@@ -11,450 +11,423 @@ const index = require('./index-d69ac031.js');
11
11
  * @returns {Boolean} true or false
12
12
  */
13
13
  const isMobile = (userAgent) => {
14
- return !!(userAgent.toLowerCase().match(/android/i) ||
15
- userAgent.toLowerCase().match(/blackberry|bb/i) ||
16
- userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
17
- userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
14
+ return !!(userAgent.toLowerCase().match(/android/i) ||
15
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
16
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
17
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
18
18
  };
19
19
  const getDevice = () => {
20
- let userAgent = window.navigator.userAgent;
21
- if (userAgent.toLowerCase().match(/android/i)) {
22
- return 'Android';
23
- }
24
- if (userAgent.toLowerCase().match(/iphone/i)) {
25
- return 'iPhone';
26
- }
27
- if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
28
- return 'iPad';
29
- }
30
- return 'PC';
31
- };
32
- const getDevicePlatform = () => {
33
- const device = getDevice();
34
- if (device) {
35
- if (device === 'PC') {
36
- return 'dk';
20
+ let userAgent = window.navigator.userAgent;
21
+ if (userAgent.toLowerCase().match(/android/i)) {
22
+ return 'Android';
37
23
  }
38
- else if (device === 'iPad' || device === 'iPhone') {
39
- return 'ios';
24
+ if (userAgent.toLowerCase().match(/iphone/i)) {
25
+ return 'iPhone';
40
26
  }
41
- else {
42
- return 'mtWeb';
27
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
28
+ return 'iPad';
29
+ }
30
+ return 'PC';
31
+ };
32
+ const getDevicePlatform = () => {
33
+ const device = getDevice();
34
+ if (device) {
35
+ if (device === 'PC') {
36
+ return 'dk';
37
+ }
38
+ else if (device === 'iPad' || device === 'iPhone') {
39
+ return 'ios';
40
+ }
41
+ else {
42
+ return 'mtWeb';
43
+ }
43
44
  }
44
- }
45
45
  };
46
46
  function checkDeviceType() {
47
- const userAgent = navigator.userAgent.toLowerCase();
48
- const width = screen.availWidth;
49
- const height = screen.availHeight;
50
- if (userAgent.includes('iphone')) {
51
- return 'mobile';
52
- }
53
- if (userAgent.includes('android')) {
54
- if (height > width && width < 800) {
55
- return 'mobile';
56
- }
57
- if (width > height && height < 800) {
58
- return 'tablet';
59
- }
60
- }
61
- return 'desktop';
47
+ const userAgent = navigator.userAgent.toLowerCase();
48
+ const width = screen.availWidth;
49
+ const height = screen.availHeight;
50
+ if (userAgent.includes('iphone')) {
51
+ return 'mobile';
52
+ }
53
+ if (userAgent.includes('android')) {
54
+ if (height > width && width < 800) {
55
+ return 'mobile';
56
+ }
57
+ if (width > height && height < 800) {
58
+ return 'tablet';
59
+ }
60
+ }
61
+ return 'desktop';
62
62
  }
63
63
 
64
64
  const DEFAULT_LANGUAGE = 'en';
65
65
  const TRANSLATIONS = {
66
- en: {
67
- error: 'Error',
68
- noResults: 'Loading, please wait ...',
69
- joinNow: 'Join now'
70
- },
71
- hu: {
72
- error: 'Error',
73
- noResults: 'Loading, please wait ...',
74
- joinNow: 'Join now'
75
- },
76
- ro: {
77
- error: 'Eroare',
78
- noResults: 'Loading, please wait ...',
79
- joinNow: 'Join now'
80
- },
81
- fr: {
82
- error: 'Error',
83
- noResults: 'Loading, please wait ...',
84
- joinNow: 'Join now'
85
- },
86
- ar: {
87
- error: 'خطأ',
88
- noResults: 'Loading, please wait ...',
89
- joinNow: 'Join now'
90
- },
91
- hr: {
92
- error: 'Greška',
93
- noResults: 'Učitavanje, molimo pričekajte ...',
94
- joinNow: 'Join now'
95
- },
96
- 'pt-br': {
97
- 'error': 'Erro',
98
- 'noResults': 'Carregando, espere por favor…',
99
- 'joinNow': 'Join now'
100
- },
101
- 'es-mx': {
102
- 'error': 'Error',
103
- 'noResults': 'Cargando, espere por favor…',
104
- 'joinNow': 'Join now'
105
- }
66
+ en: {
67
+ error: 'Error',
68
+ noResults: 'Loading, please wait ...',
69
+ joinNow: 'Join now'
70
+ },
71
+ hu: {
72
+ error: 'Error',
73
+ noResults: 'Loading, please wait ...',
74
+ joinNow: 'Join now'
75
+ },
76
+ ro: {
77
+ error: 'Eroare',
78
+ noResults: 'Loading, please wait ...',
79
+ joinNow: 'Join now'
80
+ },
81
+ fr: {
82
+ error: 'Error',
83
+ noResults: 'Loading, please wait ...',
84
+ joinNow: 'Join now'
85
+ },
86
+ ar: {
87
+ error: 'خطأ',
88
+ noResults: 'Loading, please wait ...',
89
+ joinNow: 'Join now'
90
+ },
91
+ hr: {
92
+ error: 'Greška',
93
+ noResults: 'Učitavanje, molimo pričekajte ...',
94
+ joinNow: 'Join now'
95
+ },
96
+ 'pt-br': {
97
+ 'error': 'Erro',
98
+ 'noResults': 'Carregando, espere por favor…',
99
+ 'joinNow': 'Join now'
100
+ },
101
+ 'es-mx': {
102
+ 'error': 'Error',
103
+ 'noResults': 'Cargando, espere por favor…',
104
+ 'joinNow': 'Join now'
105
+ }
106
106
  };
107
107
  const getTranslations = (url) => {
108
- return new Promise((resolve) => {
109
- fetch(url)
110
- .then((res) => res.json())
111
- .then((data) => {
112
- Object.keys(data).forEach((lang) => {
113
- if (!TRANSLATIONS[lang]) {
114
- TRANSLATIONS[lang] = {};
115
- }
116
- for (let key in data[lang]) {
117
- TRANSLATIONS[lang][key] = data[lang][key];
118
- }
119
- });
120
- resolve(true);
108
+ return new Promise((resolve) => {
109
+ fetch(url)
110
+ .then((res) => res.json())
111
+ .then((data) => {
112
+ Object.keys(data).forEach((lang) => {
113
+ if (!TRANSLATIONS[lang]) {
114
+ TRANSLATIONS[lang] = {};
115
+ }
116
+ for (let key in data[lang]) {
117
+ TRANSLATIONS[lang][key] = data[lang][key];
118
+ }
119
+ });
120
+ resolve(true);
121
+ });
121
122
  });
122
- });
123
123
  };
124
124
  const translate = (key, customLang) => {
125
- const lang = customLang;
126
- return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
125
+ const lang = customLang;
126
+ return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
127
127
  };
128
128
 
129
- const carouselComponentCss = ":host{display:block;font-family:\"Roboto\", sans-serif}html,body{padding:0;margin:0;width:100%;height:100%}.Carousel{position:relative;display:block;width:100%}.carousel__prev,.carousel__next{position:absolute;bottom:-15%;transition:transform 0.25s ease}.carousel__prev i,.carousel__next i{font-size:var(--emw--font-size-x-large, 60px);color:var(--emw-color-white, #FFFFFF);cursor:pointer}.carousel__prev:hover,.carousel__next:hover{transform:scale(1.25)}.carousel__prev{left:40%}.carousel__next{right:40%}.CarouselBody{width:100%;padding:80px 0px;overflow:hidden}.CarouselSlider{position:relative;transition:transform 1s ease-in-out;background:transparent;display:flex;align-items:center}.CarouselSliderItem{opacity:0.7;position:relative;display:block;float:left;box-sizing:border-box;height:400px}.Item3dFrame{position:relative;width:100%;height:100%;transition:transform 1s ease-in-out, box-shadow 0.5s ease-in-out;transform-style:preserve-3d;display:flex;flex-direction:column;justify-content:flex-end;border-radius:var(--emw--button-border-radius, 20px)}.CarouselSliderItemActive .Item3dFrame{animation:glow 4s linear infinite}@keyframes glow{0%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}50%{box-shadow:0 0 50px 5px var(--emfe-w-color-secondary, #F2711C)}100%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}}.TopSection{display:flex;justify-content:flex-start;align-items:center}.JoinButton{background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, var(--emw-color-white, #FFFFFF) 30%));color:var(--emw--color-typography, #FFFFFF);height:42px;width:110px;border-radius:var(--emw--button-border-radius, 20px);cursor:pointer;font-size:var(--emw--size-small, 14px);border:2px solid var(--emw--button-border-color, #0E5924);display:flex;align-items:center;justify-content:center;gap:2px}.ItemSection{padding:12px 20px;display:flex;flex-direction:column;gap:2px}.Divider{border:none;border-top:2px solid var(--emw-color-white, #FFFFFF);width:100%;opacity:0.3}.BottomSection{display:flex;justify-content:flex-start;align-items:flex-start;width:50%;height:60px}.BottomSection h3{font-size:var(--emw--size-large, 24px);margin:0;color:var(--emw--color-typography, #FFFFFF)}.CarouselNavigation{display:flex;justify-content:center;align-items:center;position:absolute;bottom:20px;left:50%;transform:translateX(-50%)}.CarouselNavigationBullet{width:12px;height:12px;background-color:var(--emw-color-grey-100, rgba(255, 255, 255, 0.5));border-radius:50%;margin:0 5px;cursor:pointer;transition:background-color 0.3s}.CarouselNavigationBulletActive{background-color:var(--emw--color-primary, #22B04E)}.CarouselSliderItemActive{opacity:1;height:470px}";
129
+ const carouselComponentCss = ":host{display:block;font-family:\"Roboto\", sans-serif}html,body{padding:0;margin:0;width:100%;height:100%}.Carousel{position:relative;display:block;width:100%}.carousel__prev,.carousel__next{position:absolute;bottom:-15%;transition:transform 0.25s ease}.carousel__prev i,.carousel__next i{font-size:var(--emw--font-size-x-large, 60px);color:var(--emw-color-white, #FFFFFF);cursor:pointer}.carousel__prev:hover,.carousel__next:hover{transform:scale(1.25)}.carousel__prev{left:40%}.carousel__next{right:40%}.CarouselBody{width:100%;padding:80px 0px;overflow:hidden}.CarouselSlider{position:relative;transition:transform 1s ease-in-out;background:transparent;display:flex;align-items:center}.CarouselSliderItem{opacity:0.7;position:relative;display:block;float:left;box-sizing:border-box}.Item3dFrame{position:relative;width:100%;height:100%;transition:transform 1s ease-in-out, box-shadow 0.5s ease-in-out;transform-style:preserve-3d;display:flex;flex-direction:column;justify-content:flex-end;border-radius:var(--emw--button-border-radius, 20px)}.CarouselSliderItemActive .Item3dFrame{animation:glow 4s linear infinite}@keyframes glow{0%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}50%{box-shadow:0 0 50px 5px var(--emfe-w-color-secondary, #F2711C)}100%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}}.TopSection{display:flex;justify-content:flex-start;align-items:center}.JoinButton{background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, var(--emw-color-white, #FFFFFF) 30%));color:var(--emw--color-typography, #FFFFFF);height:42px;width:110px;border-radius:var(--emw--button-border-radius, 20px);cursor:pointer;font-size:var(--emw--size-small, 14px);border:2px solid var(--emw--button-border-color, #0E5924);display:flex;align-items:center;justify-content:center;gap:2px}.ItemSection{padding:12px 20px;display:flex;flex-direction:column;gap:2px}.Divider{border:none;border-top:2px solid var(--emw-color-white, #FFFFFF);width:100%;opacity:0.3}.BottomSection{display:flex;justify-content:flex-start;align-items:flex-start;width:50%;height:60px}.BottomSection h3{font-size:var(--emw--size-large, 24px);margin:0;color:var(--emw--color-typography, #FFFFFF)}.CarouselNavigation{display:flex;justify-content:center;align-items:center;position:absolute;bottom:20px;left:50%;transform:translateX(-50%)}.CarouselNavigationBullet{width:12px;height:12px;background-color:var(--emw-color-grey-100, rgba(255, 255, 255, 0.5));border-radius:50%;margin:0 5px;cursor:pointer;transition:background-color 0.3s}.CarouselNavigationBulletActive{background-color:var(--emw--color-primary, #22B04E)}.CarouselSliderItemActive{opacity:1}";
130
+ const CarouselComponentStyle0 = carouselComponentCss;
130
131
 
131
132
  const CarouselComponent = class {
132
- constructor(hostRef) {
133
- index.registerInstance(this, hostRef);
134
- /**
135
- * Client custom styling via inline style
136
- */
137
- this.clientStyling = '';
138
- /**
139
- * Client custom styling via url
140
- */
141
- this.clientStylingUrl = '';
142
- /**
143
- * Show bullet navigation under slides
144
- */
145
- this.bulletNavigation = true;
146
- /**
147
- * Language of the widget
148
- */
149
- this.language = 'en';
150
- /**
151
- * Translation via url
152
- */
153
- this.translationUrl = '';
154
- this.currIndex = 0;
155
- this.device = '';
156
- this.stylingAppends = false;
157
- this.userAgent = window.navigator.userAgent;
158
- this.isMobile = isMobile(this.userAgent);
159
- this.touchStartX = 0;
160
- this.touchEndX = 0;
161
- this.setClientStylingURL = () => {
162
- let url = new URL(this.clientStylingUrl);
163
- let cssFile = document.createElement('style');
164
- fetch(url.href)
165
- .then((res) => res.text())
166
- .then((data) => {
167
- cssFile.innerHTML = data;
168
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
169
- })
170
- .catch((err) => {
171
- console.log('error ', err);
172
- });
173
- };
174
- this.setClientStyling = () => {
175
- let sheet = document.createElement('style');
176
- sheet.innerHTML = this.clientStyling;
177
- this.stylingContainer.prepend(sheet);
178
- };
179
- this.moveSliderIndex = (index) => {
180
- if (index < 1)
181
- index = this.sliderData.length;
182
- if (index > this.sliderData.length)
183
- index = 1;
184
- this.currIndex = index;
185
- if (this.sliderElement) {
186
- this.sliderElement.style.transform = this.getSliderTransformStyle();
187
- }
188
- };
189
- this.handleTouchStart = (event) => {
190
- this.touchStartX = event.changedTouches[0].screenX;
191
- };
192
- this.handleTouchEnd = (event) => {
193
- this.touchEndX = event.changedTouches[0].screenX;
194
- this.handleSwipe();
195
- };
196
- this.navigationTo = (url, target, isExternal) => {
197
- window.postMessage({ type: 'NavigateTo', path: url, target: target || null, externalLink: isExternal || false }, window.location.href);
198
- };
199
- this.changeSlider = (index) => {
200
- if (index > this.currIndex - 1) {
201
- this.next();
202
- }
203
- else if (index < this.currIndex - 1) {
204
- this.prev();
205
- }
206
- };
207
- this.setImage = (image) => {
208
- let source = '';
209
- this.device = checkDeviceType();
210
- switch (this.device) {
211
- case 'mobile':
212
- source = image.srcMobile;
213
- break;
214
- case 'tablet':
215
- source = image.srcTablet;
216
- break;
217
- case 'desktop':
218
- source = image.srcDesktop;
219
- break;
220
- }
221
- return source;
222
- };
223
- }
224
- handleNewTranslations() {
225
- getTranslations(this.translationUrl);
226
- }
227
- async componentWillLoad() {
228
- if (this.translationUrl.length > 2) {
229
- await getTranslations(this.translationUrl);
230
- }
231
- }
232
- componentDidLoad() {
233
- this.init();
234
- this.calcInnerWidth();
235
- }
236
- componentDidRender() {
237
- if (!this.stylingAppends && this.stylingContainer) {
238
- if (this.clientStyling)
239
- this.setClientStyling();
240
- if (this.clientStylingUrl)
241
- this.setClientStylingURL();
242
- this.stylingAppends = true;
243
- }
244
- }
245
- init() {
246
- this.moveSliderIndex(Math.ceil(this.sliderData.length / 2));
247
- this.bindEvents();
248
- if (this.slideTimer > 0) {
249
- this.timer();
250
- }
251
- }
252
- calcInnerWidth() {
253
- const parent = this.el.parentElement;
254
- // Check if the parent element exists and then get its width
255
- if (parent) {
256
- this.innerWidth = parent.offsetWidth;
257
- }
258
- else {
259
- this.innerWidth = window.innerWidth;
260
- }
261
- this.resize();
262
- }
263
- resize() {
264
- if (this.isMobile) {
265
- this.width = Math.max(innerWidth * 0.3, this.sliderMobileWidth);
266
- }
267
- else {
268
- this.width = Math.max(this.innerWidth * 0.1, this.sliderDesktopWidth);
269
- }
270
- this.totalWidth = this.width * this.sliderData.length;
271
- //this is where the margin gap between slides is calculated with the animation
272
- this.margin = -5;
273
- const children = this.sliderElement.children;
274
- for (let i = 0; i < children.length; i++) {
275
- const item = children[i];
276
- item.style.margin = `0 ${this.margin}px`;
277
- item.style.width = `${this.width - (this.margin * 2)}px`;
278
- }
279
- if (this.sliderElement) {
280
- this.sliderElement.style.transform = this.getSliderTransformStyle();
281
- }
282
- }
283
- timer() {
284
- this.clearTimer();
285
- this.interval = setInterval(() => {
286
- this.moveSliderIndex(++this.currIndex);
287
- }, this.slideTimer * 1000);
288
- }
289
- disconnectedCallback() {
290
- this.clearTimer();
291
- }
292
- clearTimer() {
293
- if (this.interval) {
294
- clearInterval(this.interval);
295
- }
296
- }
297
- prev() {
298
- this.moveSliderIndex(--this.currIndex);
299
- if (this.slideTimer > 0) {
300
- this.timer();
301
- }
302
- }
303
- next() {
304
- this.moveSliderIndex(++this.currIndex);
305
- if (this.slideTimer > 0) {
306
- this.timer();
307
- }
308
- }
309
- bindEvents() {
310
- window.onresize = () => this.resize();
311
- this.el.addEventListener('touchstart', this.handleTouchStart, false);
312
- this.el.addEventListener('touchend', this.handleTouchEnd, false);
313
- }
314
- handleSwipe() {
315
- if (this.touchEndX < this.touchStartX) {
316
- this.next();
317
- }
318
- if (this.touchEndX > this.touchStartX) {
319
- this.prev();
320
- }
321
- }
322
- getTransformStyle(index) {
323
- const perspective = index === this.currIndex - 1 ? '1200px' : '900px';
324
- const rotateY = index < this.currIndex - 1 ? '20deg' : '-20deg';
325
- return index === this.currIndex - 1 ? `perspective(${perspective})` : `perspective(${perspective}) rotateY(${rotateY})`;
326
- }
327
- getSliderTransformStyle() {
328
- return `translate3d(${((this.currIndex * -this.width) + (this.width / 2) + this.innerWidth / 2)}px, 0, 0)`;
329
- }
330
- renderNavigation() {
331
- return (index.h("div", { class: "CarouselNavigation" }, this.sliderData.map((_item, index$1) => (index.h("div", { class: {
332
- 'CarouselNavigationBullet': true,
333
- 'CarouselNavigationBulletActive': index$1 === this.currIndex - 1,
334
- }, onClick: this.moveSliderIndex.bind(this, index$1 + 1) })))));
335
- }
336
- render() {
337
- return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "Carousel" }, index.h("div", { class: "CarouselBody" }, index.h("div", { class: "CarouselSlider", ref: el => this.sliderElement = el, style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.sliderData.map((item, index$1) => {
338
- const isActive = index$1 === this.currIndex - 1;
339
- const buttonStyle = !isActive ? { cursor: 'unset' } : {};
340
- return (index.h("div", { class: {
341
- 'CarouselSliderItem': true,
342
- 'CarouselSliderItemActive': isActive,
343
- }, onClick: this.changeSlider.bind(this, index$1) }, index.h("div", { class: "Item3dFrame", style: { backgroundSize: 'cover', backgroundPosition: 'center', backgroundImage: `url(${this.setImage(item.image)})`, transform: this.getTransformStyle(index$1) } }, index.h("div", { class: "ItemSection" }, index.h("div", { class: "TopSection" }, index.h("button", { onClick: () => {
344
- if (isActive) {
345
- this.navigationTo(item.url, item.targetType, item.externalLink);
346
- }
347
- }, style: buttonStyle, class: "JoinButton" }, index.h("span", null, translate('joinNow', this.language)), index.h("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M5 3L10 8L5 13", stroke: "white", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })))), index.h("hr", { class: "Divider" }), index.h("div", { class: "BottomSection" }, index.h("h3", null, item.title.toUpperCase()))))));
348
- }))), this.bulletNavigation ? this.renderNavigation() : null)));
349
- }
350
- get el() { return index.getElement(this); }
351
- static get watchers() { return {
352
- "translationUrl": ["handleNewTranslations"]
353
- }; }
133
+ constructor(hostRef) {
134
+ index.registerInstance(this, hostRef);
135
+ this.userAgent = window.navigator.userAgent;
136
+ this.isMobile = isMobile(this.userAgent);
137
+ this.touchStartX = 0;
138
+ this.touchEndX = 0;
139
+ this.setClientStylingURL = () => {
140
+ let url = new URL(this.clientStylingUrl);
141
+ let cssFile = document.createElement('style');
142
+ fetch(url.href)
143
+ .then((res) => res.text())
144
+ .then((data) => {
145
+ cssFile.innerHTML = data;
146
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
147
+ })
148
+ .catch((err) => {
149
+ console.log('error ', err);
150
+ });
151
+ };
152
+ this.setClientStyling = () => {
153
+ let sheet = document.createElement('style');
154
+ sheet.innerHTML = this.clientStyling;
155
+ this.stylingContainer.prepend(sheet);
156
+ };
157
+ this.moveSliderIndex = (index) => {
158
+ if (index < 1)
159
+ index = this.sliderData.length;
160
+ if (index > this.sliderData.length)
161
+ index = 1;
162
+ this.currIndex = index;
163
+ if (this.sliderElement) {
164
+ this.sliderElement.style.transform = this.getSliderTransformStyle();
165
+ }
166
+ };
167
+ this.handleTouchStart = (event) => {
168
+ this.touchStartX = event.changedTouches[0].screenX;
169
+ };
170
+ this.handleTouchEnd = (event) => {
171
+ this.touchEndX = event.changedTouches[0].screenX;
172
+ this.handleSwipe();
173
+ };
174
+ this.navigationTo = (url, target, isExternal) => {
175
+ window.postMessage({ type: 'NavigateTo', path: url, target: target || null, externalLink: isExternal || false }, window.location.href);
176
+ };
177
+ this.changeSlider = (index) => {
178
+ if (index > this.currIndex - 1) {
179
+ this.next();
180
+ }
181
+ else if (index < this.currIndex - 1) {
182
+ this.prev();
183
+ }
184
+ };
185
+ this.setImage = (image) => {
186
+ let source = '';
187
+ this.device = checkDeviceType();
188
+ switch (this.device) {
189
+ case 'mobile':
190
+ source = image.srcMobile;
191
+ break;
192
+ case 'tablet':
193
+ source = image.srcTablet;
194
+ break;
195
+ case 'desktop':
196
+ source = image.srcDesktop;
197
+ break;
198
+ }
199
+ return source;
200
+ };
201
+ this.clientStyling = '';
202
+ this.clientStylingUrl = '';
203
+ this.sliderData = undefined;
204
+ this.bulletNavigation = true;
205
+ this.language = 'en';
206
+ this.slideTimer = undefined;
207
+ this.translationUrl = '';
208
+ this.currIndex = 0;
209
+ this.width = undefined;
210
+ this.height = undefined;
211
+ this.margin = undefined;
212
+ this.sliderElement = undefined;
213
+ this.totalWidth = undefined;
214
+ this.device = '';
215
+ this.stylingAppends = false;
216
+ this.innerWidth = undefined;
217
+ }
218
+ handleNewTranslations() {
219
+ getTranslations(this.translationUrl);
220
+ }
221
+ async componentWillLoad() {
222
+ if (this.translationUrl.length > 2) {
223
+ await getTranslations(this.translationUrl);
224
+ }
225
+ }
226
+ componentDidLoad() {
227
+ this.init();
228
+ this.calcInnerWidth();
229
+ }
230
+ componentDidRender() {
231
+ if (!this.stylingAppends && this.stylingContainer) {
232
+ if (this.clientStyling)
233
+ this.setClientStyling();
234
+ if (this.clientStylingUrl)
235
+ this.setClientStylingURL();
236
+ this.stylingAppends = true;
237
+ }
238
+ }
239
+ init() {
240
+ this.moveSliderIndex(Math.floor(this.sliderData.length / 2));
241
+ this.bindEvents();
242
+ if (this.slideTimer > 0) {
243
+ this.timer();
244
+ }
245
+ }
246
+ calcInnerWidth() {
247
+ const parent = this.el.parentElement;
248
+ // Check if the parent element exists and then get its width
249
+ if (parent) {
250
+ this.innerWidth = parent.offsetWidth;
251
+ }
252
+ else {
253
+ this.innerWidth = window.innerWidth;
254
+ }
255
+ this.resize();
256
+ }
257
+ resize() {
258
+ if (this.isMobile) {
259
+ this.width = Math.max(innerWidth * 0.3, 200);
260
+ this.height = window.innerHeight * 0.40;
261
+ }
262
+ else {
263
+ this.width = this.innerWidth > 1200 ? Math.max(this.innerWidth * 0.1, 300) : Math.max(this.innerWidth * 0.2, 200);
264
+ this.height = window.innerHeight * 0.55;
265
+ }
266
+ this.totalWidth = this.width * this.sliderData.length;
267
+ //this is where the margin gap between slides is calculated with the animation
268
+ this.margin = -5;
269
+ const children = this.sliderElement.children;
270
+ for (let i = 0; i < children.length; i++) {
271
+ const item = children[i];
272
+ item.style.margin = `0 ${this.margin}px`;
273
+ item.style.width = `${this.width - (this.margin * 2)}px`;
274
+ }
275
+ if (this.sliderElement) {
276
+ this.sliderElement.style.transform = this.getSliderTransformStyle();
277
+ }
278
+ }
279
+ timer() {
280
+ this.clearTimer();
281
+ this.interval = setInterval(() => {
282
+ this.moveSliderIndex(++this.currIndex);
283
+ }, this.slideTimer * 1000);
284
+ }
285
+ disconnectedCallback() {
286
+ this.clearTimer();
287
+ }
288
+ clearTimer() {
289
+ if (this.interval) {
290
+ clearInterval(this.interval);
291
+ }
292
+ }
293
+ prev() {
294
+ this.moveSliderIndex(--this.currIndex);
295
+ if (this.slideTimer > 0) {
296
+ this.timer();
297
+ }
298
+ }
299
+ next() {
300
+ this.moveSliderIndex(++this.currIndex);
301
+ if (this.slideTimer > 0) {
302
+ this.timer();
303
+ }
304
+ }
305
+ bindEvents() {
306
+ window.onresize = () => this.resize();
307
+ this.el.addEventListener('touchstart', this.handleTouchStart, false);
308
+ this.el.addEventListener('touchend', this.handleTouchEnd, false);
309
+ }
310
+ handleSwipe() {
311
+ if (this.touchEndX < this.touchStartX) {
312
+ this.next();
313
+ }
314
+ if (this.touchEndX > this.touchStartX) {
315
+ this.prev();
316
+ }
317
+ }
318
+ getTransformStyle(index) {
319
+ const perspective = index === this.currIndex - 1 ? '1200px' : '900px';
320
+ const rotateY = index < this.currIndex - 1 ? '20deg' : '-20deg';
321
+ return index === this.currIndex - 1 ? `perspective(${perspective})` : `perspective(${perspective}) rotateY(${rotateY})`;
322
+ }
323
+ getSliderTransformStyle() {
324
+ return `translate3d(${((this.currIndex * -this.width) + (this.width / 2) + this.innerWidth / 2)}px, 0, 0)`;
325
+ }
326
+ renderNavigation() {
327
+ return (index.h("div", { class: "CarouselNavigation" }, this.sliderData.map((_item, index$1) => (index.h("div", { class: {
328
+ 'CarouselNavigationBullet': true,
329
+ 'CarouselNavigationBulletActive': index$1 === this.currIndex - 1,
330
+ }, onClick: this.moveSliderIndex.bind(this, index$1 + 1) })))));
331
+ }
332
+ render() {
333
+ return (index.h("div", { key: '09a6305f1745c24ac709c50cdb18218c5dd616d1', ref: el => this.stylingContainer = el }, index.h("div", { key: '1b61677ab956428b710c16b7bf71d5919e9aadf5', class: "Carousel" }, index.h("div", { key: '8f0c4f36f45695ee7c15c2435a39ded15abd39bf', class: "CarouselBody" }, index.h("div", { key: '341403c4164c1c24f39f050f37cc42b1cefee512', class: "CarouselSlider", ref: el => this.sliderElement = el, style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.sliderData.map((item, index$1) => {
334
+ const isActive = index$1 === this.currIndex - 1;
335
+ const buttonStyle = !isActive ? { cursor: 'unset' } : {};
336
+ const activeItemHeight = !isActive ? { height: `${this.height - 70}px` } : { height: `${this.height}px` };
337
+ return (index.h("div", { class: {
338
+ 'CarouselSliderItem': true,
339
+ 'CarouselSliderItemActive': isActive,
340
+ }, onClick: this.changeSlider.bind(this, index$1), style: activeItemHeight }, index.h("div", { class: "Item3dFrame", style: { backgroundSize: 'cover', backgroundPosition: 'center', backgroundImage: `url(${this.setImage(item.image)})`, transform: this.getTransformStyle(index$1) } }, index.h("div", { class: "ItemSection" }, index.h("div", { class: "TopSection" }, index.h("button", { onClick: () => {
341
+ if (isActive) {
342
+ this.navigationTo(item.url, item.targetType, item.externalLink);
343
+ }
344
+ }, style: buttonStyle, class: "JoinButton" }, index.h("span", null, translate('joinNow', this.language)), index.h("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M5 3L10 8L5 13", stroke: "white", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })))), index.h("hr", { class: "Divider" }), index.h("div", { class: "BottomSection" }, index.h("h3", null, item.title.toUpperCase()))))));
345
+ }))), this.bulletNavigation ? this.renderNavigation() : null)));
346
+ }
347
+ get el() { return index.getElement(this); }
348
+ static get watchers() { return {
349
+ "translationUrl": ["handleNewTranslations"]
350
+ }; }
354
351
  };
355
- CarouselComponent.style = carouselComponentCss;
352
+ CarouselComponent.style = CarouselComponentStyle0;
356
353
 
357
354
  const generalSliderNavigationCss = "";
355
+ const GeneralSliderNavigationStyle0 = generalSliderNavigationCss;
358
356
 
359
357
  const GeneralSliderNavigation = class {
360
- constructor(hostRef) {
361
- index.registerInstance(this, hostRef);
362
- /**
363
- * Client custom styling via inline style
364
- */
365
- this.clientStyling = '';
366
- /**
367
- * Client custom styling via url
368
- */
369
- this.clientStylingUrl = '';
370
- /**
371
- * CMS Endpoint stage
372
- */
373
- this.cmsEnv = 'stage';
374
- /**
375
- * Language of the widget
376
- */
377
- this.language = 'en';
378
- /**
379
- * User roles
380
- */
381
- this.userRoles = 'everyone';
382
- /**
383
- * Show bullet navigation under slides
384
- */
385
- this.bulletNavigation = true;
386
- /**
387
- * Mobile width for sliders
388
- */
389
- this.sliderMobileWidth = 200;
390
- /**
391
- * Desktop width for sliders
392
- */
393
- this.sliderDesktopWidth = 300;
394
- /**
395
- * Translation via url
396
- */
397
- this.translationUrl = '';
398
- this.isLoading = true;
399
- this.hasErrors = false;
400
- this.device = '';
401
- }
402
- handleNewTranslations() {
403
- getTranslations(this.translationUrl);
404
- }
405
- watchEndpoint(newValue, oldValue) {
406
- if (newValue && newValue != oldValue && this.cmsEndpoint) {
407
- this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
408
- this.sliderData = GeneralSliderNavigation;
409
- });
410
- }
411
- }
412
- async componentWillLoad() {
413
- if (this.translationUrl.length > 2) {
414
- await getTranslations(this.translationUrl);
415
- }
416
- if (this.cmsEndpoint && this.language) {
417
- return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
418
- this.sliderData = GeneralSliderNavigation;
419
- });
420
- }
421
- }
422
- getGeneralSliderNavigation() {
423
- let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
424
- url.searchParams.append('env', this.cmsEnv);
425
- url.searchParams.append('userRoles', this.userRoles);
426
- url.searchParams.append('device', getDevicePlatform());
427
- return new Promise((resolve, reject) => {
428
- this.isLoading = true;
429
- fetch(url.href)
430
- .then((res) => res.json())
431
- .then((menuSliderData) => {
432
- resolve(menuSliderData.banners);
433
- })
434
- .catch((err) => {
435
- console.error(err);
436
- this.hasErrors = true;
437
- reject(err);
438
- }).finally(() => {
439
- this.isLoading = false;
440
- });
441
- });
442
- }
443
- render() {
444
- if (this.hasErrors) {
445
- return (index.h("div", { class: "PageError" }, index.h("div", { class: "TitleError" }, translate('error', this.language))));
446
- }
447
- if (!this.isLoading) {
448
- return (index.h("div", null, index.h("carousel-component", { sliderData: this.sliderData, language: this.language, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, bulletNavigation: this.bulletNavigation, slideTimer: this.slideTimer, translationUrl: this.translationUrl, sliderMobileWidth: this.sliderMobileWidth, sliderDesktopWidth: this.sliderDesktopWidth })));
449
- }
450
- }
451
- static get watchers() { return {
452
- "translationUrl": ["handleNewTranslations"],
453
- "cmsEndpoint": ["watchEndpoint"],
454
- "language": ["watchEndpoint"]
455
- }; }
358
+ constructor(hostRef) {
359
+ index.registerInstance(this, hostRef);
360
+ this.clientStyling = '';
361
+ this.clientStylingUrl = '';
362
+ this.cmsEndpoint = undefined;
363
+ this.cmsEnv = 'stage';
364
+ this.language = 'en';
365
+ this.userRoles = 'everyone';
366
+ this.bulletNavigation = true;
367
+ this.slideTimer = undefined;
368
+ this.sliderMobileWidth = 200;
369
+ this.sliderDesktopWidth = 300;
370
+ this.translationUrl = '';
371
+ this.isLoading = true;
372
+ this.hasErrors = false;
373
+ this.device = '';
374
+ }
375
+ handleNewTranslations() {
376
+ getTranslations(this.translationUrl);
377
+ }
378
+ watchEndpoint(newValue, oldValue) {
379
+ if (newValue && newValue != oldValue && this.cmsEndpoint) {
380
+ this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
381
+ this.sliderData = GeneralSliderNavigation;
382
+ });
383
+ }
384
+ }
385
+ async componentWillLoad() {
386
+ if (this.translationUrl.length > 2) {
387
+ await getTranslations(this.translationUrl);
388
+ }
389
+ if (this.cmsEndpoint && this.language) {
390
+ return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
391
+ this.sliderData = GeneralSliderNavigation;
392
+ });
393
+ }
394
+ }
395
+ getGeneralSliderNavigation() {
396
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
397
+ url.searchParams.append('env', this.cmsEnv);
398
+ url.searchParams.append('userRoles', this.userRoles);
399
+ url.searchParams.append('device', getDevicePlatform());
400
+ return new Promise((resolve, reject) => {
401
+ this.isLoading = true;
402
+ fetch(url.href)
403
+ .then((res) => res.json())
404
+ .then((menuSliderData) => {
405
+ resolve(menuSliderData.banners);
406
+ })
407
+ .catch((err) => {
408
+ console.error(err);
409
+ this.hasErrors = true;
410
+ reject(err);
411
+ }).finally(() => {
412
+ this.isLoading = false;
413
+ });
414
+ });
415
+ }
416
+ render() {
417
+ if (this.hasErrors) {
418
+ return (index.h("div", { class: "PageError" }, index.h("div", { class: "TitleError" }, translate('error', this.language))));
419
+ }
420
+ if (!this.isLoading) {
421
+ return (index.h("div", null, index.h("carousel-component", { "slider-data": this.sliderData, language: this.language, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "slider-mobile-width": this.sliderMobileWidth, "slider-desktop-width": this.sliderDesktopWidth })));
422
+ }
423
+ }
424
+ static get watchers() { return {
425
+ "translationUrl": ["handleNewTranslations"],
426
+ "cmsEndpoint": ["watchEndpoint"],
427
+ "language": ["watchEndpoint"]
428
+ }; }
456
429
  };
457
- GeneralSliderNavigation.style = generalSliderNavigationCss;
430
+ GeneralSliderNavigation.style = GeneralSliderNavigationStyle0;
458
431
 
459
432
  exports.carousel_component = CarouselComponent;
460
433
  exports.general_slider_navigation = GeneralSliderNavigation;