@salla.sa/twilight-components 2.14.348 → 2.14.350

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 (158) hide show
  1. package/dist/cjs/{filepond-plugin-file-poster-CStjlaHV.js → filepond-plugin-file-poster-DUgrMVOZ.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-validate-size-DrcM89vc.js → filepond-plugin-file-validate-size-C14LEY_l.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-type-DnIoL6mq.js → filepond-plugin-file-validate-type-AbHwQAHY.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-image-edit-DLV0U0gb.js → filepond-plugin-image-edit-5ydXOhOa.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-exif-orientation-tPl3p3z_.js → filepond-plugin-image-exif-orientation-D0oIUOy-.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-preview-WTfIQM6C.js → filepond-plugin-image-preview-Bf_VUYwr.js} +1 -1
  7. package/dist/cjs/{filepond-B_sfbQx7.js → filepond-qUaAgMcd.js} +1 -1
  8. package/dist/cjs/{index-CkpcUCU5.js → index-BRdJtc1o.js} +2 -2
  9. package/dist/cjs/{index-4jrFyN8u.js → index-DKEcPhG9.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/salla-accordion_62.cjs.entry.js +100 -28
  12. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -11
  30. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  46. package/dist/cjs/twilight.cjs.js +2 -2
  47. package/dist/cjs/{vanilla-picker-BBejdpPH.js → vanilla-picker-CYHmsxIw.js} +1 -1
  48. package/dist/collection/components/salla-count-down/salla-count-down.js +125 -1
  49. package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +0 -10
  50. package/dist/collection/components/salla-product-options/salla-product-options.js +44 -10
  51. package/dist/collection/components/salla-slider/salla-slider.css +4 -0
  52. package/dist/collection/components/salla-slider/salla-slider.js +35 -7
  53. package/dist/components/index.js +2 -2
  54. package/dist/components/salla-count-down2.js +24 -2
  55. package/dist/components/salla-order-details-multiple-bundle-product2.js +0 -10
  56. package/dist/components/salla-product-options2.js +44 -10
  57. package/dist/components/salla-slider2.js +36 -8
  58. package/dist/esm/{filepond-BBd4zIxi.js → filepond-DDOVDszb.js} +1 -1
  59. package/dist/esm/{filepond-plugin-file-poster-Vvhvcuu3.js → filepond-plugin-file-poster-DK5QZAmf.js} +1 -1
  60. package/dist/esm/{filepond-plugin-file-validate-size-NvdGUEr-.js → filepond-plugin-file-validate-size-BoUr1T-f.js} +1 -1
  61. package/dist/esm/{filepond-plugin-file-validate-type-BwVZhOLd.js → filepond-plugin-file-validate-type-USfq-Egq.js} +1 -1
  62. package/dist/esm/{filepond-plugin-image-edit-BOgZn2vW.js → filepond-plugin-image-edit-BzsOppMe.js} +1 -1
  63. package/dist/esm/{filepond-plugin-image-exif-orientation-BmbDj4hl.js → filepond-plugin-image-exif-orientation-D2x3fkHF.js} +1 -1
  64. package/dist/esm/{filepond-plugin-image-preview-CDsLWAPe.js → filepond-plugin-image-preview-CAbtIGaT.js} +1 -1
  65. package/dist/esm/{index-LmL2BolE.js → index-CkAdPgup.js} +2 -2
  66. package/dist/esm/{index-BhHl4h44.js → index-unlRcuKr.js} +1 -1
  67. package/dist/esm/loader.js +3 -3
  68. package/dist/esm/salla-accordion_62.entry.js +100 -28
  69. package/dist/esm/salla-advertisement.entry.js +1 -1
  70. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  71. package/dist/esm/salla-apps-icons.entry.js +1 -1
  72. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  73. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  74. package/dist/esm/salla-contacts.entry.js +1 -1
  75. package/dist/esm/salla-custom-fields.entry.js +1 -1
  76. package/dist/esm/salla-filters-widget.entry.js +1 -1
  77. package/dist/esm/salla-filters.entry.js +1 -1
  78. package/dist/esm/salla-hook.entry.js +1 -1
  79. package/dist/esm/salla-installment.entry.js +1 -1
  80. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  81. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  82. package/dist/esm/salla-metadata.entry.js +1 -1
  83. package/dist/esm/salla-notification-item.entry.js +1 -1
  84. package/dist/esm/salla-notifications.entry.js +1 -1
  85. package/dist/esm/salla-offer.entry.js +1 -1
  86. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -11
  87. package/dist/esm/salla-order-details-options.entry.js +1 -1
  88. package/dist/esm/salla-order-details.entry.js +1 -1
  89. package/dist/esm/salla-order-summary.entry.js +1 -1
  90. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  91. package/dist/esm/salla-orders.entry.js +1 -1
  92. package/dist/esm/salla-payments.entry.js +1 -1
  93. package/dist/esm/salla-price-range.entry.js +1 -1
  94. package/dist/esm/salla-review-card.entry.js +1 -1
  95. package/dist/esm/salla-reviews-page.entry.js +1 -1
  96. package/dist/esm/salla-reviews.entry.js +1 -1
  97. package/dist/esm/salla-social.entry.js +1 -1
  98. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  99. package/dist/esm/salla-tooltip.entry.js +1 -1
  100. package/dist/esm/salla-trust-badges.entry.js +1 -1
  101. package/dist/esm/salla-verify.entry.js +1 -1
  102. package/dist/esm/salla-wallet.entry.js +1 -1
  103. package/dist/esm/twilight.js +3 -3
  104. package/dist/esm/{vanilla-picker-nCA1ATQw.js → vanilla-picker-7Rdeecyw.js} +1 -1
  105. package/dist/twilight/{p-133f1a48.entry.js → p-0162ae20.entry.js} +1 -1
  106. package/dist/twilight/{p-388fb59e.entry.js → p-0587a19b.entry.js} +1 -1
  107. package/dist/twilight/{p-312c1af1.entry.js → p-0eb554c0.entry.js} +1 -1
  108. package/dist/twilight/{p-8c111815.entry.js → p-100f7787.entry.js} +1 -1
  109. package/dist/twilight/{p-45cd70b8.entry.js → p-17618bb7.entry.js} +1 -1
  110. package/dist/twilight/{p-2ed7cfba.entry.js → p-1d2131a2.entry.js} +1 -1
  111. package/dist/twilight/{p-3d69e45a.entry.js → p-25e36e28.entry.js} +1 -1
  112. package/dist/twilight/{p-07add349.entry.js → p-478033b6.entry.js} +1 -1
  113. package/dist/twilight/{p-6c648552.entry.js → p-4bb743c7.entry.js} +1 -1
  114. package/dist/twilight/{p-c38c65f0.entry.js → p-50098fb9.entry.js} +1 -1
  115. package/dist/twilight/{p-74aaf06c.entry.js → p-50e1eb99.entry.js} +1 -1
  116. package/dist/twilight/{p-c302d3e3.entry.js → p-57bf3aff.entry.js} +1 -1
  117. package/dist/twilight/{p-fbbd8d5d.entry.js → p-6c0dd774.entry.js} +1 -1
  118. package/dist/twilight/{p-f1f60ef7.entry.js → p-7c33b8f3.entry.js} +1 -1
  119. package/dist/twilight/{p-d2ed15e9.entry.js → p-815175b1.entry.js} +1 -1
  120. package/dist/twilight/p-82f05641.entry.js +4 -0
  121. package/dist/twilight/{p-b30a12dc.entry.js → p-843a8d82.entry.js} +1 -1
  122. package/dist/twilight/p-8565cac6.entry.js +4 -0
  123. package/dist/twilight/{p-48b90fb3.entry.js → p-9b1184eb.entry.js} +1 -1
  124. package/dist/twilight/{p-v9xIxXO9.js → p-BCXFmuAu.js} +1 -1
  125. package/dist/twilight/{p-TSs7NqKJ.js → p-BHSXg2s-.js} +1 -1
  126. package/dist/twilight/{p-D1_qMmD0.js → p-BXAV6QCo.js} +1 -1
  127. package/dist/twilight/{p-CIEz2m31.js → p-BY-pqCWB.js} +1 -1
  128. package/dist/twilight/{p-Bf4kQRcH.js → p-BgVF6sgk.js} +1 -1
  129. package/dist/twilight/p-Ciq2A6DK.js +9 -0
  130. package/dist/twilight/{p-LmL2BolE.js → p-CkAdPgup.js} +1 -1
  131. package/dist/twilight/{p-xUcnsSlW.js → p-DGD3SzSN.js} +1 -1
  132. package/dist/twilight/{p-qNQwLhxq.js → p-De1xuTRp.js} +1 -1
  133. package/dist/twilight/{p-c0pjDpvN.js → p-DhexS4-2.js} +1 -1
  134. package/dist/twilight/{p-4d47725f.entry.js → p-a4b3ddc4.entry.js} +1 -1
  135. package/dist/twilight/{p-549ff403.entry.js → p-a61b0f9c.entry.js} +1 -1
  136. package/dist/twilight/{p-7c85a102.entry.js → p-aa32cabd.entry.js} +1 -1
  137. package/dist/twilight/{p-0aef5345.entry.js → p-abcf3b2d.entry.js} +1 -1
  138. package/dist/twilight/{p-63e9750c.entry.js → p-affbe255.entry.js} +1 -1
  139. package/dist/twilight/{p-06956c1d.entry.js → p-b5b851dc.entry.js} +1 -1
  140. package/dist/twilight/{p-bcec0cf0.entry.js → p-b6cddbff.entry.js} +1 -1
  141. package/dist/twilight/{p-09dceb55.entry.js → p-b8872e5f.entry.js} +1 -1
  142. package/dist/twilight/{p-cd2c9076.entry.js → p-b8e7613a.entry.js} +1 -1
  143. package/dist/twilight/{p-f74f1591.entry.js → p-b9648b3c.entry.js} +1 -1
  144. package/dist/twilight/{p-966ed241.entry.js → p-bd0fda0b.entry.js} +1 -1
  145. package/dist/twilight/{p-03870195.entry.js → p-c18da320.entry.js} +1 -1
  146. package/dist/twilight/{p-950f9a87.entry.js → p-c4f190b2.entry.js} +1 -1
  147. package/dist/twilight/{p-4cd30c07.entry.js → p-c5ac1d40.entry.js} +1 -1
  148. package/dist/twilight/{p-23ff2132.entry.js → p-d72fc67d.entry.js} +1 -1
  149. package/dist/twilight/{p-9f39c553.entry.js → p-e5dc45dc.entry.js} +1 -1
  150. package/dist/twilight/twilight.esm.js +1 -1
  151. package/dist/types/components/salla-count-down/salla-count-down.d.ts +22 -0
  152. package/dist/types/components/salla-order-details/salla-order-details-multiple-bundle-product.d.ts +0 -1
  153. package/dist/types/components/salla-slider/salla-slider.d.ts +7 -1
  154. package/dist/types/components.d.ts +48 -0
  155. package/package.json +5 -5
  156. package/dist/twilight/p-2c9d0518.entry.js +0 -4
  157. package/dist/twilight/p-2gPrnQD6.js +0 -9
  158. package/dist/twilight/p-fff8923d.entry.js +0 -4
@@ -130,6 +130,16 @@ export class SallaCountDown {
130
130
  this.normalizedPreOrder?.availability_date &&
131
131
  this.renderPreOrderToBeAvailableOn(), this.renderPreOrderCountDown()));
