@depict-ai/ui 3.0.19 → 3.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.cjs CHANGED
@@ -83,7 +83,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
83
83
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
84
84
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
85
85
  /*! Depict.ai search and product listing SDK */
86
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.19";
86
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.21";
87
87
  const $9d19451330d04c3c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
88
88
  function $9d19451330d04c3c$export$8be2714ec7f169ee() {
89
89
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -6327,7 +6327,8 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
6327
6327
  of_: of_
6328
6328
  },
6329
6329
  get_scroll_position_ = () => scrollY,
6330
- listen_to_scroll_on_: listen_to_scroll_on_
6330
+ listen_to_scroll_on_: listen_to_scroll_on_,
6331
+ velocity_too_fast_ = 1.5
6331
6332
  } = _ref;
6332
6333
  if (0, $52FdA$solidjsweb.isServer) return; // won't show in initial render and need scroll position
6333
6334
  const [first_to_show, set_first_to_show] = $52FdA$solidjs.createSignal(0);
@@ -6335,6 +6336,7 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
6335
6336
  const [count_to_show, set_count_to_show] = $52FdA$solidjs.createSignal("");
6336
6337
  const [permitted_to_show, set_permitted_to_show] = $52FdA$solidjs.createSignal(false); // due to scroll speed
6337
6338
  const [show_triggered, set_show_triggered] = $52FdA$solidjs.createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
