@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,168 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-86ebe85a.js');
6
+
7
+ const generalSliderCss = ":host{display:block}.GeneralSlider{position:relative}.Slider{position:relative;width:100%;margin:0 auto;overflow:hidden}.SliderList{display:flex;margin:0;padding:0;list-style:none;transition:transform 0.5s ease-in-out}::slotted(li){flex:1 0 auto;width:100%;margin:auto}::slotted(li.hide){visibility:hidden;height:0;transition-delay:500ms}.Col-2 ::slotted(li){flex:2 0 auto;width:50%}.Col-3 ::slotted(li){flex:3 0 auto;width:33.3333333333%}.Col-4 ::slotted(li){flex:4 0 auto;width:25%}.Col-5 ::slotted(li){flex:5 0 auto;width:20%}.Col-6 ::slotted(li){flex:6 0 auto;width:16.6666666667%}.Col-7 ::slotted(li){flex:7 0 auto;width:14.2857142857%}.Col-8 ::slotted(li){flex:8 0 auto;width:12.5%}.Col-9 ::slotted(li){flex:9 0 auto;width:11.1111111111%}.Col-10 ::slotted(li){flex:10 0 auto;width:10%}.Col-11 ::slotted(li){flex:11 0 auto;width:9.0909090909%}.Col-12 ::slotted(li){flex:12 0 auto;width:8.3333333333%}.Button{position:absolute;z-index:1;top:calc(50% - 32px);padding:20px;font-size:20px;line-height:20px;opacity:0.5;border:none;background:var(--emfe-w-color-contrast, #07072A);color:var(--emfe-w-color-white, #FFFFFF);cursor:pointer}.Button:hover{opacity:1;transition:opacity 0.5s ease-in-out}.Button[disabled],.Button[disabled]:hover{color:var(--emfe-w-color-gray-150, #828282);opacity:0.25}.Button.ButtonNext{right:0}.PageButtons{display:flex;gap:4px;margin-top:8px}.PageButton{width:15px;height:4px;border-radius:4px;background-color:#0072ED;opacity:0.2;cursor:pointer;float:right}.PageButton.active{width:45px;opacity:1}";
8
+
9
+ const GeneralSlider = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.showStatus = false;
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.currentSlideNumber = 0;
21
+ this.slidesCount = 0;
22
+ this.slideWidth = 0;
23
+ this.currentPage = 0;
24
+ this.controls = {
25
+ Prev: null,
26
+ Next: null
27
+ };
28
+ this.xDown = null;
29
+ this.yDown = null;
30
+ }
31
+ slide(next) {
32
+ let slideTo = 0;
33
+ if (next) {
34
+ slideTo = this.currentSlideNumber + this.slideNumber;
35
+ }
36
+ else {
37
+ slideTo = this.currentSlideNumber - this.slideNumber;
38
+ }
39
+ if (slideTo < 0 || slideTo >= this.slidesCount)
40
+ return;
41
+ this.currentSlideNumber = slideTo;
42
+ this.currentPage = this.currentSlideNumber / this.slideNumber;
43
+ this.updateListStyle();
44
+ }
45
+ slideTo(page) {
46
+ this.currentSlideNumber = page * this.slideNumber;
47
+ this.currentPage = page;
48
+ this.updateListStyle();
49
+ }
50
+ updateControls() {
51
+ this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
52
+ this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
53
+ }
54
+ switchControl(type, enabled) {
55
+ if (this.controls[type]) {
56
+ this.controls[type].disabled = !enabled;
57
+ }
58
+ }
59
+ componentWillLoad() {
60
+ this.slides = this.el.querySelectorAll('li');
61
+ this.slidesCount = this.slides.length;
62
+ if (!this.slideNumber)
63
+ this.slideNumber = 1;
64
+ if (!this.slideShow)
65
+ this.slideShow = 1;
66
+ }
67
+ componentDidLoad() {
68
+ this.sliderList = this.el.shadowRoot.querySelector('ul');
69
+ this.slideWidth = this.slides[0].offsetWidth;
70
+ for (let type in this.controls) {
71
+ this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
72
+ }
73
+ this.updateControls();
74
+ if (this.autoSlide) {
75
+ this.setSlideAutoInterval();
76
+ }
77
+ }
78
+ componentDidRender() {
79
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
80
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
81
+ this.updateListStyle();
82
+ }
83
+ updateListStyle() {
84
+ if (!this.autoItemHeight)
85
+ return;
86
+ const sliderlist = this.el.querySelectorAll('li');
87
+ sliderlist.forEach((li, index) => {
88
+ li.classList.add('hide');
89
+ if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
90
+ li.classList.remove('hide');
91
+ }
92
+ });
93
+ }
94
+ disconnectedCallback() {
95
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
96
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
97
+ }
98
+ handleTouchStart(evt) {
99
+ const firstTouch = this.getTouches(evt)[0];
100
+ this.xDown = firstTouch.clientX;
101
+ this.yDown = firstTouch.clientY;
102
+ clearInterval(this.sliderInterval);
103
+ }
104
+ getTouches(evt) {
105
+ return evt.touches || evt.originalEvent.touches;
106
+ }
107
+ handleTouchMove(evt) {
108
+ if (!this.xDown || !this.yDown)
109
+ return;
110
+ let xUp = evt.touches[0].clientX;
111
+ let yUp = evt.touches[0].clientY;
112
+ let xDiff = this.xDown - xUp;
113
+ let yDiff = this.yDown - yUp;
114
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
115
+ if (xDiff > 0) {
116
+ this.slide(true);
117
+ }
118
+ else {
119
+ this.slide(false);
120
+ }
121
+ }
122
+ this.xDown = null;
123
+ this.yDown = null;
124
+ if (this.autoSlide) {
125
+ this.setSlideAutoInterval();
126
+ }
127
+ }
128
+ ;
129
+ setSlideAutoInterval() {
130
+ if (this.loopTime == 0) {
131
+ return;
132
+ }
133
+ clearInterval(this.sliderInterval);
134
+ this.sliderInterval = setInterval(() => {
135
+ if (this.currentPage + 1 < this.slidesCount / this.slideNumber) {
136
+ this.slideTo(this.currentPage + 1);
137
+ }
138
+ else {
139
+ this.slideTo(0);
140
+ }
141
+ }, Number(this.loopTime) * 1000);
142
+ }
143
+ componentDidUpdate() {
144
+ this.sliderList.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
145
+ this.updateControls();
146
+ }
147
+ switchLoopStatus(isMouseMoveEnter) {
148
+ if (!this.autoSlide)
149
+ return;
150
+ if (this.loopTime > 0) {
151
+ if (isMouseMoveEnter) {
152
+ clearInterval(this.sliderInterval);
153
+ }
154
+ else {
155
+ this.setSlideAutoInterval();
156
+ }
157
+ }
158
+ }
159
+ render() {
160
+ return (index.h("div", { class: "GeneralSlider" }, index.h("div", { class: "Slider" }, this.showArrow &&
161
+ index.h("div", null, index.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) }, ">"), index.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) }, "<")), index.h("ul", { class: `SliderList Col-${this.slideShow}`, part: "SliderList", onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, index.h("slot", null))), this.showButton && this.slidesCount > 0 &&
162
+ index.h("div", { class: "PageButtons", part: "PageButtons" }, [...Array(this.slidesCount / this.slideNumber)].map((_x, i) => index.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")))));
163
+ }
164
+ get el() { return index.getElement(this); }
165
+ };
166
+ GeneralSlider.style = generalSliderCss;
167
+
168
+ exports.general_slider = GeneralSlider;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-86ebe85a.js');
4
+
5
+ /*
6
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ const patchBrowser = () => {
9
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-slider.cjs.js', document.baseURI).href));
10
+ const opts = {};
11
+ if (importMeta !== '') {
12
+ opts.resourcesUrl = new URL('.', importMeta).href;
13
+ }
14
+ return index.promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(options => {
18
+ 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);
19
+ });