@depict-ai/ui 2.0.26 → 2.1.0
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 +483 -111
- package/ES10/index.d.ts +75 -45
- package/ES10/index.js +484 -112
- package/latest/index.cjs +453 -103
- package/latest/index.d.ts +75 -45
- package/latest/index.js +454 -104
- package/locales/require.js +1152 -0
- package/package.json +4 -4
- package/server/ES10/index.cjs +454 -111
- package/server/ES10/index.d.ts +75 -45
- package/server/ES10/index.js +455 -112
- package/server/latest/index.cjs +424 -103
- package/server/latest/index.d.ts +75 -45
- package/server/latest/index.js +425 -104
package/ES10/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { add_to_version_info as $8tj43$add_to_version_info, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, dlog as $8tj43$dlog, queueMacroTask as $8tj43$queueMacroTask, catchify as $8tj43$catchify, is_safari as $8tj43$is_safari, observer as $8tj43$observer, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, slider_fractional_factory as $8tj43$slider_fractional_factory, camelCasifyObject as $8tj43$camelCasifyObject, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, javascript_media_query as $8tj43$javascript_media_query, use_href_accessor as $8tj43$use_href_accessor, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
|
|
2
2
|
import { createComponent as $8tj43$createComponent, template as $8tj43$template, getNextElement as $8tj43$getNextElement, effect as $8tj43$effect, style as $8tj43$style, spread as $8tj43$spread, mergeProps as $8tj43$mergeProps, runHydrationEvents as $8tj43$runHydrationEvents, insert as $8tj43$insert, setAttribute as $8tj43$setAttribute, isServer as $8tj43$isServer, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, classList as $8tj43$classList, getNextMarker as $8tj43$getNextMarker, Dynamic as $8tj43$Dynamic, use as $8tj43$use } from "solid-js/web";
|
|
3
|
-
import { createSignal as $8tj43$createSignal, getOwner as $8tj43$getOwner, createEffect as $8tj43$createEffect, runWithOwner as $8tj43$runWithOwner, onCleanup as $8tj43$onCleanup, createMemo as $8tj43$createMemo, createContext as $8tj43$createContext, useContext as $8tj43$useContext, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, For as $8tj43$For, createUniqueId as $8tj43$createUniqueId,
|
|
3
|
+
import { createSignal as $8tj43$createSignal, getOwner as $8tj43$getOwner, createEffect as $8tj43$createEffect, runWithOwner as $8tj43$runWithOwner, onCleanup as $8tj43$onCleanup, createMemo as $8tj43$createMemo, createContext as $8tj43$createContext, useContext as $8tj43$useContext, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, untrack as $8tj43$untrack, createRenderEffect as $8tj43$createRenderEffect, Index as $8tj43$Index, createRoot as $8tj43$createRoot, For as $8tj43$For, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction, mapArray as $8tj43$mapArray, mergeProps as $8tj43$mergeProps1 } from "solid-js";
|
|
4
4
|
import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
5
5
|
import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
6
6
|
import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from "solid-js/store";
|
|
7
8
|
|
|
8
9
|
/*! Depict.ai search and product listing SDK */
|
|
9
10
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
10
11
|
register_es_version("ui", "ES10");
|
|
11
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0
|
|
12
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.0";
|
|
12
13
|
const $2855bffe06ef7a03$var$fallback_operator = "in";
|
|
13
14
|
const $2855bffe06ef7a03$var$fallback_token = "";
|
|
14
15
|
const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
|
|
@@ -445,7 +446,7 @@ const $a9c7ba6087881ac2$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
445
446
|
return $a9c7ba6087881ac2$var$transform_elements(sorted_cols_at_size);
|
|
446
447
|
};
|
|
447
448
|
function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
|
|
448
|
-
const text = "Please try setting `columnsAtSize` 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.";
|
|
449
|
+
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.";
|
|
449
450
|
return (0, $8tj43$isServer) ? {
|
|
450
451
|
t: "<!-- ".concat(text, " -->")
|
|
451
452
|
} : document.createComment(text);
|
|
@@ -467,12 +468,13 @@ let $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
|
|
|
467
468
|
function $bdd80c7862246dc2$export$f33414a4df0afd3f(_ref) {
|
|
468
469
|
let {
|
|
469
470
|
product_card_template_: product_card_template_,
|
|
470
|
-
num_placeholders_: num_placeholders_
|
|
471
|
+
num_placeholders_: num_placeholders_,
|
|
472
|
+
content_blocks_: content_blocks_
|
|
471
473
|
} = _ref;
|
|
472
|
-
const [
|
|
473
|
-
let existing_num = 0;
|
|
474
|
+
const [num_to_actually_show, set_num_to_actually_show] = $8tj43$createSignal($8tj43$untrack(num_placeholders_));
|
|
474
475
|
if (0, $8tj43$isServer)
|
|
475
476
|
// want to render simple placeholders on server, effects don't run there
|
|
477
|
+
// FIXME when adding proper SSR: also SSR content blocks
|
|
476
478
|
return $8tj43$createMemo(() => Array.from({
|
|
477
479
|
length: num_placeholders_()
|
|
478
480
|
}).map(() => {
|
|
@@ -481,19 +483,33 @@ function $bdd80c7862246dc2$export$f33414a4df0afd3f(_ref) {
|
|
|
481
483
|
if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
|
|
482
484
|
}));
|
|
483
485
|
$8tj43$createRenderEffect(() => {
|
|
486
|
+
const existing_num = num_to_actually_show();
|
|
484
487
|
const to_add = num_placeholders_() - existing_num;
|
|
485
488
|
if (to_add <= 0) return;
|
|
486
489
|
// Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
|
|
487
490
|
// We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
|
|
488
491
|
// The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
492
|
+
// Above comments were from when we added elements in this createRenderEffect. Now I changed it to just increment the number and render them from an <Index> instead, so I can add content blocks better
|
|
493
|
+
// Functionality should be the same
|
|
494
|
+
set_num_to_actually_show(existing_num + to_add);
|
|
495
|
+
});
|
|
496
|
+
return $8tj43$createComponent((0, $8tj43$Index), {
|
|
497
|
+
get each() {
|
|
498
|
+
return Array.from({
|
|
499
|
+
length: num_to_actually_show()
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
children: (_item, index) => {
|
|
503
|
+
const possible_content_block = $8tj43$createMemo(() => {
|
|
504
|
+
var _content_blocks_, _content_blocks_2;
|
|
505
|
+
return content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_2 = _content_blocks_()) === null || _content_blocks_2 === void 0 ? void 0 : _content_blocks_2[index];
|
|
506
|
+
});
|
|
507
|
+
// Show content block before product card, so it's *at* that index
|
|
508
|
+
return [possible_content_block, $bdd80c7862246dc2$var$Placeholder({
|
|
509
|
+
product_card_template_: product_card_template_
|
|
510
|
+
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
511
|
+
}
|
|
495
512
|
});
|
|
496
|
-
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
497
513
|
}
|
|
498
514
|
/**
|
|
499
515
|
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
@@ -584,7 +600,8 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
584
600
|
merchant_: merchant_,
|
|
585
601
|
market_: market_,
|
|
586
602
|
product_card_template_: product_card_template_,
|
|
587
|
-
do_per_elements_: do_per_elements_
|
|
603
|
+
do_per_elements_: do_per_elements_,
|
|
604
|
+
content_blocks_: content_blocks_
|
|
588
605
|
} = _ref;
|
|
589
606
|
return $8tj43$createComponent((0, $8tj43$For), {
|
|
590
607
|
get each() {
|
|
@@ -592,6 +609,10 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
592
609
|
},
|
|
593
610
|
children: (product_id, index) => {
|
|
594
611
|
const owner = $8tj43$getOwner();
|
|
612
|
+
const possible_content_block = $8tj43$createMemo(() => {
|
|
613
|
+
var _content_blocks_, _content_blocks_2;
|
|
614
|
+
return content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_2 = _content_blocks_()) === null || _content_blocks_2 === void 0 ? void 0 : _content_blocks_2[index()];
|
|
615
|
+
});
|
|
595
616
|
const display_accessor = $8tj43$createMemo(prev => {
|
|
596
617
|
const new_display = displays_by_key_().get(product_id);
|
|
597
618
|
if (prev && $2d7bad8684bc7f44$var$deep_equal(prev, new_display))
|
|
@@ -645,7 +666,9 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
645
666
|
}
|
|
646
667
|
do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
|
|
647
668
|
});
|
|
648
|
-
return
|
|
669
|
+
return [
|
|
670
|
+
// Show content block before product card, so it's *at* that index
|
|
671
|
+
possible_content_block, product_card_resource]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
649
672
|
}
|
|
650
673
|
});
|
|
651
674
|
}
|
|
@@ -4881,7 +4904,9 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4881
4904
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4882
4905
|
query_base_: query_base_,
|
|
4883
4906
|
depict_api_: depict_api_,
|
|
4884
|
-
is_loading_: is_loading_
|
|
4907
|
+
is_loading_: is_loading_,
|
|
4908
|
+
content_blocks_: content_blocks_,
|
|
4909
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4885
4910
|
} = _ref;
|
|
4886
4911
|
// The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
|
|
4887
4912
|
const target_to_index_map = new Map();
|
|
@@ -4928,11 +4953,13 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4928
4953
|
query_base_: query_base_,
|
|
4929
4954
|
depict_api_: depict_api_
|
|
4930
4955
|
});
|
|
4956
|
+
$8tj43$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4931
4957
|
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
4932
4958
|
displays_by_key_: displays_by_key_,
|
|
4933
4959
|
merchant_: merchant_,
|
|
4934
4960
|
market_: market_,
|
|
4935
4961
|
product_card_template_: product_card_template_,
|
|
4962
|
+
content_blocks_: content_blocks_,
|
|
4936
4963
|
do_per_elements_: (elements, index_accessor) =>
|
|
4937
4964
|
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
4938
4965
|
$8tj43$createEffect(() => {
|
|
@@ -4954,6 +4981,363 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4954
4981
|
})
|
|
4955
4982
|
});
|
|
4956
4983
|
}
|
|
4984
|
+
const $64d94dcaa058dc7b$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2),
|
|
4985
|
+
$64d94dcaa058dc7b$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type="text/css"></style>`, 2);
|
|
4986
|
+
const $64d94dcaa058dc7b$export$c500183c31c2b22e = "--spans-columns";
|
|
4987
|
+
function $64d94dcaa058dc7b$export$ab6b147eec64fea5(props) {
|
|
4988
|
+
const container_class = "x" + $8tj43$createUniqueId();
|
|
4989
|
+
const container_element_ = (() => {
|
|
4990
|
+
const _el$ = $8tj43$getNextElement($64d94dcaa058dc7b$var$_tmpl$);
|
|
4991
|
+
$8tj43$spread(_el$, $8tj43$mergeProps(() => props.element_attributes, {
|
|
4992
|
+
"classList": {
|
|
4993
|
+
[container_class]: true
|
|
4994
|
+
}
|
|
4995
|
+
}), false, true);
|
|
4996
|
+
$8tj43$insert(_el$, () => props.children);
|
|
4997
|
+
$8tj43$runHydrationEvents();
|
|
4998
|
+
return _el$;
|
|
4999
|
+
})(); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
5000
|
+
return $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
5001
|
+
message_: "Failed calculating css grid layout",
|
|
5002
|
+
severity_: "error",
|
|
5003
|
+
get children() {
|
|
5004
|
+
return $64d94dcaa058dc7b$export$e2f22da34aaf310a(props, container_element_, false, container_class);
|
|
5005
|
+
}
|
|
5006
|
+
});
|
|
5007
|
+
}
|
|
5008
|
+
function $64d94dcaa058dc7b$export$e2f22da34aaf310a(props, container_element) {
|
|
5009
|
+
let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
5010
|
+
let container_class = arguments.length > 3 ? arguments[3] : undefined;
|
|
5011
|
+
if (!container_class) {
|
|
5012
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
5013
|
+
container_class = $8tj43$make_random_classname();
|
|
5014
|
+
container_element.classList.add(container_class);
|
|
5015
|
+
}
|
|
5016
|
+
const container_selector = ".depict .".concat(container_class); // class so ppl can have id if needed
|
|
5017
|
+
const col_styling = $8tj43$createMemo(() => $64d94dcaa058dc7b$var$generate_media_queried_declarations({
|
|
5018
|
+
container_selector_: container_selector,
|
|
5019
|
+
default_grid_spacing_text: props.grid_spacing,
|
|
5020
|
+
cols_at_size_: props.cols_at_size,
|
|
5021
|
+
override_vertical_spacing_: props.override_vertical_spacing,
|
|
5022
|
+
top_row_shortened_by_: props.top_row_shortened_by_()
|
|
5023
|
+
}));
|
|
5024
|
+
const base_styling = $8tj43$createMemo(() => {
|
|
5025
|
+
return "".concat(container_selector, "{display:grid;}");
|
|
5026
|
+
});
|
|
5027
|
+
const get_styling = $8tj43$createMemo(() => base_styling() + col_styling());
|
|
5028
|
+
const style_element = (() => {
|
|
5029
|
+
const _el$2 = $8tj43$getNextElement($64d94dcaa058dc7b$var$_tmpl$2);
|
|
5030
|
+
$8tj43$insert(_el$2, get_styling);
|
|
5031
|
+
return _el$2;
|
|
5032
|
+
})(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
5033
|
+
if (insert_after_container) container_element.after(style_element);
|
|
5034
|
+
return [container_element, style_element];
|
|
5035
|
+
}
|
|
5036
|
+
function $64d94dcaa058dc7b$var$generate_media_queried_declarations(_ref) {
|
|
5037
|
+
let {
|
|
5038
|
+
container_selector_: container_selector_,
|
|
5039
|
+
default_grid_spacing_text: default_grid_spacing_text,
|
|
5040
|
+
cols_at_size_: cols_at_size_,
|
|
5041
|
+
override_vertical_spacing_: override_vertical_spacing_,
|
|
5042
|
+
top_row_shortened_by_: top_row_shortened_by_
|
|
5043
|
+
} = _ref;
|
|
5044
|
+
return cols_at_size_.map(options => {
|
|
5045
|
+
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
5046
|
+
const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
5047
|
+
// See comment in else block below
|
|
5048
|
+
const can_use_gap = $64d94dcaa058dc7b$var$can_use_gap_for_unit(spacing_to_use) && (!override_vertical_spacing_ || $64d94dcaa058dc7b$var$can_use_gap_for_unit(override_vertical_spacing_));
|
|
5049
|
+
let spacing_styling;
|
|
5050
|
+
let additional_styling = ""; // outside the media query
|
|
5051
|
+
if (can_use_gap) spacing_styling = "gap:".concat(spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
5052
|
+
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
5053
|
+
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
5054
|
+
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
5055
|
+
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
5056
|
+
const width_multiplier = "var(".concat($64d94dcaa058dc7b$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
5057
|
+
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($64d94dcaa058dc7b$var$strip_percent_unit(spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
5058
|
+
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
5059
|
+
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
5060
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(spacing_to_use), ")"); // Width of the gaps
|
|
5061
|
+
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
5062
|
+
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
5063
|
+
const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
5064
|
+
spacing_styling = "column-gap:".concat(spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
5065
|
+
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
5066
|
+
additional_styling = $8tj43$n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
5067
|
+
}
|
|
5068
|
+
const media_query_body = "".concat(container_selector_, "{").concat(spacing_styling, "grid-template-columns:repeat(").concat(n_cols, ",minmax(0,1fr));}");
|
|
5069
|
+
return "".concat($8tj43$layout_media_query_header(min, max), "{").concat(media_query_body, "}").concat(additional_styling);
|
|
5070
|
+
}).join("");
|
|
5071
|
+
}
|
|
5072
|
+
function $64d94dcaa058dc7b$var$can_use_gap_for_unit(spacing) {
|
|
5073
|
+
const trimmed_spacing = spacing.trim();
|
|
5074
|
+
return !trimmed_spacing.includes("%");
|
|
5075
|
+
}
|
|
5076
|
+
function $64d94dcaa058dc7b$var$strip_percent_unit(css_value) {
|
|
5077
|
+
return css_value.replaceAll("%", "");
|
|
5078
|
+
}
|
|
5079
|
+
function $b2dbaafb23d00c7f$export$cb5808ba002cdeed(_ref) {
|
|
5080
|
+
let {
|
|
5081
|
+
layout_options_: layout_options_,
|
|
5082
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
5083
|
+
} = _ref;
|
|
5084
|
+
return $8tj43$createMemo(() => {
|
|
5085
|
+
const layout_options = layout_options_();
|
|
5086
|
+
// Add grid styling that changes when filters get opened/closed
|
|
5087
|
+
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
5088
|
+
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
5089
|
+
const [num_cols_default,,,, override_cols] = row;
|
|
5090
|
+
const cloned_row = [...row];
|
|
5091
|
+
// @ts-ignore
|
|
5092
|
+
cloned_row[0] = num_cols_default - 1;
|
|
5093
|
+
if (override_cols)
|
|
5094
|
+
// @ts-ignore
|
|
5095
|
+
cloned_row[4] = {
|
|
5096
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref2 => {
|
|
5097
|
+
let [row, column] = _ref2;
|
|
5098
|
+
return [row, column - 1];
|
|
5099
|
+
}))
|
|
5100
|
+
};
|
|
5101
|
+
return cloned_row;
|
|
5102
|
+
}) : when_filters_closed_cols;
|
|
5103
|
+
});
|
|
5104
|
+
}
|
|
5105
|
+
function $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_) {
|
|
5106
|
+
const size_active = $8tj43$createMemo(() => cols_at_size_().map(_ref => {
|
|
5107
|
+
let [n_cols, min_width, max_width] = _ref;
|
|
5108
|
+
const media_query = $8tj43$layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
5109
|
+
const matches = $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query);
|
|
5110
|
+
return [matches, n_cols];
|
|
5111
|
+
}));
|
|
5112
|
+
const n_cols_currently_showing = $8tj43$createMemo(() => {
|
|
5113
|
+
try {
|
|
5114
|
+
const [, n_cols_currently_showing] = size_active().find(_ref2 => {
|
|
5115
|
+
let [media_query] = _ref2;
|
|
5116
|
+
return media_query();
|
|
5117
|
+
});
|
|
5118
|
+
return n_cols_currently_showing;
|
|
5119
|
+
} catch (e) {
|
|
5120
|
+
$8tj43$dwarn("No active size found in columnsAtSize - can't render content blocks");
|
|
5121
|
+
return null;
|
|
5122
|
+
}
|
|
5123
|
+
});
|
|
5124
|
+
return n_cols_currently_showing;
|
|
5125
|
+
}
|
|
5126
|
+
function $3ab4aa97880fb88d$export$3f37af283f8fb843(props) {
|
|
5127
|
+
const style = $8tj43$createMemo(() => {
|
|
5128
|
+
const {
|
|
5129
|
+
style: style,
|
|
5130
|
+
height: height,
|
|
5131
|
+
width: width,
|
|
5132
|
+
aspectRatio: aspectRatio
|
|
5133
|
+
} = props;
|
|
5134
|
+
const is_image = aspectRatio != undefined;
|
|
5135
|
+
const size_data = is_image ? {
|
|
5136
|
+
width: "100%",
|
|
5137
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
5138
|
+
} : {
|
|
5139
|
+
width: width,
|
|
5140
|
+
height: height
|
|
5141
|
+
};
|
|
5142
|
+
return {
|
|
5143
|
+
display: "block",
|
|
5144
|
+
...(style || {}),
|
|
5145
|
+
...size_data
|
|
5146
|
+
};
|
|
5147
|
+
});
|
|
5148
|
+
return $8tj43$createComponent((0, $bc2337c9a05ecd18$export$acb3eaade4b23afd), {
|
|
5149
|
+
get style() {
|
|
5150
|
+
return style();
|
|
5151
|
+
},
|
|
5152
|
+
get ["class"]() {
|
|
5153
|
+
return props.class;
|
|
5154
|
+
}
|
|
5155
|
+
});
|
|
5156
|
+
}
|
|
5157
|
+
const $ff7feae4dddd6073$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="content-block-wrapper"></div>`, 2);
|
|
5158
|
+
function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
|
|
5159
|
+
let {
|
|
5160
|
+
content_blocks_: incoming_content_blocks,
|
|
5161
|
+
cols_at_size_: cols_at_size_,
|
|
5162
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
5163
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5164
|
+
} = _ref;
|
|
5165
|
+
// these are by row
|
|
5166
|
+
const [content_blocks, set_content_blocks] = $8tj43$createStore([]);
|
|
5167
|
+
const n_cols_currently_showing_ = $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_);
|
|
5168
|
+
const products_to_rows = products => {
|
|
5169
|
+
const cols_currently_showing = n_cols_currently_showing_();
|
|
5170
|
+
if (cols_currently_showing === null) return 0;
|
|
5171
|
+
return Math.ceil(products / cols_currently_showing);
|
|
5172
|
+
};
|
|
5173
|
+
const showing_rows = $8tj43$createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
5174
|
+
$8tj43$createEffect(() => {
|
|
5175
|
+
const incoming_value = incoming_content_blocks();
|
|
5176
|
+
if (!incoming_value) {
|
|
5177
|
+
set_content_blocks([]);
|
|
5178
|
+
return;
|
|
5179
|
+
}
|
|
5180
|
+
const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
|
|
5181
|
+
set_content_blocks($8tj43$reconcile(capped_value));
|
|
5182
|
+
});
|
|
5183
|
+
const get_wrapped_blocks_ = $ff7feae4dddd6073$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
5184
|
+
$8tj43$createComputed(() => {
|
|
5185
|
+
// Update our styling if a content block forces some items that should be in the top row into a lower one, so we can generate margin-top declarations for them
|
|
5186
|
+
const top_row_block = get_wrapped_blocks_()[0];
|
|
5187
|
+
const blocks_in_top_row_taken = top_row_block === null || top_row_block === void 0 ? void 0 : top_row_block.span_columns;
|
|
5188
|
+
if (blocks_in_top_row_taken == undefined) {
|
|
5189
|
+
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
5190
|
+
set_top_row_shortened_by_(0);
|
|
5191
|
+
return;
|
|
5192
|
+
}
|
|
5193
|
+
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
5194
|
+
});
|
|
5195
|
+
|
|
5196
|
+
return $ff7feae4dddd6073$var$remap_blocks_to_index({
|
|
5197
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
5198
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
5199
|
+
});
|
|
5200
|
+
}
|
|
5201
|
+
/**
|
|
5202
|
+
* Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
|
|
5203
|
+
* @returns an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index
|
|
5204
|
+
*/
|
|
5205
|
+
function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
5206
|
+
let {
|
|
5207
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
5208
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
5209
|
+
} = _ref2;
|
|
5210
|
+
return $8tj43$createMemo(() => {
|
|
5211
|
+
// This computation should be quite cheap since it just moves around things into an array
|
|
5212
|
+
const content_blocks_by_index = [];
|
|
5213
|
+
const constructed_block_arrays = new WeakSet();
|
|
5214
|
+
const wrapped_blocks = get_wrapped_blocks_();
|
|
5215
|
+
const cols_showing = n_cols_currently_showing_();
|
|
5216
|
+
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
5217
|
+
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
5218
|
+
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
5219
|
+
// i = row to show at
|
|
5220
|
+
const block = wrapped_blocks[i];
|
|
5221
|
+
if (!block) continue; // Array can have holes/not defined places
|
|
5222
|
+
const index_of_first_item_in_row = i * cols_showing;
|
|
5223
|
+
const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
|
|
5224
|
+
const {
|
|
5225
|
+
span_rows: span_rows,
|
|
5226
|
+
position: position,
|
|
5227
|
+
span_columns: span_columns
|
|
5228
|
+
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
5229
|
+
let target_index;
|
|
5230
|
+
if (position === "left") target_index = index_of_first_item_in_row;else if (position === "right") target_index = index_of_last_item_in_row - span_columns;else if (position === "center") target_index = index_of_first_item_in_row + Math.floor((cols_showing - span_columns) / 2);else throw new Error("Invalid position for content block - must be left, right or center: " + JSON.stringify(position));
|
|
5231
|
+
// Calculate displacement of us by content blocks above us
|
|
5232
|
+
let displacement_by_added_blocks = 0;
|
|
5233
|
+
for (let j = 0; j < i; j++) {
|
|
5234
|
+
const row = displaced_products[j];
|
|
5235
|
+
if (row === undefined) continue; // there were no blocks in this row
|
|
5236
|
+
let items_in_row;
|
|
5237
|
+
if (typeof row === "number") items_in_row = row;else {
|
|
5238
|
+
items_in_row = row.filter(item => item).length;
|
|
5239
|
+
displaced_products[j] = items_in_row;
|
|
5240
|
+
}
|
|
5241
|
+
displacement_by_added_blocks += items_in_row;
|
|
5242
|
+
}
|
|
5243
|
+
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
5244
|
+
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
5245
|
+
var _displaced_products$i;
|
|
5246
|
+
if ((_displaced_products$i = displaced_products[i]) !== null && _displaced_products$i !== void 0 && _displaced_products$i[j])
|
|
5247
|
+
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
5248
|
+
displacement_by_added_blocks++;
|
|
5249
|
+
}
|
|
5250
|
+
// Add block to output array at the correct index
|
|
5251
|
+
const final_target_index = target_index - displacement_by_added_blocks;
|
|
5252
|
+
const existing_block = content_blocks_by_index[final_target_index];
|
|
5253
|
+
const block_content = block.content;
|
|
5254
|
+
// If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
|
|
5255
|
+
if (existing_block) {
|
|
5256
|
+
if (constructed_block_arrays.has(existing_block))
|
|
5257
|
+
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
5258
|
+
existing_block.push(block_content);else {
|
|
5259
|
+
const array = [existing_block, block_content];
|
|
5260
|
+
constructed_block_arrays.add(array);
|
|
5261
|
+
content_blocks_by_index[final_target_index] = array;
|
|
5262
|
+
}
|
|
5263
|
+
} else content_blocks_by_index[final_target_index] = block_content;
|
|
5264
|
+
// Update displacement
|
|
5265
|
+
for (let j = 0; j < span_rows; j++) {
|
|
5266
|
+
var _ref3;
|
|
5267
|
+
const row = displaced_products[_ref3 = i + j] || (displaced_products[_ref3] = []);
|
|
5268
|
+
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
return content_blocks_by_index;
|
|
5272
|
+
});
|
|
5273
|
+
}
|
|
5274
|
+
/**
|
|
5275
|
+
* Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
|
|
5276
|
+
* Then renders the content and wraps it into a div with the correct styling.
|
|
5277
|
+
* Also caps span_columns to max available columns
|
|
5278
|
+
*/
|
|
5279
|
+
function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
5280
|
+
const get_wrapped_blocks = $8tj43$mapArray(() => rendered_content_blocks, block => {
|
|
5281
|
+
if (!block) return;
|
|
5282
|
+
const get_span_columns = () => {
|
|
5283
|
+
var _max_span_columns;
|
|
5284
|
+
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
5285
|
+
};
|
|
5286
|
+
return $8tj43$mergeProps1(block, {
|
|
5287
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
5288
|
+
content: (() => {
|
|
5289
|
+
const _el$ = $8tj43$getNextElement($ff7feae4dddd6073$var$_tmpl$);
|
|
5290
|
+
$8tj43$insert(_el$, $8tj43$createComponent($ff7feae4dddd6073$var$RenderContent, {
|
|
5291
|
+
get content() {
|
|
5292
|
+
return block.content;
|
|
5293
|
+
}
|
|
5294
|
+
}));
|
|
5295
|
+
$8tj43$effect(_p$ => {
|
|
5296
|
+
const _v$ = {
|
|
5297
|
+
[(0, $64d94dcaa058dc7b$export$c500183c31c2b22e)]: get_span_columns()
|
|
5298
|
+
},
|
|
5299
|
+
_v$2 = "span ".concat(get_span_columns()),
|
|
5300
|
+
_v$3 = "span ".concat(block.span_rows);
|
|
5301
|
+
_p$._v$ = $8tj43$style(_el$, _v$, _p$._v$);
|
|
5302
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("grid-column", _p$._v$2 = _v$2);
|
|
5303
|
+
_v$3 !== _p$._v$3 && _el$.style.setProperty("grid-row", _p$._v$3 = _v$3);
|
|
5304
|
+
return _p$;
|
|
5305
|
+
}, {
|
|
5306
|
+
_v$: undefined,
|
|
5307
|
+
_v$2: undefined,
|
|
5308
|
+
_v$3: undefined
|
|
5309
|
+
});
|
|
5310
|
+
return _el$;
|
|
5311
|
+
})(),
|
|
5312
|
+
get span_columns() {
|
|
5313
|
+
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5314
|
+
return get_span_columns();
|
|
5315
|
+
}
|
|
5316
|
+
});
|
|
5317
|
+
});
|
|
5318
|
+
return get_wrapped_blocks;
|
|
5319
|
+
}
|
|
5320
|
+
/**
|
|
5321
|
+
* Basically adds support for async content block functions and shows a rudimentary placeholder if rendering is delayed. Required due to react having a rendering delay.
|
|
5322
|
+
*/
|
|
5323
|
+
function $ff7feae4dddd6073$var$RenderContent(props) {
|
|
5324
|
+
const [resource] = $8tj43$createResource(() => props.content,
|
|
5325
|
+
// Could be reactive
|
|
5326
|
+
fn => fn());
|
|
5327
|
+
$8tj43$createEffect(() => {
|
|
5328
|
+
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
5329
|
+
});
|
|
5330
|
+
// The suspense is for when there's an async content block (which we have to support due to react having a rendering delay) so that we can show some height while it's loading (should kinda never be visible)
|
|
5331
|
+
return $8tj43$createComponent((0, $8tj43$Suspense), {
|
|
5332
|
+
get fallback() {
|
|
5333
|
+
return $8tj43$createComponent((0, $3ab4aa97880fb88d$export$3f37af283f8fb843), {
|
|
5334
|
+
width: "100%",
|
|
5335
|
+
height: "max(100%, 400px)"
|
|
5336
|
+
});
|
|
5337
|
+
},
|
|
5338
|
+
children: resource
|
|
5339
|
+
});
|
|
5340
|
+
}
|
|
4957
5341
|
const $7faea0096f14b59b$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="PLP-results"><!#><!/><!#><!/></div>`, 6);
|
|
4958
5342
|
function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
4959
5343
|
let {
|
|
@@ -4970,7 +5354,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4970
5354
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
4971
5355
|
product_card_template_: product_card_template_,
|
|
4972
5356
|
layout_options_: layout_options_,
|
|
4973
|
-
id_currently_querying_for_: id_currently_querying_for_
|
|
5357
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
5358
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
4974
5359
|
} = _ref;
|
|
4975
5360
|
// 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
|
|
4976
5361
|
const is_loading_ = $8tj43$createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -5019,24 +5404,37 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5019
5404
|
let is_just_after_plp_results_update = false;
|
|
5020
5405
|
let fallback_is_alive = false;
|
|
5021
5406
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $8tj43$createSignal(true);
|
|
5407
|
+
const [top_row_shortened_by_, set_top_row_shortened_by_] = $8tj43$createSignal(0);
|
|
5408
|
+
const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $8tj43$createSignal(false);
|
|
5409
|
+
const [number_loaded_displays, set_number_loaded_displays_] = $8tj43$createSignal(0);
|
|
5410
|
+
const modified_cols_at_size = $b2dbaafb23d00c7f$export$cb5808ba002cdeed({
|
|
5411
|
+
layout_options_: layout_options_,
|
|
5412
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
5413
|
+
});
|
|
5414
|
+
const num_placeholders_ = $8tj43$createMemo(() => {
|
|
5415
|
+
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
5416
|
+
// Can't use the data out of request_base for the id because request_base is too late, we need the correct amount of placeholders before the browser has restored the scroll state after processing all popstate events
|
|
5417
|
+
return (0, $981356a8bf29ad72$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
5418
|
+
let {
|
|
5419
|
+
for_id: for_id
|
|
5420
|
+
} = _ref2;
|
|
5421
|
+
return for_id === id_currently_querying_for_();
|
|
5422
|
+
})) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
|
|
5423
|
+
});
|
|
5424
|
+
const number_of_items_shown_ = $8tj43$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
5425
|
+
const doesnt_have_content_blocks = $8tj43$createMemo(() => !content_blocks_by_row_());
|
|
5426
|
+
const content_blocks_ = $8tj43$createMemo(() => doesnt_have_content_blocks() ? () => [] : $ff7feae4dddd6073$export$791ef57e62e21c3f({
|
|
5427
|
+
content_blocks_: content_blocks_by_row_,
|
|
5428
|
+
cols_at_size_: modified_cols_at_size,
|
|
5429
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
5430
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5431
|
+
}));
|
|
5022
5432
|
const rendered_placeholders = $8tj43$createMemo(() => get_should_have_placeholders_rendered() ? $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
5433
|
+
content_blocks_: content_blocks_,
|
|
5023
5434
|
product_card_template_: product_card_template_,
|
|
5024
|
-
num_placeholders_:
|
|
5025
|
-
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
5026
|
-
// Can't use the data out of request_base for the id because request_base is too late, we need the correct amount of placeholders before the browser has restored the scroll state after processing all popstate events
|
|
5027
|
-
return (0, $981356a8bf29ad72$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
5028
|
-
let {
|
|
5029
|
-
for_id: for_id
|
|
5030
|
-
} = _ref2;
|
|
5031
|
-
return for_id === id_currently_querying_for_();
|
|
5032
|
-
})) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
|
|
5033
|
-
})
|
|
5435
|
+
num_placeholders_: num_placeholders_
|
|
5034
5436
|
}) : undefined);
|
|
5035
5437
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $8tj43$createSignal(false);
|
|
5036
|
-
const modified_cols_at_size = $7faea0096f14b59b$var$make_modified_cols_at_size({
|
|
5037
|
-
layout_options_: layout_options_,
|
|
5038
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
5039
|
-
});
|
|
5040
5438
|
const block_suspense_if_needed = () => {
|
|
5041
5439
|
if (!is_just_after_plp_results_update) return;
|
|
5042
5440
|
is_just_after_plp_results_update = false;
|
|
@@ -5069,6 +5467,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5069
5467
|
return (() => {
|
|
5070
5468
|
fallback_is_alive = true;
|
|
5071
5469
|
$8tj43$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
5470
|
+
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
5471
|
+
$8tj43$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
5072
5472
|
return $8tj43$createMemo(() => {
|
|
5073
5473
|
// We need to be able to block the suspense since when async product cards are *rendering* we want to show the placeholders on initial load but not when loading more
|
|
5074
5474
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -5093,37 +5493,64 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5093
5493
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
5094
5494
|
query_base_: query_base_,
|
|
5095
5495
|
depict_api_: depict_api_,
|
|
5096
|
-
is_loading_: is_loading_
|
|
5496
|
+
is_loading_: is_loading_,
|
|
5497
|
+
content_blocks_: content_blocks_,
|
|
5498
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
5097
5499
|
});
|
|
5098
5500
|
$8tj43$onCleanup(() => suspense_contents = undefined);
|
|
5099
5501
|
return suspense_contents;
|
|
5100
5502
|
})();
|
|
5101
5503
|
}
|
|
5102
5504
|
});
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5505
|
+
/* This Show is so that we show placeholders while query_base is loading and because it's cumbersome to ensure that everything that directly accesses the plp_results_ resource is within the <Suspense> boundary */
|
|
5506
|
+
const listing_contents = $8tj43$createComponent((0, $8tj43$Show), {
|
|
5507
|
+
get when() {
|
|
5508
|
+
return !is_loading_();
|
|
5106
5509
|
},
|
|
5107
|
-
get
|
|
5108
|
-
return
|
|
5510
|
+
get fallback() {
|
|
5511
|
+
return rendered_placeholders();
|
|
5109
5512
|
},
|
|
5110
|
-
|
|
5111
|
-
|
|
5513
|
+
children: product_cards_when_data
|
|
5514
|
+
});
|
|
5515
|
+
return [$8tj43$memo((0, $ca55612a53dbbdd2$export$a2cc176055f8f08)), $8tj43$createComponent((0, $8tj43$Show), {
|
|
5516
|
+
get when() {
|
|
5517
|
+
return doesnt_have_content_blocks();
|
|
5112
5518
|
},
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5519
|
+
get fallback() {
|
|
5520
|
+
return $8tj43$createComponent((0, $64d94dcaa058dc7b$export$ab6b147eec64fea5), {
|
|
5521
|
+
get cols_at_size() {
|
|
5522
|
+
return modified_cols_at_size();
|
|
5523
|
+
},
|
|
5524
|
+
get override_vertical_spacing() {
|
|
5525
|
+
return layout_options_().override_vertical_spacing;
|
|
5526
|
+
},
|
|
5527
|
+
get grid_spacing() {
|
|
5528
|
+
return layout_options_().grid_spacing;
|
|
5529
|
+
},
|
|
5530
|
+
element_attributes: {
|
|
5531
|
+
class: "cards css-grid"
|
|
5532
|
+
},
|
|
5533
|
+
top_row_shortened_by_: top_row_shortened_by_,
|
|
5534
|
+
children: listing_contents
|
|
5535
|
+
});
|
|
5117
5536
|
},
|
|
5118
5537
|
get children() {
|
|
5119
|
-
return $8tj43$createComponent((0, $
|
|
5120
|
-
get
|
|
5121
|
-
return
|
|
5538
|
+
return $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
|
|
5539
|
+
get cols_at_size() {
|
|
5540
|
+
return modified_cols_at_size();
|
|
5541
|
+
},
|
|
5542
|
+
get override_vertical_spacing() {
|
|
5543
|
+
return layout_options_().override_vertical_spacing;
|
|
5122
5544
|
},
|
|
5123
|
-
get
|
|
5124
|
-
return
|
|
5545
|
+
get grid_spacing() {
|
|
5546
|
+
return layout_options_().grid_spacing;
|
|
5125
5547
|
},
|
|
5126
|
-
|
|
5548
|
+
rows: "all",
|
|
5549
|
+
layout: "grid",
|
|
5550
|
+
element_attributes: {
|
|
5551
|
+
class: "cards"
|
|
5552
|
+
},
|
|
5553
|
+
children: listing_contents
|
|
5127
5554
|
});
|
|
5128
5555
|
}
|
|
5129
5556
|
})];
|
|
@@ -5136,36 +5563,6 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5136
5563
|
return _el$;
|
|
5137
5564
|
})();
|
|
5138
5565
|
}
|
|
5139
|
-
/**
|
|
5140
|
-
* Changes cols_at_size depending on if filters are open or not so one card less is shown when the filters are open
|
|
5141
|
-
* This function is special to the actual PLPResults.
|
|
5142
|
-
*/
|
|
5143
|
-
function $7faea0096f14b59b$var$make_modified_cols_at_size(_ref3) {
|
|
5144
|
-
let {
|
|
5145
|
-
layout_options_: layout_options_,
|
|
5146
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
5147
|
-
} = _ref3;
|
|
5148
|
-
return $8tj43$createMemo(() => {
|
|
5149
|
-
const layout_options = layout_options_();
|
|
5150
|
-
// Add grid styling that changes when filters get opened/closed
|
|
5151
|
-
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
5152
|
-
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
5153
|
-
const [num_cols_default,,,, override_cols] = row;
|
|
5154
|
-
const cloned_row = [...row];
|
|
5155
|
-
// @ts-ignore
|
|
5156
|
-
cloned_row[0] = num_cols_default - 1;
|
|
5157
|
-
if (override_cols)
|
|
5158
|
-
// @ts-ignore
|
|
5159
|
-
cloned_row[4] = {
|
|
5160
|
-
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref4 => {
|
|
5161
|
-
let [row, column] = _ref4;
|
|
5162
|
-
return [row, column - 1];
|
|
5163
|
-
}))
|
|
5164
|
-
};
|
|
5165
|
-
return cloned_row;
|
|
5166
|
-
}) : when_filters_closed_cols;
|
|
5167
|
-
});
|
|
5168
|
-
}
|
|
5169
5566
|
const $cfdbd124dd09d713$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="sorting-attributes"></div>`, 2),
|
|
5170
5567
|
$cfdbd124dd09d713$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class="sorting-direction"></div>`, 2),
|
|
5171
5568
|
$cfdbd124dd09d713$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span><!#><!/></div></div>`, 9),
|
|
@@ -6810,7 +7207,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
6810
7207
|
product_card_template_: product_card_template_,
|
|
6811
7208
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6812
7209
|
sorting_query_param_: sorting_query_param_,
|
|
6813
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
7210
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
7211
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
6814
7212
|
} = _ref;
|
|
6815
7213
|
let results_for;
|
|
6816
7214
|
let only_show_filters_opener_;
|
|
@@ -7130,6 +7528,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
7130
7528
|
product_card_template_: product_card_template_,
|
|
7131
7529
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
7132
7530
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
7531
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
7133
7532
|
id_currently_querying_for_: query_id_,
|
|
7134
7533
|
no_results_options_: {
|
|
7135
7534
|
selected_filters_: selected_filters_,
|
|
@@ -7746,6 +8145,7 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
|
|
|
7746
8145
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7747
8146
|
selected_filters_: selected_filters_,
|
|
7748
8147
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
8148
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
7749
8149
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
7750
8150
|
layout_options_: $8tj43$createMemo(() => ({
|
|
7751
8151
|
cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -8002,37 +8402,6 @@ async function $96fd967c5b358ead$var$download_categories(tenant, market, type) {
|
|
|
8002
8402
|
return [];
|
|
8003
8403
|
}
|
|
8004
8404
|
}
|
|
8005
|
-
function $3ab4aa97880fb88d$export$3f37af283f8fb843(props) {
|
|
8006
|
-
const style = $8tj43$createMemo(() => {
|
|
8007
|
-
const {
|
|
8008
|
-
style: style,
|
|
8009
|
-
height: height,
|
|
8010
|
-
width: width,
|
|
8011
|
-
aspectRatio: aspectRatio
|
|
8012
|
-
} = props;
|
|
8013
|
-
const is_image = aspectRatio != undefined;
|
|
8014
|
-
const size_data = is_image ? {
|
|
8015
|
-
width: "100%",
|
|
8016
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
8017
|
-
} : {
|
|
8018
|
-
width: width,
|
|
8019
|
-
height: height
|
|
8020
|
-
};
|
|
8021
|
-
return {
|
|
8022
|
-
display: "block",
|
|
8023
|
-
...(style || {}),
|
|
8024
|
-
...size_data
|
|
8025
|
-
};
|
|
8026
|
-
});
|
|
8027
|
-
return $8tj43$createComponent((0, $bc2337c9a05ecd18$export$acb3eaade4b23afd), {
|
|
8028
|
-
get style() {
|
|
8029
|
-
return style();
|
|
8030
|
-
},
|
|
8031
|
-
get ["class"]() {
|
|
8032
|
-
return props.class;
|
|
8033
|
-
}
|
|
8034
|
-
});
|
|
8035
|
-
}
|
|
8036
8405
|
const $5eaa00b951637e96$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="title"></span></div></div></div>`, 10);
|
|
8037
8406
|
function $5eaa00b951637e96$export$ee1733d9a8495996() {
|
|
8038
8407
|
return (() => {
|
|
@@ -10586,7 +10955,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
10586
10955
|
router_: router_,
|
|
10587
10956
|
content_results_rows_: content_results_rows_,
|
|
10588
10957
|
content_layout_options_: content_layout_options_,
|
|
10589
|
-
content_search_enabled_: content_search_enabled_
|
|
10958
|
+
content_search_enabled_: content_search_enabled_,
|
|
10959
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
10590
10960
|
} = _ref;
|
|
10591
10961
|
const [get_sorting] = current_sorting_;
|
|
10592
10962
|
const all_products_loaded_ = $8tj43$createSignal(false);
|
|
@@ -10887,6 +11257,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
10887
11257
|
layout_options_: layout_options_,
|
|
10888
11258
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
10889
11259
|
id_currently_querying_for_: get_search_query_,
|
|
11260
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
10890
11261
|
no_results_options_: {
|
|
10891
11262
|
selected_filters_: selected_filters_,
|
|
10892
11263
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -11420,6 +11791,7 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
11420
11791
|
search_sorting_open_: state_.sorting_open,
|
|
11421
11792
|
expanded_filters_: state_.expanded_filters,
|
|
11422
11793
|
content_results_rows_: state_.content_results_rows,
|
|
11794
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
11423
11795
|
router_: shared_properties.router_,
|
|
11424
11796
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
11425
11797
|
return $dea31647b99a443b$export$d757d54550ebfb3d({
|