@depict-ai/ui 3.0.18 → 3.0.20

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.18";
86
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.20";
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] : {};
@@ -2234,7 +2234,8 @@ function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
2234
2234
  disable_fading_: true,
2235
2235
  slider_ref_: slider => {
2236
2236
  const {
2237
- insert_here: insert_here
2237
+ insert_here: insert_here,
2238
+ container: container
2238
2239
  } = slider;
2239
2240
  const Layout = props => $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, insert_here, true);
2240
2241
  // Do like this, so we don't have to call mergeProps ourselves
@@ -2244,6 +2245,7 @@ function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
2244
2245
  }, layout_options_));
2245
2246
  $52FdA$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
2246
2247
  insert_here.before($8edd3cf30d1fd8b4$export$a2cc176055f8f08());
2248
+ container.classList.add("products");
2247
2249
  },
2248
2250
  get children() {
2249
2251
  return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
@@ -6325,7 +6327,8 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
6325
6327
  of_: of_
6326
6328
  },
6327
6329
  get_scroll_position_ = () => scrollY,
6328
- listen_to_scroll_on_: listen_to_scroll_on_
6330
+ listen_to_scroll_on_: listen_to_scroll_on_,
6331
+ velocity_too_fast_ = 1.5
6329
6332
  } = _ref;
6330
6333
  if (0, $52FdA$solidjsweb.isServer) return; // won't show in initial render and need scroll position
6331
6334
  const [first_to_show, set_first_to_show] = $52FdA$solidjs.createSignal(0);
@@ -6333,6 +6336,7 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
6333
6336
  const [count_to_show, set_count_to_show] = $52FdA$solidjs.createSignal("");
6334
6337
  const [permitted_to_show, set_permitted_to_show] = $52FdA$solidjs.createSignal(false); // due to scroll speed
6335
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);
6336
6340
  const modified_price_formatting_ = $52FdA$solidjs.createMemo(() => ({
6337
6341
  ...price_formatting_(),
6338
6342
  places_after_comma_: 0
@@ -6342,25 +6346,27 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
6342
6346
  let last_pos_time = +new Date();
6343
6347
  let last_pos = get_scroll_position_();
6344
6348
  let unpermit_when_possible = false;
6345
- let times_too_fast = 0;
6346
6349
  const handle_scrollpos_change = () => {
6347
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
6348
6351
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
6349
6352
  const now = +new Date();
6350
6353
  const age_of_distance = now - last_pos_time;
6351
6354
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
6352
- if (velocity > 1.5) {
6353
- times_too_fast++;
6354
- 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);
6355
6358
  }
6356
- if (times_too_fast > 10) {
6357
- set_permitted_to_show(true);
6358
- unpermit_when_possible = false;
6359
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
6360
6359
  last_pos_time = now;
6361
6360
  last_pos = get_scroll_position_();
6362
6361
  };
6363
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
+ });
6364
6370
  $52FdA$solidjs.createEffect(() => {
6365
6371
  show_triggered();
6366
6372
  const first = get_first_result_in_viewport();
@@ -7243,6 +7249,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
7243
7249
  }
7244
7250
  }));
7245
7251
  insert_here.classList.add("generated-spacing");
7252
+ container.classList.add("products");
7246
7253
  $52FdA$solidjs.createEffect(
7247
7254
  // @ts-ignore
7248
7255
  $52FdA$solidjs.on(query_base_, () => insert_here.scrollTo({
@@ -7256,13 +7263,13 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
7256
7263
  // Put scroll status into slider container, so it's centered relatively to the products
7257
7264
  const rendered_scroll_status = ConfiguredScrollStatus({
7258
7265
  get_scroll_position_: () => insert_here.scrollLeft,
7259
- 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
7260
7268
  });
7261
- const {
7262
- childNodes: childNodes
7263
- } = container;
7269
+
7270
+ const non_solid_nodes = [...container.childNodes];
7264
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
7265
- $52FdA$solidjsweb.insert(container, $52FdA$solidjs.createMemo(() => [...childNodes, rendered_scroll_status]));
7272
+ $52FdA$solidjsweb.insert(container, $52FdA$solidjs.createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
7266
7273
  }
7267
7274
  },
7268
7275
  children: listing_contents
@@ -8897,7 +8904,7 @@ function $eef41d50f07bf19a$export$d31a1a1a83ad9413(plp_results_, _ref) {
8897
8904
  const $ede6c70ecdca46fe$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=product-count><!$><!/> <!$><!/>`),
8898
8905
  $ede6c70ecdca46fe$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
8899
8906
  $ede6c70ecdca46fe$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
8900
- $ede6c70ecdca46fe$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/>`);
8907
+ $ede6c70ecdca46fe$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/>`);
8901
8908
  function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
8902
8909
  let {
8903
8910
  depict_api_: depict_api_,
@@ -9196,9 +9203,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
9196
9203
  _el$25 = _el$24.nextSibling,
9197
9204
  [_el$26, _co$10] = $52FdA$solidjsweb.getNextMarker(_el$25.nextSibling),
9198
9205
  _el$27 = _el$14.nextSibling,
9199
- [_el$28, _co$11] = $52FdA$solidjsweb.getNextMarker(_el$27.nextSibling),
9200
- _el$29 = _el$28.nextSibling,
9201
- [_el$30, _co$12] = $52FdA$solidjsweb.getNextMarker(_el$29.nextSibling);
9206
+ [_el$28, _co$11] = $52FdA$solidjsweb.getNextMarker(_el$27.nextSibling);
9202
9207
  $52FdA$solidjsweb.use(el => process.env.NODE_ENV === "development" && $c3a7faae6f2b93c9$export$7af06a63c5a976c9(el, id_to_query_for_, i18n_), _el$13);
9203
9208
  $52FdA$solidjsweb.insert(_el$14, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
9204
9209
  get when() {
@@ -9292,25 +9297,25 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
9292
9297
  }), _el$26, _co$10);
9293
9298
  $52FdA$solidjsweb.insert(_el$13, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
9294
9299
  get when() {
9295
- return layout_options_().layout === "grid";
9300
+ var _layout_options_$layo;
9301
+ return !((_layout_options_$layo = layout_options_().layout) !== null && _layout_options_$layo !== void 0 && _layout_options_$layo.startsWith("slider"));
9296
9302
  },
9297
9303
  get children() {
9298
- return $52FdA$solidjsweb.createComponent(ConfiguredScrollStatus, {});
9304
+ return [$52FdA$solidjsweb.createComponent(ConfiguredScrollStatus, {}), $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
9305
+ severity_: "error",
9306
+ message_: "Floating buttons failed",
9307
+ get children() {
9308
+ return $b7cbae23560f11b9$export$b23abd26de154ede({
9309
+ search_filters_open_: category_filters_open_,
9310
+ search_sorting_open_: category_sorting_open_,
9311
+ current_sorting_: current_sorting_,
9312
+ sort_and_filter_element_: sort_and_filter_element_,
9313
+ i18n_: i18n_
9314
+ });
9315
+ }
9316
+ })];
9299
9317
  }
9300
9318
  }), _el$28, _co$11);
9301
- $52FdA$solidjsweb.insert(_el$13, $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
9302
- severity_: "error",
9303
- message_: "Floating buttons failed",
9304
- get children() {
9305
- return $b7cbae23560f11b9$export$b23abd26de154ede({
9306
- search_filters_open_: category_filters_open_,
9307
- search_sorting_open_: category_sorting_open_,
9308
- current_sorting_: current_sorting_,
9309
- sort_and_filter_element_: sort_and_filter_element_,
9310
- i18n_: i18n_
9311
- });
9312
- }
9313
- }), _el$30, _co$12);
9314
9319
  $52FdA$solidjsweb.effect(() => $52FdA$solidjsweb.setAttribute(_el$13, "id", (0, $c95c6dd9e93acd82$export$44dad306455dddf).PLP_CATEGORY));
9315
9320
  return _el$13;
9316
9321
  })()];
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.18";
13
+ export const version = "3.0.20";
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.18";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.20";
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] : {};
@@ -2161,7 +2161,8 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
2161
2161
  disable_fading_: true,
2162
2162
  slider_ref_: slider => {
2163
2163
  const {
2164
- insert_here: insert_here
2164
+ insert_here: insert_here,
2165
+ container: container
2165
2166
  } = slider;
2166
2167
  const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, insert_here, true);
2167
2168
  // Do like this, so we don't have to call mergeProps ourselves
@@ -2171,6 +2172,7 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
2171
2172
  }, layout_options_));
2172
2173
  $8tj43$slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
2173
2174
  insert_here.before($ca55612a53dbbdd2$export$a2cc176055f8f08());
2175
+ container.classList.add("products");
2174
2176
  },
2175
2177
  get children() {
2176
2178
  return $8tj43$createComponent((0, $8tj43$Suspense), {
@@ -6252,7 +6254,8 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
6252
6254
  of_: of_
6253
6255
  },
6254
6256
  get_scroll_position_ = () => scrollY,
6255
- listen_to_scroll_on_: listen_to_scroll_on_
6257
+ listen_to_scroll_on_: listen_to_scroll_on_,
6258
+ velocity_too_fast_ = 1.5
6256
6259
  } = _ref;
6257
6260
  if (0, $8tj43$isServer) return; // won't show in initial render and need scroll position
6258
6261
  const [first_to_show, set_first_to_show] = $8tj43$createSignal(0);
@@ -6260,6 +6263,7 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
6260
6263
  const [count_to_show, set_count_to_show] = $8tj43$createSignal("");
6261
6264
  const [permitted_to_show, set_permitted_to_show] = $8tj43$createSignal(false); // due to scroll speed
6262
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);
6263
6267
  const modified_price_formatting_ = $8tj43$createMemo(() => ({
6264
6268
  ...price_formatting_(),
6265
6269
  places_after_comma_: 0
@@ -6269,25 +6273,27 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
6269
6273
  let last_pos_time = +new Date();
6270
6274
  let last_pos = get_scroll_position_();
6271
6275
  let unpermit_when_possible = false;
6272
- let times_too_fast = 0;
6273
6276
  const handle_scrollpos_change = () => {
6274
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
6275
6278
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
6276
6279
  const now = +new Date();
6277
6280
  const age_of_distance = now - last_pos_time;
6278
6281
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
6279
- if (velocity > 1.5) {
6280
- times_too_fast++;
6281
- 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);
6282
6285
  }
6283
- if (times_too_fast > 10) {
6284
- set_permitted_to_show(true);
6285
- unpermit_when_possible = false;
6286
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
6287
6286
  last_pos_time = now;
6288
6287
  last_pos = get_scroll_position_();
6289
6288
  };
6290
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
+ });
6291
6297
  $8tj43$createEffect(() => {
6292
6298
  show_triggered();
6293
6299
  const first = get_first_result_in_viewport();
@@ -7170,6 +7176,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
7170
7176
  }
7171
7177
  }));
7172
7178
  insert_here.classList.add("generated-spacing");
7179
+ container.classList.add("products");
7173
7180
  $8tj43$createEffect(
7174
7181
  // @ts-ignore
7175
7182
  $8tj43$on(query_base_, () => insert_here.scrollTo({
@@ -7183,13 +7190,13 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
7183
7190
  // Put scroll status into slider container, so it's centered relatively to the products
7184
7191
  const rendered_scroll_status = ConfiguredScrollStatus({
7185
7192
  get_scroll_position_: () => insert_here.scrollLeft,
7186
- 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
7187
7195
  });
7188
- const {
7189
- childNodes: childNodes
7190
- } = container;
7196
+
7197
+ const non_solid_nodes = [...container.childNodes];
7191
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
7192
- $8tj43$insert(container, $8tj43$createMemo(() => [...childNodes, rendered_scroll_status]));
7199
+ $8tj43$insert(container, $8tj43$createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
7193
7200
  }
7194
7201
  },
7195
7202
  children: listing_contents
@@ -8824,7 +8831,7 @@ function $3a2bed57c9a57e21$export$d31a1a1a83ad9413(plp_results_, _ref) {
8824
8831
  const $4b4b262708b516ee$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=product-count><!$><!/> <!$><!/>`),
8825
8832
  $4b4b262708b516ee$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div>`),
8826
8833
  $4b4b262708b516ee$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
8827
- $4b4b262708b516ee$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/>`);
8834
+ $4b4b262708b516ee$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/>`);
8828
8835
  function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
8829
8836
  let {
8830
8837
  depict_api_: depict_api_,
@@ -9123,9 +9130,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
9123
9130
  _el$25 = _el$24.nextSibling,
9124
9131
  [_el$26, _co$10] = $8tj43$getNextMarker(_el$25.nextSibling),
9125
9132
  _el$27 = _el$14.nextSibling,
9126
- [_el$28, _co$11] = $8tj43$getNextMarker(_el$27.nextSibling),
9127
- _el$29 = _el$28.nextSibling,
9128
- [_el$30, _co$12] = $8tj43$getNextMarker(_el$29.nextSibling);
9133
+ [_el$28, _co$11] = $8tj43$getNextMarker(_el$27.nextSibling);
9129
9134
  $8tj43$use(el => process.env.NODE_ENV === "development" && $1145661fd3ca5519$export$7af06a63c5a976c9(el, id_to_query_for_, i18n_), _el$13);
9130
9135
  $8tj43$insert(_el$14, $8tj43$createComponent((0, $8tj43$Show), {
9131
9136
  get when() {
@@ -9219,25 +9224,25 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
9219
9224
  }), _el$26, _co$10);
9220
9225
  $8tj43$insert(_el$13, $8tj43$createComponent((0, $8tj43$Show), {
9221
9226
  get when() {
9222
- return layout_options_().layout === "grid";
9227
+ var _layout_options_$layo;
9228
+ return !((_layout_options_$layo = layout_options_().layout) !== null && _layout_options_$layo !== void 0 && _layout_options_$layo.startsWith("slider"));
9223
9229
  },
9224
9230
  get children() {
9225
- return $8tj43$createComponent(ConfiguredScrollStatus, {});
9231
+ return [$8tj43$createComponent(ConfiguredScrollStatus, {}), $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
9232
+ severity_: "error",
9233
+ message_: "Floating buttons failed",
9234
+ get children() {
9235
+ return $6a16b21155984cef$export$b23abd26de154ede({
9236
+ search_filters_open_: category_filters_open_,
9237
+ search_sorting_open_: category_sorting_open_,
9238
+ current_sorting_: current_sorting_,
9239
+ sort_and_filter_element_: sort_and_filter_element_,
9240
+ i18n_: i18n_
9241
+ });
9242
+ }
9243
+ })];
9226
9244
  }
9227
9245
  }), _el$28, _co$11);
9228
- $8tj43$insert(_el$13, $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
9229
- severity_: "error",
9230
- message_: "Floating buttons failed",
9231
- get children() {
9232
- return $6a16b21155984cef$export$b23abd26de154ede({
9233
- search_filters_open_: category_filters_open_,
9234
- search_sorting_open_: category_sorting_open_,
9235
- current_sorting_: current_sorting_,
9236
- sort_and_filter_element_: sort_and_filter_element_,
9237
- i18n_: i18n_
9238
- });
9239
- }
9240
- }), _el$30, _co$12);
9241
9246
  $8tj43$effect(() => $8tj43$setAttribute(_el$13, "id", (0, $c3820807ac1e6fd7$export$44dad306455dddf).PLP_CATEGORY));
9242
9247
  return _el$13;
9243
9248
  })()];
package/README.md CHANGED
@@ -8,4 +8,5 @@ Breaking changes:
8
8
  - 1.2.0 added `page_url_creator` and changed typing to support it. The only breaking change is that this potentially causes type errors where the resolution is to move the generics to the provider instead of the SearchPage and CategoryPage components.
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
- - 2.0.0 Made `enable_content_search` `true` by default. Redesigned filter counts.
11
+ - 2.0.0 Made `enable_content_search` `true` by default. Redesigned filter counts.
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.18";
80
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.20";
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 (() => {
@@ -2116,7 +2116,8 @@ function $363ce4d1d71041aa$export$d41d19e89346fa2({
2116
2116
  disable_fading_: true,
2117
2117
  slider_ref_: slider => {
2118
2118
  const {
2119
- insert_here: insert_here
2119
+ insert_here: insert_here,
2120
+ container: container
2120
2121
  } = slider;
2121
2122
  const Layout = props => $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, insert_here, true);
2122
2123
  // Do like this, so we don't have to call mergeProps ourselves
@@ -2126,6 +2127,7 @@ function $363ce4d1d71041aa$export$d41d19e89346fa2({
2126
2127
  }, layout_options_));
2127
2128
  $gVhhF$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
2128
2129
  insert_here.before($fc23d7668ae0011d$export$a2cc176055f8f08());
2130
+ container.classList.add("products");
2129
2131
  },
2130
2132
  get children() {
2131
2133
  return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
@@ -5916,7 +5918,8 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5916
5918
  of_: of_
5917
5919
  },
5918
5920
  get_scroll_position_ = () => scrollY,
5919
- listen_to_scroll_on_: listen_to_scroll_on_
5921
+ listen_to_scroll_on_: listen_to_scroll_on_,
5922
+ velocity_too_fast_ = 1.5
5920
5923
  }) {
5921
5924
  if (0, $gVhhF$solidjsweb.isServer) return; // won't show in initial render and need scroll position
5922
5925
  const [first_to_show, set_first_to_show] = $gVhhF$solidjs.createSignal(0);
@@ -5924,6 +5927,7 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5924
5927
  const [count_to_show, set_count_to_show] = $gVhhF$solidjs.createSignal("");
5925
5928
  const [permitted_to_show, set_permitted_to_show] = $gVhhF$solidjs.createSignal(false); // due to scroll speed
5926
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);
5927
5931
  const modified_price_formatting_ = $gVhhF$solidjs.createMemo(() => ({
5928
5932
  ...price_formatting_(),
5929
5933
  places_after_comma_: 0
@@ -5933,25 +5937,27 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5933
5937
  let last_pos_time = +new Date();
5934
5938
  let last_pos = get_scroll_position_();
5935
5939
  let unpermit_when_possible = false;
5936
- let times_too_fast = 0;
5937
5940
  const handle_scrollpos_change = () => {
5938
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
5939
5942
  const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5940
5943
  const now = +new Date();
5941
5944
  const age_of_distance = now - last_pos_time;
5942
5945
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
5943
- if (velocity > 1.5) {
5944
- times_too_fast++;
5945
- 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);
5946
5949
  }
5947
- if (times_too_fast > 10) {
5948
- set_permitted_to_show(true);
5949
- unpermit_when_possible = false;
5950
- } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5951
5950
  last_pos_time = now;
5952
5951
  last_pos = get_scroll_position_();
5953
5952
  };
5954
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
+ });
5955
5961
  $gVhhF$solidjs.createEffect(() => {
5956
5962
  show_triggered();
5957
5963
  const first = get_first_result_in_viewport();
@@ -6799,6 +6805,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
6799
6805
  }
6800
6806
  }));
6801
6807
  insert_here.classList.add("generated-spacing");
6808
+ container.classList.add("products");
6802
6809
  $gVhhF$solidjs.createEffect(
6803
6810
  // @ts-ignore
6804
6811
  $gVhhF$solidjs.on(query_base_, () => insert_here.scrollTo({
@@ -6812,13 +6819,13 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
6812
6819
  // Put scroll status into slider container, so it's centered relatively to the products
6813
6820
  const rendered_scroll_status = ConfiguredScrollStatus({
6814
6821
  get_scroll_position_: () => insert_here.scrollLeft,
6815
- 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
6816
6824
  });
6817
- const {
6818
- childNodes: childNodes
6819
- } = container;
6825
+
6826
+ const non_solid_nodes = [...container.childNodes];
6820
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
6821
- $gVhhF$solidjsweb.insert(container, $gVhhF$solidjs.createMemo(() => [...childNodes, rendered_scroll_status]));
6828
+ $gVhhF$solidjsweb.insert(container, $gVhhF$solidjs.createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
6822
6829
  }
6823
6830
  },
6824
6831
  children: listing_contents
@@ -8356,7 +8363,7 @@ function $6a8e766e914723d8$export$d31a1a1a83ad9413(plp_results_, [get_selected_f
8356
8363
  const $840d88a04b2d22a7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=product-count><!$><!/> <!$><!/>`),
8357
8364
  $840d88a04b2d22a7$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`),
8358
8365
  $840d88a04b2d22a7$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
8359
- $840d88a04b2d22a7$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/>`);
8366
+ $840d88a04b2d22a7$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/>`);
8360
8367
  function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8361
8368
  depict_api_: depict_api_,
8362
8369
  id_to_query_for_: id_to_query_for_,
@@ -8627,9 +8634,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8627
8634
  _el$25 = _el$24.nextSibling,
8628
8635
  [_el$26, _co$10] = $gVhhF$solidjsweb.getNextMarker(_el$25.nextSibling),
8629
8636
  _el$27 = _el$14.nextSibling,
8630
- [_el$28, _co$11] = $gVhhF$solidjsweb.getNextMarker(_el$27.nextSibling),
8631
- _el$29 = _el$28.nextSibling,
8632
- [_el$30, _co$12] = $gVhhF$solidjsweb.getNextMarker(_el$29.nextSibling);
8637
+ [_el$28, _co$11] = $gVhhF$solidjsweb.getNextMarker(_el$27.nextSibling);
8633
8638
  $gVhhF$solidjsweb.use(el => process.env.NODE_ENV === "development" && $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, id_to_query_for_, i18n_), _el$13);
8634
8639
  $gVhhF$solidjsweb.insert(_el$14, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
8635
8640
  get when() {
@@ -8722,25 +8727,24 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8722
8727
  }), _el$26, _co$10);
8723
8728
  $gVhhF$solidjsweb.insert(_el$13, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
8724
8729
  get when() {
8725
- return layout_options_().layout === "grid";
8730
+ return !layout_options_().layout?.startsWith("slider");
8726
8731
  },
8727
8732
  get children() {
8728
- return $gVhhF$solidjsweb.createComponent(ConfiguredScrollStatus, {});
8733
+ return [$gVhhF$solidjsweb.createComponent(ConfiguredScrollStatus, {}), $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
8734
+ severity_: "error",
8735
+ message_: "Floating buttons failed",
8736
+ get children() {
8737
+ return $2fb324fbcc7b4a7b$export$b23abd26de154ede({
8738
+ search_filters_open_: category_filters_open_,
8739
+ search_sorting_open_: category_sorting_open_,
8740
+ current_sorting_: current_sorting_,
8741
+ sort_and_filter_element_: sort_and_filter_element_,
8742
+ i18n_: i18n_
8743
+ });
8744
+ }
8745
+ })];
8729
8746
  }
8730
8747
  }), _el$28, _co$11);
8731
- $gVhhF$solidjsweb.insert(_el$13, $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
8732
- severity_: "error",
8733
- message_: "Floating buttons failed",
8734
- get children() {
8735
- return $2fb324fbcc7b4a7b$export$b23abd26de154ede({
8736
- search_filters_open_: category_filters_open_,
8737
- search_sorting_open_: category_sorting_open_,
8738
- current_sorting_: current_sorting_,
8739
- sort_and_filter_element_: sort_and_filter_element_,
8740
- i18n_: i18n_
8741
- });
8742
- }
8743
- }), _el$30, _co$12);
8744
8748
  $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$13, "id", (0, $0b6e2070a98de347$export$44dad306455dddf).PLP_CATEGORY));
8745
8749
  return _el$13;
8746
8750
  })()];
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.18";
13
+ export const version = "3.0.20";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize