wj-elements 0.7.7 → 0.8.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.
- package/dist/animations.js +28 -51
- package/dist/animations.js.map +1 -1
- package/dist/base-path.js +19 -31
- package/dist/base-path.js.map +1 -1
- package/dist/custom-elements.json +11504 -11499
- package/dist/dark.css +1 -302
- package/dist/date.js +16 -36
- package/dist/date.js.map +1 -1
- package/dist/element-utils.js +20 -81
- package/dist/element-utils.js.map +1 -1
- package/dist/event.js +49 -165
- package/dist/event.js.map +1 -1
- package/dist/form-associated-element-BjeJn7j8.js +101 -0
- package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
- package/dist/icon-DmsqtDpL.js +102 -0
- package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
- package/dist/light.css +1 -731
- package/dist/localize.js +36 -111
- package/dist/localize.js.map +1 -1
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
- package/dist/permissions.js +14 -41
- package/dist/permissions.js.map +1 -1
- package/dist/popup.element-CbkhthPP.js +806 -0
- package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
- package/dist/router-links-CNsJ-elb.js +105 -0
- package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
- package/dist/skeleton.css +1 -197
- package/dist/styles.css +1 -866
- package/dist/universal-service.js +48 -109
- package/dist/universal-service.js.map +1 -1
- package/dist/utils.js +11 -18
- package/dist/utils.js.map +1 -1
- package/dist/web-types.json +760 -760
- package/dist/wje-accordion-item.js +33 -106
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-accordion.js +19 -84
- package/dist/wje-accordion.js.map +1 -1
- package/dist/wje-animation.js +37 -4258
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-aside.js +9 -34
- package/dist/wje-aside.js.map +1 -1
- package/dist/wje-avatar.js +36 -126
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-badge.js +10 -52
- package/dist/wje-badge.js.map +1 -1
- package/dist/wje-breadcrumb.js +205 -672
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js +177 -633
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-button-group.js +48 -153
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +92 -413
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-card-content.js +7 -30
- package/dist/wje-card-content.js.map +1 -1
- package/dist/wje-card-controls.js +7 -30
- package/dist/wje-card-controls.js.map +1 -1
- package/dist/wje-card-header.js +7 -30
- package/dist/wje-card-header.js.map +1 -1
- package/dist/wje-card-subtitle.js +7 -34
- package/dist/wje-card-subtitle.js.map +1 -1
- package/dist/wje-card-title.js +7 -34
- package/dist/wje-card-title.js.map +1 -1
- package/dist/wje-card.js +15 -71
- package/dist/wje-card.js.map +1 -1
- package/dist/wje-carousel-item.js +12 -56
- package/dist/wje-carousel-item.js.map +1 -1
- package/dist/wje-carousel.js +154 -509
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-checkbox.js +50 -227
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-chip.js +43 -160
- package/dist/wje-chip.js.map +1 -1
- package/dist/wje-col.js +7 -20
- package/dist/wje-col.js.map +1 -1
- package/dist/wje-color-picker.js +445 -1464
- package/dist/wje-color-picker.js.map +1 -1
- package/dist/wje-container.js +9 -35
- package/dist/wje-container.js.map +1 -1
- package/dist/wje-copy-button.js +64 -204
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dialog.js +85 -553
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-divider.js +7 -34
- package/dist/wje-divider.js.map +1 -1
- package/dist/wje-dropdown.js +78 -305
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js +191 -700
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload-item.js +51 -156
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-file-upload.js +181 -619
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-footer.js +7 -31
- package/dist/wje-footer.js.map +1 -1
- package/dist/wje-form.js +7 -32
- package/dist/wje-form.js.map +1 -1
- package/dist/wje-format-digital.js +26 -118
- package/dist/wje-format-digital.js.map +1 -1
- package/dist/wje-grid.js +7 -33
- package/dist/wje-grid.js.map +1 -1
- package/dist/wje-header.js +9 -35
- package/dist/wje-header.js.map +1 -1
- package/dist/wje-icon-library.js +12 -18
- package/dist/wje-icon-library.js.map +1 -1
- package/dist/wje-icon-picker.js +65 -320
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-icon.js +1 -1
- package/dist/wje-img-comparer.js +37 -114
- package/dist/wje-img-comparer.js.map +1 -1
- package/dist/wje-img.js +50 -198
- package/dist/wje-img.js.map +1 -1
- package/dist/wje-infinite-scroll.js +94 -346
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input-file.js +23 -84
- package/dist/wje-input-file.js.map +1 -1
- package/dist/wje-input.js +78 -392
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-item.js +11 -64
- package/dist/wje-item.js.map +1 -1
- package/dist/wje-kanban.js +124 -401
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-label.js +9 -32
- package/dist/wje-label.js.map +1 -1
- package/dist/wje-level-indicator.js +38 -157
- package/dist/wje-level-indicator.js.map +1 -1
- package/dist/wje-list.js +10 -40
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-main.js +7 -31
- package/dist/wje-main.js.map +1 -1
- package/dist/wje-masonry.js +66 -211
- package/dist/wje-masonry.js.map +1 -1
- package/dist/wje-master.js +45 -161
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-menu-button.js +10 -38
- package/dist/wje-menu-button.js.map +1 -1
- package/dist/wje-menu-item.js +127 -577
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-menu-label.js +9 -35
- package/dist/wje-menu-label.js.map +1 -1
- package/dist/wje-menu.js +14 -49
- package/dist/wje-menu.js.map +1 -1
- package/dist/wje-option.js +48 -279
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +130 -384
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-orgchart-group.js +16 -52
- package/dist/wje-orgchart-group.js.map +1 -1
- package/dist/wje-orgchart-item.js +24 -93
- package/dist/wje-orgchart-item.js.map +1 -1
- package/dist/wje-orgchart.js +18 -68
- package/dist/wje-orgchart.js.map +1 -1
- package/dist/wje-pagination.js +113 -397
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-popup.js +3 -3
- package/dist/wje-popup.js.map +1 -1
- package/dist/wje-progress-bar.js +53 -205
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-qr-code.js +398 -2980
- package/dist/wje-qr-code.js.map +1 -1
- package/dist/wje-radio-group.js +52 -190
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +24 -118
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-rate.js +62 -266
- package/dist/wje-rate.js.map +1 -1
- package/dist/wje-relative-time.js +24 -99
- package/dist/wje-relative-time.js.map +1 -1
- package/dist/wje-reorder-dropzone.js +9 -31
- package/dist/wje-reorder-dropzone.js.map +1 -1
- package/dist/wje-reorder-handle.js +67 -204
- package/dist/wje-reorder-handle.js.map +1 -1
- package/dist/wje-reorder-item.js +14 -44
- package/dist/wje-reorder-item.js.map +1 -1
- package/dist/wje-reorder.js +61 -246
- package/dist/wje-reorder.js.map +1 -1
- package/dist/wje-route.js +6 -24
- package/dist/wje-route.js.map +1 -1
- package/dist/wje-router-link.js +11 -39
- package/dist/wje-router-link.js.map +1 -1
- package/dist/wje-router-outlet.js +76 -172
- package/dist/wje-router-outlet.js.map +1 -1
- package/dist/wje-routerx.js +537 -1331
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-row.js +9 -31
- package/dist/wje-row.js.map +1 -1
- package/dist/wje-select.js +326 -1152
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-slider.js +44 -225
- package/dist/wje-slider.js.map +1 -1
- package/dist/wje-sliding-container.js +295 -1319
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-split-view.js +35 -121
- package/dist/wje-split-view.js.map +1 -1
- package/dist/wje-status.js +14 -45
- package/dist/wje-status.js.map +1 -1
- package/dist/wje-step.js +9 -32
- package/dist/wje-step.js.map +1 -1
- package/dist/wje-stepper.js +109 -357
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-store.js +67 -360
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-tab-group.js +85 -314
- package/dist/wje-tab-group.js.map +1 -1
- package/dist/wje-tab-panel.js +7 -28
- package/dist/wje-tab-panel.js.map +1 -1
- package/dist/wje-tab.js +21 -198
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-textarea.js +64 -264
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-thumbnail.js +10 -51
- package/dist/wje-thumbnail.js.map +1 -1
- package/dist/wje-toast.js +127 -632
- package/dist/wje-toast.js.map +1 -1
- package/dist/wje-toggle.js +52 -177
- package/dist/wje-toggle.js.map +1 -1
- package/dist/wje-toolbar-action.js +128 -456
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js +75 -270
- package/dist/wje-toolbar.js.map +1 -1
- package/dist/wje-tooltip.js +50 -161
- package/dist/wje-tooltip.js.map +1 -1
- package/dist/wje-tree-item.js +70 -301
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +145 -489
- package/dist/wje-tree.js.map +1 -1
- package/dist/wje-visually-hidden.js +7 -34
- package/dist/wje-visually-hidden.js.map +1 -1
- package/package.json +3 -2
- package/dist/form-associated-element-DEQ4y-jn.js +0 -245
- package/dist/icon-CReYMzAK.js +0 -245
- package/dist/popup.element-CwXvVFK7.js +0 -2133
- package/dist/router-links-wjqCnncc.js +0 -156
package/dist/wje-carousel.js
CHANGED
|
@@ -1,614 +1,259 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
class Carousel extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Carousel constructor method.
|
|
9
|
-
*/
|
|
4
|
+
import t from "./wje-element.js";
|
|
5
|
+
class e extends t {
|
|
10
6
|
constructor() {
|
|
11
7
|
super();
|
|
12
|
-
/**
|
|
13
|
-
* Class name for the Carousel.
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
8
|
__publicField(this, "className", "Carousel");
|
|
17
9
|
this.slidePerPage = 1;
|
|
18
10
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
set activeSlide(value) {
|
|
24
|
-
this.setAttribute("active-slide", value);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Active slide attribute.
|
|
28
|
-
* @returns {number|number}
|
|
29
|
-
*/
|
|
11
|
+
set activeSlide(t2) {
|
|
12
|
+
this.setAttribute("active-slide", t2);
|
|
13
|
+
}
|
|
30
14
|
get activeSlide() {
|
|
31
15
|
return +this.getAttribute("active-slide") || 0;
|
|
32
16
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Pagination attribute.
|
|
35
|
-
* @returns {boolean}
|
|
36
|
-
*/
|
|
37
17
|
get pagination() {
|
|
38
18
|
return this.hasAttribute("pagination");
|
|
39
19
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Navigation attribute.
|
|
42
|
-
* @returns {boolean}
|
|
43
|
-
*/
|
|
44
20
|
get navigation() {
|
|
45
21
|
return this.hasAttribute("navigation");
|
|
46
22
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Thumbnails attribute.
|
|
49
|
-
* @returns {boolean}
|
|
50
|
-
*/
|
|
51
23
|
get thumbnails() {
|
|
52
24
|
return this.hasAttribute("thumbnails");
|
|
53
25
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Loop attribute.
|
|
56
|
-
* @returns {boolean}
|
|
57
|
-
*/
|
|
58
26
|
get loop() {
|
|
59
27
|
return this.hasAttribute("loop");
|
|
60
28
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Continuous loop attribute.
|
|
63
|
-
* @returns {boolean}
|
|
64
|
-
*/
|
|
65
29
|
get continuousLoop() {
|
|
66
30
|
return this.hasAttribute("continuous-loop");
|
|
67
31
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Getter for the CSS stylesheet.
|
|
70
|
-
* @returns {*}
|
|
71
|
-
*/
|
|
72
32
|
static get cssStyleSheet() {
|
|
73
|
-
return
|
|
33
|
+
return ":host{display:block;width:var(--wje-carousel-width, 100%);max-width:100%;box-sizing:border-box}.native-carousel{position:relative;width:100%;height:var(--wje-carousel-height, 300px);scroll-behavior:smooth;box-sizing:border-box}.slides-wrapper{position:relative;display:flex;align-items:stretch;width:100%;height:var(--wje-carousel-height, 300px);box-sizing:border-box}.carousel-slides{display:flex;flex:1 1 auto;transition:transform .5s ease;align-items:stretch;overflow:auto;overscroll-behavior-x:contain;scrollbar-width:none;-ms-overflow-style:none;aspect-ratio:var(--wje-aspect-ratio, 4 / 3);scroll-snap-type:x mandatory;scroll-padding-inline:var(--wje-spacing-inline, 0);overflow-y:hidden;padding-inline:var(--wje-spacing-inline, 0);gap:var(--wje-carousel-gap, .5rem);width:100%;height:100%;min-width:0;min-height:0;box-sizing:border-box}.carousel-slides::-webkit-scrollbar{display:none}::slotted(wje-carousel-item){flex:0 0 var(--wje-carousel-item-basis, var(--wje-carousel-size));width:var(--wje-carousel-item-basis, var(--wje-carousel-size));min-width:0;max-width:100%;align-self:stretch;height:100%;box-sizing:border-box}[name=prev],[name=next]{display:block;position:absolute;top:50%;border:none;cursor:pointer;z-index:2}[name=prev]{left:-1rem;transform:translate(-100%,-50%)}[name=next]{right:-1rem;transform:translate(100%,-50%)}.pagination{position:relative;left:50%;transform:translate(-50%);display:flex;z-index:2;justify-content:center;padding-block:1rem}.pagination-item{cursor:pointer;height:15px;width:15px;margin:0 2px;background-color:var(--wje-color-contrast-4);display:inline-block;border-radius:50%}.pagination-item.active{background-color:var(--wje-color)}.thumbnails{display:flex;justify-content:center;align-items:center;overflow-x:auto;gap:.5rem;padding:0 .5rem;margin-top:.5rem;margin-bottom:.5rem;box-sizing:border-box;overflow-y:hidden}.thumbnails wje-thumbnail{--wje-thumbnail-width: 48px;--wje-thumbnail-height: 48px;--wje-thumbnail-border-radius: 0;cursor:pointer;border:1px solid transparent}.thumbnails .active{border:1px solid var(--wje-color-primary-11)}";
|
|
74
34
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Getter for the observed attributes.
|
|
77
|
-
* @returns {string[]}
|
|
78
|
-
*/
|
|
79
35
|
static get observedAttributes() {
|
|
80
36
|
return ["active-slide", "slide-per-page", "continuous-loop"];
|
|
81
37
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* @param old
|
|
86
|
-
* @param newName
|
|
87
|
-
*/
|
|
88
|
-
attributeChangedCallback(name, old, newName) {
|
|
89
|
-
if (name === "active-slide") {
|
|
90
|
-
if (this.pagination) this.changePagination();
|
|
91
|
-
if (this.thumbnails) this.changeThumbnails();
|
|
92
|
-
}
|
|
93
|
-
if (["slide-per-page", "continuous-loop"].includes(name) && old !== newName && this.slides) {
|
|
94
|
-
this.syncSlideMetrics();
|
|
95
|
-
if (this.loop) {
|
|
96
|
-
this.refresh();
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
38
|
+
attributeChangedCallback(t2, e2, i) {
|
|
39
|
+
if ("active-slide" === t2 && (this.pagination && this.changePagination(), this.thumbnails && this.changeThumbnails()), ["slide-per-page", "continuous-loop"].includes(t2) && e2 !== i && this.slides) {
|
|
40
|
+
if (this.syncSlideMetrics(), this.loop) return void this.refresh();
|
|
99
41
|
this.goToSlide(this.activeSlide, "auto");
|
|
100
42
|
}
|
|
101
43
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Sets up the attributes for the Carousel.
|
|
104
|
-
*/
|
|
105
44
|
setupAttributes() {
|
|
106
|
-
this.isShadowRoot = "open";
|
|
107
|
-
this.syncAria();
|
|
45
|
+
this.isShadowRoot = "open", this.syncAria();
|
|
108
46
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Before draw method for the Carousel.
|
|
111
|
-
*/
|
|
112
47
|
beforeDraw() {
|
|
113
|
-
this.syncSlideMetrics();
|
|
114
|
-
|
|
115
|
-
this.cloneFirstAndLastItems();
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Draw method for the Carousel.
|
|
119
|
-
* @returns {DocumentFragment}
|
|
120
|
-
*/
|
|
48
|
+
this.syncSlideMetrics(), this.removeLoopClones(), this.cloneFirstAndLastItems();
|
|
49
|
+
}
|
|
121
50
|
draw() {
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
slides.append(slot);
|
|
135
|
-
native.append(wrapper);
|
|
136
|
-
if (this.navigation) {
|
|
137
|
-
let existingPrev = this.querySelector('[slot="prev"]');
|
|
138
|
-
let existingNext = this.querySelector('[slot="next"]');
|
|
139
|
-
this.prevButton = existingPrev || this.createPreviousButton();
|
|
140
|
-
this.nextButton = existingNext || this.createNextButton();
|
|
141
|
-
if (this.prevButton && !this.prevButton.dataset.wjeCarouselNavBound) {
|
|
142
|
-
this.prevButton.addEventListener("click", () => this.previousSlide());
|
|
143
|
-
this.prevButton.dataset.wjeCarouselNavBound = "true";
|
|
144
|
-
}
|
|
145
|
-
if (this.nextButton && !this.nextButton.dataset.wjeCarouselNavBound) {
|
|
146
|
-
this.nextButton.addEventListener("click", () => this.nextSlide());
|
|
147
|
-
this.nextButton.dataset.wjeCarouselNavBound = "true";
|
|
148
|
-
}
|
|
149
|
-
if (!existingPrev) this.append(this.prevButton);
|
|
150
|
-
if (!existingNext) this.append(this.nextButton);
|
|
151
|
-
wrapper.append(slotPrev);
|
|
152
|
-
wrapper.append(slotNext);
|
|
51
|
+
let t2 = document.createDocumentFragment(), e2 = document.createElement("div");
|
|
52
|
+
e2.classList.add("native-carousel");
|
|
53
|
+
let i = document.createElement("div");
|
|
54
|
+
i.classList.add("slides-wrapper");
|
|
55
|
+
let s = document.createElement("div");
|
|
56
|
+
s.classList.add("carousel-slides");
|
|
57
|
+
let o = document.createElement("slot"), r = document.createElement("slot");
|
|
58
|
+
r.setAttribute("name", "prev");
|
|
59
|
+
let n = document.createElement("slot");
|
|
60
|
+
if (n.setAttribute("name", "next"), s.append(o), e2.append(i), this.navigation) {
|
|
61
|
+
let t3 = this.querySelector('[slot="prev"]'), e3 = this.querySelector('[slot="next"]');
|
|
62
|
+
this.prevButton = t3 || this.createPreviousButton(), this.nextButton = e3 || this.createNextButton(), this.prevButton && !this.prevButton.dataset.wjeCarouselNavBound && (this.prevButton.addEventListener("click", () => this.previousSlide()), this.prevButton.dataset.wjeCarouselNavBound = "true"), this.nextButton && !this.nextButton.dataset.wjeCarouselNavBound && (this.nextButton.addEventListener("click", () => this.nextSlide()), this.nextButton.dataset.wjeCarouselNavBound = "true"), t3 || this.append(this.prevButton), e3 || this.append(this.nextButton), i.append(r), i.append(n);
|
|
153
63
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (this.thumbnails) native.append(this.createThumbnails());
|
|
157
|
-
fragment.append(native);
|
|
158
|
-
this.slides = slides;
|
|
159
|
-
return fragment;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* After draw method for the Carousel.
|
|
163
|
-
*/
|
|
64
|
+
return i.append(s), this.pagination && e2.append(this.createPagination()), this.thumbnails && e2.append(this.createThumbnails()), t2.append(e2), this.slides = s, t2;
|
|
65
|
+
}
|
|
164
66
|
afterDraw() {
|
|
165
|
-
this.setIntersectionObserver()
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
169
|
-
this.syncSlideMetrics();
|
|
170
|
-
this.goToSlide(this.activeSlide, "auto");
|
|
171
|
-
requestAnimationFrame(() => requestAnimationFrame(() => this.syncActiveToSnapStart()));
|
|
172
|
-
this.slides.addEventListener("scrollend", (e) => {
|
|
67
|
+
this.setIntersectionObserver(), this.getSlidesWithClones().forEach((t2, e2) => {
|
|
68
|
+
this.intersectionObserver.observe(t2);
|
|
69
|
+
}), this.syncSlideMetrics(), this.goToSlide(this.activeSlide, "auto"), requestAnimationFrame(() => requestAnimationFrame(() => this.syncActiveToSnapStart())), this.slides.addEventListener("scrollend", (t2) => {
|
|
173
70
|
this.syncActiveToSnapStart();
|
|
174
|
-
});
|
|
175
|
-
this.syncAria();
|
|
71
|
+
}), this.syncAria();
|
|
176
72
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Sync `activeSlide` to the slide whose leading edge is closest to the snap start.
|
|
179
|
-
*/
|
|
180
73
|
syncActiveToSnapStart() {
|
|
181
74
|
this.getSlides();
|
|
182
|
-
const
|
|
183
|
-
if (!
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
});
|
|
196
|
-
if (!best) return;
|
|
197
|
-
const vIndex = withClones.indexOf(best);
|
|
198
|
-
if (vIndex === -1) return;
|
|
199
|
-
const logicalIndex = this.getLogicalIndexForVisual(vIndex);
|
|
200
|
-
this.activeSlide = logicalIndex;
|
|
201
|
-
this.setActiveVisualSlide(vIndex);
|
|
202
|
-
const canonicalVisualIndex = this.getVisualIndexForLogical(logicalIndex);
|
|
203
|
-
if (canonicalVisualIndex !== vIndex) {
|
|
204
|
-
this.goToSlide(logicalIndex, "auto");
|
|
205
|
-
}
|
|
75
|
+
const t2 = this.getSlidesWithClones();
|
|
76
|
+
if (!t2.length) return;
|
|
77
|
+
const e2 = this.slides.getBoundingClientRect().left + this.getScrollPaddingInlineStart();
|
|
78
|
+
let i = null, s = 1 / 0;
|
|
79
|
+
if (t2.forEach((t3) => {
|
|
80
|
+
const o2 = t3.getBoundingClientRect(), r2 = Math.abs(o2.left - e2);
|
|
81
|
+
r2 < s && (s = r2, i = t3);
|
|
82
|
+
}), !i) return;
|
|
83
|
+
const o = t2.indexOf(i);
|
|
84
|
+
if (-1 === o) return;
|
|
85
|
+
const r = this.getLogicalIndexForVisual(o);
|
|
86
|
+
this.activeSlide = r, this.setActiveVisualSlide(o);
|
|
87
|
+
this.getVisualIndexForLogical(r) !== o && this.goToSlide(r, "auto");
|
|
206
88
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Syncs computed CSS variables derived from `slide-per-page`.
|
|
209
|
-
*/
|
|
210
89
|
syncSlideMetrics() {
|
|
211
90
|
this.slidePerPage = Math.max(parseInt(this.getAttribute("slide-per-page"), 10) || 1, 1);
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
this.style.setProperty("--wje-carousel-visible-gap-count", `${visibleGapCount}`);
|
|
216
|
-
this.style.setProperty("--wje-carousel-size", computedItemSize);
|
|
217
|
-
this.style.setProperty("--wje-carousel-item-basis", "var(--wje-carousel-size)");
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Returns the inline scroll padding used by the snap area.
|
|
221
|
-
* @returns {number}
|
|
222
|
-
*/
|
|
91
|
+
const t2 = Math.max(this.slidePerPage - 1, 0), e2 = `calc((100% - (${t2} * var(--wje-carousel-gap, 0.5rem))) / ${this.slidePerPage})`;
|
|
92
|
+
this.style.setProperty("--wje-carousel-slides-per-page", `${this.slidePerPage}`), this.style.setProperty("--wje-carousel-visible-gap-count", `${t2}`), this.style.setProperty("--wje-carousel-size", e2), this.style.setProperty("--wje-carousel-item-basis", "var(--wje-carousel-size)");
|
|
93
|
+
}
|
|
223
94
|
getScrollPaddingInlineStart() {
|
|
224
95
|
if (!this.slides) return 0;
|
|
225
|
-
const
|
|
226
|
-
return parseFloat(
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Returns the interaction scroll behavior for UI controls.
|
|
230
|
-
* Continuous multi-slide loops use instant snapping to avoid blank edge states
|
|
231
|
-
* while the browser is still animating a previous smooth scroll.
|
|
232
|
-
* @returns {string}
|
|
233
|
-
*/
|
|
96
|
+
const t2 = getComputedStyle(this.slides);
|
|
97
|
+
return parseFloat(t2.scrollPaddingInlineStart || t2.scrollPaddingLeft || "0") || 0;
|
|
98
|
+
}
|
|
234
99
|
getControlBehavior() {
|
|
235
100
|
return this.continuousLoop && this.slidePerPage > 1 ? "auto" : "smooth";
|
|
236
101
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Sets up the IntersectionObserver for the Carousel.
|
|
239
|
-
*/
|
|
240
102
|
setIntersectionObserver() {
|
|
241
|
-
this.intersectionObserver = new IntersectionObserver(
|
|
242
|
-
(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
{
|
|
248
|
-
root: this.context.querySelector(".carousel-slides"),
|
|
249
|
-
threshold: 0.5
|
|
250
|
-
}
|
|
251
|
-
);
|
|
252
|
-
this.entriesMap = /* @__PURE__ */ new Map();
|
|
253
|
-
this.records = this.intersectionObserver.takeRecords();
|
|
254
|
-
this.records.forEach((entry) => {
|
|
255
|
-
this.entriesMap.set(entry.target, entry);
|
|
103
|
+
this.intersectionObserver = new IntersectionObserver((t2) => {
|
|
104
|
+
t2.forEach((t3) => {
|
|
105
|
+
this.entriesMap.set(t3.target, t3);
|
|
106
|
+
});
|
|
107
|
+
}, { root: this.context.querySelector(".carousel-slides"), threshold: 0.5 }), this.entriesMap = /* @__PURE__ */ new Map(), this.records = this.intersectionObserver.takeRecords(), this.records.forEach((t2) => {
|
|
108
|
+
this.entriesMap.set(t2.target, t2);
|
|
256
109
|
});
|
|
257
110
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
let logical;
|
|
269
|
-
if (this.loop && slides.length > 0) {
|
|
270
|
-
logical = this.normalizeLoopIndex(index, slides.length);
|
|
271
|
-
} else {
|
|
272
|
-
logical = Math.min(Math.max(index, 0), maxIndex);
|
|
273
|
-
}
|
|
274
|
-
this.activeSlide = logical;
|
|
275
|
-
const vIndex = this.getVisualIndexForLogical(logical);
|
|
276
|
-
const targetEl = withClones[vIndex];
|
|
277
|
-
if (!targetEl) return;
|
|
278
|
-
this.setActiveVisualSlide(vIndex);
|
|
279
|
-
this.scrollToVisualIndex(vIndex, behavior);
|
|
280
|
-
if (this.navigation && !this.loop) {
|
|
281
|
-
this.nextButton.removeAttribute("disabled");
|
|
282
|
-
this.prevButton.removeAttribute("disabled");
|
|
283
|
-
if (this.activeSlide === maxIndex) this.nextButton.setAttribute("disabled", "");
|
|
284
|
-
if (this.activeSlide === 0) this.prevButton.setAttribute("disabled", "");
|
|
285
|
-
}
|
|
286
|
-
this.syncAria();
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Sets the active class on the currently targeted visual slide and removes it elsewhere.
|
|
290
|
-
* @param {number} vIndex
|
|
291
|
-
*/
|
|
292
|
-
setActiveVisualSlide(vIndex) {
|
|
293
|
-
this.getSlidesWithClones().forEach((slide, index) => {
|
|
294
|
-
slide.classList.toggle("active", index === vIndex);
|
|
111
|
+
goToSlide(t2, e2 = "smooth", i = true) {
|
|
112
|
+
const s = this.getSlides(), o = this.getSlidesWithClones(), r = this.getMaxVisibleStartIndex(s.length);
|
|
113
|
+
let n;
|
|
114
|
+
n = this.loop && s.length > 0 ? this.normalizeLoopIndex(t2, s.length) : Math.min(Math.max(t2, 0), r), this.activeSlide = n;
|
|
115
|
+
const a = this.getVisualIndexForLogical(n);
|
|
116
|
+
o[a] && (this.setActiveVisualSlide(a), this.scrollToVisualIndex(a, e2), this.navigation && !this.loop && (this.nextButton.removeAttribute("disabled"), this.prevButton.removeAttribute("disabled"), this.activeSlide === r && this.nextButton.setAttribute("disabled", ""), 0 === this.activeSlide && this.prevButton.setAttribute("disabled", "")), this.syncAria());
|
|
117
|
+
}
|
|
118
|
+
setActiveVisualSlide(t2) {
|
|
119
|
+
this.getSlidesWithClones().forEach((e2, i) => {
|
|
120
|
+
e2.classList.toggle("active", i === t2);
|
|
295
121
|
});
|
|
296
122
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Syncs ARIA attributes on the carousel and slides.
|
|
299
|
-
*/
|
|
300
123
|
syncAria() {
|
|
301
|
-
this.setAriaState({
|
|
302
|
-
|
|
303
|
-
|
|
124
|
+
this.setAriaState({ role: "region", roledescription: "carousel" });
|
|
125
|
+
const t2 = this.getSlides(), e2 = t2.length;
|
|
126
|
+
t2.forEach((t3, i) => {
|
|
127
|
+
t3.setAttribute("role", "group"), t3.setAttribute("aria-roledescription", "slide"), t3.setAttribute("aria-label", `Slide ${i + 1} of ${e2}`), t3.setAttribute("aria-hidden", t3.classList.contains("active") ? "false" : "true");
|
|
304
128
|
});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
slides.forEach((slide, index) => {
|
|
308
|
-
slide.setAttribute("role", "group");
|
|
309
|
-
slide.setAttribute("aria-roledescription", "slide");
|
|
310
|
-
slide.setAttribute("aria-label", `Slide ${index + 1} of ${total}`);
|
|
311
|
-
slide.setAttribute("aria-hidden", slide.classList.contains("active") ? "false" : "true");
|
|
312
|
-
});
|
|
313
|
-
const clones = this.querySelectorAll(".clone");
|
|
314
|
-
clones.forEach((slide) => {
|
|
315
|
-
slide.setAttribute("aria-hidden", "true");
|
|
129
|
+
this.querySelectorAll(".clone").forEach((t3) => {
|
|
130
|
+
t3.setAttribute("aria-hidden", "true");
|
|
316
131
|
});
|
|
317
132
|
}
|
|
318
|
-
/**
|
|
319
|
-
* Clones the first and last items.
|
|
320
|
-
*/
|
|
321
133
|
cloneFirstAndLastItems() {
|
|
322
|
-
const
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
const clone = this.createLoopClone(item);
|
|
332
|
-
this.append(clone);
|
|
134
|
+
const t2 = this.getSlides();
|
|
135
|
+
if (t2.length && this.loop) {
|
|
136
|
+
const e2 = this.getLoopCloneCount(t2.length), i = t2[0];
|
|
137
|
+
t2.slice(t2.length - e2).forEach((t3) => {
|
|
138
|
+
const e3 = this.createLoopClone(t3);
|
|
139
|
+
this.insertBefore(e3, i);
|
|
140
|
+
}), t2.slice(0, e2).forEach((t3) => {
|
|
141
|
+
const e3 = this.createLoopClone(t3);
|
|
142
|
+
this.append(e3);
|
|
333
143
|
});
|
|
334
144
|
}
|
|
335
145
|
}
|
|
336
|
-
|
|
337
|
-
* Creates a sanitized loop clone that does not inherit transient render state
|
|
338
|
-
* such as inline `visibility: hidden` from the source slide.
|
|
339
|
-
* @param {HTMLElement} item
|
|
340
|
-
* @returns {HTMLElement}
|
|
341
|
-
*/
|
|
342
|
-
createLoopClone(item) {
|
|
146
|
+
createLoopClone(t2) {
|
|
343
147
|
var _a;
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
clone.classList.remove("active");
|
|
347
|
-
clone.style.removeProperty("visibility");
|
|
348
|
-
if (!((_a = clone.getAttribute("style")) == null ? void 0 : _a.trim())) {
|
|
349
|
-
clone.removeAttribute("style");
|
|
350
|
-
}
|
|
351
|
-
return clone;
|
|
148
|
+
const e2 = t2.cloneNode(true);
|
|
149
|
+
return e2.classList.add("clone"), e2.classList.remove("active"), e2.style.removeProperty("visibility"), ((_a = e2.getAttribute("style")) == null ? void 0 : _a.trim()) || e2.removeAttribute("style"), e2;
|
|
352
150
|
}
|
|
353
|
-
/**
|
|
354
|
-
* Removes loop clones so they can be rebuilt for the current configuration.
|
|
355
|
-
*/
|
|
356
151
|
removeLoopClones() {
|
|
357
|
-
this.querySelectorAll("wje-carousel-item.clone").forEach((
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return this.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
* @param {string} behavior
|
|
372
|
-
*/
|
|
373
|
-
scrollToVisualIndex(vIndex, behavior = "smooth") {
|
|
374
|
-
const withClones = this.getSlidesWithClones();
|
|
375
|
-
const firstEl = withClones[0];
|
|
376
|
-
const targetEl = withClones[vIndex];
|
|
377
|
-
if (!firstEl || !targetEl || !this.slides) return;
|
|
378
|
-
const firstRect = firstEl.getBoundingClientRect();
|
|
379
|
-
const targetRect = targetEl.getBoundingClientRect();
|
|
380
|
-
const contentOffsetLeft = targetRect.left - firstRect.left;
|
|
381
|
-
const nextLeft = contentOffsetLeft - this.getScrollPaddingInlineStart();
|
|
382
|
-
const targetLeft = Math.max(nextLeft, 0);
|
|
383
|
-
if (behavior === "smooth") {
|
|
384
|
-
this.slides.scrollTo({
|
|
385
|
-
left: targetLeft,
|
|
386
|
-
top: this.slides.scrollTop,
|
|
387
|
-
behavior: "smooth"
|
|
388
|
-
});
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
if (this.snapRestoreFrame) {
|
|
392
|
-
cancelAnimationFrame(this.snapRestoreFrame);
|
|
393
|
-
}
|
|
394
|
-
const inlineSnapType = this.slides.style.scrollSnapType;
|
|
395
|
-
this.slides.style.scrollSnapType = "none";
|
|
396
|
-
this.slides.scrollTo({
|
|
397
|
-
left: targetLeft,
|
|
398
|
-
top: this.slides.scrollTop,
|
|
399
|
-
behavior: "auto"
|
|
400
|
-
});
|
|
401
|
-
this.snapRestoreFrame = requestAnimationFrame(() => {
|
|
402
|
-
this.slides.style.scrollSnapType = inlineSnapType;
|
|
403
|
-
this.snapRestoreFrame = null;
|
|
152
|
+
this.querySelectorAll("wje-carousel-item.clone").forEach((t2) => t2.remove());
|
|
153
|
+
}
|
|
154
|
+
getLoopCloneCount(t2 = this.getSlides().length) {
|
|
155
|
+
return this.loop && t2 ? this.continuousLoop ? Math.min(this.slidePerPage, t2) : 1 : 0;
|
|
156
|
+
}
|
|
157
|
+
scrollToVisualIndex(t2, e2 = "smooth") {
|
|
158
|
+
const i = this.getSlidesWithClones(), s = i[0], o = i[t2];
|
|
159
|
+
if (!s || !o || !this.slides) return;
|
|
160
|
+
const r = s.getBoundingClientRect(), n = o.getBoundingClientRect().left - r.left - this.getScrollPaddingInlineStart(), a = Math.max(n, 0);
|
|
161
|
+
if ("smooth" === e2) return void this.slides.scrollTo({ left: a, top: this.slides.scrollTop, behavior: "smooth" });
|
|
162
|
+
this.snapRestoreFrame && cancelAnimationFrame(this.snapRestoreFrame);
|
|
163
|
+
const l = this.slides.style.scrollSnapType;
|
|
164
|
+
this.slides.style.scrollSnapType = "none", this.slides.scrollTo({ left: a, top: this.slides.scrollTop, behavior: "auto" }), this.snapRestoreFrame = requestAnimationFrame(() => {
|
|
165
|
+
this.slides.style.scrollSnapType = l, this.snapRestoreFrame = null;
|
|
404
166
|
});
|
|
405
167
|
}
|
|
406
|
-
/**
|
|
407
|
-
* Goes to the next slide.
|
|
408
|
-
*/
|
|
409
168
|
removeActiveSlide() {
|
|
410
|
-
this.getSlidesWithClones().forEach((
|
|
411
|
-
|
|
169
|
+
this.getSlidesWithClones().forEach((t2, e2) => {
|
|
170
|
+
t2.classList.remove("active");
|
|
171
|
+
}), this.pagination && this.context.querySelectorAll(".pagination-item").forEach((t2) => {
|
|
172
|
+
t2.classList.remove("active");
|
|
173
|
+
}), this.thumbnails && this.context.querySelectorAll("wje-thumbnail").forEach((t2) => {
|
|
174
|
+
t2.classList.remove("active");
|
|
412
175
|
});
|
|
413
|
-
if (this.pagination) {
|
|
414
|
-
this.context.querySelectorAll(".pagination-item").forEach((item) => {
|
|
415
|
-
item.classList.remove("active");
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
if (this.thumbnails) {
|
|
419
|
-
this.context.querySelectorAll("wje-thumbnail").forEach((item) => {
|
|
420
|
-
item.classList.remove("active");
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
176
|
}
|
|
424
|
-
/**
|
|
425
|
-
* Goes to the next slide.
|
|
426
|
-
*/
|
|
427
177
|
changePagination() {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
});
|
|
432
|
-
}
|
|
178
|
+
this.pagination && this.context.querySelectorAll(".pagination-item").forEach((t2, e2) => {
|
|
179
|
+
t2.classList.toggle("active", e2 === this.activeSlide);
|
|
180
|
+
});
|
|
433
181
|
}
|
|
434
|
-
/**
|
|
435
|
-
* Goes to the next slide.
|
|
436
|
-
*/
|
|
437
182
|
changeThumbnails() {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
});
|
|
442
|
-
}
|
|
183
|
+
this.thumbnails && this.context.querySelectorAll("wje-thumbnail").forEach((t2, e2) => {
|
|
184
|
+
t2.classList.toggle("active", e2 === this.activeSlide);
|
|
185
|
+
});
|
|
443
186
|
}
|
|
444
|
-
/**
|
|
445
|
-
* Goes to the next slide.
|
|
446
|
-
* @returns {Element}
|
|
447
|
-
*/
|
|
448
187
|
createNextButton() {
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
nextButton.setAttribute("fill", "link");
|
|
453
|
-
nextButton.setAttribute("slot", "next");
|
|
454
|
-
nextButton.innerHTML = '<wje-icon name="chevron-right" size="large"></wje-icon>';
|
|
455
|
-
nextButton.classList.add("next");
|
|
456
|
-
return nextButton;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Goes to the next slide.
|
|
460
|
-
* @returns {Element}
|
|
461
|
-
*/
|
|
188
|
+
const t2 = document.createElement("wje-button");
|
|
189
|
+
return t2.setAttribute("part", "next-button"), t2.setAttribute("circle", ""), t2.setAttribute("fill", "link"), t2.setAttribute("slot", "next"), t2.innerHTML = '<wje-icon name="chevron-right" size="large"></wje-icon>', t2.classList.add("next"), t2;
|
|
190
|
+
}
|
|
462
191
|
createPreviousButton() {
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
previousButton.setAttribute("fill", "link");
|
|
467
|
-
previousButton.setAttribute("slot", "prev");
|
|
468
|
-
previousButton.innerHTML = '<wje-icon name="chevron-left" size="large"></wje-icon>';
|
|
469
|
-
previousButton.classList.add("prev");
|
|
470
|
-
return previousButton;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Goes to the next slide.
|
|
474
|
-
* @returns {Element}
|
|
475
|
-
*/
|
|
192
|
+
const t2 = document.createElement("wje-button");
|
|
193
|
+
return t2.setAttribute("part", "previous-button"), t2.setAttribute("circle", ""), t2.setAttribute("fill", "link"), t2.setAttribute("slot", "prev"), t2.innerHTML = '<wje-icon name="chevron-left" size="large"></wje-icon>', t2.classList.add("prev"), t2;
|
|
194
|
+
}
|
|
476
195
|
createPagination() {
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
this.removeActiveSlide();
|
|
485
|
-
e.target.classList.add("active");
|
|
486
|
-
this.goToSlide(i, this.getControlBehavior());
|
|
487
|
-
});
|
|
488
|
-
pagination.append(paginationItem);
|
|
489
|
-
});
|
|
490
|
-
return pagination;
|
|
196
|
+
const t2 = document.createElement("div");
|
|
197
|
+
return t2.setAttribute("part", "pagination"), t2.classList.add("pagination"), this.getPaginationIndexes().forEach((e2) => {
|
|
198
|
+
const i = document.createElement("div");
|
|
199
|
+
i.classList.add("pagination-item"), i.addEventListener("click", (t3) => {
|
|
200
|
+
this.removeActiveSlide(), t3.target.classList.add("active"), this.goToSlide(e2, this.getControlBehavior());
|
|
201
|
+
}), t2.append(i);
|
|
202
|
+
}), t2;
|
|
491
203
|
}
|
|
492
|
-
/**
|
|
493
|
-
* Goes to the next slide.
|
|
494
|
-
* @returns {Element}
|
|
495
|
-
*/
|
|
496
204
|
createThumbnails() {
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
e.target.closest("wje-thumbnail").classList.add("active");
|
|
506
|
-
this.goToSlide(i, this.getControlBehavior());
|
|
507
|
-
});
|
|
508
|
-
thumbnails.append(thumbnail);
|
|
509
|
-
});
|
|
510
|
-
return thumbnails;
|
|
205
|
+
const t2 = document.createElement("div");
|
|
206
|
+
t2.classList.add("thumbnails");
|
|
207
|
+
return this.getSlides().forEach((e2, i) => {
|
|
208
|
+
const s = document.createElement("wje-thumbnail");
|
|
209
|
+
s.innerHTML = `<img src="${e2.querySelector("wje-img").getAttribute("src")}"></img>`, s.addEventListener("click", (t3) => {
|
|
210
|
+
this.removeActiveSlide(), t3.target.closest("wje-thumbnail").classList.add("active"), this.goToSlide(i, this.getControlBehavior());
|
|
211
|
+
}), t2.append(s);
|
|
212
|
+
}), t2;
|
|
511
213
|
}
|
|
512
|
-
/**
|
|
513
|
-
* Goes to the next slide.
|
|
514
|
-
*/
|
|
515
214
|
nextSlide() {
|
|
516
215
|
this.goToSlide(this.activeSlide + 1, this.getControlBehavior());
|
|
517
216
|
}
|
|
518
|
-
/**
|
|
519
|
-
* Goes to the previous slide.
|
|
520
|
-
*/
|
|
521
217
|
previousSlide() {
|
|
522
218
|
this.goToSlide(this.activeSlide - 1, this.getControlBehavior());
|
|
523
219
|
}
|
|
524
|
-
/**
|
|
525
|
-
* Goes to the slide.
|
|
526
|
-
* @returns {Array}
|
|
527
|
-
*/
|
|
528
220
|
getSlides() {
|
|
529
221
|
return Array.from(this.querySelectorAll("wje-carousel-item:not(.clone)"));
|
|
530
222
|
}
|
|
531
|
-
/**
|
|
532
|
-
* Goes to the slide.
|
|
533
|
-
* @returns {Array}
|
|
534
|
-
*/
|
|
535
223
|
getSlidesWithClones() {
|
|
536
224
|
return Array.from(this.querySelectorAll("wje-carousel-item"));
|
|
537
225
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Returns the maximum logical slide index that can still render a full viewport.
|
|
559
|
-
* @param {number} totalSlides
|
|
560
|
-
* @returns {number}
|
|
561
|
-
*/
|
|
562
|
-
getMaxVisibleStartIndex(totalSlides = this.getSlides().length) {
|
|
563
|
-
const visibleSlides = Math.min(this.slidePerPage, totalSlides);
|
|
564
|
-
return Math.max(totalSlides - visibleSlides, 0);
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Normalizes a logical index for the active loop mode.
|
|
568
|
-
* @param {number} index
|
|
569
|
-
* @param {number} totalSlides
|
|
570
|
-
* @returns {number}
|
|
571
|
-
*/
|
|
572
|
-
normalizeLoopIndex(index, totalSlides = this.getSlides().length) {
|
|
573
|
-
const logicalCount = this.getLoopLogicalCount(totalSlides);
|
|
574
|
-
if (!logicalCount) return 0;
|
|
575
|
-
return (index % logicalCount + logicalCount) % logicalCount;
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* Returns how many logical positions are reachable for the current loop mode.
|
|
579
|
-
* @param {number} totalSlides
|
|
580
|
-
* @returns {number}
|
|
581
|
-
*/
|
|
582
|
-
getLoopLogicalCount(totalSlides = this.getSlides().length) {
|
|
583
|
-
if (!totalSlides) return 0;
|
|
584
|
-
return this.continuousLoop ? totalSlides : this.getMaxVisibleStartIndex(totalSlides) + 1;
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Returns the pagination indexes for the current carousel mode.
|
|
588
|
-
* @returns {number[]}
|
|
589
|
-
*/
|
|
226
|
+
getVisualIndexForLogical(t2) {
|
|
227
|
+
return this.loop ? t2 + this.getLoopCloneCount() : t2;
|
|
228
|
+
}
|
|
229
|
+
getLogicalIndexForVisual(t2) {
|
|
230
|
+
const e2 = this.getSlides(), i = this.getMaxVisibleStartIndex(e2.length), s = this.getLoopCloneCount(e2.length);
|
|
231
|
+
return this.loop ? this.continuousLoop ? t2 < s ? e2.length - s + t2 : t2 >= s + e2.length ? t2 - (s + e2.length) : t2 - s : t2 < s ? i : t2 >= s + e2.length ? 0 : Math.min(Math.max(t2 - s, 0), i) : Math.min(Math.max(t2, 0), i);
|
|
232
|
+
}
|
|
233
|
+
getMaxVisibleStartIndex(t2 = this.getSlides().length) {
|
|
234
|
+
const e2 = Math.min(this.slidePerPage, t2);
|
|
235
|
+
return Math.max(t2 - e2, 0);
|
|
236
|
+
}
|
|
237
|
+
normalizeLoopIndex(t2, e2 = this.getSlides().length) {
|
|
238
|
+
const i = this.getLoopLogicalCount(e2);
|
|
239
|
+
return i ? (t2 % i + i) % i : 0;
|
|
240
|
+
}
|
|
241
|
+
getLoopLogicalCount(t2 = this.getSlides().length) {
|
|
242
|
+
return t2 ? this.continuousLoop ? t2 : this.getMaxVisibleStartIndex(t2) + 1 : 0;
|
|
243
|
+
}
|
|
590
244
|
getPaginationIndexes() {
|
|
591
|
-
return Array.from({ length: this.getLoopLogicalCount() }, (
|
|
245
|
+
return Array.from({ length: this.getLoopLogicalCount() }, (t2, e2) => e2);
|
|
592
246
|
}
|
|
593
|
-
/**
|
|
594
|
-
* Goes to the slide.
|
|
595
|
-
* @returns {boolean}
|
|
596
|
-
*/
|
|
597
247
|
canGoNext() {
|
|
598
|
-
const
|
|
599
|
-
return
|
|
248
|
+
const t2 = this.context.querySelector(".carousel-slides");
|
|
249
|
+
return t2.scrollLeft < t2.scrollWidth - t2.clientWidth;
|
|
600
250
|
}
|
|
601
|
-
/**
|
|
602
|
-
* Goes to the slide.
|
|
603
|
-
* @returns {boolean}
|
|
604
|
-
*/
|
|
605
251
|
canGoPrevious() {
|
|
606
|
-
|
|
607
|
-
return el.scrollLeft > 0;
|
|
252
|
+
return this.context.querySelector(".carousel-slides").scrollLeft > 0;
|
|
608
253
|
}
|
|
609
254
|
}
|
|
610
|
-
|
|
255
|
+
t.define("wje-carousel", e);
|
|
611
256
|
export {
|
|
612
|
-
|
|
257
|
+
e as default
|
|
613
258
|
};
|
|
614
259
|
//# sourceMappingURL=wje-carousel.js.map
|