@depict-ai/ui 3.0.12 → 3.0.14

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.
@@ -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.12";
86
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.14";
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;
@@ -729,7 +729,8 @@ const $33eed84f447aa0c0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
729
729
  const $33eed84f447aa0c0$export$864d304a0bc46829 = "2%";
730
730
  const $33eed84f447aa0c0$export$7bf543b9d9be2c22 = (0, $dc0bcefcc3486ebd$export$b91cec6bdc6b32a1);
731
731
  function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
732
- const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
732
+ let what = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "grid";
733
+ const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
733
734
  return (0, $3hooq$solidjsweb.isServer) ? {
734
735
  t: "<!-- ".concat(text, " -->")
735
736
  } : document.createComment(text);
@@ -5202,25 +5203,29 @@ function $068bde7fa83ac02c$export$92f2da32c6e7e7ee(_ref) {
5202
5203
  }
5203
5204
  function $1689794f03ba2554$export$205efb947c7ffd78(handler) {
5204
5205
  let passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5206
+ let override_element = arguments.length > 2 ? arguments[2] : undefined;
5205
5207
  const catchified_handler = $3hooq$depictaiutilishared.catchify(handler);
5206
5208
  const owner = $3hooq$solidjs.getOwner();
5207
5209
  // Some customers (e.g. equestrian) have `height: 100%` and/or `overflow-x: hidden` on the body, which means that scroll events won't get dispatched on `window`. The pages who get it on <body> won't get it on `window` and vice-versa, so there shouldn't be a worry about duplicate calling of the handler.
5208
5210
  // Use observer in case that this gets called before body exists
5209
- const disconnect = (0, $3hooq$depictaiutilishared.observer).onexists("body", _ref => {
5210
- let {
5211
- element: element
5212
- } = _ref;
5213
- element.addEventListener("scroll", catchified_handler, {
5214
- passive: passive
5211
+ if (!override_element) {
5212
+ const disconnect = (0, $3hooq$depictaiutilishared.observer).onexists("body", _ref => {
5213
+ let {
5214
+ element: element
5215
+ } = _ref;
5216
+ element.addEventListener("scroll", catchified_handler, {
5217
+ passive: passive
5218
+ });
5219
+ $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5215
5220
  });
5216
- $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5217
- });
5218
- $3hooq$solidjs.onCleanup(disconnect);
5221
+ $3hooq$solidjs.onCleanup(disconnect);
5222
+ }
5219
5223
  for (const event of ["resize", "orientationchange", "scroll"]) {
5220
- addEventListener(event, catchified_handler, {
5224
+ const listen_on = override_element !== null && override_element !== void 0 ? override_element : window;
5225
+ listen_on.addEventListener(event, catchified_handler, {
5221
5226
  passive: passive
5222
5227
  });
5223
- $3hooq$solidjs.onCleanup(() => removeEventListener(event, catchified_handler));
5228
+ $3hooq$solidjs.onCleanup(() => listen_on.removeEventListener(event, catchified_handler));
5224
5229
  }
5225
5230
  }
5226
5231
  const $e03dec587b6e91e3$var$_tmpl$ = ["<div", ' class="scroll-status" style="display:none"><span class="text"><b>', "</b> \u2013 <b>", "</b> <!--$-->", "<!--/--> <b>", "</b></span></div>"];
@@ -5233,7 +5238,9 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
5233
5238
  i18n_: {
5234
5239
  price_formatting_: price_formatting_,
5235
5240
  of_: of_
5236
- }
5241
+ },
5242
+ get_scroll_position_ = () => scrollY,
5243
+ listen_to_scroll_on_: listen_to_scroll_on_
5237
5244
  } = _ref;
5238
5245
  if (0, $3hooq$solidjsweb.isServer) return; // won't show in initial render and need scroll position
5239
5246
  const [first_to_show, set_first_to_show] = $3hooq$solidjs.createSignal(0);
@@ -5248,12 +5255,12 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
5248
5255
  let element;
5249
5256
  let animation;
5250
5257
  let last_pos_time = +new Date();
5251
- let last_pos = scrollY;
5258
+ let last_pos = get_scroll_position_();
5252
5259
  let unpermit_when_possible = false;
5253
5260
  let times_too_fast = 0;
5254
5261
  const handle_scrollpos_change = () => {
5255
5262
  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
5256
- const distance_travelled = Math.abs(scrollY - last_pos);
5263
+ const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5257
5264
  const now = +new Date();
5258
5265
  const age_of_distance = now - last_pos_time;
5259
5266
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
@@ -5266,9 +5273,9 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
5266
5273
  unpermit_when_possible = false;
5267
5274
  } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5268
5275
  last_pos_time = now;
5269
- last_pos = scrollY;
5276
+ last_pos = get_scroll_position_();
5270
5277
  };
5271
- $1689794f03ba2554$export$205efb947c7ffd78(handle_scrollpos_change);
5278
+ $1689794f03ba2554$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5272
5279
  $3hooq$solidjs.createEffect(() => {
5273
5280
  show_triggered();
5274
5281
  const first = get_first_result_in_viewport();
@@ -5884,7 +5891,8 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
5884
5891
  product_card_template_: product_card_template_,
5885
5892
  layout_options_: layout_options_,
5886
5893
  id_currently_querying_for_: id_currently_querying_for_,
5887
- content_blocks_by_row_: content_blocks_by_row_
5894
+ content_blocks_by_row_: content_blocks_by_row_,
5895
+ ConfiguredScrollStatus: ConfiguredScrollStatus
5888
5896
  } = _ref;
5889
5897
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
5890
5898
  const is_loading_ = $3hooq$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
@@ -5952,6 +5960,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
5952
5960
  product_card_template_: product_card_template_,
5953
5961
  num_placeholders_: num_placeholders_
5954
5962
  }) : undefined);
5963
+ const layout = $3hooq$solidjs.createMemo(() => layout_options_().layout || "grid");
5955
5964
  const [get_suspense_is_blocked, set_suspense_is_blocked] = $3hooq$solidjs.createSignal(false);
5956
5965
  const block_suspense_if_needed = () => {
5957
5966
  if (!is_just_after_plp_results_update) return;
@@ -6023,7 +6032,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
6023
6032
  },
6024
6033
  children: product_cards_when_data
6025
6034
  });
6026
- return [$8edd3cf30d1fd8b4$export$a2cc176055f8f08(), $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
6035
+ return [$8edd3cf30d1fd8b4$export$a2cc176055f8f08(layout()), $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
6027
6036
  get when() {
6028
6037
  return doesnt_have_content_blocks();
6029
6038
  },
@@ -6046,22 +6055,79 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
6046
6055
  });
6047
6056
  },
6048
6057
  get children() {
6049
- return $3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
6050
- get cols_at_size() {
6051
- return modified_cols_at_size();
6052
- },
6053
- get override_vertical_spacing() {
6054
- return layout_options_().override_vertical_spacing;
6055
- },
6056
- get grid_spacing() {
6057
- return layout_options_().grid_spacing;
6058
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
6059
+ get when() {
6060
+ return layout() === "grid";
6058
6061
  },
6059
- rows: "all",
6060
- layout: "grid",
6061
- element_attributes: {
6062
- class: "cards"
6062
+ get fallback() {
6063
+ return $3hooq$solidjsweb.createComponent((0, $ad8ec7729fffeb9c$export$6649caad96ef8870), {
6064
+ arrow_height_: 25,
6065
+ arrow_width_: 12.5,
6066
+ disable_fading_: true,
6067
+ slider_ref_: slider => {
6068
+ const {
6069
+ insert_here: insert_here,
6070
+ container: container
6071
+ } = slider;
6072
+ const Layout = props => $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, insert_here, true);
6073
+ // Do like this, so we don't have to call mergeProps ourselves
6074
+ $3hooq$solidjsweb.createComponent(Layout, $3hooq$solidjsweb.mergeProps({
6075
+ rows: "all"
6076
+ }, layout_options_, {
6077
+ get cols_at_size() {
6078
+ return modified_cols_at_size();
6079
+ },
6080
+ get layout() {
6081
+ return layout();
6082
+ }
6083
+ }));
6084
+ insert_here.classList.add("generated-spacing");
6085
+ $3hooq$solidjs.createEffect(
6086
+ // @ts-ignore
6087
+ $3hooq$solidjs.on(query_base_, () => insert_here.scrollTo({
6088
+ left: 0,
6089
+ behavior: "instant"
6090
+ }), {
6091
+ defer: true
6092
+ })); // Scroll to the beginning if a filter or the query changes
6093
+ $3hooq$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
6094
+ if (ConfiguredScrollStatus) {
6095
+ // Put scroll status into slider container, so it's centered relatively to the products
6096
+ const rendered_scroll_status = ConfiguredScrollStatus({
6097
+ get_scroll_position_: () => insert_here.scrollLeft,
6098
+ listen_to_scroll_on_: insert_here
6099
+ });
6100
+ const {
6101
+ childNodes: childNodes
6102
+ } = container;
6103
+ // 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
6104
+ $3hooq$solidjsweb.insert(container, $3hooq$solidjs.createMemo(() => [...childNodes, rendered_scroll_status]));
6105
+ }
6106
+ },
6107
+ children: listing_contents
6108
+ });
6063
6109
  },
6064
- children: listing_contents
6110
+ get children() {
6111
+ return $3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
6112
+ get cols_at_size() {
6113
+ return modified_cols_at_size();
6114
+ },
6115
+ get override_vertical_spacing() {
6116
+ return layout_options_().override_vertical_spacing;
6117
+ },
6118
+ get grid_spacing() {
6119
+ return layout_options_().grid_spacing;
6120
+ },
6121
+ rows: "all",
6122
+ get layout() {
6123
+ return layout();
6124
+ },
6125
+ element_attributes: {
6126
+ class: "cards"
6127
+ },
6128
+ children: listing_contents
6129
+ });
6130
+ }
6065
6131
  });
6066
6132
  }
6067
6133
  })];
@@ -7416,6 +7482,26 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
7416
7482
  // @ts-ignore - there's no type error here when writing the code, but parcel can't generate types that include the symbol, so we need to suppress the error that creates in our pipelines
7417
7483
  const category_title_type = category_title_[(0, $905241549bde5bff$export$5c28802497c8a83c)];
7418
7484
  const extra_sort_and_filter_args_ = {};
7485
+ const ConfiguredScrollStatus = function () {
7486
+ let extraProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7487
+ return $3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
7488
+ severity_: "error",
7489
+ message_: "Scroll status failed",
7490
+ get children() {
7491
+ return $e03dec587b6e91e3$export$83fd5de5504a7a67({
7492
+ first_result_in_viewport_: first_result_in_viewport_,
7493
+ last_result_in_viewport_: last_result_in_viewport_,
7494
+ formatted_number_of_results_: formatted_number_of_results_,
7495
+ i18n_: i18n_,
7496
+ number_of_results_: $3hooq$solidjs.createMemo(() => {
7497
+ var _plp_products_4;
7498
+ return (_plp_products_4 = plp_products_()) === null || _plp_products_4 === void 0 ? void 0 : _plp_products_4.n_hits;
7499
+ }),
7500
+ ...extraProps
7501
+ });
7502
+ }
7503
+ });
7504
+ };
7419
7505
  const make_product_count_ = () => $3hooq$solidjsweb.ssr($ede6c70ecdca46fe$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
7420
7506
  get when() {
7421
7507
  return plp_products_.loading;
@@ -7429,8 +7515,8 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
7429
7515
  }
7430
7516
  })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
7431
7517
  get when() {
7432
- var _plp_products_4;
7433
- return ((_plp_products_4 = plp_products_()) === null || _plp_products_4 === void 0 ? void 0 : _plp_products_4.n_hits) === 1;
7518
+ var _plp_products_5;
7519
+ return ((_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits) === 1;
7434
7520
  },
7435
7521
  get fallback() {
7436
7522
  return i18n_.products_();
@@ -7593,6 +7679,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
7593
7679
  sort_or_filter_open_: sort_or_filter_open_,
7594
7680
  desktop_filter_elements_: desktop_filter_elements_,
7595
7681
  content_blocks_by_row_: content_blocks_by_row_,
7682
+ ConfiguredScrollStatus: ConfiguredScrollStatus,
7596
7683
  id_currently_querying_for_: id_to_query_for_,
7597
7684
  no_results_options_: {
7598
7685
  selected_filters_: selected_filters_,
@@ -7604,20 +7691,12 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
7604
7691
  }
7605
7692
  });