6339
+ const [times_too_fast, set_times_too_fast] = $52FdA$solidjs.createSignal(0);
6338
6340
  const modified_price_formatting_ = $52FdA$solidjs.createMemo(() => ({
6339
6341
  ...price_formatting_(),
6340
6342
  places_after_comma_: 0
@@ -6344,25 +6346,27 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
6344
6346
  let last_pos_time = +new Date();
6345
6347
  let last_pos = get_scroll_position_();
6346
6348
  let unpermit_when_possible = false;
6347
- let times_too_fast = 0;
6348
6349
  const handle_scrollpos_change = () => {
6349
6350
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
6350
6351
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
6351
6352
  const now = +new Date();
6352
6353
  const age_of_distance = now - last_pos_time;
6353
6354
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
6354
- if (velocity > 1.5) {
6355
- times_too_fast++;
6356
- setTimeout(() => times_too_fast--, 1000);
6355
+ if (velocity > velocity_too_fast_) {
6356
+ set_times_too_fast(prev => prev + 1);
6357
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
6357
6358
  }
6358
- if (times_too_fast > 10) {
6359
- set_permitted_to_show(true);
6360
- unpermit_when_possible = false;
6361
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
6362
6359
  last_pos_time = now;
6363
6360
  last_pos = get_scroll_position_();
6364
6361
  };
6365
6362
  $1689794f03ba2554$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
6363
+ $52FdA$solidjs.createComputed(() => {
6364
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
6365
+ if (times_too_fast() > 10) {
6366
+ set_permitted_to_show(true);
6367
+ unpermit_when_possible = false;
6368
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
6369
+ });
6366
6370
  $52FdA$solidjs.createEffect(() => {
6367
6371
  show_triggered();
6368
6372
  const first = get_first_result_in_viewport();
@@ -7259,8 +7263,10 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
7259
7263
  // Put scroll status into slider container, so it's centered relatively to the products
7260
7264
  const rendered_scroll_status = ConfiguredScrollStatus({
7261
7265
  get_scroll_position_: () => insert_here.scrollLeft,
7262
- listen_to_scroll_on_: insert_here
7266
+ listen_to_scroll_on_: insert_here,
7267
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
7263
7268
  });
7269
+
7264
7270
  const non_solid_nodes = [...container.childNodes];
7265
7271
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
7266
7272
  $52FdA$solidjsweb.insert(container, $52FdA$solidjs.createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
package/ES10/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.19";
13
+ export const version = "3.0.21";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
package/ES10/index.js CHANGED
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.19";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.21";
14
14
  const $ca6ab5f08bd28bca$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
15
15
  function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
16
16
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -6254,7 +6254,8 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
6254
6254
  of_: of_
6255
6255
  },
6256
6256
  get_scroll_position_ = () => scrollY,
6257
- listen_to_scroll_on_: listen_to_scroll_on_
6257
+ listen_to_scroll_on_: listen_to_scroll_on_,
6258
+ velocity_too_fast_ = 1.5
6258
6259
  } = _ref;
6259
6260
  if (0, $8tj43$isServer) return; // won't show in initial render and need scroll position
6260
6261
  const [first_to_show, set_first_to_show] = $8tj43$createSignal(0);
@@ -6262,6 +6263,7 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
6262
6263
  const [count_to_show, set_count_to_show] = $8tj43$createSignal("");
6263
6264
  const [permitted_to_show, set_permitted_to_show] = $8tj43$createSignal(false); // due to scroll speed
6264
6265
  const [show_triggered, set_show_triggered] = $8tj43$createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
6266
+ const [times_too_fast, set_times_too_fast] = $8tj43$createSignal(0);
6265
6267
  const modified_price_formatting_ = $8tj43$createMemo(() => ({
6266
6268
  ...price_formatting_(),
6267
6269
  places_after_comma_: 0
@@ -6271,25 +6273,27 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
6271
6273
  let last_pos_time = +new Date();
6272
6274
  let last_pos = get_scroll_position_();
6273
6275
  let unpermit_when_possible = false;
6274
- let times_too_fast = 0;
6275
6276
  const handle_scrollpos_change = () => {
6276
6277
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
6277
6278
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
6278
6279
  const now = +new Date();
6279
6280
  const age_of_distance = now - last_pos_time;
6280
6281
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
6281
- if (velocity > 1.5) {
6282
- times_too_fast++;
6283
- setTimeout(() => times_too_fast--, 1000);
6282
+ if (velocity > velocity_too_fast_) {
6283
+ set_times_too_fast(prev => prev + 1);
6284
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
6284
6285
  }
6285
- if (times_too_fast > 10) {
6286
- set_permitted_to_show(true);
6287
- unpermit_when_possible = false;
6288
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
6289
6286
  last_pos_time = now;
6290
6287
  last_pos = get_scroll_position_();
6291
6288
  };
6292
6289
  $33e7d1906c93db7d$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
6290
+ $8tj43$createComputed(() => {
6291
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
6292
+ if (times_too_fast() > 10) {
6293
+ set_permitted_to_show(true);
6294
+ unpermit_when_possible = false;
6295
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
6296
+ });
6293
6297
  $8tj43$createEffect(() => {
6294
6298
  show_triggered();
6295
6299
  const first = get_first_result_in_viewport();
@@ -7186,8 +7190,10 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
7186
7190
  // Put scroll status into slider container, so it's centered relatively to the products
7187
7191
  const rendered_scroll_status = ConfiguredScrollStatus({
7188
7192
  get_scroll_position_: () => insert_here.scrollLeft,
7189
- listen_to_scroll_on_: insert_here
7193
+ listen_to_scroll_on_: insert_here,
7194
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
7190
7195
  });
7196
+
7191
7197
  const non_solid_nodes = [...container.childNodes];
7192
7198
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
7193
7199
  $8tj43$insert(container, $8tj43$createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
package/README.md CHANGED
@@ -9,4 +9,4 @@ Breaking changes:
9
9
  - 1.3.0 moved `depict-filter-sort-mobile-modal-container` from being a class to being an id
10
10
  - 1.4.0 Added `brand_` translation string to Locale.
11
11
  - 2.0.0 Made `enable_content_search` `true` by default. Redesigned filter counts.
12
- - 3.0.15 (first `latest` tagged release of version 3): Please see this [migration guide](https://docs.depict.ai/other-guides/sdk-migration-v2-v3)
12
+ - 3.0.19 (first `latest` tagged release of version 3): Please see this [migration guide](https://docs.depict.ai/other-guides/sdk-migration-v2-v3)
package/latest/index.cjs CHANGED
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
77
77
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
78
78
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
79
79
  /*! Depict.ai search and product listing SDK */
80
- const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.19";
80
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.21";
81
81
  const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
82
82
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
83
83
  return (() => {
@@ -5918,7 +5918,8 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5918
5918
  of_: of_
5919
5919
  },
5920
5920
  get_scroll_position_ = () => scrollY,
5921
- listen_to_scroll_on_: listen_to_scroll_on_
5921
+ listen_to_scroll_on_: listen_to_scroll_on_,
5922
+ velocity_too_fast_ = 1.5
5922
5923
  }) {
5923
5924
  if (0, $gVhhF$solidjsweb.isServer) return; // won't show in initial render and need scroll position
5924
5925
  const [first_to_show, set_first_to_show] = $gVhhF$solidjs.createSignal(0);
@@ -5926,6 +5927,7 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5926
5927
  const [count_to_show, set_count_to_show] = $gVhhF$solidjs.createSignal("");
5927
5928
  const [permitted_to_show, set_permitted_to_show] = $gVhhF$solidjs.createSignal(false); // due to scroll speed
5928
5929
  const [show_triggered, set_show_triggered] = $gVhhF$solidjs.createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
5930
+ const [times_too_fast, set_times_too_fast] = $gVhhF$solidjs.createSignal(0);
5929
5931
  const modified_price_formatting_ = $gVhhF$solidjs.createMemo(() => ({
5930
5932
  ...price_formatting_(),
5931
5933
  places_after_comma_: 0
@@ -5935,25 +5937,27 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5935
5937
  let last_pos_time = +new Date();
5936
5938
  let last_pos = get_scroll_position_();
5937
5939
  let unpermit_when_possible = false;
5938
- let times_too_fast = 0;
5939
5940
  const handle_scrollpos_change = () => {
5940
5941
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
5941
5942
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5942
5943
  const now = +new Date();
5943
5944
  const age_of_distance = now - last_pos_time;
5944
5945
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
5945
- if (velocity > 1.5) {
5946
- times_too_fast++;
5947
- setTimeout(() => times_too_fast--, 1000);
5946
+ if (velocity > velocity_too_fast_) {
5947
+ set_times_too_fast(prev => prev + 1);
5948
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
5948
5949
  }
5949
- if (times_too_fast > 10) {
5950
- set_permitted_to_show(true);
5951
- unpermit_when_possible = false;
5952
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5953
5950
  last_pos_time = now;
5954
5951
  last_pos = get_scroll_position_();
5955
5952
  };
5956
5953
  $76b6ac05693f5c71$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5954
+ $gVhhF$solidjs.createComputed(() => {
5955
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
5956
+ if (times_too_fast() > 10) {
5957
+ set_permitted_to_show(true);
5958
+ unpermit_when_possible = false;
5959
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5960
+ });
5957
5961
  $gVhhF$solidjs.createEffect(() => {
5958
5962
  show_triggered();
5959
5963
  const first = get_first_result_in_viewport();
@@ -6815,8 +6819,10 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
6815
6819
  // Put scroll status into slider container, so it's centered relatively to the products
6816
6820
  const rendered_scroll_status = ConfiguredScrollStatus({
6817
6821
  get_scroll_position_: () => insert_here.scrollLeft,
6818
- listen_to_scroll_on_: insert_here
6822
+ listen_to_scroll_on_: insert_here,
6823
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
6819
6824
  });
6825
+
6820
6826
  const non_solid_nodes = [...container.childNodes];
6821
6827
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
6822
6828
  $gVhhF$solidjsweb.insert(container, $gVhhF$solidjs.createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
package/latest/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.19";
13
+ export const version = "3.0.21";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
package/latest/index.js CHANGED
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.19";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.21";
11
11
  const $fbbadcb080ad1d4a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
12
12
  function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
13
13
  return (() => {
@@ -5848,7 +5848,8 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
5848
5848
  of_: of_
5849
5849
  },
5850
5850
  get_scroll_position_ = () => scrollY,
5851
- listen_to_scroll_on_: listen_to_scroll_on_
5851
+ listen_to_scroll_on_: listen_to_scroll_on_,
5852
+ velocity_too_fast_ = 1.5
5852
5853
  }) {
5853
5854
  if (0, $9HbP8$isServer) return; // won't show in initial render and need scroll position
5854
5855
  const [first_to_show, set_first_to_show] = $9HbP8$createSignal(0);
@@ -5856,6 +5857,7 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
5856
5857
  const [count_to_show, set_count_to_show] = $9HbP8$createSignal("");
5857
5858
  const [permitted_to_show, set_permitted_to_show] = $9HbP8$createSignal(false); // due to scroll speed
5858
5859
  const [show_triggered, set_show_triggered] = $9HbP8$createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
5860
+ const [times_too_fast, set_times_too_fast] = $9HbP8$createSignal(0);
5859
5861
  const modified_price_formatting_ = $9HbP8$createMemo(() => ({
5860
5862
  ...price_formatting_(),
5861
5863
  places_after_comma_: 0
@@ -5865,25 +5867,27 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
5865
5867
  let last_pos_time = +new Date();
5866
5868
  let last_pos = get_scroll_position_();
5867
5869
  let unpermit_when_possible = false;
5868
- let times_too_fast = 0;
5869
5870
  const handle_scrollpos_change = () => {
5870
5871
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
5871
5872
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5872
5873
  const now = +new Date();
5873
5874
  const age_of_distance = now - last_pos_time;
5874
5875
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
5875
- if (velocity > 1.5) {
5876
- times_too_fast++;
5877
- setTimeout(() => times_too_fast--, 1000);
5876
+ if (velocity > velocity_too_fast_) {
5877
+ set_times_too_fast(prev => prev + 1);
5878
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
5878
5879
  }
5879
- if (times_too_fast > 10) {
5880
- set_permitted_to_show(true);
5881
- unpermit_when_possible = false;
5882
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5883
5880
  last_pos_time = now;
5884
5881
  last_pos = get_scroll_position_();
5885
5882
  };
5886
5883
  $8f9120a1ca151e6a$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5884
+ $9HbP8$createComputed(() => {
5885
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
5886
+ if (times_too_fast() > 10) {
5887
+ set_permitted_to_show(true);
5888
+ unpermit_when_possible = false;
5889
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5890
+ });
5887
5891
  $9HbP8$createEffect(() => {
5888
5892
  show_triggered();
5889
5893
  const first = get_first_result_in_viewport();
@@ -6745,8 +6749,10 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
6745
6749
  // Put scroll status into slider container, so it's centered relatively to the products
6746
6750
  const rendered_scroll_status = ConfiguredScrollStatus({
6747
6751
  get_scroll_position_: () => insert_here.scrollLeft,
6748
- listen_to_scroll_on_: insert_here
6752
+ listen_to_scroll_on_: insert_here,
6753
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
6749
6754
  });
6755
+
6750
6756
  const non_solid_nodes = [...container.childNodes];
6751
6757
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
6752
6758
  $9HbP8$insert(container, $9HbP8$createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "3.0.19",
3
+ "version": "3.0.21",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -236,9 +236,9 @@
236
236
  "@babel/plugin-transform-typescript": "^7.22.9",
237
237
  "@babel/runtime": "latest",
238
238
  "@babel/runtime-corejs3": "^7.22.6",
239
- "@depict-ai/plp-styling": "^2.0.4",
239
+ "@depict-ai/plp-styling": "^2.0.6",
240
240
  "@depict-ai/types": "^5.0.3",
241
- "@depict-ai/utilishared": "^2.0.7",
241
+ "@depict-ai/utilishared": "^2.0.8",
242
242
  "solid-js": "^1.8.1"
243
243
  },
244
244
  "type": "module",
@@ -83,7 +83,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
83
83
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
84
84
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
85
85
  /*! Depict.ai search and product listing SDK */
86
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.19";
86
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.21";
87
87
  const $9d19451330d04c3c$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
88
88
  function $9d19451330d04c3c$export$8be2714ec7f169ee() {
89
89
  var _$escape2, _$escape3;
@@ -5242,7 +5242,8 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
5242
5242
  of_: of_
5243
5243
  },
5244
5244
  get_scroll_position_ = () => scrollY,
5245
- listen_to_scroll_on_: listen_to_scroll_on_
5245
+ listen_to_scroll_on_: listen_to_scroll_on_,
5246
+ velocity_too_fast_ = 1.5
5246
5247
  } = _ref;
5247
5248
  if (0, $3hooq$solidjsweb.isServer) return; // won't show in initial render and need scroll position
5248
5249
  const [first_to_show, set_first_to_show] = $3hooq$solidjs.createSignal(0);
@@ -5250,6 +5251,7 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
5250
5251
  const [count_to_show, set_count_to_show] = $3hooq$solidjs.createSignal("");
5251
5252
  const [permitted_to_show, set_permitted_to_show] = $3hooq$solidjs.createSignal(false); // due to scroll speed
5252
5253
  const [show_triggered, set_show_triggered] = $3hooq$solidjs.createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
5254
+ const [times_too_fast, set_times_too_fast] = $3hooq$solidjs.createSignal(0);
5253
5255
  const modified_price_formatting_ = $3hooq$solidjs.createMemo(() => ({
5254
5256
  ...price_formatting_(),
5255
5257
  places_after_comma_: 0
@@ -5259,25 +5261,27 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
5259
5261
  let last_pos_time = +new Date();
5260
5262
  let last_pos = get_scroll_position_();
5261
5263
  let unpermit_when_possible = false;
5262
- let times_too_fast = 0;
5263
5264
  const handle_scrollpos_change = () => {
5264
5265
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
5265
5266
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5266
5267
  const now = +new Date();
5267
5268
  const age_of_distance = now - last_pos_time;
5268
5269
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
5269
- if (velocity > 1.5) {
5270
- times_too_fast++;
5271
- setTimeout(() => times_too_fast--, 1000);
5270
+ if (velocity > velocity_too_fast_) {
5271
+ set_times_too_fast(prev => prev + 1);
5272
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
5272
5273
  }
5273
- if (times_too_fast > 10) {
5274
- set_permitted_to_show(true);
5275
- unpermit_when_possible = false;
5276
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5277
5274
  last_pos_time = now;
5278
5275
  last_pos = get_scroll_position_();
5279
5276
  };
5280
5277
  $1689794f03ba2554$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5278
+ $3hooq$solidjs.createComputed(() => {
5279
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
5280
+ if (times_too_fast() > 10) {
5281
+ set_permitted_to_show(true);
5282
+ unpermit_when_possible = false;
5283
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5284
+ });
5281
5285
  $3hooq$solidjs.createEffect(() => {
5282
5286
  show_triggered();
5283
5287
  const first = get_first_result_in_viewport();
@@ -6102,8 +6106,10 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
6102
6106
  // Put scroll status into slider container, so it's centered relatively to the products
6103
6107
  const rendered_scroll_status = ConfiguredScrollStatus({
6104
6108
  get_scroll_position_: () => insert_here.scrollLeft,
6105
- listen_to_scroll_on_: insert_here
6109
+ listen_to_scroll_on_: insert_here,
6110
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
6106
6111
  });
6112
+
6107
6113
  const non_solid_nodes = [...container.childNodes];
6108
6114
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
6109
6115
  $3hooq$solidjsweb.insert(container, $3hooq$solidjs.createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.19";
13
+ export const version = "3.0.21";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
@@ -10,7 +10,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.19";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.21";
14
14
  const $ca6ab5f08bd28bca$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
15
15
  function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
16
16
  var _$escape2, _$escape3;
@@ -5169,7 +5169,8 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
5169
5169
  of_: of_
5170
5170
  },
5171
5171
  get_scroll_position_ = () => scrollY,
5172
- listen_to_scroll_on_: listen_to_scroll_on_
5172
+ listen_to_scroll_on_: listen_to_scroll_on_,
5173
+ velocity_too_fast_ = 1.5
5173
5174
  } = _ref;
5174
5175
  if (0, $b8hua$isServer) return; // won't show in initial render and need scroll position
5175
5176
  const [first_to_show, set_first_to_show] = $b8hua$createSignal(0);
@@ -5177,6 +5178,7 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
5177
5178
  const [count_to_show, set_count_to_show] = $b8hua$createSignal("");
5178
5179
  const [permitted_to_show, set_permitted_to_show] = $b8hua$createSignal(false); // due to scroll speed
5179
5180
  const [show_triggered, set_show_triggered] = $b8hua$createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
5181
+ const [times_too_fast, set_times_too_fast] = $b8hua$createSignal(0);
5180
5182
  const modified_price_formatting_ = $b8hua$createMemo(() => ({
5181
5183
  ...price_formatting_(),
5182
5184
  places_after_comma_: 0
@@ -5186,25 +5188,27 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
5186
5188
  let last_pos_time = +new Date();
5187
5189
  let last_pos = get_scroll_position_();
5188
5190
  let unpermit_when_possible = false;
5189
- let times_too_fast = 0;
5190
5191
  const handle_scrollpos_change = () => {
5191
5192
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
5192
5193
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5193
5194
  const now = +new Date();
5194
5195
  const age_of_distance = now - last_pos_time;
5195
5196
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
5196
- if (velocity > 1.5) {
5197
- times_too_fast++;
5198
- setTimeout(() => times_too_fast--, 1000);
5197
+ if (velocity > velocity_too_fast_) {
5198
+ set_times_too_fast(prev => prev + 1);
5199
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
5199
5200
  }
5200
- if (times_too_fast > 10) {
5201
- set_permitted_to_show(true);
5202
- unpermit_when_possible = false;
5203
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5204
5201
  last_pos_time = now;
5205
5202
  last_pos = get_scroll_position_();
5206
5203
  };
5207
5204
  $33e7d1906c93db7d$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5205
+ $b8hua$createComputed(() => {
5206
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
5207
+ if (times_too_fast() > 10) {
5208
+ set_permitted_to_show(true);
5209
+ unpermit_when_possible = false;
5210
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5211
+ });
5208
5212
  $b8hua$createEffect(() => {
5209
5213
  show_triggered();
5210
5214
  const first = get_first_result_in_viewport();
@@ -6029,8 +6033,10 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
6029
6033
  // Put scroll status into slider container, so it's centered relatively to the products
6030
6034
  const rendered_scroll_status = ConfiguredScrollStatus({
6031
6035
  get_scroll_position_: () => insert_here.scrollLeft,
6032
- listen_to_scroll_on_: insert_here
6036
+ listen_to_scroll_on_: insert_here,
6037
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
6033
6038
  });
6039
+
6034
6040
  const non_solid_nodes = [...container.childNodes];
6035
6041
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
6036
6042
  $b8hua$insert(container, $b8hua$createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
77
77
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
78
78
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
79
79
  /*! Depict.ai search and product listing SDK */
80
- const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.19";
80
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.21";
81
81
  const $0f313083912e447a$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
82
82
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
83
83
  return $5vyXB$solidjsweb.ssr($0f313083912e447a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("width", $5vyXB$solidjsweb.escape(props.width_, true) ?? 14, false) + $5vyXB$solidjsweb.ssrAttribute("height", $5vyXB$solidjsweb.escape(props.height_, true) ?? 26, false));
@@ -4876,7 +4876,8 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
4876
4876
  of_: of_
4877
4877
  },
4878
4878
  get_scroll_position_ = () => scrollY,
4879
- listen_to_scroll_on_: listen_to_scroll_on_
4879
+ listen_to_scroll_on_: listen_to_scroll_on_,
4880
+ velocity_too_fast_ = 1.5
4880
4881
  }) {
4881
4882
  if (0, $5vyXB$solidjsweb.isServer) return; // won't show in initial render and need scroll position
4882
4883
  const [first_to_show, set_first_to_show] = $5vyXB$solidjs.createSignal(0);
@@ -4884,6 +4885,7 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
4884
4885
  const [count_to_show, set_count_to_show] = $5vyXB$solidjs.createSignal("");
4885
4886
  const [permitted_to_show, set_permitted_to_show] = $5vyXB$solidjs.createSignal(false); // due to scroll speed
4886
4887
  const [show_triggered, set_show_triggered] = $5vyXB$solidjs.createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
4888
+ const [times_too_fast, set_times_too_fast] = $5vyXB$solidjs.createSignal(0);
4887
4889
  const modified_price_formatting_ = $5vyXB$solidjs.createMemo(() => ({
4888
4890
  ...price_formatting_(),
4889
4891
  places_after_comma_: 0
@@ -4893,25 +4895,27 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
4893
4895
  let last_pos_time = +new Date();
4894
4896
  let last_pos = get_scroll_position_();
4895
4897
  let unpermit_when_possible = false;
4896
- let times_too_fast = 0;
4897
4898
  const handle_scrollpos_change = () => {
4898
4899
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
4899
4900
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
4900
4901
  const now = +new Date();
4901
4902
  const age_of_distance = now - last_pos_time;
4902
4903
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
4903
- if (velocity > 1.5) {
4904
- times_too_fast++;
4905
- setTimeout(() => times_too_fast--, 1000);
4904
+ if (velocity > velocity_too_fast_) {
4905
+ set_times_too_fast(prev => prev + 1);
4906
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
4906
4907
  }
4907
- if (times_too_fast > 10) {
4908
- set_permitted_to_show(true);
4909
- unpermit_when_possible = false;
4910
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
4911
4908
  last_pos_time = now;
4912
4909
  last_pos = get_scroll_position_();
4913
4910
  };
4914
4911
  $76b6ac05693f5c71$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
4912
+ $5vyXB$solidjs.createComputed(() => {
4913
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
4914
+ if (times_too_fast() > 10) {
4915
+ set_permitted_to_show(true);
4916
+ unpermit_when_possible = false;
4917
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
4918
+ });
4915
4919
  $5vyXB$solidjs.createEffect(() => {
4916
4920
  show_triggered();
4917
4921
  const first = get_first_result_in_viewport();
@@ -5701,8 +5705,10 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
5701
5705
  // Put scroll status into slider container, so it's centered relatively to the products
5702
5706
  const rendered_scroll_status = ConfiguredScrollStatus({
5703
5707
  get_scroll_position_: () => insert_here.scrollLeft,
5704
- listen_to_scroll_on_: insert_here
5708
+ listen_to_scroll_on_: insert_here,
5709
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
5705
5710
  });
5711
+
5706
5712
  const non_solid_nodes = [...container.childNodes];
5707
5713
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
5708
5714
  $5vyXB$solidjsweb.insert(container, $5vyXB$solidjs.createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.19";
13
+ export const version = "3.0.21";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
@@ -7,7 +7,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.19";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.21";
11
11
  const $fbbadcb080ad1d4a$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
12
12
  function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
13
13
  return $i7OB2$ssr($fbbadcb080ad1d4a$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("width", $i7OB2$escape(props.width_, true) ?? 14, false) + $i7OB2$ssrAttribute("height", $i7OB2$escape(props.height_, true) ?? 26, false));
@@ -4806,7 +4806,8 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
4806
4806
  of_: of_
4807
4807
  },
4808
4808
  get_scroll_position_ = () => scrollY,
4809
- listen_to_scroll_on_: listen_to_scroll_on_
4809
+ listen_to_scroll_on_: listen_to_scroll_on_,
4810
+ velocity_too_fast_ = 1.5
4810
4811
  }) {
4811
4812
  if (0, $i7OB2$isServer) return; // won't show in initial render and need scroll position
4812
4813
  const [first_to_show, set_first_to_show] = $i7OB2$createSignal(0);
@@ -4814,6 +4815,7 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
4814
4815
  const [count_to_show, set_count_to_show] = $i7OB2$createSignal("");
4815
4816
  const [permitted_to_show, set_permitted_to_show] = $i7OB2$createSignal(false); // due to scroll speed
4816
4817
  const [show_triggered, set_show_triggered] = $i7OB2$createSignal(false); // signal to just switch between true/false to trigger a new animation which will persist the indicator
4818
+ const [times_too_fast, set_times_too_fast] = $i7OB2$createSignal(0);
4817
4819
  const modified_price_formatting_ = $i7OB2$createMemo(() => ({
4818
4820
  ...price_formatting_(),
4819
4821
  places_after_comma_: 0
@@ -4823,25 +4825,27 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
4823
4825
  let last_pos_time = +new Date();
4824
4826
  let last_pos = get_scroll_position_();
4825
4827
  let unpermit_when_possible = false;
4826
- let times_too_fast = 0;
4827
4828
  const handle_scrollpos_change = () => {
4828
4829
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
4829
4830
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
4830
4831
  const now = +new Date();
4831
4832
  const age_of_distance = now - last_pos_time;
4832
4833
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
4833
- if (velocity > 1.5) {
4834
- times_too_fast++;
4835
- setTimeout(() => times_too_fast--, 1000);
4834
+ if (velocity > velocity_too_fast_) {
4835
+ set_times_too_fast(prev => prev + 1);
4836
+ setTimeout(() => set_times_too_fast(prev => prev - 1), 1000);
4836
4837
  }
4837
- if (times_too_fast > 10) {
4838
- set_permitted_to_show(true);
4839
- unpermit_when_possible = false;
4840
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
4841
4838
  last_pos_time = now;
4842
4839
  last_pos = get_scroll_position_();
4843
4840
  };
4844
4841
  $8f9120a1ca151e6a$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
4842
+ $i7OB2$createComputed(() => {
4843
+ // We need to set this reactively to ensure that it's forbidden to show even when times_too_fast has tapered off after a few seconds, see https://github.com/depict-org/depict/pull/82
4844
+ if (times_too_fast() > 10) {
4845
+ set_permitted_to_show(true);
4846
+ unpermit_when_possible = false;
4847
+ } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
4848
+ });
4845
4849
  $i7OB2$createEffect(() => {
4846
4850
  show_triggered();
4847
4851
  const first = get_first_result_in_viewport();
@@ -5631,8 +5635,10 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5631
5635
  // Put scroll status into slider container, so it's centered relatively to the products
5632
5636
  const rendered_scroll_status = ConfiguredScrollStatus({
5633
5637
  get_scroll_position_: () => insert_here.scrollLeft,
5634
- listen_to_scroll_on_: insert_here
5638
+ listen_to_scroll_on_: insert_here,
5639
+ velocity_too_fast_: 3 // Require twice as hard scrolling to show ScrollStatus in slider since it's easier to scroll fast there
5635
5640
  });
5641
+
5636
5642
  const non_solid_nodes = [...container.childNodes];
5637
5643
  // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
5638
5644
  $i7OB2$insert(container, $i7OB2$createMemo(() => [...non_solid_nodes, rendered_scroll_status]));