@salla.sa/twilight-components 2.14.351 → 2.14.353

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 (157) hide show
  1. package/dist/cjs/{filepond-DmgB2usw.js → filepond-7SxqaoXb.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-Qz9yBcC6.js → filepond-plugin-file-poster-DwIv84hN.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BpxufYGC.js → filepond-plugin-file-validate-size-NUNnIo4Q.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DPpMnDuU.js → filepond-plugin-file-validate-type-CXI-hfww.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DSig_Hnr.js → filepond-plugin-image-edit-fBeBGIBb.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-BdyyWkN_.js → filepond-plugin-image-exif-orientation-BmLTdQ6d.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-ClN5AjHL.js → filepond-plugin-image-preview-CssKRM6n.js} +1 -1
  8. package/dist/cjs/{index-wroCOFea.js → index-B5soIVRX.js} +2 -2
  9. package/dist/cjs/{index-ByiRU---.js → index-B9TEdQDE.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/salla-accordion_62.cjs.entry.js +84 -34
  12. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-app-install-alert.cjs.entry.js +8 -3
  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 -1
  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-Dud2hHSp.js → vanilla-picker-C6fk8_TR.js} +1 -1
  48. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +18 -6
  49. package/dist/collection/components/salla-app-install-alert/salla-app-install-alert.js +7 -2
  50. package/dist/collection/components/salla-color-picker/salla-color-picker.js +39 -8
  51. package/dist/collection/components/salla-maintenance-alert/salla-maintenance-alert.js +4 -2
  52. package/dist/collection/components/salla-products-list/salla-products-list.js +17 -11
  53. package/dist/components/index.js +2 -2
  54. package/dist/components/salla-add-product-button2.js +18 -6
  55. package/dist/components/salla-app-install-alert.js +7 -2
  56. package/dist/components/salla-color-picker2.js +38 -7
  57. package/dist/components/salla-maintenance-alert.js +4 -2
  58. package/dist/components/salla-products-list2.js +17 -11
  59. package/dist/esm/{filepond-BcVCWOQQ.js → filepond-Cuqyleyy.js} +1 -1
  60. package/dist/esm/{filepond-plugin-file-poster-B6OLqzjJ.js → filepond-plugin-file-poster-C6Wara8q.js} +1 -1
  61. package/dist/esm/{filepond-plugin-file-validate-size-BCifsMdp.js → filepond-plugin-file-validate-size-D-M3KSxo.js} +1 -1
  62. package/dist/esm/{filepond-plugin-file-validate-type-BzRNZ2wk.js → filepond-plugin-file-validate-type-DzAl1VI8.js} +1 -1
  63. package/dist/esm/{filepond-plugin-image-edit-Dvu8RWud.js → filepond-plugin-image-edit-flutfc9I.js} +1 -1
  64. package/dist/esm/{filepond-plugin-image-exif-orientation-DtlS_Id7.js → filepond-plugin-image-exif-orientation-B2UkG6iE.js} +1 -1
  65. package/dist/esm/{filepond-plugin-image-preview-DRaZsLxF.js → filepond-plugin-image-preview-B4u8N2nE.js} +1 -1
  66. package/dist/esm/{index-D8IUoDXw.js → index-6mr785rH.js} +2 -2
  67. package/dist/esm/{index-BT5aIJiI.js → index-xWIb6INF.js} +1 -1
  68. package/dist/esm/loader.js +3 -3
  69. package/dist/esm/salla-accordion_62.entry.js +84 -34
  70. package/dist/esm/salla-advertisement.entry.js +1 -1
  71. package/dist/esm/salla-app-install-alert.entry.js +8 -3
  72. package/dist/esm/salla-apps-icons.entry.js +1 -1
  73. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  74. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  75. package/dist/esm/salla-contacts.entry.js +1 -1
  76. package/dist/esm/salla-custom-fields.entry.js +1 -1
  77. package/dist/esm/salla-filters-widget.entry.js +1 -1
  78. package/dist/esm/salla-filters.entry.js +1 -1
  79. package/dist/esm/salla-hook.entry.js +1 -1
  80. package/dist/esm/salla-installment.entry.js +1 -1
  81. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  82. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  83. package/dist/esm/salla-metadata.entry.js +1 -1
  84. package/dist/esm/salla-notification-item.entry.js +1 -1
  85. package/dist/esm/salla-notifications.entry.js +1 -1
  86. package/dist/esm/salla-offer.entry.js +1 -1
  87. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  88. package/dist/esm/salla-order-details-options.entry.js +1 -1
  89. package/dist/esm/salla-order-details.entry.js +1 -1
  90. package/dist/esm/salla-order-summary.entry.js +1 -1
  91. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  92. package/dist/esm/salla-orders.entry.js +1 -1
  93. package/dist/esm/salla-payments.entry.js +1 -1
  94. package/dist/esm/salla-price-range.entry.js +1 -1
  95. package/dist/esm/salla-review-card.entry.js +1 -1
  96. package/dist/esm/salla-reviews-page.entry.js +1 -1
  97. package/dist/esm/salla-reviews.entry.js +1 -1
  98. package/dist/esm/salla-social.entry.js +1 -1
  99. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  100. package/dist/esm/salla-tooltip.entry.js +1 -1
  101. package/dist/esm/salla-trust-badges.entry.js +1 -1
  102. package/dist/esm/salla-verify.entry.js +1 -1
  103. package/dist/esm/salla-wallet.entry.js +1 -1
  104. package/dist/esm/twilight.js +3 -3
  105. package/dist/esm/{vanilla-picker-BPR2c_5J.js → vanilla-picker-B4PKRAhm.js} +1 -1
  106. package/dist/twilight/{p-de74f566.entry.js → p-0c87ef6c.entry.js} +1 -1
  107. package/dist/twilight/{p-9dc0d7cb.entry.js → p-12e49031.entry.js} +1 -1
  108. package/dist/twilight/{p-403fc5a0.entry.js → p-16b8d78c.entry.js} +1 -1
  109. package/dist/twilight/{p-1d6ae0cd.entry.js → p-18ebec2c.entry.js} +1 -1
  110. package/dist/twilight/{p-53bbd4e8.entry.js → p-19e07b9e.entry.js} +1 -1
  111. package/dist/twilight/{p-ef9334ed.entry.js → p-28900b2e.entry.js} +1 -1
  112. package/dist/twilight/{p-5a27fc24.entry.js → p-2a26c1d6.entry.js} +1 -1
  113. package/dist/twilight/{p-46095c81.entry.js → p-2d209f96.entry.js} +1 -1
  114. package/dist/twilight/{p-fad69d7b.entry.js → p-300624bb.entry.js} +1 -1
  115. package/dist/twilight/{p-234d4270.entry.js → p-33ea3141.entry.js} +1 -1
  116. package/dist/twilight/{p-4a269d95.entry.js → p-4253fc44.entry.js} +1 -1
  117. package/dist/twilight/{p-c8f83a29.entry.js → p-4bc98557.entry.js} +1 -1
  118. package/dist/twilight/{p-ffcfb224.entry.js → p-5067322a.entry.js} +1 -1
  119. package/dist/twilight/{p-d8c30c7b.entry.js → p-5bf05092.entry.js} +1 -1
  120. package/dist/twilight/{p-44c225e2.entry.js → p-6472200c.entry.js} +1 -1
  121. package/dist/twilight/p-67830f2a.entry.js +4 -0
  122. package/dist/twilight/{p-8d0e34f8.entry.js → p-6f576591.entry.js} +1 -1
  123. package/dist/twilight/{p-a50658ad.entry.js → p-6f5d02c6.entry.js} +1 -1
  124. package/dist/twilight/{p-D8IUoDXw.js → p-6mr785rH.js} +1 -1
  125. package/dist/twilight/{p-993dff37.entry.js → p-751dddd4.entry.js} +1 -1
  126. package/dist/twilight/{p-eb109f9d.entry.js → p-7e39343d.entry.js} +1 -1
  127. package/dist/twilight/{p-8af29c6e.entry.js → p-81702ecb.entry.js} +1 -1
  128. package/dist/twilight/{p-9a6195f6.entry.js → p-8b018d82.entry.js} +1 -1
  129. package/dist/twilight/{p-faa4c75d.entry.js → p-8c7b7712.entry.js} +1 -1
  130. package/dist/twilight/{p-0fb07494.entry.js → p-9946fa76.entry.js} +1 -1
  131. package/dist/twilight/{p-9ab1a8dd.entry.js → p-9b22a7eb.entry.js} +1 -1
  132. package/dist/twilight/{p-R8UuPKQS.js → p-B2SkkGH8.js} +1 -1
  133. package/dist/twilight/{p-mIk_7HE4.js → p-BijadG7g.js} +1 -1
  134. package/dist/twilight/{p-CLCMzFCR.js → p-Bp_xKTyn.js} +1 -1
  135. package/dist/twilight/{p-DNuuIRPk.js → p-C_h1JDCU.js} +1 -1
  136. package/dist/twilight/{p-DhPpUonS.js → p-ChfiVIJv.js} +1 -1
  137. package/dist/twilight/{p-BjevMNf5.js → p-Cuxsz9f-.js} +1 -1
  138. package/dist/twilight/{p-DMvcLQlj.js → p-DnELO4MH.js} +1 -1
  139. package/dist/twilight/{p-5e83dab1.entry.js → p-a515a8cc.entry.js} +1 -1
  140. package/dist/twilight/{p-6961de25.entry.js → p-ac6fc286.entry.js} +1 -1
  141. package/dist/twilight/{p-88aa8e1c.entry.js → p-b60db6c8.entry.js} +1 -1
  142. package/dist/twilight/{p-a0fb9e8d.entry.js → p-c096e336.entry.js} +1 -1
  143. package/dist/twilight/{p-97d6ac02.entry.js → p-c4821f8b.entry.js} +1 -1
  144. package/dist/twilight/{p-c5dc7685.entry.js → p-d4aaeef4.entry.js} +1 -1
  145. package/dist/twilight/{p-cef109da.entry.js → p-dde21f4b.entry.js} +1 -1
  146. package/dist/twilight/{p-b4bb7b69.entry.js → p-de807340.entry.js} +1 -1
  147. package/dist/twilight/{p-af71190f.entry.js → p-e909d28b.entry.js} +1 -1
  148. package/dist/twilight/{p-2986242d.entry.js → p-fa585081.entry.js} +1 -1
  149. package/dist/twilight/{p-VHxFG8vR.js → p-tFBCbVoG.js} +1 -1
  150. package/dist/twilight/{p-B1PME38e.js → p-zHj-W7EE.js} +1 -1
  151. package/dist/twilight/twilight.esm.js +1 -1
  152. package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +5 -0
  153. package/dist/types/components/salla-app-install-alert/salla-app-install-alert.d.ts +3 -1
  154. package/dist/types/components/salla-color-picker/salla-color-picker.d.ts +10 -0
  155. package/dist/types/components/salla-products-list/salla-products-list.d.ts +2 -0
  156. package/package.json +5 -5
  157. package/dist/twilight/p-319d0ee6.entry.js +0 -4
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { h, Host } from "@stencil/core";
4
+ import { h, Host, } from "@stencil/core";
5
5
  import ArrowDown from "../../assets/svg/keyboard_arrow_down.svg";
6
6
  export class SallaColorPicker {
7
7
  constructor() {
@@ -33,6 +33,10 @@ export class SallaColorPicker {
33
33
  * Whether to enable adjusting the alpha channel.
34
34
  */
35
35
  this.enableAlpha = false;
36
+ this.updateViewportCache = () => {
37
+ this.cachedViewportWidth = this.getViewportWidthFromBreakpoints();
38
+ };
39
+ this.cachedViewportWidth = 0; // Will be populated in componentDidLoad via requestAnimationFrame
36
40
  }
37
41
  colorChangeHandler(color) {
38
42
  if (this.colorInput)
@@ -50,7 +54,10 @@ export class SallaColorPicker {
50
54
  this.submitted.emit(color);
51
55
  }
52
56
  popupOpenedHandler(color) {
53
- this.setPopInPosition();
57
+ // Double rAF: defer setPopInPosition (getBoundingClientRect) until after paint to avoid forced reflow
58
+ requestAnimationFrame(() => {
59
+ requestAnimationFrame(() => this.setPopInPosition());
60
+ });
54
61
  this.popupOpened.emit(color);
55
62
  }
56
63
  popupClosedHandler(color) {
@@ -123,26 +130,47 @@ export class SallaColorPicker {
123
130
  this.picker = null;
124
131
  this.pickerReady = null;
125
132
  }
133
+ disconnectedCallback() {
134
+ window.removeEventListener('resize', this.updateViewportCache);
135
+ }
126
136
  componentWillLoad() {
127
137
  salla.onReady(() => {
128
138
  this.color = this.color ? this.color : salla.config.get('theme.color.primary', '#5dd5c4');
129
139
  });
130
140
  }
141
+ /**
142
+ * Returns viewport width from matchMedia breakpoints (no layout read).
143
+ * Must match updateViewportCache breakpoints for consistency.
144
+ */
145
+ getViewportWidthFromBreakpoints() {
146
+ if (typeof window === 'undefined')
147
+ return 1024;
148
+ if (window.matchMedia('(min-width: 1200px)').matches)
149
+ return 1200;
150
+ if (window.matchMedia('(min-width: 992px)').matches)
151
+ return 992;
152
+ if (window.matchMedia('(min-width: 768px)').matches)
153
+ return 768;
154
+ return 375;
155
+ }
131
156
  setPopInPosition() {
157
+ // Use cached viewport width – reading innerWidth at popup open causes forced reflow.
158
+ // Fallback: matchMedia-based value when cache is 0 (e.g. SSR before hydration). Same breakpoints as updateViewportCache.
159
+ const viewportWidth = this.cachedViewportWidth || this.getViewportWidthFromBreakpoints();
132
160
  const popup = this.host.querySelector('.picker_wrapper');
133
161
  const widgetEl = this.host.querySelector('.s-color-picker-widget');
134
162
  if (!popup || !widgetEl)
135
163
  return;
136
164
  const widgetPosition = widgetEl.getBoundingClientRect();
137
- const widgetToWindowEq = window.innerWidth / 2 - widgetPosition.width / 2;
165
+ const widgetToWindowEq = viewportWidth / 2 - widgetPosition.width / 2;
138
166
  const widgetInLeft = widgetToWindowEq > widgetPosition.x;
139
167
  const widgetInRight = widgetToWindowEq < widgetPosition.x;
140
168
  const widgetInCenter = widgetToWindowEq === widgetPosition.x;
141
- const isMobile = window.innerWidth < 768;
169
+ const isMobile = !window.matchMedia('(min-width: 768px)').matches;
142
170
  if (isMobile && widgetInLeft) {
143
171
  popup.style.left = '0';
144
172
  }
145
- if (isMobile && (widgetInRight)) {
173
+ if (isMobile && widgetInRight) {
146
174
  popup.style.left = 'auto';
147
175
  }
148
176
  if (!isMobile || (isMobile && ((!widgetInRight && !widgetInLeft) || widgetInCenter))) {
@@ -150,7 +178,7 @@ export class SallaColorPicker {
150
178
  }
151
179
  }
152
180
  initColorPicker() {
153
- this.pickerReady = import('vanilla-picker').then((mod) => {
181
+ this.pickerReady = import('vanilla-picker').then(mod => {
154
182
  const Picker = mod.default;
155
183
  const picker = new Picker({
156
184
  parent: this.host,
@@ -170,14 +198,17 @@ export class SallaColorPicker {
170
198
  });
171
199
  }
172
200
  render() {
173
- return (h(Host, { key: 'f6a001611bf20e8264346028c848490cf94c686a', class: "s-color-picker-main" }, h("slot", { key: '79648d165d81f200e064c8ef56a138f6b66757ed', name: "widget" }, h("div", { key: '95e7a8b7a92f5bb8f6f05b8cd39e6c91710e52a2', class: "s-color-picker-widget" }, h("div", { key: '24813d1de9a5834cfd37edf7affd4be94608f96c', class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), h("span", { key: '5f29f537140bc4b74431fc33229563cb1b7ce231', innerHTML: ArrowDown }))), h("input", { key: '188a9d7233388fca9a25cd5d319c0973448b07bc', class: "s-hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
201
+ return (h(Host, { key: 'dc90f101197031b0ec17939dc940b527cbb42764', class: "s-color-picker-main" }, h("slot", { key: '504a93f8bba3130a953dbfc1e03420d622247c0f', name: "widget" }, h("div", { key: '7eb60d1353d1fa6edefc400d7851499d083c3000', class: "s-color-picker-widget" }, h("div", { key: '01361959e0beeecd5c4b9ba0210931f3864b9273', class: "s-color-picker-widget-canvas", ref: dv => (this.canvas = dv) }), h("span", { key: '4091ba421758a3af182e7224ffbd74c5ca58166a', innerHTML: ArrowDown }))), h("input", { key: '5302b4da7dc9beaec6ab469175dee79d5b8c5dc5', class: "s-hidden", name: this.name, required: this.required, value: this.color, ref: color => (this.colorInput = color) })));
174
202
  }
175
203
  componentDidLoad() {
176
204
  if (this.canvas)
177
205
  this.canvas.style.backgroundColor = this.color;
178
206
  this.initColorPicker();
207
+ // Populate viewport cache in next frame (avoids forced reflow during initial render)
208
+ requestAnimationFrame(() => this.updateViewportCache());
209
+ window.addEventListener('resize', this.updateViewportCache);
179
210
  if (this.colorInput) {
180
- this.colorInput.addEventListener('invalid', (e) => {
211
+ this.colorInput.addEventListener('invalid', e => {
181
212
  this.invalidInput.emit(e);
182
213
  });
183
214
  this.colorInput.addEventListener('input', () => {
@@ -7,14 +7,16 @@ export class SallaMaintenanceAlert {
7
7
  componentWillLoad() {
8
8
  this.title = salla.config.get('maintenance_details.title');
9
9
  this.message = salla.config.get('maintenance_details.message');
10
- this.buttonTitle = window.innerWidth <= 768 ? salla.config.get('maintenance_details.button_title') : salla.config.get('maintenance_details.button_full_title');
10
+ // Use matchMedia instead of window.innerWidth to avoid forced reflow (Lighthouse/PageSpeed)
11
+ const isMobile = typeof window !== 'undefined' && !window.matchMedia('(min-width: 768px)').matches;
12
+ this.buttonTitle = isMobile ? salla.config.get('maintenance_details.button_title') : salla.config.get('maintenance_details.button_full_title');
11
13
  }
12
14
  closeAlert() {
13
15
  salla.storage.set('hide_salla-maintenance-alert_at', Date.now());
14
16
  this.host.style.display = 'none';
15
17
  }
16
18
  render() {
17
- return (h(Host, { key: 'f307529d9fa1a3cfdf33cc48dea142e274eb4f72', class: "s-maintenance-alert-wrapper" }, h("button", { key: 'a8a8d3d4c03151f9fe468153d4368ab66de0ba5f', class: "s-maintenance-alert-close", innerHTML: Cancel, onClick: () => this.closeAlert() }), h("div", { key: 'f53e7ab72950f72b68eeb5ff6887203e8f6d0dbd', class: "s-maintenance-alert-content" }, h("div", { key: 'c3c69c738da0417114c87b03c49f0a8d36663558', class: "s-maintenance-alert-container" }, h("div", { key: 'af1ec8ff601873c04de610341f15775e05a5d185', class: "s-maintenance-alert-icon" }, h("img", { key: 'a1b6dd0d161749eff7f6e7d4e92fd161896b593b', src: salla.url.cdn('images/alert.png'), alt: "Alert" })), h("div", { key: 'f1f81302bbaf4d83d50770ff1f40416624bde583', class: "s-maintenance-alert-text" }, h("h2", { key: '79eab40b1cf6cf9d307d1e9bda24fe6dd8c03852' }, this.title), h("p", { key: '5bdbe219346851b9aff8c20fd41075853fe6b981' }, this.message))), h("div", { key: '8e2cd9ad611a551ee7960310f11a9f7f07668811' }, h("a", { key: '9658d9a3e82f9719c35caf362601a12a62475508', class: "s-maintenance-alert-btn", href: salla.config.get('maintenance_details.button_url') }, this.buttonTitle)))));
19
+ return (h(Host, { key: '109e687d7d6ba48ddf89cd3631f5a852d50688fd', class: "s-maintenance-alert-wrapper" }, h("button", { key: 'd70e7e53acc699336e1611589ca3bdfc704504c2', class: "s-maintenance-alert-close", innerHTML: Cancel, onClick: () => this.closeAlert() }), h("div", { key: 'b816c1a9635828c206c792d68203ccfbe8e8235b', class: "s-maintenance-alert-content" }, h("div", { key: '61e91088a5613d943b6f662f5ed44093ecf99237', class: "s-maintenance-alert-container" }, h("div", { key: '1ca223334f52bc5097677dd23433107080567894', class: "s-maintenance-alert-icon" }, h("img", { key: '22e07c7a104267cda2bed74929307d039018698d', src: salla.url.cdn('images/alert.png'), alt: "Alert" })), h("div", { key: '64d37700bc1454f5afadb55b49512bbd5b412d9c', class: "s-maintenance-alert-text" }, h("h2", { key: '7651dcd09a0ba07f14ed744758598015d4b45ecd' }, this.title), h("p", { key: '1f8d057af072466f34d0f3a13396de5144bc967f' }, this.message))), h("div", { key: '34f8471b855011b499c2038b1ac9dd24cc5e2e8b' }, h("a", { key: 'd9c4f4a9fb80ab90c13dc1dde69adcb7c4cd7e9f', class: "s-maintenance-alert-btn", href: salla.config.get('maintenance_details.button_url') }, this.buttonTitle)))));
18
20
  }
19
21
  componentDidLoad() {
20
22
  //auto-hide the alert if close button is clicked before one hour
@@ -34,6 +34,8 @@ export class SallaProductsList {
34
34
  this.prevCategoryIdKey = "prevCategoryId";
35
35
  this.isProcessing = false; // Tracks if we are processing data
36
36
  this.scrollTimeout = null;
37
+ this.boundScrollToLastViewedProduct = () => this.scrollToLastViewedProduct();
38
+ this.boundHandleScroll = () => this.handleScroll();
37
39
  this.specialPagesWithoutIds = {
38
40
  'product.index.latest': 'latest',
39
41
  'product.index.offers': 'offers',
@@ -58,11 +60,12 @@ export class SallaProductsList {
58
60
  if ("scrollRestoration" in history)
59
61
  history.scrollRestoration = "manual";
60
62
  // required for scroll restoration case when the component loads before DOM content is completed (slow internet bandwidth /low device specs)
61
- window.addEventListener('DOMContentLoaded', this.scrollToLastViewedProduct.bind(this));
63
+ window.addEventListener('DOMContentLoaded', this.boundScrollToLastViewedProduct);
62
64
  salla.event.on('salla-filters::changed', filters => this.setFilters(filters));
63
65
  }
64
66
  disconnectedCallback() {
65
- window.removeEventListener('DOMContentLoaded', this.scrollToLastViewedProduct);
67
+ window.removeEventListener('DOMContentLoaded', this.boundScrollToLastViewedProduct);
68
+ window.removeEventListener('scroll', this.boundHandleScroll);
66
69
  }
67
70
  /**
68
71
  * Set parsed filters data from URI
@@ -464,7 +467,7 @@ export class SallaProductsList {
464
467
  this.loading(true, this.autoload ? false : true);
465
468
  });
466
469
  // Manual scroll listener
467
- shouldApplyManualLoad && window.addEventListener('scroll', this.handleScroll.bind(this));
470
+ shouldApplyManualLoad && window.addEventListener('scroll', this.boundHandleScroll);
468
471
  this.infiniteScroll?.on('load', async (response) => {
469
472
  if (this.isProcessing)
470
473
  return;
@@ -517,14 +520,17 @@ export class SallaProductsList {
517
520
  return;
518
521
  this.scrollTimeout = setTimeout(() => {
519
522
  this.scrollTimeout = null;
520
- const wrapperRect = this.wrapper.getBoundingClientRect();
521
- const windowHeight = window.innerHeight;
522
- const distanceToBottom = wrapperRect.bottom - windowHeight;
523
- // Trigger only when the wrapper bottom is within 200px of the viewport bottom
524
- if (distanceToBottom <= 200 && !this.isProcessing && this.nextPage) {
525
- // Reached near the bottom of the wrapper, loading next page...
526
- this.manualLoadNextPage();
527
- }
523
+ // Defer layout reads to next frame to avoid forced reflow (Lighthouse/PageSpeed)
524
+ requestAnimationFrame(() => {
525
+ const wrapperRect = this.wrapper.getBoundingClientRect();
526
+ const windowHeight = window.innerHeight;
527
+ const distanceToBottom = wrapperRect.bottom - windowHeight;
528
+ // Trigger only when the wrapper bottom is within 200px of the viewport bottom
529
+ if (distanceToBottom <= 200 && !this.isProcessing && this.nextPage) {
530
+ // Reached near the bottom of the wrapper, loading next page...
531
+ this.manualLoadNextPage();
532
+ }
533
+ });
528
534
  }, 200);
529
535
  }
530
536
  manualLoadNextPage() {