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.
Files changed (233) hide show
  1. package/dist/animations.js +28 -51
  2. package/dist/animations.js.map +1 -1
  3. package/dist/base-path.js +19 -31
  4. package/dist/base-path.js.map +1 -1
  5. package/dist/custom-elements.json +11504 -11499
  6. package/dist/dark.css +1 -302
  7. package/dist/date.js +16 -36
  8. package/dist/date.js.map +1 -1
  9. package/dist/element-utils.js +20 -81
  10. package/dist/element-utils.js.map +1 -1
  11. package/dist/event.js +49 -165
  12. package/dist/event.js.map +1 -1
  13. package/dist/form-associated-element-BjeJn7j8.js +101 -0
  14. package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
  15. package/dist/icon-DmsqtDpL.js +102 -0
  16. package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
  17. package/dist/light.css +1 -731
  18. package/dist/localize.js +36 -111
  19. package/dist/localize.js.map +1 -1
  20. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
  21. package/dist/permissions.js +14 -41
  22. package/dist/permissions.js.map +1 -1
  23. package/dist/popup.element-CbkhthPP.js +806 -0
  24. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  25. package/dist/router-links-CNsJ-elb.js +105 -0
  26. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  27. package/dist/skeleton.css +1 -197
  28. package/dist/styles.css +1 -866
  29. package/dist/universal-service.js +48 -109
  30. package/dist/universal-service.js.map +1 -1
  31. package/dist/utils.js +11 -18
  32. package/dist/utils.js.map +1 -1
  33. package/dist/web-types.json +760 -760
  34. package/dist/wje-accordion-item.js +33 -106
  35. package/dist/wje-accordion-item.js.map +1 -1
  36. package/dist/wje-accordion.js +19 -84
  37. package/dist/wje-accordion.js.map +1 -1
  38. package/dist/wje-animation.js +37 -4258
  39. package/dist/wje-animation.js.map +1 -1
  40. package/dist/wje-aside.js +9 -34
  41. package/dist/wje-aside.js.map +1 -1
  42. package/dist/wje-avatar.js +36 -126
  43. package/dist/wje-avatar.js.map +1 -1
  44. package/dist/wje-badge.js +10 -52
  45. package/dist/wje-badge.js.map +1 -1
  46. package/dist/wje-breadcrumb.js +205 -672
  47. package/dist/wje-breadcrumb.js.map +1 -1
  48. package/dist/wje-breadcrumbs.js +177 -633
  49. package/dist/wje-breadcrumbs.js.map +1 -1
  50. package/dist/wje-button-group.js +48 -153
  51. package/dist/wje-button-group.js.map +1 -1
  52. package/dist/wje-button.js +92 -413
  53. package/dist/wje-button.js.map +1 -1
  54. package/dist/wje-card-content.js +7 -30
  55. package/dist/wje-card-content.js.map +1 -1
  56. package/dist/wje-card-controls.js +7 -30
  57. package/dist/wje-card-controls.js.map +1 -1
  58. package/dist/wje-card-header.js +7 -30
  59. package/dist/wje-card-header.js.map +1 -1
  60. package/dist/wje-card-subtitle.js +7 -34
  61. package/dist/wje-card-subtitle.js.map +1 -1
  62. package/dist/wje-card-title.js +7 -34
  63. package/dist/wje-card-title.js.map +1 -1
  64. package/dist/wje-card.js +15 -71
  65. package/dist/wje-card.js.map +1 -1
  66. package/dist/wje-carousel-item.js +12 -56
  67. package/dist/wje-carousel-item.js.map +1 -1
  68. package/dist/wje-carousel.js +154 -509
  69. package/dist/wje-carousel.js.map +1 -1
  70. package/dist/wje-checkbox.js +50 -227
  71. package/dist/wje-checkbox.js.map +1 -1
  72. package/dist/wje-chip.js +43 -160
  73. package/dist/wje-chip.js.map +1 -1
  74. package/dist/wje-col.js +7 -20
  75. package/dist/wje-col.js.map +1 -1
  76. package/dist/wje-color-picker.js +445 -1464
  77. package/dist/wje-color-picker.js.map +1 -1
  78. package/dist/wje-container.js +9 -35
  79. package/dist/wje-container.js.map +1 -1
  80. package/dist/wje-copy-button.js +64 -204
  81. package/dist/wje-copy-button.js.map +1 -1
  82. package/dist/wje-dialog.js +85 -553
  83. package/dist/wje-dialog.js.map +1 -1
  84. package/dist/wje-divider.js +7 -34
  85. package/dist/wje-divider.js.map +1 -1
  86. package/dist/wje-dropdown.js +78 -305
  87. package/dist/wje-dropdown.js.map +1 -1
  88. package/dist/wje-element.js +191 -700
  89. package/dist/wje-element.js.map +1 -1
  90. package/dist/wje-file-upload-item.js +51 -156
  91. package/dist/wje-file-upload-item.js.map +1 -1
  92. package/dist/wje-file-upload.js +181 -619
  93. package/dist/wje-file-upload.js.map +1 -1
  94. package/dist/wje-footer.js +7 -31
  95. package/dist/wje-footer.js.map +1 -1
  96. package/dist/wje-form.js +7 -32
  97. package/dist/wje-form.js.map +1 -1
  98. package/dist/wje-format-digital.js +26 -118
  99. package/dist/wje-format-digital.js.map +1 -1
  100. package/dist/wje-grid.js +7 -33
  101. package/dist/wje-grid.js.map +1 -1
  102. package/dist/wje-header.js +9 -35
  103. package/dist/wje-header.js.map +1 -1
  104. package/dist/wje-icon-library.js +12 -18
  105. package/dist/wje-icon-library.js.map +1 -1
  106. package/dist/wje-icon-picker.js +65 -320
  107. package/dist/wje-icon-picker.js.map +1 -1
  108. package/dist/wje-icon.js +1 -1
  109. package/dist/wje-img-comparer.js +37 -114
  110. package/dist/wje-img-comparer.js.map +1 -1
  111. package/dist/wje-img.js +50 -198
  112. package/dist/wje-img.js.map +1 -1
  113. package/dist/wje-infinite-scroll.js +94 -346
  114. package/dist/wje-infinite-scroll.js.map +1 -1
  115. package/dist/wje-input-file.js +23 -84
  116. package/dist/wje-input-file.js.map +1 -1
  117. package/dist/wje-input.js +78 -392
  118. package/dist/wje-input.js.map +1 -1
  119. package/dist/wje-item.js +11 -64
  120. package/dist/wje-item.js.map +1 -1
  121. package/dist/wje-kanban.js +124 -401
  122. package/dist/wje-kanban.js.map +1 -1
  123. package/dist/wje-label.js +9 -32
  124. package/dist/wje-label.js.map +1 -1
  125. package/dist/wje-level-indicator.js +38 -157
  126. package/dist/wje-level-indicator.js.map +1 -1
  127. package/dist/wje-list.js +10 -40
  128. package/dist/wje-list.js.map +1 -1
  129. package/dist/wje-main.js +7 -31
  130. package/dist/wje-main.js.map +1 -1
  131. package/dist/wje-masonry.js +66 -211
  132. package/dist/wje-masonry.js.map +1 -1
  133. package/dist/wje-master.js +45 -161
  134. package/dist/wje-master.js.map +1 -1
  135. package/dist/wje-menu-button.js +10 -38
  136. package/dist/wje-menu-button.js.map +1 -1
  137. package/dist/wje-menu-item.js +127 -577
  138. package/dist/wje-menu-item.js.map +1 -1
  139. package/dist/wje-menu-label.js +9 -35
  140. package/dist/wje-menu-label.js.map +1 -1
  141. package/dist/wje-menu.js +14 -49
  142. package/dist/wje-menu.js.map +1 -1
  143. package/dist/wje-option.js +48 -279
  144. package/dist/wje-option.js.map +1 -1
  145. package/dist/wje-options.js +130 -384
  146. package/dist/wje-options.js.map +1 -1
  147. package/dist/wje-orgchart-group.js +16 -52
  148. package/dist/wje-orgchart-group.js.map +1 -1
  149. package/dist/wje-orgchart-item.js +24 -93
  150. package/dist/wje-orgchart-item.js.map +1 -1
  151. package/dist/wje-orgchart.js +18 -68
  152. package/dist/wje-orgchart.js.map +1 -1
  153. package/dist/wje-pagination.js +113 -397
  154. package/dist/wje-pagination.js.map +1 -1
  155. package/dist/wje-popup.js +3 -3
  156. package/dist/wje-popup.js.map +1 -1
  157. package/dist/wje-progress-bar.js +53 -205
  158. package/dist/wje-progress-bar.js.map +1 -1
  159. package/dist/wje-qr-code.js +398 -2980
  160. package/dist/wje-qr-code.js.map +1 -1
  161. package/dist/wje-radio-group.js +52 -190
  162. package/dist/wje-radio-group.js.map +1 -1
  163. package/dist/wje-radio.js +24 -118
  164. package/dist/wje-radio.js.map +1 -1
  165. package/dist/wje-rate.js +62 -266
  166. package/dist/wje-rate.js.map +1 -1
  167. package/dist/wje-relative-time.js +24 -99
  168. package/dist/wje-relative-time.js.map +1 -1
  169. package/dist/wje-reorder-dropzone.js +9 -31
  170. package/dist/wje-reorder-dropzone.js.map +1 -1
  171. package/dist/wje-reorder-handle.js +67 -204
  172. package/dist/wje-reorder-handle.js.map +1 -1
  173. package/dist/wje-reorder-item.js +14 -44
  174. package/dist/wje-reorder-item.js.map +1 -1
  175. package/dist/wje-reorder.js +61 -246
  176. package/dist/wje-reorder.js.map +1 -1
  177. package/dist/wje-route.js +6 -24
  178. package/dist/wje-route.js.map +1 -1
  179. package/dist/wje-router-link.js +11 -39
  180. package/dist/wje-router-link.js.map +1 -1
  181. package/dist/wje-router-outlet.js +76 -172
  182. package/dist/wje-router-outlet.js.map +1 -1
  183. package/dist/wje-routerx.js +537 -1331
  184. package/dist/wje-routerx.js.map +1 -1
  185. package/dist/wje-row.js +9 -31
  186. package/dist/wje-row.js.map +1 -1
  187. package/dist/wje-select.js +326 -1152
  188. package/dist/wje-select.js.map +1 -1
  189. package/dist/wje-slider.js +44 -225
  190. package/dist/wje-slider.js.map +1 -1
  191. package/dist/wje-sliding-container.js +295 -1319
  192. package/dist/wje-sliding-container.js.map +1 -1
  193. package/dist/wje-split-view.js +35 -121
  194. package/dist/wje-split-view.js.map +1 -1
  195. package/dist/wje-status.js +14 -45
  196. package/dist/wje-status.js.map +1 -1
  197. package/dist/wje-step.js +9 -32
  198. package/dist/wje-step.js.map +1 -1
  199. package/dist/wje-stepper.js +109 -357
  200. package/dist/wje-stepper.js.map +1 -1
  201. package/dist/wje-store.js +67 -360
  202. package/dist/wje-store.js.map +1 -1
  203. package/dist/wje-tab-group.js +85 -314
  204. package/dist/wje-tab-group.js.map +1 -1
  205. package/dist/wje-tab-panel.js +7 -28
  206. package/dist/wje-tab-panel.js.map +1 -1
  207. package/dist/wje-tab.js +21 -198
  208. package/dist/wje-tab.js.map +1 -1
  209. package/dist/wje-textarea.js +64 -264
  210. package/dist/wje-textarea.js.map +1 -1
  211. package/dist/wje-thumbnail.js +10 -51
  212. package/dist/wje-thumbnail.js.map +1 -1
  213. package/dist/wje-toast.js +127 -632
  214. package/dist/wje-toast.js.map +1 -1
  215. package/dist/wje-toggle.js +52 -177
  216. package/dist/wje-toggle.js.map +1 -1
  217. package/dist/wje-toolbar-action.js +128 -456
  218. package/dist/wje-toolbar-action.js.map +1 -1
  219. package/dist/wje-toolbar.js +75 -270
  220. package/dist/wje-toolbar.js.map +1 -1
  221. package/dist/wje-tooltip.js +50 -161
  222. package/dist/wje-tooltip.js.map +1 -1
  223. package/dist/wje-tree-item.js +70 -301
  224. package/dist/wje-tree-item.js.map +1 -1
  225. package/dist/wje-tree.js +145 -489
  226. package/dist/wje-tree.js.map +1 -1
  227. package/dist/wje-visually-hidden.js +7 -34
  228. package/dist/wje-visually-hidden.js.map +1 -1
  229. package/package.json +3 -2
  230. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  231. package/dist/icon-CReYMzAK.js +0 -245
  232. package/dist/popup.element-CwXvVFK7.js +0 -2133
  233. package/dist/router-links-wjqCnncc.js +0 -156
@@ -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 WJElement from "./wje-element.js";
5
- const styles = '/*\n[ Carousel ]\n*/\n\n:host {\n display: block;\n width: var(--wje-carousel-width, 100%);\n max-width: 100%;\n box-sizing: border-box;\n}\n\n.native-carousel {\n position: relative;\n width: 100%;\n height: var(--wje-carousel-height, 300px);\n scroll-behavior: smooth;\n box-sizing: border-box;\n}\n\n.slides-wrapper {\n position: relative;\n display: flex;\n align-items: stretch;\n width: 100%;\n height: var(--wje-carousel-height, 300px);\n box-sizing: border-box;\n}\n\n.carousel-slides {\n display: flex;\n flex: 1 1 auto;\n transition: transform 0.5s ease;\n align-items: stretch;\n overflow: auto;\n overscroll-behavior-x: contain;\n scrollbar-width: none;\n -ms-overflow-style: none;\n aspect-ratio: var(--wje-aspect-ratio, 4 / 3);\n scroll-snap-type: x mandatory;\n scroll-padding-inline: var(--wje-spacing-inline, 0);\n overflow-y: hidden;\n padding-inline: var(--wje-spacing-inline, 0);\n gap: var(--wje-carousel-gap, 0.5rem);\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n box-sizing: border-box;\n}\n\n.carousel-slides::-webkit-scrollbar {\n display: none;\n}\n\n::slotted(wje-carousel-item) {\n flex: 0 0 var(--wje-carousel-item-basis, var(--wje-carousel-size));\n width: var(--wje-carousel-item-basis, var(--wje-carousel-size));\n min-width: 0;\n max-width: 100%;\n align-self: stretch;\n height: 100%;\n box-sizing: border-box;\n}\n\n/*NAVIGATION*/\n\n[name="prev"], [name="next"] {\n display: block;\n position: absolute;\n top: 50%;\n border: none;\n cursor: pointer;\n z-index: 2;\n}\n\n[name="prev"] {\n left: -1rem;\n transform: translate(-100%, -50%);\n}\n\n[name="next"] {\n right: -1rem;\n transform: translate(100%, -50%);\n}\n\n/*PAGINATION*/\n\n.pagination {\n position: relative;\n left: 50%;\n transform: translate(-50%, 0);\n display: flex;\n z-index: 2;\n justify-content: center;\n padding-block: 1rem;\n}\n.pagination-item {\n cursor: pointer;\n height: 15px;\n width: 15px;\n margin: 0 2px;\n background-color: var(--wje-color-contrast-4);\n display: inline-block;\n border-radius: 50%;\n}\n.pagination-item.active {\n background-color: var(--wje-color);\n}\n\n/*THUMBNAILS*/\n\n.thumbnails {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow-x: auto;\n gap: 0.5rem;\n padding: 0 0.5rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n box-sizing: border-box;\n overflow-y: hidden;\n wje-thumbnail {\n --wje-thumbnail-width: 48px;\n --wje-thumbnail-height: 48px;\n --wje-thumbnail-border-radius: 0;\n cursor: pointer;\n border: 1px solid transparent;\n }\n .active {\n border: 1px solid var(--wje-color-primary-11);\n }\n}\n';
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
- * Active slide attribute.
21
- * @param value
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 styles;
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
- * Sets up the attributes for the Carousel.
84
- * @param name
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
- this.removeLoopClones();
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 fragment = document.createDocumentFragment();
123
- let native = document.createElement("div");
124
- native.classList.add("native-carousel");
125
- let wrapper = document.createElement("div");
126
- wrapper.classList.add("slides-wrapper");
127
- let slides = document.createElement("div");
128
- slides.classList.add("carousel-slides");
129
- let slot = document.createElement("slot");
130
- let slotPrev = document.createElement("slot");
131
- slotPrev.setAttribute("name", "prev");
132
- let slotNext = document.createElement("slot");
133
- slotNext.setAttribute("name", "next");
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
- wrapper.append(slides);
155
- if (this.pagination) native.append(this.createPagination());
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
- this.getSlidesWithClones().forEach((slide, i) => {
167
- this.intersectionObserver.observe(slide);
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 withClones = this.getSlidesWithClones();
183
- if (!withClones.length) return;
184
- const containerRect = this.slides.getBoundingClientRect();
185
- const snapStartX = containerRect.left + this.getScrollPaddingInlineStart();
186
- let best = null;
187
- let bestDist = Infinity;
188
- withClones.forEach((el) => {
189
- const r = el.getBoundingClientRect();
190
- const dist = Math.abs(r.left - snapStartX);
191
- if (dist < bestDist) {
192
- bestDist = dist;
193
- best = el;
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 visibleGapCount = Math.max(this.slidePerPage - 1, 0);
213
- const computedItemSize = `calc((100% - (${visibleGapCount} * var(--wje-carousel-gap, 0.5rem))) / ${this.slidePerPage})`;
214
- this.style.setProperty("--wje-carousel-slides-per-page", `${this.slidePerPage}`);
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 slideStyles = getComputedStyle(this.slides);
226
- return parseFloat(slideStyles.scrollPaddingInlineStart || slideStyles.scrollPaddingLeft || "0") || 0;
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
- (entries) => {
243
- entries.forEach((entry) => {
244
- this.entriesMap.set(entry.target, entry);
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
- * Goes to the slide.
260
- * @param index
261
- * @param behavior
262
- * @param next
263
- */
264
- goToSlide(index, behavior = "smooth", next = true) {
265
- const slides = this.getSlides();
266
- const withClones = this.getSlidesWithClones();
267
- const maxIndex = this.getMaxVisibleStartIndex(slides.length);
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
- role: "region",
303
- roledescription: "carousel"
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
- const slides = this.getSlides();
306
- const total = slides.length;
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 items = this.getSlides();
323
- if (items.length && this.loop) {
324
- const cloneCount = this.getLoopCloneCount(items.length);
325
- const firstOriginal = items[0];
326
- items.slice(items.length - cloneCount).forEach((item) => {
327
- const clone = this.createLoopClone(item);
328
- this.insertBefore(clone, firstOriginal);
329
- });
330
- items.slice(0, cloneCount).forEach((item) => {
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 clone = item.cloneNode(true);
345
- clone.classList.add("clone");
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((clone) => clone.remove());
358
- }
359
- /**
360
- * Returns how many slides should be cloned on each side when loop is enabled.
361
- * @param {number} totalSlides
362
- * @returns {number}
363
- */
364
- getLoopCloneCount(totalSlides = this.getSlides().length) {
365
- if (!this.loop || !totalSlides) return 0;
366
- return this.continuousLoop ? Math.min(this.slidePerPage, totalSlides) : 1;
367
- }
368
- /**
369
- * Scrolls the carousel to a visual slide index.
370
- * @param {number} vIndex
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((slide, i) => {
411
- slide.classList.remove("active");
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
- if (this.pagination) {
429
- this.context.querySelectorAll(".pagination-item").forEach((item, i) => {
430
- item.classList.toggle("active", i === this.activeSlide);
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
- if (this.thumbnails) {
439
- this.context.querySelectorAll("wje-thumbnail").forEach((item, i) => {
440
- item.classList.toggle("active", i === this.activeSlide);
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 nextButton = document.createElement("wje-button");
450
- nextButton.setAttribute("part", "next-button");
451
- nextButton.setAttribute("circle", "");
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 previousButton = document.createElement("wje-button");
464
- previousButton.setAttribute("part", "previous-button");
465
- previousButton.setAttribute("circle", "");
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 pagination = document.createElement("div");
478
- pagination.setAttribute("part", "pagination");
479
- pagination.classList.add("pagination");
480
- this.getPaginationIndexes().forEach((i) => {
481
- const paginationItem = document.createElement("div");
482
- paginationItem.classList.add("pagination-item");
483
- paginationItem.addEventListener("click", (e) => {
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 thumbnails = document.createElement("div");
498
- thumbnails.classList.add("thumbnails");
499
- const slides = this.getSlides();
500
- slides.forEach((slide, i) => {
501
- const thumbnail = document.createElement("wje-thumbnail");
502
- thumbnail.innerHTML = `<img src="${slide.querySelector("wje-img").getAttribute("src")}"></img>`;
503
- thumbnail.addEventListener("click", (e) => {
504
- this.removeActiveSlide();
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
- /** Maps logical index to visual index, including leading clones when loop is enabled. */
539
- getVisualIndexForLogical(index) {
540
- return this.loop ? index + this.getLoopCloneCount() : index;
541
- }
542
- /** Maps visual index to logical index, including edge clones when loop is enabled. */
543
- getLogicalIndexForVisual(vIndex) {
544
- const slides = this.getSlides();
545
- const maxIndex = this.getMaxVisibleStartIndex(slides.length);
546
- const cloneCount = this.getLoopCloneCount(slides.length);
547
- if (!this.loop) return Math.min(Math.max(vIndex, 0), maxIndex);
548
- if (this.continuousLoop) {
549
- if (vIndex < cloneCount) return slides.length - cloneCount + vIndex;
550
- if (vIndex >= cloneCount + slides.length) return vIndex - (cloneCount + slides.length);
551
- return vIndex - cloneCount;
552
- }
553
- if (vIndex < cloneCount) return maxIndex;
554
- if (vIndex >= cloneCount + slides.length) return 0;
555
- return Math.min(Math.max(vIndex - cloneCount, 0), maxIndex);
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() }, (_, index) => index);
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 el = this.context.querySelector(".carousel-slides");
599
- return el.scrollLeft < el.scrollWidth - el.clientWidth;
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
- const el = this.context.querySelector(".carousel-slides");
607
- return el.scrollLeft > 0;
252
+ return this.context.querySelector(".carousel-slides").scrollLeft > 0;
608
253
  }
609
254
  }
610
- WJElement.define("wje-carousel", Carousel);
255
+ t.define("wje-carousel", e);
611
256
  export {
612
- Carousel as default
257
+ e as default
613
258
  };
614
259
  //# sourceMappingURL=wje-carousel.js.map