@everymatrix/general-slider 1.0.69

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 (42) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/general-slider.cjs.entry.js +207 -0
  3. package/dist/cjs/general-slider.cjs.js +25 -0
  4. package/dist/cjs/index-a188f427.js +1190 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/loader.cjs.js +15 -0
  7. package/dist/collection/collection-manifest.json +12 -0
  8. package/dist/collection/components/general-slider/general-slider.css +134 -0
  9. package/dist/collection/components/general-slider/general-slider.js +380 -0
  10. package/dist/collection/components/general-slider/index.js +1 -0
  11. package/dist/collection/index.js +1 -0
  12. package/dist/collection/utils/utils.js +3 -0
  13. package/dist/esm/app-globals-0f993ce5.js +3 -0
  14. package/dist/esm/general-slider.entry.js +203 -0
  15. package/dist/esm/general-slider.js +20 -0
  16. package/dist/esm/index-81e4031d.js +1163 -0
  17. package/dist/esm/index.js +1 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/general-slider/general-slider.esm.js +1 -0
  20. package/dist/general-slider/index.esm.js +0 -0
  21. package/dist/general-slider/p-0c9064c9.entry.js +1 -0
  22. package/dist/general-slider/p-b2733fb4.js +2 -0
  23. package/dist/general-slider/p-e1255160.js +1 -0
  24. package/dist/index.cjs.js +1 -0
  25. package/dist/index.js +1 -0
  26. package/dist/stencil.config.dev.js +17 -0
  27. package/dist/stencil.config.js +17 -0
  28. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-slider/.stencil/packages/stencil/general-slider/stencil.config.d.ts +2 -0
  29. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-slider/.stencil/packages/stencil/general-slider/stencil.config.dev.d.ts +2 -0
  30. package/dist/types/components/general-slider/general-slider.d.ts +69 -0
  31. package/dist/types/components/general-slider/index.d.ts +1 -0
  32. package/dist/types/components.d.ts +109 -0
  33. package/dist/types/index.d.ts +1 -0
  34. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  35. package/dist/types/utils/utils.d.ts +1 -0
  36. package/loader/cdn.js +1 -0
  37. package/loader/index.cjs.js +1 -0
  38. package/loader/index.d.ts +24 -0
  39. package/loader/index.es2017.js +1 -0
  40. package/loader/index.js +2 -0
  41. package/loader/package.json +11 -0
  42. package/package.json +26 -0
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a188f427.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ const defineCustomElements = async (win, options) => {
9
+ if (typeof window === 'undefined') return undefined;
10
+ await appGlobals.globalScripts();
11
+ 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);
12
+ };
13
+
14
+ exports.setNonce = index.setNonce;
15
+ 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": "4.20.0",
8
+ "typescriptVersion": "5.5.3"
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,380 @@
1
+ import { h } from "@stencil/core";
2
+ export class GeneralSlider {
3
+ constructor() {
4
+ this.slides = null;
5
+ this.slideWidth = 0;
6
+ this.currentPage = 0;
7
+ this.controls = {
8
+ Prev: null,
9
+ Next: null
10
+ };
11
+ this.xDown = null;
12
+ this.yDown = null;
13
+ this.slideNumber = 3;
14
+ this.slideShow = 3;
15
+ this.showArrow = true;
16
+ this.showButton = false;
17
+ this.autoSlide = false;
18
+ this.loopTime = 1;
19
+ this.autoItemHeight = false;
20
+ this.clientStyling = '';
21
+ this.clientStylingUrl = '';
22
+ this.currentSlideNumber = 0;
23
+ this.slidesCount = 0;
24
+ this.limitStylingAppends = false;
25
+ }
26
+ slide(next) {
27
+ let slideTo = 0;
28
+ if (next) {
29
+ slideTo = this.currentSlideNumber + this.slideNumber;
30
+ }
31
+ else {
32
+ slideTo = this.currentSlideNumber - this.slideNumber;
33
+ }
34
+ if (slideTo < 0 || slideTo >= this.slidesCount)
35
+ return;
36
+ this.currentSlideNumber = slideTo;
37
+ this.currentPage = this.currentSlideNumber / this.slideNumber;
38
+ this.updateListStyle();
39
+ }
40
+ slideTo(page) {
41
+ this.currentSlideNumber = page * this.slideNumber;
42
+ this.currentPage = page;
43
+ this.updateListStyle();
44
+ }
45
+ updateControls() {
46
+ this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
47
+ this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
48
+ }
49
+ switchControl(type, enabled) {
50
+ if (this.controls[type]) {
51
+ this.controls[type].disabled = !enabled;
52
+ }
53
+ }
54
+ componentWillLoad() {
55
+ if (!this.slideNumber)
56
+ this.slideNumber = 1;
57
+ if (!this.slideShow)
58
+ this.slideShow = 1;
59
+ }
60
+ componentDidLoad() {
61
+ this.slides = this.slotEl.assignedElements();
62
+ this.slidesCount = this.slides.length;
63
+ for (let type in this.controls) {
64
+ this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
65
+ }
66
+ if (this.autoSlide) {
67
+ this.setSlideAutoInterval();
68
+ }
69
+ if (!this.limitStylingAppends && this.el.shadowRoot) {
70
+ if (this.clientStyling)
71
+ this.setClientStyling();
72
+ if (this.clientStylingUrl)
73
+ this.setClientStylingURL();
74
+ this.limitStylingAppends = true;
75
+ }
76
+ }
77
+ componentDidRender() {
78
+ if (this.slides)
79
+ this.slideWidth = this.slides[0].offsetWidth;
80
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
81
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
82
+ this.updateListStyle();
83
+ if (!this.limitStylingAppends && this.el.shadowRoot) {
84
+ if (this.clientStyling)
85
+ this.setClientStyling();
86
+ if (this.clientStylingUrl)
87
+ this.setClientStylingURL();
88
+ this.limitStylingAppends = true;
89
+ }
90
+ }
91
+ updateListStyle() {
92
+ if (!this.autoItemHeight)
93
+ return;
94
+ if (this.slides === null)
95
+ return;
96
+ this.slides.forEach((li, index) => {
97
+ if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
98
+ li.classList.remove('hide');
99
+ }
100
+ else {
101
+ li.classList.add('hide');
102
+ }
103
+ });
104
+ }
105
+ disconnectedCallback() {
106
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
107
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
108
+ }
109
+ handleTouchStart(evt) {
110
+ const firstTouch = this.getTouches(evt)[0];
111
+ this.xDown = firstTouch.clientX;
112
+ this.yDown = firstTouch.clientY;
113
+ clearInterval(this.sliderInterval);
114
+ }
115
+ getTouches(evt) {
116
+ return evt.touches || evt.originalEvent.touches;
117
+ }
118
+ handleTouchMove(evt) {
119
+ if (!this.xDown || !this.yDown)
120
+ return;
121
+ let xUp = evt.touches[0].clientX;
122
+ let yUp = evt.touches[0].clientY;
123
+ let xDiff = this.xDown - xUp;
124
+ let yDiff = this.yDown - yUp;
125
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
126
+ if (xDiff > 0) {
127
+ this.slide(true);
128
+ }
129
+ else {
130
+ this.slide(false);
131
+ }
132
+ }
133
+ this.xDown = null;
134
+ this.yDown = null;
135
+ if (this.autoSlide) {
136
+ this.setSlideAutoInterval();
137
+ }
138
+ }
139
+ ;
140
+ setSlideAutoInterval() {
141
+ if (this.loopTime == 0) {
142
+ return;
143
+ }
144
+ clearInterval(this.sliderInterval);
145
+ this.sliderInterval = setInterval(() => {
146
+ if (this.currentPage + 1 < this.slidesCount / this.slideNumber) {
147
+ this.slideTo(this.currentPage + 1);
148
+ }
149
+ else {
150
+ this.slideTo(0);
151
+ }
152
+ }, Number(this.loopTime) * 1000);
153
+ }
154
+ componentDidUpdate() {
155
+ this.sliderEl.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
156
+ this.updateControls();
157
+ }
158
+ switchLoopStatus(isMouseMoveEnter) {
159
+ if (!this.autoSlide)
160
+ return;
161
+ if (this.loopTime > 0) {
162
+ if (isMouseMoveEnter) {
163
+ clearInterval(this.sliderInterval);
164
+ }
165
+ else {
166
+ this.setSlideAutoInterval();
167
+ }
168
+ }
169
+ }
170
+ setClientStyling() {
171
+ const sheet = new CSSStyleSheet();
172
+ // @ts-ignore
173
+ sheet.replace(this.clientStyling);
174
+ // @ts-ignore
175
+ this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
176
+ }
177
+ setClientStylingURL() {
178
+ let url = new URL(this.clientStylingUrl);
179
+ fetch(url.href)
180
+ .then((res) => res.text())
181
+ .then((data) => {
182
+ const sheet = new CSSStyleSheet();
183
+ // @ts-ignore
184
+ sheet.replace(data);
185
+ // @ts-ignore
186
+ this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
187
+ });
188
+ }
189
+ render() {
190
+ return (h("div", { key: 'b8c30bef4c9ca004256c94cb642e8acb350afea4', class: "GeneralSlider" }, h("div", { key: '27d6869ae4f675f5e14d17fae20718ec24391e1b', class: "Slider" }, this.showArrow &&
191
+ h("div", { key: '61acebc8e1a0ecf02ae6dad1ecc6f618424d05d5' }, h("button", { key: 'c593883f94b693d6dfe741b2b4ed08185db36ef2', type: "button", class: "Button ButtonNext", onClick: this.slide.bind(this, true), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, ">"), h("button", { key: '2bea5e3e9f36443e78bc25f0556dce2adb7111a0', type: "button", class: "Button ButtonPrev", onClick: this.slide.bind(this, false), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, "<")), h("ul", { key: '6643c865256f26b5d06ec78044a2b595832ecb5e', class: `SliderList Col-${this.slideShow}`, part: "SliderList", onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false), ref: (el) => this.sliderEl = el }, h("slot", { key: '48f1ad37b771f32ecc27f3065d58bc7ef1a8a021', ref: (el) => this.slotEl = el }))), this.showButton && this.slidesCount > 0 &&
192
+ h("div", { key: 'd125efa8c68a6e913664d01fb395ed6cada71f5b', 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")))));
193
+ }
194
+ static get is() { return "general-slider"; }
195
+ static get encapsulation() { return "shadow"; }
196
+ static get originalStyleUrls() {
197
+ return {
198
+ "$": ["general-slider.scss"]
199
+ };
200
+ }
201
+ static get styleUrls() {
202
+ return {
203
+ "$": ["general-slider.css"]
204
+ };
205
+ }
206
+ static get properties() {
207
+ return {
208
+ "slideNumber": {
209
+ "type": "number",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "number",
213
+ "resolved": "number",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "Slide Count"
221
+ },
222
+ "attribute": "slide-number",
223
+ "reflect": false,
224
+ "defaultValue": "3"
225
+ },
226
+ "slideShow": {
227
+ "type": "number",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "number",
231
+ "resolved": "number",
232
+ "references": {}
233
+ },
234
+ "required": false,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "Slides to show"
239
+ },
240
+ "attribute": "slide-show",
241
+ "reflect": false,
242
+ "defaultValue": "3"
243
+ },
244
+ "showArrow": {
245
+ "type": "boolean",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "boolean",
249
+ "resolved": "boolean",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Display the arrow icon"
257
+ },
258
+ "attribute": "show-arrow",
259
+ "reflect": false,
260
+ "defaultValue": "true"
261
+ },
262
+ "showButton": {
263
+ "type": "boolean",
264
+ "mutable": false,
265
+ "complexType": {
266
+ "original": "boolean",
267
+ "resolved": "boolean",
268
+ "references": {}
269
+ },
270
+ "required": false,
271
+ "optional": false,
272
+ "docs": {
273
+ "tags": [],
274
+ "text": "Display the button"
275
+ },
276
+ "attribute": "show-button",
277
+ "reflect": false,
278
+ "defaultValue": "false"
279
+ },
280
+ "autoSlide": {
281
+ "type": "boolean",
282
+ "mutable": false,
283
+ "complexType": {
284
+ "original": "boolean",
285
+ "resolved": "boolean",
286
+ "references": {}
287
+ },
288
+ "required": false,
289
+ "optional": false,
290
+ "docs": {
291
+ "tags": [],
292
+ "text": "Auto Slide"
293
+ },
294
+ "attribute": "auto-slide",
295
+ "reflect": false,
296
+ "defaultValue": "false"
297
+ },
298
+ "loopTime": {
299
+ "type": "number",
300
+ "mutable": false,
301
+ "complexType": {
302
+ "original": "number",
303
+ "resolved": "number",
304
+ "references": {}
305
+ },
306
+ "required": false,
307
+ "optional": false,
308
+ "docs": {
309
+ "tags": [],
310
+ "text": "Auto Slide loop time"
311
+ },
312
+ "attribute": "loop-time",
313
+ "reflect": false,
314
+ "defaultValue": "1"
315
+ },
316
+ "autoItemHeight": {
317
+ "type": "boolean",
318
+ "mutable": false,
319
+ "complexType": {
320
+ "original": "boolean",
321
+ "resolved": "boolean",
322
+ "references": {}
323
+ },
324
+ "required": false,
325
+ "optional": false,
326
+ "docs": {
327
+ "tags": [],
328
+ "text": "Auto fill the Item height"
329
+ },
330
+ "attribute": "auto-item-height",
331
+ "reflect": false,
332
+ "defaultValue": "false"
333
+ },
334
+ "clientStyling": {
335
+ "type": "string",
336
+ "mutable": false,
337
+ "complexType": {
338
+ "original": "string",
339
+ "resolved": "string",
340
+ "references": {}
341
+ },
342
+ "required": false,
343
+ "optional": true,
344
+ "docs": {
345
+ "tags": [],
346
+ "text": "Client custom styling via inline styles"
347
+ },
348
+ "attribute": "client-styling",
349
+ "reflect": false,
350
+ "defaultValue": "''"
351
+ },
352
+ "clientStylingUrl": {
353
+ "type": "string",
354
+ "mutable": false,
355
+ "complexType": {
356
+ "original": "string",
357
+ "resolved": "string",
358
+ "references": {}
359
+ },
360
+ "required": false,
361
+ "optional": true,
362
+ "docs": {
363
+ "tags": [],
364
+ "text": "Client custom styling via url"
365
+ },
366
+ "attribute": "client-styling-url",
367
+ "reflect": false,
368
+ "defaultValue": "''"
369
+ }
370
+ };
371
+ }
372
+ static get states() {
373
+ return {
374
+ "currentSlideNumber": {},
375
+ "slidesCount": {},
376
+ "limitStylingAppends": {}
377
+ };
378
+ }
379
+ static get elementRef() { return "el"; }
380
+ }
@@ -0,0 +1 @@
1
+ export { GeneralSlider } from './general-slider';
@@ -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,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };