@everymatrix/general-slider 1.32.4 → 1.33.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 (46) hide show
  1. package/dist/cjs/general-slider.cjs.entry.js +233 -0
  2. package/dist/cjs/general-slider.cjs.js +19 -0
  3. package/dist/cjs/index-813e9dd4.js +1176 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/collection/collection-manifest.json +12 -0
  7. package/dist/collection/components/general-slider/general-slider.css +134 -0
  8. package/dist/collection/components/general-slider/general-slider.js +406 -0
  9. package/dist/collection/index.js +1 -0
  10. package/dist/collection/utils/utils.js +3 -0
  11. package/dist/components/general-slider.d.ts +11 -0
  12. package/dist/components/general-slider.js +260 -0
  13. package/dist/components/index.d.ts +26 -0
  14. package/dist/components/index.js +1 -0
  15. package/dist/esm/general-slider.entry.js +229 -0
  16. package/dist/esm/general-slider.js +17 -0
  17. package/dist/esm/index-3bef6f6d.js +1150 -0
  18. package/dist/esm/index.js +1 -0
  19. package/dist/esm/loader.js +17 -0
  20. package/dist/esm/polyfills/core-js.js +11 -0
  21. package/dist/esm/polyfills/css-shim.js +1 -0
  22. package/dist/esm/polyfills/dom.js +79 -0
  23. package/dist/esm/polyfills/es5-html-element.js +1 -0
  24. package/dist/esm/polyfills/index.js +34 -0
  25. package/dist/esm/polyfills/system.js +6 -0
  26. package/dist/general-slider/general-slider.esm.js +1 -0
  27. package/dist/general-slider/index.esm.js +0 -0
  28. package/dist/general-slider/p-1d97b302.js +1 -0
  29. package/dist/general-slider/p-20e28994.entry.js +1 -0
  30. package/dist/index.cjs.js +1 -0
  31. package/dist/index.js +1 -0
  32. package/dist/stencil.config.js +22 -0
  33. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-slider/.stencil/packages/general-slider/stencil.config.d.ts +2 -0
  34. package/dist/types/components/general-slider/general-slider.d.ts +69 -0
  35. package/dist/types/components.d.ts +109 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  38. package/dist/types/utils/utils.d.ts +1 -0
  39. package/loader/cdn.js +3 -0
  40. package/loader/index.cjs.js +3 -0
  41. package/loader/index.d.ts +12 -0
  42. package/loader/index.es2017.js +3 -0
  43. package/loader/index.js +4 -0
  44. package/loader/package.json +10 -0
  45. package/package.json +2 -3
  46. package/LICENSE +0 -21
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-813e9dd4.js');
6
+
7
+ /*
8
+ Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchEsm = () => {
11
+ return index.promiseResolve();
12
+ };
13
+
14
+ const defineCustomElements = (win, options) => {
15
+ if (typeof window === 'undefined') return Promise.resolve();
16
+ return patchEsm().then(() => {
17
+ return index.bootstrapLazy([["general-slider.cjs",[[1,"general-slider",{"slideNumber":[2,"slide-number"],"slideShow":[2,"slide-show"],"showArrow":[4,"show-arrow"],"showButton":[4,"show-button"],"autoSlide":[4,"auto-slide"],"loopTime":[2,"loop-time"],"autoItemHeight":[4,"auto-item-height"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"currentSlideNumber":[32],"slidesCount":[32],"limitStylingAppends":[32]}]]]], options);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "./components/general-slider/general-slider.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "2.15.2",
8
+ "typescriptVersion": "4.5.4"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1,134 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .GeneralSlider {
6
+ position: relative;
7
+ }
8
+
9
+ .Slider {
10
+ position: relative;
11
+ width: 100%;
12
+ margin: 0 auto;
13
+ overflow: hidden;
14
+ }
15
+
16
+ .SliderList {
17
+ display: flex;
18
+ margin: 0;
19
+ padding: 0;
20
+ list-style: none;
21
+ transition: transform 0.5s ease-in-out;
22
+ }
23
+
24
+ ::slotted(li) {
25
+ flex: 1 0 auto;
26
+ width: 100%;
27
+ margin: auto;
28
+ }
29
+
30
+ ::slotted(li.hide) {
31
+ visibility: hidden;
32
+ height: 0;
33
+ transition-delay: 500ms;
34
+ }
35
+
36
+ .Col-2 ::slotted(li) {
37
+ flex: 2 0 auto;
38
+ width: 50%;
39
+ }
40
+
41
+ .Col-3 ::slotted(li) {
42
+ flex: 3 0 auto;
43
+ width: 33.3333333333%;
44
+ }
45
+
46
+ .Col-4 ::slotted(li) {
47
+ flex: 4 0 auto;
48
+ width: 25%;
49
+ }
50
+
51
+ .Col-5 ::slotted(li) {
52
+ flex: 5 0 auto;
53
+ width: 20%;
54
+ }
55
+
56
+ .Col-6 ::slotted(li) {
57
+ flex: 6 0 auto;
58
+ width: 16.6666666667%;
59
+ }
60
+
61
+ .Col-7 ::slotted(li) {
62
+ flex: 7 0 auto;
63
+ width: 14.2857142857%;
64
+ }
65
+
66
+ .Col-8 ::slotted(li) {
67
+ flex: 8 0 auto;
68
+ width: 12.5%;
69
+ }
70
+
71
+ .Col-9 ::slotted(li) {
72
+ flex: 9 0 auto;
73
+ width: 11.1111111111%;
74
+ }
75
+
76
+ .Col-10 ::slotted(li) {
77
+ flex: 10 0 auto;
78
+ width: 10%;
79
+ }
80
+
81
+ .Col-11 ::slotted(li) {
82
+ flex: 11 0 auto;
83
+ width: 9.0909090909%;
84
+ }
85
+
86
+ .Col-12 ::slotted(li) {
87
+ flex: 12 0 auto;
88
+ width: 8.3333333333%;
89
+ }
90
+
91
+ .Button {
92
+ position: absolute;
93
+ z-index: 1;
94
+ top: calc(50% - 32px);
95
+ padding: 20px;
96
+ font-size: 20px;
97
+ line-height: 20px;
98
+ opacity: 0.5;
99
+ border: none;
100
+ background: var(--emfe-w-color-contrast, #07072A);
101
+ color: var(--emfe-w-color-white, #FFFFFF);
102
+ cursor: pointer;
103
+ }
104
+ .Button:hover {
105
+ opacity: 1;
106
+ transition: opacity 0.5s ease-in-out;
107
+ }
108
+ .Button[disabled], .Button[disabled]:hover {
109
+ color: var(--emfe-w-color-gray-150, #828282);
110
+ opacity: 0.25;
111
+ }
112
+ .Button.ButtonNext {
113
+ right: 0;
114
+ }
115
+
116
+ .PageButtons {
117
+ display: flex;
118
+ gap: 4px;
119
+ margin-top: 8px;
120
+ }
121
+
122
+ .PageButton {
123
+ width: 15px;
124
+ height: 4px;
125
+ border-radius: 4px;
126
+ background-color: var(--emfe-w-tournament-color-primary, #0072ed);
127
+ opacity: 0.2;
128
+ cursor: pointer;
129
+ float: right;
130
+ }
131
+ .PageButton.active {
132
+ width: 45px;
133
+ opacity: 1;
134
+ }
@@ -0,0 +1,406 @@
1
+ import { Component, Prop, h, Element, State } from '@stencil/core';
2
+ export class GeneralSlider {
3
+ constructor() {
4
+ /**
5
+ * Slide Count
6
+ */
7
+ this.slideNumber = 3;
8
+ /**
9
+ * Slides to show
10
+ */
11
+ this.slideShow = 3;
12
+ /**
13
+ * Display the arrow icon
14
+ */
15
+ this.showArrow = true;
16
+ /**
17
+ * Display the button
18
+ */
19
+ this.showButton = false;
20
+ /**
21
+ * Auto Slide
22
+ */
23
+ this.autoSlide = false;
24
+ /**
25
+ * Auto Slide loop time
26
+ */
27
+ this.loopTime = 1;
28
+ /**
29
+ * Auto fill the Item height
30
+ */
31
+ this.autoItemHeight = false;
32
+ /**
33
+ * Client custom styling via inline styles
34
+ */
35
+ this.clientStyling = '';
36
+ /**
37
+ * Client custom styling via url
38
+ */
39
+ this.clientStylingUrl = '';
40
+ this.currentSlideNumber = 0;
41
+ this.slidesCount = 0;
42
+ this.limitStylingAppends = false;
43
+ this.slides = null;
44
+ this.slideWidth = 0;
45
+ this.currentPage = 0;
46
+ this.controls = {
47
+ Prev: null,
48
+ Next: null
49
+ };
50
+ this.xDown = null;
51
+ this.yDown = null;
52
+ }
53
+ slide(next) {
54
+ let slideTo = 0;
55
+ if (next) {
56
+ slideTo = this.currentSlideNumber + this.slideNumber;
57
+ }
58
+ else {
59
+ slideTo = this.currentSlideNumber - this.slideNumber;
60
+ }
61
+ if (slideTo < 0 || slideTo >= this.slidesCount)
62
+ return;
63
+ this.currentSlideNumber = slideTo;
64
+ this.currentPage = this.currentSlideNumber / this.slideNumber;
65
+ this.updateListStyle();
66
+ }
67
+ slideTo(page) {
68
+ this.currentSlideNumber = page * this.slideNumber;
69
+ this.currentPage = page;
70
+ this.updateListStyle();
71
+ }
72
+ updateControls() {
73
+ this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
74
+ this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
75
+ }
76
+ switchControl(type, enabled) {
77
+ if (this.controls[type]) {
78
+ this.controls[type].disabled = !enabled;
79
+ }
80
+ }
81
+ componentWillLoad() {
82
+ if (!this.slideNumber)
83
+ this.slideNumber = 1;
84
+ if (!this.slideShow)
85
+ this.slideShow = 1;
86
+ }
87
+ componentDidLoad() {
88
+ this.slides = this.slotEl.assignedElements();
89
+ this.slidesCount = this.slides.length;
90
+ for (let type in this.controls) {
91
+ this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
92
+ }
93
+ if (this.autoSlide) {
94
+ this.setSlideAutoInterval();
95
+ }
96
+ if (!this.limitStylingAppends && this.el.shadowRoot) {
97
+ if (this.clientStyling)
98
+ this.setClientStyling();
99
+ if (this.clientStylingUrl)
100
+ this.setClientStylingURL();
101
+ this.limitStylingAppends = true;
102
+ }
103
+ }
104
+ componentDidRender() {
105
+ if (this.slides)
106
+ this.slideWidth = this.slides[0].offsetWidth;
107
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
108
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
109
+ this.updateListStyle();
110
+ if (!this.limitStylingAppends && this.el.shadowRoot) {
111
+ if (this.clientStyling)
112
+ this.setClientStyling();
113
+ if (this.clientStylingUrl)
114
+ this.setClientStylingURL();
115
+ this.limitStylingAppends = true;
116
+ }
117
+ }
118
+ updateListStyle() {
119
+ if (!this.autoItemHeight)
120
+ return;
121
+ if (this.slides === null)
122
+ return;
123
+ this.slides.forEach((li, index) => {
124
+ if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
125
+ li.classList.remove('hide');
126
+ }
127
+ else {
128
+ li.classList.add('hide');
129
+ }
130
+ });
131
+ }
132
+ disconnectedCallback() {
133
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
134
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
135
+ }
136
+ handleTouchStart(evt) {
137
+ const firstTouch = this.getTouches(evt)[0];
138
+ this.xDown = firstTouch.clientX;
139
+ this.yDown = firstTouch.clientY;
140
+ clearInterval(this.sliderInterval);
141
+ }
142
+ getTouches(evt) {
143
+ return evt.touches || evt.originalEvent.touches;
144
+ }
145
+ handleTouchMove(evt) {
146
+ if (!this.xDown || !this.yDown)
147
+ return;
148
+ let xUp = evt.touches[0].clientX;
149
+ let yUp = evt.touches[0].clientY;
150
+ let xDiff = this.xDown - xUp;
151
+ let yDiff = this.yDown - yUp;
152
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
153
+ if (xDiff > 0) {
154
+ this.slide(true);
155
+ }
156
+ else {
157
+ this.slide(false);
158
+ }
159
+ }
160
+ this.xDown = null;
161
+ this.yDown = null;
162
+ if (this.autoSlide) {
163
+ this.setSlideAutoInterval();
164
+ }
165
+ }
166
+ ;
167
+ setSlideAutoInterval() {
168
+ if (this.loopTime == 0) {
169
+ return;
170
+ }
171
+ clearInterval(this.sliderInterval);
172
+ this.sliderInterval = setInterval(() => {
173
+ if (this.currentPage + 1 < this.slidesCount / this.slideNumber) {
174
+ this.slideTo(this.currentPage + 1);
175
+ }
176
+ else {
177
+ this.slideTo(0);
178
+ }
179
+ }, Number(this.loopTime) * 1000);
180
+ }
181
+ componentDidUpdate() {
182
+ this.sliderEl.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
183
+ this.updateControls();
184
+ }
185
+ switchLoopStatus(isMouseMoveEnter) {
186
+ if (!this.autoSlide)
187
+ return;
188
+ if (this.loopTime > 0) {
189
+ if (isMouseMoveEnter) {
190
+ clearInterval(this.sliderInterval);
191
+ }
192
+ else {
193
+ this.setSlideAutoInterval();
194
+ }
195
+ }
196
+ }
197
+ setClientStyling() {
198
+ const sheet = new CSSStyleSheet();
199
+ // @ts-ignore
200
+ sheet.replace(this.clientStyling);
201
+ // @ts-ignore
202
+ this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
203
+ }
204
+ setClientStylingURL() {
205
+ let url = new URL(this.clientStylingUrl);
206
+ fetch(url.href)
207
+ .then((res) => res.text())
208
+ .then((data) => {
209
+ const sheet = new CSSStyleSheet();
210
+ // @ts-ignore
211
+ sheet.replace(data);
212
+ // @ts-ignore
213
+ this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
214
+ });
215
+ }
216
+ render() {
217
+ return (h("div", { class: "GeneralSlider" },
218
+ h("div", { class: "Slider" },
219
+ this.showArrow &&
220
+ h("div", null,
221
+ h("button", { type: "button", class: "Button ButtonNext", onClick: this.slide.bind(this, true), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, ">"),
222
+ h("button", { type: "button", class: "Button ButtonPrev", onClick: this.slide.bind(this, false), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, "<")),
223
+ h("ul", { class: `SliderList Col-${this.slideShow}`, part: "SliderList", onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false), ref: (el) => this.sliderEl = el },
224
+ h("slot", { ref: (el) => this.slotEl = el }))),
225
+ this.showButton && this.slidesCount > 0 &&
226
+ h("div", { class: "PageButtons", part: "PageButtons" }, [...Array(this.slidesCount / this.slideNumber)].map((_x, i) => h("div", { class: `PageButton ${this.currentPage == i ? 'active' : ''}`, title: `page${i}`, onClick: this.slideTo.bind(this, i), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, "\u00A0")))));
227
+ }
228
+ static get is() { return "general-slider"; }
229
+ static get encapsulation() { return "shadow"; }
230
+ static get originalStyleUrls() { return {
231
+ "$": ["general-slider.scss"]
232
+ }; }
233
+ static get styleUrls() { return {
234
+ "$": ["general-slider.css"]
235
+ }; }
236
+ static get properties() { return {
237
+ "slideNumber": {
238
+ "type": "number",
239
+ "mutable": false,
240
+ "complexType": {
241
+ "original": "number",
242
+ "resolved": "number",
243
+ "references": {}
244
+ },
245
+ "required": false,
246
+ "optional": false,
247
+ "docs": {
248
+ "tags": [],
249
+ "text": "Slide Count"
250
+ },
251
+ "attribute": "slide-number",
252
+ "reflect": false,
253
+ "defaultValue": "3"
254
+ },
255
+ "slideShow": {
256
+ "type": "number",
257
+ "mutable": false,
258
+ "complexType": {
259
+ "original": "number",
260
+ "resolved": "number",
261
+ "references": {}
262
+ },
263
+ "required": false,
264
+ "optional": false,
265
+ "docs": {
266
+ "tags": [],
267
+ "text": "Slides to show"
268
+ },
269
+ "attribute": "slide-show",
270
+ "reflect": false,
271
+ "defaultValue": "3"
272
+ },
273
+ "showArrow": {
274
+ "type": "boolean",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "boolean",
278
+ "resolved": "boolean",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "Display the arrow icon"
286
+ },
287
+ "attribute": "show-arrow",
288
+ "reflect": false,
289
+ "defaultValue": "true"
290
+ },
291
+ "showButton": {
292
+ "type": "boolean",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "boolean",
296
+ "resolved": "boolean",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "Display the button"
304
+ },
305
+ "attribute": "show-button",
306
+ "reflect": false,
307
+ "defaultValue": "false"
308
+ },
309
+ "autoSlide": {
310
+ "type": "boolean",
311
+ "mutable": false,
312
+ "complexType": {
313
+ "original": "boolean",
314
+ "resolved": "boolean",
315
+ "references": {}
316
+ },
317
+ "required": false,
318
+ "optional": false,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": "Auto Slide"
322
+ },
323
+ "attribute": "auto-slide",
324
+ "reflect": false,
325
+ "defaultValue": "false"
326
+ },
327
+ "loopTime": {
328
+ "type": "number",
329
+ "mutable": false,
330
+ "complexType": {
331
+ "original": "number",
332
+ "resolved": "number",
333
+ "references": {}
334
+ },
335
+ "required": false,
336
+ "optional": false,
337
+ "docs": {
338
+ "tags": [],
339
+ "text": "Auto Slide loop time"
340
+ },
341
+ "attribute": "loop-time",
342
+ "reflect": false,
343
+ "defaultValue": "1"
344
+ },
345
+ "autoItemHeight": {
346
+ "type": "boolean",
347
+ "mutable": false,
348
+ "complexType": {
349
+ "original": "boolean",
350
+ "resolved": "boolean",
351
+ "references": {}
352
+ },
353
+ "required": false,
354
+ "optional": false,
355
+ "docs": {
356
+ "tags": [],
357
+ "text": "Auto fill the Item height"
358
+ },
359
+ "attribute": "auto-item-height",
360
+ "reflect": false,
361
+ "defaultValue": "false"
362
+ },
363
+ "clientStyling": {
364
+ "type": "string",
365
+ "mutable": false,
366
+ "complexType": {
367
+ "original": "string",
368
+ "resolved": "string",
369
+ "references": {}
370
+ },
371
+ "required": false,
372
+ "optional": true,
373
+ "docs": {
374
+ "tags": [],
375
+ "text": "Client custom styling via inline styles"
376
+ },
377
+ "attribute": "client-styling",
378
+ "reflect": false,
379
+ "defaultValue": "''"
380
+ },
381
+ "clientStylingUrl": {
382
+ "type": "string",
383
+ "mutable": false,
384
+ "complexType": {
385
+ "original": "string",
386
+ "resolved": "string",
387
+ "references": {}
388
+ },
389
+ "required": false,
390
+ "optional": true,
391
+ "docs": {
392
+ "tags": [],
393
+ "text": "Client custom styling via url"
394
+ },
395
+ "attribute": "client-styling-url",
396
+ "reflect": false,
397
+ "defaultValue": "''"
398
+ }
399
+ }; }
400
+ static get states() { return {
401
+ "currentSlideNumber": {},
402
+ "slidesCount": {},
403
+ "limitStylingAppends": {}
404
+ }; }
405
+ static get elementRef() { return "el"; }
406
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,3 @@
1
+ export function format(first, middle, last) {
2
+ return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
3
+ }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GeneralSlider extends Components.GeneralSlider, HTMLElement {}
4
+ export const GeneralSlider: {
5
+ prototype: GeneralSlider;
6
+ new (): GeneralSlider;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;