132
132
  }
133
+ renderPrefixText() {
134
+ if (!this.prefixText)
135
+ return null;
136
+ return h("span", { class: "s-count-down-prefix-text" }, this.prefixText);
137
+ }
138
+ renderButton() {
139
+ if (!this.withButton || !this.buttonText)
140
+ return null;
141
+ return h("salla-button", { color: "primary", size: "medium", href: this.buttonHref }, this.buttonIcon ? h("i", { class: this.buttonIcon }) : null, h("span", null, this.buttonText));
142
+ }
133
143
  renderContent() {
134
144
  if (!this.date)
135
145
  return null;
@@ -142,7 +152,7 @@ export class SallaCountDown {
142
152
  return this.renderCountDown();
143
153
  }
144
154
  render() {
145
- return (h(Host, { key: '96bba6312e710673e1f249cabecfc8756fac5c0e', class: `s-count-down-wrapper ${this.preOrder && this.isValidDate(this.date) ? 's-count-down-pre-order' : ''}` }, this.renderContent(), this.offerEnded && this.renderOfferEnded()));
155
+ return (h(Host, { key: '11e7cf7cf77bbde82d990107b7ccda8f1fc9ad6f', class: `s-count-down-wrapper ${this.preOrder && this.isValidDate(this.date) ? 's-count-down-pre-order' : ''} ${this.horizontal ? 's-count-down-horizontal' : ''} ${this.withButton ? 's-count-down-with-button' : ''}` }, this.renderPrefixText(), this.renderContent(), this.offerEnded && this.renderOfferEnded(), this.renderButton()));
146
156
  }
147
157
  static get is() { return "salla-count-down"; }
148
158
  static get originalStyleUrls() {
@@ -200,6 +210,120 @@ export class SallaCountDown {
200
210
  "setter": false,
201
211
  "reflect": false
202
212
  },
213
+ "horizontal": {
214
+ "type": "boolean",
215
+ "attribute": "horizontal",
216
+ "mutable": false,
217
+ "complexType": {
218
+ "original": "boolean",
219
+ "resolved": "boolean",
220
+ "references": {}
221
+ },
222
+ "required": false,
223
+ "optional": true,
224
+ "docs": {
225
+ "tags": [],
226
+ "text": "If true, applies compact horizontal layout"
227
+ },
228
+ "getter": false,
229
+ "setter": false,
230
+ "reflect": false
231
+ },
232
+ "withButton": {
233
+ "type": "boolean",
234
+ "attribute": "with-button",
235
+ "mutable": false,
236
+ "complexType": {
237
+ "original": "boolean",
238
+ "resolved": "boolean",
239
+ "references": {}
240
+ },
241
+ "required": false,
242
+ "optional": true,
243
+ "docs": {
244
+ "tags": [],
245
+ "text": "If true, renders a slot for an action button alongside the countdown"
246
+ },
247
+ "getter": false,
248
+ "setter": false,
249
+ "reflect": false
250
+ },
251
+ "prefixText": {
252
+ "type": "string",
253
+ "attribute": "prefix-text",
254
+ "mutable": false,
255
+ "complexType": {
256
+ "original": "string",
257
+ "resolved": "string",
258
+ "references": {}
259
+ },
260
+ "required": false,
261
+ "optional": true,
262
+ "docs": {
263
+ "tags": [],
264
+ "text": "The prefix text to show before the countdown"
265
+ },
266
+ "getter": false,
267
+ "setter": false,
268
+ "reflect": false
269
+ },
270
+ "buttonHref": {
271
+ "type": "string",
272
+ "attribute": "button-href",
273
+ "mutable": false,
274
+ "complexType": {
275
+ "original": "string",
276
+ "resolved": "string",
277
+ "references": {}
278
+ },
279
+ "required": false,
280
+ "optional": true,
281
+ "docs": {
282
+ "tags": [],
283
+ "text": "The button href to show with the countdown"
284
+ },
285
+ "getter": false,
286
+ "setter": false,
287
+ "reflect": false
288
+ },
289
+ "buttonText": {
290
+ "type": "string",
291
+ "attribute": "button-text",
292
+ "mutable": false,
293
+ "complexType": {
294
+ "original": "string",
295
+ "resolved": "string",
296
+ "references": {}
297
+ },
298
+ "required": false,
299
+ "optional": true,
300
+ "docs": {
301
+ "tags": [],
302
+ "text": "The button text to show with the countdown"
303
+ },
304
+ "getter": false,
305
+ "setter": false,
306
+ "reflect": false
307
+ },
308
+ "buttonIcon": {
309
+ "type": "string",
310
+ "attribute": "button-icon",
311
+ "mutable": false,
312
+ "complexType": {
313
+ "original": "string",
314
+ "resolved": "string",
315
+ "references": {}
316
+ },
317
+ "required": false,
318
+ "optional": true,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": "The button icon to show with the countdown"
322
+ },
323
+ "getter": false,
324
+ "setter": false,
325
+ "reflect": false
326
+ },
203
327
  "boxed": {
204
328
  "type": "boolean",
205
329
  "attribute": "boxed",
@@ -40,16 +40,6 @@ export class SallaproductDetailsMultipleBundleProduct {
40
40
  }
41
41
  return this.productDetails?.options?.length > 0;
42
42
  }
43
- renderProductPrice() {
44
- if (!this.productDetails) {
45
- return null;
46
- }
47
- const { is_on_sale, sale_price, regular_price, price } = this.productDetails;
48
- if (is_on_sale && sale_price) {
49
- return (h("div", null, h("span", { class: "s-order-details-product-price s-order-details-product-price-sale" }, h("span", { innerHTML: salla.money(sale_price) })), regular_price && (h("span", { class: "s-order-details-product-regular-price" }, h("span", { innerHTML: salla.money(regular_price) })))));
50
- }
51
- return (h("span", { class: "s-order-details-product-price" }, h("span", { innerHTML: salla.money(price) })));
52
- }
53
43
  renderOptions() {
54
44
  if (!this.productDetails?.options?.length) {
55
45
  return null;
@@ -508,19 +508,53 @@ export class SallaProductOptions {
508
508
  }, []);
509
509
  }
510
510
  componentDidLoad() {
511
- if (this.optionsData?.length === 0 && !this.optionsData.some(option => option.type === DisplayType.DONATION)) {
511
+ if (!this.optionsData?.length) {
512
512
  return;
513
513
  }
514
- const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details.find(detail => detail.is_selected);
515
- if (!selectedDonationOption) {
516
- return;
514
+ // Handle donation options
515
+ const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details?.find(detail => detail.is_selected);
516
+ if (selectedDonationOption) {
517
+ setTimeout(() => {
518
+ salla.event.emit('product-options::donation-changed', {
519
+ id: this.productId,
520
+ price: selectedDonationOption.additional_price
521
+ });
522
+ }, 1000);
523
+ }
524
+ // Handle pre-selected options on product page
525
+ // Call salla.product.getPrice() directly to avoid triggering form validation which causes unwanted scroll
526
+ if (!salla.url.is_page("cart")) {
527
+ const pricingOptionTypes = [
528
+ DisplayType.SINGLE_OPTION,
529
+ DisplayType.MULTIPLE_OPTIONS,
530
+ DisplayType.COLOR,
531
+ DisplayType.THUMBNAIL,
532
+ DisplayType.DONATION,
533
+ DisplayType.DIGITAL_CARD_VALUE,
534
+ DisplayType.COUNTRY
535
+ ];
536
+ const hasPreSelectedPricingOption = this.optionsData.some(option => pricingOptionTypes.includes(option.type) &&
537
+ option.details?.some(detail => detail.is_selected));
538
+ if (hasPreSelectedPricingOption) {
539
+ // Use requestAnimationFrame to ensure DOM is fully painted before accessing form
540
+ requestAnimationFrame(() => {
541
+ try {
542
+ const form = this.host.closest('form');
543
+ if (!form)
544
+ return;
545
+ // Validate form belongs to this product to avoid conflicts on complex pages
546
+ const formData = new FormData(form);
547
+ const formProductId = formData.get('id') || formData.get('product_id');
548
+ if (formProductId && String(formProductId) !== String(this.productId))
549
+ return;
550
+ salla.product.getPrice(formData);
551
+ }
552
+ catch (e) {
553
+ salla.log('Error updating price for pre-selected options:', e);
554
+ }
555
+ });
556
+ }
517
557
  }
518
- setTimeout(() => {
519
- salla.event.emit('product-options::donation-changed', {
520
- id: this.productId,
521
- price: selectedDonationOption.additional_price
522
- });
523
- }, 1000);
524
558
  }
525
559
  /**
526
560
  * Enable user-initiated validation mode so invalid fields will scroll into view
@@ -860,4 +860,8 @@
860
860
 
861
861
  .swiper {
862
862
  overflow: clip;
863
+ }
864
+
865
+ .s-slider-vertical .s-slider-container {
866
+ min-width: 0;
863
867
  }
@@ -89,7 +89,9 @@ export class SallaSlider {
89
89
  this.currentIndex = undefined;
90
90
  this.isEnd = false;
91
91
  this.isBeginning = true;
92
- this.windowWidth = window.innerWidth;
92
+ /** Use matchMedia instead of window.innerWidth to avoid forced reflow (Lighthouse recommended) */
93
+ this.isDesktopViewport = typeof window !== 'undefined' ? window.matchMedia('(min-width: 768px)').matches : true;
94
+ this.viewportMediaQuery = null;
93
95
  this.hasThumbSlot = false;
94
96
  this.pre_defined_config = {
95
97
  carousel: {
@@ -133,6 +135,9 @@ export class SallaSlider {
133
135
  spaceBetween: 30
134
136
  }
135
137
  };
138
+ this.onViewportChange = (e) => {
139
+ this.isDesktopViewport = e.matches;
140
+ };
136
141
  this.direction = this.direction || document.documentElement.dir;
137
142
  }
138
143
  // Methods
@@ -429,11 +434,11 @@ export class SallaSlider {
429
434
  return pre_defined_config;
430
435
  }
431
436
  getThumbsDirection() {
432
- const { verticalThumbs, windowWidth, direction } = this;
433
- if (verticalThumbs && windowWidth < 768 && direction === 'rtl') {
437
+ const { verticalThumbs, isDesktopViewport, direction } = this;
438
+ if (verticalThumbs && !isDesktopViewport && direction === 'rtl') {
434
439
  return 'rtl';
435
440
  }
436
- if (verticalThumbs && windowWidth > 768 && direction === 'rtl') {
441
+ if (verticalThumbs && isDesktopViewport && direction === 'rtl') {
437
442
  return 'ltr';
438
443
  }
439
444
  return direction;
@@ -451,6 +456,8 @@ export class SallaSlider {
451
456
  // Backward compatibility: lazy load data-background as background-image (removed in Swiper v9+)
452
457
  this.loadLazyBackgrounds();
453
458
  this.slider.on('slideChange', () => this.loadLazyBackgrounds());
459
+ // Add swiper-lazy-loaded to lazy images when visible
460
+ this.observeLazyImages();
454
461
  // Expose slider events
455
462
  this.slider.on('slideChange', (slider) => {
456
463
  //todo:: it doesn't change when loop is active, always will be false
@@ -486,7 +493,7 @@ export class SallaSlider {
486
493
  classes += this.verticalThumbs ? ' s-slider-vertical ' : ' s-slider-horizontal ';
487
494
  classes += this.arrowsCentered ? ' s-slider-v-centered ' : '';
488
495
  classes += this.gridThumbs ? ' s-slider-with-grid-thumbs ' : '';
489
- return (h(Host, { key: '671c02110bae2bd18cac37cf07ea33a5f0fbd671', class: 's-slider-wrapper ' + classes }, this.blockTitle || this.showControls ?
496
+ return (h(Host, { key: '44f6baf2ec3a6421cd8d8ce6779c6ce781cecc7f', class: 's-slider-wrapper ' + classes }, this.blockTitle || this.showControls ?
490
497
  h("div", { class: "s-slider-block__title" }, this.blockTitle ?
491
498
  h("div", { class: "s-slider-block__title-right" }, h("h2", null, this.blockTitle), this.blockSubtitle ? h("p", { innerHTML: this.blockSubtitle }) : '')
492
499
  : '', h("div", { class: "s-slider-block__title-left" }, this.displayAllUrl ?
@@ -494,11 +501,28 @@ export class SallaSlider {
494
501
  : '', this.showControls ?
495
502
  h("div", { class: "s-slider-block__title-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowLeftIcon : ArrowRightIcon })))
496
503
  : ''))
497
- : '', h("div", { key: '75e963b5694e4af9d2cef0e179644c44bee587ef', class: "swiper s-slider-container", ref: el => this.sliderContainer = el, dir: this.vertical ? "ltr" : this.direction }, h("slot", { key: '01ab750e52328fec9acef587acfa23d0477ef41d' }), h("div", { key: '87790d8f677a5c6ae52c31de07fa53642be096ba', class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { key: 'e14d002dbb228d96b4ce915a2a83f566fce00cf7', name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' && this.hasThumbSlot ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", dir: this.getThumbsDirection(), ref: el => this.thumbsSliderContainer = el }, h("div", { class: { "s-slider-swiper-wrapper swiper-wrapper": true, "s-slider-grid-thumbs": this.gridThumbs }, ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ?
504
+ : '', h("div", { key: '384d3224e9e2f9ad08d71093ee4c6f907232c07e', class: "swiper s-slider-container", ref: el => this.sliderContainer = el, dir: this.vertical ? "ltr" : this.direction }, h("slot", { key: '578756df5b652d9b7e86d3f0424e4ec886b7a75f' }), h("div", { key: '7966a00ec720374a3dac1533d72fdfeb31db8105', class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { key: '39f9656cabb053dc4878ae1f2bd94a6efc19f975', name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' && this.hasThumbSlot ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", dir: this.getThumbsDirection(), ref: el => this.thumbsSliderContainer = el }, h("div", { class: { "s-slider-swiper-wrapper swiper-wrapper": true, "s-slider-grid-thumbs": this.gridThumbs }, ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ?
498
505
  h("div", { class: "s-slider-thumbs-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-thumbs-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-thumbs-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowLeftIcon : ArrowRightIcon })))
499
506
  : null))
500
507
  : null));
501
508
  }
509
+ /** Observe all .swiper-lazy images and add swiper-lazy-loaded when they enter viewport. */
510
+ observeLazyImages() {
511
+ const lazyEls = this.sliderContainer?.querySelectorAll('.swiper-lazy:not(.swiper-lazy-loaded)');
512
+ if (!lazyEls?.length)
513
+ return;
514
+ if (!this.lazyImageObserver) {
515
+ this.lazyImageObserver = new IntersectionObserver((entries, observer) => {
516
+ entries.forEach(entry => {
517
+ if (!entry.isIntersecting)
518
+ return;
519
+ entry.target.classList.add('swiper-lazy-loaded');
520
+ observer.unobserve(entry.target);
521
+ });
522
+ }, { rootMargin: '50px' });
523
+ }
524
+ lazyEls.forEach(el => this.lazyImageObserver.observe(el));
525
+ }
502
526
  /** Lazy load data-background for active slide and adjacent slides (backward compat for Swiper v9+). */
503
527
  loadLazyBackgrounds() {
504
528
  if (!this.slider?.slides)
@@ -551,9 +575,13 @@ export class SallaSlider {
551
575
  this.flattenSlotToElements(this.thumbsSliderWrapper, 'div[slot="thumbs"]');
552
576
  }
553
577
  this.initSlider();
578
+ this.viewportMediaQuery = window.matchMedia('(min-width: 768px)');
579
+ this.viewportMediaQuery.addEventListener('change', this.onViewportChange);
554
580
  }
555
581
  disconnectedCallback() {
582
+ this.viewportMediaQuery?.removeEventListener('change', this.onViewportChange);
556
583
  this.lazyObserver?.disconnect();
584
+ this.lazyImageObserver?.disconnect();
557
585
  }
558
586
  static get is() { return "salla-slider"; }
559
587
  static get originalStyleUrls() {
@@ -999,7 +1027,7 @@ export class SallaSlider {
999
1027
  "isEnd": {},
1000
1028
  "isBeginning": {},
1001
1029
  "displayAllTitle": {},
1002
- "windowWidth": {}
1030
+ "isDesktopViewport": {}
1003
1031
  };
1004
1032
  }
1005
1033
  static get events() {