7606
7693
  }
7607
- })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
7608
- severity_: "error",
7609
- message_: "Scroll status failed",
7694
+ })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
7695
+ get when() {
7696
+ return layout_options_().layout === "grid";
7697
+ },
7610
7698
  get children() {
7611
- return $e03dec587b6e91e3$export$83fd5de5504a7a67({
7612
- first_result_in_viewport_: first_result_in_viewport_,
7613
- last_result_in_viewport_: last_result_in_viewport_,
7614
- formatted_number_of_results_: formatted_number_of_results_,
7615
- i18n_: i18n_,
7616
- number_of_results_: $3hooq$solidjs.createMemo(() => {
7617
- var _plp_products_5;
7618
- return (_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits;
7619
- })
7620
- });
7699
+ return $3hooq$solidjsweb.createComponent(ConfiguredScrollStatus, {});
7621
7700
  }
7622
7701
  })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
7623
7702
  severity_: "error",
@@ -8078,7 +8157,8 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
8078
8157
  scroll_restoration_data_: scroll_restoration_data_,
8079
8158
  layout_options_: $3hooq$solidjs.createMemo(() => ({
8080
8159
  cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
8081
- ...grid_spacing_override()
8160
+ ...grid_spacing_override(),
8161
+ layout: props.layout || "grid"
8082
8162
  })),
8083
8163
  product_card_template_: product_card_template,
8084
8164
  sorting_query_param_: sorting_query_param_,
@@ -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.12";
13
+ export const version = "3.0.14";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
@@ -182,6 +182,11 @@ export interface BaseCategoryPageConfig extends BaseProductListingConfig {
182
182
  * @default true
183
183
  */
184
184
  showQuicklinks?: boolean;
185
+ /**
186
+ * Whether to show the listing in a grid or a slider.
187
+ * @default "grid"
188
+ */
189
+ layout?: "grid" | "slider";
185
190
  }
186
191
  /**
187
192
  * The listing to query Depict for. `type` can be `"listingId"` or `"externalId"` and `id` is the actual id.
@@ -965,7 +970,8 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
965
970
  category_title: typeof CategoryTitle | typeof embedded_num_products;
966
971
  on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
967
972
  content_blocks_by_row?: ContentBlocksByRow;
968
- }): import("@depict-ai/utilishared").Node_Array;
973
+ layout?: "slider" | "grid";
974
+ }): import("@depict-ai/utilishared/latest").Node_Array;
969
975
  export function BreadCrumbs<T extends Display>({
970
976
  depict_category
971
977
  }: {
@@ -1117,7 +1123,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1117
1123
  * Open the modal with support for alignment.
1118
1124
  * @returns {void}
1119
1125
  */
1120
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1126
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1121
1127
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1122
1128
  export interface PageReplacer {
1123
1129
  readonly render_: () => Node_Array;
@@ -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.12";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.14";
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;
@@ -656,7 +656,8 @@ const $d399250dfa491636$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
656
656
  const $d399250dfa491636$export$864d304a0bc46829 = "2%";
657
657
  const $d399250dfa491636$export$7bf543b9d9be2c22 = (0, $fa332ea03168857c$export$b91cec6bdc6b32a1);
658
658
  function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
659
- const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
659
+ let what = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "grid";
660
+ const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
660
661
  return (0, $b8hua$isServer) ? {
661
662
  t: "<!-- ".concat(text, " -->")
662
663
  } : document.createComment(text);
@@ -5129,25 +5130,29 @@ function $43fbdca0f726a34b$export$92f2da32c6e7e7ee(_ref) {
5129
5130
  }
5130
5131
  function $33e7d1906c93db7d$export$205efb947c7ffd78(handler) {
5131
5132
  let passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5133
+ let override_element = arguments.length > 2 ? arguments[2] : undefined;
5132
5134
  const catchified_handler = $b8hua$catchify1(handler);
5133
5135
  const owner = $b8hua$getOwner();
5134
5136
  // Some customers (e.g. equestrian) have `height: 100%` and/or `overflow-x: hidden` on the body, which means that scroll events won't get dispatched on `window`. The pages who get it on <body> won't get it on `window` and vice-versa, so there shouldn't be a worry about duplicate calling of the handler.
5135
5137
  // Use observer in case that this gets called before body exists
5136
- const disconnect = (0, $b8hua$observer).onexists("body", _ref => {
5137
- let {
5138
- element: element
5139
- } = _ref;
5140
- element.addEventListener("scroll", catchified_handler, {
5141
- passive: passive
5138
+ if (!override_element) {
5139
+ const disconnect = (0, $b8hua$observer).onexists("body", _ref => {
5140
+ let {
5141
+ element: element
5142
+ } = _ref;
5143
+ element.addEventListener("scroll", catchified_handler, {
5144
+ passive: passive
5145
+ });
5146
+ $b8hua$runWithOwner(owner, () => $b8hua$onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5142
5147
  });
5143
- $b8hua$runWithOwner(owner, () => $b8hua$onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5144
- });
5145
- $b8hua$onCleanup(disconnect);
5148
+ $b8hua$onCleanup(disconnect);
5149
+ }
5146
5150
  for (const event of ["resize", "orientationchange", "scroll"]) {
5147
- addEventListener(event, catchified_handler, {
5151
+ const listen_on = override_element !== null && override_element !== void 0 ? override_element : window;
5152
+ listen_on.addEventListener(event, catchified_handler, {
5148
5153
  passive: passive
5149
5154
  });
5150
- $b8hua$onCleanup(() => removeEventListener(event, catchified_handler));
5155
+ $b8hua$onCleanup(() => listen_on.removeEventListener(event, catchified_handler));
5151
5156
  }
5152
5157
  }
5153
5158
  const $b69740fc6de9f17e$var$_tmpl$ = ["<div", ' class="scroll-status" style="display:none"><span class="text"><b>', "</b> \u2013 <b>", "</b> <!--$-->", "<!--/--> <b>", "</b></span></div>"];
@@ -5160,7 +5165,9 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
5160
5165
  i18n_: {
5161
5166
  price_formatting_: price_formatting_,
5162
5167
  of_: of_
5163
- }
5168
+ },
5169
+ get_scroll_position_ = () => scrollY,
5170
+ listen_to_scroll_on_: listen_to_scroll_on_
5164
5171
  } = _ref;
5165
5172
  if (0, $b8hua$isServer) return; // won't show in initial render and need scroll position
5166
5173
  const [first_to_show, set_first_to_show] = $b8hua$createSignal(0);
@@ -5175,12 +5182,12 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
5175
5182
  let element;
5176
5183
  let animation;
5177
5184
  let last_pos_time = +new Date();
5178
- let last_pos = scrollY;
5185
+ let last_pos = get_scroll_position_();
5179
5186
  let unpermit_when_possible = false;
5180
5187
  let times_too_fast = 0;
5181
5188
  const handle_scrollpos_change = () => {
5182
5189
  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
5183
- const distance_travelled = Math.abs(scrollY - last_pos);
5190
+ const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5184
5191
  const now = +new Date();
5185
5192
  const age_of_distance = now - last_pos_time;
5186
5193
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
@@ -5193,9 +5200,9 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
5193
5200
  unpermit_when_possible = false;
5194
5201
  } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5195
5202
  last_pos_time = now;
5196
- last_pos = scrollY;
5203
+ last_pos = get_scroll_position_();
5197
5204
  };
5198
- $33e7d1906c93db7d$export$205efb947c7ffd78(handle_scrollpos_change);
5205
+ $33e7d1906c93db7d$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5199
5206
  $b8hua$createEffect(() => {
5200
5207
  show_triggered();
5201
5208
  const first = get_first_result_in_viewport();
@@ -5811,7 +5818,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5811
5818
  product_card_template_: product_card_template_,
5812
5819
  layout_options_: layout_options_,
5813
5820
  id_currently_querying_for_: id_currently_querying_for_,
5814
- content_blocks_by_row_: content_blocks_by_row_
5821
+ content_blocks_by_row_: content_blocks_by_row_,
5822
+ ConfiguredScrollStatus: ConfiguredScrollStatus
5815
5823
  } = _ref;
5816
5824
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
5817
5825
  const is_loading_ = $b8hua$createMemo(() => plp_results_.loading || query_base_.loading);
@@ -5879,6 +5887,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5879
5887
  product_card_template_: product_card_template_,
5880
5888
  num_placeholders_: num_placeholders_
5881
5889
  }) : undefined);
5890
+ const layout = $b8hua$createMemo(() => layout_options_().layout || "grid");
5882
5891
  const [get_suspense_is_blocked, set_suspense_is_blocked] = $b8hua$createSignal(false);
5883
5892
  const block_suspense_if_needed = () => {
5884
5893
  if (!is_just_after_plp_results_update) return;
@@ -5950,7 +5959,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5950
5959
  },
5951
5960
  children: product_cards_when_data
5952
5961
  });
5953
- return [$ca55612a53dbbdd2$export$a2cc176055f8f08(), $b8hua$createComponent((0, $b8hua$Show), {
5962
+ return [$ca55612a53dbbdd2$export$a2cc176055f8f08(layout()), $b8hua$createComponent((0, $b8hua$Show), {
5954
5963
  get when() {
5955
5964
  return doesnt_have_content_blocks();
5956
5965
  },
@@ -5973,22 +5982,79 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5973
5982
  });
5974
5983
  },
5975
5984
  get children() {
5976
- return $b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
5977
- get cols_at_size() {
5978
- return modified_cols_at_size();
5979
- },
5980
- get override_vertical_spacing() {
5981
- return layout_options_().override_vertical_spacing;
5982
- },
5983
- get grid_spacing() {
5984
- return layout_options_().grid_spacing;
5985
+ return $b8hua$createComponent((0, $b8hua$Show), {
5986
+ get when() {
5987
+ return layout() === "grid";
5985
5988
  },
5986
- rows: "all",
5987
- layout: "grid",
5988
- element_attributes: {
5989
- class: "cards"
5989
+ get fallback() {
5990
+ return $b8hua$createComponent((0, $002f09d00aac50b2$export$6649caad96ef8870), {
5991
+ arrow_height_: 25,
5992
+ arrow_width_: 12.5,
5993
+ disable_fading_: true,
5994
+ slider_ref_: slider => {
5995
+ const {
5996
+ insert_here: insert_here,
5997
+ container: container
5998
+ } = slider;
5999
+ const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, insert_here, true);
6000
+ // Do like this, so we don't have to call mergeProps ourselves
6001
+ $b8hua$createComponent(Layout, $b8hua$mergeProps({
6002
+ rows: "all"
6003
+ }, layout_options_, {
6004
+ get cols_at_size() {
6005
+ return modified_cols_at_size();
6006
+ },
6007
+ get layout() {
6008
+ return layout();
6009
+ }
6010
+ }));
6011
+ insert_here.classList.add("generated-spacing");
6012
+ $b8hua$createEffect(
6013
+ // @ts-ignore
6014
+ $b8hua$on(query_base_, () => insert_here.scrollTo({
6015
+ left: 0,
6016
+ behavior: "instant"
6017
+ }), {
6018
+ defer: true
6019
+ })); // Scroll to the beginning if a filter or the query changes
6020
+ $b8hua$slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
6021
+ if (ConfiguredScrollStatus) {
6022
+ // Put scroll status into slider container, so it's centered relatively to the products
6023
+ const rendered_scroll_status = ConfiguredScrollStatus({
6024
+ get_scroll_position_: () => insert_here.scrollLeft,
6025
+ listen_to_scroll_on_: insert_here
6026
+ });
6027
+ const {
6028
+ childNodes: childNodes
6029
+ } = container;
6030
+ // 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
6031
+ $b8hua$insert(container, $b8hua$createMemo(() => [...childNodes, rendered_scroll_status]));
6032
+ }
6033
+ },
6034
+ children: listing_contents
6035
+ });
5990
6036
  },
5991
- children: listing_contents
6037
+ get children() {
6038
+ return $b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
6039
+ get cols_at_size() {
6040
+ return modified_cols_at_size();
6041
+ },
6042
+ get override_vertical_spacing() {
6043
+ return layout_options_().override_vertical_spacing;
6044
+ },
6045
+ get grid_spacing() {
6046
+ return layout_options_().grid_spacing;
6047
+ },
6048
+ rows: "all",
6049
+ get layout() {
6050
+ return layout();
6051
+ },
6052
+ element_attributes: {
6053
+ class: "cards"
6054
+ },
6055
+ children: listing_contents
6056
+ });
6057
+ }
5992
6058
  });
5993
6059
  }
5994
6060
  })];
@@ -7343,6 +7409,26 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
7343
7409
  // @ts-ignore - there's no type error here when writing the code, but parcel can't generate types that include the symbol, so we need to suppress the error that creates in our pipelines
7344
7410
  const category_title_type = category_title_[(0, $ec8a6e10026dcff9$export$5c28802497c8a83c)];
7345
7411
  const extra_sort_and_filter_args_ = {};
7412
+ const ConfiguredScrollStatus = function () {
7413
+ let extraProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7414
+ return $b8hua$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
7415
+ severity_: "error",
7416
+ message_: "Scroll status failed",
7417
+ get children() {
7418
+ return $b69740fc6de9f17e$export$83fd5de5504a7a67({
7419
+ first_result_in_viewport_: first_result_in_viewport_,
7420
+ last_result_in_viewport_: last_result_in_viewport_,
7421
+ formatted_number_of_results_: formatted_number_of_results_,
7422
+ i18n_: i18n_,
7423
+ number_of_results_: $b8hua$createMemo(() => {
7424
+ var _plp_products_4;
7425
+ return (_plp_products_4 = plp_products_()) === null || _plp_products_4 === void 0 ? void 0 : _plp_products_4.n_hits;
7426
+ }),
7427
+ ...extraProps
7428
+ });
7429
+ }
7430
+ });
7431
+ };
7346
7432
  const make_product_count_ = () => $b8hua$ssr($4b4b262708b516ee$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
7347
7433
  get when() {
7348
7434
  return plp_products_.loading;
@@ -7356,8 +7442,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
7356
7442
  }
7357
7443
  })), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
7358
7444
  get when() {
7359
- var _plp_products_4;
7360
- return ((_plp_products_4 = plp_products_()) === null || _plp_products_4 === void 0 ? void 0 : _plp_products_4.n_hits) === 1;
7445
+ var _plp_products_5;
7446
+ return ((_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits) === 1;
7361
7447
  },
7362
7448
  get fallback() {
7363
7449
  return i18n_.products_();
@@ -7520,6 +7606,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
7520
7606
  sort_or_filter_open_: sort_or_filter_open_,
7521
7607
  desktop_filter_elements_: desktop_filter_elements_,
7522
7608
  content_blocks_by_row_: content_blocks_by_row_,
7609
+ ConfiguredScrollStatus: ConfiguredScrollStatus,
7523
7610
  id_currently_querying_for_: id_to_query_for_,
7524
7611
  no_results_options_: {
7525
7612
  selected_filters_: selected_filters_,
@@ -7531,20 +7618,12 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
7531
7618
  }
7532
7619
  });
7533
7620
  }
7534
- })), $b8hua$escape($b8hua$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
7535
- severity_: "error",
7536
- message_: "Scroll status failed",
7621
+ })), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
7622
+ get when() {
7623
+ return layout_options_().layout === "grid";
7624
+ },
7537
7625
  get children() {
7538
- return $b69740fc6de9f17e$export$83fd5de5504a7a67({
7539
- first_result_in_viewport_: first_result_in_viewport_,
7540
- last_result_in_viewport_: last_result_in_viewport_,
7541
- formatted_number_of_results_: formatted_number_of_results_,
7542
- i18n_: i18n_,
7543
- number_of_results_: $b8hua$createMemo(() => {
7544
- var _plp_products_5;
7545
- return (_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits;
7546
- })
7547
- });
7626
+ return $b8hua$createComponent(ConfiguredScrollStatus, {});
7548
7627
  }
7549
7628
  })), $b8hua$escape($b8hua$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
7550
7629
  severity_: "error",
@@ -8005,7 +8084,8 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
8005
8084
  scroll_restoration_data_: scroll_restoration_data_,
8006
8085
  layout_options_: $b8hua$createMemo(() => ({
8007
8086
  cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77(props.cols_at_size),
8008
- ...grid_spacing_override()
8087
+ ...grid_spacing_override(),
8088
+ layout: props.layout || "grid"
8009
8089
  })),
8010
8090
  product_card_template_: product_card_template,
8011
8091
  sorting_query_param_: sorting_query_param_,