@everymatrix/general-slider 1.16.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.
Files changed (45) hide show
  1. package/dist/cjs/general-slider.cjs.entry.js +168 -0
  2. package/dist/cjs/general-slider.cjs.js +19 -0
  3. package/dist/cjs/index-86ebe85a.js +1158 -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 +321 -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 +192 -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 +164 -0
  16. package/dist/esm/general-slider.js +17 -0
  17. package/dist/esm/index-d8114a95.js +1132 -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-7bfeafea.entry.js +1 -0
  29. package/dist/general-slider/p-95e8d88b.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 +37 -0
  35. package/dist/types/components.d.ts +53 -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 +19 -0
@@ -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-86ebe85a.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",{"showStatus":[4,"show-status"],"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"],"currentSlideNumber":[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: #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,321 @@
1
+ import { Component, Prop, h, Element, State } from '@stencil/core';
2
+ export class GeneralSlider {
3
+ constructor() {
4
+ this.showStatus = false;
5
+ this.slideNumber = 3;
6
+ this.slideShow = 3;
7
+ this.showArrow = true;
8
+ this.showButton = false;
9
+ this.autoSlide = false;
10
+ this.loopTime = 1;
11
+ this.autoItemHeight = false;
12
+ this.currentSlideNumber = 0;
13
+ this.slidesCount = 0;
14
+ this.slideWidth = 0;
15
+ this.currentPage = 0;
16
+ this.controls = {
17
+ Prev: null,
18
+ Next: null
19
+ };
20
+ this.xDown = null;
21
+ this.yDown = null;
22
+ }
23
+ slide(next) {
24
+ let slideTo = 0;
25
+ if (next) {
26
+ slideTo = this.currentSlideNumber + this.slideNumber;
27
+ }
28
+ else {
29
+ slideTo = this.currentSlideNumber - this.slideNumber;
30
+ }
31
+ if (slideTo < 0 || slideTo >= this.slidesCount)
32
+ return;
33
+ this.currentSlideNumber = slideTo;
34
+ this.currentPage = this.currentSlideNumber / this.slideNumber;
35
+ this.updateListStyle();
36
+ }
37
+ slideTo(page) {
38
+ this.currentSlideNumber = page * this.slideNumber;
39
+ this.currentPage = page;
40
+ this.updateListStyle();
41
+ }
42
+ updateControls() {
43
+ this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
44
+ this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
45
+ }
46
+ switchControl(type, enabled) {
47
+ if (this.controls[type]) {
48
+ this.controls[type].disabled = !enabled;
49
+ }
50
+ }
51
+ componentWillLoad() {
52
+ this.slides = this.el.querySelectorAll('li');
53
+ this.slidesCount = this.slides.length;
54
+ if (!this.slideNumber)
55
+ this.slideNumber = 1;
56
+ if (!this.slideShow)
57
+ this.slideShow = 1;
58
+ }
59
+ componentDidLoad() {
60
+ this.sliderList = this.el.shadowRoot.querySelector('ul');
61
+ this.slideWidth = this.slides[0].offsetWidth;
62
+ for (let type in this.controls) {
63
+ this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
64
+ }
65
+ this.updateControls();
66
+ if (this.autoSlide) {
67
+ this.setSlideAutoInterval();
68
+ }
69
+ }
70
+ componentDidRender() {
71
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
72
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
73
+ this.updateListStyle();
74
+ }
75
+ updateListStyle() {
76
+ if (!this.autoItemHeight)
77
+ return;
78
+ const sliderlist = this.el.querySelectorAll('li');
79
+ sliderlist.forEach((li, index) => {
80
+ li.classList.add('hide');
81
+ if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
82
+ li.classList.remove('hide');
83
+ }
84
+ });
85
+ }
86
+ disconnectedCallback() {
87
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
88
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
89
+ }
90
+ handleTouchStart(evt) {
91
+ const firstTouch = this.getTouches(evt)[0];
92
+ this.xDown = firstTouch.clientX;
93
+ this.yDown = firstTouch.clientY;
94
+ clearInterval(this.sliderInterval);
95
+ }
96
+ getTouches(evt) {
97
+ return evt.touches || evt.originalEvent.touches;
98
+ }
99
+ handleTouchMove(evt) {
100
+ if (!this.xDown || !this.yDown)
101
+ return;
102
+ let xUp = evt.touches[0].clientX;
103
+ let yUp = evt.touches[0].clientY;
104
+ let xDiff = this.xDown - xUp;
105
+ let yDiff = this.yDown - yUp;
106
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
107
+ if (xDiff > 0) {
108
+ this.slide(true);
109
+ }
110
+ else {
111
+ this.slide(false);
112
+ }
113
+ }
114
+ this.xDown = null;
115
+ this.yDown = null;
116
+ if (this.autoSlide) {
117
+ this.setSlideAutoInterval();
118
+ }
119
+ }
120
+ ;
121
+ setSlideAutoInterval() {
122
+ if (this.loopTime == 0) {
123
+ return;
124
+ }
125
+ clearInterval(this.sliderInterval);
126
+ this.sliderInterval = setInterval(() => {
127
+ if (this.currentPage + 1 < this.slidesCount / this.slideNumber) {
128
+ this.slideTo(this.currentPage + 1);
129
+ }
130
+ else {
131
+ this.slideTo(0);
132
+ }
133
+ }, Number(this.loopTime) * 1000);
134
+ }
135
+ componentDidUpdate() {
136
+ this.sliderList.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
137
+ this.updateControls();
138
+ }
139
+ switchLoopStatus(isMouseMoveEnter) {
140
+ if (!this.autoSlide)
141
+ return;
142
+ if (this.loopTime > 0) {
143
+ if (isMouseMoveEnter) {
144
+ clearInterval(this.sliderInterval);
145
+ }
146
+ else {
147
+ this.setSlideAutoInterval();
148
+ }
149
+ }
150
+ }
151
+ render() {
152
+ return (h("div", { class: "GeneralSlider" },
153
+ h("div", { class: "Slider" },
154
+ this.showArrow &&
155
+ h("div", null,
156
+ 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) }, ">"),
157
+ 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) }, "<")),
158
+ h("ul", { class: `SliderList Col-${this.slideShow}`, part: "SliderList", onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) },
159
+ h("slot", null))),
160
+ this.showButton && this.slidesCount > 0 &&
161
+ 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")))));
162
+ }
163
+ static get is() { return "general-slider"; }
164
+ static get encapsulation() { return "shadow"; }
165
+ static get originalStyleUrls() { return {
166
+ "$": ["general-slider.scss"]
167
+ }; }
168
+ static get styleUrls() { return {
169
+ "$": ["general-slider.css"]
170
+ }; }
171
+ static get properties() { return {
172
+ "showStatus": {
173
+ "type": "boolean",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "boolean",
177
+ "resolved": "boolean",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": ""
185
+ },
186
+ "attribute": "show-status",
187
+ "reflect": false,
188
+ "defaultValue": "false"
189
+ },
190
+ "slideNumber": {
191
+ "type": "number",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "number",
195
+ "resolved": "number",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": ""
203
+ },
204
+ "attribute": "slide-number",
205
+ "reflect": false,
206
+ "defaultValue": "3"
207
+ },
208
+ "slideShow": {
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": ""
221
+ },
222
+ "attribute": "slide-show",
223
+ "reflect": false,
224
+ "defaultValue": "3"
225
+ },
226
+ "showArrow": {
227
+ "type": "boolean",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "boolean",
231
+ "resolved": "boolean",
232
+ "references": {}
233
+ },
234
+ "required": false,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": ""
239
+ },
240
+ "attribute": "show-arrow",
241
+ "reflect": false,
242
+ "defaultValue": "true"
243
+ },
244
+ "showButton": {
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": ""
257
+ },
258
+ "attribute": "show-button",
259
+ "reflect": false,
260
+ "defaultValue": "false"
261
+ },
262
+ "autoSlide": {
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": ""
275
+ },
276
+ "attribute": "auto-slide",
277
+ "reflect": false,
278
+ "defaultValue": "false"
279
+ },
280
+ "loopTime": {
281
+ "type": "number",
282
+ "mutable": false,
283
+ "complexType": {
284
+ "original": "number",
285
+ "resolved": "number",
286
+ "references": {}
287
+ },
288
+ "required": false,
289
+ "optional": false,
290
+ "docs": {
291
+ "tags": [],
292
+ "text": ""
293
+ },
294
+ "attribute": "loop-time",
295
+ "reflect": false,
296
+ "defaultValue": "1"
297
+ },
298
+ "autoItemHeight": {
299
+ "type": "boolean",
300
+ "mutable": false,
301
+ "complexType": {
302
+ "original": "boolean",
303
+ "resolved": "boolean",
304
+ "references": {}
305
+ },
306
+ "required": false,
307
+ "optional": false,
308
+ "docs": {
309
+ "tags": [],
310
+ "text": ""
311
+ },
312
+ "attribute": "auto-item-height",
313
+ "reflect": false,
314
+ "defaultValue": "false"
315
+ }
316
+ }; }
317
+ static get states() { return {
318
+ "currentSlideNumber": {}
319
+ }; }
320
+ static get elementRef() { return "el"; }
321
+ }
@@ -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;